botan: Replace deprecated FFI function calls
Several "wrapper" functions have been marked deprecated with 2.11.0.
This commit is contained in:
@@ -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))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user