• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 Huawei Technologies Co., Ltd.
3  * Licensed under the Mulan PSL v2.
4  * You can use this software according to the terms and conditions of the Mulan PSL v2.
5  * You may obtain a copy of Mulan PSL v2 at:
6  *     http://license.coscl.org.cn/MulanPSL2
7  * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
8  * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
9  * PURPOSE.
10  * See the Mulan PSL v2 for more details.
11  */
12 #include <stdbool.h>
13 #include <securec.h>
14 #include <tee_log.h>
15 #include "crypto_inner_interface.h"
16 
ec_nid_tom2boringssl(uint32_t domain)17 int ec_nid_tom2boringssl(uint32_t domain)
18 {
19     (void)domain;
20     return -1;
21 }
22 
ecc_privkey_tee_to_boring(void * priv,void ** eckey)23 TEE_Result ecc_privkey_tee_to_boring(void *priv, void **eckey)
24 {
25     (void)priv;
26     (void)eckey;
27     return TEE_ERROR_NOT_SUPPORTED;
28 }
29 
ecc_derive_public_key(ecc_priv_key_t * priv_info,ecc_pub_key_t * pub_info)30 int ecc_derive_public_key(ecc_priv_key_t *priv_info, ecc_pub_key_t *pub_info)
31 {
32     (void)priv_info;
33     (void)pub_info;
34     return -1;
35 }
36 
derive_ecc_private_key_from_huk(ecc_priv_key_t * priv,const uint8_t * secret,uint32_t sec_len)37 int derive_ecc_private_key_from_huk(ecc_priv_key_t *priv, const uint8_t *secret, uint32_t sec_len)
38 {
39     (void)priv;
40     (void)secret;
41     (void)sec_len;
42     return -1;
43 }
44 
derive_private_key_from_secret(void * priv,uint8_t * secret,uint32_t secret_len,uint32_t bits,uint32_t key_type,uint8_t * file_name)45 int derive_private_key_from_secret(void *priv, uint8_t *secret, uint32_t secret_len, uint32_t bits, uint32_t key_type,
46                                    uint8_t *file_name)
47 {
48     (void)priv;
49     (void)secret;
50     (void)secret_len;
51     (void)bits;
52     (void)key_type;
53     (void)file_name;
54     return -1;
55 }
56 
ecc_export_pub(uint8_t * out,uint32_t out_size,ecc_pub_key_t * pub)57 int32_t ecc_export_pub(uint8_t *out, uint32_t out_size, ecc_pub_key_t *pub)
58 {
59     (void)out;
60     (void)out_size;
61     (void)pub;
62     return -1;
63 }
64 
ecc_import_pub(ecc_pub_key_t * pub,const uint8_t * in,uint32_t inlen)65 int32_t ecc_import_pub(ecc_pub_key_t *pub, const uint8_t *in, uint32_t inlen)
66 {
67     (void)pub;
68     (void)in;
69     (void)inlen;
70     return -1;
71 }
72 
ecc_import_priv(ecc_priv_key_t * priv,const uint8_t * in,uint32_t inlen)73 int32_t ecc_import_priv(ecc_priv_key_t *priv, const uint8_t *in, uint32_t inlen)
74 {
75     (void)priv;
76     (void)in;
77     (void)inlen;
78     return -1;
79 }
80 
get_next_tlv(uint32_t * type,uint32_t * header_len,const uint8_t * buf,uint32_t buf_len)81 int32_t get_next_tlv(uint32_t *type, uint32_t *header_len, const uint8_t *buf, uint32_t buf_len)
82 {
83     (void)type;
84     (void)header_len;
85     (void)buf;
86     (void)buf_len;
87     return -1;
88 }
89 
ecc_sign_digest(uint8_t * signature,uint32_t sig_size,uint8_t * in,uint32_t in_len,ecc_priv_key_t * priv)90 int32_t ecc_sign_digest(uint8_t *signature, uint32_t sig_size, uint8_t *in, uint32_t in_len, ecc_priv_key_t *priv)
91 {
92     (void)signature;
93     (void)sig_size;
94     (void)in;
95     (void)in_len;
96     (void)priv;
97     return -1;
98 }
99 
ecc_verify_digest(const uint8_t * signature,uint32_t sig_len,uint8_t * in,uint32_t in_len,ecc_pub_key_t * pub)100 int32_t ecc_verify_digest(const uint8_t *signature, uint32_t sig_len, uint8_t *in, uint32_t in_len, ecc_pub_key_t *pub)
101 {
102     (void)signature;
103     (void)sig_len;
104     (void)in;
105     (void)in_len;
106     (void)pub;
107     return -1;
108 }
109