diff options
author | Damien Miller <djm@mindrot.org> | 2014-07-02 15:28:02 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2014-07-02 15:28:02 +1000 |
commit | 8668706d0f52654fe64c0ca41a96113aeab8d2b8 (patch) | |
tree | 73e78e1ea3d39206e39870bbe0af17d6c430fb51 /cipher.h | |
parent | 2cd7929250cf9e9f658d70dcd452f529ba08c942 (diff) |
- djm@cvs.openbsd.org 2014/06/24 01:13:21
[Makefile.in auth-bsdauth.c auth-chall.c auth-options.c auth-rsa.c
[auth2-none.c auth2-pubkey.c authfile.c authfile.h cipher-3des1.c
[cipher-chachapoly.c cipher-chachapoly.h cipher.c cipher.h
[digest-libc.c digest-openssl.c digest.h dns.c entropy.c hmac.h
[hostfile.c key.c key.h krl.c monitor.c packet.c rsa.c rsa.h
[ssh-add.c ssh-agent.c ssh-dss.c ssh-ecdsa.c ssh-ed25519.c
[ssh-keygen.c ssh-pkcs11-client.c ssh-pkcs11-helper.c ssh-pkcs11.c
[ssh-rsa.c sshbuf-misc.c sshbuf.h sshconnect.c sshconnect1.c
[sshconnect2.c sshd.c sshkey.c sshkey.h
[openbsd-compat/openssl-compat.c openbsd-compat/openssl-compat.h]
New key API: refactor key-related functions to be more library-like,
existing API is offered as a set of wrappers.
with and ok markus@
Thanks also to Ben Hawkes, David Tomaschik, Ivan Fratric, Matthew
Dempsky and Ron Bowes for a detailed review a few months ago.
NB. This commit also removes portable OpenSSH support for OpenSSL
<0.9.8e.
Diffstat (limited to 'cipher.h')
-rw-r--r-- | cipher.h | 57 |
1 files changed, 30 insertions, 27 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: cipher.h,v 1.45 2014/04/29 18:01:49 markus Exp $ */ | 1 | /* $OpenBSD: cipher.h,v 1.46 2014/06/24 01:13:21 djm Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -37,6 +37,7 @@ | |||
37 | #ifndef CIPHER_H | 37 | #ifndef CIPHER_H |
38 | #define CIPHER_H | 38 | #define CIPHER_H |
39 | 39 | ||
40 | #include <sys/types.h> | ||
40 | #include <openssl/evp.h> | 41 | #include <openssl/evp.h> |
41 | #include "cipher-chachapoly.h" | 42 | #include "cipher-chachapoly.h" |
42 | #include "cipher-aesctr.h" | 43 | #include "cipher-aesctr.h" |
@@ -61,45 +62,47 @@ | |||
61 | #define CIPHER_ENCRYPT 1 | 62 | #define CIPHER_ENCRYPT 1 |
62 | #define CIPHER_DECRYPT 0 | 63 | #define CIPHER_DECRYPT 0 |
63 | 64 | ||
64 | typedef struct Cipher Cipher; | 65 | struct sshcipher; |
65 | typedef struct CipherContext CipherContext; | 66 | struct sshcipher_ctx { |
66 | |||
67 | struct Cipher; | ||
68 | struct CipherContext { | ||
69 | int plaintext; | 67 | int plaintext; |
70 | int encrypt; | 68 | int encrypt; |
71 | EVP_CIPHER_CTX evp; | 69 | EVP_CIPHER_CTX evp; |
72 | struct chachapoly_ctx cp_ctx; /* XXX union with evp? */ | 70 | struct chachapoly_ctx cp_ctx; /* XXX union with evp? */ |
73 | struct aesctr_ctx ac_ctx; /* XXX union with evp? */ | 71 | struct aesctr_ctx ac_ctx; /* XXX union with evp? */ |
74 | const Cipher *cipher; | 72 | const struct sshcipher *cipher; |
75 | }; | 73 | }; |
76 | 74 | ||
75 | typedef struct sshcipher Cipher ; | ||
76 | typedef struct sshcipher_ctx CipherContext ; | ||
77 | |||
77 | u_int cipher_mask_ssh1(int); | 78 | u_int cipher_mask_ssh1(int); |
78 | const Cipher *cipher_by_name(const char *); | 79 | const struct sshcipher *cipher_by_name(const char *); |
79 | const Cipher *cipher_by_number(int); | 80 | const struct sshcipher *cipher_by_number(int); |
80 | int cipher_number(const char *); | 81 | int cipher_number(const char *); |
81 | char *cipher_name(int); | 82 | char *cipher_name(int); |
82 | int ciphers_valid(const char *); | 83 | int ciphers_valid(const char *); |
83 | char *cipher_alg_list(char, int); | 84 | char *cipher_alg_list(char, int); |
84 | void cipher_init(CipherContext *, const Cipher *, const u_char *, u_int, | 85 | int cipher_init(struct sshcipher_ctx *, const struct sshcipher *, |
85 | const u_char *, u_int, int); | 86 | const u_char *, u_int, const u_char *, u_int, int); |
86 | int cipher_crypt(CipherContext *, u_int, u_char *, const u_char *, | 87 | const char* cipher_warning_message(const struct sshcipher_ctx *); |
88 | int cipher_crypt(struct sshcipher_ctx *, u_int, u_char *, const u_char *, | ||
87 | u_int, u_int, u_int); | 89 | u_int, u_int, u_int); |
88 | int cipher_get_length(CipherContext *, u_int *, u_int, | 90 | int cipher_get_length(struct sshcipher_ctx *, u_int *, u_int, |
89 | const u_char *, u_int); | 91 | const u_char *, u_int); |
90 | void cipher_cleanup(CipherContext *); | 92 | int cipher_cleanup(struct sshcipher_ctx *); |
91 | void cipher_set_key_string(CipherContext *, const Cipher *, const char *, int); | 93 | int cipher_set_key_string(struct sshcipher_ctx *, const struct sshcipher *, |
92 | u_int cipher_blocksize(const Cipher *); | 94 | const char *, int); |
93 | u_int cipher_keylen(const Cipher *); | 95 | u_int cipher_blocksize(const struct sshcipher *); |
94 | u_int cipher_seclen(const Cipher *); | 96 | u_int cipher_keylen(const struct sshcipher *); |
95 | u_int cipher_authlen(const Cipher *); | 97 | u_int cipher_seclen(const struct sshcipher *); |
96 | u_int cipher_ivlen(const Cipher *); | 98 | u_int cipher_authlen(const struct sshcipher *); |
97 | u_int cipher_is_cbc(const Cipher *); | 99 | u_int cipher_ivlen(const struct sshcipher *); |
100 | u_int cipher_is_cbc(const struct sshcipher *); | ||
98 | 101 | ||
99 | u_int cipher_get_number(const Cipher *); | 102 | u_int cipher_get_number(const struct sshcipher *); |
100 | void cipher_get_keyiv(CipherContext *, u_char *, u_int); | 103 | int cipher_get_keyiv(struct sshcipher_ctx *, u_char *, u_int); |
101 | void cipher_set_keyiv(CipherContext *, u_char *); | 104 | int cipher_set_keyiv(struct sshcipher_ctx *, const u_char *); |
102 | int cipher_get_keyiv_len(const CipherContext *); | 105 | int cipher_get_keyiv_len(const struct sshcipher_ctx *); |
103 | int cipher_get_keycontext(const CipherContext *, u_char *); | 106 | int cipher_get_keycontext(const struct sshcipher_ctx *, u_char *); |
104 | void cipher_set_keycontext(CipherContext *, u_char *); | 107 | void cipher_set_keycontext(struct sshcipher_ctx *, const u_char *); |
105 | #endif /* CIPHER_H */ | 108 | #endif /* CIPHER_H */ |