From: Andreas Reichel <[email protected]>

This patch set contains two fixes and a small API change to accomodate
swupdate's needs for global data storage.

It also adds tests for user variables.

Difference to v1: %llu expects long long unsigned int instead of
uint64_t, since long long unsigned int can be larger. Added a type cast
in bg_setenv.c.

Fixes:
* Deleting a user variable is done by setting its data type field to
  USERVAR_TYPE_DELETED. The deletion function checks if the variable
  exists and deletes it if this type is recognized. However, if the
  variable was not found, the function created the variable instead with
  this datatype stored into the environment. This is fixed so that
  deleting non existing variables has no effect.
* ustate is set with the wrong data size, since the state is internally
  handled as a null terminated string, the null terminating character
  must also be paid attention at here.

Small API change:
* User types, which were not used yet except with deletion of variables,
  were formerly introduced as a string. However, by defining it as a big
  integer, flags as well as data type definitions can be handled much
  better.
  USERVAR_TYPE_DELETED is converted into bit 63 of the data type field,
  which, if detected, causes deletion of the variable.
  A new FLAG "USERVAR_TYPE_GLOBAL" is introduced, which gives a variable
  the property "global" such that it is saved into all environment
  copies. This implements a feature needed by swupdate, which wants to
  store a temporary state which must not alter in failure cases or
  rollback scenarios.
  This flag is set per default so that all user variables are global
  variables. If a user wants to create user variables that are managed
  by the update mechanism, the functions ebg_env_set_ex / ebg_env_get_ex
  can be used, to explicitely set the variable datatype and omit the
  flag.

Signed-off-by: Andreas Reichel <[email protected]>

Andreas Reichel (5):
  bugfix: ustate: include null termination calling bgenv_set
  uservars: change type data field from char* to uint64_t
  uservars: Implement USERVAR_TYPE_GLOBAL flag
  Implement tests for user variables
  bugfix: uservars: Fix deletion of deleted variables.

 env/env_api.c                          |   9 ++-
 env/env_api_fat.c                      |  43 ++++++++++---
 env/uservars.c                         |  49 ++++++++-------
 include/ebgenv.h                       |  24 +++++--
 include/env_api.h                      |  11 ++--
 include/uservars.h                     |  13 ++--
 tools/bg_setenv.c                      |  41 ++++++------
 tools/tests/test_ebgenv_api.c          |  33 +++++-----
 tools/tests/test_ebgenv_api_internal.c | 112 +++++++++++++++++++++++++++------
 9 files changed, 226 insertions(+), 109 deletions(-)

-- 
2.14.2

-- 
You received this message because you are subscribed to the Google Groups "EFI 
Boot Guard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/efibootguard-dev/20171103122121.27121-1-andreas.reichel.ext%40siemens.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to