Use enum for slot state in PSA-based cipher context
diff --git a/include/mbedtls/cipher_internal.h b/include/mbedtls/cipher_internal.h
index f1f0e2b..cecad9a 100644
--- a/include/mbedtls/cipher_internal.h
+++ b/include/mbedtls/cipher_internal.h
@@ -119,14 +119,26 @@
 } mbedtls_cipher_definition_t;
 
 #if defined(MBEDTLS_USE_PSA_CRYPTO)
+typedef enum
+{
+    MBEDTLS_CIPHER_PSA_KEY_UNSET = 0,
+    MBEDTLS_CIPHER_PSA_KEY_OWNED, /* Used for PSA-based cipher contexts
+                                   * which use raw key material internally
+                                   * imported into a freshly allocated key slot,
+                                   * and which hence need to destroy that key
+                                   * slot when they are no longer needed. */
+    MBEDTLS_CIPHER_PSA_KEY_NOT_OWNED, /* Used for PSA-based cipher contexts
+                                       * which use a key from a key slot
+                                       * provided by the user, and which hence
+                                       * should not be destroyed when the
+                                       * context is no longer needed. */
+} mbedtls_cipher_psa_key_ownership;
+
 typedef struct
 {
     psa_algorithm_t alg;
     psa_key_slot_t slot;
-    unsigned char slot_state; /*!< 0: The slot is unset.
-                               *   1: The slot is set and we own it.
-                               *   2: The slot is set but we don't own it. */
-
+    mbedtls_cipher_psa_key_ownership slot_state;
 } mbedtls_cipher_context_psa;
 #endif /* MBEDTLS_USE_PSA_CRYPTO */