1 | /* |
2 | This file is part of KittenDB/Engine Library. |
3 | |
4 | KittenDB/Engine Library is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU Lesser General Public License as published by |
6 | the Free Software Foundation, either version 2 of the License, or |
7 | (at your option) any later version. |
8 | |
9 | KittenDB/Engine Library is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | GNU Lesser General Public License for more details. |
13 | |
14 | You should have received a copy of the GNU Lesser General Public License |
15 | along with KittenDB/Engine Library. If not, see <http://www.gnu.org/licenses/>. |
16 | |
17 | Copyright 2016 Telegram Messenger Inc |
18 | 2016 Nikolai Durov |
19 | */ |
20 | |
21 | #pragma once |
22 | |
23 | #include <openssl/evp.h> |
24 | #include <openssl/opensslv.h> |
25 | |
26 | #if OPENSSL_VERSION_NUMBER < 0x10100000 |
27 | #define EVP_MD_CTX_new EVP_MD_CTX_create |
28 | #define EVP_MD_CTX_free EVP_MD_CTX_destroy |
29 | #endif |
30 | |
31 | typedef EVP_MD_CTX sha256_context; |
32 | |
33 | void sha256_starts (sha256_context *ctx); |
34 | void sha256_update (sha256_context *ctx, const unsigned char *input, int ilen); |
35 | void sha256_finish (sha256_context *ctx, unsigned char output[32]); |
36 | void sha256 (const unsigned char *input, int ilen, unsigned char output[32]); |
37 | void sha256_two_chunks (const unsigned char *input1, int ilen1, const unsigned char *input2, int ilen2, unsigned char output[32]); |
38 | |