botan: Replace deprecated FFI function calls

Several "wrapper" functions have been marked deprecated with 2.11.0.
This commit is contained in:
Tobias Brunner
2019-07-02 11:35:21 +02:00
parent ab1aa03bf5
commit 6051d9b5e4
7 changed files with 14 additions and 10 deletions
@@ -211,7 +211,7 @@ botan_ec_diffie_hellman_t *botan_ec_diffie_hellman_create(
return NULL;
}
if (botan_privkey_create_ecdh(&this->key, rng, this->curve_name))
if (botan_privkey_create(&this->key, "ECDH", this->curve_name, rng))
{
DBG1(DBG_LIB, "ECDH private key generation failed");
botan_rng_destroy(rng);
@@ -336,7 +336,7 @@ botan_ec_private_key_t *botan_ec_private_key_gen(key_type_t type, va_list args)
this = create_empty(oid);
if (botan_privkey_create_ecdsa(&this->key, rng, curve))
if (botan_privkey_create(&this->key, "ECDSA", curve, rng))
{
DBG1(DBG_LIB, "EC private key generation failed");
botan_rng_destroy(rng);
@@ -225,7 +225,7 @@ METHOD(private_key_t, get_keysize, int,
return 0;
}
if (botan_privkey_rsa_get_n(n, this->key) ||
if (botan_privkey_get_field(n, this->key, "n") ||
botan_mp_num_bits(n, &bits))
{
botan_mp_destroy(n);
@@ -346,6 +346,7 @@ botan_rsa_private_key_t *botan_rsa_private_key_gen(key_type_t type,
{
private_botan_rsa_private_key_t *this;
botan_rng_t rng;
char buf[BUF_LEN];
u_int key_size = 0;
while (TRUE)
@@ -375,7 +376,9 @@ botan_rsa_private_key_t *botan_rsa_private_key_gen(key_type_t type,
this = create_empty();
if (botan_privkey_create_rsa(&this->key, rng, key_size))
snprintf(buf, sizeof(buf), "%u", key_size);
if (botan_privkey_create(&this->key, "RSA", buf, rng))
{
botan_rng_destroy(rng);
free(this);
@@ -412,7 +415,7 @@ static bool calculate_pq(botan_mp_t *n, botan_mp_t *e, botan_mp_t *d,
}
/* k must be even */
if (!botan_mp_is_even(k))
if (botan_mp_get_bit(k, 0) != 0)
{
goto error;
}
@@ -424,7 +427,7 @@ static bool calculate_pq(botan_mp_t *n, botan_mp_t *e, botan_mp_t *d,
goto error;
}
for (t = 0; !botan_mp_is_odd(r); t++)
for (t = 0; botan_mp_get_bit(r, 0) != 1; t++)
{
if (botan_mp_rshift(r, r, 1))
{
@@ -215,7 +215,7 @@ METHOD(public_key_t, get_keysize, int,
return 0;
}
if (botan_pubkey_rsa_get_n(n, this->key) ||
if (botan_pubkey_get_field(n, this->key, "n") ||
botan_mp_num_bits(n, &bits))
{
botan_mp_destroy(n);
@@ -161,7 +161,7 @@ diffie_hellman_t *botan_x25519_create(diffie_hellman_group_t group)
return NULL;
}
if (botan_privkey_create_ecdh(&this->key, rng, "curve25519"))
if (botan_privkey_create(&this->key, "Curve25519", "", rng))
{
DBG1(DBG_LIB, "x25519 private key generation failed");
botan_rng_destroy(rng);