Fixed warning where variable passed to fprintf was of type size_t and
fprintf expected format of long int.
Signed-off-by: Andrey Borisovich <andrey.borisovich@intel.com>
This is especially a problem considering the -v option outputs non-ASCII
garbage which can break some automation, see issue #86
Fixes commit db40934e57 ("cavs: add support for cavs2.5 code
signing")
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
This patch fixes an invalid format specifier that causes a numeric value
to be interpreted as a string, resulting in an Segmentation fault.
Signed-off-by: Adrian Warecki <adrianx.warecki@intel.com>
Such a global variables does not exists, so should not be declared.
It has been deprecated since:
2965908 (manifest: Remove -m option)
Signed-off-by: Trzcinski, Karol <karol.trzcinski@intel.com>
cppcheck gives errors from openssl 1.0 related code that has some old
churn and should be fixed, so fix it.
Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
literals are signed by default, so shifting them 32 times is an
overflow, found via cppcheck
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
x param was removed from switch case but not from getopt. So if you use
x rimage silently fails on the switch case.
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Refactor the signing and verification functions as they have a lot of
duplicated code and adding openssl 3.0 support without refactor would
make things even more messy.
1) Add common "rimage_read_key" to read the key from file.
2) Variate most important functionality based on different openssl versions:
- rimage_check_key
- rimage_set_modexp
- rimage_sign
- rimage_verify
- rimage_get_key_size
Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
Add function to resign already signed images. This can
be done with switch "q" as follows:
"rimage -q sof-tgl.ri -o sof-tgl-mod.ri -c tgl.toml -k key.pem"
Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
Fixes clang failure:
clang: error: -Wl,-EL: 'linker' input unused [-Werror,-Wunused-command-line-argument]
-EL has an effect only when using OUTPUT_FORMAT or --oformat but rimage
uses neither.
The binaries produced by ld version 2.34 are strictly identical before
and after this removal.
It is not clear why -EL was ever added. It was added to src/Makefile.am
by commit 0d33e87433 and to src/CMakeLists.txt by commit 4e3ead0096
but these commits were initial additions of the entire files and they
did not get into detail.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
From the gcc documentation:
'-Wimplicit-fallthrough'
'-Wimplicit-fallthrough' is the same as '-Wimplicit-fallthrough=3'
and '-Wno-implicit-fallthrough' is the same as
'-Wimplicit-fallthrough=0'.
clang supports only the number-less option.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
When some automation script gets some rimage flag wrong then rimage
exits and does not run at all. In such a case we want the build to fail
immediately and see the error at the bottom of the build logs and not
obscured by other, consecutive failures caused by the lack of rimage
output.
Take control of the exit code away from usage() and give it back to
main() where it belongs.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
This patch removes the unnecessary and unscalable -x option.
This option aims to add an offset to the .data section of
its parent .module section. This is horrible idea because this
offset will vary depend on the compiler used. It is better and
much easier to just store only the .data section so the offset
is always 0.
Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
This makes is more obvious when the filename is empty, which happened in
bug https://github.com/thesofproject/sof/pull/4711
Also prefix identical log statements with their different __func__
names.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
After commit 916fc2cd73ff: "config: Remove unused adsp structs"
those defines are unused.
Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
Return value, for error case should be unified.
For those functions, default error value is UINT32_MAX.
Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
Developer should know what is ther return value for error cases.
Improved doxydoc may be used eg. by IDE to speed-up code development.
Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
This enum value is used only to distinguish suecreek from other
platforms, which can be done also by platform name.
Manual enumeration, in separate toml files with manual synchronization
in enum definition is quite error prone. After commit
9bf46d3: "rimage: Add support for mt8195" and
9716e10: "config: Add imx8ulp.toml" there are two different
platform with the same enum value 15 specified, which proves such a
thesis.
Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
After commit 2965908 "manifest: Remove -m option" those
structs are unused. ADSP configuration comes from toml
configuration files.
Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
This patch fixes the potential overflow which may happen during
conversion of signed long. On a platforms where signed long
is only 32 bits the address which is stored in temp_s will experience
overflow.
Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
memory clearly has exit path through argument, factor out temporary
variable to silence cppcheck
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
'key' argument must describe 'key' which triggered error message
to keep stderr output helpful.
Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>