CyaSSL 1.9.0
[tomato.git] / release / src / router / cyassl / include / openssl / evp.h
bloba795dcab8eb9fdf147982664f96d75102f03d406
1 /* evp.h
3 * Copyright (C) 2011 Sawtooth Consulting Ltd.
5 * This file is part of CyaSSL.
7 * CyaSSL is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * CyaSSL is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
23 /* evp.h defines mini evp openssl compatibility layer
29 #ifndef CYASSL_EVP_H_
30 #define CYASSL_EVP_H_
32 #ifdef YASSL_PREFIX
33 #include "prefix_evp.h"
34 #endif
36 #include "md5.h"
37 #include "sha.h"
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
44 typedef char EVP_MD;
45 typedef char EVP_CIPHER;
47 const EVP_MD* EVP_md5(void);
48 const EVP_MD* EVP_sha1(void);
51 typedef union {
52 MD5_CTX md5;
53 SHA_CTX sha;
54 } Hasher;
57 typedef struct EVP_MD_CTX {
58 unsigned char macType; /* md5 or sha for now */
59 Hasher hash;
60 } EVP_MD_CTX;
63 void EVP_MD_CTX_init(EVP_MD_CTX* ctx);
64 int EVP_MD_CTX_cleanup(EVP_MD_CTX* ctx);
66 int EVP_DigestInit(EVP_MD_CTX* ctx, const EVP_MD* type);
67 int EVP_DigestUpdate(EVP_MD_CTX* ctx, const void* data, size_t sz);
68 int EVP_DigestFinal(EVP_MD_CTX* ctx, unsigned char* md, unsigned int* s);
69 int EVP_DigestFinal_ex(EVP_MD_CTX* ctx, unsigned char* md, unsigned int* s);
71 int EVP_BytesToKey(const EVP_CIPHER*, const EVP_MD*, const unsigned char*,
72 const unsigned char*, int, int, unsigned char*, unsigned char*);
74 #ifdef __cplusplus
75 } /* extern "C" */
76 #endif
79 #endif /* CYASSL_EVP_H_ */