test: Fix RFC7748 test vector 1 point and expected values
This commit is contained in:
@@ -499,18 +499,19 @@ int se050_x25519_sw_derive_public_key(uint8_t *public_key,
|
||||
#ifdef X25519_SW_TEST
|
||||
#include <stdio.h>
|
||||
|
||||
/* RFC 7748 §6.1 Test Vector 1 */
|
||||
static const uint8_t RFC7748_SK_1[32] = {
|
||||
0xa5,0x46,0xe3,0x6b,0xf0,0x52,0x7c,0x9d,0x3b,0x16,0x15,0x4b,
|
||||
0x82,0x46,0x5e,0xdd,0x62,0x14,0x4c,0x0a,0xc1,0xfc,0x5a,0x18,
|
||||
0x50,0x6a,0x22,0x44,0xba,0x44,0x9a,0xc4 };
|
||||
static const uint8_t RFC7748_PK_1[32] = {
|
||||
0xe6,0xdb,0x68,0x67,0x58,0x32,0x30,0xdb,0x35,0x84,0x0c,0x00,
|
||||
0x68,0x3c,0x21,0x21,0xe2,0x4e,0xb3,0x5b,0x00,0x5a,0xee,0x68,
|
||||
0x9d,0xea,0xa5,0x38,0x25,0x28,0x8b,0x92 };
|
||||
0xe6,0xdb,0x68,0x67,0x58,0x30,0x30,0xdb,0x35,0x94,0xc1,0xa4,
|
||||
0x24,0xb1,0x5f,0x7c,0x72,0x66,0x24,0xec,0x26,0xb3,0x35,0x3b,
|
||||
0x10,0xa9,0x03,0xa6,0xd0,0xab,0x1c,0x4c };
|
||||
static const uint8_t RFC7748_SS_1[32] = {
|
||||
0x4a,0x5d,0x9d,0x5b,0xa4,0xce,0x2d,0xe1,0x72,0x8e,0x3b,0xf4,
|
||||
0x80,0x35,0x0f,0x25,0xe0,0x7e,0x21,0xc9,0x47,0xd1,0x9e,0x33,
|
||||
0x76,0xf0,0x9b,0x3c,0x1e,0x16,0x17,0x42 };
|
||||
0xc3,0xda,0x55,0x37,0x9d,0xe9,0xc6,0x90,0x8e,0x94,0xea,0x4d,
|
||||
0xf2,0x8d,0x08,0x4f,0x32,0xec,0xcf,0x03,0x49,0x1c,0x71,0xf7,
|
||||
0x54,0xb4,0x07,0x55,0x77,0xa2,0x85,0x52 };
|
||||
|
||||
static void print_hex(const char *label, const uint8_t *buf, size_t len)
|
||||
{
|
||||
@@ -525,6 +526,8 @@ int main(void)
|
||||
printf("X25519 Software Implementation Test\n");
|
||||
printf("====================================\n\n");
|
||||
printf("RFC 7748 Test Vector 1:\n");
|
||||
print_hex("Scalar", RFC7748_SK_1, 32);
|
||||
print_hex("Point", RFC7748_PK_1, 32);
|
||||
x25519_sw(shared_secret, RFC7748_SK_1, RFC7748_PK_1);
|
||||
print_hex("Computed SS", shared_secret, 32);
|
||||
print_hex("Expected SS", RFC7748_SS_1, 32);
|
||||
|
||||
Reference in New Issue
Block a user