• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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 #include "cf_ability.h"
17 
18 #include "cf_log.h"
19 #include "cf_magic.h"
20 #include "cf_object_ability_define.h"
21 #include "cf_object_cert.h"
22 #include "x509_certificate_create.h"
23 
24 static CfObjectAbilityFunc g_certObjectFunc = {
25     .base.type = CF_MAGIC(CF_MAGIC_TYPE_OBJ_FUNC, CF_OBJ_TYPE_CERT),
26     .create = CfCertCreate,
27     .destroy = CfCertDestroy,
28     .check = CfCertCheck,
29     .get = CfCertGet,
30 };
31 
LoadCertOjbectAbility(void)32 __attribute__((constructor)) static void LoadCertOjbectAbility(void)
33 {
34     (void)RegisterAbility(CF_ABILITY(CF_ABILITY_TYPE_OBJECT, CF_OBJ_TYPE_CERT), &g_certObjectFunc.base);
35     SetHcfX509CertCreateFunc(HcfX509CertificateCreate);
36 }
37