-/* $OpenBSD: ec_curve.c,v 1.42 2023/07/07 13:54:45 beck Exp $ */
+/* $OpenBSD: ec_curve.c,v 1.43 2024/03/24 06:05:41 tb Exp $ */
/*
* Written by Nils Larsch for the OpenSSL project.
*/
},
};
-#ifndef OPENSSL_NO_GOST
-static const struct {
- uint8_t p[32];
- uint8_t a[32];
- uint8_t b[32];
- uint8_t x[32];
- uint8_t y[32];
- uint8_t order[32];
-} _EC_GOST_2001_Test = {
- .p = {
- 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x04, 0x31,
- },
- .a = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x07,
- },
- .b = {
- 0x5f, 0xbf, 0xf4, 0x98, 0xaa, 0x93, 0x8c, 0xe7, 0x39, 0xb8,
- 0xe0, 0x22, 0xfb, 0xaf, 0xef, 0x40, 0x56, 0x3f, 0x6e, 0x6a,
- 0x34, 0x72, 0xfc, 0x2a, 0x51, 0x4c, 0x0c, 0xe9, 0xda, 0xe2,
- 0x3b, 0x7e,
- },
- .x = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x02,
- },
- .y = {
- 0x08, 0xe2, 0xa8, 0xa0, 0xe6, 0x51, 0x47, 0xd4, 0xbd, 0x63,
- 0x16, 0x03, 0x0e, 0x16, 0xd1, 0x9c, 0x85, 0xc9, 0x7f, 0x0a,
- 0x9c, 0xa2, 0x67, 0x12, 0x2b, 0x96, 0xab, 0xbc, 0xea, 0x7e,
- 0x8f, 0xc8,
- },
- .order = {
- 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x50, 0xfe, 0x8a, 0x18,
- 0x92, 0x97, 0x61, 0x54, 0xc5, 0x9c, 0xfc, 0x19, 0x3a, 0xcc,
- 0xf5, 0xb3,
- },
-};
-
-static const struct {
- uint8_t p[32];
- uint8_t a[32];
- uint8_t b[32];
- uint8_t x[32];
- uint8_t y[32];
- uint8_t order[32];
-} _EC_GOST_2001_CryptoPro_A = {
- .p = {
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xfd, 0x97,
- },
- .a = {
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xfd, 0x94,
- },
- .b = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0xa6,
- },
- .x = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x01,
- },
- .y = {
- 0x8d, 0x91, 0xe4, 0x71, 0xe0, 0x98, 0x9c, 0xda, 0x27, 0xdf,
- 0x50, 0x5a, 0x45, 0x3f, 0x2b, 0x76, 0x35, 0x29, 0x4f, 0x2d,
- 0xdf, 0x23, 0xe3, 0xb1, 0x22, 0xac, 0xc9, 0x9c, 0x9e, 0x9f,
- 0x1e, 0x14,
- },
- .order = {
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6c, 0x61, 0x10, 0x70,
- 0x99, 0x5a, 0xd1, 0x00, 0x45, 0x84, 0x1b, 0x09, 0xb7, 0x61,
- 0xb8, 0x93,
- },
-};
-
-static const struct {
- uint8_t p[32];
- uint8_t a[32];
- uint8_t b[32];
- uint8_t x[32];
- uint8_t y[32];
- uint8_t order[32];
-} _EC_GOST_2001_CryptoPro_B = {
- .p = {
- 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x0c, 0x99,
- },
- .a = {
- 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x0c, 0x96,
- },
- .b = {
- 0x3e, 0x1a, 0xf4, 0x19, 0xa2, 0x69, 0xa5, 0xf8, 0x66, 0xa7,
- 0xd3, 0xc2, 0x5c, 0x3d, 0xf8, 0x0a, 0xe9, 0x79, 0x25, 0x93,
- 0x73, 0xff, 0x2b, 0x18, 0x2f, 0x49, 0xd4, 0xce, 0x7e, 0x1b,
- 0xbc, 0x8b,
- },
- .x = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x01,
- },
- .y = {
- 0x3f, 0xa8, 0x12, 0x43, 0x59, 0xf9, 0x66, 0x80, 0xb8, 0x3d,
- 0x1c, 0x3e, 0xb2, 0xc0, 0x70, 0xe5, 0xc5, 0x45, 0xc9, 0x85,
- 0x8d, 0x03, 0xec, 0xfb, 0x74, 0x4b, 0xf8, 0xd7, 0x17, 0x71,
- 0x7e, 0xfc,
- },
- .order = {
- 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x5f, 0x70, 0x0c, 0xff,
- 0xf1, 0xa6, 0x24, 0xe5, 0xe4, 0x97, 0x16, 0x1b, 0xcc, 0x8a,
- 0x19, 0x8f,
- },
-};
-
-static const struct {
- uint8_t p[32];
- uint8_t a[32];
- uint8_t b[32];
- uint8_t x[32];
- uint8_t y[32];
- uint8_t order[32];
-} _EC_GOST_2001_CryptoPro_C = {
- .p = {
- 0x9b, 0x9f, 0x60, 0x5f, 0x5a, 0x85, 0x81, 0x07, 0xab, 0x1e,
- 0xc8, 0x5e, 0x6b, 0x41, 0xc8, 0xaa, 0xcf, 0x84, 0x6e, 0x86,
- 0x78, 0x90, 0x51, 0xd3, 0x79, 0x98, 0xf7, 0xb9, 0x02, 0x2d,
- 0x75, 0x9b,
- },
- .a = {
- 0x9b, 0x9f, 0x60, 0x5f, 0x5a, 0x85, 0x81, 0x07, 0xab, 0x1e,
- 0xc8, 0x5e, 0x6b, 0x41, 0xc8, 0xaa, 0xcf, 0x84, 0x6e, 0x86,
- 0x78, 0x90, 0x51, 0xd3, 0x79, 0x98, 0xf7, 0xb9, 0x02, 0x2d,
- 0x75, 0x98,
- },
- .b = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x80, 0x5a,
- },
- .x = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00,
- },
- .y = {
- 0x41, 0xec, 0xe5, 0x57, 0x43, 0x71, 0x1a, 0x8c, 0x3c, 0xbf,
- 0x37, 0x83, 0xcd, 0x08, 0xc0, 0xee, 0x4d, 0x4d, 0xc4, 0x40,
- 0xd4, 0x64, 0x1a, 0x8f, 0x36, 0x6e, 0x55, 0x0d, 0xfd, 0xb3,
- 0xbb, 0x67,
- },
- .order = {
- 0x9b, 0x9f, 0x60, 0x5f, 0x5a, 0x85, 0x81, 0x07, 0xab, 0x1e,
- 0xc8, 0x5e, 0x6b, 0x41, 0xc8, 0xaa, 0x58, 0x2c, 0xa3, 0x51,
- 0x1e, 0xdd, 0xfb, 0x74, 0xf0, 0x2f, 0x3a, 0x65, 0x98, 0x98,
- 0x0b, 0xb9,
- },
-};
-
-/*
- * This curve is defined in two birationally equal forms: canonical and Twisted
- * Edwards. We do calculations in canonical (Weierstrass) form.
- */
-static const struct {
- uint8_t p[32];
- uint8_t a[32];
- uint8_t b[32];
- uint8_t x[32];
- uint8_t y[32];
- uint8_t order[32];
-} _EC_GOST_2012_256_TC26_A = {
- .p = {
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xfd, 0x97,
- },
- .a = {
- 0xc2, 0x17, 0x3f, 0x15, 0x13, 0x98, 0x16, 0x73, 0xaf, 0x48,
- 0x92, 0xc2, 0x30, 0x35, 0xa2, 0x7c, 0xe2, 0x5e, 0x20, 0x13,
- 0xbf, 0x95, 0xaa, 0x33, 0xb2, 0x2c, 0x65, 0x6f, 0x27, 0x7e,
- 0x73, 0x35,
- },
- .b = {
- 0x29, 0x5f, 0x9b, 0xae, 0x74, 0x28, 0xed, 0x9c, 0xcc, 0x20,
- 0xe7, 0xc3, 0x59, 0xa9, 0xd4, 0x1a, 0x22, 0xfc, 0xcd, 0x91,
- 0x08, 0xe1, 0x7b, 0xf7, 0xba, 0x93, 0x37, 0xa6, 0xf8, 0xae,
- 0x95, 0x13,
- },
- .x = {
- 0x91, 0xe3, 0x84, 0x43, 0xa5, 0xe8, 0x2c, 0x0d, 0x88, 0x09,
- 0x23, 0x42, 0x57, 0x12, 0xb2, 0xbb, 0x65, 0x8b, 0x91, 0x96,
- 0x93, 0x2e, 0x02, 0xc7, 0x8b, 0x25, 0x82, 0xfe, 0x74, 0x2d,
- 0xaa, 0x28,
- },
- .y = {
- 0x32, 0x87, 0x94, 0x23, 0xab, 0x1a, 0x03, 0x75, 0x89, 0x57,
- 0x86, 0xc4, 0xbb, 0x46, 0xe9, 0x56, 0x5f, 0xde, 0x0b, 0x53,
- 0x44, 0x76, 0x67, 0x40, 0xaf, 0x26, 0x8a, 0xdb, 0x32, 0x32,
- 0x2e, 0x5c,
- },
- .order = {
- 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xd8, 0xcd, 0xdf,
- 0xc8, 0x7b, 0x66, 0x35, 0xc1, 0x15, 0xaf, 0x55, 0x6c, 0x36,
- 0x0c, 0x67,
- },
-};
-
-static const struct {
- uint8_t p[64];
- uint8_t a[64];
- uint8_t b[64];
- uint8_t x[64];
- uint8_t y[64];
- uint8_t order[64];
-} _EC_GOST_2012_512_Test = {
- .p = {
- 0x45, 0x31, 0xac, 0xd1, 0xfe, 0x00, 0x23, 0xc7, 0x55, 0x0d,
- 0x26, 0x7b, 0x6b, 0x2f, 0xee, 0x80, 0x92, 0x2b, 0x14, 0xb2,
- 0xff, 0xb9, 0x0f, 0x04, 0xd4, 0xeb, 0x7c, 0x09, 0xb5, 0xd2,
- 0xd1, 0x5d, 0xf1, 0xd8, 0x52, 0x74, 0x1a, 0xf4, 0x70, 0x4a,
- 0x04, 0x58, 0x04, 0x7e, 0x80, 0xe4, 0x54, 0x6d, 0x35, 0xb8,
- 0x33, 0x6f, 0xac, 0x22, 0x4d, 0xd8, 0x16, 0x64, 0xbb, 0xf5,
- 0x28, 0xbe, 0x63, 0x73,
- },
- .a = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x07,
- },
- .b = {
- 0x1c, 0xff, 0x08, 0x06, 0xa3, 0x11, 0x16, 0xda, 0x29, 0xd8,
- 0xcf, 0xa5, 0x4e, 0x57, 0xeb, 0x74, 0x8b, 0xc5, 0xf3, 0x77,
- 0xe4, 0x94, 0x00, 0xfd, 0xd7, 0x88, 0xb6, 0x49, 0xec, 0xa1,
- 0xac, 0x43, 0x61, 0x83, 0x40, 0x13, 0xb2, 0xad, 0x73, 0x22,
- 0x48, 0x0a, 0x89, 0xca, 0x58, 0xe0, 0xcf, 0x74, 0xbc, 0x9e,
- 0x54, 0x0c, 0x2a, 0xdd, 0x68, 0x97, 0xfa, 0xd0, 0xa3, 0x08,
- 0x4f, 0x30, 0x2a, 0xdc,
- },
- .x = {
- 0x24, 0xd1, 0x9c, 0xc6, 0x45, 0x72, 0xee, 0x30, 0xf3, 0x96,
- 0xbf, 0x6e, 0xbb, 0xfd, 0x7a, 0x6c, 0x52, 0x13, 0xb3, 0xb3,
- 0xd7, 0x05, 0x7c, 0xc8, 0x25, 0xf9, 0x10, 0x93, 0xa6, 0x8c,
- 0xd7, 0x62, 0xfd, 0x60, 0x61, 0x12, 0x62, 0xcd, 0x83, 0x8d,
- 0xc6, 0xb6, 0x0a, 0xa7, 0xee, 0xe8, 0x04, 0xe2, 0x8b, 0xc8,
- 0x49, 0x97, 0x7f, 0xac, 0x33, 0xb4, 0xb5, 0x30, 0xf1, 0xb1,
- 0x20, 0x24, 0x8a, 0x9a,
- },
- .y = {
- 0x2b, 0xb3, 0x12, 0xa4, 0x3b, 0xd2, 0xce, 0x6e, 0x0d, 0x02,
- 0x06, 0x13, 0xc8, 0x57, 0xac, 0xdd, 0xcf, 0xbf, 0x06, 0x1e,
- 0x91, 0xe5, 0xf2, 0xc3, 0xf3, 0x24, 0x47, 0xc2, 0x59, 0xf3,
- 0x9b, 0x2c, 0x83, 0xab, 0x15, 0x6d, 0x77, 0xf1, 0x49, 0x6b,
- 0xf7, 0xeb, 0x33, 0x51, 0xe1, 0xee, 0x4e, 0x43, 0xdc, 0x1a,
- 0x18, 0xb9, 0x1b, 0x24, 0x64, 0x0b, 0x6d, 0xbb, 0x92, 0xcb,
- 0x1a, 0xdd, 0x37, 0x1e,
- },
- .order = {
- 0x45, 0x31, 0xac, 0xd1, 0xfe, 0x00, 0x23, 0xc7, 0x55, 0x0d,
- 0x26, 0x7b, 0x6b, 0x2f, 0xee, 0x80, 0x92, 0x2b, 0x14, 0xb2,
- 0xff, 0xb9, 0x0f, 0x04, 0xd4, 0xeb, 0x7c, 0x09, 0xb5, 0xd2,
- 0xd1, 0x5d, 0xa8, 0x2f, 0x2d, 0x7e, 0xcb, 0x1d, 0xba, 0xc7,
- 0x19, 0x90, 0x5c, 0x5e, 0xec, 0xc4, 0x23, 0xf1, 0xd8, 0x6e,
- 0x25, 0xed, 0xbe, 0x23, 0xc5, 0x95, 0xd6, 0x44, 0xaa, 0xf1,
- 0x87, 0xe6, 0xe6, 0xdf,
- },
-};
-
-static const struct {
- uint8_t p[64];
- uint8_t a[64];
- uint8_t b[64];
- uint8_t x[64];
- uint8_t y[64];
- uint8_t order[64];
-} _EC_GOST_2012_512_TC26_A = {
- .p = {
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xfd, 0xc7,
- },
- .a = {
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xfd, 0xc4,
- },
- .b = {
- 0xe8, 0xc2, 0x50, 0x5d, 0xed, 0xfc, 0x86, 0xdd, 0xc1, 0xbd,
- 0x0b, 0x2b, 0x66, 0x67, 0xf1, 0xda, 0x34, 0xb8, 0x25, 0x74,
- 0x76, 0x1c, 0xb0, 0xe8, 0x79, 0xbd, 0x08, 0x1c, 0xfd, 0x0b,
- 0x62, 0x65, 0xee, 0x3c, 0xb0, 0x90, 0xf3, 0x0d, 0x27, 0x61,
- 0x4c, 0xb4, 0x57, 0x40, 0x10, 0xda, 0x90, 0xdd, 0x86, 0x2e,
- 0xf9, 0xd4, 0xeb, 0xee, 0x47, 0x61, 0x50, 0x31, 0x90, 0x78,
- 0x5a, 0x71, 0xc7, 0x60,
- },
- .x = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x03,
- },
- .y = {
- 0x75, 0x03, 0xcf, 0xe8, 0x7a, 0x83, 0x6a, 0xe3, 0xa6, 0x1b,
- 0x88, 0x16, 0xe2, 0x54, 0x50, 0xe6, 0xce, 0x5e, 0x1c, 0x93,
- 0xac, 0xf1, 0xab, 0xc1, 0x77, 0x80, 0x64, 0xfd, 0xcb, 0xef,
- 0xa9, 0x21, 0xdf, 0x16, 0x26, 0xbe, 0x4f, 0xd0, 0x36, 0xe9,
- 0x3d, 0x75, 0xe6, 0xa5, 0x0e, 0x3a, 0x41, 0xe9, 0x80, 0x28,
- 0xfe, 0x5f, 0xc2, 0x35, 0xf5, 0xb8, 0x89, 0xa5, 0x89, 0xcb,
- 0x52, 0x15, 0xf2, 0xa4,
- },
- .order = {
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0x27, 0xe6, 0x95, 0x32, 0xf4, 0x8d, 0x89, 0x11,
- 0x6f, 0xf2, 0x2b, 0x8d, 0x4e, 0x05, 0x60, 0x60, 0x9b, 0x4b,
- 0x38, 0xab, 0xfa, 0xd2, 0xb8, 0x5d, 0xca, 0xcd, 0xb1, 0x41,
- 0x1f, 0x10, 0xb2, 0x75,
- },
-};
-
-static const struct {
- uint8_t p[64];
- uint8_t a[64];
- uint8_t b[64];
- uint8_t x[64];
- uint8_t y[64];
- uint8_t order[64];
-} _EC_GOST_2012_512_TC26_B = {
- .p = {
- 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x6f,
- },
- .a = {
- 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x6c,
- },
- .b = {
- 0x68, 0x7d, 0x1b, 0x45, 0x9d, 0xc8, 0x41, 0x45, 0x7e, 0x3e,
- 0x06, 0xcf, 0x6f, 0x5e, 0x25, 0x17, 0xb9, 0x7c, 0x7d, 0x61,
- 0x4a, 0xf1, 0x38, 0xbc, 0xbf, 0x85, 0xdc, 0x80, 0x6c, 0x4b,
- 0x28, 0x9f, 0x3e, 0x96, 0x5d, 0x2d, 0xb1, 0x41, 0x6d, 0x21,
- 0x7f, 0x8b, 0x27, 0x6f, 0xad, 0x1a, 0xb6, 0x9c, 0x50, 0xf7,
- 0x8b, 0xee, 0x1f, 0xa3, 0x10, 0x6e, 0xfb, 0x8c, 0xcb, 0xc7,
- 0xc5, 0x14, 0x01, 0x16,
- },
- .x = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x02,
- },
- .y = {
- 0x1a, 0x8f, 0x7e, 0xda, 0x38, 0x9b, 0x09, 0x4c, 0x2c, 0x07,
- 0x1e, 0x36, 0x47, 0xa8, 0x94, 0x0f, 0x3c, 0x12, 0x3b, 0x69,
- 0x75, 0x78, 0xc2, 0x13, 0xbe, 0x6d, 0xd9, 0xe6, 0xc8, 0xec,
- 0x73, 0x35, 0xdc, 0xb2, 0x28, 0xfd, 0x1e, 0xdf, 0x4a, 0x39,
- 0x15, 0x2c, 0xbc, 0xaa, 0xf8, 0xc0, 0x39, 0x88, 0x28, 0x04,
- 0x10, 0x55, 0xf9, 0x4c, 0xee, 0xec, 0x7e, 0x21, 0x34, 0x07,
- 0x80, 0xfe, 0x41, 0xbd,
- },
- .order = {
- 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x01, 0x49, 0xa1, 0xec, 0x14, 0x25, 0x65, 0xa5, 0x45,
- 0xac, 0xfd, 0xb7, 0x7b, 0xd9, 0xd4, 0x0c, 0xfa, 0x8b, 0x99,
- 0x67, 0x12, 0x10, 0x1b, 0xea, 0x0e, 0xc6, 0x34, 0x6c, 0x54,
- 0x37, 0x4f, 0x25, 0xbd,
- },
-};
-
-/*
- * This curve is defined in two birationally equal forms: canonical and Twisted
- * Edwards. We do calculations in canonical (Weierstrass) form.
- */
-static const struct {
- uint8_t p[64];
- uint8_t a[64];
- uint8_t b[64];
- uint8_t x[64];
- uint8_t y[64];
- uint8_t order[64];
-} _EC_GOST_2012_512_TC26_C = {
- .p = {
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xfd, 0xc7,
- },
- .a = {
- 0xdc, 0x92, 0x03, 0xe5, 0x14, 0xa7, 0x21, 0x87, 0x54, 0x85,
- 0xa5, 0x29, 0xd2, 0xc7, 0x22, 0xfb, 0x18, 0x7b, 0xc8, 0x98,
- 0x0e, 0xb8, 0x66, 0x64, 0x4d, 0xe4, 0x1c, 0x68, 0xe1, 0x43,
- 0x06, 0x45, 0x46, 0xe8, 0x61, 0xc0, 0xe2, 0xc9, 0xed, 0xd9,
- 0x2a, 0xde, 0x71, 0xf4, 0x6f, 0xcf, 0x50, 0xff, 0x2a, 0xd9,
- 0x7f, 0x95, 0x1f, 0xda, 0x9f, 0x2a, 0x2e, 0xb6, 0x54, 0x6f,
- 0x39, 0x68, 0x9b, 0xd3,
- },
- .b = {
- 0xb4, 0xc4, 0xee, 0x28, 0xce, 0xbc, 0x6c, 0x2c, 0x8a, 0xc1,
- 0x29, 0x52, 0xcf, 0x37, 0xf1, 0x6a, 0xc7, 0xef, 0xb6, 0xa9,
- 0xf6, 0x9f, 0x4b, 0x57, 0xff, 0xda, 0x2e, 0x4f, 0x0d, 0xe5,
- 0xad, 0xe0, 0x38, 0xcb, 0xc2, 0xff, 0xf7, 0x19, 0xd2, 0xc1,
- 0x8d, 0xe0, 0x28, 0x4b, 0x8b, 0xfe, 0xf3, 0xb5, 0x2b, 0x8c,
- 0xc7, 0xa5, 0xf5, 0xbf, 0x0a, 0x3c, 0x8d, 0x23, 0x19, 0xa5,
- 0x31, 0x25, 0x57, 0xe1,
- },
- .x = {
- 0xe2, 0xe3, 0x1e, 0xdf, 0xc2, 0x3d, 0xe7, 0xbd, 0xeb, 0xe2,
- 0x41, 0xce, 0x59, 0x3e, 0xf5, 0xde, 0x22, 0x95, 0xb7, 0xa9,
- 0xcb, 0xae, 0xf0, 0x21, 0xd3, 0x85, 0xf7, 0x07, 0x4c, 0xea,
- 0x04, 0x3a, 0xa2, 0x72, 0x72, 0xa7, 0xae, 0x60, 0x2b, 0xf2,
- 0xa7, 0xb9, 0x03, 0x3d, 0xb9, 0xed, 0x36, 0x10, 0xc6, 0xfb,
- 0x85, 0x48, 0x7e, 0xae, 0x97, 0xaa, 0xc5, 0xbc, 0x79, 0x28,
- 0xc1, 0x95, 0x01, 0x48,
- },
- .y = {
- 0xf5, 0xce, 0x40, 0xd9, 0x5b, 0x5e, 0xb8, 0x99, 0xab, 0xbc,
- 0xcf, 0xf5, 0x91, 0x1c, 0xb8, 0x57, 0x79, 0x39, 0x80, 0x4d,
- 0x65, 0x27, 0x37, 0x8b, 0x8c, 0x10, 0x8c, 0x3d, 0x20, 0x90,
- 0xff, 0x9b, 0xe1, 0x8e, 0x2d, 0x33, 0xe3, 0x02, 0x1e, 0xd2,
- 0xef, 0x32, 0xd8, 0x58, 0x22, 0x42, 0x3b, 0x63, 0x04, 0xf7,
- 0x26, 0xaa, 0x85, 0x4b, 0xae, 0x07, 0xd0, 0x39, 0x6e, 0x9a,
- 0x9a, 0xdd, 0xc4, 0x0f,
- },
- .order = {
- 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xc9, 0x8c, 0xdb, 0xa4, 0x65, 0x06, 0xab, 0x00,
- 0x4c, 0x33, 0xa9, 0xff, 0x51, 0x47, 0x50, 0x2c, 0xc8, 0xed,
- 0xa9, 0xe7, 0xa7, 0x69, 0xa1, 0x26, 0x94, 0x62, 0x3c, 0xef,
- 0x47, 0xf0, 0x23, 0xed,
- },
-};
-#endif
-
static const struct ec_list_element {
const char *comment;
int nid;
.order = _EC_FRP256v1.order,
.cofactor = 1,
},
-#ifndef OPENSSL_NO_GOST
- /* GOST R 34.10-2001 */
- {
- .comment = "GOST R 34.10-2001 Test Curve",
- .nid = NID_id_GostR3410_2001_TestParamSet,
- .param_len = sizeof(_EC_GOST_2001_Test.p),
- .p = _EC_GOST_2001_Test.p,
- .a = _EC_GOST_2001_Test.a,
- .b = _EC_GOST_2001_Test.b,
- .x = _EC_GOST_2001_Test.x,
- .y = _EC_GOST_2001_Test.y,
- .order = _EC_GOST_2001_Test.order,
- .cofactor = 1,
- },
- {
- .comment = "GOST R 34.10-2001 CryptoPro-A",
- .nid = NID_id_GostR3410_2001_CryptoPro_A_ParamSet,
- .param_len = sizeof(_EC_GOST_2001_CryptoPro_A.p),
- .p = _EC_GOST_2001_CryptoPro_A.p,
- .a = _EC_GOST_2001_CryptoPro_A.a,
- .b = _EC_GOST_2001_CryptoPro_A.b,
- .x = _EC_GOST_2001_CryptoPro_A.x,
- .y = _EC_GOST_2001_CryptoPro_A.y,
- .order = _EC_GOST_2001_CryptoPro_A.order,
- .cofactor = 1,
- },
- {
- .comment = "GOST R 34.10-2001 CryptoPro-B",
- .nid = NID_id_GostR3410_2001_CryptoPro_B_ParamSet,
- .param_len = sizeof(_EC_GOST_2001_CryptoPro_B.p),
- .p = _EC_GOST_2001_CryptoPro_B.p,
- .a = _EC_GOST_2001_CryptoPro_B.a,
- .b = _EC_GOST_2001_CryptoPro_B.b,
- .x = _EC_GOST_2001_CryptoPro_B.x,
- .y = _EC_GOST_2001_CryptoPro_B.y,
- .order = _EC_GOST_2001_CryptoPro_B.order,
- .cofactor = 1,
- },
- {
- .comment = "GOST R 34.10-2001 CryptoPro-C",
- .nid = NID_id_GostR3410_2001_CryptoPro_C_ParamSet,
- .param_len = sizeof(_EC_GOST_2001_CryptoPro_C.p),
- .p = _EC_GOST_2001_CryptoPro_C.p,
- .a = _EC_GOST_2001_CryptoPro_C.a,
- .b = _EC_GOST_2001_CryptoPro_C.b,
- .x = _EC_GOST_2001_CryptoPro_C.x,
- .y = _EC_GOST_2001_CryptoPro_C.y,
- .order = _EC_GOST_2001_CryptoPro_C.order,
- .cofactor = 1,
- },
- {
- .comment = "GOST R 34.10-2001 CryptoPro-XchA",
- .nid = NID_id_GostR3410_2001_CryptoPro_XchA_ParamSet,
- .param_len = sizeof(_EC_GOST_2001_CryptoPro_A.p),
- .p = _EC_GOST_2001_CryptoPro_A.p,
- .a = _EC_GOST_2001_CryptoPro_A.a,
- .b = _EC_GOST_2001_CryptoPro_A.b,
- .x = _EC_GOST_2001_CryptoPro_A.x,
- .y = _EC_GOST_2001_CryptoPro_A.y,
- .order = _EC_GOST_2001_CryptoPro_A.order,
- .cofactor = 1,
- },
- {
- .comment = "GOST R 34.10-2001 CryptoPro-XchB",
- .nid = NID_id_GostR3410_2001_CryptoPro_XchB_ParamSet,
- .param_len = sizeof(_EC_GOST_2001_CryptoPro_C.p),
- .p = _EC_GOST_2001_CryptoPro_C.p,
- .a = _EC_GOST_2001_CryptoPro_C.a,
- .b = _EC_GOST_2001_CryptoPro_C.b,
- .x = _EC_GOST_2001_CryptoPro_C.x,
- .y = _EC_GOST_2001_CryptoPro_C.y,
- .order = _EC_GOST_2001_CryptoPro_C.order,
- .cofactor = 1,
- },
- {
- .comment = "GOST R 34.10-2012 256 TC26-A",
- .nid = NID_id_tc26_gost_3410_12_256_paramSetA,
- .param_len = sizeof(_EC_GOST_2012_256_TC26_A.p),
- .p = _EC_GOST_2012_256_TC26_A.p,
- .a = _EC_GOST_2012_256_TC26_A.a,
- .b = _EC_GOST_2012_256_TC26_A.b,
- .x = _EC_GOST_2012_256_TC26_A.x,
- .y = _EC_GOST_2012_256_TC26_A.y,
- .order = _EC_GOST_2012_256_TC26_A.order,
- .cofactor = 4,
- },
- {
- .comment = "GOST R 34.10-2012 256 TC26-B",
- .nid = NID_id_tc26_gost_3410_12_256_paramSetB,
- .param_len = sizeof(_EC_GOST_2001_CryptoPro_A.p),
- .p = _EC_GOST_2001_CryptoPro_A.p,
- .a = _EC_GOST_2001_CryptoPro_A.a,
- .b = _EC_GOST_2001_CryptoPro_A.b,
- .x = _EC_GOST_2001_CryptoPro_A.x,
- .y = _EC_GOST_2001_CryptoPro_A.y,
- .order = _EC_GOST_2001_CryptoPro_A.order,
- .cofactor = 1,
- },
- {
- .comment = "GOST R 34.10-2012 256 TC26-C",
- .nid = NID_id_tc26_gost_3410_12_256_paramSetC,
- .param_len = sizeof(_EC_GOST_2001_CryptoPro_B.p),
- .p = _EC_GOST_2001_CryptoPro_B.p,
- .a = _EC_GOST_2001_CryptoPro_B.a,
- .b = _EC_GOST_2001_CryptoPro_B.b,
- .x = _EC_GOST_2001_CryptoPro_B.x,
- .y = _EC_GOST_2001_CryptoPro_B.y,
- .order = _EC_GOST_2001_CryptoPro_B.order,
- .cofactor = 1,
- },
- {
- .comment = "GOST R 34.10-2012 256 TC26-D",
- .nid = NID_id_tc26_gost_3410_12_256_paramSetD,
- .param_len = sizeof(_EC_GOST_2001_CryptoPro_C.p),
- .p = _EC_GOST_2001_CryptoPro_C.p,
- .a = _EC_GOST_2001_CryptoPro_C.a,
- .b = _EC_GOST_2001_CryptoPro_C.b,
- .x = _EC_GOST_2001_CryptoPro_C.x,
- .y = _EC_GOST_2001_CryptoPro_C.y,
- .order = _EC_GOST_2001_CryptoPro_C.order,
- .cofactor = 1,
- },
- {
- .comment = "GOST R 34.10-2012 512 Test Curve",
- .nid = NID_id_tc26_gost_3410_12_512_paramSetTest,
- .param_len = sizeof(_EC_GOST_2012_512_Test.p),
- .p = _EC_GOST_2012_512_Test.p,
- .a = _EC_GOST_2012_512_Test.a,
- .b = _EC_GOST_2012_512_Test.b,
- .x = _EC_GOST_2012_512_Test.x,
- .y = _EC_GOST_2012_512_Test.y,
- .order = _EC_GOST_2012_512_Test.order,
- .cofactor = 1,
- },
- {
- .comment = "GOST R 34.10-2012 512 TC26-A",
- .nid = NID_id_tc26_gost_3410_12_512_paramSetA,
- .param_len = sizeof(_EC_GOST_2012_512_TC26_A.p),
- .p = _EC_GOST_2012_512_TC26_A.p,
- .a = _EC_GOST_2012_512_TC26_A.a,
- .b = _EC_GOST_2012_512_TC26_A.b,
- .x = _EC_GOST_2012_512_TC26_A.x,
- .y = _EC_GOST_2012_512_TC26_A.y,
- .order = _EC_GOST_2012_512_TC26_A.order,
- .cofactor = 1,
- },
- {
- .comment = "GOST R 34.10-2012 512 TC26-B",
- .nid = NID_id_tc26_gost_3410_12_512_paramSetB,
- .param_len = sizeof(_EC_GOST_2012_512_TC26_B.p),
- .p = _EC_GOST_2012_512_TC26_B.p,
- .a = _EC_GOST_2012_512_TC26_B.a,
- .b = _EC_GOST_2012_512_TC26_B.b,
- .x = _EC_GOST_2012_512_TC26_B.x,
- .y = _EC_GOST_2012_512_TC26_B.y,
- .order = _EC_GOST_2012_512_TC26_B.order,
- .cofactor = 1,
- },
- {
- .comment = "GOST R 34.10-2012 512 TC26-C",
- .nid = NID_id_tc26_gost_3410_12_512_paramSetC,
- .param_len = sizeof(_EC_GOST_2012_512_TC26_C.p),
- .p = _EC_GOST_2012_512_TC26_C.p,
- .a = _EC_GOST_2012_512_TC26_C.a,
- .b = _EC_GOST_2012_512_TC26_C.b,
- .x = _EC_GOST_2012_512_TC26_C.x,
- .y = _EC_GOST_2012_512_TC26_C.y,
- .order = _EC_GOST_2012_512_TC26_C.order,
- .cofactor = 4,
- },
-#endif
};
#define CURVE_LIST_LENGTH (sizeof(curve_list) / sizeof(curve_list[0]))