summaryrefslogtreecommitdiff
path: root/cipher.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2000-04-06 12:32:37 +1000
committerDamien Miller <djm@mindrot.org>2000-04-06 12:32:37 +1000
commit1383bd8eb91a8ec9c8d283679faec5925b0ccc42 (patch)
treef71278df6c50983ea3dad850ae79c45c340d9362 /cipher.c
parent74a333bbe11f67c59c559e0f424d5945eb438577 (diff)
- OpenBSD CVS update:
- [channels.c] close efd on eof - [clientloop.c compat.c ssh.c sshconnect.c myproposal.h] ssh2 client implementation, interops w/ ssh.com and lsh servers. - [sshconnect.c] missing free. - [authfile.c cipher.c cipher.h packet.c sshconnect.c sshd.c] remove unused argument, split cipher_mask() - [clientloop.c] re-order: group ssh1 vs. ssh2 - Make Redhat spec require openssl >= 0.9.5a
Diffstat (limited to 'cipher.c')
-rw-r--r--cipher.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/cipher.c b/cipher.c
index f7b7b472..8911ffef 100644
--- a/cipher.c
+++ b/cipher.c
@@ -12,7 +12,7 @@
*/
#include "includes.h"
-RCSID("$Id: cipher.c,v 1.15 2000/04/01 01:09:23 damien Exp $");
+RCSID("$Id: cipher.c,v 1.16 2000/04/06 02:32:39 damien Exp $");
#include "ssh.h"
#include "cipher.h"
@@ -137,17 +137,28 @@ static char *cipher_names[] =
*/
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. */
@@ -182,8 +193,7 @@ cipher_number(const char *name)
*/
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];
@@ -192,7 +202,7 @@ cipher_set_key_string(CipherContext *context, int cipher,
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));
@@ -201,8 +211,8 @@ cipher_set_key_string(CipherContext *context, int cipher,
/* 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];