ssize_t is a POSIX type. API definition must be pure C (C99).
Signed 32 bits can hold larger values than size_t (64k) and
ssize_t(32k) in minimum.

Signed-off-by: Petri Savolainen <petri.savolai...@linaro.org>
---
 example/ipsec/odp_ipsec_cache.c              | 4 ++--
 include/odp/api/random.h                     | 4 ++--
 platform/linux-generic/odp_crypto.c          | 6 +++---
 test/validation/crypto/odp_crypto_test_rng.c | 2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/example/ipsec/odp_ipsec_cache.c b/example/ipsec/odp_ipsec_cache.c
index 5a41cec..12b960d 100644
--- a/example/ipsec/odp_ipsec_cache.c
+++ b/example/ipsec/odp_ipsec_cache.c
@@ -96,9 +96,9 @@ int create_ipsec_cache_entry(sa_db_entry_t *cipher_sa,
 
        /* Generate an IV */
        if (params.iv.length) {
-               ssize_t size = params.iv.length;
+               int32_t size = params.iv.length;
 
-               ssize_t ret = odp_random_data(params.iv.data, size, 1);
+               int32_t ret = odp_random_data(params.iv.data, size, 1);
                if (ret != size)
                        return -1;
        }
diff --git a/include/odp/api/random.h b/include/odp/api/random.h
index 293043e..3451b0d 100644
--- a/include/odp/api/random.h
+++ b/include/odp/api/random.h
@@ -35,8 +35,8 @@ extern "C" {
  * @return Number of bytes written
  * @retval <0 on failure
  */
-ssize_t
-odp_random_data(uint8_t *buf, ssize_t size, odp_bool_t use_entropy);
+int32_t
+odp_random_data(uint8_t *buf, int32_t size, odp_bool_t use_entropy);
 
 /**
  * @}
diff --git a/platform/linux-generic/odp_crypto.c 
b/platform/linux-generic/odp_crypto.c
index 2df37e7..61dba6e 100644
--- a/platform/linux-generic/odp_crypto.c
+++ b/platform/linux-generic/odp_crypto.c
@@ -458,10 +458,10 @@ int odp_crypto_term_global(void)
        return ret;
 }
 
-ssize_t
-odp_random_data(uint8_t *buf, ssize_t len, odp_bool_t use_entropy ODP_UNUSED)
+int32_t
+odp_random_data(uint8_t *buf, int32_t len, odp_bool_t use_entropy ODP_UNUSED)
 {
-       int rc;
+       int32_t rc;
        rc = RAND_bytes(buf, len);
        return (1 == rc) ? len /*success*/: -1 /*failure*/;
 }
diff --git a/test/validation/crypto/odp_crypto_test_rng.c 
b/test/validation/crypto/odp_crypto_test_rng.c
index a9e3db0..6a4ad17 100644
--- a/test/validation/crypto/odp_crypto_test_rng.c
+++ b/test/validation/crypto/odp_crypto_test_rng.c
@@ -15,7 +15,7 @@
 #define RNG_GET_SIZE   "RNG_GET_SIZE"
 static void rng_get_size(void)
 {
-       int ret;
+       int32_t ret;
        uint8_t buf[TDES_CBC_IV_LEN];
 
        ret = odp_random_data(buf, sizeof(buf), false);
-- 
2.3.0


_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to