API参考
载入中...
搜索中...
未找到
dsa_local.h
1/*
2 * This file is part of the openHiTLS project.
3 *
4 * openHiTLS is licensed under the Mulan PSL v2.
5 * You can use this software according to the terms and conditions of the Mulan PSL v2.
6 * You may obtain a copy of Mulan PSL v2 at:
7 *
8 * http://license.coscl.org.cn/MulanPSL2
9 *
10 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
11 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
12 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
13 * See the Mulan PSL v2 for more details.
14 */
15
16#ifndef DSA_LOCAL_H
17#define DSA_LOCAL_H
18
19#include "hitls_build.h"
20#ifdef HITLS_CRYPTO_DSA
21
22#include "crypt_bn.h"
23#include "crypt_dsa.h"
24#include "sal_atomic.h"
25
26#ifdef __cplusplus
27extern "C" {
28#endif /* __cpluscplus */
29
30#define DSA_MIN_PBITS 1024 // The minimum specification of DSA: 1024 bits
31#define DSA_MAX_PBITS 3072 // The maximum specification of DSA: 3072 bits
32#define DSA_MIN_QBITS 160 // The minimum specification of parameter q of DSA
33
34/* DSA key parameters */
35struct DSA_Para {
36 BN_BigNum *p;
37 BN_BigNum *q;
38 BN_BigNum *g;
39};
40
41/* DSA key ctx */
42struct DSA_Ctx {
43 BN_BigNum *x; // private key
44 BN_BigNum *y; // public key
45 CRYPT_DSA_Para *para; // key parameter
46 BSL_SAL_RefCount references;
47 CRYPT_MD_AlgId signMdId;
48 uint8_t flag;
49 void *libCtx;
50 char *mdAttr;
51};
52
53#ifdef __cplusplus
54}
55#endif
56
57#endif // HITLS_CRYPTO_DSA
58
59#endif // DSA_LOCAL_H
CRYPT_MD_AlgId
定义 crypt_algid.h:68