mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-26 09:55:46 +01:00
Add support for minimum-tag-length AEAD and MAC policies
Includes tests. Signed-off-by: Steven Cooreman <steven.cooreman@silabs.com> # Conflicts: # include/psa/crypto_values.h # tests/suites/test_suite_psa_crypto.function
This commit is contained in:
parent
34045c1d6a
commit
b3ce8156ce
8
ChangeLog.d/psa-crypto-key-policies.txt
Normal file
8
ChangeLog.d/psa-crypto-key-policies.txt
Normal file
@ -0,0 +1,8 @@
|
||||
Features
|
||||
* Added PSA_ALG_AEAD_WITH_MINIMUM_LENGTH_TAG and
|
||||
PSA_ALG_MAC_WITH_MINIMUM_LENGTH_TAG as usage algorithms for declaring key
|
||||
usage in PSA Crypto. These algorithm values describe that a key is allowed
|
||||
to be used with any algorithm that matches the specified base algorithm
|
||||
(e.g PSA_ALG_CCM for AEAD or PSA_ALG_CMAC for MAC) and has a tag length
|
||||
which is at least as long as the one encoded in the MINIMUM_TAG_LENGTH
|
||||
usage algorithm.
|
@ -264,6 +264,12 @@ static psa_key_usage_t psa_get_key_usage_flags(
|
||||
* - An algorithm value permits this particular algorithm.
|
||||
* - An algorithm wildcard built from #PSA_ALG_ANY_HASH allows the specified
|
||||
* signature scheme with any hash algorithm.
|
||||
* - An algorithm value for which PSA_ALG_IS_WILDCARD() evaluates to true
|
||||
* allows any algorithm specified by that usage algorithm definition.
|
||||
* E.g. a usage algorithm built from PSA_ALG_MAC_WITH_MINIMUM_LENGTH_TAG()
|
||||
* allows using the key for any algorithm with the same base MAC algorithm as
|
||||
* long as the used algorithm isn't truncated to less than the minimum tag
|
||||
* length declared in the usage algorithm.
|
||||
*
|
||||
* This function overwrites any algorithm policy
|
||||
* previously set in \p attributes.
|
||||
|
@ -900,7 +900,7 @@
|
||||
* too large for the specified MAC algorithm.
|
||||
*/
|
||||
#define PSA_ALG_TRUNCATED_MAC(mac_alg, mac_length) \
|
||||
(((mac_alg) & ~PSA_ALG_MAC_TRUNCATION_MASK) | \
|
||||
(((mac_alg) & ~(PSA_ALG_MAC_TRUNCATION_MASK | PSA_ALG_MAC_MINIMUM_LENGTH_FLAG)) | \
|
||||
((mac_length) << PSA_MAC_TRUNCATION_OFFSET & PSA_ALG_MAC_TRUNCATION_MASK))
|
||||
|
||||
/** Macro to build the base MAC algorithm corresponding to a truncated
|
||||
@ -916,7 +916,7 @@
|
||||
* MAC algorithm.
|
||||
*/
|
||||
#define PSA_ALG_FULL_LENGTH_MAC(mac_alg) \
|
||||
((mac_alg) & ~PSA_ALG_MAC_TRUNCATION_MASK)
|
||||
((mac_alg) & ~(PSA_ALG_MAC_TRUNCATION_MASK | PSA_ALG_MAC_MINIMUM_LENGTH_FLAG))
|
||||
|
||||
/** Length to which a MAC algorithm is truncated.
|
||||
*
|
||||
@ -932,6 +932,34 @@
|
||||
#define PSA_MAC_TRUNCATED_LENGTH(mac_alg) \
|
||||
(((mac_alg) & PSA_ALG_MAC_TRUNCATION_MASK) >> PSA_MAC_TRUNCATION_OFFSET)
|
||||
|
||||
/* In the encoding of a MAC algorithm, the bit corresponding to
|
||||
* PSA_ALG_MAC_MINIMUM_LENGTH_FLAG encodes the fact that the algorithm is
|
||||
* a usage algorithm, which allows any algorithm corresponding to the same
|
||||
* base class and a tag length greater or equal than the one encoded in
|
||||
* PSA_ALG_MAC_TRUNCATION_MASK. */
|
||||
#define PSA_ALG_MAC_MINIMUM_LENGTH_FLAG ((psa_algorithm_t)0x00008000)
|
||||
|
||||
/** Macro to build a MAC minimum-tag-length usage algorithm.
|
||||
*
|
||||
* A mininimum-tag-length MAC usage algorithm contains all MAC algorithms
|
||||
* sharing the same base algorithm, and where the tag length of the specific
|
||||
* algorithm is equal to or larger then the usage's minimum tag length.
|
||||
*
|
||||
* \param mac_alg A MAC algorithm identifier (value of type
|
||||
* #psa_algorithm_t such that #PSA_ALG_IS_MAC(\p alg)
|
||||
* is true).
|
||||
* \param tag_length Desired minimum length of the authentication tag in
|
||||
* bytes.
|
||||
*
|
||||
* \return The corresponding MAC usage algorithm with the
|
||||
* specified minimum length.
|
||||
* \return Unspecified if \p alg is not a supported
|
||||
* MAC algorithm or if \p tag_length is not valid
|
||||
* for the specified MAC algorithm.
|
||||
*/
|
||||
#define PSA_ALG_MAC_WITH_MINIMUM_LENGTH_TAG(mac_alg, tag_length) \
|
||||
( PSA_ALG_TRUNCATED_MAC(mac_alg, tag_length) | PSA_ALG_MAC_MINIMUM_LENGTH_FLAG )
|
||||
|
||||
#define PSA_ALG_CIPHER_MAC_BASE ((psa_algorithm_t)0x03c00000)
|
||||
/** The CBC-MAC construction over a block cipher
|
||||
*
|
||||
@ -1111,10 +1139,25 @@
|
||||
* for the specified AEAD algorithm.
|
||||
*/
|
||||
#define PSA_ALG_AEAD_WITH_SHORTENED_TAG(aead_alg, tag_length) \
|
||||
(((aead_alg) & ~PSA_ALG_AEAD_TAG_LENGTH_MASK) | \
|
||||
(((aead_alg) & ~(PSA_ALG_AEAD_TAG_LENGTH_MASK | PSA_ALG_AEAD_MINIMUM_LENGTH_FLAG)) | \
|
||||
((tag_length) << PSA_AEAD_TAG_LENGTH_OFFSET & \
|
||||
PSA_ALG_AEAD_TAG_LENGTH_MASK))
|
||||
|
||||
/** Retrieve the tag length of a specified AEAD algorithm
|
||||
*
|
||||
* \param aead_alg An AEAD algorithm identifier (value of type
|
||||
* #psa_algorithm_t such that #PSA_ALG_IS_AEAD(\p alg)
|
||||
* is true).
|
||||
*
|
||||
* \return The tag length specified by the input algorithm.
|
||||
* \return Unspecified if \p alg is not a supported
|
||||
* AEAD algorithm or if \p tag_length is not valid
|
||||
* for the specified AEAD algorithm.
|
||||
*/
|
||||
#define PSA_ALG_AEAD_GET_TAG_LENGTH(aead_alg) \
|
||||
(((aead_alg) & PSA_ALG_AEAD_TAG_LENGTH_MASK) >> \
|
||||
PSA_AEAD_TAG_LENGTH_OFFSET )
|
||||
|
||||
/** Calculate the corresponding AEAD algorithm with the default tag length.
|
||||
*
|
||||
* \param aead_alg An AEAD algorithm (\c PSA_ALG_XXX value such that
|
||||
@ -1134,6 +1177,34 @@
|
||||
PSA_ALG_AEAD_WITH_SHORTENED_TAG(ref, 0) ? \
|
||||
ref :
|
||||
|
||||
/* In the encoding of an AEAD algorithm, the bit corresponding to
|
||||
* PSA_ALG_AEAD_MINIMUM_LENGTH_FLAG encodes the fact that the algorithm is
|
||||
* a usage algorithm, which allows any algorithm corresponding to the same
|
||||
* base class and a tag length greater or equal than the one encoded in
|
||||
* PSA_ALG_AEAD_TAG_LENGTH_MASK. */
|
||||
#define PSA_ALG_AEAD_MINIMUM_LENGTH_FLAG ((psa_algorithm_t)0x00008000)
|
||||
|
||||
/** Macro to build an AEAD minimum-tag-length usage algorithm.
|
||||
*
|
||||
* A mininimum-tag-length AEAD usage algorithm contains all AEAD algorithms
|
||||
* sharing the same base algorithm, and where the tag length of the specific
|
||||
* algorithm is equal to or larger then the usage's minimum tag length.
|
||||
*
|
||||
* \param aead_alg An AEAD algorithm identifier (value of type
|
||||
* #psa_algorithm_t such that #PSA_ALG_IS_AEAD(\p alg)
|
||||
* is true).
|
||||
* \param tag_length Desired minimum length of the authentication tag in
|
||||
* bytes.
|
||||
*
|
||||
* \return The corresponding AEAD usage algorithm with the
|
||||
* specified minimum length.
|
||||
* \return Unspecified if \p alg is not a supported
|
||||
* AEAD algorithm or if \p tag_length is not valid
|
||||
* for the specified AEAD algorithm.
|
||||
*/
|
||||
#define PSA_ALG_AEAD_WITH_MINIMUM_LENGTH_TAG(aead_alg, tag_length) \
|
||||
( PSA_ALG_AEAD_WITH_SHORTENED_TAG(aead_alg, tag_length) | PSA_ALG_AEAD_MINIMUM_LENGTH_FLAG )
|
||||
|
||||
#define PSA_ALG_RSA_PKCS1V15_SIGN_BASE ((psa_algorithm_t)0x06000200)
|
||||
/** RSA PKCS#1 v1.5 signature with hashing.
|
||||
*
|
||||
@ -1580,10 +1651,14 @@
|
||||
* \return This macro may return either 0 or 1 if \c alg is not a supported
|
||||
* algorithm identifier.
|
||||
*/
|
||||
#define PSA_ALG_IS_WILDCARD(alg) \
|
||||
(PSA_ALG_IS_HASH_AND_SIGN(alg) ? \
|
||||
PSA_ALG_SIGN_GET_HASH(alg) == PSA_ALG_ANY_HASH : \
|
||||
(alg) == PSA_ALG_ANY_HASH)
|
||||
#define PSA_ALG_IS_WILDCARD(alg) \
|
||||
(PSA_ALG_IS_HASH_AND_SIGN(alg) ? \
|
||||
PSA_ALG_SIGN_GET_HASH(alg) == PSA_ALG_ANY_HASH : \
|
||||
(PSA_ALG_IS_MAC(alg) ? \
|
||||
(alg & PSA_ALG_MAC_MINIMUM_LENGTH_FLAG) != 0 : \
|
||||
(PSA_ALG_IS_AEAD(alg) ? \
|
||||
(alg & PSA_ALG_AEAD_MINIMUM_LENGTH_FLAG) != 0 : \
|
||||
(alg) == PSA_ALG_ANY_HASH)))
|
||||
|
||||
/**@}*/
|
||||
|
||||
|
@ -663,16 +663,79 @@ static psa_algorithm_t psa_key_policy_algorithm_intersection(
|
||||
/* Common case: both sides actually specify the same policy. */
|
||||
if( alg1 == alg2 )
|
||||
return( alg1 );
|
||||
/* If the policies are from the same hash-and-sign family, check
|
||||
* if one is a wildcard. If so the other has the specific algorithm. */
|
||||
if( PSA_ALG_IS_HASH_AND_SIGN( alg1 ) &&
|
||||
PSA_ALG_IS_HASH_AND_SIGN( alg2 ) &&
|
||||
( alg1 & ~PSA_ALG_HASH_MASK ) == ( alg2 & ~PSA_ALG_HASH_MASK ) )
|
||||
/* Special case: one or both sides contain a wildcard. */
|
||||
if( PSA_ALG_IS_WILDCARD( alg1 ) || PSA_ALG_IS_WILDCARD( alg2 ) )
|
||||
{
|
||||
if( PSA_ALG_SIGN_GET_HASH( alg1 ) == PSA_ALG_ANY_HASH )
|
||||
return( alg2 );
|
||||
if( PSA_ALG_SIGN_GET_HASH( alg2 ) == PSA_ALG_ANY_HASH )
|
||||
return( alg1 );
|
||||
/* If the policies are from the same hash-and-sign family, check
|
||||
* if one is a wildcard. If so the other has the specific algorithm. */
|
||||
if( PSA_ALG_IS_HASH_AND_SIGN( alg1 ) &&
|
||||
PSA_ALG_IS_HASH_AND_SIGN( alg2 ) &&
|
||||
( alg1 & ~PSA_ALG_HASH_MASK ) == ( alg2 & ~PSA_ALG_HASH_MASK ) )
|
||||
{
|
||||
if( PSA_ALG_SIGN_GET_HASH( alg1 ) == PSA_ALG_ANY_HASH )
|
||||
return( alg2 );
|
||||
if( PSA_ALG_SIGN_GET_HASH( alg2 ) == PSA_ALG_ANY_HASH )
|
||||
return( alg1 );
|
||||
}
|
||||
/* If the policies are from the same AEAD family, then at least one
|
||||
* of them is a minimum-tag-length policy. Calculate the most
|
||||
* restrictive tag length. */
|
||||
if( PSA_ALG_IS_AEAD( alg1 ) && PSA_ALG_IS_AEAD( alg2 ) &&
|
||||
( PSA_ALG_AEAD_WITH_SHORTENED_TAG( alg1, 0 ) ==
|
||||
PSA_ALG_AEAD_WITH_SHORTENED_TAG( alg2, 0 ) ) )
|
||||
{
|
||||
size_t alg1_len = PSA_ALG_AEAD_GET_TAG_LENGTH( alg1 );
|
||||
size_t alg2_len = PSA_ALG_AEAD_GET_TAG_LENGTH( alg2 );
|
||||
size_t max_len = alg1_len > alg2_len ? alg1_len : alg2_len;
|
||||
|
||||
/* If both are wildcards, return most restricitve wildcard */
|
||||
if( PSA_ALG_IS_WILDCARD( alg1 ) && PSA_ALG_IS_WILDCARD( alg2 ) )
|
||||
{
|
||||
return( PSA_ALG_AEAD_WITH_MINIMUM_LENGTH_TAG( alg1, max_len ) );
|
||||
}
|
||||
/* If only one is a wildcard, return specific algorithm if compatible. */
|
||||
if( PSA_ALG_IS_WILDCARD( alg1 ) && (alg1_len <= alg2_len) )
|
||||
{
|
||||
return( alg2 );
|
||||
}
|
||||
if( PSA_ALG_IS_WILDCARD( alg2 ) && (alg2_len <= alg1_len) )
|
||||
{
|
||||
return( alg1 );
|
||||
}
|
||||
}
|
||||
/* If the policies are from the same MAC family, then at least one
|
||||
* of them is a minimum-tag-length policy. Calculate the most
|
||||
* restrictive tag length. */
|
||||
if( PSA_ALG_IS_MAC( alg1 ) && PSA_ALG_IS_MAC( alg2 ) &&
|
||||
( PSA_ALG_FULL_LENGTH_MAC( alg1 ) ==
|
||||
PSA_ALG_FULL_LENGTH_MAC( alg2 ) ) )
|
||||
{
|
||||
size_t alg1_len = PSA_MAC_TRUNCATED_LENGTH( alg1 );
|
||||
size_t alg2_len = PSA_MAC_TRUNCATED_LENGTH( alg2 );
|
||||
size_t max_len = alg1_len > alg2_len ? alg1_len : alg2_len;
|
||||
|
||||
/* If both are wildcards, return most restricitve wildcard */
|
||||
if( PSA_ALG_IS_WILDCARD( alg1 ) && PSA_ALG_IS_WILDCARD( alg2 ) )
|
||||
{
|
||||
return( PSA_ALG_MAC_WITH_MINIMUM_LENGTH_TAG( alg1, max_len ) );
|
||||
}
|
||||
/* If only one is a wildcard, return specific algorithm if compatible.
|
||||
* Special case: specific MAC algorithm with '0' as length means full-
|
||||
* length MAC, which is always allowed by a wildcard with the same
|
||||
* base algorithm. */
|
||||
if( PSA_ALG_IS_WILDCARD( alg1 ) &&
|
||||
( ( alg1_len <= alg2_len) ||
|
||||
( alg2 == PSA_ALG_FULL_LENGTH_MAC( alg1 ) ) ) )
|
||||
{
|
||||
return( alg2 );
|
||||
}
|
||||
if( PSA_ALG_IS_WILDCARD( alg2 ) &&
|
||||
( (alg2_len <= alg1_len) ||
|
||||
( alg1 == PSA_ALG_FULL_LENGTH_MAC( alg2 ) ) ) )
|
||||
{
|
||||
return( alg1 );
|
||||
}
|
||||
}
|
||||
}
|
||||
/* If the policies are incompatible, allow nothing. */
|
||||
return( 0 );
|
||||
@ -681,17 +744,51 @@ static psa_algorithm_t psa_key_policy_algorithm_intersection(
|
||||
static int psa_key_algorithm_permits( psa_algorithm_t policy_alg,
|
||||
psa_algorithm_t requested_alg )
|
||||
{
|
||||
/* A requested algorithm cannot be a wildcard. */
|
||||
if( PSA_ALG_IS_WILDCARD( requested_alg ) )
|
||||
return( 0 );
|
||||
/* Common case: the policy only allows requested_alg. */
|
||||
if( requested_alg == policy_alg )
|
||||
return( 1 );
|
||||
/* If policy_alg is a hash-and-sign with a wildcard for the hash,
|
||||
* and requested_alg is the same hash-and-sign family with any hash,
|
||||
* then requested_alg is compliant with policy_alg. */
|
||||
if( PSA_ALG_IS_HASH_AND_SIGN( requested_alg ) &&
|
||||
PSA_ALG_SIGN_GET_HASH( policy_alg ) == PSA_ALG_ANY_HASH )
|
||||
/* Special cases: the policy is an algorithm collection. */
|
||||
if( PSA_ALG_IS_WILDCARD( policy_alg ) )
|
||||
{
|
||||
return( ( policy_alg & ~PSA_ALG_HASH_MASK ) ==
|
||||
( requested_alg & ~PSA_ALG_HASH_MASK ) );
|
||||
/* If policy_alg is a hash-and-sign with a wildcard for the hash,
|
||||
* and requested_alg is the same hash-and-sign family with any hash,
|
||||
* then requested_alg is compliant with policy_alg. */
|
||||
if( PSA_ALG_IS_HASH_AND_SIGN( requested_alg ) &&
|
||||
PSA_ALG_SIGN_GET_HASH( policy_alg ) == PSA_ALG_ANY_HASH )
|
||||
{
|
||||
return( ( policy_alg & ~PSA_ALG_HASH_MASK ) ==
|
||||
( requested_alg & ~PSA_ALG_HASH_MASK ) );
|
||||
}
|
||||
/* If policy_alg is a wildcard AEAD algorithm of the same base as
|
||||
* the requested algorithm, check the requested tag length to be
|
||||
* equal-length or longer than the wildcard-specified length. */
|
||||
if( PSA_ALG_IS_AEAD( policy_alg ) &&
|
||||
PSA_ALG_IS_AEAD( requested_alg ) &&
|
||||
( PSA_ALG_AEAD_WITH_SHORTENED_TAG( policy_alg, 0 ) ==
|
||||
PSA_ALG_AEAD_WITH_SHORTENED_TAG( requested_alg, 0 ) ) )
|
||||
{
|
||||
return( PSA_ALG_AEAD_GET_TAG_LENGTH( policy_alg ) <=
|
||||
PSA_ALG_AEAD_GET_TAG_LENGTH( requested_alg ) );
|
||||
}
|
||||
/* If policy_alg is a wildcard MAC algorithm of the same base as
|
||||
* the requested algorithm, check the requested tag length to be
|
||||
* equal-length or longer than the wildcard-specified length. */
|
||||
if( PSA_ALG_IS_MAC( policy_alg ) &&
|
||||
PSA_ALG_IS_MAC( requested_alg ) &&
|
||||
( PSA_ALG_FULL_LENGTH_MAC( policy_alg ) ==
|
||||
PSA_ALG_FULL_LENGTH_MAC( requested_alg ) ) )
|
||||
{
|
||||
/* Special case: full-length MAC is encoded with 0-length.
|
||||
* A minimum-length policy will always allow a full-length MAC. */
|
||||
if( PSA_ALG_FULL_LENGTH_MAC( requested_alg ) == requested_alg )
|
||||
return( 1 );
|
||||
|
||||
return( PSA_MAC_TRUNCATED_LENGTH( policy_alg ) <=
|
||||
PSA_MAC_TRUNCATED_LENGTH( requested_alg ) );
|
||||
}
|
||||
}
|
||||
/* If policy_alg is a generic key agreement operation, then using it for
|
||||
* a key derivation with that key agreement should also be allowed. This
|
||||
@ -702,7 +799,7 @@ static int psa_key_algorithm_permits( psa_algorithm_t policy_alg,
|
||||
return( PSA_ALG_KEY_AGREEMENT_GET_BASE( requested_alg ) ==
|
||||
policy_alg );
|
||||
}
|
||||
/* If it isn't permitted, it's forbidden. */
|
||||
/* If it isn't explicitly permitted, it's forbidden. */
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
|
@ -378,31 +378,63 @@ key_attributes_init:
|
||||
|
||||
PSA key policy: MAC, sign | verify
|
||||
depends_on:PSA_WANT_ALG_HMAC:PSA_WANT_ALG_SHA_256:PSA_WANT_KEY_TYPE_HMAC
|
||||
mac_key_policy:PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH:PSA_ALG_HMAC(PSA_ALG_SHA_256):PSA_KEY_TYPE_HMAC:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":PSA_ALG_HMAC(PSA_ALG_SHA_256)
|
||||
mac_key_policy:PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH:PSA_ALG_HMAC(PSA_ALG_SHA_256):PSA_KEY_TYPE_HMAC:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":PSA_ALG_HMAC(PSA_ALG_SHA_256):PSA_SUCCESS
|
||||
|
||||
PSA key policy: MAC, wrong algorithm
|
||||
depends_on:PSA_WANT_ALG_HMAC:PSA_WANT_ALG_SHA_224:PSA_WANT_ALG_SHA_256:PSA_WANT_KEY_TYPE_HMAC
|
||||
mac_key_policy:PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH:PSA_ALG_HMAC(PSA_ALG_SHA_256):PSA_KEY_TYPE_HMAC:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":PSA_ALG_HMAC(PSA_ALG_SHA_224)
|
||||
mac_key_policy:PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH:PSA_ALG_HMAC(PSA_ALG_SHA_256):PSA_KEY_TYPE_HMAC:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":PSA_ALG_HMAC(PSA_ALG_SHA_224):PSA_ERROR_NOT_PERMITTED
|
||||
|
||||
PSA key policy: MAC, alg=0 in policy
|
||||
depends_on:PSA_WANT_ALG_HMAC:PSA_WANT_ALG_SHA_256:PSA_WANT_KEY_TYPE_HMAC
|
||||
mac_key_policy:PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH:0:PSA_KEY_TYPE_HMAC:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":PSA_ALG_HMAC(PSA_ALG_SHA_256)
|
||||
mac_key_policy:PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH:0:PSA_KEY_TYPE_HMAC:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":PSA_ALG_HMAC(PSA_ALG_SHA_256):PSA_ERROR_NOT_PERMITTED
|
||||
|
||||
PSA key policy: MAC, ANY_HASH in policy is not meaningful
|
||||
depends_on:PSA_WANT_ALG_HMAC:PSA_WANT_ALG_SHA_256:PSA_WANT_KEY_TYPE_HMAC
|
||||
mac_key_policy:PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH:PSA_ALG_HMAC(PSA_ALG_ANY_HASH):PSA_KEY_TYPE_HMAC:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":PSA_ALG_HMAC(PSA_ALG_SHA_256)
|
||||
mac_key_policy:PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH:PSA_ALG_HMAC(PSA_ALG_ANY_HASH):PSA_KEY_TYPE_HMAC:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":PSA_ALG_HMAC(PSA_ALG_SHA_256):PSA_ERROR_NOT_PERMITTED
|
||||
|
||||
PSA key policy: MAC, sign but not verify
|
||||
depends_on:PSA_WANT_ALG_HMAC:PSA_WANT_ALG_SHA_256:PSA_WANT_KEY_TYPE_HMAC
|
||||
mac_key_policy:PSA_KEY_USAGE_SIGN_HASH:PSA_ALG_HMAC(PSA_ALG_SHA_256):PSA_KEY_TYPE_HMAC:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":PSA_ALG_HMAC(PSA_ALG_SHA_256)
|
||||
mac_key_policy:PSA_KEY_USAGE_SIGN_HASH:PSA_ALG_HMAC(PSA_ALG_SHA_256):PSA_KEY_TYPE_HMAC:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":PSA_ALG_HMAC(PSA_ALG_SHA_256):PSA_SUCCESS
|
||||
|
||||
PSA key policy: MAC, verify but not sign
|
||||
depends_on:PSA_WANT_ALG_HMAC:PSA_WANT_ALG_SHA_256:PSA_WANT_KEY_TYPE_HMAC
|
||||
mac_key_policy:PSA_KEY_USAGE_VERIFY_HASH:PSA_ALG_HMAC(PSA_ALG_SHA_256):PSA_KEY_TYPE_HMAC:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":PSA_ALG_HMAC(PSA_ALG_SHA_256)
|
||||
mac_key_policy:PSA_KEY_USAGE_VERIFY_HASH:PSA_ALG_HMAC(PSA_ALG_SHA_256):PSA_KEY_TYPE_HMAC:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":PSA_ALG_HMAC(PSA_ALG_SHA_256):PSA_SUCCESS
|
||||
|
||||
PSA key policy: MAC, neither sign nor verify
|
||||
depends_on:PSA_WANT_ALG_HMAC:PSA_WANT_ALG_SHA_256:PSA_WANT_KEY_TYPE_HMAC
|
||||
mac_key_policy:0:PSA_ALG_HMAC(PSA_ALG_SHA_256):PSA_KEY_TYPE_HMAC:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":PSA_ALG_HMAC(PSA_ALG_SHA_256)
|
||||
mac_key_policy:0:PSA_ALG_HMAC(PSA_ALG_SHA_256):PSA_KEY_TYPE_HMAC:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":PSA_ALG_HMAC(PSA_ALG_SHA_256):PSA_ERROR_NOT_PERMITTED
|
||||
|
||||
PSA key policy: MAC, sign-verify, tag length > min-length policy
|
||||
depends_on:PSA_WANT_ALG_HMAC:PSA_WANT_ALG_SHA_256:PSA_WANT_KEY_TYPE_HMAC
|
||||
mac_key_policy:PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH:PSA_ALG_MAC_WITH_MINIMUM_LENGTH_TAG(PSA_ALG_HMAC(PSA_ALG_SHA_256), 20):PSA_KEY_TYPE_HMAC:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":PSA_ALG_TRUNCATED_MAC(PSA_ALG_HMAC(PSA_ALG_SHA_256), 30):PSA_SUCCESS
|
||||
|
||||
PSA key policy: MAC, sign-verify, tag length = min-length policy
|
||||
depends_on:PSA_WANT_ALG_HMAC:PSA_WANT_ALG_SHA_256:PSA_WANT_KEY_TYPE_HMAC
|
||||
mac_key_policy:PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH:PSA_ALG_MAC_WITH_MINIMUM_LENGTH_TAG(PSA_ALG_HMAC(PSA_ALG_SHA_256), 20):PSA_KEY_TYPE_HMAC:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":PSA_ALG_TRUNCATED_MAC(PSA_ALG_HMAC(PSA_ALG_SHA_256), 20):PSA_SUCCESS
|
||||
|
||||
PSA key policy: MAC, sign-verify, tag length < min-length policy
|
||||
depends_on:PSA_WANT_ALG_HMAC:PSA_WANT_ALG_SHA_256:PSA_WANT_KEY_TYPE_HMAC
|
||||
mac_key_policy:PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH:PSA_ALG_MAC_WITH_MINIMUM_LENGTH_TAG(PSA_ALG_HMAC(PSA_ALG_SHA_256), 20):PSA_KEY_TYPE_HMAC:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":PSA_ALG_TRUNCATED_MAC(PSA_ALG_HMAC(PSA_ALG_SHA_256), 10):PSA_ERROR_NOT_PERMITTED
|
||||
|
||||
PSA key policy: MAC, sign-verify, min-length policy, unmatched base alg
|
||||
depends_on:PSA_WANT_ALG_HMAC:PSA_WANT_ALG_SHA_256:PSA_WANT_KEY_TYPE_HMAC:MBEDTLS_CMAC_C
|
||||
mac_key_policy:PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH:PSA_ALG_MAC_WITH_MINIMUM_LENGTH_TAG(PSA_ALG_HMAC(PSA_ALG_SHA_256), 20):PSA_KEY_TYPE_HMAC:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":PSA_ALG_TRUNCATED_MAC(PSA_ALG_CMAC, 20):PSA_ERROR_NOT_PERMITTED
|
||||
|
||||
PSA key policy: MAC, sign-verify, min-length policy used as algorithm
|
||||
depends_on:PSA_WANT_ALG_HMAC:PSA_WANT_ALG_SHA_256:PSA_WANT_KEY_TYPE_HMAC
|
||||
mac_key_policy:PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH:PSA_ALG_MAC_WITH_MINIMUM_LENGTH_TAG(PSA_ALG_HMAC(PSA_ALG_SHA_256), 20):PSA_KEY_TYPE_HMAC:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":PSA_ALG_MAC_WITH_MINIMUM_LENGTH_TAG(PSA_ALG_HMAC(PSA_ALG_SHA_256), 20):PSA_ERROR_NOT_PERMITTED
|
||||
|
||||
PSA key policy: MAC, sign-verify, tag length > exact-length policy
|
||||
depends_on:PSA_WANT_ALG_HMAC:PSA_WANT_ALG_SHA_256:PSA_WANT_KEY_TYPE_HMAC
|
||||
mac_key_policy:PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH:PSA_ALG_TRUNCATED_MAC(PSA_ALG_HMAC(PSA_ALG_SHA_256), 10):PSA_KEY_TYPE_HMAC:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":PSA_ALG_TRUNCATED_MAC(PSA_ALG_HMAC(PSA_ALG_SHA_256), 20):PSA_ERROR_NOT_PERMITTED
|
||||
|
||||
PSA key policy: MAC, sign-verify, tag length = exact-length policy
|
||||
depends_on:PSA_WANT_ALG_HMAC:PSA_WANT_ALG_SHA_256:PSA_WANT_KEY_TYPE_HMAC
|
||||
mac_key_policy:PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH:PSA_ALG_TRUNCATED_MAC(PSA_ALG_HMAC(PSA_ALG_SHA_256), 20):PSA_KEY_TYPE_HMAC:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":PSA_ALG_TRUNCATED_MAC(PSA_ALG_HMAC(PSA_ALG_SHA_256), 20):PSA_SUCCESS
|
||||
|
||||
PSA key policy: MAC, sign-verify, tag length < exact-length policy
|
||||
depends_on:PSA_WANT_ALG_HMAC:PSA_WANT_ALG_SHA_256:PSA_WANT_KEY_TYPE_HMAC
|
||||
mac_key_policy:PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH:PSA_ALG_TRUNCATED_MAC(PSA_ALG_HMAC(PSA_ALG_SHA_256), 20):PSA_KEY_TYPE_HMAC:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":PSA_ALG_TRUNCATED_MAC(PSA_ALG_HMAC(PSA_ALG_SHA_256), 10):PSA_ERROR_NOT_PERMITTED
|
||||
|
||||
PSA key policy: cipher, encrypt | decrypt
|
||||
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CTR
|
||||
@ -430,27 +462,59 @@ cipher_key_policy:PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT:0:PSA_KEY_TYPE_A
|
||||
|
||||
PSA key policy: AEAD, encrypt | decrypt
|
||||
depends_on:MBEDTLS_AES_C:MBEDTLS_CCM_C
|
||||
aead_key_policy:PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT:PSA_ALG_CCM:PSA_KEY_TYPE_AES:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":13:16:PSA_ALG_CCM
|
||||
aead_key_policy:PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT:PSA_ALG_CCM:PSA_KEY_TYPE_AES:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":13:16:PSA_ALG_CCM:PSA_SUCCESS
|
||||
|
||||
PSA key policy: AEAD, wrong algorithm
|
||||
depends_on:MBEDTLS_AES_C:MBEDTLS_CCM_C:MBEDTLS_GCM_C
|
||||
aead_key_policy:PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT:PSA_ALG_CCM:PSA_KEY_TYPE_AES:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":16:16:PSA_ALG_GCM
|
||||
aead_key_policy:PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT:PSA_ALG_CCM:PSA_KEY_TYPE_AES:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":16:16:PSA_ALG_GCM:PSA_ERROR_NOT_PERMITTED
|
||||
|
||||
PSA key policy: AEAD, alg=0 in policy
|
||||
depends_on:MBEDTLS_AES_C:MBEDTLS_CCM_C
|
||||
aead_key_policy:PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT:0:PSA_KEY_TYPE_AES:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":16:16:PSA_ALG_CCM
|
||||
aead_key_policy:PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT:0:PSA_KEY_TYPE_AES:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":16:16:PSA_ALG_CCM:PSA_ERROR_NOT_PERMITTED
|
||||
|
||||
PSA key policy: AEAD, encrypt but not decrypt
|
||||
depends_on:MBEDTLS_AES_C:MBEDTLS_CCM_C
|
||||
aead_key_policy:PSA_KEY_USAGE_ENCRYPT:PSA_ALG_CCM:PSA_KEY_TYPE_AES:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":13:16:PSA_ALG_CCM
|
||||
aead_key_policy:PSA_KEY_USAGE_ENCRYPT:PSA_ALG_CCM:PSA_KEY_TYPE_AES:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":13:16:PSA_ALG_CCM:PSA_SUCCESS
|
||||
|
||||
PSA key policy: AEAD, decrypt but not encrypt
|
||||
depends_on:MBEDTLS_AES_C:MBEDTLS_CCM_C
|
||||
aead_key_policy:PSA_KEY_USAGE_DECRYPT:PSA_ALG_CCM:PSA_KEY_TYPE_AES:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":13:16:PSA_ALG_CCM
|
||||
aead_key_policy:PSA_KEY_USAGE_DECRYPT:PSA_ALG_CCM:PSA_KEY_TYPE_AES:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":13:16:PSA_ALG_CCM:PSA_SUCCESS
|
||||
|
||||
PSA key policy: AEAD, neither encrypt nor decrypt
|
||||
depends_on:MBEDTLS_AES_C:MBEDTLS_CCM_C
|
||||
aead_key_policy:0:PSA_ALG_CCM:PSA_KEY_TYPE_AES:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":13:16:PSA_ALG_CCM
|
||||
aead_key_policy:0:PSA_ALG_CCM:PSA_KEY_TYPE_AES:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":13:16:PSA_ALG_CCM:PSA_ERROR_NOT_PERMITTED
|
||||
|
||||
PSA key policy: AEAD, tag length > min-length policy
|
||||
depends_on:MBEDTLS_AES_C:MBEDTLS_CCM_C
|
||||
aead_key_policy:PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT:PSA_ALG_AEAD_WITH_MINIMUM_LENGTH_TAG(PSA_ALG_CCM, 4):PSA_KEY_TYPE_AES:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":13:8:PSA_ALG_AEAD_WITH_SHORTENED_TAG(PSA_ALG_CCM, 8):PSA_SUCCESS
|
||||
|
||||
PSA key policy: AEAD, tag length = min-length policy
|
||||
depends_on:MBEDTLS_AES_C:MBEDTLS_CCM_C
|
||||
aead_key_policy:PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT:PSA_ALG_AEAD_WITH_MINIMUM_LENGTH_TAG(PSA_ALG_CCM, 4):PSA_KEY_TYPE_AES:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":13:4:PSA_ALG_AEAD_WITH_SHORTENED_TAG(PSA_ALG_CCM, 4):PSA_SUCCESS
|
||||
|
||||
PSA key policy: AEAD, tag length < min-length policy
|
||||
depends_on:MBEDTLS_AES_C:MBEDTLS_CCM_C
|
||||
aead_key_policy:PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT:PSA_ALG_AEAD_WITH_MINIMUM_LENGTH_TAG(PSA_ALG_CCM, 8):PSA_KEY_TYPE_AES:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":13:4:PSA_ALG_AEAD_WITH_SHORTENED_TAG(PSA_ALG_CCM, 4):PSA_ERROR_NOT_PERMITTED
|
||||
|
||||
PSA key policy: AEAD, min-length policy, unmatched base alg
|
||||
depends_on:MBEDTLS_AES_C:MBEDTLS_CCM_C:MBEDTLS_GCM_C
|
||||
aead_key_policy:PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT:PSA_ALG_AEAD_WITH_MINIMUM_LENGTH_TAG(PSA_ALG_CCM, 4):PSA_KEY_TYPE_AES:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":13:4:PSA_ALG_AEAD_WITH_SHORTENED_TAG(PSA_ALG_GCM, 4):PSA_ERROR_NOT_PERMITTED
|
||||
|
||||
PSA key policy: AEAD, min-length policy used as algorithm
|
||||
depends_on:MBEDTLS_AES_C:MBEDTLS_CCM_C
|
||||
aead_key_policy:PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT:PSA_ALG_AEAD_WITH_MINIMUM_LENGTH_TAG(PSA_ALG_CCM, 8):PSA_KEY_TYPE_AES:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":13:8:PSA_ALG_AEAD_WITH_MINIMUM_LENGTH_TAG(PSA_ALG_CCM, 8):PSA_ERROR_NOT_PERMITTED
|
||||
|
||||
PSA key policy: AEAD, tag length > exact-length policy
|
||||
depends_on:MBEDTLS_AES_C:MBEDTLS_CCM_C
|
||||
aead_key_policy:PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT:PSA_ALG_AEAD_WITH_SHORTENED_TAG(PSA_ALG_CCM, 4):PSA_KEY_TYPE_AES:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":13:8:PSA_ALG_AEAD_WITH_SHORTENED_TAG(PSA_ALG_CCM, 8):PSA_ERROR_NOT_PERMITTED
|
||||
|
||||
PSA key policy: AEAD, tag length = exact-length policy
|
||||
depends_on:MBEDTLS_AES_C:MBEDTLS_CCM_C
|
||||
aead_key_policy:PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT:PSA_ALG_AEAD_WITH_SHORTENED_TAG(PSA_ALG_CCM, 4):PSA_KEY_TYPE_AES:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":13:4:PSA_ALG_AEAD_WITH_SHORTENED_TAG(PSA_ALG_CCM, 4):PSA_SUCCESS
|
||||
|
||||
PSA key policy: AEAD, tag length < exact-length policy
|
||||
depends_on:MBEDTLS_AES_C:MBEDTLS_CCM_C
|
||||
aead_key_policy:PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT:PSA_ALG_AEAD_WITH_SHORTENED_TAG(PSA_ALG_CCM, 8):PSA_KEY_TYPE_AES:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":13:4:PSA_ALG_AEAD_WITH_SHORTENED_TAG(PSA_ALG_CCM, 4):PSA_ERROR_NOT_PERMITTED
|
||||
|
||||
PSA key policy: asymmetric encryption, encrypt | decrypt
|
||||
depends_on:PSA_WANT_ALG_RSA_PKCS1V15_CRYPT:PSA_WANT_KEY_TYPE_RSA_KEY_PAIR
|
||||
@ -698,6 +762,78 @@ Copy fail: AES, incompatible target policy
|
||||
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CTR:MBEDTLS_CIPHER_MODE_CBC
|
||||
copy_fail:PSA_KEY_USAGE_COPY | PSA_KEY_USAGE_EXPORT:PSA_ALG_CTR:0:PSA_KEY_TYPE_AES:"404142434445464748494a4b4c4d4e4f":0:0:PSA_KEY_USAGE_EXPORT:PSA_ALG_CBC_NO_PADDING:0:PSA_ERROR_INVALID_ARGUMENT
|
||||
|
||||
Copy key: source=MAC min-length, target=MAC length > min-length
|
||||
depends_on:MBEDTLS_SHA256_C
|
||||
copy_success:PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH | PSA_KEY_USAGE_COPY | PSA_KEY_USAGE_EXPORT:PSA_ALG_MAC_WITH_MINIMUM_LENGTH_TAG(PSA_ALG_HMAC(PSA_ALG_SHA_256), 20):0:PSA_KEY_TYPE_HMAC:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":0:PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH | PSA_KEY_USAGE_EXPORT:PSA_ALG_TRUNCATED_MAC(PSA_ALG_HMAC(PSA_ALG_SHA_256), 24):0:PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH | PSA_KEY_USAGE_EXPORT:PSA_ALG_TRUNCATED_MAC(PSA_ALG_HMAC(PSA_ALG_SHA_256), 24):0
|
||||
|
||||
Copy key: source=MAC min-length, target=MAC length = min-length
|
||||
depends_on:MBEDTLS_SHA256_C
|
||||
copy_success:PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH | PSA_KEY_USAGE_COPY | PSA_KEY_USAGE_EXPORT:PSA_ALG_MAC_WITH_MINIMUM_LENGTH_TAG(PSA_ALG_HMAC(PSA_ALG_SHA_256), 20):0:PSA_KEY_TYPE_HMAC:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":0:PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH | PSA_KEY_USAGE_EXPORT:PSA_ALG_TRUNCATED_MAC(PSA_ALG_HMAC(PSA_ALG_SHA_256), 20):0:PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH | PSA_KEY_USAGE_EXPORT:PSA_ALG_TRUNCATED_MAC(PSA_ALG_HMAC(PSA_ALG_SHA_256), 20):0
|
||||
|
||||
Copy fail: source=MAC min-length, target=MAC length < min-length
|
||||
depends_on:MBEDTLS_SHA256_C
|
||||
copy_fail:PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH | PSA_KEY_USAGE_COPY | PSA_KEY_USAGE_EXPORT:PSA_ALG_MAC_WITH_MINIMUM_LENGTH_TAG(PSA_ALG_HMAC(PSA_ALG_SHA_256), 20):0:PSA_KEY_TYPE_HMAC:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":PSA_KEY_TYPE_HMAC:256:PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH | PSA_KEY_USAGE_EXPORT:PSA_ALG_TRUNCATED_MAC(PSA_ALG_HMAC(PSA_ALG_SHA_256), 16):0:PSA_ERROR_INVALID_ARGUMENT
|
||||
|
||||
Copy key: source=MAC min-length, target=MAC min-length, src > tgt
|
||||
depends_on:MBEDTLS_SHA256_C
|
||||
copy_success:PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH | PSA_KEY_USAGE_COPY | PSA_KEY_USAGE_EXPORT:PSA_ALG_MAC_WITH_MINIMUM_LENGTH_TAG(PSA_ALG_HMAC(PSA_ALG_SHA_256), 24):0:PSA_KEY_TYPE_HMAC:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":0:PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH | PSA_KEY_USAGE_EXPORT:PSA_ALG_MAC_WITH_MINIMUM_LENGTH_TAG(PSA_ALG_HMAC(PSA_ALG_SHA_256), 20):0:PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH | PSA_KEY_USAGE_EXPORT:PSA_ALG_MAC_WITH_MINIMUM_LENGTH_TAG(PSA_ALG_HMAC(PSA_ALG_SHA_256), 24):0
|
||||
|
||||
Copy key: source=MAC min-length, target=MAC min-length, src = tgt
|
||||
depends_on:MBEDTLS_SHA256_C
|
||||
copy_success:PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH | PSA_KEY_USAGE_COPY | PSA_KEY_USAGE_EXPORT:PSA_ALG_MAC_WITH_MINIMUM_LENGTH_TAG(PSA_ALG_HMAC(PSA_ALG_SHA_256), 20):0:PSA_KEY_TYPE_HMAC:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":0:PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH | PSA_KEY_USAGE_EXPORT:PSA_ALG_MAC_WITH_MINIMUM_LENGTH_TAG(PSA_ALG_HMAC(PSA_ALG_SHA_256), 20):0:PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH | PSA_KEY_USAGE_EXPORT:PSA_ALG_MAC_WITH_MINIMUM_LENGTH_TAG(PSA_ALG_HMAC(PSA_ALG_SHA_256), 20):0
|
||||
|
||||
Copy key: source=MAC min-length, target=MAC min-length, src < tgt
|
||||
depends_on:MBEDTLS_SHA256_C
|
||||
copy_success:PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH | PSA_KEY_USAGE_COPY | PSA_KEY_USAGE_EXPORT:PSA_ALG_MAC_WITH_MINIMUM_LENGTH_TAG(PSA_ALG_HMAC(PSA_ALG_SHA_256), 20):0:PSA_KEY_TYPE_HMAC:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":0:PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH | PSA_KEY_USAGE_EXPORT:PSA_ALG_MAC_WITH_MINIMUM_LENGTH_TAG(PSA_ALG_HMAC(PSA_ALG_SHA_256), 24):0:PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH | PSA_KEY_USAGE_EXPORT:PSA_ALG_MAC_WITH_MINIMUM_LENGTH_TAG(PSA_ALG_HMAC(PSA_ALG_SHA_256), 24):0
|
||||
|
||||
Copy fail: source=MAC, target=MAC min-length > length
|
||||
depends_on:MBEDTLS_SHA256_C
|
||||
copy_fail:PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH | PSA_KEY_USAGE_COPY | PSA_KEY_USAGE_EXPORT:PSA_ALG_TRUNCATED_MAC(PSA_ALG_HMAC(PSA_ALG_SHA_256), 20):0:PSA_KEY_TYPE_HMAC:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":PSA_KEY_TYPE_HMAC:256:PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH | PSA_KEY_USAGE_EXPORT:PSA_ALG_MAC_WITH_MINIMUM_LENGTH_TAG(PSA_ALG_HMAC(PSA_ALG_SHA_256), 24):0:PSA_ERROR_INVALID_ARGUMENT
|
||||
|
||||
Copy key: source=MAC, target=MAC min-length = length
|
||||
depends_on:MBEDTLS_SHA256_C
|
||||
copy_success:PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH | PSA_KEY_USAGE_COPY | PSA_KEY_USAGE_EXPORT:PSA_ALG_TRUNCATED_MAC(PSA_ALG_HMAC(PSA_ALG_SHA_256), 20):0:PSA_KEY_TYPE_HMAC:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":0:PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH | PSA_KEY_USAGE_EXPORT:PSA_ALG_MAC_WITH_MINIMUM_LENGTH_TAG(PSA_ALG_HMAC(PSA_ALG_SHA_256), 20):0:PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH | PSA_KEY_USAGE_EXPORT:PSA_ALG_TRUNCATED_MAC(PSA_ALG_HMAC(PSA_ALG_SHA_256), 20):0
|
||||
|
||||
Copy key: source=MAC, target=MAC min-length < length
|
||||
depends_on:MBEDTLS_SHA256_C
|
||||
copy_success:PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH | PSA_KEY_USAGE_COPY | PSA_KEY_USAGE_EXPORT:PSA_ALG_TRUNCATED_MAC(PSA_ALG_HMAC(PSA_ALG_SHA_256), 20):0:PSA_KEY_TYPE_HMAC:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":0:PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH | PSA_KEY_USAGE_EXPORT:PSA_ALG_MAC_WITH_MINIMUM_LENGTH_TAG(PSA_ALG_HMAC(PSA_ALG_SHA_256), 16):0:PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH | PSA_KEY_USAGE_EXPORT:PSA_ALG_TRUNCATED_MAC(PSA_ALG_HMAC(PSA_ALG_SHA_256), 20):0
|
||||
|
||||
Copy key: source=AEAD min-length, target=AEAD length > min-length
|
||||
depends_on:MBEDTLS_AES_C:MBEDTLS_CCM_C
|
||||
copy_success:PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT | PSA_KEY_USAGE_COPY | PSA_KEY_USAGE_EXPORT:PSA_ALG_AEAD_WITH_MINIMUM_LENGTH_TAG(PSA_ALG_CCM, 4):0:PSA_KEY_TYPE_AES:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":0:PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT | PSA_KEY_USAGE_EXPORT:PSA_ALG_AEAD_WITH_SHORTENED_TAG(PSA_ALG_CCM, 8):0:PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT | PSA_KEY_USAGE_EXPORT:PSA_ALG_AEAD_WITH_SHORTENED_TAG(PSA_ALG_CCM, 8):0
|
||||
|
||||
Copy key: source=AEAD min-length, target=AEAD length = min-length
|
||||
depends_on:MBEDTLS_AES_C:MBEDTLS_CCM_C
|
||||
copy_success:PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT | PSA_KEY_USAGE_COPY | PSA_KEY_USAGE_EXPORT:PSA_ALG_AEAD_WITH_MINIMUM_LENGTH_TAG(PSA_ALG_CCM, 4):0:PSA_KEY_TYPE_AES:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":0:PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT | PSA_KEY_USAGE_EXPORT:PSA_ALG_AEAD_WITH_SHORTENED_TAG(PSA_ALG_CCM, 4):0:PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT | PSA_KEY_USAGE_EXPORT:PSA_ALG_AEAD_WITH_SHORTENED_TAG(PSA_ALG_CCM, 4):0
|
||||
|
||||
Copy fail: source=AEAD min-length, target=AEAD length < min-length
|
||||
depends_on:MBEDTLS_AES_C:MBEDTLS_CCM_C
|
||||
copy_fail:PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT | PSA_KEY_USAGE_COPY | PSA_KEY_USAGE_EXPORT:PSA_ALG_AEAD_WITH_MINIMUM_LENGTH_TAG(PSA_ALG_CCM, 8):0:PSA_KEY_TYPE_AES:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":PSA_KEY_TYPE_AES:128:PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT | PSA_KEY_USAGE_EXPORT:PSA_ALG_AEAD_WITH_SHORTENED_TAG(PSA_ALG_CCM, 4):0:PSA_ERROR_INVALID_ARGUMENT
|
||||
|
||||
Copy key: source=AEAD min-length, target=AEAD min-length, src > tgt
|
||||
depends_on:MBEDTLS_AES_C:MBEDTLS_CCM_C
|
||||
copy_success:PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT | PSA_KEY_USAGE_COPY | PSA_KEY_USAGE_EXPORT:PSA_ALG_AEAD_WITH_MINIMUM_LENGTH_TAG(PSA_ALG_CCM, 8):0:PSA_KEY_TYPE_AES:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":0:PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT | PSA_KEY_USAGE_EXPORT:PSA_ALG_AEAD_WITH_MINIMUM_LENGTH_TAG(PSA_ALG_CCM, 4):0:PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT | PSA_KEY_USAGE_EXPORT:PSA_ALG_AEAD_WITH_MINIMUM_LENGTH_TAG(PSA_ALG_CCM, 8):0
|
||||
|
||||
Copy key: source=AEAD min-length, target=AEAD min-length, src = tgt
|
||||
depends_on:MBEDTLS_AES_C:MBEDTLS_CCM_C
|
||||
copy_success:PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT | PSA_KEY_USAGE_COPY | PSA_KEY_USAGE_EXPORT:PSA_ALG_AEAD_WITH_MINIMUM_LENGTH_TAG(PSA_ALG_CCM, 8):0:PSA_KEY_TYPE_AES:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":0:PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT | PSA_KEY_USAGE_EXPORT:PSA_ALG_AEAD_WITH_MINIMUM_LENGTH_TAG(PSA_ALG_CCM, 8):0:PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT | PSA_KEY_USAGE_EXPORT:PSA_ALG_AEAD_WITH_MINIMUM_LENGTH_TAG(PSA_ALG_CCM, 8):0
|
||||
|
||||
Copy key: source=AEAD min-length, target=AEAD min-length, src < tgt
|
||||
depends_on:MBEDTLS_AES_C:MBEDTLS_CCM_C
|
||||
copy_success:PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT | PSA_KEY_USAGE_COPY | PSA_KEY_USAGE_EXPORT:PSA_ALG_AEAD_WITH_MINIMUM_LENGTH_TAG(PSA_ALG_CCM, 4):0:PSA_KEY_TYPE_AES:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":0:PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT | PSA_KEY_USAGE_EXPORT:PSA_ALG_AEAD_WITH_MINIMUM_LENGTH_TAG(PSA_ALG_CCM, 8):0:PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT | PSA_KEY_USAGE_EXPORT:PSA_ALG_AEAD_WITH_MINIMUM_LENGTH_TAG(PSA_ALG_CCM, 8):0
|
||||
|
||||
Copy fail: source=AEAD, target=AEAD min-length > length
|
||||
depends_on:MBEDTLS_AES_C:MBEDTLS_CCM_C
|
||||
copy_fail:PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT | PSA_KEY_USAGE_COPY | PSA_KEY_USAGE_EXPORT:PSA_ALG_AEAD_WITH_SHORTENED_TAG(PSA_ALG_CCM, 4):0:PSA_KEY_TYPE_AES:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":PSA_KEY_TYPE_AES:128:PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT | PSA_KEY_USAGE_EXPORT:PSA_ALG_AEAD_WITH_MINIMUM_LENGTH_TAG(PSA_ALG_CCM, 8):0:PSA_ERROR_INVALID_ARGUMENT
|
||||
|
||||
Copy key: source=AEAD, target=AEAD min-length = length
|
||||
depends_on:MBEDTLS_AES_C:MBEDTLS_CCM_C
|
||||
copy_success:PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT | PSA_KEY_USAGE_COPY | PSA_KEY_USAGE_EXPORT:PSA_ALG_AEAD_WITH_SHORTENED_TAG(PSA_ALG_CCM, 8):0:PSA_KEY_TYPE_AES:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":0:PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT | PSA_KEY_USAGE_EXPORT:PSA_ALG_AEAD_WITH_MINIMUM_LENGTH_TAG(PSA_ALG_CCM, 8):0:PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT | PSA_KEY_USAGE_EXPORT:PSA_ALG_AEAD_WITH_SHORTENED_TAG(PSA_ALG_CCM, 8):0
|
||||
|
||||
Copy key: source=AEAD, target=AEAD min-length < length
|
||||
depends_on:MBEDTLS_AES_C:MBEDTLS_CCM_C
|
||||
copy_success:PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT | PSA_KEY_USAGE_COPY | PSA_KEY_USAGE_EXPORT:PSA_ALG_AEAD_WITH_SHORTENED_TAG(PSA_ALG_CCM, 12):0:PSA_KEY_TYPE_AES:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":0:PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT | PSA_KEY_USAGE_EXPORT:PSA_ALG_AEAD_WITH_MINIMUM_LENGTH_TAG(PSA_ALG_CCM, 8):0:PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT | PSA_KEY_USAGE_EXPORT:PSA_ALG_AEAD_WITH_SHORTENED_TAG(PSA_ALG_CCM, 12):0
|
||||
|
||||
Copy fail: RSA, incompatible target policy (source wildcard)
|
||||
depends_on:PSA_WANT_ALG_RSA_PKCS1V15_SIGN:PSA_WANT_KEY_TYPE_RSA_KEY_PAIR:MBEDTLS_PK_PARSE_C:MBEDTLS_PK_WRITE_C
|
||||
copy_fail:PSA_KEY_USAGE_COPY | PSA_KEY_USAGE_EXPORT:PSA_ALG_RSA_PKCS1V15_SIGN(PSA_ALG_ANY_HASH):0:PSA_KEY_TYPE_RSA_KEY_PAIR:"3082025e02010002818100af057d396ee84fb75fdbb5c2b13c7fe5a654aa8aa2470b541ee1feb0b12d25c79711531249e1129628042dbbb6c120d1443524ef4c0e6e1d8956eeb2077af12349ddeee54483bc06c2c61948cd02b202e796aebd94d3a7cbf859c2c1819c324cb82b9cd34ede263a2abffe4733f077869e8660f7d6834da53d690ef7985f6bc3020301000102818100874bf0ffc2f2a71d14671ddd0171c954d7fdbf50281e4f6d99ea0e1ebcf82faa58e7b595ffb293d1abe17f110b37c48cc0f36c37e84d876621d327f64bbe08457d3ec4098ba2fa0a319fba411c2841ed7be83196a8cdf9daa5d00694bc335fc4c32217fe0488bce9cb7202e59468b1ead119000477db2ca797fac19eda3f58c1024100e2ab760841bb9d30a81d222de1eb7381d82214407f1b975cbbfe4e1a9467fd98adbd78f607836ca5be1928b9d160d97fd45c12d6b52e2c9871a174c66b488113024100c5ab27602159ae7d6f20c3c2ee851e46dc112e689e28d5fcbbf990a99ef8a90b8bb44fd36467e7fc1789ceb663abda338652c3c73f111774902e840565927091024100b6cdbd354f7df579a63b48b3643e353b84898777b48b15f94e0bfc0567a6ae5911d57ad6409cf7647bf96264e9bd87eb95e263b7110b9a1f9f94acced0fafa4d024071195eec37e8d257decfc672b07ae639f10cbb9b0c739d0c809968d644a94e3fd6ed9287077a14583f379058f76a8aecd43c62dc8c0f41766650d725275ac4a1024100bb32d133edc2e048d463388b7be9cb4be29f4b6250be603e70e3647501c97ddde20a4e71be95fd5e71784e25aca4baf25be5738aae59bbfe1c997781447a2b24":0:0:PSA_KEY_USAGE_EXPORT:PSA_ALG_RSA_PSS(PSA_ALG_SHA_256):0:PSA_ERROR_INVALID_ARGUMENT
|
||||
@ -1928,7 +2064,7 @@ PSA sign: RSA PKCS#1 v1.5, invalid hash (wildcard)
|
||||
depends_on:MBEDTLS_PK_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_MD_C:MBEDTLS_PKCS1_V15
|
||||
# Arguably the error should be INVALID_ARGUMENT, but NOT_SUPPORTED is simpler
|
||||
# to implement.
|
||||
sign_fail:PSA_KEY_TYPE_RSA_KEY_PAIR:"3082025e02010002818100af057d396ee84fb75fdbb5c2b13c7fe5a654aa8aa2470b541ee1feb0b12d25c79711531249e1129628042dbbb6c120d1443524ef4c0e6e1d8956eeb2077af12349ddeee54483bc06c2c61948cd02b202e796aebd94d3a7cbf859c2c1819c324cb82b9cd34ede263a2abffe4733f077869e8660f7d6834da53d690ef7985f6bc3020301000102818100874bf0ffc2f2a71d14671ddd0171c954d7fdbf50281e4f6d99ea0e1ebcf82faa58e7b595ffb293d1abe17f110b37c48cc0f36c37e84d876621d327f64bbe08457d3ec4098ba2fa0a319fba411c2841ed7be83196a8cdf9daa5d00694bc335fc4c32217fe0488bce9cb7202e59468b1ead119000477db2ca797fac19eda3f58c1024100e2ab760841bb9d30a81d222de1eb7381d82214407f1b975cbbfe4e1a9467fd98adbd78f607836ca5be1928b9d160d97fd45c12d6b52e2c9871a174c66b488113024100c5ab27602159ae7d6f20c3c2ee851e46dc112e689e28d5fcbbf990a99ef8a90b8bb44fd36467e7fc1789ceb663abda338652c3c73f111774902e840565927091024100b6cdbd354f7df579a63b48b3643e353b84898777b48b15f94e0bfc0567a6ae5911d57ad6409cf7647bf96264e9bd87eb95e263b7110b9a1f9f94acced0fafa4d024071195eec37e8d257decfc672b07ae639f10cbb9b0c739d0c809968d644a94e3fd6ed9287077a14583f379058f76a8aecd43c62dc8c0f41766650d725275ac4a1024100bb32d133edc2e048d463388b7be9cb4be29f4b6250be603e70e3647501c97ddde20a4e71be95fd5e71784e25aca4baf25be5738aae59bbfe1c997781447a2b24":PSA_ALG_RSA_PKCS1V15_SIGN(PSA_ALG_ANY_HASH):"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":128:PSA_ERROR_NOT_SUPPORTED
|
||||
sign_fail:PSA_KEY_TYPE_RSA_KEY_PAIR:"3082025e02010002818100af057d396ee84fb75fdbb5c2b13c7fe5a654aa8aa2470b541ee1feb0b12d25c79711531249e1129628042dbbb6c120d1443524ef4c0e6e1d8956eeb2077af12349ddeee54483bc06c2c61948cd02b202e796aebd94d3a7cbf859c2c1819c324cb82b9cd34ede263a2abffe4733f077869e8660f7d6834da53d690ef7985f6bc3020301000102818100874bf0ffc2f2a71d14671ddd0171c954d7fdbf50281e4f6d99ea0e1ebcf82faa58e7b595ffb293d1abe17f110b37c48cc0f36c37e84d876621d327f64bbe08457d3ec4098ba2fa0a319fba411c2841ed7be83196a8cdf9daa5d00694bc335fc4c32217fe0488bce9cb7202e59468b1ead119000477db2ca797fac19eda3f58c1024100e2ab760841bb9d30a81d222de1eb7381d82214407f1b975cbbfe4e1a9467fd98adbd78f607836ca5be1928b9d160d97fd45c12d6b52e2c9871a174c66b488113024100c5ab27602159ae7d6f20c3c2ee851e46dc112e689e28d5fcbbf990a99ef8a90b8bb44fd36467e7fc1789ceb663abda338652c3c73f111774902e840565927091024100b6cdbd354f7df579a63b48b3643e353b84898777b48b15f94e0bfc0567a6ae5911d57ad6409cf7647bf96264e9bd87eb95e263b7110b9a1f9f94acced0fafa4d024071195eec37e8d257decfc672b07ae639f10cbb9b0c739d0c809968d644a94e3fd6ed9287077a14583f379058f76a8aecd43c62dc8c0f41766650d725275ac4a1024100bb32d133edc2e048d463388b7be9cb4be29f4b6250be603e70e3647501c97ddde20a4e71be95fd5e71784e25aca4baf25be5738aae59bbfe1c997781447a2b24":PSA_ALG_RSA_PKCS1V15_SIGN(PSA_ALG_ANY_HASH):"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa":128:PSA_ERROR_NOT_PERMITTED
|
||||
|
||||
PSA sign: RSA PKCS#1 v1.5 raw, input too large
|
||||
depends_on:PSA_WANT_ALG_RSA_PKCS1V15_SIGN:PSA_WANT_KEY_TYPE_RSA_KEY_PAIR:MBEDTLS_PK_PARSE_C:MBEDTLS_MD_C
|
||||
@ -1956,7 +2092,7 @@ sign_fail:PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_FAMILY_SECP_R1):"ab45435712649cb30bb
|
||||
|
||||
PSA sign: deterministic ECDSA SECP256R1, invalid hash algorithm (wildcard)
|
||||
depends_on:PSA_WANT_ALG_DETERMINISTIC_ECDSA:PSA_WANT_KEY_TYPE_ECC_KEY_PAIR:MBEDTLS_PK_PARSE_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_MD_C
|
||||
sign_fail:PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_FAMILY_SECP_R1):"ab45435712649cb30bbddac49197eebf2740ffc7f874d9244c3460f54f322d3a":PSA_ALG_DETERMINISTIC_ECDSA( PSA_ALG_ANY_HASH ):"9ac4335b469bbd791439248504dd0d49c71349a295fee5a1c68507f45a9e1c7b":72:PSA_ERROR_INVALID_ARGUMENT
|
||||
sign_fail:PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_FAMILY_SECP_R1):"ab45435712649cb30bbddac49197eebf2740ffc7f874d9244c3460f54f322d3a":PSA_ALG_DETERMINISTIC_ECDSA( PSA_ALG_ANY_HASH ):"9ac4335b469bbd791439248504dd0d49c71349a295fee5a1c68507f45a9e1c7b":72:PSA_ERROR_NOT_PERMITTED
|
||||
|
||||
PSA sign: invalid key type, signing with a public key
|
||||
depends_on:PSA_WANT_ALG_RSA_PKCS1V15_SIGN:PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY:MBEDTLS_PK_PARSE_C
|
||||
|
@ -834,12 +834,14 @@ void mac_key_policy( int policy_usage,
|
||||
int policy_alg,
|
||||
int key_type,
|
||||
data_t *key_data,
|
||||
int exercise_alg )
|
||||
int exercise_alg,
|
||||
int expected_status_arg )
|
||||
{
|
||||
mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
|
||||
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
|
||||
psa_mac_operation_t operation = PSA_MAC_OPERATION_INIT;
|
||||
psa_status_t status;
|
||||
psa_status_t expected_status = expected_status_arg;
|
||||
unsigned char mac[PSA_MAC_MAX_SIZE];
|
||||
|
||||
PSA_ASSERT( psa_crypto_init( ) );
|
||||
@ -852,20 +854,19 @@ void mac_key_policy( int policy_usage,
|
||||
&key ) );
|
||||
|
||||
status = psa_mac_sign_setup( &operation, key, exercise_alg );
|
||||
if( policy_alg == exercise_alg &&
|
||||
( policy_usage & PSA_KEY_USAGE_SIGN_HASH ) != 0 )
|
||||
PSA_ASSERT( status );
|
||||
else
|
||||
if( ( policy_usage & PSA_KEY_USAGE_SIGN_HASH ) == 0 )
|
||||
TEST_EQUAL( status, PSA_ERROR_NOT_PERMITTED );
|
||||
else
|
||||
TEST_EQUAL( status, expected_status );
|
||||
|
||||
psa_mac_abort( &operation );
|
||||
|
||||
memset( mac, 0, sizeof( mac ) );
|
||||
status = psa_mac_verify_setup( &operation, key, exercise_alg );
|
||||
if( policy_alg == exercise_alg &&
|
||||
( policy_usage & PSA_KEY_USAGE_VERIFY_HASH ) != 0 )
|
||||
PSA_ASSERT( status );
|
||||
else
|
||||
if( ( policy_usage & PSA_KEY_USAGE_VERIFY_HASH ) == 0 )
|
||||
TEST_EQUAL( status, PSA_ERROR_NOT_PERMITTED );
|
||||
else
|
||||
TEST_EQUAL( status, expected_status );
|
||||
|
||||
exit:
|
||||
psa_mac_abort( &operation );
|
||||
@ -924,11 +925,13 @@ void aead_key_policy( int policy_usage,
|
||||
data_t *key_data,
|
||||
int nonce_length_arg,
|
||||
int tag_length_arg,
|
||||
int exercise_alg )
|
||||
int exercise_alg,
|
||||
int expected_status_arg )
|
||||
{
|
||||
mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
|
||||
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
|
||||
psa_status_t status;
|
||||
psa_status_t expected_status = expected_status_arg;
|
||||
unsigned char nonce[16] = {0};
|
||||
size_t nonce_length = nonce_length_arg;
|
||||
unsigned char tag[16];
|
||||
@ -953,9 +956,8 @@ void aead_key_policy( int policy_usage,
|
||||
NULL, 0,
|
||||
tag, tag_length,
|
||||
&output_length );
|
||||
if( policy_alg == exercise_alg &&
|
||||
( policy_usage & PSA_KEY_USAGE_ENCRYPT ) != 0 )
|
||||
PSA_ASSERT( status );
|
||||
if( ( policy_usage & PSA_KEY_USAGE_ENCRYPT ) != 0 )
|
||||
TEST_EQUAL( status, expected_status );
|
||||
else
|
||||
TEST_EQUAL( status, PSA_ERROR_NOT_PERMITTED );
|
||||
|
||||
@ -966,11 +968,12 @@ void aead_key_policy( int policy_usage,
|
||||
tag, tag_length,
|
||||
NULL, 0,
|
||||
&output_length );
|
||||
if( policy_alg == exercise_alg &&
|
||||
( policy_usage & PSA_KEY_USAGE_DECRYPT ) != 0 )
|
||||
if( ( policy_usage & PSA_KEY_USAGE_DECRYPT ) == 0 )
|
||||
TEST_EQUAL( status, PSA_ERROR_NOT_PERMITTED );
|
||||
else if( expected_status == PSA_SUCCESS )
|
||||
TEST_EQUAL( status, PSA_ERROR_INVALID_SIGNATURE );
|
||||
else
|
||||
TEST_EQUAL( status, PSA_ERROR_NOT_PERMITTED );
|
||||
TEST_EQUAL( status, expected_status );
|
||||
|
||||
exit:
|
||||
psa_destroy_key( key );
|
||||
@ -1334,6 +1337,20 @@ void copy_success( int source_usage_arg,
|
||||
ASSERT_COMPARE( material->x, material->len,
|
||||
export_buffer, length );
|
||||
}
|
||||
|
||||
/* Convert wildcard algorithm to exercisable algorithm */
|
||||
if( PSA_ALG_IS_WILDCARD( expected_alg ) )
|
||||
{
|
||||
if( PSA_ALG_IS_MAC( expected_alg ) )
|
||||
expected_alg = PSA_ALG_TRUNCATED_MAC(
|
||||
expected_alg,
|
||||
PSA_MAC_TRUNCATED_LENGTH( expected_alg ) );
|
||||
if( PSA_ALG_IS_AEAD( expected_alg ) )
|
||||
expected_alg = PSA_ALG_AEAD_WITH_SHORTENED_TAG(
|
||||
expected_alg,
|
||||
PSA_ALG_AEAD_GET_TAG_LENGTH( expected_alg ) );
|
||||
}
|
||||
|
||||
if( ! mbedtls_test_psa_exercise_key( target_key, expected_usage, expected_alg ) )
|
||||
goto exit;
|
||||
if( ! mbedtls_test_psa_exercise_key( target_key, expected_usage, expected_alg2 ) )
|
||||
|
Loading…
Reference in New Issue
Block a user