Implement atomic-creation psa_import_key
Implement the new, attribute-based psa_import_key and some basic
functions to access psa_key_attributes_t. Replace
psa_import_key_to_handle by psa_import_key in a few test functions.
This commit does not handle persistence attributes yet.
diff --git a/include/psa/crypto.h b/include/psa/crypto.h
index 564dd87..74a36b0 100644
--- a/include/psa/crypto.h
+++ b/include/psa/crypto.h
@@ -109,6 +109,39 @@
*/
typedef struct psa_key_attributes_s psa_key_attributes_t;
+static void psa_make_key_persistent(psa_key_attributes_t *attributes,
+ psa_key_id_t id,
+ psa_key_lifetime_t lifetime);
+
+static psa_key_id_t psa_get_key_id(const psa_key_attributes_t *attributes);
+
+static psa_key_lifetime_t psa_get_key_lifetime(
+ const psa_key_attributes_t *attributes);
+
+static void psa_set_key_usage_flags(psa_key_attributes_t *attributes,
+ psa_key_usage_t usage_flags);
+
+static psa_key_usage_t psa_get_key_usage_flags(
+ const psa_key_attributes_t *attributes);
+
+static void psa_set_key_algorithm(psa_key_attributes_t *attributes,
+ psa_algorithm_t alg);
+
+static psa_algorithm_t psa_get_key_algorithm(
+ const psa_key_attributes_t *attributes);
+
+static void psa_set_key_type(psa_key_attributes_t *attributes,
+ psa_key_type_t type);
+
+static psa_key_type_t psa_get_key_type(const psa_key_attributes_t *attributes);
+
+static size_t psa_get_key_bits(const psa_key_attributes_t *attributes);
+
+psa_status_t psa_get_key_attributes(psa_key_handle_t handle,
+ psa_key_attributes_t *attributes);
+
+psa_status_t psa_reset_key_attributes(psa_key_attributes_t *attributes);
+
/**@}*/
/** \defgroup policy Key policies
@@ -380,7 +413,6 @@
*/
psa_status_t psa_import_key(const psa_key_attributes_t *attributes,
psa_key_handle_t *handle,
- psa_key_type_t type,
const uint8_t *data,
size_t data_length);
@@ -2970,7 +3002,6 @@
*/
psa_status_t psa_generator_import_key(const psa_key_attributes_t *attributes,
psa_key_handle_t *handle,
- psa_key_type_t type,
size_t bits,
psa_crypto_generator_t *generator);
@@ -3363,7 +3394,6 @@
*/
psa_status_t psa_generate_key(const psa_key_attributes_t *attributes,
psa_key_handle_t *handle,
- psa_key_type_t type,
size_t bits,
const void *extra,
size_t extra_size);