summaryrefslogtreecommitdiff
path: root/storage/xtradb/include/fil0pageencryption.h
blob: fa2b1a5c592bbb91184d35dfc54dd8c4e77902db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*****************************************************************************

Copyright (C) 2014 eperi GmbH. All Rights Reserved.

This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; version 2 of the License.

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.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

*****************************************************************************/

#ifndef fil0pageencryption_h
#define fil0pageencryption_h

#define PAGE_ENCRYPTION_WRONG_KEY 1
#define PAGE_ENCRYPTION_WRONG_PAGE_TYPE 2
#define PAGE_ENCRYPTION_ERROR 3
#define PAGE_ENCRYPTION_KEY_MISSING  4
#define PAGE_ENCRYPTION_OK 0
#define PAGE_ENCRYPTION_WILL_NOT_ENCRYPT  5

/* This key will be used if nothing else is given */
#define DEFAULT_ENCRYPTION_KEY 1

#include "fsp0fsp.h"
#include "fsp0pageencryption.h"

/******************************************************************//**
@file include/fil0pageencryption.h
Helper functions for encryption/decryption page data on to table space.

Created 08/25/2014
***********************************************************************/

/*******************************************************************//**
Find out whether the page is page encrypted.
Returns the page encryption flag of the space, or false if the space
is not encrypted. The tablespace must be cached in the memory cache.
@return	true if page encrypted, false if not or space not found */
ibool
fil_space_is_page_encrypted(
/*========================*/
    ulint   id);	/*!< in: space id */

/*******************************************************************//**
Find out whether the page is page encrypted
@return	true if page is page encrypted, false if not */
UNIV_INLINE
ibool
fil_page_is_encrypted(
/*==================*/
    const byte *buf);	/*!< in: page */
/*******************************************************************//**
Find out whether the page is page compressed and then encrypted
@return	true if page is page compressed+encrypted, false if not */
UNIV_INLINE
ibool
fil_page_is_compressed_encrypted(
/*=============================*/
    const byte *buf);	/*!< in: page */

/*******************************************************************//**
Find out whether the page can be decrypted
@return	true if page can be decrypted, false if not. */
UNIV_INLINE
ulint
fil_page_encryption_status(
/*=======================*/
    const byte *buf);	/*!< in: page */


#endif // fil0pageencryption_h