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