diff options
Diffstat (limited to 'src/lib/libcrypto/chacha/chacha.c')
-rw-r--r-- | src/lib/libcrypto/chacha/chacha.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/libcrypto/chacha/chacha.c b/src/lib/libcrypto/chacha/chacha.c index b8422306fa..0c384ab88a 100644 --- a/src/lib/libcrypto/chacha/chacha.c +++ b/src/lib/libcrypto/chacha/chacha.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: chacha.c,v 1.6 2014/07/08 14:30:23 bcook Exp $ */ | 1 | /* $OpenBSD: chacha.c,v 1.7 2015/12/09 14:07:55 bcook Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> |
4 | * | 4 | * |
@@ -57,7 +57,7 @@ ChaCha(ChaCha_ctx *ctx, unsigned char *out, const unsigned char *in, size_t len) | |||
57 | 57 | ||
58 | void | 58 | void |
59 | CRYPTO_chacha_20(unsigned char *out, const unsigned char *in, size_t len, | 59 | CRYPTO_chacha_20(unsigned char *out, const unsigned char *in, size_t len, |
60 | const unsigned char key[32], const unsigned char iv[8], size_t counter) | 60 | const unsigned char key[32], const unsigned char iv[8], uint64_t counter) |
61 | { | 61 | { |
62 | struct chacha_ctx ctx; | 62 | struct chacha_ctx ctx; |
63 | 63 | ||
@@ -70,7 +70,7 @@ CRYPTO_chacha_20(unsigned char *out, const unsigned char *in, size_t len, | |||
70 | chacha_ivsetup(&ctx, iv, NULL); | 70 | chacha_ivsetup(&ctx, iv, NULL); |
71 | if (counter != 0) { | 71 | if (counter != 0) { |
72 | ctx.input[12] = (uint32_t)counter; | 72 | ctx.input[12] = (uint32_t)counter; |
73 | ctx.input[13] = (uint32_t)(((uint64_t)counter) >> 32); | 73 | ctx.input[13] = (uint32_t)(counter >> 32); |
74 | } | 74 | } |
75 | 75 | ||
76 | chacha_encrypt_bytes(&ctx, in, out, (uint32_t)len); | 76 | chacha_encrypt_bytes(&ctx, in, out, (uint32_t)len); |