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 | #include <openssl/evp.h> |
21 | #include <openssl/opensslv.h> |
22 | |
23 | #if OPENSSL_VERSION_NUMBER < 0x10100000 |
24 | #define EVP_MD_CTX_new EVP_MD_CTX_create |
25 | #define EVP_MD_CTX_free EVP_MD_CTX_destroy |
26 | #endif |
27 | |
28 | typedef EVP_MD_CTX sha1_context; |
29 | |
30 | void sha1_starts (sha1_context *ctx); |
31 | void sha1_update (sha1_context *ctx, const unsigned char *input, int ilen); |
32 | void sha1_finish (sha1_context *ctx, unsigned char output[20]); |
33 | void sha1 (const unsigned char *input, int ilen, unsigned char output[20]); |
34 | void sha1_two_chunks (const unsigned char *input1, int ilen1, const unsigned char *input2, int ilen2, unsigned char output[20]); |
35 | |