2015-04-21 07:27:38

by jonathan.thieuleux

[permalink] [raw]
Subject: Cipher block questions

Hi,

I'm implementing a new cipher block within the kernel and I'm stuck into a
problem. My algorithm works pretty well, it can cipher and decipher a block. The
algorithm also works with ECB, CBC, and CTR modes, however when I try to use the
modes such as XTS or LRW I have the following errors which are attached. Did I
need to add more code to make it work with XTS and other modes ?

Cheers,

--
Jonathan "Coldshell" Thieuleux
Mail : [email protected]
IRC : coldshell [Freenode, OFTC]
Shaarli : https://links.stdcall.me/

"If you write interfaces with more than 4 or 5 function arguments, it's possible that you and I cannot be friends." -- David Miller


Attachments:
(No filename) (668.00 B)
errors.txt (4.52 kB)
proc-crypto (6.41 kB)
gost28147-89.c (6.84 kB)
gost28147-89.h (1.22 kB)
Download all attachments

2015-04-21 08:07:51

by Milan Broz

[permalink] [raw]
Subject: Re: Cipher block questions

On 04/21/2015 09:27 AM, [email protected] wrote:
> I'm implementing a new cipher block within the kernel and I'm stuck into a
> problem. My algorithm works pretty well, it can cipher and decipher a block. The
> algorithm also works with ECB, CBC, and CTR modes, however when I try to use the
> modes such as XTS or LRW I have the following errors which are attached. Did I
> need to add more code to make it work with XTS and other modes ?

First, from the cryptsetup log
# Userspace crypto wrapper cannot use gost-xts-plain64 (-2).
it seems that there is some problem with loading of your gost cipher implementation.

What key size you are using in cryptsetup (default is probably 256bit)?

LRW and XTS modes requires *two* keys in fact (tweaking+encryption).

GOST should use 256bit key, so if you add --key-size 512 to your cryptsetup command
does it help?

Milan

2015-04-21 09:52:27

by jonathan.thieuleux

[permalink] [raw]
Subject: Re: Cipher block questions

On Tue, Apr 21, 2015 at 10:07:47AM +0200, Milan Broz wrote:


> First, from the cryptsetup log
> # Userspace crypto wrapper cannot use gost-xts-plain64 (-2).
> it seems that there is some problem with loading of your gost cipher implementation.
>
I relaunch the command into QEMU and I obtain "Userspace crypto wrapper cannot use
gost-xts-plain64 (-95)", and when I try with an algorithm which work fine I have the same
result "Userspace crypto wrapper cannot use aes-xts-plain64 (-95)". So, I don't
know what's the problem or where it came from. I quickly Googled the problem, but nothing.

> What key size you are using in cryptsetup (default is probably 256bit)?

Yes, the key size is 256-bit.

> LRW and XTS modes requires *two* keys in fact (tweaking+encryption).
>
> GOST should use 256bit key, so if you add --key-size 512 to your cryptsetup command
> does it help?

I already tried it, but that doesn't change anything.

--
Jonathan "Coldshell" Thieuleux
Mail : [email protected]
IRC : coldshell [Freenode, OFTC]
Shaarli : https://links.stdcall.me/

"If you write interfaces with more than 4 or 5 function arguments, it's possible that you and I cannot be friends." -- David Miller