2hmac.h 762 B

123456789101112131415161718192021222324252627282930
  1. /* Copyright 2016 The Chromium OS Authors. All rights reserved.
  2. * Use of this source code is governed by a BSD-style license that can be
  3. * found in the LICENSE file.
  4. */
  5. #ifndef VBOOT_REFERENCE_VBOOT_2HMAC_H_
  6. #define VBOOT_REFERENCE_VBOOT_2HMAC_H_
  7. #include <stdint.h>
  8. #include "2crypto.h"
  9. /**
  10. * Compute HMAC
  11. *
  12. * @param alg Hash algorithm ID
  13. * @param key HMAC key
  14. * @param key_size HMAC key size
  15. * @param msg Message to compute HMAC for
  16. * @param msg_size Message size
  17. * @param mac Computed message authentication code
  18. * @param mac_size Size of the buffer pointed by <mac>
  19. * @return
  20. */
  21. int hmac(enum vb2_hash_algorithm alg,
  22. const void *key, uint32_t key_size,
  23. const void *msg, uint32_t msg_size,
  24. uint8_t *mac, uint32_t mac_size);
  25. #endif