diff options
author | Bryan Donlan <bdonlan@amazon.com> | 2018-03-07 16:01:06 -0500 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2018-03-08 10:27:49 -0500 |
commit | 082193ef2b25cf16ec51af9dc9f0ee890beb38b9 (patch) | |
tree | 47569ec7a98b96948ca9c6c4fdc9f25def757efc /test/build.info | |
parent | 83918ad6fddf33acc43aadcc40f08be22ff39482 (diff) |
Fix issues in ia32 RDRAND asm leading to reduced entropy
This patch fixes two issues in the ia32 RDRAND assembly code that result in a
(possibly significant) loss of entropy.
The first, less significant, issue is that, by returning success as 0 from
OPENSSL_ia32_rdrand() and OPENSSL_ia32_rdseed(), a subtle bias was introduced.
Specifically, because the assembly routine copied the remaining number of
retries over the result when RDRAND/RDSEED returned 'successful but zero', a
bias towards values 1-8 (primarily 8) was introduced.
The second, more worrying issue was that, due to a mixup in registers, when a
buffer that was not size 0 or 1 mod 8 was passed to OPENSSL_ia32_rdrand_bytes
or OPENSSL_ia32_rdseed_bytes, the last (n mod 8) bytes were all the same value.
This issue impacts only the 64-bit variant of the assembly.
This change fixes both issues by first eliminating the only use of
OPENSSL_ia32_rdrand, replacing it with OPENSSL_ia32_rdrand_bytes, and fixes the
register mixup in OPENSSL_ia32_rdrand_bytes. It also adds a sanity test for
OPENSSL_ia32_rdrand_bytes and OPENSSL_ia32_rdseed_bytes to help catch problems
of this nature in the future.
Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5342)
Diffstat (limited to 'test/build.info')
-rw-r--r-- | test/build.info | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/test/build.info b/test/build.info index 30424dc4cf..9fcaa7d8c8 100644 --- a/test/build.info +++ b/test/build.info @@ -405,7 +405,8 @@ INCLUDE_MAIN___test_libtestutil_OLB = /INCLUDE=MAIN # names with the DLL import libraries. IF[{- $disabled{shared} || $target{build_scheme}->[1] ne 'windows' -}] PROGRAMS_NO_INST=asn1_internal_test modes_internal_test x509_internal_test \ - tls13encryptiontest wpackettest ctype_internal_test + tls13encryptiontest wpackettest ctype_internal_test \ + rdrand_sanitytest IF[{- !$disabled{poly1305} -}] PROGRAMS_NO_INST=poly1305_internal_test ENDIF @@ -465,6 +466,10 @@ INCLUDE_MAIN___test_libtestutil_OLB = /INCLUDE=MAIN SOURCE[curve448_internal_test]=curve448_internal_test.c INCLUDE[curve448_internal_test]=.. ../include ../crypto/ec/curve448 DEPEND[curve448_internal_test]=../libcrypto.a libtestutil.a + + SOURCE[rdrand_sanitytest]=rdrand_sanitytest.c + INCLUDE[rdrand_sanitytest]=../include + DEPEND[rdrand_sanitytest]=../libcrypto.a libtestutil.a ENDIF IF[{- !$disabled{mdc2} -}] |