summaryrefslogtreecommitdiffstats
path: root/lib/libssl
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2014-11-09 19:12:16 +0000
committermiod <miod@openbsd.org>2014-11-09 19:12:16 +0000
commitb40b93b26ccf799c3dfa7cf18fff743cdb37142a (patch)
treec096a7483548b4748bde6865b7de2038a49a577c /lib/libssl
parentAllow digest routines to provide their own HASH_FINAL routine; will be (diff)
downloadwireguard-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.c26
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;
+}