Merge pull request #6010 from mprse/ffdh_import_export

FFDH 1, 2A, 2B: FFDH add support for import/export key, key agreement, key generation + tests
This commit is contained in:
Manuel Pégourié-Gonnard 2023-05-10 11:40:54 +02:00 committed by GitHub
commit 1d046fa0dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 882 additions and 54 deletions

View file

@ -1530,8 +1530,15 @@ void import_export(data_t *data,
psa_set_key_algorithm(&attributes, alg);
psa_set_key_type(&attributes, type);
if (PSA_KEY_TYPE_IS_DH(type) &&
expected_export_status == PSA_ERROR_BUFFER_TOO_SMALL) {
/* Simulate that buffer is too small, by decreasing its size by 1 byte. */
export_size -= 1;
}
/* Import the key */
PSA_ASSERT(psa_import_key(&attributes, data->x, data->len, &key));
TEST_EQUAL(psa_import_key(&attributes, data->x, data->len, &key),
PSA_SUCCESS);
/* Test the key information */
PSA_ASSERT(psa_get_key_attributes(key, &got_attributes));