~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

Viewing changes to include/my_aes.h

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2010-03-17 14:56:02 UTC
  • Revision ID: james.westby@ubuntu.com-20100317145602-x7e30l1b2sb5s6w6
Tags: upstream-5.1.45
ImportĀ upstreamĀ versionĀ 5.1.45

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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 "rijndael.h"
 
21
 
 
22
C_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
 
 
37
int 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
 
 
52
int 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
 
 
63
int my_aes_get_size(int source_length);
 
64
 
 
65
C_MODE_END