From fe56d8e8a3665dc7e6784e0c170f790e6df8153f Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Mon, 7 Mar 2016 09:57:58 -0500 Subject: [PATCH] RT 4393: Call EC_GROUP_order_bits in priv2opt. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The private key is a scalar and should be sized by the order, not the degree. See RFC 5915. Reviewed-by: Rich Salz Reviewed-by: Emilia Käsper --- crypto/ec/ec_key.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto/ec/ec_key.c b/crypto/ec/ec_key.c index d241154630..f7948ccab2 100644 --- a/crypto/ec/ec_key.c +++ b/crypto/ec/ec_key.c @@ -607,7 +607,7 @@ size_t ec_key_simple_priv2oct(const EC_KEY *eckey, { size_t buf_len; - buf_len = (EC_GROUP_get_degree(eckey->group) + 7) / 8; + buf_len = (EC_GROUP_order_bits(eckey->group) + 7) / 8; if (eckey->priv_key == NULL) return 0; if (buf == NULL) -- 2.25.1