CC3XX: Rename cc3xx_lowlevel_entropy_get to cc3xx_lowlevel_get_entropy()

Signed-off-by: Antonio de Angelis <antonio.deangelis@arm.com>
Change-Id: I3eb1c91024a22cfa53fcc267a67f783bd2b4cc3d
diff --git a/platform/ext/target/arm/drivers/cc3xx/low_level_driver/include/cc3xx_entropy.h b/platform/ext/target/arm/drivers/cc3xx/low_level_driver/include/cc3xx_entropy.h
index 330adbd..3aa8899 100644
--- a/platform/ext/target/arm/drivers/cc3xx/low_level_driver/include/cc3xx_entropy.h
+++ b/platform/ext/target/arm/drivers/cc3xx/low_level_driver/include/cc3xx_entropy.h
@@ -26,7 +26,8 @@
 #define CC3XX_ENTROPY_SIZE (CC3XX_TRNG_SAMPLE_SIZE)
 
 /**
- * @brief                        Requires an amount of entropy from the TRNG
+ * @brief                        Requires an amount of entropy from the SP800-90B
+ *                               entropy source.
  *
  * @param[out] entropy           Buffer containing the requested entropy
  * @param[in]  entropy_len       Size in bytes of the \p entropy buffer. Must be an
@@ -35,7 +36,7 @@
  * @return                       CC3XX_ERR_SUCCESS on success, another
  *                               cc3xx_err_t on error.
  */
-cc3xx_err_t cc3xx_lowlevel_entropy_get(uint32_t *entropy, size_t entropy_len);
+cc3xx_err_t cc3xx_lowlevel_get_entropy(uint32_t *entropy, size_t entropy_len);
 
 /**
  * @brief Returns a generic pointer to the context of the underlying noise source
diff --git a/platform/ext/target/arm/drivers/cc3xx/low_level_driver/src/cc3xx_entropy.c b/platform/ext/target/arm/drivers/cc3xx/low_level_driver/src/cc3xx_entropy.c
index eea4d5d..647dd1f 100644
--- a/platform/ext/target/arm/drivers/cc3xx/low_level_driver/src/cc3xx_entropy.c
+++ b/platform/ext/target/arm/drivers/cc3xx/low_level_driver/src/cc3xx_entropy.c
@@ -209,7 +209,7 @@
  *                         SP800-90B compliant entropy source
  */
 /*!@{*/
-cc3xx_err_t cc3xx_lowlevel_entropy_get(uint32_t *entropy, size_t entropy_len)
+cc3xx_err_t cc3xx_lowlevel_get_entropy(uint32_t *entropy, size_t entropy_len)
 {
     cc3xx_err_t err;
     size_t num_words = 0;
diff --git a/platform/ext/target/arm/drivers/cc3xx/low_level_driver/src/cc3xx_rng.c b/platform/ext/target/arm/drivers/cc3xx/low_level_driver/src/cc3xx_rng.c
index 4f99c0d..1f42610 100644
--- a/platform/ext/target/arm/drivers/cc3xx/low_level_driver/src/cc3xx_rng.c
+++ b/platform/ext/target/arm/drivers/cc3xx/low_level_driver/src/cc3xx_rng.c
@@ -93,11 +93,8 @@
 static inline void lfsr_seed(xorshift_plus_128_state_t *lfsr)
 {
     if (!lfsr->seed_done) {
-        cc3xx_err_t err;
-        do {
-            err = cc3xx_lowlevel_entropy_get(lfsr->entropy, sizeof(lfsr->entropy));
-        } while (err != CC3XX_ERR_SUCCESS);
-
+        while (cc3xx_lowlevel_get_entropy(
+                    lfsr->entropy, sizeof(lfsr->entropy)) != CC3XX_ERR_SUCCESS);
         lfsr->seed_done = true;
     }
 }
@@ -129,10 +126,9 @@
 
     if (!g_drbg.seed_done) {
 
-        /* Get 24 bytes of entropy */
-        do {
-            err = cc3xx_lowlevel_entropy_get(entropy, sizeof(entropy));
-        } while (err != CC3XX_ERR_SUCCESS);
+        /* Get CC3XX_ENTROPY_SIZE bytes of entropy */
+        while (cc3xx_lowlevel_get_entropy(
+                    entropy, sizeof(entropy)) != CC3XX_ERR_SUCCESS);
 
         /* Call the seeding API of the desired drbg */
         err = g_drbg.init(&g_drbg.state,
@@ -150,10 +146,9 @@
     /* Add re-seeding capabilities */
     if (g_drbg.state.reseed_counter == UINT32_MAX) {
 
-        /* Get 24 bytes of entropy */
-        do {
-            err = cc3xx_lowlevel_entropy_get(entropy, sizeof(entropy));
-        } while (err != CC3XX_ERR_SUCCESS);
+        /* Get CC3XX_ENTROPY_SIZE bytes of entropy */
+        while (cc3xx_lowlevel_get_entropy(
+                    entropy, sizeof(entropy)) != CC3XX_ERR_SUCCESS);
 
         err = g_drbg.reseed(&g_drbg.state,
                     (const uint8_t *)entropy, sizeof(entropy), NULL, 0);
diff --git a/platform/ext/target/arm/drivers/cc3xx/psa_driver_api/src/cc3xx_psa_entropy.c b/platform/ext/target/arm/drivers/cc3xx/psa_driver_api/src/cc3xx_psa_entropy.c
index 0e0a82a..eaec96d 100644
--- a/platform/ext/target/arm/drivers/cc3xx/psa_driver_api/src/cc3xx_psa_entropy.c
+++ b/platform/ext/target/arm/drivers/cc3xx/psa_driver_api/src/cc3xx_psa_entropy.c
@@ -41,7 +41,7 @@
     }
 
     /* Get a multiple of CC3XX_ENTROPY_SIZE bytes of entropy */
-    err = cc3xx_lowlevel_entropy_get((uint32_t *)output, int_mult);
+    err = cc3xx_lowlevel_get_entropy((uint32_t *)output, int_mult);
 
     if (err != CC3XX_ERR_SUCCESS) {
         return cc3xx_to_psa_err(err);
@@ -49,7 +49,7 @@
 
     if ((output_size % CC3XX_ENTROPY_SIZE) != 0) {
         uint32_t last[CC3XX_ENTROPY_SIZE / sizeof(uint32_t)];
-        err = cc3xx_lowlevel_entropy_get(last, sizeof(last));
+        err = cc3xx_lowlevel_get_entropy(last, sizeof(last));
         if (err != CC3XX_ERR_SUCCESS) {
             return cc3xx_to_psa_err(err);
         }