-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implementation of COMPONENT_SECUREF with JEDEC TG424_3 for secure flash block device driver #15436
Open
AlvinZhou97
wants to merge
1
commit into
ARMmbed:master
Choose a base branch
from
macronix:macronix_secureflash
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Copyright (c) 2020 ARM Limited. All rights reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
target_sources(mbed-storage-securef | ||
INTERFACE | ||
source/SecureFBlockDevice.cpp | ||
PRIVATE | ||
platform/plat_secure_flash.cpp | ||
spi_nor_flash/spi_nor.c | ||
) | ||
|
||
target_include_directories(mbed-storage-securef | ||
INTERFACE | ||
include | ||
include/SECUREF | ||
PRIVATE | ||
platform/include/ | ||
spi_nor_flash/ | ||
) | ||
add_subdirectory(JEDEC_security_HAL) |
27 changes: 27 additions & 0 deletions
27
storage/blockdevice/COMPONENT_SECUREF/TG424_3/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#------------------------------------------------------------------------------- | ||
# Copyright (c) 2020-2023 Macronix International Co. LTD. All rights reserved. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
#------------------------------------------------------------------------------- | ||
|
||
cmake_minimum_required(VERSION 3.15) | ||
|
||
cmake_policy(SET CMP0079 NEW) | ||
|
||
add_library(jedec_security_hal STATIC) | ||
|
||
target_sources(jedec_security_hal | ||
PRIVATE | ||
JEDEC_security_HAL/jedec_security_hal.c | ||
JEDEC_security_HAL/queue.c | ||
) | ||
|
||
target_include_directories(jedec_security_hal | ||
PUBLIC | ||
${CMAKE_CURRENT_SOURCE_DIR}/JEDEC_security_HAL | ||
${CMAKE_CURRENT_SOURCE_DIR}/JEDEC_security_HAL/include | ||
${CMAKE_CURRENT_SOURCE_DIR}/vendor_impl | ||
) | ||
|
||
add_subdirectory(vendor_impl) |
24 changes: 24 additions & 0 deletions
24
storage/blockdevice/COMPONENT_SECUREF/TG424_3/JEDEC_security_HAL/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#------------------------------------------------------------------------------- | ||
# Copyright (c) 2020-2023 Macronix International Co. LTD. All rights reserved. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
#------------------------------------------------------------------------------- | ||
|
||
cmake_minimum_required(VERSION 3.15) | ||
|
||
cmake_policy(SET CMP0079 NEW) | ||
|
||
add_library(jedec_security_hal STATIC) | ||
|
||
target_sources(jedec_security_hal | ||
PRIVATE | ||
jedec_security_hal.c | ||
queue.c | ||
) | ||
|
||
target_include_directories(jedec_security_hal | ||
PUBLIC | ||
${CMAKE_CURRENT_SOURCE_DIR} | ||
${CMAKE_CURRENT_SOURCE_DIR}/include | ||
) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you add a new line at the end of the file, following our guidelines There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will make the correction, thanks. |
67 changes: 67 additions & 0 deletions
67
storage/blockdevice/COMPONENT_SECUREF/TG424_3/JEDEC_security_HAL/crypto_wrapper.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* Copyright (c) 2022-2023 Macronix International Co. LTD. All rights reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
#ifndef _CRYPTO_WRAPPER_H_ | ||
#define _CRYPTO_WRAPPER_H_ | ||
|
||
#include <stdint.h> | ||
#include "include/crypto_defs.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
typedef int (*init_t)(void); | ||
typedef int (*deinit_t)(void); | ||
typedef int (*algorithm_support_t)(int alg); | ||
typedef int (*crypto_func_t)(crypto_indicator_t *indicator); | ||
typedef int (*key_derive_t)(crypto_indicator_t *indicator, uint32_t *output_key_id); | ||
typedef int (*generate_random_t)(uint8_t *odata, uint32_t odata_len); | ||
typedef int (*ecdh_gen_key_pair_t)(crypto_indicator_t *indicator); | ||
typedef int (*ecdh_gen_shared_secret_t)(crypto_indicator_t *indicator); | ||
|
||
typedef int (*open_key_t)(uint32_t key_id); | ||
typedef int (*close_key_t)(uint32_t key_id); | ||
typedef int (*destroy_key_t)(uint32_t key_id); | ||
typedef int (*export_public_key_t)(uint32_t key_id, uint8_t *key_buf, uint32_t buf_size, uint32_t *actual_size); | ||
typedef int (*export_key_t)(uint32_t key_id, uint8_t *key_buf, uint32_t buf_size, uint32_t *actual_size); | ||
typedef int (*import_key_t)(uint32_t *key_id, uint8_t *key_buf, uint32_t buf_size, KeyLifeTime lifetime); | ||
|
||
|
||
typedef struct { | ||
init_t init; | ||
deinit_t deinit; | ||
algorithm_support_t algorithm_support; | ||
crypto_func_t crypto_func; | ||
key_derive_t key_derive; | ||
generate_random_t generate_random; | ||
ecdh_gen_key_pair_t ecdh_gen_key_pair; | ||
ecdh_gen_shared_secret_t ecdh_gen_shared_secret; | ||
|
||
open_key_t open_key; | ||
close_key_t close_key; | ||
destroy_key_t destroy_key; | ||
export_public_key_t export_public_key; | ||
export_key_t export_key; | ||
import_key_t import_key; | ||
|
||
} crypto_wrapper_t; | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* _CRYPTO_WRAPPER_H_ */ |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be separate commit but the main thread should be changed in the application, this would not fit smaller devices.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it, I will move to the appropriate place.