X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=crypto%2Fdsa%2Fdsa.h;h=6b5a24149ed8f232ebdd4065154da221fea50dcf;hb=6f7af1524ea4a0eb9bcd0596075cef4bcaf887b1;hp=d9ff1933ee2e139591b61e71a7a80a39f6c8349f;hpb=f5d7a031a3c3e7b1700a67d6dc19daf3718ce6ee;p=oweals%2Fopenssl.git diff --git a/crypto/dsa/dsa.h b/crypto/dsa/dsa.h index d9ff1933ee..6b5a24149e 100644 --- a/crypto/dsa/dsa.h +++ b/crypto/dsa/dsa.h @@ -74,10 +74,41 @@ extern "C" { #endif #include +#include +#ifndef NO_DH +# include +#endif #define DSA_FLAG_CACHE_MONT_P 0x01 -typedef struct dsa_st +typedef struct dsa_st DSA; + +typedef struct DSA_SIG_st + { + BIGNUM *r; + BIGNUM *s; + } DSA_SIG; + +typedef struct dsa_method { + const char *name; + DSA_SIG * (*dsa_do_sign)(const unsigned char *dgst, int dlen, DSA *dsa); + int (*dsa_sign_setup)(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, + BIGNUM **rp); + int (*dsa_do_verify)(const unsigned char *dgst, int dgst_len, + DSA_SIG *sig, DSA *dsa); + int (*dsa_mod_exp)(DSA *dsa, BIGNUM *rr, BIGNUM *a1, BIGNUM *p1, + BIGNUM *a2, BIGNUM *p2, BIGNUM *m, BN_CTX *ctx, + BN_MONT_CTX *in_mont); + int (*bn_mod_exp)(DSA *dsa, BIGNUM *r, BIGNUM *a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx, + BN_MONT_CTX *m_ctx); /* Can be null */ + int (*init)(DSA *dsa); + int (*finish)(DSA *dsa); + int flags; + char *app_data; +} DSA_METHOD; + +struct dsa_st { /* This first variable is used to pick up errors where * a DSA is passed instead of of a EVP_PKEY */ @@ -97,15 +128,10 @@ typedef struct dsa_st int flags; /* Normally used to cache montgomery values */ char *method_mont_p; - int references; - } DSA; - -typedef struct DSA_SIG_st - { - BIGNUM *r; - BIGNUM *s; - } DSA_SIG; + CRYPTO_EX_DATA ex_data; + DSA_METHOD *meth; + }; #define DSAparams_dup(x) (DSA *)ASN1_dup((int (*)())i2d_DSAparams, \ (char *(*)())d2i_DSAparams,(char *)(x)) @@ -128,7 +154,10 @@ DSA_SIG * DSA_do_sign(const unsigned char *dgst,int dlen,DSA *dsa); int DSA_do_verify(const unsigned char *dgst,int dgst_len, DSA_SIG *sig,DSA *dsa); +DSA_METHOD *DSA_OpenSSL(void); + DSA * DSA_new(void); +DSA * DSA_new_method(DSA_METHOD *meth); int DSA_size(DSA *); /* next 4 return -1 on error */ int DSA_sign_setup( DSA *dsa,BN_CTX *ctx_in,BIGNUM **kinvp,BIGNUM **rp); @@ -137,6 +166,10 @@ int DSA_sign(int type,const unsigned char *dgst,int dlen, int DSA_verify(int type,const unsigned char *dgst,int dgst_len, unsigned char *sigbuf, int siglen, DSA *dsa); void DSA_free (DSA *r); +int DSA_get_ex_new_index(long argl, char *argp, int (*new_func)(), + int (*dup_func)(), void (*free_func)()); +int DSA_set_ex_data(DSA *d, int idx, char *arg); +char *DSA_get_ex_data(DSA *d, int idx); void ERR_load_DSA_strings(void ); @@ -162,6 +195,12 @@ int DSA_print_fp(FILE *bp, DSA *x, int off); int DSA_is_prime(BIGNUM *q,void (*callback)(),char *cb_arg); +#ifndef NO_DH +/* Convert DSA structure (key or just parameters) into DH structure + * (be careful to avoid small subgroup attacks when using this!) */ +DH *DSA_dup_DH(DSA *r); +#endif + /* BEGIN ERROR CODES */ /* The following lines are auto generated by the script mkerr.pl. Any changes * made after this point may be overwritten when the script is next run.