~ubuntu-branches/ubuntu/lucid/openssl/lucid-proposed

« back to all changes in this revision

Viewing changes to crypto/dsa/dsa_sign.c

  • Committer: Bazaar Package Importer
  • Author(s): Kurt Roeckx
  • Date: 2009-06-13 18:15:46 UTC
  • mto: (11.1.5 squeeze)
  • mto: This revision was merged to the branch mainline in revision 34.
  • Revision ID: james.westby@ubuntu.com-20090613181546-vbfntai3b009dl1u
Tags: upstream-0.9.8k
ImportĀ upstreamĀ versionĀ 0.9.8k

Show diffs side-by-side

added added

removed removed

Lines of Context:
64
64
#include <openssl/dsa.h>
65
65
#include <openssl/rand.h>
66
66
#include <openssl/asn1.h>
 
67
#ifdef OPENSSL_FIPS
 
68
#include <openssl/fips.h>
 
69
#endif
 
70
 
67
71
 
68
72
DSA_SIG * DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa)
69
73
        {
 
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
70
81
        return dsa->meth->dsa_do_sign(dgst, dlen, dsa);
71
82
        }
72
83
 
73
 
int DSA_sign(int type, const unsigned char *dgst, int dlen, unsigned char *sig,
74
 
             unsigned int *siglen, DSA *dsa)
75
 
        {
76
 
        DSA_SIG *s;
77
 
        s=DSA_do_sign(dgst,dlen,dsa);
78
 
        if (s == NULL)
79
 
                {
80
 
                *siglen=0;
81
 
                return(0);
82
 
                }
83
 
        *siglen=i2d_DSA_SIG(s,&sig);
84
 
        DSA_SIG_free(s);
85
 
        return(1);
86
 
        }
87
 
 
88
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
93
        return dsa->meth->dsa_sign_setup(dsa, ctx_in, kinvp, rp);
91
94
        }
92
95