37 Commits
Author SHA1 Message Date
William Douglas dd3e0f3d81 Update copyright years
Signed-off-by: William Douglas <william.douglas@intel.com>
2025-04-24 14:20:58 -07:00
William Douglas 0d2d11d0fc Add APX flag support
Add support for new APX optimization level. Change increases the
maximim potential optimization level but does not yet allow the files
to be used (installed). get_opt_level_mask still needs to be updated
to account for system supporting the new optimization level (and
adding APX_SKIP_FILE support) before the APX files can be installed.

This change is being done at this time to allow mixer to create these
files without swupd error messages during updates.

Signed-off-by: William Douglas <william.douglas@intel.com>
2024-01-22 06:50:40 -08:00
William Douglas ce82b5da51 Enable use of optimized manifest files beyond SSE
Allow the usage of non-SSE files from manifests. This involves testing
what the currently running system supports for optimized content and
installing the best matching available binary the manifest provides.

There is an exception for operations where the prefix is set to
something other than the rootfs where SSE binaries will be used in all
cases.

Signed-off-by: William Douglas <william.douglas@intel.com>
2023-04-25 14:44:10 -07:00
William Douglas a9aac28ae7 Update opt_mask handling to match mixer-tools
mixer-tools populates the optimized mask based on a matrix of values
where the mask includes both the optimization of the file on the line
but also the combined masks of all matching files.

This means a file mask needs to be translaed from the mask to what its
actual optimization level is and what other optimizations levels are
available to be useful. This change adds 2 new elements to the file
struct. The opt_level stores a files optimization level and
available_levels stores a bitwise or of the different optimization
levels that can be found in the file list for the same file.

For instance an AVX2_3 mask indicates the file is AVX2 with both SSE
and AVX512 files also available (SSE | AVX2 | AVX512 == 3).

Signed-off-by: William Douglas <william.douglas@intel.com>
2023-04-11 12:20:25 -07:00
William Douglas 5ecf766ba8 Fix typo in OPTIMIZED_BITMASKS
Remove duplicate '9' in string for generating OPTIMIZED_BITMASKS array
and regenerate. This also requires an additional element is added to
the array to get to the 64 characters usable in the map.

Signed-off-by: William Douglas <william.douglas@intel.com>
2023-03-03 10:11:00 -08:00
William Douglas 77f16b0120 Add new handling for modifier field
The modifier field will be a character that translates roughly into a
base64 encoded bitmask. The first 3 bytes are the optimization level
and the last three are the max optimization level any files with that
same filename can have.

For now though skip all lines that don't match SSE_OPT (the previous
values the modifier field would have: 'b', 's' and 'C' all map to
the SSE_OPT bitmask).

Also rework the manifest unit tests a bit more. Noticed the exported
flag was wrong in the data and the X flag for the 3rd field was
completely unchecked for in swupd code. Added testing for the ignored
'b', 's' and 'C' values of the modifier field and checked the non-sse
is in fact skipped as a file for now.

Signed-off-by: William Douglas <william.douglas@intel.com>
2023-03-02 12:35:32 -08:00
William Douglas a011f9429a Remove logic for flag not in use
The logic is testing a flag that mixer does not set and would like
to change the purpose of in a new version. Remove the test (needs a
format bump before mixer can use the flag) for the flag.

Signed-off-by: William Douglas <william.douglas@intel.com>
2023-02-28 13:25:05 -08:00
Otavio Pontes 99823e0d66 sys: Use a list for get_mounted_directories()
Instead of saving it in a global string, just use a list of strings to
return the current mounted directories. Also moving function to sys.c

Also fixes hashdump command to correctly print the warning if file is a
mounted directory.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-05-29 14:42:54 -07:00
Otavio Pontes a9301c660a heuristics: Create heuristics rules
Instead of using multiple ifs, create heuristics rules to be applied
to each file.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-05-29 14:42:54 -07:00
Otavio Pontes e1fd274599 Fixing multiple unsigned to signed int conversion errors
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-05-12 12:27:06 -07:00
Otavio Pontes 9fd1632ef0 int: Add functions to safely convert signed ints to unsigned
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-05-12 12:27:06 -07:00
Otavio Pontes 5f67a46354 string: Add function to convert from string to unsigned ints
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-05-12 12:27:06 -07:00
Otavio Pontes 6613fc5ffa heuristics: Add test to validate heuristics
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-05-08 13:34:53 -07:00
Otavio Pontes 8d7a7dad6e Organizing src/ directories in categories
src/
    src/3rd-party/ # Everything that is 3rd-party related
    src/cmds/ # All sub-commands from swupd (except 3rd-party ones)
    src/lib/ # Modules that implement functions not dependent on swupd
               behavior (i.e. system interations, logging)
    src/swupd_lib/ # Modules that implement functions dependent on swupd
                     behavior (i.e. hash calculation, signature verification,
                     manifest/bundle handlers)
