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.
This commit is contained in:
Gilles Peskine 2019-02-18 17:33:52 +01:00
parent c8569bc5c2
commit e988a66b5b
2 changed files with 2 additions and 2 deletions

View File

@ -201,7 +201,7 @@ static int psa_is_key_id_valid( psa_key_id_t key_id )
return( 0 ); return( 0 );
/* Reject high values because the file names are reserved for the /* Reject high values because the file names are reserved for the
* library's internal use. */ * library's internal use. */
if( key_id >= PSA_MAX_PERSISTENT_KEY_IDENTIFIER ) if( key_id > PSA_MAX_PERSISTENT_KEY_IDENTIFIER )
return( 0 ); return( 0 );
return( 1 ); return( 1 );
} }

View File

@ -59,7 +59,7 @@ extern "C" {
* This limitation will probably become moot when we implement client * This limitation will probably become moot when we implement client
* separation for key storage. * separation for key storage.
*/ */
#define PSA_MAX_PERSISTENT_KEY_IDENTIFIER 0xffff0000 #define PSA_MAX_PERSISTENT_KEY_IDENTIFIER 0xfffeffff
/** /**
* \brief Format key data and metadata and save to a location for given key * \brief Format key data and metadata and save to a location for given key