From e6e4f59af9263ae4152af11d793c95288e656fc5 Mon Sep 17 00:00:00 2001 From: Graham Percival Date: Sat, 8 Feb 2025 16:17:00 -0800 Subject: [PATCH] build: import libcperciva_crypto_aes --- Makefile.am | 13 ++++++++++++- .../Build/apisupport-LIBCRYPTO-LOW_LEVEL_AES.c | 15 +++++++++++++++ libcperciva/crypto/crypto_aes.c | 4 ++++ 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 libcperciva/apisupport/Build/apisupport-LIBCRYPTO-LOW_LEVEL_AES.c diff --git a/Makefile.am b/Makefile.am index 57ea489c..74f4b015 100644 --- a/Makefile.am +++ b/Makefile.am @@ -10,6 +10,7 @@ noinst_LIBRARIES= \ lib/libcperciva_arm_aes.a \ lib/libcperciva_arm_sha256.a \ lib/libcperciva_cpusupport_detect.a \ + lib/libcperciva_crypto_aes.a \ lib/libcperciva_rdrand.a \ lib/libcperciva_shani.a \ lib/libtarsnap.a \ @@ -188,7 +189,6 @@ lib_libtarsnap_a_SOURCES= \ libcperciva/alg/sha256_shani.h \ libcperciva/alg/sha256_sse2.h \ libcperciva/cpusupport/cpusupport.h \ - libcperciva/crypto/crypto_aes.c \ libcperciva/crypto/crypto_aes.h \ libcperciva/crypto/crypto_aes_aesni.h \ libcperciva/crypto/crypto_aes_aesni_m128i.h \ @@ -346,6 +346,17 @@ CLEANFILES+= \ cpusupport-config.h \ cpusupport-config.h.tmp +# libcperciva_crypto_aes depends on libcperciva_cpusupport_detect, so _crypto_aes +# must come before _cpusupport_detect in LIBTARSNAP_A. +lib_libcperciva_crypto_aes_a_SOURCES= \ + libcperciva/crypto/crypto_aes.c +nodist_lib_libcperciva_crypto_aes_a_SOURCES= \ + apisupport-config.h \ + cpusupport-config.h +lib_libcperciva_crypto_aes_a_CPPFLAGS=$(lib_libtarsnap_a_CPPFLAGS) +lib_libcperciva_crypto_aes_a_CFLAGS=`. ./apisupport-config.h; echo $${CFLAGS_LIBCRYPTO_LOW_LEVEL_AES}` +LIBTARSNAP_A+= lib/libcperciva_crypto_aes.a + lib_libcperciva_aesni_a_SOURCES= \ libcperciva/crypto/crypto_aes_aesni.c \ libcperciva/crypto/crypto_aesctr_aesni.c diff --git a/libcperciva/apisupport/Build/apisupport-LIBCRYPTO-LOW_LEVEL_AES.c b/libcperciva/apisupport/Build/apisupport-LIBCRYPTO-LOW_LEVEL_AES.c new file mode 100644 index 00000000..1864f011 --- /dev/null +++ b/libcperciva/apisupport/Build/apisupport-LIBCRYPTO-LOW_LEVEL_AES.c @@ -0,0 +1,15 @@ +#include + +#include + +int +main(void) +{ + AES_KEY kexp_actual; + const uint8_t key_unexpanded[16] = { 0 }; + + AES_set_encrypt_key(key_unexpanded, 128, &kexp_actual); + + /* Success! */ + return (0); +} diff --git a/libcperciva/crypto/crypto_aes.c b/libcperciva/crypto/crypto_aes.c index f884605b..d88f9510 100644 --- a/libcperciva/crypto/crypto_aes.c +++ b/libcperciva/crypto/crypto_aes.c @@ -1,3 +1,7 @@ +/** + * APISUPPORT CFLAGS: LIBCRYPTO_LOW_LEVEL_AES + */ + #include #include #include