Lines Matching refs:cc
206 cipher_init(CipherContext *cc, Cipher *cipher,
228 cc->plaintext = (cipher->number == SSH_CIPHER_NONE);
236 cc->cipher = cipher;
240 EVP_CIPHER_CTX_init(&cc->evp);
247 EVP_CipherInit(&cc->evp, type, (u_char *)key, (u_char *)iv,
250 if (EVP_CipherInit(&cc->evp, type, NULL, (u_char *)iv,
254 klen = EVP_CIPHER_CTX_key_length(&cc->evp);
257 if (EVP_CIPHER_CTX_set_key_length(&cc->evp, keylen) == 0)
261 if (EVP_CipherInit(&cc->evp, NULL, (u_char *)key, NULL, -1) == 0)
269 if (EVP_Cipher(&cc->evp, discard, junk,
279 cipher_crypt(CipherContext *cc, u_char *dest, const u_char *src, u_int len)
281 if (len % cc->cipher->block_size)
283 if (EVP_Cipher(&cc->evp, dest, (u_char *)src, len) == 0)
288 cipher_cleanup(CipherContext *cc)
290 if (EVP_CIPHER_CTX_cleanup(&cc->evp) == 0)
300 cipher_set_key_string(CipherContext *cc, Cipher *cipher,
310 cipher_init(cc, cipher, digest, 16, NULL, 0, do_encrypt);
323 cipher_get_keyiv_len(const CipherContext *cc)
325 Cipher *c = cc->cipher;
331 ivlen = EVP_CIPHER_CTX_iv_length(&cc->evp);
336 cipher_get_keyiv(CipherContext *cc, u_char *iv, u_int len)
338 Cipher *c = cc->cipher;
345 evplen = EVP_CIPHER_CTX_iv_length(&cc->evp);
353 ssh_rijndael_iv(&cc->evp, 0, iv, len);
357 ssh_aes_ctr_iv(&cc->evp, 0, iv, len);
359 memcpy(iv, cc->evp.iv, len);
362 ssh1_3des_iv(&cc->evp, 0, iv, 24);
370 cipher_set_keyiv(CipherContext *cc, u_char *iv)
372 Cipher *c = cc->cipher;
379 evplen = EVP_CIPHER_CTX_iv_length(&cc->evp);
384 ssh_rijndael_iv(&cc->evp, 1, iv, evplen);
388 ssh_aes_ctr_iv(&cc->evp, 1, iv, evplen);
390 memcpy(cc->evp.iv, iv, evplen);
393 ssh1_3des_iv(&cc->evp, 1, iv, 24);
409 cipher_get_keycontext(const CipherContext *cc, u_char *dat)
411 Cipher *c = cc->cipher;
415 plen = EVP_X_STATE_LEN(cc->evp);
418 memcpy(dat, EVP_X_STATE(cc->evp), plen);
424 cipher_set_keycontext(CipherContext *cc, u_char *dat)
426 Cipher *c = cc->cipher;
430 plen = EVP_X_STATE_LEN(cc->evp);
431 memcpy(EVP_X_STATE(cc->evp), dat, plen);