[cipher.c key.c]
     KNF
This commit is contained in:
Ben Lindstrom 2002-06-23 21:21:30 +00:00
parent 2953d0fb4e
commit 836f0e9d9a
3 changed files with 25 additions and 4 deletions

View File

@ -3,6 +3,9 @@
- deraadt@cvs.openbsd.org 2002/06/23 03:25:50 - deraadt@cvs.openbsd.org 2002/06/23 03:25:50
[tildexpand.c] [tildexpand.c]
KNF KNF
- deraadt@cvs.openbsd.org 2002/06/23 03:26:19
[cipher.c key.c]
KNF
20020623 20020623
- (stevesk) [configure.ac] bug #255 LOGIN_NEEDS_UTMPX for AIX. - (stevesk) [configure.ac] bug #255 LOGIN_NEEDS_UTMPX for AIX.
@ -1047,4 +1050,4 @@
- (stevesk) entropy.c: typo in debug message - (stevesk) entropy.c: typo in debug message
- (djm) ssh-keygen -i needs seeded RNG; report from markus@ - (djm) ssh-keygen -i needs seeded RNG; report from markus@
$Id: ChangeLog,v 1.2254 2002/06/23 21:20:34 mouring Exp $ $Id: ChangeLog,v 1.2255 2002/06/23 21:21:30 mouring Exp $

View File

