summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/aes/aes_core.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/aes/aes_core.c')
-rw-r--r--src/lib/libcrypto/aes/aes_core.c63
1 files changed, 9 insertions, 54 deletions
diff --git a/src/lib/libcrypto/aes/aes_core.c b/src/lib/libcrypto/aes/aes_core.c
index 4383d74903..687cd60fe7 100644
--- a/src/lib/libcrypto/aes/aes_core.c
+++ b/src/lib/libcrypto/aes/aes_core.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: aes_core.c,v 1.25 2024/11/13 21:00:57 tb Exp $ */ 1/* $OpenBSD: aes_core.c,v 1.26 2025/04/20 09:17:53 jsing Exp $ */
2/** 2/**
3 * rijndael-alg-fst.c 3 * rijndael-alg-fst.c
4 * 4 *
@@ -633,16 +633,11 @@ static const u32 rcon[] = {
633}; 633};
634#endif 634#endif
635 635
636#ifdef HAVE_AES_SET_ENCRYPT_KEY_INTERNAL 636#ifndef HAVE_AES_SET_ENCRYPT_KEY_INTERNAL
637int aes_set_encrypt_key_internal(const unsigned char *userKey, const int bits,
638 AES_KEY *key);
639
640#else
641
642/* 637/*
643 * Expand the cipher key into the encryption key schedule. 638 * Expand the cipher key into the encryption key schedule.
644 */ 639 */
645static inline int 640int
646aes_set_encrypt_key_internal(const unsigned char *userKey, const int bits, 641aes_set_encrypt_key_internal(const unsigned char *userKey, const int bits,
647 AES_KEY *key) 642 AES_KEY *key)
648{ 643{
@@ -742,22 +737,11 @@ aes_set_encrypt_key_internal(const unsigned char *userKey, const int bits,
742} 737}
743#endif 738#endif
744 739
745int 740#ifndef HAVE_AES_SET_DECRYPT_KEY_INTERNAL
746AES_set_encrypt_key(const unsigned char *userKey, const int bits, AES_KEY *key)
747{
748 return aes_set_encrypt_key_internal(userKey, bits, key);
749}
750LCRYPTO_ALIAS(AES_set_encrypt_key);
751
752#ifdef HAVE_AES_SET_DECRYPT_KEY_INTERNAL
753int aes_set_decrypt_key_internal(const unsigned char *userKey, const int bits,
754 AES_KEY *key);
755
756#else
757/* 741/*
758 * Expand the cipher key into the decryption key schedule. 742 * Expand the cipher key into the decryption key schedule.
759 */ 743 */
760static inline int 744int
761aes_set_decrypt_key_internal(const unsigned char *userKey, const int bits, 745aes_set_decrypt_key_internal(const unsigned char *userKey, const int bits,
762 AES_KEY *key) 746 AES_KEY *key)
763{ 747{
@@ -815,22 +799,11 @@ aes_set_decrypt_key_internal(const unsigned char *userKey, const int bits,
815} 799}
816#endif 800#endif
817 801
818int 802#ifndef HAVE_AES_ENCRYPT_INTERNAL
819AES_set_decrypt_key(const unsigned char *userKey, const int bits, AES_KEY *key)
820{
821 return aes_set_decrypt_key_internal(userKey, bits, key);
822}
823LCRYPTO_ALIAS(AES_set_decrypt_key);
824
825#ifdef HAVE_AES_ENCRYPT_INTERNAL
826void aes_encrypt_internal(const unsigned char *in, unsigned char *out,
827 const AES_KEY *key);
828
829#else
830/* 803/*
831 * Encrypt a single block - in and out can overlap. 804 * Encrypt a single block - in and out can overlap.
832 */ 805 */
833static inline void 806void
834aes_encrypt_internal(const unsigned char *in, unsigned char *out, 807aes_encrypt_internal(const unsigned char *in, unsigned char *out,
835 const AES_KEY *key) 808 const AES_KEY *key)
836{ 809{
@@ -1018,22 +991,11 @@ aes_encrypt_internal(const unsigned char *in, unsigned char *out,
1018} 991}
1019#endif 992#endif
1020 993
1021void 994#ifndef HAVE_AES_DECRYPT_INTERNAL
1022AES_encrypt(const unsigned char *in, unsigned char *out, const AES_KEY *key)
1023{
1024 aes_encrypt_internal(in, out, key);
1025}
1026LCRYPTO_ALIAS(AES_encrypt);
1027
1028#ifdef HAVE_AES_DECRYPT_INTERNAL
1029void aes_decrypt_internal(const unsigned char *in, unsigned char *out,
1030 const AES_KEY *key);
1031
1032#else
1033/* 995/*
1034 * Decrypt a single block - in and out can overlap. 996 * Decrypt a single block - in and out can overlap.
1035 */ 997 */
1036static inline void 998void
1037aes_decrypt_internal(const unsigned char *in, unsigned char *out, 999aes_decrypt_internal(const unsigned char *in, unsigned char *out,
1038 const AES_KEY *key) 1000 const AES_KEY *key)
1039{ 1001{
@@ -1220,10 +1182,3 @@ aes_decrypt_internal(const unsigned char *in, unsigned char *out,
1220 crypto_store_htobe32(&out[3 * 4], s3); 1182 crypto_store_htobe32(&out[3 * 4], s3);
1221} 1183}
1222#endif 1184#endif
1223
1224void
1225AES_decrypt(const unsigned char *in, unsigned char *out, const AES_KEY *key)
1226{
1227 aes_decrypt_internal(in, out, key);
1228}
1229LCRYPTO_ALIAS(AES_decrypt);