cmac.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /* cmac.h
  2. *
  3. * Copyright (C) 2006-2022 wolfSSL Inc.
  4. *
  5. * This file is part of wolfSSL.
  6. *
  7. * wolfSSL is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * wolfSSL is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
  20. */
  21. #ifndef WOLFSSL_CMAC_H_
  22. #define WOLFSSL_CMAC_H_
  23. #include <wolfssl/wolfcrypt/cmac.h>
  24. #ifdef __cplusplus
  25. extern "C" {
  26. #endif
  27. typedef struct WOLFSSL_CMAC_CTX {
  28. void* internal; /* internal Cmac object */
  29. WOLFSSL_EVP_CIPHER_CTX* cctx;
  30. } WOLFSSL_CMAC_CTX;
  31. typedef WOLFSSL_CMAC_CTX CMAC_CTX;
  32. WOLFSSL_API WOLFSSL_CMAC_CTX* wolfSSL_CMAC_CTX_new(void);
  33. WOLFSSL_API void wolfSSL_CMAC_CTX_free(WOLFSSL_CMAC_CTX *ctx);
  34. WOLFSSL_API WOLFSSL_EVP_CIPHER_CTX* wolfSSL_CMAC_CTX_get0_cipher_ctx(
  35. WOLFSSL_CMAC_CTX* ctx);
  36. WOLFSSL_API int wolfSSL_CMAC_Init(
  37. WOLFSSL_CMAC_CTX* ctx, const void *key, size_t keyLen,
  38. const WOLFSSL_EVP_CIPHER* cipher, WOLFSSL_ENGINE* engine);
  39. WOLFSSL_API int wolfSSL_CMAC_Update(
  40. WOLFSSL_CMAC_CTX* ctx, const void* data, size_t len);
  41. WOLFSSL_API int wolfSSL_CMAC_Final(
  42. WOLFSSL_CMAC_CTX* ctx, unsigned char* out, size_t* len);
  43. #define CMAC_CTX_new wolfSSL_CMAC_CTX_new
  44. #define CMAC_CTX_free wolfSSL_CMAC_CTX_free
  45. #define CMAC_CTX_get0_cipher_ctx wolfSSL_CMAC_CTX_get0_cipher_ctx
  46. #define CMAC_Init wolfSSL_CMAC_Init
  47. #define CMAC_Update wolfSSL_CMAC_Update
  48. #define CMAC_Final wolfSSL_CMAC_Final
  49. #ifdef __cplusplus
  50. } /* extern "C" */
  51. #endif
  52. #endif /* WOLFSSL_CMAC_H_ */