2 * Copyright (c) 2007 KISA(Korea Information Security Agency). All rights reserved.
\r
4 * Redistribution and use in source and binary forms, with or without
\r
5 * modification, are permitted provided that the following conditions
\r
7 * 1. Redistributions of source code must retain the above copyright
\r
8 * notice, this list of conditions and the following disclaimer.
\r
9 * 2. Neither the name of author nor the names of its contributors may
\r
10 * be used to endorse or promote products derived from this software
\r
11 * without specific prior written permission.
\r
13 * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
\r
14 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
\r
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
\r
16 * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
\r
17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
\r
18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
\r
19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
\r
20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
\r
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
\r
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
\r
26 /* ====================================================================
\r
27 * Copyright (c) 1998-2007 The OpenSSL Project. All rights reserved.
\r
29 * Redistribution and use in source and binary forms, with or without
\r
30 * modification, are permitted provided that the following conditions
\r
33 * 1. Redistributions of source code must retain the above copyright
\r
34 * notice, this list of conditions and the following disclaimer.
\r
36 * 2. Redistributions in binary form must reproduce the above copyright
\r
37 * notice, this list of conditions and the following disclaimer in
\r
38 * the documentation and/or other materials provided with the
\r
41 * 3. All advertising materials mentioning features or use of this
\r
42 * software must display the following acknowledgment:
\r
43 * "This product includes software developed by the OpenSSL Project
\r
44 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
\r
46 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
\r
47 * endorse or promote products derived from this software without
\r
48 * prior written permission. For written permission, please contact
\r
49 * openssl-core@openssl.org.
\r
51 * 5. Products derived from this software may not be called "OpenSSL"
\r
52 * nor may "OpenSSL" appear in their names without prior written
\r
53 * permission of the OpenSSL Project.
\r
55 * 6. Redistributions of any form whatsoever must retain the following
\r
57 * "This product includes software developed by the OpenSSL Project
\r
58 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
\r
60 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
\r
61 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
\r
62 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
\r
63 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
\r
64 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
\r
65 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
\r
66 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
\r
67 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
\r
68 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
\r
69 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
\r
70 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
\r
71 * OF THE POSSIBILITY OF SUCH DAMAGE.
\r
72 * ====================================================================
\r
74 * This product includes cryptographic software written by Eric Young
\r
75 * (eay@cryptsoft.com). This product includes software written by Tim
\r
76 * Hudson (tjh@cryptsoft.com).
\r
81 #ifndef HEADER_SEED_H
\r
82 #define HEADER_SEED_H
\r
84 #include <openssl/opensslconf.h>
\r
85 #include <openssl/e_os2.h>
\r
86 #include <openssl/crypto.h>
\r
88 #ifdef OPENSSL_NO_SEED
\r
89 #error SEED is disabled.
\r
92 #ifdef AES_LONG /* look whether we need 'long' to get 32 bits */
\r
94 # define SEED_LONG 1
\r
98 #if !defined(NO_SYS_TYPES_H)
\r
99 # include <sys/types.h>
\r
102 #define SEED_BLOCK_SIZE 16
\r
103 #define SEED_KEY_LENGTH 16
\r
111 typedef struct seed_key_st {
\r
113 unsigned long data[32];
\r
115 unsigned int data[32];
\r
117 } SEED_KEY_SCHEDULE;
\r
120 void SEED_set_key(const unsigned char rawkey[SEED_KEY_LENGTH], SEED_KEY_SCHEDULE *ks);
\r
122 void SEED_encrypt(const unsigned char s[SEED_BLOCK_SIZE], unsigned char d[SEED_BLOCK_SIZE], const SEED_KEY_SCHEDULE *ks);
\r
123 void SEED_decrypt(const unsigned char s[SEED_BLOCK_SIZE], unsigned char d[SEED_BLOCK_SIZE], const SEED_KEY_SCHEDULE *ks);
\r
125 void SEED_ecb_encrypt(const unsigned char *in, unsigned char *out, const SEED_KEY_SCHEDULE *ks, int enc);
\r
126 void SEED_cbc_encrypt(const unsigned char *in, unsigned char *out,
\r
127 size_t len, const SEED_KEY_SCHEDULE *ks, unsigned char ivec[SEED_BLOCK_SIZE], int enc);
\r
128 void SEED_cfb128_encrypt(const unsigned char *in, unsigned char *out,
\r
129 size_t len, const SEED_KEY_SCHEDULE *ks, unsigned char ivec[SEED_BLOCK_SIZE], int *num, int enc);
\r
130 void SEED_ofb128_encrypt(const unsigned char *in, unsigned char *out,
\r
131 size_t len, const SEED_KEY_SCHEDULE *ks, unsigned char ivec[SEED_BLOCK_SIZE], int *num);
\r
137 #endif /* HEADER_SEED_H */
\r