From 1fc7de9a9b7eb95420ca9e0caf125db0f96e3085 Mon Sep 17 00:00:00 2001 From: "Mayeul@Zama" Date: Tue, 20 Dec 2022 17:19:21 +0100 Subject: [PATCH 1/3] chor: replace python by python3 --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 241bcdc6d..17e2ad0e1 100644 --- a/Makefile +++ b/Makefile @@ -11,21 +11,21 @@ generate-code: generate-cpp generate-rust # Generate CPP ######################## $(CURVES_CPP_GEN_H): concrete-security-curves-cpp/gen_header.py $(CURVES_JSON_PATH) - cat $(CURVES_JSON_PATH) | python concrete-security-curves-cpp/gen_header.py > $(CURVES_CPP_GEN_H) + cat $(CURVES_JSON_PATH) | python3 concrete-security-curves-cpp/gen_header.py > $(CURVES_CPP_GEN_H) generate-cpp: $(CURVES_CPP_GEN_H) # Generate RUST ######################## $(CURVES_RUST_GEN_TXT): concrete-security-curves-rust/gen_table.py $(CURVES_JSON_PATH) - cat $(CURVES_JSON_PATH) | python concrete-security-curves-rust/gen_table.py > $(CURVES_RUST_GEN_TXT) + cat $(CURVES_JSON_PATH) | python3 concrete-security-curves-rust/gen_table.py > $(CURVES_RUST_GEN_TXT) generate-rust: $(CURVES_RUST_GEN_TXT) # Compare curves ####################### $(SAGE_OBJECT_DIR)/outdated_curves.timestamp: ./lattice-scripts/compare_curves_and_estimator.py - python ./lattice-scripts/compare_curves_and_estimator.py \ + python3 ./lattice-scripts/compare_curves_and_estimator.py \ --curves-dir $(SAGE_OBJECT_DIR) --security-levels $(SECURITY_LEVELS) --log-q 64 \ || touch $(SAGE_OBJECT_DIR)/outdated_curves.timestamp @@ -42,7 +42,7 @@ generate-curves: $(SAGE_SECURITY_CURVES) # Verify curves ####################### $(CURVES_JSON_PATH): ./lattice-scripts/verify_curves.py $(SAGE_SECURITY_CURVES) - python ./lattice-scripts/verify_curves.py \ + python3 ./lattice-scripts/verify_curves.py \ --curves-dir $(SAGE_OBJECT_DIR) --security-levels $(SECURITY_LEVELS) --log-q 64 > $(CURVES_JSON_PATH) verify-curves: $(CURVES_JSON_PATH) From e1cbed78673ad389ae6e1b445a93d6e76f74a5d1 Mon Sep 17 00:00:00 2001 From: "Mayeul@Zama" Date: Tue, 20 Dec 2022 17:20:35 +0100 Subject: [PATCH 2/3] fix(rust): fix hardcoded array size --- concrete-security-curves-rust/gen_table.py | 4 ++-- concrete-security-curves-rust/src/curves.gen.rs | 4 ++-- concrete-security-curves-rust/src/lib.rs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/concrete-security-curves-rust/gen_table.py b/concrete-security-curves-rust/gen_table.py index 3f2040fe9..4646cbbc5 100644 --- a/concrete-security-curves-rust/gen_table.py +++ b/concrete-security-curves-rust/gen_table.py @@ -5,9 +5,9 @@ def print_curve(data): def print_rust_curves_declaration(datas): - print("[") + print(f"const SECURITY_WEIGHTS_ARRAY: [(u64, SecurityWeights); {len(datas)}] = [") for data in datas: print_curve(data) - print("]") + print("];") print_rust_curves_declaration(json.load(sys.stdin)) \ No newline at end of file diff --git a/concrete-security-curves-rust/src/curves.gen.rs b/concrete-security-curves-rust/src/curves.gen.rs index d95a357b6..0875dde19 100644 --- a/concrete-security-curves-rust/src/curves.gen.rs +++ b/concrete-security-curves-rust/src/curves.gen.rs @@ -1,6 +1,6 @@ -[ +const SECURITY_WEIGHTS_ARRAY: [(u64, SecurityWeights); 4] = [ (80, SecurityWeights { slope: -0.0404263311936459, bias: 1.660978864143658, minimal_lwe_dimension: 450 }), (112, SecurityWeights { slope: -0.02967013708113588, bias: 2.16246371408387, minimal_lwe_dimension: 450 }), (128, SecurityWeights { slope: -0.026405028765226296, bias: 2.482642269104389, minimal_lwe_dimension: 450 }), (192, SecurityWeights { slope: -0.018610403247590064, bias: 3.2996236848399008, minimal_lwe_dimension: 606 }), -] +]; diff --git a/concrete-security-curves-rust/src/lib.rs b/concrete-security-curves-rust/src/lib.rs index d0c941f17..2e89d02a0 100644 --- a/concrete-security-curves-rust/src/lib.rs +++ b/concrete-security-curves-rust/src/lib.rs @@ -1,4 +1,4 @@ -const SECURITY_WEIGHTS_ARRAY: [(u64, SecurityWeights); 4] = include!("./curves.gen.rs"); +include!("./curves.gen.rs"); #[derive(Clone, Copy)] pub struct SecurityWeights { From 8cfce52df0342e365133ea92cf9294dced7750d6 Mon Sep 17 00:00:00 2001 From: "Mayeul@Zama" Date: Tue, 20 Dec 2022 17:20:41 +0100 Subject: [PATCH 3/3] fix gitignore --- .gitignore | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index fd32d8964..cac880d90 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ -concrete-security-curves/target/ -concrete-security-curves/Cargo.lock +concrete-security-curves-rust/target/