[API-NEXT,3/4] linux-generic: crypto: implement crypto capabilities and entropy

Message ID 1477399744-16516-3-git-send-email-bill.fischofer@linaro.org
State New
Headers show

Commit Message

Bill Fischofer Oct. 25, 2016, 12:49 p.m.
Add entropy related values to odp_crypto_capability() and implement
the use_entropy field of odp_random_data()

Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>

---
 platform/linux-generic/odp_crypto.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

-- 
2.7.4

Patch

diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c
index c7431e6..9011bc0 100644
--- a/platform/linux-generic/odp_crypto.c
+++ b/platform/linux-generic/odp_crypto.c
@@ -618,6 +618,9 @@  int odp_crypto_capability(odp_crypto_capability_t *capa)
 
 	capa->max_sessions = MAX_SESSIONS;
 
+	capa->entropy_available = 0;
+	capa->entropy_size = 0;
+
 	return 0;
 }
 
@@ -872,9 +875,13 @@  int odp_crypto_term_global(void)
 }
 
 int32_t
-odp_random_data(uint8_t *buf, int32_t len, odp_bool_t use_entropy ODP_UNUSED)
+odp_random_data(uint8_t *buf, int32_t len, odp_bool_t use_entropy)
 {
 	int32_t rc;
+
+	if (use_entropy)
+		return -1;
+
 	rc = RAND_bytes(buf, len);
 	return (1 == rc) ? len /*success*/: -1 /*failure*/;
 }