2019-08-16 09:51:04

by Stephan Müller

[permalink] [raw]
Subject: XTS self test fail

Hi,

with the current cryptodev-2.6 code, I get the following with fips=1:

[ 22.301826] alg: skcipher: xts-aes-aesni encryption failed on test vector
"random: len=28 klen=64"; expected_error=0, actual_error=-22, cfg="random:
inplace may_sleep use_final src_divs=[<reimport>100.0%@+20] iv_offset=57"
[ 22.304800] Kernel panic - not syncing: alg: self-tests for xts-aes-aesni
(xts(aes)) failed in fips mode!
[ 22.305709] CPU: 0 PID: 259 Comm: cryptomgr_test Not tainted 5.3.0-rc1+ #9
[ 22.305709] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
1.12.0-2.fc30 04/01/2014
[ 22.305709] Call Trace:
[ 22.305709] dump_stack+0x7c/0xc0
[ 22.305709] panic+0x240/0x453
[ 22.305709] ? add_taint.cold+0x11/0x11
[ 22.305709] ? __atomic_notifier_call_chain+0x5/0x130
[ 22.305709] ? notifier_call_chain+0x27/0xb0
[ 22.305709] alg_test+0x789/0x8d0
[ 22.305709] ? valid_testvec_config+0x1d0/0x1d0
[ 22.305709] ? lock_downgrade+0x380/0x380
[ 22.305709] ? lock_acquire+0xff/0x220
[ 22.305709] ? __kthread_parkme+0x45/0xd0
[ 22.305709] ? mark_held_locks+0x24/0x90
[ 22.305709] ? _raw_spin_unlock_irqrestore+0x43/0x50
[ 22.305709] ? lockdep_hardirqs_on+0x1a8/0x290
[ 22.305709] cryptomgr_test+0x36/0x60
[ 22.305709] kthread+0x1a8/0x200
[ 22.305709] ? crypto_acomp_scomp_free_ctx+0x70/0x70
[ 22.305709] ? kthread_create_on_node+0xd0/0xd0
[ 22.305709] ret_from_fork+0x3a/0x50
[ 22.305709] Kernel Offset: 0x35000000 from 0xffffffff81000000 (relocation
range: 0xffffffff80000000-0xffffffffbfffffff)
[ 22.305709] ---[ end Kernel panic - not syncing: alg: self-tests for xts-
aes-aesni (xts(aes)) failed in fips mode! ]---

Ciao
Stephan



2019-08-16 09:53:20

by Ard Biesheuvel

[permalink] [raw]
Subject: Re: XTS self test fail

On Fri, 16 Aug 2019 at 12:50, Stephan Müller <[email protected]> wrote:
>
> Hi,
>
> with the current cryptodev-2.6 code, I get the following with fips=1:
>
> [ 22.301826] alg: skcipher: xts-aes-aesni encryption failed on test vector
> "random: len=28 klen=64"; expected_error=0, actual_error=-22, cfg="random:
> inplace may_sleep use_final src_divs=[<reimport>100.0%@+20] iv_offset=57"

This is currently being discussed: we are adding support for
ciphertext stealing (which is part of the XTS spec but currently
unimplemented)

Do you have CONFIG_CRYPTO_MANAGER_EXTRA_TESTS=y enabled?

