Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package jitterentropy for openSUSE:Factory checked in at 2022-09-12 19:08:28 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/jitterentropy (Old) and /work/SRC/openSUSE:Factory/.jitterentropy.new.2083 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "jitterentropy" Mon Sep 12 19:08:28 2022 rev:4 rq:1002712 version:3.4.1 Changes: -------- --- /work/SRC/openSUSE:Factory/jitterentropy/jitterentropy.changes 2022-08-03 21:17:23.351550911 +0200 +++ /work/SRC/openSUSE:Factory/.jitterentropy.new.2083/jitterentropy.changes 2022-09-12 19:08:32.494585804 +0200 @@ -1,0 +2,9 @@ +Mon Sep 12 07:04:35 UTC 2022 - Marcus Meissner <meiss...@suse.com> + +- updated to 3.4.1 + * add FIPS 140 hints to man page + * simplify the test tool to search for optimal configurations + * fix: jent_loop_shuffle: re-add setting the time that was lost with 3.4.0 + * enhancement: add ARM64 assembler code to read high-res timer + +------------------------------------------------------------------- Old: ---- v3.4.0.tar.gz New: ---- v3.4.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ jitterentropy.spec ++++++ --- /var/tmp/diff_new_pack.WnN0kC/_old 2022-09-12 19:08:32.970587142 +0200 +++ /var/tmp/diff_new_pack.WnN0kC/_new 2022-09-12 19:08:32.974587153 +0200 @@ -20,7 +20,7 @@ Summary: A userspace library for jitter entropy generation License: BSD-3-Clause OR GPL-2.0-or-later Group: Development/Tools/Other -Version: 3.4.0 +Version: 3.4.1 Release: 0 URL: https://github.com/smuellerDD/jitterentropy-library Source0: https://github.com/smuellerDD/jitterentropy-library/archive/refs/tags/v%{version}.tar.gz @@ -91,6 +91,6 @@ %files -n libjitterentropy3 %license LICENSE.gplv2 LICENSE LICENSE.bsd %_libdir/libjitterentropy.so.3 -%_libdir/libjitterentropy.so.3.4.0 +%_libdir/libjitterentropy.so.%version %changelog ++++++ v3.4.0.tar.gz -> v3.4.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jitterentropy-library-3.4.0/.gitignore new/jitterentropy-library-3.4.1/.gitignore --- old/jitterentropy-library-3.4.0/.gitignore 1970-01-01 01:00:00.000000000 +0100 +++ new/jitterentropy-library-3.4.1/.gitignore 2022-08-31 08:08:36.000000000 +0200 @@ -0,0 +1,4 @@ +SP800-90B_EntropyAssessment +.kdev4 +*.kdev4 + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jitterentropy-library-3.4.0/CHANGES.md new/jitterentropy-library-3.4.1/CHANGES.md --- old/jitterentropy-library-3.4.0/CHANGES.md 2022-03-17 22:28:14.000000000 +0100 +++ new/jitterentropy-library-3.4.1/CHANGES.md 2022-08-31 08:08:36.000000000 +0200 @@ -1,3 +1,9 @@ +3.4.1 + * add FIPS 140 hints to man page + * simplify the test tool to search for optimal configurations + * fix: jent_loop_shuffle: re-add setting the time that was lost with 3.4.0 + * enhancement: add ARM64 assembler code to read high-res timer + 3.4.0 * enhancement: add API call jent_set_fips_failure_callback as requested by Daniel Ojalvo * fix: Change the SHA-3 integration: The entropy pool is now a SHA-3 state. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jitterentropy-library-3.4.0/arch/jitterentropy-base-windows.h new/jitterentropy-library-3.4.1/arch/jitterentropy-base-windows.h --- old/jitterentropy-library-3.4.0/arch/jitterentropy-base-windows.h 2022-03-17 22:28:14.000000000 +0100 +++ new/jitterentropy-library-3.4.1/arch/jitterentropy-base-windows.h 2022-08-31 08:08:36.000000000 +0200 @@ -65,14 +65,14 @@ { #if defined(_M_ARM) || defined(_M_ARM64) - // Generic code. + /* Generic code. */ LARGE_INTEGER ticks; QueryPerformanceCounter(&ticks); *out = ticks.QuadPart; #else - // x86, x86_64 intrinsic + /* x86, x86_64 intrinsic */ *out = __rdtsc(); #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jitterentropy-library-3.4.0/doc/jitterentropy.3 new/jitterentropy-library-3.4.1/doc/jitterentropy.3 --- old/jitterentropy-library-3.4.0/doc/jitterentropy.3 2022-03-17 22:28:14.000000000 +0100 +++ new/jitterentropy-library-3.4.1/doc/jitterentropy.3 2022-08-31 08:08:36.000000000 +0200 @@ -127,9 +127,13 @@ The .IR osr value defines the amount of oversampling performed by the entropy -collector. Usually, a caller wants to provide the value 1 here to -not perform oversampling. The value 0 is converted into a 1 automatically -by the entropy collector. +collector. Usually, a caller wants to provide the value 0 here to +apply the default oversampling. The call ensures that any value +lower than +.B JENT_MIN_OSR +is converted to +.B JENT_MIN_OSR +automatically. .LP The .IR flags @@ -259,6 +263,40 @@ returns the version number of the library as an integer value that is monotonically increasing. .PP +.SH FIPS 140-3 Considerations +In order for the Jitter RNG to execute compliant to FIPS 140-3 and by +extension also SP800-90B and SP800-90C compliant, the following +considerations must be applied: +.TP +.B Enable FIPS mode +The FIPS mode is enabled by using the +.IR JENT_FORCE_FIPS +flag during initialization of the Jitter RNG library. On Linux, the +the FIPS mode is transparently enabled if the entire operating system +was booted in FIPS mode, usually by using the "fips=1" Linux kernel +command line parameter. +.TP +.B Perform heursitic entropy analysis +The test tool set provided as part of the Jitter RNG library source +distribution contains the helper to obtain raw noise data at runtime +as well as at initialization time to calculate the SP800-90B entropy rate. +This rate must be above 0.333, the implied heuristic minimum by the Jitter +RNG library. +.TP +.B Resolve insufficient entropy +If insufficient entropy is found during the aforementioned SP800-90B +analysis, the test tool set provides a helper to analyze optimal +settings - see the test tool set for raw entropy for details. The resulting +configuration values are expected to be used with the +.IR flags +parameter of the calls +.BR jent_entropy_collector_alloc () +and +.BR jent_entropy_init_ex () . +It is recommended that the function +.BR jent_read_entropy_safe () +API call is used for generating random numbers. +.PP .SH NOTES In addition to use the generated random bit stream directly for cryptographic operations, the output of diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jitterentropy-library-3.4.0/jitterentropy-base-user.h new/jitterentropy-library-3.4.1/jitterentropy-base-user.h --- old/jitterentropy-library-3.4.0/jitterentropy-base-user.h 2022-03-17 22:28:14.000000000 +0100 +++ new/jitterentropy-library-3.4.1/jitterentropy-base-user.h 2022-08-31 08:08:36.000000000 +0200 @@ -96,7 +96,8 @@ /* Support rdtsc read on 64-bit and 32-bit x86 architectures */ #ifdef __x86_64__ -# define DECLARE_ARGS(val, low, high) unsigned long low, high +/* specify 64 bit type since long is 32 bits in LLP64 x86_64 systems */ +# define DECLARE_ARGS(val, low, high) uint64_t low, high # define EAX_EDX_VAL(val, low, high) ((low) | (high) << 32) # define EAX_EDX_RET(val, low, high) "=a" (low), "=d" (high) #elif __i386__ @@ -112,7 +113,52 @@ *out = EAX_EDX_VAL(val, low, high); } -#else /* (__x86_64__) || (__i386__) */ +#elif defined(__aarch64__) + +static inline void jent_get_nstime(uint64_t *out) +{ + uint64_t ctr_val; + /* + * Use the system counter for aarch64 (64 bit ARM). + */ + asm volatile("mrs %0, cntvct_el0" : "=r" (ctr_val)); + *out = ctr_val; +} + +#elif defined(__s390x__) + +static inline void jent_get_nstime(uint64_t *out) +{ + uint64_t clk; + + /* this is MVS code! enable with -S in the compiler */ + /*__asm__ volatile("stck %0" : "=m" (clk) : : "cc"); */ + /* this is gcc */ + asm volatile("stcke %0" : "=Q" (clk) : : "cc"); + *out = (uint64_t)(clk); +} + +#elif defined(__powerpc) + +/* taken from http://www.ecrypt.eu.org/ebats/cpucycles.html */ + +static inline void jent_get_nstime(uint64_t *out) +{ + unsigned long high; + unsigned long low; + unsigned long newhigh; + uint64_t result; + asm volatile( + "Lcpucycles:mftbu %0;mftb %1;mftbu %2;cmpw %0,%2;bne Lcpucycles" + : "=r" (high), "=r" (low), "=r" (newhigh) + ); + result = high; + result <<= 32; + result |= low; + *out = result; +} + +#else /* (__x86_64__) || (__i386__) || (__aarch64__) || (__s390x__) || (__powerpc) */ static inline void jent_get_nstime(uint64_t *out) { @@ -147,7 +193,7 @@ # endif /* __MACH__ */ } -#endif /* __x86_64__ */ +#endif /* (__x86_64__) || (__i386__) || (__aarch64__) */ static inline void *jent_zalloc(size_t len) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jitterentropy-library-3.4.0/src/jitterentropy-base.c new/jitterentropy-library-3.4.1/src/jitterentropy-base.c --- old/jitterentropy-library-3.4.0/src/jitterentropy-base.c 2022-03-17 22:28:14.000000000 +0100 +++ new/jitterentropy-library-3.4.1/src/jitterentropy-base.c 2022-08-31 08:08:36.000000000 +0200 @@ -45,7 +45,7 @@ #define MINVERSION 4 /* API compatible, ABI may change, functional * enhancements only, consumer can be left unchanged if * enhancements are not considered */ -#define PATCHLEVEL 0 /* API / ABI compatible, no functional changes, no +#define PATCHLEVEL 1 /* API / ABI compatible, no functional changes, no * enhancements, bug fixes only */ /*************************************************************************** diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jitterentropy-library-3.4.0/src/jitterentropy-health.c new/jitterentropy-library-3.4.1/src/jitterentropy-health.c --- old/jitterentropy-library-3.4.0/src/jitterentropy-health.c 2022-03-17 22:28:14.000000000 +0100 +++ new/jitterentropy-library-3.4.1/src/jitterentropy-health.c 2022-08-31 08:08:36.000000000 +0200 @@ -115,7 +115,7 @@ /* Reset Lag counters */ ec->lag_prediction_success_count = 0; ec->lag_prediction_success_run = 0; - ec->lag_best_predictor = 0; //The first guess is basically arbitrary. + ec->lag_best_predictor = 0; /* The first guess is basically arbitrary. */ ec->lag_observations = 0; for (i = 0; i < JENT_LAG_HISTORY_SIZE; i++) { @@ -307,21 +307,21 @@ { /* Initialize the base reference */ if (!ec->apt_base_set) { - ec->apt_base = current_delta; // APT Step 1 - ec->apt_base_set = 1; // APT Step 2 + ec->apt_base = current_delta; /* APT Step 1 */ + ec->apt_base_set = 1; /* APT Step 2 */ /* * Reset APT counter * Note that we've taken in the first symbol in the window. */ - ec->apt_count = 1; // B = 1 + ec->apt_count = 1; /* B = 1 */ ec->apt_observations = 1; return; } if (current_delta == ec->apt_base) { - ec->apt_count++; // B = B + 1 + ec->apt_count++; /* B = B + 1 */ /* Note, ec->apt_count starts with one. */ if (ec->apt_count >= ec->apt_cutoff) @@ -332,7 +332,7 @@ /* Completed one window, the next symbol input will be new apt_base. */ if (ec->apt_observations >= JENT_APT_WINDOW_SIZE) - jent_apt_reset(ec); // APT Step 4 + jent_apt_reset(ec); /* APT Step 4 */ } /*************************************************************************** diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jitterentropy-library-3.4.0/src/jitterentropy-noise.c new/jitterentropy-library-3.4.1/src/jitterentropy-noise.c --- old/jitterentropy-library-3.4.0/src/jitterentropy-noise.c 2022-03-17 22:28:14.000000000 +0100 +++ new/jitterentropy-library-3.4.1/src/jitterentropy-noise.c 2022-08-31 08:08:36.000000000 +0200 @@ -33,16 +33,19 @@ * Update of the loop count used for the next round of * an entropy collection. * + * @ec [in] entropy collector struct * @bits [in] is the number of low bits of the timer to consider * @min [in] is the number of bits we shift the timer value to the right at * the end to make sure we have a guaranteed minimum value * * @return Newly calculated loop counter */ -static uint64_t jent_loop_shuffle(unsigned int bits, unsigned int min) +static uint64_t jent_loop_shuffle(struct rand_data *ec, + unsigned int bits, unsigned int min) { #ifdef JENT_CONF_DISABLE_LOOP_SHUFFLE + (void)ec; (void)bits; return (UINT64_C(1)<<min); @@ -55,10 +58,16 @@ unsigned int i = 0; /* + * Mix the current state of the random number into the shuffle + * calculation to balance that shuffle a bit more. + */ + jent_get_nstime_internal(ec, &time); + + /* * We fold the time value as much as possible to ensure that as many * bits of the time stamp are included as possible. */ - for (i = 0; ((DATA_SIZE_BITS + bits - 1) / bits) > i; i++) { + for (i = 0; (((sizeof(time) << 3) + bits - 1) / bits) > i; i++) { shuffle ^= time & mask; time = time >> bits; } @@ -79,7 +88,7 @@ * This function injects the individual bits of the time value into the * entropy pool using a hash. * - * @ec [in] entropy collector struct -- may be NULL + * @ec [in] entropy collector struct * @time [in] time delta to be injected * @loop_cnt [in] if a value not equal to 0 is set, use the given value as * number of loops to perform the hash operation @@ -100,7 +109,7 @@ /* Ensure that macros cannot overflow jent_loop_shuffle() */ BUILD_BUG_ON((MAX_HASH_LOOP + MIN_HASH_LOOP) > 63); uint64_t hash_loop_cnt = - jent_loop_shuffle(MAX_HASH_LOOP, MIN_HASH_LOOP); + jent_loop_shuffle(ec, MAX_HASH_LOOP, MIN_HASH_LOOP); /* Use the memset to shut up valgrind */ memset(intermediary, 0, sizeof(intermediary)); @@ -203,7 +212,7 @@ /* Ensure that macros cannot overflow jent_loop_shuffle() */ BUILD_BUG_ON((MAX_ACC_LOOP_BIT + MIN_ACC_LOOP_BIT) > 63); uint64_t acc_loop_cnt = - jent_loop_shuffle(MAX_ACC_LOOP_BIT, MIN_ACC_LOOP_BIT); + jent_loop_shuffle(ec, MAX_ACC_LOOP_BIT, MIN_ACC_LOOP_BIT); if (NULL == ec || NULL == ec->mem) return; @@ -281,7 +290,7 @@ /* Ensure that macros cannot overflow jent_loop_shuffle() */ BUILD_BUG_ON((MAX_ACC_LOOP_BIT + MIN_ACC_LOOP_BIT) > 63); uint64_t acc_loop_cnt = - jent_loop_shuffle(MAX_ACC_LOOP_BIT, MIN_ACC_LOOP_BIT); + jent_loop_shuffle(ec, MAX_ACC_LOOP_BIT, MIN_ACC_LOOP_BIT); if (NULL == ec || NULL == ec->mem) return; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jitterentropy-library-3.4.0/tests/raw-entropy/README.md new/jitterentropy-library-3.4.1/tests/raw-entropy/README.md --- old/jitterentropy-library-3.4.0/tests/raw-entropy/README.md 2022-03-17 22:28:14.000000000 +0100 +++ new/jitterentropy-library-3.4.1/tests/raw-entropy/README.md 2022-08-31 08:08:36.000000000 +0200 @@ -72,7 +72,8 @@ # Approach to Solve Insufficient Entropy -In case your entropy assessment shows that insufficient entropy is +The Jitter RNG does not need any specific configurations or settings. However, +in case your entropy assessment shows that insufficient entropy is present (e.g. by showing that the measured entropy rate is less than 1/3), you can perform a search whether different memory access values gives better entropy. @@ -155,37 +156,30 @@ For example, the test returns the following data ``` -Max memory size Number of bits min entropy -... -1048576 22 0.455422 -1048576 23 0.502770 -1048576 24 0.477720 -2097152 10 1.039674 -2097152 11 1.032812 -2097152 12 1.041936 -2097152 13 1.008875 -2097152 14 1.024471 -2097152 15 0.909834 -2097152 16 0.993031 -2097152 17 1.015445 -2097152 18 1.043770 -2097152 19 1.056669 -2097152 20 1.118589 -2097152 21 1.009380 -2097152 22 0.983140 -2097152 23 1.012301 -2097152 24 0.981318 -4194304 10 1.502379 -4194304 11 1.546510 -4194304 12 1.622690 -4194304 13 1.565022 -... +Number of bits min entropy +10 0.406505 +11 0.445082 +12 0.402972 +13 0.459021 +14 0.436911 +15 0.578995 +16 0.643272 +17 0.573532 +18 0.627915 +19 0.503923 +20 0.720609 +21 1.871527 +22 2.491569 +23 2.481533 +24 2.493987 +25 2.491303 +26 2.495017 ``` This stack tells you in the first column the actual amount of memory requested -to be allocated by the Jitter RNG for the memory access (Note, this amount -is limited by the CPU's data cache size.). The second column is what you can -ignore for this test. +to be allocated by the Jitter RNG for the memory access in powers of 2 (Note, +this amount is limited by the CPU's data cache size.). The second column is what +you can ignore for this test. You now conclude that the following line is good for you because the measurement shows that about 1 bit of entropy per Jitter RNG time delta is received. This @@ -194,17 +188,17 @@ underestimates the available entropy - which is the result you want. ``` -2097152 13 1.008875 +21 1.871527 ``` -This value means that the allocated memory is 2097152. +This value means that the allocated memory is 2^21 = 2MBytes. You now have two options how to apply this value: either recompiling the library and use this value as the default allocation or use it as a flags field when allocating your Jitter RNG instance which does not need to change the binary. -When recompiling, you need to apply the log2(2097152) = 21 with your +When recompiling, you need to apply the value `21` with your CFLAGS setting for compiling the Jitter RNG like this: `CFLAGS="-DJENT_MEMORY_BITS=21"` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jitterentropy-library-3.4.0/tests/raw-entropy/recording_userspace/analyze_options.sh new/jitterentropy-library-3.4.1/tests/raw-entropy/recording_userspace/analyze_options.sh --- old/jitterentropy-library-3.4.0/tests/raw-entropy/recording_userspace/analyze_options.sh 2022-03-17 22:28:14.000000000 +0100 +++ new/jitterentropy-library-3.4.1/tests/raw-entropy/recording_userspace/analyze_options.sh 2022-08-31 08:08:36.000000000 +0200 @@ -10,17 +10,14 @@ if (grep JENT_RANDOM_MEMACCESS ../../../jitterentropy.h | head -n 1 | grep -q define) then - for memsize in 32768 65536 131072 262144 524288 1048576 2097152 4194304 8388608 16777216 33554432 67108864 134217728 268435456 536870912 + for bits in 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 do - for bits in 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 - do - export CFLAGS="-DJENT_MEMORY_BITS=$bits -DJENT_MEMORY_SIZE=$memsize" + export CFLAGS="-DJENT_MEMORY_BITS=$bits" - ./invoke_testing.sh + ./invoke_testing.sh - mv $OUTDIR $OUTDIR-random_memaccess-${bits}bits-${memsize}bytes + mv $OUTDIR $OUTDIR-random_memaccess-${bits}bits - done done else diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jitterentropy-library-3.4.0/tests/raw-entropy/recording_userspace/jitterentropy-hashtime.c new/jitterentropy-library-3.4.1/tests/raw-entropy/recording_userspace/jitterentropy-hashtime.c --- old/jitterentropy-library-3.4.0/tests/raw-entropy/recording_userspace/jitterentropy-hashtime.c 2022-03-17 22:28:14.000000000 +0100 +++ new/jitterentropy-library-3.4.1/tests/raw-entropy/recording_userspace/jitterentropy-hashtime.c 2022-08-31 08:08:36.000000000 +0200 @@ -188,7 +188,7 @@ switch (val) { case 0: - // Allow to set no option + /* Allow to set no option */ break; case 1: flags |= JENT_MAX_MEMSIZE_32kB; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jitterentropy-library-3.4.0/tests/raw-entropy/recording_userspace/jitterentropy-rng.c new/jitterentropy-library-3.4.1/tests/raw-entropy/recording_userspace/jitterentropy-rng.c --- old/jitterentropy-library-3.4.0/tests/raw-entropy/recording_userspace/jitterentropy-rng.c 2022-03-17 22:28:14.000000000 +0100 +++ new/jitterentropy-library-3.4.1/tests/raw-entropy/recording_userspace/jitterentropy-rng.c 2022-08-31 08:08:36.000000000 +0200 @@ -78,7 +78,7 @@ val = strtoul(argv[1], NULL, 10); switch (val) { case 0: - // Allow to set no option + /* Allow to set no option */ break; case 1: flags |= JENT_MAX_MEMSIZE_32kB; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jitterentropy-library-3.4.0/tests/raw-entropy/validation-restart/analyze_options.sh new/jitterentropy-library-3.4.1/tests/raw-entropy/validation-restart/analyze_options.sh --- old/jitterentropy-library-3.4.0/tests/raw-entropy/validation-restart/analyze_options.sh 2022-03-17 22:28:14.000000000 +0100 +++ new/jitterentropy-library-3.4.1/tests/raw-entropy/validation-restart/analyze_options.sh 2022-08-31 08:08:36.000000000 +0200 @@ -77,32 +77,29 @@ calc_randmem() { local crunch=$1 - for memsize in 32768 65536 131072 262144 524288 1048576 2097152 4194304 8388608 16777216 33554432 67108864 134217728 268435456 536870912 + for bits in 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 do - for bits in 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 - do - local target="$RES_DIR-random_memaccess-${bits}bits-${memsize}bytes" - local source="$ENT_DIR-random_memaccess-${bits}bits-${memsize}bytes" + local target="$RES_DIR-random_memaccess-${bits}bits-${memsize}bytes" + local source="$ENT_DIR-random_memaccess-${bits}bits-${memsize}bytes" - if [ ! -d "$source" ] - then - continue - fi + if [ ! -d "$source" ] + then + continue + fi - if [ $randmem_written -eq 0 ] - then - echo -e "Max memory size\tNumber of bits\tmin entropy" > $RESULT - randmem_written=1 - fi + if [ $randmem_written -eq 0 ] + then + echo -e "Number of bits\tmin entropy" > $RESULT + randmem_written=1 + fi - if [ $crunch -eq 0 ] - then - ent=$(grep min $target/jent-raw-noise-restart-consolidated.minentropy_FF_8bits.var.txt | cut -d ":" -f 2) - echo -e "$memsize\t$bits\t$ent" >> $RESULT - else - crunch_numbers $source $target - fi - done + if [ $crunch -eq 0 ] + then + ent=$(grep min $target/jent-raw-noise-restart-consolidated.minentropy_FF_8bits.var.txt | cut -d ":" -f 2) + echo -e "$bits\t$ent" >> $RESULT + else + crunch_numbers $source $target + fi done } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jitterentropy-library-3.4.0/tests/raw-entropy/validation-restart/extractlsb.c new/jitterentropy-library-3.4.1/tests/raw-entropy/validation-restart/extractlsb.c --- old/jitterentropy-library-3.4.0/tests/raw-entropy/validation-restart/extractlsb.c 2022-03-17 22:28:14.000000000 +0100 +++ new/jitterentropy-library-3.4.1/tests/raw-entropy/validation-restart/extractlsb.c 2022-08-31 08:08:36.000000000 +0200 @@ -198,7 +198,7 @@ res = strtok_r(buf, " ", &saveptr); if (!res) { - printf("strtok_r error\n"); + printf("strtok_r error (%s)\n", buf); return 1; } @@ -211,7 +211,7 @@ res = strtok_r(NULL, " ", &saveptr); if (!res) { - printf("strtok_r error\n"); + printf("strtok_r error (%s)\n", buf); return 1; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jitterentropy-library-3.4.0/tests/raw-entropy/validation-runtime/analyze_options.sh new/jitterentropy-library-3.4.1/tests/raw-entropy/validation-runtime/analyze_options.sh --- old/jitterentropy-library-3.4.0/tests/raw-entropy/validation-runtime/analyze_options.sh 2022-03-17 22:28:14.000000000 +0100 +++ new/jitterentropy-library-3.4.1/tests/raw-entropy/validation-runtime/analyze_options.sh 2022-08-31 08:08:36.000000000 +0200 @@ -75,32 +75,29 @@ calc_randmem() { local crunch=$1 - for memsize in 32768 65536 131072 262144 524288 1048576 2097152 4194304 8388608 16777216 33554432 67108864 134217728 268435456 536870912 + for bits in 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 do - for bits in 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 - do - local target="$RES_DIR-random_memaccess-${bits}bits-${memsize}bytes" - local source="$ENT_DIR-random_memaccess-${bits}bits-${memsize}bytes" + local target="$RES_DIR-random_memaccess-${bits}bits" + local source="$ENT_DIR-random_memaccess-${bits}bits" - if [ ! -d "$source" ] - then - continue - fi + if [ ! -d "$source" ] + then + continue + fi - if [ $randmem_written -eq 0 ] - then - echo -e "Max memory size\tNumber of bits\tmin entropy" > $RESULT - randmem_written=1 - fi + if [ $randmem_written -eq 0 ] + then + echo -e "Number of bits\tmin entropy" > $RESULT + randmem_written=1 + fi - if [ $crunch -eq 0 ] - then - ent=$(grep min $target/jent-raw-noise-0001.minentropy_FF_8bits.var.txt | cut -d ":" -f 2) - echo -e "$memsize\t$bits\t$ent" >> $RESULT - else - crunch_numbers $source $target - fi - done + if [ $crunch -eq 0 ] + then + ent=$(grep min $target/jent-raw-noise-0001.minentropy_FF_8bits.var.txt | cut -d ":" -f 2) + echo -e "$bits\t$ent" >> $RESULT + else + crunch_numbers $source $target + fi done } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jitterentropy-library-3.4.0/tests/raw-entropy/validation-runtime/draw_graph_analyze_options.r new/jitterentropy-library-3.4.1/tests/raw-entropy/validation-runtime/draw_graph_analyze_options.r --- old/jitterentropy-library-3.4.0/tests/raw-entropy/validation-runtime/draw_graph_analyze_options.r 1970-01-01 01:00:00.000000000 +0100 +++ new/jitterentropy-library-3.4.1/tests/raw-entropy/validation-runtime/draw_graph_analyze_options.r 2022-08-31 08:08:36.000000000 +0200 @@ -0,0 +1,41 @@ +# Plot data from IRQ duration table +# +# 1. create results-runtime-multi with analyze_options.sh: +# +# $ cat results-runtime-multi +# Number of bits min entropy +# 10 0.406505 +# 11 0.445082 +# 12 0.402972 +# 13 0.459021 +# 14 0.436911 +# 15 0.578995 +# 16 0.643272 +# 17 0.573532 +# 18 0.627915 +# 19 0.503923 +# 20 0.720609 +# 21 1.871527 +# 22 2.491569 +# 23 2.481533 +# 24 2.493987 +# 25 2.491303 +# 26 2.495017 +# +# 2. Generate plot: Rscript --vanilla draw_graph_analyze_options.r results-runtime-multi +# + +args <- commandArgs(trailingOnly = TRUE) + +if (length(args) != 1) { + stop("Invoke with <input file>") +} + +file <- args[1] + +data <- read.csv(file=file, header=TRUE, sep="\t") + +pdf("memory_access_times.pdf", width=8, height=5, pointsize=10) + +# print software +plot(data[,1], data[,2], type="b", col="red", main="Memory Access Time Variations", pch=19, xlab="Memory size in powers of 2", ylab="SP800-90B Min Entropy", ylim=c(min(data[,2]), max(data[,2])))