The Netsukuku Project  0.0.9
An Alternative routing method
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
crypto.h
Go to the documentation of this file.
1 /* This file is part of Netsukuku
2  * (c) Copyright 2005 Andrea Lo Pumo aka AlpT <alpt@freaknet.org>
3  *
4  * This source code is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as published
6  * by the Free Software Foundation; either version 2 of the License,
7  * or (at your option) any later version.
8  *
9  * This source code 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.
12  * Please refer to the GNU Public License for more details.
13  *
14  * You should have received a copy of the GNU Public License along with
15  * this source code; if not, write to:
16  * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17  */
18 
19 #ifndef CRYPTO_H
20 #define CRYPTO_H
21 
22 #include <openssl/bio.h>
23 #include <openssl/evp.h>
24 #include <openssl/crypto.h>
25 #include <openssl/x509.h>
26 #include <openssl/err.h>
27 #include <openssl/rand.h>
28 #include <openssl/rsa.h>
29 #include <openssl/pem.h>
30 
31 #include <sys/types.h>
32 
33 #define RSA_PUB_EXPONENT 65537
34 
35 void init_crypto(void);
36 void free_crypto(void);
37 char *ssl_strerr(void);
38 RSA *genrsa(int key_bits, u_char **pub, u_int *pub_len, u_char **priv, u_int *priv_len);
39 RSA *get_rsa_pub(const u_char **pub_key, long length);
40 RSA *get_rsa_priv(const u_char **priv_key, long length);
41 u_char *hash_sha1(u_char *msg, u_int len, u_char *hash);
42 u_char *hash_md5(u_char *msg, u_int m_len, u_char *hash);
43 u_char *rsa_sign(u_char *msg, u_int m_len, RSA *priv, u_int *siglen);
44 int verify_sign(u_char *msg, u_int m_len, u_char *signature, u_int siglen, RSA *pub);
45 
46 #endif /*CRYPTO_H*/
u_char * rsa_sign(u_char *msg, u_int m_len, RSA *priv, u_int *siglen)
Definition: crypto.c:138
char * ssl_strerr(void)
Definition: crypto.c:49
u_char * hash_md5(u_char *msg, u_int m_len, u_char *hash)
Definition: crypto.c:128
void init_crypto(void)
Definition: crypto.c:38
int verify_sign(u_char *msg, u_int m_len, u_char *signature, u_int siglen, RSA *pub)
Definition: crypto.c:160
RSA * genrsa(int key_bits, u_char **pub, u_int *pub_len, u_char **priv, u_int *priv_len)
Definition: crypto.c:61
RSA * get_rsa_priv(const u_char **priv_key, long length)
Definition: crypto.c:118
RSA * get_rsa_pub(const u_char **pub_key, long length)
Definition: crypto.c:107
void free_crypto(void)
Definition: crypto.c:44
u_char * hash_sha1(u_char *msg, u_int len, u_char *hash)
Definition: crypto.c:123