Bugzilla – Attachment 3606 Details for
Bug 3467
[upstream] arc4random: make rekey interval less predictable
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Make rekey interval less predictable.
0001-Adapted-from-OpenBSD-arc4random-upstream-make-rekey-.patch (text/plain), 1.60 KB, created by
Loganaden Velvindron
on 2022-08-03 22:33:51 AEST
(
hide
)
Description:
Make rekey interval less predictable.
Filename:
MIME Type:
Creator:
Loganaden Velvindron
Created:
2022-08-03 22:33:51 AEST
Size:
1.60 KB
patch
obsolete
>From 44b037b5b7d028997b7986387411d19853044ce7 Mon Sep 17 00:00:00 2001 >From: Loganaden Velvindron <logan@cyberstorm.mu> >Date: Wed, 3 Aug 2022 15:38:37 +0400 >Subject: [PATCH] Adapted from OpenBSD arc4random upstream: make rekey interval > less predictable > >Signed-off-by: Loganaden Velvindron <logan@cyberstorm.mu> >--- > openbsd-compat/arc4random.c | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > >diff --git a/openbsd-compat/arc4random.c b/openbsd-compat/arc4random.c >index ce5f054f..661d769e 100644 >--- a/openbsd-compat/arc4random.c >+++ b/openbsd-compat/arc4random.c >@@ -1,6 +1,6 @@ > /* OPENBSD ORIGINAL: lib/libc/crypto/arc4random.c */ > >-/* $OpenBSD: arc4random.c,v 1.25 2013/10/01 18:34:57 markus Exp $ */ >+/* $OpenBSD: arc4random.c,v 1.57 2022/07/31 05:10:36 djm Exp $ */ > > /* > * Copyright (c) 1996, David Mazieres <dm@uun.org> >@@ -65,6 +65,8 @@ > #define IVSZ 8 > #define BLOCKSZ 64 > #define RSBUFSZ (16*BLOCKSZ) >+#define REKEY_BASE (1024*1024) /* NB. should be a power of 2 */ >+ > static int rs_initialized; > static pid_t rs_stir_pid; > static chacha_ctx rs; /* chacha context for random keystream */ >@@ -125,6 +127,7 @@ static void > _rs_stir(void) > { > u_char rnd[KEYSZ + IVSZ]; >+ uint32_t rekey_fuzz = 0; > > #ifdef WITH_OPENSSL > if (RAND_bytes(rnd, sizeof(rnd)) <= 0) >@@ -145,7 +148,10 @@ _rs_stir(void) > rs_have = 0; > memset(rs_buf, 0, RSBUFSZ); > >- rs_count = 1600000; >+ /* rekey interval should not be predictable */ >+ chacha_encrypt_bytes(&rs, (uint8_t *)&rekey_fuzz, >+ (uint8_t *)&rekey_fuzz, sizeof(rekey_fuzz)); >+ rs_count = REKEY_BASE + (rekey_fuzz % REKEY_BASE); > } > > static inline void >-- >2.17.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 3467
:
3605
| 3606 |
3607
|
3608
|
3609