• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *    http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef HCF_OEPNSSL_CLASS_H
17 #define HCF_OEPNSSL_CLASS_H
18 
19 #include "pub_key.h"
20 #include "pri_key.h"
21 #include "key_pair.h"
22 #include "x509_certificate_spi.h"
23 #include "x509_crl_entry.h"
24 #include "x509_crl.h"
25 #include "x509_crl_spi.h"
26 
27 #include <openssl/bn.h>
28 #include <openssl/ec.h>
29 #include <openssl/evp.h>
30 #include <openssl/rsa.h>
31 #include <openssl/x509.h>
32 
33 typedef struct {
34     HcfPubKey base;
35 
36     int32_t curveId;
37 
38     EC_POINT *pk;
39 } HcfOpensslEccPubKey;
40 #define HCF_OPENSSL_ECC_PUB_KEY_CLASS "OPENSSL.ECC.PUB_KEY"
41 
42 typedef struct {
43     HcfPriKey base;
44 
45     int32_t curveId;
46 
47     BIGNUM *sk;
48 } HcfOpensslEccPriKey;
49 #define HCF_OPENSSL_ECC_PRI_KEY_CLASS "OPENSSL.ECC.PRI_KEY"
50 
51 typedef struct {
52     HcfKeyPair base;
53 } HcfOpensslEccKeyPair;
54 #define HCF_OPENSSL_ECC_KEY_PAIR_CLASS "OPENSSL.ECC.KEY_PAIR"
55 
56 typedef struct {
57     HcfPubKey base;
58 
59     uint32_t bits;
60 
61     RSA *pk;
62 } HcfOpensslRsaPubKey;
63 #define OPENSSL_RSA_PUBKEY_CLASS "OPENSSL.RSA.PUB_KEY"
64 
65 typedef struct {
66     HcfPriKey base;
67 
68     uint32_t bits;
69 
70     RSA *sk;
71 } HcfOpensslRsaPriKey;
72 #define OPENSSL_RSA_PRIKEY_CLASS "OPENSSL.RSA.PRI_KEY"
73 
74 typedef struct {
75     HcfKeyPair base;
76 } HcfOpensslRsaKeyPair;
77 #define OPENSSL_RSA_KEYPAIR_CLASS "OPENSSL.RSA.KEY_PAIR"
78 
79 typedef struct {
80     HcfX509CertificateSpi base;
81     X509 *x509;
82 } HcfOpensslX509Cert;
83 #define X509_CERT_OPENSSL_CLASS "X509CertOpensslClass"
84 
85 typedef struct {
86     HcfX509CrlEntry base;
87     X509_REVOKED *rev;
88     HcfBlob *certIssuer;
89 } HcfX509CRLEntryOpensslImpl;
90 #define X509_CRL_ENTRY_OPENSSL_CLASS "X509CrlEntryOpensslClass"
91 
92 typedef struct {
93     HcfX509Crl base;
94     HcfX509CrlSpi *spiObj;
95     const char *certType;
96 } HcfX509CrlImpl;
97 #define X509_CRL_OPENSSL_CLASS "X509CrlOpensslClass"
98 
99 #define OPENSSL_RSA_CIPHER_CLASS "OPENSSL.RSA.CIPHER"
100 #define OPENSSL_3DES_CIPHER_CLASS "OPENSSL.3DES.CIPHER"
101 #define OPENSSL_AES_CIPHER_CLASS "OPENSSL.AES.CIPHER"
102 
103 #endif
104