comparison libtomcrypt/src/stream/chacha/chacha_keystream.c @ 1471:6dba84798cd5

Update to libtomcrypt 1.18.1, merged with Dropbear changes
author Matt Johnston <matt@ucc.asn.au>
date Fri, 09 Feb 2018 21:44:05 +0800
parents
children
comparison
equal deleted inserted replaced
1470:8bba51a55704 1471:6dba84798cd5
1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis
2 *
3 * LibTomCrypt is a library that provides various cryptographic
4 * algorithms in a highly modular and flexible manner.
5 *
6 * The library is free for all purposes without any express
7 * guarantee it works.
8 */
9
10 /* The implementation is based on:
11 * chacha-ref.c version 20080118
12 * Public domain from D. J. Bernstein
13 */
14
15 #include "tomcrypt.h"
16
17 #ifdef LTC_CHACHA
18
19 /**
20 Generate a stream of random bytes via ChaCha
21 @param st The ChaCha20 state
22 @param out [out] The output buffer
23 @param outlen The output length
24 @return CRYPT_OK on success
25 */
26 int chacha_keystream(chacha_state *st, unsigned char *out, unsigned long outlen)
27 {
28 if (outlen == 0) return CRYPT_OK; /* nothing to do */
29 LTC_ARGCHK(out != NULL);
30 XMEMSET(out, 0, outlen);
31 return chacha_crypt(st, out, outlen, out);
32 }
33
34 #endif
35
36 /* ref: $Format:%D$ */
37 /* git commit: $Format:%H$ */
38 /* commit time: $Format:%ai$ */