summaryrefslogtreecommitdiff
path: root/cipher.h
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2016-08-03 05:41:57 +0000
committerDarren Tucker <dtucker@zip.com.au>2016-08-09 09:06:52 +1000
commit4706c1d8c15cd5565b59512853c2da9bd4ca26c9 (patch)
tree81ff9de3bdf3627b382bb4b808cf0e0612f4424f /cipher.h
parente600348a7afd6325cc5cd783cb424065cbc20434 (diff)
upstream commit
small refactor of cipher.c: make ciphercontext opaque to callers feedback and ok markus@ Upstream-ID: 094849f8be68c3bdad2c0f3dee551ecf7be87f6f
Diffstat (limited to 'cipher.h')
-rw-r--r--cipher.h23
1 files changed, 10 insertions, 13 deletions
diff --git a/cipher.h b/cipher.h
index 06d4be4d7..f4bca6285 100644
--- a/cipher.h
+++ b/cipher.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: cipher.h,v 1.48 2015/07/08 19:09:25 markus Exp $ */ 1/* $OpenBSD: cipher.h,v 1.49 2016/08/03 05:41:57 djm Exp $ */
2 2
3/* 3/*
4 * Author: Tatu Ylonen <ylo@cs.hut.fi> 4 * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -63,14 +63,7 @@
63#define CIPHER_DECRYPT 0 63#define CIPHER_DECRYPT 0
64 64
65struct sshcipher; 65struct sshcipher;
66struct sshcipher_ctx { 66struct sshcipher_ctx;
67 int plaintext;
68 int encrypt;
69 EVP_CIPHER_CTX evp;
70 struct chachapoly_ctx cp_ctx; /* XXX union with evp? */
71 struct aesctr_ctx ac_ctx; /* XXX union with evp? */
72 const struct sshcipher *cipher;
73};
74 67
75u_int cipher_mask_ssh1(int); 68u_int cipher_mask_ssh1(int);
76const struct sshcipher *cipher_by_name(const char *); 69const struct sshcipher *cipher_by_name(const char *);
@@ -80,15 +73,15 @@ char *cipher_name(int);
80const char *cipher_warning_message(const struct sshcipher_ctx *); 73const char *cipher_warning_message(const struct sshcipher_ctx *);
81int ciphers_valid(const char *); 74int ciphers_valid(const char *);
82char *cipher_alg_list(char, int); 75char *cipher_alg_list(char, int);
83int cipher_init(struct sshcipher_ctx *, const struct sshcipher *, 76int cipher_init(struct sshcipher_ctx **, const struct sshcipher *,
84 const u_char *, u_int, const u_char *, u_int, int); 77 const u_char *, u_int, const u_char *, u_int, int);
85int cipher_crypt(struct sshcipher_ctx *, u_int, u_char *, const u_char *, 78int cipher_crypt(struct sshcipher_ctx *, u_int, u_char *, const u_char *,
86 u_int, u_int, u_int); 79 u_int, u_int, u_int);
87int cipher_get_length(struct sshcipher_ctx *, u_int *, u_int, 80int cipher_get_length(struct sshcipher_ctx *, u_int *, u_int,
88 const u_char *, u_int); 81 const u_char *, u_int);
89int cipher_cleanup(struct sshcipher_ctx *); 82void cipher_free(struct sshcipher_ctx *);
90int cipher_set_key_string(struct sshcipher_ctx *, const struct sshcipher *, 83int cipher_set_key_string(struct sshcipher_ctx **,
91 const char *, int); 84 const struct sshcipher *, const char *, int);
92u_int cipher_blocksize(const struct sshcipher *); 85u_int cipher_blocksize(const struct sshcipher *);
93u_int cipher_keylen(const struct sshcipher *); 86u_int cipher_keylen(const struct sshcipher *);
94u_int cipher_seclen(const struct sshcipher *); 87u_int cipher_seclen(const struct sshcipher *);
@@ -96,10 +89,14 @@ u_int cipher_authlen(const struct sshcipher *);
96u_int cipher_ivlen(const struct sshcipher *); 89u_int cipher_ivlen(const struct sshcipher *);
97u_int cipher_is_cbc(const struct sshcipher *); 90u_int cipher_is_cbc(const struct sshcipher *);
98 91
92u_int cipher_ctx_is_plaintext(struct sshcipher_ctx *);
93u_int cipher_ctx_get_number(struct sshcipher_ctx *);
94
99u_int cipher_get_number(const struct sshcipher *); 95u_int cipher_get_number(const struct sshcipher *);
100int cipher_get_keyiv(struct sshcipher_ctx *, u_char *, u_int); 96int cipher_get_keyiv(struct sshcipher_ctx *, u_char *, u_int);
101int cipher_set_keyiv(struct sshcipher_ctx *, const u_char *); 97int cipher_set_keyiv(struct sshcipher_ctx *, const u_char *);
102int cipher_get_keyiv_len(const struct sshcipher_ctx *); 98int cipher_get_keyiv_len(const struct sshcipher_ctx *);
103int cipher_get_keycontext(const struct sshcipher_ctx *, u_char *); 99int cipher_get_keycontext(const struct sshcipher_ctx *, u_char *);
104void cipher_set_keycontext(struct sshcipher_ctx *, const u_char *); 100void cipher_set_keycontext(struct sshcipher_ctx *, const u_char *);
101
105#endif /* CIPHER_H */ 102#endif /* CIPHER_H */