source: asp3_tinet_ecnl_rx/trunk/wolfssl-3.12.2/wolfssl/wolfcrypt/dsa.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.5 KB
Line 
1/* dsa.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_DSA_H
24#define WOLF_CRYPT_DSA_H
25
26#include <wolfssl/wolfcrypt/types.h>
27
28#ifndef NO_DSA
29
30#include <wolfssl/wolfcrypt/integer.h>
31#include <wolfssl/wolfcrypt/random.h>
32
33/* for DSA reverse compatibility */
34#define InitDsaKey wc_InitDsaKey
35#define FreeDsaKey wc_FreeDsaKey
36#define DsaSign wc_DsaSign
37#define DsaVerify wc_DsaVerify
38#define DsaPublicKeyDecode wc_DsaPublicKeyDecode
39#define DsaPrivateKeyDecode wc_DsaPrivateKeyDecode
40#define DsaKeyToDer wc_DsaKeyToDer
41
42#ifdef __cplusplus
43 extern "C" {
44#endif
45
46
47enum {
48 DSA_PUBLIC = 0,
49 DSA_PRIVATE = 1
50};
51
52/* DSA */
53typedef struct DsaKey {
54 mp_int p, q, g, y, x;
55 int type; /* public or private */
56 void* heap; /* memory hint */
57} DsaKey;
58
59WOLFSSL_API int wc_InitDsaKey(DsaKey* key);
60WOLFSSL_API int wc_InitDsaKey_h(DsaKey* key, void* h);
61WOLFSSL_API void wc_FreeDsaKey(DsaKey* key);
62WOLFSSL_API int wc_DsaSign(const byte* digest, byte* out,
63 DsaKey* key, WC_RNG* rng);
64WOLFSSL_API int wc_DsaVerify(const byte* digest, const byte* sig,
65 DsaKey* key, int* answer);
66WOLFSSL_API int wc_DsaPublicKeyDecode(const byte* input, word32* inOutIdx,
67 DsaKey*, word32);
68WOLFSSL_API int wc_DsaPrivateKeyDecode(const byte* input, word32* inOutIdx,
69 DsaKey*, word32);
70WOLFSSL_API int wc_DsaKeyToDer(DsaKey* key, byte* output, word32 inLen);
71
72#ifdef WOLFSSL_KEY_GEN
73WOLFSSL_API int wc_MakeDsaKey(WC_RNG *rng, DsaKey *dsa);
74WOLFSSL_API int wc_MakeDsaParameters(WC_RNG *rng, int modulus_size, DsaKey *dsa);
75#endif
76
77#ifdef __cplusplus
78 } /* extern "C" */
79#endif
80
81#endif /* NO_DSA */
82#endif /* WOLF_CRYPT_DSA_H */
83
Note: See TracBrowser for help on using the repository browser.