diff options
| author | djm <> | 2010-10-01 22:59:01 +0000 |
|---|---|---|
| committer | djm <> | 2010-10-01 22:59:01 +0000 |
| commit | 8922d4bc4a8b8893d72a48deb2cdf58215f98505 (patch) | |
| tree | 939b752540947d33507b3acc48d76a8bfb7c3dc3 /src/lib/libcrypto/dsa/dsa_vrf.c | |
| parent | 76262f7bf9262f965142b1b2b2105cb279c5c696 (diff) | |
| download | openbsd-8922d4bc4a8b8893d72a48deb2cdf58215f98505.tar.gz openbsd-8922d4bc4a8b8893d72a48deb2cdf58215f98505.tar.bz2 openbsd-8922d4bc4a8b8893d72a48deb2cdf58215f98505.zip | |
resolve conflicts, fix local changes
Diffstat (limited to 'src/lib/libcrypto/dsa/dsa_vrf.c')
| -rw-r--r-- | src/lib/libcrypto/dsa/dsa_vrf.c | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/src/lib/libcrypto/dsa/dsa_vrf.c b/src/lib/libcrypto/dsa/dsa_vrf.c index c75e423048..226a75ff3f 100644 --- a/src/lib/libcrypto/dsa/dsa_vrf.c +++ b/src/lib/libcrypto/dsa/dsa_vrf.c | |||
| @@ -58,27 +58,32 @@ | |||
| 58 | 58 | ||
| 59 | /* Original version from Steven Schoch <schoch@sheba.arc.nasa.gov> */ | 59 | /* Original version from Steven Schoch <schoch@sheba.arc.nasa.gov> */ |
| 60 | 60 | ||
| 61 | #include <stdio.h> | ||
| 62 | #include "cryptlib.h" | 61 | #include "cryptlib.h" |
| 63 | #include <openssl/bn.h> | ||
| 64 | #include <openssl/dsa.h> | 62 | #include <openssl/dsa.h> |
| 65 | #include <openssl/rand.h> | ||
| 66 | #include <openssl/asn1.h> | ||
| 67 | #ifdef OPENSSL_FIPS | ||
| 68 | #include <openssl/fips.h> | ||
| 69 | #endif | ||
| 70 | |||
| 71 | #include <openssl/asn1_mac.h> | ||
| 72 | 63 | ||
| 73 | int DSA_do_verify(const unsigned char *dgst, int dgst_len, DSA_SIG *sig, | 64 | int DSA_do_verify(const unsigned char *dgst, int dgst_len, DSA_SIG *sig, |
| 74 | DSA *dsa) | 65 | DSA *dsa) |
| 75 | { | 66 | { |
| 76 | #ifdef OPENSSL_FIPS | ||
| 77 | if(FIPS_mode() && !(dsa->flags & DSA_FLAG_NON_FIPS_ALLOW)) | ||
| 78 | { | ||
| 79 | DSAerr(DSA_F_DSA_DO_VERIFY, DSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE); | ||
| 80 | return 0; | ||
| 81 | } | ||
| 82 | #endif | ||
| 83 | return dsa->meth->dsa_do_verify(dgst, dgst_len, sig, dsa); | 67 | return dsa->meth->dsa_do_verify(dgst, dgst_len, sig, dsa); |
| 84 | } | 68 | } |
| 69 | |||
| 70 | /* data has already been hashed (probably with SHA or SHA-1). */ | ||
| 71 | /* returns | ||
| 72 | * 1: correct signature | ||
| 73 | * 0: incorrect signature | ||
| 74 | * -1: error | ||
| 75 | */ | ||
| 76 | int DSA_verify(int type, const unsigned char *dgst, int dgst_len, | ||
| 77 | const unsigned char *sigbuf, int siglen, DSA *dsa) | ||
| 78 | { | ||
| 79 | DSA_SIG *s; | ||
| 80 | int ret=-1; | ||
| 81 | |||
| 82 | s = DSA_SIG_new(); | ||
| 83 | if (s == NULL) return(ret); | ||
| 84 | if (d2i_DSA_SIG(&s,&sigbuf,siglen) == NULL) goto err; | ||
| 85 | ret=DSA_do_verify(dgst,dgst_len,s,dsa); | ||
| 86 | err: | ||
| 87 | DSA_SIG_free(s); | ||
| 88 | return(ret); | ||
| 89 | } | ||
