From b915692195a2ca2b38be98e3604c0c274a4d55ca Mon Sep 17 00:00:00 2001 From: JoungKyun Kim Date: Mon, 23 Dec 2013 16:51:13 +0000 Subject: [PATCH] tagging 1.0.2 --- Changes | 2 +- Makefile.am | 2 +- Makefile.in | 2 +- README | 2 +- autogen | 24 -- configure | 0 configure.ac | 2 +- contrib/external/Makefile | 11 - contrib/external/mysql_aes256_crypto.c | 228 ------------------ contrib/external/mysql_aes256_mcrypt.c | 315 ------------------------- contrib/external/test.c | 153 ------------ docs/aes256_install.sql | 2 +- m4/ax_gcc_visibility.m4 | 2 +- src/Makefile.am | 2 +- src/Makefile.in | 2 +- src/mysql_aes256.c | 2 +- src/mysql_aes256.h | 2 +- src/mysql_aes256_config.h.in | 2 +- 18 files changed, 12 insertions(+), 743 deletions(-) delete mode 100755 autogen mode change 100644 => 100755 configure delete mode 100644 contrib/external/Makefile delete mode 100644 contrib/external/mysql_aes256_crypto.c delete mode 100644 contrib/external/mysql_aes256_mcrypt.c delete mode 100644 contrib/external/test.c diff --git a/Changes b/Changes index e898987..6052385 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,6 @@ Changelog -$Id$ +$Id: Changes 20 2013-12-23 16:44:25Z oops $ Tue, Dec 24 2013 JoungKyun.Kim - release 1.0.2 diff --git a/Makefile.am b/Makefile.am index 3a088e1..4797922 100644 --- a/Makefile.am +++ b/Makefile.am @@ -18,7 +18,7 @@ # ----------------------------------------------------------------------------- # This file is part of lib_mysqludf_aes256. # -# $Id$ +# $Id: Makefile.am 21 2013-12-23 16:46:44Z oops $ DISTCLEANFILES = *.bz2 *~ diff --git a/Makefile.in b/Makefile.in index caa99fc..75c0b34 100644 --- a/Makefile.in +++ b/Makefile.in @@ -35,7 +35,7 @@ # ----------------------------------------------------------------------------- # This file is part of lib_mysqludf_aes256. # -# $Id$ +# $Id: Makefile.in 22 2013-12-23 16:47:53Z oops $ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ diff --git a/README b/README index ce230ef..6085036 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -$Id$ +$Id: README 2 2013-09-22 06:56:19Z oops $ lib_mysqludf_aes256 - Support AES256 encrypt/decrypt diff --git a/autogen b/autogen deleted file mode 100755 index ff8570e..0000000 --- a/autogen +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# -# $Id$ -# require autoconf > 2.63 & automake > 1.11 -# - -opt= - -[ "$1" = "--install" ] && opt="$1" - -export LIBTOOL=/usr/bin/libtool -export AUTOMAKE=/usr/bin/automake -export ACLOCAL=/usr/bin/aclocal - -rm -f configure -autoreconf $opt - -if [ -n "$opt" ]; then - rm -rf po ABOUT-NLS -fi - -rm -rf autom4te.cache *~ - -exit 0 diff --git a/configure b/configure old mode 100644 new mode 100755 diff --git a/configure.ac b/configure.ac index 4417992..685f810 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ # Process this file with autoconf to produce a configure script. # Configure template for mysql aes256 encrypt/decrypt UDF # -# $Id$ +# $Id: configure.ac 19 2013-12-23 16:43:42Z oops $ AC_PREREQ(2.59) AC_INIT([lib_mysqludf_aes256], [1.0.2], [http://oops.org]) diff --git a/contrib/external/Makefile b/contrib/external/Makefile deleted file mode 100644 index e9be025..0000000 --- a/contrib/external/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -CC = gcc -CFLAGS = -Wall -O0 -g3 -DMY_AES256_DEBUG -LDFLAGS = -LIBADD = -CPPFLAGS = -I. -I../../src -I/usr/include/mysql - -all: - $(CC) $(CFLAGS) $(LDFLAGS) $(CPPFLAGS) test.c mysql_aes256_mcrypt.c $(LIBADD) -lmcrypt - -crypto: - $(CC) $(CFLAGS) -DFORCE_CRYPTO $(LDFLAGS) $(CPPFLAGS) test.c mysql_aes256_crypto.c $(LIBADD) -lcrypto diff --git a/contrib/external/mysql_aes256_crypto.c b/contrib/external/mysql_aes256_crypto.c deleted file mode 100644 index 919329a..0000000 --- a/contrib/external/mysql_aes256_crypto.c +++ /dev/null @@ -1,228 +0,0 @@ -/* - * Written by JoungKyun.Kim - * Copyright (c) 2013 JoungKyun.Kim - * - * ----------------------------------------------------------------------------- - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of JoungKyun.Kim nor the url of http[s]://[*.]oops.org - * nor the names of their contributors may be used to endorse or - * promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * ----------------------------------------------------------------------------- - * This file is part of lib_mysqludf_aes267 - * - * $Id$ - */ - -#include -#include -#include -#include -#include - -#include -#include - -#ifdef FORCE_CRYPTO - #ifdef HAVE_MCRYPT_H - #undef HAVE_MCRYPT_H - #endif -#endif - -typedef struct aes256_data { - unsigned char * data; - int datalen; - unsigned char * key; - int keylen; - unsigned char * iv; - int ivlen; - int keysize; - int blocksize; - int ivsize; - unsigned char * buffer; - void * handle; -} AES256_DATA; - -my_bool aes256_init_api (AES256_DATA * aes, char *msg) { - EVP_CIPHER_CTX *e; - int i; - int nrounds = 5; - unsigned char iv[32], ckey[32]; - - DEBUG_SUB_FUNCTION_IN; - - if ( aes->handle != null ) - return true; - - /* - * Gen key & IV for AES 256 ECB mode. A SHA1 digest is used to hash - * the supplied key material. nrounds is the number of times the - * we hash the material. More rounds are more secure but - * slower. - */ - i = EVP_BytesToKey ( - EVP_aes_256_ecb (), - EVP_sha1 (), NULL, - aes->key, - aes->keylen, - nrounds, - ckey, - iv - ); - - if ( i != 32 ) { - sprintf (msg, "Key size is %d bits - should be 256 bits\n", i); - sprintf ( - msg, - "Key size is %d bits - should be 256 bits (udf: %s %s:%d)\n", - i, MY_AES256_DEBUGINFO - ); - DEBUG_SUB_FUNCTION_OUT; - return false; - } - - e = (EVP_CIPHER_CTX *) malloc (sizeof (EVP_CIPHER_CTX)); - EVP_CIPHER_CTX_init (e); - - aes->handle = (EVP_CIPHER_CTX *) e; - aes->keysize = 32; - aes->blocksize = 16; - - DEBUG_SUB_FUNCTION_OUT; - return true; -} - -void aes256_close_api (AES256_DATA * aes) { - DEBUG_SUB_FUNCTION_IN; - EVP_CIPHER_CTX_cleanup (aes->handle); - aes->handle = null; - DEBUG_SUB_FUNCTION_OUT; -} - -my_bool aes256_encrypt_api (AES256_DATA * aes) { - int blocks; - int length; - - DEBUG_SUB_FUNCTION_IN; - - if ( aes->handle == null ) { - fprintf ( - stderr, - "EVP Encrypt handle is not initialize. (udf: %s %s:%d)\n", - MY_AES256_DEBUGINFO - ); - DEBUG_SUB_FUNCTION_OUT; - return false; - } - - EVP_EncryptInit_ex (aes->handle, EVP_aes_256_ecb (), NULL, aes->key, NULL); - blocks = sizeof (char) * aes->datalen * aes->blocksize; - -#ifdef MY_AES256_DEBUG - fprintf (stderr, " - data : %s (udf: %s:%d)\n", aes->data, MY_AES256_SDEBUGINFO); - fprintf (stderr, " - datalen : %u (%zd) (udf: %s:%d)\n", aes->datalen, strlen ((char *) aes->data), MY_AES256_SDEBUGINFO); - int i; - fprintf (stderr, " "); - for ( i=0; idatalen; i++ ) { - fprintf (stderr, "%d ", aes->data[i]); - } - fprintf (stderr, "(udf: %s:%d)\n", MY_AES256_SDEBUGINFO); - fprintf (stderr, " - key : %s (udf: %s:%d)\n", aes->key, MY_AES256_SDEBUGINFO); - fprintf (stderr, " - keylen : %u (udf: %s:%d)\n", aes->keylen, MY_AES256_SDEBUGINFO); - fprintf (stderr, " - blocks : %d (udf: %s:%d)\n", blocks, MY_AES256_SDEBUGINFO); -#endif - - aes->buffer = (unsigned char *) malloc (blocks + 1); - if ( aes->buffer == null ) { - fprintf ( - stderr, - "Failed memory allocated (udf: %s %s:%d)\n", - MY_AES256_DEBUGINFO - ); - DEBUG_SUB_FUNCTION_OUT; - return false; - } - memset (aes->buffer, 0, blocks); - - EVP_EncryptInit_ex (aes->handle, NULL, NULL, NULL, NULL); - EVP_EncryptUpdate (aes->handle, aes->buffer, &blocks, aes->data, aes->datalen); - EVP_EncryptFinal_ex(aes->handle, aes->buffer + blocks, &length); - -#ifdef MY_AES256_DEBUG - fprintf (stderr, " - buf : %s (udf: %s:%d)\n", aes->buffer, MY_AES256_SDEBUGINFO); - fprintf (stderr, " - buflen : %u (%zd) (udf: %s:%d)\n", blocks, strlen ((char *) aes->buffer), MY_AES256_SDEBUGINFO); - - fprintf (stderr, " "); - for ( i=0; ibuffer[i]); - } - fprintf (stderr, "(udf: %s:%d)\n", MY_AES256_SDEBUGINFO); -#endif - - aes->datalen = blocks + length; - DEBUG_SUB_FUNCTION_OUT; - return true; -} - -my_bool aes256_decrypt_api (AES256_DATA * aes) { - int blocks; - int length; - - DEBUG_SUB_FUNCTION_IN; - - EVP_DecryptInit_ex (aes->handle, EVP_aes_256_ecb (), NULL, aes->key, NULL); - blocks = sizeof (char) * aes->datalen; - - aes->buffer = (unsigned char *) malloc (blocks + 1); - if ( aes->buffer == null ) { - fprintf ( - stderr, - "Failed memory allocated (udf: %s %s:%d)\n", - MY_AES256_DEBUGINFO - ); - DEBUG_SUB_FUNCTION_OUT; - return false; - } - memset (aes->buffer, 0, blocks); - - EVP_DecryptInit_ex(aes->handle, NULL, NULL, NULL, NULL); - EVP_DecryptUpdate(aes->handle, aes->buffer, &blocks, aes->data, aes->datalen); - EVP_DecryptFinal_ex(aes->handle, aes->buffer + blocks, &length); - - aes->datalen = blocks + length; - aes->buffer[aes->datalen] = 0; - - DEBUG_SUB_FUNCTION_OUT; - return true; -} -#endif - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: noet sw=4 ts=4 fdm=marker - * vim<600: noet sw=4 ts=4 - */ diff --git a/contrib/external/mysql_aes256_mcrypt.c b/contrib/external/mysql_aes256_mcrypt.c deleted file mode 100644 index eb21080..0000000 --- a/contrib/external/mysql_aes256_mcrypt.c +++ /dev/null @@ -1,315 +0,0 @@ -/* - * Written by JoungKyun.Kim - * Copyright (c) 2013 JoungKyun.Kim - * - * ----------------------------------------------------------------------------- - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of JoungKyun.Kim nor the url of http[s]://[*.]oops.org - * nor the names of their contributors may be used to endorse or - * promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * ----------------------------------------------------------------------------- - * This file is part of lib_mysqludf_aes267 - * - * $Id$ - */ - -#include -#include -#include -#include -#include - -#include -#include - -typedef struct aes256_data { - unsigned char * data; - int datalen; - unsigned char * key; - int keylen; - unsigned char * iv; - int ivlen; - int keysize; - int blocksize; - int ivsize; - unsigned char * buffer; - void * handle; -} AES256_DATA; - -my_bool aes256_init_api (AES256_DATA * aes, char *msg) { - DEBUG_SUB_FUNCTION_IN; - - if ( aes->handle != null ) - return true; - - aes->handle = mcrypt_module_open (MCRYPT_RIJNDAEL_128, NULL, MCRYPT_ECB, NULL); - if ( aes->handle == MCRYPT_FAILED ) { - sprintf ( - msg, - "Mcrypt module open failed (udf: %s %s:%d)\n", - MY_AES256_DEBUGINFO - ); - return false; - } - - aes->keysize = mcrypt_enc_get_key_size (aes->handle); // 32 - aes->blocksize = mcrypt_enc_get_block_size (aes->handle); // 16 - - DEBUG_SUB_FUNCTION_OUT; - return true; -} - -void aes256_close_api (AES256_DATA * aes) { - DEBUG_SUB_FUNCTION_IN; - mcrypt_module_close (aes->handle); - aes->handle = null; - DEBUG_SUB_FUNCTION_OUT; -} - -my_bool aes256_encrypt_api (AES256_DATA * aes) { - int r; - int blocks; - int padlen; - - DEBUG_SUB_FUNCTION_IN; - - if ( aes->handle == null ) { - fprintf ( - stderr, - "Mcrypt handle is not initialize. (udf: %s %s:%d)\n", - MY_AES256_DEBUGINFO - ); - DEBUG_SUB_FUNCTION_OUT; - return false; - } - - if ( aes->datalen < 1 || aes->keylen < 1 ) { - fprintf ( - stderr, - "The data or key is missing. (udf: %s %s:%d)\n", - MY_AES256_DEBUGINFO - ); - DEBUG_SUB_FUNCTION_OUT; - return false; - } - - r = mcrypt_generic_init (aes->handle, aes->key, aes->keysize, NULL); - if ( r < 0 ) { - aes256_close_api (aes); - fprintf ( - stderr, - "%s (udf: %s %s:%d)\n", - mcrypt_strerror (r), MY_AES256_DEBUGINFO - ); - DEBUG_SUB_FUNCTION_OUT; - return false; - } - -#ifdef MY_AES256_DEBUG - fprintf (stderr, " - data : %s (udf: %s:%d)\n", aes->data, MY_AES256_SDEBUGINFO); - fprintf (stderr, " - datalen : %u (%zd) (udf: %s:%d)\n", aes->datalen, strlen ((char *) aes->data), MY_AES256_SDEBUGINFO); - fprintf (stderr, " - key : %s (udf: %s:%d)\n", aes->key, MY_AES256_SDEBUGINFO); - fprintf (stderr, " - keylen : %u (udf: %s:%d)\n", aes->keylen, MY_AES256_SDEBUGINFO); -#endif - - blocks = aes->blocksize * ((int) (aes->datalen / aes->blocksize) + 1); - blocks = sizeof (char) * (blocks); - - aes->buffer = (unsigned char *) malloc (blocks + 1); - if ( aes->buffer == null ) { - fprintf ( - stderr, - "Failed memory allocated (udf: %s %s:%d)\n", - MY_AES256_DEBUGINFO - ); - DEBUG_SUB_FUNCTION_OUT; - return false; - } - - memset (aes->buffer, 0, blocks + 1); - - if ( aes->datalen > blocks ) - aes->datalen = blocks - 1; - - memcpy (aes->buffer, aes->data, aes->datalen); - padlen = blocks - aes->datalen; - // padding - memset (aes->buffer + aes->datalen, padlen, ((int) padlen)); - -#ifdef MY_AES256_DEBUG - fprintf (stderr, " - blocks : %d (udf: %s:%d)\n", blocks, MY_AES256_SDEBUGINFO); - fprintf (stderr, " - buf : %s (udf: %s:%d)\n", aes->buffer, MY_AES256_SDEBUGINFO); - int i; - fprintf (stderr, " "); - for ( i=0; ibuffer[i]); - } - fprintf (stderr, "(udf: %s:%d)\n", MY_AES256_SDEBUGINFO); -#endif - - r = mcrypt_generic (aes->handle, aes->buffer, blocks); - if ( r ) { - fprintf ( - stderr, - "%s (udf: %s %s:%d)\n", - mcrypt_strerror (r), MY_AES256_DEBUGINFO - ); - DEBUG_SUB_FUNCTION_OUT; - return r; - } - -#ifdef MY_AES256_DEBUG - fprintf (stderr, " - buf : %s (udf: %s:%d)\n", aes->buffer, MY_AES256_SDEBUGINFO); - fprintf (stderr, " - buflen : %u (%zd) (udf: %s:%d)\n", blocks, strlen ((char *) aes->buffer), MY_AES256_SDEBUGINFO); - - fprintf (stderr, " "); - for ( i=0; ibuffer[i]); - } - fprintf (stderr, "(udf: %s:%d)\n", MY_AES256_SDEBUGINFO); -#endif - - aes->datalen = blocks; - - mcrypt_generic_deinit (aes->handle); - aes256_close_api (aes); - - DEBUG_SUB_FUNCTION_OUT; - return true; -} - -my_bool aes256_decrypt_api (AES256_DATA * aes) { - int r; - int blocks; - char last; - - DEBUG_SUB_FUNCTION_IN; - - if ( aes->handle == null ) { - fprintf ( - stderr, - "Mcrypt handle is not initialize. (udf: %s %s:%d)\n", - MY_AES256_DEBUGINFO - ); - DEBUG_SUB_FUNCTION_OUT; - return false; - } - - if ( aes->datalen < 1 || aes->keylen < 1 ) { - fprintf ( - stderr, - "The data or key is missing. (udf: %s %s:%d)\n", - MY_AES256_DEBUGINFO - ); - DEBUG_SUB_FUNCTION_OUT; - return false; - } - - r = mcrypt_generic_init (aes->handle, aes->key, aes->keysize, NULL); - if ( r < 0 ) { - fprintf ( - stderr, - "%s (udf: %s %s:%d)\n", - mcrypt_strerror (r), MY_AES256_DEBUGINFO - ); - aes256_close_api (aes); - DEBUG_SUB_FUNCTION_OUT; - return false; - } - -#ifdef MY_AES256_DEBUG - fprintf (stderr, " - data : %s (udf: %s:%d)\n", aes->data, MY_AES256_SDEBUGINFO); - fprintf (stderr, " - datalen : %u (%zd) (udf: %s:%d)\n", aes->datalen, strlen ((char *) aes->data), MY_AES256_SDEBUGINFO); - fprintf (stderr, " - key : %s (udf: %s:%d)\n", aes->key, MY_AES256_SDEBUGINFO); - fprintf (stderr, " - keylen : %u (udf: %s:%d)\n", aes->keylen, MY_AES256_SDEBUGINFO); -#endif - - blocks = sizeof (char) * (aes->datalen + 1); - aes->buffer = (unsigned char *) malloc (blocks); - memset (aes->buffer, 0, blocks); - memcpy (aes->buffer, aes->data, aes->datalen); - -#ifdef MY_AES256_DEBUG - fprintf (stderr, " - blocks : %d (udf: %s:%d)\n", blocks, MY_AES256_SDEBUGINFO); - fprintf (stderr, " - buf : %s (udf: %s:%d)\n", aes->buffer, MY_AES256_SDEBUGINFO); - int i; - fprintf (stderr, " "); - for ( i=0; ibuffer[i]); - } - fprintf (stderr, "(udf: %s:%d)\n", MY_AES256_SDEBUGINFO); -#endif - - r = mdecrypt_generic (aes->handle, aes->buffer, aes->datalen); - mcrypt_generic_deinit (aes->handle); - aes256_close_api (aes); - - if ( r ) { - fprintf ( - stderr, - "%s (udf: %s %s:%d)\n", - mcrypt_strerror (r), MY_AES256_DEBUGINFO - ); - DEBUG_SUB_FUNCTION_OUT; - return false; - } - - last = aes->buffer[strlen ((char *) aes->buffer) - 1]; - if ( last > aes->blocksize ) { - fprintf ( - stderr, - "Wrong blcoksize matching (udf: %s %s:%d)\n", - MY_AES256_DEBUGINFO - ); - DEBUG_SUB_FUNCTION_OUT; - return false; - } - -#ifdef MY_AES256_DEBUG - fprintf (stderr, " - buf : %s (udf: %s:%d)\n", aes->buffer, MY_AES256_SDEBUGINFO); - fprintf (stderr, " - buflen : %u (%zd) (udf: %s:%d)\n", blocks, strlen ((char *) aes->buffer), MY_AES256_SDEBUGINFO); - - fprintf (stderr, " "); - for ( i=0; ibuffer[i]); - } - fprintf (stderr, "(udf: %s:%d)\n", MY_AES256_SDEBUGINFO); -#endif - - aes->datalen = strlen ((char *) aes->buffer) - last; - aes->buffer[aes->datalen] = 0; - - DEBUG_SUB_FUNCTION_OUT; - return true; -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: noet sw=4 ts=4 fdm=marker - * vim<600: noet sw=4 ts=4 - */ diff --git a/contrib/external/test.c b/contrib/external/test.c deleted file mode 100644 index 29f6c23..0000000 --- a/contrib/external/test.c +++ /dev/null @@ -1,153 +0,0 @@ -#include -#include -#include - -//#define KEY "01234567890123456789012345678901" -#define KEY "0123456789012345" -//#define KEY "asdf" -//#define DATA "김말똥a 그러나 z쿨!" -#define DATA "김말똥 123123" - -#define false 1 -#define true 0 -#define null NULL - -typedef struct aes256_data { - unsigned char * data; - int datalen; - unsigned char * key; - int keylen; - unsigned char * iv; - int ivlen; - int keysize; - int blocksize; - int ivsize; - unsigned char * buffer; - void * handle; -} AES256_DATA; -typedef char my_bool; - -#ifndef safe_free - #define safe_free(x) if ((x) != NULL) { free(x); x=NULL; } -#endif - -my_bool aes256_init_api (AES256_DATA * aes, char * msg); -void aes256_close_api (AES256_DATA * aes); -my_bool aes256_encrypt_api (AES256_DATA * aes); -my_bool aes256_decrypt_api (AES256_DATA * aes); - -void aes256_data_init (AES256_DATA * aes) { - aes->data = null; - aes->datalen = 0; - aes->key = null; - aes->keylen = 0; - aes->iv = null; - aes->ivlen = 0; - aes->keysize = 0; - aes->blocksize = 0; - aes->ivsize = 0; - aes->buffer = null; - aes->handle = null; -} - -AES256_DATA * aes256_encrypt (void) { - AES256_DATA * aes; - char msg[1024] = { 0, }; - - aes = (AES256_DATA *) malloc (sizeof (AES256_DATA)); - aes256_data_init (aes); - - if ( aes256_init_api (aes, msg) == false ) { - fprintf (stderr, "%s\n", msg); - safe_free (aes); - return NULL; - } - - aes->data = (unsigned char *) DATA; - aes->datalen = strlen (DATA); - aes->key = (unsigned char *) KEY; - aes->keylen = strlen (KEY); - - if ( aes->keylen > aes->keysize ) { - fprintf ( - stderr, - "KEY size is too big (udf: aes256_encrypt)" - ); - aes256_close_api (aes); - safe_free (aes); - return NULL; - } - - aes->iv = null; - aes->ivlen = 0; - - if ( aes256_encrypt_api (aes) == false ) { - fprintf (stderr, "encrypt failed\n"); - return null; - } - - //result = aes->buffer; - //*length = (uint) strlen (result); - aes->datalen = strlen ((char *) aes->buffer); - - return aes; -} - -AES256_DATA * aes256_decrypt (char * s) { - AES256_DATA * aes; - char msg[1024] = { 0, }; - - aes = (AES256_DATA *) malloc (sizeof (AES256_DATA)); - aes256_data_init (aes); - - if ( aes256_init_api (aes, msg) == false ) { - fprintf (stderr, "%s\n", msg); - safe_free (aes); - return NULL; - } - - aes->data = (unsigned char *) s; - aes->datalen = strlen (s); - aes->key = (unsigned char *) KEY; - aes->keylen = strlen (KEY); - aes->iv = null; - aes->ivlen = 0; - - if ( aes256_decrypt_api (aes) == false ) { - fprintf (stderr, "decrypt failed\n"); - return null; - } - - //result = aes->buffer; - //*length = (uint) strlen (result); - aes->datalen = strlen ((char *) aes->buffer); - - return aes; -} - -int main (void) { - AES256_DATA * aes; - char * p; - - aes = aes256_encrypt (); - printf ("--------------------------------------------\n"); - printf ("Length: %u\n", aes->datalen); - printf ("%s\n", aes->buffer); - printf ("--------------------------------------------\n"); - - p = strdup ((char *) aes->buffer); - safe_free (aes->buffer); - safe_free (aes); - - aes = aes256_decrypt (p); - printf ("--------------------------------------------\n"); - printf ("Length: %u\n", aes->datalen); - printf ("%s\n", aes->buffer); - printf ("--------------------------------------------\n"); - - safe_free (p); - safe_free (aes->buffer); - safe_free (aes); - - return 0; -} diff --git a/docs/aes256_install.sql b/docs/aes256_install.sql index 91c5373..d6f5f10 100644 --- a/docs/aes256_install.sql +++ b/docs/aes256_install.sql @@ -18,7 +18,7 @@ * ----------------------------------------------------------------------------- * This file is part of lib_mysqludf_aes267 * - * $Id$ + * $Id: aes256_install.sql 21 2013-12-23 16:46:44Z oops $ */ use mysql; diff --git a/m4/ax_gcc_visibility.m4 b/m4/ax_gcc_visibility.m4 index cfe34c0..5cd833b 100644 --- a/m4/ax_gcc_visibility.m4 +++ b/m4/ax_gcc_visibility.m4 @@ -32,7 +32,7 @@ dnl POSSIBILITY OF SUCH DAMAGE. dnl ---------------------------------------------------------------------------- dnl This file is part of olibc. dnl -dnl $Id$ +dnl $Id: ax_gcc_visibility.m4 2 2013-09-22 06:56:19Z oops $ dnl AC_SUBST(GCC_MAJOR_VERSION) diff --git a/src/Makefile.am b/src/Makefile.am index 99a5d4b..7f832c5 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -18,7 +18,7 @@ # ----------------------------------------------------------------------------- # This file is part of lib_mysqludf_aes256. # -# $Id$ +# $Id: Makefile.am 13 2013-12-23 10:37:57Z oops $ lib_LTLIBRARIES = diff --git a/src/Makefile.in b/src/Makefile.in index 1313d4d..0155a47 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -35,7 +35,7 @@ # ----------------------------------------------------------------------------- # This file is part of lib_mysqludf_aes256. # -# $Id$ +# $Id: Makefile.am 13 2013-12-23 10:37:57Z oops $ VPATH = @srcdir@ diff --git a/src/mysql_aes256.c b/src/mysql_aes256.c index 1141c96..7440995 100644 --- a/src/mysql_aes256.c +++ b/src/mysql_aes256.c @@ -18,7 +18,7 @@ * ----------------------------------------------------------------------------- * This file is part of lib_mysqludf_aes267 * - * $Id$ + * $Id: mysql_aes256.c 20 2013-12-23 16:44:25Z oops $ */ #ifdef STANDARD diff --git a/src/mysql_aes256.h b/src/mysql_aes256.h index 47607c3..7bb0def 100644 --- a/src/mysql_aes256.h +++ b/src/mysql_aes256.h @@ -18,7 +18,7 @@ * ----------------------------------------------------------------------------- * This file is part of lib_mysqludf_aes267 * - * $Id$ + * $Id: mysql_aes256.h 2 2013-09-22 06:56:19Z oops $ */ diff --git a/src/mysql_aes256_config.h.in b/src/mysql_aes256_config.h.in index 2ee1942..6d522ac 100644 --- a/src/mysql_aes256_config.h.in +++ b/src/mysql_aes256_config.h.in @@ -1,5 +1,5 @@ /* src/mysql_aes256_config.h.in. Generated from configure.ac by autoheader. */ -/* $Id$ */ +/* $Id: $ */ #ifndef LIB_MYSQLUDF_AES256_CONFIG_H #define LIB_MYSQLUDF_AES256_CONFIG_H