* [jarkko-tpmdd:tpm2key-v3 7/7] crypto/asymmetric_keys/tpm2_key_rsa.c:360:1: warning: label 'err_auth' defined but not used
@ 2024-05-23 7:50 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2024-05-23 7:50 UTC (permalink / raw)
To: James Prestwood; +Cc: oe-kbuild-all, Jarkko Sakkinen
tree: git://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd.git tpm2key-v3
head: 9e82832aa16a3b33db19220c360342be336b77d2
commit: 9e82832aa16a3b33db19220c360342be336b77d2 [7/7] keys: asymmetric: ASYMMETRIC_TPM2_KEY_RSA_SUBTYPE
config: alpha-allyesconfig (https://download.01.org/0day-ci/archive/20240523/202405231542.NYBUAOf9-lkp@intel.com/config)
compiler: alpha-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240523/202405231542.NYBUAOf9-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202405231542.NYBUAOf9-lkp@intel.com/
All warnings (new ones prefixed by >>):
crypto/asymmetric_keys/tpm2_key_rsa.c: In function '__tpm2_key_rsa_decrypt':
>> crypto/asymmetric_keys/tpm2_key_rsa.c:360:1: warning: label 'err_auth' defined but not used [-Wunused-label]
360 | err_auth:
| ^~~~~~~~
crypto/asymmetric_keys/tpm2_key_rsa.c:284:22: warning: unused variable 'offset' [-Wunused-variable]
284 | unsigned int offset = 0;
| ^~~~~~
vim +/err_auth +360 crypto/asymmetric_keys/tpm2_key_rsa.c
278
279 static int __tpm2_key_rsa_decrypt(struct tpm_chip *chip,
280 struct tpm2_key_rsa *key,
281 struct kernel_pkey_params *params,
282 const void *in, int in_len, void *out)
283 {
284 unsigned int offset = 0;
285 u32 key_handle = 0;
286 struct tpm_buf buf;
287 u16 decrypted_len;
288 u32 parent;
289 u8 *pos;
290 int ret;
291
292 ret = tpm_try_get_ops(chip);
293 if (ret)
294 return ret;
295
296 ret = tpm2_start_auth_session(chip);
297 if (ret)
298 goto err_ops;
299
300 parent = key->key.parent;
301
302 ret = tpm_buf_init(&buf, TPM2_ST_SESSIONS, TPM2_CC_LOAD);
303 if (ret < 0)
304 goto err_parent;
305
306 tpm_buf_append_name(chip, &buf, parent, NULL);
307 tpm_buf_append_hmac_session(chip, &buf, TPM2_SA_CONTINUE_SESSION |
308 TPM2_SA_ENCRYPT, NULL, 0);
309 tpm_buf_append(&buf, key->key.blob, key->key.blob_len);
310 if (buf.flags & TPM_BUF_OVERFLOW) {
311 ret = -E2BIG;
312 goto err_buf;
313 }
314 tpm_buf_fill_hmac_session(chip, &buf);
315 ret = tpm_transmit_cmd(chip, &buf, 4, "RSA key loading");
316 ret = tpm_buf_check_hmac_response(chip, &buf, ret);
317 if (ret) {
318 ret = -EIO;
319 goto err_buf;
320 }
321 key_handle = be32_to_cpup((__be32 *)&buf.data[TPM_HEADER_SIZE]);
322
323 tpm_buf_reset(&buf, TPM2_ST_SESSIONS, TPM2_CC_RSA_DECRYPT);
324 tpm_buf_append_name(chip, &buf, key_handle, NULL);
325 tpm_buf_append_hmac_session(chip, &buf, TPM2_SA_DECRYPT, NULL, 0);
326 tpm_buf_append_u16(&buf, in_len);
327 tpm_buf_append(&buf, in, in_len);
328 tpm_buf_append_u16(&buf, TPM_ALG_NULL);
329 tpm_buf_append_u16(&buf, 0);
330 tpm_buf_fill_hmac_session(chip, &buf);
331 ret = tpm_transmit_cmd(chip, &buf, 4, "RSA key decrypting");
332 ret = tpm_buf_check_hmac_response(chip, &buf, ret);
333 if (ret) {
334 ret = -EIO;
335 goto err_blob;
336 }
337
338 pos = buf.data + TPM_HEADER_SIZE + 4;
339 decrypted_len = be16_to_cpup((__be16 *)pos);
340 pos += 2;
341
342 if (params->out_len < decrypted_len) {
343 ret = -EMSGSIZE;
344 goto err_blob;
345 }
346
347 memcpy(out, pos, decrypted_len);
348 ret = decrypted_len;
349
350 err_blob:
351 tpm2_flush_context(chip, key_handle);
352
353 err_buf:
354 tpm_buf_destroy(&buf);
355
356 err_parent:
357 if (key->key.parent == TPM2_RH_NULL)
358 tpm2_flush_context(chip, parent);
359
> 360 err_auth:
361 if (ret < 0)
362 tpm2_end_auth_session(chip);
363
364 err_ops:
365 tpm_put_ops(chip);
366 return ret;
367 }
368
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-05-23 8:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-23 7:50 [jarkko-tpmdd:tpm2key-v3 7/7] crypto/asymmetric_keys/tpm2_key_rsa.c:360:1: warning: label 'err_auth' defined but not used kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.