mirror of
https://github.com/strongswan/strongswan.git
synced 2025-10-05 00:00:45 -04:00
botan: Replace deprecated FFI function calls
Several "wrapper" functions have been marked deprecated with 2.11.0.
This commit is contained in:
parent
ab1aa03bf5
commit
6051d9b5e4
@ -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);
|
||||
|
@ -157,8 +157,10 @@ START_TEST(test_gen)
|
||||
privkey = lib->creds->create(lib->creds, CRED_PRIVATE_KEY, KEY_RSA,
|
||||
BUILD_KEY_SIZE, key_sizes[_i], BUILD_END);
|
||||
ck_assert(privkey != NULL);
|
||||
ck_assert_int_eq(key_sizes[_i], privkey->get_keysize(privkey));
|
||||
pubkey = privkey->get_public_key(privkey);
|
||||
ck_assert(pubkey != NULL);
|
||||
ck_assert_int_eq(key_sizes[_i], pubkey->get_keysize(pubkey));
|
||||
|
||||
test_good_sig(privkey, pubkey);
|
||||
|
||||
|
@ -626,8 +626,7 @@ static char *whitelist[] = {
|
||||
"TNC_IMV_NotifyConnectionChange",
|
||||
/* Botan */
|
||||
"botan_public_key_load",
|
||||
"botan_privkey_create_ecdsa",
|
||||
"botan_privkey_create_ecdh",
|
||||
"botan_privkey_create",
|
||||
"botan_privkey_load_ecdh",
|
||||
"botan_privkey_load",
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user