|
| 1 | +#ifndef MYSQL_SERVICE_ENCRYPTION_KEYS_INCLUDED |
| 2 | +/* Copyright (c) 2015, MariaDB |
| 3 | +
|
| 4 | + This program is free software; you can redistribute it and/or modify |
| 5 | + it under the terms of the GNU General Public License as published by |
| 6 | + the Free Software Foundation; version 2 of the License. |
| 7 | +
|
| 8 | + This program is distributed in the hope that it will be useful, |
| 9 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | + GNU General Public License for more details. |
| 12 | +
|
| 13 | + You should have received a copy of the GNU General Public License |
| 14 | + along with this program; if not, write to the Free Software |
| 15 | + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ |
| 16 | + |
| 17 | +/** |
| 18 | + @file |
| 19 | + encryption keys service |
| 20 | +
|
| 21 | + Functions to get encryption keys and IV from the encryption key management plugin |
| 22 | +*/ |
| 23 | + |
| 24 | +#ifdef __cplusplus |
| 25 | +extern "C" { |
| 26 | +#endif |
| 27 | + |
| 28 | +extern struct encryption_keys_service_st { |
| 29 | + unsigned int (*get_latest_encryption_key_version_func)(); |
| 30 | + unsigned int (*has_encryption_key_func)(unsigned int); |
| 31 | + unsigned int (*get_encryption_key_size_func)(unsigned int); |
| 32 | + int (*get_encryption_key_func)(unsigned int, unsigned char*, unsigned int); |
| 33 | + int (*get_encryption_iv_func)(unsigned int, unsigned char*, unsigned int); |
| 34 | +} *encryption_keys_service; |
| 35 | + |
| 36 | +#ifdef MYSQL_DYNAMIC_PLUGIN |
| 37 | + |
| 38 | +#define get_latest_encryption_key_version() encryption_keys_service->get_latest_encryption_key_version_func() |
| 39 | +#define has_encryption_key(V) encryption_keys_service->has_encryption_key_func(V) |
| 40 | +#define get_encryption_key_size(V) encryption_keys_service->get_encryption_key_size_func(V) |
| 41 | +#define get_encryption_key(V,K,S) encryption_keys_service->get_encryption_key_func((V), (K), (S)) |
| 42 | +#define get_encryption_iv(V, I, S) encryption_keys_service->get_encryption_iv_func((V), (I), (S)) |
| 43 | + |
| 44 | +#else |
| 45 | + |
| 46 | +unsigned int get_latest_encryption_key_version(); |
| 47 | +unsigned int has_encryption_key(unsigned int version); |
| 48 | +unsigned int get_encryption_key_size(unsigned int version); |
| 49 | +int get_encryption_key(unsigned int version, unsigned char* key, unsigned int keybufsize); |
| 50 | +int get_encryption_iv(unsigned int version, unsigned char* iv, unsigned int ivbufsize); |
| 51 | + |
| 52 | +#endif |
| 53 | + |
| 54 | +#ifdef __cplusplus |
| 55 | +} |
| 56 | +#endif |
| 57 | + |
| 58 | +#define MYSQL_SERVICE_ENCRYPTION_KEYS_INCLUDED |
| 59 | +#endif |
| 60 | + |
0 commit comments