mirror of
https://github.com/systemd/systemd.git
synced 2025-03-25 18:50:18 +03:00
openssl-util: use EVP API to get RSA bits
This commit is contained in:
parent
18f568b8e6
commit
7f12adc300
@ -46,7 +46,6 @@ int rsa_pkey_to_suitable_key_size(
|
||||
size_t *ret_suitable_key_size) {
|
||||
|
||||
size_t suitable_key_size;
|
||||
const RSA *rsa;
|
||||
int bits;
|
||||
|
||||
assert_se(pkey);
|
||||
@ -58,11 +57,7 @@ int rsa_pkey_to_suitable_key_size(
|
||||
if (EVP_PKEY_base_id(pkey) != EVP_PKEY_RSA)
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(EBADMSG), "X.509 certificate does not refer to RSA key.");
|
||||
|
||||
rsa = EVP_PKEY_get0_RSA(pkey);
|
||||
if (!rsa)
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(EIO), "Failed to acquire RSA public key from X.509 certificate.");
|
||||
|
||||
bits = RSA_bits(rsa);
|
||||
bits = EVP_PKEY_bits(pkey);
|
||||
log_debug("Bits in RSA key: %i", bits);
|
||||
|
||||
/* We use PKCS#1 padding for the RSA cleartext, hence let's leave some extra space for it, hence only
|
||||
|
Loading…
x
Reference in New Issue
Block a user