2 * Copyright 2018 Advanced Micro Devices, Inc.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
26 #define MAX_NUM_DISPLAYS 24
34 static void hdcp2_message_init(struct mod_hdcp
*hdcp
,
35 struct ta_hdcp_cmd_hdcp2_process_prepare_authentication_message_input_v2
*in
)
37 in
->session_handle
= hdcp
->auth
.id
;
38 in
->prepare
.msg1_id
= TA_HDCP_HDCP2_MSG_ID__NULL_MESSAGE
;
39 in
->prepare
.msg2_id
= TA_HDCP_HDCP2_MSG_ID__NULL_MESSAGE
;
40 in
->process
.msg1_desc
.msg_id
= TA_HDCP_HDCP2_MSG_ID__NULL_MESSAGE
;
41 in
->process
.msg1_desc
.msg_size
= 0;
42 in
->process
.msg2_desc
.msg_id
= TA_HDCP_HDCP2_MSG_ID__NULL_MESSAGE
;
43 in
->process
.msg2_desc
.msg_size
= 0;
44 in
->process
.msg3_desc
.msg_id
= TA_HDCP_HDCP2_MSG_ID__NULL_MESSAGE
;
45 in
->process
.msg3_desc
.msg_size
= 0;
47 enum mod_hdcp_status
mod_hdcp_remove_display_topology(struct mod_hdcp
*hdcp
)
50 struct psp_context
*psp
= hdcp
->config
.psp
.handle
;
51 struct ta_dtm_shared_memory
*dtm_cmd
;
52 struct mod_hdcp_display
*display
= NULL
;
55 dtm_cmd
= (struct ta_dtm_shared_memory
*)psp
->dtm_context
.dtm_shared_buf
;
57 for (i
= 0; i
< MAX_NUM_OF_DISPLAYS
; i
++) {
58 if (is_display_added(&(hdcp
->connection
.displays
[i
]))) {
60 memset(dtm_cmd
, 0, sizeof(struct ta_dtm_shared_memory
));
62 display
= &hdcp
->connection
.displays
[i
];
64 dtm_cmd
->cmd_id
= TA_DTM_COMMAND__TOPOLOGY_UPDATE_V2
;
65 dtm_cmd
->dtm_in_message
.topology_update_v2
.display_handle
= display
->index
;
66 dtm_cmd
->dtm_in_message
.topology_update_v2
.is_active
= 0;
67 dtm_cmd
->dtm_status
= TA_DTM_STATUS__GENERIC_FAILURE
;
69 psp_dtm_invoke(psp
, dtm_cmd
->cmd_id
);
71 if (dtm_cmd
->dtm_status
!= TA_DTM_STATUS__SUCCESS
)
72 return MOD_HDCP_STATUS_UPDATE_TOPOLOGY_FAILURE
;
74 display
->state
= MOD_HDCP_DISPLAY_ACTIVE
;
75 HDCP_TOP_REMOVE_DISPLAY_TRACE(hdcp
, display
->index
);
79 return MOD_HDCP_STATUS_SUCCESS
;
82 enum mod_hdcp_status
mod_hdcp_add_display_topology(struct mod_hdcp
*hdcp
)
84 struct psp_context
*psp
= hdcp
->config
.psp
.handle
;
85 struct ta_dtm_shared_memory
*dtm_cmd
;
86 struct mod_hdcp_display
*display
= NULL
;
87 struct mod_hdcp_link
*link
= &hdcp
->connection
.link
;
90 if (!psp
->dtm_context
.dtm_initialized
) {
91 DRM_ERROR("Failed to add display topology, DTM TA is not initialized.");
92 return MOD_HDCP_STATUS_FAILURE
;
95 dtm_cmd
= (struct ta_dtm_shared_memory
*)psp
->dtm_context
.dtm_shared_buf
;
97 for (i
= 0; i
< MAX_NUM_OF_DISPLAYS
; i
++) {
98 if (hdcp
->connection
.displays
[i
].state
== MOD_HDCP_DISPLAY_ACTIVE
) {
99 display
= &hdcp
->connection
.displays
[i
];
101 memset(dtm_cmd
, 0, sizeof(struct ta_dtm_shared_memory
));
103 dtm_cmd
->cmd_id
= TA_DTM_COMMAND__TOPOLOGY_UPDATE_V2
;
104 dtm_cmd
->dtm_in_message
.topology_update_v2
.display_handle
= display
->index
;
105 dtm_cmd
->dtm_in_message
.topology_update_v2
.is_active
= 1;
106 dtm_cmd
->dtm_in_message
.topology_update_v2
.controller
= display
->controller
;
107 dtm_cmd
->dtm_in_message
.topology_update_v2
.ddc_line
= link
->ddc_line
;
108 dtm_cmd
->dtm_in_message
.topology_update_v2
.dig_be
= link
->dig_be
;
109 dtm_cmd
->dtm_in_message
.topology_update_v2
.dig_fe
= display
->dig_fe
;
110 dtm_cmd
->dtm_in_message
.topology_update_v2
.dp_mst_vcid
= display
->vc_id
;
111 dtm_cmd
->dtm_in_message
.topology_update_v2
.max_hdcp_supported_version
=
112 TA_DTM_HDCP_VERSION_MAX_SUPPORTED__2_2
;
113 dtm_cmd
->dtm_status
= TA_DTM_STATUS__GENERIC_FAILURE
;
115 psp_dtm_invoke(psp
, dtm_cmd
->cmd_id
);
117 if (dtm_cmd
->dtm_status
!= TA_DTM_STATUS__SUCCESS
)
118 return MOD_HDCP_STATUS_UPDATE_TOPOLOGY_FAILURE
;
120 display
->state
= MOD_HDCP_DISPLAY_ACTIVE_AND_ADDED
;
121 HDCP_TOP_ADD_DISPLAY_TRACE(hdcp
, display
->index
);
125 return MOD_HDCP_STATUS_SUCCESS
;
128 enum mod_hdcp_status
mod_hdcp_hdcp1_create_session(struct mod_hdcp
*hdcp
)
131 struct psp_context
*psp
= hdcp
->config
.psp
.handle
;
132 struct mod_hdcp_display
*display
= get_first_added_display(hdcp
);
133 struct ta_hdcp_shared_memory
*hdcp_cmd
;
135 if (!psp
->hdcp_context
.hdcp_initialized
) {
136 DRM_ERROR("Failed to create hdcp session. HDCP TA is not initialized.");
137 return MOD_HDCP_STATUS_FAILURE
;
140 hdcp_cmd
= (struct ta_hdcp_shared_memory
*)psp
->hdcp_context
.hdcp_shared_buf
;
141 memset(hdcp_cmd
, 0, sizeof(struct ta_hdcp_shared_memory
));
143 hdcp_cmd
->in_msg
.hdcp1_create_session
.display_handle
= display
->index
;
144 hdcp_cmd
->cmd_id
= TA_HDCP_COMMAND__HDCP1_CREATE_SESSION
;
146 psp_hdcp_invoke(psp
, hdcp_cmd
->cmd_id
);
148 hdcp
->auth
.id
= hdcp_cmd
->out_msg
.hdcp1_create_session
.session_handle
;
150 if (hdcp_cmd
->hdcp_status
!= TA_HDCP_STATUS__SUCCESS
)
151 return MOD_HDCP_STATUS_HDCP1_CREATE_SESSION_FAILURE
;
153 hdcp
->auth
.msg
.hdcp1
.ainfo
= hdcp_cmd
->out_msg
.hdcp1_create_session
.ainfo_primary
;
154 memcpy(hdcp
->auth
.msg
.hdcp1
.aksv
, hdcp_cmd
->out_msg
.hdcp1_create_session
.aksv_primary
,
155 sizeof(hdcp
->auth
.msg
.hdcp1
.aksv
));
156 memcpy(hdcp
->auth
.msg
.hdcp1
.an
, hdcp_cmd
->out_msg
.hdcp1_create_session
.an_primary
,
157 sizeof(hdcp
->auth
.msg
.hdcp1
.an
));
159 return MOD_HDCP_STATUS_SUCCESS
;
162 enum mod_hdcp_status
mod_hdcp_hdcp1_destroy_session(struct mod_hdcp
*hdcp
)
165 struct psp_context
*psp
= hdcp
->config
.psp
.handle
;
166 struct ta_hdcp_shared_memory
*hdcp_cmd
;
168 hdcp_cmd
= (struct ta_hdcp_shared_memory
*)psp
->hdcp_context
.hdcp_shared_buf
;
169 memset(hdcp_cmd
, 0, sizeof(struct ta_hdcp_shared_memory
));
171 hdcp_cmd
->in_msg
.hdcp1_destroy_session
.session_handle
= hdcp
->auth
.id
;
172 hdcp_cmd
->cmd_id
= TA_HDCP_COMMAND__HDCP1_DESTROY_SESSION
;
174 psp_hdcp_invoke(psp
, hdcp_cmd
->cmd_id
);
176 if (hdcp_cmd
->hdcp_status
!= TA_HDCP_STATUS__SUCCESS
)
177 return MOD_HDCP_STATUS_HDCP1_DESTROY_SESSION_FAILURE
;
179 HDCP_TOP_HDCP1_DESTROY_SESSION_TRACE(hdcp
);
181 return MOD_HDCP_STATUS_SUCCESS
;
184 enum mod_hdcp_status
mod_hdcp_hdcp1_validate_rx(struct mod_hdcp
*hdcp
)
186 struct psp_context
*psp
= hdcp
->config
.psp
.handle
;
187 struct ta_hdcp_shared_memory
*hdcp_cmd
;
189 hdcp_cmd
= (struct ta_hdcp_shared_memory
*)psp
->hdcp_context
.hdcp_shared_buf
;
190 memset(hdcp_cmd
, 0, sizeof(struct ta_hdcp_shared_memory
));
192 hdcp_cmd
->in_msg
.hdcp1_first_part_authentication
.session_handle
= hdcp
->auth
.id
;
194 memcpy(hdcp_cmd
->in_msg
.hdcp1_first_part_authentication
.bksv_primary
, hdcp
->auth
.msg
.hdcp1
.bksv
,
195 TA_HDCP__HDCP1_KSV_SIZE
);
197 hdcp_cmd
->in_msg
.hdcp1_first_part_authentication
.r0_prime_primary
= hdcp
->auth
.msg
.hdcp1
.r0p
;
198 hdcp_cmd
->in_msg
.hdcp1_first_part_authentication
.bcaps
= hdcp
->auth
.msg
.hdcp1
.bcaps
;
199 hdcp_cmd
->cmd_id
= TA_HDCP_COMMAND__HDCP1_FIRST_PART_AUTHENTICATION
;
201 psp_hdcp_invoke(psp
, hdcp_cmd
->cmd_id
);
203 if (hdcp_cmd
->hdcp_status
!= TA_HDCP_STATUS__SUCCESS
)
204 return MOD_HDCP_STATUS_HDCP1_VALIDATE_RX_FAILURE
;
206 if (hdcp_cmd
->out_msg
.hdcp1_first_part_authentication
.authentication_status
==
207 TA_HDCP_AUTHENTICATION_STATUS__HDCP1_FIRST_PART_COMPLETE
) {
208 /* needs second part of authentication */
209 hdcp
->connection
.is_repeater
= 1;
210 } else if (hdcp_cmd
->out_msg
.hdcp1_first_part_authentication
.authentication_status
==
211 TA_HDCP_AUTHENTICATION_STATUS__HDCP1_AUTHENTICATED
) {
212 hdcp
->connection
.is_repeater
= 0;
214 return MOD_HDCP_STATUS_HDCP1_VALIDATE_RX_FAILURE
;
217 return MOD_HDCP_STATUS_SUCCESS
;
220 enum mod_hdcp_status
mod_hdcp_hdcp1_enable_encryption(struct mod_hdcp
*hdcp
)
222 struct psp_context
*psp
= hdcp
->config
.psp
.handle
;
223 struct ta_hdcp_shared_memory
*hdcp_cmd
;
224 struct mod_hdcp_display
*display
= get_first_added_display(hdcp
);
226 hdcp_cmd
= (struct ta_hdcp_shared_memory
*)psp
->hdcp_context
.hdcp_shared_buf
;
227 memset(hdcp_cmd
, 0, sizeof(struct ta_hdcp_shared_memory
));
229 hdcp_cmd
->in_msg
.hdcp1_enable_encryption
.session_handle
= hdcp
->auth
.id
;
230 hdcp_cmd
->cmd_id
= TA_HDCP_COMMAND__HDCP1_ENABLE_ENCRYPTION
;
232 psp_hdcp_invoke(psp
, hdcp_cmd
->cmd_id
);
234 if (hdcp_cmd
->hdcp_status
!= TA_HDCP_STATUS__SUCCESS
)
235 return MOD_HDCP_STATUS_HDCP1_ENABLE_ENCRYPTION
;
237 if (!is_dp_mst_hdcp(hdcp
)) {
238 display
->state
= MOD_HDCP_DISPLAY_ENCRYPTION_ENABLED
;
239 HDCP_HDCP1_ENABLED_TRACE(hdcp
, display
->index
);
241 return MOD_HDCP_STATUS_SUCCESS
;
244 enum mod_hdcp_status
mod_hdcp_hdcp1_validate_ksvlist_vp(struct mod_hdcp
*hdcp
)
246 struct psp_context
*psp
= hdcp
->config
.psp
.handle
;
247 struct ta_hdcp_shared_memory
*hdcp_cmd
;
249 hdcp_cmd
= (struct ta_hdcp_shared_memory
*)psp
->hdcp_context
.hdcp_shared_buf
;
250 memset(hdcp_cmd
, 0, sizeof(struct ta_hdcp_shared_memory
));
252 hdcp_cmd
->in_msg
.hdcp1_second_part_authentication
.session_handle
= hdcp
->auth
.id
;
254 hdcp_cmd
->in_msg
.hdcp1_second_part_authentication
.ksv_list_size
= hdcp
->auth
.msg
.hdcp1
.ksvlist_size
;
255 memcpy(hdcp_cmd
->in_msg
.hdcp1_second_part_authentication
.ksv_list
, hdcp
->auth
.msg
.hdcp1
.ksvlist
,
256 hdcp
->auth
.msg
.hdcp1
.ksvlist_size
);
258 memcpy(hdcp_cmd
->in_msg
.hdcp1_second_part_authentication
.v_prime
, hdcp
->auth
.msg
.hdcp1
.vp
,
259 sizeof(hdcp
->auth
.msg
.hdcp1
.vp
));
261 hdcp_cmd
->in_msg
.hdcp1_second_part_authentication
.bstatus_binfo
=
262 is_dp_hdcp(hdcp
) ? hdcp
->auth
.msg
.hdcp1
.binfo_dp
: hdcp
->auth
.msg
.hdcp1
.bstatus
;
263 hdcp_cmd
->cmd_id
= TA_HDCP_COMMAND__HDCP1_SECOND_PART_AUTHENTICATION
;
265 psp_hdcp_invoke(psp
, hdcp_cmd
->cmd_id
);
267 if (hdcp_cmd
->hdcp_status
!= TA_HDCP_STATUS__SUCCESS
)
268 return MOD_HDCP_STATUS_HDCP1_VALIDATE_KSV_LIST_FAILURE
;
270 return MOD_HDCP_STATUS_SUCCESS
;
273 enum mod_hdcp_status
mod_hdcp_hdcp1_enable_dp_stream_encryption(struct mod_hdcp
*hdcp
)
276 struct psp_context
*psp
= hdcp
->config
.psp
.handle
;
277 struct ta_hdcp_shared_memory
*hdcp_cmd
;
280 hdcp_cmd
= (struct ta_hdcp_shared_memory
*)psp
->hdcp_context
.hdcp_shared_buf
;
282 for (i
= 0; i
< MAX_NUM_OF_DISPLAYS
; i
++) {
284 if (hdcp
->connection
.displays
[i
].state
!= MOD_HDCP_DISPLAY_ACTIVE_AND_ADDED
||
285 hdcp
->connection
.displays
[i
].adjust
.disable
)
288 memset(hdcp_cmd
, 0, sizeof(struct ta_hdcp_shared_memory
));
290 hdcp_cmd
->in_msg
.hdcp1_enable_dp_stream_encryption
.session_handle
= hdcp
->auth
.id
;
291 hdcp_cmd
->in_msg
.hdcp1_enable_dp_stream_encryption
.display_handle
= hdcp
->connection
.displays
[i
].index
;
292 hdcp_cmd
->cmd_id
= TA_HDCP_COMMAND__HDCP1_ENABLE_DP_STREAM_ENCRYPTION
;
294 psp_hdcp_invoke(psp
, hdcp_cmd
->cmd_id
);
296 if (hdcp_cmd
->hdcp_status
!= TA_HDCP_STATUS__SUCCESS
)
297 return MOD_HDCP_STATUS_HDCP1_ENABLE_STREAM_ENCRYPTION_FAILURE
;
299 hdcp
->connection
.displays
[i
].state
= MOD_HDCP_DISPLAY_ENCRYPTION_ENABLED
;
300 HDCP_HDCP1_ENABLED_TRACE(hdcp
, hdcp
->connection
.displays
[i
].index
);
303 return MOD_HDCP_STATUS_SUCCESS
;
306 enum mod_hdcp_status
mod_hdcp_hdcp1_link_maintenance(struct mod_hdcp
*hdcp
)
308 struct psp_context
*psp
= hdcp
->config
.psp
.handle
;
309 struct ta_hdcp_shared_memory
*hdcp_cmd
;
311 hdcp_cmd
= (struct ta_hdcp_shared_memory
*)psp
->hdcp_context
.hdcp_shared_buf
;
313 memset(hdcp_cmd
, 0, sizeof(struct ta_hdcp_shared_memory
));
315 hdcp_cmd
->in_msg
.hdcp1_get_encryption_status
.session_handle
= hdcp
->auth
.id
;
317 hdcp_cmd
->out_msg
.hdcp1_get_encryption_status
.protection_level
= 0;
318 hdcp_cmd
->cmd_id
= TA_HDCP_COMMAND__HDCP1_GET_ENCRYPTION_STATUS
;
320 psp_hdcp_invoke(psp
, hdcp_cmd
->cmd_id
);
322 if (hdcp_cmd
->hdcp_status
!= TA_HDCP_STATUS__SUCCESS
)
323 return MOD_HDCP_STATUS_HDCP1_LINK_MAINTENANCE_FAILURE
;
325 return (hdcp_cmd
->out_msg
.hdcp1_get_encryption_status
.protection_level
== 1)
326 ? MOD_HDCP_STATUS_SUCCESS
327 : MOD_HDCP_STATUS_HDCP1_LINK_MAINTENANCE_FAILURE
;
330 enum mod_hdcp_status
mod_hdcp_hdcp1_get_link_encryption_status(struct mod_hdcp
*hdcp
,
331 enum mod_hdcp_encryption_status
*encryption_status
)
333 *encryption_status
= MOD_HDCP_ENCRYPTION_STATUS_HDCP_OFF
;
335 if (mod_hdcp_hdcp1_link_maintenance(hdcp
) != MOD_HDCP_STATUS_SUCCESS
)
336 return MOD_HDCP_STATUS_FAILURE
;
338 *encryption_status
= MOD_HDCP_ENCRYPTION_STATUS_HDCP1_ON
;
340 return MOD_HDCP_STATUS_SUCCESS
;
343 enum mod_hdcp_status
mod_hdcp_hdcp2_create_session(struct mod_hdcp
*hdcp
)
345 struct psp_context
*psp
= hdcp
->config
.psp
.handle
;
346 struct ta_hdcp_shared_memory
*hdcp_cmd
;
347 struct mod_hdcp_display
*display
= get_first_added_display(hdcp
);
349 if (!psp
->hdcp_context
.hdcp_initialized
) {
350 DRM_ERROR("Failed to create hdcp session, HDCP TA is not initialized");
351 return MOD_HDCP_STATUS_FAILURE
;
354 hdcp_cmd
= (struct ta_hdcp_shared_memory
*)psp
->hdcp_context
.hdcp_shared_buf
;
355 memset(hdcp_cmd
, 0, sizeof(struct ta_hdcp_shared_memory
));
358 return MOD_HDCP_STATUS_DISPLAY_NOT_FOUND
;
360 hdcp_cmd
->in_msg
.hdcp2_create_session_v2
.display_handle
= display
->index
;
362 if (hdcp
->connection
.link
.adjust
.hdcp2
.force_type
== MOD_HDCP_FORCE_TYPE_0
)
363 hdcp_cmd
->in_msg
.hdcp2_create_session_v2
.negotiate_content_type
=
364 TA_HDCP2_CONTENT_TYPE_NEGOTIATION_TYPE__FORCE_TYPE0
;
365 else if (hdcp
->connection
.link
.adjust
.hdcp2
.force_type
== MOD_HDCP_FORCE_TYPE_1
)
366 hdcp_cmd
->in_msg
.hdcp2_create_session_v2
.negotiate_content_type
=
367 TA_HDCP2_CONTENT_TYPE_NEGOTIATION_TYPE__FORCE_TYPE1
;
368 else if (hdcp
->connection
.link
.adjust
.hdcp2
.force_type
== MOD_HDCP_FORCE_TYPE_MAX
)
369 hdcp_cmd
->in_msg
.hdcp2_create_session_v2
.negotiate_content_type
=
370 TA_HDCP2_CONTENT_TYPE_NEGOTIATION_TYPE__MAX_SUPPORTED
;
372 hdcp_cmd
->cmd_id
= TA_HDCP_COMMAND__HDCP2_CREATE_SESSION_V2
;
374 psp_hdcp_invoke(psp
, hdcp_cmd
->cmd_id
);
376 if (hdcp_cmd
->hdcp_status
!= TA_HDCP_STATUS__SUCCESS
)
377 return MOD_HDCP_STATUS_HDCP2_CREATE_SESSION_FAILURE
;
379 hdcp
->auth
.id
= hdcp_cmd
->out_msg
.hdcp2_create_session_v2
.session_handle
;
381 return MOD_HDCP_STATUS_SUCCESS
;
384 enum mod_hdcp_status
mod_hdcp_hdcp2_destroy_session(struct mod_hdcp
*hdcp
)
386 struct psp_context
*psp
= hdcp
->config
.psp
.handle
;
387 struct ta_hdcp_shared_memory
*hdcp_cmd
;
389 hdcp_cmd
= (struct ta_hdcp_shared_memory
*)psp
->hdcp_context
.hdcp_shared_buf
;
390 memset(hdcp_cmd
, 0, sizeof(struct ta_hdcp_shared_memory
));
392 hdcp_cmd
->in_msg
.hdcp2_destroy_session
.session_handle
= hdcp
->auth
.id
;
393 hdcp_cmd
->cmd_id
= TA_HDCP_COMMAND__HDCP2_DESTROY_SESSION
;
395 psp_hdcp_invoke(psp
, hdcp_cmd
->cmd_id
);
397 if (hdcp_cmd
->hdcp_status
!= TA_HDCP_STATUS__SUCCESS
)
398 return MOD_HDCP_STATUS_HDCP2_DESTROY_SESSION_FAILURE
;
400 HDCP_TOP_HDCP2_DESTROY_SESSION_TRACE(hdcp
);
402 return MOD_HDCP_STATUS_SUCCESS
;
405 enum mod_hdcp_status
mod_hdcp_hdcp2_prepare_ake_init(struct mod_hdcp
*hdcp
)
407 struct psp_context
*psp
= hdcp
->config
.psp
.handle
;
408 struct ta_hdcp_shared_memory
*hdcp_cmd
;
409 struct ta_hdcp_cmd_hdcp2_process_prepare_authentication_message_input_v2
*msg_in
;
410 struct ta_hdcp_cmd_hdcp2_process_prepare_authentication_message_output_v2
*msg_out
;
412 hdcp_cmd
= (struct ta_hdcp_shared_memory
*)psp
->hdcp_context
.hdcp_shared_buf
;
413 memset(hdcp_cmd
, 0, sizeof(struct ta_hdcp_shared_memory
));
415 msg_in
= &hdcp_cmd
->in_msg
.hdcp2_prepare_process_authentication_message_v2
;
416 msg_out
= &hdcp_cmd
->out_msg
.hdcp2_prepare_process_authentication_message_v2
;
418 hdcp2_message_init(hdcp
, msg_in
);
420 hdcp_cmd
->cmd_id
= TA_HDCP_COMMAND__HDCP2_PREPARE_PROCESS_AUTHENTICATION_MSG_V2
;
421 msg_in
->prepare
.msg1_id
= TA_HDCP_HDCP2_MSG_ID__AKE_INIT
;
423 psp_hdcp_invoke(psp
, hdcp_cmd
->cmd_id
);
425 if (hdcp_cmd
->hdcp_status
!= TA_HDCP_STATUS__SUCCESS
)
426 return MOD_HDCP_STATUS_HDCP2_PREP_AKE_INIT_FAILURE
;
428 memcpy(&hdcp
->auth
.msg
.hdcp2
.ake_init
[0], &msg_out
->prepare
.transmitter_message
[0],
429 sizeof(hdcp
->auth
.msg
.hdcp2
.ake_init
));
431 return MOD_HDCP_STATUS_SUCCESS
;
434 enum mod_hdcp_status
mod_hdcp_hdcp2_validate_ake_cert(struct mod_hdcp
*hdcp
)
436 struct psp_context
*psp
= hdcp
->config
.psp
.handle
;
437 struct ta_hdcp_shared_memory
*hdcp_cmd
;
438 struct ta_hdcp_cmd_hdcp2_process_prepare_authentication_message_input_v2
*msg_in
;
439 struct ta_hdcp_cmd_hdcp2_process_prepare_authentication_message_output_v2
*msg_out
;
441 hdcp_cmd
= (struct ta_hdcp_shared_memory
*)psp
->hdcp_context
.hdcp_shared_buf
;
442 memset(hdcp_cmd
, 0, sizeof(struct ta_hdcp_shared_memory
));
444 msg_in
= &hdcp_cmd
->in_msg
.hdcp2_prepare_process_authentication_message_v2
;
445 msg_out
= &hdcp_cmd
->out_msg
.hdcp2_prepare_process_authentication_message_v2
;
447 hdcp2_message_init(hdcp
, msg_in
);
449 msg_in
->process
.msg1_desc
.msg_id
= TA_HDCP_HDCP2_MSG_ID__AKE_SEND_CERT
;
450 msg_in
->process
.msg1_desc
.msg_size
= TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__AKE_SEND_CERT
;
452 memcpy(&msg_in
->process
.receiver_message
[0], hdcp
->auth
.msg
.hdcp2
.ake_cert
,
453 sizeof(hdcp
->auth
.msg
.hdcp2
.ake_cert
));
455 msg_in
->prepare
.msg1_id
= TA_HDCP_HDCP2_MSG_ID__AKE_NO_STORED_KM
;
456 msg_in
->prepare
.msg2_id
= TA_HDCP_HDCP2_MSG_ID__AKE_STORED_KM
;
458 hdcp_cmd
->cmd_id
= TA_HDCP_COMMAND__HDCP2_PREPARE_PROCESS_AUTHENTICATION_MSG_V2
;
460 psp_hdcp_invoke(psp
, hdcp_cmd
->cmd_id
);
462 if (hdcp_cmd
->hdcp_status
!= TA_HDCP_STATUS__SUCCESS
)
463 return MOD_HDCP_STATUS_HDCP2_VALIDATE_AKE_CERT_FAILURE
;
465 memcpy(hdcp
->auth
.msg
.hdcp2
.ake_no_stored_km
, &msg_out
->prepare
.transmitter_message
[0],
466 sizeof(hdcp
->auth
.msg
.hdcp2
.ake_no_stored_km
));
468 memcpy(hdcp
->auth
.msg
.hdcp2
.ake_stored_km
,
469 &msg_out
->prepare
.transmitter_message
[sizeof(hdcp
->auth
.msg
.hdcp2
.ake_no_stored_km
)],
470 sizeof(hdcp
->auth
.msg
.hdcp2
.ake_stored_km
));
472 if (msg_out
->process
.msg1_status
== TA_HDCP2_MSG_AUTHENTICATION_STATUS__SUCCESS
) {
473 hdcp
->connection
.is_km_stored
= msg_out
->process
.is_km_stored
? 1 : 0;
474 hdcp
->connection
.is_repeater
= msg_out
->process
.is_repeater
? 1 : 0;
475 return MOD_HDCP_STATUS_SUCCESS
;
478 return MOD_HDCP_STATUS_FAILURE
;
481 enum mod_hdcp_status
mod_hdcp_hdcp2_validate_h_prime(struct mod_hdcp
*hdcp
)
483 struct psp_context
*psp
= hdcp
->config
.psp
.handle
;
484 struct ta_hdcp_shared_memory
*hdcp_cmd
;
485 struct ta_hdcp_cmd_hdcp2_process_prepare_authentication_message_input_v2
*msg_in
;
486 struct ta_hdcp_cmd_hdcp2_process_prepare_authentication_message_output_v2
*msg_out
;
488 hdcp_cmd
= (struct ta_hdcp_shared_memory
*)psp
->hdcp_context
.hdcp_shared_buf
;
489 memset(hdcp_cmd
, 0, sizeof(struct ta_hdcp_shared_memory
));
491 msg_in
= &hdcp_cmd
->in_msg
.hdcp2_prepare_process_authentication_message_v2
;
492 msg_out
= &hdcp_cmd
->out_msg
.hdcp2_prepare_process_authentication_message_v2
;
494 hdcp2_message_init(hdcp
, msg_in
);
496 msg_in
->process
.msg1_desc
.msg_id
= TA_HDCP_HDCP2_MSG_ID__AKE_SEND_H_PRIME
;
497 msg_in
->process
.msg1_desc
.msg_size
= TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__AKE_SEND_H_PRIME
;
499 memcpy(&msg_in
->process
.receiver_message
[0], hdcp
->auth
.msg
.hdcp2
.ake_h_prime
,
500 sizeof(hdcp
->auth
.msg
.hdcp2
.ake_h_prime
));
502 if (!hdcp
->connection
.is_km_stored
) {
503 msg_in
->process
.msg2_desc
.msg_id
= TA_HDCP_HDCP2_MSG_ID__AKE_SEND_PAIRING_INFO
;
504 msg_in
->process
.msg2_desc
.msg_size
= TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__AKE_SEND_PAIRING_INFO
;
505 memcpy(&msg_in
->process
.receiver_message
[sizeof(hdcp
->auth
.msg
.hdcp2
.ake_h_prime
)],
506 hdcp
->auth
.msg
.hdcp2
.ake_pairing_info
, sizeof(hdcp
->auth
.msg
.hdcp2
.ake_pairing_info
));
509 hdcp_cmd
->cmd_id
= TA_HDCP_COMMAND__HDCP2_PREPARE_PROCESS_AUTHENTICATION_MSG_V2
;
511 psp_hdcp_invoke(psp
, hdcp_cmd
->cmd_id
);
513 if (hdcp_cmd
->hdcp_status
!= TA_HDCP_STATUS__SUCCESS
)
514 return MOD_HDCP_STATUS_HDCP2_VALIDATE_H_PRIME_FAILURE
;
516 if (msg_out
->process
.msg1_status
!= TA_HDCP2_MSG_AUTHENTICATION_STATUS__SUCCESS
)
517 return MOD_HDCP_STATUS_HDCP2_VALIDATE_H_PRIME_FAILURE
;
518 else if (!hdcp
->connection
.is_km_stored
&&
519 msg_out
->process
.msg2_status
!= TA_HDCP2_MSG_AUTHENTICATION_STATUS__SUCCESS
)
520 return MOD_HDCP_STATUS_HDCP2_VALIDATE_PAIRING_INFO_FAILURE
;
523 return MOD_HDCP_STATUS_SUCCESS
;
526 enum mod_hdcp_status
mod_hdcp_hdcp2_prepare_lc_init(struct mod_hdcp
*hdcp
)
528 struct psp_context
*psp
= hdcp
->config
.psp
.handle
;
529 struct ta_hdcp_shared_memory
*hdcp_cmd
;
530 struct ta_hdcp_cmd_hdcp2_process_prepare_authentication_message_input_v2
*msg_in
;
531 struct ta_hdcp_cmd_hdcp2_process_prepare_authentication_message_output_v2
*msg_out
;
533 hdcp_cmd
= (struct ta_hdcp_shared_memory
*)psp
->hdcp_context
.hdcp_shared_buf
;
534 memset(hdcp_cmd
, 0, sizeof(struct ta_hdcp_shared_memory
));
536 msg_in
= &hdcp_cmd
->in_msg
.hdcp2_prepare_process_authentication_message_v2
;
537 msg_out
= &hdcp_cmd
->out_msg
.hdcp2_prepare_process_authentication_message_v2
;
539 hdcp2_message_init(hdcp
, msg_in
);
541 msg_in
->prepare
.msg1_id
= TA_HDCP_HDCP2_MSG_ID__LC_INIT
;
543 hdcp_cmd
->cmd_id
= TA_HDCP_COMMAND__HDCP2_PREPARE_PROCESS_AUTHENTICATION_MSG_V2
;
545 psp_hdcp_invoke(psp
, hdcp_cmd
->cmd_id
);
547 if (hdcp_cmd
->hdcp_status
!= TA_HDCP_STATUS__SUCCESS
)
548 return MOD_HDCP_STATUS_HDCP2_PREP_LC_INIT_FAILURE
;
550 memcpy(hdcp
->auth
.msg
.hdcp2
.lc_init
, &msg_out
->prepare
.transmitter_message
[0],
551 sizeof(hdcp
->auth
.msg
.hdcp2
.lc_init
));
553 return MOD_HDCP_STATUS_SUCCESS
;
556 enum mod_hdcp_status
mod_hdcp_hdcp2_validate_l_prime(struct mod_hdcp
*hdcp
)
558 struct psp_context
*psp
= hdcp
->config
.psp
.handle
;
559 struct ta_hdcp_shared_memory
*hdcp_cmd
;
560 struct ta_hdcp_cmd_hdcp2_process_prepare_authentication_message_input_v2
*msg_in
;
561 struct ta_hdcp_cmd_hdcp2_process_prepare_authentication_message_output_v2
*msg_out
;
563 hdcp_cmd
= (struct ta_hdcp_shared_memory
*)psp
->hdcp_context
.hdcp_shared_buf
;
564 memset(hdcp_cmd
, 0, sizeof(struct ta_hdcp_shared_memory
));
566 msg_in
= &hdcp_cmd
->in_msg
.hdcp2_prepare_process_authentication_message_v2
;
567 msg_out
= &hdcp_cmd
->out_msg
.hdcp2_prepare_process_authentication_message_v2
;
569 hdcp2_message_init(hdcp
, msg_in
);
571 msg_in
->process
.msg1_desc
.msg_id
= TA_HDCP_HDCP2_MSG_ID__LC_SEND_L_PRIME
;
572 msg_in
->process
.msg1_desc
.msg_size
= TA_HDCP_HDCP2_MSG_ID_MAX_SIZE__LC_SEND_L_PRIME
;
574 memcpy(&msg_in
->process
.receiver_message
[0], hdcp
->auth
.msg
.hdcp2
.lc_l_prime
,
575 sizeof(hdcp
->auth
.msg
.hdcp2
.lc_l_prime
));
577 hdcp_cmd
->cmd_id
= TA_HDCP_COMMAND__HDCP2_PREPARE_PROCESS_AUTHENTICATION_MSG_V2
;
579 psp_hdcp_invoke(psp
, hdcp_cmd
->cmd_id
);
581 if (hdcp_cmd
->hdcp_status
!= TA_HDCP_STATUS__SUCCESS
)
582 return MOD_HDCP_STATUS_HDCP2_VALIDATE_L_PRIME_FAILURE
;
584 if (msg_out
->process
.msg1_status
!= TA_HDCP2_MSG_AUTHENTICATION_STATUS__SUCCESS
)
585 return MOD_HDCP_STATUS_HDCP2_VALIDATE_L_PRIME_FAILURE
;
587 return MOD_HDCP_STATUS_SUCCESS
;
590 enum mod_hdcp_status
mod_hdcp_hdcp2_prepare_eks(struct mod_hdcp
*hdcp
)
592 struct psp_context
*psp
= hdcp
->config
.psp
.handle
;
593 struct ta_hdcp_shared_memory
*hdcp_cmd
;
594 struct ta_hdcp_cmd_hdcp2_process_prepare_authentication_message_input_v2
*msg_in
;
595 struct ta_hdcp_cmd_hdcp2_process_prepare_authentication_message_output_v2
*msg_out
;
597 hdcp_cmd
= (struct ta_hdcp_shared_memory
*)psp
->hdcp_context
.hdcp_shared_buf
;
598 memset(hdcp_cmd
, 0, sizeof(struct ta_hdcp_shared_memory
));
600 msg_in
= &hdcp_cmd
->in_msg
.hdcp2_prepare_process_authentication_message_v2
;
601 msg_out
= &hdcp_cmd
->out_msg
.hdcp2_prepare_process_authentication_message_v2
;
603 hdcp2_message_init(hdcp
, msg_in
);
605 msg_in
->prepare
.msg1_id
= TA_HDCP_HDCP2_MSG_ID__SKE_SEND_EKS
;
607 if (is_dp_hdcp(hdcp
))
608 msg_in
->prepare
.msg2_id
= TA_HDCP_HDCP2_MSG_ID__SIGNAL_CONTENT_STREAM_TYPE_DP
;
610 hdcp_cmd
->cmd_id
= TA_HDCP_COMMAND__HDCP2_PREPARE_PROCESS_AUTHENTICATION_MSG_V2
;
611 psp_hdcp_invoke(psp
, hdcp_cmd
->cmd_id
);
613 if (hdcp_cmd
->hdcp_status
!= TA_HDCP_STATUS__SUCCESS
)
614 return MOD_HDCP_STATUS_HDCP2_PREP_EKS_FAILURE
;
616 memcpy(hdcp
->auth
.msg
.hdcp2
.ske_eks
, &msg_out
->prepare
.transmitter_message
[0],
617 sizeof(hdcp
->auth
.msg
.hdcp2
.ske_eks
));
618 msg_out
->prepare
.msg1_desc
.msg_size
= sizeof(hdcp
->auth
.msg
.hdcp2
.ske_eks
);
620 if (is_dp_hdcp(hdcp
)) {
621 memcpy(hdcp
->auth
.msg
.hdcp2
.content_stream_type_dp
,
622 &msg_out
->prepare
.transmitter_message
[sizeof(hdcp
->auth
.msg
.hdcp2
.ske_eks
)],
623 sizeof(hdcp
->auth
.msg
.hdcp2
.content_stream_type_dp
));
626 return MOD_HDCP_STATUS_SUCCESS
;
629 enum mod_hdcp_status
mod_hdcp_hdcp2_enable_encryption(struct mod_hdcp
*hdcp
)
631 struct psp_context
*psp
= hdcp
->config
.psp
.handle
;
632 struct ta_hdcp_shared_memory
*hdcp_cmd
;
633 struct ta_hdcp_cmd_hdcp2_process_prepare_authentication_message_input_v2
*msg_in
;
634 struct mod_hdcp_display
*display
= get_first_added_display(hdcp
);
636 hdcp_cmd
= (struct ta_hdcp_shared_memory
*)psp
->hdcp_context
.hdcp_shared_buf
;
637 memset(hdcp_cmd
, 0, sizeof(struct ta_hdcp_shared_memory
));
639 msg_in
= &hdcp_cmd
->in_msg
.hdcp2_prepare_process_authentication_message_v2
;
641 hdcp2_message_init(hdcp
, msg_in
);
644 return MOD_HDCP_STATUS_DISPLAY_NOT_FOUND
;
646 hdcp_cmd
->in_msg
.hdcp1_enable_encryption
.session_handle
= hdcp
->auth
.id
;
648 hdcp_cmd
->cmd_id
= TA_HDCP_COMMAND__HDCP2_SET_ENCRYPTION
;
649 psp_hdcp_invoke(psp
, hdcp_cmd
->cmd_id
);
651 if (hdcp_cmd
->hdcp_status
!= TA_HDCP_STATUS__SUCCESS
)
652 return MOD_HDCP_STATUS_HDCP2_ENABLE_ENCRYPTION_FAILURE
;
654 if (!is_dp_mst_hdcp(hdcp
)) {
655 display
->state
= MOD_HDCP_DISPLAY_ENCRYPTION_ENABLED
;
656 HDCP_HDCP2_ENABLED_TRACE(hdcp
, display
->index
);
659 return MOD_HDCP_STATUS_SUCCESS
;
662 enum mod_hdcp_status
mod_hdcp_hdcp2_validate_rx_id_list(struct mod_hdcp
*hdcp
)
664 struct psp_context
*psp
= hdcp
->config
.psp
.handle
;
665 struct ta_hdcp_shared_memory
*hdcp_cmd
;
666 struct ta_hdcp_cmd_hdcp2_process_prepare_authentication_message_input_v2
*msg_in
;
667 struct ta_hdcp_cmd_hdcp2_process_prepare_authentication_message_output_v2
*msg_out
;
669 hdcp_cmd
= (struct ta_hdcp_shared_memory
*)psp
->hdcp_context
.hdcp_shared_buf
;
670 memset(hdcp_cmd
, 0, sizeof(struct ta_hdcp_shared_memory
));
672 msg_in
= &hdcp_cmd
->in_msg
.hdcp2_prepare_process_authentication_message_v2
;
673 msg_out
= &hdcp_cmd
->out_msg
.hdcp2_prepare_process_authentication_message_v2
;
675 hdcp2_message_init(hdcp
, msg_in
);
677 msg_in
->process
.msg1_desc
.msg_id
= TA_HDCP_HDCP2_MSG_ID__REPEATERAUTH_SEND_RECEIVERID_LIST
;
678 msg_in
->process
.msg1_desc
.msg_size
= sizeof(hdcp
->auth
.msg
.hdcp2
.rx_id_list
);
679 memcpy(&msg_in
->process
.receiver_message
[0], hdcp
->auth
.msg
.hdcp2
.rx_id_list
,
680 sizeof(hdcp
->auth
.msg
.hdcp2
.rx_id_list
));
682 msg_in
->prepare
.msg1_id
= TA_HDCP_HDCP2_MSG_ID__REPEATERAUTH_SEND_ACK
;
684 hdcp_cmd
->cmd_id
= TA_HDCP_COMMAND__HDCP2_PREPARE_PROCESS_AUTHENTICATION_MSG_V2
;
686 psp_hdcp_invoke(psp
, hdcp_cmd
->cmd_id
);
688 if (hdcp_cmd
->hdcp_status
!= TA_HDCP_STATUS__SUCCESS
)
689 return MOD_HDCP_STATUS_HDCP2_VALIDATE_RX_ID_LIST_FAILURE
;
691 memcpy(hdcp
->auth
.msg
.hdcp2
.repeater_auth_ack
, &msg_out
->prepare
.transmitter_message
[0],
692 sizeof(hdcp
->auth
.msg
.hdcp2
.repeater_auth_ack
));
694 if (msg_out
->process
.msg1_status
== TA_HDCP2_MSG_AUTHENTICATION_STATUS__SUCCESS
) {
695 hdcp
->connection
.is_km_stored
= msg_out
->process
.is_km_stored
? 1 : 0;
696 hdcp
->connection
.is_repeater
= msg_out
->process
.is_repeater
? 1 : 0;
697 return MOD_HDCP_STATUS_SUCCESS
;
701 return MOD_HDCP_STATUS_HDCP2_VALIDATE_RX_ID_LIST_FAILURE
;
704 enum mod_hdcp_status
mod_hdcp_hdcp2_enable_dp_stream_encryption(struct mod_hdcp
*hdcp
)
706 struct psp_context
*psp
= hdcp
->config
.psp
.handle
;
707 struct ta_hdcp_shared_memory
*hdcp_cmd
;
708 struct ta_hdcp_cmd_hdcp2_process_prepare_authentication_message_input_v2
*msg_in
;
711 hdcp_cmd
= (struct ta_hdcp_shared_memory
*)psp
->hdcp_context
.hdcp_shared_buf
;
712 memset(hdcp_cmd
, 0, sizeof(struct ta_hdcp_shared_memory
));
714 msg_in
= &hdcp_cmd
->in_msg
.hdcp2_prepare_process_authentication_message_v2
;
716 hdcp2_message_init(hdcp
, msg_in
);
719 for (i
= 0; i
< MAX_NUM_OF_DISPLAYS
; i
++) {
720 if (hdcp
->connection
.displays
[i
].state
!= MOD_HDCP_DISPLAY_ACTIVE_AND_ADDED
||
721 hdcp
->connection
.displays
[i
].adjust
.disable
)
723 hdcp_cmd
->in_msg
.hdcp2_enable_dp_stream_encryption
.display_handle
= hdcp
->connection
.displays
[i
].index
;
724 hdcp_cmd
->in_msg
.hdcp2_enable_dp_stream_encryption
.session_handle
= hdcp
->auth
.id
;
726 hdcp_cmd
->cmd_id
= TA_HDCP_COMMAND__HDCP2_ENABLE_DP_STREAM_ENCRYPTION
;
727 psp_hdcp_invoke(psp
, hdcp_cmd
->cmd_id
);
729 if (hdcp_cmd
->hdcp_status
!= TA_HDCP_STATUS__SUCCESS
)
732 hdcp
->connection
.displays
[i
].state
= MOD_HDCP_DISPLAY_ENCRYPTION_ENABLED
;
733 HDCP_HDCP2_ENABLED_TRACE(hdcp
, hdcp
->connection
.displays
[i
].index
);
736 return (hdcp_cmd
->hdcp_status
== TA_HDCP_STATUS__SUCCESS
) ? MOD_HDCP_STATUS_SUCCESS
737 : MOD_HDCP_STATUS_HDCP2_ENABLE_STREAM_ENCRYPTION
;
740 enum mod_hdcp_status
mod_hdcp_hdcp2_prepare_stream_management(struct mod_hdcp
*hdcp
)
743 struct psp_context
*psp
= hdcp
->config
.psp
.handle
;
744 struct ta_hdcp_shared_memory
*hdcp_cmd
;
745 struct ta_hdcp_cmd_hdcp2_process_prepare_authentication_message_input_v2
*msg_in
;
746 struct ta_hdcp_cmd_hdcp2_process_prepare_authentication_message_output_v2
*msg_out
;
748 hdcp_cmd
= (struct ta_hdcp_shared_memory
*)psp
->hdcp_context
.hdcp_shared_buf
;
749 memset(hdcp_cmd
, 0, sizeof(struct ta_hdcp_shared_memory
));
751 msg_in
= &hdcp_cmd
->in_msg
.hdcp2_prepare_process_authentication_message_v2
;
752 msg_out
= &hdcp_cmd
->out_msg
.hdcp2_prepare_process_authentication_message_v2
;
754 hdcp2_message_init(hdcp
, msg_in
);
756 msg_in
->prepare
.msg1_id
= TA_HDCP_HDCP2_MSG_ID__REPEATERAUTH_STREAM_MANAGE
;
759 hdcp_cmd
->cmd_id
= TA_HDCP_COMMAND__HDCP2_PREPARE_PROCESS_AUTHENTICATION_MSG_V2
;
760 psp_hdcp_invoke(psp
, hdcp_cmd
->cmd_id
);
762 if (hdcp_cmd
->hdcp_status
!= TA_HDCP_STATUS__SUCCESS
)
763 return MOD_HDCP_STATUS_HDCP2_PREPARE_STREAM_MANAGEMENT_FAILURE
;
765 hdcp
->auth
.msg
.hdcp2
.stream_manage_size
= msg_out
->prepare
.msg1_desc
.msg_size
;
767 memcpy(hdcp
->auth
.msg
.hdcp2
.repeater_auth_stream_manage
, &msg_out
->prepare
.transmitter_message
[0],
768 sizeof(hdcp
->auth
.msg
.hdcp2
.repeater_auth_stream_manage
));
770 return MOD_HDCP_STATUS_SUCCESS
;
773 enum mod_hdcp_status
mod_hdcp_hdcp2_validate_stream_ready(struct mod_hdcp
*hdcp
)
775 struct psp_context
*psp
= hdcp
->config
.psp
.handle
;
776 struct ta_hdcp_shared_memory
*hdcp_cmd
;
777 struct ta_hdcp_cmd_hdcp2_process_prepare_authentication_message_input_v2
*msg_in
;
778 struct ta_hdcp_cmd_hdcp2_process_prepare_authentication_message_output_v2
*msg_out
;
780 hdcp_cmd
= (struct ta_hdcp_shared_memory
*)psp
->hdcp_context
.hdcp_shared_buf
;
781 memset(hdcp_cmd
, 0, sizeof(struct ta_hdcp_shared_memory
));
783 msg_in
= &hdcp_cmd
->in_msg
.hdcp2_prepare_process_authentication_message_v2
;
784 msg_out
= &hdcp_cmd
->out_msg
.hdcp2_prepare_process_authentication_message_v2
;
786 hdcp2_message_init(hdcp
, msg_in
);
788 msg_in
->process
.msg1_desc
.msg_id
= TA_HDCP_HDCP2_MSG_ID__REPEATERAUTH_STREAM_READY
;
790 msg_in
->process
.msg1_desc
.msg_size
= sizeof(hdcp
->auth
.msg
.hdcp2
.repeater_auth_stream_ready
);
792 memcpy(&msg_in
->process
.receiver_message
[0], hdcp
->auth
.msg
.hdcp2
.repeater_auth_stream_ready
,
793 sizeof(hdcp
->auth
.msg
.hdcp2
.repeater_auth_stream_ready
));
795 hdcp_cmd
->cmd_id
= TA_HDCP_COMMAND__HDCP2_PREPARE_PROCESS_AUTHENTICATION_MSG_V2
;
796 psp_hdcp_invoke(psp
, hdcp_cmd
->cmd_id
);
798 return (hdcp_cmd
->hdcp_status
== TA_HDCP_STATUS__SUCCESS
) &&
799 (msg_out
->process
.msg1_status
== TA_HDCP2_MSG_AUTHENTICATION_STATUS__SUCCESS
)
800 ? MOD_HDCP_STATUS_SUCCESS
801 : MOD_HDCP_STATUS_HDCP2_VALIDATE_STREAM_READY_FAILURE
;
804 enum mod_hdcp_status
mod_hdcp_hdcp2_get_link_encryption_status(struct mod_hdcp
*hdcp
,
805 enum mod_hdcp_encryption_status
*encryption_status
)
807 struct psp_context
*psp
= hdcp
->config
.psp
.handle
;
808 struct ta_hdcp_shared_memory
*hdcp_cmd
;
810 hdcp_cmd
= (struct ta_hdcp_shared_memory
*)psp
->hdcp_context
.hdcp_shared_buf
;
812 memset(hdcp_cmd
, 0, sizeof(struct ta_hdcp_shared_memory
));
814 hdcp_cmd
->in_msg
.hdcp2_get_encryption_status
.session_handle
= hdcp
->auth
.id
;
815 hdcp_cmd
->out_msg
.hdcp2_get_encryption_status
.protection_level
= 0;
816 hdcp_cmd
->cmd_id
= TA_HDCP_COMMAND__HDCP2_GET_ENCRYPTION_STATUS
;
817 *encryption_status
= MOD_HDCP_ENCRYPTION_STATUS_HDCP_OFF
;
819 psp_hdcp_invoke(psp
, hdcp_cmd
->cmd_id
);
821 if (hdcp_cmd
->hdcp_status
!= TA_HDCP_STATUS__SUCCESS
)
822 return MOD_HDCP_STATUS_FAILURE
;
824 if (hdcp_cmd
->out_msg
.hdcp2_get_encryption_status
.protection_level
== 1) {
825 if (hdcp_cmd
->out_msg
.hdcp2_get_encryption_status
.hdcp2_type
== TA_HDCP2_CONTENT_TYPE__TYPE1
)
826 *encryption_status
= MOD_HDCP_ENCRYPTION_STATUS_HDCP2_TYPE1_ON
;
828 *encryption_status
= MOD_HDCP_ENCRYPTION_STATUS_HDCP2_TYPE0_ON
;
831 return MOD_HDCP_STATUS_SUCCESS
;