-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
options: tee: manufacturing protection
This option allows lmp-device-register to interrogate the CAAM hardware for an EC public key (256 bits usually) The key will be stored in /var/sota in PEM format (for reference) and passed to the gateway in the CSR using a custom extension [1] Afer registration aktualizer-lite should periodically request the CAAM hardware to sign random strings and send these signatures to the gateway along with the message. See [2] for optee-client reference. Upon receiving these digests, the gateway shall verify them using the board associated public key [1] "1.3.6.1.4.1.294.1.00" [2] OP-TEE/optee_client#352 Signed-off-by: Jorge Ramirez-Ortiz <[email protected]>
- Loading branch information
Showing
8 changed files
with
218 additions
and
10 deletions.
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,35 @@ | ||
/* SPDX-License-Identifier: BSD-2-Clause */ | ||
/* | ||
* Copyright 2018-2019, 2023 NXP | ||
*/ | ||
#ifndef PTA_IMX_MANUFACTURING_PROTECTION_H | ||
#define PTA_IMX_MANUFACTURING_PROTECTION_H | ||
|
||
#define PTA_MANUFACT_PROTEC_UUID { 0x83268b7c, 0x85e3, 0x11e8, \ | ||
{ 0xad, 0xc0, 0xfa, 0x7a, 0xe0, 0x1b, 0xbe, 0xbc} } | ||
|
||
/* | ||
* Sign the given message with the manufacturing protection private key | ||
* | ||
* [in] memref[0].buffer Message buffer | ||
* [in] memref[0].size Message size | ||
* [out] memref[1].buffer Signature buffer | ||
* [out] memref[1].size Signature size | ||
* [out] memref[2].buffer MPMR buffer | ||
* [out] memref[2].size MPMR size | ||
*/ | ||
#define PTA_IMX_MP_CMD_SIGNATURE_MPMR 0 | ||
|
||
/* | ||
* Get the manufacturing protection public key | ||
* | ||
* [out] memref[0].buffer Public key buffer | ||
* [out] memref[0].size Public key size | ||
* | ||
* Return codes: | ||
* TEE_SUCCESS - Invoke command success | ||
* TEE_ERROR_BAD_PARAMETERS - Incorrect input param | ||
*/ | ||
#define PTA_IMX_MP_CMD_GET_PUBLIC_KEY 1 | ||
|
||
#endif /* PTA_IMX_MANUFACTURING_PROTECTION_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
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,31 @@ | ||
/* | ||
* Copyright (c) 2023 Foundries.io | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
#include <device_register.h> | ||
#include <pta_tee.h> | ||
#include <stdio.h> | ||
|
||
int tee_imx_get_mprotect_pubkey(lmp_options &opt) | ||
{ | ||
char key[257] = { 0 }; | ||
size_t key_len = sizeof(key) - 1; | ||
string ec_raw; | ||
PTA_RV res; | ||
|
||
memset(key, '\0', sizeof(key)); | ||
|
||
/* Uncompressed format*/ | ||
key[0] = POINT_CONVERSION_UNCOMPRESSED; | ||
|
||
res = pta_imx_mprotect_get_key(key + 1, &key_len); | ||
if (res != PTAR_OK) { | ||
cout << "Can't get the MProtect key (" << res << ")" << endl; | ||
return -1; | ||
} | ||
|
||
ec_raw = string(key); | ||
|
||
return openssl_ec_raw_to_pem(ec_raw, opt.mprotect_key); | ||
} |
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) 2023 Foundries.io | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
#include <device_register.h> | ||
#include <stdio.h> | ||
|
||
int tee_imx_get_mprotect_pubkey(lmp_options &opt) | ||
{ | ||
/* Taken from imx8mm */ | ||
string ec_raw = "8EE2ECDD46EEF367774F225E4EAD75A8" | ||
"0FD71C8A1B03779H9H0808C053584C14" | ||
"6FF5114EA17220A513C15F91D314766D" | ||
"316840DF69740BBB8E48BC39C84887BE"; | ||
|
||
cout << "WARNING: using Manufacturing Protection stub" << endl; | ||
|
||
return openssl_ec_raw_to_pem(ec_raw,opt.mprotect_key); | ||
} |