Improve/fix documentation

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
diff --git a/library/psa_crypto_core.h b/library/psa_crypto_core.h
index 1492d19..f61ef95 100644
--- a/library/psa_crypto_core.h
+++ b/library/psa_crypto_core.h
@@ -38,14 +38,14 @@
     psa_core_key_attributes_t attr;
 
     /*
-     * Number of locks, read and/or write, to the key slot by the library.
+     * Number of locks on the key slot held by the library.
      *
      * This counter is incremented by one each time a library function
      * retrieves through one of the dedicated internal API a pointer to the
      * key slot.
      *
      * This counter is decremented by one each time a library function stops
-     * accessing to the key slot and states it by calling the
+     * accessing the key slot and states it by calling the
      * psa_unlock_key_slot() API.
      *
      * This counter is used to prevent resetting the key slot while the library
@@ -102,7 +102,7 @@
 
 /** Test whether a key slot is locked.
  *
- * A key slot is locked iff its lock counter is strickly greater than 0.
+ * A key slot is locked iff its lock counter is strictly greater than 0.
  *
  * \param[in] slot  The key slot to test.
  *
diff --git a/library/psa_crypto_slot_management.c b/library/psa_crypto_slot_management.c
index 1d2e51f..4c4ad03 100644
--- a/library/psa_crypto_slot_management.c
+++ b/library/psa_crypto_slot_management.c
@@ -110,6 +110,15 @@
     if( psa_key_id_is_volatile( key_id ) )
     {
         slot = &global_data.key_slots[ key_id - PSA_KEY_ID_VOLATILE_MIN ];
+
+        /*
+         * Check if both the PSA key identifier key_id and the owner
+         * identifier of key match those of the key slot.
+         *
+         * Note that, if the key slot is not occupied, its PSA key identifier
+         * is equal to zero. This is an invalid value for a PSA key identifier
+         * and thus cannot be equal to the valid PSA key identifier key_id.
+         */
         status = mbedtls_svc_key_id_equal( key, slot->attr.id ) ?
                  PSA_SUCCESS : PSA_ERROR_DOES_NOT_EXIST;
     }
@@ -192,9 +201,9 @@
 
     /*
      * If there is no unused key slot and there is at least one unlocked key
-     * slot containing the description of a permament key, recycle the first
-     * such key slot we encountered. If we need later on to operate on the
-     * persistent key we evict now, we will reload its description from
+     * slot containing the description of a persistent key, recycle the first
+     * such key slot we encountered. If we later need to operate on the
+     * persistent key we are evicting now, we will reload its description from
      * storage.
      */
     if( ( selected_slot == NULL ) &&
diff --git a/library/psa_crypto_slot_management.h b/library/psa_crypto_slot_management.h
index 8b9d746..ef0814a 100644
--- a/library/psa_crypto_slot_management.h
+++ b/library/psa_crypto_slot_management.h
@@ -79,9 +79,9 @@
  *                      identified by \p key.
  *
  * \retval #PSA_SUCCESS
- *         The pointer to the key slot containing the description of the key
- *         identified by \p key was returned. The key slot counter was
- *         implemented.
+ *         \p *p_slot contains a pointer to the key slot containing the
+ *         description of the key identified by \p key.
+ *         The key slot counter has been incremented.
  * \retval #PSA_ERROR_BAD_STATE
  *         The library has not been initialized.
  * \retval #PSA_ERROR_INVALID_HANDLE