MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
sha2.h
1 /* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
2 
3  This program is free software; you can redistribute it and/or modify
4  it under the terms of the GNU General Public License as published by
5  the Free Software Foundation; version 2 of the License.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  GNU General Public License for more details.
11 
12  You should have received a copy of the GNU General Public License
13  along with this program; if not, write to the Free Software
14  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
15 
16 #ifndef included_sha2_h
17 #define included_sha2_h
18 
19 #include <my_config.h>
20 
21 #if defined(HAVE_YASSL) || defined(HAVE_OPENSSL)
22 
23 # ifdef HAVE_STDDEF_H
24 # include <stddef.h>
25 # endif
26 
27 # ifndef HAVE_YASSL
28 # include <openssl/sha.h>
29 
30 # else
31 
32 #include "../extra/yassl/taocrypt/include/sha.hpp"
33 
34 # ifdef __cplusplus
35 extern "C" {
36 # endif
37 
38 #ifndef SHA512_DIGEST_LENGTH
39 #define SHA512_DIGEST_LENGTH TaoCrypt::SHA512::DIGEST_SIZE
40 #endif
41 
42 #ifndef SHA384_DIGEST_LENGTH
43 #define SHA384_DIGEST_LENGTH TaoCrypt::SHA384::DIGEST_SIZE
44 #endif
45 
46 #ifndef SHA256_DIGEST_LENGTH
47 #define SHA256_DIGEST_LENGTH TaoCrypt::SHA256::DIGEST_SIZE
48 #endif
49 
50 #ifndef SHA224_DIGEST_LENGTH
51 #define SHA224_DIGEST_LENGTH TaoCrypt::SHA224::DIGEST_SIZE
52 #endif
53 
54 #define GEN_YASSL_SHA2_BRIDGE(size) \
55 unsigned char* SHA##size(const unsigned char *input_ptr, size_t input_length, \
56  char unsigned *output_ptr);
57 
58 GEN_YASSL_SHA2_BRIDGE(512);
59 GEN_YASSL_SHA2_BRIDGE(384);
60 GEN_YASSL_SHA2_BRIDGE(256);
61 GEN_YASSL_SHA2_BRIDGE(224);
62 
63 #undef GEN_YASSL_SHA2_BRIDGE
64 
65 # ifdef __cplusplus
66 }
67 # endif
68 
69 # endif /* HAVE_YASSL */
70 
71 #endif /* HAVE_OPENSSL || HAVE_YASSL */
72 #endif /* included_sha2_h */