From: kernel test robot <lkp@intel.com>
To: James Bottomley <James.Bottomley@hansenpartnership.com>,
linux-integrity@vger.kernel.org
Cc: oe-kbuild-all@lists.linux.dev,
Jarkko Sakkinen <jarkko@kernel.org>,
keyrings@vger.kernel.org, Ard Biesheuvel <ardb@kernel.org>
Subject: Re: [PATCH v4 08/13] tpm: Add full HMAC and encrypt/decrypt session handling code
Date: Tue, 4 Apr 2023 09:49:51 +0800 [thread overview]
Message-ID: <202304040920.8D4b7ebX-lkp@intel.com> (raw)
In-Reply-To: <20230403214003.32093-9-James.Bottomley@HansenPartnership.com>
Hi James,
kernel test robot noticed the following build warnings:
[auto build test WARNING on char-misc/char-misc-testing]
[also build test WARNING on char-misc/char-misc-next char-misc/char-misc-linus herbert-cryptodev-2.6/master herbert-crypto-2.6/master linus/master v6.3-rc5 next-20230403]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/James-Bottomley/crypto-lib-implement-library-version-of-AES-in-CFB-mode/20230404-055053
patch link: https://lore.kernel.org/r/20230403214003.32093-9-James.Bottomley%40HansenPartnership.com
patch subject: [PATCH v4 08/13] tpm: Add full HMAC and encrypt/decrypt session handling code
config: sparc-allyesconfig (https://download.01.org/0day-ci/archive/20230404/202304040920.8D4b7ebX-lkp@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/2fbef78e6bdb1d5385ac75a5a5e750fed42e53e2
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review James-Bottomley/crypto-lib-implement-library-version-of-AES-in-CFB-mode/20230404-055053
git checkout 2fbef78e6bdb1d5385ac75a5a5e750fed42e53e2
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sparc olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sparc SHELL=/bin/bash drivers/char/tpm/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202304040920.8D4b7ebX-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/char/tpm/tpm2-sessions.c:337: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst
* tpm_buf_append_hmac_session() append a TPM session element
vim +337 drivers/char/tpm/tpm2-sessions.c
335
336 /**
> 337 * tpm_buf_append_hmac_session() append a TPM session element
338 * @chip: the TPM chip structure
339 * @buf: The buffer to be appended
340 * @attributes: The session attributes
341 * @passphrase: The session authority (NULL if none)
342 * @passphraselen: The length of the session authority (0 if none)
343 *
344 * This fills in a session structure in the TPM command buffer, except
345 * for the HMAC which cannot be computed until the command buffer is
346 * complete. The type of session is controlled by the @attributes,
347 * the main ones of which are TPM2_SA_CONTINUE_SESSION which means the
348 * session won't terminate after tpm_buf_check_hmac_response(),
349 * TPM2_SA_DECRYPT which means this buffers first parameter should be
350 * encrypted with a session key and TPM2_SA_ENCRYPT, which means the
351 * response buffer's first parameter needs to be decrypted (confusing,
352 * but the defines are written from the point of view of the TPM).
353 *
354 * Any session appended by this command must be finalized by calling
355 * tpm_buf_fill_hmac_session() otherwise the HMAC will be incorrect
356 * and the TPM will reject the command.
357 *
358 * As with most tpm_buf operations, success is assumed because failure
359 * will be caused by an incorrect programming model and indicated by a
360 * kernel message.
361 */
362 void tpm_buf_append_hmac_session(struct tpm_chip *chip, struct tpm_buf *buf,
363 u8 attributes, u8 *passphrase,
364 int passphraselen)
365 {
366 u8 nonce[SHA256_DIGEST_SIZE];
367 u32 len;
368 struct tpm2_auth *auth = chip->auth;
369
370 /*
371 * The Architecture Guide requires us to strip trailing zeros
372 * before computing the HMAC
373 */
374 while (passphrase && passphraselen > 0
375 && passphrase[passphraselen - 1] == '\0')
376 passphraselen--;
377
378 auth->attrs = attributes;
379 auth->passphraselen = passphraselen;
380 if (passphraselen)
381 memcpy(auth->passphrase, passphrase, passphraselen);
382
383 if (auth->session != tpm_buf_length(buf)) {
384 /* we're not the first session */
385 len = get_unaligned_be32(&buf->data[auth->session]);
386 if (4 + len + auth->session != tpm_buf_length(buf)) {
387 WARN(1, "session length mismatch, cannot append");
388 return;
389 }
390
391 /* add our new session */
392 len += 9 + 2 * SHA256_DIGEST_SIZE;
393 put_unaligned_be32(len, &buf->data[auth->session]);
394 } else {
395 tpm_buf_append_u32(buf, 9 + 2 * SHA256_DIGEST_SIZE);
396 }
397
398 /* random number for our nonce */
399 get_random_bytes(nonce, sizeof(nonce));
400 memcpy(auth->our_nonce, nonce, sizeof(nonce));
401 tpm_buf_append_u32(buf, auth->handle);
402 /* our new nonce */
403 tpm_buf_append_u16(buf, SHA256_DIGEST_SIZE);
404 tpm_buf_append(buf, nonce, SHA256_DIGEST_SIZE);
405 tpm_buf_append_u8(buf, auth->attrs);
406 /* and put a placeholder for the hmac */
407 tpm_buf_append_u16(buf, SHA256_DIGEST_SIZE);
408 tpm_buf_append(buf, nonce, SHA256_DIGEST_SIZE);
409 }
410 EXPORT_SYMBOL(tpm_buf_append_hmac_session);
411
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
next prev parent reply other threads:[~2023-04-04 1:49 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-03 21:39 [PATCH v4 00/13] add integrity and security to TPM2 transactions James Bottomley
2023-04-03 21:39 ` [PATCH v4 01/13] crypto: lib - implement library version of AES in CFB mode James Bottomley
2023-04-23 3:34 ` Jarkko Sakkinen
2023-04-03 21:39 ` [PATCH v4 02/13] tpm: move buffer handling from static inlines to real functions James Bottomley
2023-04-23 3:36 ` Jarkko Sakkinen
2023-04-03 21:39 ` [PATCH v4 03/13] tpm: add kernel doc to buffer handling functions James Bottomley
2023-04-23 3:40 ` Jarkko Sakkinen
2023-04-03 21:39 ` [PATCH v4 04/13] tpm: add buffer handling for TPM2B types James Bottomley
2023-04-23 4:12 ` Jarkko Sakkinen
2023-05-02 15:43 ` Stefan Berger
2023-05-03 11:29 ` Jarkko Sakkinen
2023-04-03 21:39 ` [PATCH v4 05/13] tpm: add cursor based buffer functions for response parsing James Bottomley
2023-04-23 4:14 ` Jarkko Sakkinen
2023-05-02 13:54 ` Stefan Berger
2023-08-22 11:15 ` Jarkko Sakkinen
2023-08-22 13:51 ` Jarkko Sakkinen
2023-04-03 21:39 ` [PATCH v4 06/13] tpm: add buffer function to point to returned parameters James Bottomley
2023-05-02 14:09 ` Stefan Berger
2023-05-03 11:31 ` Jarkko Sakkinen
2023-06-06 2:09 ` James Bottomley
2023-06-06 15:34 ` Jarkko Sakkinen
2023-04-03 21:39 ` [PATCH v4 07/13] tpm: export the context save and load commands James Bottomley
2023-05-02 14:12 ` Stefan Berger
2023-04-03 21:39 ` [PATCH v4 08/13] tpm: Add full HMAC and encrypt/decrypt session handling code James Bottomley
2023-04-04 1:49 ` kernel test robot [this message]
2023-04-23 5:29 ` Jarkko Sakkinen
2023-11-26 3:39 ` Jarkko Sakkinen
2023-11-26 3:45 ` Jarkko Sakkinen
2023-11-26 15:07 ` James Bottomley
2023-11-26 15:05 ` James Bottomley
2023-12-04 2:29 ` Jarkko Sakkinen
2023-12-04 12:35 ` James Bottomley
2023-12-04 13:43 ` Mimi Zohar
2023-12-04 13:53 ` James Bottomley
2023-12-04 13:59 ` Mimi Zohar
2023-12-04 14:02 ` James Bottomley
2023-12-04 14:10 ` Mimi Zohar
2023-12-04 14:23 ` James Bottomley
2023-12-04 22:58 ` Jarkko Sakkinen
2023-12-04 22:46 ` Jarkko Sakkinen
2023-04-03 21:39 ` [PATCH v4 09/13] tpm: add hmac checks to tpm2_pcr_extend() James Bottomley
2023-04-23 5:32 ` Jarkko Sakkinen
2023-04-03 21:40 ` [PATCH v4 10/13] tpm: add session encryption protection to tpm2_get_random() James Bottomley
2023-04-03 21:40 ` [PATCH v4 11/13] KEYS: trusted: Add session encryption protection to the seal/unseal path James Bottomley
2023-04-03 21:40 ` [PATCH v4 12/13] tpm: add the null key name as a sysfs export James Bottomley
2023-04-23 5:38 ` Jarkko Sakkinen
2023-04-03 21:40 ` [PATCH v4 13/13] Documentation: add tpm-security.rst James Bottomley
2023-04-04 18:43 ` [PATCH v4 00/13] add integrity and security to TPM2 transactions William Roberts
2023-04-04 19:18 ` James Bottomley
2023-04-04 19:42 ` William Roberts
2023-04-04 20:19 ` James Bottomley
2023-04-04 21:10 ` William Roberts
2023-04-04 21:33 ` James Bottomley
2023-04-04 21:44 ` William Roberts
2023-04-05 18:39 ` William Roberts
2023-04-05 19:41 ` James Bottomley
2023-04-07 14:40 ` William Roberts
2023-04-23 5:42 ` Jarkko Sakkinen
2023-12-04 18:56 ` Stefan Berger
2023-12-04 19:24 ` James Bottomley
2023-12-04 21:02 ` Stefan Berger
2023-12-05 13:50 ` James Bottomley
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=202304040920.8D4b7ebX-lkp@intel.com \
--to=lkp@intel.com \
--cc=James.Bottomley@hansenpartnership.com \
--cc=ardb@kernel.org \
--cc=jarkko@kernel.org \
--cc=keyrings@vger.kernel.org \
--cc=linux-integrity@vger.kernel.org \
--cc=oe-kbuild-all@lists.linux.dev \
/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