aboutsummaryrefslogtreecommitdiff
path: root/crypto/openssh/cipher.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/openssh/cipher.c')
-rw-r--r--crypto/openssh/cipher.c44
1 files changed, 11 insertions, 33 deletions
diff --git a/crypto/openssh/cipher.c b/crypto/openssh/cipher.c
index f770e666cf16..0697e559b117 100644
--- a/crypto/openssh/cipher.c
+++ b/crypto/openssh/cipher.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cipher.c,v 1.126 2026/02/14 00:18:34 jsg Exp $ */
+/* $OpenBSD: cipher.c,v 1.129 2026/06/19 05:26:04 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -184,6 +184,12 @@ cipher_is_cbc(const struct sshcipher *c)
}
u_int
+cipher_is_internal(const struct sshcipher *c)
+{
+ return (c->flags & CFLAG_INTERNAL) != 0;
+}
+
+u_int
cipher_ctx_is_plaintext(struct sshcipher_ctx *cc)
{
return cc->plaintext;
@@ -206,6 +212,7 @@ ciphers_valid(const char *names)
const struct sshcipher *c;
char *cipher_list, *cp;
char *p;
+ int found = 0;
if (names == NULL || strcmp(names, "") == 0)
return 0;
@@ -217,10 +224,11 @@ ciphers_valid(const char *names)
if (c == NULL || (c->flags & CFLAG_INTERNAL) != 0) {
free(cipher_list);
return 0;
- }
+ } else
+ found = 1;
}
free(cipher_list);
- return 1;
+ return found;
}
const char *
@@ -463,33 +471,3 @@ cipher_get_keyiv(struct sshcipher_ctx *cc, u_char *iv, size_t len)
#endif
return 0;
}
-
-int
-cipher_set_keyiv(struct sshcipher_ctx *cc, const u_char *iv, size_t len)
-{
-#ifdef WITH_OPENSSL
- const struct sshcipher *c = cc->cipher;
- int evplen = 0;
-#endif
-
- if ((cc->cipher->flags & CFLAG_CHACHAPOLY) != 0)
- return 0;
- if ((cc->cipher->flags & CFLAG_NONE) != 0)
- return 0;
-
-#ifdef WITH_OPENSSL
- evplen = EVP_CIPHER_CTX_iv_length(cc->evp);
- if (evplen <= 0)
- return SSH_ERR_LIBCRYPTO_ERROR;
- if ((size_t)evplen != len)
- return SSH_ERR_INVALID_ARGUMENT;
- if (cipher_authlen(c)) {
- /* XXX iv arg is const, but EVP_CIPHER_CTX_ctrl isn't */
- if (EVP_CIPHER_CTX_ctrl(cc->evp,
- EVP_CTRL_GCM_SET_IV_FIXED, -1, (void *)iv) <= 0)
- return SSH_ERR_LIBCRYPTO_ERROR;
- } else if (!EVP_CIPHER_CTX_set_iv(cc->evp, iv, evplen))
- return SSH_ERR_LIBCRYPTO_ERROR;
-#endif
- return 0;
-}