Bug 1701

Summary: FIPS-140-2 requires call to RAND_cleanup() before the program using RAND exits
Product: Portable OpenSSH Reporter: jchadima
Component: MiscellaneousAssignee: Assigned to nobody <unassigned-bugs>
Status: NEW ---    
Severity: normal CC: dtucker, jfch, pcerny, t8m
Priority: P2    
Version: 5.3p1   
Hardware: Other   
OS: Linux   
Attachments:
Description Flags
Patch solving the problem
none
Alternate patch using cleanup_exit none

Description jchadima 2010-01-21 23:01:50 AEDT
There is the mandatory call RAND_cleanup() before the exit of the program that uses RAND for the fips-140-2 compliance.
Comment 1 jchadima 2010-01-21 23:05:10 AEDT
Created attachment 1781 [details]
Patch solving the problem

This is the patch which initilaizing the random device, ensure the call to RAND_cleanup at the exit of the program.
Comment 2 Darren Tucker 2010-03-26 11:37:57 AEDT
Is RAND_cleanup() signal-safe?  (I suspect not, and if it's not then this potentially opens a signal race vulnerability in sshd, which is the reason why all use of atexit was removed from OpenSSH previously.)
Comment 3 Tomas Mraz 2010-04-06 16:47:25 AEST
RAND_cleanup() is not signal safe if the rand generator is supplied by an engine which would be released by the call (no other references than the generator). But this is irrelevant anyway as the functions registered with atexit() are called only in exit() calls and not in the default signal handler termination or in _exit().

If openssh called exit() in signal handler it would be a security problem anyway as this is signal handler unsafe call itself.
Comment 4 jchadima 2010-04-06 19:35:17 AEST
Created attachment 1828 [details]
Alternate patch using cleanup_exit