Hi Christian,
On 09/05/2017 14:56, Stefano Babic wrote:
>>>> Then I ran SWUpdate using this sw-description file:
>>>>
>>>> software =
>>>> {
>>>> version = "0.0.1";
>>>> images: ( {
>>>> filename = "dummy.root.crypt";
>>>> device = "/dev/mmcblk0p3";
>>>> compressed = false;
>>>> sha256 = "d5917ed1d56f6714831de7fc7bd92c78639186e3f3244152923535db9fa18144";
>>>> encrypted = true;
>>>> }
>>>> );
>>>> }
>>>>
>>>>
>>>> Do you have any hints for me how to track this down? Maybe I just missed
>>>> a simple thing?
>>>>
>>>
>>> I checked my use cases - the only thing I have seen (apart the -nosalt
>>> option) is that in my test cases I did not had signed images. Of course,
>>> it *must* work, but it is worth to test to check if the issue is correlated.
>>
>> Checked with and without SIGNED_IMAGES, outcome is the same.
>>
>>
>> Do you have any more ideas I can try out to nail this down?
>> What exact version of OpenSSL are you using in your use case? Maybe that
>> makes a difference in logics while not in API...
>
> I have no other idea - I will set up a test and try myself.
I ran a simple test on PC. I plan to test on a real device, too. Anyway,
my use case works. I have this sw-description:
software =
{
version = "0.1.0";
pc = {
hardware-compatibility: [ "1.0"];
files: (
{
filename = "examples.tar.enc";
type = "archive";
path = "/tmp/test";
encrypted = true;
}
);
scripts: (
{
filename = "shellscript_logger.sh";
type = "shellscript";
}
);
};
}
And I have encrypted the original examples.tar file with the following
script:
#!/bin/bash
key=`cat ../etc/aeskey | cut -d' ' -f1`
ivt=`cat ../etc/aeskey | cut -d' ' -f2`
echo KEY=${key} iv=${ivt}
openssl enc -aes-256-cbc -in $1 -out $1.enc -K ${key} -iv ${ivt}
openssl is 1.0.2g
and:
./swupdate -v -H pc:1.0 -l 5 -K tests/etc/aeskey -i
tests/auto/boards/pc/test5/software_pc_test5.swu
Swupdate v2017.4.0
Licensed under GPLv2. See source distribution for detailed copyright
notices.
Searching for custom LUA handlers :[string "require
("swupdate_handlers")"]:1: module 'swupdate_handlers' not found:
no field package.preload['swupdate_handlers']
no file '/usr/local/share/lua/5.2/swupdate_handlers.lua'
no file '/usr/local/share/lua/5.2/swupdate_handlers/init.lua'
no file '/usr/local/lib/lua/5.2/swupdate_handlers.lua'
no file '/usr/local/lib/lua/5.2/swupdate_handlers/init.lua'
no file '/usr/share/lua/5.2/swupdate_handlers.lua'
no file '/usr/share/lua/5.2/swupdate_handlers/init.lua'
no file './swupdate_handlers.lua'
no file '/usr/local/lib/lua/5.2/swupdate_handlers.so'
no file '/usr/lib/x86_64-linux-gnu/lua/5.2/swupdate_handlers.so'
no file '/usr/lib/lua/5.2/swupdate_handlers.so'
no file '/usr/local/lib/lua/5.2/loadall.so'
no file './swupdate_handlers.so'
Custom handlers not found, no error, skipping...
Running on pc Revision 1.0
Registered handlers:
archive
tar
raw
rawfile
lua
shellscript
preinstall
postinstall
remote
uboot
bootloader
Main loop Daemon
[NOTIFY] : SWUPDATE running : [extract_sw_description] : Found file:
filename sw-description
size 308
checksum 0x538d VERIFIED
Version 0.1.0
[NOTIFY] : SWUPDATE running : [parse_hw_compatibility] : Accepted Hw
Revision : 1.0
[NOTIFY] : SWUPDATE running : [parse_scripts] : Found Script:
shellscript_logger.sh
[NOTIFY] : SWUPDATE running : [parse_files] : Found File :
examples.tar.enc --> /tmp/test (ROOTFS)
[NOTIFY] : SWUPDATE running : [check_hw_compatibility] : Hardware pc
Revision: 1.0
[NOTIFY] : SWUPDATE running : [check_hw_compatibility] : Hardware
compatibility verified
[NOTIFY] : SWUPDATE running : [cpio_scan] : Found file:
filename examples.tar.enc
size 1689616
REQUIRED
[NOTIFY] : SWUPDATE running : [cpio_scan] : Found file:
filename shellscript_logger.sh
size 261
REQUIRED
Cannot parse config file '/etc/fw_env.config': No such file or directory
Error: environment not initialized
[NOTIFY] : SWUPDATE running : [extract_next_file] : Copied file:
filename shellscript_logger.sh
size 261
checksum 0x5476 VERIFIED
[NOTIFY] : SWUPDATE running : [execute_shell_script] : Calling shell
script /tmp/shellscript_logger.sh preinst: return with 0
[NOTIFY] : SWUPDATE running : [install_single_image] : Found installer
for stream examples.tar.enc archive
[NOTIFY] : SWUPDATE running : [install_archive_image] : Installing file
examples.tar.enc on /tmp/test
[NOTIFY] : SWUPDATE running : [execute_shell_script] : Calling shell
script /tmp/shellscript_logger.sh postinst: return with 0
Cannot parse config file '/etc/fw_env.config': No such file or directory
Error: environment not initialized
Software updated successfully
Please reboot the device to start the new software
[NOTIFY] : SWUPDATE successful !
so everything is ok - and if I change the key I passed to SWUpdate, I
get of course an error by decryption:
[NOTIFY] : SWUPDATE running : [execute_shell_script] : Calling shell
script /tmp/shellscript_logger.sh preinst: return with 0
[NOTIFY] : SWUPDATE running : [install_single_image] : Found installer
for stream examples.tar.enc archive
[NOTIFY] : SWUPDATE running : [install_archive_image] : Installing file
examples.tar.enc on /tmp/test
[NOTIFY] : SWUPDATE failed [0] ERROR corelib/swupdate_decrypt.c :
swupdate_DECRYPT_final : 86 : Decryption error 0x(null)
[NOTIFY] : SWUPDATE failed [0] ERROR handlers/archive_handler.c :
install_archive_image : 213 : Error copying extracted file
[NOTIFY] : SWUPDATE running : [install_single_image] : Installer for
archive not successful !
Software updated failed
So I cannot reproduce it. I see you add explicitely "compressed = false"
in sw-description. I do not need to add it if fileis not compressed
(default is false). Does it change if you drop the line ?