crypto under FreeBSD 4.8 etc.

Youki Kadobayashi youki-k@REDACTED
Fri May 2 04:40:22 CEST 2003


Hi,

I found that simply #defining OPENSSL_DES_LIBDES_COMPATIBILITY
is not enough to make crypto functions work.  I verified the
following patch under FreeBSD-4.8.  It would be applicable
to other systems with newer versions of OpenSSL.

NB: The patch to Makefile is crude hack and it should be replaced
with more appropriate tests against OpenSSL versions..

Anyway here it goes...
--
        Youki Kadobayashi, Ph.D.
        Graduate School of Information Science
        Nara Institute of Science and Technology

*** otp_src_R9B-1/lib/crypto/c_src/crypto_drv.c.ports   Fri May  2 09:43:00 2003
--- otp_src_R9B-1/lib/crypto/c_src/crypto_drv.c Fri May  2 11:01:10 2003
***************
*** 208,216 ****
      cfs.SHA1_Init = driver_dl_sym(lib_handle, "SHA1_Init");
      cfs.SHA1_Update = driver_dl_sym(lib_handle, "SHA1_Update");
      cfs.SHA1_Final = driver_dl_sym(lib_handle, "SHA1_Final");
!     cfs.des_set_key = driver_dl_sym(lib_handle, "des_set_key");
!     cfs.des_ncbc_encrypt = driver_dl_sym(lib_handle, "des_ncbc_encrypt");
!     cfs.des_ede3_cbc_encrypt = driver_dl_sym(lib_handle, "des_ede3_cbc_encrypt");
  
      /* Check that all pointer where initialized */
      for (i = 0; i < sizeof(crypto_funcs)/sizeof(void*); i++) {
--- 208,216 ----
      cfs.SHA1_Init = driver_dl_sym(lib_handle, "SHA1_Init");
      cfs.SHA1_Update = driver_dl_sym(lib_handle, "SHA1_Update");
      cfs.SHA1_Final = driver_dl_sym(lib_handle, "SHA1_Final");
!     cfs.des_set_key = driver_dl_sym(lib_handle, "_ossl_old_des_set_key");
!     cfs.des_ncbc_encrypt = driver_dl_sym(lib_handle, "_ossl_old_des_ncbc_encrypt");
!     cfs.des_ede3_cbc_encrypt = driver_dl_sym(lib_handle, "_ossl_old_des_ede3_cbc_encrypt");
  
      /* Check that all pointer where initialized */
      for (i = 0; i < sizeof(crypto_funcs)/sizeof(void*); i++) {
*** otp_src_R9B-1/lib/crypto/c_src/i386-unknown-freebsd4.8/Makefile.orig       Fri May  2 09:43:28 2003
--- otp_src_R9B-1/lib/crypto/c_src/i386-unknown-freebsd4.8/Makefile     Fri May  2 10:57:47 2003
***************
*** 98,103 ****
--- 98,118 ----
        -u _des_ncbc_encrypt \
        -u _des_ede3_cbc_encrypt
  else
+ ifeq ($(findstring freebsd,$(TARGET)),freebsd)
+ ELIBCRYPTO_UNDEFS = \
+       -u CRYPTO_set_mem_functions \
+       -u MD5 \
+       -u MD5_Init \
+       -u MD5_Update \
+       -u MD5_Final \
+       -u SHA1 \
+       -u SHA1_Init \
+       -u SHA1_Update \
+       -u SHA1_Final \
+       -u _ossl_old_des_set_key \
+       -u _ossl_old_des_ncbc_encrypt \
+       -u _ossl_old_des_ede3_cbc_encrypt
+ else
  ELIBCRYPTO_UNDEFS = \
        -u CRYPTO_set_mem_functions \
        -u MD5 \
***************
*** 111,116 ****
--- 126,132 ----
        -u des_set_key \
        -u des_ncbc_encrypt \
        -u des_ede3_cbc_encrypt
+ endif
  endif
  
  # ----------------------------------------------------




More information about the erlang-questions mailing list