diff options
author | Jack Lloyd <[email protected]> | 2017-05-19 10:43:11 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-05-19 10:43:11 -0400 |
commit | 08ea995eb6f55ae52ec74c5c76ea8a114c72ccf8 (patch) | |
tree | e49b1b1ea62e1f787064944f9a3910e1d88ffc55 /src/lib/ffi | |
parent | 2165cda540bac5311f46ac63480c5138a03adaca (diff) | |
parent | bebecf225713bc7e8b2082adfd163a173e4483c1 (diff) |
Merge GH #1051 Extensions for PKCSv1.5 signature formatting
Diffstat (limited to 'src/lib/ffi')
-rw-r--r-- | src/lib/ffi/ffi.cpp | 21 | ||||
-rw-r--r-- | src/lib/ffi/ffi.h | 2 |
2 files changed, 23 insertions, 0 deletions
diff --git a/src/lib/ffi/ffi.cpp b/src/lib/ffi/ffi.cpp index 9442634c4..3686c26f1 100644 --- a/src/lib/ffi/ffi.cpp +++ b/src/lib/ffi/ffi.cpp @@ -73,6 +73,10 @@ #include <botan/bcrypt.h> #endif +#if defined(BOTAN_HAS_HASH_ID) + #include <botan/hash_id.h> +#endif + #if defined(BOTAN_HAS_TLS) #include <botan/tls_client.h> #include <botan/tls_server.h> @@ -2249,6 +2253,23 @@ int botan_x509_cert_allowed_usage(botan_x509_cert_t cert, unsigned int key_usage }); } +int botan_pkcs_hash_id(const char* hash_name, uint8_t pkcs_id[], size_t* pkcs_id_len) + { +#if defined(BOTAN_HAS_HASH_ID) + try + { + const std::vector<uint8_t> hash_id = Botan::pkcs_hash_id(hash_name); + return write_output(pkcs_id, pkcs_id_len, hash_id.data(), hash_id.size()); + } + catch(...) + { + return BOTAN_FFI_ERROR_EXCEPTION_THROWN; + } +#else + return BOTAN_FFI_ERROR_NOT_IMPLEMENTED; +#endif + } + int botan_mceies_decrypt(botan_privkey_t mce_key_obj, const char* aead, const uint8_t ct[], size_t ct_len, diff --git a/src/lib/ffi/ffi.h b/src/lib/ffi/ffi.h index f93265e22..4953bce06 100644 --- a/src/lib/ffi/ffi.h +++ b/src/lib/ffi/ffi.h @@ -911,6 +911,8 @@ BOTAN_DLL int botan_pk_op_key_agreement(botan_pk_op_ka_t op, const uint8_t other_key[], size_t other_key_len, const uint8_t salt[], size_t salt_len); +BOTAN_DLL int botan_pkcs_hash_id(const char* hash_name, uint8_t pkcs_id[], size_t* pkcs_id_len); + /* * |