Re: zeroing tfms in crypto_free_tfm()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 5 Feb 2009, Herbert Xu wrote:
> On Wed, Feb 04, 2009 at 04:09:04PM +0100, Geert Uytterhoeven wrote:
> > However, in the mean time, the allocation mechanism for crypto_tfm objects has
> > been changed twice, by:
> >   1. commit fbdae9f3e7fb57c07cb0d973f113eb25da2e8ff2 ("[CRYPTO] Ensure cit_iv
> >      is aligned correctly"), which replaced "alg->cra_ctxsize" by
> >      "crypto_ctxsize(alg, flags)" in crypto_alloc_tfm(),
> >   2. commit 7b0bac64cd5b74d6f1147524c26216de13a501fd ("crypto: api - Rebirth of
> >      crypto_alloc_tfm"), which introduced the alternative crypto_create_tfm(),
> >      where the memory requirements are based on
> >      "frontend->extsize(alg, frontend)" instead of "alg->cra_ctxsize".
> 
> Good catch.  In fact we've been freeing the wrong pointer with
> shash all along.  I wonder how it avoided crashing.

It doesn't crash because crypto_shash_type.tfmsize =
offsetof(struct crypto_shash, base) = zero.

With kind regards,

Geert Uytterhoeven
Software Architect

Sony Techsoft Centre Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium

Phone:    +32 (0)2 700 8453
Fax:      +32 (0)2 700 8622
E-mail:   Geert.Uytterhoeven@xxxxxxxxxxx
Internet: http://www.sony-europe.com/

A division of Sony Europe (Belgium) N.V.
VAT BE 0413.825.160 · RPR Brussels
Fortis · BIC GEBABEBB · IBAN BE41293037680010
--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux