diff options
author | monty@hundin.mysql.fi <> | 2002-06-19 00:22:30 +0300 |
---|---|---|
committer | monty@hundin.mysql.fi <> | 2002-06-19 00:22:30 +0300 |
commit | 0d8e13979d49b1ea775a51d1e1b465c9621ef92b (patch) | |
tree | df0fd78ddd1c83d577e830a40da77487a62451b7 /include | |
parent | b1f7c1251c89cbd49fc20d244e14d07415715b71 (diff) | |
download | mariadb-git-0d8e13979d49b1ea775a51d1e1b465c9621ef92b.tar.gz |
Made keyread (key scanning) a key specific attribute.
This avoids using fulltext keys for table scanning.
This also reverts Sinisa's original fix for this problem.
Diffstat (limited to 'include')
-rw-r--r-- | include/my_aes.h | 80 | ||||
-rw-r--r-- | include/rijndael.h | 50 | ||||
-rw-r--r-- | include/sha1.h | 75 |
3 files changed, 82 insertions, 123 deletions
diff --git a/include/my_aes.h b/include/my_aes.h index 48ee11d15e5..5852baa5892 100644 --- a/include/my_aes.h +++ b/include/my_aes.h @@ -4,81 +4,63 @@ it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - - + + /* Header file for my_aes.c */ /* Wrapper to give simple interface for MySQL to AES standard encryption */ -#ifndef __MY_AES_H -#define __MY_AES_H - -#include "my_global.h" -#include <stdio.h> #include "rijndael.h" -#define AES_KEY_LENGTH 128 -/* Must be 128 192 or 256 */ +C_MODE_START -#ifdef __cplusplus -extern "C" { -#endif +#define AES_KEY_LENGTH 128 /* Must be 128 192 or 256 */ /* -my_aes_encrypt - Crypt buffer with AES encryption algorithm. -source - Pinter to data for encryption -source_length - size of encruption data -dest - buffer to place encrypted data (must be large enough) -key - Key to be used for encryption -kel_length - Lenght of the key. Will handle keys of any length - -returns - size of encrypted data, or negative in case of error. - + my_aes_encrypt - Crypt buffer with AES encryption algorithm. + source - Pointer to data for encryption + source_length - size of encryption data + dest - buffer to place encrypted data (must be large enough) + key - Key to be used for encryption + kel_length - Length of the key. Will handle keys of any length + + returns - size of encrypted data, or negative in case of error. */ -int my_aes_encrypt(const char* source, int source_length, const char* dest, - const char* key, int key_length); +int my_aes_encrypt(const char *source, int source_length, char *dest, + const char *key, int key_length); /* -my_aes_decrypt - DeCrypt buffer with AES encryption algorithm. -source - Pinter to data for decryption -source_length - size of encrypted data -dest - buffer to place decrypted data (must be large enough) -key - Key to be used for decryption -kel_length - Lenght of the key. Will handle keys of any length - -returns - size of original data, or negative in case of error. - + my_aes_decrypt - DeCrypt buffer with AES encryption algorithm. + source - Pointer to data for decryption + source_length - size of encrypted data + dest - buffer to place decrypted data (must be large enough) + key - Key to be used for decryption + kel_length - Length of the key. Will handle keys of any length + + returns - size of original data, or negative in case of error. */ -int my_aes_decrypt(const char* source, int source_length, const char* dest, - const char* key, int key_length); - +int my_aes_decrypt(const char *source, int source_length, char *dest, + const char *key, int key_length); /* -my_aes_get_size - get size of buffer which will be large enough for encrypted - data -source_length - length of data to be encrypted - -returns - size of buffer required to store encrypted data + my_aes_get_size - get size of buffer which will be large enough for encrypted + data + source_length - length of data to be encrypted + returns - size of buffer required to store encrypted data */ int my_aes_get_size(int source_length); - -#ifdef __cplusplus - } -#endif - - -#endif +C_MODE_END diff --git a/include/rijndael.h b/include/rijndael.h index 9d9f11e74bd..e286c89cbdc 100644 --- a/include/rijndael.h +++ b/include/rijndael.h @@ -4,45 +4,39 @@ it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - - + + /* - rijndael-alg-fst.h - - @version 3.0 (December 2000) - Optimised ANSI C code for the Rijndael cipher (now AES) - @author Vincent Rijmen <vincent.rijmen@esat.kuleuven.ac.be> - @author Antoon Bosselaers <antoon.bosselaers@esat.kuleuven.ac.be> - @author Paulo Barreto <paulo.barreto@terra.com.br> - - This code is hereby placed in the public domain. - - Modified by Peter Zaitsev to fit MySQL coding style. - + rijndael-alg-fst.h + + @version 3.0 (December 2000) + Optimised ANSI C code for the Rijndael cipher (now AES) + @author Vincent Rijmen <vincent.rijmen@esat.kuleuven.ac.be> + @author Antoon Bosselaers <antoon.bosselaers@esat.kuleuven.ac.be> + @author Paulo Barreto <paulo.barreto@terra.com.br> + + This code is hereby placed in the public domain. + Modified by Peter Zaitsev to fit MySQL coding style. */ -#ifndef __RIJNDAEL_ALG_FST_H -#define __RIJNDAEL_ALG_FST_H -#define MAXKC (256/32) -#define MAXKB (256/8) -#define MAXNR 14 +#define AES_MAXKC (256/32) +#define AES_MAXKB (256/8) +#define AES_MAXNR 14 -int rijndaelKeySetupEnc(uint32 rk[/*4*(Nr + 1)*/], const uint8 cipherKey[], - int keyBits); +int rijndaelKeySetupEnc(uint32 rk[/*4*(Nr + 1)*/], const uint8 cipherKey[], + int keyBits); int rijndaelKeySetupDec(uint32 rk[/*4*(Nr + 1)*/], const uint8 cipherKey[], - int keyBits); + int keyBits); void rijndaelEncrypt(const uint32 rk[/*4*(Nr + 1)*/], int Nr, - const uint8 pt[16], uint8 ct[16]); + const uint8 pt[16], uint8 ct[16]); void rijndaelDecrypt(const uint32 rk[/*4*(Nr + 1)*/], int Nr, - const uint8 ct[16], uint8 pt[16]); - -#endif /* __RIJNDAEL_ALG_FST_H */ + const uint8 ct[16], uint8 pt[16]); diff --git a/include/sha1.h b/include/sha1.h index 9871282cdd4..1c345469d3c 100644 --- a/include/sha1.h +++ b/include/sha1.h @@ -4,81 +4,64 @@ it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + /* - sha1.h - - Description: - This is the header file for code which implements the Secure - Hashing Algorithm 1 as defined in FIPS PUB 180-1 published - April 17, 1995. - - Many of the variable names in this code, especially the - single character names, were used because those were the names - used in the publication. - - Please read the file sha1.c for more information. - -*/ - -/* Modified 2002 by Peter Zaitsev to better follow MySQL standards */ + This is the header file for code which implements the Secure + Hashing Algorithm 1 as defined in FIPS PUB 180-1 published + April 17, 1995. + Many of the variable names in this code, especially the + single character names, were used because those were the names + used in the publication. -#ifndef _SHA1_H_ -#define _SHA1_H_ + Please read the file sha1.c for more information. -#include "my_global.h" + Modified 2002 by Peter Zaitsev to better follow MySQL standards +*/ -/* Required for uint32, uint8, int16 ulonglong types */ enum sha_result_codes { - SHA_SUCCESS = 0, - SHA_NULL, /* Null pointer parameter */ - SHA_INPUT_TOO_LONG, /* input data too long */ - SHA_STATE_ERROR /* called Input after Result */ + SHA_SUCCESS = 0, + SHA_NULL, /* Null pointer parameter */ + SHA_INPUT_TOO_LONG, /* input data too long */ + SHA_STATE_ERROR /* called Input after Result */ }; #define SHA1_HASH_SIZE 20 /* Hash size in bytes */ /* - This structure will hold context information for the SHA-1 - hashing operation - */ + This structure will hold context information for the SHA-1 + hashing operation +*/ + typedef struct SHA1_CONTEXT { - ulonglong Length; /* Message length in bits */ + ulonglong Length; /* Message length in bits */ uint32 Intermediate_Hash[SHA1_HASH_SIZE/4]; /* Message Digest */ - int Computed; /* Is the digest computed? */ - int Corrupted; /* Is the message digest corrupted? */ - int16 Message_Block_Index; /* Index into message block array */ - uint8 Message_Block[64]; /* 512-bit message blocks */ + int Computed; /* Is the digest computed? */ + int Corrupted; /* Is the message digest corrupted? */ + int16 Message_Block_Index; /* Index into message block array */ + uint8 Message_Block[64]; /* 512-bit message blocks */ } SHA1_CONTEXT; /* - * Function Prototypes - */ - + Function Prototypes +*/ -#ifdef __cplusplus -extern "C" { -#endif +C_MODE_START int sha1_reset( SHA1_CONTEXT* ); int sha1_input( SHA1_CONTEXT*, const uint8 *, unsigned int ); int sha1_result( SHA1_CONTEXT* , uint8 Message_Digest[SHA1_HASH_SIZE] ); - -#ifdef __cplusplus -} -#endif -#endif +C_MODE_END |