Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <openssl/evp.h>
- #include <openssl/hmac.h>
- #include <openssl/aes.h>
- int openssl_hmac_vector(const EVP_MD *type, const u8 *key,
- size_t key_len, size_t num_elem,
- const u8 *addr[], const size_t *len, u8 *mac,
- unsigned int mdlen)
- {
- HMAC_CTX ctx;
- size_t i;
- int res;
- HMAC_CTX_init(&ctx);
- #if OPENSSL_VERSION_NUMBER < 0x00909000
- HMAC_Init_ex(&ctx, key, key_len, type, NULL);
- #else /* openssl < 0.9.9 */
- if (HMAC_Init_ex(&ctx, key, key_len, type, NULL) != 1)
- return -1;
- #endif /* openssl < 0.9.9 */
- for (i = 0; i < num_elem; i++)
- HMAC_Update(&ctx, addr[i], len[i]);
- #if OPENSSL_VERSION_NUMBER < 0x00909000
- HMAC_Final(&ctx, mac, &mdlen);
- res = 1;
- #else /* openssl < 0.9.9 */
- res = HMAC_Final(&ctx, mac, &mdlen);
- #endif /* openssl < 0.9.9 */
- HMAC_CTX_cleanup(&ctx);
- return res == 1 ? 0 : -1;
- }
- Error 12 error LNK2001: unresolved external symbol _HMAC_CTX_cleanup@4
- Error 13 error LNK2001: unresolved external symbol _HMAC_Final@12
- Error 15 error LNK2001: unresolved external symbol _HMAC_Init_ex@20
- Error 16 error LNK2001: unresolved external symbol _HMAC_CTX_init@4
Add Comment
Please, Sign In to add comment