Re: Re: XTS does not get the expected result for non-byte-aligned NIST vectors

Jeffrey Walton <[email protected]>
Newsgroups gmane.comp.encryption.cryptopp
Message-ID <CAH8yC8mVJ0tPby4uJdQK6xtC=1ag7jqvV1fFKf-nU1mb94e0zg@mail.gmail.com>
On Thu, May 20, 2021 at 4:02 AM yu li <[email protected]> wrote:
>
> Thank you for your reply.
>
> All test vector in https://github.com/weidai11/cryptopp/blob/master/TestVectors/xts.txt.  are byte-aligned . I've tested these vectors locally, and they're all pass. But it doesn't have a non-byte-aligned vector like datalen=250bit in https://github.com/weidai11/cryptopp/blob/master/TestVectors/xts.txt.  We can found non-byte-aligned vector in https://csrc.nist.gov/Projects/Cryptographic-Algorithm-Validation-Program/CAVP-TESTING-BLOCK-CIPHER-MODES#XTS .  All byte-aligned vector in https://csrc.nist.gov/Projects/Cryptographic-Algorithm-Validation-Program/CAVP-TESTING-BLOCK-CIPHER-MODES#XTS can pass, but all non-byte-aligned vector are fail.

My bad Yu. I took alignment to mean type alignment. Sorry about that.

XTS mode in Crypto++ is byte oriented, not bit oriented. We could
possibly change that.

I'm looking at https://csrc.nist.gov/CSRC/media/Projects/Cryptographic-Algorithm-Validation-Program/documents/aes/XTSVS.pdf,
and it says (from p. 6):

An implementation may support a data unit length that is not a
multiple of 8 bits.  In this case, the plaintext (PT) and ciphertext
(CT) will be represented in the request, sample, and response files by
a bit string padded with zeros on the right to the next byte boundary,
in hexadecimal.  For example, suppose an implementation supports a 137
bit data unit.  The first 128-bit block consists of the first (i.e.,
leftmost) 128 bits.  If the second, nine-bit partial block is
011011011, then in the request and sample files it will be padded with
seven zeros on the right – 0110 1101 1000 0000 – and represented as
6d80 (hex).  Response files values should be formatted the same way.

The values seem non-sensical to me. Where did 137-bit data unit come
from? That's going to be a sector size in real life, so its going to
be 512, 2048, 4096, 64k, etc.

Jeff

-- 
You received this message because you are subscribed to the Google Groups "Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/cryptopp-users/CAH8yC8mVJ0tPby4uJdQK6xtC%3D1ag7jqvV1fFKf-nU1mb94e0zg%40mail.gmail.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.