Add OAEP placeholders in asymmetric encrypt/decrypt

Replace PSS placeholders by OAEP placeholders. PSS is a signature
algorithm, not an encryption algorithm.

Fix typo in PSA_ALG_IS_RSA_OAEP_MGF1.
This commit is contained in:
Gilles Peskine 2018-06-08 17:43:16 +02:00 committed by itayzafrir
parent 8b18a4fef3
commit 625b01c9c3
2 changed files with 3 additions and 3 deletions

View file

@ -336,7 +336,7 @@ typedef uint32_t psa_algorithm_t;
#define PSA_ALG_RSA_OAEP_MGF1(hash_alg) \ #define PSA_ALG_RSA_OAEP_MGF1(hash_alg) \
(PSA_ALG_RSA_OAEP_MGF1_RAW | ((hash_alg) & PSA_ALG_HASH_MASK)) (PSA_ALG_RSA_OAEP_MGF1_RAW | ((hash_alg) & PSA_ALG_HASH_MASK))
#define PSA_ALG_IS_RSA_OAEP_MGF1(alg) \ #define PSA_ALG_IS_RSA_OAEP_MGF1(alg) \
(((alg) & ~PSA_ALG_HASH_MASK) == PSA_ALG_RSA_OAEP_MGF1_RAW) (((alg) & ~PSA_ALG_HASH_MASK) == PSA_ALG_RSA_OAEP_MGF1_BASE)
#define PSA_ALG_RSA_GET_HASH(alg) \ #define PSA_ALG_RSA_GET_HASH(alg) \
(((alg) & PSA_ALG_HASH_MASK) | PSA_ALG_CATEGORY_HASH) (((alg) & PSA_ALG_HASH_MASK) | PSA_ALG_CATEGORY_HASH)

View file

@ -1458,7 +1458,7 @@ psa_status_t psa_asymmetric_encrypt( psa_key_slot_t key,
else else
#endif /* MBEDTLS_PKCS1_V15 */ #endif /* MBEDTLS_PKCS1_V15 */
#if defined(MBEDTLS_PKCS1_V21) #if defined(MBEDTLS_PKCS1_V21)
if( alg == PSA_ALG_RSA_PSS_MGF1 ) if( PSA_ALG_IS_RSA_OAEP_MGF1( alg ) )
{ {
return( PSA_ERROR_NOT_SUPPORTED ); return( PSA_ERROR_NOT_SUPPORTED );
} }
@ -1535,7 +1535,7 @@ psa_status_t psa_asymmetric_decrypt( psa_key_slot_t key,
else else
#endif /* MBEDTLS_PKCS1_V15 */ #endif /* MBEDTLS_PKCS1_V15 */
#if defined(MBEDTLS_PKCS1_V21) #if defined(MBEDTLS_PKCS1_V21)
if( alg == PSA_ALG_RSA_PSS_MGF1 ) if( PSA_ALG_IS_RSA_OAEP_MGF1( alg ) )
{ {
return( PSA_ERROR_NOT_SUPPORTED ); return( PSA_ERROR_NOT_SUPPORTED );
} }