Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Mbedtls
提交
a6de8b99
T
Third Party Mbedtls
项目概览
OpenHarmony
/
Third Party Mbedtls
大约 2 年 前同步成功
通知
0
Star
19
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Mbedtls
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
a6de8b99
编写于
10月 14, 2022
作者:
O
openharmony_ci
提交者:
Gitee
10月 14, 2022
浏览文件
操作
浏览文件
下载
差异文件
!65 #I5VV26:黄区编译
Merge pull request !65 from liyufan/master
上级
74e39bc9
ac13d0b2
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
24 addition
and
32 deletion
+24
-32
library/psa_crypto.c
library/psa_crypto.c
+22
-30
library/psa_crypto_driver_wrappers.c
library/psa_crypto_driver_wrappers.c
+2
-2
未找到文件。
library/psa_crypto.c
浏览文件 @
a6de8b99
...
...
@@ -1405,6 +1405,7 @@ psa_status_t psa_export_public_key( mbedtls_svc_key_id_t key,
psa_status_t
status
=
PSA_ERROR_CORRUPTION_DETECTED
;
psa_status_t
unlock_status
=
PSA_ERROR_CORRUPTION_DETECTED
;
psa_key_slot_t
*
slot
;
psa_key_attributes_t
attributes
;
/* Reject a zero-length output buffer now, since this can never be a
* valid key representation. This way we know that data must be a valid
...
...
@@ -1429,9 +1430,7 @@ psa_status_t psa_export_public_key( mbedtls_svc_key_id_t key,
goto
exit
;
}
psa_key_attributes_t
attributes
=
{
.
core
=
slot
->
attr
};
attributes
.
core
=
slot
->
attr
;
status
=
psa_driver_wrapper_export_public_key
(
&
attributes
,
slot
->
key
.
data
,
slot
->
key
.
bytes
,
data
,
data_size
,
data_length
);
...
...
@@ -2343,6 +2342,7 @@ static psa_status_t psa_mac_setup( psa_mac_operation_t *operation,
psa_status_t
status
=
PSA_ERROR_CORRUPTION_DETECTED
;
psa_status_t
unlock_status
=
PSA_ERROR_CORRUPTION_DETECTED
;
psa_key_slot_t
*
slot
=
NULL
;
psa_key_attributes_t
attributes
;
/* A context must be freshly initialized before it can be set up. */
if
(
operation
->
id
!=
0
)
...
...
@@ -2359,10 +2359,7 @@ static psa_status_t psa_mac_setup( psa_mac_operation_t *operation,
if
(
status
!=
PSA_SUCCESS
)
goto
exit
;
psa_key_attributes_t
attributes
=
{
.
core
=
slot
->
attr
};
attributes
.
core
=
slot
->
attr
;
status
=
psa_mac_finalize_alg_and_key_validation
(
alg
,
&
attributes
,
&
operation
->
mac_size
);
if
(
status
!=
PSA_SUCCESS
)
...
...
@@ -2537,6 +2534,7 @@ static psa_status_t psa_mac_compute_internal( mbedtls_svc_key_id_t key,
psa_status_t
unlock_status
=
PSA_ERROR_CORRUPTION_DETECTED
;
psa_key_slot_t
*
slot
;
uint8_t
operation_mac_size
=
0
;
psa_key_attributes_t
attributes
;
status
=
psa_get_and_lock_key_slot_with_policy
(
key
,
...
...
@@ -2546,9 +2544,7 @@ static psa_status_t psa_mac_compute_internal( mbedtls_svc_key_id_t key,
if
(
status
!=
PSA_SUCCESS
)
goto
exit
;
psa_key_attributes_t
attributes
=
{
.
core
=
slot
->
attr
};
attributes
.
core
=
slot
->
attr
;
status
=
psa_mac_finalize_alg_and_key_validation
(
alg
,
&
attributes
,
&
operation_mac_size
);
...
...
@@ -2675,6 +2671,7 @@ static psa_status_t psa_sign_internal( mbedtls_svc_key_id_t key,
psa_status_t
status
=
PSA_ERROR_CORRUPTION_DETECTED
;
psa_status_t
unlock_status
=
PSA_ERROR_CORRUPTION_DETECTED
;
psa_key_slot_t
*
slot
;
psa_key_attributes_t
attributes
;
*
signature_length
=
0
;
...
...
@@ -2704,9 +2701,7 @@ static psa_status_t psa_sign_internal( mbedtls_svc_key_id_t key,
goto
exit
;
}
psa_key_attributes_t
attributes
=
{
.
core
=
slot
->
attr
};
attributes
.
core
=
slot
->
attr
;
if
(
input_is_message
)
{
...
...
@@ -3286,6 +3281,7 @@ static psa_status_t psa_cipher_setup( psa_cipher_operation_t *operation,
psa_key_usage_t
usage
=
(
cipher_operation
==
MBEDTLS_ENCRYPT
?
PSA_KEY_USAGE_ENCRYPT
:
PSA_KEY_USAGE_DECRYPT
);
psa_key_attributes_t
attributes
;
/* A context must be freshly initialized before it can be set up. */
if
(
operation
->
id
!=
0
)
...
...
@@ -3315,9 +3311,7 @@ static psa_status_t psa_cipher_setup( psa_cipher_operation_t *operation,
operation
->
iv_required
=
1
;
operation
->
default_iv_length
=
PSA_CIPHER_IV_LENGTH
(
slot
->
attr
.
type
,
alg
);
psa_key_attributes_t
attributes
=
{
.
core
=
slot
->
attr
};
attributes
.
core
=
slot
->
attr
;
/* Try doing the operation through a driver before using software fallback. */
if
(
cipher_operation
==
MBEDTLS_ENCRYPT
)
...
...
@@ -3552,6 +3546,7 @@ psa_status_t psa_cipher_encrypt( mbedtls_svc_key_id_t key,
psa_key_slot_t
*
slot
=
NULL
;
uint8_t
local_iv
[
PSA_CIPHER_IV_MAX_SIZE
];
size_t
default_iv_length
=
0
;
psa_key_attributes_t
attributes
;
if
(
!
PSA_ALG_IS_CIPHER
(
alg
)
)
{
...
...
@@ -3565,9 +3560,7 @@ psa_status_t psa_cipher_encrypt( mbedtls_svc_key_id_t key,
if
(
status
!=
PSA_SUCCESS
)
goto
exit
;
psa_key_attributes_t
attributes
=
{
.
core
=
slot
->
attr
};
attributes
.
core
=
slot
->
attr
;
default_iv_length
=
PSA_CIPHER_IV_LENGTH
(
slot
->
attr
.
type
,
alg
);
if
(
default_iv_length
>
PSA_CIPHER_IV_MAX_SIZE
)
...
...
@@ -3623,6 +3616,7 @@ psa_status_t psa_cipher_decrypt( mbedtls_svc_key_id_t key,
psa_status_t
status
=
PSA_ERROR_CORRUPTION_DETECTED
;
psa_status_t
unlock_status
=
PSA_ERROR_CORRUPTION_DETECTED
;
psa_key_slot_t
*
slot
=
NULL
;
psa_key_attributes_t
attributes
;
if
(
!
PSA_ALG_IS_CIPHER
(
alg
)
)
{
...
...
@@ -3636,9 +3630,7 @@ psa_status_t psa_cipher_decrypt( mbedtls_svc_key_id_t key,
if
(
status
!=
PSA_SUCCESS
)
goto
exit
;
psa_key_attributes_t
attributes
=
{
.
core
=
slot
->
attr
};
attributes
.
core
=
slot
->
attr
;
if
(
alg
==
PSA_ALG_CCM_STAR_NO_TAG
&&
input_length
<
PSA_BLOCK_CIPHER_BLOCK_LENGTH
(
slot
->
attr
.
type
)
)
{
...
...
@@ -3829,6 +3821,7 @@ static psa_status_t psa_aead_setup( psa_aead_operation_t *operation,
psa_status_t
unlock_status
=
PSA_ERROR_CORRUPTION_DETECTED
;
psa_key_slot_t
*
slot
=
NULL
;
psa_key_usage_t
key_usage
=
0
;
psa_key_attributes_t
attributes
;
if
(
!
PSA_ALG_IS_AEAD
(
alg
)
||
PSA_ALG_IS_WILDCARD
(
alg
)
)
{
...
...
@@ -3859,9 +3852,7 @@ static psa_status_t psa_aead_setup( psa_aead_operation_t *operation,
if
(
status
!=
PSA_SUCCESS
)
goto
exit
;
psa_key_attributes_t
attributes
=
{
.
core
=
slot
->
attr
};
attributes
.
core
=
slot
->
attr
;
if
(
is_encrypt
)
status
=
psa_driver_wrapper_aead_encrypt_setup
(
operation
,
...
...
@@ -4781,6 +4772,7 @@ static psa_status_t psa_generate_derived_key_internal(
size_t
bytes
=
PSA_BITS_TO_BYTES
(
bits
);
size_t
storage_size
=
bytes
;
psa_status_t
status
;
psa_key_attributes_t
attributes
;
if
(
!
key_type_is_raw_bytes
(
slot
->
attr
.
type
)
)
return
(
PSA_ERROR_INVALID_ARGUMENT
);
...
...
@@ -4799,9 +4791,7 @@ static psa_status_t psa_generate_derived_key_internal(
#endif
/* MBEDTLS_PSA_BUILTIN_KEY_TYPE_DES */
slot
->
attr
.
bits
=
(
psa_key_bits_t
)
bits
;
psa_key_attributes_t
attributes
=
{
.
core
=
slot
->
attr
};
attributes
.
core
=
slot
->
attr
;
if
(
psa_key_lifetime_is_external
(
attributes
.
core
.
lifetime
)
)
{
...
...
@@ -5372,14 +5362,16 @@ static psa_status_t psa_key_agreement_raw_internal( psa_algorithm_t alg,
size_t
shared_secret_size
,
size_t
*
shared_secret_length
)
{
mbedtls_ecp_keypair
*
ecp
;
psa_status_t
status
;
switch
(
alg
)
{
#if defined(MBEDTLS_PSA_BUILTIN_ALG_ECDH)
case
PSA_ALG_ECDH
:
if
(
!
PSA_KEY_TYPE_IS_ECC_KEY_PAIR
(
private_key
->
attr
.
type
)
)
return
(
PSA_ERROR_INVALID_ARGUMENT
);
mbedtls_ecp_keypair
*
ecp
=
NULL
;
psa_status_t
status
=
mbedtls_psa_ecp_load_representation
(
ecp
=
NULL
;
status
=
mbedtls_psa_ecp_load_representation
(
private_key
->
attr
.
type
,
private_key
->
attr
.
bits
,
private_key
->
key
.
data
,
...
...
library/psa_crypto_driver_wrappers.c
浏览文件 @
a6de8b99
...
...
@@ -1157,9 +1157,9 @@ psa_status_t psa_driver_wrapper_cipher_decrypt_setup(
operation
->
id
=
PSA_CRYPTO_MBED_TLS_DRIVER_ID
;
return
(
status
);
#e
ndif
/* MBEDTLS_PSA_BUILTIN_CIPHER */
#e
lse
/* MBEDTLS_PSA_BUILTIN_CIPHER */
return
(
PSA_ERROR_NOT_SUPPORTED
);
#endif
/* Add cases for opaque driver here */
#if defined(PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT)
#if defined(PSA_CRYPTO_DRIVER_TEST)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录