key_protector.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * GRUB -- GRand Unified Bootloader
  3. * Copyright (C) 2022 Microsoft Corporation
  4. * Copyright (C) 2024 Free Software Foundation, Inc.
  5. *
  6. * GRUB is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * GRUB is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #ifndef GRUB_PROTECTOR_HEADER
  20. #define GRUB_PROTECTOR_HEADER 1
  21. #include <grub/err.h>
  22. #include <grub/types.h>
  23. struct grub_key_protector
  24. {
  25. struct grub_key_protector *next;
  26. struct grub_key_protector **prev;
  27. const char *name;
  28. grub_err_t (*recover_key) (grub_uint8_t **key, grub_size_t *key_size);
  29. };
  30. grub_err_t
  31. grub_key_protector_register (struct grub_key_protector *protector);
  32. grub_err_t
  33. grub_key_protector_unregister (struct grub_key_protector *protector);
  34. grub_err_t
  35. grub_key_protector_recover_key (const char *protector,
  36. grub_uint8_t **key,
  37. grub_size_t *key_size);
  38. #endif /* ! GRUB_PROTECTOR_HEADER */