Skip to content

Commit

Permalink
apisupport: add & use LIBCRYPTO-LOW_LEVEL_AES
Browse files Browse the repository at this point in the history
  • Loading branch information
gperciva authored and cperciva committed May 9, 2024
1 parent deb547d commit 329439f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ scrypt_SOURCES= main.c \
lib/util/passphrase_entry.c \
lib/util/passphrase_entry.h \
lib-platform/util/memlimit.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 @@ -101,6 +100,7 @@ AM_CPPFLAGS= -I$(srcdir)/lib \
scrypt_LDADD= libcperciva_aesni.la libcperciva_rdrand.la \
libcperciva_shani.la libscrypt_sse2.la \
libscrypt_memlimit.la \
libscrypt_crypto_aes.la \
libcperciva_arm_sha256.la \
libcperciva_arm_aes.la \
${LDADD_POSIX}
Expand Down Expand Up @@ -159,6 +159,11 @@ libscrypt_memlimit_la_SOURCES= lib-platform/util/memlimit.c \
lib-platform/util/memlimit.h
libscrypt_memlimit_la_CFLAGS=`. ./apisupport-config.h; echo $${CFLAGS_NONPOSIX_MEMLIMIT}`

noinst_LTLIBRARIES+= libscrypt_crypto_aes.la
libscrypt_crypto_aes_la_SOURCES= libcperciva/crypto/crypto_aes.c \
libcperciva/crypto/crypto_aes.h
libscrypt_crypto_aes_la_CFLAGS=`. ./apisupport-config.h; echo $${CFLAGS_LIBCRYPTO_LOW_LEVEL_AES}`

# Install libscrypt-kdf?
if LIBSCRYPT_KDF
lib_LTLIBRARIES= libscrypt-kdf.la
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 329439f

Please sign in to comment.