LTKCPP-- LLRP Toolkit C Plus Plus Library
|
00001 /* 00002 * Copyright (c) 2007 KISA(Korea Information Security Agency). All rights reserved. 00003 * 00004 * Redistribution and use in source and binary forms, with or without 00005 * modification, are permitted provided that the following conditions 00006 * are met: 00007 * 1. Redistributions of source code must retain the above copyright 00008 * notice, this list of conditions and the following disclaimer. 00009 * 2. Neither the name of author nor the names of its contributors may 00010 * be used to endorse or promote products derived from this software 00011 * without specific prior written permission. 00012 * 00013 * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND 00014 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00015 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00016 * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE 00017 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00018 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 00019 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00020 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00021 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 00022 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00023 * SUCH DAMAGE. 00024 * 00025 */ 00026 /* ==================================================================== 00027 * Copyright (c) 1998-2007 The OpenSSL Project. All rights reserved. 00028 * 00029 * Redistribution and use in source and binary forms, with or without 00030 * modification, are permitted provided that the following conditions 00031 * are met: 00032 * 00033 * 1. Redistributions of source code must retain the above copyright 00034 * notice, this list of conditions and the following disclaimer. 00035 * 00036 * 2. Redistributions in binary form must reproduce the above copyright 00037 * notice, this list of conditions and the following disclaimer in 00038 * the documentation and/or other materials provided with the 00039 * distribution. 00040 * 00041 * 3. All advertising materials mentioning features or use of this 00042 * software must display the following acknowledgment: 00043 * "This product includes software developed by the OpenSSL Project 00044 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" 00045 * 00046 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 00047 * endorse or promote products derived from this software without 00048 * prior written permission. For written permission, please contact 00049 * openssl-core@openssl.org. 00050 * 00051 * 5. Products derived from this software may not be called "OpenSSL" 00052 * nor may "OpenSSL" appear in their names without prior written 00053 * permission of the OpenSSL Project. 00054 * 00055 * 6. Redistributions of any form whatsoever must retain the following 00056 * acknowledgment: 00057 * "This product includes software developed by the OpenSSL Project 00058 * for use in the OpenSSL Toolkit (http://www.openssl.org/)" 00059 * 00060 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 00061 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00062 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00063 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 00064 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00065 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 00066 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00067 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00068 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 00069 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00070 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 00071 * OF THE POSSIBILITY OF SUCH DAMAGE. 00072 * ==================================================================== 00073 * 00074 * This product includes cryptographic software written by Eric Young 00075 * (eay@cryptsoft.com). This product includes software written by Tim 00076 * Hudson (tjh@cryptsoft.com). 00077 * 00078 */ 00079 00080 #ifndef HEADER_SEED_H 00081 # define HEADER_SEED_H 00082 00083 # include <openssl/opensslconf.h> 00084 # include <openssl/e_os2.h> 00085 # include <openssl/crypto.h> 00086 00087 # ifdef OPENSSL_NO_SEED 00088 # error SEED is disabled. 00089 # endif 00090 00091 /* look whether we need 'long' to get 32 bits */ 00092 # ifdef AES_LONG 00093 # ifndef SEED_LONG 00094 # define SEED_LONG 1 00095 # endif 00096 # endif 00097 00098 # if !defined(NO_SYS_TYPES_H) 00099 # include <sys/types.h> 00100 # endif 00101 00102 # define SEED_BLOCK_SIZE 16 00103 # define SEED_KEY_LENGTH 16 00104 00105 00106 #ifdef __cplusplus 00107 extern "C" { 00108 #endif 00109 00110 typedef struct seed_key_st { 00111 # ifdef SEED_LONG 00112 unsigned long data[32]; 00113 # else 00114 unsigned int data[32]; 00115 # endif 00116 } SEED_KEY_SCHEDULE; 00117 00118 # ifdef OPENSSL_FIPS 00119 void private_SEED_set_key(const unsigned char rawkey[SEED_KEY_LENGTH], 00120 SEED_KEY_SCHEDULE *ks); 00121 # endif 00122 void SEED_set_key(const unsigned char rawkey[SEED_KEY_LENGTH], 00123 SEED_KEY_SCHEDULE *ks); 00124 00125 void SEED_encrypt(const unsigned char s[SEED_BLOCK_SIZE], 00126 unsigned char d[SEED_BLOCK_SIZE], 00127 const SEED_KEY_SCHEDULE *ks); 00128 void SEED_decrypt(const unsigned char s[SEED_BLOCK_SIZE], 00129 unsigned char d[SEED_BLOCK_SIZE], 00130 const SEED_KEY_SCHEDULE *ks); 00131 00132 void SEED_ecb_encrypt(const unsigned char *in, unsigned char *out, 00133 const SEED_KEY_SCHEDULE *ks, int enc); 00134 void SEED_cbc_encrypt(const unsigned char *in, unsigned char *out, size_t len, 00135 const SEED_KEY_SCHEDULE *ks, 00136 unsigned char ivec[SEED_BLOCK_SIZE], int enc); 00137 void SEED_cfb128_encrypt(const unsigned char *in, unsigned char *out, 00138 size_t len, const SEED_KEY_SCHEDULE *ks, 00139 unsigned char ivec[SEED_BLOCK_SIZE], int *num, 00140 int enc); 00141 void SEED_ofb128_encrypt(const unsigned char *in, unsigned char *out, 00142 size_t len, const SEED_KEY_SCHEDULE *ks, 00143 unsigned char ivec[SEED_BLOCK_SIZE], int *num); 00144 00145 #ifdef __cplusplus 00146 } 00147 #endif 00148 00149 #endif /* HEADER_SEED_H */