Update sm2_crypt.c
authorneighbads <16126598+neighbads@users.noreply.github.com>
Wed, 11 Jul 2018 07:40:03 +0000 (15:40 +0800)
committerRichard Levitte <levitte@openssl.org>
Tue, 24 Jul 2018 10:28:03 +0000 (12:28 +0200)
asn1_encode : x, y  =>    0 | x,0 | y
(because of DER encoding rules when x and y have high bit set)

CLA: Trivial

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6694)

crypto/sm2/sm2_crypt.c

index aedf9054c1cf08a4b739011d38e40ae568d39977..d6f9c81d8c800b44d77bb3a8fa94f125e14a0dc4 100644 (file)
@@ -95,7 +95,7 @@ int sm2_ciphertext_size(const EC_KEY *key, const EVP_MD *digest, size_t msg_len,
     if (field_size == 0 || md_size < 0)
         return 0;
 
-    *ct_size = 10 + 2 * field_size + (size_t)md_size + msg_len;
+    *ct_size = 12 + 2 * field_size + (size_t)md_size + msg_len;
     return 1;
 }