Lines Matching +full:12 +full:v
1 /* $OpenBSD: chacha.c,v 1.2 2023/07/17 05:26:38 djm Exp $ */
17 #define U8C(v) (v##U) argument
18 #define U32C(v) (v##U) argument
20 #define U8V(v) ((u8)(v) & U8C(0xFF)) argument
21 #define U32V(v) ((u32)(v) & U32C(0xFFFFFFFF)) argument
23 #define ROTL32(v, n) \ argument
24 (U32V((v) << (n)) | ((v) >> (32 - (n))))
32 #define U32TO8_LITTLE(p, v) \ argument
34 (p)[0] = U8V((v) ); \
35 (p)[1] = U8V((v) >> 8); \
36 (p)[2] = U8V((v) >> 16); \
37 (p)[3] = U8V((v) >> 24); \
40 #define ROTATE(v,c) (ROTL32(v,c)) argument
41 #define XOR(v,w) ((v) ^ (w)) argument
42 #define PLUS(v,w) (U32V((v) + (w))) argument
43 #define PLUSONE(v) (PLUS((v),1)) argument
47 c = PLUS(c,d); b = ROTATE(XOR(b,c),12); \
62 x->input[7] = U8TO32_LITTLE(k + 12); in chacha_keysetup()
72 x->input[11] = U8TO32_LITTLE(k + 12); in chacha_keysetup()
76 x->input[3] = U8TO32_LITTLE(constants + 12); in chacha_keysetup()
82 x->input[12] = counter == NULL ? 0 : U8TO32_LITTLE(counter + 0); in chacha_ivsetup()
111 j12 = x->input[12]; in chacha_encrypt_bytes()
169 x3 = XOR(x3,U8TO32_LITTLE(m + 12)); in chacha_encrypt_bytes()
192 U32TO8_LITTLE(c + 12,x3); in chacha_encrypt_bytes()
210 x->input[12] = j12; in chacha_encrypt_bytes()