aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/pubkey/mceies/mceies.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/pubkey/mceies/mceies.cpp')
-rw-r--r--src/lib/pubkey/mceies/mceies.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/lib/pubkey/mceies/mceies.cpp b/src/lib/pubkey/mceies/mceies.cpp
index e83fa257e..0af71719a 100644
--- a/src/lib/pubkey/mceies/mceies.cpp
+++ b/src/lib/pubkey/mceies/mceies.cpp
@@ -8,7 +8,7 @@
#include <botan/mceies.h>
#include <botan/aead.h>
#include <botan/mceliece.h>
-#include <botan/mce_kem.h>
+#include <botan/pubkey.h>
namespace Botan {
@@ -36,11 +36,10 @@ mceies_encrypt(const McEliece_PublicKey& pubkey,
RandomNumberGenerator& rng,
const std::string& algo)
{
- McEliece_KEM_Encryptor kem_op(pubkey);
+ PK_KEM_Encryptor kem_op(pubkey, "KDF1(SHA-512)");
- const std::pair<secure_vector<byte>,secure_vector<byte>> mce_ciphertext__key = kem_op.encrypt(rng);
- const secure_vector<byte>& mce_ciphertext = mce_ciphertext__key.first;
- const secure_vector<byte>& mce_key = mce_ciphertext__key.second;
+ secure_vector<byte> mce_ciphertext, mce_key;
+ kem_op.encrypt(mce_ciphertext, mce_key, 64, rng);
const size_t mce_code_bytes = (pubkey.get_code_length() + 7) / 8;
@@ -75,7 +74,7 @@ mceies_decrypt(const McEliece_PrivateKey& privkey,
{
try
{
- McEliece_KEM_Decryptor kem_op(privkey);
+ PK_KEM_Decryptor kem_op(privkey, "KDF1(SHA-512)");
const size_t mce_code_bytes = (privkey.get_code_length() + 7) / 8;
@@ -88,7 +87,7 @@ mceies_decrypt(const McEliece_PrivateKey& privkey,
if(ct_len < mce_code_bytes + nonce_len + aead->tag_size())
throw Exception("Input message too small to be valid");
- const secure_vector<byte> mce_key = kem_op.decrypt(ct, mce_code_bytes);
+ const secure_vector<byte> mce_key = kem_op.decrypt(ct, mce_code_bytes, 64);
aead->set_key(aead_key(mce_key, *aead));
aead->set_associated_data(ad, ad_len);