From: kernel test robot <lkp@intel.com>
To: Lakshmi Prasanna Eachuri <lakshmi.prasanna.eachuri@amd.com>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev, git@amd.com,
Michal Simek <monstr@monstr.eu>,
Vishal Sagar <vishal.sagar@amd.com>
Subject: [xilinx-xlnx:lkp_test 267/504] drivers/gpu/drm/xlnx/hdcp/xlnx_hdcp2x_crypt.c:312:6: warning: stack frame size (1032) exceeds limit (1024) in 'xlnx_hdcp2x_tx_compute_hprime'
Date: Sat, 11 Jan 2025 19:08:22 +0800 [thread overview]
Message-ID: <202501111807.GgRdE5tE-lkp@intel.com> (raw)
tree: https://github.com/Xilinx/linux-xlnx lkp_test
head: 9ac6b4acf9144465ac1408d4d799635dec0223a0
commit: 6c8caf3eeadd38ffab47f6cfb7dba45556256143 [267/504] drm: xlnx: Add HDCP2X TX support
config: hexagon-allmodconfig (https://download.01.org/0day-ci/archive/20250111/202501111807.GgRdE5tE-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project f5cd181ffbb7cb61d582fe130d46580d5969d47a)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250111/202501111807.GgRdE5tE-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/202501111807.GgRdE5tE-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/gpu/drm/xlnx/hdcp/xlnx_hdcp2x_crypt.c:312:6: warning: stack frame size (1032) exceeds limit (1024) in 'xlnx_hdcp2x_tx_compute_hprime' [-Wframe-larger-than]
312 | void xlnx_hdcp2x_tx_compute_hprime(const u8 *r_rx, const u8 *rxcaps,
| ^
>> drivers/gpu/drm/xlnx/hdcp/xlnx_hdcp2x_crypt.c:380:6: warning: stack frame size (1040) exceeds limit (1024) in 'xlnx_hdcp2x_tx_compute_lprime' [-Wframe-larger-than]
380 | void xlnx_hdcp2x_tx_compute_lprime(const u8 *rn, const u8 *km,
| ^
>> drivers/gpu/drm/xlnx/hdcp/xlnx_hdcp2x_crypt.c:411:6: warning: stack frame size (1192) exceeds limit (1024) in 'xlnx_hdcp2x_tx_compute_v' [-Wframe-larger-than]
411 | void xlnx_hdcp2x_tx_compute_v(const u8 *rn, const u8 *r_rx, const u8 *rx_info,
| ^
>> drivers/gpu/drm/xlnx/hdcp/xlnx_hdcp2x_crypt.c:446:6: warning: stack frame size (1216) exceeds limit (1024) in 'xlnx_hdcp2x_tx_compute_m' [-Wframe-larger-than]
446 | void xlnx_hdcp2x_tx_compute_m(const u8 *rn, const u8 *r_rx, const u8 *r_tx,
| ^
4 warnings generated.
vim +/xlnx_hdcp2x_tx_compute_hprime +312 drivers/gpu/drm/xlnx/hdcp/xlnx_hdcp2x_crypt.c
311
> 312 void xlnx_hdcp2x_tx_compute_hprime(const u8 *r_rx, const u8 *rxcaps,
313 const u8 *r_tx, const u8 *txcaps,
314 const u8 *km, u8 *hprime)
315 {
316 u8 kd[HDCP2X_TX_DKEY_SIZE * HDCP2X_TX_AES128_SIZE] = {0};
317 u8 aes_iv[HDCP2X_TX_AES128_SIZE] = {0};
318 u8 aes_key[HDCP2X_TX_AES128_SIZE] = {0};
319 u8 hash_input[HDCP_2_2_RTX_LEN + HDCP_2_2_RXCAPS_LEN +
320 HDCP2X_TX_TXCAPS_SIZE] = {0};
321 int idx = 0;
322
323 memcpy(aes_key, km, HDCP2X_TX_KM_SIZE);
324 memcpy(aes_iv, r_tx, HDCP_2_2_RTX_LEN);
325 memcpy(&aes_iv[HDCP_2_2_RTX_LEN], r_rx, HDCP_2_2_RRX_LEN);
326
327 xlnx_hdcp2x_tx_aes128_encrypt(aes_iv, aes_key, kd);
328
329 /* Determine dkey1, counter is 1: Rrx | 0x01. */
330
331 /*
332 * Reference: Section 2.7.1: Key derivation
333 * https://www.digital-cp.com/sites/default/files/HDCP%20on%20DisplayPort%20Specification%20Rev2_3.pdf
334 */
335 aes_iv[HDCP2X_TX_DKEY] ^= HDCP2X_TX_DKEY_CTR1;
336
337 xlnx_hdcp2x_tx_aes128_encrypt(aes_iv, aes_key, &kd[HDCP2X_TX_KM_SIZE]);
338 memcpy(hash_input, r_tx, HDCP_2_2_RTX_LEN);
339 idx += HDCP_2_2_RTX_LEN;
340 memcpy(&hash_input[idx], rxcaps, HDCP_2_2_RXCAPS_LEN);
341 idx += HDCP_2_2_RXCAPS_LEN;
342 memcpy(&hash_input[idx], txcaps, HDCP2X_TX_TXCAPS_SIZE);
343
344 xlnx_hdcp2x_cmn_hmac_sha256_hash(hash_input, sizeof(hash_input), kd,
345 sizeof(kd), hprime);
346 }
347
348 void xlnx_hdcp2x_tx_compute_edkey_ks(const u8 *rn, const u8 *km, const u8 *ks,
349 const u8 *r_rx, const u8 *r_tx,
350 u8 *encrypted_ks)
351 {
352 u8 aes_iv[HDCP2X_TX_AES128_SIZE] = {0};
353 u8 aes_key[HDCP2X_TX_AES128_SIZE] = {0};
354 u8 dkey2[HDCP2X_TX_AES128_SIZE] = {0};
355
356 memcpy(&aes_key[HDCP_2_2_RN_LEN], rn, HDCP_2_2_RN_LEN);
357
358 xlnx_hdcp2x_tx_memxor(aes_key, aes_key, km, HDCP2X_TX_KM_SIZE);
359
360 /* Determine dkey2. */
361 /* Add m = Rtx || Rrx. */
362 memcpy(aes_iv, r_tx, HDCP_2_2_RTX_LEN);
363 memcpy(&aes_iv[HDCP_2_2_RTX_LEN], r_rx, HDCP_2_2_RRX_LEN);
364
365 aes_iv[HDCP2X_TX_DKEY] ^= HDCP2X_TX_DKEY_CTR2;
366
367 xlnx_hdcp2x_tx_aes128_encrypt(aes_iv, aes_key, dkey2);
368
369 /* EdkeyKs = Ks XOR (Dkey2 XOR Rrx). */
370 /* Rrx XOR Dkey2. */
371 memset(encrypted_ks, 0, HDCP_2_2_E_DKEY_KS_LEN);
372
373 memcpy(&encrypted_ks[HDCP_2_2_E_DKEY_KS_LEN - HDCP_2_2_RRX_LEN], r_rx,
374 HDCP_2_2_RRX_LEN);
375
376 xlnx_hdcp2x_tx_memxor(encrypted_ks, encrypted_ks, dkey2, HDCP2X_TX_AES128_SIZE);
377 xlnx_hdcp2x_tx_memxor(encrypted_ks, encrypted_ks, ks, HDCP2X_TX_KS_SIZE);
378 }
379
> 380 void xlnx_hdcp2x_tx_compute_lprime(const u8 *rn, const u8 *km,
381 const u8 *r_rx, const u8 *r_tx,
382 u8 *lprime)
383 {
384 u8 hash_key[HDCP2X_TX_SHA256_HASH_SIZE] = {0};
385 u8 aes_iv[HDCP2X_TX_AES128_SIZE] = {0};
386 u8 aes_key[HDCP2X_TX_AES128_SIZE] = {0};
387 u8 kd[HDCP2X_TX_DKEY_SIZE * HDCP2X_TX_AES128_SIZE] = {0};
388
389 memcpy(aes_key, km, HDCP2X_TX_KM_SIZE);
390 memcpy(aes_iv, r_tx, HDCP_2_2_RTX_LEN);
391 memcpy(&aes_iv[HDCP_2_2_RTX_LEN], r_rx, HDCP_2_2_RRX_LEN);
392
393 /* Compute Dkey0. */
394 /* Add m = Rtx || Rrx. */
395 xlnx_hdcp2x_tx_aes128_encrypt(aes_iv, aes_key, kd);
396
397 /* Compute Dkey , counter is 1: Rrx | 0x01. */
398 aes_iv[HDCP2X_TX_DKEY] ^= HDCP2X_TX_DKEY_CTR1;
399 xlnx_hdcp2x_tx_aes128_encrypt(aes_iv, aes_key, &kd[HDCP2X_TX_KM_SIZE]);
400
401 /* Create hash with HMAC-SHA256. */
402 /* Key: Kd XOR Rrx (least sign. 64 bits). */
403 memcpy(&hash_key[HDCP2X_TX_SHA256_HASH_SIZE - HDCP_2_2_RRX_LEN], r_rx,
404 HDCP_2_2_RRX_LEN);
405
406 xlnx_hdcp2x_tx_memxor(hash_key, hash_key, kd, HDCP2X_TX_SHA256_HASH_SIZE);
407 xlnx_hdcp2x_cmn_hmac_sha256_hash(rn, HDCP_2_2_RN_LEN, hash_key,
408 HDCP2X_TX_SHA256_HASH_SIZE, lprime);
409 }
410
> 411 void xlnx_hdcp2x_tx_compute_v(const u8 *rn, const u8 *r_rx, const u8 *rx_info,
412 const u8 *r_tx, const u8 *rcvid_list, const u8 rcvid_count,
413 const u8 *seq_num_v, const u8 *km, u8 *hash_v)
414 {
415 u8 kd[HDCP2X_TX_DKEY_SIZE * HDCP2X_TX_AES128_SIZE] = {0};
416 u8 aes_iv[HDCP2X_TX_AES128_SIZE] = {0};
417 u8 aes_key[HDCP2X_TX_AES128_SIZE] = {0};
418 u8 hash_input[(HDCP_2_2_MAX_DEVICE_COUNT * HDCP_2_2_RECEIVER_ID_LEN) +
419 HDCP_2_2_RXINFO_LEN + HDCP_2_2_SEQ_NUM_LEN];
420 int idx = 0;
421
422 memcpy(aes_key, km, HDCP2X_TX_KM_SIZE);
423
424 /* Determine Dkey. */
425 /* Add m = Rtx || Rrx. */
426 memcpy(aes_iv, r_tx, HDCP_2_2_RTX_LEN);
427 memcpy(&aes_iv[HDCP_2_2_RTX_LEN], r_rx, HDCP_2_2_RRX_LEN);
428
429 xlnx_hdcp2x_tx_aes128_encrypt(aes_iv, aes_key, kd);
430
431 aes_iv[HDCP2X_TX_DKEY] ^= HDCP2X_TX_DKEY_CTR1;
432 xlnx_hdcp2x_tx_aes128_encrypt(aes_iv, aes_key, &kd[HDCP2X_TX_KM_SIZE]);
433
434 /* Create hash with HMAC-SHA256. */
435 /* Input: ReceiverID list || RxInfo || seq_num_V. */
436 memcpy(hash_input, rcvid_list, (rcvid_count * HDCP_2_2_RECEIVER_ID_LEN));
437 idx += (rcvid_count * HDCP_2_2_RECEIVER_ID_LEN);
438 memcpy(&hash_input[idx], rx_info, HDCP_2_2_RXINFO_LEN);
439 idx += HDCP_2_2_RXINFO_LEN;
440 memcpy(&hash_input[idx], seq_num_v, HDCP_2_2_SEQ_NUM_LEN);
441 idx += HDCP_2_2_SEQ_NUM_LEN;
442
443 xlnx_hdcp2x_cmn_hmac_sha256_hash(hash_input, idx, kd, sizeof(kd), hash_v);
444 }
445
> 446 void xlnx_hdcp2x_tx_compute_m(const u8 *rn, const u8 *r_rx, const u8 *r_tx,
447 const u8 *stream_id_type, const u8 *k,
448 const u8 *seq_num_m, const u8 *km, u8 *m_hash)
449 {
450 u8 aes_iv[HDCP2X_TX_AES128_SIZE];
451 u8 aes_key[HDCP2X_TX_AES128_SIZE];
452 u8 kd[HDCP2X_TX_DKEY_SIZE * HDCP2X_TX_AES128_SIZE];
453 u8 sha256_kd[HDCP2X_TX_SHA256_HASH_SIZE];
454 u8 hash_input[(HDCP_2_2_MAX_DEVICE_COUNT * HDCP_2_2_RECEIVER_ID_LEN) +
455 HDCP_2_2_RXINFO_LEN + HDCP_2_2_SEQ_NUM_LEN];
456 u16 stream_id_count;
457 int idx = 0;
458
459 stream_id_count = k[0] << BITS_PER_BYTE;
460 stream_id_count |= k[1];
461
462 memcpy(aes_key, km, HDCP2X_TX_KM_SIZE);
463 memcpy(aes_iv, r_tx, HDCP_2_2_RTX_LEN);
464 memcpy(&aes_iv[HDCP_2_2_RTX_LEN], r_rx, HDCP_2_2_RRX_LEN);
465
466 xlnx_hdcp2x_tx_aes128_encrypt(aes_iv, aes_key, kd);
467
468 /* Determine Dkey0. */
469 /* Add m = Rtx || Rrx. */
470 aes_iv[HDCP2X_TX_DKEY] ^= HDCP2X_TX_DKEY_CTR1;
471
472 xlnx_hdcp2x_tx_aes128_encrypt(aes_iv, aes_key, &kd[HDCP2X_TX_KM_SIZE]);
473
474 sha256(kd, sizeof(kd), sha256_kd);
475
476 /* Create hash with HMAC-SHA256. */
477 /* Input: StreamID_Type list || seq_num_M. */
478 memcpy(hash_input, stream_id_type, (stream_id_count * HDCP2X_TX_STREAMID_TYPE_SIZE));
479 idx += (stream_id_count * HDCP2X_TX_STREAMID_TYPE_SIZE);
480 memcpy(&hash_input[idx], seq_num_m, HDCP_2_2_SEQ_NUM_LEN);
481 idx += HDCP_2_2_SEQ_NUM_LEN;
482
483 /* HashKey: SHA256(Kd) */
484 xlnx_hdcp2x_cmn_hmac_sha256_hash(hash_input, idx, sha256_kd, sizeof(sha256_kd), m_hash);
485 }
486
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2025-01-11 11:08 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=202501111807.GgRdE5tE-lkp@intel.com \
--to=lkp@intel.com \
--cc=git@amd.com \
--cc=lakshmi.prasanna.eachuri@amd.com \
--cc=llvm@lists.linux.dev \
--cc=monstr@monstr.eu \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=vishal.sagar@amd.com \
/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 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.