diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | cipher.c | 14 | ||||
-rw-r--r-- | key.c | 10 |
3 files changed, 25 insertions, 4 deletions
@@ -3,6 +3,9 @@ | |||
3 | - deraadt@cvs.openbsd.org 2002/06/23 03:25:50 | 3 | - deraadt@cvs.openbsd.org 2002/06/23 03:25:50 |
4 | [tildexpand.c] | 4 | [tildexpand.c] |
5 | KNF | 5 | KNF |
6 | - deraadt@cvs.openbsd.org 2002/06/23 03:26:19 | ||
7 | [cipher.c key.c] | ||
8 | KNF | ||
6 | 9 | ||
7 | 20020623 | 10 | 20020623 |
8 | - (stevesk) [configure.ac] bug #255 LOGIN_NEEDS_UTMPX for AIX. | 11 | - (stevesk) [configure.ac] bug #255 LOGIN_NEEDS_UTMPX for AIX. |
@@ -1047,4 +1050,4 @@ | |||
1047 | - (stevesk) entropy.c: typo in debug message | 1050 | - (stevesk) entropy.c: typo in debug message |
1048 | - (djm) ssh-keygen -i needs seeded RNG; report from markus@ | 1051 | - (djm) ssh-keygen -i needs seeded RNG; report from markus@ |
1049 | 1052 | ||
1050 | $Id: ChangeLog,v 1.2254 2002/06/23 21:20:34 mouring Exp $ | 1053 | $Id: ChangeLog,v 1.2255 2002/06/23 21:21:30 mouring Exp $ |
@@ -35,7 +35,7 @@ | |||
35 | */ | 35 | */ |
36 | 36 | ||
37 | #include "includes.h" | 37 | #include "includes.h" |
38 | RCSID("$OpenBSD: cipher.c,v 1.59 2002/06/19 18:01:00 markus Exp $"); | 38 | RCSID("$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 | |||
98 | u_int | 99 | u_int |
99 | cipher_keylen(Cipher *c) | 100 | cipher_keylen(Cipher *c) |
100 | { | 101 | { |
101 | return (c->key_len); | 102 | return (c->key_len); |
102 | } | 103 | } |
104 | |||
103 | u_int | 105 | u_int |
104 | cipher_get_number(Cipher *c) | 106 | cipher_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 | |||
317 | static int | 320 | static int |
318 | ssh1_3des_init(EVP_CIPHER_CTX *ctx, const u_char *key, const u_char *iv, | 321 | ssh1_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 | |||
359 | static int | 363 | static int |
360 | ssh1_3des_cbc(EVP_CIPHER_CTX *ctx, u_char *dest, const u_char *src, u_int len) | 364 | ssh1_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 | |||
380 | static int | 385 | static int |
381 | ssh1_3des_cleanup(EVP_CIPHER_CTX *ctx) | 386 | ssh1_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 | |||
392 | static const EVP_CIPHER * | 398 | static const EVP_CIPHER * |
393 | evp_ssh1_3des(void) | 399 | evp_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 | |||
433 | static int (*orig_bf)(EVP_CIPHER_CTX *, u_char *, const u_char *, u_int) = NULL; | 440 | static int (*orig_bf)(EVP_CIPHER_CTX *, u_char *, const u_char *, u_int) = NULL; |
441 | |||
434 | static int | 442 | static int |
435 | bf_ssh1_cipher(EVP_CIPHER_CTX *ctx, u_char *out, const u_char *in, u_int len) | 443 | bf_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 | |||
444 | static const EVP_CIPHER * | 453 | static const EVP_CIPHER * |
445 | evp_ssh1_bf(void) | 454 | evp_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 | |||
486 | static int | 496 | static int |
487 | ssh_rijndael_cbc(EVP_CIPHER_CTX *ctx, u_char *dest, const u_char *src, | 497 | ssh_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 | |||
531 | static int | 542 | static int |
532 | ssh_rijndael_cleanup(EVP_CIPHER_CTX *ctx) | 543 | ssh_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 | |||
543 | static const EVP_CIPHER * | 555 | static const EVP_CIPHER * |
544 | evp_rijndael(void) | 556 | evp_rijndael(void) |
545 | { | 557 | { |
@@ -32,7 +32,7 @@ | |||
32 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 32 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
33 | */ | 33 | */ |
34 | #include "includes.h" | 34 | #include "includes.h" |
35 | RCSID("$OpenBSD: key.c,v 1.44 2002/05/31 13:16:48 markus Exp $"); | 35 | RCSID("$OpenBSD: key.c,v 1.45 2002/06/23 03:26:19 deraadt Exp $"); |
36 | 36 | ||
37 | #include <openssl/evp.h> | 37 | #include <openssl/evp.h> |
38 | 38 | ||
@@ -89,6 +89,7 @@ key_new(int type) | |||
89 | } | 89 | } |
90 | return k; | 90 | return k; |
91 | } | 91 | } |
92 | |||
92 | Key * | 93 | Key * |
93 | key_new_private(int type) | 94 | key_new_private(int type) |
94 | { | 95 | { |
@@ -120,6 +121,7 @@ key_new_private(int type) | |||
120 | } | 121 | } |
121 | return k; | 122 | return k; |
122 | } | 123 | } |
124 | |||
123 | void | 125 | void |
124 | key_free(Key *k) | 126 | key_free(Key *k) |
125 | { | 127 | { |
@@ -359,6 +361,7 @@ read_bignum(char **cpp, BIGNUM * value) | |||
359 | *cpp = cp; | 361 | *cpp = cp; |
360 | return 1; | 362 | return 1; |
361 | } | 363 | } |
364 | |||
362 | static int | 365 | static int |
363 | write_bignum(FILE *f, BIGNUM *num) | 366 | write_bignum(FILE *f, BIGNUM *num) |
364 | { | 367 | { |
@@ -485,6 +488,7 @@ key_read(Key *ret, char **cpp) | |||
485 | } | 488 | } |
486 | return success; | 489 | return success; |
487 | } | 490 | } |
491 | |||
488 | int | 492 | int |
489 | key_write(Key *key, FILE *f) | 493 | key_write(Key *key, FILE *f) |
490 | { | 494 | { |
@@ -516,6 +520,7 @@ key_write(Key *key, FILE *f) | |||
516 | } | 520 | } |
517 | return success; | 521 | return success; |
518 | } | 522 | } |
523 | |||
519 | char * | 524 | char * |
520 | key_type(Key *k) | 525 | key_type(Key *k) |
521 | { | 526 | { |
@@ -532,6 +537,7 @@ key_type(Key *k) | |||
532 | } | 537 | } |
533 | return "unknown"; | 538 | return "unknown"; |
534 | } | 539 | } |
540 | |||
535 | char * | 541 | char * |
536 | key_ssh_name(Key *k) | 542 | key_ssh_name(Key *k) |
537 | { | 543 | { |
@@ -545,6 +551,7 @@ key_ssh_name(Key *k) | |||
545 | } | 551 | } |
546 | return "ssh-unknown"; | 552 | return "ssh-unknown"; |
547 | } | 553 | } |
554 | |||
548 | u_int | 555 | u_int |
549 | key_size(Key *k) | 556 | key_size(Key *k) |
550 | { | 557 | { |
@@ -807,7 +814,6 @@ key_verify( | |||
807 | } | 814 | } |
808 | 815 | ||
809 | /* Converts a private to a public key */ | 816 | /* Converts a private to a public key */ |
810 | |||
811 | Key * | 817 | Key * |
812 | key_demote(Key *k) | 818 | key_demote(Key *k) |
813 | { | 819 | { |