diff options
Diffstat (limited to 'src/lib/libcrypto/dsa/dsa_sign.c')
-rw-r--r-- | src/lib/libcrypto/dsa/dsa_sign.c | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/src/lib/libcrypto/dsa/dsa_sign.c b/src/lib/libcrypto/dsa/dsa_sign.c index 4cfbbe57a8..89205026f0 100644 --- a/src/lib/libcrypto/dsa/dsa_sign.c +++ b/src/lib/libcrypto/dsa/dsa_sign.c | |||
@@ -64,32 +64,29 @@ | |||
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 | 67 | ||
72 | DSA_SIG * DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa) | 68 | DSA_SIG * DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa) |
73 | { | 69 | { |
74 | #ifdef OPENSSL_FIPS | ||
75 | if(FIPS_mode() && !(dsa->flags & DSA_FLAG_NON_FIPS_ALLOW)) | ||
76 | { | ||
77 | DSAerr(DSA_F_DSA_DO_SIGN, DSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE); | ||
78 | return NULL; | ||
79 | } | ||
80 | #endif | ||
81 | return dsa->meth->dsa_do_sign(dgst, dlen, dsa); | 70 | return dsa->meth->dsa_do_sign(dgst, dlen, dsa); |
82 | } | 71 | } |
83 | 72 | ||
84 | int DSA_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp) | 73 | int DSA_sign(int type, const unsigned char *dgst, int dlen, unsigned char *sig, |
74 | unsigned int *siglen, DSA *dsa) | ||
85 | { | 75 | { |
86 | #ifdef OPENSSL_FIPS | 76 | DSA_SIG *s; |
87 | if(FIPS_mode() && !(dsa->flags & DSA_FLAG_NON_FIPS_ALLOW)) | 77 | s=DSA_do_sign(dgst,dlen,dsa); |
78 | if (s == NULL) | ||
88 | { | 79 | { |
89 | DSAerr(DSA_F_DSA_SIGN_SETUP, DSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE); | 80 | *siglen=0; |
90 | return 0; | 81 | return(0); |
91 | } | 82 | } |
92 | #endif | 83 | *siglen=i2d_DSA_SIG(s,&sig); |
84 | DSA_SIG_free(s); | ||
85 | return(1); | ||
86 | } | ||
87 | |||
88 | int DSA_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp) | ||
89 | { | ||
93 | return dsa->meth->dsa_sign_setup(dsa, ctx_in, kinvp, rp); | 90 | return dsa->meth->dsa_sign_setup(dsa, ctx_in, kinvp, rp); |
94 | } | 91 | } |
95 | 92 | ||