How to calculate AES CMAC using OpenSSL's CMAC_xxx functions?

前端 未结 1 1859
旧巷少年郎
旧巷少年郎 2020-12-17 07:11

Is there any way to compute AES CMAC with OpenSSL/libcrypto?

Preferably in a way that takes advantage of AES-NI (or any other hardware ac

1条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-17 07:29

    As stated in my blog post you can use the CMAC_CTX_new, CMAC_Init, CMAC_Update and CMAC_Final from lib crypto to calculate AES-128-CBC CMAC. Here is an example:

    #include 
    #include 
    
    void printBytes(unsigned char *buf, size_t len) {
      for(int i=0; i

    0 讨论(0)
提交回复
热议问题