mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
47 lines
1.7 KiB
Diff
47 lines
1.7 KiB
Diff
From ed69076abbe83ed256f1e1fbdf74726961c9071e Mon Sep 17 00:00:00 2001
|
|
From: Kaspar Schleiser <kaspar@schleiser.de>
|
|
Date: Fri, 5 Jul 2019 14:51:09 +0200
|
|
Subject: [PATCH] RIOT: Use RIOT random_bytes function instead of randombytes
|
|
|
|
---
|
|
src/crypt/hacl.c | 6 +++---
|
|
1 file changed, 3 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/src/crypt/hacl.c b/src/crypt/hacl.c
|
|
index c24d751732..3bdcabf95e 100644
|
|
--- a/src/crypt/hacl.c
|
|
+++ b/src/crypt/hacl.c
|
|
@@ -19,10 +19,10 @@
|
|
#include <stdint.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
+#include "random.h"
|
|
|
|
extern void Hacl_Ed25519_sign(uint8_t *signature, uint8_t *secret, uint8_t *msg, uint32_t len1);
|
|
extern bool Hacl_Ed25519_verify(uint8_t *public, uint8_t *msg, uint32_t len1, uint8_t *signature);
|
|
-extern void randombytes(uint8_t *target, uint64_t n);
|
|
|
|
#ifdef CRYPTO_HACL_INCLUDE_CHACHAPOLY
|
|
int cose_crypto_aead_encrypt_chachapoly(uint8_t *c,
|
|
@@ -67,7 +67,7 @@ COSE_ssize_t cose_crypto_keygen_chachapoly(uint8_t *sk, size_t len)
|
|
if (len < COSE_CRYPTO_AEAD_CHACHA20POLY1305_KEYBYTES) {
|
|
return COSE_ERR_NOMEM;
|
|
}
|
|
- randombytes(sk, COSE_CRYPTO_AEAD_CHACHA20POLY1305_KEYBYTES);
|
|
+ random_bytes(sk, COSE_CRYPTO_AEAD_CHACHA20POLY1305_KEYBYTES);
|
|
return COSE_CRYPTO_AEAD_CHACHA20POLY1305_KEYBYTES;
|
|
}
|
|
|
|
@@ -76,7 +76,7 @@ size_t cose_crypto_aead_nonce_chachapoly(uint8_t *nonce, size_t len)
|
|
if (len < COSE_CRYPTO_AEAD_CHACHA20POLY1305_NONCEBYTES) {
|
|
return 0;
|
|
}
|
|
- randombytes(nonce, COSE_CRYPTO_AEAD_CHACHA20POLY1305_NONCEBYTES);
|
|
+ random_bytes(nonce, COSE_CRYPTO_AEAD_CHACHA20POLY1305_NONCEBYTES);
|
|
return COSE_CRYPTO_AEAD_CHACHA20POLY1305_NONCEBYTES;
|
|
}
|
|
#endif /* CRYPTO_HACL_INCLUDE_CHACHAPOLY */
|
|
--
|
|
2.22.0
|
|
|