aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2017-09-21 11:42:20 -0400
committerJack Lloyd <[email protected]>2017-09-21 11:42:20 -0400
commitfc8c4fd18eb43017c53c2cfce78335fd337726fb (patch)
treed6383d14810c3d5a8aa780233945d8179725dc92
parent98993f542727787dcdc8e549a748a94886643458 (diff)
Fix the SM2 FFI test
-rw-r--r--src/tests/test_ffi.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/tests/test_ffi.cpp b/src/tests/test_ffi.cpp
index 2d63bfa69..bc3e72b09 100644
--- a/src/tests/test_ffi.cpp
+++ b/src/tests/test_ffi.cpp
@@ -1532,8 +1532,8 @@ class FFI_Unit_Tests : public Test
result.test_eq(namebuf, namebuf, "SM2_Enc");
std::vector<uint8_t> message(32);
- // Assumes 256-bit params:
- std::vector<uint8_t> ciphertext(1 + 32*2 + message.size() + 32);
+
+ std::vector<uint8_t> ciphertext(4096);
TEST_FFI_OK(botan_rng_get, (rng, message.data(), message.size()));
botan_pk_op_encrypt_t enc;
@@ -1542,11 +1542,12 @@ class FFI_Unit_Tests : public Test
size_t ctext_len = ciphertext.size();
TEST_FFI_OK(botan_pk_op_encrypt, (enc, rng, ciphertext.data(), &ctext_len,
message.data(), message.size()));
+ ciphertext.resize(ctext_len);
botan_pk_op_decrypt_t dec;
TEST_FFI_OK(botan_pk_op_decrypt_create, (&dec, loaded_privkey, "", 0));
- std::vector<uint8_t> recovered(ciphertext.size());
+ std::vector<uint8_t> recovered(message.size());
size_t recovered_len = recovered.size();
TEST_FFI_OK(botan_pk_op_decrypt,