Skip to content

Commit 46ceff9

Browse files
committed
format update
1 parent 92aeb22 commit 46ceff9

File tree

2 files changed

+15
-17
lines changed

2 files changed

+15
-17
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ https://github.com/Azure-Samples/Azure-RTOS-on-Azure-Sphere-Mediatek-MT3620
4141

4242
This sample demonstrates how Azure Sphere and Azure RTOS are able to run together on the MediaTek MT3620 Development Kit.
4343

44-
## User-defined Crypto Ciphersuites
44+
## User-defined Crypto Ciphersuite
4545

46-
This [guide](./user-defined%20ciphersuites.md) demonstrates how to implement user-defined crypto ciphersuites and integrate it with Azure IoT Sample.
46+
This [guide](./user-defined-ciphersuite.md) demonstrates how to implement user-defined crypto ciphersuite and integrate it with Azure IoT Sample.
4747

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
# User-defined Crypto Ciphersuites Used by Azure IoT Sample
1+
# User-defined Crypto Ciphersuite Used by Azure IoT Sample
22

33
## Introduction
44

5-
[Azure RTOS NetX Crypto](https://learn.microsoft.com/en-us/azure/rtos/netx/netx-crypto/chapter1) is the default crypto ciphersuite used by [Azure RTOS NetX Secure](https://learn.microsoft.com/en-us/azure/rtos/netx-duo/netx-secure-tls/chapter1) TLS stack in [Azure IoT Sample](https://github.com/azure-rtos/samples). If clients want to use different crypto algorithm implementation, such as hardware security engine, TF-M PSA, or PKCS#11 based crypto methods, this user guide will show how to implement user-defined crypto ciphersuite and integrate it with Azure IoT Sample.
5+
[Azure RTOS NetX Crypto](https://learn.microsoft.com/azure/rtos/netx/netx-crypto/chapter1) is the default crypto ciphersuite used by [Azure RTOS NetX Secure](https://learn.microsoft.com/azure/rtos/netx-duo/netx-secure-tls/chapter1) TLS stack in [Azure IoT Sample](https://github.com/azure-rtos/samples). If clients want to use different crypto algorithm implementation, such as hardware security engine, TF-M PSA, or PKCS#11 based crypto methods, this user guide will show how to implement user-defined crypto ciphersuite and integrate it with Azure IoT Sample.
66

77
## General Process
88

99
There are four steps to implement and utilize a user-defined crypto ciphersuite.
1010

11-
1. Declare a [NX_CRYPTO_METHOD](https://github.com/azure-rtos/netxduo/blob/a69a06e35da0ac763b363388f555b508b0cd84b7/crypto_libraries/inc/nx_crypto.h#L320) struct for your crypto algorithm, which contains initialization, cleanup and crypto operations function pointers for the crypto method in use.
11+
1. Declare a [NX_CRYPTO_METHOD](https://github.com/azure-rtos/netxduo/blob/master/crypto_libraries/inc/nx_crypto.h#L320) struct for your crypto algorithm, which contains initialization, cleanup and crypto operations function pointers for the crypto method in use.
1212

1313
2. Define initialization, cleanup and crypto operation functions for this crypto method.
1414

@@ -20,13 +20,11 @@ There are four steps to implement and utilize a user-defined crypto ciphersuite.
2020

2121
[The STMicroelectronics B-U585I-IOT02A sample project](https://github.com/azure-rtos/samples/releases/download/v6.1_rel/Azure_RTOS_6.1_B-U585I-IOT02A_IAR_Samples_Beta_2021_10_01.zip) implements [TF-M PSA](https://www.trustedfirmware.org/projects/tf-m/) based ECDSA crypto ciphersuite for TLS device authentication. We will use it an an example to demonstrate the above process.
2222

23-
<p>
24-
All the changed files are under the path <em>B-U585I-IOT02A\Projects\B-U585I-IOT02A\Applications\TFM\TFM_Appli\NonSecure\Projects\B-U585I-IOT02A\Applications\TFM\TFM_Appli\NonSecure</em>.
25-
</p>
23+
All the changed files are under the path *B-U585I-IOT02A\Projects\B-U585I-IOT02A\Applications\TFM\TFM_Appli\NonSecure\Projects\B-U585I-IOT02A\Applications\TFM\TFM_Appli\NonSecure*.
2624

27-
1. In <em>psa_crypto_ciphersuites/nx_crypto_psa_crypto_ciphersuites.c</em>, declare NX_CRYPTO_METHOD struct `crypto_method_ecdsa_psa_crypto` for PSA based ECDSA crypto method.
25+
1. In *psa_crypto_ciphersuites/nx_crypto_psa_crypto_ciphersuites.c*, declare NX_CRYPTO_METHOD struct `crypto_method_ecdsa_psa_crypto` for PSA based ECDSA crypto method.
2826

29-
<pre>
27+
```c
3028
NX_CRYPTO_METHOD crypto_method_ecdsa_psa_crypto =
3129
{
3230
NX_CRYPTO_DIGITAL_SIGNATURE_ECDSA, /* ECDSA crypto algorithm name */
@@ -39,18 +37,18 @@ NX_CRYPTO_METHOD crypto_method_ecdsa_psa_crypto =
3937
_nx_crypto_method_ecdsa_psa_crypto_cleanup, /* ECDSA cleanup routine */
4038
_nx_crypto_method_ecdsa_psa_crypto_operation, /* ECDSA operation */
4139
};
42-
</pre>
40+
```
4341

44-
2. In <em>psa_crypto_ciphersuites/nx_crypto_ecdsa_psa_crypto.c</em>, define initialization, cleanup and crypto operations for this crypto method.
42+
2. In *psa_crypto_ciphersuites/nx_crypto_ecdsa_psa_crypto.c*, define initialization, cleanup and crypto operations for this crypto method.
4543
- `_nx_crypto_method_ecdsa_psa_crypto_init()` for parameter check and metadata initialization;
4644
- `_nx_crypto_method_ecdsa_psa_crypto_cleanup()` for metadata clean up;
4745
- `_nx_crypto_method_ecdsa_psa_crypto_operation()` to perform ECDSA operations, including ECDSA signature, verify, EC curve setting, with [PSA crypto APIs](https://armmbed.github.io/mbed-crypto/html/index.html).
4846

49-
3. In <em>psa_crypto_ciphersuites/nx_crypto_ecdsa_psa_crypto.h</em>, define a struct 'NX_CRYPTO_ECDSA_PSA_CRYPTO' to save metadata used by crypto functions, such as scrtch buffer, psa key handle, etc.
47+
3. In *psa_crypto_ciphersuites/nx_crypto_ecdsa_psa_crypto.h*, define a struct `NX_CRYPTO_ECDSA_PSA_CRYPTO` to save metadata used by crypto functions, such as scrtch buffer, psa key handle, etc.
5048

51-
4. In <em>Src/nx_azure_iot_ciphersuites.c</em>, add this new defined NX_CRYPTO_METHOD <b>`crypto_method_ecdsa_psa_crypto`</b> into `_nx_azure_iot_tls_supported_crypto[]`.
49+
4. In *Src/nx_azure_iot_ciphersuites.c*, add this newly defined NX_CRYPTO_METHOD `crypto_method_ecdsa_psa_crypto` into `_nx_azure_iot_tls_supported_crypto[]`.
5250

53-
<pre>
51+
```c
5452
const NX_CRYPTO_METHOD *_nx_azure_iot_tls_supported_crypto[] =
5553
{
5654
&crypto_method_hmac,
@@ -61,7 +59,7 @@ const NX_CRYPTO_METHOD *_nx_azure_iot_tls_supported_crypto[] =
6159
&crypto_method_rsa,
6260
#ifdef NX_SECURE_ENABLE_ECC_CIPHERSUITE
6361
#ifdef ENABLE_PSA_CRYPTO_CIPHERSUITES
64-
<b>&crypto_method_ecdsa_psa_crypto</b>,
62+
&crypto_method_ecdsa_psa_crypto, /* PSA based ECDSA crypto method */
6563
#else
6664
&crypto_method_ecdsa,
6765
#endif
@@ -70,6 +68,6 @@ const NX_CRYPTO_METHOD *_nx_azure_iot_tls_supported_crypto[] =
7068
&crypto_method_ec_secp256,
7169
#endif /* NX_SECURE_ENABLE_ECC_CIPHERSUITE */
7270
};
73-
</pre>
71+
```
7472

7573
With these changes, the user-defined PSA based ECDSA crypto method will be used by NX secure TLS stack in Azure IoT Sample.

0 commit comments

Comments
 (0)