gmp uses component builder to build public- from private-key

This commit is contained in:
Martin Willi
2009-08-26 11:23:51 +02:00
parent 8380503168
commit 831520d895
2 changed files with 37 additions and 47 deletions
@@ -568,26 +568,6 @@ bool gmp_rsa_public_key_build_id(mpz_t n, mpz_t e, identification_t **keyid,
return TRUE;
}
/**
* Create a public key from mpz values, used in gmp_rsa_private_key
*/
gmp_rsa_public_key_t *gmp_rsa_public_key_create_from_n_e(mpz_t n, mpz_t e)
{
private_gmp_rsa_public_key_t *this = gmp_rsa_public_key_create_empty();
mpz_init_set(this->n, n);
mpz_init_set(this->e, e);
this->k = (mpz_sizeinbase(this->n, 2) + 7) / BITS_PER_BYTE;
if (!gmp_rsa_public_key_build_id(this->n, this->e,
&this->keyid, &this->keyid_info))
{
destroy(this);
return NULL;
}
return &this->public;
}
/**
* Load a public key from n and e
*/