projects
/
tfcrypt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
-o logfile: logging to separate logfile instead of stderr.
[tfcrypt.git]
/
tfe.c
diff --git
a/tfe.c
b/tfe.c
index 544bcc7bed097f853140bb3c1f78ff3d5a6be8ce..eea50d36e46c45cc81b8e5ce0ac7be4bc8164c10 100644
(file)
--- a/
tfe.c
+++ b/
tfe.c
@@
-6,11
+6,7
@@
void tfe_init_iv(struct tfe_stream *tfe, const void *key, const void *iv)
{
memset(tfe, 0, sizeof(struct tfe_stream));
memcpy(tfe->key, key, TF_KEY_SIZE);
{
memset(tfe, 0, sizeof(struct tfe_stream));
memcpy(tfe->key, key, TF_KEY_SIZE);
- data_to_words(tfe->key, TF_KEY_SIZE);
- if (iv) {
- memcpy(tfe->iv, iv, TF_BLOCK_SIZE);
- data_to_words(tfe->iv, TF_BLOCK_SIZE);
- }
+ if (iv) memcpy(tfe->iv, iv, TF_BLOCK_SIZE);
tfe->carry_bytes = 0;
}
tfe->carry_bytes = 0;
}
@@
-53,9
+49,13
@@
void tfe_emit(void *dst, size_t szdst, struct tfe_stream *tfe)
}
if (sz) {
}
if (sz) {
+ TF_UNIT_TYPE t[TF_NR_BLOCK_UNITS];
+
tf_encrypt_rawblk(tfe->iv, tfe->iv, tfe->key);
tf_encrypt_rawblk(tfe->iv, tfe->iv, tfe->key);
- memcpy(udst, tfe->iv, sz);
- data_to_words(udst, TF_BLOCK_SIZE);
+ memcpy(t, tfe->iv, TF_BLOCK_SIZE);
+ data_to_words(t, TF_BLOCK_SIZE);
+ memcpy(udst, t, sz);
+ memset(t, 0, TF_BLOCK_SIZE);
udst = (TF_BYTE_TYPE *)tfe->iv;
tfe->carry_bytes = TF_BLOCK_SIZE-sz;
memcpy(tfe->carry_block, udst+sz, tfe->carry_bytes);
udst = (TF_BYTE_TYPE *)tfe->iv;
tfe->carry_bytes = TF_BLOCK_SIZE-sz;
memcpy(tfe->carry_block, udst+sz, tfe->carry_bytes);