Merge branch 'fix/nvs_part_gen_docs' into 'master'

fix(docs/nvs_part_gen): Show the NVS HMAC encryption scheme-specific commands only for supported SOCs

See merge request espressif/esp-idf!26332
This commit is contained in:
Laukik Hase
2023-10-11 20:56:54 +08:00

View File

@@ -158,12 +158,19 @@ You can run the utility to generate NVS partition using the command below. A sam
Generate Encryption Keys Partition Generate Encryption Keys Partition
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. only:: SOC_HMAC_SUPPORTED
**Usage**:: **Usage**::
python nvs_partition_gen.py generate-key [-h] [--key_protect_hmac] [--kp_hmac_keygen] python nvs_partition_gen.py generate-key [-h] [--key_protect_hmac] [--kp_hmac_keygen]
[--kp_hmac_keyfile KP_HMAC_KEYFILE] [--kp_hmac_inputkey KP_HMAC_INPUTKEY] [--kp_hmac_keyfile KP_HMAC_KEYFILE] [--kp_hmac_inputkey KP_HMAC_INPUTKEY]
[--keyfile KEYFILE] [--outdir OUTDIR] [--keyfile KEYFILE] [--outdir OUTDIR]
.. only:: not SOC_HMAC_SUPPORTED
**Usage**::
python nvs_partition_gen.py generate-key [-h] [--keyfile KEYFILE] [--outdir OUTDIR]
**Optional Arguments**: **Optional Arguments**:
@@ -172,6 +179,18 @@ Generate Encryption Keys Partition
+=============================================+===================================================================================+ +=============================================+===================================================================================+
| ``-h`` \ ``--help`` | Show the help message and exit | | ``-h`` \ ``--help`` | Show the help message and exit |
+---------------------------------------------+-----------------------------------------------------------------------------------+ +---------------------------------------------+-----------------------------------------------------------------------------------+
| ``--keyfile KEYFILE`` | Path to output encryption keys file |
+---------------------------------------------+-----------------------------------------------------------------------------------+
| ``--outdir OUTDIR`` | Output directory to store files created. (Default: current directory) |
+---------------------------------------------+-----------------------------------------------------------------------------------+
.. only:: SOC_HMAC_SUPPORTED
**Optional Arguments (HMAC scheme-specific)**:
+---------------------------------------------+-----------------------------------------------------------------------------------+
| Parameter | Description |
+=============================================+===================================================================================+
| ``--key_protect_hmac`` | If set, the NVS encryption key protection scheme based on HMAC | | ``--key_protect_hmac`` | If set, the NVS encryption key protection scheme based on HMAC |
| | peripheral is used; else the default scheme based on Flash Encryption | | | peripheral is used; else the default scheme based on Flash Encryption |
| | is used | | | is used |
@@ -182,15 +201,13 @@ Generate Encryption Keys Partition
+---------------------------------------------+-----------------------------------------------------------------------------------+ +---------------------------------------------+-----------------------------------------------------------------------------------+
| ``--kp_hmac_inputkey KP_HMAC_INPUTKEY`` | File having the HMAC key for generating the NVS encryption keys | | ``--kp_hmac_inputkey KP_HMAC_INPUTKEY`` | File having the HMAC key for generating the NVS encryption keys |
+---------------------------------------------+-----------------------------------------------------------------------------------+ +---------------------------------------------+-----------------------------------------------------------------------------------+
| ``--keyfile KEYFILE`` | Path to output encryption keys file |
+---------------------------------------------+-----------------------------------------------------------------------------------+
| ``--outdir OUTDIR`` | Output directory to store files created. (Default: current directory) |
+---------------------------------------------+-----------------------------------------------------------------------------------+
You can run the utility to generate only the encryption key partition using the command below:: You can run the utility to generate only the encryption key partition using the command below::
python nvs_partition_gen.py generate-key python nvs_partition_gen.py generate-key
.. only:: SOC_HMAC_SUPPORTED
For generating encryption key for the HMAC-based scheme, the following commands can be used: For generating encryption key for the HMAC-based scheme, the following commands can be used:
- Generate the HMAC key and the NVS encryption keys:: - Generate the HMAC key and the NVS encryption keys::
@@ -206,7 +223,9 @@ For generating encryption key for the HMAC-based scheme, the following commands
.. note:: You can provide the custom filename for the HMAC key as well as the encryption key as a parameter. .. note:: You can provide the custom filename for the HMAC key as well as the encryption key as a parameter.
Generate Encrypted NVS Partition Generate Encrypted NVS Partition
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. only:: SOC_HMAC_SUPPORTED
**Usage**:: **Usage**::
@@ -216,6 +235,14 @@ Generate Encrypted NVS Partition
[--kp_hmac_keyfile KP_HMAC_KEYFILE] [--kp_hmac_inputkey KP_HMAC_INPUTKEY] [--kp_hmac_keyfile KP_HMAC_KEYFILE] [--kp_hmac_inputkey KP_HMAC_INPUTKEY]
input output size input output size
.. only:: not SOC_HMAC_SUPPORTED
**Usage**::
python nvs_partition_gen.py encrypt [-h] [--version {1,2}] [--keygen]
[--keyfile KEYFILE] [--inputkey INPUTKEY] [--outdir OUTDIR]
input output size
**Positional Arguments**: **Positional Arguments**:
@@ -250,6 +277,14 @@ Generate Encrypted NVS Partition
+---------------------------------------------+-------------------------------------------------------------------------------+ +---------------------------------------------+-------------------------------------------------------------------------------+
| ``--outdir OUTDIR`` | Output directory to store file created (Default: current directory) | | ``--outdir OUTDIR`` | Output directory to store file created (Default: current directory) |
+---------------------------------------------+-------------------------------------------------------------------------------+ +---------------------------------------------+-------------------------------------------------------------------------------+
.. only:: SOC_HMAC_SUPPORTED
**Optional Arguments (HMAC scheme-specific)**:
+---------------------------------------------+-------------------------------------------------------------------------------+
| Parameter | Description |
+=============================================+===============================================================================+
| ``--key_protect_hmac`` | If set, the NVS encryption key protection scheme based on HMAC | | ``--key_protect_hmac`` | If set, the NVS encryption key protection scheme based on HMAC |
| | peripheral is used; else the default scheme based on Flash Encryption | | | peripheral is used; else the default scheme based on Flash Encryption |
| | is used | | | is used |
@@ -269,6 +304,8 @@ You can run the utility to encrypt NVS partition using the command below. A samp
.. note:: Encryption key of the format ``<outdir>/keys/keys-<timestamp>.bin`` is created. .. note:: Encryption key of the format ``<outdir>/keys/keys-<timestamp>.bin`` is created.
.. only:: SOC_HMAC_SUPPORTED
- To generate an encrypted partition using the HMAC-based scheme, the above command can be used alongwith some additional parameters. - To generate an encrypted partition using the HMAC-based scheme, the above command can be used alongwith some additional parameters.
- Encrypt by allowing the utility to generate encryption keys and the HMAC-key:: - Encrypt by allowing the utility to generate encryption keys and the HMAC-key::