wolfSSL SSL/TLS library, support up to TLS1.3

Dependents:   OS

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers dh.h Source File

dh.h

00001 /* dh.h
00002  *
00003  * Copyright (C) 2006-2017 wolfSSL Inc.
00004  *
00005  * This file is part of wolfSSL.
00006  *
00007  * wolfSSL is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 2 of the License, or
00010  * (at your option) any later version.
00011  *
00012  * wolfSSL is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
00020  */
00021 
00022 /* dh.h for openSSL */
00023 
00024 
00025 #ifndef WOLFSSL_DH_H_
00026 #define WOLFSSL_DH_H_
00027 
00028 #include <wolfssl/openssl/ssl.h>
00029 #include <wolfssl/openssl/bn.h>
00030 
00031 #ifdef __cplusplus
00032     extern "C" {
00033 #endif
00034 
00035 struct WOLFSSL_DH {
00036     WOLFSSL_BIGNUM* p;
00037     WOLFSSL_BIGNUM* g;
00038     WOLFSSL_BIGNUM* q;
00039     WOLFSSL_BIGNUM* pub_key;      /* openssh deference g^x */
00040     WOLFSSL_BIGNUM* priv_key;     /* openssh deference x   */
00041     void*          internal;     /* our DH */
00042     char           inSet;        /* internal set from external ? */
00043     char           exSet;        /* external set from internal ? */
00044     /*added for lighttpd openssl compatibility, go back and add a getter in
00045      * lighttpd src code.
00046      */
00047      int length;
00048 };
00049 
00050 
00051 WOLFSSL_API WOLFSSL_DH* wolfSSL_DH_new(void);
00052 WOLFSSL_API void       wolfSSL_DH_free(WOLFSSL_DH*);
00053 
00054 WOLFSSL_API int wolfSSL_DH_size(WOLFSSL_DH*);
00055 WOLFSSL_API int wolfSSL_DH_generate_key(WOLFSSL_DH*);
00056 WOLFSSL_API int wolfSSL_DH_compute_key(unsigned char* key, WOLFSSL_BIGNUM* pub,
00057                                      WOLFSSL_DH*);
00058 
00059 typedef WOLFSSL_DH DH;
00060 
00061 #define DH_new  wolfSSL_DH_new
00062 #define DH_free wolfSSL_DH_free
00063 
00064 #define DH_size         wolfSSL_DH_size
00065 #define DH_generate_key wolfSSL_DH_generate_key
00066 #define DH_compute_key  wolfSSL_DH_compute_key
00067 #define get_rfc3526_prime_1536 wolfSSL_DH_1536_prime
00068 
00069 
00070 #ifdef __cplusplus
00071     }  /* extern "C" */
00072 #endif
00073 
00074 #if defined(OPENSSL_ALL) || defined(HAVE_STUNNEL)
00075 #define DH_generate_parameters    wolfSSL_DH_generate_parameters
00076 #define DH_generate_parameters_ex wolfSSL_DH_generate_parameters_ex
00077 #endif /* OPENSSL_ALL || HAVE_STUNNEL */
00078 
00079 #endif /* WOLFSSL_DH_H_ */
00080