PageRenderTime 20ms CodeModel.GetById 11ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/External/Mysql-5.0/include/my_aes.h

http://awoe.googlecode.com/
C++ Header | 65 lines | 9 code | 13 blank | 43 comment | 0 complexity | 1c73913fa8492d5e9d035dadc72eba2a MD5 | raw file
 1/* Copyright (C) 2002 MySQL AB
 2
 3 This program is free software; you can redistribute it and/or modify
 4 it under the terms of the GNU General Public License as published by
 5 the Free Software Foundation; version 2 of the License.
 6
 7 This program is distributed in the hope that it will be useful,
 8 but WITHOUT ANY WARRANTY; without even the implied warranty of
 9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10 GNU General Public License for more details.
11
12 You should have received a copy of the GNU General Public License
13 along with this program; if not, write to the Free Software
14 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
16
17/* Header file for my_aes.c */
18/* Wrapper to give simple interface for MySQL to AES standard encryption */
19
20#include "mysys/rijndael.h"
21
22C_MODE_START
23
24#define AES_KEY_LENGTH 128		/* Must be 128 192 or 256 */
25
26/*
27  my_aes_encrypt	- Crypt buffer with AES encryption algorithm.
28  source		- Pointer to data for encryption
29  source_length		- size of encryption data
30  dest			- buffer to place encrypted data (must be large enough)
31  key			- Key to be used for encryption
32  kel_length		- Length of the key. Will handle keys of any length
33
34  returns  - size of encrypted data, or negative in case of error.
35*/
36
37int my_aes_encrypt(const char *source, int source_length, char *dest,
38		   const char *key, int key_length);
39
40/*
41  my_aes_decrypt	- DeCrypt buffer with AES encryption algorithm.
42  source		- Pointer to data for decryption
43  source_length		- size of encrypted data
44  dest			- buffer to place decrypted data (must be large enough)
45  key			- Key to be used for decryption
46  kel_length		- Length of the key. Will handle keys of any length
47
48  returns  - size of original data, or negative in case of error.
49*/
50
51
52int my_aes_decrypt(const char *source, int source_length, char *dest,
53		   const char *key, int key_length);
54
55/*
56  my_aes_get_size - get size of buffer which will be large enough for encrypted
57		    data
58  source_length   -  length of data to be encrypted
59
60  returns  - size of buffer required to store encrypted data
61*/
62
63int my_aes_get_size(int source_length);
64
65C_MODE_END