Merge branch 'jb/aes-siv-fix' (#3013)

* origin/jb/aes-siv-fix:
  tests: updates aes-siv regression test comment
  pill: updates solid
  zuse: propagates fix to aes-128-siv and aes-192-siv as well
  Revert "test: disable aes-siv jets to demonstrate test failure"
  pill: updates solid
  zuse: fixes bug in aes-256-siv iv calculation (+s2vc:aes:crypto)
  test: disable aes-siv jets to demonstrate test failure
  test: add test case for aes-256-siv jet mismatch, observed in the wild

Signed-off-by: Philip Monk <phil@pcmonk.me>
This commit is contained in:
Philip Monk 2020-06-15 19:57:01 -07:00
commit 4e3aace970
No known key found for this signature in database
GPG Key ID: B66E1F02604E44EC
3 changed files with 41 additions and 38 deletions

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:46d79f0b3dc1c4ff5f7ca56f1601a26a0fbc67540ab0ebcc672dc282fe8bbe74 oid sha256:aacd15519a11badc17cbb3de42500a4673c0189d1cee11d759b6472629a88722
size 13825786 size 13817804

View File

@ -3642,62 +3642,53 @@
:: :: ++s2va:aes:crypto :: :: ++s2va:aes:crypto
++ s2va :: AES-128 S2V ++ s2va :: AES-128 S2V
~/ %s2va ~/ %s2va
|= {key/@H ads/(list @)} |= [key=@H ads=(list @)]
=+ res=(maca key `16 0x0)
%^ maca key ~
|- ^- @uxH
?~ ads (maca key `16 0x1) ?~ ads (maca key `16 0x1)
=/ res (maca key `16 0x0)
%+ maca key
|- ^- [[~ @ud] @uxH]
?~ t.ads ?~ t.ads
?: (gte (xeb i.ads) 128) =/ wyt (met 3 i.ads)
(mix i.ads res) ?: (gte wyt 16)
%+ mix [`wyt (mix i.ads res)]
(doub res) [`16 (mix (doub res) (mpad wyt i.ads))]
(mpad (met 3 i.ads) i.ads)
%= $ %= $
res %+ mix
(doub res)
(maca key ~ i.ads)
ads t.ads ads t.ads
res (mix (doub res) (maca key ~ i.ads))
== ==
:: :: ++s2vb:aes:crypto :: :: ++s2vb:aes:crypto
++ s2vb :: AES-192 S2V ++ s2vb :: AES-192 S2V
~/ %s2vb ~/ %s2vb
|= {key/@I ads/(list @)} |= [key=@I ads=(list @)]
=+ res=(macb key `16 0x0)
%^ macb key ~
|- ^- @uxH
?~ ads (macb key `16 0x1) ?~ ads (macb key `16 0x1)
=/ res (macb key `16 0x0)
%+ macb key
|- ^- [[~ @ud] @uxH]
?~ t.ads ?~ t.ads
?: (gte (xeb i.ads) 128) =/ wyt (met 3 i.ads)
(mix i.ads res) ?: (gte wyt 16)
%+ mix [`wyt (mix i.ads res)]
(doub res) [`16 (mix (doub res) (mpad wyt i.ads))]
(mpad (met 3 i.ads) i.ads)
%= $ %= $
res %+ mix
(doub res)
(macb key ~ i.ads)
ads t.ads ads t.ads
res (mix (doub res) (macb key ~ i.ads))
== ==
:: :: ++s2vc:aes:crypto :: :: ++s2vc:aes:crypto
++ s2vc :: AES-256 S2V ++ s2vc :: AES-256 S2V
~/ %s2vc ~/ %s2vc
|= {key/@I ads/(list @)} |= [key=@I ads=(list @)]
=+ res=(macc key `16 0x0)
%^ macc key ~
|- ^- @uxH
?~ ads (macc key `16 0x1) ?~ ads (macc key `16 0x1)
=/ res (macc key `16 0x0)
%+ macc key
|- ^- [[~ @ud] @uxH]
?~ t.ads ?~ t.ads
?: (gte (xeb i.ads) 128) =/ wyt (met 3 i.ads)
(mix i.ads res) ?: (gte wyt 16)
%+ mix [`wyt (mix i.ads res)]
(doub res) [`16 (mix (doub res) (mpad wyt i.ads))]
(mpad (met 3 i.ads) i.ads)
%= $ %= $
res %+ mix
(doub res)
(macc key ~ i.ads)
ads t.ads ads t.ads
res (mix (doub res) (macc key ~ i.ads))
== ==
:: :: ++siva:aes:crypto :: :: ++siva:aes:crypto
++ siva :: AES-128 SIV ++ siva :: AES-128 SIV

View File

@ -567,6 +567,18 @@
^- (list vector-siv) ^- (list vector-siv)
:~ :~
:: ::
:: failed in the wild, see https://github.com/urbit/urbit/pull/3013
::
:^ 0xfdef.6253.d284.a940.1b5d.d1b7.fbcd.4489.
3071.bf93.ace9.37da.7c5d.77d2.1f3e.cda4.
83be.1c51.a88b.c9ba.8741.e1ee.935b.c0ef.
888a.feff.0249.bdb6.1344.0ff9.4e1b.fca5
ad=~
inp=0x97.0341.38e3.960e.87e1
:+ iv=0x249f.85e3.c9a8.29b6.3122.ec22.cde6.76df
len=9
cph=0xdc.bdcd.e4f1.4fd4.2d8d
::
:: from RFC 5297, with extended key :: from RFC 5297, with extended key
:: ::
:^ 0xfffe.fdfc.fbfa.f9f8.f7f6.f5f4.f3f2.f1f0. :^ 0xfffe.fdfc.fbfa.f9f8.f7f6.f5f4.f3f2.f1f0.