File: crypto_core_hsalsa20.c

package info (click to toggle)
dq 20230101-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,020 kB
  • sloc: ansic: 8,269; makefile: 363; sh: 176; python: 82
file content (18 lines) | stat: -rw-r--r-- 564 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include "salsa.h"
#include "uint32_unpack.h"
#include "cleanup.h"
#include "crypto_core_hsalsa20.h"

int crypto_core_hsalsa20_tinynacl(unsigned char *o, const unsigned char *nn, const unsigned char *kk, const unsigned char *cc) {

    crypto_uint32 k[8], n[4], c[4];
    long long i;

    for (i = 0; i < 8; ++i) k[i] = uint32_unpack(kk + 4 * i);
    for (i = 0; i < 4; ++i) n[i] = uint32_unpack(nn + 4 * i);
    for (i = 0; i < 4; ++i) c[i] = uint32_unpack(cc + 4 * i);

    salsa_core(o, n, k, c, 1, 20);
    cleanup(k); cleanup(n); cleanup(c);
    return 0;
}