sm4_cbc_mac.h 738 B

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * Copyright 2014-2022 The GmSSL Project. All Rights Reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the License); you may
  5. * not use this file except in compliance with the License.
  6. *
  7. * http://www.apache.org/licenses/LICENSE-2.0
  8. */
  9. #ifndef GMSSL_SM4_CBC_MAC_H
  10. #define GMSSL_SM4_CBC_MAC_H
  11. #include <stdint.h>
  12. #include <gmssl/sm4.h>
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16. typedef struct {
  17. SM4_KEY key;
  18. uint8_t iv[16];
  19. size_t ivlen;
  20. } SM4_CBC_MAC_CTX;
  21. void sm4_cbc_mac_init(SM4_CBC_MAC_CTX *ctx, const uint8_t key[16]);
  22. void sm4_cbc_mac_update(SM4_CBC_MAC_CTX *ctx, const uint8_t *data, size_t datalen);
  23. void sm4_cbc_mac_finish(SM4_CBC_MAC_CTX *ctx, uint8_t mac[16]);
  24. #ifdef __cplusplus
  25. }
  26. #endif
  27. #endif