summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorShane Lontis <shane.lontis@oracle.com>2019-09-11 17:52:30 +1000
committerShane Lontis <shane.lontis@oracle.com>2019-09-11 17:52:30 +1000
commitdc64dc2edd215d6cc5843c1bfe1f0b64bff26adc (patch)
tree2e2fb32d97e77ddc2cac66d0577dba3ddd73fa1c /crypto
parent64115f05ac950390e80e3993703513cda439fca0 (diff)
Add EVP_CIPHER_CTX_tag_length()
There is no deprecated CTRL support for this new field. Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9698)
Diffstat (limited to 'crypto')
-rw-r--r--crypto/evp/evp_lib.c11
-rw-r--r--crypto/evp/evp_utils.c2
2 files changed, 13 insertions, 0 deletions
diff --git a/crypto/evp/evp_lib.c b/crypto/evp/evp_lib.c
index 9c3edb3322..5be04b0502 100644
--- a/crypto/evp/evp_lib.c
+++ b/crypto/evp/evp_lib.c
@@ -336,6 +336,17 @@ legacy:
return v;
}
+int EVP_CIPHER_CTX_tag_length(const EVP_CIPHER_CTX *ctx)
+{
+ int ret;
+ size_t v = 0;
+ OSSL_PARAM params[2] = { OSSL_PARAM_END, OSSL_PARAM_END };
+
+ params[0] = OSSL_PARAM_construct_size_t(OSSL_CIPHER_PARAM_AEAD_TAGLEN, &v);
+ ret = evp_do_ciph_ctx_getparams(ctx->cipher, ctx->provctx, params);
+ return ret == 1 ? (int)v : 0;
+}
+
const unsigned char *EVP_CIPHER_CTX_original_iv(const EVP_CIPHER_CTX *ctx)
{
return ctx->oiv;
diff --git a/crypto/evp/evp_utils.c b/crypto/evp/evp_utils.c
index e5cd5b84e1..3da208a69f 100644
--- a/crypto/evp/evp_utils.c
+++ b/crypto/evp/evp_utils.c
@@ -25,6 +25,8 @@
* use the same value, and other callers will have to compensate.
*/
#define PARAM_CHECK(obj, func, errfunc) \
+ if (obj == NULL) \
+ return 0; \
if (obj->prov == NULL) \
return EVP_CTRL_RET_UNSUPPORTED; \
if (obj->func == NULL) { \