Loading crypto/dsa/Makefile +5 −11 Original line number Diff line number Diff line Loading @@ -142,17 +142,11 @@ dsa_lib.o: ../../e_os.h ../../include/openssl/asn1.h dsa_lib.o: ../../include/openssl/bio.h ../../include/openssl/bn.h dsa_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h dsa_lib.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h dsa_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h dsa_lib.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h dsa_lib.o: ../../include/openssl/engine.h ../../include/openssl/err.h dsa_lib.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h dsa_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h dsa_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h dsa_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h dsa_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h dsa_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h dsa_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h dsa_lib.o: ../cryptlib.h dsa_lib.c dsa_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h dsa_lib.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h dsa_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h dsa_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h dsa_lib.o: ../../include/openssl/symhacks.h ../cryptlib.h dsa_lib.c dsa_ossl.o: ../../e_os.h ../../include/openssl/asn1.h dsa_ossl.o: ../../include/openssl/bio.h ../../include/openssl/bn.h dsa_ossl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h Loading crypto/dsa/dsa_asn1.c +39 −1 Original line number Diff line number Diff line Loading @@ -61,6 +61,7 @@ #include <openssl/dsa.h> #include <openssl/asn1.h> #include <openssl/asn1t.h> #include <openssl/rand.h> /* Override the default new methods */ static int sig_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, Loading @@ -87,7 +88,7 @@ ASN1_SEQUENCE_cb(DSA_SIG, sig_cb) = { ASN1_SIMPLE(DSA_SIG, s, CBIGNUM) } ASN1_SEQUENCE_END_cb(DSA_SIG, DSA_SIG) IMPLEMENT_ASN1_FUNCTIONS_const(DSA_SIG) IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(DSA_SIG, DSA_SIG, DSA_SIG) /* Override the default free and new methods */ static int dsa_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, Loading Loading @@ -148,3 +149,40 @@ DSA *DSAparams_dup(DSA *dsa) { return ASN1_item_dup(ASN1_ITEM_rptr(DSAparams), dsa); } int DSA_sign(int type, const unsigned char *dgst, int dlen, unsigned char *sig, unsigned int *siglen, DSA *dsa) { DSA_SIG *s; RAND_seed(dgst, dlen); s=DSA_do_sign(dgst,dlen,dsa); if (s == NULL) { *siglen=0; return(0); } *siglen=i2d_DSA_SIG(s,&sig); DSA_SIG_free(s); return(1); } /* data has already been hashed (probably with SHA or SHA-1). */ /* returns * 1: correct signature * 0: incorrect signature * -1: error */ int DSA_verify(int type, const unsigned char *dgst, int dgst_len, const unsigned char *sigbuf, int siglen, DSA *dsa) { DSA_SIG *s; int ret=-1; s = DSA_SIG_new(); if (s == NULL) return(ret); if (d2i_DSA_SIG(&s,&sigbuf,siglen) == NULL) goto err; ret=DSA_do_verify(dgst,dgst_len,s,dsa); err: DSA_SIG_free(s); return(ret); } crypto/dsa/dsa_sign.c +23 −15 Original line number Diff line number Diff line Loading @@ -61,30 +61,38 @@ #include "cryptlib.h" #include <openssl/dsa.h> #include <openssl/rand.h> #include <openssl/bn.h> DSA_SIG * DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa) { return dsa->meth->dsa_do_sign(dgst, dlen, dsa); } int DSA_sign(int type, const unsigned char *dgst, int dlen, unsigned char *sig, unsigned int *siglen, DSA *dsa) { DSA_SIG *s; RAND_seed(dgst, dlen); s=DSA_do_sign(dgst,dlen,dsa); if (s == NULL) int DSA_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp) { *siglen=0; return(0); return dsa->meth->dsa_sign_setup(dsa, ctx_in, kinvp, rp); } *siglen=i2d_DSA_SIG(s,&sig); DSA_SIG_free(s); return(1); DSA_SIG *DSA_SIG_new(void) { DSA_SIG *sig; sig = OPENSSL_malloc(sizeof(DSA_SIG)); if (!sig) return NULL; sig->r = NULL; sig->s = NULL; return sig; } int DSA_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp) void DSA_SIG_free(DSA_SIG *sig) { return dsa->meth->dsa_sign_setup(dsa, ctx_in, kinvp, rp); if (sig) { if (sig->r) BN_free(sig->r); if (sig->s) BN_free(sig->s); OPENSSL_free(sig); } } crypto/dsa/dsa_vrf.c +0 −21 Original line number Diff line number Diff line Loading @@ -66,24 +66,3 @@ int DSA_do_verify(const unsigned char *dgst, int dgst_len, DSA_SIG *sig, { return dsa->meth->dsa_do_verify(dgst, dgst_len, sig, dsa); } /* data has already been hashed (probably with SHA or SHA-1). */ /* returns * 1: correct signature * 0: incorrect signature * -1: error */ int DSA_verify(int type, const unsigned char *dgst, int dgst_len, const unsigned char *sigbuf, int siglen, DSA *dsa) { DSA_SIG *s; int ret=-1; s = DSA_SIG_new(); if (s == NULL) return(ret); if (d2i_DSA_SIG(&s,&sigbuf,siglen) == NULL) goto err; ret=DSA_do_verify(dgst,dgst_len,s,dsa); err: DSA_SIG_free(s); return(ret); } Loading
crypto/dsa/Makefile +5 −11 Original line number Diff line number Diff line Loading @@ -142,17 +142,11 @@ dsa_lib.o: ../../e_os.h ../../include/openssl/asn1.h dsa_lib.o: ../../include/openssl/bio.h ../../include/openssl/bn.h dsa_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h dsa_lib.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h dsa_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h dsa_lib.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h dsa_lib.o: ../../include/openssl/engine.h ../../include/openssl/err.h dsa_lib.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h dsa_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h dsa_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h dsa_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h dsa_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h dsa_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h dsa_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h dsa_lib.o: ../cryptlib.h dsa_lib.c dsa_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h dsa_lib.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h dsa_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h dsa_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h dsa_lib.o: ../../include/openssl/symhacks.h ../cryptlib.h dsa_lib.c dsa_ossl.o: ../../e_os.h ../../include/openssl/asn1.h dsa_ossl.o: ../../include/openssl/bio.h ../../include/openssl/bn.h dsa_ossl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h Loading
crypto/dsa/dsa_asn1.c +39 −1 Original line number Diff line number Diff line Loading @@ -61,6 +61,7 @@ #include <openssl/dsa.h> #include <openssl/asn1.h> #include <openssl/asn1t.h> #include <openssl/rand.h> /* Override the default new methods */ static int sig_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, Loading @@ -87,7 +88,7 @@ ASN1_SEQUENCE_cb(DSA_SIG, sig_cb) = { ASN1_SIMPLE(DSA_SIG, s, CBIGNUM) } ASN1_SEQUENCE_END_cb(DSA_SIG, DSA_SIG) IMPLEMENT_ASN1_FUNCTIONS_const(DSA_SIG) IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(DSA_SIG, DSA_SIG, DSA_SIG) /* Override the default free and new methods */ static int dsa_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, Loading Loading @@ -148,3 +149,40 @@ DSA *DSAparams_dup(DSA *dsa) { return ASN1_item_dup(ASN1_ITEM_rptr(DSAparams), dsa); } int DSA_sign(int type, const unsigned char *dgst, int dlen, unsigned char *sig, unsigned int *siglen, DSA *dsa) { DSA_SIG *s; RAND_seed(dgst, dlen); s=DSA_do_sign(dgst,dlen,dsa); if (s == NULL) { *siglen=0; return(0); } *siglen=i2d_DSA_SIG(s,&sig); DSA_SIG_free(s); return(1); } /* data has already been hashed (probably with SHA or SHA-1). */ /* returns * 1: correct signature * 0: incorrect signature * -1: error */ int DSA_verify(int type, const unsigned char *dgst, int dgst_len, const unsigned char *sigbuf, int siglen, DSA *dsa) { DSA_SIG *s; int ret=-1; s = DSA_SIG_new(); if (s == NULL) return(ret); if (d2i_DSA_SIG(&s,&sigbuf,siglen) == NULL) goto err; ret=DSA_do_verify(dgst,dgst_len,s,dsa); err: DSA_SIG_free(s); return(ret); }
crypto/dsa/dsa_sign.c +23 −15 Original line number Diff line number Diff line Loading @@ -61,30 +61,38 @@ #include "cryptlib.h" #include <openssl/dsa.h> #include <openssl/rand.h> #include <openssl/bn.h> DSA_SIG * DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa) { return dsa->meth->dsa_do_sign(dgst, dlen, dsa); } int DSA_sign(int type, const unsigned char *dgst, int dlen, unsigned char *sig, unsigned int *siglen, DSA *dsa) { DSA_SIG *s; RAND_seed(dgst, dlen); s=DSA_do_sign(dgst,dlen,dsa); if (s == NULL) int DSA_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp) { *siglen=0; return(0); return dsa->meth->dsa_sign_setup(dsa, ctx_in, kinvp, rp); } *siglen=i2d_DSA_SIG(s,&sig); DSA_SIG_free(s); return(1); DSA_SIG *DSA_SIG_new(void) { DSA_SIG *sig; sig = OPENSSL_malloc(sizeof(DSA_SIG)); if (!sig) return NULL; sig->r = NULL; sig->s = NULL; return sig; } int DSA_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp) void DSA_SIG_free(DSA_SIG *sig) { return dsa->meth->dsa_sign_setup(dsa, ctx_in, kinvp, rp); if (sig) { if (sig->r) BN_free(sig->r); if (sig->s) BN_free(sig->s); OPENSSL_free(sig); } }
crypto/dsa/dsa_vrf.c +0 −21 Original line number Diff line number Diff line Loading @@ -66,24 +66,3 @@ int DSA_do_verify(const unsigned char *dgst, int dgst_len, DSA_SIG *sig, { return dsa->meth->dsa_do_verify(dgst, dgst_len, sig, dsa); } /* data has already been hashed (probably with SHA or SHA-1). */ /* returns * 1: correct signature * 0: incorrect signature * -1: error */ int DSA_verify(int type, const unsigned char *dgst, int dgst_len, const unsigned char *sigbuf, int siglen, DSA *dsa) { DSA_SIG *s; int ret=-1; s = DSA_SIG_new(); if (s == NULL) return(ret); if (d2i_DSA_SIG(&s,&sigbuf,siglen) == NULL) goto err; ret=DSA_do_verify(dgst,dgst_len,s,dsa); err: DSA_SIG_free(s); return(ret); }