diff options
Diffstat (limited to 'src/lib/libcrypto/dsa/dsa_vrf.c')
-rw-r--r-- | src/lib/libcrypto/dsa/dsa_vrf.c | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/src/lib/libcrypto/dsa/dsa_vrf.c b/src/lib/libcrypto/dsa/dsa_vrf.c index 226a75ff3f..c75e423048 100644 --- a/src/lib/libcrypto/dsa/dsa_vrf.c +++ b/src/lib/libcrypto/dsa/dsa_vrf.c | |||
@@ -58,32 +58,27 @@ | |||
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> | ||
61 | #include "cryptlib.h" | 62 | #include "cryptlib.h" |
63 | #include <openssl/bn.h> | ||
62 | #include <openssl/dsa.h> | 64 | #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> | ||
63 | 72 | ||
64 | int DSA_do_verify(const unsigned char *dgst, int dgst_len, DSA_SIG *sig, | 73 | int DSA_do_verify(const unsigned char *dgst, int dgst_len, DSA_SIG *sig, |
65 | DSA *dsa) | 74 | DSA *dsa) |
66 | { | 75 | { |
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 | ||
67 | return dsa->meth->dsa_do_verify(dgst, dgst_len, sig, dsa); | 83 | return dsa->meth->dsa_do_verify(dgst, dgst_len, sig, dsa); |
68 | } | 84 | } |
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 | } | ||