Lines Matching full:pos

181 	const char *pos;  member
190 char *pos; in eap_teap_read_line() local
200 if (rc->pos >= rc->end) in eap_teap_read_line()
202 l_end = rc->pos; in eap_teap_read_line()
205 len = l_end - rc->pos; in eap_teap_read_line()
208 os_memcpy(rc->buf, rc->pos, len); in eap_teap_read_line()
210 rc->pos = l_end + 1; in eap_teap_read_line()
214 pos = rc->buf; in eap_teap_read_line()
215 while (*pos != '\0') { in eap_teap_read_line()
216 if (*pos == '\n' || *pos == '\r') { in eap_teap_read_line()
217 *pos = '\0'; in eap_teap_read_line()
220 pos++; in eap_teap_read_line()
223 pos = os_strchr(rc->buf, '='); in eap_teap_read_line()
224 if (pos) in eap_teap_read_line()
225 *pos++ = '\0'; in eap_teap_read_line()
226 *value = pos; in eap_teap_read_line()
275 rc->pos = (char *) blob->data; in eap_teap_init_pac_data()
333 char *pos) in eap_teap_parse_pac_type() argument
335 if (!pos) in eap_teap_parse_pac_type()
337 pac->pac_type = atoi(pos); in eap_teap_parse_pac_type()
345 static const char * eap_teap_parse_pac_key(struct eap_teap_pac *pac, char *pos) in eap_teap_parse_pac_key() argument
350 key = eap_teap_parse_hex(pos, &key_len); in eap_teap_parse_pac_key()
364 char *pos) in eap_teap_parse_pac_opaque() argument
367 pac->pac_opaque = eap_teap_parse_hex(pos, &pac->pac_opaque_len); in eap_teap_parse_pac_opaque()
374 static const char * eap_teap_parse_a_id(struct eap_teap_pac *pac, char *pos) in eap_teap_parse_a_id() argument
377 pac->a_id = eap_teap_parse_hex(pos, &pac->a_id_len); in eap_teap_parse_a_id()
384 static const char * eap_teap_parse_i_id(struct eap_teap_pac *pac, char *pos) in eap_teap_parse_i_id() argument
387 pac->i_id = eap_teap_parse_hex(pos, &pac->i_id_len); in eap_teap_parse_i_id()
395 char *pos) in eap_teap_parse_a_id_info() argument
398 pac->a_id_info = eap_teap_parse_hex(pos, &pac->a_id_info_len); in eap_teap_parse_a_id_info()
418 char *pos; in eap_teap_load_pac() local
427 if (eap_teap_read_line(&rc, &pos) < 0) { in eap_teap_load_pac()
435 while (!err && eap_teap_read_line(&rc, &pos) == 0) { in eap_teap_load_pac()
444 err = eap_teap_parse_pac_type(pac, pos); in eap_teap_load_pac()
446 err = eap_teap_parse_pac_key(pac, pos); in eap_teap_load_pac()
448 err = eap_teap_parse_pac_opaque(pac, pos); in eap_teap_load_pac()
450 err = eap_teap_parse_a_id(pac, pos); in eap_teap_load_pac()
452 err = eap_teap_parse_i_id(pac, pos); in eap_teap_load_pac()
454 err = eap_teap_parse_a_id_info(pac, pos); in eap_teap_load_pac()
478 static void eap_teap_write(char **buf, char **pos, size_t *buf_len, in eap_teap_write() argument
486 if (!data || !buf || !(*buf) || !pos || !(*pos) || *pos < *buf) in eap_teap_write()
493 if (*pos - *buf + need > *buf_len) { in eap_teap_write()
501 *pos = nbuf + (*pos - *buf); in eap_teap_write()
507 ret = os_snprintf(*pos, end - *pos, "%s=", field); in eap_teap_write()
508 if (os_snprintf_error(end - *pos, ret)) in eap_teap_write()
510 *pos += ret; in eap_teap_write()
511 *pos += wpa_snprintf_hex(*pos, end - *pos, data, len); in eap_teap_write()
512 ret = os_snprintf(*pos, end - *pos, "\n"); in eap_teap_write()
513 if (os_snprintf_error(end - *pos, ret)) in eap_teap_write()
515 *pos += ret; in eap_teap_write()
518 ret = os_snprintf(*pos, end - *pos, "%s-txt=", field); in eap_teap_write()
519 if (os_snprintf_error(end - *pos, ret)) in eap_teap_write()
521 *pos += ret; in eap_teap_write()
523 ret = os_snprintf(*pos, end - *pos, "%c", data[i]); in eap_teap_write()
524 if (os_snprintf_error(end - *pos, ret)) in eap_teap_write()
526 *pos += ret; in eap_teap_write()
528 ret = os_snprintf(*pos, end - *pos, "\n"); in eap_teap_write()
529 if (os_snprintf_error(end - *pos, ret)) in eap_teap_write()
531 *pos += ret; in eap_teap_write()
580 char **pos, size_t *buf_len) in eap_teap_add_pac_data() argument
584 ret = os_snprintf(*pos, *buf + *buf_len - *pos, in eap_teap_add_pac_data()
586 if (os_snprintf_error(*buf + *buf_len - *pos, ret)) in eap_teap_add_pac_data()
589 *pos += ret; in eap_teap_add_pac_data()
590 eap_teap_write(buf, pos, buf_len, "PAC-Key", in eap_teap_add_pac_data()
592 eap_teap_write(buf, pos, buf_len, "PAC-Opaque", in eap_teap_add_pac_data()
594 eap_teap_write(buf, pos, buf_len, "PAC-Info", in eap_teap_add_pac_data()
596 eap_teap_write(buf, pos, buf_len, "A-ID", in eap_teap_add_pac_data()
598 eap_teap_write(buf, pos, buf_len, "I-ID", in eap_teap_add_pac_data()
600 eap_teap_write(buf, pos, buf_len, "A-ID-Info", in eap_teap_add_pac_data()
606 ret = os_snprintf(*pos, *buf + *buf_len - *pos, "END\n"); in eap_teap_add_pac_data()
607 if (os_snprintf_error(*buf + *buf_len - *pos, ret)) in eap_teap_add_pac_data()
609 *pos += ret; in eap_teap_add_pac_data()
627 char *buf, *pos; in eap_teap_save_pac() local
634 pos = buf = os_malloc(buf_len); in eap_teap_save_pac()
638 ret = os_snprintf(pos, buf + buf_len - pos, "%s\n", pac_file_hdr); in eap_teap_save_pac()
639 if (os_snprintf_error(buf + buf_len - pos, ret)) { in eap_teap_save_pac()
643 pos += ret; in eap_teap_save_pac()
647 if (eap_teap_add_pac_data(pac, &buf, &pos, &buf_len)) { in eap_teap_save_pac()
655 if (eap_teap_write_pac(sm, pac_file, buf, pos - buf)) { in eap_teap_save_pac()
710 u8 *pos, *end; in eap_teap_pac_get_a_id() local
713 pos = pac->pac_info; in eap_teap_pac_get_a_id()
714 end = pos + pac->pac_info_len; in eap_teap_pac_get_a_id()
716 while (end - pos > 4) { in eap_teap_pac_get_a_id()
717 type = WPA_GET_BE16(pos); in eap_teap_pac_get_a_id()
718 pos += 2; in eap_teap_pac_get_a_id()
719 len = WPA_GET_BE16(pos); in eap_teap_pac_get_a_id()
720 pos += 2; in eap_teap_pac_get_a_id()
721 if (len > (unsigned int) (end - pos)) in eap_teap_pac_get_a_id()
726 pac->a_id = os_memdup(pos, len); in eap_teap_pac_get_a_id()
734 pac->a_id_info = os_memdup(pos, len); in eap_teap_pac_get_a_id()
740 pos += len; in eap_teap_pac_get_a_id()
756 u8 *buf, *end, *pos; in eap_teap_load_pac_bin() local
801 pos = buf + 6; in eap_teap_load_pac_bin()
803 while (pos < end) { in eap_teap_load_pac_bin()
806 if (end - pos < 2 + EAP_TEAP_PAC_KEY_LEN + 2 + 2) { in eap_teap_load_pac_bin()
815 pac->pac_type = WPA_GET_BE16(pos); in eap_teap_load_pac_bin()
816 pos += 2; in eap_teap_load_pac_bin()
817 os_memcpy(pac->pac_key, pos, EAP_TEAP_PAC_KEY_LEN); in eap_teap_load_pac_bin()
818 pos += EAP_TEAP_PAC_KEY_LEN; in eap_teap_load_pac_bin()
819 val = WPA_GET_BE16(pos); in eap_teap_load_pac_bin()
820 pos += 2; in eap_teap_load_pac_bin()
821 if (val > end - pos) in eap_teap_load_pac_bin()
824 pac->pac_opaque = os_memdup(pos, pac->pac_opaque_len); in eap_teap_load_pac_bin()
827 pos += pac->pac_opaque_len; in eap_teap_load_pac_bin()
828 if (end - pos < 2) in eap_teap_load_pac_bin()
830 val = WPA_GET_BE16(pos); in eap_teap_load_pac_bin()
831 pos += 2; in eap_teap_load_pac_bin()
832 if (val > end - pos) in eap_teap_load_pac_bin()
835 pac->pac_info = os_memdup(pos, pac->pac_info_len); in eap_teap_load_pac_bin()
838 pos += pac->pac_info_len; in eap_teap_load_pac_bin()
880 u8 *buf, *pos; in eap_teap_save_pac_bin() local
897 pos = buf; in eap_teap_save_pac_bin()
898 WPA_PUT_BE32(pos, EAP_TEAP_PAC_BINARY_MAGIC); in eap_teap_save_pac_bin()
899 pos += 4; in eap_teap_save_pac_bin()
900 WPA_PUT_BE16(pos, EAP_TEAP_PAC_BINARY_FORMAT_VERSION); in eap_teap_save_pac_bin()
901 pos += 2; in eap_teap_save_pac_bin()
905 WPA_PUT_BE16(pos, pac->pac_type); in eap_teap_save_pac_bin()
906 pos += 2; in eap_teap_save_pac_bin()
907 os_memcpy(pos, pac->pac_key, EAP_TEAP_PAC_KEY_LEN); in eap_teap_save_pac_bin()
908 pos += EAP_TEAP_PAC_KEY_LEN; in eap_teap_save_pac_bin()
909 WPA_PUT_BE16(pos, pac->pac_opaque_len); in eap_teap_save_pac_bin()
910 pos += 2; in eap_teap_save_pac_bin()
911 os_memcpy(pos, pac->pac_opaque, pac->pac_opaque_len); in eap_teap_save_pac_bin()
912 pos += pac->pac_opaque_len; in eap_teap_save_pac_bin()
913 WPA_PUT_BE16(pos, pac->pac_info_len); in eap_teap_save_pac_bin()
914 pos += 2; in eap_teap_save_pac_bin()
915 os_memcpy(pos, pac->pac_info, pac->pac_info_len); in eap_teap_save_pac_bin()
916 pos += pac->pac_info_len; in eap_teap_save_pac_bin()