|
|
|
@ -1,7 +1,7 @@
|
|
|
|
|
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
|
|
|
|
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
|
|
|
|
|
#
|
|
|
|
|
# Filename: package/.../csprng/0001-add-disable-http-rng.patch
|
|
|
|
|
# Filename: package/.../csprng/0001-configure-add-option-to-disable-http-rng.patch
|
|
|
|
|
# Copyright (C) 2013 The OpenSDE Project
|
|
|
|
|
#
|
|
|
|
|
# More information can be found in the files COPYING and README.
|
|
|
|
@ -14,12 +14,24 @@
|
|
|
|
|
# version.
|
|
|
|
|
# --- SDE-COPYRIGHT-NOTE-END ---
|
|
|
|
|
|
|
|
|
|
This patch introduces a new configure option '--disable-http-rng' to disable
|
|
|
|
|
the feature to fetch random data via http from random.irb.hr.
|
|
|
|
|
From 5f069c7847bc02a738594fc21d437ecae04e2db9 Mon Sep 17 00:00:00 2001
|
|
|
|
|
From: Christian Wiese <chris@opensde.org>
|
|
|
|
|
Date: Wed, 4 Sep 2013 22:39:09 +0200
|
|
|
|
|
Subject: [PATCH] configure: add option to disable http rng
|
|
|
|
|
|
|
|
|
|
--- a/configure.ac 2013-09-04 15:24:23.917623411 +0200
|
|
|
|
|
+++ b/configure.ac 2013-09-04 15:33:53.843839270 +0200
|
|
|
|
|
@@ -55,6 +55,23 @@
|
|
|
|
|
---
|
|
|
|
|
configure.ac | 17 +++++++++++++++++
|
|
|
|
|
src/Makefile.am | 15 ++++++++++-----
|
|
|
|
|
src/csprng.c | 12 ++++++++++++
|
|
|
|
|
test/Makefile.am | 5 ++++-
|
|
|
|
|
utils/csprng-generate.c | 6 ++++++
|
|
|
|
|
5 files changed, 49 insertions(+), 6 deletions(-)
|
|
|
|
|
|
|
|
|
|
diff --git a/configure.ac b/configure.ac
|
|
|
|
|
index 40dfaa4..12fd277 100755
|
|
|
|
|
--- a/configure.ac
|
|
|
|
|
+++ b/configure.ac
|
|
|
|
|
@@ -55,6 +55,23 @@ AC_FUNC_SELECT_ARGTYPES
|
|
|
|
|
AC_TYPE_SIGNAL
|
|
|
|
|
AC_CHECK_FUNCS([floor gettimeofday memset pow select sqrt clock_gettime])
|
|
|
|
|
|
|
|
|
@ -43,9 +55,11 @@ the feature to fetch random data via http from random.irb.hr.
|
|
|
|
|
#### Find OpenSSL
|
|
|
|
|
AC_MSG_CHECKING([for --with-openssl])
|
|
|
|
|
AC_ARG_WITH(
|
|
|
|
|
--- a/src/Makefile.am 2013-09-04 13:25:26.970114877 +0200
|
|
|
|
|
+++ b/src/Makefile.am 2013-09-04 15:43:09.946405852 +0200
|
|
|
|
|
@@ -16,6 +16,14 @@
|
|
|
|
|
diff --git a/src/Makefile.am b/src/Makefile.am
|
|
|
|
|
index 8e1a2bb..302a87b 100644
|
|
|
|
|
--- a/src/Makefile.am
|
|
|
|
|
+++ b/src/Makefile.am
|
|
|
|
|
@@ -16,6 +16,14 @@ libcsprng_la_LIBADD =
|
|
|
|
|
libcsprng_la_CPPFLAGS = -I$(top_srcdir)/include
|
|
|
|
|
libcsprng_la_LDFLAGS = -version-number @CSPRNG_LT_VERSION@
|
|
|
|
|
|
|
|
|
@ -60,7 +74,7 @@ the feature to fetch random data via http from random.irb.hr.
|
|
|
|
|
# Sources
|
|
|
|
|
# The shell script is the easy way to do this, by far. But it may not
|
|
|
|
|
# be sufficiently portable.
|
|
|
|
|
@@ -29,11 +37,8 @@
|
|
|
|
|
@@ -29,11 +37,8 @@ libcsprng_la_SOURCES = \
|
|
|
|
|
csprng.c \
|
|
|
|
|
memt19937ar-JH.c \
|
|
|
|
|
sha1_rng.c \
|
|
|
|
@ -74,9 +88,11 @@ the feature to fetch random data via http from random.irb.hr.
|
|
|
|
|
|
|
|
|
|
MAINTAINERCLEANFILES = Makefile.in
|
|
|
|
|
|
|
|
|
|
--- a/src/csprng.c 2013-09-04 14:41:34.295736601 +0200
|
|
|
|
|
+++ b/src/csprng.c 2013-09-04 15:37:22.230823512 +0200
|
|
|
|
|
@@ -38,7 +38,9 @@
|
|
|
|
|
diff --git a/src/csprng.c b/src/csprng.c
|
|
|
|
|
index 76823e2..89dedad 100644
|
|
|
|
|
--- a/src/csprng.c
|
|
|
|
|
+++ b/src/csprng.c
|
|
|
|
|
@@ -38,7 +38,9 @@ along with CSRNG. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
#include <csprng/nist_ctr_drbg.h>
|
|
|
|
|
#include <csprng/memt19937ar-JH.h>
|
|
|
|
|
#include <csprng/sha1_rng.h>
|
|
|
|
@ -86,7 +102,7 @@ the feature to fetch random data via http from random.irb.hr.
|
|
|
|
|
#include <csprng/csprng.h>
|
|
|
|
|
#include <csprng/fips.h>
|
|
|
|
|
|
|
|
|
|
@@ -282,6 +284,7 @@
|
|
|
|
|
@@ -282,6 +284,7 @@ static void fill_buffer_using_SHA ( rng_buf_type* data )
|
|
|
|
|
}
|
|
|
|
|
//}}}
|
|
|
|
|
|
|
|
|
@ -94,7 +110,7 @@ the feature to fetch random data via http from random.irb.hr.
|
|
|
|
|
//{{{ static void fill_buffer_using_HTTP ( rng_buf_type* data )
|
|
|
|
|
static void fill_buffer_using_HTTP ( rng_buf_type* data )
|
|
|
|
|
{
|
|
|
|
|
@@ -332,6 +335,7 @@
|
|
|
|
|
@@ -332,6 +335,7 @@ static void fill_buffer_using_HTTP ( rng_buf_type* data )
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
//}}}
|
|
|
|
@ -102,7 +118,7 @@ the feature to fetch random data via http from random.irb.hr.
|
|
|
|
|
|
|
|
|
|
//{{{ static void fill_buffer_using_MT_RNG ( rng_buf_type* data )
|
|
|
|
|
static void fill_buffer_using_MT_RNG ( rng_buf_type* data )
|
|
|
|
|
@@ -380,9 +384,11 @@
|
|
|
|
|
@@ -380,9 +384,11 @@ static const unsigned char* get_data_from_RNG_buffer ( rng_buf_type* data, unsig
|
|
|
|
|
case SHA1_RNG:
|
|
|
|
|
fill_buffer_using_SHA (data);
|
|
|
|
|
break;
|
|
|
|
@ -114,7 +130,7 @@ the feature to fetch random data via http from random.irb.hr.
|
|
|
|
|
case MT_RNG:
|
|
|
|
|
fill_buffer_using_MT_RNG (data);
|
|
|
|
|
break;
|
|
|
|
|
@@ -906,9 +912,11 @@
|
|
|
|
|
@@ -906,9 +912,11 @@ csprng_state_type* csprng_initialize( const mode_of_operation_type* mode_of_oper
|
|
|
|
|
unsigned int allocated_size; //Number of bytes allocated for seed.
|
|
|
|
|
rng_state_type rng_state;
|
|
|
|
|
csprng_state_type* csprng_state;
|
|
|
|
@ -126,7 +142,7 @@ the feature to fetch random data via http from random.irb.hr.
|
|
|
|
|
|
|
|
|
|
//{{{ Init csprng_state, do sanity checks
|
|
|
|
|
assert ( mode_of_operation->entropy_source < SOURCES_COUNT );
|
|
|
|
|
@@ -1072,6 +1080,7 @@
|
|
|
|
|
@@ -1072,6 +1080,7 @@ csprng_state_type* csprng_initialize( const mode_of_operation_type* mode_of_oper
|
|
|
|
|
}
|
|
|
|
|
//}}}
|
|
|
|
|
|
|
|
|
@ -134,7 +150,7 @@ the feature to fetch random data via http from random.irb.hr.
|
|
|
|
|
//{{{ Check if need HTTP_RNG and init it
|
|
|
|
|
if ( csprng_state->mode.entropy_source == HTTP_RNG || csprng_state->mode.add_input_source == HTTP_RNG ) {
|
|
|
|
|
QRBG_RNG_login_name = getenv("QRBG_USER");
|
|
|
|
|
@@ -1097,6 +1106,7 @@
|
|
|
|
|
@@ -1097,6 +1106,7 @@ csprng_state_type* csprng_initialize( const mode_of_operation_type* mode_of_oper
|
|
|
|
|
if ( unsetenv("QRBG_PASSWD") ) fprintf(stderr, "WARNING: unsetenv(\"QRBG_PASSWD\") failed with %s.\n", strerror(errno));
|
|
|
|
|
}
|
|
|
|
|
//}}}
|
|
|
|
@ -142,7 +158,7 @@ the feature to fetch random data via http from random.irb.hr.
|
|
|
|
|
|
|
|
|
|
//{{{ Check if need HAVEGE and init it
|
|
|
|
|
if ( csprng_state->mode.entropy_source == HAVEGE || csprng_state->mode.add_input_source == HAVEGE ) {
|
|
|
|
|
@@ -1485,9 +1495,11 @@
|
|
|
|
|
@@ -1485,9 +1495,11 @@ csprng_destroy ( csprng_state_type* csprng_state )
|
|
|
|
|
destroy_buffer( csprng_state->entropy_buf );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -154,9 +170,11 @@ the feature to fetch random data via http from random.irb.hr.
|
|
|
|
|
|
|
|
|
|
if ( csprng_state->sha != NULL ) {
|
|
|
|
|
destroy_SHA1( csprng_state->sha );
|
|
|
|
|
--- a/test/Makefile.am 2013-09-04 15:14:20.288198731 +0200
|
|
|
|
|
+++ b/test/Makefile.am 2013-09-04 15:18:27.146249565 +0200
|
|
|
|
|
@@ -4,7 +4,10 @@
|
|
|
|
|
diff --git a/test/Makefile.am b/test/Makefile.am
|
|
|
|
|
index d3e045e..023ded7 100644
|
|
|
|
|
--- a/test/Makefile.am
|
|
|
|
|
+++ b/test/Makefile.am
|
|
|
|
|
@@ -4,7 +4,10 @@ include $(top_srcdir)/common.mk
|
|
|
|
|
#bin_PROGRAMS = openssl-rand sha1_main memt qrbg_main http_main ctr_drbg_test
|
|
|
|
|
#TODO - link static does not work for qrbg_main.c => move it to C++ ??
|
|
|
|
|
|
|
|
|
@ -168,9 +186,11 @@ the feature to fetch random data via http from random.irb.hr.
|
|
|
|
|
if HAVE_LIBTESTU01
|
|
|
|
|
bin_PROGRAMS += TestU01_raw_stdin_input_with_log
|
|
|
|
|
endif
|
|
|
|
|
--- a/utils/csprng-generate.c 2013-09-04 14:39:26.110846139 +0200
|
|
|
|
|
+++ b/utils/csprng-generate.c 2013-09-04 15:13:04.426054925 +0200
|
|
|
|
|
@@ -832,7 +832,9 @@
|
|
|
|
|
diff --git a/utils/csprng-generate.c b/utils/csprng-generate.c
|
|
|
|
|
index f9207fb..7a1928a 100644
|
|
|
|
|
--- a/utils/csprng-generate.c
|
|
|
|
|
+++ b/utils/csprng-generate.c
|
|
|
|
|
@@ -832,7 +832,9 @@ int main(int argc, char **argv) {
|
|
|
|
|
mode_of_operation.file_read_size = 16384;
|
|
|
|
|
mode_of_operation.max_number_of_csprng_blocks = arguments.max_num_of_blocks;
|
|
|
|
|
mode_of_operation.random_length_of_csprng_generated_bytes = arguments.randomize_num_of_blocks;
|
|
|
|
@ -180,7 +200,7 @@ the feature to fetch random data via http from random.irb.hr.
|
|
|
|
|
|
|
|
|
|
fips_state = fips_approved_csprng_initialize(arguments.fips_test, 0, &mode_of_operation);
|
|
|
|
|
|
|
|
|
|
@@ -942,9 +944,11 @@
|
|
|
|
|
@@ -942,9 +944,11 @@ int main(int argc, char **argv) {
|
|
|
|
|
current_time = time(NULL);
|
|
|
|
|
strftime(current_time_string, sizeof(current_time_string) , "%a %b %H:%M:%S %Y", localtime(¤t_time));
|
|
|
|
|
fprintf ( stderr, "\n========================= %s ==========================\n", current_time_string );
|
|
|
|
@ -192,7 +212,7 @@ the feature to fetch random data via http from random.irb.hr.
|
|
|
|
|
print_statistics(total_bytes_written, arguments.unlimited, remaining_bytes, arguments.size, stderr, &start_time);
|
|
|
|
|
fprintf(stderr, "\n");
|
|
|
|
|
if ( arguments.fips_test) fprintf ( stderr, "%s", dump_fips_statistics ( &fips_state->fips_ctx.fips_statistics ) );
|
|
|
|
|
@@ -968,9 +972,11 @@
|
|
|
|
|
@@ -968,9 +972,11 @@ int main(int argc, char **argv) {
|
|
|
|
|
current_time = time(NULL);
|
|
|
|
|
strftime(current_time_string, sizeof(current_time_string) , "%a %b %H:%M:%S %Y", localtime(¤t_time));
|
|
|
|
|
fprintf ( stderr, "\n======FINAL REPORT======= %s ==========================\n", current_time_string );
|
|
|
|
@ -204,3 +224,6 @@ the feature to fetch random data via http from random.irb.hr.
|
|
|
|
|
print_statistics(total_bytes_written, arguments.unlimited, remaining_bytes, arguments.size, stderr, &start_time);
|
|
|
|
|
fprintf(stderr, "\n");
|
|
|
|
|
if ( arguments.fips_test) fprintf ( stderr, "%s", dump_fips_statistics ( &fips_state->fips_ctx.fips_statistics ) );
|
|
|
|
|
--
|
|
|
|
|
1.7.2.3
|
|
|
|
|
|