MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
my_aes.h
1 #ifndef MY_AES_INCLUDED
2 #define MY_AES_INCLUDED
3 
4 /* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; version 2 of the License.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
18 
19 
20 /* Header file for my_aes.c */
21 /* Wrapper to give simple interface for MySQL to AES standard encryption */
22 
23 C_MODE_START
24 
25 #define AES_KEY_LENGTH 128 /* Must be 128 192 or 256 */
26 
27 /*
28  my_aes_encrypt - Crypt buffer with AES encryption algorithm.
29  source - Pointer to data for encryption
30  source_length - size of encryption data
31  dest - buffer to place encrypted data (must be large enough)
32  key - Key to be used for encryption
33  kel_length - Length of the key. Will handle keys of any length
34 
35  returns - size of encrypted data, or negative in case of error.
36 */
37 
38 int my_aes_encrypt(const char *source, int source_length, char *dest,
39  const char *key, int key_length);
40 
41 /*
42  my_aes_decrypt - DeCrypt buffer with AES encryption algorithm.
43  source - Pointer to data for decryption
44  source_length - size of encrypted data
45  dest - buffer to place decrypted data (must be large enough)
46  key - Key to be used for decryption
47  kel_length - Length of the key. Will handle keys of any length
48 
49  returns - size of original data, or negative in case of error.
50 */
51 
52 
53 int my_aes_decrypt(const char *source, int source_length, char *dest,
54  const char *key, int key_length);
55 
56 /*
57  my_aes_get_size - get size of buffer which will be large enough for encrypted
58  data
59  source_length - length of data to be encrypted
60 
61  returns - size of buffer required to store encrypted data
62 */
63 
64 int my_aes_get_size(int source_length);
65 
66 C_MODE_END
67 
68 #endif /* MY_AES_INCLUDED */