summaryrefslogtreecommitdiff
path: root/extmod/modussl_mbedtls.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2018-05-31 21:52:29 +1000
committerDamien George <damien.p.george@gmail.com>2018-05-31 21:52:29 +1000
commitea22406f7661edcce88defb9d20517ec967a5a9f (patch)
tree8620cbb4d8d23c730bd19b1525e0e0400365a726 /extmod/modussl_mbedtls.c
parent98b9f0fc9d0fe14c5f13faf2e9b902422919594c (diff)
extmod/modussl_mbedtls: Use mbedtls_entropy_func for CTR-DRBG entropy.
If mbedtls_ctr_drbg_seed() is available in the mbedtls bulid then so should be mbedtls_entropy_func(). Then it's up to the port to configure a valid entropy source, eg via MBEDTLS_ENTROPY_HARDWARE_ALT.
Diffstat (limited to 'extmod/modussl_mbedtls.c')
-rw-r--r--extmod/modussl_mbedtls.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/extmod/modussl_mbedtls.c b/extmod/modussl_mbedtls.c
index 636f45f4e..1c9dfd17f 100644
--- a/extmod/modussl_mbedtls.c
+++ b/extmod/modussl_mbedtls.c
@@ -73,15 +73,6 @@ STATIC void mbedtls_debug(void *ctx, int level, const char *file, int line, cons
}
#endif
-// TODO: FIXME!
-STATIC int null_entropy_func(void *data, unsigned char *output, size_t len) {
- (void)data;
- (void)output;
- (void)len;
- // enjoy random bytes
- return 0;
-}
-
STATIC int _mbedtls_ssl_send(void *ctx, const byte *buf, size_t len) {
mp_obj_t sock = *(mp_obj_t*)ctx;
@@ -140,7 +131,7 @@ STATIC mp_obj_ssl_socket_t *socket_new(mp_obj_t sock, struct ssl_args *args) {
mbedtls_entropy_init(&o->entropy);
const byte seed[] = "upy";
- ret = mbedtls_ctr_drbg_seed(&o->ctr_drbg, null_entropy_func/*mbedtls_entropy_func*/, &o->entropy, seed, sizeof(seed));
+ ret = mbedtls_ctr_drbg_seed(&o->ctr_drbg, mbedtls_entropy_func, &o->entropy, seed, sizeof(seed));
if (ret != 0) {
goto cleanup;
}