• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 HITLS_CRL_LOCAL_H
17 #define HITLS_CRL_LOCAL_H
18 
19 #include "hitls_build.h"
20 #ifdef HITLS_PKI_X509_CRL
21 #include <stdint.h>
22 #include "bsl_asn1.h"
23 #include "bsl_obj.h"
24 #include "sal_atomic.h"
25 #include "hitls_x509_local.h"
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 #define HITLS_X509_CRL_PARSE_FLAG  0x01
32 #define HITLS_X509_CRL_GEN_FLAG    0x02
33 
34 #define BSL_TIME_REVOKE_TIME_IS_GMT  0x4
35 
36 typedef struct _HITLS_X509_CrlEntry {
37     uint8_t flag;
38     BSL_ASN1_Buffer serialNumber;
39     BSL_TIME time;
40     BSL_ASN1_List *extList;
41 } HITLS_X509_CrlEntry;
42 
43 typedef struct {
44     uint8_t *tbsRawData;
45     uint32_t tbsRawDataLen;
46 
47     int32_t version;
48     HITLS_X509_Asn1AlgId signAlgId;
49 
50     BSL_ASN1_List *issuerName;
51     HITLS_X509_ValidTime validTime;
52 
53     BSL_ASN1_List *revokedCerts;
54     HITLS_X509_Ext crlExt;
55 } HITLS_X509_CrlTbs;
56 
57 typedef enum {
58     HITLS_X509_CRL_STATE_NEW = 0,
59     HITLS_X509_CRL_STATE_SET,
60     HITLS_X509_CRL_STATE_SIGN,
61     HITLS_X509_CRL_STATE_GEN,
62 } HITLS_X509_CRL_STATE;
63 
64 typedef struct _HITLS_X509_Crl {
65     uint8_t flag;
66     uint8_t state;
67 
68     uint8_t *rawData;
69     uint32_t rawDataLen;
70     HITLS_X509_CrlTbs tbs;
71     HITLS_X509_Asn1AlgId signAlgId;
72     BSL_ASN1_BitString signature;
73 
74     BSL_SAL_RefCount references;
75 } HITLS_X509_Crl;
76 
77 #ifdef __cplusplus
78 }
79 #endif
80 
81 #endif // HITLS_PKI_X509_CRL
82 
83 #endif // HITLS_CRL_LOCAL_H