2015-03-04 17:13:03

by Nicolae Rosia

[permalink] [raw]
Subject: IPSec hmac(sha256) truncation bits length

Hello,

I'm trying to understand why icv_truncbits is set to 96 for
hmac(sha256) in xfrm_algo.c because
RFC4868 [1] says that the truncation length for HMAC-SHA256 should be 128.
Am I looking in the wrong place?

[1] https://tools.ietf.org/html/rfc4868#section-2.6

Best regards,
Nicolae Rosia


2015-03-04 18:28:28

by Nicolae Rosia

[permalink] [raw]
Subject: Re: IPSec hmac(sha256) truncation bits length

+ CC net, James Morris

On Wed, Mar 4, 2015 at 7:13 PM, Nicolae Rosia <[email protected]> wrote:
> Hello,
>
> I'm trying to understand why icv_truncbits is set to 96 for
> hmac(sha256) in xfrm_algo.c because
> RFC4868 [1] says that the truncation length for HMAC-SHA256 should be 128.
> Am I looking in the wrong place?
>
> [1] https://tools.ietf.org/html/rfc4868#section-2.6
>
> Best regards,
> Nicolae Rosia

2015-03-04 18:43:53

by Kim Phillips

[permalink] [raw]
Subject: Re: IPSec hmac(sha256) truncation bits length

On Wed, 4 Mar 2015 20:28:26 +0200
Nicolae Rosia <[email protected]> wrote:

> On Wed, Mar 4, 2015 at 7:13 PM, Nicolae Rosia <[email protected]> wrote:
> > I'm trying to understand why icv_truncbits is set to 96 for
> > hmac(sha256) in xfrm_algo.c because
> > RFC4868 [1] says that the truncation length for HMAC-SHA256 should be 128.

See http://comments.gmane.org/gmane.linux.kernel.cryptoapi/6767

Kim

2015-03-04 18:46:03

by Andreas Steffen

[permalink] [raw]
Subject: Re: IPSec hmac(sha256) truncation bits length

Hi Nicolae,

up to the Linux 2.6.32 kernel the SHA256 hash was erroneously truncated
to 96 bits. With Linux 2.6.33 the correct truncation to 128 bits
was introduce as well as the SHA384_192 and SHA512_256 data integrity
algorithms. If you want to apply the correct SHA2 truncation, use
XFRMA_ALG_AUTH_TRUNC instead of XFRMA_ALG_AUTH.

Best regards

Andreas

On 03/04/2015 06:13 PM, Nicolae Rosia wrote:
> Hello,
>
> I'm trying to understand why icv_truncbits is set to 96 for
> hmac(sha256) in xfrm_algo.c because
> RFC4868 [1] says that the truncation length for HMAC-SHA256 should be 128.
> Am I looking in the wrong place?
>
> [1] https://tools.ietf.org/html/rfc4868#section-2.6
>
> Best regards,
> Nicolae Rosia
> --
> To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>

--
======================================================================
Andreas Steffen [email protected]
strongSwan - the Open Source VPN Solution! http://www.strongswan.org
Institute for Internet Technologies and Applications
University of Applied Sciences Rapperswil
CH-8640 Rapperswil (Switzerland)
===========================================================[ITA-HSR]==


Attachments:
smime.p7s (4.16 kB)
S/MIME Cryptographic Signature

2015-03-04 18:56:58

by Nicolae Rosia

[permalink] [raw]
Subject: Re: IPSec hmac(sha256) truncation bits length

Thank you, Andreas and Kim.

Best regards,
Nicolae Rosia

On Wed, Mar 4, 2015 at 8:38 PM, Kim Phillips <[email protected]> wrote:
> On Wed, 4 Mar 2015 20:28:26 +0200
> Nicolae Rosia <[email protected]> wrote:
>
>> On Wed, Mar 4, 2015 at 7:13 PM, Nicolae Rosia <[email protected]> wrote:
>> > I'm trying to understand why icv_truncbits is set to 96 for
>> > hmac(sha256) in xfrm_algo.c because
>> > RFC4868 [1] says that the truncation length for HMAC-SHA256 should be 128.
>
> See http://comments.gmane.org/gmane.linux.kernel.cryptoapi/6767
>
> Kim