avb_user_verity.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * Copyright (C) 2017 The Android Open Source Project
  3. *
  4. * Permission is hereby granted, free of charge, to any person
  5. * obtaining a copy of this software and associated documentation
  6. * files (the "Software"), to deal in the Software without
  7. * restriction, including without limitation the rights to use, copy,
  8. * modify, merge, publish, distribute, sublicense, and/or sell copies
  9. * of the Software, and to permit persons to whom the Software is
  10. * furnished to do so, subject to the following conditions:
  11. *
  12. * The above copyright notice and this permission notice shall be
  13. * included in all copies or substantial portions of the Software.
  14. *
  15. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  16. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  17. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  18. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  19. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  20. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  21. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  22. * SOFTWARE.
  23. */
  24. #ifndef AVB_USER_VERITY_H_
  25. #define AVB_USER_VERITY_H_
  26. #include <libavb/libavb.h>
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30. /* Function to enable or disable dm-verity for an entire slot. The
  31. * passed in |ops| should be obtained via avb_ops_user_new(). The
  32. * |ab_suffix| parameter should specify the slot to modify including
  33. * the leading underscore (e.g. "_a" or "_b"). The |enable_verity|
  34. * parameter should be set to |true| to enable dm-verity and |false|
  35. * to disable.
  36. *
  37. * Returns |true| if the operation succeeded, otherwise |false|.
  38. */
  39. bool avb_user_verity_set(AvbOps* ops,
  40. const char* ab_suffix,
  41. bool enable_verity);
  42. /* Gets whether dm-verity is enabled for an entire slot. The passed in
  43. * |ops| should be obtained via avb_ops_user_new(). The |ab_suffix|
  44. * parameter should specify the slot to query including the leading
  45. * underscore (e.g. "_a" or "_b"). The result is returned in the
  46. * |out_verity_enabled| parameter.
  47. *
  48. * Returns |true| if the operation succeeded, otherwise |false|.
  49. */
  50. bool avb_user_verity_get(AvbOps* ops,
  51. const char* ab_suffix,
  52. bool* out_verity_enabled);
  53. #ifdef __cplusplus
  54. }
  55. #endif
  56. #endif /* AVB_USER_VERITY_H_ */