From 632f5e9a34e79245895ded44887ccae475319198 Mon Sep 17 00:00:00 2001 Message-Id: <632f5e9a34e79245895ded44887ccae475319198.1714437728.git.mdw@distorted.org.uk> From: Mark Wooding Date: Sun, 16 Jul 2017 16:07:29 +0100 Subject: [PATCH] README: Include some useful documentation. Organization: Straylight/Edgeware From: Mark Wooding --- Makefile | 2 + README | 132 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 134 insertions(+) create mode 100644 README diff --git a/Makefile b/Makefile index ccfe86d..433f808 100644 --- a/Makefile +++ b/Makefile @@ -251,6 +251,8 @@ dlraes512.verbose: ocbgen Makefile all:: $(TARGETS) +DIST += README + DISTDIR = ocb-tv dist: all diff --git a/README b/README new file mode 100644 index 0000000..0f9c4f0 --- /dev/null +++ b/README @@ -0,0 +1,132 @@ +OCB3 test vectors for larger block sizes +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +This distribution contains (what I intend to be) a reference +implementation for OCB3 with unusual block sizes (i.e., not 128 bits). + + +Extending OCB3 + +Unfortunately, defining OCB3 for a new block size is not trivial. Here +are the details which need to be addressed for a new block size w. + + * OCB3 does arithmetic in the finite field GF(2^w). It consistently + uses a polynomial basis representation, so GF(2^w) =~ + GF(2)[x]/(p(x)) for an irreducible polynomial p. Choose p to be the + lexicographically earliest of those irreducible polynomials with + smallest degree. + + * OCB3 uses a strongly XOR-universal hash to amortize the overhead of + encrypting nonces over several messages. This hash stretches a + w-bit string x into a 2 w bit string x || (x XOR x << c), and then + picks out i overlapping w-bit windows starting at position i, for 0 + <= i < D for a limit D. For w = 128, D = 64 and c = 8. In the + general case, D is the largest power of two such that c exists, and + c is the largest possible value out of those for which c mod 8 is + minimal -- i.e., we prefer shifts which are byte-aligned over ones + which aren't, and subjet to that we prefer larger shifts to smaller + ones. + + * OCB3 encodes the intended tag length t into the leftmost bits of the + nonce. The number of bits available for encoding the tag size is + ceil(log_2(w)): if w is a power of two, then t = w won't fit, and is + encoded as zero. + + +Example block ciphers + +Not everyone necessarily has Rijndael-256 knocking about, so here's a +simple block cipher for testing. It's four-round Luby--Rackoff with AES +as the round function, but with all of the details specified. Four +rounds is enough for strong-PRP security, but don't use this to extend +block size in real life because you lose when there are internal +collisions in the Luby--Rackoff construction, and that happens much +earlier than you'd hope for a blockcipher of this width. Also, it's +slow. + +As usual, let || denote concatenation of bitstrings. For an integer a +in {0, 1, ..., 2^w - 1}, let [a]_w be w-bit big-endian encoding of a, +i..e, the unique bitstring a_{w-1} || ... || a_1 || a_0 such that a = +SUM_{0<=i