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:
Brian Smith 2021-05-02 14:42:05 -07:00
parent 384f7d056b
commit 7886603cee
46 changed files with 89 additions and 89 deletions

View File

@ -13,7 +13,7 @@ repository = "https://github.com/briansmith/ring"
version = "0.16.20"
# Prevent multiple versions of *ring* from being linked into the same program.
links = "ring-asm"
links = "ring_core_dev"
include = [
"LICENSE",
@ -95,14 +95,14 @@ include = [
"crypto/cipher_extra/asm/chacha20_poly1305_x86_64.pl",
"doc/link-to-readme.md",
"examples/checkdigest.rs",
"include/GFp/aes.h",
"include/GFp/arm_arch.h",
"include/GFp/base.h",
"include/GFp/check.h",
"include/GFp/cpu.h",
"include/GFp/mem.h",
"include/GFp/poly1305.h",
"include/GFp/type_check.h",
"include/ring-core/aes.h",
"include/ring-core/arm_arch.h",
"include/ring-core/base.h",
"include/ring-core/check.h",
"include/ring-core/cpu.h",
"include/ring-core/mem.h",
"include/ring-core/poly1305.h",
"include/ring-core/type_check.h",
"src/aead.rs",
"src/aead/aes.rs",
"src/aead/aes_gcm.rs",

View File

@ -425,22 +425,24 @@ fn build_c_code(target: &Target, pregenerated: PathBuf, out_dir: &Path) {
let test_srcs = RING_TEST_SRCS.iter().map(PathBuf::from).collect::<Vec<_>>();
let libs = [
("ring-core", &core_srcs[..], &asm_srcs[..]),
("ring-test", &test_srcs[..], &[]),
("", &core_srcs[..], &asm_srcs[..]),
("test", &test_srcs[..], &[]),
];
// XXX: Ideally, ring-test would only be built for `cargo test`, but Cargo
// can't do that yet.
libs.iter().for_each(|&(lib_name, srcs, additional_srcs)| {
build_library(
&target,
&out_dir,
lib_name,
srcs,
additional_srcs,
warnings_are_errors,
)
});
libs.iter()
.for_each(|&(lib_name_suffix, srcs, additional_srcs)| {
let lib_name = String::from(BORINGSSL_PREFIX_VALUE) + lib_name_suffix;
build_library(
&target,
&out_dir,
&lib_name,
srcs,
additional_srcs,
warnings_are_errors,
)
});
println!(
"cargo:rustc-link-search=native={}",
@ -524,9 +526,7 @@ fn obj_path(out_dir: &Path, src: &Path, obj_ext: &str) -> PathBuf {
out_path
}
// This is the prefix we've been using for most symbols since we started
// prefixing.
const BORINGSSL_PREFIX_VALUE: &str = "GFp_";
const BORINGSSL_PREFIX_VALUE: &str = "ring_core_dev_";
fn cc(
file: &Path,
@ -595,7 +595,7 @@ fn cc(
// TODO: Expand this to non-clang compilers in 0.17.0 if practical.
if compiler.is_like_clang() {
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!(
file,
r#"
{pp}ifndef GFp_generated_{filename_ident}
{pp}define GFp_generated_{filename_ident}
{pp}ifndef ring_core_generated_{filename_ident}
{pp}define ring_core_generated_{filename_ident}
"#,
pp = pp,
filename_ident = filename_ident

View File

@ -171,7 +171,7 @@ my @ret;
}
$code.=<<___;
#include <GFp/arm_arch.h>
#include <ring-core/arm_arch.h>
@ Silence ARMv8 deprecated IT instruction warnings. This file is used by both
@ ARMv7 and ARMv8 processors and does not use ARMv8 instructions.

View File

@ -120,7 +120,7 @@ my ($a3,$b3,$c3,$d3)=map(($_&~3)+(($_+1)&3),($a2,$b2,$c2,$d2));
}
$code.=<<___;
#include <GFp/arm_arch.h>
#include <ring-core/arm_arch.h>
.extern OPENSSL_armcap_P
.hidden OPENSSL_armcap_P

View File

@ -54,7 +54,7 @@
* copied and put under another distribution 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))

View File

@ -12,7 +12,7 @@
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
#include <GFp/cpu.h>
#include <ring-core/cpu.h>
#include "internal.h"
// Our assembly does not use the GOT to reference symbols, which means

View File

@ -19,7 +19,7 @@
//
// 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"

View File

@ -15,7 +15,7 @@
#ifndef OPENSSL_HEADER_CURVE25519_INTERNAL_H
#define OPENSSL_HEADER_CURVE25519_INTERNAL_H
#include <GFp/base.h>
#include <ring-core/base.h>
#include "../internal.h"

View File

@ -12,7 +12,7 @@
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
#include <GFp/aes.h>
#include <ring-core/aes.h>
#include "../../internal.h"

View File

@ -53,7 +53,7 @@ open OUT,"| \"$^X\" $xlate $flavour $output";
$prefix="aes_hw";
$code=<<___;
#include <GFp/arm_arch.h>
#include <ring-core/arm_arch.h>
#if __ARM_MAX_ARCH__>=7
.text

View File

@ -707,7 +707,7 @@ ___
$code.=<<___;
#ifndef __KERNEL__
# include <GFp/arm_arch.h>
# include <ring-core/arm_arch.h>
# define VFP_ABI_PUSH vstmdb sp!,{d8-d15}
# define VFP_ABI_POP vldmia sp!,{d8-d15}

View File

@ -49,7 +49,7 @@ open OUT,"| \"$^X\" $xlate $flavour $output";
*STDOUT=*OUT;
$code.=<<___;
#include <GFp/arm_arch.h>
#include <ring-core/arm_arch.h>
.section .rodata

View File

@ -97,7 +97,7 @@ $_n0="$num,#14*4";
$_num="$num,#15*4"; $_bpend=$_num;
$code=<<___;
#include <GFp/arm_arch.h>
#include <ring-core/arm_arch.h>
@ Silence ARMv8 deprecated IT instruction warnings. This file is used by both
@ ARMv7 and ARMv8 processors and does not use ARMv8 instructions.

View File

@ -64,7 +64,7 @@ $n0="x4"; # const BN_ULONG *n0,
$num="x5"; # size_t num);
$code.=<<___;
#include <GFp/arm_arch.h>
#include <ring-core/arm_arch.h>
.text

View File

@ -123,7 +123,7 @@
#ifndef 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__)
#pragma warning(push, 3)

View File

@ -15,7 +15,7 @@
#ifndef 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"

View File

@ -16,7 +16,7 @@
* 256 Bit Primes"
*/
#include <GFp/base.h>
#include <ring-core/base.h>
#include "../../limbs/limbs.inl"

View File

@ -19,7 +19,7 @@
#ifndef 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"

View File

@ -16,7 +16,7 @@
// 256-bit Montgomery form for 64 and 32-bit. Field operations are generated by
// Fiat, which lives in //third_party/fiat.
#include <GFp/base.h>
#include <ring-core/base.h>
#include "../../limbs/limbs.h"
#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.
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);
fiat_p256_opp(ftmp, tmp[1]); // (X, -Y, Z) is the negative point.
fiat_p256_cmovznz(tmp[1], sign, tmp[1], ftmp);

View File

@ -19,7 +19,7 @@
#ifndef 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"

View File

@ -12,7 +12,7 @@
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
#include <GFp/base.h>
#include <ring-core/base.h>
#include "../../internal.h"

View File

@ -104,7 +104,7 @@ $inp="r2";
$len="r3";
$code=<<___;
#include <GFp/arm_arch.h>
#include <ring-core/arm_arch.h>
@ Silence ARMv8 deprecated IT instruction warnings. This file is used by both
@ ARMv7 and ARMv8 processors and does not use ARMv8 instructions. (ARMv8 PMULL

View File

@ -157,7 +157,7 @@ ___
}
$code .= <<___;
#include <GFp/arm_arch.h>
#include <ring-core/arm_arch.h>
.text

View File

@ -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));
$code=<<___;
#include <GFp/arm_arch.h>
#include <ring-core/arm_arch.h>
.text
___

View File

@ -177,7 +177,7 @@ ___
$code=<<___;
#ifndef __KERNEL__
# include <GFp/arm_arch.h>
# include <ring-core/arm_arch.h>
#else
# define __ARM_ARCH__ __LINUX_ARM_ARCH__
# define __ARM_MAX_ARCH__ 7

View File

@ -200,7 +200,7 @@ ___
}
$code=<<___;
#ifndef __KERNEL__
# include <GFp/arm_arch.h>
# include <ring-core/arm_arch.h>
# define VFP_ABI_PUSH vstmdb sp!,{d8-d15}
# define VFP_ABI_POP vldmia sp!,{d8-d15}
#else

