projects
/
tfcrypt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
-O readloops=n: read source repeatedly n times (by default disabled).
[tfcrypt.git]
/
tfc_base64.c
diff --git
a/tfc_base64.c
b/tfc_base64.c
index 2498004d7211e13c164f9839022b0f8686b9815e..68f0677998db07d6046e1edf8e8af87ae17711fb 100644
(file)
--- a/
tfc_base64.c
+++ b/
tfc_base64.c
@@
-2,7
+2,7
@@
* tfcrypt -- high security Threefish encryption tool.
*
* tfcrypt is copyrighted:
* tfcrypt -- high security Threefish encryption tool.
*
* tfcrypt is copyrighted:
- * Copyright (C) 2012-201
8
Andrey Rys. All rights reserved.
+ * Copyright (C) 2012-201
9
Andrey Rys. All rights reserved.
*
* tfcrypt is licensed to you under the terms of std. MIT/X11 license:
*
*
* tfcrypt is licensed to you under the terms of std. MIT/X11 license:
*
@@
-28,12
+28,16
@@
#include "tfcrypt.h"
#include "tfcrypt.h"
+enum { TFB64_STOP1 = 1, TFB64_STOPF };
+
void do_edbase64(char **fargv)
{
struct base64_decodestate dstate;
struct base64_encodestate estate;
size_t lread = 0;
void do_edbase64(char **fargv)
{
struct base64_decodestate dstate;
struct base64_encodestate estate;
size_t lread = 0;
+ xexit_no_nl = YES;
+
sfd = 0; dfd = 1;
if (fargv[0]) {
sfd = 0; dfd = 1;
if (fargv[0]) {
@@
-69,8
+73,8
@@
void do_edbase64(char **fargv)
lblock = lrem = do_edcrypt == TFC_DO_DECRYPT ? TFC_B64_DWIDTH : TFC_B64_EWIDTH;
ldone = 0;
if (error_action == TFC_ERRACT_SYNC) rdpos = tfc_fdgetpos(sfd);
lblock = lrem = do_edcrypt == TFC_DO_DECRYPT ? TFC_B64_DWIDTH : TFC_B64_EWIDTH;
ldone = 0;
if (error_action == TFC_ERRACT_SYNC) rdpos = tfc_fdgetpos(sfd);
-_again: lio = read(sfd, pblk, lrem);
- if (lio == 0) do_stop =
YES
;
+_again: lio =
x
read(sfd, pblk, lrem);
+ if (lio == 0) do_stop =
TFB64_STOP1
;
if (lio != NOSIZE) ldone += lio;
else {
if (errno != EIO && catch_all_errors != YES)
if (lio != NOSIZE) ldone += lio;
else {
if (errno != EIO && catch_all_errors != YES)
@@
-108,18
+112,18
@@
_again: lio = read(sfd, pblk, lrem);
pblk = dstblk;
if (ldone == 0) {
pblk = dstblk;
if (ldone == 0) {
- do_stop = TF
C_STOP_FULL
;
+ do_stop = TF
B64_STOPF
;
break;
}
lrem = ldone;
ldone = 0;
break;
}
lrem = ldone;
ldone = 0;
-_wagain: lio = write(dfd, pblk, lrem);
+_wagain: lio =
x
write(dfd, pblk, lrem);
if (lio != NOSIZE) ldone += lio;
else xerror(NO, NO, NO, "%s", fargv[1]);
if (do_edcrypt == TFC_DO_ENCRYPT) {
size_t t;
if (lio != NOSIZE) ldone += lio;
else xerror(NO, NO, NO, "%s", fargv[1]);
if (do_edcrypt == TFC_DO_ENCRYPT) {
size_t t;
- if (lread >= lblock || do_stop == TF
C_STOP_FULL
) {
- t = write(dfd, "\n", 1);
+ if (lread >= lblock || do_stop == TF
B64_STOPF
) {
+ t =
x
write(dfd, "\n", 1);
if (t != NOSIZE) lio += t;
else lio = NOSIZE;
}
if (t != NOSIZE) lio += t;
else lio = NOSIZE;
}
@@
-134,19
+138,18
@@
_wagain: lio = write(dfd, pblk, lrem);
}
}
}
}
- if (do_edcrypt == TFC_DO_ENCRYPT && do_stop == TF
C_STOP_BEGAN
) {
+ if (do_edcrypt == TFC_DO_ENCRYPT && do_stop == TF
B64_STOP1
) {
size_t t = estate.count;
pblk = dstblk + estate.count;
base64_encode_blockend((char *)dstblk, &estate);
lrem = estate.count - t;
ldone = 0;
size_t t = estate.count;
pblk = dstblk + estate.count;
base64_encode_blockend((char *)dstblk, &estate);
lrem = estate.count - t;
ldone = 0;
- do_stop = TF
C_STOP_FULL
;
+ do_stop = TF
B64_STOPF
;
goto _wagain;
}
memset(&estate, 0, sizeof(struct base64_encodestate));
memset(&dstate, 0, sizeof(struct base64_decodestate));
goto _wagain;
}
memset(&estate, 0, sizeof(struct base64_encodestate));
memset(&dstate, 0, sizeof(struct base64_decodestate));
- if (do_preserve_time) fcopy_matime(dfd, &s_stat);
xexit(0);
}
xexit(0);
}