aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/ffi
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-07-04 17:52:44 -0400
committerJack Lloyd <[email protected]>2018-07-04 17:52:44 -0400
commit26b2bdc110cb088eb2e29166f3ef11d47620e0e3 (patch)
tree50544a81c729634b21c68c1471dd3238ac80c414 /src/lib/ffi
parentad45110c607efe73590e265a336a02f113e027c8 (diff)
Small post-merge fixups of #1621
Formatting, and fix the API revision annotations Adds pem as explicit dependency to FFI; already pubkey pulls it in but good to be explicit.
Diffstat (limited to 'src/lib/ffi')
-rw-r--r--src/lib/ffi/ffi.h16
-rw-r--r--src/lib/ffi/ffi_pkey_algs.cpp23
-rw-r--r--src/lib/ffi/info.txt1
3 files changed, 20 insertions, 20 deletions
diff --git a/src/lib/ffi/ffi.h b/src/lib/ffi/ffi.h
index c1b1a1284..d2e924eb6 100644
--- a/src/lib/ffi/ffi.h
+++ b/src/lib/ffi/ffi.h
@@ -829,9 +829,9 @@ BOTAN_PUBLIC_API(2,0) int botan_privkey_load_rsa(botan_privkey_t* key,
botan_mp_t q,
botan_mp_t e);
-BOTAN_PUBLIC_API(2,0) int botan_privkey_load_rsa_pkcs1(botan_privkey_t* key,
- const uint8_t bits[],
- size_t len);
+BOTAN_PUBLIC_API(2,8) int botan_privkey_load_rsa_pkcs1(botan_privkey_t* key,
+ const uint8_t bits[],
+ size_t len);
BOTAN_PUBLIC_API(2,0) int botan_privkey_rsa_get_p(botan_mp_t p, botan_privkey_t rsa_key);
BOTAN_PUBLIC_API(2,0) int botan_privkey_rsa_get_q(botan_mp_t q, botan_privkey_t rsa_key);
@@ -839,13 +839,13 @@ BOTAN_PUBLIC_API(2,0) int botan_privkey_rsa_get_d(botan_mp_t d, botan_privkey_t
BOTAN_PUBLIC_API(2,0) int botan_privkey_rsa_get_n(botan_mp_t n, botan_privkey_t rsa_key);
BOTAN_PUBLIC_API(2,0) int botan_privkey_rsa_get_e(botan_mp_t e, botan_privkey_t rsa_key);
-BOTAN_PUBLIC_API(2,0) int botan_privkey_rsa_get_privkey(botan_privkey_t rsa_key,
- uint8_t out[], size_t* out_len,
- uint32_t flags);
+BOTAN_PUBLIC_API(2,8) int botan_privkey_rsa_get_privkey(botan_privkey_t rsa_key,
+ uint8_t out[], size_t* out_len,
+ uint32_t flags);
BOTAN_PUBLIC_API(2,0) int botan_pubkey_load_rsa(botan_pubkey_t* key,
- botan_mp_t n,
- botan_mp_t e);
+ botan_mp_t n,
+ botan_mp_t e);
BOTAN_PUBLIC_API(2,0) int botan_pubkey_rsa_get_e(botan_mp_t e, botan_pubkey_t rsa_key);
BOTAN_PUBLIC_API(2,0) int botan_pubkey_rsa_get_n(botan_mp_t n, botan_pubkey_t rsa_key);
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;
diff --git a/src/lib/ffi/info.txt b/src/lib/ffi/info.txt
index c02bd3a39..e064d5f24 100644
--- a/src/lib/ffi/info.txt
+++ b/src/lib/ffi/info.txt
@@ -21,6 +21,7 @@ aead
kdf
pbkdf
pubkey
+pem
bigint
x509
#tls