source: asp3_tinet_ecnl_rx/trunk/wolfssl-3.12.2/wolfssl/wolfcrypt/dh.h@ 337

Last change on this file since 337 was 337, checked in by coas-nagasima, 6 years ago

ASP3版ECNLを追加

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-chdr;charset=UTF-8
File size: 2.8 KB
Line 
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
23#ifndef WOLF_CRYPT_DH_H
24#define WOLF_CRYPT_DH_H
25
26#include <wolfssl/wolfcrypt/types.h>
27
28#ifndef NO_DH
29
30#include <wolfssl/wolfcrypt/integer.h>
31#include <wolfssl/wolfcrypt/random.h>
32
33#ifdef __cplusplus
34 extern "C" {
35#endif
36
37#ifdef WOLFSSL_ASYNC_CRYPT
38 #include <wolfssl/wolfcrypt/async.h>
39#endif
40typedef struct DhParams {
41 const byte* p;
42 word32 p_len;
43 const byte* g;
44 word32 g_len;
45} DhParams;
46
47/* Diffie-Hellman Key */
48typedef struct DhKey {
49 mp_int p, g; /* group parameters */
50 void* heap;
51#ifdef WOLFSSL_ASYNC_CRYPT
52 WC_ASYNC_DEV asyncDev;
53#endif
54} DhKey;
55
56
57#ifdef HAVE_FFDHE_2048
58WOLFSSL_API const DhParams* wc_Dh_ffdhe2048_Get(void);
59#endif
60#ifdef HAVE_FFDHE_3072
61WOLFSSL_API const DhParams* wc_Dh_ffdhe3072_Get(void);
62#endif
63#ifdef HAVE_FFDHE_4096
64WOLFSSL_API const DhParams* wc_Dh_ffdhe4096_Get(void);
65#endif
66#ifdef HAVE_FFDHE_6144
67WOLFSSL_API const DhParams* wc_Dh_ffdhe6144_Get(void);
68#endif
69#ifdef HAVE_FFDHE_8192
70WOLFSSL_API const DhParams* wc_Dh_ffdhe8192_Get(void);
71#endif
72
73WOLFSSL_API int wc_InitDhKey(DhKey* key);
74WOLFSSL_API int wc_InitDhKey_ex(DhKey* key, void* heap, int devId);
75WOLFSSL_API void wc_FreeDhKey(DhKey* key);
76
77WOLFSSL_API int wc_DhGenerateKeyPair(DhKey* key, WC_RNG* rng, byte* priv,
78 word32* privSz, byte* pub, word32* pubSz);
79WOLFSSL_API int wc_DhAgree(DhKey* key, byte* agree, word32* agreeSz,
80 const byte* priv, word32 privSz, const byte* otherPub,
81 word32 pubSz);
82
83WOLFSSL_API int wc_DhKeyDecode(const byte* input, word32* inOutIdx, DhKey* key,
84 word32);
85WOLFSSL_API int wc_DhSetKey(DhKey* key, const byte* p, word32 pSz, const byte* g,
86 word32 gSz);
87WOLFSSL_API int wc_DhParamsLoad(const byte* input, word32 inSz, byte* p,
88 word32* pInOutSz, byte* g, word32* gInOutSz);
89WOLFSSL_API int wc_DhCheckPubKey(DhKey* key, const byte* pub, word32 pubSz);
90
91#ifdef __cplusplus
92 } /* extern "C" */
93#endif
94
95#endif /* NO_DH */
96#endif /* WOLF_CRYPT_DH_H */
97
Note: See TracBrowser for help on using the repository browser.