例えば、以下など。
note: declared here
xx | DEPRECATEDIN_1_1_0(int RAND_pseudo_bytes(unsigned char *buf, int num))
undefined reference to `HMAC_CTX_init'
undefined reference to `HMAC_CTX_cleanup'
undefined reference to `EVP_MD_CTX_cleanup'
以下の manpage などで上記エラーが出る関数の後継となる関数や、入出力の型を確認し修正を行う。
例えば、
- 入出力の型を変える必要がなく、かつ、変換前の文字列が一意に定まるなら、ヘッダファイルなどで #define でまとめて変換する。
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
#define RAND_pseudo_bytes RAND_priv_bytes
#define CRYPTO_malloc_init OPENSSL_malloc_init
#endif
または、以下のように個別に場合分けする。
#if OPENSSL_VERSION_NUMBER < 0x10100000L
CRYPTO_malloc_init();
#else
OPENSSL_malloc_init();
#endif
HMAC_CTX_init
はHMAC_CTX_init_ex
に移行させるなど*_ex
が存在しているかを調べてみる。EVP_MD_CTX_cleanup(&ctx)
はこちらに従いEVP_MD_CTX_free(ctx)
に変更。HMAC_CTX_cleanup(&ctx)
はこちらに従いHMAC_CTX_free(ctx)
に変更、または、サンプルコードも参考にしながらEVP_MAC_
に更新する。