Skip to content

Commit

Permalink
build: import libcperciva_crypto_aes
Browse files Browse the repository at this point in the history
  • Loading branch information
gperciva committed Feb 9, 2025
1 parent 1671651 commit e6e4f59
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
13 changes: 12 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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 \
Expand Down Expand Up @@ -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
Expand Down
15 changes: 15 additions & 0 deletions libcperciva/apisupport/Build/apisupport-LIBCRYPTO-LOW_LEVEL_AES.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include <stdint.h>

#include <openssl/aes.h>

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);
}
4 changes: 4 additions & 0 deletions libcperciva/crypto/crypto_aes.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**
* APISUPPORT CFLAGS: LIBCRYPTO_LOW_LEVEL_AES
*/

#include <assert.h>
#include <stdint.h>
#include <stdlib.h>
Expand Down

0 comments on commit e6e4f59

Please sign in to comment.