summaryrefslogtreecommitdiff
path: root/cipher.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2000-04-16 11:18:38 +1000
committerDamien Miller <djm@mindrot.org>2000-04-16 11:18:38 +1000
commit4af51306d9a51459a5bef922df1037f876ae51fe (patch)
tree09ecfc215fce82345a3259f8a0f384b9a67906f0 /cipher.c
parent5d1705ecf9bd3216dc99a84242bcdf2e7297d307 (diff)
- OpenBSD CVS updates.
[ssh.1 ssh.c] - ssh -2 [auth.c channels.c clientloop.c packet.c packet.h serverloop.c] [session.c sshconnect.c] - check payload for (illegal) extra data [ALL] - whitespace cleanup
Diffstat (limited to 'cipher.c')
-rw-r--r--cipher.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/cipher.c b/cipher.c
index 1bd8f7c86..edc50dcf4 100644
--- a/cipher.c
+++ b/cipher.c
@@ -1,18 +1,18 @@
1/* 1/*
2 * 2 *
3 * cipher.c 3 * cipher.c
4 * 4 *
5 * Author: Tatu Ylonen <ylo@cs.hut.fi> 5 * Author: Tatu Ylonen <ylo@cs.hut.fi>
6 * 6 *
7 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 7 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
8 * All rights reserved 8 * All rights reserved
9 * 9 *
10 * Created: Wed Apr 19 17:41:39 1995 ylo 10 * Created: Wed Apr 19 17:41:39 1995 ylo
11 * 11 *
12 */ 12 */
13 13
14#include "includes.h" 14#include "includes.h"
15RCSID("$Id: cipher.c,v 1.18 2000/04/13 02:26:36 damien Exp $"); 15RCSID("$Id: cipher.c,v 1.19 2000/04/16 01:18:41 damien Exp $");
16 16
17#include "ssh.h" 17#include "ssh.h"
18#include "cipher.h" 18#include "cipher.h"
@@ -138,7 +138,7 @@ static char *cipher_names[] =
138 * supported cipher. 138 * supported cipher.
139 */ 139 */
140 140
141unsigned int 141unsigned int
142cipher_mask1() 142cipher_mask1()
143{ 143{
144 unsigned int mask = 0; 144 unsigned int mask = 0;
@@ -146,7 +146,7 @@ cipher_mask1()
146 mask |= 1 << SSH_CIPHER_BLOWFISH; 146 mask |= 1 << SSH_CIPHER_BLOWFISH;
147 return mask; 147 return mask;
148} 148}
149unsigned int 149unsigned int
150cipher_mask2() 150cipher_mask2()
151{ 151{
152 unsigned int mask = 0; 152 unsigned int mask = 0;
@@ -156,7 +156,7 @@ cipher_mask2()
156 mask |= 1 << SSH_CIPHER_CAST128_CBC; 156 mask |= 1 << SSH_CIPHER_CAST128_CBC;
157 return mask; 157 return mask;
158} 158}
159unsigned int 159unsigned int
160cipher_mask() 160cipher_mask()
161{ 161{
162 return cipher_mask1() | cipher_mask2(); 162 return cipher_mask1() | cipher_mask2();
@@ -218,7 +218,7 @@ cipher_number(const char *name)
218 * passphrase and using the resulting 16 bytes as the key. 218 * passphrase and using the resulting 16 bytes as the key.
219 */ 219 */
220 220
221void 221void
222cipher_set_key_string(CipherContext *context, int cipher, const char *passphrase) 222cipher_set_key_string(CipherContext *context, int cipher, const char *passphrase)
223{ 223{
224 MD5_CTX md; 224 MD5_CTX md;
@@ -236,7 +236,7 @@ cipher_set_key_string(CipherContext *context, int cipher, const char *passphrase
236 236
237/* Selects the cipher to use and sets the key. */ 237/* Selects the cipher to use and sets the key. */
238 238
239void 239void
240cipher_set_key(CipherContext *context, int cipher, const unsigned char *key, 240cipher_set_key(CipherContext *context, int cipher, const unsigned char *key,
241 int keylen) 241 int keylen)
242{ 242{
@@ -297,9 +297,9 @@ cipher_set_key(CipherContext *context, int cipher, const unsigned char *key,
297 memset(padded, 0, sizeof(padded)); 297 memset(padded, 0, sizeof(padded));
298} 298}
299 299
300void 300void
301cipher_set_key_iv(CipherContext * context, int cipher, 301cipher_set_key_iv(CipherContext * context, int cipher,
302 const unsigned char *key, int keylen, 302 const unsigned char *key, int keylen,
303 const unsigned char *iv, int ivlen) 303 const unsigned char *iv, int ivlen)
304{ 304{
305 /* Set cipher type. */ 305 /* Set cipher type. */
@@ -357,7 +357,7 @@ cipher_set_key_iv(CipherContext * context, int cipher,
357 357
358/* Encrypts data using the cipher. */ 358/* Encrypts data using the cipher. */
359 359
360void 360void
361cipher_encrypt(CipherContext *context, unsigned char *dest, 361cipher_encrypt(CipherContext *context, unsigned char *dest,
362 const unsigned char *src, unsigned int len) 362 const unsigned char *src, unsigned int len)
363{ 363{
@@ -379,14 +379,14 @@ cipher_encrypt(CipherContext *context, unsigned char *dest,
379 case SSH_CIPHER_BLOWFISH: 379 case SSH_CIPHER_BLOWFISH:
380 swap_bytes(src, dest, len); 380 swap_bytes(src, dest, len);
381 BF_cbc_encrypt(dest, dest, len, 381 BF_cbc_encrypt(dest, dest, len,
382 &context->u.bf.key, context->u.bf.iv, 382 &context->u.bf.key, context->u.bf.iv,
383 BF_ENCRYPT); 383 BF_ENCRYPT);
384 swap_bytes(dest, dest, len); 384 swap_bytes(dest, dest, len);
385 break; 385 break;
386 386
387 case SSH_CIPHER_BLOWFISH_CBC: 387 case SSH_CIPHER_BLOWFISH_CBC:
388 BF_cbc_encrypt((void *)src, dest, len, 388 BF_cbc_encrypt((void *)src, dest, len,
389 &context->u.bf.key, context->u.bf.iv, 389 &context->u.bf.key, context->u.bf.iv,
390 BF_ENCRYPT); 390 BF_ENCRYPT);
391 break; 391 break;
392 392
@@ -412,7 +412,7 @@ cipher_encrypt(CipherContext *context, unsigned char *dest,
412 412
413/* Decrypts data using the cipher. */ 413/* Decrypts data using the cipher. */
414 414
415void 415void
416cipher_decrypt(CipherContext *context, unsigned char *dest, 416cipher_decrypt(CipherContext *context, unsigned char *dest,
417 const unsigned char *src, unsigned int len) 417 const unsigned char *src, unsigned int len)
418{ 418{