From 0cd704b3d82834f1454ffcb523fd88d0982d3ebe Mon Sep 17 00:00:00 2001 From: Anjan Roy Date: Sun, 16 Jun 2024 13:23:37 +0400 Subject: [PATCH] Change the directory structure of source tree Signed-off-by: Anjan Roy --- Makefile | 2 +- benchmarks/bench_kem.cpp | 2 +- examples/kyber512_kem.cpp | 2 +- include/{ => kyber/internals}/kem.hpp | 2 +- include/{ => kyber/internals/math}/field.hpp | 2 +- include/{ => kyber/internals}/pke.hpp | 10 +++++----- include/{ => kyber/internals/poly}/compression.hpp | 6 +++--- include/{ => kyber/internals/poly}/ntt.hpp | 2 +- include/{ => kyber/internals/poly}/poly_vec.hpp | 10 +++++----- include/{ => kyber/internals/poly}/sampling.hpp | 6 +++--- include/{ => kyber/internals/poly}/serialize.hpp | 6 +++--- include/{ => kyber/internals/rng}/prng.hpp | 0 include/{ => kyber/internals/utility}/params.hpp | 1 - include/{ => kyber/internals/utility}/utils.hpp | 1 - include/{ => kyber}/kyber1024_kem.hpp | 3 +-- include/{ => kyber}/kyber512_kem.hpp | 4 +--- include/{ => kyber}/kyber768_kem.hpp | 3 +-- tests/dudect/test_kyber1024_kem.cpp | 2 +- tests/dudect/test_kyber512_kem.cpp | 2 +- tests/dudect/test_kyber768_kem.cpp | 2 +- tests/test_compression.cpp | 2 +- tests/test_field.cpp | 2 +- tests/test_kem.cpp | 4 ++-- tests/test_kem_kat.cpp | 8 ++++---- tests/test_ntt.cpp | 4 ++-- tests/test_serialize.cpp | 4 ++-- 26 files changed, 43 insertions(+), 49 deletions(-) rename include/{ => kyber/internals}/kem.hpp (99%) rename include/{ => kyber/internals/math}/field.hpp (99%) rename include/{ => kyber/internals}/pke.hpp (96%) rename include/{ => kyber/internals/poly}/compression.hpp (95%) rename include/{ => kyber/internals/poly}/ntt.hpp (99%) rename include/{ => kyber/internals/poly}/poly_vec.hpp (96%) rename include/{ => kyber/internals/poly}/sampling.hpp (97%) rename include/{ => kyber/internals/poly}/serialize.hpp (99%) rename include/{ => kyber/internals/rng}/prng.hpp (100%) rename include/{ => kyber/internals/utility}/params.hpp (99%) rename include/{ => kyber/internals/utility}/utils.hpp (99%) rename include/{ => kyber}/kyber1024_kem.hpp (98%) rename include/{ => kyber}/kyber512_kem.hpp (97%) rename include/{ => kyber}/kyber768_kem.hpp (98%) diff --git a/Makefile b/Makefile index 9c62fb6..4f88598 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ DEP_IFLAGS = -I $(SHA3_INC_DIR) -I $(SUBTLE_INC_DIR) DUDECT_DEP_IFLAGS = $(DEP_IFLAGS) -I $(DUDECT_INC_DIR) SRC_DIR = include -KYBER_SOURCES := $(wildcard $(SRC_DIR)/*.hpp) +KYBER_SOURCES := $(shell find $(SRC_DIR) -name '*.hpp') BUILD_DIR = build DUDECT_BUILD_DIR = $(BUILD_DIR)/dudect ASAN_BUILD_DIR = $(BUILD_DIR)/asan diff --git a/benchmarks/bench_kem.cpp b/benchmarks/bench_kem.cpp index d3192a4..48de174 100644 --- a/benchmarks/bench_kem.cpp +++ b/benchmarks/bench_kem.cpp @@ -1,5 +1,5 @@ #include "bench_helper.hpp" -#include "kem.hpp" +#include "kyber/internals/kem.hpp" #include "x86_64_cpu_ticks.hpp" #include diff --git a/examples/kyber512_kem.cpp b/examples/kyber512_kem.cpp index 95da574..b44943b 100644 --- a/examples/kyber512_kem.cpp +++ b/examples/kyber512_kem.cpp @@ -1,4 +1,4 @@ -#include "kyber512_kem.hpp" +#include "kyber/kyber512_kem.hpp" #include #include #include diff --git a/include/kem.hpp b/include/kyber/internals/kem.hpp similarity index 99% rename from include/kem.hpp rename to include/kyber/internals/kem.hpp index 846e139..45d281b 100644 --- a/include/kem.hpp +++ b/include/kyber/internals/kem.hpp @@ -1,9 +1,9 @@ #pragma once +#include "kyber/internals/utility/utils.hpp" #include "pke.hpp" #include "sha3_256.hpp" #include "sha3_512.hpp" #include "shake256.hpp" -#include "utils.hpp" #include #include #include diff --git a/include/field.hpp b/include/kyber/internals/math/field.hpp similarity index 99% rename from include/field.hpp rename to include/kyber/internals/math/field.hpp index a369a42..677097a 100644 --- a/include/field.hpp +++ b/include/kyber/internals/math/field.hpp @@ -1,5 +1,5 @@ #pragma once -#include "prng.hpp" +#include "kyber/internals/rng/prng.hpp" #include #include diff --git a/include/pke.hpp b/include/kyber/internals/pke.hpp similarity index 96% rename from include/pke.hpp rename to include/kyber/internals/pke.hpp index 84983b3..ba20f6e 100644 --- a/include/pke.hpp +++ b/include/kyber/internals/pke.hpp @@ -1,10 +1,10 @@ #pragma once -#include "field.hpp" -#include "params.hpp" -#include "poly_vec.hpp" -#include "sampling.hpp" +#include "kyber/internals/math/field.hpp" +#include "kyber/internals/poly/poly_vec.hpp" +#include "kyber/internals/poly/sampling.hpp" +#include "kyber/internals/utility/params.hpp" +#include "kyber/internals/utility/utils.hpp" #include "sha3_512.hpp" -#include "utils.hpp" #include #include diff --git a/include/compression.hpp b/include/kyber/internals/poly/compression.hpp similarity index 95% rename from include/compression.hpp rename to include/kyber/internals/poly/compression.hpp index 36f3a19..bd12cfb 100644 --- a/include/compression.hpp +++ b/include/kyber/internals/poly/compression.hpp @@ -1,7 +1,7 @@ #pragma once -#include "field.hpp" -#include "ntt.hpp" -#include "params.hpp" +#include "kyber/internals/math/field.hpp" +#include "kyber/internals/poly/ntt.hpp" +#include "kyber/internals/utility/params.hpp" #include // IND-CPA-secure Public Key Encryption Scheme Utilities diff --git a/include/ntt.hpp b/include/kyber/internals/poly/ntt.hpp similarity index 99% rename from include/ntt.hpp rename to include/kyber/internals/poly/ntt.hpp index 782418d..85daa1c 100644 --- a/include/ntt.hpp +++ b/include/kyber/internals/poly/ntt.hpp @@ -1,5 +1,5 @@ #pragma once -#include "field.hpp" +#include "kyber/internals/math/field.hpp" #include #include diff --git a/include/poly_vec.hpp b/include/kyber/internals/poly/poly_vec.hpp similarity index 96% rename from include/poly_vec.hpp rename to include/kyber/internals/poly/poly_vec.hpp index 4eb3657..f54e71b 100644 --- a/include/poly_vec.hpp +++ b/include/kyber/internals/poly/poly_vec.hpp @@ -1,9 +1,9 @@ #pragma once -#include "compression.hpp" -#include "field.hpp" -#include "ntt.hpp" -#include "params.hpp" -#include "serialize.hpp" +#include "kyber/internals/math/field.hpp" +#include "kyber/internals/poly/compression.hpp" +#include "kyber/internals/poly/ntt.hpp" +#include "kyber/internals/poly/serialize.hpp" +#include "kyber/internals/utility/params.hpp" #include #include diff --git a/include/sampling.hpp b/include/kyber/internals/poly/sampling.hpp similarity index 97% rename from include/sampling.hpp rename to include/kyber/internals/poly/sampling.hpp index 2dd7436..3535843 100644 --- a/include/sampling.hpp +++ b/include/kyber/internals/poly/sampling.hpp @@ -1,7 +1,7 @@ #pragma once -#include "field.hpp" -#include "ntt.hpp" -#include "params.hpp" +#include "kyber/internals/math/field.hpp" +#include "kyber/internals/poly/ntt.hpp" +#include "kyber/internals/utility/params.hpp" #include "shake128.hpp" #include "shake256.hpp" #include diff --git a/include/serialize.hpp b/include/kyber/internals/poly/serialize.hpp similarity index 99% rename from include/serialize.hpp rename to include/kyber/internals/poly/serialize.hpp index 7764ed5..11106ed 100644 --- a/include/serialize.hpp +++ b/include/kyber/internals/poly/serialize.hpp @@ -1,7 +1,7 @@ #pragma once -#include "field.hpp" -#include "ntt.hpp" -#include "params.hpp" +#include "kyber/internals/math/field.hpp" +#include "kyber/internals/poly/ntt.hpp" +#include "kyber/internals/utility/params.hpp" #include // IND-CPA-secure Public Key Encryption Scheme Utilities diff --git a/include/prng.hpp b/include/kyber/internals/rng/prng.hpp similarity index 100% rename from include/prng.hpp rename to include/kyber/internals/rng/prng.hpp diff --git a/include/params.hpp b/include/kyber/internals/utility/params.hpp similarity index 99% rename from include/params.hpp rename to include/kyber/internals/utility/params.hpp index de94efc..33f0ced 100644 --- a/include/params.hpp +++ b/include/kyber/internals/utility/params.hpp @@ -1,6 +1,5 @@ #pragma once #include -#include // Holds compile-time executable functions, ensuring that routines are invoked // with proper arguments. diff --git a/include/utils.hpp b/include/kyber/internals/utility/utils.hpp similarity index 99% rename from include/utils.hpp rename to include/kyber/internals/utility/utils.hpp index 0c58bca..49b4f6b 100644 --- a/include/utils.hpp +++ b/include/kyber/internals/utility/utils.hpp @@ -1,5 +1,4 @@ #pragma once -#include "params.hpp" #include "subtle.hpp" #include #include diff --git a/include/kyber1024_kem.hpp b/include/kyber/kyber1024_kem.hpp similarity index 98% rename from include/kyber1024_kem.hpp rename to include/kyber/kyber1024_kem.hpp index acb97da..e5c6b8e 100644 --- a/include/kyber1024_kem.hpp +++ b/include/kyber/kyber1024_kem.hpp @@ -1,6 +1,5 @@ #pragma once -#include "kem.hpp" -#include "utils.hpp" +#include "kyber/internals/kem.hpp" // Kyber Key Encapsulation Mechanism (KEM) instantiated with Kyber1024 // parameters diff --git a/include/kyber512_kem.hpp b/include/kyber/kyber512_kem.hpp similarity index 97% rename from include/kyber512_kem.hpp rename to include/kyber/kyber512_kem.hpp index 1abc9c4..d67778a 100644 --- a/include/kyber512_kem.hpp +++ b/include/kyber/kyber512_kem.hpp @@ -1,7 +1,5 @@ #pragma once -#include "kem.hpp" -#include "utils.hpp" -#include +#include "kyber/internals/kem.hpp" // Kyber Key Encapsulation Mechanism (KEM) instantiated with Kyber512 parameters namespace kyber512_kem { diff --git a/include/kyber768_kem.hpp b/include/kyber/kyber768_kem.hpp similarity index 98% rename from include/kyber768_kem.hpp rename to include/kyber/kyber768_kem.hpp index 4e8ab34..4374479 100644 --- a/include/kyber768_kem.hpp +++ b/include/kyber/kyber768_kem.hpp @@ -1,6 +1,5 @@ #pragma once -#include "kem.hpp" -#include "utils.hpp" +#include "kyber/internals/kem.hpp" // Kyber Key Encapsulation Mechanism (KEM) instantiated with Kyber768 parameters namespace kyber768_kem { diff --git a/tests/dudect/test_kyber1024_kem.cpp b/tests/dudect/test_kyber1024_kem.cpp index ad8df25..54d628a 100644 --- a/tests/dudect/test_kyber1024_kem.cpp +++ b/tests/dudect/test_kyber1024_kem.cpp @@ -1,4 +1,4 @@ -#include "kyber1024_kem.hpp" +#include "kyber/kyber1024_kem.hpp" #define DUDECT_IMPLEMENTATION #define DUDECT_VISIBLITY_STATIC diff --git a/tests/dudect/test_kyber512_kem.cpp b/tests/dudect/test_kyber512_kem.cpp index 40c4253..c4e1b64 100644 --- a/tests/dudect/test_kyber512_kem.cpp +++ b/tests/dudect/test_kyber512_kem.cpp @@ -1,4 +1,4 @@ -#include "kyber512_kem.hpp" +#include "kyber/kyber512_kem.hpp" #include #define DUDECT_IMPLEMENTATION diff --git a/tests/dudect/test_kyber768_kem.cpp b/tests/dudect/test_kyber768_kem.cpp index 5d217d9..ac7f61d 100644 --- a/tests/dudect/test_kyber768_kem.cpp +++ b/tests/dudect/test_kyber768_kem.cpp @@ -1,4 +1,4 @@ -#include "kyber768_kem.hpp" +#include "kyber/kyber768_kem.hpp" #define DUDECT_IMPLEMENTATION #define DUDECT_VISIBLITY_STATIC diff --git a/tests/test_compression.cpp b/tests/test_compression.cpp index 5e92acd..0efee66 100644 --- a/tests/test_compression.cpp +++ b/tests/test_compression.cpp @@ -1,4 +1,4 @@ -#include "compression.hpp" +#include "kyber/internals/poly/compression.hpp" #include // Decompression error that can happen for some given `d` s.t. diff --git a/tests/test_field.cpp b/tests/test_field.cpp index c14c775..f01cf8c 100644 --- a/tests/test_field.cpp +++ b/tests/test_field.cpp @@ -1,4 +1,4 @@ -#include "field.hpp" +#include "kyber/internals/math/field.hpp" #include // Test functional correctness of Kyber prime field operations ( using diff --git a/tests/test_kem.cpp b/tests/test_kem.cpp index 953d4d2..4b49064 100644 --- a/tests/test_kem.cpp +++ b/tests/test_kem.cpp @@ -1,5 +1,5 @@ -#include "kem.hpp" -#include "utils.hpp" +#include "kyber/internals/kem.hpp" +#include "kyber/internals/utility/utils.hpp" #include // Given k, η1, η2, du, dv - Kyber parameters, this routine checks whether diff --git a/tests/test_kem_kat.cpp b/tests/test_kem_kat.cpp index c6f75af..3942e7e 100644 --- a/tests/test_kem_kat.cpp +++ b/tests/test_kem_kat.cpp @@ -1,7 +1,7 @@ -#include "kyber1024_kem.hpp" -#include "kyber512_kem.hpp" -#include "kyber768_kem.hpp" -#include "utils.hpp" +#include "kyber/internals/utility/utils.hpp" +#include "kyber/kyber1024_kem.hpp" +#include "kyber/kyber512_kem.hpp" +#include "kyber/kyber768_kem.hpp" #include #include #include diff --git a/tests/test_ntt.cpp b/tests/test_ntt.cpp index c434ae5..0d70ae0 100644 --- a/tests/test_ntt.cpp +++ b/tests/test_ntt.cpp @@ -1,5 +1,5 @@ -#include "field.hpp" -#include "ntt.hpp" +#include "kyber/internals/math/field.hpp" +#include "kyber/internals/poly/ntt.hpp" #include #include diff --git a/tests/test_serialize.cpp b/tests/test_serialize.cpp index 1f1a3e0..048ad8e 100644 --- a/tests/test_serialize.cpp +++ b/tests/test_serialize.cpp @@ -1,5 +1,5 @@ -#include "field.hpp" -#include "serialize.hpp" +#include "kyber/internals/math/field.hpp" +#include "kyber/internals/poly/serialize.hpp" #include #include #include