Lines Matching refs:cipher

1 /* $OpenBSD: cipher.c,v 1.101 2015/12/10 17:08:40 mmcc Exp $ */
46 #include "cipher.h"
189 * Default is cipher block size, except for chacha20+poly1305 that
265 * Parses the name of the cipher. Returns the number of the corresponding
266 * cipher, or -1 on error.
291 if (cc == NULL || cc->cipher == NULL)
293 if (cc->cipher->number == SSH_CIPHER_DES)
300 cipher_init(struct sshcipher_ctx *cc, const struct sshcipher *cipher,
310 if (cipher->number == SSH_CIPHER_DES) {
315 cc->plaintext = (cipher->number == SSH_CIPHER_NONE);
318 if (keylen < cipher->key_len ||
319 (iv != NULL && ivlen < cipher_ivlen(cipher)))
322 cc->cipher = cipher;
323 if ((cc->cipher->flags & CFLAG_CHACHAPOLY) != 0) {
327 if ((cc->cipher->flags & CFLAG_AESCTR) != 0) {
332 if ((cc->cipher->flags & CFLAG_NONE) != 0)
336 type = (*cipher->evptype)();
343 if (cipher_authlen(cipher) &&
361 if (cipher->discard_len > 0) {
362 if ((junk = malloc(cipher->discard_len)) == NULL ||
363 (discard = malloc(cipher->discard_len)) == NULL) {
368 ret = EVP_Cipher(&cc->evp, discard, junk, cipher->discard_len);
369 explicit_bzero(discard, cipher->discard_len);
397 if ((cc->cipher->flags & CFLAG_CHACHAPOLY) != 0) {
402 if ((cc->cipher->flags & CFLAG_AESCTR) != 0) {
409 if ((cc->cipher->flags & CFLAG_NONE) != 0) {
418 if (authlen != cipher_authlen(cc->cipher))
436 if (len % cc->cipher->block_size)
460 if ((cc->cipher->flags & CFLAG_CHACHAPOLY) != 0)
472 if (cc == NULL || cc->cipher == NULL)
474 if ((cc->cipher->flags & CFLAG_CHACHAPOLY) != 0)
476 else if ((cc->cipher->flags & CFLAG_AESCTR) != 0)
486 * Selects the cipher, and keys if by computing the MD5 checksum of the
490 cipher_set_key_string(struct sshcipher_ctx *cc, const struct sshcipher *cipher,
501 r = cipher_init(cc, cipher, digest, 16, NULL, 0, do_encrypt);
515 const struct sshcipher *c = cc->cipher;
520 else if ((cc->cipher->flags & CFLAG_CHACHAPOLY) != 0)
522 else if ((cc->cipher->flags & CFLAG_AESCTR) != 0)
534 const struct sshcipher *c = cc->cipher;
539 if ((cc->cipher->flags & CFLAG_CHACHAPOLY) != 0) {
544 if ((cc->cipher->flags & CFLAG_AESCTR) != 0) {
550 if ((cc->cipher->flags & CFLAG_NONE) != 0)
591 const struct sshcipher *c = cc->cipher;
596 if ((cc->cipher->flags & CFLAG_CHACHAPOLY) != 0)
598 if ((cc->cipher->flags & CFLAG_NONE) != 0)
630 #define EVP_X_STATE_LEN(evp) (evp).cipher->ctx_size
637 const struct sshcipher *c = cc->cipher;
656 const struct sshcipher *c = cc->cipher;