Fixing DSA keys

Generating and writing now works
master
David Lanzendörfer 9 months ago
parent 3d545e766d
commit 0697c23955

@ -833,6 +833,13 @@ pgp_dsa_generate_keypair(pgp_key_t *keydata,
pgp_memory_t *mem;
int res;
const BIGNUM *_p = NULL;
const BIGNUM *_q = NULL;
const BIGNUM *_g = NULL;
const BIGNUM *_y = NULL;
const BIGNUM *_x = NULL;
ctx = BN_CTX_new();
pgp_keydata_init(keydata, PGP_PTAG_CT_SECRET_KEY);
seckey = pgp_get_writable_seckey(keydata);
@ -853,10 +860,10 @@ pgp_dsa_generate_keypair(pgp_key_t *keydata,
seckey->pubkey.days_valid = 0;
seckey->pubkey.alg = PGP_PKA_DSA;
seckey->pubkey.key.dsa.p = (BIGNUM *)DSA_get0_p(dsa);
seckey->pubkey.key.dsa.q = (BIGNUM *)DSA_get0_q(dsa);
seckey->pubkey.key.dsa.g = (BIGNUM *)DSA_get0_g(dsa);
seckey->pubkey.key.dsa.y = (BIGNUM *)DSA_get0_pub_key(dsa);
_p = (BIGNUM *)DSA_get0_p(dsa);
_q = (BIGNUM *)DSA_get0_q(dsa);
_g = (BIGNUM *)DSA_get0_g(dsa);
_y = (BIGNUM *)DSA_get0_pub_key(dsa);
/* seckey->s2k_usage = PGP_S2KU_ENCRYPTED_AND_HASHED; */
seckey->s2k_usage = PGP_S2KU_NONE;
@ -869,7 +876,13 @@ pgp_dsa_generate_keypair(pgp_key_t *keydata,
seckey->octetc = 0;
seckey->checksum = 0;
seckey->key.dsa.x = (BIGNUM *)DSA_get0_priv_key(dsa);
_x = (BIGNUM *)DSA_get0_priv_key(dsa);
seckey->pubkey.key.dsa.p = BN_dup(_p);
seckey->pubkey.key.dsa.q = BN_dup(_q);
seckey->pubkey.key.dsa.g = BN_dup(_g);
seckey->pubkey.key.dsa.y = BN_dup(_y);
seckey->key.dsa.x = BN_dup(_x);
BN_CTX_free(ctx);

Loading…
Cancel
Save