Cipher problem on Mac OS X
Hello,
I have looked into the problem, it seems to be caused by the return type of cipher_kt_mode() in crypto_backend.h being declared as a bool. This function is called from init_key_type() of crypto.c during the tests. The actual mode value in cipher_kt_mode() of openssl_backend.c during the failed test is 2, but is converted to 1 due to this boolean return type. My guess is that this is only happening on OS X because of a specific GCC compiler version or custom Apple patches.
Below I have included a patch that changes the bool return type to an int. This will result in 'make check' to pass.
crypto_backend.h +0 -0
@@ -218,7 +218,7 @@ int cipher_kt_block_size (const cipher_kt_t
*cipher_kt);
* @return Cipher mode, either \c OPENVPN_MODE_CBC, \c
* OPENVPN_MODE_OFB or \c OPENVPN_MODE_CFB
*/
-bool cipher_kt_mode (const cipher_kt_t *cipher_kt); +int cipher_kt_mode (const cipher_kt_t *cipher_kt);
/**
crypto_openssl.c +1 -1
@@ -555,7 +555,7 @@ cipher_kt_block_size (const EVP_CIPHER *cipher_kt)return EVP_CIPHER_block_size (cipher_kt); } -bool +int cipher_kt_mode (const EVP_CIPHER *cipher_kt) {ASSERT (NULL != cipher_kt);
crypto_polarssl.c +1 -1
@@ -313,7 +313,7 @@ cipher_kt_block_size (const cipher_info_t *cipher_kt)return cipher_kt->block_size; } -bool +int cipher_kt_mode (const cipher_info_t *cipher_kt) {ASSERT (NULL != cipher_kt);
Quoted 14 lines
-----Original Message-----
From: Frank de Brabander [mailto:[email protected]...]Hello,
I have looked into the problem, it seems to be caused by the return type of
cipher_kt_mode()incrypto_backend.hbeing declared as a bool. This function is called frominit_key_type()ofcrypto.cduring the tests. The actual mode value incipher_kt_mode()ofopenssl_backend.cduring the failed test is 2, but is converted to 1 due to this boolean return type.
My guess is that this is only happening on OS X because of a specific GCC compiler version or custom Apple patches.
Quoted 4 lines
Below I have included a patch that changes the bool return type to an int.
This will result in 'make check' to pass.
Ack, I saw this work on Frank's mac :). Apologies for the missed bool.
Adriaan
Quoted 2 lines · Frank de Brabander
Below I have included a patch that changes the bool return type to an int. This will result in 'make check' to pass.
I see that you already committed this.
% cd openvpn
% make distclean
% git pull
% git checkout 6449a149f850e9e1207233f3ca642d9342fbfbaf % autoreconf -i -v
% ./configure --with-lzo-headers=/opt/local/include \
--with-lzo-lib=/opt/local/lib
% make
% make check
(wait for it...)
====================
All 2 tests passed
(1 test was not run)
====================
Works like a charm!
Thanks, both of you!
Freek