@ -35,7 +35,7 @@
*/ */
#include "includes.h" #include "includes.h"
RCSID("$OpenBSD: cipher.c,v 1.59 2002/06/19 18:01:00 markus Exp $"); RCSID("$OpenBSD: cipher.c,v 1.60 2002/06/23 03:26:52 deraadt Exp $");
#include "xmalloc.h" #include "xmalloc.h"
#include "log.h" #include "log.h"
@ -95,11 +95,13 @@ cipher_blocksize(Cipher *c)
{ {
return (c->block_size); return (c->block_size);
} }
u_int u_int
cipher_keylen(Cipher *c) cipher_keylen(Cipher *c)
{ {
return (c->key_len); return (c->key_len);
} }
u_int u_int
cipher_get_number(Cipher *c) cipher_get_number(Cipher *c)
{ {
@ -314,6 +316,7 @@ struct ssh1_3des_ctx
{ {
EVP_CIPHER_CTX k1, k2, k3; EVP_CIPHER_CTX k1, k2, k3;
}; };
static int static int
ssh1_3des_init(EVP_CIPHER_CTX *ctx, const u_char *key, const u_char *iv, ssh1_3des_init(EVP_CIPHER_CTX *ctx, const u_char *key, const u_char *iv,
int enc) int enc)
@ -356,6 +359,7 @@ ssh1_3des_init(EVP_CIPHER_CTX *ctx, const u_char *key, const u_char *iv,
#endif #endif
return (1); return (1);
} }
static int static int
ssh1_3des_cbc(EVP_CIPHER_CTX *ctx, u_char *dest, const u_char *src, u_int len) ssh1_3des_cbc(EVP_CIPHER_CTX *ctx, u_char *dest, const u_char *src, u_int len)
{ {
@ -377,6 +381,7 @@ ssh1_3des_cbc(EVP_CIPHER_CTX *ctx, u_char *dest, const u_char *src, u_int len)
#endif #endif
return (1); return (1);
} }
static int static int
ssh1_3des_cleanup(EVP_CIPHER_CTX *ctx) ssh1_3des_cleanup(EVP_CIPHER_CTX *ctx)
{ {
@ -389,6 +394,7 @@ ssh1_3des_cleanup(EVP_CIPHER_CTX *ctx)
} }
return (1); return (1);
} }
static const EVP_CIPHER * static const EVP_CIPHER *
evp_ssh1_3des(void) evp_ssh1_3des(void)
{ {
@ -430,7 +436,9 @@ swap_bytes(const u_char *src, u_char *dst, int n)
*dst++ = c[3]; *dst++ = c[3];
} }
} }
static int (*orig_bf)(EVP_CIPHER_CTX *, u_char *, const u_char *, u_int) = NULL; static int (*orig_bf)(EVP_CIPHER_CTX *, u_char *, const u_char *, u_int) = NULL;
static int static int
bf_ssh1_cipher(EVP_CIPHER_CTX *ctx, u_char *out, const u_char *in, u_int len) bf_ssh1_cipher(EVP_CIPHER_CTX *ctx, u_char *out, const u_char *in, u_int len)
{ {
@ -441,6 +449,7 @@ bf_ssh1_cipher(EVP_CIPHER_CTX *ctx, u_char *out, const u_char *in, u_int len)
swap_bytes(out, out, len); swap_bytes(out, out, len);
return (ret); return (ret);
} }
static const EVP_CIPHER * static const EVP_CIPHER *
evp_ssh1_bf(void) evp_ssh1_bf(void)
{ {
@ -483,6 +492,7 @@ ssh_rijndael_init(EVP_CIPHER_CTX *ctx, const u_char *key, const u_char *iv,
memcpy(c->r_iv, iv, RIJNDAEL_BLOCKSIZE); memcpy(c->r_iv, iv, RIJNDAEL_BLOCKSIZE);
return (1); return (1);
} }
static int static int
ssh_rijndael_cbc(EVP_CIPHER_CTX *ctx, u_char *dest, const u_char *src, ssh_rijndael_cbc(EVP_CIPHER_CTX *ctx, u_char *dest, const u_char *src,
u_int len) u_int len)
@ -528,6 +538,7 @@ ssh_rijndael_cbc(EVP_CIPHER_CTX *ctx, u_char *dest, const u_char *src,
} }
return (1); return (1);
} }
static int static int
ssh_rijndael_cleanup(EVP_CIPHER_CTX *ctx) ssh_rijndael_cleanup(EVP_CIPHER_CTX *ctx)
{ {
@ -540,6 +551,7 @@ ssh_rijndael_cleanup(EVP_CIPHER_CTX *ctx)
} }
return (1); return (1);
} }
static const EVP_CIPHER * static const EVP_CIPHER *
evp_rijndael(void) evp_rijndael(void)
{ {

10
key.c
View File

@ -32,7 +32,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "includes.h" #include "includes.h"
RCSID("$OpenBSD: key.c,v 1.44 2002/05/31 13:16:48 markus Exp $"); RCSID("$OpenBSD: key.c,v 1.45 2002/06/23 03:26:19 deraadt Exp $");
#include <openssl/evp.h> #include <openssl/evp.h>
@ -89,6 +89,7 @@ key_new(int type)
} }
return k; return k;
} }
Key * Key *
key_new_private(int type) key_new_private(int type)
{ {
@ -120,6 +121,7 @@ key_new_private(int type)
} }
return k; return k;
} }
void void
key_free(Key *k) key_free(Key *k)
{ {
@ -359,6 +361,7 @@ read_bignum(char **cpp, BIGNUM * value)
*cpp = cp; *cpp = cp;
return 1; return 1;
} }
static int static int
write_bignum(FILE *f, BIGNUM *num) write_bignum(FILE *f, BIGNUM *num)
{ {
@ -485,6 +488,7 @@ key_read(Key *ret, char **cpp)
} }
return success; return success;
} }
int int
key_write(Key *key, FILE *f) key_write(Key *key, FILE *f)
{ {
@ -516,6 +520,7 @@ key_write(Key *key, FILE *f)
} }
return success; return success;
} }
char * char *
key_type(Key *k) key_type(Key *k)
{ {
@ -532,6 +537,7 @@ key_type(Key *k)
} }
return "unknown"; return "unknown";
} }
char * char *
key_ssh_name(Key *k) key_ssh_name(Key *k)
{ {
@ -545,6 +551,7 @@ key_ssh_name(Key *k)
} }
return "ssh-unknown"; return "ssh-unknown";
} }
u_int u_int
key_size(Key *k) key_size(Key *k)
{ {
@ -807,7 +814,6 @@ key_verify(
} }
/* Converts a private to a public key */ /* Converts a private to a public key */
Key * Key *
key_demote(Key *k) key_demote(Key *k)
{ {