#include "tfcrypt.h"
#include "tfcore.h"
+static void exit_sigterm_skein(int signal)
+{
+ if (xexit_no_nl == YES) xexit_no_nl = NO;
+ exit_sigterm(signal);
+}
+
void skein(void *hash, size_t bits, const void *key, const void *data, size_t szdata)
{
struct skein sk;
tfc_byte *pblk;
size_t ldone, lblock, lrem, lio;
tfc_fsize total = 0;
- tfc_yesno stop;
if (ctr_mode == TFC_MODE_SKSUM) total_processed_src = total_processed_dst = delta_processed = 0;
else skein_init(&sk, bits);
errno = 0;
- stop = NO;
+ do_stop = NO;
while (1) {
- if (stop) break;
+ if (do_stop) break;
pblk = skblk;
lblock = lrem = blk_len_adj(readto, total, TFC_BLKSIZE);
ldone = 0;
if (error_action == TFC_ERRACT_SYNC) rdpos = tfc_fdgetpos(fd);
_again: lio = xread(fd, pblk, lrem);
- if (lio == 0) stop = YES;
+ if (lio == 0) do_stop = YES;
if (lio != NOSIZE) ldone += lio;
else {
if (errno != EIO && catch_all_errors != YES) goto _fail;
skein_final(hash, &sk);
if (ctr_mode == TFC_MODE_SKSUM) {
- if (verbose || status_timer) print_crypt_status(-1);
+ if (verbose || status_timer) {
+ print_crypt_status(-1);
+ tfc_esay("\n");
+ }
total_processed_src = total_processed_dst = delta_processed = 0;
}
memset(skblk, 0, TFC_BLKSIZE);
int x = 0, xx;
size_t bits;
+ xexit_no_nl = YES;
+
if (macbits < TF_MAX_BITS) {
bits = macbits;
goto _dothat;
sigaction(SIGQUIT, &sigact, NULL);
sigact.sa_handler = change_status_timer;
sigaction(SIGUSR2, &sigact, NULL);
- sigact.sa_handler = exit_sigterm;
+ sigact.sa_handler = exit_sigterm_skein;
sigaction(SIGINT, &sigact, NULL);
sigaction(SIGTERM, &sigact, NULL);
sigact.sa_handler = handle_sigtstp;
s = strchr(shash, ' ');
if (s && s[1] == ' ') *s = 0;
- fd = open(fname, O_RDONLY | O_LARGEFILE);
+ fd = xxopen(YES, fname, O_RDONLY | O_LARGEFILE);
if (fd == -1) {
xerror(YES, NO, YES, "%s", fname);
exitcode = 1;
for (x = 0; fargv[x] && xx; x++) {
if (!strcmp(fargv[x], "-")) fd = 0;
- else fd = open(fargv[x], O_RDONLY | O_LARGEFILE);
+ else fd = xxopen(YES, fargv[x], O_RDONLY | O_LARGEFILE);
if (fd == -1) {
xerror(YES, NO, YES, "%s", fargv[x]);
exitcode = 1;