1 // Copyright (c) 2007, 2018, 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, version 2.0, as
5 // published by the Free Software Foundation.
6 //
7 // This program is also distributed with certain software (including
8 // but not limited to OpenSSL) that is licensed under separate terms,
9 // as designated in a particular file or component or in included license
10 // documentation. The authors of MySQL hereby grant you an
11 // additional permission to link the program and your derivative works
12 // with the separately licensed software that they have included with
13 // MySQL.
14 //
15 // Without limiting anything contained in the foregoing, this file,
16 // which is part of MySQL Server, is also subject to the
17 // Universal FOSS Exception, version 1.0, a copy of which can be found at
18 // http://oss.oracle.com/licenses/universal-foss-exception.
19 //
20 // This program is distributed in the hope that it will be useful, but
21 // WITHOUT ANY WARRANTY; without even the implied warranty of
22 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
23 // See the GNU General Public License, version 2.0, for more details.
24 //
25 // You should have received a copy of the GNU General Public License
26 // along with this program; if not, write to the Free Software Foundation, Inc.,
27 // 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 
29 #ifndef included_sha2_h
30 #define included_sha2_h
31 
32 /**
33   @file include/sha2.h
34 */
35 
36 #if defined(HAVE_OPENSSL)
37 
38 #include <openssl/evp.h>
39 #include <stddef.h>
40 
41 #if !defined(HAVE_WOLFSSL)
42 #include <openssl/sha.h>
43 #endif  // !defined(HAVE_WOLFSSL)
44 
45 #if defined(HAVE_WOLFSSL) && defined(__cplusplus)
46 extern "C" {
47 #endif  // defined(HAVE_WOLFSSL) && defined(__cplusplus)
48 
49 #define GEN_OPENSSL_EVP_SHA2_BRIDGE(size)                      \
50   unsigned char *SHA_EVP##size(const unsigned char *input_ptr, \
51                                size_t input_length,            \
52                                char unsigned *output_ptr);
53 GEN_OPENSSL_EVP_SHA2_BRIDGE(512)
54 GEN_OPENSSL_EVP_SHA2_BRIDGE(384)
55 GEN_OPENSSL_EVP_SHA2_BRIDGE(256)
56 GEN_OPENSSL_EVP_SHA2_BRIDGE(224)
57 #undef GEN_OPENSSL_EVP_SHA2_BRIDGE
58 
59 #if defined(HAVE_WOLFSSL) && defined(__cplusplus)
60 }
61 #endif  // defined(HAVE_WOLFSSL) && defined(__cplusplus)
62 
63 #endif /* HAVE_OPENSSL */
64 #endif /* included_sha2_h */
65