Lines Matching refs:dsa
1 /* crypto/dsa/dsa_key.c */
64 #include <openssl/dsa.h>
68 int DSA_generate_key(DSA *dsa)
76 if (dsa->priv_key == NULL)
81 priv_key=dsa->priv_key;
84 if (!BN_rand_range(priv_key,dsa->q)) goto err;
87 if (dsa->pub_key == NULL)
92 pub_key=dsa->pub_key;
94 if (!BN_mod_exp(pub_key,dsa->g,priv_key,dsa->p,ctx)) goto err;
96 dsa->priv_key=priv_key;
97 dsa->pub_key=pub_key;
101 if ((pub_key != NULL) && (dsa->pub_key == NULL)) BN_free(pub_key);
102 if ((priv_key != NULL) && (dsa->priv_key == NULL)) BN_free(priv_key);