pkg/hacl: Use RIOT random_bytes instead of randombytes
This commit is contained in:
parent
d6c63592bb
commit
86b5f648ce
@ -6,7 +6,6 @@ PKG_LICENSE=MIT
|
|||||||
.PHONY: all
|
.PHONY: all
|
||||||
|
|
||||||
all: git-download
|
all: git-download
|
||||||
@cp $(RIOTBASE)/pkg/hacl/src/* $(PKG_BUILDDIR)
|
|
||||||
"$(MAKE)" -C $(PKG_BUILDDIR) -f $(CURDIR)/Makefile.$(PKG_NAME)
|
"$(MAKE)" -C $(PKG_BUILDDIR) -f $(CURDIR)/Makefile.$(PKG_NAME)
|
||||||
|
|
||||||
include $(RIOTBASE)/pkg/pkg.mk
|
include $(RIOTBASE)/pkg/pkg.mk
|
||||||
|
|||||||
@ -0,0 +1,43 @@
|
|||||||
|
From 23c0d7e698ec5a31d65d7da172891f6aabad39d5 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Joakim=20Nohlg=C3=A5rd?= <joakim.nohlgard@eistec.se>
|
||||||
|
Date: Tue, 15 May 2018 13:17:38 +0200
|
||||||
|
Subject: [PATCH] RIOT: Use RIOT random_bytes function instead of randombytes
|
||||||
|
|
||||||
|
---
|
||||||
|
haclnacl.c | 6 +++---
|
||||||
|
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/haclnacl.c b/haclnacl.c
|
||||||
|
index e9bf635309..072a2db6b3 100644
|
||||||
|
--- a/haclnacl.c
|
||||||
|
+++ b/haclnacl.c
|
||||||
|
@@ -28,7 +28,7 @@
|
||||||
|
#include "NaCl.h"
|
||||||
|
|
||||||
|
|
||||||
|
-extern void randombytes(uint8_t *bytes, uint64_t bytes_len);
|
||||||
|
+#include "random.h"
|
||||||
|
|
||||||
|
|
||||||
|
/* HACL* Primitives and Constructions */
|
||||||
|
@@ -93,7 +93,7 @@ int crypto_auth_verify(const unsigned char *tag, const unsigned char *input, uns
|
||||||
|
|
||||||
|
|
||||||
|
int crypto_box_keypair(unsigned char *pk, unsigned char *sk){
|
||||||
|
- randombytes(sk, 32);
|
||||||
|
+ random_bytes(sk, 32);
|
||||||
|
uint8_t basepoint[32] = {9};
|
||||||
|
curve25519_scalarmult(pk, sk, basepoint);
|
||||||
|
return 0;
|
||||||
|
@@ -241,7 +241,7 @@ int crypto_sign_open(unsigned char *unsigned_msg, unsigned long long *unsigned_m
|
||||||
|
}
|
||||||
|
|
||||||
|
int crypto_sign_keypair(uint8_t pk[32], uint8_t sk[64]){
|
||||||
|
- randombytes(sk, 32 * sizeof(uint8_t));
|
||||||
|
+ random_bytes(sk, 32 * sizeof(uint8_t));
|
||||||
|
Hacl_Ed25519_secret_to_public(pk, sk);
|
||||||
|
for (int i = 0; i < 32; i++) sk[32+i] = pk[i];
|
||||||
|
return 0;
|
||||||
|
--
|
||||||
|
2.17.0
|
||||||
|
|
||||||
@ -1,18 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2016 Kaspar Schleiser <kaspar@schleiser.de>
|
|
||||||
*
|
|
||||||
* This file is subject to the terms and conditions of the GNU Lesser
|
|
||||||
* General Public License v2.1. See the file LICENSE in the top level
|
|
||||||
* directory for more details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#include "random.h"
|
|
||||||
|
|
||||||
|
|
||||||
void randombytes(uint8_t *target, uint64_t n)
|
|
||||||
{
|
|
||||||
/* HACL* (haclnacl.c) needs uint64_t as "n" parameter, random provides uint32 */
|
|
||||||
random_bytes(target, n);
|
|
||||||
}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user