|
|
@ -1,7 +1,7 @@ |
|
|
|
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
|
|
|
|
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
|
|
|
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
|
|
|
|
# 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
|
|
|
|
# Copyright (C) 2013 The OpenSDE Project
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# More information can be found in the files COPYING and README.
|
|
|
|
# More information can be found in the files COPYING and README.
|
|
|
@ -14,12 +14,24 @@ |
|
|
|
# version.
|
|
|
|
# version.
|
|
|
|
# --- SDE-COPYRIGHT-NOTE-END ---
|
|
|
|
# --- SDE-COPYRIGHT-NOTE-END ---
|
|
|
|
|
|
|
|
|
|
|
|
This patch introduces a new configure option '--disable-http-rng' to disable
|
|
|
|
From 5f069c7847bc02a738594fc21d437ecae04e2db9 Mon Sep 17 00:00:00 2001
|
|
|
|
the feature to fetch random data via http from random.irb.hr.
|
|
|
|
From: Christian Wiese <chris@opensde.org>
|
|
|
|
|
|
|
|
Date: Wed, 4 Sep 2013 22:39:09 +0200
|
|
|
|
--- a/configure.ac 2013-09-04 15:24:23.917623411 +0200
|
|
|
|
Subject: [PATCH] configure: add option to disable http rng
|
|
|
|
+++ 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_TYPE_SIGNAL
|
|
|
|
AC_CHECK_FUNCS([floor gettimeofday memset pow select sqrt clock_gettime])
|
|
|
|
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
|
|
|
|
#### Find OpenSSL
|
|
|
|
AC_MSG_CHECKING([for --with-openssl])
|
|
|
|
AC_MSG_CHECKING([for --with-openssl])
|
|
|
|
AC_ARG_WITH(
|
|
|
|
AC_ARG_WITH(
|
|
|
|
--- a/src/Makefile.am 2013-09-04 13:25:26.970114877 +0200
|
|
|
|
diff --git a/src/Makefile.am b/src/Makefile.am
|
|
|
|
+++ b/src/Makefile.am 2013-09-04 15:43:09.946405852 +0200
|
|
|
|
index 8e1a2bb..302a87b 100644
|
|
|
|
@@ -16,6 +16,14 @@
|
|
|
|
--- a/src/Makefile.am
|
|
|
|
|
|
|
|
+++ b/src/Makefile.am
|
|
|
|
|
|
|
|
@@ -16,6 +16,14 @@ libcsprng_la_LIBADD =
|
|
|
|
libcsprng_la_CPPFLAGS = -I$(top_srcdir)/include
|
|
|
|
libcsprng_la_CPPFLAGS = -I$(top_srcdir)/include
|
|
|
|
libcsprng_la_LDFLAGS = -version-number @CSPRNG_LT_VERSION@
|
|
|
|
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
|
|
|
|
# Sources
|
|
|
|
# The shell script is the easy way to do this, by far. But it may not
|
|
|
|
# The shell script is the easy way to do this, by far. But it may not
|
|
|
|
# be sufficiently portable.
|
|
|
|
# be sufficiently portable.
|
|
|
|
@@ -29,11 +37,8 @@
|
|
|
|
@@ -29,11 +37,8 @@ libcsprng_la_SOURCES = \
|
|
|
|
csprng.c \
|
|
|
|
csprng.c \
|
|
|
|
memt19937ar-JH.c \
|
|
|
|
memt19937ar-JH.c \
|
|
|
|
sha1_rng.c \
|
|
|
|
sha1_rng.c \
|
|
|
@ -74,9 +88,11 @@ the feature to fetch random data via http from random.irb.hr. |
|
|
|
|
|
|
|
|
|
|
|
MAINTAINERCLEANFILES = Makefile.in
|
|
|
|
MAINTAINERCLEANFILES = Makefile.in
|
|
|
|
|
|
|
|
|
|
|
|
--- a/src/csprng.c 2013-09-04 14:41:34.295736601 +0200
|
|
|
|
diff --git a/src/csprng.c b/src/csprng.c
|
|
|
|
+++ b/src/csprng.c 2013-09-04 15:37:22.230823512 +0200
|
|
|
|
index 76823e2..89dedad 100644
|
|
|
|
@@ -38,7 +38,9 @@
|
|
|
|
--- 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/nist_ctr_drbg.h>
|
|
|
|
#include <csprng/memt19937ar-JH.h>
|
|
|
|
#include <csprng/memt19937ar-JH.h>
|
|
|
|
#include <csprng/sha1_rng.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/csprng.h>
|
|
|
|
#include <csprng/fips.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 )
|
|
|
|
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;
|
|
|
|
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 )
|
|
|
|
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:
|
|
|
|
case SHA1_RNG:
|
|
|
|
fill_buffer_using_SHA (data);
|
|
|
|
fill_buffer_using_SHA (data);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
@ -114,7 +130,7 @@ the feature to fetch random data via http from random.irb.hr. |
|
|
|
case MT_RNG:
|
|
|
|
case MT_RNG:
|
|
|
|
fill_buffer_using_MT_RNG (data);
|
|
|
|
fill_buffer_using_MT_RNG (data);
|
|
|
|
break;
|
|
|
|
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.
|
|
|
|
unsigned int allocated_size; //Number of bytes allocated for seed.
|
|
|
|
rng_state_type rng_state;
|
|
|
|
rng_state_type rng_state;
|
|
|
|
csprng_state_type* csprng_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
|
|
|
|
//{{{ Init csprng_state, do sanity checks
|
|
|
|
assert ( mode_of_operation->entropy_source < SOURCES_COUNT );
|
|
|
|
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
|
|
|
|
//{{{ Check if need HTTP_RNG and init it
|
|
|
|
if ( csprng_state->mode.entropy_source == HTTP_RNG || csprng_state->mode.add_input_source == HTTP_RNG ) {
|
|
|
|
if ( csprng_state->mode.entropy_source == HTTP_RNG || csprng_state->mode.add_input_source == HTTP_RNG ) {
|
|
|
|
QRBG_RNG_login_name = getenv("QRBG_USER");
|
|
|
|
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));
|
|
|
|
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
|
|
|
|
//{{{ Check if need HAVEGE and init it
|
|
|
|
if ( csprng_state->mode.entropy_source == HAVEGE || csprng_state->mode.add_input_source == HAVEGE ) {
|
|
|
|
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 );
|
|
|
|
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 ) {
|
|
|
|
if ( csprng_state->sha != NULL ) {
|
|
|
|
destroy_SHA1( csprng_state->sha );
|
|
|
|
destroy_SHA1( csprng_state->sha );
|
|
|
|
--- a/test/Makefile.am 2013-09-04 15:14:20.288198731 +0200
|
|
|
|
diff --git a/test/Makefile.am b/test/Makefile.am
|
|
|
|
+++ b/test/Makefile.am 2013-09-04 15:18:27.146249565 +0200
|
|
|
|
index d3e045e..023ded7 100644
|
|
|
|
@@ -4,7 +4,10 @@
|
|
|
|
--- 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
|
|
|
|
#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++ ??
|
|
|
|
#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
|
|
|
|
if HAVE_LIBTESTU01
|
|
|
|
bin_PROGRAMS += TestU01_raw_stdin_input_with_log
|
|
|
|
bin_PROGRAMS += TestU01_raw_stdin_input_with_log
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
--- a/utils/csprng-generate.c 2013-09-04 14:39:26.110846139 +0200
|
|
|
|
diff --git a/utils/csprng-generate.c b/utils/csprng-generate.c
|
|
|
|
+++ b/utils/csprng-generate.c 2013-09-04 15:13:04.426054925 +0200
|
|
|
|
index f9207fb..7a1928a 100644
|
|
|
|
@@ -832,7 +832,9 @@
|
|
|
|
--- 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.file_read_size = 16384;
|
|
|
|
mode_of_operation.max_number_of_csprng_blocks = arguments.max_num_of_blocks;
|
|
|
|
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;
|
|
|
|
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);
|
|
|
|
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);
|
|
|
|
current_time = time(NULL);
|
|
|
|
strftime(current_time_string, sizeof(current_time_string) , "%a %b %H:%M:%S %Y", localtime(¤t_time));
|
|
|
|
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 );
|
|
|
|
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);
|
|
|
|
print_statistics(total_bytes_written, arguments.unlimited, remaining_bytes, arguments.size, stderr, &start_time);
|
|
|
|
fprintf(stderr, "\n");
|
|
|
|
fprintf(stderr, "\n");
|
|
|
|
if ( arguments.fips_test) fprintf ( stderr, "%s", dump_fips_statistics ( &fips_state->fips_ctx.fips_statistics ) );
|
|
|
|
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);
|
|
|
|
current_time = time(NULL);
|
|
|
|
strftime(current_time_string, sizeof(current_time_string) , "%a %b %H:%M:%S %Y", localtime(¤t_time));
|
|
|
|
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 );
|
|
|
|
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);
|
|
|
|
print_statistics(total_bytes_written, arguments.unlimited, remaining_bytes, arguments.size, stderr, &start_time);
|
|
|
|
fprintf(stderr, "\n");
|
|
|
|
fprintf(stderr, "\n");
|
|
|
|
if ( arguments.fips_test) fprintf ( stderr, "%s", dump_fips_statistics ( &fips_state->fips_ctx.fips_statistics ) );
|
|
|
|
if ( arguments.fips_test) fprintf ( stderr, "%s", dump_fips_statistics ( &fips_state->fips_ctx.fips_statistics ) );
|
|
|
|
|
|
|
|
--
|
|
|
|
|
|
|
|
1.7.2.3
|
|
|
|
|
|
|
|
|