|
|
|
@ -1,6 +1,6 @@
|
|
|
|
|
diff -up openssl-1.1.1e/crypto/fips/fips.c.fips-post-rand openssl-1.1.1e/crypto/fips/fips.c
|
|
|
|
|
--- openssl-1.1.1e/crypto/fips/fips.c.fips-post-rand 2020-03-17 18:06:16.822418854 +0100
|
|
|
|
|
+++ openssl-1.1.1e/crypto/fips/fips.c 2020-03-17 18:06:16.861418172 +0100
|
|
|
|
|
diff -up openssl-1.1.1i/crypto/fips/fips.c.fips-post-rand openssl-1.1.1i/crypto/fips/fips.c
|
|
|
|
|
--- openssl-1.1.1i/crypto/fips/fips.c.fips-post-rand 2020-12-09 10:26:41.634106328 +0100
|
|
|
|
|
+++ openssl-1.1.1i/crypto/fips/fips.c 2020-12-09 10:26:41.652106475 +0100
|
|
|
|
|
@@ -68,6 +68,7 @@
|
|
|
|
|
|
|
|
|
|
# include <openssl/fips.h>
|
|
|
|
@ -51,10 +51,10 @@ diff -up openssl-1.1.1e/crypto/fips/fips.c.fips-post-rand openssl-1.1.1e/crypto/
|
|
|
|
|
ret = 1;
|
|
|
|
|
goto end;
|
|
|
|
|
}
|
|
|
|
|
diff -up openssl-1.1.1e/crypto/rand/drbg_lib.c.fips-post-rand openssl-1.1.1e/crypto/rand/drbg_lib.c
|
|
|
|
|
--- openssl-1.1.1e/crypto/rand/drbg_lib.c.fips-post-rand 2020-03-17 15:31:17.000000000 +0100
|
|
|
|
|
+++ openssl-1.1.1e/crypto/rand/drbg_lib.c 2020-03-17 18:07:35.305045521 +0100
|
|
|
|
|
@@ -1009,6 +1009,20 @@ size_t rand_drbg_seedlen(RAND_DRBG *drbg
|
|
|
|
|
diff -up openssl-1.1.1i/crypto/rand/drbg_lib.c.fips-post-rand openssl-1.1.1i/crypto/rand/drbg_lib.c
|
|
|
|
|
--- openssl-1.1.1i/crypto/rand/drbg_lib.c.fips-post-rand 2020-12-08 14:20:59.000000000 +0100
|
|
|
|
|
+++ openssl-1.1.1i/crypto/rand/drbg_lib.c 2020-12-09 10:26:41.652106475 +0100
|
|
|
|
|
@@ -1005,6 +1005,20 @@ size_t rand_drbg_seedlen(RAND_DRBG *drbg
|
|
|
|
|
return min_entropy > min_entropylen ? min_entropy : min_entropylen;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -75,9 +75,9 @@ diff -up openssl-1.1.1e/crypto/rand/drbg_lib.c.fips-post-rand openssl-1.1.1e/cry
|
|
|
|
|
/* Implements the default OpenSSL RAND_add() method */
|
|
|
|
|
static int drbg_add(const void *buf, int num, double randomness)
|
|
|
|
|
{
|
|
|
|
|
diff -up openssl-1.1.1e/crypto/rand/rand_unix.c.fips-post-rand openssl-1.1.1e/crypto/rand/rand_unix.c
|
|
|
|
|
--- openssl-1.1.1e/crypto/rand/rand_unix.c.fips-post-rand 2020-03-17 15:31:17.000000000 +0100
|
|
|
|
|
+++ openssl-1.1.1e/crypto/rand/rand_unix.c 2020-03-17 18:09:01.503537189 +0100
|
|
|
|
|
diff -up openssl-1.1.1i/crypto/rand/rand_unix.c.fips-post-rand openssl-1.1.1i/crypto/rand/rand_unix.c
|
|
|
|
|
--- openssl-1.1.1i/crypto/rand/rand_unix.c.fips-post-rand 2020-12-08 14:20:59.000000000 +0100
|
|
|
|
|
+++ openssl-1.1.1i/crypto/rand/rand_unix.c 2020-12-09 10:36:59.531221903 +0100
|
|
|
|
|
@@ -17,10 +17,12 @@
|
|
|
|
|
#include <openssl/crypto.h>
|
|
|
|
|
#include "rand_local.h"
|
|
|
|
@ -91,7 +91,7 @@ diff -up openssl-1.1.1e/crypto/rand/rand_unix.c.fips-post-rand openssl-1.1.1e/cr
|
|
|
|
|
# ifdef DEVRANDOM_WAIT
|
|
|
|
|
# include <sys/shm.h>
|
|
|
|
|
# include <sys/utsname.h>
|
|
|
|
|
@@ -342,7 +344,7 @@ static ssize_t sysctl_random(char *buf,
|
|
|
|
|
@@ -344,7 +346,7 @@ static ssize_t sysctl_random(char *buf,
|
|
|
|
|
* syscall_random(): Try to get random data using a system call
|
|
|
|
|
* returns the number of bytes returned in buf, or < 0 on error.
|
|
|
|
|
*/
|
|
|
|
@ -100,15 +100,15 @@ diff -up openssl-1.1.1e/crypto/rand/rand_unix.c.fips-post-rand openssl-1.1.1e/cr
|
|
|
|
|
{
|
|
|
|
|
/*
|
|
|
|
|
* Note: 'buflen' equals the size of the buffer which is used by the
|
|
|
|
|
@@ -364,6 +366,7 @@ static ssize_t syscall_random(void *buf,
|
|
|
|
|
* - Linux since 3.17 with glibc 2.25
|
|
|
|
|
* - FreeBSD since 12.0 (1200061)
|
|
|
|
|
@@ -369,6 +371,7 @@ static ssize_t syscall_random(void *buf,
|
|
|
|
|
* Note: Sometimes getentropy() can be provided but not implemented
|
|
|
|
|
* internally. So we need to check errno for ENOSYS
|
|
|
|
|
*/
|
|
|
|
|
+# if 0
|
|
|
|
|
# if defined(__GNUC__) && __GNUC__>=2 && defined(__ELF__) && !defined(__hpux)
|
|
|
|
|
extern int getentropy(void *buffer, size_t length) __attribute__((weak));
|
|
|
|
|
|
|
|
|
|
@@ -385,10 +388,10 @@ static ssize_t syscall_random(void *buf,
|
|
|
|
|
@@ -394,10 +397,10 @@ static ssize_t syscall_random(void *buf,
|
|
|
|
|
if (p_getentropy.p != NULL)
|
|
|
|
|
return p_getentropy.f(buf, buflen) == 0 ? (ssize_t)buflen : -1;
|
|
|
|
|
# endif
|
|
|
|
@ -122,7 +122,7 @@ diff -up openssl-1.1.1e/crypto/rand/rand_unix.c.fips-post-rand openssl-1.1.1e/cr
|
|
|
|
|
# elif (defined(__FreeBSD__) || defined(__NetBSD__)) && defined(KERN_ARND)
|
|
|
|
|
return sysctl_random(buf, buflen);
|
|
|
|
|
# else
|
|
|
|
|
@@ -623,6 +626,9 @@ size_t rand_pool_acquire_entropy(RAND_PO
|
|
|
|
|
@@ -633,6 +636,9 @@ size_t rand_pool_acquire_entropy(RAND_PO
|
|
|
|
|
size_t entropy_available;
|
|
|
|
|
|
|
|
|
|
# if defined(OPENSSL_RAND_SEED_GETRANDOM)
|
|
|
|
@ -132,7 +132,7 @@ diff -up openssl-1.1.1e/crypto/rand/rand_unix.c.fips-post-rand openssl-1.1.1e/cr
|
|
|
|
|
{
|
|
|
|
|
size_t bytes_needed;
|
|
|
|
|
unsigned char *buffer;
|
|
|
|
|
@@ -633,7 +639,7 @@ size_t rand_pool_acquire_entropy(RAND_PO
|
|
|
|
|
@@ -643,7 +649,7 @@ size_t rand_pool_acquire_entropy(RAND_PO
|
|
|
|
|
bytes_needed = rand_pool_bytes_needed(pool, 1 /*entropy_factor*/);
|
|
|
|
|
while (bytes_needed != 0 && attempts-- > 0) {
|
|
|
|
|
buffer = rand_pool_add_begin(pool, bytes_needed);
|
|
|
|
@ -141,7 +141,7 @@ diff -up openssl-1.1.1e/crypto/rand/rand_unix.c.fips-post-rand openssl-1.1.1e/cr
|
|
|
|
|
if (bytes > 0) {
|
|
|
|
|
rand_pool_add_end(pool, bytes, 8 * bytes);
|
|
|
|
|
bytes_needed -= bytes;
|
|
|
|
|
@@ -668,8 +674,10 @@ size_t rand_pool_acquire_entropy(RAND_PO
|
|
|
|
|
@@ -678,8 +684,10 @@ size_t rand_pool_acquire_entropy(RAND_PO
|
|
|
|
|
int attempts = 3;
|
|
|
|
|
const int fd = get_random_device(i);
|
|
|
|
|
|
|
|
|
@ -153,7 +153,7 @@ diff -up openssl-1.1.1e/crypto/rand/rand_unix.c.fips-post-rand openssl-1.1.1e/cr
|
|
|
|
|
|
|
|
|
|
while (bytes_needed != 0 && attempts-- > 0) {
|
|
|
|
|
buffer = rand_pool_add_begin(pool, bytes_needed);
|
|
|
|
|
@@ -732,7 +740,9 @@ size_t rand_pool_acquire_entropy(RAND_PO
|
|
|
|
|
@@ -742,7 +750,9 @@ size_t rand_pool_acquire_entropy(RAND_PO
|
|
|
|
|
return entropy_available;
|
|
|
|
|
}
|
|
|
|
|
# endif
|
|
|
|
@ -164,9 +164,9 @@ diff -up openssl-1.1.1e/crypto/rand/rand_unix.c.fips-post-rand openssl-1.1.1e/cr
|
|
|
|
|
return rand_pool_entropy_available(pool);
|
|
|
|
|
# endif
|
|
|
|
|
}
|
|
|
|
|
diff -up openssl-1.1.1e/include/crypto/fips.h.fips-post-rand openssl-1.1.1e/include/crypto/fips.h
|
|
|
|
|
--- openssl-1.1.1e/include/crypto/fips.h.fips-post-rand 2020-03-17 18:06:16.831418696 +0100
|
|
|
|
|
+++ openssl-1.1.1e/include/crypto/fips.h 2020-03-17 18:06:16.861418172 +0100
|
|
|
|
|
diff -up openssl-1.1.1i/include/crypto/fips.h.fips-post-rand openssl-1.1.1i/include/crypto/fips.h
|
|
|
|
|
--- openssl-1.1.1i/include/crypto/fips.h.fips-post-rand 2020-12-09 10:26:41.639106369 +0100
|
|
|
|
|
+++ openssl-1.1.1i/include/crypto/fips.h 2020-12-09 10:26:41.657106516 +0100
|
|
|
|
|
@@ -77,6 +77,8 @@ int FIPS_selftest_hmac(void);
|
|
|
|
|
int FIPS_selftest_drbg(void);
|
|
|
|
|
int FIPS_selftest_cmac(void);
|
|
|
|
@ -176,9 +176,9 @@ diff -up openssl-1.1.1e/include/crypto/fips.h.fips-post-rand openssl-1.1.1e/incl
|
|
|
|
|
int fips_pkey_signature_test(EVP_PKEY *pkey,
|
|
|
|
|
const unsigned char *tbs, int tbslen,
|
|
|
|
|
const unsigned char *kat,
|
|
|
|
|
diff -up openssl-1.1.1e/include/crypto/rand.h.fips-post-rand openssl-1.1.1e/include/crypto/rand.h
|
|
|
|
|
--- openssl-1.1.1e/include/crypto/rand.h.fips-post-rand 2020-03-17 15:31:17.000000000 +0100
|
|
|
|
|
+++ openssl-1.1.1e/include/crypto/rand.h 2020-03-17 18:07:35.303045555 +0100
|
|
|
|
|
diff -up openssl-1.1.1i/include/crypto/rand.h.fips-post-rand openssl-1.1.1i/include/crypto/rand.h
|
|
|
|
|
--- openssl-1.1.1i/include/crypto/rand.h.fips-post-rand 2020-12-08 14:20:59.000000000 +0100
|
|
|
|
|
+++ openssl-1.1.1i/include/crypto/rand.h 2020-12-09 10:26:41.657106516 +0100
|
|
|
|
|
@@ -24,6 +24,7 @@
|
|
|
|
|
typedef struct rand_pool_st RAND_POOL;
|
|
|
|
|
|
|
|
|
|