View File

@ -173,7 +173,7 @@ ___
$code.=<<___;
#ifndef __KERNEL__
# include <GFp/arm_arch.h>
# include <ring-core/arm_arch.h>
#endif
.text

View File

@ -109,9 +109,9 @@
#ifndef 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__) && \
(__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40800
@ -129,9 +129,9 @@
// reason explained in
// https://gustedt.wordpress.com/2011/02/12/const-and-arrays/
#if defined(__clang__) || defined(_MSC_VER)
#define GFp_POINTLESS_ARRAY_CONST_CAST(cast)
#define RING_CORE_POINTLESS_ARRAY_CONST_CAST(cast)
#else
#define GFp_POINTLESS_ARRAY_CONST_CAST(cast) cast
#define RING_CORE_POINTLESS_ARRAY_CONST_CAST(cast) cast
#endif
#if (!defined(_MSC_VER) || defined(__clang__)) && defined(OPENSSL_64_BIT)
@ -268,12 +268,12 @@ static inline uint32_t CRYPTO_bswap4(uint32_t x) {
}
#endif
#if !defined(GFp_NOSTDLIBINC)
#if !defined(RING_CORE_NOSTDLIBINC)
#include <string.h>
#endif
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) {
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) {
#if !defined(GFp_NOSTDLIBINC)
#if !defined(RING_CORE_NOSTDLIBINC)
if (n == 0) {
return dst;
}

View File

@ -15,7 +15,7 @@
#ifndef RING_LIMBS_H
#define RING_LIMBS_H
#include <GFp/base.h>
#include <ring-core/base.h>
#include "../internal.h"

View File

@ -13,7 +13,7 @@
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
#include "limbs.h"
#include "GFp/check.h"
#include "ring-core/check.h"
#if defined(_MSC_VER) && !defined(__clang__)
#pragma warning(push, 3)
@ -36,12 +36,12 @@
typedef uint8_t Carry;
#if LIMB_BITS == 64
#pragma intrinsic(_addcarry_u64, _subborrow_u64)
#define GFp_ADDCARRY_INTRINSIC _addcarry_u64
#define GFp_SUBBORROW_INTRINSIC _subborrow_u64
#define RING_CORE_ADDCARRY_INTRINSIC _addcarry_u64
#define RING_CORE_SUBBORROW_INTRINSIC _subborrow_u64
#elif LIMB_BITS == 32
#pragma intrinsic(_addcarry_u32, _subborrow_u32)
#define GFp_ADDCARRY_INTRINSIC _addcarry_u32
#define GFp_SUBBORROW_INTRINSIC _subborrow_u32
#define RING_CORE_ADDCARRY_INTRINSIC _addcarry_u32
#define RING_CORE_SUBBORROW_INTRINSIC _subborrow_u32
typedef uint64_t DoubleLimb;
#endif
#else
@ -58,8 +58,8 @@ typedef uint64_t DoubleLimb;
static inline Carry limb_adc(Limb *r, Limb a, Limb b, Carry carry_in) {
dev_assert_secret(carry_in == 0 || carry_in == 1);
Carry ret;
#if defined(GFp_ADDCARRY_INTRINSIC)
ret = GFp_ADDCARRY_INTRINSIC(carry_in, a, b, r);
#if defined(RING_CORE_ADDCARRY_INTRINSIC)
ret = RING_CORE_ADDCARRY_INTRINSIC(carry_in, a, b, r);
#else
DoubleLimb x = (DoubleLimb)a + b + carry_in;
*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. */
static inline Carry limb_add(Limb *r, Limb a, Limb b) {
Carry ret;
#if defined(GFp_ADDCARRY_INTRINSIC)
ret = GFp_ADDCARRY_INTRINSIC(0, a, b, r);
#if defined(RING_CORE_ADDCARRY_INTRINSIC)
ret = RING_CORE_ADDCARRY_INTRINSIC(0, a, b, r);
#else
DoubleLimb x = (DoubleLimb)a + b;
*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) {
dev_assert_secret(borrow_in == 0 || borrow_in == 1);
Carry ret;
#if defined(GFp_SUBBORROW_INTRINSIC)
ret = GFp_SUBBORROW_INTRINSIC(borrow_in, a, b, r);
#if defined(RING_CORE_SUBBORROW_INTRINSIC)
ret = RING_CORE_SUBBORROW_INTRINSIC(borrow_in, a, b, r);
#else
DoubleLimb x = (DoubleLimb)a - b - borrow_in;
*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. */
static inline Carry limb_sub(Limb *r, Limb a, Limb b) {
Carry ret;
#if defined(GFp_SUBBORROW_INTRINSIC)
ret = GFp_SUBBORROW_INTRINSIC(0, a, b, r);
#if defined(RING_CORE_SUBBORROW_INTRINSIC)
ret = RING_CORE_SUBBORROW_INTRINSIC(0, a, b, r);
#else
DoubleLimb x = (DoubleLimb)a - b;
*r = (Limb)x;

View File

@ -54,7 +54,7 @@
* copied and put under another distribution 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) {
uint8_t x = 0;

View File

@ -15,8 +15,8 @@
#ifndef OPENSSL_HEADER_POLY1305_INTERNAL_H
#define OPENSSL_HEADER_POLY1305_INTERNAL_H
#include <GFp/base.h>
#include <GFp/poly1305.h>
#include <ring-core/base.h>
#include <ring-core/poly1305.h>
#if defined(OPENSSL_ARM) && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_APPLE)
#define OPENSSL_POLY1305_NEON

View File

@ -16,7 +16,7 @@
// (https://github.com/floodyberry/poly1305-donna) and released as public
// domain.
#include <GFp/poly1305.h>
#include <ring-core/poly1305.h>
#include "internal.h"
#include "../internal.h"

View File

@ -15,7 +15,7 @@
// This implementation was taken from the public domain, neon2 version in
// SUPERCOP by D. J. Bernstein and Peter Schwabe.
#include <GFp/poly1305.h>
#include <ring-core/poly1305.h>
#include "internal.h"
#include "../internal.h"

View File

@ -18,7 +18,7 @@
// http://cr.yp.to/papers.html#neoncrypto. Unrolled to 2 powers, i.e. 64 byte
// block size
#include <GFp/poly1305.h>
#include <ring-core/poly1305.h>
#include "internal.h"
#include "../internal.h"

View File

@ -49,7 +49,7 @@
#ifndef OPENSSL_HEADER_AES_H
#define OPENSSL_HEADER_AES_H
#include <GFp/base.h>
#include <ring-core/base.h>
// Raw AES functions.

View File

@ -58,7 +58,7 @@
#include <ring_core_generated/prefix_symbols.h>
#include <GFp/type_check.h>
#include <ring-core/type_check.h>
#if defined(_MSC_VER) && !defined(__clang__)
#pragma warning(push, 3)

View File

@ -23,7 +23,7 @@
// When reviewing uses of |debug_assert_nonsecret|, verify that the check
// really does not have potential to leak a secret.
#if !defined(GFp_NOSTDLIBINC)
#if !defined(RING_CORE_NOSTDLIBINC)
# include <assert.h>
# define debug_assert_nonsecret(x) assert(x)
#else

View File

@ -61,7 +61,7 @@
#ifndef OPENSSL_HEADER_CPU_H
#define OPENSSL_HEADER_CPU_H
#include <GFp/base.h>
#include <ring-core/base.h>
// Runtime CPU feature support

View File

@ -57,7 +57,7 @@
#ifndef 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
// takes an amount of time dependent on |len|, but independent of the contents

View File

@ -15,7 +15,7 @@
#ifndef 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.
typedef uint8_t poly1305_state[512];

View File

View File

@ -57,7 +57,7 @@
#ifndef 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__))

View File

@ -43,7 +43,7 @@ pub struct Context {
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
// are used, is only correct when the state buffer is 64-byte aligned.

View File

@ -68,7 +68,7 @@ macro_rules! prefixed_item {
} => {
prefixed_item! {
$attr
{ concat!("GFp_", stringify!($name)) }
{ concat!("ring_core_dev_", stringify!($name)) }
{ $( $item )+ }
}
};