Lines Matching full:hdcp

28 #include "hdcp.h"
35 static inline enum mod_hdcp_status check_receiver_id_list_ready(struct mod_hdcp *hdcp) in check_receiver_id_list_ready() argument
39 if (is_dp_hdcp(hdcp)) in check_receiver_id_list_ready()
40 is_ready = HDCP_2_2_DP_RXSTATUS_READY(hdcp->auth.msg.hdcp2.rxstatus_dp) ? 1 : 0; in check_receiver_id_list_ready()
42 is_ready = (HDCP_2_2_HDMI_RXSTATUS_READY(hdcp->auth.msg.hdcp2.rxstatus[1]) && in check_receiver_id_list_ready()
43 get_hdmi_rxstatus_msg_size(hdcp->auth.msg.hdcp2.rxstatus) != 0) ? 1 : 0; in check_receiver_id_list_ready()
48 static inline enum mod_hdcp_status check_hdcp2_capable(struct mod_hdcp *hdcp) in check_hdcp2_capable() argument
52 if (is_dp_hdcp(hdcp)) in check_hdcp2_capable()
53 status = (hdcp->auth.msg.hdcp2.rxcaps_dp[0] == HDCP_2_2_RX_CAPS_VERSION_VAL) && in check_hdcp2_capable()
54 HDCP_2_2_DP_HDCP_CAPABLE(hdcp->auth.msg.hdcp2.rxcaps_dp[2]) ? in check_hdcp2_capable()
58 status = (hdcp->auth.msg.hdcp2.hdcp2version_hdmi & HDCP_2_2_HDMI_SUPPORT_MASK) ? in check_hdcp2_capable()
65 struct mod_hdcp *hdcp) in check_reauthentication_request() argument
69 if (is_dp_hdcp(hdcp)) in check_reauthentication_request()
70 ret = HDCP_2_2_DP_RXSTATUS_REAUTH_REQ(hdcp->auth.msg.hdcp2.rxstatus_dp) ? in check_reauthentication_request()
74 ret = HDCP_2_2_HDMI_RXSTATUS_REAUTH_REQ(hdcp->auth.msg.hdcp2.rxstatus[1]) ? in check_reauthentication_request()
81 struct mod_hdcp *hdcp) in check_link_integrity_failure_dp() argument
83 return HDCP_2_2_DP_RXSTATUS_LINK_FAILED(hdcp->auth.msg.hdcp2.rxstatus_dp) ? in check_link_integrity_failure_dp()
88 static enum mod_hdcp_status check_ake_cert_available(struct mod_hdcp *hdcp) in check_ake_cert_available() argument
92 if (is_dp_hdcp(hdcp)) { in check_ake_cert_available()
95 status = mod_hdcp_read_rxstatus(hdcp); in check_ake_cert_available()
97 const uint16_t size = get_hdmi_rxstatus_msg_size(hdcp->auth.msg.hdcp2.rxstatus); in check_ake_cert_available()
98 status = (size == sizeof(hdcp->auth.msg.hdcp2.ake_cert)) ? in check_ake_cert_available()
106 static enum mod_hdcp_status check_h_prime_available(struct mod_hdcp *hdcp) in check_h_prime_available() argument
110 status = mod_hdcp_read_rxstatus(hdcp); in check_h_prime_available()
114 if (is_dp_hdcp(hdcp)) { in check_h_prime_available()
115 status = HDCP_2_2_DP_RXSTATUS_H_PRIME(hdcp->auth.msg.hdcp2.rxstatus_dp) ? in check_h_prime_available()
119 const uint16_t size = get_hdmi_rxstatus_msg_size(hdcp->auth.msg.hdcp2.rxstatus); in check_h_prime_available()
120 status = (size == sizeof(hdcp->auth.msg.hdcp2.ake_h_prime)) ? in check_h_prime_available()
128 static enum mod_hdcp_status check_pairing_info_available(struct mod_hdcp *hdcp) in check_pairing_info_available() argument
132 status = mod_hdcp_read_rxstatus(hdcp); in check_pairing_info_available()
136 if (is_dp_hdcp(hdcp)) { in check_pairing_info_available()
137 status = HDCP_2_2_DP_RXSTATUS_PAIRING(hdcp->auth.msg.hdcp2.rxstatus_dp) ? in check_pairing_info_available()
141 const uint16_t size = get_hdmi_rxstatus_msg_size(hdcp->auth.msg.hdcp2.rxstatus); in check_pairing_info_available()
142 status = (size == sizeof(hdcp->auth.msg.hdcp2.ake_pairing_info)) ? in check_pairing_info_available()
150 static enum mod_hdcp_status poll_l_prime_available(struct mod_hdcp *hdcp) in poll_l_prime_available() argument
157 if (is_dp_hdcp(hdcp)) in poll_l_prime_available()
163 status = mod_hdcp_read_rxstatus(hdcp); in poll_l_prime_available()
167 const uint16_t size = get_hdmi_rxstatus_msg_size(hdcp->auth.msg.hdcp2.rxstatus); in poll_l_prime_available()
168 status = (size == sizeof(hdcp->auth.msg.hdcp2.lc_l_prime)) ? in poll_l_prime_available()
177 static enum mod_hdcp_status check_stream_ready_available(struct mod_hdcp *hdcp) in check_stream_ready_available() argument
181 if (is_dp_hdcp(hdcp)) { in check_stream_ready_available()
184 status = mod_hdcp_read_rxstatus(hdcp); in check_stream_ready_available()
187 const uint16_t size = get_hdmi_rxstatus_msg_size(hdcp->auth.msg.hdcp2.rxstatus); in check_stream_ready_available()
188 status = (size == sizeof(hdcp->auth.msg.hdcp2.repeater_auth_stream_ready)) ? in check_stream_ready_available()
196 static inline uint8_t get_device_count(struct mod_hdcp *hdcp) in get_device_count() argument
198 return HDCP_2_2_DEV_COUNT_LO(hdcp->auth.msg.hdcp2.rx_id_list[2]) + in get_device_count()
199 (HDCP_2_2_DEV_COUNT_HI(hdcp->auth.msg.hdcp2.rx_id_list[1]) << 4); in get_device_count()
202 static enum mod_hdcp_status check_device_count(struct mod_hdcp *hdcp) in check_device_count() argument
205 if (get_device_count(hdcp) == 0) in check_device_count()
208 /* Some MST display may choose to report the internal panel as an HDCP RX. */ in check_device_count()
210 /* panel is possibly not included in DEVICE_COUNT) + get_device_count(hdcp). */ in check_device_count()
211 /* Device count must be greater than or equal to tracked hdcp displays. */ in check_device_count()
212 return ((1 + get_device_count(hdcp)) < get_active_display_count(hdcp)) ? in check_device_count()
217 static uint8_t process_rxstatus(struct mod_hdcp *hdcp, in process_rxstatus() argument
224 hdcp, "rxstatus_read")) in process_rxstatus()
228 hdcp, "reauth_request_check")) in process_rxstatus()
230 if (is_dp_hdcp(hdcp)) { in process_rxstatus()
233 hdcp, "link_integrity_check_dp")) in process_rxstatus()
236 if (hdcp->connection.is_repeater) in process_rxstatus()
237 if (check_receiver_id_list_ready(hdcp) == in process_rxstatus()
239 HDCP_INPUT_PASS_TRACE(hdcp, "rx_id_list_ready"); in process_rxstatus()
241 if (is_dp_hdcp(hdcp)) in process_rxstatus()
242 hdcp->auth.msg.hdcp2.rx_id_list_size = in process_rxstatus()
243 sizeof(hdcp->auth.msg.hdcp2.rx_id_list); in process_rxstatus()
245 hdcp->auth.msg.hdcp2.rx_id_list_size = in process_rxstatus()
246 get_hdmi_rxstatus_msg_size(hdcp->auth.msg.hdcp2.rxstatus); in process_rxstatus()
252 static enum mod_hdcp_status known_hdcp2_capable_rx(struct mod_hdcp *hdcp, in known_hdcp2_capable_rx() argument
265 hdcp, "hdcp2version_read")) in known_hdcp2_capable_rx()
269 hdcp, "hdcp2_capable")) in known_hdcp2_capable_rx()
275 static enum mod_hdcp_status send_ake_init(struct mod_hdcp *hdcp, in send_ake_init() argument
288 hdcp, "create_session")) in send_ake_init()
292 hdcp, "ake_init_prepare")) in send_ake_init()
296 hdcp, "ake_init_write")) in send_ake_init()
302 static enum mod_hdcp_status validate_ake_cert(struct mod_hdcp *hdcp, in validate_ake_cert() argument
315 if (is_hdmi_dvi_sl_hdcp(hdcp)) in validate_ake_cert()
318 hdcp, "ake_cert_available")) in validate_ake_cert()
322 hdcp, "ake_cert_read")) in validate_ake_cert()
326 hdcp, "ake_cert_validation")) in validate_ake_cert()
332 static enum mod_hdcp_status send_no_stored_km(struct mod_hdcp *hdcp, in send_no_stored_km() argument
345 hdcp, "no_stored_km_write")) in send_no_stored_km()
351 static enum mod_hdcp_status read_h_prime(struct mod_hdcp *hdcp, in read_h_prime() argument
366 hdcp, "h_prime_available")) in read_h_prime()
371 hdcp, "h_prime_read")) in read_h_prime()
378 struct mod_hdcp *hdcp, in read_pairing_info_and_validate_h_prime() argument
393 hdcp, "pairing_available")) in read_pairing_info_and_validate_h_prime()
397 hdcp, "pairing_info_read")) in read_pairing_info_and_validate_h_prime()
401 hdcp, "h_prime_validation")) in read_pairing_info_and_validate_h_prime()
407 static enum mod_hdcp_status send_stored_km(struct mod_hdcp *hdcp, in send_stored_km() argument
420 hdcp, "stored_km_write")) in send_stored_km()
426 static enum mod_hdcp_status validate_h_prime(struct mod_hdcp *hdcp, in validate_h_prime() argument
441 hdcp, "h_prime_available")) in validate_h_prime()
445 hdcp, "h_prime_read")) in validate_h_prime()
449 hdcp, "h_prime_validation")) in validate_h_prime()
455 static enum mod_hdcp_status locality_check(struct mod_hdcp *hdcp, in locality_check() argument
468 hdcp, "lc_init_prepare")) in locality_check()
472 hdcp, "lc_init_write")) in locality_check()
474 if (is_dp_hdcp(hdcp)) in locality_check()
479 hdcp, "l_prime_available_poll")) in locality_check()
483 hdcp, "l_prime_read")) in locality_check()
487 hdcp, "l_prime_validation")) in locality_check()
493 static enum mod_hdcp_status exchange_ks_and_test_for_repeater(struct mod_hdcp *hdcp, in exchange_ks_and_test_for_repeater() argument
506 hdcp, "eks_prepare")) in exchange_ks_and_test_for_repeater()
510 hdcp, "eks_write")) in exchange_ks_and_test_for_repeater()
516 static enum mod_hdcp_status enable_encryption(struct mod_hdcp *hdcp, in enable_encryption() argument
528 process_rxstatus(hdcp, event_ctx, input, &status); in enable_encryption()
532 if (is_hdmi_dvi_sl_hdcp(hdcp)) { in enable_encryption()
533 if (!process_rxstatus(hdcp, event_ctx, input, &status)) in enable_encryption()
540 hdcp, "enable_encryption")) in enable_encryption()
542 if (is_dp_mst_hdcp(hdcp)) { in enable_encryption()
546 hdcp, "stream_encryption_dp")) in enable_encryption()
553 static enum mod_hdcp_status authenticated(struct mod_hdcp *hdcp, in authenticated() argument
565 process_rxstatus(hdcp, event_ctx, input, &status); in authenticated()
570 static enum mod_hdcp_status wait_for_rx_id_list(struct mod_hdcp *hdcp, in wait_for_rx_id_list() argument
583 if (!process_rxstatus(hdcp, event_ctx, input, &status)) in wait_for_rx_id_list()
593 static enum mod_hdcp_status verify_rx_id_list_and_send_ack(struct mod_hdcp *hdcp, in verify_rx_id_list_and_send_ack() argument
605 process_rxstatus(hdcp, event_ctx, input, &status); in verify_rx_id_list_and_send_ack()
611 &status, hdcp, "receiver_id_list_read")) in verify_rx_id_list_and_send_ack()
615 &status, hdcp, "device_count_check")) in verify_rx_id_list_and_send_ack()
619 &status, hdcp, "rx_id_list_validation")) in verify_rx_id_list_and_send_ack()
623 &status, hdcp, "repeater_auth_ack_write")) in verify_rx_id_list_and_send_ack()
629 static enum mod_hdcp_status send_stream_management(struct mod_hdcp *hdcp, in send_stream_management() argument
641 process_rxstatus(hdcp, event_ctx, input, &status); in send_stream_management()
645 if (is_hdmi_dvi_sl_hdcp(hdcp)) { in send_stream_management()
646 if (!process_rxstatus(hdcp, event_ctx, input, &status)) in send_stream_management()
653 &status, hdcp, "prepare_stream_manage")) in send_stream_management()
658 &status, hdcp, "stream_manage_write")) in send_stream_management()
664 static enum mod_hdcp_status validate_stream_ready(struct mod_hdcp *hdcp, in validate_stream_ready() argument
677 process_rxstatus(hdcp, event_ctx, input, &status); in validate_stream_ready()
681 if (is_hdmi_dvi_sl_hdcp(hdcp)) { in validate_stream_ready()
682 if (!process_rxstatus(hdcp, event_ctx, input, &status)) in validate_stream_ready()
687 if (is_hdmi_dvi_sl_hdcp(hdcp)) in validate_stream_ready()
690 &status, hdcp, "stream_ready_available")) in validate_stream_ready()
694 &status, hdcp, "stream_ready_read")) in validate_stream_ready()
698 &status, hdcp, "stream_ready_validation")) in validate_stream_ready()
705 static enum mod_hdcp_status determine_rx_hdcp_capable_dp(struct mod_hdcp *hdcp, in determine_rx_hdcp_capable_dp() argument
718 &status, hdcp, "rx_caps_read_dp")) in determine_rx_hdcp_capable_dp()
722 hdcp, "hdcp2_capable_check")) in determine_rx_hdcp_capable_dp()
728 static enum mod_hdcp_status send_content_stream_type_dp(struct mod_hdcp *hdcp, in send_content_stream_type_dp() argument
740 if (!process_rxstatus(hdcp, event_ctx, input, &status)) in send_content_stream_type_dp()
744 hdcp, "content_stream_type_write")) in send_content_stream_type_dp()
750 enum mod_hdcp_status mod_hdcp_hdcp2_execution(struct mod_hdcp *hdcp, in mod_hdcp_hdcp2_execution() argument
756 switch (current_state(hdcp)) { in mod_hdcp_hdcp2_execution()
758 status = known_hdcp2_capable_rx(hdcp, event_ctx, input); in mod_hdcp_hdcp2_execution()
761 status = send_ake_init(hdcp, event_ctx, input); in mod_hdcp_hdcp2_execution()
764 status = validate_ake_cert(hdcp, event_ctx, input); in mod_hdcp_hdcp2_execution()
767 status = send_no_stored_km(hdcp, event_ctx, input); in mod_hdcp_hdcp2_execution()
770 status = read_h_prime(hdcp, event_ctx, input); in mod_hdcp_hdcp2_execution()
773 status = read_pairing_info_and_validate_h_prime(hdcp, in mod_hdcp_hdcp2_execution()
777 status = send_stored_km(hdcp, event_ctx, input); in mod_hdcp_hdcp2_execution()
780 status = validate_h_prime(hdcp, event_ctx, input); in mod_hdcp_hdcp2_execution()
783 status = locality_check(hdcp, event_ctx, input); in mod_hdcp_hdcp2_execution()
786 status = exchange_ks_and_test_for_repeater(hdcp, event_ctx, input); in mod_hdcp_hdcp2_execution()
789 status = enable_encryption(hdcp, event_ctx, input); in mod_hdcp_hdcp2_execution()
792 status = authenticated(hdcp, event_ctx, input); in mod_hdcp_hdcp2_execution()
795 status = wait_for_rx_id_list(hdcp, event_ctx, input); in mod_hdcp_hdcp2_execution()
798 status = verify_rx_id_list_and_send_ack(hdcp, event_ctx, input); in mod_hdcp_hdcp2_execution()
801 status = send_stream_management(hdcp, event_ctx, input); in mod_hdcp_hdcp2_execution()
804 status = validate_stream_ready(hdcp, event_ctx, input); in mod_hdcp_hdcp2_execution()
814 enum mod_hdcp_status mod_hdcp_hdcp2_dp_execution(struct mod_hdcp *hdcp, in mod_hdcp_hdcp2_dp_execution() argument
820 switch (current_state(hdcp)) { in mod_hdcp_hdcp2_dp_execution()
822 status = determine_rx_hdcp_capable_dp(hdcp, event_ctx, input); in mod_hdcp_hdcp2_dp_execution()
825 status = send_ake_init(hdcp, event_ctx, input); in mod_hdcp_hdcp2_dp_execution()
828 status = validate_ake_cert(hdcp, event_ctx, input); in mod_hdcp_hdcp2_dp_execution()
831 status = send_no_stored_km(hdcp, event_ctx, input); in mod_hdcp_hdcp2_dp_execution()
834 status = read_h_prime(hdcp, event_ctx, input); in mod_hdcp_hdcp2_dp_execution()
837 status = read_pairing_info_and_validate_h_prime(hdcp, in mod_hdcp_hdcp2_dp_execution()
841 status = send_stored_km(hdcp, event_ctx, input); in mod_hdcp_hdcp2_dp_execution()
844 status = validate_h_prime(hdcp, event_ctx, input); in mod_hdcp_hdcp2_dp_execution()
847 status = locality_check(hdcp, event_ctx, input); in mod_hdcp_hdcp2_dp_execution()
850 status = exchange_ks_and_test_for_repeater(hdcp, in mod_hdcp_hdcp2_dp_execution()
854 status = send_content_stream_type_dp(hdcp, event_ctx, input); in mod_hdcp_hdcp2_dp_execution()
857 status = enable_encryption(hdcp, event_ctx, input); in mod_hdcp_hdcp2_dp_execution()
860 status = authenticated(hdcp, event_ctx, input); in mod_hdcp_hdcp2_dp_execution()
863 status = wait_for_rx_id_list(hdcp, event_ctx, input); in mod_hdcp_hdcp2_dp_execution()
866 status = verify_rx_id_list_and_send_ack(hdcp, event_ctx, input); in mod_hdcp_hdcp2_dp_execution()
869 status = send_stream_management(hdcp, event_ctx, input); in mod_hdcp_hdcp2_dp_execution()
872 status = validate_stream_ready(hdcp, event_ctx, input); in mod_hdcp_hdcp2_dp_execution()