This is a port of cyaSSL 2.7.0.
Dependents: CyaSSL_DTLS_Cellular CyaSSL_DTLS_Ethernet
dh.h
00001 /* dh.h 00002 * 00003 * Copyright (C) 2006-2013 wolfSSL Inc. 00004 * 00005 * This file is part of CyaSSL. 00006 * 00007 * CyaSSL 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 * CyaSSL 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 00020 */ 00021 00022 00023 #ifndef NO_DH 00024 00025 #ifndef CTAO_CRYPT_DH_H 00026 #define CTAO_CRYPT_DH_H 00027 00028 #include <cyassl/ctaocrypt/types.h> 00029 #include <cyassl/ctaocrypt/integer.h> 00030 #include <cyassl/ctaocrypt/random.h> 00031 00032 #ifdef __cplusplus 00033 extern "C" { 00034 #endif 00035 00036 00037 /* Diffie-Hellman Key */ 00038 typedef struct DhKey { 00039 mp_int p, g; /* group parameters */ 00040 } DhKey; 00041 00042 00043 CYASSL_API void InitDhKey(DhKey* key); 00044 CYASSL_API void FreeDhKey(DhKey* key); 00045 00046 CYASSL_API int DhGenerateKeyPair(DhKey* key, RNG* rng, byte* priv, 00047 word32* privSz, byte* pub, word32* pubSz); 00048 CYASSL_API int DhAgree(DhKey* key, byte* agree, word32* agreeSz, 00049 const byte* priv, word32 privSz, const byte* otherPub, 00050 word32 pubSz); 00051 00052 CYASSL_API int DhKeyDecode(const byte* input, word32* inOutIdx, DhKey* key, 00053 word32); 00054 CYASSL_API int DhSetKey(DhKey* key, const byte* p, word32 pSz, const byte* g, 00055 word32 gSz); 00056 CYASSL_API int DhParamsLoad(const byte* input, word32 inSz, byte* p, 00057 word32* pInOutSz, byte* g, word32* gInOutSz); 00058 00059 00060 #ifdef __cplusplus 00061 } /* extern "C" */ 00062 #endif 00063 00064 #endif /* CTAO_CRYPT_DH_H */ 00065 00066 #endif /* NO_DH */ 00067
Generated on Tue Jul 12 2022 20:44:50 by 1.7.2