2020-05-07 14:31:27 -07:00
Otavio Pontes 3f87d09f2b Updating copyright headers of files changed on 2020
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-05-01 14:00:11 -07:00
Otavio Pontes 203b9e35ca macros: Create a wrapper for free()
On several points on swupd we need to free a pointer and then set it to
NULL. This is made in some areas using the free_and_clear_pointer(). But
most places free_and_clear_pointer() is used, this is not really necessary.

On the other hand it's hard to make sure that we are really setting to NULL
every pointer that we need, so we're adding a more conservative approach on
setting every pointer to NULL after free using a wrapper.

The greatest advantage of this wrapper over free_and_clear_pointer() is that
it's not type dependent and we don't need to call it with a pointer of a pointer,
so calls look more to calls to a standard free.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-29 10:20:50 -07:00
Otavio Pontes 6346f75477 sys: sys_path_join was wrong for string "//"
When sys_path_join("//") was used, the result was "" instead of "/"

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-27 13:59:07 -07:00
Otavio Pontes 73a6d0055c strings: Create safer wrapper to strcmp()
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-23 08:55:45 -07:00
Otavio Pontes bbd7da491d strings: renaming functions to have a str_ prefix
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-23 08:55:45 -07:00
Otavio Pontes 12d0152085 mixin: Remove mixin from manifest functions
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-08 09:03:56 -07:00
Otavio Pontes 0c96d28565 signature: Add flags to signature verification to be able to extend it
Replace a bool value with an enum flags, so we can add more modifiers to
function.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-01 08:38:15 -07:00
Castulo Martinez 43d909838a Remove extra slash from path in 3rd-party funcs
This commit introduces a function to build a path from multiple string
variables and at the same time it removes all duplicated slashes in the
path.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-03-24 15:00:11 -07:00
Otavio Pontes ebd7b0dbc6 list: Move strcmp related function to string.h
It makes more sense to have this grouped in string.h then list.h

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-10-28 12:57:58 -07:00
Otavio Pontes 96061a06d7 list: Improvements in list API
- Better documentation on header file
 - Renaming all functions that requires the list to be sorted to add
   a prefix list_sorted_
 - Make sure all functions are calling list_head() and list_tail()
   when needed

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-10-28 12:57:58 -07:00
Otavio Pontes bb1559ef6e compliant: Add check for trailing whitespaces on tests
Note that the clang-format already does this for the source code

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-10-04 16:05:21 -07:00
Otavio Pontes 1c250f442e list: Add function to filter out elements from a list
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-10-04 17:43:18 -05:00
Otavio Pontes d70f776dd5 manifest: Rename function to a proper name
And improve implementation using list API instead of reimplementing
search

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-10-04 17:43:18 -05:00
Otavio Pontes eb316d0a0e list: Adding unit test for list_deduplicate
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-09-25 09:09:25 -07:00
Otavio Pontes 69cd7d9395 test: Support running tests in a different directory
All files that are written by tests should be written in the directory
where the tests were executed and not the directory where code is.

Make distcheck now works fine

Fixes #343

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-09-13 15:35:03 -07:00
Otavio Pontes 6bf50db9bf test: Add missing NULL parameter to run_command() call
Last parameter was missing on a run_command() call and tests were breaking for some specific configurations.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-07-12 11:17:13 -07:00
Otavio Pontes f337da5b9c bundleadd: Rename flag from optional to also-add
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-07-08 13:58:24 -07:00
Castulo Martinez afc27768bd Parse optional bundles in manifests
This commit adds the ability to the manifest parser to recognize the
"optional" manifest header and to add those optional bundles in the
manifest to the manifest struct.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-07-03 14:59:47 -07:00
Otavio Pontes a4c00b4ed9 test: Move unit test datas to data/ directory
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-05-14 14:28:27 -07:00
Otavio Pontes a3a58b7319 test: Adding extra tests for signature
Test if certificates with Authority Information Access property set as critical
aren't used to validate swupd content.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-05-14 14:28:27 -07:00
Otavio Pontes db512848c7 signature: Add a unit test for signature
Create a unit test for signature checking.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-04-18 10:20:41 -07:00
Otavio Pontes aabc453fd1 manifest: Add manifest parser unit tests
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-03-28 09:39:02 -07:00
Otavio Pontes 8648e83c33 test: Add first swupd unit test
Adding a unit test for string functions on string.h module.
Unit tests will help us to test functions that are hard to test
with function tests. String conversions, for example would be extremely
hard to test using functional tests.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-01-31 10:55:17 -08:00