Lines Matching full:pos
181 const char *pos; member
190 char *pos; in eap_fast_read_line() local
199 if (rc->pos >= rc->end) in eap_fast_read_line()
201 l_end = rc->pos; in eap_fast_read_line()
204 len = l_end - rc->pos; in eap_fast_read_line()
207 os_memcpy(rc->buf, rc->pos, len); in eap_fast_read_line()
209 rc->pos = l_end + 1; in eap_fast_read_line()
213 pos = rc->buf; in eap_fast_read_line()
214 while (*pos != '\0') { in eap_fast_read_line()
215 if (*pos == '\n' || *pos == '\r') { in eap_fast_read_line()
216 *pos = '\0'; in eap_fast_read_line()
219 pos++; in eap_fast_read_line()
222 pos = os_strchr(rc->buf, '='); in eap_fast_read_line()
223 if (pos) in eap_fast_read_line()
224 *pos++ = '\0'; in eap_fast_read_line()
225 *value = pos; in eap_fast_read_line()
273 rc->pos = (char *) blob->data; in eap_fast_init_pac_data()
330 char *pos) in eap_fast_parse_pac_type() argument
332 if (!pos) in eap_fast_parse_pac_type()
334 pac->pac_type = atoi(pos); in eap_fast_parse_pac_type()
344 static const char * eap_fast_parse_pac_key(struct eap_fast_pac *pac, char *pos) in eap_fast_parse_pac_key() argument
349 key = eap_fast_parse_hex(pos, &key_len); in eap_fast_parse_pac_key()
363 char *pos) in eap_fast_parse_pac_opaque() argument
366 pac->pac_opaque = eap_fast_parse_hex(pos, &pac->pac_opaque_len); in eap_fast_parse_pac_opaque()
373 static const char * eap_fast_parse_a_id(struct eap_fast_pac *pac, char *pos) in eap_fast_parse_a_id() argument
376 pac->a_id = eap_fast_parse_hex(pos, &pac->a_id_len); in eap_fast_parse_a_id()
383 static const char * eap_fast_parse_i_id(struct eap_fast_pac *pac, char *pos) in eap_fast_parse_i_id() argument
386 pac->i_id = eap_fast_parse_hex(pos, &pac->i_id_len); in eap_fast_parse_i_id()
394 char *pos) in eap_fast_parse_a_id_info() argument
397 pac->a_id_info = eap_fast_parse_hex(pos, &pac->a_id_info_len); in eap_fast_parse_a_id_info()
417 char *pos; in eap_fast_load_pac() local
426 if (eap_fast_read_line(&rc, &pos) < 0) { in eap_fast_load_pac()
434 while (!err && eap_fast_read_line(&rc, &pos) == 0) { in eap_fast_load_pac()
443 err = eap_fast_parse_pac_type(pac, pos); in eap_fast_load_pac()
445 err = eap_fast_parse_pac_key(pac, pos); in eap_fast_load_pac()
447 err = eap_fast_parse_pac_opaque(pac, pos); in eap_fast_load_pac()
449 err = eap_fast_parse_a_id(pac, pos); in eap_fast_load_pac()
451 err = eap_fast_parse_i_id(pac, pos); in eap_fast_load_pac()
453 err = eap_fast_parse_a_id_info(pac, pos); in eap_fast_load_pac()
477 static void eap_fast_write(char **buf, char **pos, size_t *buf_len, in eap_fast_write() argument
486 pos == NULL || *pos == NULL || *pos < *buf) in eap_fast_write()
493 if (*pos - *buf + need > *buf_len) { in eap_fast_write()
500 *pos = nbuf + (*pos - *buf); in eap_fast_write()
506 ret = os_snprintf(*pos, end - *pos, "%s=", field); in eap_fast_write()
507 if (os_snprintf_error(end - *pos, ret)) in eap_fast_write()
509 *pos += ret; in eap_fast_write()
510 *pos += wpa_snprintf_hex(*pos, end - *pos, data, len); in eap_fast_write()
511 ret = os_snprintf(*pos, end - *pos, "\n"); in eap_fast_write()
512 if (os_snprintf_error(end - *pos, ret)) in eap_fast_write()
514 *pos += ret; in eap_fast_write()
517 ret = os_snprintf(*pos, end - *pos, "%s-txt=", field); in eap_fast_write()
518 if (os_snprintf_error(end - *pos, ret)) in eap_fast_write()
520 *pos += ret; in eap_fast_write()
522 ret = os_snprintf(*pos, end - *pos, "%c", data[i]); in eap_fast_write()
523 if (os_snprintf_error(end - *pos, ret)) in eap_fast_write()
525 *pos += ret; in eap_fast_write()
527 ret = os_snprintf(*pos, end - *pos, "\n"); in eap_fast_write()
528 if (os_snprintf_error(end - *pos, ret)) in eap_fast_write()
530 *pos += ret; in eap_fast_write()
575 char **pos, size_t *buf_len) in eap_fast_add_pac_data() argument
579 ret = os_snprintf(*pos, *buf + *buf_len - *pos, in eap_fast_add_pac_data()
581 if (os_snprintf_error(*buf + *buf_len - *pos, ret)) in eap_fast_add_pac_data()
584 *pos += ret; in eap_fast_add_pac_data()
585 eap_fast_write(buf, pos, buf_len, "PAC-Key", in eap_fast_add_pac_data()
587 eap_fast_write(buf, pos, buf_len, "PAC-Opaque", in eap_fast_add_pac_data()
589 eap_fast_write(buf, pos, buf_len, "PAC-Info", in eap_fast_add_pac_data()
591 eap_fast_write(buf, pos, buf_len, "A-ID", in eap_fast_add_pac_data()
593 eap_fast_write(buf, pos, buf_len, "I-ID", in eap_fast_add_pac_data()
595 eap_fast_write(buf, pos, buf_len, "A-ID-Info", in eap_fast_add_pac_data()
602 ret = os_snprintf(*pos, *buf + *buf_len - *pos, "END\n"); in eap_fast_add_pac_data()
603 if (os_snprintf_error(*buf + *buf_len - *pos, ret)) in eap_fast_add_pac_data()
605 *pos += ret; in eap_fast_add_pac_data()
623 char *buf, *pos; in eap_fast_save_pac() local
630 pos = buf = os_malloc(buf_len); in eap_fast_save_pac()
634 ret = os_snprintf(pos, buf + buf_len - pos, "%s\n", pac_file_hdr); in eap_fast_save_pac()
635 if (os_snprintf_error(buf + buf_len - pos, ret)) { in eap_fast_save_pac()
639 pos += ret; in eap_fast_save_pac()
643 if (eap_fast_add_pac_data(pac, &buf, &pos, &buf_len)) { in eap_fast_save_pac()
651 if (eap_fast_write_pac(sm, pac_file, buf, pos - buf)) { in eap_fast_save_pac()
706 u8 *pos, *end; in eap_fast_pac_get_a_id() local
709 pos = pac->pac_info; in eap_fast_pac_get_a_id()
710 end = pos + pac->pac_info_len; in eap_fast_pac_get_a_id()
712 while (end - pos > 4) { in eap_fast_pac_get_a_id()
713 type = WPA_GET_BE16(pos); in eap_fast_pac_get_a_id()
714 pos += 2; in eap_fast_pac_get_a_id()
715 len = WPA_GET_BE16(pos); in eap_fast_pac_get_a_id()
716 pos += 2; in eap_fast_pac_get_a_id()
717 if (len > (unsigned int) (end - pos)) in eap_fast_pac_get_a_id()
722 pac->a_id = os_memdup(pos, len); in eap_fast_pac_get_a_id()
730 pac->a_id_info = os_memdup(pos, len); in eap_fast_pac_get_a_id()
736 pos += len; in eap_fast_pac_get_a_id()
752 u8 *buf, *end, *pos; in eap_fast_load_pac_bin() local
797 pos = buf + 6; in eap_fast_load_pac_bin()
799 while (pos < end) { in eap_fast_load_pac_bin()
802 if (end - pos < 2 + EAP_FAST_PAC_KEY_LEN + 2 + 2) { in eap_fast_load_pac_bin()
811 pac->pac_type = WPA_GET_BE16(pos); in eap_fast_load_pac_bin()
812 pos += 2; in eap_fast_load_pac_bin()
813 os_memcpy(pac->pac_key, pos, EAP_FAST_PAC_KEY_LEN); in eap_fast_load_pac_bin()
814 pos += EAP_FAST_PAC_KEY_LEN; in eap_fast_load_pac_bin()
815 val = WPA_GET_BE16(pos); in eap_fast_load_pac_bin()
816 pos += 2; in eap_fast_load_pac_bin()
817 if (val > end - pos) in eap_fast_load_pac_bin()
820 pac->pac_opaque = os_memdup(pos, pac->pac_opaque_len); in eap_fast_load_pac_bin()
823 pos += pac->pac_opaque_len; in eap_fast_load_pac_bin()
824 if (2 > end - pos) in eap_fast_load_pac_bin()
826 val = WPA_GET_BE16(pos); in eap_fast_load_pac_bin()
827 pos += 2; in eap_fast_load_pac_bin()
828 if (val > end - pos) in eap_fast_load_pac_bin()
831 pac->pac_info = os_memdup(pos, pac->pac_info_len); in eap_fast_load_pac_bin()
834 pos += pac->pac_info_len; in eap_fast_load_pac_bin()
876 u8 *buf, *pos; in eap_fast_save_pac_bin() local
893 pos = buf; in eap_fast_save_pac_bin()
894 WPA_PUT_BE32(pos, EAP_FAST_PAC_BINARY_MAGIC); in eap_fast_save_pac_bin()
895 pos += 4; in eap_fast_save_pac_bin()
896 WPA_PUT_BE16(pos, EAP_FAST_PAC_BINARY_FORMAT_VERSION); in eap_fast_save_pac_bin()
897 pos += 2; in eap_fast_save_pac_bin()
901 WPA_PUT_BE16(pos, pac->pac_type); in eap_fast_save_pac_bin()
902 pos += 2; in eap_fast_save_pac_bin()
903 os_memcpy(pos, pac->pac_key, EAP_FAST_PAC_KEY_LEN); in eap_fast_save_pac_bin()
904 pos += EAP_FAST_PAC_KEY_LEN; in eap_fast_save_pac_bin()
905 WPA_PUT_BE16(pos, pac->pac_opaque_len); in eap_fast_save_pac_bin()
906 pos += 2; in eap_fast_save_pac_bin()
907 os_memcpy(pos, pac->pac_opaque, pac->pac_opaque_len); in eap_fast_save_pac_bin()
908 pos += pac->pac_opaque_len; in eap_fast_save_pac_bin()
909 WPA_PUT_BE16(pos, pac->pac_info_len); in eap_fast_save_pac_bin()
910 pos += 2; in eap_fast_save_pac_bin()
911 os_memcpy(pos, pac->pac_info, pac->pac_info_len); in eap_fast_save_pac_bin()
912 pos += pac->pac_info_len; in eap_fast_save_pac_bin()