wolfSSL SSL/TLS library, support up to TLS1.3
wolfssl/openssl/dh.h@17:ff9d1e86ad5f, 2019-11-20 (annotated)
- Committer:
- sPymbed
- Date:
- Wed Nov 20 13:27:48 2019 +0000
- Revision:
- 17:ff9d1e86ad5f
- Parent:
- 15:117db924cf7c
removed: wolfcrypt
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
wolfSSL | 15:117db924cf7c | 1 | /* dh.h |
wolfSSL | 15:117db924cf7c | 2 | * |
wolfSSL | 15:117db924cf7c | 3 | * Copyright (C) 2006-2017 wolfSSL Inc. |
wolfSSL | 15:117db924cf7c | 4 | * |
wolfSSL | 15:117db924cf7c | 5 | * This file is part of wolfSSL. |
wolfSSL | 15:117db924cf7c | 6 | * |
wolfSSL | 15:117db924cf7c | 7 | * wolfSSL is free software; you can redistribute it and/or modify |
wolfSSL | 15:117db924cf7c | 8 | * it under the terms of the GNU General Public License as published by |
wolfSSL | 15:117db924cf7c | 9 | * the Free Software Foundation; either version 2 of the License, or |
wolfSSL | 15:117db924cf7c | 10 | * (at your option) any later version. |
wolfSSL | 15:117db924cf7c | 11 | * |
wolfSSL | 15:117db924cf7c | 12 | * wolfSSL is distributed in the hope that it will be useful, |
wolfSSL | 15:117db924cf7c | 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
wolfSSL | 15:117db924cf7c | 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
wolfSSL | 15:117db924cf7c | 15 | * GNU General Public License for more details. |
wolfSSL | 15:117db924cf7c | 16 | * |
wolfSSL | 15:117db924cf7c | 17 | * You should have received a copy of the GNU General Public License |
wolfSSL | 15:117db924cf7c | 18 | * along with this program; if not, write to the Free Software |
wolfSSL | 15:117db924cf7c | 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA |
wolfSSL | 15:117db924cf7c | 20 | */ |
wolfSSL | 15:117db924cf7c | 21 | |
wolfSSL | 15:117db924cf7c | 22 | /* dh.h for openSSL */ |
wolfSSL | 15:117db924cf7c | 23 | |
wolfSSL | 15:117db924cf7c | 24 | |
wolfSSL | 15:117db924cf7c | 25 | #ifndef WOLFSSL_DH_H_ |
wolfSSL | 15:117db924cf7c | 26 | #define WOLFSSL_DH_H_ |
wolfSSL | 15:117db924cf7c | 27 | |
wolfSSL | 15:117db924cf7c | 28 | #include <wolfssl/openssl/ssl.h> |
wolfSSL | 15:117db924cf7c | 29 | #include <wolfssl/openssl/bn.h> |
wolfSSL | 15:117db924cf7c | 30 | |
wolfSSL | 15:117db924cf7c | 31 | #ifdef __cplusplus |
wolfSSL | 15:117db924cf7c | 32 | extern "C" { |
wolfSSL | 15:117db924cf7c | 33 | #endif |
wolfSSL | 15:117db924cf7c | 34 | |
wolfSSL | 15:117db924cf7c | 35 | struct WOLFSSL_DH { |
wolfSSL | 15:117db924cf7c | 36 | WOLFSSL_BIGNUM* p; |
wolfSSL | 15:117db924cf7c | 37 | WOLFSSL_BIGNUM* g; |
wolfSSL | 15:117db924cf7c | 38 | WOLFSSL_BIGNUM* q; |
wolfSSL | 15:117db924cf7c | 39 | WOLFSSL_BIGNUM* pub_key; /* openssh deference g^x */ |
wolfSSL | 15:117db924cf7c | 40 | WOLFSSL_BIGNUM* priv_key; /* openssh deference x */ |
wolfSSL | 15:117db924cf7c | 41 | void* internal; /* our DH */ |
wolfSSL | 15:117db924cf7c | 42 | char inSet; /* internal set from external ? */ |
wolfSSL | 15:117db924cf7c | 43 | char exSet; /* external set from internal ? */ |
wolfSSL | 15:117db924cf7c | 44 | /*added for lighttpd openssl compatibility, go back and add a getter in |
wolfSSL | 15:117db924cf7c | 45 | * lighttpd src code. |
wolfSSL | 15:117db924cf7c | 46 | */ |
wolfSSL | 15:117db924cf7c | 47 | int length; |
wolfSSL | 15:117db924cf7c | 48 | }; |
wolfSSL | 15:117db924cf7c | 49 | |
wolfSSL | 15:117db924cf7c | 50 | |
wolfSSL | 15:117db924cf7c | 51 | WOLFSSL_API WOLFSSL_DH* wolfSSL_DH_new(void); |
wolfSSL | 15:117db924cf7c | 52 | WOLFSSL_API void wolfSSL_DH_free(WOLFSSL_DH*); |
wolfSSL | 15:117db924cf7c | 53 | |
wolfSSL | 15:117db924cf7c | 54 | WOLFSSL_API int wolfSSL_DH_size(WOLFSSL_DH*); |
wolfSSL | 15:117db924cf7c | 55 | WOLFSSL_API int wolfSSL_DH_generate_key(WOLFSSL_DH*); |
wolfSSL | 15:117db924cf7c | 56 | WOLFSSL_API int wolfSSL_DH_compute_key(unsigned char* key, WOLFSSL_BIGNUM* pub, |
wolfSSL | 15:117db924cf7c | 57 | WOLFSSL_DH*); |
wolfSSL | 15:117db924cf7c | 58 | |
wolfSSL | 15:117db924cf7c | 59 | typedef WOLFSSL_DH DH; |
wolfSSL | 15:117db924cf7c | 60 | |
wolfSSL | 15:117db924cf7c | 61 | #define DH_new wolfSSL_DH_new |
wolfSSL | 15:117db924cf7c | 62 | #define DH_free wolfSSL_DH_free |
wolfSSL | 15:117db924cf7c | 63 | |
wolfSSL | 15:117db924cf7c | 64 | #define DH_size wolfSSL_DH_size |
wolfSSL | 15:117db924cf7c | 65 | #define DH_generate_key wolfSSL_DH_generate_key |
wolfSSL | 15:117db924cf7c | 66 | #define DH_compute_key wolfSSL_DH_compute_key |
wolfSSL | 15:117db924cf7c | 67 | #define get_rfc3526_prime_1536 wolfSSL_DH_1536_prime |
wolfSSL | 15:117db924cf7c | 68 | |
wolfSSL | 15:117db924cf7c | 69 | |
wolfSSL | 15:117db924cf7c | 70 | #ifdef __cplusplus |
wolfSSL | 15:117db924cf7c | 71 | } /* extern "C" */ |
wolfSSL | 15:117db924cf7c | 72 | #endif |
wolfSSL | 15:117db924cf7c | 73 | |
wolfSSL | 15:117db924cf7c | 74 | #if defined(OPENSSL_ALL) || defined(HAVE_STUNNEL) |
wolfSSL | 15:117db924cf7c | 75 | #define DH_generate_parameters wolfSSL_DH_generate_parameters |
wolfSSL | 15:117db924cf7c | 76 | #define DH_generate_parameters_ex wolfSSL_DH_generate_parameters_ex |
wolfSSL | 15:117db924cf7c | 77 | #endif /* OPENSSL_ALL || HAVE_STUNNEL */ |
wolfSSL | 15:117db924cf7c | 78 | |
wolfSSL | 15:117db924cf7c | 79 | #endif /* WOLFSSL_DH_H_ */ |
wolfSSL | 15:117db924cf7c | 80 |