diff options
author | djm <> | 2010-10-01 22:54:21 +0000 |
---|---|---|
committer | djm <> | 2010-10-01 22:54:21 +0000 |
commit | 829fd51d4f8dde4a7f3bf54754f3c1d1a502f5e2 (patch) | |
tree | e03b9f1bd051e844b971936729e9df549a209130 /src/lib/libcrypto/dsa/dsa_vrf.c | |
parent | e6b755d2a53d3cac7a344dfdd6bf7c951cac754c (diff) | |
download | openbsd-829fd51d4f8dde4a7f3bf54754f3c1d1a502f5e2.tar.gz openbsd-829fd51d4f8dde4a7f3bf54754f3c1d1a502f5e2.tar.bz2 openbsd-829fd51d4f8dde4a7f3bf54754f3c1d1a502f5e2.zip |
import OpenSSL-1.0.0a
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 | } | ||