From 6e687a12f157d63e9838ed3cc30d6fe24cc9c75f Mon Sep 17 00:00:00 2001
From: David Benjamin <davidben@google.com>
Date: Mon, 7 Mar 2016 09:57:58 -0500
Subject: [PATCH 7/7] Call EC_GROUP_order_bits in priv2opt.

The private key is a scalar and should be sized by the order, not the
degree.
---
 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 3b02eca..3306d30 100644
--- a/crypto/ec/ec_key.c
+++ b/crypto/ec/ec_key.c
@@ -604,7 +604,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.5.4 (Apple Git-61)

