Bug 3467

Summary: [upstream] arc4random: make rekey interval less predictable
Product: Portable OpenSSH Reporter: Loganaden Velvindron <logan>
Component: Build systemAssignee: Assigned to nobody <unassigned-bugs>
Status: CLOSED FIXED    
Severity: enhancement CC: djm, dtucker
Priority: P5    
Version: -current   
Hardware: Other   
OS: All   
Bug Depends on:    
Bug Blocks: 3418    
Attachments:
Description Flags
Make rekey interval less predictable.
none
Make rekey interval less predictable.
none
Factor out getrnd() into its own file and rename to getentropy()
djm: ok+
Split arc4random_uniform out into its own file.
djm: ok+
Resync arc4random with OpenBSD rev 1.58 djm: ok+

Description Loganaden Velvindron 2022-08-03 21:41:33 AEST
Created attachment 3605 [details]
Make rekey interval less predictable.

This patch sync's OpenSSH compat arc4random with the one in OpenBSD.
Comment 1 Loganaden Velvindron 2022-08-03 22:33:51 AEST
Created attachment 3606 [details]
Make rekey interval less predictable.
Comment 2 Darren Tucker 2022-08-04 21:38:09 AEST
We should probably resync all of the changes from OpenBSD, but it'll need to be done carefully.
Comment 3 Darren Tucker 2022-08-04 21:45:16 AEST
Created attachment 3607 [details]
Factor out getrnd() into its own file and rename to getentropy()

Step 1: factor out getentropy equivalent code into its own file.
Comment 4 Darren Tucker 2022-08-05 13:48:59 AEST
Created attachment 3608 [details]
Split arc4random_uniform out into its own file.

This matches the file currently in OpenBSD.  It also changes the types from u_int32_t to uint32_t which happened in OpenBSD's arc4random.c rev 1.40.
Comment 5 Darren Tucker 2022-08-05 14:54:16 AEST
Created attachment 3609 [details]
Resync arc4random with OpenBSD rev 1.58

Step 3: resync remaining changes.  The arc4random.h is taken from LibreSSL with some simplifications (most of the platform specific code is the same with the exception of  thread support, however we don't support that.)

(Also marking patch 3607 as obsolete as it's gone in.)
Comment 6 Damien Miller 2022-08-06 16:18:45 AEST
Comment on attachment 3609 [details]
Resync arc4random with OpenBSD rev 1.58

>--- a/openbsd-compat/arc4random.c
>+++ b/openbsd-compat/arc4random.c
...
> /*
>  * If we are providing arc4random, then we can provide a more efficient 

whitespace at EOL here
Comment 7 Darren Tucker 2022-09-02 14:33:12 AEST
The full resync of arc4random went is as https://github.com/openssh/openssh-portable/commit/ce39e7d8b70c4726defde5d3bc4cb7d40d131153

This greatly reduces the diff of portable vs openbsd.
Comment 8 Damien Miller 2022-10-04 21:58:54 AEDT
Closing bugs from openssh-9.1 release cycle