Test the block size for symmetric keys

Also insist on their category.

Fix a missing implementation of PSA_BLOCK_CIPHER_BLOCK_SIZE for
ChaCha20.
diff --git a/include/psa/crypto_values.h b/include/psa/crypto_values.h
index d0008a9..dbe75ad 100644
--- a/include/psa/crypto_values.h
+++ b/include/psa/crypto_values.h
@@ -604,6 +604,7 @@
         (type) == PSA_KEY_TYPE_DES ? 8 :             \
         (type) == PSA_KEY_TYPE_CAMELLIA ? 16 :       \
         (type) == PSA_KEY_TYPE_ARC4 ? 1 :            \
+        (type) == PSA_KEY_TYPE_CHACHA20 ? 1 :            \
         0)
 
 /** Vendor-defined algorithm flag.
diff --git a/tests/scripts/test_psa_constant_names.py b/tests/scripts/test_psa_constant_names.py
index 585f9de..717d0db 100755
--- a/tests/scripts/test_psa_constant_names.py
+++ b/tests/scripts/test_psa_constant_names.py
@@ -102,6 +102,8 @@
             # Any function ending in _algorithm also gets added to
             # self.algorithms.
             'key_type': [self.key_types],
+            'block_cipher_key_type': [self.key_types],
+            'stream_cipher_key_type': [self.key_types],
             'ecc_key_types': [self.ecc_curves],
             'dh_key_types': [self.dh_groups],
             'hash_algorithm': [self.hash_algorithms],
diff --git a/tests/suites/test_suite_psa_crypto_metadata.data b/tests/suites/test_suite_psa_crypto_metadata.data
index 9cdee03..d0cc799 100644
--- a/tests/suites/test_suite_psa_crypto_metadata.data
+++ b/tests/suites/test_suite_psa_crypto_metadata.data
@@ -315,25 +315,25 @@
 Key type: secret for key derivation
 key_type:PSA_KEY_TYPE_DERIVE:KEY_TYPE_IS_UNSTRUCTURED
 
-Key type: AES
+Block cipher key type: AES
 depends_on:MBEDTLS_AES_C
-key_type:PSA_KEY_TYPE_AES:KEY_TYPE_IS_UNSTRUCTURED
+block_cipher_key_type:PSA_KEY_TYPE_AES:16
 
-Key type: DES
+Block cipher key type: DES
 depends_on:MBEDTLS_DES_C
-key_type:PSA_KEY_TYPE_DES:KEY_TYPE_IS_UNSTRUCTURED
+block_cipher_key_type:PSA_KEY_TYPE_DES:8
 
-Key type: Camellia
+Block cipher key type: Camellia
 depends_on:MBEDTLS_CAMELLIA_C
-key_type:PSA_KEY_TYPE_CAMELLIA:KEY_TYPE_IS_UNSTRUCTURED
+block_cipher_key_type:PSA_KEY_TYPE_CAMELLIA:16
 
-Key type: ARC4
+Stream cipher key type: ARC4
 depends_on:MBEDTLS_ARC4_C
-key_type:PSA_KEY_TYPE_ARC4:KEY_TYPE_IS_UNSTRUCTURED
+stream_cipher_key_type:PSA_KEY_TYPE_ARC4
 
-Key type: ChaCha20
+Stream cipher key type: ChaCha20
 depends_on:MBEDTLS_CHACHA20_C
-key_type:PSA_KEY_TYPE_CHACHA20:KEY_TYPE_IS_UNSTRUCTURED
+stream_cipher_key_type:PSA_KEY_TYPE_CHACHA20
 
 Key type: RSA public key
 depends_on:MBEDTLS_RSA_C
diff --git a/tests/suites/test_suite_psa_crypto_metadata.function b/tests/suites/test_suite_psa_crypto_metadata.function
index 3a9347e..9282641 100644
--- a/tests/suites/test_suite_psa_crypto_metadata.function
+++ b/tests/suites/test_suite_psa_crypto_metadata.function
@@ -450,6 +450,33 @@
 /* END_CASE */
 
 /* BEGIN_CASE */
+void block_cipher_key_type( int type_arg, int block_size_arg )
+{
+    psa_key_type_t type = type_arg;
+    size_t block_size = block_size_arg;
+
+    test_key_type( type_arg, KEY_TYPE_IS_UNSTRUCTURED );
+
+    TEST_EQUAL( type & PSA_KEY_TYPE_CATEGORY_MASK,
+                PSA_KEY_TYPE_CATEGORY_SYMMETRIC );
+    TEST_EQUAL( PSA_BLOCK_CIPHER_BLOCK_SIZE( type ), block_size );
+}
+/* END_CASE */
+
+/* BEGIN_CASE */
+void stream_cipher_key_type( int type_arg )
+{
+    psa_key_type_t type = type_arg;
+
+    test_key_type( type_arg, KEY_TYPE_IS_UNSTRUCTURED );
+
+    TEST_EQUAL( type & PSA_KEY_TYPE_CATEGORY_MASK,
+                PSA_KEY_TYPE_CATEGORY_SYMMETRIC );
+    TEST_EQUAL( PSA_BLOCK_CIPHER_BLOCK_SIZE( type ), 1 );
+}
+/* END_CASE */
+
+/* BEGIN_CASE */
 void ecc_key_types( int curve_arg, int curve_bits_arg )
 {
     psa_ecc_curve_t curve = curve_arg;