40 #include <sys/types.h> 41 #include <openssl/evp.h> 42 #include "cipher-chachapoly.h" 43 #include "cipher-aesctr.h" 49 #define SSH_CIPHER_SSH2 -3 50 #define SSH_CIPHER_INVALID -2 51 #define SSH_CIPHER_NOT_SET -1 52 #define SSH_CIPHER_NONE 0 53 #define SSH_CIPHER_IDEA 1 54 #define SSH_CIPHER_DES 2 55 #define SSH_CIPHER_3DES 3 56 #define SSH_CIPHER_BROKEN_TSS 4 57 #define SSH_CIPHER_BROKEN_RC4 5 58 #define SSH_CIPHER_BLOWFISH 6 59 #define SSH_CIPHER_RESERVED 7 60 #define SSH_CIPHER_MAX 31 62 #define CIPHER_ENCRYPT 1 63 #define CIPHER_DECRYPT 0 66 struct sshcipher_ctx {
70 struct chachapoly_ctx cp_ctx;
71 struct aesctr_ctx ac_ctx;
72 const struct sshcipher *cipher;
75 void ssh_aes_ctr_thread_destroy(EVP_CIPHER_CTX *ctx);
76 void ssh_aes_ctr_thread_reconstruction(EVP_CIPHER_CTX *ctx);
78 u_int cipher_mask_ssh1(
int);
79 struct sshcipher *cipher_by_name(
const char *);
80 const struct sshcipher *cipher_by_number(
int);
81 int cipher_number(
const char *);
82 char *cipher_name(
int);
83 const char *cipher_warning_message(
const struct sshcipher_ctx *);
84 int ciphers_valid(
const char *);
85 char *cipher_alg_list(
char,
int);
86 int cipher_init(
struct sshcipher_ctx *,
const struct sshcipher *,
87 const u_char *, u_int,
const u_char *, u_int,
int);
88 int cipher_crypt(
struct sshcipher_ctx *, u_int, u_char *,
const u_char *,
90 int cipher_get_length(
struct sshcipher_ctx *, u_int *, u_int,
91 const u_char *, u_int);
92 int cipher_cleanup(
struct sshcipher_ctx *);
93 int cipher_set_key_string(
struct sshcipher_ctx *,
const struct sshcipher *,
95 u_int cipher_blocksize(
const struct sshcipher *);
96 u_int cipher_keylen(
const struct sshcipher *);
97 u_int cipher_seclen(
const struct sshcipher *);
98 u_int cipher_authlen(
const struct sshcipher *);
99 u_int cipher_ivlen(
const struct sshcipher *);
100 u_int cipher_is_cbc(
const struct sshcipher *);
101 void cipher_reset_multithreaded(
void);
102 const char *cipher_return_name(
const struct sshcipher *);
104 u_int cipher_get_number(
const struct sshcipher *);
105 int cipher_get_keyiv(
struct sshcipher_ctx *, u_char *, u_int);
106 int cipher_set_keyiv(
struct sshcipher_ctx *,
const u_char *);
107 int cipher_get_keyiv_len(
const struct sshcipher_ctx *);
108 int cipher_get_keycontext(
const struct sshcipher_ctx *, u_char *);
109 void cipher_set_keycontext(
struct sshcipher_ctx *,
const u_char *);