summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortb <>2021-12-24 12:55:04 +0000
committertb <>2021-12-24 12:55:04 +0000
commit6d0e78d09a83ec5890337baf10efbff2f48b6f9d (patch)
tree49667c45b395567bea6b4d81b319cab34cbad9cd /src
parente52fde876fd50f605f22b3abd919333afe296d0a (diff)
downloadopenbsd-6d0e78d09a83ec5890337baf10efbff2f48b6f9d.tar.gz
openbsd-6d0e78d09a83ec5890337baf10efbff2f48b6f9d.tar.bz2
openbsd-6d0e78d09a83ec5890337baf10efbff2f48b6f9d.zip
Prepare to provide EVP_CIPHER_CTX_{get,set}_cipher_data
They will be needed by security/py-M2Crypto and telephony/sngrep. ok inoguchi jsing
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/evp/evp.h6
-rw-r--r--src/lib/libcrypto/evp/evp_lib.c19
2 files changed, 22 insertions, 3 deletions
diff --git a/src/lib/libcrypto/evp/evp.h b/src/lib/libcrypto/evp/evp.h
index 2e6053c9bc..aa0a9e77c9 100644
--- a/src/lib/libcrypto/evp/evp.h
+++ b/src/lib/libcrypto/evp/evp.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: evp.h,v 1.89 2021/12/24 12:02:15 tb Exp $ */ 1/* $OpenBSD: evp.h,v 1.90 2021/12/24 12:55:04 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 *
@@ -520,9 +520,11 @@ int EVP_CIPHER_CTX_get_iv(const EVP_CIPHER_CTX *ctx,
520int EVP_CIPHER_CTX_set_iv(EVP_CIPHER_CTX *ctx, 520int EVP_CIPHER_CTX_set_iv(EVP_CIPHER_CTX *ctx,
521 const unsigned char *iv, size_t len); 521 const unsigned char *iv, size_t len);
522int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in); 522int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in);
523void * EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx); 523void *EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx);
524void EVP_CIPHER_CTX_set_app_data(EVP_CIPHER_CTX *ctx, void *data); 524void EVP_CIPHER_CTX_set_app_data(EVP_CIPHER_CTX *ctx, void *data);
525#if defined(LIBRESSL_NEXT_API) || defined(LIBRESSL_CRYPTO_INTERNAL) 525#if defined(LIBRESSL_NEXT_API) || defined(LIBRESSL_CRYPTO_INTERNAL)
526void *EVP_CIPHER_CTX_get_cipher_data(const EVP_CIPHER_CTX *ctx);
527void *EVP_CIPHER_CTX_set_cipher_data(EVP_CIPHER_CTX *ctx, void *cipher_data);
526unsigned char *EVP_CIPHER_CTX_buf_noconst(EVP_CIPHER_CTX *ctx); 528unsigned char *EVP_CIPHER_CTX_buf_noconst(EVP_CIPHER_CTX *ctx);
527#endif 529#endif
528#define EVP_CIPHER_CTX_type(c) EVP_CIPHER_type(EVP_CIPHER_CTX_cipher(c)) 530#define EVP_CIPHER_CTX_type(c) EVP_CIPHER_type(EVP_CIPHER_CTX_cipher(c))
diff --git a/src/lib/libcrypto/evp/evp_lib.c b/src/lib/libcrypto/evp/evp_lib.c
index d74a53997e..63bd147fea 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.20 2021/12/24 12:02:15 tb Exp $ */ 1/* $OpenBSD: evp_lib.c,v 1.21 2021/12/24 12:55:04 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 *
@@ -239,6 +239,23 @@ EVP_CIPHER_CTX_set_app_data(EVP_CIPHER_CTX *ctx, void *data)
239 ctx->app_data = data; 239 ctx->app_data = data;
240} 240}
241 241
242void *
243EVP_CIPHER_CTX_get_cipher_data(const EVP_CIPHER_CTX *ctx)
244{
245 return ctx->cipher_data;
246}
247
248void *
249EVP_CIPHER_CTX_set_cipher_data(EVP_CIPHER_CTX *ctx, void *cipher_data)
250{
251 void *old_cipher_data;
252
253 old_cipher_data = ctx->cipher_data;
254 ctx->cipher_data = cipher_data;
255
256 return old_cipher_data;
257}
258
242int 259int
243EVP_CIPHER_iv_length(const EVP_CIPHER *cipher) 260EVP_CIPHER_iv_length(const EVP_CIPHER *cipher)
244{ 261{