diff options
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libcrypto/evp/evp.h | 14 | ||||
-rw-r--r-- | src/lib/libcrypto/evp/m_sigver.c | 24 |
2 files changed, 35 insertions, 3 deletions
diff --git a/src/lib/libcrypto/evp/evp.h b/src/lib/libcrypto/evp/evp.h index e8a6eea035..e2ec40b26c 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.81 2021/03/31 16:47:01 tb Exp $ */ | 1 | /* $OpenBSD: evp.h,v 1.82 2021/05/09 14:25:40 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 | * |
@@ -617,7 +617,7 @@ int EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); | |||
617 | #ifndef LIBRESSL_INTERNAL | 617 | #ifndef LIBRESSL_INTERNAL |
618 | int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); | 618 | int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); |
619 | #endif | 619 | #endif |
620 | 620 | ||
621 | int EVP_SignFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s, | 621 | int EVP_SignFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s, |
622 | EVP_PKEY *pkey); | 622 | EVP_PKEY *pkey); |
623 | 623 | ||
@@ -628,11 +628,21 @@ int EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, | |||
628 | const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey); | 628 | const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey); |
629 | int EVP_DigestSignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, size_t *siglen); | 629 | int EVP_DigestSignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, size_t *siglen); |
630 | 630 | ||
631 | #if defined(LIBRESSL_INTERNAL) | ||
632 | int EVP_DigestSign(EVP_MD_CTX *ctx, unsigned char *sigret, size_t *siglen, | ||
633 | const unsigned char *tbs, size_t tbslen); | ||
634 | #endif | ||
635 | |||
631 | int EVP_DigestVerifyInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, | 636 | int EVP_DigestVerifyInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, |
632 | const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey); | 637 | const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey); |
633 | int EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sig, | 638 | int EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sig, |
634 | size_t siglen); | 639 | size_t siglen); |
635 | 640 | ||
641 | #if defined(LIBRESSL_INTERNAL) | ||
642 | int EVP_DigestVerify(EVP_MD_CTX *ctx, const unsigned char *sigret, | ||
643 | size_t siglen, const unsigned char *tbs, size_t tbslen); | ||
644 | #endif | ||
645 | |||
636 | int EVP_OpenInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, | 646 | int EVP_OpenInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, |
637 | const unsigned char *ek, int ekl, const unsigned char *iv, EVP_PKEY *priv); | 647 | const unsigned char *ek, int ekl, const unsigned char *iv, EVP_PKEY *priv); |
638 | int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); | 648 | int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); |
diff --git a/src/lib/libcrypto/evp/m_sigver.c b/src/lib/libcrypto/evp/m_sigver.c index f7dcaff418..bd9374651a 100644 --- a/src/lib/libcrypto/evp/m_sigver.c +++ b/src/lib/libcrypto/evp/m_sigver.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: m_sigver.c,v 1.8 2021/03/29 15:57:23 tb Exp $ */ | 1 | /* $OpenBSD: m_sigver.c,v 1.9 2021/05/09 14:25:40 tb Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2006. | 3 | * project 2006. |
4 | */ | 4 | */ |
@@ -187,6 +187,18 @@ EVP_DigestSignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, size_t *siglen) | |||
187 | } | 187 | } |
188 | 188 | ||
189 | int | 189 | int |
190 | EVP_DigestSign(EVP_MD_CTX *ctx, unsigned char *sigret, size_t *siglen, | ||
191 | const unsigned char *tbs, size_t tbslen) | ||
192 | { | ||
193 | if (sigret != NULL) { | ||
194 | if (EVP_DigestSignUpdate(ctx, tbs, tbslen) <= 0) | ||
195 | return 0; | ||
196 | } | ||
197 | |||
198 | return EVP_DigestSignFinal(ctx, sigret, siglen); | ||
199 | } | ||
200 | |||
201 | int | ||
190 | EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sig, size_t siglen) | 202 | EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sig, size_t siglen) |
191 | { | 203 | { |
192 | EVP_MD_CTX tmp_ctx; | 204 | EVP_MD_CTX tmp_ctx; |
@@ -212,3 +224,13 @@ EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sig, size_t siglen) | |||
212 | return r; | 224 | return r; |
213 | return EVP_PKEY_verify(ctx->pctx, sig, siglen, md, mdlen); | 225 | return EVP_PKEY_verify(ctx->pctx, sig, siglen, md, mdlen); |
214 | } | 226 | } |
227 | |||
228 | int | ||
229 | EVP_DigestVerify(EVP_MD_CTX *ctx, const unsigned char *sigret, size_t siglen, | ||
230 | const unsigned char *tbs, size_t tbslen) | ||
231 | { | ||
232 | if (EVP_DigestVerifyUpdate(ctx, tbs, tbslen) <= 0) | ||
233 | return -1; | ||
234 | |||
235 | return EVP_DigestVerifyFinal(ctx, sigret, siglen); | ||
236 | } | ||