• Home
  • Raw
  • Download

Lines Matching +full:- +full:j4

2 chacha-merged.c version 20080118
8 #include "lws-ssh.h"
35 (U32V((v) << (n)) | ((v) >> (32 - (n))))
62 static const char sigma[16] = "expand 32-byte k";
63 static const char tau[16] = "expand 16-byte k";
70 x->input[4] = U8TO32_LITTLE(k + 0); in chacha_keysetup()
71 x->input[5] = U8TO32_LITTLE(k + 4); in chacha_keysetup()
72 x->input[6] = U8TO32_LITTLE(k + 8); in chacha_keysetup()
73 x->input[7] = U8TO32_LITTLE(k + 12); in chacha_keysetup()
80 x->input[8] = U8TO32_LITTLE(k + 0); in chacha_keysetup()
81 x->input[9] = U8TO32_LITTLE(k + 4); in chacha_keysetup()
82 x->input[10] = U8TO32_LITTLE(k + 8); in chacha_keysetup()
83 x->input[11] = U8TO32_LITTLE(k + 12); in chacha_keysetup()
84 x->input[0] = U8TO32_LITTLE(constants + 0); in chacha_keysetup()
85 x->input[1] = U8TO32_LITTLE(constants + 4); in chacha_keysetup()
86 x->input[2] = U8TO32_LITTLE(constants + 8); in chacha_keysetup()
87 x->input[3] = U8TO32_LITTLE(constants + 12); in chacha_keysetup()
93 x->input[12] = counter == NULL ? 0 : U8TO32_LITTLE(counter + 0); in chacha_ivsetup()
94 x->input[13] = counter == NULL ? 0 : U8TO32_LITTLE(counter + 4); in chacha_ivsetup()
95 x->input[14] = U8TO32_LITTLE(iv + 0); in chacha_ivsetup()
96 x->input[15] = U8TO32_LITTLE(iv + 4); in chacha_ivsetup()
103 u32 j0, j1, j2, j3, j4, j5, j6, j7, j8, j9, j10, j11, j12, j13, j14, j15; in chacha_encrypt_bytes() local
110 j0 = x->input[0]; in chacha_encrypt_bytes()
111 j1 = x->input[1]; in chacha_encrypt_bytes()
112 j2 = x->input[2]; in chacha_encrypt_bytes()
113 j3 = x->input[3]; in chacha_encrypt_bytes()
114 j4 = x->input[4]; in chacha_encrypt_bytes()
115 j5 = x->input[5]; in chacha_encrypt_bytes()
116 j6 = x->input[6]; in chacha_encrypt_bytes()
117 j7 = x->input[7]; in chacha_encrypt_bytes()
118 j8 = x->input[8]; in chacha_encrypt_bytes()
119 j9 = x->input[9]; in chacha_encrypt_bytes()
120 j10 = x->input[10]; in chacha_encrypt_bytes()
121 j11 = x->input[11]; in chacha_encrypt_bytes()
122 j12 = x->input[12]; in chacha_encrypt_bytes()
123 j13 = x->input[13]; in chacha_encrypt_bytes()
124 j14 = x->input[14]; in chacha_encrypt_bytes()
125 j15 = x->input[15]; in chacha_encrypt_bytes()
138 x4 = j4; in chacha_encrypt_bytes()
150 for (i = 20;i > 0;i -= 2) { in chacha_encrypt_bytes()
164 x4 = PLUS(x4,j4); in chacha_encrypt_bytes()
220 x->input[12] = j12; in chacha_encrypt_bytes()
221 x->input[13] = j13; in chacha_encrypt_bytes()
224 bytes -= 64; in chacha_encrypt_bytes()
234 #define K_1(_keys) &((struct lws_cipher_chacha *)_keys->cipher)->ccctx[0]
235 #define K_2(_keys) &((struct lws_cipher_chacha *)_keys->cipher)->ccctx[1]
240 if (keys->cipher) { in lws_chacha_activate()
241 free(keys->cipher); in lws_chacha_activate()
242 keys->cipher = NULL; in lws_chacha_activate()
245 keys->cipher = malloc(sizeof(struct lws_cipher_chacha)); in lws_chacha_activate()
246 if (!keys->cipher) in lws_chacha_activate()
249 memset(keys->cipher, 0, sizeof(struct lws_cipher_chacha)); in lws_chacha_activate()
251 /* uses 2 x 256-bit keys, so 512 bits (64 bytes) needed */ in lws_chacha_activate()
252 chacha_keysetup(K_2(keys), keys->key[SSH_KEYIDX_ENC], 256); in lws_chacha_activate()
253 chacha_keysetup(K_1(keys), &keys->key[SSH_KEYIDX_ENC][32], 256); in lws_chacha_activate()
255 keys->valid = 1; in lws_chacha_activate()
256 keys->full_length = 1; in lws_chacha_activate()
257 keys->padding_alignment = 8; // CHACHA_BLOCKLEN; in lws_chacha_activate()
258 keys->MAC_length = POLY1305_TAGLEN; in lws_chacha_activate()
266 if (keys->cipher) { in lws_chacha_destroy()
267 free(keys->cipher); in lws_chacha_destroy()
268 keys->cipher = NULL; in lws_chacha_destroy()
306 const u_char one[8] = { 1, 0, 0, 0, 0, 0, 0, 0 }; /* NB little-endian */ in chachapoly_crypt()
358 return chachapoly_crypt(keys, seq, pt, ct, len - POLY1305_TAGLEN - 4, 4, in lws_chacha_decrypt()
366 return chachapoly_crypt(keys, seq, pt, ct, len - 4, 4, 0, 1); in lws_chacha_encrypt()