|
|
e62613 |
diff -up openssl-1.0.2d/crypto/ec/ec_curve.c.secp256k1 openssl-1.0.2d/crypto/ec/ec_curve.c
|
|
|
e62613 |
--- openssl-1.0.2d/crypto/ec/ec_curve.c.secp256k1 2015-08-12 14:55:15.203415420 -0400
|
|
|
e62613 |
+++ openssl-1.0.2d/crypto/ec/ec_curve.c 2015-08-12 15:07:12.659113262 -0400
|
|
|
e62613 |
@@ -86,6 +86,42 @@ typedef struct {
|
|
|
e62613 |
unsigned int cofactor; /* promoted to BN_ULONG */
|
|
|
e62613 |
} EC_CURVE_DATA;
|
|
|
e62613 |
|
|
|
e62613 |
+static const struct {
|
|
|
e62613 |
+ EC_CURVE_DATA h;
|
|
|
e62613 |
+ unsigned char data[0 + 32 * 6];
|
|
|
e62613 |
+} _EC_SECG_PRIME_256K1 = {
|
|
|
e62613 |
+ {
|
|
|
e62613 |
+ NID_X9_62_prime_field, 0, 32, 1
|
|
|
e62613 |
+ },
|
|
|
e62613 |
+ {
|
|
|
e62613 |
+ /* no seed */
|
|
|
e62613 |
+ /* p */
|
|
|
e62613 |
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
|
|
e62613 |
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
|
|
e62613 |
+ 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xFC, 0x2F,
|
|
|
e62613 |
+ /* a */
|
|
|
e62613 |
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
e62613 |
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
e62613 |
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
e62613 |
+ /* b */
|
|
|
e62613 |
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
e62613 |
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
e62613 |
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07,
|
|
|
e62613 |
+ /* x */
|
|
|
e62613 |
+ 0x79, 0xBE, 0x66, 0x7E, 0xF9, 0xDC, 0xBB, 0xAC, 0x55, 0xA0, 0x62, 0x95,
|
|
|
e62613 |
+ 0xCE, 0x87, 0x0B, 0x07, 0x02, 0x9B, 0xFC, 0xDB, 0x2D, 0xCE, 0x28, 0xD9,
|
|
|
e62613 |
+ 0x59, 0xF2, 0x81, 0x5B, 0x16, 0xF8, 0x17, 0x98,
|
|
|
e62613 |
+ /* y */
|
|
|
e62613 |
+ 0x48, 0x3a, 0xda, 0x77, 0x26, 0xa3, 0xc4, 0x65, 0x5d, 0xa4, 0xfb, 0xfc,
|
|
|
e62613 |
+ 0x0e, 0x11, 0x08, 0xa8, 0xfd, 0x17, 0xb4, 0x48, 0xa6, 0x85, 0x54, 0x19,
|
|
|
e62613 |
+ 0x9c, 0x47, 0xd0, 0x8f, 0xfb, 0x10, 0xd4, 0xb8,
|
|
|
e62613 |
+ /* order */
|
|
|
e62613 |
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
|
|
e62613 |
+ 0xFF, 0xFF, 0xFF, 0xFE, 0xBA, 0xAE, 0xDC, 0xE6, 0xAF, 0x48, 0xA0, 0x3B,
|
|
|
e62613 |
+ 0xBF, 0xD2, 0x5E, 0x8C, 0xD0, 0x36, 0x41, 0x41
|
|
|
e62613 |
+ }
|
|
|
e62613 |
+};
|
|
|
e62613 |
+
|
|
|
e62613 |
/* the nist prime curves */
|
|
|
e62613 |
static const struct {
|
|
|
e62613 |
EC_CURVE_DATA h;
|
|
|
e62613 |
@@ -235,6 +271,8 @@ typedef struct _ec_list_element_st {
|
|
|
e62613 |
static const ec_list_element curve_list[] = {
|
|
|
e62613 |
/* prime field curves */
|
|
|
e62613 |
/* secg curves */
|
|
|
e62613 |
+ {NID_secp256k1, &_EC_SECG_PRIME_256K1.h, 0,
|
|
|
e62613 |
+ "SECG curve over a 256 bit prime field"},
|
|
|
e62613 |
/* SECG secp256r1 is the same as X9.62 prime256v1 and hence omitted */
|
|
|
e62613 |
{NID_secp384r1, &_EC_NIST_PRIME_384.h, 0,
|
|
|
e62613 |
"NIST/SECG curve over a 384 bit prime field"},
|
|
|
e62613 |
diff -up openssl-1.0.2d/ssl/t1_lib.c.secp256k1 openssl-1.0.2d/ssl/t1_lib.c
|
|
|
e62613 |
--- openssl-1.0.2d/ssl/t1_lib.c.secp256k1 2015-08-12 15:04:42.876925441 -0400
|
|
|
e62613 |
+++ openssl-1.0.2d/ssl/t1_lib.c 2015-08-12 15:04:47.837699822 -0400
|
|
|
e62613 |
@@ -269,6 +269,7 @@ static const unsigned char eccurves_auto
|
|
|
e62613 |
/* Other >= 256-bit prime curves. */
|
|
|
e62613 |
0, 25, /* secp521r1 (25) */
|
|
|
e62613 |
0, 24, /* secp384r1 (24) */
|
|
|
e62613 |
+ 0, 22, /* secp256k1 (22) */
|
|
|
e62613 |
# ifndef OPENSSL_NO_EC2M
|
|
|
e62613 |
/* >= 256-bit binary curves. */
|
|
|
e62613 |
0, 14, /* sect571r1 (14) */
|
|
|
e62613 |
@@ -286,6 +287,7 @@ static const unsigned char eccurves_all[
|
|
|
e62613 |
/* Other >= 256-bit prime curves. */
|
|
|
e62613 |
0, 25, /* secp521r1 (25) */
|
|
|
e62613 |
0, 24, /* secp384r1 (24) */
|
|
|
e62613 |
+ 0, 22, /* secp256k1 (22) */
|
|
|
e62613 |
# ifndef OPENSSL_NO_EC2M
|
|
|
e62613 |
/* >= 256-bit binary curves. */
|
|
|
e62613 |
0, 14, /* sect571r1 (14) */
|
|
|
e62613 |
@@ -333,6 +335,7 @@ static const unsigned char fips_curves_d
|
|
|
e62613 |
0, 9, /* sect283k1 (9) */
|
|
|
e62613 |
0, 10, /* sect283r1 (10) */
|
|
|
e62613 |
# endif
|
|
|
e62613 |
+ 0, 22, /* secp256k1 (22) */
|
|
|
e62613 |
0, 23, /* secp256r1 (23) */
|
|
|
e62613 |
# ifndef OPENSSL_NO_EC2M
|
|
|
e62613 |
0, 8, /* sect239k1 (8) */
|