Skip to content

Latest commit

 

History

History
51 lines (37 loc) · 1.73 KB

deprecated.md

File metadata and controls

51 lines (37 loc) · 1.73 KB

"DEPRECATEDIN_" エラーや "undefined reference to" エラーが出る場合が出る場合

例えば、以下など。

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_initHMAC_CTX_init_ex に移行させるなど *_ex が存在しているかを調べてみる。
  • EVP_MD_CTX_cleanup(&ctx)こちらに従いEVP_MD_CTX_free(ctx)に変更。
  • HMAC_CTX_cleanup(&ctx)こちらに従いHMAC_CTX_free(ctx)に変更、または、サンプルコードも参考にしながら EVP_MAC_ に更新する。