projects
/
tfcrypt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
-X: add simple XOR mode (embedded xor tool)
[tfcrypt.git]
/
tfstream.c
diff --git
a/tfstream.c
b/tfstream.c
index b64d4d9243b8ae090b6af613f05e9a405267975d..6f52a329ab5ece70fef11c163d5492d3770ddcee 100644
(file)
--- a/
tfstream.c
+++ b/
tfstream.c
@@
-4,19
+4,6
@@
void tf_stream_crypt(struct tfe_stream *tfe, void *out, const void *in, size_t sz)
{
void tf_stream_crypt(struct tfe_stream *tfe, void *out, const void *in, size_t sz)
{
- const TF_UNIT_TYPE *uin = in;
- TF_UNIT_TYPE *uout = out;
- const TF_BYTE_TYPE *uuin = in;
- TF_BYTE_TYPE *uuout = out;
- size_t n, z, x;
-
- switch (TF_SIZE_UNIT) {
- case 2: n = 1; break;
- case 4: n = 2; break;
- case 8: n = 3; break;
- }
-
tfe_emit(out, sz, tfe);
tfe_emit(out, sz, tfe);
- for (z = 0; z < (sz >> n); z++) uout[z] ^= uin[z];
- if (sz - (z << n)) for (x = (z << n); x < sz; x++) uuout[x] ^= uuin[x];
+ xor_block(out, in, sz);
}
}