summaryrefslogtreecommitdiff
path: root/cipher.c
diff options
context:
space:
mode:
Diffstat (limited to 'cipher.c')
-rw-r--r--cipher.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/cipher.c b/cipher.c
index b18c701fb..6db340d7a 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.59 2002/06/19 18:01:00 markus Exp $"); 38RCSID("$OpenBSD: cipher.c,v 1.60 2002/06/23 03:26:52 deraadt Exp $");
39 39
40#include "xmalloc.h" 40#include "xmalloc.h"
41#include "log.h" 41#include "log.h"
@@ -95,11 +95,13 @@ cipher_blocksize(Cipher *c)
95{ 95{
96 return (c->block_size); 96 return (c->block_size);
97} 97}
98
98u_int 99u_int
99cipher_keylen(Cipher *c) 100cipher_keylen(Cipher *c)
100{ 101{
101 return (c->key_len); 102 return (c->key_len);
102} 103}
104
103u_int 105u_int
104cipher_get_number(Cipher *c) 106cipher_get_number(Cipher *c)
105{ 107{
@@ -314,6 +316,7 @@ struct ssh1_3des_ctx
314{ 316{
315 EVP_CIPHER_CTX k1, k2, k3; 317 EVP_CIPHER_CTX k1, k2, k3;
316}; 318};
319
317static int 320static int
318ssh1_3des_init(EVP_CIPHER_CTX *ctx, const u_char *key, const u_char *iv, 321ssh1_3des_init(EVP_CIPHER_CTX *ctx, const u_char *key, const u_char *iv,
319 int enc) 322 int enc)
@@ -356,6 +359,7 @@ ssh1_3des_init(EVP_CIPHER_CTX *ctx, const u_char *key, const u_char *iv,
356#endif 359#endif
357 return (1); 360 return (1);
358} 361}
362
359static int 363static int
360ssh1_3des_cbc(EVP_CIPHER_CTX *ctx, u_char *dest, const u_char *src, u_int len) 364ssh1_3des_cbc(EVP_CIPHER_CTX *ctx, u_char *dest, const u_char *src, u_int len)
361{ 365{
@@ -377,6 +381,7 @@ ssh1_3des_cbc(EVP_CIPHER_CTX *ctx, u_char *dest, const u_char *src, u_int len)
377#endif 381#endif
378 return (1); 382 return (1);
379} 383}
384
380static int 385static int
381ssh1_3des_cleanup(EVP_CIPHER_CTX *ctx) 386ssh1_3des_cleanup(EVP_CIPHER_CTX *ctx)
382{ 387{
@@ -389,6 +394,7 @@ ssh1_3des_cleanup(EVP_CIPHER_CTX *ctx)
389 } 394 }
390 return (1); 395 return (1);
391} 396}
397
392static const EVP_CIPHER * 398static const EVP_CIPHER *
393evp_ssh1_3des(void) 399evp_ssh1_3des(void)
394{ 400{
@@ -430,7 +436,9 @@ swap_bytes(const u_char *src, u_char *dst, int n)
430 *dst++ = c[3]; 436 *dst++ = c[3];
431 } 437 }
432} 438}
439
433static int (*orig_bf)(EVP_CIPHER_CTX *, u_char *, const u_char *, u_int) = NULL; 440static int (*orig_bf)(EVP_CIPHER_CTX *, u_char *, const u_char *, u_int) = NULL;
441
434static int 442static int
435bf_ssh1_cipher(EVP_CIPHER_CTX *ctx, u_char *out, const u_char *in, u_int len) 443bf_ssh1_cipher(EVP_CIPHER_CTX *ctx, u_char *out, const u_char *in, u_int len)
436{ 444{
@@ -441,6 +449,7 @@ bf_ssh1_cipher(EVP_CIPHER_CTX *ctx, u_char *out, const u_char *in, u_int len)
441 swap_bytes(out, out, len); 449 swap_bytes(out, out, len);
442 return (ret); 450 return (ret);
443} 451}
452
444static const EVP_CIPHER * 453static const EVP_CIPHER *
445evp_ssh1_bf(void) 454evp_ssh1_bf(void)
446{ 455{
@@ -483,6 +492,7 @@ ssh_rijndael_init(EVP_CIPHER_CTX *ctx, const u_char *key, const u_char *iv,
483 memcpy(c->r_iv, iv, RIJNDAEL_BLOCKSIZE); 492 memcpy(c->r_iv, iv, RIJNDAEL_BLOCKSIZE);
484 return (1); 493 return (1);
485} 494}
495
486static int 496static int
487ssh_rijndael_cbc(EVP_CIPHER_CTX *ctx, u_char *dest, const u_char *src, 497ssh_rijndael_cbc(EVP_CIPHER_CTX *ctx, u_char *dest, const u_char *src,
488 u_int len) 498 u_int len)
@@ -528,6 +538,7 @@ ssh_rijndael_cbc(EVP_CIPHER_CTX *ctx, u_char *dest, const u_char *src,
528 } 538 }
529 return (1); 539 return (1);
530} 540}
541
531static int 542static int
532ssh_rijndael_cleanup(EVP_CIPHER_CTX *ctx) 543ssh_rijndael_cleanup(EVP_CIPHER_CTX *ctx)
533{ 544{
@@ -540,6 +551,7 @@ ssh_rijndael_cleanup(EVP_CIPHER_CTX *ctx)
540 } 551 }
541 return (1); 552 return (1);
542} 553}
554
543static const EVP_CIPHER * 555static const EVP_CIPHER *
544evp_rijndael(void) 556evp_rijndael(void)
545{ 557{