@@ -9,22 +9,17 @@ bit key length but you may use other key lengths as well.
Building an Encrypted SWU Image
-------------------------------
-First, create a key via `openssl` which is part of the OpenSSL project.
+First, create a key; for aes-256-cbc we need 32 bytes of key and 16 bytes
+for an initialisation vector (IV).
A complete documentation can be found at the
`OpenSSL Website <https://www.openssl.org/docs/manmaster/man1/openssl.html>`_.
::
- openssl enc -aes-256-cbc -k <PASSPHRASE> -P -md sha1
-
-The key and initialization vector is generated based on the given ``<PASSPHRASE>``.
-The output of the above command looks like this:
-
-::
-
- salt=CE7B0488EFBF0D1B
- key=B78CC67DD3DC13042A1B575184D4E16D6A09412C242CE253ACEE0F06B5AD68FC
- iv =65D793B87B6724BB27954C7664F15FF3
+ openssl rand -hex 32
+ # key, for example 390ad54490a4a5f53722291023c19e08ffb5c4677a59e958c96ffa6e641df040
+ openssl rand -hex 16
+ # IV, for example d5d601bacfe13100b149177318ebc7a4
Then, encrypt an image using this information via
@@ -43,12 +38,11 @@ separated by whitespace, e.g., for above example values
::
- B78CC67DD3DC13042A1B575184D4E16D6A09412C242CE253ACEE0F06B5AD68FC 65D793B87B6724BB27954C7664F15FF3
+ 390ad54490a4a5f53722291023c19e08ffb5c4677a59e958c96ffa6e641df040 d5d601bacfe13100b149177318ebc7a4
-For earlier versions of SWUpdate it was falsely noted that passing the SALT as a
-3rd parameter would increase security. Key and IV are enough for maximum security,
-salt doesn't add any value.
+Previous versions of SWUpdate allowed for a salt as third word in key file,
+that was never actually used for aes and has been removed.
You should change the IV with every encryption, see CWE-329_. The ``ivt``
sw-description attribute overrides the key file's IV for one specific image.
swupdate has no need to recreate the same key from user input, so generating key/iv from password/salt does not make sense. Suggest using random data instead as has been suggested in ac75ad653502 ("doc swupdate.rst: clarify execution order for scripts") Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com> --- While I'm touching documentation, the encrypted image documentation has been bugging me; generating keys from passphrase with a deprecated method that gives a warning when users try it is not good. Likewise, feel free to adjust or request changes. doc/source/encrypted_images.rst | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-)