/***************************************************************************** Copyright (c) 2015, MariaDB Corporation. 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 Street, Suite 500, Boston, MA 02110-1335 USA *****************************************************************************/ /**************************************************//** @file include/fil0crypt.h The low-level file system encryption support functions Created 04/01/2015 Jan Lindström *******************************************************/ #ifndef fil0crypt_h #define fil0crypt_h #define FIL_MSG_CANNOT_DECRYPT "can not decrypt" #define FIL_ENCRYPTION_WRONG_KEY 1 #define FIL_ENCRYPTION_WRONG_PAGE_TYPE 2 #define FIL_ENCRYPTION_ERROR 3 #define FIL_ENCRYPTION_KEY_MISSING 4 #define FIL_ENCRYPTION_OK 0 #define FIL_ENCRYPTION_WILL_NOT_ENCRYPT 5 /* This key will be used if nothing else is given */ #define FIL_DEFAULT_ENCRYPTION_KEY 1 /** Enum values for encryption table option */ typedef enum { FIL_SPACE_ENCRYPTION_DEFAULT = 0, /* Tablespace encrypted if srv_encrypt_tables = ON */ FIL_SPACE_ENCRYPTION_ON = 1, /* Tablespace is encrypted always */ FIL_SPACE_ENCRYPTION_OFF = 2 /* Tablespace is not encrypted */ } fil_encryption_t; /** * CRYPT_SCHEME_UNENCRYPTED * * Used as intermediate state when convering a space from unencrypted * to encrypted */ /** * CRYPT_SCHEME_1 * * AES_CTR / AES_CBC: * L = AES_ECB(KEY, IV) * CRYPT(PAGE) = AES_CRT(KEY=L, IV=C, PAGE) */ #define CRYPT_SCHEME_1 1 #define CRYPT_SCHEME_1_IV_LEN 16 #define CRYPT_SCHEME_UNENCRYPTED 0 /* Currently supported encryption methods */ typedef enum { CRYPT_SCHEME_1_UNENCRYPTED = 0, /*