diff options
author | Jack Lloyd <[email protected]> | 2018-08-10 14:45:44 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-08-10 14:45:44 -0400 |
commit | 36a7ec51b23b5d30e42480ef8a8a16468804065f (patch) | |
tree | 00483a4c4883d54f9c34b45ef3c0fd31e6704213 /src | |
parent | e25b3ace8caa63821fba442dfdb750bcbaa7f39f (diff) |
Fix off by one for SM2 ciphertext length
It is possible up to 13 bytes are required. Round up to 16 bytes
just cause.
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/pubkey/sm2/sm2_enc.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lib/pubkey/sm2/sm2_enc.cpp b/src/lib/pubkey/sm2/sm2_enc.cpp index 856cb5cbc..55549afe3 100644 --- a/src/lib/pubkey/sm2/sm2_enc.cpp +++ b/src/lib/pubkey/sm2/sm2_enc.cpp @@ -41,7 +41,7 @@ class SM2_Encryption_Operation final : public PK_Ops::Encryption size_t ciphertext_length(size_t ptext_len) const override { const size_t elem_size = m_group.get_order_bytes(); - const size_t der_overhead = 12; + const size_t der_overhead = 16; return der_overhead + 2*elem_size + m_hash_size + ptext_len; } |