Bug 229795 - [cryptosoft] Investigate blake2 mismatch vs cryptocheck
Summary: [cryptosoft] Investigate blake2 mismatch vs cryptocheck
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: Conrad Meyer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-07-15 23:38 UTC by Conrad Meyer
Modified: 2018-07-20 01:52 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Conrad Meyer freebsd_committer freebsd_triage 2018-07-15 23:38:41 UTC
t/t/crypto $ $(make -V .OBJDIR)/cryptocheck.full -vvv -a hmac -d cryptosoft0
...
blake2b (16) mismatch:
control:
0000   b1 7e 59 ed ed 0a ef 7c a0 a6 d2 f8 4c 93 35 d0  |.~Y....|....L.5.|
0010   b0 4f 77 2f f0 2e 91 39 38 24 6a ee 54 d8 2a 50  |.Ow/...98$j.T.*P|
0020   b4 41 1a cc 11 1a 90 6a ee 6e 66 60 fd 14 26 f2  |.A.....j.nf`..&.|
0030   df 75 ec 4d 0e 49 27 b2 f9 9e 8a e6 36 a7 01 d0  |.u.M.I'.....6...|
test (cryptodev device cryptosoft0):
0000   46 49 c9 db 92 e4 a8 13 a4 b9 45 27 ca 67 47 0e  |FI........E'.gG.|
0010   b6 d7 06 6c 5c 4f 01 79 75 7e d3 bd 26 d2 00 6f  |...l\O.yu~..&..o|
0020   72 ba c0 16 4a aa a5 78 1e aa 32 84 da 8e 14 df  |r...J..x..2.....|
0030   a9 36 13 62 83 a9 c6 e2 67 d0 dd ea 4d 18 46 db  |.6.b....g...M.F.|
blake2s (16) mismatch:
control:
0000   26 28 a0 66 b9 c0 82 c8 fd 54 64 ed 0b b2 30 ec  |&(.f.....Td...0.|
0010   a1 18 9a da 89 a3 bd 71 e1 f0 30 5b 28 40 48 5e  |.......q..0[(@H^|
test (cryptodev device cryptosoft0):
0000   05 92 b0 1d 9d ee e3 4b d0 a0 94 cf ec 33 6c 1b  |.......K.....3l.|
0010   1d 9a 3a 09 25 17 2c fd 64 81 a7 c9 02 52 80 3d  |..:.%.,.d....R.=|
Comment 1 Conrad Meyer freebsd_committer freebsd_triage 2018-07-20 01:51:18 UTC
r336527
Comment 2 commit-hook freebsd_committer freebsd_triage 2018-07-20 01:52:00 UTC
A commit references this bug:

Author: cem
Date: Fri Jul 20 01:51:06 UTC 2018
New revision: 336527
URL: https://svnweb.freebsd.org/changeset/base/336527

Log:
  cryptocheck: Correct mismatch between OpenSSL use and OCF Blake2

  This corrects a mistake introduced to the cryptocheck tool in r331418.

  Our CRYPTO_BLAKE2B and CRYPTO_BLAKE2S algorithms refer to either the plain,
  unkeyed hashes (specified with cri_klen = 0), or a Blake2-specific keyed MAC
  (when a cri_key is provided).

  In contrast, OpenSSL's Blake2 algorithms only provide the plain hash.
  Cryptocheck's T_HMAC corresponds to OpenSSL's HMAC() routine, which is the
  ordinary HMAC construction applied to any plain, unkeyed hash.  We don't
  have any HMAC-Blake2 cipher modes in OCF, so fix the test to only test
  Blake2 as a plain hash.

  (Ideally we would test keyed Blake2 as well, but that is left as future
  work.)

  PR:		229795

Changes:
  head/tools/tools/crypto/cryptocheck.c