No empty .Rs/.Re
[netbsd-mini2440.git] / crypto / external / bsd / openssh / dist / cipher.h
blob8edbf21d94b0596fcadfdf16f9d20e91e193cf78
1 /* $NetBSD$ */
2 /* $OpenBSD: cipher.h,v 1.37 2009/01/26 09:58:15 markus Exp $ */
4 /*
5 * Author: Tatu Ylonen <ylo@cs.hut.fi>
6 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
7 * All rights reserved
9 * As far as I am concerned, the code I have written for this software
10 * can be used freely for any purpose. Any derived versions of this
11 * software must be clearly marked as such, and if the derived work is
12 * incompatible with the protocol description in the RFC file, it must be
13 * called by a name other than "ssh" or "Secure Shell".
15 * Copyright (c) 2000 Markus Friedl. All rights reserved.
17 * Redistribution and use in source and binary forms, with or without
18 * modification, are permitted provided that the following conditions
19 * are met:
20 * 1. Redistributions of source code must retain the above copyright
21 * notice, this list of conditions and the following disclaimer.
22 * 2. Redistributions in binary form must reproduce the above copyright
23 * notice, this list of conditions and the following disclaimer in the
24 * documentation and/or other materials provided with the distribution.
26 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
27 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
28 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
29 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
30 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
31 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
35 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 #ifndef CIPHER_H
39 #define CIPHER_H
41 #include <openssl/evp.h>
43 * Cipher types for SSH-1. New types can be added, but old types should not
44 * be removed for compatibility. The maximum allowed value is 31.
46 #define SSH_CIPHER_SSH2 -3
47 #define SSH_CIPHER_INVALID -2 /* No valid cipher selected. */
48 #define SSH_CIPHER_NOT_SET -1 /* None selected (invalid number). */
49 #define SSH_CIPHER_NONE 0 /* no encryption */
50 #define SSH_CIPHER_IDEA 1 /* IDEA CFB */
51 #define SSH_CIPHER_DES 2 /* DES CBC */
52 #define SSH_CIPHER_3DES 3 /* 3DES CBC */
53 #define SSH_CIPHER_BROKEN_TSS 4 /* TRI's Simple Stream encryption CBC */
54 #define SSH_CIPHER_BROKEN_RC4 5 /* Alleged RC4 */
55 #define SSH_CIPHER_BLOWFISH 6
56 #define SSH_CIPHER_RESERVED 7
57 #define SSH_CIPHER_MAX 31
59 #define CIPHER_ENCRYPT 1
60 #define CIPHER_DECRYPT 0
62 typedef struct Cipher Cipher;
63 typedef struct CipherContext CipherContext;
65 struct Cipher;
66 struct CipherContext {
67 int plaintext;
68 EVP_CIPHER_CTX evp;
69 Cipher *cipher;
72 u_int cipher_mask_ssh1(int);
73 Cipher *cipher_by_name(const char *);
74 Cipher *cipher_by_number(int);
75 int cipher_number(const char *);
76 char *cipher_name(int);
77 int ciphers_valid(const char *);
78 void cipher_init(CipherContext *, Cipher *, const u_char *, u_int,
79 const u_char *, u_int, int);
80 void cipher_crypt(CipherContext *, u_char *, const u_char *, u_int);
81 void cipher_cleanup(CipherContext *);
82 void cipher_set_key_string(CipherContext *, Cipher *, const char *, int);
83 u_int cipher_blocksize(const Cipher *);
84 u_int cipher_keylen(const Cipher *);
85 u_int cipher_is_cbc(const Cipher *);
87 u_int cipher_get_number(const Cipher *);
88 void cipher_get_keyiv(CipherContext *, u_char *, u_int);
89 void cipher_set_keyiv(CipherContext *, u_char *);
90 int cipher_get_keyiv_len(const CipherContext *);
91 int cipher_get_keycontext(const CipherContext *, u_char *);
92 void cipher_set_keycontext(CipherContext *, u_char *);
93 #endif /* CIPHER_H */