Coverage Report

Created: 2025-11-09 06:08

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/dropbear/libtomcrypt/src/stream/chacha/chacha_keystream.c
Line
Count
Source
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
255k
{
28
255k
   if (outlen == 0) return CRYPT_OK; /* nothing to do */
29
255k
   LTC_ARGCHK(out != NULL);
30
255k
   XMEMSET(out, 0, outlen);
31
255k
   return chacha_crypt(st, out, outlen, out);
32
255k
}
33
34
#endif
35
36
/* ref:         $Format:%D$ */
37
/* git commit:  $Format:%H$ */
38
/* commit time: $Format:%ai$ */