summaryrefslogtreecommitdiff
path: root/mysys_ssl
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2017-03-06 13:06:03 +0100
committerSergei Golubchik <serg@mariadb.org>2017-03-10 18:21:26 +0100
commitd6a7aece0826e0c115eb21912527c77596c1305e (patch)
treea08ea49d3154f59572868f45cbb14ba51a705cfd /mysys_ssl
parentbd1139ad2722cf8717cd1aaac4431f369d39562f (diff)
downloadmariadb-git-d6a7aece0826e0c115eb21912527c77596c1305e.tar.gz
my_sha2 service
Diffstat (limited to 'mysys_ssl')
-rw-r--r--mysys_ssl/CMakeLists.txt26
-rw-r--r--mysys_ssl/my_sha.ic4
-rw-r--r--mysys_ssl/my_sha224.cc18
-rw-r--r--mysys_ssl/my_sha256.cc18
-rw-r--r--mysys_ssl/my_sha384.cc18
-rw-r--r--mysys_ssl/my_sha512.cc18
6 files changed, 91 insertions, 11 deletions
diff --git a/mysys_ssl/CMakeLists.txt b/mysys_ssl/CMakeLists.txt
index b00213bc492..7251d8777f8 100644
--- a/mysys_ssl/CMakeLists.txt
+++ b/mysys_ssl/CMakeLists.txt
@@ -21,24 +21,30 @@ IF(SSL_DEFINES)
ADD_DEFINITIONS(${SSL_DEFINES})
ENDIF()
+SET(MYSYS_SSL_HIDDEN_SOURCES
+ my_sha1.cc
+ my_sha224.cc
+ my_sha256.cc
+ my_sha384.cc
+ my_sha512.cc
+ my_sha2.cc
+ my_md5.cc
+ )
+
+SET(MYSYS_SSL_SOURCES
+ ${MYSYS_SSL_HIDDEN_SOURCES}
+ my_crypt.cc
+ )
+
# We do RESTRICT_SYMBOL_EXPORTS(yassl) elsewhere.
# In order to get correct symbol visibility, these files
# must be compiled with "-fvisibility=hidden"
IF(WITH_SSL STREQUAL "bundled" AND HAVE_VISIBILITY_HIDDEN)
SET_SOURCE_FILES_PROPERTIES(
- my_md5.cc
- my_sha1.cc
- my_sha2.cc
+ ${MYSYS_SSL_HIDDEN_SOURCES}
PROPERTIES COMPILE_FLAGS "-fvisibility=hidden")
ENDIF()
-SET(MYSYS_SSL_SOURCES
- my_sha1.cc
- my_sha2.cc
- my_md5.cc
- my_crypt.cc
- )
-
ADD_CONVENIENCE_LIBRARY(mysys_ssl ${MYSYS_SSL_SOURCES})
TARGET_LINK_LIBRARIES(mysys_ssl dbug strings ${SSL_LIBRARIES})
DTRACE_INSTRUMENT(mysys_ssl)
diff --git a/mysys_ssl/my_sha.ic b/mysys_ssl/my_sha.ic
index 5a95c9c4682..a7ec8bad593 100644
--- a/mysys_ssl/my_sha.ic
+++ b/mysys_ssl/my_sha.ic
@@ -26,7 +26,7 @@
#include <my_global.h>
#include <stdarg.h>
-#define HASH_SIZE 20
+#define HASH_SIZE (NUM > 1 ? NUM/8 : 20)
#if defined(HAVE_YASSL)
#include "sha.hpp"
@@ -66,6 +66,8 @@ static void sha_result(CONTEXT *context, uchar digest[HASH_SIZE])
#define yCONTEXT(y) xCONTEXT(y)
#define CONTEXT yCONTEXT(NUM)
#define SHA1_CTX SHA_CTX
+#define SHA224_CTX SHA256_CTX
+#define SHA384_CTX SHA512_CTX
#define xSHA_Init(x) SHA ## x ## _Init
#define xSHA_Update(x) SHA ## x ## _Update
diff --git a/mysys_ssl/my_sha224.cc b/mysys_ssl/my_sha224.cc
new file mode 100644
index 00000000000..7e8b481256b
--- /dev/null
+++ b/mysys_ssl/my_sha224.cc
@@ -0,0 +1,18 @@
+/* Copyright (c) 2017, MariaDB
+
+ 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,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
+
+#define NUM 224
+
+#include "my_sha.ic"
diff --git a/mysys_ssl/my_sha256.cc b/mysys_ssl/my_sha256.cc
new file mode 100644
index 00000000000..8c1a4662009
--- /dev/null
+++ b/mysys_ssl/my_sha256.cc
@@ -0,0 +1,18 @@
+/* Copyright (c) 2017, MariaDB
+
+ 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,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
+
+#define NUM 256
+
+#include "my_sha.ic"
diff --git a/mysys_ssl/my_sha384.cc b/mysys_ssl/my_sha384.cc
new file mode 100644
index 00000000000..3bad6b39248
--- /dev/null
+++ b/mysys_ssl/my_sha384.cc
@@ -0,0 +1,18 @@
+/* Copyright (c) 2017, MariaDB
+
+ 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,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
+
+#define NUM 384
+
+#include "my_sha.ic"
diff --git a/mysys_ssl/my_sha512.cc b/mysys_ssl/my_sha512.cc
new file mode 100644
index 00000000000..8077efd3b57
--- /dev/null
+++ b/mysys_ssl/my_sha512.cc
@@ -0,0 +1,18 @@
+/* Copyright (c) 2017, MariaDB
+
+ 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,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
+
+#define NUM 512
+
+#include "my_sha.ic"