25 #include <my_global.h>
28 #if defined(HAVE_YASSL)
40 void mysql_sha1_yassl(uint8 *digest,
const char *
buf,
int len)
43 hasher.Update((
const TaoCrypt::byte *) buf, len);
44 hasher.Final ((TaoCrypt::byte *) digest);
59 void mysql_sha1_multi_yassl(uint8 *digest,
const char *buf1,
int len1,
60 const char *buf2,
int len2)
63 hasher.Update((
const TaoCrypt::byte *) buf1, len1);
64 hasher.Update((
const TaoCrypt::byte *) buf2, len2);
65 hasher.Final((TaoCrypt::byte *) digest);
68 #elif defined(HAVE_OPENSSL)
69 #include <openssl/sha.h>
71 int mysql_sha1_reset(SHA_CTX *context)
73 return SHA1_Init(context);
77 int mysql_sha1_input(SHA_CTX *context,
const uint8 *message_array,
80 return SHA1_Update(context, message_array, length);
84 int mysql_sha1_result(SHA_CTX *context,
85 uint8 Message_Digest[SHA1_HASH_SIZE])
87 return SHA1_Final(Message_Digest, context);
103 #if defined(HAVE_YASSL)
104 mysql_sha1_yassl(digest, buf, len);
105 #elif defined(HAVE_OPENSSL)
106 SHA_CTX sha1_context;
108 mysql_sha1_reset(&sha1_context);
109 mysql_sha1_input(&sha1_context, (
const uint8 *) buf, len);
110 mysql_sha1_result(&sha1_context, digest);
128 const char *buf2,
int len2)
130 #if defined(HAVE_YASSL)
131 mysql_sha1_multi_yassl(digest, buf1, len1, buf2, len2);
132 #elif defined(HAVE_OPENSSL)
133 SHA_CTX sha1_context;
135 mysql_sha1_reset(&sha1_context);
136 mysql_sha1_input(&sha1_context, (
const uint8 *) buf1, len1);
137 mysql_sha1_input(&sha1_context, (
const uint8 *) buf2, len2);
138 mysql_sha1_result(&sha1_context, digest);