Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net Use cprng_strong, not cprng_fast, for ephemeral key.
details: https://anonhg.NetBSD.org/src/rev/29a6c9daed17
branches: trunk
changeset: 975036:29a6c9daed17
user: riastradh <riastradh%NetBSD.org@localhost>
date: Thu Aug 20 21:30:56 2020 +0000
description:
Use cprng_strong, not cprng_fast, for ephemeral key.
diffstat:
sys/external/isc/libsodium/include/randombytes.h | 5 +++--
sys/net/if_wg.c | 6 +++---
2 files changed, 6 insertions(+), 5 deletions(-)
diffs (45 lines):
diff -r 5e8d2e5b210c -r 29a6c9daed17 sys/external/isc/libsodium/include/randombytes.h
--- a/sys/external/isc/libsodium/include/randombytes.h Thu Aug 20 21:30:46 2020 +0000
+++ b/sys/external/isc/libsodium/include/randombytes.h Thu Aug 20 21:30:56 2020 +0000
@@ -1,11 +1,12 @@
/* This overwrites dist/src/libsodium/include/sodium/randombytes.h */
+#include <sys/cprng.h>
+
static inline void
randombytes_buf(void * const buf, const size_t size)
{
- extern size_t cprng_fast(void *, size_t);
- cprng_fast(buf, size);
+ cprng_strong(kern_cprng, buf, size, 0);
}
static inline void
diff -r 5e8d2e5b210c -r 29a6c9daed17 sys/net/if_wg.c
--- a/sys/net/if_wg.c Thu Aug 20 21:30:46 2020 +0000
+++ b/sys/net/if_wg.c Thu Aug 20 21:30:56 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_wg.c,v 1.2 2020/08/20 21:29:44 riastradh Exp $ */
+/* $NetBSD: if_wg.c,v 1.3 2020/08/20 21:30:56 riastradh Exp $ */
/*
* Copyright (C) Ryota Ozaki <ozaki.ryota%gmail.com@localhost>
@@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wg.c,v 1.2 2020/08/20 21:29:44 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wg.c,v 1.3 2020/08/20 21:30:56 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -813,7 +813,7 @@
CTASSERT(WG_EPHEMERAL_KEY_LEN == crypto_scalarmult_curve25519_BYTES);
- cprng_fast(privkey, WG_EPHEMERAL_KEY_LEN);
+ cprng_strong(kern_cprng, privkey, WG_EPHEMERAL_KEY_LEN, 0);
crypto_scalarmult_base(pubkey, privkey);
}
Home |
Main Index |
Thread Index |
Old Index