hmac.h 977 B

123456789101112131415161718192021222324252627282930
  1. /*-------------------------------------------------------------------------
  2. *
  3. * hmac.h
  4. * Generic headers for HMAC
  5. *
  6. * Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
  7. * Portions Copyright (c) 1994, Regents of the University of California
  8. *
  9. * IDENTIFICATION
  10. * src/include/common/hmac.h
  11. *
  12. *-------------------------------------------------------------------------
  13. */
  14. #ifndef PG_HMAC_H
  15. #define PG_HMAC_H
  16. #include "common/cryptohash.h"
  17. /* opaque context, private to each HMAC implementation */
  18. typedef struct pg_hmac_ctx pg_hmac_ctx;
  19. extern pg_hmac_ctx *pg_hmac_create(pg_cryptohash_type type);
  20. extern int pg_hmac_init(pg_hmac_ctx *ctx, const uint8 *key, size_t len);
  21. extern int pg_hmac_update(pg_hmac_ctx *ctx, const uint8 *data, size_t len);
  22. extern int pg_hmac_final(pg_hmac_ctx *ctx, uint8 *dest, size_t len);
  23. extern void pg_hmac_free(pg_hmac_ctx *ctx);
  24. extern const char *pg_hmac_error(pg_hmac_ctx *ctx);
  25. #endif /* PG_HMAC_H */