diff options
author | tb <> | 2023-12-15 13:28:30 +0000 |
---|---|---|
committer | tb <> | 2023-12-15 13:28:30 +0000 |
commit | 21316bd190bc144c08df39f1ffe220ce6e2aa856 (patch) | |
tree | 8ca28d76bb611c2f5816f7d1ed701c6720ba4137 /src | |
parent | 297e7294f5840e1bff79014cff7d8d0ed901623e (diff) | |
download | openbsd-21316bd190bc144c08df39f1ffe220ce6e2aa856.tar.gz openbsd-21316bd190bc144c08df39f1ffe220ce6e2aa856.tar.bz2 openbsd-21316bd190bc144c08df39f1ffe220ce6e2aa856.zip |
Move EVP_Cipher() from evp_lib.c to evp_enc.c
EVP_Cipher() is a dangerous thin wrapper of the do_cipher() method set on
the EVP_CIPHER_CTX's cipher. It implements (part of) the update and final
step of the EVP_Cipher* API. Its behavior is nuts and will be documented
in a comment in a subsequent commit. schwarze has a manpage diff that will
fix the incorrect documentation.
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/evp/evp_enc.c | 9 | ||||
-rw-r--r-- | src/lib/libcrypto/evp/evp_lib.c | 9 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/lib/libcrypto/evp/evp_enc.c b/src/lib/libcrypto/evp/evp_enc.c index 7c3f8c8648..4c00b0ee0a 100644 --- a/src/lib/libcrypto/evp/evp_enc.c +++ b/src/lib/libcrypto/evp/evp_enc.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: evp_enc.c,v 1.58 2023/12/03 11:18:30 tb Exp $ */ | 1 | /* $OpenBSD: evp_enc.c,v 1.59 2023/12/15 13:28:30 tb Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -247,6 +247,13 @@ EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *impl, | |||
247 | } | 247 | } |
248 | 248 | ||
249 | int | 249 | int |
250 | EVP_Cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, | ||
251 | unsigned int inl) | ||
252 | { | ||
253 | return ctx->cipher->do_cipher(ctx, out, in, inl); | ||
254 | } | ||
255 | |||
256 | int | ||
250 | EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, | 257 | EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, |
251 | const unsigned char *in, int inl) | 258 | const unsigned char *in, int inl) |
252 | { | 259 | { |
diff --git a/src/lib/libcrypto/evp/evp_lib.c b/src/lib/libcrypto/evp/evp_lib.c index 55573b21db..622d40dbdf 100644 --- a/src/lib/libcrypto/evp/evp_lib.c +++ b/src/lib/libcrypto/evp/evp_lib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: evp_lib.c,v 1.29 2023/11/18 09:37:15 tb Exp $ */ | 1 | /* $OpenBSD: evp_lib.c,v 1.30 2023/12/15 13:28:30 tb Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -197,13 +197,6 @@ EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX *ctx) | |||
197 | return ctx->cipher->block_size; | 197 | return ctx->cipher->block_size; |
198 | } | 198 | } |
199 | 199 | ||
200 | int | ||
201 | EVP_Cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, | ||
202 | unsigned int inl) | ||
203 | { | ||
204 | return ctx->cipher->do_cipher(ctx, out, in, inl); | ||
205 | } | ||
206 | |||
207 | const EVP_CIPHER * | 200 | const EVP_CIPHER * |
208 | EVP_CIPHER_CTX_cipher(const EVP_CIPHER_CTX *ctx) | 201 | EVP_CIPHER_CTX_cipher(const EVP_CIPHER_CTX *ctx) |
209 | { | 202 | { |