Eneboo - Documentación para desarrolladores
src/libdigidoc/openssl/crypto/seed/seed.h
Ir a la documentación de este archivo.
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 
00081 #ifndef HEADER_SEED_H
00082 #define HEADER_SEED_H
00083 
00084 #include <openssl/opensslconf.h>
00085 
00086 #ifdef OPENSSL_NO_SEED
00087 #error SEED is disabled.
00088 #endif
00089 
00090 #ifdef AES_LONG /* look whether we need 'long' to get 32 bits */
00091 # ifndef SEED_LONG
00092 #  define SEED_LONG 1
00093 # endif
00094 #endif
00095 
00096 #if !defined(NO_SYS_TYPES_H)
00097 # include <sys/types.h>
00098 #endif
00099 
00100 #define SEED_BLOCK_SIZE 16
00101 #define SEED_KEY_LENGTH 16
00102 
00103 
00104 #ifdef  __cplusplus
00105 extern "C" {
00106 #endif
00107 
00108 
00109 typedef struct seed_key_st {
00110 #ifdef SEED_LONG
00111     unsigned long data[32];
00112 #else
00113     unsigned int data[32];
00114 #endif
00115 } SEED_KEY_SCHEDULE;
00116 
00117 
00118 void SEED_set_key(const unsigned char rawkey[SEED_KEY_LENGTH], SEED_KEY_SCHEDULE *ks);
00119 
00120 void SEED_encrypt(const unsigned char s[SEED_BLOCK_SIZE], unsigned char d[SEED_BLOCK_SIZE], const SEED_KEY_SCHEDULE *ks);
00121 void SEED_decrypt(const unsigned char s[SEED_BLOCK_SIZE], unsigned char d[SEED_BLOCK_SIZE], const SEED_KEY_SCHEDULE *ks);
00122 
00123 void SEED_ecb_encrypt(const unsigned char *in, unsigned char *out, const SEED_KEY_SCHEDULE *ks, int enc);
00124 void SEED_cbc_encrypt(const unsigned char *in, unsigned char *out,
00125         size_t len, const SEED_KEY_SCHEDULE *ks, unsigned char ivec[SEED_BLOCK_SIZE], int enc);
00126 void SEED_cfb128_encrypt(const unsigned char *in, unsigned char *out,
00127         size_t len, const SEED_KEY_SCHEDULE *ks, unsigned char ivec[SEED_BLOCK_SIZE], int *num, int enc);
00128 void SEED_ofb128_encrypt(const unsigned char *in, unsigned char *out,
00129         size_t len, const SEED_KEY_SCHEDULE *ks, unsigned char ivec[SEED_BLOCK_SIZE], int *num);
00130 
00131 #ifdef  __cplusplus
00132 }
00133 #endif
00134 
00135 #endif /* HEADER_SEED_H */
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'