Lines Matching full:hdr
446 struct asn1_hdr hdr; in pkcs12_certbag() local
458 if (asn1_get_next(buf, len, &hdr) < 0 || !asn1_is_sequence(&hdr)) { in pkcs12_certbag()
459 asn1_unexpected(&hdr, "PKCS #12: Expected SEQUENCE (CertBag)"); in pkcs12_certbag()
463 pos = hdr.payload; in pkcs12_certbag()
464 end = hdr.payload + hdr.length; in pkcs12_certbag()
481 if (asn1_get_next(pos, end - pos, &hdr) < 0 || !hdr.constructed || in pkcs12_certbag()
482 !asn1_is_cs_tag(&hdr, 0)) { in pkcs12_certbag()
483 asn1_unexpected(&hdr, in pkcs12_certbag()
488 if (asn1_get_next(hdr.payload, hdr.length, &hdr) < 0 || in pkcs12_certbag()
489 !asn1_is_octetstring(&hdr)) { in pkcs12_certbag()
490 asn1_unexpected(&hdr, in pkcs12_certbag()
496 hdr.payload, hdr.length); in pkcs12_certbag()
501 cert = x509_certificate_parse(hdr.payload, hdr.length); in pkcs12_certbag()
511 return tlsv1_set_cert(cred, NULL, hdr.payload, hdr.length); in pkcs12_certbag()
517 struct asn1_hdr hdr; in pkcs12_parse_attr_friendly_name() local
528 if (asn1_get_next(pos, end - pos, &hdr) < 0 || in pkcs12_parse_attr_friendly_name()
529 !asn1_is_bmpstring(&hdr)) { in pkcs12_parse_attr_friendly_name()
530 asn1_unexpected(&hdr, in pkcs12_parse_attr_friendly_name()
535 hdr.payload, hdr.length); in pkcs12_parse_attr_friendly_name()
542 struct asn1_hdr hdr; in pkcs12_parse_attr_local_key_id() local
553 if (asn1_get_next(pos, end - pos, &hdr) < 0 || in pkcs12_parse_attr_local_key_id()
554 !asn1_is_octetstring(&hdr)) { in pkcs12_parse_attr_local_key_id()
555 asn1_unexpected(&hdr, in pkcs12_parse_attr_local_key_id()
560 hdr.payload, hdr.length); in pkcs12_parse_attr_local_key_id()
568 struct asn1_hdr hdr; in pkcs12_parse_attr() local
587 if (asn1_get_next(pos, end - pos, &hdr) < 0 || !asn1_is_set(&hdr)) { in pkcs12_parse_attr()
588 asn1_unexpected(&hdr, "PKCS #12: Expected SET (attrValues)"); in pkcs12_parse_attr()
592 hdr.payload, hdr.length); in pkcs12_parse_attr()
593 pos = hdr.payload; in pkcs12_parse_attr()
594 end = hdr.payload + hdr.length; in pkcs12_parse_attr()
609 struct asn1_hdr hdr; in pkcs12_safebag() local
628 if (asn1_get_next(pos, end - pos, &hdr) < 0 || !hdr.constructed || in pkcs12_safebag()
629 !asn1_is_cs_tag(&hdr, 0)) { in pkcs12_safebag()
630 asn1_unexpected(&hdr, in pkcs12_safebag()
634 value = hdr.payload; in pkcs12_safebag()
635 value_len = hdr.length; in pkcs12_safebag()
637 pos = hdr.payload + hdr.length; in pkcs12_safebag()
641 if (asn1_get_next(pos, end - pos, &hdr) < 0 || in pkcs12_safebag()
642 !asn1_is_set(&hdr)) { in pkcs12_safebag()
643 asn1_unexpected(&hdr, in pkcs12_safebag()
648 hdr.payload, hdr.length); in pkcs12_safebag()
650 pos = hdr.payload; in pkcs12_safebag()
651 end = hdr.payload + hdr.length; in pkcs12_safebag()
654 if (asn1_get_next(pos, end - pos, &hdr) < 0 || in pkcs12_safebag()
655 !asn1_is_sequence(&hdr)) { in pkcs12_safebag()
656 asn1_unexpected(&hdr, in pkcs12_safebag()
660 if (pkcs12_parse_attr(hdr.payload, hdr.length) < 0) in pkcs12_safebag()
662 pos = hdr.payload + hdr.length; in pkcs12_safebag()
682 struct asn1_hdr hdr; in pkcs12_safecontents() local
686 if (asn1_get_next(buf, len, &hdr) < 0 || !asn1_is_sequence(&hdr)) { in pkcs12_safecontents()
687 asn1_unexpected(&hdr, in pkcs12_safecontents()
691 pos = hdr.payload; in pkcs12_safecontents()
692 end = hdr.payload + hdr.length; in pkcs12_safecontents()
703 if (asn1_get_next(pos, end - pos, &hdr) < 0 || in pkcs12_safecontents()
704 !asn1_is_sequence(&hdr)) { in pkcs12_safecontents()
705 asn1_unexpected(&hdr, in pkcs12_safecontents()
709 if (pkcs12_safebag(cred, hdr.payload, hdr.length, passwd) < 0) in pkcs12_safecontents()
711 pos = hdr.payload + hdr.length; in pkcs12_safecontents()
722 struct asn1_hdr hdr; in pkcs12_parse_content_data() local
725 if (asn1_get_next(pos, end - pos, &hdr) < 0 || in pkcs12_parse_content_data()
726 !asn1_is_octetstring(&hdr)) { in pkcs12_parse_content_data()
727 asn1_unexpected(&hdr, "PKCS #12: Expected OCTET STRING (Data)"); in pkcs12_parse_content_data()
731 wpa_hexdump(MSG_MSGDUMP, "PKCS #12: Data", hdr.payload, hdr.length); in pkcs12_parse_content_data()
733 return pkcs12_safecontents(cred, hdr.payload, hdr.length, passwd); in pkcs12_parse_content_data()
741 struct asn1_hdr hdr; in pkcs12_parse_content_enc_data() local
754 if (asn1_get_next(pos, end - pos, &hdr) < 0 || in pkcs12_parse_content_enc_data()
755 !asn1_is_sequence(&hdr)) { in pkcs12_parse_content_enc_data()
756 asn1_unexpected(&hdr, in pkcs12_parse_content_enc_data()
760 pos = hdr.payload; in pkcs12_parse_content_enc_data()
763 if (asn1_get_next(pos, end - pos, &hdr) < 0 || !asn1_is_integer(&hdr)) { in pkcs12_parse_content_enc_data()
764 asn1_unexpected(&hdr, in pkcs12_parse_content_enc_data()
768 if (hdr.length != 1 || hdr.payload[0] != 0) { in pkcs12_parse_content_enc_data()
772 pos = hdr.payload + hdr.length; in pkcs12_parse_content_enc_data()
783 if (asn1_get_next(pos, end - pos, &hdr) < 0 || in pkcs12_parse_content_enc_data()
784 !asn1_is_sequence(&hdr)) { in pkcs12_parse_content_enc_data()
785 asn1_unexpected(&hdr, in pkcs12_parse_content_enc_data()
790 pos = hdr.payload; in pkcs12_parse_content_enc_data()
791 end = pos + hdr.length; in pkcs12_parse_content_enc_data()
811 if (asn1_get_next(pos, end - pos, &hdr) < 0 || in pkcs12_parse_content_enc_data()
812 !asn1_is_sequence(&hdr)) { in pkcs12_parse_content_enc_data()
813 asn1_unexpected(&hdr, in pkcs12_parse_content_enc_data()
817 enc_alg = hdr.payload; in pkcs12_parse_content_enc_data()
818 enc_alg_len = hdr.length; in pkcs12_parse_content_enc_data()
819 pos = hdr.payload + hdr.length; in pkcs12_parse_content_enc_data()
821 if (asn1_get_next(pos, end - pos, &hdr) < 0 || hdr.constructed || in pkcs12_parse_content_enc_data()
822 !asn1_is_cs_tag(&hdr, 0)) { in pkcs12_parse_content_enc_data()
823 asn1_unexpected(&hdr, in pkcs12_parse_content_enc_data()
829 data = pkcs5_decrypt(enc_alg, enc_alg_len, hdr.payload, hdr.length, in pkcs12_parse_content_enc_data()
851 struct asn1_hdr hdr; in pkcs12_parse_content() local
864 if (asn1_get_next(pos, end - pos, &hdr) < 0 || !hdr.constructed || in pkcs12_parse_content()
865 !asn1_is_cs_tag(&hdr, 0)) { in pkcs12_parse_content()
866 asn1_unexpected(&hdr, in pkcs12_parse_content()
870 pos = hdr.payload; in pkcs12_parse_content()
887 struct asn1_hdr hdr; in pkcs12_parse() local
900 if (asn1_get_next(key, len, &hdr) < 0 || !asn1_is_sequence(&hdr)) { in pkcs12_parse()
901 asn1_unexpected(&hdr, in pkcs12_parse()
906 pos = hdr.payload; in pkcs12_parse()
907 end = pos + hdr.length; in pkcs12_parse()
909 if (asn1_get_next(pos, end - pos, &hdr) < 0 || !asn1_is_integer(&hdr)) { in pkcs12_parse()
910 asn1_unexpected(&hdr, in pkcs12_parse()
914 if (hdr.length != 1 || hdr.payload[0] != 3) { in pkcs12_parse()
918 pos = hdr.payload + hdr.length; in pkcs12_parse()
926 if (asn1_get_next(pos, end - pos, &hdr) < 0 || in pkcs12_parse()
927 !asn1_is_sequence(&hdr)) { in pkcs12_parse()
928 asn1_unexpected(&hdr, in pkcs12_parse()
933 pos = hdr.payload; in pkcs12_parse()
934 end = pos + hdr.length; in pkcs12_parse()
950 if (asn1_get_next(pos, end - pos, &hdr) < 0 || !hdr.constructed || in pkcs12_parse()
951 !asn1_is_cs_tag(&hdr, 0)) { in pkcs12_parse()
952 asn1_unexpected(&hdr, in pkcs12_parse()
957 pos = hdr.payload; in pkcs12_parse()
960 if (asn1_get_next(pos, end - pos, &hdr) < 0 || in pkcs12_parse()
961 !asn1_is_octetstring(&hdr)) { in pkcs12_parse()
962 asn1_unexpected(&hdr, in pkcs12_parse()
974 hdr.payload, hdr.length); in pkcs12_parse()
976 if (asn1_get_next(hdr.payload, hdr.length, &hdr) < 0 || in pkcs12_parse()
977 !asn1_is_sequence(&hdr)) { in pkcs12_parse()
978 asn1_unexpected(&hdr, in pkcs12_parse()
983 pos = hdr.payload; in pkcs12_parse()
984 end = pos + hdr.length; in pkcs12_parse()
987 if (asn1_get_next(pos, end - pos, &hdr) < 0 || in pkcs12_parse()
988 !asn1_is_sequence(&hdr)) { in pkcs12_parse()
989 asn1_unexpected(&hdr, in pkcs12_parse()
993 if (pkcs12_parse_content(cred, hdr.payload, hdr.length, in pkcs12_parse()
997 pos = hdr.payload + hdr.length; in pkcs12_parse()
1074 struct asn1_hdr hdr; in tlsv1_set_dhparams_der() local
1088 if (asn1_get_next(pos, len, &hdr) < 0 || !asn1_is_sequence(&hdr)) { in tlsv1_set_dhparams_der()
1089 asn1_unexpected(&hdr, in tlsv1_set_dhparams_der()
1093 pos = hdr.payload; in tlsv1_set_dhparams_der()
1096 if (asn1_get_next(pos, end - pos, &hdr) < 0 || in tlsv1_set_dhparams_der()
1097 !asn1_is_integer(&hdr)) { in tlsv1_set_dhparams_der()
1098 asn1_unexpected(&hdr, "DH: No INTEGER tag found for p"); in tlsv1_set_dhparams_der()
1102 wpa_hexdump(MSG_MSGDUMP, "DH: prime (p)", hdr.payload, hdr.length); in tlsv1_set_dhparams_der()
1103 if (hdr.length == 0) in tlsv1_set_dhparams_der()
1106 cred->dh_p = os_memdup(hdr.payload, hdr.length); in tlsv1_set_dhparams_der()
1109 cred->dh_p_len = hdr.length; in tlsv1_set_dhparams_der()
1110 pos = hdr.payload + hdr.length; in tlsv1_set_dhparams_der()
1113 if (asn1_get_next(pos, end - pos, &hdr) < 0 || in tlsv1_set_dhparams_der()
1114 !asn1_is_integer(&hdr)) { in tlsv1_set_dhparams_der()
1115 asn1_unexpected(&hdr, "DH: No INTEGER tag found for g"); in tlsv1_set_dhparams_der()
1119 wpa_hexdump(MSG_MSGDUMP, "DH: base (g)", hdr.payload, hdr.length); in tlsv1_set_dhparams_der()
1120 if (hdr.length == 0) in tlsv1_set_dhparams_der()
1123 cred->dh_g = os_memdup(hdr.payload, hdr.length); in tlsv1_set_dhparams_der()
1126 cred->dh_g_len = hdr.length; in tlsv1_set_dhparams_der()