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 27 extern "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 */ 35 struct DSA_Para { 36 BN_BigNum *p; 37 BN_BigNum *q; 38 BN_BigNum *g; 39 }; 40 41 /* DSA key ctx */ 42 struct 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 void *libCtx; 48 }; 49 50 #ifdef __cplusplus 51 } 52 #endif 53 54 #endif // HITLS_CRYPTO_DSA 55 56 #endif // DSA_LOCAL_H 57