*/
#include "includes.h"
-RCSID("$Id: authfile.c,v 1.11 1999/12/06 19:11:15 deraadt Exp $");
+RCSID("$Id: authfile.c,v 1.12 2000/04/04 21:37:27 markus Exp $");
#include <ssl/bn.h>
#include "xmalloc.h"
/* Allocate space for the private part of the key in the buffer. */
buffer_append_space(&encrypted, &cp, buffer_len(&buffer));
- cipher_set_key_string(&cipher, cipher_type, passphrase, 1);
+ cipher_set_key_string(&cipher, cipher_type, passphrase);
cipher_encrypt(&cipher, (unsigned char *) cp,
(unsigned char *) buffer_ptr(&buffer),
buffer_len(&buffer));
xfree(buffer_get_string(&buffer, NULL));
/* Check that it is a supported cipher. */
- if (((cipher_mask() | SSH_CIPHER_NONE | SSH_AUTHFILE_CIPHER) &
+ if (((cipher_mask1() | SSH_CIPHER_NONE | SSH_AUTHFILE_CIPHER) &
(1 << cipher_type)) == 0) {
debug("Unsupported cipher %.100s used in key file %.200s.",
cipher_name(cipher_type), filename);
buffer_append_space(&decrypted, &cp, buffer_len(&buffer));
/* Rest of the buffer is encrypted. Decrypt it using the passphrase. */
- cipher_set_key_string(&cipher, cipher_type, passphrase, 0);
+ cipher_set_key_string(&cipher, cipher_type, passphrase);
cipher_decrypt(&cipher, (unsigned char *) cp,
(unsigned char *) buffer_ptr(&buffer),
buffer_len(&buffer));
*/
#include "includes.h"
-RCSID("$Id: cipher.c,v 1.21 2000/03/28 20:24:49 markus Exp $");
+RCSID("$Id: cipher.c,v 1.22 2000/04/04 21:37:27 markus Exp $");
#include "ssh.h"
#include "cipher.h"
*/
unsigned int
-cipher_mask()
+cipher_mask1()
{
unsigned int mask = 0;
mask |= 1 << SSH_CIPHER_3DES; /* Mandatory */
mask |= 1 << SSH_CIPHER_BLOWFISH;
+ return mask;
+}
+unsigned int
+cipher_mask2()
+{
+ unsigned int mask = 0;
mask |= 1 << SSH_CIPHER_BLOWFISH_CBC;
mask |= 1 << SSH_CIPHER_3DES_CBC;
mask |= 1 << SSH_CIPHER_ARCFOUR;
mask |= 1 << SSH_CIPHER_CAST128_CBC;
return mask;
}
+unsigned int
+cipher_mask()
+{
+ return cipher_mask1() | cipher_mask2();
+}
/* Returns the name of the cipher. */
*/
void
-cipher_set_key_string(CipherContext *context, int cipher,
- const char *passphrase, int for_encryption)
+cipher_set_key_string(CipherContext *context, int cipher, const char *passphrase)
{
MD5_CTX md;
unsigned char digest[16];
MD5_Update(&md, (const unsigned char *) passphrase, strlen(passphrase));
MD5_Final(digest, &md);
- cipher_set_key(context, cipher, digest, 16, for_encryption);
+ cipher_set_key(context, cipher, digest, 16);
memset(digest, 0, sizeof(digest));
memset(&md, 0, sizeof(md));
/* Selects the cipher to use and sets the key. */
void
-cipher_set_key(CipherContext *context, int cipher,
- const unsigned char *key, int keylen, int for_encryption)
+cipher_set_key(CipherContext *context, int cipher, const unsigned char *key,
+ int keylen)
{
unsigned char padded[32];
*
*/
-/* RCSID("$Id: cipher.h,v 1.12 2000/03/28 20:24:50 markus Exp $"); */
+/* RCSID("$Id: cipher.h,v 1.13 2000/04/04 21:37:27 markus Exp $"); */
#ifndef CIPHER_H
#define CIPHER_H
* supported cipher.
*/
unsigned int cipher_mask();
+unsigned int cipher_mask1();
+unsigned int cipher_mask2();
/* Returns the name of the cipher. */
const char *cipher_name(int cipher);
*/
void
cipher_set_key(CipherContext * context, int cipher,
- const unsigned char *key, int keylen, int for_encryption);
+ const unsigned char *key, int keylen);
void
cipher_set_key_iv(CipherContext * context, int cipher,
const unsigned char *key, int keylen,
*/
void
cipher_set_key_string(CipherContext * context, int cipher,
- const char *passphrase, int for_encryption);
+ const char *passphrase);
/* Encrypts data using the cipher. */
void
*/
#include "includes.h"
-RCSID("$Id: packet.c,v 1.25 2000/04/03 20:12:55 markus Exp $");
+RCSID("$Id: packet.c,v 1.26 2000/04/04 21:37:27 markus Exp $");
#include "xmalloc.h"
#include "buffer.h"
connection_in = fd_in;
connection_out = fd_out;
cipher_type = SSH_CIPHER_NONE;
- cipher_set_key(&send_context, SSH_CIPHER_NONE, (unsigned char *) "", 0, 1);
- cipher_set_key(&receive_context, SSH_CIPHER_NONE, (unsigned char *) "", 0, 0);
+ cipher_set_key(&send_context, SSH_CIPHER_NONE, (unsigned char *) "", 0);
+ cipher_set_key(&receive_context, SSH_CIPHER_NONE, (unsigned char *) "", 0);
if (!initialized) {
initialized = 1;
buffer_init(&input);
fatal("keylen too small: %d", keylen);
/* All other ciphers use the same key in both directions for now. */
- cipher_set_key(&receive_context, cipher, key, keylen, 0);
- cipher_set_key(&send_context, cipher, key, keylen, 1);
+ cipher_set_key(&receive_context, cipher, key, keylen);
+ cipher_set_key(&send_context, cipher, key, keylen);
}
/* Starts constructing a packet to send. */
*/
#include "includes.h"
-RCSID("$OpenBSD: sshconnect.c,v 1.60 2000/04/04 15:30:51 markus Exp $");
+RCSID("$OpenBSD: sshconnect.c,v 1.61 2000/04/04 21:37:27 markus Exp $");
#include <ssl/bn.h>
#include "xmalloc.h"
RSA_free(host_key);
if (options.cipher == SSH_CIPHER_NOT_SET) {
- if (cipher_mask() & supported_ciphers & (1 << ssh_cipher_default))
+ if (cipher_mask1() & supported_ciphers & (1 << ssh_cipher_default))
options.cipher = ssh_cipher_default;
else {
debug("Cipher %s not supported, using %.100s instead.",
*/
#include "includes.h"
-RCSID("$OpenBSD: sshd.c,v 1.96 2000/03/28 21:15:45 markus Exp $");
+RCSID("$OpenBSD: sshd.c,v 1.97 2000/04/04 21:37:27 markus Exp $");
#include "xmalloc.h"
#include "rsa.h"
packet_put_int(SSH_PROTOFLAG_HOST_IN_FWD_OPEN);
/* Declare which ciphers we support. */
- packet_put_int(cipher_mask());
+ packet_put_int(cipher_mask1());
/* Declare supported authentication types. */
auth_mask = 0;