Lines Matching refs:pos

45 	u8 *pos, *rhdr, *hs_start, *hs_length, *ext_start;
49 pos = *msgpos;
52 rhdr = pos;
53 pos += TLS_RECORD_HEADER_LEN;
77 hs_start = pos;
79 *pos++ = TLS_HANDSHAKE_TYPE_SERVER_HELLO;
81 hs_length = pos;
82 pos += 3;
85 WPA_PUT_BE16(pos, conn->rl.tls_version);
86 pos += 2;
88 os_memcpy(pos, conn->server_random, TLS_RANDOM_LEN);
89 pos += TLS_RANDOM_LEN;
91 *pos++ = conn->session_id_len;
92 os_memcpy(pos, conn->session_id, conn->session_id_len);
93 pos += conn->session_id_len;
95 WPA_PUT_BE16(pos, conn->cipher_suite);
96 pos += 2;
98 *pos++ = TLS_COMPRESSION_NULL;
101 ext_start = pos;
102 pos += 2;
107 WPA_PUT_BE16(pos, TLS_EXT_STATUS_REQUEST);
108 pos += 2;
110 WPA_PUT_BE16(pos, 0);
111 pos += 2;
119 WPA_PUT_BE16(pos, TLS_EXT_STATUS_REQUEST_V2);
120 pos += 2;
122 WPA_PUT_BE16(pos, 0);
123 pos += 2;
162 if (pos == ext_start + 2)
163 pos -= 2; /* no extensions */
165 WPA_PUT_BE16(ext_start, pos - ext_start - 2);
167 WPA_PUT_BE24(hs_length, pos - hs_length - 3);
168 tls_verify_hash_add(&conn->verify, hs_start, pos - hs_start);
171 rhdr, end - rhdr, hs_start, pos - hs_start,
178 pos = rhdr + rlen;
180 *msgpos = pos;
189 u8 *pos, *rhdr, *hs_start, *hs_length, *cert_start;
201 pos = *msgpos;
202 if (TLS_RECORD_HEADER_LEN + 1 + 3 + 3 > end - pos) {
209 rhdr = pos;
210 pos += TLS_RECORD_HEADER_LEN;
215 hs_start = pos;
217 *pos++ = TLS_HANDSHAKE_TYPE_CERTIFICATE;
219 hs_length = pos;
220 pos += 3;
223 cert_start = pos;
224 pos += 3;
227 if (3 + cert->cert_len > (size_t) (end - pos)) {
231 (unsigned long) (end - pos));
236 WPA_PUT_BE24(pos, cert->cert_len);
237 pos += 3;
238 os_memcpy(pos, cert->cert_start, cert->cert_len);
239 pos += cert->cert_len;
256 WPA_PUT_BE24(cert_start, pos - cert_start - 3);
258 WPA_PUT_BE24(hs_length, pos - hs_length - 3);
261 rhdr, end - rhdr, hs_start, pos - hs_start,
268 pos = rhdr + rlen;
270 tls_verify_hash_add(&conn->verify, hs_start, pos - hs_start);
272 *msgpos = pos;
284 u8 *pos, *rhdr, *hs_start, *hs_length;
295 pos = *msgpos;
297 (unsigned int) (end - pos)) {
304 rhdr = pos;
305 pos += TLS_RECORD_HEADER_LEN;
310 hs_start = pos;
312 *pos++ = TLS_HANDSHAKE_TYPE_CERTIFICATE_STATUS;
314 hs_length = pos;
315 pos += 3;
336 *pos++ = 2; /* ocsp_multi(2) */
338 *pos++ = 1; /* ocsp(1) */
340 WPA_PUT_BE24(pos, ocsp_resp_len);
341 pos += 3;
342 os_memcpy(pos, ocsp_resp, ocsp_resp_len);
343 pos += ocsp_resp_len;
345 WPA_PUT_BE24(hs_length, pos - hs_length - 3);
348 rhdr, end - rhdr, hs_start, pos - hs_start,
355 pos = rhdr + rlen;
357 tls_verify_hash_add(&conn->verify, hs_start, pos - hs_start);
359 *msgpos = pos;
370 u8 *pos, *rhdr, *hs_start, *hs_length, *server_params;
426 pos = conn->dh_secret;
427 while (pos + 1 < conn->dh_secret + conn->dh_secret_len && *pos == 0)
428 pos++;
429 if (pos != conn->dh_secret) {
430 os_memmove(conn->dh_secret, pos,
431 conn->dh_secret_len - (pos - conn->dh_secret));
432 conn->dh_secret_len -= pos - conn->dh_secret;
478 pos = *msgpos;
481 rhdr = pos;
482 pos += TLS_RECORD_HEADER_LEN;
487 hs_start = pos;
489 *pos++ = TLS_HANDSHAKE_TYPE_SERVER_KEY_EXCHANGE;
491 hs_length = pos;
492 pos += 3;
495 server_params = pos;
497 if (2 + dh_p_len > (size_t) (end - pos)) {
505 WPA_PUT_BE16(pos, dh_p_len);
506 pos += 2;
507 os_memcpy(pos, dh_p, dh_p_len);
508 pos += dh_p_len;
511 if (2 + conn->cred->dh_g_len > (size_t) (end - pos)) {
519 WPA_PUT_BE16(pos, conn->cred->dh_g_len);
520 pos += 2;
521 os_memcpy(pos, conn->cred->dh_g, conn->cred->dh_g_len);
522 pos += conn->cred->dh_g_len;
525 if (2 + dh_ys_len > (size_t) (end - pos)) {
533 WPA_PUT_BE16(pos, dh_ys_len);
534 pos += 2;
535 os_memcpy(pos, dh_ys, dh_ys_len);
536 pos += dh_ys_len;
572 pos - server_params, hash + 19);
584 if (hlen < 0 || end - pos < 2) {
589 *pos++ = TLS_HASH_ALG_SHA256;
590 *pos++ = TLS_SIGN_ALG_RSA;
620 pos - server_params, hash);
650 signed_start = pos; /* length to be filled */
651 pos += 2;
652 clen = end - pos;
655 pos, &clen) < 0) {
665 pos[clen - 1] ^= 0x80;
669 pos += clen;
672 WPA_PUT_BE24(hs_length, pos - hs_length - 3);
675 rhdr, end - rhdr, hs_start, pos - hs_start,
682 pos = rhdr + rlen;
684 tls_verify_hash_add(&conn->verify, hs_start, pos - hs_start);
686 *msgpos = pos;
695 u8 *pos, *rhdr, *hs_start, *hs_length;
703 pos = *msgpos;
706 rhdr = pos;
707 pos += TLS_RECORD_HEADER_LEN;
712 hs_start = pos;
714 *pos++ = TLS_HANDSHAKE_TYPE_CERTIFICATE_REQUEST;
716 hs_length = pos;
717 pos += 3;
727 *pos++ = 1;
728 *pos++ = 1; /* rsa_sign */
735 WPA_PUT_BE16(pos, 0);
736 pos += 2;
738 WPA_PUT_BE24(hs_length, pos - hs_length - 3);
741 rhdr, end - rhdr, hs_start, pos - hs_start,
748 pos = rhdr + rlen;
750 tls_verify_hash_add(&conn->verify, hs_start, pos - hs_start);
752 *msgpos = pos;
761 u8 *pos;
770 pos = payload;
772 *pos++ = TLS_HANDSHAKE_TYPE_SERVER_HELLO_DONE;
774 WPA_PUT_BE24(pos, 0);
775 pos += 3;
779 *msgpos, end - *msgpos, payload, pos - payload,
787 tls_verify_hash_add(&conn->verify, payload, pos - payload);
831 u8 *pos, *hs_start;
836 pos = *msgpos;
903 pos = hs_start = verify_data;
905 *pos++ = TLS_HANDSHAKE_TYPE_FINISHED;
907 WPA_PUT_BE24(pos, TLS_VERIFY_DATA_LEN);
908 pos += 3;
909 pos += TLS_VERIFY_DATA_LEN;
910 tls_verify_hash_add(&conn->verify, hs_start, pos - hs_start);
913 *msgpos, end - *msgpos, hs_start, pos - hs_start,
929 u8 *msg, *end, *pos;
959 pos = msg;
962 if (tls_write_server_hello(conn, &pos, end) < 0) {
972 if (tls_write_server_change_cipher_spec(conn, &pos, end) < 0 ||
973 tls_write_server_finished(conn, &pos, end) < 0) {
978 *out_len = pos - msg;
986 if (tls_write_server_certificate(conn, &pos, end) < 0 ||
987 tls_write_server_certificate_status(conn, &pos, end, ocsp_multi,
989 tls_write_server_key_exchange(conn, &pos, end) < 0 ||
990 tls_write_server_certificate_request(conn, &pos, end) < 0 ||
991 tls_write_server_hello_done(conn, &pos, end) < 0) {
998 *out_len = pos - msg;
1009 u8 *msg, *end, *pos;
1017 pos = msg;
1020 if (tls_write_server_change_cipher_spec(conn, &pos, end) < 0 ||
1021 tls_write_server_finished(conn, &pos, end) < 0) {
1026 *out_len = pos - msg;
1057 u8 *alert, *pos, *length;
1066 pos = alert;
1070 *pos++ = TLS_CONTENT_TYPE_ALERT;
1072 WPA_PUT_BE16(pos, conn->rl.tls_version ? conn->rl.tls_version :
1074 pos += 2;
1076 length = pos;
1077 pos += 2;
1082 *pos++ = level;
1084 *pos++ = description;
1086 WPA_PUT_BE16(length, pos - length - 2);
1087 *out_len = pos - alert;