You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by ja...@apache.org on 2018/05/28 19:45:57 UTC
svn commit: r1832415 - /apr/apr/trunk/crypto/apr_md4.c
Author: jailletc36
Date: Mon May 28 19:45:56 2018
New Revision: 1832415
URL: http://svn.apache.org/viewvc?rev=1832415&view=rev
Log:
Better stack memseting of sensitive information.
Why is 'apr_crypto_memzero()' only available if APU_HAVE_CRYPTO=1?
See PR 55738
Modified:
apr/apr/trunk/crypto/apr_md4.c
Modified: apr/apr/trunk/crypto/apr_md4.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/crypto/apr_md4.c?rev=1832415&r1=1832414&r2=1832415&view=diff
==============================================================================
--- apr/apr/trunk/crypto/apr_md4.c (original)
+++ apr/apr/trunk/crypto/apr_md4.c Mon May 28 19:45:56 2018
@@ -41,6 +41,7 @@
#include "apr_strings.h"
#include "apr_md4.h"
#include "apr_lib.h"
+#include "apr_crypto.h" /* for apr_crypto_memzero, if available */
#if APR_HAVE_STRING_H
#include <string.h>
@@ -359,7 +360,11 @@ static void MD4Transform(apr_uint32_t st
state[3] += d;
/* Zeroize sensitive information. */
+#if APU_HAVE_CRYPTO
+ apr_crypto_memzero(x, sizeof(x));
+#else
memset(x, 0, sizeof(x));
+#endif
}
/* Encodes input (apr_uint32_t) into output (unsigned char). Assumes len is
Re: svn commit: r1832415 - /apr/apr/trunk/crypto/apr_md4.c
Posted by Yann Ylavic <yl...@gmail.com>.
On Fri, Jun 15, 2018 at 12:46 PM, Yann Ylavic <yl...@gmail.com> wrote:
>
> apr_crypto_{memzero,equals} => apr_consttime_{memzero,equals}
I meant apr_crypto_memzero() => apr_explicit_memzero() and
apr_crypto_equals() => apr_consttime_equals().
Re: svn commit: r1832415 - /apr/apr/trunk/crypto/apr_md4.c
Posted by Yann Ylavic <yl...@gmail.com>.
On Fri, Jun 15, 2018 at 12:41 PM, Yann Ylavic <yl...@gmail.com> wrote:
> Hi Christophe,
>
> On Fri, Jun 15, 2018 at 11:17 AM, Christophe JAILLET
> <ch...@wanadoo.fr> wrote:
>>
>> any plan/interrest in having apr_crypto_memzero() available even if
>> APU_HAVE_CRYPTO is not defined?
>> There are a few places in httpd and in APR that should use this safer
>> memset'ing.
>
> Agreed, apr_crypto_memzero() and apr_crypto_equals() could not depend
> on APU_HAVE_CRYPTO, though still defined/implemented in
> apr_crypto.h/c.
> Unfortunately this was made so in APR-1.6, but from 1.7 I'm +1.
Hmm, actually for APR-1.x where APR and APU and separated, we can't
use APU code in APR, so that'd require to move them to APR.
So there is probably some naming trick to do, e.g.
apr_crypto_{memzero,equals} => apr_consttime_{memzero,equals}, and
then APU functions would call APR ones...
Re: svn commit: r1832415 - /apr/apr/trunk/crypto/apr_md4.c
Posted by Yann Ylavic <yl...@gmail.com>.
Hi Christophe,
On Fri, Jun 15, 2018 at 11:17 AM, Christophe JAILLET
<ch...@wanadoo.fr> wrote:
>
> any plan/interrest in having apr_crypto_memzero() available even if
> APU_HAVE_CRYPTO is not defined?
> There are a few places in httpd and in APR that should use this safer
> memset'ing.
Agreed, apr_crypto_memzero() and apr_crypto_equals() could not depend
on APU_HAVE_CRYPTO, though still defined/implemented in
apr_crypto.h/c.
Unfortunately this was made so in APR-1.6, but from 1.7 I'm +1.
Thanks for noticing!
Yann.
Re: svn commit: r1832415 - /apr/apr/trunk/crypto/apr_md4.c
Posted by Christophe JAILLET <ch...@wanadoo.fr>.
Hi,
any plan/interrest in having apr_crypto_memzero() available even if
APU_HAVE_CRYPTO is not defined?
There are a few places in httpd and in APR that should use this safer
memset'ing.
CJ
Le 28/05/2018 à 21:45, jailletc36@apache.org a écrit :
> Author: jailletc36
> Date: Mon May 28 19:45:56 2018
> New Revision: 1832415
>
> URL: http://svn.apache.org/viewvc?rev=1832415&view=rev
> Log:
> Better stack memseting of sensitive information.
>
> Why is 'apr_crypto_memzero()' only available if APU_HAVE_CRYPTO=1?
>
> See PR 55738
>
> Modified:
> apr/apr/trunk/crypto/apr_md4.c
>
> Modified: apr/apr/trunk/crypto/apr_md4.c
> URL: http://svn.apache.org/viewvc/apr/apr/trunk/crypto/apr_md4.c?rev=1832415&r1=1832414&r2=1832415&view=diff
> ==============================================================================
> --- apr/apr/trunk/crypto/apr_md4.c (original)
> +++ apr/apr/trunk/crypto/apr_md4.c Mon May 28 19:45:56 2018
> @@ -41,6 +41,7 @@
> #include "apr_strings.h"
> #include "apr_md4.h"
> #include "apr_lib.h"
> +#include "apr_crypto.h" /* for apr_crypto_memzero, if available */
>
> #if APR_HAVE_STRING_H
> #include <string.h>
> @@ -359,7 +360,11 @@ static void MD4Transform(apr_uint32_t st
> state[3] += d;
>
> /* Zeroize sensitive information. */
> +#if APU_HAVE_CRYPTO
> + apr_crypto_memzero(x, sizeof(x));
> +#else
> memset(x, 0, sizeof(x));
> +#endif
> }
>
> /* Encodes input (apr_uint32_t) into output (unsigned char). Assumes len is
>
>
>