Skip to content

Commit

Permalink
Remove changes based on GitHub feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
bltavares committed May 4, 2021
1 parent 53cfcd6 commit bd27ae2
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 535 deletions.
2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ include = [
"crypto/fipsmodule/bn/asm/x86-mont.pl",
"crypto/fipsmodule/bn/asm/x86_64-mont.pl",
"crypto/fipsmodule/bn/asm/x86_64-mont5.pl",
"crypto/fipsmodule/bn/asm/mips-mont.pl",
"crypto/fipsmodule/bn/internal.h",
"crypto/fipsmodule/bn/montgomery.c",
"crypto/fipsmodule/bn/montgomery_inv.c",
Expand Down Expand Up @@ -106,7 +105,6 @@ include = [
"examples/checkdigest.rs",
"include/ring-core/aes.h",
"include/ring-core/arm_arch.h",
"include/ring-core/mips_arch.h",
"include/ring-core/base.h",
"include/ring-core/check.h",
"include/ring-core/cpu.h",
Expand Down
41 changes: 10 additions & 31 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ const X86: &str = "x86";
const X86_64: &str = "x86_64";
const AARCH64: &str = "aarch64";
const ARM: &str = "arm";
const MIPS: &str = "mips";
const MIPS64: &str = "mips64";

#[rustfmt::skip]
const RING_SRCS: &[(&[&str], &str)] = &[
Expand All @@ -41,13 +39,13 @@ const RING_SRCS: &[(&[&str], &str)] = &[
(&[], "crypto/limbs/limbs.c"),
(&[], "crypto/mem.c"),
(&[], "crypto/poly1305/poly1305.c"),
(&[], "crypto/curve25519/curve25519.c"),
(&[], "crypto/fipsmodule/ec/ecp_nistz.c"),
(&[], "crypto/fipsmodule/ec/gfp_p256.c"),
(&[], "crypto/fipsmodule/ec/gfp_p384.c"),
(&[], "crypto/fipsmodule/ec/p256.c"),

(&[AARCH64, ARM, MIPS, MIPS64, X86_64, X86], "crypto/crypto.c"),
(&[AARCH64, ARM, MIPS, MIPS64, X86_64, X86], "crypto/curve25519/curve25519.c"),
(&[AARCH64, ARM, MIPS, MIPS64, X86_64, X86], "crypto/fipsmodule/ec/ecp_nistz.c"),
(&[AARCH64, ARM, MIPS, MIPS64, X86_64, X86], "crypto/fipsmodule/ec/gfp_p256.c"),
(&[AARCH64, ARM, MIPS, MIPS64, X86_64, X86], "crypto/fipsmodule/ec/gfp_p384.c"),
(&[AARCH64, ARM, MIPS, MIPS64, X86_64, X86], "crypto/fipsmodule/ec/p256.c"),
(&[AARCH64, X86_64, X86], "crypto/crypto.c"),

(&[X86_64, X86], "crypto/cpu-intel.c"),

Expand Down Expand Up @@ -89,8 +87,6 @@ const RING_SRCS: &[(&[&str], &str)] = &[
(&[AARCH64], "crypto/chacha/asm/chacha-armv8.pl"),
(&[AARCH64], "crypto/fipsmodule/modes/asm/ghash-neon-armv8.pl"),
(&[AARCH64], SHA512_ARMV8),

(&[MIPS, MIPS64], "crypto/fipsmodule/bn/asm/mips-mont.pl"),
];

const SHA256_X86_64: &str = "crypto/fipsmodule/sha/asm/sha256-x86_64.pl";
Expand Down Expand Up @@ -204,20 +200,6 @@ const ASM_TARGETS: &[AsmTarget] = &[
asm_extension: "S",
preassemble: false,
},
AsmTarget {
oss: LINUX_ABI,
arch: "mips",
perlasm_format: "elf",
asm_extension: "S",
preassemble: false,
},
AsmTarget {
oss: LINUX_ABI,
arch: "mips64",
perlasm_format: "elf",
asm_extension: "S",
preassemble: false,
},
AsmTarget {
oss: MACOS_ABI,
arch: "aarch64",
Expand Down Expand Up @@ -321,13 +303,16 @@ fn main() {
fn ring_build_rs_main() {
use std::env;

if env::var("CARGO_CFG_TARGET_ENDIAN").unwrap() == "big" {
panic!("Big-endian targets are not supported yet");
}

let out_dir = env::var("OUT_DIR").unwrap();
let out_dir = PathBuf::from(out_dir);

let arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap();
let os = env::var("CARGO_CFG_TARGET_OS").unwrap();
let env = env::var("CARGO_CFG_TARGET_ENV").unwrap();
let endian = env::var("CARGO_CFG_TARGET_ENDIAN").unwrap();
let (obj_ext, obj_opt) = if env == MSVC {
(MSVC_OBJ_EXT, MSVC_OBJ_OPT)
} else {
Expand All @@ -341,7 +326,6 @@ fn ring_build_rs_main() {

let target = Target {
arch,
endian,
os,
env,
obj_ext,
Expand Down Expand Up @@ -393,7 +377,6 @@ fn pregenerate_asm_main() {

struct Target {
arch: String,
endian: String,
os: String,
env: String,
obj_ext: &'static str,
Expand All @@ -412,10 +395,6 @@ fn build_c_code(target: &Target, pregenerated: PathBuf, out_dir: &Path, ring_cor
}
}

if target.arch == "mips" && target.endian == "big" {
panic!("MIPS Big-Endian detected. Stoping compilation as BoringSSL code are not available for this platform");
}

let asm_target = ASM_TARGETS.iter().find(|asm_target| {
asm_target.arch == target.arch && asm_target.oss.contains(&target.os.as_ref())
});
Expand Down
Loading

0 comments on commit bd27ae2

Please sign in to comment.