Remove key_set and use id instead
In keeping with the other PSA multipart operations.
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
diff --git a/include/psa/crypto_struct.h b/include/psa/crypto_struct.h
index 6bb6f42..36503f9 100644
--- a/include/psa/crypto_struct.h
+++ b/include/psa/crypto_struct.h
@@ -165,7 +165,6 @@
psa_algorithm_t alg;
psa_key_type_t key_type;
- unsigned int key_set : 1;
unsigned int nonce_set : 1;
unsigned int lengths_set : 1;
unsigned int ad_started : 1;
@@ -174,7 +173,7 @@
psa_driver_aead_context_t ctx;
};
-#define PSA_AEAD_OPERATION_INIT {0, 0, 0, 0, 0, 0, 0, 0, {0}}
+#define PSA_AEAD_OPERATION_INIT {0, 0, 0, 0, 0, 0, 0, {0}}
static inline struct psa_aead_operation_s psa_aead_operation_init( void )
{
const struct psa_aead_operation_s v = PSA_AEAD_OPERATION_INIT;
diff --git a/library/psa_crypto.c b/library/psa_crypto.c
index 81673c4..527e44e 100644
--- a/library/psa_crypto.c
+++ b/library/psa_crypto.c
@@ -3248,7 +3248,7 @@
goto exit;
}
- if( operation->key_set || operation->nonce_set ||
+ if( operation->id || operation->nonce_set ||
operation->ad_started || operation->body_started )
{
status = PSA_ERROR_BAD_STATE;
@@ -3288,10 +3288,7 @@
exit:
if( status == PSA_SUCCESS )
- {
operation->alg = psa_aead_get_base_algorithm( alg );
- operation->key_set = 1;
- }
else
psa_aead_abort( operation );
@@ -3313,7 +3310,7 @@
goto exit;
}
- if( operation->key_set || operation->nonce_set ||
+ if( operation->id || operation->nonce_set ||
operation->ad_started || operation->body_started )
{
status = PSA_ERROR_BAD_STATE;
@@ -3344,10 +3341,7 @@
exit:
if( status == PSA_SUCCESS )
- {
operation->alg = psa_aead_get_base_algorithm( alg );
- operation->key_set = 1;
- }
else
psa_aead_abort( operation );
@@ -3365,7 +3359,7 @@
*nonce_length = 0;
- if( !operation->key_set || operation->nonce_set ||
+ if( !operation->id || operation->nonce_set ||
operation->ad_started || operation->body_started )
{
status = PSA_ERROR_BAD_STATE;
@@ -3407,7 +3401,7 @@
{
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
- if( !operation->key_set || operation->nonce_set ||
+ if( !operation->id || operation->nonce_set ||
operation->ad_started || operation->body_started )
{
status = PSA_ERROR_BAD_STATE;
@@ -3434,7 +3428,7 @@
{
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
- if( !operation->key_set || operation->lengths_set )
+ if( !operation->id || operation->lengths_set )
{
status = PSA_ERROR_BAD_STATE;
goto exit;
@@ -3459,7 +3453,7 @@
{
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
- if( !operation->nonce_set || !operation->key_set )
+ if( !operation->id || !operation->nonce_set )
{
status = PSA_ERROR_BAD_STATE;
goto exit;
@@ -3491,7 +3485,7 @@
*output_length = 0;
- if( !operation->nonce_set || !operation->key_set || !operation->ad_started )
+ if( !operation->id || !operation->nonce_set || !operation->ad_started )
{
status = PSA_ERROR_BAD_STATE;
goto exit;
@@ -3525,7 +3519,7 @@
*ciphertext_length = 0;
*tag_length = 0;
- if( !operation->key_set || !operation->nonce_set ||
+ if( !operation->id || !operation->nonce_set ||
!operation->ad_started || !operation->body_started )
{
status = PSA_ERROR_BAD_STATE;
@@ -3557,7 +3551,7 @@
*plaintext_length = 0;
- if( !operation->key_set || !operation->nonce_set ||
+ if( !operation->id || !operation->nonce_set ||
!operation->ad_started || !operation->body_started )
{
status = PSA_ERROR_BAD_STATE;
@@ -3592,7 +3586,6 @@
status = psa_driver_wrapper_aead_abort( operation );
operation->id = 0;
- operation->key_set = 0;
operation->nonce_set = 0;
operation->lengths_set = 0;
operation->ad_started = 0;