summaryrefslogtreecommitdiff
path: root/cipher.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2004-06-22 12:56:01 +1000
committerDarren Tucker <dtucker@zip.com.au>2004-06-22 12:56:01 +1000
commit3f9fdc71219d498a996c4e4ca8330df7f598fb5d (patch)
tree902072deed2ca26a5b0b3fa5f3749783e0bd62e6 /cipher.c
parentb357afc0a03a4238a01acf5d9641ebda9f71d500 (diff)
- avsm@cvs.openbsd.org 2004/06/21 17:36:31
[auth-rsa.c auth2-gss.c auth2-pubkey.c authfile.c canohost.c channels.c cipher.c dns.c kex.c monitor.c monitor_fdpass.c monitor_wrap.c monitor_wrap.h nchan.c packet.c progressmeter.c scp.c sftp-server.c sftp.c ssh-gss.h ssh-keygen.c ssh.c sshconnect.c sshconnect1.c sshlogin.c sshpty.c] make ssh -Wshadow clean, no functional changes markus@ ok There are also some portable-specific -Wshadow warnings to be fixed in monitor.c and montior_wrap.c.
Diffstat (limited to 'cipher.c')
-rw-r--r--cipher.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/cipher.c b/cipher.c
index c13ff5862..255f840a3 100644
--- a/cipher.c
+++ b/cipher.c
@@ -35,7 +35,7 @@
35 */ 35 */
36 36
37#include "includes.h" 37#include "includes.h"
38RCSID("$OpenBSD: cipher.c,v 1.68 2004/01/23 19:26:33 hshoexer Exp $"); 38RCSID("$OpenBSD: cipher.c,v 1.69 2004/06/21 17:36:31 avsm Exp $");
39 39
40#include "xmalloc.h" 40#include "xmalloc.h"
41#include "log.h" 41#include "log.h"
@@ -166,25 +166,25 @@ int
166ciphers_valid(const char *names) 166ciphers_valid(const char *names)
167{ 167{
168 Cipher *c; 168 Cipher *c;
169 char *ciphers, *cp; 169 char *cipher_list, *cp;
170 char *p; 170 char *p;
171 171
172 if (names == NULL || strcmp(names, "") == 0) 172 if (names == NULL || strcmp(names, "") == 0)
173 return 0; 173 return 0;
174 ciphers = cp = xstrdup(names); 174 cipher_list = cp = xstrdup(names);
175 for ((p = strsep(&cp, CIPHER_SEP)); p && *p != '\0'; 175 for ((p = strsep(&cp, CIPHER_SEP)); p && *p != '\0';
176 (p = strsep(&cp, CIPHER_SEP))) { 176 (p = strsep(&cp, CIPHER_SEP))) {
177 c = cipher_by_name(p); 177 c = cipher_by_name(p);
178 if (c == NULL || c->number != SSH_CIPHER_SSH2) { 178 if (c == NULL || c->number != SSH_CIPHER_SSH2) {
179 debug("bad cipher %s [%s]", p, names); 179 debug("bad cipher %s [%s]", p, names);
180 xfree(ciphers); 180 xfree(cipher_list);
181 return 0; 181 return 0;
182 } else { 182 } else {
183 debug3("cipher ok: %s [%s]", p, names); 183 debug3("cipher ok: %s [%s]", p, names);
184 } 184 }
185 } 185 }
186 debug3("ciphers ok: [%s]", names); 186 debug3("ciphers ok: [%s]", names);
187 xfree(ciphers); 187 xfree(cipher_list);
188 return 1; 188 return 1;
189} 189}
190 190
@@ -213,7 +213,7 @@ cipher_name(int id)
213void 213void
214cipher_init(CipherContext *cc, Cipher *cipher, 214cipher_init(CipherContext *cc, Cipher *cipher,
215 const u_char *key, u_int keylen, const u_char *iv, u_int ivlen, 215 const u_char *key, u_int keylen, const u_char *iv, u_int ivlen,
216 int encrypt) 216 int do_encrypt)
217{ 217{
218 static int dowarn = 1; 218 static int dowarn = 1;
219#ifdef SSH_OLD_EVP 219#ifdef SSH_OLD_EVP
@@ -255,7 +255,7 @@ cipher_init(CipherContext *cc, Cipher *cipher,
255 (encrypt == CIPHER_ENCRYPT)); 255 (encrypt == CIPHER_ENCRYPT));
256#else 256#else
257 if (EVP_CipherInit(&cc->evp, type, NULL, (u_char *)iv, 257 if (EVP_CipherInit(&cc->evp, type, NULL, (u_char *)iv,
258 (encrypt == CIPHER_ENCRYPT)) == 0) 258 (do_encrypt == CIPHER_ENCRYPT)) == 0)
259 fatal("cipher_init: EVP_CipherInit failed for %s", 259 fatal("cipher_init: EVP_CipherInit failed for %s",
260 cipher->name); 260 cipher->name);
261 klen = EVP_CIPHER_CTX_key_length(&cc->evp); 261 klen = EVP_CIPHER_CTX_key_length(&cc->evp);
@@ -302,7 +302,7 @@ cipher_cleanup(CipherContext *cc)
302 302
303void 303void
304cipher_set_key_string(CipherContext *cc, Cipher *cipher, 304cipher_set_key_string(CipherContext *cc, Cipher *cipher,
305 const char *passphrase, int encrypt) 305 const char *passphrase, int do_encrypt)
306{ 306{
307 MD5_CTX md; 307 MD5_CTX md;
308 u_char digest[16]; 308 u_char digest[16];
@@ -311,7 +311,7 @@ cipher_set_key_string(CipherContext *cc, Cipher *cipher,
311 MD5_Update(&md, (const u_char *)passphrase, strlen(passphrase)); 311 MD5_Update(&md, (const u_char *)passphrase, strlen(passphrase));
312 MD5_Final(digest, &md); 312 MD5_Final(digest, &md);
313 313
314 cipher_init(cc, cipher, digest, 16, NULL, 0, encrypt); 314 cipher_init(cc, cipher, digest, 16, NULL, 0, do_encrypt);
315 315
316 memset(digest, 0, sizeof(digest)); 316 memset(digest, 0, sizeof(digest));
317 memset(&md, 0, sizeof(md)); 317 memset(&md, 0, sizeof(md));