> [ 22.304800] Kernel panic - not syncing: alg: self-tests for xts-aes-aesni
> (xts(aes)) failed in fips mode!
> [ 22.305709] CPU: 0 PID: 259 Comm: cryptomgr_test Not tainted 5.3.0-rc1+ #9
> [ 22.305709] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
> 1.12.0-2.fc30 04/01/2014
> [ 22.305709] Call Trace:
> [ 22.305709] dump_stack+0x7c/0xc0
> [ 22.305709] panic+0x240/0x453
> [ 22.305709] ? add_taint.cold+0x11/0x11
> [ 22.305709] ? __atomic_notifier_call_chain+0x5/0x130
> [ 22.305709] ? notifier_call_chain+0x27/0xb0
> [ 22.305709] alg_test+0x789/0x8d0
> [ 22.305709] ? valid_testvec_config+0x1d0/0x1d0
> [ 22.305709] ? lock_downgrade+0x380/0x380
> [ 22.305709] ? lock_acquire+0xff/0x220
> [ 22.305709] ? __kthread_parkme+0x45/0xd0
> [ 22.305709] ? mark_held_locks+0x24/0x90
> [ 22.305709] ? _raw_spin_unlock_irqrestore+0x43/0x50
> [ 22.305709] ? lockdep_hardirqs_on+0x1a8/0x290
> [ 22.305709] cryptomgr_test+0x36/0x60
> [ 22.305709] kthread+0x1a8/0x200
> [ 22.305709] ? crypto_acomp_scomp_free_ctx+0x70/0x70
> [ 22.305709] ? kthread_create_on_node+0xd0/0xd0
> [ 22.305709] ret_from_fork+0x3a/0x50
> [ 22.305709] Kernel Offset: 0x35000000 from 0xffffffff81000000 (relocation
> range: 0xffffffff80000000-0xffffffffbfffffff)
> [ 22.305709] ---[ end Kernel panic - not syncing: alg: self-tests for xts-
> aes-aesni (xts(aes)) failed in fips mode! ]---
>
> Ciao
> Stephan
>
>

2019-08-16 10:00:06

by Stephan Müller

[permalink] [raw]
Subject: Re: XTS self test fail

Am Freitag, 16. August 2019, 11:52:33 CEST schrieb Ard Biesheuvel:

Hi Ard,

> On Fri, 16 Aug 2019 at 12:50, Stephan M?ller <[email protected]> wrote:
> > Hi,
> >
> > with the current cryptodev-2.6 code, I get the following with fips=1:
> >
> > [ 22.301826] alg: skcipher: xts-aes-aesni encryption failed on test
> > vector "random: len=28 klen=64"; expected_error=0, actual_error=-22,
> > cfg="random: inplace may_sleep use_final src_divs=[<reimport>100.0%@+20]
> > iv_offset=57"
> This is currently being discussed: we are adding support for
> ciphertext stealing (which is part of the XTS spec but currently
> unimplemented)

Sorry, I did not connect the dots here and failed to link the issue to the
ongoing discussion.
>
> Do you have CONFIG_CRYPTO_MANAGER_EXTRA_TESTS=y enabled?

Yes.
>
> > [ 22.304800] Kernel panic - not syncing: alg: self-tests for
> > xts-aes-aesni (xts(aes)) failed in fips mode!
> > [ 22.305709] CPU: 0 PID: 259 Comm: cryptomgr_test Not tainted 5.3.0-rc1+
> > #9 [ 22.305709] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996),
> > BIOS 1.12.0-2.fc30 04/01/2014
> > [ 22.305709] Call Trace:
> > [ 22.305709] dump_stack+0x7c/0xc0
> > [ 22.305709] panic+0x240/0x453
> > [ 22.305709] ? add_taint.cold+0x11/0x11
> > [ 22.305709] ? __atomic_notifier_call_chain+0x5/0x130
> > [ 22.305709] ? notifier_call_chain+0x27/0xb0
> > [ 22.305709] alg_test+0x789/0x8d0
> > [ 22.305709] ? valid_testvec_config+0x1d0/0x1d0
> > [ 22.305709] ? lock_downgrade+0x380/0x380
> > [ 22.305709] ? lock_acquire+0xff/0x220
> > [ 22.305709] ? __kthread_parkme+0x45/0xd0
> > [ 22.305709] ? mark_held_locks+0x24/0x90
> > [ 22.305709] ? _raw_spin_unlock_irqrestore+0x43/0x50
> > [ 22.305709] ? lockdep_hardirqs_on+0x1a8/0x290
> > [ 22.305709] cryptomgr_test+0x36/0x60
> > [ 22.305709] kthread+0x1a8/0x200
> > [ 22.305709] ? crypto_acomp_scomp_free_ctx+0x70/0x70
> > [ 22.305709] ? kthread_create_on_node+0xd0/0xd0
> > [ 22.305709] ret_from_fork+0x3a/0x50
> > [ 22.305709] Kernel Offset: 0x35000000 from 0xffffffff81000000
> > (relocation range: 0xffffffff80000000-0xffffffffbfffffff)
> > [ 22.305709] ---[ end Kernel panic - not syncing: alg: self-tests for
> > xts- aes-aesni (xts(aes)) failed in fips mode! ]---
> >
> > Ciao
> > Stephan



Ciao
Stephan