Lines Matching refs:keys
238 lws_chacha_activate(struct lws_ssh_keys *keys) in lws_chacha_activate() argument
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()
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()
264 lws_chacha_destroy(struct lws_ssh_keys *keys) in lws_chacha_destroy() argument
266 if (keys->cipher) { in lws_chacha_destroy()
267 free(keys->cipher); in lws_chacha_destroy()
268 keys->cipher = NULL; in lws_chacha_destroy()
273 lws_chachapoly_get_length(struct lws_ssh_keys *keys, uint32_t seq, in lws_chachapoly_get_length() argument
286 chacha_ivsetup(K_1(keys), seqbuf, NULL); in lws_chachapoly_get_length()
287 chacha_encrypt_bytes(K_1(keys), in4, buf, 4); in lws_chachapoly_get_length()
302 chachapoly_crypt(struct lws_ssh_keys *keys, u_int seqnr, u_char *dest, in chachapoly_crypt() argument
316 chacha_ivsetup(K_2(keys), seqbuf, NULL); in chachapoly_crypt()
317 chacha_encrypt_bytes(K_2(keys), in chachapoly_crypt()
333 chacha_ivsetup(K_1(keys), seqbuf, NULL); in chachapoly_crypt()
334 chacha_encrypt_bytes(K_1(keys), src, dest, aadlen); in chachapoly_crypt()
338 chacha_ivsetup(K_2(keys), seqbuf, one); in chachapoly_crypt()
339 chacha_encrypt_bytes(K_2(keys), src + aadlen, dest + aadlen, len); in chachapoly_crypt()
355 lws_chacha_decrypt(struct lws_ssh_keys *keys, uint32_t seq, in lws_chacha_decrypt() argument
358 return chachapoly_crypt(keys, seq, pt, ct, len - POLY1305_TAGLEN - 4, 4, in lws_chacha_decrypt()
363 lws_chacha_encrypt(struct lws_ssh_keys *keys, uint32_t seq, in lws_chacha_encrypt() argument
366 return chachapoly_crypt(keys, seq, pt, ct, len - 4, 4, 0, 1); in lws_chacha_encrypt()