Use some variant of "ring core" instead of "GFp" as a prefix for everything.
"GFp_" isn't in the code at all anymore.
This commit is contained in:
parent
384f7d056b
commit
7886603cee
18
Cargo.toml
18
Cargo.toml
@ -13,7 +13,7 @@ repository = "https://github.com/briansmith/ring"
|
|||||||
version = "0.16.20"
|
version = "0.16.20"
|
||||||
|
|
||||||
# Prevent multiple versions of *ring* from being linked into the same program.
|
# Prevent multiple versions of *ring* from being linked into the same program.
|
||||||
links = "ring-asm"
|
links = "ring_core_dev"
|
||||||
|
|
||||||
include = [
|
include = [
|
||||||
"LICENSE",
|
"LICENSE",
|
||||||
@ -95,14 +95,14 @@ include = [
|
|||||||
"crypto/cipher_extra/asm/chacha20_poly1305_x86_64.pl",
|
"crypto/cipher_extra/asm/chacha20_poly1305_x86_64.pl",
|
||||||
"doc/link-to-readme.md",
|
"doc/link-to-readme.md",
|
||||||
"examples/checkdigest.rs",
|
"examples/checkdigest.rs",
|
||||||
"include/GFp/aes.h",
|
"include/ring-core/aes.h",
|
||||||
"include/GFp/arm_arch.h",
|
"include/ring-core/arm_arch.h",
|
||||||
"include/GFp/base.h",
|
"include/ring-core/base.h",
|
||||||
"include/GFp/check.h",
|
"include/ring-core/check.h",
|
||||||
"include/GFp/cpu.h",
|
"include/ring-core/cpu.h",
|
||||||
"include/GFp/mem.h",
|
"include/ring-core/mem.h",
|
||||||
"include/GFp/poly1305.h",
|
"include/ring-core/poly1305.h",
|
||||||
"include/GFp/type_check.h",
|
"include/ring-core/type_check.h",
|
||||||
"src/aead.rs",
|
"src/aead.rs",
|
||||||
"src/aead/aes.rs",
|
"src/aead/aes.rs",
|
||||||
"src/aead/aes_gcm.rs",
|
"src/aead/aes_gcm.rs",
|
||||||
|
20
build.rs
20
build.rs
@ -425,17 +425,19 @@ fn build_c_code(target: &Target, pregenerated: PathBuf, out_dir: &Path) {
|
|||||||
let test_srcs = RING_TEST_SRCS.iter().map(PathBuf::from).collect::<Vec<_>>();
|
let test_srcs = RING_TEST_SRCS.iter().map(PathBuf::from).collect::<Vec<_>>();
|
||||||
|
|
||||||
let libs = [
|
let libs = [
|
||||||
("ring-core", &core_srcs[..], &asm_srcs[..]),
|
("", &core_srcs[..], &asm_srcs[..]),
|
||||||
("ring-test", &test_srcs[..], &[]),
|
("test", &test_srcs[..], &[]),
|
||||||
];
|
];
|
||||||
|
|
||||||
// XXX: Ideally, ring-test would only be built for `cargo test`, but Cargo
|
// XXX: Ideally, ring-test would only be built for `cargo test`, but Cargo
|
||||||
// can't do that yet.
|
// can't do that yet.
|
||||||
libs.iter().for_each(|&(lib_name, srcs, additional_srcs)| {
|
libs.iter()
|
||||||
|
.for_each(|&(lib_name_suffix, srcs, additional_srcs)| {
|
||||||
|
let lib_name = String::from(BORINGSSL_PREFIX_VALUE) + lib_name_suffix;
|
||||||
build_library(
|
build_library(
|
||||||
&target,
|
&target,
|
||||||
&out_dir,
|
&out_dir,
|
||||||
lib_name,
|
&lib_name,
|
||||||
srcs,
|
srcs,
|
||||||
additional_srcs,
|
additional_srcs,
|
||||||
warnings_are_errors,
|
warnings_are_errors,
|
||||||
@ -524,9 +526,7 @@ fn obj_path(out_dir: &Path, src: &Path, obj_ext: &str) -> PathBuf {
|
|||||||
out_path
|
out_path
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is the prefix we've been using for most symbols since we started
|
const BORINGSSL_PREFIX_VALUE: &str = "ring_core_dev_";
|
||||||
// prefixing.
|
|
||||||
const BORINGSSL_PREFIX_VALUE: &str = "GFp_";
|
|
||||||
|
|
||||||
fn cc(
|
fn cc(
|
||||||
file: &Path,
|
file: &Path,
|
||||||
@ -595,7 +595,7 @@ fn cc(
|
|||||||
// TODO: Expand this to non-clang compilers in 0.17.0 if practical.
|
// TODO: Expand this to non-clang compilers in 0.17.0 if practical.
|
||||||
if compiler.is_like_clang() {
|
if compiler.is_like_clang() {
|
||||||
let _ = c.flag("-nostdlibinc");
|
let _ = c.flag("-nostdlibinc");
|
||||||
let _ = c.define("GFp_NOSTDLIBINC", "1");
|
let _ = c.define("RING_CORE_NOSTDLIBINC", "1");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -836,8 +836,8 @@ fn generate_prefix_symbols_header(
|
|||||||
writeln!(
|
writeln!(
|
||||||
file,
|
file,
|
||||||
r#"
|
r#"
|
||||||
{pp}ifndef GFp_generated_{filename_ident}
|
{pp}ifndef ring_core_generated_{filename_ident}
|
||||||
{pp}define GFp_generated_{filename_ident}
|
{pp}define ring_core_generated_{filename_ident}
|
||||||
"#,
|
"#,
|
||||||
pp = pp,
|
pp = pp,
|
||||||
filename_ident = filename_ident
|
filename_ident = filename_ident
|
||||||
|
@ -171,7 +171,7 @@ my @ret;
|
|||||||
}
|
}
|
||||||
|
|
||||||
$code.=<<___;
|
$code.=<<___;
|
||||||
#include <GFp/arm_arch.h>
|
#include <ring-core/arm_arch.h>
|
||||||
|
|
||||||
@ Silence ARMv8 deprecated IT instruction warnings. This file is used by both
|
@ Silence ARMv8 deprecated IT instruction warnings. This file is used by both
|
||||||
@ ARMv7 and ARMv8 processors and does not use ARMv8 instructions.
|
@ ARMv7 and ARMv8 processors and does not use ARMv8 instructions.
|
||||||
|
@ -120,7 +120,7 @@ my ($a3,$b3,$c3,$d3)=map(($_&~3)+(($_+1)&3),($a2,$b2,$c2,$d2));
|
|||||||
}
|
}
|
||||||
|
|
||||||
$code.=<<___;
|
$code.=<<___;
|
||||||
#include <GFp/arm_arch.h>
|
#include <ring-core/arm_arch.h>
|
||||||
|
|
||||||
.extern OPENSSL_armcap_P
|
.extern OPENSSL_armcap_P
|
||||||
.hidden OPENSSL_armcap_P
|
.hidden OPENSSL_armcap_P
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
* copied and put under another distribution licence
|
* copied and put under another distribution licence
|
||||||
* [including the GNU Public Licence.] */
|
* [including the GNU Public Licence.] */
|
||||||
|
|
||||||
#include <GFp/cpu.h>
|
#include <ring-core/cpu.h>
|
||||||
|
|
||||||
|
|
||||||
#if !defined(OPENSSL_NO_ASM) && (defined(OPENSSL_X86) || defined(OPENSSL_X86_64))
|
#if !defined(OPENSSL_NO_ASM) && (defined(OPENSSL_X86) || defined(OPENSSL_X86_64))
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
|
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
|
||||||
|
|
||||||
#include <GFp/cpu.h>
|
#include <ring-core/cpu.h>
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
|
||||||
// Our assembly does not use the GOT to reference symbols, which means
|
// Our assembly does not use the GOT to reference symbols, which means
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
//
|
//
|
||||||
// The field functions are shared by Ed25519 and X25519 where possible.
|
// The field functions are shared by Ed25519 and X25519 where possible.
|
||||||
|
|
||||||
#include <GFp/mem.h>
|
#include <ring-core/mem.h>
|
||||||
|
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
#include "../internal.h"
|
#include "../internal.h"
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
#ifndef OPENSSL_HEADER_CURVE25519_INTERNAL_H
|
#ifndef OPENSSL_HEADER_CURVE25519_INTERNAL_H
|
||||||
#define OPENSSL_HEADER_CURVE25519_INTERNAL_H
|
#define OPENSSL_HEADER_CURVE25519_INTERNAL_H
|
||||||
|
|
||||||
#include <GFp/base.h>
|
#include <ring-core/base.h>
|
||||||
|
|
||||||
#include "../internal.h"
|
#include "../internal.h"
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
|
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
|
||||||
|
|
||||||
#include <GFp/aes.h>
|
#include <ring-core/aes.h>
|
||||||
|
|
||||||
#include "../../internal.h"
|
#include "../../internal.h"
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ open OUT,"| \"$^X\" $xlate $flavour $output";
|
|||||||
$prefix="aes_hw";
|
$prefix="aes_hw";
|
||||||
|
|
||||||
$code=<<___;
|
$code=<<___;
|
||||||
#include <GFp/arm_arch.h>
|
#include <ring-core/arm_arch.h>
|
||||||
|
|
||||||
#if __ARM_MAX_ARCH__>=7
|
#if __ARM_MAX_ARCH__>=7
|
||||||
.text
|
.text
|
||||||
|
@ -707,7 +707,7 @@ ___
|
|||||||
|
|
||||||
$code.=<<___;
|
$code.=<<___;
|
||||||
#ifndef __KERNEL__
|
#ifndef __KERNEL__
|
||||||
# include <GFp/arm_arch.h>
|
# include <ring-core/arm_arch.h>
|
||||||
|
|
||||||
# define VFP_ABI_PUSH vstmdb sp!,{d8-d15}
|
# define VFP_ABI_PUSH vstmdb sp!,{d8-d15}
|
||||||
# define VFP_ABI_POP vldmia sp!,{d8-d15}
|
# define VFP_ABI_POP vldmia sp!,{d8-d15}
|
||||||
|
@ -49,7 +49,7 @@ open OUT,"| \"$^X\" $xlate $flavour $output";
|
|||||||
*STDOUT=*OUT;
|
*STDOUT=*OUT;
|
||||||
|
|
||||||
$code.=<<___;
|
$code.=<<___;
|
||||||
#include <GFp/arm_arch.h>
|
#include <ring-core/arm_arch.h>
|
||||||
|
|
||||||
.section .rodata
|
.section .rodata
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ $_n0="$num,#14*4";
|
|||||||
$_num="$num,#15*4"; $_bpend=$_num;
|
$_num="$num,#15*4"; $_bpend=$_num;
|
||||||
|
|
||||||
$code=<<___;
|
$code=<<___;
|
||||||
#include <GFp/arm_arch.h>
|
#include <ring-core/arm_arch.h>
|
||||||
|
|
||||||
@ Silence ARMv8 deprecated IT instruction warnings. This file is used by both
|
@ Silence ARMv8 deprecated IT instruction warnings. This file is used by both
|
||||||
@ ARMv7 and ARMv8 processors and does not use ARMv8 instructions.
|
@ ARMv7 and ARMv8 processors and does not use ARMv8 instructions.
|
||||||
|
@ -64,7 +64,7 @@ $n0="x4"; # const BN_ULONG *n0,
|
|||||||
$num="x5"; # size_t num);
|
$num="x5"; # size_t num);
|
||||||
|
|
||||||
$code.=<<___;
|
$code.=<<___;
|
||||||
#include <GFp/arm_arch.h>
|
#include <ring-core/arm_arch.h>
|
||||||
|
|
||||||
.text
|
.text
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@
|
|||||||
#ifndef OPENSSL_HEADER_BN_INTERNAL_H
|
#ifndef OPENSSL_HEADER_BN_INTERNAL_H
|
||||||
#define OPENSSL_HEADER_BN_INTERNAL_H
|
#define OPENSSL_HEADER_BN_INTERNAL_H
|
||||||
|
|
||||||
#include <GFp/base.h>
|
#include <ring-core/base.h>
|
||||||
|
|
||||||
#if defined(OPENSSL_X86_64) && defined(_MSC_VER) && !defined(__clang__)
|
#if defined(OPENSSL_X86_64) && defined(_MSC_VER) && !defined(__clang__)
|
||||||
#pragma warning(push, 3)
|
#pragma warning(push, 3)
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
#ifndef OPENSSL_HEADER_EC_ECP_NISTZ_H
|
#ifndef OPENSSL_HEADER_EC_ECP_NISTZ_H
|
||||||
#define OPENSSL_HEADER_EC_ECP_NISTZ_H
|
#define OPENSSL_HEADER_EC_ECP_NISTZ_H
|
||||||
|
|
||||||
#include <GFp/base.h>
|
#include <ring-core/base.h>
|
||||||
|
|
||||||
#include "../../limbs/limbs.h"
|
#include "../../limbs/limbs.h"
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
* 256 Bit Primes"
|
* 256 Bit Primes"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <GFp/base.h>
|
#include <ring-core/base.h>
|
||||||
|
|
||||||
#include "../../limbs/limbs.inl"
|
#include "../../limbs/limbs.inl"
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#ifndef OPENSSL_HEADER_EC_P256_X86_64_H
|
#ifndef OPENSSL_HEADER_EC_P256_X86_64_H
|
||||||
#define OPENSSL_HEADER_EC_P256_X86_64_H
|
#define OPENSSL_HEADER_EC_P256_X86_64_H
|
||||||
|
|
||||||
#include <GFp/base.h>
|
#include <ring-core/base.h>
|
||||||
|
|
||||||
#include "p256_shared.h"
|
#include "p256_shared.h"
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
// 256-bit Montgomery form for 64 and 32-bit. Field operations are generated by
|
// 256-bit Montgomery form for 64 and 32-bit. Field operations are generated by
|
||||||
// Fiat, which lives in //third_party/fiat.
|
// Fiat, which lives in //third_party/fiat.
|
||||||
|
|
||||||
#include <GFp/base.h>
|
#include <ring-core/base.h>
|
||||||
|
|
||||||
#include "../../limbs/limbs.h"
|
#include "../../limbs/limbs.h"
|
||||||
#include "../../limbs/limbs.inl"
|
#include "../../limbs/limbs.inl"
|
||||||
@ -384,7 +384,7 @@ void p256_point_mul(P256_POINT *r, const Limb scalar[P256_LIMBS],
|
|||||||
|
|
||||||
// select the point to add or subtract, in constant time.
|
// select the point to add or subtract, in constant time.
|
||||||
fiat_p256_select_point(digit, 17,
|
fiat_p256_select_point(digit, 17,
|
||||||
GFp_POINTLESS_ARRAY_CONST_CAST((const fiat_p256_felem(*)[3]))p_pre_comp,
|
RING_CORE_POINTLESS_ARRAY_CONST_CAST((const fiat_p256_felem(*)[3]))p_pre_comp,
|
||||||
tmp);
|
tmp);
|
||||||
fiat_p256_opp(ftmp, tmp[1]); // (X, -Y, Z) is the negative point.
|
fiat_p256_opp(ftmp, tmp[1]); // (X, -Y, Z) is the negative point.
|
||||||
fiat_p256_cmovznz(tmp[1], sign, tmp[1], ftmp);
|
fiat_p256_cmovznz(tmp[1], sign, tmp[1], ftmp);
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#ifndef OPENSSL_HEADER_EC_P256_SHARED_H
|
#ifndef OPENSSL_HEADER_EC_P256_SHARED_H
|
||||||
#define OPENSSL_HEADER_EC_P256_SHARED_H
|
#define OPENSSL_HEADER_EC_P256_SHARED_H
|
||||||
|
|
||||||
#include "GFp/base.h"
|
#include "ring-core/base.h"
|
||||||
|
|
||||||
#include "../bn/internal.h"
|
#include "../bn/internal.h"
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
|
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
|
||||||
|
|
||||||
#include <GFp/base.h>
|
#include <ring-core/base.h>
|
||||||
|
|
||||||
#include "../../internal.h"
|
#include "../../internal.h"
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ $inp="r2";
|
|||||||
$len="r3";
|
$len="r3";
|
||||||
|
|
||||||
$code=<<___;
|
$code=<<___;
|
||||||
#include <GFp/arm_arch.h>
|
#include <ring-core/arm_arch.h>
|
||||||
|
|
||||||
@ Silence ARMv8 deprecated IT instruction warnings. This file is used by both
|
@ Silence ARMv8 deprecated IT instruction warnings. This file is used by both
|
||||||
@ ARMv7 and ARMv8 processors and does not use ARMv8 instructions. (ARMv8 PMULL
|
@ ARMv7 and ARMv8 processors and does not use ARMv8 instructions. (ARMv8 PMULL
|
||||||
|
@ -157,7 +157,7 @@ ___
|
|||||||
}
|
}
|
||||||
|
|
||||||
$code .= <<___;
|
$code .= <<___;
|
||||||
#include <GFp/arm_arch.h>
|
#include <ring-core/arm_arch.h>
|
||||||
|
|
||||||
.text
|
.text
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ my ($Xl,$Xm,$Xh,$IN)=map("q$_",(0..3));
|
|||||||
my ($t0,$t1,$t2,$xC2,$H,$Hhl,$H2)=map("q$_",(8..14));
|
my ($t0,$t1,$t2,$xC2,$H,$Hhl,$H2)=map("q$_",(8..14));
|
||||||
|
|
||||||
$code=<<___;
|
$code=<<___;
|
||||||
#include <GFp/arm_arch.h>
|
#include <ring-core/arm_arch.h>
|
||||||
|
|
||||||
.text
|
.text
|
||||||
___
|
___
|
||||||
|
@ -177,7 +177,7 @@ ___
|
|||||||
|
|
||||||
$code=<<___;
|
$code=<<___;
|
||||||
#ifndef __KERNEL__
|
#ifndef __KERNEL__
|
||||||
# include <GFp/arm_arch.h>
|
# include <ring-core/arm_arch.h>
|
||||||
#else
|
#else
|
||||||
# define __ARM_ARCH__ __LINUX_ARM_ARCH__
|
# define __ARM_ARCH__ __LINUX_ARM_ARCH__
|
||||||
# define __ARM_MAX_ARCH__ 7
|
# define __ARM_MAX_ARCH__ 7
|
||||||
|
@ -200,7 +200,7 @@ ___
|
|||||||
}
|
}
|
||||||
$code=<<___;
|
$code=<<___;
|
||||||
#ifndef __KERNEL__
|
#ifndef __KERNEL__
|
||||||
# include <GFp/arm_arch.h>
|
# include <ring-core/arm_arch.h>
|
||||||
# define VFP_ABI_PUSH vstmdb sp!,{d8-d15}
|
# define VFP_ABI_PUSH vstmdb sp!,{d8-d15}
|
||||||
# define VFP_ABI_POP vldmia sp!,{d8-d15}
|
# define VFP_ABI_POP vldmia sp!,{d8-d15}
|
||||||
#else
|
#else
|
||||||
|
@ -173,7 +173,7 @@ ___
|
|||||||
|
|
||||||
$code.=<<___;
|
$code.=<<___;
|
||||||
#ifndef __KERNEL__
|
#ifndef __KERNEL__
|
||||||
# include <GFp/arm_arch.h>
|
# include <ring-core/arm_arch.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
.text
|
.text
|
||||||
|
@ -109,9 +109,9 @@
|
|||||||
#ifndef OPENSSL_HEADER_CRYPTO_INTERNAL_H
|
#ifndef OPENSSL_HEADER_CRYPTO_INTERNAL_H
|
||||||
#define OPENSSL_HEADER_CRYPTO_INTERNAL_H
|
#define OPENSSL_HEADER_CRYPTO_INTERNAL_H
|
||||||
|
|
||||||
#include <GFp/base.h> // Must be first.
|
#include <ring-core/base.h> // Must be first.
|
||||||
|
|
||||||
#include "GFp/check.h"
|
#include "ring-core/check.h"
|
||||||
|
|
||||||
#if defined(__GNUC__) && \
|
#if defined(__GNUC__) && \
|
||||||
(__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40800
|
(__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40800
|
||||||
@ -129,9 +129,9 @@
|
|||||||
// reason explained in
|
// reason explained in
|
||||||
// https://gustedt.wordpress.com/2011/02/12/const-and-arrays/
|
// https://gustedt.wordpress.com/2011/02/12/const-and-arrays/
|
||||||
#if defined(__clang__) || defined(_MSC_VER)
|
#if defined(__clang__) || defined(_MSC_VER)
|
||||||
#define GFp_POINTLESS_ARRAY_CONST_CAST(cast)
|
#define RING_CORE_POINTLESS_ARRAY_CONST_CAST(cast)
|
||||||
#else
|
#else
|
||||||
#define GFp_POINTLESS_ARRAY_CONST_CAST(cast) cast
|
#define RING_CORE_POINTLESS_ARRAY_CONST_CAST(cast) cast
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (!defined(_MSC_VER) || defined(__clang__)) && defined(OPENSSL_64_BIT)
|
#if (!defined(_MSC_VER) || defined(__clang__)) && defined(OPENSSL_64_BIT)
|
||||||
@ -268,12 +268,12 @@ static inline uint32_t CRYPTO_bswap4(uint32_t x) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(GFp_NOSTDLIBINC)
|
#if !defined(RING_CORE_NOSTDLIBINC)
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static inline void *OPENSSL_memcpy(void *dst, const void *src, size_t n) {
|
static inline void *OPENSSL_memcpy(void *dst, const void *src, size_t n) {
|
||||||
#if !defined(GFp_NOSTDLIBINC)
|
#if !defined(RING_CORE_NOSTDLIBINC)
|
||||||
if (n == 0) {
|
if (n == 0) {
|
||||||
return dst;
|
return dst;
|
||||||
}
|
}
|
||||||
@ -289,7 +289,7 @@ static inline void *OPENSSL_memcpy(void *dst, const void *src, size_t n) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline void *OPENSSL_memset(void *dst, int c, size_t n) {
|
static inline void *OPENSSL_memset(void *dst, int c, size_t n) {
|
||||||
#if !defined(GFp_NOSTDLIBINC)
|
#if !defined(RING_CORE_NOSTDLIBINC)
|
||||||
if (n == 0) {
|
if (n == 0) {
|
||||||
return dst;
|
return dst;
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
#ifndef RING_LIMBS_H
|
#ifndef RING_LIMBS_H
|
||||||
#define RING_LIMBS_H
|
#define RING_LIMBS_H
|
||||||
|
|
||||||
#include <GFp/base.h>
|
#include <ring-core/base.h>
|
||||||
|
|
||||||
#include "../internal.h"
|
#include "../internal.h"
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
|
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
|
||||||
|
|
||||||
#include "limbs.h"
|
#include "limbs.h"
|
||||||
#include "GFp/check.h"
|
#include "ring-core/check.h"
|
||||||
|
|
||||||
#if defined(_MSC_VER) && !defined(__clang__)
|
#if defined(_MSC_VER) && !defined(__clang__)
|
||||||
#pragma warning(push, 3)
|
#pragma warning(push, 3)
|
||||||
@ -36,12 +36,12 @@
|
|||||||
typedef uint8_t Carry;
|
typedef uint8_t Carry;
|
||||||
#if LIMB_BITS == 64
|
#if LIMB_BITS == 64
|
||||||
#pragma intrinsic(_addcarry_u64, _subborrow_u64)
|
#pragma intrinsic(_addcarry_u64, _subborrow_u64)
|
||||||
#define GFp_ADDCARRY_INTRINSIC _addcarry_u64
|
#define RING_CORE_ADDCARRY_INTRINSIC _addcarry_u64
|
||||||
#define GFp_SUBBORROW_INTRINSIC _subborrow_u64
|
#define RING_CORE_SUBBORROW_INTRINSIC _subborrow_u64
|
||||||
#elif LIMB_BITS == 32
|
#elif LIMB_BITS == 32
|
||||||
#pragma intrinsic(_addcarry_u32, _subborrow_u32)
|
#pragma intrinsic(_addcarry_u32, _subborrow_u32)
|
||||||
#define GFp_ADDCARRY_INTRINSIC _addcarry_u32
|
#define RING_CORE_ADDCARRY_INTRINSIC _addcarry_u32
|
||||||
#define GFp_SUBBORROW_INTRINSIC _subborrow_u32
|
#define RING_CORE_SUBBORROW_INTRINSIC _subborrow_u32
|
||||||
typedef uint64_t DoubleLimb;
|
typedef uint64_t DoubleLimb;
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
@ -58,8 +58,8 @@ typedef uint64_t DoubleLimb;
|
|||||||
static inline Carry limb_adc(Limb *r, Limb a, Limb b, Carry carry_in) {
|
static inline Carry limb_adc(Limb *r, Limb a, Limb b, Carry carry_in) {
|
||||||
dev_assert_secret(carry_in == 0 || carry_in == 1);
|
dev_assert_secret(carry_in == 0 || carry_in == 1);
|
||||||
Carry ret;
|
Carry ret;
|
||||||
#if defined(GFp_ADDCARRY_INTRINSIC)
|
#if defined(RING_CORE_ADDCARRY_INTRINSIC)
|
||||||
ret = GFp_ADDCARRY_INTRINSIC(carry_in, a, b, r);
|
ret = RING_CORE_ADDCARRY_INTRINSIC(carry_in, a, b, r);
|
||||||
#else
|
#else
|
||||||
DoubleLimb x = (DoubleLimb)a + b + carry_in;
|
DoubleLimb x = (DoubleLimb)a + b + carry_in;
|
||||||
*r = (Limb)x;
|
*r = (Limb)x;
|
||||||
@ -72,8 +72,8 @@ static inline Carry limb_adc(Limb *r, Limb a, Limb b, Carry carry_in) {
|
|||||||
/* |*r = a + b|, returning carry bit. */
|
/* |*r = a + b|, returning carry bit. */
|
||||||
static inline Carry limb_add(Limb *r, Limb a, Limb b) {
|
static inline Carry limb_add(Limb *r, Limb a, Limb b) {
|
||||||
Carry ret;
|
Carry ret;
|
||||||
#if defined(GFp_ADDCARRY_INTRINSIC)
|
#if defined(RING_CORE_ADDCARRY_INTRINSIC)
|
||||||
ret = GFp_ADDCARRY_INTRINSIC(0, a, b, r);
|
ret = RING_CORE_ADDCARRY_INTRINSIC(0, a, b, r);
|
||||||
#else
|
#else
|
||||||
DoubleLimb x = (DoubleLimb)a + b;
|
DoubleLimb x = (DoubleLimb)a + b;
|
||||||
*r = (Limb)x;
|
*r = (Limb)x;
|
||||||
@ -88,8 +88,8 @@ static inline Carry limb_add(Limb *r, Limb a, Limb b) {
|
|||||||
static inline Carry limb_sbb(Limb *r, Limb a, Limb b, Carry borrow_in) {
|
static inline Carry limb_sbb(Limb *r, Limb a, Limb b, Carry borrow_in) {
|
||||||
dev_assert_secret(borrow_in == 0 || borrow_in == 1);
|
dev_assert_secret(borrow_in == 0 || borrow_in == 1);
|
||||||
Carry ret;
|
Carry ret;
|
||||||
#if defined(GFp_SUBBORROW_INTRINSIC)
|
#if defined(RING_CORE_SUBBORROW_INTRINSIC)
|
||||||
ret = GFp_SUBBORROW_INTRINSIC(borrow_in, a, b, r);
|
ret = RING_CORE_SUBBORROW_INTRINSIC(borrow_in, a, b, r);
|
||||||
#else
|
#else
|
||||||
DoubleLimb x = (DoubleLimb)a - b - borrow_in;
|
DoubleLimb x = (DoubleLimb)a - b - borrow_in;
|
||||||
*r = (Limb)x;
|
*r = (Limb)x;
|
||||||
@ -102,8 +102,8 @@ static inline Carry limb_sbb(Limb *r, Limb a, Limb b, Carry borrow_in) {
|
|||||||
/* |*r = a - b|, returning borrow bit. */
|
/* |*r = a - b|, returning borrow bit. */
|
||||||
static inline Carry limb_sub(Limb *r, Limb a, Limb b) {
|
static inline Carry limb_sub(Limb *r, Limb a, Limb b) {
|
||||||
Carry ret;
|
Carry ret;
|
||||||
#if defined(GFp_SUBBORROW_INTRINSIC)
|
#if defined(RING_CORE_SUBBORROW_INTRINSIC)
|
||||||
ret = GFp_SUBBORROW_INTRINSIC(0, a, b, r);
|
ret = RING_CORE_SUBBORROW_INTRINSIC(0, a, b, r);
|
||||||
#else
|
#else
|
||||||
DoubleLimb x = (DoubleLimb)a - b;
|
DoubleLimb x = (DoubleLimb)a - b;
|
||||||
*r = (Limb)x;
|
*r = (Limb)x;
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
* copied and put under another distribution licence
|
* copied and put under another distribution licence
|
||||||
* [including the GNU Public Licence.] */
|
* [including the GNU Public Licence.] */
|
||||||
|
|
||||||
#include <GFp/mem.h>
|
#include <ring-core/mem.h>
|
||||||
|
|
||||||
int OPENSSL_memcmp(const uint8_t *a, const uint8_t *b, size_t len) {
|
int OPENSSL_memcmp(const uint8_t *a, const uint8_t *b, size_t len) {
|
||||||
uint8_t x = 0;
|
uint8_t x = 0;
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
#ifndef OPENSSL_HEADER_POLY1305_INTERNAL_H
|
#ifndef OPENSSL_HEADER_POLY1305_INTERNAL_H
|
||||||
#define OPENSSL_HEADER_POLY1305_INTERNAL_H
|
#define OPENSSL_HEADER_POLY1305_INTERNAL_H
|
||||||
|
|
||||||
#include <GFp/base.h>
|
#include <ring-core/base.h>
|
||||||
#include <GFp/poly1305.h>
|
#include <ring-core/poly1305.h>
|
||||||
|
|
||||||
#if defined(OPENSSL_ARM) && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_APPLE)
|
#if defined(OPENSSL_ARM) && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_APPLE)
|
||||||
#define OPENSSL_POLY1305_NEON
|
#define OPENSSL_POLY1305_NEON
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
// (https://github.com/floodyberry/poly1305-donna) and released as public
|
// (https://github.com/floodyberry/poly1305-donna) and released as public
|
||||||
// domain.
|
// domain.
|
||||||
|
|
||||||
#include <GFp/poly1305.h>
|
#include <ring-core/poly1305.h>
|
||||||
|
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
#include "../internal.h"
|
#include "../internal.h"
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
// This implementation was taken from the public domain, neon2 version in
|
// This implementation was taken from the public domain, neon2 version in
|
||||||
// SUPERCOP by D. J. Bernstein and Peter Schwabe.
|
// SUPERCOP by D. J. Bernstein and Peter Schwabe.
|
||||||
|
|
||||||
#include <GFp/poly1305.h>
|
#include <ring-core/poly1305.h>
|
||||||
|
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
#include "../internal.h"
|
#include "../internal.h"
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
// http://cr.yp.to/papers.html#neoncrypto. Unrolled to 2 powers, i.e. 64 byte
|
// http://cr.yp.to/papers.html#neoncrypto. Unrolled to 2 powers, i.e. 64 byte
|
||||||
// block size
|
// block size
|
||||||
|
|
||||||
#include <GFp/poly1305.h>
|
#include <ring-core/poly1305.h>
|
||||||
|
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
#include "../internal.h"
|
#include "../internal.h"
|
||||||
|
@ -49,7 +49,7 @@
|
|||||||
#ifndef OPENSSL_HEADER_AES_H
|
#ifndef OPENSSL_HEADER_AES_H
|
||||||
#define OPENSSL_HEADER_AES_H
|
#define OPENSSL_HEADER_AES_H
|
||||||
|
|
||||||
#include <GFp/base.h>
|
#include <ring-core/base.h>
|
||||||
|
|
||||||
// Raw AES functions.
|
// Raw AES functions.
|
||||||
|
|
@ -58,7 +58,7 @@
|
|||||||
|
|
||||||
#include <ring_core_generated/prefix_symbols.h>
|
#include <ring_core_generated/prefix_symbols.h>
|
||||||
|
|
||||||
#include <GFp/type_check.h>
|
#include <ring-core/type_check.h>
|
||||||
|
|
||||||
#if defined(_MSC_VER) && !defined(__clang__)
|
#if defined(_MSC_VER) && !defined(__clang__)
|
||||||
#pragma warning(push, 3)
|
#pragma warning(push, 3)
|
@ -23,7 +23,7 @@
|
|||||||
// When reviewing uses of |debug_assert_nonsecret|, verify that the check
|
// When reviewing uses of |debug_assert_nonsecret|, verify that the check
|
||||||
// really does not have potential to leak a secret.
|
// really does not have potential to leak a secret.
|
||||||
|
|
||||||
#if !defined(GFp_NOSTDLIBINC)
|
#if !defined(RING_CORE_NOSTDLIBINC)
|
||||||
# include <assert.h>
|
# include <assert.h>
|
||||||
# define debug_assert_nonsecret(x) assert(x)
|
# define debug_assert_nonsecret(x) assert(x)
|
||||||
#else
|
#else
|
@ -61,7 +61,7 @@
|
|||||||
#ifndef OPENSSL_HEADER_CPU_H
|
#ifndef OPENSSL_HEADER_CPU_H
|
||||||
#define OPENSSL_HEADER_CPU_H
|
#define OPENSSL_HEADER_CPU_H
|
||||||
|
|
||||||
#include <GFp/base.h>
|
#include <ring-core/base.h>
|
||||||
|
|
||||||
// Runtime CPU feature support
|
// Runtime CPU feature support
|
||||||
|
|
@ -57,7 +57,7 @@
|
|||||||
#ifndef OPENSSL_HEADER_MEM_H
|
#ifndef OPENSSL_HEADER_MEM_H
|
||||||
#define OPENSSL_HEADER_MEM_H
|
#define OPENSSL_HEADER_MEM_H
|
||||||
|
|
||||||
#include <GFp/base.h>
|
#include <ring-core/base.h>
|
||||||
|
|
||||||
// OPENSSL_memcmp returns zero iff the |len| bytes at |a| and |b| are equal. It
|
// OPENSSL_memcmp returns zero iff the |len| bytes at |a| and |b| are equal. It
|
||||||
// takes an amount of time dependent on |len|, but independent of the contents
|
// takes an amount of time dependent on |len|, but independent of the contents
|
@ -15,7 +15,7 @@
|
|||||||
#ifndef OPENSSL_HEADER_POLY1305_H
|
#ifndef OPENSSL_HEADER_POLY1305_H
|
||||||
#define OPENSSL_HEADER_POLY1305_H
|
#define OPENSSL_HEADER_POLY1305_H
|
||||||
|
|
||||||
#include <GFp/base.h>
|
#include <ring-core/base.h>
|
||||||
|
|
||||||
// Keep in sync with `poly1305_state` in poly1305.rs.
|
// Keep in sync with `poly1305_state` in poly1305.rs.
|
||||||
typedef uint8_t poly1305_state[512];
|
typedef uint8_t poly1305_state[512];
|
0
include/ring-core/prefix_symbols.h
Normal file
0
include/ring-core/prefix_symbols.h
Normal file
@ -57,7 +57,7 @@
|
|||||||
#ifndef OPENSSL_HEADER_TYPE_CHECK_H
|
#ifndef OPENSSL_HEADER_TYPE_CHECK_H
|
||||||
#define OPENSSL_HEADER_TYPE_CHECK_H
|
#define OPENSSL_HEADER_TYPE_CHECK_H
|
||||||
|
|
||||||
#include <GFp/base.h>
|
#include <ring-core/base.h>
|
||||||
|
|
||||||
|
|
||||||
#if defined(__cplusplus) || (defined(_MSC_VER) && !defined(__clang__))
|
#if defined(__cplusplus) || (defined(_MSC_VER) && !defined(__clang__))
|
@ -43,7 +43,7 @@ pub struct Context {
|
|||||||
cpu_features: cpu::Features,
|
cpu_features: cpu::Features,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Keep in sync with `poly1305_state` in GFp/poly1305.h.
|
// Keep in sync with `poly1305_state` in ring-core/poly1305.h.
|
||||||
//
|
//
|
||||||
// The C code, in particular the way the `poly1305_aligned_state` functions
|
// The C code, in particular the way the `poly1305_aligned_state` functions
|
||||||
// are used, is only correct when the state buffer is 64-byte aligned.
|
// are used, is only correct when the state buffer is 64-byte aligned.
|
||||||
|
@ -68,7 +68,7 @@ macro_rules! prefixed_item {
|
|||||||
} => {
|
} => {
|
||||||
prefixed_item! {
|
prefixed_item! {
|
||||||
$attr
|
$attr
|
||||||
{ concat!("GFp_", stringify!($name)) }
|
{ concat!("ring_core_dev_", stringify!($name)) }
|
||||||
{ $( $item )+ }
|
{ $( $item )+ }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user