Lines Matching defs:pos
45 u8 *pos, *rhdr, *hs_start, *hs_length, *ext_start;
49 pos = *msgpos;
52 rhdr = pos;
53 pos += TLS_RECORD_HEADER_LEN;
80 hs_start = pos;
82 *pos++ = TLS_HANDSHAKE_TYPE_SERVER_HELLO;
84 hs_length = pos;
85 pos += 3;
88 WPA_PUT_BE16(pos, conn->rl.tls_version);
89 pos += 2;
91 os_memcpy(pos, conn->server_random, TLS_RANDOM_LEN);
92 pos += TLS_RANDOM_LEN;
94 *pos++ = conn->session_id_len;
95 os_memcpy(pos, conn->session_id, conn->session_id_len);
96 pos += conn->session_id_len;
98 WPA_PUT_BE16(pos, conn->cipher_suite);
99 pos += 2;
101 *pos++ = TLS_COMPRESSION_NULL;
104 ext_start = pos;
105 pos += 2;
110 WPA_PUT_BE16(pos, TLS_EXT_STATUS_REQUEST);
111 pos += 2;
113 WPA_PUT_BE16(pos, 0);
114 pos += 2;
122 WPA_PUT_BE16(pos, TLS_EXT_STATUS_REQUEST_V2);
123 pos += 2;
125 WPA_PUT_BE16(pos, 0);
126 pos += 2;
165 if (pos == ext_start + 2)
166 pos -= 2; /* no extensions */
168 WPA_PUT_BE16(ext_start, pos - ext_start - 2);
170 WPA_PUT_BE24(hs_length, pos - hs_length - 3);
171 tls_verify_hash_add(&conn->verify, hs_start, pos - hs_start);
174 rhdr, end - rhdr, hs_start, pos - hs_start,
181 pos = rhdr + rlen;
183 *msgpos = pos;
192 u8 *pos, *rhdr, *hs_start, *hs_length, *cert_start;
204 pos = *msgpos;
205 if (TLS_RECORD_HEADER_LEN + 1 + 3 + 3 > end - pos) {
212 rhdr = pos;
213 pos += TLS_RECORD_HEADER_LEN;
218 hs_start = pos;
220 *pos++ = TLS_HANDSHAKE_TYPE_CERTIFICATE;
222 hs_length = pos;
223 pos += 3;
226 cert_start = pos;
227 pos += 3;
230 if (3 + cert->cert_len > (size_t) (end - pos)) {
234 (unsigned long) (end - pos));
239 WPA_PUT_BE24(pos, cert->cert_len);
240 pos += 3;
241 os_memcpy(pos, cert->cert_start, cert->cert_len);
242 pos += cert->cert_len;
259 WPA_PUT_BE24(cert_start, pos - cert_start - 3);
261 WPA_PUT_BE24(hs_length, pos - hs_length - 3);
264 rhdr, end - rhdr, hs_start, pos - hs_start,
271 pos = rhdr + rlen;
273 tls_verify_hash_add(&conn->verify, hs_start, pos - hs_start);
275 *msgpos = pos;
287 u8 *pos, *rhdr, *hs_start, *hs_length;
298 pos = *msgpos;
300 (unsigned int) (end - pos)) {
307 rhdr = pos;
308 pos += TLS_RECORD_HEADER_LEN;
313 hs_start = pos;
315 *pos++ = TLS_HANDSHAKE_TYPE_CERTIFICATE_STATUS;
317 hs_length = pos;
318 pos += 3;
339 *pos++ = 2; /* ocsp_multi(2) */
341 *pos++ = 1; /* ocsp(1) */
343 WPA_PUT_BE24(pos, ocsp_resp_len);
344 pos += 3;
345 os_memcpy(pos, ocsp_resp, ocsp_resp_len);
346 pos += ocsp_resp_len;
348 WPA_PUT_BE24(hs_length, pos - hs_length - 3);
351 rhdr, end - rhdr, hs_start, pos - hs_start,
358 pos = rhdr + rlen;
360 tls_verify_hash_add(&conn->verify, hs_start, pos - hs_start);
362 *msgpos = pos;
373 u8 *pos, *rhdr, *hs_start, *hs_length, *server_params;
429 pos = conn->dh_secret;
430 while (pos + 1 < conn->dh_secret + conn->dh_secret_len && *pos == 0)
431 pos++;
432 if (pos != conn->dh_secret) {
433 os_memmove(conn->dh_secret, pos,
434 conn->dh_secret_len - (pos - conn->dh_secret));
435 conn->dh_secret_len -= pos - conn->dh_secret;
481 pos = *msgpos;
484 rhdr = pos;
485 pos += TLS_RECORD_HEADER_LEN;
490 hs_start = pos;
492 *pos++ = TLS_HANDSHAKE_TYPE_SERVER_KEY_EXCHANGE;
494 hs_length = pos;
495 pos += 3;
498 server_params = pos;
500 if (2 + dh_p_len > (size_t) (end - pos)) {
508 WPA_PUT_BE16(pos, dh_p_len);
509 pos += 2;
510 os_memcpy(pos, dh_p, dh_p_len);
511 pos += dh_p_len;
514 if (2 + conn->cred->dh_g_len > (size_t) (end - pos)) {
522 WPA_PUT_BE16(pos, conn->cred->dh_g_len);
523 pos += 2;
524 os_memcpy(pos, conn->cred->dh_g, conn->cred->dh_g_len);
525 pos += conn->cred->dh_g_len;
528 if (2 + dh_ys_len > (size_t) (end - pos)) {
536 WPA_PUT_BE16(pos, dh_ys_len);
537 pos += 2;
538 os_memcpy(pos, dh_ys, dh_ys_len);
539 pos += dh_ys_len;
575 pos - server_params, hash + 19);
587 if (hlen < 0 || end - pos < 2) {
592 *pos++ = TLS_HASH_ALG_SHA256;
593 *pos++ = TLS_SIGN_ALG_RSA;
623 pos - server_params, hash, sizeof(hash));
653 signed_start = pos; /* length to be filled */
654 pos += 2;
655 clen = end - pos;
658 pos, &clen) < 0) {
668 pos[clen - 1] ^= 0x80;
672 pos += clen;
675 WPA_PUT_BE24(hs_length, pos - hs_length - 3);
678 rhdr, end - rhdr, hs_start, pos - hs_start,
685 pos = rhdr + rlen;
687 tls_verify_hash_add(&conn->verify, hs_start, pos - hs_start);
689 *msgpos = pos;
698 u8 *pos, *rhdr, *hs_start, *hs_length;
706 pos = *msgpos;
709 rhdr = pos;
710 pos += TLS_RECORD_HEADER_LEN;
715 hs_start = pos;
717 *pos++ = TLS_HANDSHAKE_TYPE_CERTIFICATE_REQUEST;
719 hs_length = pos;
720 pos += 3;
730 *pos++ = 1;
731 *pos++ = 1; /* rsa_sign */
738 WPA_PUT_BE16(pos, 0);
739 pos += 2;
741 WPA_PUT_BE24(hs_length, pos - hs_length - 3);
744 rhdr, end - rhdr, hs_start, pos - hs_start,
751 pos = rhdr + rlen;
753 tls_verify_hash_add(&conn->verify, hs_start, pos - hs_start);
755 *msgpos = pos;
764 u8 *pos;
773 pos = payload;
775 *pos++ = TLS_HANDSHAKE_TYPE_SERVER_HELLO_DONE;
777 WPA_PUT_BE24(pos, 0);
778 pos += 3;
782 *msgpos, end - *msgpos, payload, pos - payload,
790 tls_verify_hash_add(&conn->verify, payload, pos - payload);
834 u8 *pos, *hs_start;
839 pos = *msgpos;
906 pos = hs_start = verify_data;
908 *pos++ = TLS_HANDSHAKE_TYPE_FINISHED;
910 WPA_PUT_BE24(pos, TLS_VERIFY_DATA_LEN);
911 pos += 3;
912 pos += TLS_VERIFY_DATA_LEN;
913 tls_verify_hash_add(&conn->verify, hs_start, pos - hs_start);
916 *msgpos, end - *msgpos, hs_start, pos - hs_start,
932 u8 *msg, *end, *pos;
962 pos = msg;
965 if (tls_write_server_hello(conn, &pos, end) < 0) {
975 if (tls_write_server_change_cipher_spec(conn, &pos, end) < 0 ||
976 tls_write_server_finished(conn, &pos, end) < 0) {
981 *out_len = pos - msg;
989 if (tls_write_server_certificate(conn, &pos, end) < 0 ||
990 tls_write_server_certificate_status(conn, &pos, end, ocsp_multi,
992 tls_write_server_key_exchange(conn, &pos, end) < 0 ||
993 tls_write_server_certificate_request(conn, &pos, end) < 0 ||
994 tls_write_server_hello_done(conn, &pos, end) < 0) {
1001 *out_len = pos - msg;
1012 u8 *msg, *end, *pos;
1020 pos = msg;
1023 if (tls_write_server_change_cipher_spec(conn, &pos, end) < 0 ||
1024 tls_write_server_finished(conn, &pos, end) < 0) {
1029 *out_len = pos - msg;
1060 u8 *alert, *pos, *length;
1069 pos = alert;
1073 *pos++ = TLS_CONTENT_TYPE_ALERT;
1075 WPA_PUT_BE16(pos, conn->rl.tls_version ? conn->rl.tls_version :
1077 pos += 2;
1079 length = pos;
1080 pos += 2;
1085 *pos++ = level;
1087 *pos++ = description;
1089 WPA_PUT_BE16(length, pos - length - 2);
1090 *out_len = pos - alert;