1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +03:00

Backport of:

ChangeSet@1.2703, 2007-12-07 09:35:28-05:00, cmiller@zippy.cornsilk.net +40 -0
Bug#13174: SHA2 function
Patch contributed from Bill Karwin, paper unnumbered CLA in Seattle

Implement SHA2 functions.

Chad added code to make it work with YaSSL.  Also, he removed the 
(probable) bug of embedded server never using SSL-dependent 
functions.  (libmysqld/Makefile.am didn't read ANY autoconf defs.)

Function specification:
  SHA2( string cleartext, integer hash_length ) 
    -> string hash, or NULL
where hash_length is one of 224, 256, 384, or 512.  If either is 
NULL or a length is unsupported, then the result is NULL.  The 
resulting string is always the length of the hash_length parameter
or is NULL.

Include the canonical hash examples from the NIST in the test
results.
---
Polish and address concerns of reviewers.
This commit is contained in:
Konstantin Osipov
2010-04-13 19:04:45 +04:00
parent 04b601a7fe
commit 53fecff1ef
40 changed files with 2315 additions and 83 deletions

View File

@@ -36,7 +36,7 @@
// reset_host_errors
#include "sql_acl.h" // acl_getroot, NO_ACCESS, SUPER_ACL
#ifdef HAVE_OPENSSL
#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
/*
Without SSL the handshake consists of one packet. This packet
has both client capabilites and scrambled password.
@@ -52,7 +52,7 @@
#define MIN_HANDSHAKE_SIZE 2
#else
#define MIN_HANDSHAKE_SIZE 6
#endif /* HAVE_OPENSSL */
#endif /* HAVE_OPENSSL && !EMBEDDED_LIBRARY */
/*
Get structure for logging connection data for the current user
@@ -654,6 +654,7 @@ bool init_new_connection_handler_thread()
return 0;
}
#ifndef EMBEDDED_LIBRARY
/*
Perform handshake, authorize client and update thd ACL variables.
@@ -667,7 +668,6 @@ bool init_new_connection_handler_thread()
> 0 error code (not sent to user)
*/
#ifndef EMBEDDED_LIBRARY
static int check_connection(THD *thd)
{
uint connect_errors= 0;
@@ -749,7 +749,7 @@ static int check_connection(THD *thd)
#ifdef HAVE_COMPRESS
server_capabilites|= CLIENT_COMPRESS;
#endif /* HAVE_COMPRESS */
#ifdef HAVE_OPENSSL
#if defined(HAVE_OPENSSL)
if (ssl_acceptor_fd)
{
server_capabilites |= CLIENT_SSL; /* Wow, SSL is available! */
@@ -827,7 +827,7 @@ static int check_connection(THD *thd)
if (thd->client_capabilities & CLIENT_IGNORE_SPACE)
thd->variables.sql_mode|= MODE_IGNORE_SPACE;
#ifdef HAVE_OPENSSL
#if defined(HAVE_OPENSSL)
DBUG_PRINT("info", ("client capabilities: %lu", thd->client_capabilities));
if (thd->client_capabilities & CLIENT_SSL)
{