Linux cryptographic layer development
 help / color / mirror / Atom feed
From: jonathan.thieuleux@gmail.com
To: linux-crypto@vger.kernel.org
Subject: XTS and 64-bit block
Date: Wed, 6 May 2015 10:28:25 +0200	[thread overview]
Message-ID: <20150506082825.GA13842@arch.localdomain> (raw)

Hi,

I'm implementing a new block cipher algorithm which is GOST 28147-89. This is a
256-bit key and 64-bit block algorithm. This algorithm works well with ECB, CBC
and CTR modes. But, when I try to use the XTS mode, the encryption fails. So I
tried to find the problem and it seems to come from the file crypto/xts.c,
function init_tfm :

	if (crypto_cipher_blocksize(cipher) != XTS_BLOCK_SIZE) {
		*flags |= CRYPTO_TFM_RES_BAD_BLOCK_LEN;
		crypto_free_cipher(cipher);
		return -EINVAL;
	}

So, I checked the value of XTS_BLOCK_SIZE which is 0x10. The snag is that the
block size of GOST is 0x8. So I changed the block value of my algorithm to 0x10,
and then I tried again with the XTS mode, and it works!

Because of what just happened, I've two questions:

Q1: Why does the GOST algorithm still work? Despite I changed the block size.
Q2: Why in the code, was the block size of XTS fixed? As far as I know,
operations modes should adapt to the size of the block cipher.


Regards,
Thanks in advance
--
Jonathan "Coldshell" Thieuleux
Mail : jonathan.thieuleux@gmail.com
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

                 reply	other threads:[~2015-05-06  8:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150506082825.GA13842@arch.localdomain \
    --to=jonathan.thieuleux@gmail.com \
    --cc=linux-crypto@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox