diff options
Diffstat (limited to 'src/lib/ffi/ffi_pkey_algs.cpp')
-rw-r--r-- | src/lib/ffi/ffi_pkey_algs.cpp | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/lib/ffi/ffi_pkey_algs.cpp b/src/lib/ffi/ffi_pkey_algs.cpp index 46c7e28d5..d9388afee 100644 --- a/src/lib/ffi/ffi_pkey_algs.cpp +++ b/src/lib/ffi/ffi_pkey_algs.cpp @@ -285,17 +285,16 @@ int botan_privkey_load_rsa(botan_privkey_t* key, } int botan_privkey_load_rsa_pkcs1(botan_privkey_t* key, - const uint8_t bits[], - size_t len) + const uint8_t bits[], + size_t len) { #if defined(BOTAN_HAS_RSA) *key = nullptr; Botan::secure_vector<uint8_t> src(bits, bits + len); return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int { - *key = new botan_privkey_struct(new Botan::RSA_PrivateKey(Botan::AlgorithmIdentifier("RSA", - Botan::AlgorithmIdentifier::USE_NULL_PARAM), - src)); + Botan::AlgorithmIdentifier alg_id("RSA", Botan::AlgorithmIdentifier::USE_NULL_PARAM); + *key = new botan_privkey_struct(new Botan::RSA_PrivateKey(alg_id, src)); return BOTAN_FFI_SUCCESS; }); #else @@ -355,13 +354,13 @@ int botan_pubkey_rsa_get_n(botan_mp_t n, botan_pubkey_t key) } int botan_privkey_rsa_get_privkey(botan_privkey_t rsa_key, - uint8_t out[], size_t* out_len, - uint32_t flags) + uint8_t out[], size_t* out_len, + uint32_t flags) { #if defined(BOTAN_HAS_RSA) return BOTAN_FFI_DO(Botan::Private_Key, rsa_key, k, { if(const Botan::RSA_PrivateKey* rsa = dynamic_cast<const Botan::RSA_PrivateKey*>(&k)) - { + { if(flags == BOTAN_PRIVKEY_EXPORT_FLAG_DER) return write_vec_output(out, out_len, rsa->private_key_bits()); else if(flags == BOTAN_PRIVKEY_EXPORT_FLAG_PEM) @@ -369,12 +368,12 @@ int botan_privkey_rsa_get_privkey(botan_privkey_t rsa_key, "RSA PRIVATE KEY")); else return BOTAN_FFI_ERROR_BAD_FLAG; - } + } else - { + { return BOTAN_FFI_ERROR_BAD_PARAMETER; - } - }); + } + }); #else BOTAN_UNUSED(rsa_key, out, out_len); return BOTAN_FFI_ERROR_NOT_IMPLEMENTED; |