Lines Matching refs:hdr

538 	struct asn1_hdr hdr;  in dpp_parse_recipient_infos()  local
559 if (asn1_get_next(pos, end - pos, &hdr) < 0 || !hdr.constructed || in dpp_parse_recipient_infos()
560 !asn1_is_cs_tag(&hdr, 3)) { in dpp_parse_recipient_infos()
561 asn1_unexpected(&hdr, "DPP: Expected CHOICE [3] (pwri)"); in dpp_parse_recipient_infos()
565 hdr.payload, hdr.length); in dpp_parse_recipient_infos()
566 pos = hdr.payload; in dpp_parse_recipient_infos()
567 end = pos + hdr.length; in dpp_parse_recipient_infos()
580 if (asn1_get_sequence(pos, end - pos, &hdr, &end) < 0) in dpp_parse_recipient_infos()
582 pos = hdr.payload; in dpp_parse_recipient_infos()
594 if (asn1_get_next(pos, end - pos, &hdr) < 0 || !hdr.constructed || in dpp_parse_recipient_infos()
595 !asn1_is_cs_tag(&hdr, 0)) { in dpp_parse_recipient_infos()
596 asn1_unexpected(&hdr, in dpp_parse_recipient_infos()
600 pos = hdr.payload; in dpp_parse_recipient_infos()
601 e_end = pos + hdr.length; in dpp_parse_recipient_infos()
631 asn1_get_sequence(params, params_len, &hdr, &e_end) < 0) in dpp_parse_recipient_infos()
633 pos = hdr.payload; in dpp_parse_recipient_infos()
635 if (asn1_get_next(pos, e_end - pos, &hdr) < 0 || in dpp_parse_recipient_infos()
636 !asn1_is_octetstring(&hdr)) { in dpp_parse_recipient_infos()
637 asn1_unexpected(&hdr, in dpp_parse_recipient_infos()
642 hdr.payload, hdr.length); in dpp_parse_recipient_infos()
643 if (hdr.length != 64) { in dpp_parse_recipient_infos()
645 hdr.length); in dpp_parse_recipient_infos()
648 data->salt = hdr.payload; in dpp_parse_recipient_infos()
649 pos = hdr.payload + hdr.length; in dpp_parse_recipient_infos()
666 if (asn1_get_sequence(pos, e_end - pos, &hdr, NULL) < 0 || in dpp_parse_recipient_infos()
667 asn1_get_oid(hdr.payload, hdr.length, &oid, &pos) < 0) { in dpp_parse_recipient_infos()
713 if (asn1_get_next(pos, end - pos, &hdr) < 0 || in dpp_parse_recipient_infos()
714 !asn1_is_octetstring(&hdr)) { in dpp_parse_recipient_infos()
715 asn1_unexpected(&hdr, in dpp_parse_recipient_infos()
720 hdr.payload, hdr.length); in dpp_parse_recipient_infos()
721 data->enc_key = hdr.payload; in dpp_parse_recipient_infos()
722 data->enc_key_len = hdr.length; in dpp_parse_recipient_infos()
731 struct asn1_hdr hdr; in dpp_parse_encrypted_content_info() local
740 if (asn1_get_sequence(pos, end - pos, &hdr, &pos) < 0) in dpp_parse_encrypted_content_info()
743 hdr.payload, hdr.length); in dpp_parse_encrypted_content_info()
752 pos = hdr.payload; in dpp_parse_encrypted_content_info()
785 if (asn1_get_next(pos, end - pos, &hdr) < 0 || hdr.constructed || in dpp_parse_encrypted_content_info()
786 !asn1_is_cs_tag(&hdr, 0)) { in dpp_parse_encrypted_content_info()
787 asn1_unexpected(&hdr, in dpp_parse_encrypted_content_info()
792 hdr.payload, hdr.length); in dpp_parse_encrypted_content_info()
793 data->enc_cont = hdr.payload; in dpp_parse_encrypted_content_info()
794 data->enc_cont_len = hdr.length; in dpp_parse_encrypted_content_info()
802 struct asn1_hdr hdr; in dpp_parse_enveloped_data() local
826 if (asn1_get_sequence(env_data, env_data_len, &hdr, &end) < 0) in dpp_parse_enveloped_data()
828 pos = hdr.payload; in dpp_parse_enveloped_data()
843 if (asn1_get_next(pos, end - pos, &hdr) < 0 || !asn1_is_set(&hdr)) { in dpp_parse_enveloped_data()
844 asn1_unexpected(&hdr, in dpp_parse_enveloped_data()
849 if (dpp_parse_recipient_infos(hdr.payload, hdr.length, data) < 0) in dpp_parse_enveloped_data()
851 return dpp_parse_encrypted_content_info(hdr.payload + hdr.length, end, in dpp_parse_enveloped_data()
859 struct asn1_hdr hdr; in dpp_parse_one_asymmetric_key() local
885 if (asn1_get_sequence(pos, end - pos, &hdr, &end) < 0) in dpp_parse_one_asymmetric_key()
887 pos = hdr.payload; in dpp_parse_one_asymmetric_key()
932 if (asn1_get_next(pos, end - pos, &hdr) < 0 || in dpp_parse_one_asymmetric_key()
933 !asn1_is_octetstring(&hdr)) { in dpp_parse_one_asymmetric_key()
934 asn1_unexpected(&hdr, in dpp_parse_one_asymmetric_key()
939 hdr.payload, hdr.length); in dpp_parse_one_asymmetric_key()
940 pos = hdr.payload + hdr.length; in dpp_parse_one_asymmetric_key()
941 key->csign = crypto_ec_key_parse_priv(hdr.payload, hdr.length); in dpp_parse_one_asymmetric_key()
952 if (asn1_get_next(pos, end - pos, &hdr) < 0 || !hdr.constructed || in dpp_parse_one_asymmetric_key()
953 !asn1_is_cs_tag(&hdr, 0)) { in dpp_parse_one_asymmetric_key()
954 asn1_unexpected(&hdr, "DPP: Expected [0] Attributes"); in dpp_parse_one_asymmetric_key()
958 hdr.payload, hdr.length); in dpp_parse_one_asymmetric_key()
959 if (hdr.payload + hdr.length < end) { in dpp_parse_one_asymmetric_key()
962 hdr.payload + hdr.length, in dpp_parse_one_asymmetric_key()
963 end - (hdr.payload + hdr.length)); in dpp_parse_one_asymmetric_key()
965 pos = hdr.payload; in dpp_parse_one_asymmetric_key()
966 end = hdr.payload + hdr.length; in dpp_parse_one_asymmetric_key()
968 if (asn1_get_next(pos, end - pos, &hdr) < 0 || !asn1_is_set(&hdr)) { in dpp_parse_one_asymmetric_key()
969 asn1_unexpected(&hdr, "DPP: Expected SET (Attributes)"); in dpp_parse_one_asymmetric_key()
972 if (hdr.payload + hdr.length < end) { in dpp_parse_one_asymmetric_key()
975 hdr.payload + hdr.length, in dpp_parse_one_asymmetric_key()
976 end - (hdr.payload + hdr.length)); in dpp_parse_one_asymmetric_key()
978 pos = hdr.payload; in dpp_parse_one_asymmetric_key()
979 end = hdr.payload + hdr.length; in dpp_parse_one_asymmetric_key()
996 if (asn1_get_sequence(pos, end - pos, &hdr, &pos) < 0) in dpp_parse_one_asymmetric_key()
1004 pos = hdr.payload; in dpp_parse_one_asymmetric_key()
1015 if (asn1_get_next(pos, end - pos, &hdr) < 0 || !asn1_is_set(&hdr)) { in dpp_parse_one_asymmetric_key()
1016 asn1_unexpected(&hdr, "DPP: Expected SET (Attribute)"); in dpp_parse_one_asymmetric_key()
1019 pos = hdr.payload; in dpp_parse_one_asymmetric_key()
1020 end = hdr.payload + hdr.length; in dpp_parse_one_asymmetric_key()
1031 if (asn1_get_sequence(pos, end - pos, &hdr, &pos) < 0) in dpp_parse_one_asymmetric_key()
1039 pos = hdr.payload; in dpp_parse_one_asymmetric_key()
1045 if (asn1_get_next(pos, end - pos, &hdr) < 0 || in dpp_parse_one_asymmetric_key()
1046 !asn1_is_octetstring(&hdr)) { in dpp_parse_one_asymmetric_key()
1047 asn1_unexpected(&hdr, "DPP: Expected OCTETSTRING (PrivateKey)"); in dpp_parse_one_asymmetric_key()
1051 hdr.payload, hdr.length); in dpp_parse_one_asymmetric_key()
1052 pos = hdr.payload + hdr.length; in dpp_parse_one_asymmetric_key()
1053 key->pp_key = crypto_ec_key_parse_priv(hdr.payload, hdr.length); in dpp_parse_one_asymmetric_key()
1060 if (asn1_get_next(pos, end - pos, &hdr) < 0 || in dpp_parse_one_asymmetric_key()
1061 !asn1_is_utf8string(&hdr)) { in dpp_parse_one_asymmetric_key()
1062 asn1_unexpected(&hdr, in dpp_parse_one_asymmetric_key()
1067 hdr.payload, hdr.length); in dpp_parse_one_asymmetric_key()
1068 key->config_template = os_zalloc(hdr.length + 1); in dpp_parse_one_asymmetric_key()
1071 os_memcpy(key->config_template, hdr.payload, hdr.length); in dpp_parse_one_asymmetric_key()
1073 pos = hdr.payload + hdr.length; in dpp_parse_one_asymmetric_key()
1076 if (asn1_get_next(pos, end - pos, &hdr) < 0 || in dpp_parse_one_asymmetric_key()
1077 !asn1_is_utf8string(&hdr)) { in dpp_parse_one_asymmetric_key()
1078 asn1_unexpected(&hdr, in dpp_parse_one_asymmetric_key()
1083 hdr.payload, hdr.length); in dpp_parse_one_asymmetric_key()
1084 key->connector_template = os_zalloc(hdr.length + 1); in dpp_parse_one_asymmetric_key()
1087 os_memcpy(key->connector_template, hdr.payload, hdr.length); in dpp_parse_one_asymmetric_key()
1101 struct asn1_hdr hdr; in dpp_parse_dpp_asymmetric_key_package() local
1114 if (asn1_get_sequence(pos, end - pos, &hdr, &pos) < 0 || in dpp_parse_dpp_asymmetric_key_package()
1115 !(key = dpp_parse_one_asymmetric_key(hdr.payload, in dpp_parse_dpp_asymmetric_key_package()
1116 hdr.length))) { in dpp_parse_dpp_asymmetric_key_package()