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 | /* dsa.h for openSSL */
|
---|
23 |
|
---|
24 |
|
---|
25 | #ifndef WOLFSSL_DSA_H_
|
---|
26 | #define WOLFSSL_DSA_H_
|
---|
27 |
|
---|
28 | #include <wolfssl/openssl/bn.h>
|
---|
29 |
|
---|
30 | #ifdef __cplusplus
|
---|
31 | extern "C" {
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | #ifndef WOLFSSL_DSA_TYPE_DEFINED /* guard on redeclaration */
|
---|
35 | typedef struct WOLFSSL_DSA WOLFSSL_DSA;
|
---|
36 | #define WOLFSSL_DSA_TYPE_DEFINED
|
---|
37 | #endif
|
---|
38 |
|
---|
39 | typedef WOLFSSL_DSA DSA;
|
---|
40 |
|
---|
41 | struct WOLFSSL_DSA {
|
---|
42 | WOLFSSL_BIGNUM* p;
|
---|
43 | WOLFSSL_BIGNUM* q;
|
---|
44 | WOLFSSL_BIGNUM* g;
|
---|
45 | WOLFSSL_BIGNUM* pub_key; /* our y */
|
---|
46 | WOLFSSL_BIGNUM* priv_key; /* our x */
|
---|
47 | void* internal; /* our Dsa Key */
|
---|
48 | char inSet; /* internal set from external ? */
|
---|
49 | char exSet; /* external set from internal ? */
|
---|
50 | };
|
---|
51 |
|
---|
52 |
|
---|
53 | WOLFSSL_API WOLFSSL_DSA* wolfSSL_DSA_new(void);
|
---|
54 | WOLFSSL_API void wolfSSL_DSA_free(WOLFSSL_DSA*);
|
---|
55 |
|
---|
56 | WOLFSSL_API int wolfSSL_DSA_generate_key(WOLFSSL_DSA*);
|
---|
57 |
|
---|
58 | typedef void (*WOLFSSL_BN_CB)(int i, int j, void* exArg);
|
---|
59 | WOLFSSL_API WOLFSSL_DSA* wolfSSL_DSA_generate_parameters(int bits,
|
---|
60 | unsigned char* seed, int seedLen, int* counterRet,
|
---|
61 | unsigned long* hRet, WOLFSSL_BN_CB cb, void* CBArg);
|
---|
62 | WOLFSSL_API int wolfSSL_DSA_generate_parameters_ex(WOLFSSL_DSA*, int bits,
|
---|
63 | unsigned char* seed, int seedLen, int* counterRet,
|
---|
64 | unsigned long* hRet, void* cb);
|
---|
65 |
|
---|
66 | WOLFSSL_API int wolfSSL_DSA_LoadDer(WOLFSSL_DSA*, const unsigned char*, int sz);
|
---|
67 |
|
---|
68 | WOLFSSL_API int wolfSSL_DSA_do_sign(const unsigned char* d,
|
---|
69 | unsigned char* sigRet, WOLFSSL_DSA* dsa);
|
---|
70 |
|
---|
71 | WOLFSSL_API int wolfSSL_DSA_do_verify(const unsigned char* d,
|
---|
72 | unsigned char* sig,
|
---|
73 | WOLFSSL_DSA* dsa, int *dsacheck);
|
---|
74 |
|
---|
75 | #define DSA_new wolfSSL_DSA_new
|
---|
76 | #define DSA_free wolfSSL_DSA_free
|
---|
77 |
|
---|
78 | #define DSA_generate_key wolfSSL_DSA_generate_key
|
---|
79 | #define DSA_generate_parameters wolfSSL_DSA_generate_parameters
|
---|
80 | #define DSA_generate_parameters_ex wolfSSL_DSA_generate_parameters_ex
|
---|
81 |
|
---|
82 |
|
---|
83 | #ifdef __cplusplus
|
---|
84 | } /* extern "C" */
|
---|
85 | #endif
|
---|
86 |
|
---|
87 | #endif /* header */
|
---|