summaryrefslogtreecommitdiff
path: root/mysys_ssl
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2015-01-05 13:36:14 +0100
committerSergei Golubchik <serg@mariadb.org>2015-02-10 10:21:17 +0100
commitcf8bf0b68e1c4281535813d4087680296138271c (patch)
tree6215215741e5ff9cebc7b7ec83168f396b735882 /mysys_ssl
parentc8997c39b4fac47eb580ea31f97a421bfc399e28 (diff)
downloadmariadb-git-cf8bf0b68e1c4281535813d4087680296138271c.tar.gz
encryption key management plugin api
Diffstat (limited to 'mysys_ssl')
-rw-r--r--mysys_ssl/CMakeLists.txt2
-rw-r--r--mysys_ssl/my_crypt_key_management.cc110
-rw-r--r--mysys_ssl/my_crypt_key_management_impl.cc34
3 files changed, 0 insertions, 146 deletions
diff --git a/mysys_ssl/CMakeLists.txt b/mysys_ssl/CMakeLists.txt
index 05b04b4d8cb..1479e3b3a90 100644
--- a/mysys_ssl/CMakeLists.txt
+++ b/mysys_ssl/CMakeLists.txt
@@ -40,8 +40,6 @@ SET(MYSYS_SSL_SOURCES
my_md5.cc
my_rnd.cc
my_crypt.cc
- my_crypt_key_management.cc
- my_crypt_key_management_impl.cc
)
ADD_CONVENIENCE_LIBRARY(mysys_ssl ${MYSYS_SSL_SOURCES})
diff --git a/mysys_ssl/my_crypt_key_management.cc b/mysys_ssl/my_crypt_key_management.cc
deleted file mode 100644
index 69efed32567..00000000000
--- a/mysys_ssl/my_crypt_key_management.cc
+++ /dev/null
@@ -1,110 +0,0 @@
-#include <my_global.h>
-#include <my_crypt_key_management.h>
-#include <cstring>
-
-#ifndef DBUG_OFF
-#include <myisampack.h>
-my_bool debug_use_static_encryption_keys = 0;
-
-#ifdef HAVE_PSI_INTERFACE
-PSI_rwlock_key key_LOCK_dbug_encryption_key_version;
-#endif
-mysql_rwlock_t LOCK_dbug_encryption_key_version;
-unsigned int opt_debug_encryption_key_version = 0;
-#endif
-
-/**
- * Default functions
- */
-int GetLatestCryptoKeyVersionImpl();
-unsigned int HasCryptoKeyImpl(unsigned int version);
-int GetCryptoKeySizeImpl(unsigned int version);
-int GetCryptoKeyImpl(unsigned int version, unsigned char* key_buffer,
- unsigned int size);
-int GetCryptoIVImpl(unsigned int version, unsigned char* key_buffer,
- unsigned int size);
-
-/**
- * Function pointers for
- * - GetLatestCryptoKeyVersion
- * - GetCryptoKey
- */
-static
-struct CryptoKeyFuncs_t cryptoKeyFuncs = {
- GetLatestCryptoKeyVersionImpl,
- HasCryptoKeyImpl,
- GetCryptoKeySizeImpl,
- GetCryptoKeyImpl,
- GetCryptoIVImpl
-};
-
-extern "C"
-int GetLatestCryptoKeyVersion() {
-#ifndef DBUG_OFF
- if (debug_use_static_encryption_keys) {
- mysql_rwlock_rdlock(&LOCK_dbug_encryption_key_version);
- unsigned int res = opt_debug_encryption_key_version;
- mysql_rwlock_unlock(&LOCK_dbug_encryption_key_version);
- return res;
- }
-#endif
-
- return (* cryptoKeyFuncs.getLatestCryptoKeyVersionFunc)();
-}
-
-extern "C"
-unsigned int HasCryptoKey(unsigned int version) {
- return (* cryptoKeyFuncs.hasCryptoKeyFunc)(version);
-}
-
-extern "C"
-int GetCryptoKeySize(unsigned int version) {
- return (* cryptoKeyFuncs.getCryptoKeySize)(version);
-}
-
-extern "C"
-int GetCryptoKey(unsigned int version, unsigned char* key, unsigned int size) {
-#ifndef DBUG_OFF
- if (debug_use_static_encryption_keys) {
- memset(key, 0, size);
- // Just don't support tiny keys, no point anyway.
- if (size < 4) {
- return 1;
- }
-
- mi_int4store(key, version);
- return 0;
- }
-#endif
-
- return (* cryptoKeyFuncs.getCryptoKeyFunc)(version, key, size);
-}
-
-extern "C"
-int GetCryptoIV(unsigned int version, unsigned char* key, unsigned int size) {
- return (* cryptoKeyFuncs.getCryptoIVFunc)(version, key, size);
-}
-
-extern "C"
-void
-InstallCryptoKeyFunctions(const struct CryptoKeyFuncs_t* _cryptoKeyFuncs)
-{
- if (_cryptoKeyFuncs == NULL)
- {
- /* restore defaults wHashhen called with NULL argument */
- cryptoKeyFuncs.getLatestCryptoKeyVersionFunc =
- GetLatestCryptoKeyVersionImpl;
- cryptoKeyFuncs.hasCryptoKeyFunc =
- HasCryptoKeyImpl;
- cryptoKeyFuncs.getCryptoKeySize =
- GetCryptoKeySizeImpl;
- cryptoKeyFuncs.getCryptoKeyFunc =
- GetCryptoKeyImpl;
- cryptoKeyFuncs.getCryptoIVFunc =
- GetCryptoIVImpl;
- }
- else
- {
- cryptoKeyFuncs = *_cryptoKeyFuncs;
- }
-}
diff --git a/mysys_ssl/my_crypt_key_management_impl.cc b/mysys_ssl/my_crypt_key_management_impl.cc
deleted file mode 100644
index af2077d8d15..00000000000
--- a/mysys_ssl/my_crypt_key_management_impl.cc
+++ /dev/null
@@ -1,34 +0,0 @@
-#include <my_global.h>
-
-// TODO Not yet implemented.
-int GetLatestCryptoKeyVersionImpl()
-{
- abort();
- return 0; /* Keep compiler happy */
-}
-
-unsigned int HasCryptoKeyImpl(unsigned int version)
-{
- abort();
- return 0; /* Keep compiler happy */
-}
-
-int GetCryptoKeySizeImpl(unsigned int version)
-{
- abort();
- return 0; /* Keep compiler happy */
-}
-
-int GetCryptoKeyImpl(unsigned int version, unsigned char* key,
- unsigned int key_size)
-{
- abort();
- return 0; /* Keep compiler happy */
-}
-
-int GetCryptoIVImpl(unsigned int version, unsigned char* key,
- unsigned int key_size)
-{
- abort();
- return 0; /* Keep compiler happy */
-}