Skip to content

Commit

Permalink
Updated Copyright message (year). Added log messages
Browse files Browse the repository at this point in the history
Jirka Hladky committed Dec 31, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 98ead65 commit fc4a994
Showing 13 changed files with 45 additions and 32 deletions.
34 changes: 22 additions & 12 deletions src/havege.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
** Simple entropy harvester based upon the havege RNG
**
** Copyright 2018-2021 Jirka Hladky hladky DOT jiri AT gmail DOT com
** Copyright 2018-2022 Jirka Hladky hladky DOT jiri AT gmail DOT com
** Copyright 2009-2014 Gary Wuertz [email protected]
** Copyright 2011-2012 BenEleventh Consulting [email protected]
**
@@ -317,7 +317,7 @@ int havege_status_dump( /* RETURN: output length */
{
struct h_status status;
int n = 0;

if (buf != 0) {
*buf = 0;
len -= 1;
@@ -346,7 +346,7 @@ int havege_status_dump( /* RETURN: output length */
case H_SD_TOPIC_TEST:
{
H_UINT m;

if (strlen(status.tot_tests)>0) {
n += snprintf(buf+n, len-n, "tot tests(%s): ", status.tot_tests);
if ((m = status.n_tests[ H_OLT_TOT_A_P] + status.n_tests[ H_OLT_TOT_A_F])>0)
@@ -368,19 +368,29 @@ int havege_status_dump( /* RETURN: output length */
case H_SD_TOPIC_SUM:
{
char units[] = {'T', 'G', 'M', 'K', 0};
double factor = 1024.0 * 1024.0 * 1024.0 * 1024.0;
double factor[2];
factor[0] = 1024.0 * 1024.0 * 1024.0 * 1024.0;
factor[1] = factor[0];
double sz = ((double)hptr->n_fills * hptr->i_collectSz) * sizeof(H_UINT);
int i;

for (i=0;0 != units[i];i++) {
if (sz >= factor)
double ent = ((double) hptr->n_entropy_bytes);
int i[2];

for (i[0]=0;0 != units[i[0]];i[0]++) {
if (sz >= factor[0])
break;
factor[0] /= 1024.0;
}
for (i[1]=0;0 != units[i[1]];i[1]++) {
if (ent >= factor[1])
break;
factor /= 1024.0;
factor[1] /= 1024.0;
}
n = snprintf(buf, len, "fills: %u, generated: %.4g %c bytes",
n = snprintf(buf, len, "fills: %u, generated: %.4g %c bytes, RNDADDENTROPY: %.4g %c bytes",
hptr->n_fills,
sz / factor,
units[i]
sz / factor[0],
units[i[0]],
ent / factor[1],
units[i[1]]
);
}
break;
7 changes: 4 additions & 3 deletions src/havege.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
** Simple entropy harvester based upon the havege RNG
**
** Copyright 2018-2021 Jirka Hladky hladky DOT jiri AT gmail DOT com
** Copyright 2018-2022 Jirka Hladky hladky DOT jiri AT gmail DOT com
** Copyright 2009-2014 Gary Wuertz [email protected]
** Copyright 2011-2012 BenEleventh Consulting [email protected]
**
@@ -56,7 +56,7 @@ typedef void (*pMsg)(const char *format, ...);
typedef int (*pRawIn)(volatile H_UINT *pData, H_UINT szData);
/**
* options for H_PARAMS below. Lower byte transferred from verbose settings
* upper byte set by diagnositic run options
* upper byte set by diagnositic run options
*/
#define H_VERBOSE 0x001 /* deprecated from ver 1.7 */
#define H_DEBUG_INFO 0x001 /* Show config info, retries */
@@ -72,7 +72,7 @@ typedef int (*pRawIn)(volatile H_UINT *pData, H_UINT szData);
/**
* Initialization parameters. Use non-zero values to override default values.
* Notes:
*
*
* 1) Correspondence between provided value and value of H_PTR members are:
* ioSz <==> i_readSz, collectSize <==> i_collectSz, nCores <==> n_cores,
* options <==> havege_opts
@@ -159,6 +159,7 @@ typedef struct h_anchor {
H_UINT m_sz; /* size of thread ipc area (bytes) */
H_UINT n_cores; /* number of cores */
H_UINT n_fills; /* number of buffer fills */
size_t n_entropy_bytes; /* total amount of entropy (byte) */
} *H_PTR;
/**
* Fail/Success counters for tot and production tests.
2 changes: 1 addition & 1 deletion src/havegecmd.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
** Provide HAVEGE socket communication API
**
** Copyright 2018-2021 Jirka Hladky hladky DOT jiri AT gmail DOT com
** Copyright 2018-2022 Jirka Hladky hladky DOT jiri AT gmail DOT com
** Copyright 2018 Werner Fink <[email protected]>
**
** This program is free software: you can redistribute it and/or modify
2 changes: 1 addition & 1 deletion src/havegecmd.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
** Provide HAVEGE socket communication API
**
** Copyright 2018-2021 Jirka Hladky hladky DOT jiri AT gmail DOT com
** Copyright 2018-2022 Jirka Hladky hladky DOT jiri AT gmail DOT com
** Copyright 2018 Werner Fink <[email protected]>
**
** This program is free software: you can redistribute it and/or modify
2 changes: 1 addition & 1 deletion src/havegecollect.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
** Simple entropy harvester based upon the havege RNG
**
** Copyright 2018-2021 Jirka Hladky hladky DOT jiri AT gmail DOT com
** Copyright 2018-2022 Jirka Hladky hladky DOT jiri AT gmail DOT com
** Copyright 2009-2014 Gary Wuertz [email protected]
** Copyright 2011-2012 BenEleventh Consulting [email protected]
**
2 changes: 1 addition & 1 deletion src/havegecollect.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
** Simple entropy harvester based upon the havege RNG
**
** Copyright 2018-2021 Jirka Hladky hladky DOT jiri AT gmail DOT com
** Copyright 2018-2022 Jirka Hladky hladky DOT jiri AT gmail DOT com
** Copyright 2009-2014 Gary Wuertz [email protected]
** Copyright 2011-2012 BenEleventh Consulting [email protected]
**
16 changes: 9 additions & 7 deletions src/haveged.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
** Simple entropy harvester based upon the havege RNG
**
** Copyright 2018-2021 Jirka Hladky hladky DOT jiri AT gmail DOT com
** Copyright 2018-2022 Jirka Hladky hladky DOT jiri AT gmail DOT com
** Copyright 2009-2014 Gary Wuertz [email protected]
** Copyright 2011-2012 BenEleventh Consulting [email protected]
**
@@ -60,7 +60,7 @@
// {{{ VERSION_TEXT
static const char* VERSION_TEXT =
"haveged %s\n\n"
"Copyright (C) 2018-2021 Jirka Hladky <[email protected]>\n"
"Copyright (C) 2018-2022 Jirka Hladky <[email protected]>\n"
"Copyright (C) 2009-2014 Gary Wuertz <[email protected]>\n"
"Copyright (C) 2011-2012 BenEleventh Consulting <[email protected]>\n\n"
"License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.\n"
@@ -655,9 +655,10 @@ static void run_daemon( /* RETURN: nothing */
/* entropy is 8 bits per byte */
output->entropy_count = nbytes * 8;
if (ioctl(random_fd, RNDADDENTROPY, output) == -1)
printf("Warning: RNDADDENTROPY failed!");
error_exit("RNDADDENTROPY failed!");
h->n_entropy_bytes += nbytes;
if (params->once == 1)
return;
error_exit("Entropy refilled once (%d bytes), exiting.", nbytes);
t[0] = t[1];
continue;
}
@@ -743,6 +744,7 @@ static void run_daemon( /* RETURN: nothing */
t[0] = t[1];
if (ioctl(random_fd, RNDADDENTROPY, output) == -1)
error_exit("RNDADDENTROPY failed!");
h->n_entropy_bytes += nbytes;
}
}
/**
@@ -801,7 +803,7 @@ void error_exit( /* RETURN: nothing */
#endif
{
fprintf(stderr, "%s: %s\n", params->daemon, buffer);
if (0 !=(params->setup & RUN_AS_APP) && 0 != handle) {
if (0 !=(params->setup & (RUN_AS_APP | RUN_IN_FG) ) && 0 != handle) {
if (havege_status_dump(handle, H_SD_TOPIC_TEST, buffer, sizeof(buffer))>0)
fprintf(stderr, "%s\n", buffer);
if (havege_status_dump(handle, H_SD_TOPIC_SUM, buffer, sizeof(buffer))>0)
@@ -824,7 +826,7 @@ static int get_runsize( /* RETURN: the size */
int p2 = 0;
int p10 = APP_BUFF_SIZE * sizeof(H_UINT);
long long ct;


f = strtod(bp, &suffix);
if (f < 0 || strlen(suffix)>1)
@@ -888,7 +890,7 @@ static char *ppSize( /* RETURN: the formatted size */
char units[] = {'T', 'G', 'M', 'K', 0};
double factor = 1024.0 * 1024.0 * 1024.0 * 1024.0;
int i;

for (i=0;0 != units[i];i++) {
if (sz >= factor)
break;
2 changes: 1 addition & 1 deletion src/haveged.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
** Simple entropy harvester based upon the havege RNG
**
** Copyright 2018-2021 Jirka Hladky hladky DOT jiri AT gmail DOT com
** Copyright 2018-2022 Jirka Hladky hladky DOT jiri AT gmail DOT com
** Copyright 2009-2014 Gary Wuertz [email protected]
**
** This program is free software: you can redistribute it and/or modify
2 changes: 1 addition & 1 deletion src/havegetest.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
** Simple entropy harvester based upon the havege RNG
**
** Copyright 2018-2021 Jirka Hladky hladky DOT jiri AT gmail DOT com
** Copyright 2018-2022 Jirka Hladky hladky DOT jiri AT gmail DOT com
** Copyright 2012-2014 Gary Wuertz [email protected]
** Copyright 2012 BenEleventh Consulting [email protected]
**
2 changes: 1 addition & 1 deletion src/havegetest.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
** Simple entropy harvester based upon the havege RNG
**
** Copyright 2018-2021 Jirka Hladky hladky DOT jiri AT gmail DOT com
** Copyright 2018-2022 Jirka Hladky hladky DOT jiri AT gmail DOT com
** Copyright 2012-2014 Gary Wuertz [email protected]
** Copyright 2012 BenEleventh Consulting [email protected]
**
2 changes: 1 addition & 1 deletion src/havegetune.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
** Determine HAVEGE environment
**
** Copyright 2018-2021 Jirka Hladky hladky DOT jiri AT gmail DOT com
** Copyright 2018-2022 Jirka Hladky hladky DOT jiri AT gmail DOT com
** Copyright 2009-2014 Gary Wuertz [email protected]
** Copyright 2011-2012 BenEleventh Consulting [email protected]
**
2 changes: 1 addition & 1 deletion src/havegetune.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
** Simple entropy harvester based upon the havege RNG
**
** Copyright 2018-2021 Jirka Hladky hladky DOT jiri AT gmail DOT com
** Copyright 2018-2022 Jirka Hladky hladky DOT jiri AT gmail DOT com
** Copyright 2009-2014 Gary Wuertz [email protected]
**
** This program is free software: you can redistribute it and/or modify
2 changes: 1 addition & 1 deletion src/oneiteration.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
** Simple entropy harvester based upon the havege RNG
**
** Copyright 2018-2021 Jirka Hladky hladky DOT jiri AT gmail DOT com
** Copyright 2018-2022 Jirka Hladky hladky DOT jiri AT gmail DOT com
** Copyright 2009-2013 Gary Wuertz [email protected]
**
** This program is free software: you can redistribute it and/or modify

0 comments on commit fc4a994

Please sign in to comment.