diff options
author | 2014-11-09 19:12:16 +0000 | |
---|---|---|
committer | 2014-11-09 19:12:16 +0000 | |
commit | b40b93b26ccf799c3dfa7cf18fff743cdb37142a (patch) | |
tree | c096a7483548b4748bde6865b7de2038a49a577c /lib/libssl | |
parent | Allow digest routines to provide their own HASH_FINAL routine; will be (diff) | |
download | wireguard-openbsd-b40b93b26ccf799c3dfa7cf18fff743cdb37142a.tar.xz wireguard-openbsd-b40b93b26ccf799c3dfa7cf18fff743cdb37142a.zip |
Introduce EVP_MD_CTX_ctrl(), to allow for fine control of a given digest.
This functionality was already available (and optional), and used in the
bowels of the ASN.1 code. This exposes it as a public interface, which will
be used by the upcoming GOST code.
Crank libcrypto minor version.
From Dmitry Eremin-Solenikov.
Diffstat (limited to 'lib/libssl')
-rw-r--r-- | lib/libssl/src/crypto/evp/digest.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/lib/libssl/src/crypto/evp/digest.c b/lib/libssl/src/crypto/evp/digest.c index a1be18ee225..4a18aff6578 100644 --- a/lib/libssl/src/crypto/evp/digest.c +++ b/lib/libssl/src/crypto/evp/digest.c @@ -1,4 +1,4 @@ -/* $OpenBSD: digest.c,v 1.23 2014/07/13 11:14:02 miod Exp $ */ +/* $OpenBSD: digest.c,v 1.24 2014/11/09 19:12:18 miod Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -375,3 +375,27 @@ EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx) return 1; } + +int +EVP_MD_CTX_ctrl(EVP_MD_CTX *ctx, int type, int arg, void *ptr) +{ + int ret; + + if (!ctx->digest) { + EVPerr(EVP_F_EVP_MD_CTX_CTRL, EVP_R_NO_CIPHER_SET); + return 0; + } + + if (!ctx->digest->md_ctrl) { + EVPerr(EVP_F_EVP_MD_CTX_CTRL, EVP_R_CTRL_NOT_IMPLEMENTED); + return 0; + } + + ret = ctx->digest->md_ctrl(ctx, type, arg, ptr); + if (ret == -1) { + EVPerr(EVP_F_EVP_MD_CTX_CTRL, + EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED); + return 0; + } + return ret; +} |