diff options
| author | jsing <> | 2025-05-19 04:32:52 +0000 |
|---|---|---|
| committer | jsing <> | 2025-05-19 04:32:52 +0000 |
| commit | 4ec16279eb7cfd33c1785a5832ba16feff4a0ed8 (patch) | |
| tree | 933fe7cf5ca670d95a283dd28b6cd3dbbcfcf0c5 /src/lib/libcrypto/aes/aes.c | |
| parent | 613a780b1e5d2028c7a41081a3f34510cd1752e1 (diff) | |
| download | openbsd-4ec16279eb7cfd33c1785a5832ba16feff4a0ed8.tar.gz openbsd-4ec16279eb7cfd33c1785a5832ba16feff4a0ed8.tar.bz2 openbsd-4ec16279eb7cfd33c1785a5832ba16feff4a0ed8.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.c | 14 |
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, | |||
| 191 | LCRYPTO_ALIAS(AES_ecb_encrypt); | 191 | LCRYPTO_ALIAS(AES_ecb_encrypt); |
| 192 | 192 | ||
| 193 | void | 193 | void |
| 194 | aes_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 | |||
| 205 | void | ||
| 194 | AES_ofb128_encrypt(const unsigned char *in, unsigned char *out, size_t length, | 206 | AES_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 | { |
