openssl使用错误"error: storage size of 'ctx' isn't known"
前言 SSL是Secure Sockets Layer(安全套接层协议)的缩写,openssl是一套开源的库,以便使用者进行安全通信,避免窃听,识别身份。 其中,ssl的HMAC是计算MAC的一种方法,有密钥参与计算,不采用HASH算法,对数据做hash计算,并用密钥加密,计算出MAC数值。 测试 源码请看传送门: https://github.com/openssl/openssl 把openssl编译成动态库libssl.so后以便工程引用。 部分代码片段如下: HMAC_CTX ctx ; H_Mac mac ; mac . accessKey = ACCESS_KEY ; mac . secretKey = SECRET_KEY ; HMAC_CTX_init ( & ctx ) ; HMAC_Init_ex ( & ctx , mac . secretKey , strlen ( mac . secretKey ) , EVP_sha1 ( ) , NULL ) ; HMAC_Update ( & ctx , path , strlen ( path ) ) ; HMAC_Update ( & ctx , "\n" , 1 ) ; if ( addlen > 0 ) { HMAC_Update ( & ctx , addition , addlen ) ; } HMAC