diff options
author | Dag-Erling Smørgrav <des@FreeBSD.org> | 2017-04-22 01:06:23 +0000 |
---|---|---|
committer | Dag-Erling Smørgrav <des@FreeBSD.org> | 2017-04-22 01:06:23 +0000 |
commit | f03be66539c3d86aba8993911a85038a7762e701 (patch) | |
tree | 38814e53125a5bc5edba51ecc7bd52b12cb9acaf | |
parent | 0596f343f8146ff2b9196739a65e2261f4694c91 (diff) |
Notes
-rw-r--r-- | sys/crypto/chacha20/chacha20.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/sys/crypto/chacha20/chacha20.c b/sys/crypto/chacha20/chacha20.c index 8f68b413a88b..4efab0604e7b 100644 --- a/sys/crypto/chacha20/chacha20.c +++ b/sys/crypto/chacha20/chacha20.c @@ -130,7 +130,6 @@ size_t chacha20_encrypt(chacha20_ctx *ctx, const void *vpt, uint8_t *ct, size_t len) { const uint8_t *pt = vpt; - uint64_t ctr; uint32_t mix[16]; uint8_t ks[64]; unsigned int b, i; @@ -157,8 +156,8 @@ chacha20_encrypt(chacha20_ctx *ctx, const void *vpt, uint8_t *ct, size_t len) for (i = 0; i < 64 && i < len; ++i) *ct++ = *pt++ ^ ks[i]; } - ctr = le64dec(ctx->state + 12); - le64enc(ctx->state + 12, ++ctr); + if (++ctx->state[12] == 0) + ++ctx->state[13]; } return (len); } |