Commit 033b5d6b authored by Jeffrey Kardatzke's avatar Jeffrey Kardatzke Committed by Chromium LUCI CQ

vaapi: Add pattern based decryption

This updates the Intel header file and also includes the Chrome change.

BUG=b:153111783
TEST=CBCS pattern based test content works

Change-Id: If9d5563b9de43b7ba4d48061ad1093fb0d3002ff
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2575824Reviewed-by: default avatarJ Kardatzke <jkardatzke@chromium.org>
Reviewed-by: default avatarMiguel Casas <mcasas@chromium.org>
Commit-Queue: Jeffrey Kardatzke <jkardatzke@google.com>
Cr-Commit-Position: refs/heads/master@{#834803}
parent 912cb135
......@@ -159,25 +159,21 @@ VaapiVideoDecoderDelegate::SetupDecryptDecode(
protected_session_state_ = ProtectedSessionState::kFailed;
return protected_session_state_;
}
// TODO(jkardatzke): Fix pattern based encryption after Intel updates their
// API.
VAEncryptionSegmentInfo segment_info;
segment_info.segment_start_offset = subsamples[0].clear_bytes;
segment_info.segment_length =
DecryptConfig::kDecryptionKeySize *
(decrypt_config_->encryption_pattern()->skip_byte_block() +
decrypt_config_->encryption_pattern()->crypt_byte_block());
segment_info.partial_aes_block_size = 0;
segment_info.init_byte_length =
DecryptConfig::kDecryptionKeySize *
crypto_params->blocks_stripe_encrypted =
decrypt_config_->encryption_pattern()->crypt_byte_block();
crypto_params->blocks_stripe_clear =
decrypt_config_->encryption_pattern()->skip_byte_block();
VAEncryptionSegmentInfo segment_info = {};
segment_info.init_byte_length = subsamples[0].clear_bytes;
segment_info.segment_length =
subsamples[0].clear_bytes + subsamples[0].cypher_bytes;
memcpy(segment_info.aes_cbc_iv_or_ctr, decrypt_config_->iv().data(),
DecryptConfig::kDecryptionKeySize);
segments->emplace_back(std::move(segment_info));
} else {
size_t offset = 0;
for (const auto& entry : subsamples) {
VAEncryptionSegmentInfo segment_info;
VAEncryptionSegmentInfo segment_info = {};
segment_info.segment_start_offset = offset;
segment_info.segment_length = entry.clear_bytes + entry.cypher_bytes;
segment_info.partial_aes_block_size = 0;
......
......@@ -178,7 +178,7 @@ typedef struct _VAEncryptionSegmentInfo {
uint32_t va_reserved[VA_PADDING_MEDIUM];
} VAEncryptionSegmentInfo;
/** \brief encrytpion parameters, corresonding to
/** \brief encryption parameters, corresponding to
* #VAEncryptionParameterBufferType*/
typedef struct _VAEncryptionParameters {
/** \brief Encryption type, attribute values. */
......@@ -197,6 +197,21 @@ typedef struct _VAEncryptionParameters {
uint8_t wrapped_decrypt_blob[16];
/** \brief Wrapped Key blob info (Sne)kb */
uint8_t wrapped_encrypt_blob[16];
/** \brief Indicates the number of 16-byte BLOCKS that are encrypted in any
* given encrypted region of segments.
* If this value is zero:
* 1. All bytes in encrypted region of segments are encrypted, i.e. the
* CENC or CBC1 scheme is being used
* 2. blocks_stripe_clear must also be zero.
* If this value is non-zero, blocks_stripe_clear must also be non-zero. */
uint32_t blocks_stripe_encrypted;
/** \brief Indicates the number of 16-byte BLOCKS that are clear in any given
* encrypted region of segments, as defined by the CENS and CBCS schemes in
* the common encryption spec.
* If this value is zero, all bytes in encrypted region of segments are
* encrypted, i.e. the CENC or CBC1 scheme is being used.
*/
uint32_t blocks_stripe_clear;
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_MEDIUM];
} VAEncryptionParameters;
......@@ -215,7 +230,7 @@ typedef struct _VA_PROTECTED_BLT_PARAMS {
void* reserved_extension; // The reserved extension for future BLT operations
} VA_PROTECTED_BLT_PARAMS;
/** \brief cenc status parameters, corresonding to
/** \brief cenc status parameters, corresponding to
* #VACencStatusParameterBufferType*/
typedef struct _VACencStatusParameters {
/** \brief The status report index feedback. */
......@@ -485,7 +500,7 @@ typedef enum {
/** \brief Buffer for CENC status reporting*/
typedef struct _VACencStatusBuf {
/** \brief Encryption status. VA_ENCRYPTION_STATUS_SUCCESSFUL if
* hardware has returned detailed inforamtion, others mean the
* hardware has returned detailed information, others mean the
* CENC result is invalid */
VAEncryptionStatus status;
/* \brief feedback of status report index
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment