You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Ruediger Pluem <rp...@apache.org> on 2012/10/05 17:21:02 UTC

Re: svn commit: r1394552 - in /apr/apr/trunk: Makefile.in build.conf build/crypto.m4 build/dso.m4 crypto/apr_crypto.c crypto/apr_crypto_commoncrypto.c include/apr.h.in include/apr.hnw include/apr.hw include/apr_crypto.h test/testcrypto.c


minfrin@apache.org wrote:
> Author: minfrin
> Date: Fri Oct  5 14:46:27 2012
> New Revision: 1394552
> 
> URL: http://svn.apache.org/viewvc?rev=1394552&view=rev
> Log:
> apr_crypto: Add a native CommonCrypto implementation for iOS and OSX
> where OpenSSL has been deprecated.
> 
> Added:
>     apr/apr/trunk/crypto/apr_crypto_commoncrypto.c
> Modified:
>     apr/apr/trunk/Makefile.in
>     apr/apr/trunk/build.conf
>     apr/apr/trunk/build/crypto.m4
>     apr/apr/trunk/build/dso.m4
>     apr/apr/trunk/crypto/apr_crypto.c
>     apr/apr/trunk/include/apr.h.in
>     apr/apr/trunk/include/apr.hnw
>     apr/apr/trunk/include/apr.hw
>     apr/apr/trunk/include/apr_crypto.h
>     apr/apr/trunk/test/testcrypto.c
> 

> Modified: apr/apr/trunk/build/crypto.m4
> URL: http://svn.apache.org/viewvc/apr/apr/trunk/build/crypto.m4?rev=1394552&r1=1394551&r2=1394552&view=diff
> ==============================================================================
> --- apr/apr/trunk/build/crypto.m4 (original)
> +++ apr/apr/trunk/build/crypto.m4 Fri Oct  5 14:46:27 2012

> @@ -238,4 +240,71 @@ AC_DEFUN([APU_CHECK_CRYPTO_NSS], [
>    CPPFLAGS="$old_cppflags"
>    LDFLAGS="$old_ldflags"
>  ])
> +
> +AC_DEFUN([APU_CHECK_CRYPTO_COMMONCRYPTO], [
> +  apu_have_commoncrypto=0
> +  commoncrypto_have_headers=0
> +  commoncrypto_have_libs=0
> +
> +  old_libs="$LIBS"
> +  old_cppflags="$CPPFLAGS"
> +  old_ldflags="$LDFLAGS"
> +
> +  AC_ARG_WITH([commoncrypto], 
> +  [APR_HELP_STRING([--with-commoncrypto=DIR], [specify location of CommonCrypto])],
> +  [
> +    if test "$withval" = "yes"; then
> +      AC_CHECK_HEADERS(CommonCrypto/CommonKeyDerivation.h, [commoncrypto_have_headers=1])
> +      AC_CHECK_LIB(System, CCKeyDerivationPBKDF, AC_CHECK_LIB(System, CCCryptorCreate, [commoncrypto_have_libs=1],,-lcrypto))
> +      if test "$commoncrypto_have_headers" != "0" && test "$commoncrypto_have_libs" != "0"; then
> +        apu_have_commoncrypto=1
> +      fi
> +    elif test "$withval" = "no"; then
> +      apu_have_commoncrypto=0
> +    else
> +
> +      commoncrypto_CPPFLAGS="-I$withval/include"
> +      commoncrypto_LDFLAGS="-L$withval/lib "
> +
> +      APR_ADDTO(CPPFLAGS, [$commoncrypto_CPPFLAGS])
> +      APR_ADDTO(LDFLAGS, [$commoncrypto_LDFLAGS])
> +
> +      AC_MSG_NOTICE(checking for commoncrypto in $withval)
> +      AC_CHECK_HEADERS(CommonCrypto/CommonKeyDerivation.h, [commoncrypto_have_headers=1])
> +      AC_CHECK_LIB(System, CCKeyDerivationPBKDF, AC_CHECK_LIB(System, CCCryptorCreate, [commoncrypto_have_libs=1],,-lcrypto))
> +      if test "$commoncrypto_have_headers" != "0" && test "$commoncrypto_have_libs" != "0"; then
> +        apu_have_commoncrypto=1
> +        APR_ADDTO(LDFLAGS, [-L$withval/lib])
> +        APR_ADDTO(INCLUDES, [-I$withval/include])
> +      fi
> +
> +      if test "$apu_have_commoncrypto" != "1"; then
> +        AC_CHECK_HEADERS(CommonCrypto/CommonKeyDerivation.h, [commoncrypto_have_headers=1])
> +        AC_CHECK_LIB(System, CCKeyDerivationPBKDF, AC_CHECK_LIB(System, CCCryptorCreate, [commoncrypto_have_libs=1],,-lcrypto))
> +        if test "$commoncrypto_have_headers" != "0" && test "$commoncrypto_have_libs" != "0"; then
> +          apu_have_commoncrypto=1
> +          APR_ADDTO(LDFLAGS, [-L$withval/lib])
> +          APR_ADDTO(INCLUDES, [-I$withval/include])
> +        fi
> +      fi

Maybe I am missing something, but why doing the same tests again if they failed?

> +
> +    fi
> +  ], [
> +    apu_have_commoncrypto=0
> +  ])
> +
> +  dnl Since we have already done the AC_CHECK_LIB tests, if we have it, 
> +  dnl we know the library is there.
> +  if test "$apu_have_commoncrypto" = "1"; then
> +    apu_have_crypto=1
> +  fi
> +  AC_SUBST(apu_have_commoncrypto)
> +  AC_SUBST(LDADD_crypto_commoncrypto)
> +  AC_SUBST(apu_have_crypto)
> +
> +  LIBS="$old_libs"
> +  CPPFLAGS="$old_cppflags"
> +  LDFLAGS="$old_ldflags"
> +])
> +
>  dnl
> 

Regards

RĂ¼diger

Re: svn commit: r1394552 - in /apr/apr/trunk: Makefile.in build.conf build/crypto.m4 build/dso.m4 crypto/apr_crypto.c crypto/apr_crypto_commoncrypto.c include/apr.h.in include/apr.hnw include/apr.hw include/apr_crypto.h test/testcrypto.c

Posted by Rainer Jung <ra...@kippdata.de>.
On 06.10.2012 02:25, Graham Leggett wrote:
> On 05 Oct 2012, at 11:10 PM, Rainer Jung <ra...@kippdata.de> wrote:
>
>>>> Maybe I am missing something, but why doing the same tests again if they failed?
>>>
>>> No idea, this is templated off the openssl tests, which seem to do the same thing.
>>>
>>> I don't see a reason why the openssl tests are done twice, can you confirm?
>>
>> That part seems to have been added by you back in 2008:
>>
>> http://svn.apache.org/viewvc?view=revision&revision=692949
>
> I am aware of that, however what I was asking was whether there was some problem that is solved by running the tests twice, maybe some subtle detail in the two tests that I have missed. It would be nice to get a second opinion on this rather than just yanking it out and then discovering it broke something for somebody.
>
> The openssl crypto.m4 config was templated from the did.m4 config, which also runs tests twice. It would be a good thing to get eyeballs on this to ensure it is fixed too.

I guess you mean dbd.m4? Can you be more specific (it's a big file)? I'd 
like to check for any reasons there so we can judge whether it was 
already broken in the first place.

Regards,

Rainer

Re: svn commit: r1394552 - in /apr/apr/trunk: Makefile.in build.conf build/crypto.m4 build/dso.m4 crypto/apr_crypto.c crypto/apr_crypto_commoncrypto.c include/apr.h.in include/apr.hnw include/apr.hw include/apr_crypto.h test/testcrypto.c

Posted by Graham Leggett <mi...@sharp.fm>.
On 05 Oct 2012, at 11:10 PM, Rainer Jung <ra...@kippdata.de> wrote:

>>> Maybe I am missing something, but why doing the same tests again if they failed?
>> 
>> No idea, this is templated off the openssl tests, which seem to do the same thing.
>> 
>> I don't see a reason why the openssl tests are done twice, can you confirm?
> 
> That part seems to have been added by you back in 2008:
> 
> http://svn.apache.org/viewvc?view=revision&revision=692949

I am aware of that, however what I was asking was whether there was some problem that is solved by running the tests twice, maybe some subtle detail in the two tests that I have missed. It would be nice to get a second opinion on this rather than just yanking it out and then discovering it broke something for somebody.

The openssl crypto.m4 config was templated from the did.m4 config, which also runs tests twice. It would be a good thing to get eyeballs on this to ensure it is fixed too.

Regards,
Graham
--


Re: svn commit: r1394552 - in /apr/apr/trunk: Makefile.in build.conf build/crypto.m4 build/dso.m4 crypto/apr_crypto.c crypto/apr_crypto_commoncrypto.c include/apr.h.in include/apr.hnw include/apr.hw include/apr_crypto.h test/testcrypto.c

Posted by Rainer Jung <ra...@kippdata.de>.
On 05.10.2012 17:36, Graham Leggett wrote:
> On 05 Oct 2012, at 5:21 PM, Ruediger Pluem <rp...@apache.org> wrote:
>
>>> +      AC_MSG_NOTICE(checking for commoncrypto in $withval)
>>> +      AC_CHECK_HEADERS(CommonCrypto/CommonKeyDerivation.h, [commoncrypto_have_headers=1])
>>> +      AC_CHECK_LIB(System, CCKeyDerivationPBKDF, AC_CHECK_LIB(System, CCCryptorCreate, [commoncrypto_have_libs=1],,-lcrypto))
>>> +      if test "$commoncrypto_have_headers" != "0" && test "$commoncrypto_have_libs" != "0"; then
>>> +        apu_have_commoncrypto=1
>>> +        APR_ADDTO(LDFLAGS, [-L$withval/lib])
>>> +        APR_ADDTO(INCLUDES, [-I$withval/include])
>>> +      fi
>>> +
>>> +      if test "$apu_have_commoncrypto" != "1"; then
>>> +        AC_CHECK_HEADERS(CommonCrypto/CommonKeyDerivation.h, [commoncrypto_have_headers=1])
>>> +        AC_CHECK_LIB(System, CCKeyDerivationPBKDF, AC_CHECK_LIB(System, CCCryptorCreate, [commoncrypto_have_libs=1],,-lcrypto))
>>> +        if test "$commoncrypto_have_headers" != "0" && test "$commoncrypto_have_libs" != "0"; then
>>> +          apu_have_commoncrypto=1
>>> +          APR_ADDTO(LDFLAGS, [-L$withval/lib])
>>> +          APR_ADDTO(INCLUDES, [-I$withval/include])
>>> +        fi
>>> +      fi
>>
>> Maybe I am missing something, but why doing the same tests again if they failed?
>
> No idea, this is templated off the openssl tests, which seem to do the same thing.
>
> I don't see a reason why the openssl tests are done twice, can you confirm?

That part seems to have been added by you back in 2008:

http://svn.apache.org/viewvc?view=revision&revision=692949

Regards,

Rainer

Re: svn commit: r1394552 - in /apr/apr/trunk: Makefile.in build.conf build/crypto.m4 build/dso.m4 crypto/apr_crypto.c crypto/apr_crypto_commoncrypto.c include/apr.h.in include/apr.hnw include/apr.hw include/apr_crypto.h test/testcrypto.c

Posted by Graham Leggett <mi...@sharp.fm>.
On 05 Oct 2012, at 5:21 PM, Ruediger Pluem <rp...@apache.org> wrote:

>> +      AC_MSG_NOTICE(checking for commoncrypto in $withval)
>> +      AC_CHECK_HEADERS(CommonCrypto/CommonKeyDerivation.h, [commoncrypto_have_headers=1])
>> +      AC_CHECK_LIB(System, CCKeyDerivationPBKDF, AC_CHECK_LIB(System, CCCryptorCreate, [commoncrypto_have_libs=1],,-lcrypto))
>> +      if test "$commoncrypto_have_headers" != "0" && test "$commoncrypto_have_libs" != "0"; then
>> +        apu_have_commoncrypto=1
>> +        APR_ADDTO(LDFLAGS, [-L$withval/lib])
>> +        APR_ADDTO(INCLUDES, [-I$withval/include])
>> +      fi
>> +
>> +      if test "$apu_have_commoncrypto" != "1"; then
>> +        AC_CHECK_HEADERS(CommonCrypto/CommonKeyDerivation.h, [commoncrypto_have_headers=1])
>> +        AC_CHECK_LIB(System, CCKeyDerivationPBKDF, AC_CHECK_LIB(System, CCCryptorCreate, [commoncrypto_have_libs=1],,-lcrypto))
>> +        if test "$commoncrypto_have_headers" != "0" && test "$commoncrypto_have_libs" != "0"; then
>> +          apu_have_commoncrypto=1
>> +          APR_ADDTO(LDFLAGS, [-L$withval/lib])
>> +          APR_ADDTO(INCLUDES, [-I$withval/include])
>> +        fi
>> +      fi
> 
> Maybe I am missing something, but why doing the same tests again if they failed?

No idea, this is templated off the openssl tests, which seem to do the same thing.

I don't see a reason why the openssl tests are done twice, can you confirm?

Regards,
Graham
--