diff options
Diffstat (limited to 'src/lib/libcrypto/dsa/dsa_vrf.c')
-rw-r--r-- | src/lib/libcrypto/dsa/dsa_vrf.c | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/src/lib/libcrypto/dsa/dsa_vrf.c b/src/lib/libcrypto/dsa/dsa_vrf.c index c75e423048..c4aeddd056 100644 --- a/src/lib/libcrypto/dsa/dsa_vrf.c +++ b/src/lib/libcrypto/dsa/dsa_vrf.c | |||
@@ -64,21 +64,31 @@ | |||
64 | #include <openssl/dsa.h> | 64 | #include <openssl/dsa.h> |
65 | #include <openssl/rand.h> | 65 | #include <openssl/rand.h> |
66 | #include <openssl/asn1.h> | 66 | #include <openssl/asn1.h> |
67 | #ifdef OPENSSL_FIPS | ||
68 | #include <openssl/fips.h> | ||
69 | #endif | ||
70 | |||
71 | #include <openssl/asn1_mac.h> | 67 | #include <openssl/asn1_mac.h> |
72 | 68 | ||
73 | int DSA_do_verify(const unsigned char *dgst, int dgst_len, DSA_SIG *sig, | 69 | int DSA_do_verify(const unsigned char *dgst, int dgst_len, DSA_SIG *sig, |
74 | DSA *dsa) | 70 | DSA *dsa) |
75 | { | 71 | { |
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); | 72 | return dsa->meth->dsa_do_verify(dgst, dgst_len, sig, dsa); |
84 | } | 73 | } |
74 | |||
75 | /* data has already been hashed (probably with SHA or SHA-1). */ | ||
76 | /* returns | ||
77 | * 1: correct signature | ||
78 | * 0: incorrect signature | ||
79 | * -1: error | ||
80 | */ | ||
81 | int DSA_verify(int type, const unsigned char *dgst, int dgst_len, | ||
82 | const unsigned char *sigbuf, int siglen, DSA *dsa) | ||
83 | { | ||
84 | DSA_SIG *s; | ||
85 | int ret=-1; | ||
86 | |||
87 | s = DSA_SIG_new(); | ||
88 | if (s == NULL) return(ret); | ||
89 | if (d2i_DSA_SIG(&s,&sigbuf,siglen) == NULL) goto err; | ||
90 | ret=DSA_do_verify(dgst,dgst_len,s,dsa); | ||
91 | err: | ||
92 | DSA_SIG_free(s); | ||
93 | return(ret); | ||
94 | } | ||