key-exchange: Joint ke_test_vector format for DH and KEM

Both Diffie-Hellman (DH) and Key Encapsulation Mechanism (KEM) based
key exchange methods use a common ke_test_vector format. The
set_seed() function is used to provide deterministic private key
material for the crypto tests.
This commit is contained in:
Andreas Steffen 2019-11-04 22:22:47 +01:00 committed by Tobias Brunner
parent 8d5f269f07
commit 03d0c3b8e2
21 changed files with 1954 additions and 1178 deletions

View File

@ -1444,8 +1444,8 @@ failure:
static u_int bench_ke(private_crypto_tester_t *this,
key_exchange_method_t method, ke_constructor_t create)
{
chunk_t pub = chunk_empty, shared = chunk_empty;
key_exchange_t *ke;
chunk_t a_pub = chunk_empty, b_pub = chunk_empty, shared = chunk_empty;
key_exchange_t *a, *b;
struct timespec start;
u_int runs;
@ -1453,108 +1453,134 @@ static u_int bench_ke(private_crypto_tester_t *this,
start_timing(&start);
while (end_timing(&start) < this->bench_time)
{
ke = create(method);
if (!ke)
a = create(method);
b = create(method);
if (!a || !b)
{
DESTROY_IF(a);
DESTROY_IF(b);
return 0;
}
if (ke->get_public_key(ke, &pub) &&
ke->set_public_key(ke, pub) &&
ke->get_shared_secret(ke, &shared))
if (a->get_public_key(a, &a_pub) &&
b->set_public_key(b, a_pub) &&
b->get_public_key(b, &b_pub) &&
a->set_public_key(a, b_pub) &&
a->get_shared_secret(a, &shared))
{
runs++;
}
chunk_free(&pub);
chunk_free(&a_pub);
chunk_free(&b_pub);
chunk_free(&shared);
ke->destroy(ke);
a->destroy(a);
b->destroy(b);
}
return runs;
}
static bool test_single_ke(key_exchange_method_t method, ke_test_vector_t *v,
ke_constructor_t create)
{
rng_t *entropy = NULL;
drbg_t *drbg = NULL;
key_exchange_t *a = NULL, *b = NULL;
chunk_t a_priv, b_priv, a_pub, b_pub, a_sec, b_sec;
bool success = FALSE;
a = create(method);
b = create(method);
if (!a || !b)
{
goto failure;
}
a_pub = b_pub = a_sec = b_sec = chunk_empty;
if (key_exchange_is_kem(method))
{
/* entropy instance will be owned by drbg */
entropy = rng_tester_create(v->seed);
drbg = lib->crypto->create_drbg(lib->crypto, DRBG_CTR_AES256, 256,
entropy, chunk_empty);
if (!drbg)
{
entropy->destroy(entropy);
goto failure;
}
if (!a->set_seed(a, chunk_empty, drbg) ||
!b->set_seed(b, chunk_empty, drbg))
{
goto failure;
}
}
else
{
/* the seed is the concatenation of both DH private keys */
a_priv = chunk_create(v->seed.ptr, v->seed.len/2);
b_priv = chunk_create(v->seed.ptr + v->seed.len/2, v->seed.len/2);
if (!a->set_seed(a, a_priv, NULL) || !b->set_seed(b, b_priv, NULL))
{
goto failure;
}
}
if (!a->get_public_key(a, &a_pub) || !chunk_equals(a_pub, v->pub_i))
{
goto failure;
}
if (!b->set_public_key(b, a_pub))
{
goto failure;
}
if (!b->get_shared_secret(b, &b_sec) || !chunk_equals(b_sec, v->shared))
{
goto failure;
}
if (!b->get_public_key(b, &b_pub) || !chunk_equals(b_pub, v->pub_r))
{
goto failure;
}
if (!a->set_public_key(a, b_pub))
{
goto failure;
}
if (!a->get_shared_secret(a, &a_sec) || !chunk_equals(a_sec, v->shared))
{
goto failure;
}
success = TRUE;
failure:
DESTROY_IF(a);
DESTROY_IF(b);
chunk_free(&a_pub);
chunk_free(&b_pub);
chunk_free(&a_sec);
chunk_free(&b_sec);
DESTROY_IF(drbg);
return success;
}
METHOD(crypto_tester_t, test_ke, bool,
private_crypto_tester_t *this, key_exchange_method_t method,
ke_constructor_t create, u_int *speed, const char *plugin_name)
{
enumerator_t *enumerator;
ke_test_vector_t *v;
bool failed = FALSE;
bool success = TRUE;
u_int tested = 0;
enumerator = this->ke->create_enumerator(this->ke);
while (enumerator->enumerate(enumerator, &v))
{
key_exchange_t *a, *b;
chunk_t apub, bpub, asec, bsec;
if (v->method != method)
{
continue;
}
a = create(method);
b = create(method);
if (!a || !b)
{
DESTROY_IF(a);
DESTROY_IF(b);
failed = TRUE;
tested++;
DBG1(DBG_LIB, "disabled %N[%s]: creating instance failed",
key_exchange_method_names, method, plugin_name);
break;
}
if (!a->set_private_key || !b->set_private_key)
{ /* does not support testing */
a->destroy(a);
b->destroy(b);
continue;
}
failed = TRUE;
success = test_single_ke(method, v, create);
tested++;
apub = bpub = asec = bsec = chunk_empty;
if (!a->set_private_key(a, chunk_create(v->priv_a, v->priv_len)) ||
!b->set_private_key(b, chunk_create(v->priv_b, v->priv_len)))
{
goto failure;
}
if (!a->get_public_key(a, &apub) ||
!chunk_equals(apub, chunk_create(v->pub_a, v->pub_len)))
{
goto failure;
}
if (!b->get_public_key(b, &bpub) ||
!chunk_equals(bpub, chunk_create(v->pub_b, v->pub_len)))
{
goto failure;
}
if (!a->set_public_key(a, bpub) ||
!b->set_public_key(b, apub))
{
goto failure;
}
if (!a->get_shared_secret(a, &asec) ||
!chunk_equals(asec, chunk_create(v->shared, v->shared_len)))
{
goto failure;
}
if (!b->get_shared_secret(b, &bsec) ||
!chunk_equals(bsec, chunk_create(v->shared, v->shared_len)))
{
goto failure;
}
failed = FALSE;
failure:
a->destroy(a);
b->destroy(b);
chunk_free(&apub);
chunk_free(&bpub);
chunk_free(&asec);
chunk_free(&bsec);
if (failed)
if (!success)
{
DBG1(DBG_LIB, "disabled %N[%s]: %s test vector failed",
key_exchange_method_names, method, plugin_name, get_name(v));
@ -1562,6 +1588,7 @@ failure:
}
}
enumerator->destroy(enumerator);
if (!tested)
{
DBG1(DBG_LIB, "%s %N[%s]: no test vectors found / untestable",
@ -1569,7 +1596,7 @@ failure:
key_exchange_method_names, method, plugin_name);
return !this->required;
}
if (!failed)
if (success)
{
if (speed)
{
@ -1583,7 +1610,7 @@ failure:
key_exchange_method_names, method, plugin_name, tested);
}
}
return !failed;
return success;
}
METHOD(crypto_tester_t, add_crypter_vector, void,

View File

@ -162,22 +162,14 @@ struct rng_test_vector_t {
struct ke_test_vector_t {
/** key exchange method to test */
key_exchange_method_t method;
/** private key of alice */
u_char *priv_a;
/** private key of bob */
u_char *priv_b;
/** length of private keys */
size_t priv_len;
/** expected public key of alice */
u_char *pub_a;
/** expected public key of bob */
u_char *pub_b;
/** size of public keys */
size_t pub_len;
/** seed from which private key material is derived */
chunk_t seed;
/** expected public factor of initiator */
chunk_t pub_i;
/** expected public factor of responder */
chunk_t pub_r;
/** expected shared secret */
u_char *shared;
/** size of shared secret */
size_t shared_len;
chunk_t shared;
};
/**

View File

@ -2,6 +2,7 @@
* Copyright (C) 2010-2020 Tobias Brunner
* Copyright (C) 2005-2007 Martin Willi
* Copyright (C) 2005 Jan Hutter
* Copyright (C) 2016-2019 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
@ -160,9 +161,10 @@ struct key_exchange_t {
* used mostly for testing purposes. The private key may be the actual key
* or a seed for a DRBG.
*
* @param value private key value to set
* @param value optional seed value to set (can be chunk_empty)
* @param drbg optional DRBG (can be NULL)
*/
bool (*set_private_key)(key_exchange_t *this, chunk_t value)
bool (*set_seed)(key_exchange_t *this, chunk_t value, drbg_t *drbg)
__attribute__((warn_unused_result));
/**

View File

@ -129,8 +129,8 @@ METHOD(key_exchange_t, get_public_key, bool,
return TRUE;
}
METHOD(key_exchange_t, set_private_key, bool,
private_botan_diffie_hellman_t *this, chunk_t value)
METHOD(key_exchange_t, set_seed, bool,
private_botan_diffie_hellman_t *this, chunk_t value, drbg_t *drbg)
{
chunk_clear(&this->shared_secret);
return load_private_key(this, value);
@ -179,7 +179,7 @@ static botan_diffie_hellman_t *create_generic(key_exchange_method_t group,
.get_shared_secret = _get_shared_secret,
.set_public_key = _set_public_key,
.get_public_key = _get_public_key,
.set_private_key = _set_private_key,
.set_seed = _set_seed,
.get_method = _get_method,
.destroy = _destroy,
},

View File

@ -104,8 +104,8 @@ METHOD(key_exchange_t, get_public_key, bool,
return TRUE;
}
METHOD(key_exchange_t, set_private_key, bool,
private_botan_ec_diffie_hellman_t *this, chunk_t value)
METHOD(key_exchange_t, set_seed, bool,
private_botan_ec_diffie_hellman_t *this, chunk_t value, drbg_t *drbg)
{
botan_mp_t scalar;
@ -172,7 +172,7 @@ botan_ec_diffie_hellman_t *botan_ec_diffie_hellman_create(
.get_shared_secret = _get_shared_secret,
.set_public_key = _set_public_key,
.get_public_key = _get_public_key,
.set_private_key = _set_private_key,
.set_seed = _set_seed,
.get_method = _get_method,
.destroy = _destroy,
},

View File

@ -89,8 +89,8 @@ METHOD(key_exchange_t, get_public_key, bool,
return TRUE;
}
METHOD(key_exchange_t, set_private_key, bool,
private_diffie_hellman_t *this, chunk_t value)
METHOD(key_exchange_t, set_seed, bool,
private_diffie_hellman_t *this, chunk_t value, drbg_t *drbg)
{
if (value.len != 32)
{
@ -149,7 +149,7 @@ key_exchange_t *botan_x25519_create(key_exchange_method_t ke)
.get_shared_secret = _get_shared_secret,
.set_public_key = _set_public_key,
.get_public_key = _get_public_key,
.set_private_key = _set_private_key,
.set_seed = _set_seed,
.get_method = _get_method,
.destroy = _destroy,
},

View File

@ -100,8 +100,8 @@ METHOD(key_exchange_t, get_public_key, bool,
return FALSE;
}
METHOD(key_exchange_t, set_private_key, bool,
private_curve25519_dh_t *this, chunk_t value)
METHOD(key_exchange_t, set_seed, bool,
private_curve25519_dh_t *this, chunk_t value, drbg_t *drbg)
{
if (value.len != CURVE25519_KEY_SIZE)
{
@ -152,7 +152,7 @@ curve25519_dh_t *curve25519_dh_create(key_exchange_method_t group)
.get_shared_secret = _get_shared_secret,
.set_public_key = _set_public_key,
.get_public_key = _get_public_key,
.set_private_key = _set_private_key,
.set_seed = _set_seed,
.get_method = _get_method,
.destroy = _destroy,
},

View File

@ -145,8 +145,8 @@ METHOD(key_exchange_t, get_public_key, bool,
return TRUE;
}
METHOD(key_exchange_t, set_private_key, bool,
private_gcrypt_dh_t *this, chunk_t value)
METHOD(key_exchange_t, set_seed, bool,
private_gcrypt_dh_t *this, chunk_t value, drbg_t *drbg)
{
gcry_error_t err;
gcry_mpi_t xa;
@ -209,7 +209,7 @@ static gcrypt_dh_t *create_generic(key_exchange_method_t group, size_t exp_len,
.get_shared_secret = _get_shared_secret,
.set_public_key = _set_public_key,
.get_public_key = _get_public_key,
.set_private_key = _set_private_key,
.set_seed = _set_seed,
.get_method = _get_method,
.destroy = _destroy,
},

View File

@ -162,8 +162,8 @@ METHOD(key_exchange_t, get_public_key, bool,
return TRUE;
}
METHOD(key_exchange_t, set_private_key, bool,
private_gmp_diffie_hellman_t *this, chunk_t value)
METHOD(key_exchange_t, set_seed, bool,
private_gmp_diffie_hellman_t *this, chunk_t value, drbg_t *drbg)
{
mpz_import(this->xa, value.len, 1, 1, 1, 0, value.ptr);
mpz_powm(this->ya, this->g, this->xa, this->p);
@ -221,7 +221,7 @@ static gmp_diffie_hellman_t *create_generic(key_exchange_method_t group,
.get_shared_secret = _get_shared_secret,
.set_public_key = _set_public_key,
.get_public_key = _get_public_key,
.set_private_key = _set_private_key,
.set_seed = _set_seed,
.get_method = _get_method,
.destroy = _destroy,
},

View File

@ -123,8 +123,8 @@ METHOD(key_exchange_t, set_public_key, bool,
return TRUE;
}
METHOD(key_exchange_t, set_private_key, bool,
private_openssl_diffie_hellman_t *this, chunk_t value)
METHOD(key_exchange_t, set_seed, bool,
private_openssl_diffie_hellman_t *this, chunk_t value, drbg_t *drbg)
{
BIGNUM *privkey;
@ -204,7 +204,7 @@ openssl_diffie_hellman_t *openssl_diffie_hellman_create(
.get_shared_secret = _get_shared_secret,
.set_public_key = _set_public_key,
.get_public_key = _get_public_key,
.set_private_key = _set_private_key,
.set_seed = _set_seed,
.get_method = _get_method,
.destroy = _destroy,
},

View File

@ -253,8 +253,8 @@ METHOD(key_exchange_t, get_public_key, bool,
#endif
}
METHOD(key_exchange_t, set_private_key, bool,
private_openssl_ec_diffie_hellman_t *this, chunk_t value)
METHOD(key_exchange_t, set_seed, bool,
private_openssl_ec_diffie_hellman_t *this, chunk_t value, drbg_t *drbg)
{
EC_KEY *key = NULL;
EC_POINT *pub = NULL;
@ -646,7 +646,7 @@ openssl_ec_diffie_hellman_t *openssl_ec_diffie_hellman_create(
.get_shared_secret = _get_shared_secret,
.set_public_key = _set_public_key,
.get_public_key = _get_public_key,
.set_private_key = _set_private_key,
.set_seed = _set_seed,
.get_method = _get_method,
.destroy = _destroy,
},

View File

@ -125,8 +125,8 @@ METHOD(key_exchange_t, get_public_key, bool,
return TRUE;
}
METHOD(key_exchange_t, set_private_key, bool,
private_key_exchange_t *this, chunk_t value)
METHOD(key_exchange_t, set_seed, bool,
private_key_exchange_t *this, chunk_t value, drbg_t *drbg)
{
EVP_PKEY_free(this->key);
this->key = EVP_PKEY_new_raw_private_key(map_key_type(this->ke), NULL,
@ -200,7 +200,7 @@ key_exchange_t *openssl_x_diffie_hellman_create(key_exchange_method_t ke)
.get_shared_secret = _get_shared_secret,
.set_public_key = _set_public_key,
.get_public_key = _get_public_key,
.set_private_key = _set_private_key,
.set_seed = _set_seed,
.get_method = _get_method,
.destroy = _destroy,
},

View File

@ -2,6 +2,9 @@
* Copyright (C) 2015 Martin Willi
* Copyright (C) 2015 revosec AG
*
* Copyright (C) 2019 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the Licenseor (at your
@ -19,32 +22,60 @@
* From RFC 7748
*/
ke_test_vector_t curve25519_1 = {
.method = CURVE_25519, .priv_len = 32, .pub_len = 32, .shared_len = 32,
.priv_a = "\x77\x07\x6d\x0a\x73\x18\xa5\x7d\x3c\x16\xc1\x72\x51\xb2\x66\x45"
"\xdf\x4c\x2f\x87\xeb\xc0\x99\x2a\xb1\x77\xfb\xa5\x1d\xb9\x2c\x2a",
.priv_b = "\x5d\xab\x08\x7e\x62\x4a\x8a\x4b\x79\xe1\x7f\x8b\x83\x80\x0e\xe6"
"\x6f\x3b\xb1\x29\x26\x18\xb6\xfd\x1c\x2f\x8b\x27\xff\x88\xe0\xeb",
.pub_a = "\x85\x20\xf0\x09\x89\x30\xa7\x54\x74\x8b\x7d\xdc\xb4\x3e\xf7\x5a"
"\x0d\xbf\x3a\x0d\x26\x38\x1a\xf4\xeb\xa4\xa9\x8e\xaa\x9b\x4e\x6a",
.pub_b = "\xde\x9e\xdb\x7d\x7b\x7d\xc1\xb4\xd3\x5b\x61\xc2\xec\xe4\x35\x37"
"\x3f\x83\x43\xc8\x5b\x78\x67\x4d\xad\xfc\x7e\x14\x6f\x88\x2b\x4f",
.shared = "\x4a\x5d\x9d\x5b\xa4\xce\x2d\xe1\x72\x8e\x3b\xf4\x80\x35\x0f\x25"
"\xe0\x7e\x21\xc9\x47\xd1\x9e\x33\x76\xf0\x9b\x3c\x1e\x16\x17\x42",
.method = CURVE_25519,
.seed = chunk_from_chars(
0x77, 0x07, 0x6d, 0x0a, 0x73, 0x18, 0xa5, 0x7d, 0x3c, 0x16,
0xc1, 0x72, 0x51, 0xb2, 0x66, 0x45, 0xdf, 0x4c, 0x2f, 0x87,
0xeb, 0xc0, 0x99, 0x2a, 0xb1, 0x77, 0xfb, 0xa5, 0x1d, 0xb9,
0x2c, 0x2a, /* - */
0x5d, 0xab, 0x08, 0x7e, 0x62, 0x4a, 0x8a, 0x4b, 0x79, 0xe1,
0x7f, 0x8b, 0x83, 0x80, 0x0e, 0xe6, 0x6f, 0x3b, 0xb1, 0x29,
0x26, 0x18, 0xb6, 0xfd, 0x1c, 0x2f, 0x8b, 0x27, 0xff, 0x88,
0xe0, 0xeb),
.pub_i = chunk_from_chars(
0x85, 0x20, 0xf0, 0x09, 0x89, 0x30, 0xa7, 0x54, 0x74, 0x8b,
0x7d, 0xdc, 0xb4, 0x3e, 0xf7, 0x5a, 0x0d, 0xbf, 0x3a, 0x0d,
0x26, 0x38, 0x1a, 0xf4, 0xeb, 0xa4, 0xa9, 0x8e, 0xaa, 0x9b,
0x4e, 0x6a),
.pub_r = chunk_from_chars(
0xde, 0x9e, 0xdb, 0x7d, 0x7b, 0x7d, 0xc1, 0xb4, 0xd3, 0x5b,
0x61, 0xc2, 0xec, 0xe4, 0x35, 0x37, 0x3f, 0x83, 0x43, 0xc8,
0x5b, 0x78, 0x67, 0x4d, 0xad, 0xfc, 0x7e, 0x14, 0x6f, 0x88,
0x2b, 0x4f),
.shared = chunk_from_chars(
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)
};
/**
* From RFC 8031
*/
ke_test_vector_t curve25519_2 = {
.method = CURVE_25519, .priv_len = 32, .pub_len = 32, .shared_len = 32,
.priv_a = "\x75\x1f\xb4\x30\x86\x55\xb4\x76\xb6\x78\x9b\x73\x25\xf9\xea\x8c"
"\xdd\xd1\x6a\x58\x53\x3f\xf6\xd9\xe6\x00\x09\x46\x4a\x5f\x9d\x94",
.priv_b = "\x0a\x54\x64\x52\x53\x29\x0d\x60\xdd\xad\xd0\xe0\x30\xba\xcd\x9e"
"\x55\x01\xef\xdc\x22\x07\x55\xa1\xe9\x78\xf1\xb8\x39\xa0\x56\x88",
.pub_a = "\x48\xd5\xdd\xd4\x06\x12\x57\xba\x16\x6f\xa3\xf9\xbb\xdb\x74\xf1"
"\xa4\xe8\x1c\x08\x93\x84\xfa\x77\xf7\x90\x70\x9f\x0d\xfb\xc7\x66",
.pub_b = "\x0b\xe7\xc1\xf5\xaa\xd8\x7d\x7e\x44\x86\x62\x67\x32\x98\xa4\x43"
"\x47\x8b\x85\x97\x45\x17\x9e\xaf\x56\x4c\x79\xc0\xef\x6e\xee\x25",
.shared = "\xc7\x49\x50\x60\x7a\x12\x32\x7f\x32\x04\xd9\x4b\x68\x25\xbf\xb0"
"\x68\xb7\xf8\x31\x9a\x9e\x37\x08\xed\x3d\x43\xce\x81\x30\xc9\x50",
.method = CURVE_25519,
.seed = chunk_from_chars(
0x75, 0x1f, 0xb4, 0x30, 0x86, 0x55, 0xb4, 0x76, 0xb6, 0x78,
0x9b, 0x73, 0x25, 0xf9, 0xea, 0x8c, 0xdd, 0xd1, 0x6a, 0x58,
0x53, 0x3f, 0xf6, 0xd9, 0xe6, 0x00, 0x09, 0x46, 0x4a, 0x5f,
0x9d, 0x94, /* - */
0x0a, 0x54, 0x64, 0x52, 0x53, 0x29, 0x0d, 0x60, 0xdd, 0xad,
0xd0, 0xe0, 0x30, 0xba, 0xcd, 0x9e, 0x55, 0x01, 0xef, 0xdc,
0x22, 0x07, 0x55, 0xa1, 0xe9, 0x78, 0xf1, 0xb8, 0x39, 0xa0,
0x56, 0x88),
.pub_i = chunk_from_chars(
0x48, 0xd5, 0xdd, 0xd4, 0x06, 0x12, 0x57, 0xba, 0x16, 0x6f,
0xa3, 0xf9, 0xbb, 0xdb, 0x74, 0xf1, 0xa4, 0xe8, 0x1c, 0x08,
0x93, 0x84, 0xfa, 0x77, 0xf7, 0x90, 0x70, 0x9f, 0x0d, 0xfb,
0xc7, 0x66),
.pub_r = chunk_from_chars(
0x0b, 0xe7, 0xc1, 0xf5, 0xaa, 0xd8, 0x7d, 0x7e, 0x44, 0x86,
0x62, 0x67, 0x32, 0x98, 0xa4, 0x43, 0x47, 0x8b, 0x85, 0x97,
0x45, 0x17, 0x9e, 0xaf, 0x56, 0x4c, 0x79, 0xc0, 0xef, 0x6e,
0xee, 0x25),
.shared = chunk_from_chars(
0xc7, 0x49, 0x50, 0x60, 0x7a, 0x12, 0x32, 0x7f, 0x32, 0x04,
0xd9, 0x4b, 0x68, 0x25, 0xbf, 0xb0, 0x68, 0xb7, 0xf8, 0x31,
0x9a, 0x9e, 0x37, 0x08, 0xed, 0x3d, 0x43, 0xce, 0x81, 0x30,
0xc9, 0x50)
};

View File

@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 Tobias Brunner
* Copyright (C) 2019 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
@ -19,25 +20,39 @@
* From RFC 7748
*/
ke_test_vector_t curve448_1 = {
.method = CURVE_448, .priv_len = 56, .pub_len = 56, .shared_len = 56,
.priv_a = "\x9a\x8f\x49\x25\xd1\x51\x9f\x57\x75\xcf\x46\xb0\x4b\x58\x00\xd4"
"\xee\x9e\xe8\xba\xe8\xbc\x55\x65\xd4\x98\xc2\x8d\xd9\xc9\xba\xf5"
"\x74\xa9\x41\x97\x44\x89\x73\x91\x00\x63\x82\xa6\xf1\x27\xab\x1d"
"\x9a\xc2\xd8\xc0\xa5\x98\x72\x6b",
.priv_b = "\x1c\x30\x6a\x7a\xc2\xa0\xe2\xe0\x99\x0b\x29\x44\x70\xcb\xa3\x39"
"\xe6\x45\x37\x72\xb0\x75\x81\x1d\x8f\xad\x0d\x1d\x69\x27\xc1\x20"
"\xbb\x5e\xe8\x97\x2b\x0d\x3e\x21\x37\x4c\x9c\x92\x1b\x09\xd1\xb0"
"\x36\x6f\x10\xb6\x51\x73\x99\x2d",
.pub_a = "\x9b\x08\xf7\xcc\x31\xb7\xe3\xe6\x7d\x22\xd5\xae\xa1\x21\x07\x4a"
"\x27\x3b\xd2\xb8\x3d\xe0\x9c\x63\xfa\xa7\x3d\x2c\x22\xc5\xd9\xbb"
"\xc8\x36\x64\x72\x41\xd9\x53\xd4\x0c\x5b\x12\xda\x88\x12\x0d\x53"
"\x17\x7f\x80\xe5\x32\xc4\x1f\xa0",
.pub_b = "\x3e\xb7\xa8\x29\xb0\xcd\x20\xf5\xbc\xfc\x0b\x59\x9b\x6f\xec\xcf"
"\x6d\xa4\x62\x71\x07\xbd\xb0\xd4\xf3\x45\xb4\x30\x27\xd8\xb9\x72"
"\xfc\x3e\x34\xfb\x42\x32\xa1\x3c\xa7\x06\xdc\xb5\x7a\xec\x3d\xae"
"\x07\xbd\xc1\xc6\x7b\xf3\x36\x09",
.shared = "\x07\xff\xf4\x18\x1a\xc6\xcc\x95\xec\x1c\x16\xa9\x4a\x0f\x74\xd1"
"\x2d\xa2\x32\xce\x40\xa7\x75\x52\x28\x1d\x28\x2b\xb6\x0c\x0b\x56"
"\xfd\x24\x64\xc3\x35\x54\x39\x36\x52\x1c\x24\x40\x30\x85\xd5\x9a"
"\x44\x9a\x50\x37\x51\x4a\x87\x9d",
.method = CURVE_448,
.seed = chunk_from_chars(
0x9a, 0x8f, 0x49, 0x25, 0xd1, 0x51, 0x9f, 0x57, 0x75, 0xcf,
0x46, 0xb0, 0x4b, 0x58, 0x00, 0xd4, 0xee, 0x9e, 0xe8, 0xba,
0xe8, 0xbc, 0x55, 0x65, 0xd4, 0x98, 0xc2, 0x8d, 0xd9, 0xc9,
0xba, 0xf5, 0x74, 0xa9, 0x41, 0x97, 0x44, 0x89, 0x73, 0x91,
0x00, 0x63, 0x82, 0xa6, 0xf1, 0x27, 0xab, 0x1d, 0x9a, 0xc2,
0xd8, 0xc0, 0xa5, 0x98, 0x72, 0x6b, /* - */
0x1c, 0x30, 0x6a, 0x7a, 0xc2, 0xa0, 0xe2, 0xe0, 0x99, 0x0b,
0x29, 0x44, 0x70, 0xcb, 0xa3, 0x39, 0xe6, 0x45, 0x37, 0x72,
0xb0, 0x75, 0x81, 0x1d, 0x8f, 0xad, 0x0d, 0x1d, 0x69, 0x27,
0xc1, 0x20, 0xbb, 0x5e, 0xe8, 0x97, 0x2b, 0x0d, 0x3e, 0x21,
0x37, 0x4c, 0x9c, 0x92, 0x1b, 0x09, 0xd1, 0xb0, 0x36, 0x6f,
0x10, 0xb6, 0x51, 0x73, 0x99, 0x2d),
.pub_i = chunk_from_chars(
0x9b, 0x08, 0xf7, 0xcc, 0x31, 0xb7, 0xe3, 0xe6, 0x7d, 0x22,
0xd5, 0xae, 0xa1, 0x21, 0x07, 0x4a, 0x27, 0x3b, 0xd2, 0xb8,
0x3d, 0xe0, 0x9c, 0x63, 0xfa, 0xa7, 0x3d, 0x2c, 0x22, 0xc5,
0xd9, 0xbb, 0xc8, 0x36, 0x64, 0x72, 0x41, 0xd9, 0x53, 0xd4,
0x0c, 0x5b, 0x12, 0xda, 0x88, 0x12, 0x0d, 0x53, 0x17, 0x7f,
0x80, 0xe5, 0x32, 0xc4, 0x1f, 0xa0),
.pub_r = chunk_from_chars(
0x3e, 0xb7, 0xa8, 0x29, 0xb0, 0xcd, 0x20, 0xf5, 0xbc, 0xfc,
0x0b, 0x59, 0x9b, 0x6f, 0xec, 0xcf, 0x6d, 0xa4, 0x62, 0x71,
0x07, 0xbd, 0xb0, 0xd4, 0xf3, 0x45, 0xb4, 0x30, 0x27, 0xd8,
0xb9, 0x72, 0xfc, 0x3e, 0x34, 0xfb, 0x42, 0x32, 0xa1, 0x3c,
0xa7, 0x06, 0xdc, 0xb5, 0x7a, 0xec, 0x3d, 0xae, 0x07, 0xbd,
0xc1, 0xc6, 0x7b, 0xf3, 0x36, 0x09),
.shared = chunk_from_chars(
0x07, 0xff, 0xf4, 0x18, 0x1a, 0xc6, 0xcc, 0x95, 0xec, 0x1c,
0x16, 0xa9, 0x4a, 0x0f, 0x74, 0xd1, 0x2d, 0xa2, 0x32, 0xce,
0x40, 0xa7, 0x75, 0x52, 0x28, 0x1d, 0x28, 0x2b, 0xb6, 0x0c,
0x0b, 0x56, 0xfd, 0x24, 0x64, 0xc3, 0x35, 0x54, 0x39, 0x36,
0x52, 0x1c, 0x24, 0x40, 0x30, 0x85, 0xd5, 0x9a, 0x44, 0x9a,
0x50, 0x37, 0x51, 0x4a, 0x87, 0x9d)
};

View File

@ -2,6 +2,9 @@
* Copyright (C) 2015 Martin Willi
* Copyright (C) 2015 revosec AG
*
* Copyright (C) 2019 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the Licenseor (at your
@ -20,115 +23,191 @@
*/
ke_test_vector_t ecp192 = {
.method = ECP_192_BIT, .priv_len = 24, .pub_len = 48, .shared_len = 24,
.priv_a = "\x32\x3f\xa3\x16\x9d\x8e\x9c\x65\x93\xf5\x94\x76\xbc\x14\x20\x00"
"\xab\x5b\xe0\xe2\x49\xc4\x34\x26",
.priv_b = "\x63\x1f\x95\xbb\x4a\x67\x63\x2c\x9c\x47\x6e\xee\x9a\xb6\x95\xab"
"\x24\x0a\x04\x99\x30\x7f\xcf\x62",
.pub_a = "\xcd\x46\x48\x9e\xcf\xd6\xc1\x05\xe7\xb3\xd3\x25\x66\xe2\xb1\x22"
"\xe2\x49\xab\xaa\xdd\x87\x06\x12\x68\x88\x7b\x48\x77\xdf\x51\xdd"
"\x4d\xc3\xd6\xfd\x11\xf0\xa2\x6f\x8f\xd3\x84\x43\x17\x91\x6e\x9a",
.pub_b = "\x51\x9a\x12\x16\x80\xe0\x04\x54\x66\xba\x21\xdf\x2e\xee\x47\xf5"
"\x97\x3b\x50\x05\x77\xef\x13\xd5\xff\x61\x3a\xb4\xd6\x4c\xee\x3a"
"\x20\x87\x5b\xdb\x10\xf9\x53\xf6\xb3\x0c\xa0\x72\xc6\x0a\xa5\x7f",
.shared = "\xad\x42\x01\x82\x63\x3f\x85\x26\xbf\xe9\x54\xac\xda\x37\x6f\x05"
"\xe5\xff\x4f\x83\x7f\x54\xfe\xbe",
.method = ECP_192_BIT,
.seed = chunk_from_chars(
0x32, 0x3f, 0xa3, 0x16, 0x9d, 0x8e, 0x9c, 0x65, 0x93, 0xf5,
0x94, 0x76, 0xbc, 0x14, 0x20, 0x00, 0xab, 0x5b, 0xe0, 0xe2,
0x49, 0xc4, 0x34, 0x26, /* - */
0x63, 0x1f, 0x95, 0xbb, 0x4a, 0x67, 0x63, 0x2c, 0x9c, 0x47,
0x6e, 0xee, 0x9a, 0xb6, 0x95, 0xab, 0x24, 0x0a, 0x04, 0x99,
0x30, 0x7f, 0xcf, 0x62),
.pub_i = chunk_from_chars(
0xcd, 0x46, 0x48, 0x9e, 0xcf, 0xd6, 0xc1, 0x05, 0xe7, 0xb3,
0xd3, 0x25, 0x66, 0xe2, 0xb1, 0x22, 0xe2, 0x49, 0xab, 0xaa,
0xdd, 0x87, 0x06, 0x12, 0x68, 0x88, 0x7b, 0x48, 0x77, 0xdf,
0x51, 0xdd, 0x4d, 0xc3, 0xd6, 0xfd, 0x11, 0xf0, 0xa2, 0x6f,
0x8f, 0xd3, 0x84, 0x43, 0x17, 0x91, 0x6e, 0x9a),
.pub_r = chunk_from_chars(
0x51, 0x9a, 0x12, 0x16, 0x80, 0xe0, 0x04, 0x54, 0x66, 0xba,
0x21, 0xdf, 0x2e, 0xee, 0x47, 0xf5, 0x97, 0x3b, 0x50, 0x05,
0x77, 0xef, 0x13, 0xd5, 0xff, 0x61, 0x3a, 0xb4, 0xd6, 0x4c,
0xee, 0x3a, 0x20, 0x87, 0x5b, 0xdb, 0x10, 0xf9, 0x53, 0xf6,
0xb3, 0x0c, 0xa0, 0x72, 0xc6, 0x0a, 0xa5, 0x7f),
.shared = chunk_from_chars(
0xad, 0x42, 0x01, 0x82, 0x63, 0x3f, 0x85, 0x26, 0xbf, 0xe9,
0x54, 0xac, 0xda, 0x37, 0x6f, 0x05, 0xe5, 0xff, 0x4f, 0x83,
0x7f, 0x54, 0xfe, 0xbe)
};
ke_test_vector_t ecp224 = {
.method = ECP_224_BIT, .priv_len = 28, .pub_len = 56, .shared_len = 28,
.priv_a = "\xb5\x58\xeb\x6c\x28\x8d\xa7\x07\xbb\xb4\xf8\xfb\xae\x2a\xb9\xe9"
"\xcb\x62\xe3\xbc\x5c\x75\x73\xe2\x2e\x26\xd3\x7f",
.priv_b = "\xac\x3b\x1a\xdd\x3d\x97\x70\xe6\xf6\xa7\x08\xee\x9f\x3b\x8e\x0a"
"\xb3\xb4\x80\xe9\xf2\x7f\x85\xc8\x8b\x5e\x6d\x18",
.pub_a = "\x49\xdf\xef\x30\x9f\x81\x48\x8c\x30\x4c\xff\x5a\xb3\xee\x5a\x21"
"\x54\x36\x7d\xc7\x83\x31\x50\xe0\xa5\x1f\x3e\xeb\x4f\x2b\x5e\xe4"
"\x57\x62\xc4\xf6\x54\xc1\xa0\xc6\x7f\x54\xcf\x88\xb0\x16\xb5\x1b"
"\xce\x3d\x7c\x22\x8d\x57\xad\xb4",
.pub_b = "\x6b\x3a\xc9\x6a\x8d\x0c\xde\x6a\x55\x99\xbe\x80\x32\xed\xf1\x0c"
"\x16\x2d\x0a\x8a\xd2\x19\x50\x6d\xcd\x42\xa2\x07\xd4\x91\xbe\x99"
"\xc2\x13\xa7\xd1\xca\x37\x06\xde\xbf\xe3\x05\xf3\x61\xaf\xcb\xb3"
"\x3e\x26\x09\xc8\xb1\x61\x8a\xd5",
.shared = "\x52\x27\x2f\x50\xf4\x6f\x4e\xdc\x91\x51\x56\x90\x92\xf4\x6d\xf2"
"\xd9\x6e\xcc\x3b\x6d\xc1\x71\x4a\x4e\xa9\x49\xfa",
.method = ECP_224_BIT,
.seed = chunk_from_chars(
0xb5, 0x58, 0xeb, 0x6c, 0x28, 0x8d, 0xa7, 0x07, 0xbb, 0xb4,
0xf8, 0xfb, 0xae, 0x2a, 0xb9, 0xe9, 0xcb, 0x62, 0xe3, 0xbc,
0x5c, 0x75, 0x73, 0xe2, 0x2e, 0x26, 0xd3, 0x7f, /* - */
0xac, 0x3b, 0x1a, 0xdd, 0x3d, 0x97, 0x70, 0xe6, 0xf6, 0xa7,
0x08, 0xee, 0x9f, 0x3b, 0x8e, 0x0a, 0xb3, 0xb4, 0x80, 0xe9,
0xf2, 0x7f, 0x85, 0xc8, 0x8b, 0x5e, 0x6d, 0x18),
.pub_i = chunk_from_chars(
0x49, 0xdf, 0xef, 0x30, 0x9f, 0x81, 0x48, 0x8c, 0x30, 0x4c,
0xff, 0x5a, 0xb3, 0xee, 0x5a, 0x21, 0x54, 0x36, 0x7d, 0xc7,
0x83, 0x31, 0x50, 0xe0, 0xa5, 0x1f, 0x3e, 0xeb, 0x4f, 0x2b,
0x5e, 0xe4, 0x57, 0x62, 0xc4, 0xf6, 0x54, 0xc1, 0xa0, 0xc6,
0x7f, 0x54, 0xcf, 0x88, 0xb0, 0x16, 0xb5, 0x1b, 0xce, 0x3d,
0x7c, 0x22, 0x8d, 0x57, 0xad, 0xb4),
.pub_r = chunk_from_chars(
0x6b, 0x3a, 0xc9, 0x6a, 0x8d, 0x0c, 0xde, 0x6a, 0x55, 0x99,
0xbe, 0x80, 0x32, 0xed, 0xf1, 0x0c, 0x16, 0x2d, 0x0a, 0x8a,
0xd2, 0x19, 0x50, 0x6d, 0xcd, 0x42, 0xa2, 0x07, 0xd4, 0x91,
0xbe, 0x99, 0xc2, 0x13, 0xa7, 0xd1, 0xca, 0x37, 0x06, 0xde,
0xbf, 0xe3, 0x05, 0xf3, 0x61, 0xaf, 0xcb, 0xb3, 0x3e, 0x26,
0x09, 0xc8, 0xb1, 0x61, 0x8a, 0xd5),
.shared = chunk_from_chars(
0x52, 0x27, 0x2f, 0x50, 0xf4, 0x6f, 0x4e, 0xdc, 0x91, 0x51,
0x56, 0x90, 0x92, 0xf4, 0x6d, 0xf2, 0xd9, 0x6e, 0xcc, 0x3b,
0x6d, 0xc1, 0x71, 0x4a, 0x4e, 0xa9, 0x49, 0xfa)
};
ke_test_vector_t ecp256 = {
.method = ECP_256_BIT, .priv_len = 32, .pub_len = 64, .shared_len = 32,
.priv_a = "\x81\x42\x64\x14\x5f\x2f\x56\xf2\xe9\x6a\x8e\x33\x7a\x12\x84\x99"
"\x3f\xaf\x43\x2a\x5a\xbc\xe5\x9e\x86\x7b\x72\x91\xd5\x07\xa3\xaf",
.priv_b = "\x2c\xe1\x78\x8e\xc1\x97\xe0\x96\xdb\x95\xa2\x00\xcc\x0a\xb2\x6a"
"\x19\xce\x6b\xcc\xad\x56\x2b\x8e\xee\x1b\x59\x37\x61\xcf\x7f\x41",
.pub_a = "\x2a\xf5\x02\xf3\xbe\x89\x52\xf2\xc9\xb5\xa8\xd4\x16\x0d\x09\xe9"
"\x71\x65\xbe\x50\xbc\x42\xae\x4a\x5e\x8d\x3b\x4b\xa8\x3a\xeb\x15"
"\xeb\x0f\xaf\x4c\xa9\x86\xc4\xd3\x86\x81\xa0\xf9\x87\x2d\x79\xd5"
"\x67\x95\xbd\x4b\xff\x6e\x6d\xe3\xc0\xf5\x01\x5e\xce\x5e\xfd\x85",
.pub_b = "\xb1\x20\xde\x4a\xa3\x64\x92\x79\x53\x46\xe8\xde\x6c\x2c\x86\x46"
"\xae\x06\xaa\xea\x27\x9f\xa7\x75\xb3\xab\x07\x15\xf6\xce\x51\xb0"
"\x9f\x1b\x7e\xec\xe2\x0d\x7b\x5e\xd8\xec\x68\x5f\xa3\xf0\x71\xd8"
"\x37\x27\x02\x70\x92\xa8\x41\x13\x85\xc3\x4d\xde\x57\x08\xb2\xb6",
.shared = "\xdd\x0f\x53\x96\x21\x9d\x1e\xa3\x93\x31\x04\x12\xd1\x9a\x08\xf1"
"\xf5\x81\x1e\x9d\xc8\xec\x8e\xea\x7f\x80\xd2\x1c\x82\x0c\x27\x88",
.method = ECP_256_BIT,
.seed = chunk_from_chars(
0x81, 0x42, 0x64, 0x14, 0x5f, 0x2f, 0x56, 0xf2, 0xe9, 0x6a,
0x8e, 0x33, 0x7a, 0x12, 0x84, 0x99, 0x3f, 0xaf, 0x43, 0x2a,
0x5a, 0xbc, 0xe5, 0x9e, 0x86, 0x7b, 0x72, 0x91, 0xd5, 0x07,
0xa3, 0xaf, /* - */
0x2c, 0xe1, 0x78, 0x8e, 0xc1, 0x97, 0xe0, 0x96, 0xdb, 0x95,
0xa2, 0x00, 0xcc, 0x0a, 0xb2, 0x6a, 0x19, 0xce, 0x6b, 0xcc,
0xad, 0x56, 0x2b, 0x8e, 0xee, 0x1b, 0x59, 0x37, 0x61, 0xcf,
0x7f, 0x41),
.pub_i = chunk_from_chars(
0x2a, 0xf5, 0x02, 0xf3, 0xbe, 0x89, 0x52, 0xf2, 0xc9, 0xb5,
0xa8, 0xd4, 0x16, 0x0d, 0x09, 0xe9, 0x71, 0x65, 0xbe, 0x50,
0xbc, 0x42, 0xae, 0x4a, 0x5e, 0x8d, 0x3b, 0x4b, 0xa8, 0x3a,
0xeb, 0x15, 0xeb, 0x0f, 0xaf, 0x4c, 0xa9, 0x86, 0xc4, 0xd3,
0x86, 0x81, 0xa0, 0xf9, 0x87, 0x2d, 0x79, 0xd5, 0x67, 0x95,
0xbd, 0x4b, 0xff, 0x6e, 0x6d, 0xe3, 0xc0, 0xf5, 0x01, 0x5e,
0xce, 0x5e, 0xfd, 0x85),
.pub_r = chunk_from_chars(
0xb1, 0x20, 0xde, 0x4a, 0xa3, 0x64, 0x92, 0x79, 0x53, 0x46,
0xe8, 0xde, 0x6c, 0x2c, 0x86, 0x46, 0xae, 0x06, 0xaa, 0xea,
0x27, 0x9f, 0xa7, 0x75, 0xb3, 0xab, 0x07, 0x15, 0xf6, 0xce,
0x51, 0xb0, 0x9f, 0x1b, 0x7e, 0xec, 0xe2, 0x0d, 0x7b, 0x5e,
0xd8, 0xec, 0x68, 0x5f, 0xa3, 0xf0, 0x71, 0xd8, 0x37, 0x27,
0x02, 0x70, 0x92, 0xa8, 0x41, 0x13, 0x85, 0xc3, 0x4d, 0xde,
0x57, 0x08, 0xb2, 0xb6),
.shared = chunk_from_chars(
0xdd, 0x0f, 0x53, 0x96, 0x21, 0x9d, 0x1e, 0xa3, 0x93, 0x31,
0x04, 0x12, 0xd1, 0x9a, 0x08, 0xf1, 0xf5, 0x81, 0x1e, 0x9d,
0xc8, 0xec, 0x8e, 0xea, 0x7f, 0x80, 0xd2, 0x1c, 0x82, 0x0c,
0x27, 0x88)
};
ke_test_vector_t ecp384 = {
.method = ECP_384_BIT, .priv_len = 48, .pub_len = 96, .shared_len = 48,
.priv_a = "\xd2\x73\x35\xea\x71\x66\x4a\xf2\x44\xdd\x14\xe9\xfd\x12\x60\x71"
"\x5d\xfd\x8a\x79\x65\x57\x1c\x48\xd7\x09\xee\x7a\x79\x62\xa1\x56"
"\xd7\x06\xa9\x0c\xbc\xb5\xdf\x29\x86\xf0\x5f\xea\xdb\x93\x76\xf1",
.priv_b = "\x52\xd1\x79\x1f\xdb\x4b\x70\xf8\x9c\x0f\x00\xd4\x56\xc2\xf7\x02"
"\x3b\x61\x25\x26\x2c\x36\xa7\xdf\x1f\x80\x23\x11\x21\xcc\xe3\xd3"
"\x9b\xe5\x2e\x00\xc1\x94\xa4\x13\x2c\x4a\x6c\x76\x8b\xcd\x94\xd2",
.pub_a = "\x79\x31\x48\xf1\x78\x76\x34\xd5\xda\x4c\x6d\x90\x74\x41\x7d\x05"
"\xe0\x57\xab\x62\xf8\x20\x54\xd1\x0e\xe6\xb0\x40\x3d\x62\x79\x54"
"\x7e\x6a\x8e\xa9\xd1\xfd\x77\x42\x7d\x01\x6f\xe2\x7a\x8b\x8c\x66"
"\xc6\xc4\x12\x94\x33\x1d\x23\xe6\xf4\x80\xf4\xfb\x4c\xd4\x05\x04"
"\xc9\x47\x39\x2e\x94\xf4\xc3\xf0\x6b\x8f\x39\x8b\xb2\x9e\x42\x36"
"\x8f\x7a\x68\x59\x23\xde\x3b\x67\xba\xce\xd2\x14\xa1\xa1\xd1\x28",
.pub_b = "\x5c\xd4\x2a\xb9\xc4\x1b\x53\x47\xf7\x4b\x8d\x4e\xfb\x70\x8b\x3d"
"\x5b\x36\xdb\x65\x91\x53\x59\xb4\x4a\xbc\x17\x64\x7b\x6b\x99\x99"
"\x78\x9d\x72\xa8\x48\x65\xae\x2f\x22\x3f\x12\xb5\xa1\xab\xc1\x20"
"\xe1\x71\x45\x8f\xea\xa9\x39\xaa\xa3\xa8\xbf\xac\x46\xb4\x04\xbd"
"\x8f\x6d\x5b\x34\x8c\x0f\xa4\xd8\x0c\xec\xa1\x63\x56\xca\x93\x32"
"\x40\xbd\xe8\x72\x34\x15\xa8\xec\xe0\x35\xb0\xed\xf3\x67\x55\xde",
.shared = "\x5e\xa1\xfc\x4a\xf7\x25\x6d\x20\x55\x98\x1b\x11\x05\x75\xe0\xa8"
"\xca\xe5\x31\x60\x13\x7d\x90\x4c\x59\xd9\x26\xeb\x1b\x84\x56\xe4"
"\x27\xaa\x8a\x45\x40\x88\x4c\x37\xde\x15\x9a\x58\x02\x8a\xbc\x0e",
.method = ECP_384_BIT,
.seed = chunk_from_chars(
0xd2, 0x73, 0x35, 0xea, 0x71, 0x66, 0x4a, 0xf2, 0x44, 0xdd,
0x14, 0xe9, 0xfd, 0x12, 0x60, 0x71, 0x5d, 0xfd, 0x8a, 0x79,
0x65, 0x57, 0x1c, 0x48, 0xd7, 0x09, 0xee, 0x7a, 0x79, 0x62,
0xa1, 0x56, 0xd7, 0x06, 0xa9, 0x0c, 0xbc, 0xb5, 0xdf, 0x29,
0x86, 0xf0, 0x5f, 0xea, 0xdb, 0x93, 0x76, 0xf1, /* - */
0x52, 0xd1, 0x79, 0x1f, 0xdb, 0x4b, 0x70, 0xf8, 0x9c, 0x0f,
0x00, 0xd4, 0x56, 0xc2, 0xf7, 0x02, 0x3b, 0x61, 0x25, 0x26,
0x2c, 0x36, 0xa7, 0xdf, 0x1f, 0x80, 0x23, 0x11, 0x21, 0xcc,
0xe3, 0xd3, 0x9b, 0xe5, 0x2e, 0x00, 0xc1, 0x94, 0xa4, 0x13,
0x2c, 0x4a, 0x6c, 0x76, 0x8b, 0xcd, 0x94, 0xd2),
.pub_i = chunk_from_chars(
0x79, 0x31, 0x48, 0xf1, 0x78, 0x76, 0x34, 0xd5, 0xda, 0x4c,
0x6d, 0x90, 0x74, 0x41, 0x7d, 0x05, 0xe0, 0x57, 0xab, 0x62,
0xf8, 0x20, 0x54, 0xd1, 0x0e, 0xe6, 0xb0, 0x40, 0x3d, 0x62,
0x79, 0x54, 0x7e, 0x6a, 0x8e, 0xa9, 0xd1, 0xfd, 0x77, 0x42,
0x7d, 0x01, 0x6f, 0xe2, 0x7a, 0x8b, 0x8c, 0x66, 0xc6, 0xc4,
0x12, 0x94, 0x33, 0x1d, 0x23, 0xe6, 0xf4, 0x80, 0xf4, 0xfb,
0x4c, 0xd4, 0x05, 0x04, 0xc9, 0x47, 0x39, 0x2e, 0x94, 0xf4,
0xc3, 0xf0, 0x6b, 0x8f, 0x39, 0x8b, 0xb2, 0x9e, 0x42, 0x36,
0x8f, 0x7a, 0x68, 0x59, 0x23, 0xde, 0x3b, 0x67, 0xba, 0xce,
0xd2, 0x14, 0xa1, 0xa1, 0xd1, 0x28),
.pub_r = chunk_from_chars(
0x5c, 0xd4, 0x2a, 0xb9, 0xc4, 0x1b, 0x53, 0x47, 0xf7, 0x4b,
0x8d, 0x4e, 0xfb, 0x70, 0x8b, 0x3d, 0x5b, 0x36, 0xdb, 0x65,
0x91, 0x53, 0x59, 0xb4, 0x4a, 0xbc, 0x17, 0x64, 0x7b, 0x6b,
0x99, 0x99, 0x78, 0x9d, 0x72, 0xa8, 0x48, 0x65, 0xae, 0x2f,
0x22, 0x3f, 0x12, 0xb5, 0xa1, 0xab, 0xc1, 0x20, 0xe1, 0x71,
0x45, 0x8f, 0xea, 0xa9, 0x39, 0xaa, 0xa3, 0xa8, 0xbf, 0xac,
0x46, 0xb4, 0x04, 0xbd, 0x8f, 0x6d, 0x5b, 0x34, 0x8c, 0x0f,
0xa4, 0xd8, 0x0c, 0xec, 0xa1, 0x63, 0x56, 0xca, 0x93, 0x32,
0x40, 0xbd, 0xe8, 0x72, 0x34, 0x15, 0xa8, 0xec, 0xe0, 0x35,
0xb0, 0xed, 0xf3, 0x67, 0x55, 0xde),
.shared = chunk_from_chars(
0x5e, 0xa1, 0xfc, 0x4a, 0xf7, 0x25, 0x6d, 0x20, 0x55, 0x98,
0x1b, 0x11, 0x05, 0x75, 0xe0, 0xa8, 0xca, 0xe5, 0x31, 0x60,
0x13, 0x7d, 0x90, 0x4c, 0x59, 0xd9, 0x26, 0xeb, 0x1b, 0x84,
0x56, 0xe4, 0x27, 0xaa, 0x8a, 0x45, 0x40, 0x88, 0x4c, 0x37,
0xde, 0x15, 0x9a, 0x58, 0x02, 0x8a, 0xbc, 0x0e)
};
ke_test_vector_t ecp521 = {
.method = ECP_521_BIT, .priv_len = 66, .pub_len = 132, .shared_len = 66,
.priv_a = "\x01\x13\xf8\x2d\xa8\x25\x73\x5e\x3d\x97\x27\x66\x83\xb2\xb7\x42"
"\x77\xba\xd2\x73\x35\xea\x71\x66\x4a\xf2\x43\x0c\xc4\xf3\x34\x59"
"\xb9\x66\x9e\xe7\x8b\x3f\xfb\x9b\x86\x83\x01\x5d\x34\x4d\xcb\xfe"
"\xf6\xfb\x9a\xf4\xc6\xc4\x70\xbe\x25\x45\x16\xcd\x3c\x1a\x1f\xb4"
"\x73\x62",
.priv_b = "\x00\xce\xe3\x48\x0d\x86\x45\xa1\x7d\x24\x9f\x27\x76\xd2\x8b\xae"
"\x61\x69\x52\xd1\x79\x1f\xdb\x4b\x70\xf7\xc3\x37\x87\x32\xaa\x1b"
"\x22\x92\x84\x48\xbc\xd1\xdc\x24\x96\xd4\x35\xb0\x10\x48\x06\x6e"
"\xbe\x4f\x72\x90\x3c\x36\x1b\x1a\x9d\xc1\x19\x3d\xc2\xc9\xd0\x89"
"\x1b\x96",
.pub_a = "\x01\xeb\xb3\x4d\xd7\x57\x21\xab\xf8\xad\xc9\xdb\xed\x17\x88\x9c"
"\xbb\x97\x65\xd9\x0a\x7c\x60\xf2\xce\xf0\x07\xbb\x0f\x2b\x26\xe1"
"\x48\x81\xfd\x44\x42\xe6\x89\xd6\x1c\xb2\xdd\x04\x6e\xe3\x0e\x3f"
"\xfd\x20\xf9\xa4\x5b\xbd\xf6\x41\x3d\x58\x3a\x2d\xbf\x59\x92\x4f"
"\xd3\x5c\x00\xf6\xb6\x32\xd1\x94\xc0\x38\x8e\x22\xd8\x43\x7e\x55"
"\x8c\x55\x2a\xe1\x95\xad\xfd\x15\x3f\x92\xd7\x49\x08\x35\x1b\x2f"
"\x8c\x4e\xda\x94\xed\xb0\x91\x6d\x1b\x53\xc0\x20\xb5\xee\xca\xed"
"\x1a\x5f\xc3\x8a\x23\x3e\x48\x30\x58\x7b\xb2\xee\x34\x89\xb3\xb4"
"\x2a\x5a\x86\xa4",
.pub_b = "\x01\x0e\xbf\xaf\xc6\xe8\x5e\x08\xd2\x4b\xff\xfc\xc1\xa4\x51\x1d"
"\xb0\xe6\x34\xbe\xeb\x1b\x6d\xec\x8c\x59\x39\xae\x44\x76\x62\x01"
"\xaf\x62\x00\x43\x0b\xa9\x7c\x8a\xc6\xa0\xe9\xf0\x8b\x33\xce\x7e"
"\x9f\xee\xb5\xba\x4e\xe5\xe0\xd8\x15\x10\xc2\x42\x95\xb8\xa0\x8d"
"\x02\x35\x00\xa4\xa6\xec\x30\x0d\xf9\xe2\x57\xb0\x37\x2b\x5e\x7a"
"\xbf\xef\x09\x34\x36\x71\x9a\x77\x88\x7e\xbb\x0b\x18\xcf\x80\x99"
"\xb9\xf4\x21\x2b\x6e\x30\xa1\x41\x9c\x18\xe0\x29\xd3\x68\x63\xcc"
"\x9d\x44\x8f\x4d\xba\x4d\x2a\x0e\x60\x71\x1b\xe5\x72\x91\x5f\xbd"
"\x4f\xef\x26\x95",
.shared = "\x00\xcd\xea\x89\x62\x1c\xfa\x46\xb1\x32\xf9\xe4\xcf\xe2\x26\x1c"
"\xde\x2d\x43\x68\xeb\x56\x56\x63\x4c\x7c\xc9\x8c\x7a\x00\xcd\xe5"
"\x4e\xd1\x86\x6a\x0d\xd3\xe6\x12\x6c\x9d\x2f\x84\x5d\xaf\xf8\x2c"
"\xeb\x1d\xa0\x8f\x5d\x87\x52\x1b\xb0\xeb\xec\xa7\x79\x11\x16\x9c"
"\x20\xcc",
.method = ECP_521_BIT,
.seed = chunk_from_chars(
0x01, 0x13, 0xf8, 0x2d, 0xa8, 0x25, 0x73, 0x5e, 0x3d, 0x97,
0x27, 0x66, 0x83, 0xb2, 0xb7, 0x42, 0x77, 0xba, 0xd2, 0x73,
0x35, 0xea, 0x71, 0x66, 0x4a, 0xf2, 0x43, 0x0c, 0xc4, 0xf3,
0x34, 0x59, 0xb9, 0x66, 0x9e, 0xe7, 0x8b, 0x3f, 0xfb, 0x9b,
0x86, 0x83, 0x01, 0x5d, 0x34, 0x4d, 0xcb, 0xfe, 0xf6, 0xfb,
0x9a, 0xf4, 0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0xed, 0xb0, 0x91, 0x6d, 0x1b, 0x53, 0xc0, 0x20, 0xb5, 0xee,
0xca, 0xed, 0x1a, 0x5f, 0xc3, 0x8a, 0x23, 0x3e, 0x48, 0x30,
0x58, 0x7b, 0xb2, 0xee, 0x34, 0x89, 0xb3, 0xb4, 0x2a, 0x5a,
0x86, 0xa4),
.pub_r = chunk_from_chars(
0x01, 0x0e, 0xbf, 0xaf, 0xc6, 0xe8, 0x5e, 0x08, 0xd2, 0x4b,
0xff, 0xfc, 0xc1, 0xa4, 0x51, 0x1d, 0xb0, 0xe6, 0x34, 0xbe,
0xeb, 0x1b, 0x6d, 0xec, 0x8c, 0x59, 0x39, 0xae, 0x44, 0x76,
0x62, 0x01, 0xaf, 0x62, 0x00, 0x43, 0x0b, 0xa9, 0x7c, 0x8a,
0xc6, 0xa0, 0xe9, 0xf0, 0x8b, 0x33, 0xce, 0x7e, 0x9f, 0xee,
0xb5, 0xba, 0x4e, 0xe5, 0xe0, 0xd8, 0x15, 0x10, 0xc2, 0x42,
0x95, 0xb8, 0xa0, 0x8d, 0x02, 0x35, 0x00, 0xa4, 0xa6, 0xec,
0x30, 0x0d, 0xf9, 0xe2, 0x57, 0xb0, 0x37, 0x2b, 0x5e, 0x7a,
0xbf, 0xef, 0x09, 0x34, 0x36, 0x71, 0x9a, 0x77, 0x88, 0x7e,
0xbb, 0x0b, 0x18, 0xcf, 0x80, 0x99, 0xb9, 0xf4, 0x21, 0x2b, /* 100 */
0x6e, 0x30, 0xa1, 0x41, 0x9c, 0x18, 0xe0, 0x29, 0xd3, 0x68,
0x63, 0xcc, 0x9d, 0x44, 0x8f, 0x4d, 0xba, 0x4d, 0x2a, 0x0e,
0x60, 0x71, 0x1b, 0xe5, 0x72, 0x91, 0x5f, 0xbd, 0x4f, 0xef,
0x26, 0x95),
.shared = chunk_from_chars(
0x00, 0xcd, 0xea, 0x89, 0x62, 0x1c, 0xfa, 0x46, 0xb1, 0x32,
0xf9, 0xe4, 0xcf, 0xe2, 0x26, 0x1c, 0xde, 0x2d, 0x43, 0x68,
0xeb, 0x56, 0x56, 0x63, 0x4c, 0x7c, 0xc9, 0x8c, 0x7a, 0x00,
0xcd, 0xe5, 0x4e, 0xd1, 0x86, 0x6a, 0x0d, 0xd3, 0xe6, 0x12,
0x6c, 0x9d, 0x2f, 0x84, 0x5d, 0xaf, 0xf8, 0x2c, 0xeb, 0x1d,
0xa0, 0x8f, 0x5d, 0x87, 0x52, 0x1b, 0xb0, 0xeb, 0xec, 0xa7,
0x79, 0x11, 0x16, 0x9c, 0x20, 0xcc)
};

View File

@ -2,6 +2,9 @@
* Copyright (C) 2015 Martin Willi
* Copyright (C) 2015 revosec AG
*
* Copyright (C) 2019 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the Licenseor (at your
@ -20,94 +23,162 @@
*/
ke_test_vector_t ecp224bp = {
.method = ECP_224_BP, .priv_len = 28, .pub_len = 56, .shared_len = 28,
.priv_a = "\x7c\x4b\x7a\x2c\x8a\x4b\xad\x1f\xbb\x7d\x79\xcc\x09\x55\xdb\x7c"
"\x6a\x46\x60\xca\x64\xcc\x47\x78\x15\x9b\x49\x5e",
.priv_b = "\x63\x97\x6d\x4a\xae\x6c\xd0\xf6\xdd\x18\xde\xfe\xf5\x5d\x96\x56"
"\x9d\x05\x07\xc0\x3e\x74\xd6\x48\x6f\xfa\x28\xfb",
.pub_a = "\xb1\x04\xa6\x7a\x6f\x6e\x85\xe1\x4e\xc1\x82\x5e\x15\x39\xe8\xec"
"\xdb\xbf\x58\x49\x22\x36\x7d\xd8\x8c\x6b\xdc\xf2\x46\xd7\x82\xe7"
"\xfd\xb5\xf6\x0c\xd8\x40\x43\x01\xac\x59\x49\xc5\x8e\xdb\x26\xbc"
"\x68\xba\x07\x69\x5b\x75\x0a\x94",
.pub_b = "\x2a\x97\x08\x9a\x92\x96\x14\x7b\x71\xb2\x1a\x4b\x57\x4e\x12\x78"
"\x24\x5b\x53\x6f\x14\xd8\xc2\xb9\xd0\x7a\x87\x4e\x9b\x90\x0d\x7c"
"\x77\xa7\x09\xa7\x97\x27\x6b\x8c\xa1\xba\x61\xbb\x95\xb5\x46\xfc"
"\x29\xf8\x62\xe4\x4d\x59\xd2\x5b",
.shared = "\x31\x2d\xfd\x98\x78\x3f\x9f\xb7\x7b\x97\x04\x94\x5a\x73\xbe\xb6"
"\xdc\xcb\xe3\xb6\x5d\x0f\x96\x7d\xca\xb5\x74\xeb",
.method = ECP_224_BP,
.seed = chunk_from_chars(
0x7c, 0x4b, 0x7a, 0x2c, 0x8a, 0x4b, 0xad, 0x1f, 0xbb, 0x7d,
0x79, 0xcc, 0x09, 0x55, 0xdb, 0x7c, 0x6a, 0x46, 0x60, 0xca,
0x64, 0xcc, 0x47, 0x78, 0x15, 0x9b, 0x49, 0x5e, /* - */
0x63, 0x97, 0x6d, 0x4a, 0xae, 0x6c, 0xd0, 0xf6, 0xdd, 0x18,
0xde, 0xfe, 0xf5, 0x5d, 0x96, 0x56, 0x9d, 0x05, 0x07, 0xc0,
0x3e, 0x74, 0xd6, 0x48, 0x6f, 0xfa, 0x28, 0xfb),
.pub_i = chunk_from_chars(
0xb1, 0x04, 0xa6, 0x7a, 0x6f, 0x6e, 0x85, 0xe1, 0x4e, 0xc1,
0x82, 0x5e, 0x15, 0x39, 0xe8, 0xec, 0xdb, 0xbf, 0x58, 0x49,
0x22, 0x36, 0x7d, 0xd8, 0x8c, 0x6b, 0xdc, 0xf2, 0x46, 0xd7,
0x82, 0xe7, 0xfd, 0xb5, 0xf6, 0x0c, 0xd8, 0x40, 0x43, 0x01,
0xac, 0x59, 0x49, 0xc5, 0x8e, 0xdb, 0x26, 0xbc, 0x68, 0xba,
0x07, 0x69, 0x5b, 0x75, 0x0a, 0x94),
.pub_r = chunk_from_chars(
0x2a, 0x97, 0x08, 0x9a, 0x92, 0x96, 0x14, 0x7b, 0x71, 0xb2,
0x1a, 0x4b, 0x57, 0x4e, 0x12, 0x78, 0x24, 0x5b, 0x53, 0x6f,
0x14, 0xd8, 0xc2, 0xb9, 0xd0, 0x7a, 0x87, 0x4e, 0x9b, 0x90,
0x0d, 0x7c, 0x77, 0xa7, 0x09, 0xa7, 0x97, 0x27, 0x6b, 0x8c,
0xa1, 0xba, 0x61, 0xbb, 0x95, 0xb5, 0x46, 0xfc, 0x29, 0xf8,
0x62, 0xe4, 0x4d, 0x59, 0xd2, 0x5b),
.shared = chunk_from_chars(
0x31, 0x2d, 0xfd, 0x98, 0x78, 0x3f, 0x9f, 0xb7, 0x7b, 0x97,
0x04, 0x94, 0x5a, 0x73, 0xbe, 0xb6, 0xdc, 0xcb, 0xe3, 0xb6,
0x5d, 0x0f, 0x96, 0x7d, 0xca, 0xb5, 0x74, 0xeb)
};
ke_test_vector_t ecp256bp = {
.method = ECP_256_BP, .priv_len = 32, .pub_len = 64, .shared_len = 32,
.priv_a = "\x81\xdb\x1e\xe1\x00\x15\x0f\xf2\xea\x33\x8d\x70\x82\x71\xbe\x38"
"\x30\x0c\xb5\x42\x41\xd7\x99\x50\xf7\x7b\x06\x30\x39\x80\x4f\x1d",
.priv_b = "\x55\xe4\x0b\xc4\x1e\x37\xe3\xe2\xad\x25\xc3\xc6\x65\x45\x11\xff"
"\xa8\x47\x4a\x91\xa0\x03\x20\x87\x59\x38\x52\xd3\xe7\xd7\x6b\xd3",
.pub_a = "\x44\x10\x6e\x91\x3f\x92\xbc\x02\xa1\x70\x5d\x99\x53\xa8\x41\x4d"
"\xb9\x5e\x1a\xaa\x49\xe8\x1d\x9e\x85\xf9\x29\xa8\xe3\x10\x0b\xe5"
"\x8a\xb4\x84\x6f\x11\xca\xcc\xb7\x3c\xe4\x9c\xbd\xd1\x20\xf5\xa9"
"\x00\xa6\x9f\xd3\x2c\x27\x22\x23\xf7\x89\xef\x10\xeb\x08\x9b\xdc",
.pub_b = "\x8d\x2d\x68\x8c\x6c\xf9\x3e\x11\x60\xad\x04\xcc\x44\x29\x11\x7d"
"\xc2\xc4\x18\x25\xe1\xe9\xfc\xa0\xad\xdd\x34\xe6\xf1\xb3\x9f\x7b"
"\x99\x0c\x57\x52\x08\x12\xbe\x51\x26\x41\xe4\x70\x34\x83\x21\x06"
"\xbc\x7d\x3e\x8d\xd0\xe4\xc7\xf1\x13\x6d\x70\x06\x54\x7c\xec\x6a",
.shared = "\x89\xaf\xc3\x9d\x41\xd3\xb3\x27\x81\x4b\x80\x94\x0b\x04\x25\x90"
"\xf9\x65\x56\xec\x91\xe6\xae\x79\x39\xbc\xe3\x1f\x3a\x18\xbf\x2b",
.method = ECP_256_BP,
.seed = chunk_from_chars(
0x81, 0xdb, 0x1e, 0xe1, 0x00, 0x15, 0x0f, 0xf2, 0xea, 0x33,
0x8d, 0x70, 0x82, 0x71, 0xbe, 0x38, 0x30, 0x0c, 0xb5, 0x42,
0x41, 0xd7, 0x99, 0x50, 0xf7, 0x7b, 0x06, 0x30, 0x39, 0x80,
0x4f, 0x1d, /* - */
0x55, 0xe4, 0x0b, 0xc4, 0x1e, 0x37, 0xe3, 0xe2, 0xad, 0x25,
0xc3, 0xc6, 0x65, 0x45, 0x11, 0xff, 0xa8, 0x47, 0x4a, 0x91,
0xa0, 0x03, 0x20, 0x87, 0x59, 0x38, 0x52, 0xd3, 0xe7, 0xd7,
0x6b, 0xd3),
.pub_i = chunk_from_chars(
0x44, 0x10, 0x6e, 0x91, 0x3f, 0x92, 0xbc, 0x02, 0xa1, 0x70,
0x5d, 0x99, 0x53, 0xa8, 0x41, 0x4d, 0xb9, 0x5e, 0x1a, 0xaa,
0x49, 0xe8, 0x1d, 0x9e, 0x85, 0xf9, 0x29, 0xa8, 0xe3, 0x10,
0x0b, 0xe5, 0x8a, 0xb4, 0x84, 0x6f, 0x11, 0xca, 0xcc, 0xb7,
0x3c, 0xe4, 0x9c, 0xbd, 0xd1, 0x20, 0xf5, 0xa9, 0x00, 0xa6,
0x9f, 0xd3, 0x2c, 0x27, 0x22, 0x23, 0xf7, 0x89, 0xef, 0x10,
0xeb, 0x08, 0x9b, 0xdc),
.pub_r = chunk_from_chars(
0x8d, 0x2d, 0x68, 0x8c, 0x6c, 0xf9, 0x3e, 0x11, 0x60, 0xad,
0x04, 0xcc, 0x44, 0x29, 0x11, 0x7d, 0xc2, 0xc4, 0x18, 0x25,
0xe1, 0xe9, 0xfc, 0xa0, 0xad, 0xdd, 0x34, 0xe6, 0xf1, 0xb3,
0x9f, 0x7b, 0x99, 0x0c, 0x57, 0x52, 0x08, 0x12, 0xbe, 0x51,
0x26, 0x41, 0xe4, 0x70, 0x34, 0x83, 0x21, 0x06, 0xbc, 0x7d,
0x3e, 0x8d, 0xd0, 0xe4, 0xc7, 0xf1, 0x13, 0x6d, 0x70, 0x06,
0x54, 0x7c, 0xec, 0x6a),
.shared = chunk_from_chars(
0x89, 0xaf, 0xc3, 0x9d, 0x41, 0xd3, 0xb3, 0x27, 0x81, 0x4b,
0x80, 0x94, 0x0b, 0x04, 0x25, 0x90, 0xf9, 0x65, 0x56, 0xec,
0x91, 0xe6, 0xae, 0x79, 0x39, 0xbc, 0xe3, 0x1f, 0x3a, 0x18,
0xbf, 0x2b)
};
ke_test_vector_t ecp384bp = {
.method = ECP_384_BP, .priv_len = 48, .pub_len = 96, .shared_len = 48,
.priv_a = "\x1e\x20\xf5\xe0\x48\xa5\x88\x6f\x1f\x15\x7c\x74\xe9\x1b\xde\x2b"
"\x98\xc8\xb5\x2d\x58\xe5\x00\x3d\x57\x05\x3f\xc4\xb0\xbd\x65\xd6"
"\xf1\x5e\xb5\xd1\xee\x16\x10\xdf\x87\x07\x95\x14\x36\x27\xd0\x42",
.priv_b = "\x03\x26\x40\xbc\x60\x03\xc5\x92\x60\xf7\x25\x0c\x3d\xb5\x8c\xe6"
"\x47\xf9\x8e\x12\x60\xac\xce\x4a\xcd\xa3\xdd\x86\x9f\x74\xe0\x1f"
"\x8b\xa5\xe0\x32\x43\x09\xdb\x6a\x98\x31\x49\x7a\xba\xc9\x66\x70",
.pub_a = "\x68\xb6\x65\xdd\x91\xc1\x95\x80\x06\x50\xcd\xd3\x63\xc6\x25\xf4"
"\xe7\x42\xe8\x13\x46\x67\xb7\x67\xb1\xb4\x76\x79\x35\x88\xf8\x85"
"\xab\x69\x8c\x85\x2d\x4a\x6e\x77\xa2\x52\xd6\x38\x0f\xca\xf0\x68"
"\x55\xbc\x91\xa3\x9c\x9e\xc0\x1d\xee\x36\x01\x7b\x7d\x67\x3a\x93"
"\x12\x36\xd2\xf1\xf5\xc8\x39\x42\xd0\x49\xe3\xfa\x20\x60\x74\x93"
"\xe0\xd0\x38\xff\x2f\xd3\x0c\x2a\xb6\x7d\x15\xc8\x5f\x7f\xaa\x59",
.pub_b = "\x4d\x44\x32\x6f\x26\x9a\x59\x7a\x5b\x58\xbb\xa5\x65\xda\x55\x56"
"\xed\x7f\xd9\xa8\xa9\xeb\x76\xc2\x5f\x46\xdb\x69\xd1\x9d\xc8\xce"
"\x6a\xd1\x8e\x40\x4b\x15\x73\x8b\x20\x86\xdf\x37\xe7\x1d\x1e\xb4"
"\x62\xd6\x92\x13\x6d\xe5\x6c\xbe\x93\xbf\x5f\xa3\x18\x8e\xf5\x8b"
"\xc8\xa3\xa0\xec\x6c\x1e\x15\x1a\x21\x03\x8a\x42\xe9\x18\x53\x29"
"\xb5\xb2\x75\x90\x3d\x19\x2f\x8d\x4e\x1f\x32\xfe\x9c\xc7\x8c\x48",
.shared = "\x0b\xd9\xd3\xa7\xea\x0b\x3d\x51\x9d\x09\xd8\xe4\x8d\x07\x85\xfb"
"\x74\x4a\x6b\x35\x5e\x63\x04\xbc\x51\xc2\x29\xfb\xbc\xe2\x39\xbb"
"\xad\xf6\x40\x37\x15\xc3\x5d\x4f\xb2\xa5\x44\x4f\x57\x5d\x4f\x42",
.method = ECP_384_BP,
.seed = chunk_from_chars(
0x1e, 0x20, 0xf5, 0xe0, 0x48, 0xa5, 0x88, 0x6f, 0x1f, 0x15,
0x7c, 0x74, 0xe9, 0x1b, 0xde, 0x2b, 0x98, 0xc8, 0xb5, 0x2d,
0x58, 0xe5, 0x00, 0x3d, 0x57, 0x05, 0x3f, 0xc4, 0xb0, 0xbd,
0x65, 0xd6, 0xf1, 0x5e, 0xb5, 0xd1, 0xee, 0x16, 0x10, 0xdf,
0x87, 0x07, 0x95, 0x14, 0x36, 0x27, 0xd0, 0x42, /* - */
0x03, 0x26, 0x40, 0xbc, 0x60, 0x03, 0xc5, 0x92, 0x60, 0xf7,
0x25, 0x0c, 0x3d, 0xb5, 0x8c, 0xe6, 0x47, 0xf9, 0x8e, 0x12,
0x60, 0xac, 0xce, 0x4a, 0xcd, 0xa3, 0xdd, 0x86, 0x9f, 0x74,
0xe0, 0x1f, 0x8b, 0xa5, 0xe0, 0x32, 0x43, 0x09, 0xdb, 0x6a,
0x98, 0x31, 0x49, 0x7a, 0xba, 0xc9, 0x66, 0x70),
.pub_i = chunk_from_chars(
0x68, 0xb6, 0x65, 0xdd, 0x91, 0xc1, 0x95, 0x80, 0x06, 0x50,
0xcd, 0xd3, 0x63, 0xc6, 0x25, 0xf4, 0xe7, 0x42, 0xe8, 0x13,
0x46, 0x67, 0xb7, 0x67, 0xb1, 0xb4, 0x76, 0x79, 0x35, 0x88,
0xf8, 0x85, 0xab, 0x69, 0x8c, 0x85, 0x2d, 0x4a, 0x6e, 0x77,
0xa2, 0x52, 0xd6, 0x38, 0x0f, 0xca, 0xf0, 0x68, 0x55, 0xbc,
0x91, 0xa3, 0x9c, 0x9e, 0xc0, 0x1d, 0xee, 0x36, 0x01, 0x7b,
0x7d, 0x67, 0x3a, 0x93, 0x12, 0x36, 0xd2, 0xf1, 0xf5, 0xc8,
0x39, 0x42, 0xd0, 0x49, 0xe3, 0xfa, 0x20, 0x60, 0x74, 0x93,
0xe0, 0xd0, 0x38, 0xff, 0x2f, 0xd3, 0x0c, 0x2a, 0xb6, 0x7d,
0x15, 0xc8, 0x5f, 0x7f, 0xaa, 0x59),
.pub_r = chunk_from_chars(
0x4d, 0x44, 0x32, 0x6f, 0x26, 0x9a, 0x59, 0x7a, 0x5b, 0x58,
0xbb, 0xa5, 0x65, 0xda, 0x55, 0x56, 0xed, 0x7f, 0xd9, 0xa8,
0xa9, 0xeb, 0x76, 0xc2, 0x5f, 0x46, 0xdb, 0x69, 0xd1, 0x9d,
0xc8, 0xce, 0x6a, 0xd1, 0x8e, 0x40, 0x4b, 0x15, 0x73, 0x8b,
0x20, 0x86, 0xdf, 0x37, 0xe7, 0x1d, 0x1e, 0xb4, 0x62, 0xd6,
0x92, 0x13, 0x6d, 0xe5, 0x6c, 0xbe, 0x93, 0xbf, 0x5f, 0xa3,
0x18, 0x8e, 0xf5, 0x8b, 0xc8, 0xa3, 0xa0, 0xec, 0x6c, 0x1e,
0x15, 0x1a, 0x21, 0x03, 0x8a, 0x42, 0xe9, 0x18, 0x53, 0x29,
0xb5, 0xb2, 0x75, 0x90, 0x3d, 0x19, 0x2f, 0x8d, 0x4e, 0x1f,
0x32, 0xfe, 0x9c, 0xc7, 0x8c, 0x48),
.shared = chunk_from_chars(
0x0b, 0xd9, 0xd3, 0xa7, 0xea, 0x0b, 0x3d, 0x51, 0x9d, 0x09,
0xd8, 0xe4, 0x8d, 0x07, 0x85, 0xfb, 0x74, 0x4a, 0x6b, 0x35,
0x5e, 0x63, 0x04, 0xbc, 0x51, 0xc2, 0x29, 0xfb, 0xbc, 0xe2,
0x39, 0xbb, 0xad, 0xf6, 0x40, 0x37, 0x15, 0xc3, 0x5d, 0x4f,
0xb2, 0xa5, 0x44, 0x4f, 0x57, 0x5d, 0x4f, 0x42)
};
ke_test_vector_t ecp512bp = {
.method = ECP_512_BP, .priv_len = 64, .pub_len = 128, .shared_len = 64,
.priv_a = "\x16\x30\x2f\xf0\xdb\xbb\x5a\x8d\x73\x3d\xab\x71\x41\xc1\xb4\x5a"
"\xcb\xc8\x71\x59\x39\x67\x7f\x6a\x56\x85\x0a\x38\xbd\x87\xbd\x59"
"\xb0\x9e\x80\x27\x96\x09\xff\x33\x3e\xb9\xd4\xc0\x61\x23\x1f\xb2"
"\x6f\x92\xee\xb0\x49\x82\xa5\xf1\xd1\x76\x4c\xad\x57\x66\x54\x22",
.priv_b = "\x23\x0e\x18\xe1\xbc\xc8\x8a\x36\x2f\xa5\x4e\x4e\xa3\x90\x20\x09"
"\x29\x2f\x7f\x80\x33\x62\x4f\xd4\x71\xb5\xd8\xac\xe4\x9d\x12\xcf"
"\xab\xbc\x19\x96\x3d\xab\x8e\x2f\x1e\xba\x00\xbf\xfb\x29\xe4\xd7"
"\x2d\x13\xf2\x22\x45\x62\xf4\x05\xcb\x80\x50\x36\x66\xb2\x54\x29",
.pub_a = "\x0a\x42\x05\x17\xe4\x06\xaa\xc0\xac\xdc\xe9\x0f\xcd\x71\x48\x77"
"\x18\xd3\xb9\x53\xef\xd7\xfb\xec\x5f\x7f\x27\xe2\x8c\x61\x49\x99"
"\x93\x97\xe9\x1e\x02\x9e\x06\x45\x7d\xb2\xd3\xe6\x40\x66\x8b\x39"
"\x2c\x2a\x7e\x73\x7a\x7f\x0b\xf0\x44\x36\xd1\x16\x40\xfd\x09\xfd"
"\x72\xe6\x88\x2e\x8d\xb2\x8a\xad\x36\x23\x7c\xd2\x5d\x58\x0d\xb2"
"\x37\x83\x96\x1c\x8d\xc5\x2d\xfa\x2e\xc1\x38\xad\x47\x2a\x0f\xce"
"\xf3\x88\x7c\xf6\x2b\x62\x3b\x2a\x87\xde\x5c\x58\x83\x01\xea\x3e"
"\x5f\xc2\x69\xb3\x73\xb6\x07\x24\xf5\xe8\x2a\x6a\xd1\x47\xfd\xe7",
.pub_b = "\x9d\x45\xf6\x6d\xe5\xd6\x7e\x2e\x6d\xb6\xe9\x3a\x59\xce\x0b\xb4"
"\x81\x06\x09\x7f\xf7\x8a\x08\x1d\xe7\x81\xcd\xb3\x1f\xce\x8c\xcb"
"\xaa\xea\x8d\xd4\x32\x0c\x41\x19\xf1\xe9\xcd\x43\x7a\x2e\xab\x37"
"\x31\xfa\x96\x68\xab\x26\x8d\x87\x1d\xed\xa5\x5a\x54\x73\x19\x9f"
"\x2f\xdc\x31\x30\x95\xbc\xdd\x5f\xb3\xa9\x16\x36\xf0\x7a\x95\x9c"
"\x8e\x86\xb5\x63\x6a\x1e\x93\x0e\x83\x96\x04\x9c\xb4\x81\x96\x1d"
"\x36\x5c\xc1\x14\x53\xa0\x6c\x71\x98\x35\x47\x5b\x12\xcb\x52\xfc"
"\x3c\x38\x3b\xce\x35\xe2\x7e\xf1\x94\x51\x2b\x71\x87\x62\x85\xfa",
.shared = "\xa7\x92\x70\x98\x65\x5f\x1f\x99\x76\xfa\x50\xa9\xd5\x66\x86\x5d"
"\xc5\x30\x33\x18\x46\x38\x1c\x87\x25\x6b\xaf\x32\x26\x24\x4b\x76"
"\xd3\x64\x03\xc0\x24\xd7\xbb\xf0\xaa\x08\x03\xea\xff\x40\x5d\x3d"
"\x24\xf1\x1a\x9b\x5c\x0b\xef\x67\x9f\xe1\x45\x4b\x21\xc4\xcd\x1f",
.method = ECP_512_BP,
.seed = chunk_from_chars(
0x16, 0x30, 0x2f, 0xf0, 0xdb, 0xbb, 0x5a, 0x8d, 0x73, 0x3d,
0xab, 0x71, 0x41, 0xc1, 0xb4, 0x5a, 0xcb, 0xc8, 0x71, 0x59,
0x39, 0x67, 0x7f, 0x6a, 0x56, 0x85, 0x0a, 0x38, 0xbd, 0x87,
0xbd, 0x59, 0xb0, 0x9e, 0x80, 0x27, 0x96, 0x09, 0xff, 0x33,
0x3e, 0xb9, 0xd4, 0xc0, 0x61, 0x23, 0x1f, 0xb2, 0x6f, 0x92,
0xee, 0xb0, 0x49, 0x82, 0xa5, 0xf1, 0xd1, 0x76, 0x4c, 0xad,
0x57, 0x66, 0x54, 0x22, /* - */
0x23, 0x0e, 0x18, 0xe1, 0xbc, 0xc8, 0x8a, 0x36, 0x2f, 0xa5,
0x4e, 0x4e, 0xa3, 0x90, 0x20, 0x09, 0x29, 0x2f, 0x7f, 0x80,
0x33, 0x62, 0x4f, 0xd4, 0x71, 0xb5, 0xd8, 0xac, 0xe4, 0x9d,
0x12, 0xcf, 0xab, 0xbc, 0x19, 0x96, 0x3d, 0xab, 0x8e, 0x2f,
0x1e, 0xba, 0x00, 0xbf, 0xfb, 0x29, 0xe4, 0xd7, 0x2d, 0x13,
0xf2, 0x22, 0x45, 0x62, 0xf4, 0x05, 0xcb, 0x80, 0x50, 0x36,
0x66, 0xb2, 0x54, 0x29),
.pub_i = chunk_from_chars(
0x0a, 0x42, 0x05, 0x17, 0xe4, 0x06, 0xaa, 0xc0, 0xac, 0xdc,
0xe9, 0x0f, 0xcd, 0x71, 0x48, 0x77, 0x18, 0xd3, 0xb9, 0x53,
0xef, 0xd7, 0xfb, 0xec, 0x5f, 0x7f, 0x27, 0xe2, 0x8c, 0x61,
0x49, 0x99, 0x93, 0x97, 0xe9, 0x1e, 0x02, 0x9e, 0x06, 0x45,
0x7d, 0xb2, 0xd3, 0xe6, 0x40, 0x66, 0x8b, 0x39, 0x2c, 0x2a,
0x7e, 0x73, 0x7a, 0x7f, 0x0b, 0xf0, 0x44, 0x36, 0xd1, 0x16,
0x40, 0xfd, 0x09, 0xfd, 0x72, 0xe6, 0x88, 0x2e, 0x8d, 0xb2,
0x8a, 0xad, 0x36, 0x23, 0x7c, 0xd2, 0x5d, 0x58, 0x0d, 0xb2,
0x37, 0x83, 0x96, 0x1c, 0x8d, 0xc5, 0x2d, 0xfa, 0x2e, 0xc1,
0x38, 0xad, 0x47, 0x2a, 0x0f, 0xce, 0xf3, 0x88, 0x7c, 0xf6, /* 100 */
0x2b, 0x62, 0x3b, 0x2a, 0x87, 0xde, 0x5c, 0x58, 0x83, 0x01,
0xea, 0x3e, 0x5f, 0xc2, 0x69, 0xb3, 0x73, 0xb6, 0x07, 0x24,
0xf5, 0xe8, 0x2a, 0x6a, 0xd1, 0x47, 0xfd, 0xe7),
.pub_r = chunk_from_chars(
0x9d, 0x45, 0xf6, 0x6d, 0xe5, 0xd6, 0x7e, 0x2e, 0x6d, 0xb6,
0xe9, 0x3a, 0x59, 0xce, 0x0b, 0xb4, 0x81, 0x06, 0x09, 0x7f,
0xf7, 0x8a, 0x08, 0x1d, 0xe7, 0x81, 0xcd, 0xb3, 0x1f, 0xce,
0x8c, 0xcb, 0xaa, 0xea, 0x8d, 0xd4, 0x32, 0x0c, 0x41, 0x19,
0xf1, 0xe9, 0xcd, 0x43, 0x7a, 0x2e, 0xab, 0x37, 0x31, 0xfa,
0x96, 0x68, 0xab, 0x26, 0x8d, 0x87, 0x1d, 0xed, 0xa5, 0x5a,
0x54, 0x73, 0x19, 0x9f, 0x2f, 0xdc, 0x31, 0x30, 0x95, 0xbc,
0xdd, 0x5f, 0xb3, 0xa9, 0x16, 0x36, 0xf0, 0x7a, 0x95, 0x9c,
0x8e, 0x86, 0xb5, 0x63, 0x6a, 0x1e, 0x93, 0x0e, 0x83, 0x96,
0x04, 0x9c, 0xb4, 0x81, 0x96, 0x1d, 0x36, 0x5c, 0xc1, 0x14, /* 100 */
0x53, 0xa0, 0x6c, 0x71, 0x98, 0x35, 0x47, 0x5b, 0x12, 0xcb,
0x52, 0xfc, 0x3c, 0x38, 0x3b, 0xce, 0x35, 0xe2, 0x7e, 0xf1,
0x94, 0x51, 0x2b, 0x71, 0x87, 0x62, 0x85, 0xfa),
.shared = chunk_from_chars(
0xa7, 0x92, 0x70, 0x98, 0x65, 0x5f, 0x1f, 0x99, 0x76, 0xfa,
0x50, 0xa9, 0xd5, 0x66, 0x86, 0x5d, 0xc5, 0x30, 0x33, 0x18,
0x46, 0x38, 0x1c, 0x87, 0x25, 0x6b, 0xaf, 0x32, 0x26, 0x24,
0x4b, 0x76, 0xd3, 0x64, 0x03, 0xc0, 0x24, 0xd7, 0xbb, 0xf0,
0xaa, 0x08, 0x03, 0xea, 0xff, 0x40, 0x5d, 0x3d, 0x24, 0xf1,
0x1a, 0x9b, 0x5c, 0x0b, 0xef, 0x67, 0x9f, 0xe1, 0x45, 0x4b,
0x21, 0xc4, 0xcd, 0x1f)
};

File diff suppressed because it is too large Load Diff

View File

@ -2,6 +2,9 @@
* Copyright (C) 2015 Martin Willi
* Copyright (C) 2015 revosec AG
*
* Copyright (C) 2019 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the Licenseor (at your
@ -20,145 +23,238 @@
*/
ke_test_vector_t modp1024_160 = {
.method = MODP_1024_160, .priv_len = 20, .pub_len = 128, .shared_len = 128,
.priv_a = "\xB9\xA3\xB3\xAE\x8F\xEF\xC1\xA2\x93\x04\x96\x50\x70\x86\xF8\x45"
"\x5D\x48\x94\x3E",
.priv_b = "\x93\x92\xC9\xF9\xEB\x6A\x7A\x6A\x90\x22\xF7\xD8\x3E\x72\x23\xC6"
"\x83\x5B\xBD\xDA",
.pub_a = "\x2A\x85\x3B\x3D\x92\x19\x75\x01\xB9\x01\x5B\x2D\xEB\x3E\xD8\x4F"
"\x5E\x02\x1D\xCC\x3E\x52\xF1\x09\xD3\x27\x3D\x2B\x75\x21\x28\x1C"
"\xBA\xBE\x0E\x76\xFF\x57\x27\xFA\x8A\xCC\xE2\x69\x56\xBA\x9A\x1F"
"\xCA\x26\xF2\x02\x28\xD8\x69\x3F\xEB\x10\x84\x1D\x84\xA7\x36\x00"
"\x54\xEC\xE5\xA7\xF5\xB7\xA6\x1A\xD3\xDF\xB3\xC6\x0D\x2E\x43\x10"
"\x6D\x87\x27\xDA\x37\xDF\x9C\xCE\x95\xB4\x78\x75\x5D\x06\xBC\xEA"
"\x8F\x9D\x45\x96\x5F\x75\xA5\xF3\xD1\xDF\x37\x01\x16\x5F\xC9\xE5"
"\x0C\x42\x79\xCE\xB0\x7F\x98\x95\x40\xAE\x96\xD5\xD8\x8E\xD7\x76",
.pub_b = "\x71\x7A\x6C\xB0\x53\x37\x1F\xF4\xA3\xB9\x32\x94\x1C\x1E\x56\x63"
"\xF8\x61\xA1\xD6\xAD\x34\xAE\x66\x57\x6D\xFB\x98\xF6\xC6\xCB\xF9"
"\xDD\xD5\xA5\x6C\x78\x33\xF6\xBC\xFD\xFF\x09\x55\x82\xAD\x86\x8E"
"\x44\x0E\x8D\x09\xFD\x76\x9E\x3C\xEC\xCD\xC3\xD3\xB1\xE4\xCF\xA0"
"\x57\x77\x6C\xAA\xF9\x73\x9B\x6A\x9F\xEE\x8E\x74\x11\xF8\xD6\xDA"
"\xC0\x9D\x6A\x4E\xDB\x46\xCC\x2B\x5D\x52\x03\x09\x0E\xAE\x61\x26"
"\x31\x1E\x53\xFD\x2C\x14\xB5\x74\xE6\xA3\x10\x9A\x3D\xA1\xBE\x41"
"\xBD\xCE\xAA\x18\x6F\x5C\xE0\x67\x16\xA2\xB6\xA0\x7B\x3C\x33\xFE",
.shared = "\x5C\x80\x4F\x45\x4D\x30\xD9\xC4\xDF\x85\x27\x1F\x93\x52\x8C\x91"
"\xDF\x6B\x48\xAB\x5F\x80\xB3\xB5\x9C\xAA\xC1\xB2\x8F\x8A\xCB\xA9"
"\xCD\x3E\x39\xF3\xCB\x61\x45\x25\xD9\x52\x1D\x2E\x64\x4C\x53\xB8"
"\x07\xB8\x10\xF3\x40\x06\x2F\x25\x7D\x7D\x6F\xBF\xE8\xD5\xE8\xF0"
"\x72\xE9\xB6\xE9\xAF\xDA\x94\x13\xEA\xFB\x2E\x8B\x06\x99\xB1\xFB"
"\x5A\x0C\xAC\xED\xDE\xAE\xAD\x7E\x9C\xFB\xB3\x6A\xE2\xB4\x20\x83"
"\x5B\xD8\x3A\x19\xFB\x0B\x5E\x96\xBF\x8F\xA4\xD0\x9E\x34\x55\x25"
"\x16\x7E\xCD\x91\x55\x41\x6F\x46\xF4\x08\xED\x31\xB6\x3C\x6E\x6D",
.method = MODP_1024_160,
.seed = chunk_from_chars(
0xB9, 0xA3, 0xB3, 0xAE, 0x8F, 0xEF, 0xC1, 0xA2, 0x93, 0x04,
0x96, 0x50, 0x70, 0x86, 0xF8, 0x45, 0x5D, 0x48, 0x94, 0x3E, /* - */
0x93, 0x92, 0xC9, 0xF9, 0xEB, 0x6A, 0x7A, 0x6A, 0x90, 0x22,
0xF7, 0xD8, 0x3E, 0x72, 0x23, 0xC6, 0x83, 0x5B, 0xBD, 0xDA),
.pub_i = chunk_from_chars(
0x2A, 0x85, 0x3B, 0x3D, 0x92, 0x19, 0x75, 0x01, 0xB9, 0x01,
0x5B, 0x2D, 0xEB, 0x3E, 0xD8, 0x4F, 0x5E, 0x02, 0x1D, 0xCC,
0x3E, 0x52, 0xF1, 0x09, 0xD3, 0x27, 0x3D, 0x2B, 0x75, 0x21,
0x28, 0x1C, 0xBA, 0xBE, 0x0E, 0x76, 0xFF, 0x57, 0x27, 0xFA,
0x8A, 0xCC, 0xE2, 0x69, 0x56, 0xBA, 0x9A, 0x1F, 0xCA, 0x26,
0xF2, 0x02, 0x28, 0xD8, 0x69, 0x3F, 0xEB, 0x10, 0x84, 0x1D,
0x84, 0xA7, 0x36, 0x00, 0x54, 0xEC, 0xE5, 0xA7, 0xF5, 0xB7,
0xA6, 0x1A, 0xD3, 0xDF, 0xB3, 0xC6, 0x0D, 0x2E, 0x43, 0x10,
0x6D, 0x87, 0x27, 0xDA, 0x37, 0xDF, 0x9C, 0xCE, 0x95, 0xB4,
0x78, 0x75, 0x5D, 0x06, 0xBC, 0xEA, 0x8F, 0x9D, 0x45, 0x96, /* 100 */
0x5F, 0x75, 0xA5, 0xF3, 0xD1, 0xDF, 0x37, 0x01, 0x16, 0x5F,
0xC9, 0xE5, 0x0C, 0x42, 0x79, 0xCE, 0xB0, 0x7F, 0x98, 0x95,
0x40, 0xAE, 0x96, 0xD5, 0xD8, 0x8E, 0xD7, 0x76),
.pub_r = chunk_from_chars(
0x71, 0x7A, 0x6C, 0xB0, 0x53, 0x37, 0x1F, 0xF4, 0xA3, 0xB9,
0x32, 0x94, 0x1C, 0x1E, 0x56, 0x63, 0xF8, 0x61, 0xA1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9, 0xAF, 0xDA,
0x94, 0x13, 0xEA, 0xFB, 0x2E, 0x8B, 0x06, 0x99, 0xB1, 0xFB,
0x5A, 0x0C, 0xAC, 0xED, 0xDE, 0xAE, 0xAD, 0x7E, 0x9C, 0xFB,
0xB3, 0x6A, 0xE2, 0xB4, 0x20, 0x83, 0x5B, 0xD8, 0x3A, 0x19, /* 100 */
0xFB, 0x0B, 0x5E, 0x96, 0xBF, 0x8F, 0xA4, 0xD0, 0x9E, 0x34,
0x55, 0x25, 0x16, 0x7E, 0xCD, 0x91, 0x55, 0x41, 0x6F, 0x46,
0xF4, 0x08, 0xED, 0x31, 0xB6, 0x3C, 0x6E, 0x6D)
};
ke_test_vector_t modp2048_224 = {
.method = MODP_2048_224, .priv_len = 28, .pub_len = 256, .shared_len = 256,
.priv_a = "\x22\xe6\x26\x01\xdb\xff\xd0\x67\x08\xa6\x80\xf7\x47\xf3\x61\xf7"
"\x6d\x8f\x4f\x72\x1a\x05\x48\xe4\x83\x29\x4b\x0c",
.priv_b = "\x4f\xf3\xbc\x96\xc7\xfc\x6a\x6d\x71\xd3\xb3\x63\x80\x0a\x7c\xdf"
"\xef\x6f\xc4\x1b\x44\x17\xea\x15\x35\x3b\x75\x90",
.pub_a = "\x1b\x3a\x63\x45\x1b\xd8\x86\xe6\x99\xe6\x7b\x49\x4e\x28\x8b\xd7"
"\xf8\xe0\xd3\x70\xba\xdd\xa7\xa0\xef\xd2\xfd\xe7\xd8\xf6\x61\x45"
"\xcc\x9f\x28\x04\x19\x97\x5e\xb8\x08\x87\x7c\x8a\x4c\x0c\x8e\x0b"
"\xd4\x8d\x4a\x54\x01\xeb\x1e\x87\x76\xbf\xee\xe1\x34\xc0\x38\x31"
"\xac\x27\x3c\xd9\xd6\x35\xab\x0c\xe0\x06\xa4\x2a\x88\x7e\x3f\x52"
"\xfb\x87\x66\xb6\x50\xf3\x80\x78\xbc\x8e\xe8\x58\x0c\xef\xe2\x43"
"\x96\x8c\xfc\x4f\x8d\xc3\xdb\x08\x45\x54\x17\x1d\x41\xbf\x2e\x86"
"\x1b\x7b\xb4\xd6\x9d\xd0\xe0\x1e\xa3\x87\xcb\xaa\x5c\xa6\x72\xaf"
"\xcb\xe8\xbd\xb9\xd6\x2d\x4c\xe1\x5f\x17\xdd\x36\xf9\x1e\xd1\xee"
"\xdd\x65\xca\x4a\x06\x45\x5c\xb9\x4c\xd4\x0a\x52\xec\x36\x0e\x84"
"\xb3\xc9\x26\xe2\x2c\x43\x80\xa3\xbf\x30\x9d\x56\x84\x97\x68\xb7"
"\xf5\x2c\xfd\xf6\x55\xfd\x05\x3a\x7e\xf7\x06\x97\x9e\x7e\x58\x06"
"\xb1\x7d\xfa\xe5\x3a\xd2\xa5\xbc\x56\x8e\xbb\x52\x9a\x7a\x61\xd6"
"\x8d\x25\x6f\x8f\xc9\x7c\x07\x4a\x86\x1d\x82\x7e\x2e\xbc\x8c\x61"
"\x34\x55\x31\x15\xb7\x0e\x71\x03\x92\x0a\xa1\x6d\x85\xe5\x2b\xcb"
"\xab\x8d\x78\x6a\x68\x17\x8f\xa8\xff\x7c\x2f\x5c\x71\x64\x8d\x6f",
.pub_b = "\x4d\xce\xe9\x92\xa9\x76\x2a\x13\xf2\xf8\x38\x44\xad\x3d\x77\xee"
"\x0e\x31\xc9\x71\x8b\x3d\xb6\xc2\x03\x5d\x39\x61\x18\x2c\x3e\x0b"
"\xa2\x47\xec\x41\x82\xd7\x60\xcd\x48\xd9\x95\x99\x97\x06\x22\xa1"
"\x88\x1b\xba\x2d\xc8\x22\x93\x9c\x78\xc3\x91\x2c\x66\x61\xfa\x54"
"\x38\xb2\x07\x66\x22\x2b\x75\xe2\x4c\x2e\x3a\xd0\xc7\x28\x72\x36"
"\x12\x95\x25\xee\x15\xb5\xdd\x79\x98\xaa\x04\xc4\xa9\x69\x6c\xac"
"\xd7\x17\x20\x83\xa9\x7a\x81\x66\x4e\xad\x2c\x47\x9e\x44\x4e\x4c"
"\x06\x54\xcc\x19\xe2\x8d\x77\x03\xce\xe8\xda\xcd\x61\x26\xf5\xd6"
"\x65\xec\x52\xc6\x72\x55\xdb\x92\x01\x4b\x03\x7e\xb6\x21\xa2\xac"
"\x8e\x36\x5d\xe0\x71\xff\xc1\x40\x0a\xcf\x07\x7a\x12\x91\x3d\xd8"
"\xde\x89\x47\x34\x37\xab\x7b\xa3\x46\x74\x3c\x1b\x21\x5d\xd9\xc1"
"\x21\x64\xa7\xe4\x05\x31\x18\xd1\x99\xbe\xc8\xef\x6f\xc5\x61\x17"
"\x0c\x84\xc8\x7d\x10\xee\x9a\x67\x4a\x1f\xa8\xff\xe1\x3b\xdf\xba"
"\x1d\x44\xde\x48\x94\x6d\x68\xdc\x0c\xdd\x77\x76\x35\xa7\xab\x5b"
"\xfb\x1e\x4b\xb7\xb8\x56\xf9\x68\x27\x73\x4c\x18\x41\x38\xe9\x15"
"\xd9\xc3\x00\x2e\xbc\xe5\x31\x20\x54\x6a\x7e\x20\x02\x14\x2b\x6c",
.shared = "\x34\xd9\xbd\xdc\x1b\x42\x17\x6c\x31\x3f\xea\x03\x4c\x21\x03\x4d"
"\x07\x4a\x63\x13\xbb\x4e\xcd\xb3\x70\x3f\xff\x42\x45\x67\xa4\x6b"
"\xdf\x75\x53\x0e\xde\x0a\x9d\xa5\x22\x9d\xe7\xd7\x67\x32\x28\x6c"
"\xbc\x0f\x91\xda\x4c\x3c\x85\x2f\xc0\x99\xc6\x79\x53\x1d\x94\xc7"
"\x8a\xb0\x3d\x9d\xec\xb0\xa4\xe4\xca\x8b\x2b\xb4\x59\x1c\x40\x21"
"\xcf\x8c\xe3\xa2\x0a\x54\x1d\x33\x99\x40\x17\xd0\x20\x0a\xe2\xc9"
"\x51\x6e\x2f\xf5\x14\x57\x79\x26\x9e\x86\x2b\x0f\xb4\x74\xa2\xd5"
"\x6d\xc3\x1e\xd5\x69\xa7\x70\x0b\x4c\x4a\xb1\x6b\x22\xa4\x55\x13"
"\x53\x1e\xf5\x23\xd7\x12\x12\x07\x7b\x5a\x16\x9b\xde\xff\xad\x7a"
"\xd9\x60\x82\x84\xc7\x79\x5b\x6d\x5a\x51\x83\xb8\x70\x66\xde\x17"
"\xd8\xd6\x71\xc9\xeb\xd8\xec\x89\x54\x4d\x45\xec\x06\x15\x93\xd4"
"\x42\xc6\x2a\xb9\xce\x3b\x1c\xb9\x94\x3a\x1d\x23\xa5\xea\x3b\xcf"
"\x21\xa0\x14\x71\xe6\x7e\x00\x3e\x7f\x8a\x69\xc7\x28\xbe\x49\x0b"
"\x2f\xc8\x8c\xfe\xb9\x2d\xb6\xa2\x15\xe5\xd0\x3c\x17\xc4\x64\xc9"
"\xac\x1a\x46\xe2\x03\xe1\x3f\x95\x29\x95\xfb\x03\xc6\x9d\x3c\xc4"
"\x7f\xcb\x51\x0b\x69\x98\xff\xd3\xaa\x6d\xe7\x3c\xf9\xf6\x38\x69",
.method = MODP_2048_224,
.seed = chunk_from_chars(
0x22, 0xe6, 0x26, 0x01, 0xdb, 0xff, 0xd0, 0x67, 0x08, 0xa6,
0x80, 0xf7, 0x47, 0xf3, 0x61, 0xf7, 0x6d, 0x8f, 0x4f, 0x72,
0x1a, 0x05, 0x48, 0xe4, 0x83, 0x29, 0x4b, 0x0c, /* - */
0x4f, 0xf3, 0xbc, 0x96, 0xc7, 0xfc, 0x6a, 0x6d, 0x71, 0xd3,
0xb3, 0x63, 0x80, 0x0a, 0x7c, 0xdf, 0xef, 0x6f, 0xc4, 0x1b,
0x44, 0x17, 0xea, 0x15, 0x35, 0x3b, 0x75, 0x90),
.pub_i = chunk_from_chars(
0x1b, 0x3a, 0x63, 0x45, 0x1b, 0xd8, 0x86, 0xe6, 0x99, 0xe6,
0x7b, 0x49, 0x4e, 0x28, 0x8b, 0xd7, 0xf8, 0xe0, 0xd3, 0x70,
0xba, 0xdd, 0xa7, 0xa0, 0xef, 0xd2, 0xfd, 0xe7, 0xd8, 0xf6,
0x61, 0x45, 0xcc, 0x9f, 0x28, 0x04, 0x19, 0x97, 0x5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0x82, 0x7e,
0x2e, 0xbc, 0x8c, 0x61, 0x34, 0x55, 0x31, 0x15, 0xb7, 0x0e,
0x71, 0x03, 0x92, 0x0a, 0xa1, 0x6d, 0x85, 0xe5, 0x2b, 0xcb,
0xab, 0x8d, 0x78, 0x6a, 0x68, 0x17, 0x8f, 0xa8, 0xff, 0x7c,
0x2f, 0x5c, 0x71, 0x64, 0x8d, 0x6f),
.pub_r = chunk_from_chars(
0x4d, 0xce, 0xe9, 0x92, 0xa9, 0x76, 0x2a, 0x13, 0xf2, 0xf8,
0x38, 0x44, 0xad, 0x3d, 0x77, 0xee, 0x0e, 0x31, 0xc9, 0x71,
0x8b, 0x3d, 0xb6, 0xc2, 0x03, 0x5d, 0x39, 0x61, 0x18, 0x2c,
0x3e, 0x0b, 0xa2, 0x47, 0xec, 0x41, 0x82, 0xd7, 0x60, 0xcd,
0x48, 0xd9, 0x95, 0x99, 0x97, 0x06, 0x22, 0xa1, 0x88, 0x1b,
0xba, 0x2d, 0xc8, 0x22, 0x93, 0x9c, 0x78, 0xc3, 0x91, 0x2c,
0x66, 0x61, 0xfa, 0x54, 0x38, 0xb2, 0x07, 0x66, 0x22, 0x2b,
0x75, 0xe2, 0x4c, 0x2e, 0x3a, 0xd0, 0xc7, 0x28, 0x72, 0x36,
0x12, 0x95, 0x25, 0xee, 0x15, 0xb5, 0xdd, 0x79, 0x98, 0xaa,
0x04, 0xc4, 0xa9, 0x69, 0x6c, 0xac, 0xd7, 0x17, 0x20, 0x83, /* 100 */
0xa9, 0x7a, 0x81, 0x66, 0x4e, 0xad, 0x2c, 0x47, 0x9e, 0x44,
0x4e, 0x4c, 0x06, 0x54, 0xcc, 0x19, 0xe2, 0x8d, 0x77, 0x03,
0xce, 0xe8, 0xda, 0xcd, 0x61, 0x26, 0xf5, 0xd6, 0x65, 0xec,
0x52, 0xc6, 0x72, 0x55, 0xdb, 0x92, 0x01, 0x4b, 0x03, 0x7e,
0xb6, 0x21, 0xa2, 0xac, 0x8e, 0x36, 0x5d, 0xe0, 0x71, 0xff,
0xc1, 0x40, 0x0a, 0xcf, 0x07, 0x7a, 0x12, 0x91, 0x3d, 0xd8,
0xde, 0x89, 0x47, 0x34, 0x37, 0xab, 0x7b, 0xa3, 0x46, 0x74,
0x3c, 0x1b, 0x21, 0x5d, 0xd9, 0xc1, 0x21, 0x64, 0xa7, 0xe4,
0x05, 0x31, 0x18, 0xd1, 0x99, 0xbe, 0xc8, 0xef, 0x6f, 0xc5,
0x61, 0x17, 0x0c, 0x84, 0xc8, 0x7d, 0x10, 0xee, 0x9a, 0x67, /* 200 */
0x4a, 0x1f, 0xa8, 0xff, 0xe1, 0x3b, 0xdf, 0xba, 0x1d, 0x44,
0xde, 0x48, 0x94, 0x6d, 0x68, 0xdc, 0x0c, 0xdd, 0x77, 0x76,
0x35, 0xa7, 0xab, 0x5b, 0xfb, 0x1e, 0x4b, 0xb7, 0xb8, 0x56,
0xf9, 0x68, 0x27, 0x73, 0x4c, 0x18, 0x41, 0x38, 0xe9, 0x15,
0xd9, 0xc3, 0x00, 0x2e, 0xbc, 0xe5, 0x31, 0x20, 0x54, 0x6a,
0x7e, 0x20, 0x02, 0x14, 0x2b, 0x6c),
.shared = chunk_from_chars(
0x34, 0xd9, 0xbd, 0xdc, 0x1b, 0x42, 0x17, 0x6c, 0x31, 0x3f,
0xea, 0x03, 0x4c, 0x21, 0x03, 0x4d, 0x07, 0x4a, 0x63, 0x13,
0xbb, 0x4e, 0xcd, 0xb3, 0x70, 0x3f, 0xff, 0x42, 0x45, 0x67,
0xa4, 0x6b, 0xdf, 0x75, 0x53, 0x0e, 0xde, 0x0a, 0x9d, 0xa5,
0x22, 0x9d, 0xe7, 0xd7, 0x67, 0x32, 0x28, 0x6c, 0xbc, 0x0f,
0x91, 0xda, 0x4c, 0x3c, 0x85, 0x2f, 0xc0, 0x99, 0xc6, 0x79,
0x53, 0x1d, 0x94, 0xc7, 0x8a, 0xb0, 0x3d, 0x9d, 0xec, 0xb0,
0xa4,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xf9, 0xf6, 0x38, 0x69)
};
ke_test_vector_t modp2048_256 = {
.method = MODP_2048_256, .priv_len = 32, .pub_len = 256, .shared_len = 256,
.priv_a = "\x08\x81\x38\x2c\xdb\x87\x66\x0c\x6d\xc1\x3e\x61\x49\x38\xd5\xb9"
"\xc8\xb2\xf2\x48\x58\x1c\xc5\xe3\x1b\x35\x45\x43\x97\xfc\xe5\x0e",
.priv_b = "\x7d\x62\xa7\xe3\xef\x36\xde\x61\x7b\x13\xd1\xaf\xb8\x2c\x78\x0d"
"\x83\xa2\x3b\xd4\xee\x67\x05\x64\x51\x21\xf3\x71\xf5\x46\xa5\x3d",
.pub_a = "\x2e\x93\x80\xc8\x32\x3a\xf9\x75\x45\xbc\x49\x41\xde\xb0\xec\x37"
"\x42\xc6\x2f\xe0\xec\xe8\x24\xa6\xab\xdb\xe6\x6c\x59\xbe\xe0\x24"
"\x29\x11\xbf\xb9\x67\x23\x5c\xeb\xa3\x5a\xe1\x3e\x4e\xc7\x52\xbe"
"\x63\x0b\x92\xdc\x4b\xde\x28\x47\xa9\xc6\x2c\xb8\x15\x27\x45\x42"
"\x1f\xb7\xeb\x60\xa6\x3c\x0f\xe9\x15\x9f\xcc\xe7\x26\xce\x7c\xd8"
"\x52\x3d\x74\x50\x66\x7e\xf8\x40\xe4\x91\x91\x21\xeb\x5f\x01\xc8"
"\xc9\xb0\xd3\xd6\x48\xa9\x3b\xfb\x75\x68\x9e\x82\x44\xac\x13\x4a"
"\xf5\x44\x71\x1c\xe7\x9a\x02\xdc\xc3\x42\x26\x68\x47\x80\xdd\xdc"
"\xb4\x98\x59\x41\x06\xc3\x7f\x5b\xc7\x98\x56\x48\x7a\xf5\xab\x02"
"\x2a\x2e\x5e\x42\xf0\x98\x97\xc1\xa8\x5a\x11\xea\x02\x12\xaf\x04"
"\xd9\xb4\xce\xbc\x93\x7c\x3c\x1a\x3e\x15\xa8\xa0\x34\x2e\x33\x76"
"\x15\xc8\x4e\x7f\xe3\xb8\xb9\xb8\x7f\xb1\xe7\x3a\x15\xaf\x12\xa3"
"\x0d\x74\x6e\x06\xdf\xc3\x4f\x29\x0d\x79\x7c\xe5\x1a\xa1\x3a\xa7"
"\x85\xbf\x66\x58\xaf\xf5\xe4\xb0\x93\x00\x3c\xbe\xaf\x66\x5b\x3c"
"\x2e\x11\x3a\x3a\x4e\x90\x52\x69\x34\x1d\xc0\x71\x14\x26\x68\x5f"
"\x4e\xf3\x7e\x86\x8a\x81\x26\xff\x3f\x22\x79\xb5\x7c\xa6\x7e\x29",
.pub_b = "\x57\x5f\x03\x51\xbd\x2b\x1b\x81\x74\x48\xbd\xf8\x7a\x6c\x36\x2c"
"\x1e\x28\x9d\x39\x03\xa3\x0b\x98\x32\xc5\x74\x1f\xa2\x50\x36\x3e"
"\x7a\xcb\xc7\xf7\x7f\x3d\xac\xbc\x1f\x13\x1a\xdd\x8e\x03\x36\x7e"
"\xff\x8f\xbb\xb3\xe1\xc5\x78\x44\x24\x80\x9b\x25\xaf\xe4\xd2\x26"
"\x2a\x1a\x6f\xd2\xfa\xb6\x41\x05\xca\x30\xa6\x74\xe0\x7f\x78\x09"
"\x85\x20\x88\x63\x2f\xc0\x49\x23\x37\x91\xad\x4e\xdd\x08\x3a\x97"
"\x8b\x88\x3e\xe6\x18\xbc\x5e\x0d\xd0\x47\x41\x5f\x2d\x95\xe6\x83"
"\xcf\x14\x82\x6b\x5f\xbe\x10\xd3\xce\x41\xc6\xc1\x20\xc7\x8a\xb2"
"\x00\x08\xc6\x98\xbf\x7f\x0b\xca\xb9\xd7\xf4\x07\xbe\xd0\xf4\x3a"
"\xfb\x29\x70\xf5\x7f\x8d\x12\x04\x39\x63\xe6\x6d\xdd\x32\x0d\x59"
"\x9a\xd9\x93\x6c\x8f\x44\x13\x7c\x08\xb1\x80\xec\x5e\x98\x5c\xeb"
"\xe1\x86\xf3\xd5\x49\x67\x7e\x80\x60\x73\x31\xee\x17\xaf\x33\x80"
"\xa7\x25\xb0\x78\x23\x17\xd7\xdd\x43\xf5\x9d\x7a\xf9\x56\x8a\x9b"
"\xb6\x3a\x84\xd3\x65\xf9\x22\x44\xed\x12\x09\x88\x21\x93\x02\xf4"
"\x29\x24\xc7\xca\x90\xb8\x9d\x24\xf7\x1b\x0a\xb6\x97\x82\x3d\x7d"
"\xeb\x1a\xff\x5b\x0e\x8e\x4a\x45\xd4\x9f\x7f\x53\x75\x7e\x19\x13",
.shared = "\x86\xc7\x0b\xf8\xd0\xbb\x81\xbb\x01\x07\x8a\x17\x21\x9c\xb7\xd2"
"\x72\x03\xdb\x2a\x19\xc8\x77\xf1\xd1\xf1\x9f\xd7\xd7\x7e\xf2\x25"
"\x46\xa6\x8f\x00\x5a\xd5\x2d\xc8\x45\x53\xb7\x8f\xc6\x03\x30\xbe"
"\x51\xea\x7c\x06\x72\xca\xc1\x51\x5e\x4b\x35\xc0\x47\xb9\xa5\x51"
"\xb8\x8f\x39\xdc\x26\xda\x14\xa0\x9e\xf7\x47\x74\xd4\x7c\x76\x2d"
"\xd1\x77\xf9\xed\x5b\xc2\xf1\x1e\x52\xc8\x79\xbd\x95\x09\x85\x04"
"\xcd\x9e\xec\xd8\xa8\xf9\xb3\xef\xbd\x1f\x00\x8a\xc5\x85\x30\x97"
"\xd9\xd1\x83\x7f\x2b\x18\xf7\x7c\xd7\xbe\x01\xaf\x80\xa7\xc7\xb5"
"\xea\x3c\xa5\x4c\xc0\x2d\x0c\x11\x6f\xee\x3f\x95\xbb\x87\x39\x93"
"\x85\x87\x5d\x7e\x86\x74\x7e\x67\x6e\x72\x89\x38\xac\xbf\xf7\x09"
"\x8e\x05\xbe\x4d\xcf\xb2\x40\x52\xb8\x3a\xef\xfb\x14\x78\x3f\x02"
"\x9a\xdb\xde\x7f\x53\xfa\xe9\x20\x84\x22\x40\x90\xe0\x07\xce\xe9"
"\x4d\x4b\xf2\xba\xce\x9f\xfd\x4b\x57\xd2\xaf\x7c\x72\x4d\x0c\xaa"
"\x19\xbf\x05\x01\xf6\xf1\x7b\x4a\xa1\x0f\x42\x5e\x3e\xa7\x60\x80"
"\xb4\xb9\xd6\xb3\xce\xfe\xa1\x15\xb2\xce\xb8\x78\x9b\xb8\xa3\xb0"
"\xea\x87\xfe\xbe\x63\xb6\xc8\xf8\x46\xec\x6d\xb0\xc2\x6c\x5d\x7c",
.method = MODP_2048_256,
.seed = chunk_from_chars(
0x08, 0x81, 0x38, 0x2c, 0xdb, 0x87, 0x66, 0x0c, 0x6d, 0xc1,
0x3e, 0x61, 0x49, 0x38, 0xd5, 0xb9, 0xc8, 0xb2, 0xf2, 0x48,
0x58, 0x1c, 0xc5, 0xe3, 0x1b, 0x35, 0x45, 0x43, 0x97, 0xfc,
0xe5, 0x0e, /* - */
0x7d, 0x62, 0xa7, 0xe3, 0xef, 0x36, 0xde, 0x61, 0x7b, 0x13,
0xd1, 0xaf, 0xb8, 0x2c, 0x78, 0x0d, 0x83, 0xa2, 0x3b, 0xd4,
0xee, 0x67, 0x05, 0x64, 0x51, 0x21, 0xf3, 0x71, 0xf5, 0x46,
0xa5, 0x3d),
.pub_i = chunk_from_chars(
0x2e, 0x93, 0x80, 0xc8, 0x32, 0x3a, 0xf9, 0x75, 0x45, 0xbc,
0x49, 0x41, 0xde, 0xb0, 0xec, 0x37, 0x42, 0xc6, 0x2f, 0xe0,
0xec, 0xe8, 0x24, 0xa6, 0xab, 0xdb, 0xe6, 0x6c, 0x59, 0xbe,
0xe0, 0x24, 0x29, 0x11, 0xbf, 0xb9, 0x67, 0x23, 0x5c, 0xeb,
0xa3, 0x5a, 0xe1, 0x3e, 0x4e, 0xc7, 0x52, 0xbe, 0x63, 0x0b,
0x92, 0xdc, 0x4b, 0xde, 0x28, 0x47, 0xa9, 0xc6, 0x2c, 0xb8,
0x15, 0x27, 0x45, 0x42, 0x1f, 0xb7, 0xeb, 0x60, 0xa6, 0x3c,
0x0f, 0xe9, 0x15, 0x9f, 0xcc, 0xe7, 0x26, 0xce, 0x7c, 0xd8,
0x52, 0x3d, 0x74,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9, 0xd1, 0x83, 0x7f, 0x2b, 0x18, 0xf7, 0x7c,
0xd7, 0xbe, 0x01, 0xaf, 0x80, 0xa7, 0xc7, 0xb5, 0xea, 0x3c,
0xa5, 0x4c, 0xc0, 0x2d, 0x0c, 0x11, 0x6f, 0xee, 0x3f, 0x95,
0xbb, 0x87, 0x39, 0x93, 0x85, 0x87, 0x5d, 0x7e, 0x86, 0x74,
0x7e, 0x67, 0x6e, 0x72, 0x89, 0x38, 0xac, 0xbf, 0xf7, 0x09,
0x8e, 0x05, 0xbe, 0x4d, 0xcf, 0xb2, 0x40, 0x52, 0xb8, 0x3a,
0xef, 0xfb, 0x14, 0x78, 0x3f, 0x02, 0x9a, 0xdb, 0xde, 0x7f,
0x53, 0xfa, 0xe9, 0x20, 0x84, 0x22, 0x40, 0x90, 0xe0, 0x07,
0xce, 0xe9, 0x4d, 0x4b, 0xf2, 0xba, 0xce, 0x9f, 0xfd, 0x4b, /* 200 */
0x57, 0xd2, 0xaf, 0x7c, 0x72, 0x4d, 0x0c, 0xaa, 0x19, 0xbf,
0x05, 0x01, 0xf6, 0xf1, 0x7b, 0x4a, 0xa1, 0x0f, 0x42, 0x5e,
0x3e, 0xa7, 0x60, 0x80, 0xb4, 0xb9, 0xd6, 0xb3, 0xce, 0xfe,
0xa1, 0x15, 0xb2, 0xce, 0xb8, 0x78, 0x9b, 0xb8, 0xa3, 0xb0,
0xea, 0x87, 0xfe, 0xbe, 0x63, 0xb6, 0xc8, 0xf8, 0x46, 0xec,
0x6d, 0xb0, 0xc2, 0x6c, 0x5d, 0x7c)
};

View File

@ -115,8 +115,8 @@ METHOD(key_exchange_t, set_public_key, bool,
return TRUE;
}
METHOD(key_exchange_t, set_private_key, bool,
private_wolfssl_diffie_hellman_t *this, chunk_t value)
METHOD(key_exchange_t, set_seed, bool,
private_wolfssl_diffie_hellman_t *this, chunk_t value, drbg_t *drbg)
{
bool success = FALSE;
chunk_t g;
@ -213,7 +213,7 @@ static wolfssl_diffie_hellman_t *create_generic(key_exchange_method_t group,
.get_shared_secret = _get_shared_secret,
.set_public_key = _set_public_key,
.get_public_key = _get_public_key,
.set_private_key = _set_private_key,
.set_seed = _set_seed,
.get_method = _get_method,
.destroy = _destroy,
},

View File

@ -210,8 +210,8 @@ METHOD(key_exchange_t, get_public_key, bool,
return ecp2chunk(this->keysize, &this->key.pubkey, value, FALSE);
}
METHOD(key_exchange_t, set_private_key, bool,
private_wolfssl_ec_diffie_hellman_t *this, chunk_t value)
METHOD(key_exchange_t, set_seed, bool,
private_wolfssl_ec_diffie_hellman_t *this, chunk_t value, drbg_t *drbg)
{
bool success = FALSE;
ecc_point *base;
@ -287,7 +287,7 @@ wolfssl_ec_diffie_hellman_t *wolfssl_ec_diffie_hellman_create(key_exchange_metho
.get_shared_secret = _get_shared_secret,
.set_public_key = _set_public_key,
.get_public_key = _get_public_key,
.set_private_key = _set_private_key,
.set_seed = _set_seed,
.get_method = _get_method,
.destroy = _destroy,
},

View File

@ -136,8 +136,8 @@ METHOD(key_exchange_t, get_public_key_25519, bool,
return TRUE;
}
METHOD(key_exchange_t, set_private_key_25519, bool,
private_diffie_hellman_t *this, chunk_t value)
METHOD(key_exchange_t, set_seed_25519, bool,
private_diffie_hellman_t *this, chunk_t value, drbg_t *drbg)
{
curve25519_key pub;
u_char basepoint[CURVE25519_KEYSIZE] = {9};
@ -228,8 +228,8 @@ METHOD(key_exchange_t, get_public_key_448, bool,
return TRUE;
}
METHOD(key_exchange_t, set_private_key_448, bool,
private_diffie_hellman_t *this, chunk_t value)
METHOD(key_exchange_t, set_seed_448, bool,
private_diffie_hellman_t *this, chunk_t value, drbg_t *drbg)
{
curve448_key pub;
u_char basepoint[CURVE448_KEY_SIZE] = {5};
@ -325,7 +325,7 @@ key_exchange_t *wolfssl_x_diffie_hellman_create(key_exchange_method_t group)
#ifdef HAVE_CURVE25519
this->public.set_public_key = _set_public_key_25519;
this->public.get_public_key = _get_public_key_25519;
this->public.set_private_key = _set_private_key_25519;
this->public.set_seed = _set_seed_25519;
if (wc_curve25519_init(&this->key.key25519) != 0)
{
@ -342,7 +342,7 @@ key_exchange_t *wolfssl_x_diffie_hellman_create(key_exchange_method_t group)
#ifdef HAVE_CURVE448
this->public.set_public_key = _set_public_key_448;
this->public.get_public_key = _get_public_key_448;
this->public.set_private_key = _set_private_key_448;
this->public.set_seed = _set_seed_448;
if (wc_curve448_init(&this->key.key448) != 0)
{