summaryrefslogtreecommitdiff
path: root/chacha-set-nonce.c
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2015-01-30 14:37:59 +0100
committerNiels Möller <nisse@lysator.liu.se>2015-01-30 14:37:59 +0100
commitc631998044731bfa576cc5cee9d45ab17b808bbf (patch)
tree5a161ba39e67d29a588eba134e5c5273cb55cd1f /chacha-set-nonce.c
parentd54ad2d51178c444faf388e03364aaad0b4783b2 (diff)
downloadnettle-c631998044731bfa576cc5cee9d45ab17b808bbf.tar.gz
New function chacha_set_nonce96.
Diffstat (limited to 'chacha-set-nonce.c')
-rw-r--r--chacha-set-nonce.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/chacha-set-nonce.c b/chacha-set-nonce.c
index e73babce..607f176b 100644
--- a/chacha-set-nonce.c
+++ b/chacha-set-nonce.c
@@ -59,3 +59,12 @@ chacha_set_nonce(struct chacha_ctx *ctx, const uint8_t *nonce)
ctx->state[14] = LE_READ_UINT32(nonce + 0);
ctx->state[15] = LE_READ_UINT32(nonce + 4);
}
+
+void
+chacha_set_nonce96(struct chacha_ctx *ctx, const uint8_t *nonce)
+{
+ ctx->state[12] = 0;
+ ctx->state[13] = LE_READ_UINT32(nonce + 0);
+ ctx->state[14] = LE_READ_UINT32(nonce + 4);
+ ctx->state[15] = LE_READ_UINT32(nonce + 8);
+}