summaryrefslogtreecommitdiff
path: root/lib/libcrypto/evp
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2021-12-24 12:55:05 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2021-12-24 12:55:05 +0000
commit404c8501cd30e161805b7a924de93d0dc83a8211 (patch)
tree789d2310a85740499f2a8301982fc2b7c0a46d9d /lib/libcrypto/evp
parent112935111377df8b783b97f6bcd44856c63ef3cc (diff)
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 'lib/libcrypto/evp')
-rw-r--r--lib/libcrypto/evp/evp.h6
-rw-r--r--lib/libcrypto/evp/evp_lib.c19
2 files changed, 22 insertions, 3 deletions
diff --git a/lib/libcrypto/evp/evp.h b/lib/libcrypto/evp/evp.h
index 2e6053c9bc8..aa0a9e77c9e 100644
--- a/lib/libcrypto/evp/evp.h
+++ b/lib/libcrypto/evp/evp.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: evp.h,v 1.89 2021/12/24 12:02:15 tb Exp $ */
+/* $OpenBSD: evp.h,v 1.90 2021/12/24 12:55:04 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -520,9 +520,11 @@ int EVP_CIPHER_CTX_get_iv(const EVP_CIPHER_CTX *ctx,
int EVP_CIPHER_CTX_set_iv(EVP_CIPHER_CTX *ctx,
const unsigned char *iv, size_t len);
int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in);
-void * EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx);
+void *EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx);
void EVP_CIPHER_CTX_set_app_data(EVP_CIPHER_CTX *ctx, void *data);
#if defined(LIBRESSL_NEXT_API) || defined(LIBRESSL_CRYPTO_INTERNAL)
+void *EVP_CIPHER_CTX_get_cipher_data(const EVP_CIPHER_CTX *ctx);
+void *EVP_CIPHER_CTX_set_cipher_data(EVP_CIPHER_CTX *ctx, void *cipher_data);
unsigned char *EVP_CIPHER_CTX_buf_noconst(EVP_CIPHER_CTX *ctx);
#endif
#define EVP_CIPHER_CTX_type(c) EVP_CIPHER_type(EVP_CIPHER_CTX_cipher(c))
diff --git a/lib/libcrypto/evp/evp_lib.c b/lib/libcrypto/evp/evp_lib.c
index d74a53997e7..63bd147fead 100644
--- a/lib/libcrypto/evp/evp_lib.c
+++ b/lib/libcrypto/evp/evp_lib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: evp_lib.c,v 1.20 2021/12/24 12:02:15 tb Exp $ */
+/* $OpenBSD: evp_lib.c,v 1.21 2021/12/24 12:55:04 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -239,6 +239,23 @@ EVP_CIPHER_CTX_set_app_data(EVP_CIPHER_CTX *ctx, void *data)
ctx->app_data = data;
}
+void *
+EVP_CIPHER_CTX_get_cipher_data(const EVP_CIPHER_CTX *ctx)
+{
+ return ctx->cipher_data;
+}
+
+void *
+EVP_CIPHER_CTX_set_cipher_data(EVP_CIPHER_CTX *ctx, void *cipher_data)
+{
+ void *old_cipher_data;
+
+ old_cipher_data = ctx->cipher_data;
+ ctx->cipher_data = cipher_data;
+
+ return old_cipher_data;
+}
+
int
EVP_CIPHER_iv_length(const EVP_CIPHER *cipher)
{