1 | /* dh.h
|
---|
2 | *
|
---|
3 | * Copyright (C) 2006-2017 wolfSSL Inc.
|
---|
4 | *
|
---|
5 | * This file is part of wolfSSL.
|
---|
6 | *
|
---|
7 | * wolfSSL 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.
|
---|
11 | *
|
---|
12 | * wolfSSL 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.
|
---|
16 | *
|
---|
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
---|
20 | */
|
---|
21 |
|
---|
22 | /* dh.h for openSSL */
|
---|
23 |
|
---|
24 |
|
---|
25 | #ifndef WOLFSSL_DH_H_
|
---|
26 | #define WOLFSSL_DH_H_
|
---|
27 |
|
---|
28 | #include <wolfssl/openssl/ssl.h>
|
---|
29 | #include <wolfssl/openssl/bn.h>
|
---|
30 |
|
---|
31 | #ifdef __cplusplus
|
---|
32 | extern "C" {
|
---|
33 | #endif
|
---|
34 |
|
---|
35 | struct WOLFSSL_DH {
|
---|
36 | WOLFSSL_BIGNUM* p;
|
---|
37 | WOLFSSL_BIGNUM* g;
|
---|
38 | WOLFSSL_BIGNUM* q;
|
---|
39 | WOLFSSL_BIGNUM* pub_key; /* openssh deference g^x */
|
---|
40 | WOLFSSL_BIGNUM* priv_key; /* openssh deference x */
|
---|
41 | void* internal; /* our DH */
|
---|
42 | char inSet; /* internal set from external ? */
|
---|
43 | char exSet; /* external set from internal ? */
|
---|
44 | /*added for lighttpd openssl compatibility, go back and add a getter in
|
---|
45 | * lighttpd src code.
|
---|
46 | */
|
---|
47 | int length;
|
---|
48 | };
|
---|
49 |
|
---|
50 |
|
---|
51 | WOLFSSL_API WOLFSSL_DH* wolfSSL_DH_new(void);
|
---|
52 | WOLFSSL_API void wolfSSL_DH_free(WOLFSSL_DH*);
|
---|
53 |
|
---|
54 | WOLFSSL_API int wolfSSL_DH_size(WOLFSSL_DH*);
|
---|
55 | WOLFSSL_API int wolfSSL_DH_generate_key(WOLFSSL_DH*);
|
---|
56 | WOLFSSL_API int wolfSSL_DH_compute_key(unsigned char* key, WOLFSSL_BIGNUM* pub,
|
---|
57 | WOLFSSL_DH*);
|
---|
58 |
|
---|
59 | typedef WOLFSSL_DH DH;
|
---|
60 |
|
---|
61 | #define DH_new wolfSSL_DH_new
|
---|
62 | #define DH_free wolfSSL_DH_free
|
---|
63 |
|
---|
64 | #define DH_size wolfSSL_DH_size
|
---|
65 | #define DH_generate_key wolfSSL_DH_generate_key
|
---|
66 | #define DH_compute_key wolfSSL_DH_compute_key
|
---|
67 | #define get_rfc3526_prime_1536 wolfSSL_DH_1536_prime
|
---|
68 |
|
---|
69 |
|
---|
70 | #ifdef __cplusplus
|
---|
71 | } /* extern "C" */
|
---|
72 | #endif
|
---|
73 |
|
---|
74 | #if defined(OPENSSL_ALL) || defined(HAVE_STUNNEL)
|
---|
75 | #define DH_generate_parameters wolfSSL_DH_generate_parameters
|
---|
76 | #define DH_generate_parameters_ex wolfSSL_DH_generate_parameters_ex
|
---|
77 | #endif /* OPENSSL_ALL || HAVE_STUNNEL */
|
---|
78 |
|
---|
79 | #endif /* WOLFSSL_DH_H_ */
|
---|