Skip to content

Commit 4b43dd6

Browse files
Fix PSA_MAX_PERSISTENT_KEY_IDENTIFIER to mean what it says
PSA_MAX_PERSISTENT_KEY_IDENTIFIER was actually one plus the maximum key identifier. Change it to be the maximum value, and change the code that uses it accordingly. There is no semantic change here (the maximum value hasn't changed). This commit only makes the implementation clearer.
1 parent cebb8f9 commit 4b43dd6

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

library/psa_crypto_slot_management.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ static int psa_is_key_id_valid( psa_key_id_t key_id )
201201
return( 0 );
202202
/* Reject high values because the file names are reserved for the
203203
* library's internal use. */
204-
if( key_id >= PSA_MAX_PERSISTENT_KEY_IDENTIFIER )
204+
if( key_id > PSA_MAX_PERSISTENT_KEY_IDENTIFIER )
205205
return( 0 );
206206
return( 1 );
207207
}

library/psa_crypto_storage.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ extern "C" {
5959
* This limitation will probably become moot when we implement client
6060
* separation for key storage.
6161
*/
62-
#define PSA_MAX_PERSISTENT_KEY_IDENTIFIER 0xffff0000
62+
#define PSA_MAX_PERSISTENT_KEY_IDENTIFIER 0xfffeffff
6363

6464
/**
6565
* \brief Format key data and metadata and save to a location for given key

0 commit comments

Comments
 (0)