summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/aes/aes.c
diff options
context:
space:
mode:
authorjsing <>2025-05-19 04:32:52 +0000
committerjsing <>2025-05-19 04:32:52 +0000
commitc2782d1f52bceb30584b71c11631e00eacebcc4e (patch)
tree933fe7cf5ca670d95a283dd28b6cd3dbbcfcf0c5 /src/lib/libcrypto/aes/aes.c
parent79868e04e6efa26035e7e479e6094da677341390 (diff)
downloadopenbsd-c2782d1f52bceb30584b71c11631e00eacebcc4e.tar.gz
openbsd-c2782d1f52bceb30584b71c11631e00eacebcc4e.tar.bz2
openbsd-c2782d1f52bceb30584b71c11631e00eacebcc4e.zip
Simplify EVP AES code for ECB.
AES_ecb_encrypt() does not really do ECB - provide an aes_ecb_encrypt_internal that actually does multiple blocks and call this from aes_ecb_cipher(). Provide ECB with its own key initialisation function, which allows aes_init_key() to be simplified considerably. The block function pointer is now unused, so mop this up. ok joshua@ tb@
Diffstat (limited to 'src/lib/libcrypto/aes/aes.c')
-rw-r--r--src/lib/libcrypto/aes/aes.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/lib/libcrypto/aes/aes.c b/src/lib/libcrypto/aes/aes.c
index 712168e9fa..1c1c61a7a9 100644
--- a/src/lib/libcrypto/aes/aes.c
+++ b/src/lib/libcrypto/aes/aes.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: aes.c,v 1.6 2025/05/19 04:01:07 jsing Exp $ */ 1/* $OpenBSD: aes.c,v 1.7 2025/05/19 04:32:51 jsing Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 2002-2006 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 2002-2006 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -191,6 +191,18 @@ AES_ecb_encrypt(const unsigned char *in, unsigned char *out,
191LCRYPTO_ALIAS(AES_ecb_encrypt); 191LCRYPTO_ALIAS(AES_ecb_encrypt);
192 192
193void 193void
194aes_ecb_encrypt_internal(const unsigned char *in, unsigned char *out,
195 size_t len, const AES_KEY *key, int encrypt)
196{
197 while (len >= AES_BLOCK_SIZE) {
198 AES_ecb_encrypt(in, out, key, encrypt);
199 in += AES_BLOCK_SIZE;
200 out += AES_BLOCK_SIZE;
201 len -= AES_BLOCK_SIZE;
202 }
203}
204
205void
194AES_ofb128_encrypt(const unsigned char *in, unsigned char *out, size_t length, 206AES_ofb128_encrypt(const unsigned char *in, unsigned char *out, size_t length,
195 const AES_KEY *key, unsigned char *ivec, int *num) 207 const AES_KEY *key, unsigned char *ivec, int *num)
196{ 208{