| 60 | } /* extern "C" */ |
| 61 | |
| 62 | int initialize_encryption_plugin(void *plugin_) |
| 63 | { |
| 64 | st_plugin_int *plugin= static_cast<st_plugin_int *>(plugin_); |
| 65 | if (encryption_manager) |
| 66 | return 1; |
| 67 | |
| 68 | vio_check_ssl_init(); |
| 69 | |
| 70 | if (plugin->plugin->init && plugin->plugin->init(plugin)) |
| 71 | { |
| 72 | sql_print_error("Plugin '%s' init function returned error.", |
| 73 | plugin->name.str); |
| 74 | return 1; |
| 75 | } |
| 76 | |
| 77 | encryption_manager= plugin_lock(NULL, plugin_int_to_ref(plugin)); |
| 78 | st_mariadb_encryption *handle= |
| 79 | (struct st_mariadb_encryption*) plugin->plugin->info; |
| 80 | |
| 81 | /* |
| 82 | Compiler on Spark doesn't like the '?' operator here as it |
| 83 | believes the (uint (*)...) implies the C++ call model. |
| 84 | */ |
| 85 | if (handle->crypt_ctx_size) |
| 86 | encryption_handler.encryption_ctx_size_func= handle->crypt_ctx_size; |
| 87 | else |
| 88 | encryption_handler.encryption_ctx_size_func= ctx_size; |
| 89 | |
| 90 | encryption_handler.encryption_ctx_init_func= |
| 91 | handle->crypt_ctx_init ? handle->crypt_ctx_init : ctx_init; |
| 92 | |
| 93 | encryption_handler.encryption_ctx_update_func= |
| 94 | handle->crypt_ctx_update ? handle->crypt_ctx_update : my_aes_crypt_update; |
| 95 | |
| 96 | encryption_handler.encryption_ctx_finish_func= |
| 97 | handle->crypt_ctx_finish ? handle->crypt_ctx_finish : my_aes_crypt_finish; |
| 98 | |
| 99 | encryption_handler.encryption_encrypted_length_func= |
| 100 | handle->encrypted_length ? handle->encrypted_length : get_length; |
| 101 | |
| 102 | encryption_handler.encryption_key_get_func= |
| 103 | handle->get_key; |
| 104 | |
| 105 | encryption_handler.encryption_key_get_latest_version_func= |
| 106 | handle->get_latest_key_version; // must be the last |
| 107 | |
| 108 | return 0; |
| 109 | } |
| 110 | |
| 111 | int finalize_encryption_plugin(void *plugin_) |
| 112 | { |
nothing calls this directly
no test coverage detected