cipher.c (60576) | cipher.c (61212) |
---|---|
1/* 2 * 3 * cipher.c 4 * 5 * Author: Tatu Ylonen <ylo@cs.hut.fi> 6 * 7 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 8 * All rights reserved 9 * 10 * Created: Wed Apr 19 17:41:39 1995 ylo 11 * | 1/* 2 * 3 * cipher.c 4 * 5 * Author: Tatu Ylonen <ylo@cs.hut.fi> 6 * 7 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 8 * All rights reserved 9 * 10 * Created: Wed Apr 19 17:41:39 1995 ylo 11 * |
12 * $FreeBSD: head/crypto/openssh/cipher.c 60576 2000-05-15 05:24:25Z kris $ | 12 * $FreeBSD: head/crypto/openssh/cipher.c 61212 2000-06-03 09:58:15Z kris $ |
13 */ 14 15#include "includes.h" | 13 */ 14 15#include "includes.h" |
16RCSID("$Id: cipher.c,v 1.26 2000/04/14 10:30:30 markus Exp $"); | 16RCSID("$Id: cipher.c,v 1.27 2000/05/22 18:42:00 markus Exp $"); |
17 18#include "ssh.h" 19#include "cipher.h" 20#include "xmalloc.h" 21 22#include <openssl/md5.h> 23 24/* --- 149 unchanged lines hidden (view full) --- 174#define CIPHER_SEP "," 175int 176ciphers_valid(const char *names) 177{ 178 char *ciphers; 179 char *p; 180 int i; 181 | 17 18#include "ssh.h" 19#include "cipher.h" 20#include "xmalloc.h" 21 22#include <openssl/md5.h> 23 24/* --- 149 unchanged lines hidden (view full) --- 174#define CIPHER_SEP "," 175int 176ciphers_valid(const char *names) 177{ 178 char *ciphers; 179 char *p; 180 int i; 181 |
182 if (strcmp(names, "") == 0) | 182 if (names == NULL || strcmp(names, "") == 0) |
183 return 0; 184 ciphers = xstrdup(names); 185 for ((p = strtok(ciphers, CIPHER_SEP)); p; (p = strtok(NULL, CIPHER_SEP))) { 186 i = cipher_number(p); 187 if (i == -1 || !(cipher_mask2() & (1 << i))) { 188 xfree(ciphers); 189 return 0; 190 } --- 6 unchanged lines hidden (view full) --- 197 * Parses the name of the cipher. Returns the number of the corresponding 198 * cipher, or -1 on error. 199 */ 200 201int 202cipher_number(const char *name) 203{ 204 int i; | 183 return 0; 184 ciphers = xstrdup(names); 185 for ((p = strtok(ciphers, CIPHER_SEP)); p; (p = strtok(NULL, CIPHER_SEP))) { 186 i = cipher_number(p); 187 if (i == -1 || !(cipher_mask2() & (1 << i))) { 188 xfree(ciphers); 189 return 0; 190 } --- 6 unchanged lines hidden (view full) --- 197 * Parses the name of the cipher. Returns the number of the corresponding 198 * cipher, or -1 on error. 199 */ 200 201int 202cipher_number(const char *name) 203{ 204 int i; |
205 if (name == NULL) 206 return -1; |
|
205 for (i = 0; i < sizeof(cipher_names) / sizeof(cipher_names[0]); i++) 206 if (strcmp(cipher_names[i], name) == 0 && 207 (cipher_mask() & (1 << i))) 208 return i; 209 return -1; 210} 211 212/* --- 250 unchanged lines hidden --- | 207 for (i = 0; i < sizeof(cipher_names) / sizeof(cipher_names[0]); i++) 208 if (strcmp(cipher_names[i], name) == 0 && 209 (cipher_mask() & (1 << i))) 210 return i; 211 return -1; 212} 213 214/* --- 250 unchanged lines hidden --- |