summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortb <>2023-12-15 13:28:30 +0000
committertb <>2023-12-15 13:28:30 +0000
commit21316bd190bc144c08df39f1ffe220ce6e2aa856 (patch)
tree8ca28d76bb611c2f5816f7d1ed701c6720ba4137 /src
parent297e7294f5840e1bff79014cff7d8d0ed901623e (diff)
downloadopenbsd-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.c9
-rw-r--r--src/lib/libcrypto/evp/evp_lib.c9
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
249int 249int
250EVP_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
256int
250EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, 257EVP_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
200int
201EVP_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
207const EVP_CIPHER * 200const EVP_CIPHER *
208EVP_CIPHER_CTX_cipher(const EVP_CIPHER_CTX *ctx) 201EVP_CIPHER_CTX_cipher(const EVP_CIPHER_CTX *ctx)
209{ 202{