mirror of
https://github.com/martijnvanbrummelen/nwipe.git
synced 2026-02-22 06:52:12 +00:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9c63eef565 | ||
|
|
db9e7ef1aa | ||
|
|
7039f381af | ||
|
|
c6fa743f15 | ||
|
|
61e8e4663f | ||
|
|
ea198137de | ||
|
|
263d5d161f | ||
|
|
15c444e2eb | ||
|
|
1e1eadbc0a | ||
|
|
51d33b9f61 |
10
README
10
README
@@ -18,6 +18,16 @@ Martijn van Brummelen
|
||||
RELEASE NOTES
|
||||
=============
|
||||
|
||||
v0.21
|
||||
- Fix ETA not updating properly and bad total throughput display. Thanks (Niels Bassler).
|
||||
|
||||
v0.20
|
||||
- Fix build when panel header is not in /usr/include (Thanks Vincent Untz).
|
||||
|
||||
v0.19
|
||||
- Fix building on Fedora(Unknown off64_t) bug #19.
|
||||
- Use PRNG instead of zero's bug #7. Thanks xambroz.
|
||||
|
||||
v0.18
|
||||
=====
|
||||
- Fixed grammar.
|
||||
|
||||
13
configure.ac
13
configure.ac
@@ -2,8 +2,8 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ([2.64])
|
||||
AC_INIT(nwipe, 0.18, git@brumit.nl)
|
||||
AM_INIT_AUTOMAKE(nwipe, 0.18)
|
||||
AC_INIT(nwipe, 0.21, git@brumit.nl)
|
||||
AM_INIT_AUTOMAKE(nwipe, 0.21)
|
||||
AC_OUTPUT(Makefile src/Makefile man/Makefile)
|
||||
AC_CONFIG_SRCDIR([src/nwipe.c])
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
@@ -21,7 +21,14 @@ PKG_CHECK_MODULES(
|
||||
CFLAGS="${CFLAGS} ${PANEL_CFLAGS}"
|
||||
LIBS="${LIBS} ${PANEL_LIBS}"
|
||||
],
|
||||
[AC_CHECK_LIB([panel], [main], ,[AC_MSG_ERROR([ncurses panel library not found])])]
|
||||
[AC_CHECK_LIB([panel], [main], [
|
||||
LIBS="-lpanel $LIBS"
|
||||
AC_CHECK_HEADERS(panel.h,, [
|
||||
AC_CHECK_HEADERS(ncurses/panel.h, [
|
||||
AC_DEFINE([PANEL_IN_SUBDIR], [ncurses/], [Look for ncurses headers in subdir])
|
||||
], [AC_MSG_ERROR([ncurses panel headers not found])])
|
||||
])
|
||||
], [AC_MSG_ERROR([ncurses panel library not found])])]
|
||||
)
|
||||
|
||||
PKG_CHECK_MODULES(
|
||||
|
||||
@@ -2036,6 +2036,9 @@ int compute_stats(void *ptr)
|
||||
int i;
|
||||
|
||||
time_t nwipe_time_now = time( NULL );
|
||||
|
||||
nwipe_misc_thread_data->throughput = 0;
|
||||
nwipe_misc_thread_data->maxeta = 0;
|
||||
|
||||
/* Enumerate all contexts to compute statistics. */
|
||||
for( i = 0 ; i < count ; i++ )
|
||||
|
||||
12
src/nwipe.h
12
src/nwipe.h
@@ -31,6 +31,11 @@
|
||||
#define _FILE_OFFSET_BITS 64
|
||||
#endif
|
||||
|
||||
/* workaround for Fedora */
|
||||
#ifndef off64_t
|
||||
# define off64_t off_t
|
||||
#endif
|
||||
|
||||
/* Busybox headers. */
|
||||
#ifdef BB_VER
|
||||
#include "busybox.h"
|
||||
@@ -65,12 +70,15 @@ extern int log_current_element;
|
||||
extern int log_elements_allocated;
|
||||
extern pthread_mutex_t mutex1;
|
||||
|
||||
/* Ncurses headers. Assume panel.h is in same place.*/
|
||||
/* Ncurses headers. */
|
||||
#ifdef NCURSES_IN_SUBDIR
|
||||
#include <ncurses/ncurses.h>
|
||||
#include <ncurses/panel.h>
|
||||
#else
|
||||
#include <ncurses.h>
|
||||
#endif
|
||||
#ifdef PANEL_IN_SUBDIR
|
||||
#include <ncurses/panel.h>
|
||||
#else
|
||||
#include <panel.h>
|
||||
#endif
|
||||
|
||||
|
||||
38
src/prng.c
38
src/prng.c
@@ -25,6 +25,7 @@
|
||||
#include "mt19937ar-cok.h"
|
||||
#include "isaac_rand.h"
|
||||
|
||||
|
||||
nwipe_prng_t nwipe_twister =
|
||||
{
|
||||
"Mersenne Twister (mt19937ar-cok)",
|
||||
@@ -40,6 +41,25 @@ nwipe_prng_t nwipe_isaac =
|
||||
};
|
||||
|
||||
|
||||
/* Print given number of bytes from unsigned integer number to a byte stream buffer starting with low-endian*/
|
||||
int nwipe_u32tobuffer(u8 *buffer, u32 rand, int len)
|
||||
{
|
||||
int i;
|
||||
u8 c; //single char
|
||||
if (len > sizeof(u32))
|
||||
{
|
||||
nwipe_log( NWIPE_LOG_FATAL, "Tried to print longer number than the value passed." );
|
||||
len = sizeof(u32);
|
||||
}
|
||||
|
||||
for (i=0 ; i < len; i++)
|
||||
{
|
||||
c=rand & 0xFFUL;
|
||||
rand = rand >> 8;
|
||||
buffer[i]=c;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int nwipe_twister_init( NWIPE_PRNG_INIT_SIGNATURE )
|
||||
{
|
||||
@@ -54,21 +74,23 @@ int nwipe_twister_init( NWIPE_PRNG_INIT_SIGNATURE )
|
||||
|
||||
int nwipe_twister_read( NWIPE_PRNG_READ_SIGNATURE )
|
||||
{
|
||||
u32 i=0;
|
||||
u32 ii;
|
||||
u32 words = count / sizeof( u32 );
|
||||
u32 remain = count % sizeof( u32 );
|
||||
u32 words = count / SIZE_OF_TWISTER ; // the values of twister_genrand_int32 is strictly 4 bytes
|
||||
u32 remain = count % SIZE_OF_TWISTER ; // the values of twister_genrand_int32 is strictly 4 bytes
|
||||
|
||||
/* Twister returns 4-bytes per call, so cast the buffer into words. */
|
||||
/* Twister returns 4-bytes per call, so progress by 4 bytes. */
|
||||
for( ii = 0; ii < words; ++ii )
|
||||
{
|
||||
((u32*)buffer)[ii] = twister_genrand_int32( (twister_state_t*)*state );
|
||||
nwipe_u32tobuffer((u8*)(buffer+i), twister_genrand_int32( (twister_state_t*)*state ), SIZE_OF_TWISTER) ;
|
||||
i = i + SIZE_OF_TWISTER;
|
||||
}
|
||||
|
||||
/* Fill the buffer tail if the count is not evenly divided by the size of u32. */
|
||||
for( ii = 1; ii <= remain; ++ii )
|
||||
/* If there is some remainder copy only relevant number of bytes to not
|
||||
* overflow the buffer. */
|
||||
if ( remain > 0 )
|
||||
{
|
||||
/* Notice how three bytes are discarded by doing this. */
|
||||
((u8*)buffer)[count-ii] = twister_genrand_int32( (twister_state_t*)*state );
|
||||
nwipe_u32tobuffer((u8*)(buffer+i), twister_genrand_int32( (twister_state_t*)*state ), remain) ;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -51,6 +51,10 @@ int nwipe_twister_read( NWIPE_PRNG_READ_SIGNATURE );
|
||||
int nwipe_isaac_init( NWIPE_PRNG_INIT_SIGNATURE );
|
||||
int nwipe_isaac_read( NWIPE_PRNG_READ_SIGNATURE );
|
||||
|
||||
/* Size of the twister is not derived from the architecture, but it is strictly 4 bytes */
|
||||
#define SIZE_OF_TWISTER 4
|
||||
|
||||
|
||||
#endif /* PRNG_H_ */
|
||||
|
||||
/* eof */
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* used by configure to dynamically assign those values
|
||||
* to documentation files.
|
||||
*/
|
||||
const char *version_string = "0.18";
|
||||
const char *version_string = "0.21";
|
||||
const char *program_name = "nwipe";
|
||||
const char *author_name = "Martijn van Brummelen";
|
||||
const char *email_address = "git@brumit.nl";
|
||||
|
||||
Reference in New Issue
Block a user