Index: openssl/crypto/dsa/dsa_sign.c |
=================================================================== |
--- openssl/crypto/dsa/dsa_sign.c (revision 105093) |
+++ openssl/crypto/dsa/dsa_sign.c (working copy) |
@@ -58,38 +58,33 @@ |
/* Original version from Steven Schoch <schoch@sheba.arc.nasa.gov> */ |
-#include <stdio.h> |
#include "cryptlib.h" |
-#include <openssl/bn.h> |
#include <openssl/dsa.h> |
#include <openssl/rand.h> |
-#include <openssl/asn1.h> |
-#ifdef OPENSSL_FIPS |
-#include <openssl/fips.h> |
-#endif |
- |
DSA_SIG * DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa) |
{ |
-#ifdef OPENSSL_FIPS |
- if(FIPS_mode() && !(dsa->flags & DSA_FLAG_NON_FIPS_ALLOW)) |
- { |
- DSAerr(DSA_F_DSA_DO_SIGN, DSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE); |
- return NULL; |
- } |
-#endif |
return dsa->meth->dsa_do_sign(dgst, dlen, dsa); |
} |
-int DSA_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp) |
+int DSA_sign(int type, const unsigned char *dgst, int dlen, unsigned char *sig, |
+ unsigned int *siglen, DSA *dsa) |
{ |
-#ifdef OPENSSL_FIPS |
- if(FIPS_mode() && !(dsa->flags & DSA_FLAG_NON_FIPS_ALLOW)) |
+ DSA_SIG *s; |
+ RAND_seed(dgst, dlen); |
+ s=DSA_do_sign(dgst,dlen,dsa); |
+ if (s == NULL) |
{ |
- DSAerr(DSA_F_DSA_SIGN_SETUP, DSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE); |
- return 0; |
+ *siglen=0; |
+ return(0); |
} |
-#endif |
+ *siglen=i2d_DSA_SIG(s,&sig); |
+ DSA_SIG_free(s); |
+ return(1); |
+ } |
+ |
+int DSA_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp) |
+ { |
return dsa->meth->dsa_sign_setup(dsa, ctx_in, kinvp, rp); |
} |