~mdw
/
catacomb
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
symm/ecb-def.h: Simplify the discarding-output path.
[catacomb]
/
symm
/
ecb-def.h
diff --git
a/symm/ecb-def.h
b/symm/ecb-def.h
index
957a16e
..
c69790d
100644
(file)
--- a/
symm/ecb-def.h
+++ b/
symm/ecb-def.h
@@
-126,9
+126,9
@@
void pre##_ecbencrypt(pre##_ecbctx *ctx, \
octet y; \
unsigned i; \
\
octet y; \
unsigned i; \
\
- /* --- Empty blocks are trivial
--- */
\
+ /* --- Empty blocks are trivial
, and ECB is stateless --- */
\
\
\
- if (!sz
) return;
\
+ if (!sz
|| !d) return;
\
\
/* --- Short blocks aren't allowed in ECB --- * \
* \
\
/* --- Short blocks aren't allowed in ECB --- * \
* \
@@
-149,7
+149,7
@@
void pre##_ecbencrypt(pre##_ecbctx *ctx, \
if (!s) BLKC_ZERO(PRE, t); \
else { BLKC_LOAD(PRE, t, s); s += PRE##_BLKSZ; } \
pre##_eblk(&ctx->ctx, t, t); \
if (!s) BLKC_ZERO(PRE, t); \
else { BLKC_LOAD(PRE, t, s); s += PRE##_BLKSZ; } \
pre##_eblk(&ctx->ctx, t, t); \
-
if (d) { BLKC_STORE(PRE, d, t); d += PRE##_BLKSZ; }
\
+
BLKC_STORE(PRE, d, t); d += PRE##_BLKSZ;
\
sz -= PRE##_BLKSZ; \
} \
\
sz -= PRE##_BLKSZ; \
} \
\
@@
-183,11
+183,11
@@
void pre##_ecbencrypt(pre##_ecbctx *ctx, \
* ciphertext block. \
*/ \
\
* ciphertext block. \
*/ \
\
-
if (d) d += PRE##_BLKSZ;
\
- for (i = 0; i < sz; i++) { y = b[i]; b[i] = s[i];
if (d) d[i] = y; }
\
+
d += PRE##_BLKSZ;
\
+ for (i = 0; i < sz; i++) { y = b[i]; b[i] = s[i];
d[i] = y; }
\
BLKC_LOAD(PRE, t, b); \
pre##_eblk(&ctx->ctx, t, t); \
BLKC_LOAD(PRE, t, b); \
pre##_eblk(&ctx->ctx, t, t); \
-
if (d) BLKC_STORE(PRE, d - PRE##_BLKSZ, t);
\
+
BLKC_STORE(PRE, d - PRE##_BLKSZ, t);
\
} \
\
/* --- Done --- */ \
} \
\
/* --- Done --- */ \