Skip to content

Commit f94001a

Browse files
Declare SM3, SM4, EAX, EAXprime
Declare key types and algorithms for the SM3 hash function, the SM4 block cipher and the EAX and EAXprime AEAD modes over block ciphers.
1 parent 8e89c39 commit f94001a

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

include/psa/crypto_values.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,10 @@
411411
* ARIA block cipher. */
412412
#define PSA_KEY_TYPE_ARIA ((psa_key_type_t)0x2405)
413413

414+
/** Key for a cipher, AEAD or MAC algorithm based on the
415+
* SM4 block cipher. */
416+
#define PSA_KEY_TYPE_SM4 ((psa_key_type_t)0x2406)
417+
414418
/** Key for the RC4 stream cipher.
415419
*
416420
* Note that RC4 is weak and deprecated and should only be used in
@@ -760,6 +764,8 @@
760764
#define PSA_ALG_RIPEMD160 ((psa_algorithm_t)0x01000004)
761765
/** SHA1 */
762766
#define PSA_ALG_SHA_1 ((psa_algorithm_t)0x01000005)
767+
/** SM3 */
768+
#define PSA_ALG_SM3 ((psa_algorithm_t)0x01000006)
763769
/** SHA2-224 */
764770
#define PSA_ALG_SHA_224 ((psa_algorithm_t)0x01000008)
765771
/** SHA2-256 */
@@ -1055,6 +1061,20 @@
10551061
*/
10561062
#define PSA_ALG_GCM ((psa_algorithm_t)0x06401002)
10571063

1064+
/** The EAX authenticated encryption algorithm.
1065+
*
1066+
* The underlying block cipher is determined by the key type.
1067+
*/
1068+
#define PSA_ALG_EAX ((psa_algorithm_t)0x06401003)
1069+
1070+
/** The EAXprime authenticated encryption algorithm defined in ANSI C12.22.
1071+
*
1072+
* The underlying block cipher is determined by the key type.
1073+
*
1074+
* Note that EAXprime is unsafe with messages that are shorter than the key.
1075+
*/
1076+
#define PSA_ALG_EAX_PRIME ((psa_algorithm_t)0x06401004)
1077+
10581078
/** The Chacha20-Poly1305 AEAD algorithm.
10591079
*
10601080
* The ChaCha20_Poly1305 construction is defined in RFC 7539.

tests/suites/test_suite_psa_crypto_metadata.data

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ Hash: SHA-1
1818
depends_on:MBEDTLS_SHA1_C
1919
hash_algorithm:PSA_ALG_SHA_1:20
2020

21+
Hash: SM3
22+
depends_on:MBEDTLS_SM3_C
23+
hash_algorithm:PSA_ALG_SM3:32
24+
2125
Hash: SHA-2 SHA-224
2226
depends_on:MBEDTLS_SHA256_C
2327
hash_algorithm:PSA_ALG_SHA_224:28
@@ -198,6 +202,14 @@ AEAD: GCM
198202
depends_on:MBEDTLS_GCM_C
199203
aead_algorithm:PSA_ALG_GCM:ALG_IS_AEAD_ON_BLOCK_CIPHER:16
200204

205+
AEAD: EAX
206+
depends_on:MBEDTLS_EAX_C
207+
aead_algorithm:PSA_ALG_EAX:ALG_IS_AEAD_ON_BLOCK_CIPHER:16
208+
209+
AEAD: EAXprime
210+
depends_on:MBEDTLS_EAX_C
211+
aead_algorithm:PSA_ALG_EAX_PRIME:ALG_IS_AEAD_ON_BLOCK_CIPHER:16
212+
201213
AEAD: ChaCha20_Poly1305
202214
depends_on:MBEDTLS_CHACHAPOLY_C
203215
aead_algorithm:PSA_ALG_CHACHA20_POLY1305:0:16
@@ -343,6 +355,10 @@ Block cipher key type: ARIA
343355
depends_on:MBEDTLS_ARIA_C
344356
block_cipher_key_type:PSA_KEY_TYPE_ARIA:16
345357

358+
Block cipher key type: SM4
359+
depends_on:MBEDTLS_SM4_C
360+
block_cipher_key_type:PSA_KEY_TYPE_SM4:16
361+
346362
Stream cipher key type: ARC4
347363
depends_on:MBEDTLS_ARC4_C
348364
stream_cipher_key_type:PSA_KEY_TYPE_ARC4

0 commit comments

Comments
 (0)