/src/openssl111/ssl/packet_local.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright 2015-2022 The OpenSSL Project Authors. All Rights Reserved. |
3 | | * |
4 | | * Licensed under the OpenSSL license (the "License"). You may not use |
5 | | * this file except in compliance with the License. You can obtain a copy |
6 | | * in the file LICENSE in the source distribution or at |
7 | | * https://www.openssl.org/source/license.html |
8 | | */ |
9 | | |
10 | | #ifndef OSSL_SSL_PACKET_LOCAL_H |
11 | | # define OSSL_SSL_PACKET_LOCAL_H |
12 | | |
13 | | # include <string.h> |
14 | | # include <openssl/bn.h> |
15 | | # include <openssl/buffer.h> |
16 | | # include <openssl/crypto.h> |
17 | | # include <openssl/e_os2.h> |
18 | | |
19 | | # include "internal/numbers.h" |
20 | | |
21 | | typedef struct { |
22 | | /* Pointer to where we are currently reading from */ |
23 | | const unsigned char *curr; |
24 | | /* Number of bytes remaining */ |
25 | | size_t remaining; |
26 | | } PACKET; |
27 | | |
28 | | /* Internal unchecked shorthand; don't use outside this file. */ |
29 | | static ossl_inline void packet_forward(PACKET *pkt, size_t len) |
30 | 0 | { |
31 | 0 | pkt->curr += len; |
32 | 0 | pkt->remaining -= len; |
33 | 0 | } Unexecuted instantiation: ssl_asn1.c:packet_forward Unexecuted instantiation: ssl_init.c:packet_forward Unexecuted instantiation: ssl_sess.c:packet_forward Unexecuted instantiation: ssl_txt.c:packet_forward Unexecuted instantiation: extensions.c:packet_forward Unexecuted instantiation: extensions_clnt.c:packet_forward Unexecuted instantiation: extensions_cust.c:packet_forward Unexecuted instantiation: extensions_srvr.c:packet_forward Unexecuted instantiation: statem.c:packet_forward Unexecuted instantiation: statem_clnt.c:packet_forward Unexecuted instantiation: statem_dtls.c:packet_forward Unexecuted instantiation: statem_lib.c:packet_forward Unexecuted instantiation: statem_srvr.c:packet_forward Unexecuted instantiation: t1_lib.c:packet_forward Unexecuted instantiation: tls13_enc.c:packet_forward Unexecuted instantiation: tls_srp.c:packet_forward Unexecuted instantiation: d1_lib.c:packet_forward Unexecuted instantiation: d1_srtp.c:packet_forward Unexecuted instantiation: methods.c:packet_forward Unexecuted instantiation: packet.c:packet_forward Unexecuted instantiation: pqueue.c:packet_forward Unexecuted instantiation: rec_layer_d1.c:packet_forward Unexecuted instantiation: rec_layer_s3.c:packet_forward Unexecuted instantiation: ssl3_buffer.c:packet_forward Unexecuted instantiation: ssl3_record.c:packet_forward Unexecuted instantiation: ssl3_record_tls13.c:packet_forward Unexecuted instantiation: s3_cbc.c:packet_forward Unexecuted instantiation: s3_enc.c:packet_forward Unexecuted instantiation: s3_lib.c:packet_forward Unexecuted instantiation: s3_msg.c:packet_forward Unexecuted instantiation: ssl_cert.c:packet_forward Unexecuted instantiation: ssl_ciph.c:packet_forward Unexecuted instantiation: ssl_lib.c:packet_forward Unexecuted instantiation: ssl_mcnf.c:packet_forward Unexecuted instantiation: ssl_rsa.c:packet_forward Unexecuted instantiation: t1_enc.c:packet_forward Unexecuted instantiation: d1_msg.c:packet_forward Unexecuted instantiation: dtls1_bitmap.c:packet_forward Unexecuted instantiation: ssl_conf.c:packet_forward |
34 | | |
35 | | /* |
36 | | * Returns the number of bytes remaining to be read in the PACKET |
37 | | */ |
38 | | static ossl_inline size_t PACKET_remaining(const PACKET *pkt) |
39 | 0 | { |
40 | 0 | return pkt->remaining; |
41 | 0 | } Unexecuted instantiation: ssl_asn1.c:PACKET_remaining Unexecuted instantiation: ssl_init.c:PACKET_remaining Unexecuted instantiation: ssl_sess.c:PACKET_remaining Unexecuted instantiation: ssl_txt.c:PACKET_remaining Unexecuted instantiation: extensions.c:PACKET_remaining Unexecuted instantiation: extensions_clnt.c:PACKET_remaining Unexecuted instantiation: extensions_cust.c:PACKET_remaining Unexecuted instantiation: extensions_srvr.c:PACKET_remaining Unexecuted instantiation: statem.c:PACKET_remaining Unexecuted instantiation: statem_clnt.c:PACKET_remaining Unexecuted instantiation: statem_dtls.c:PACKET_remaining Unexecuted instantiation: statem_lib.c:PACKET_remaining Unexecuted instantiation: statem_srvr.c:PACKET_remaining Unexecuted instantiation: t1_lib.c:PACKET_remaining Unexecuted instantiation: tls13_enc.c:PACKET_remaining Unexecuted instantiation: tls_srp.c:PACKET_remaining Unexecuted instantiation: d1_lib.c:PACKET_remaining Unexecuted instantiation: d1_srtp.c:PACKET_remaining Unexecuted instantiation: methods.c:PACKET_remaining Unexecuted instantiation: packet.c:PACKET_remaining Unexecuted instantiation: pqueue.c:PACKET_remaining Unexecuted instantiation: rec_layer_d1.c:PACKET_remaining Unexecuted instantiation: rec_layer_s3.c:PACKET_remaining Unexecuted instantiation: ssl3_buffer.c:PACKET_remaining Unexecuted instantiation: ssl3_record.c:PACKET_remaining Unexecuted instantiation: ssl3_record_tls13.c:PACKET_remaining Unexecuted instantiation: s3_cbc.c:PACKET_remaining Unexecuted instantiation: s3_enc.c:PACKET_remaining Unexecuted instantiation: s3_lib.c:PACKET_remaining Unexecuted instantiation: s3_msg.c:PACKET_remaining Unexecuted instantiation: ssl_cert.c:PACKET_remaining Unexecuted instantiation: ssl_ciph.c:PACKET_remaining Unexecuted instantiation: ssl_lib.c:PACKET_remaining Unexecuted instantiation: ssl_mcnf.c:PACKET_remaining Unexecuted instantiation: ssl_rsa.c:PACKET_remaining Unexecuted instantiation: t1_enc.c:PACKET_remaining Unexecuted instantiation: d1_msg.c:PACKET_remaining Unexecuted instantiation: dtls1_bitmap.c:PACKET_remaining Unexecuted instantiation: ssl_conf.c:PACKET_remaining |
42 | | |
43 | | /* |
44 | | * Returns a pointer to the first byte after the packet data. |
45 | | * Useful for integrating with non-PACKET parsing code. |
46 | | * Specifically, we use PACKET_end() to verify that a d2i_... call |
47 | | * has consumed the entire packet contents. |
48 | | */ |
49 | | static ossl_inline const unsigned char *PACKET_end(const PACKET *pkt) |
50 | 0 | { |
51 | 0 | return pkt->curr + pkt->remaining; |
52 | 0 | } Unexecuted instantiation: ssl_asn1.c:PACKET_end Unexecuted instantiation: ssl_init.c:PACKET_end Unexecuted instantiation: ssl_sess.c:PACKET_end Unexecuted instantiation: ssl_txt.c:PACKET_end Unexecuted instantiation: extensions.c:PACKET_end Unexecuted instantiation: extensions_clnt.c:PACKET_end Unexecuted instantiation: extensions_cust.c:PACKET_end Unexecuted instantiation: extensions_srvr.c:PACKET_end Unexecuted instantiation: statem.c:PACKET_end Unexecuted instantiation: statem_clnt.c:PACKET_end Unexecuted instantiation: statem_dtls.c:PACKET_end Unexecuted instantiation: statem_lib.c:PACKET_end Unexecuted instantiation: statem_srvr.c:PACKET_end Unexecuted instantiation: t1_lib.c:PACKET_end Unexecuted instantiation: tls13_enc.c:PACKET_end Unexecuted instantiation: tls_srp.c:PACKET_end Unexecuted instantiation: d1_lib.c:PACKET_end Unexecuted instantiation: d1_srtp.c:PACKET_end Unexecuted instantiation: methods.c:PACKET_end Unexecuted instantiation: packet.c:PACKET_end Unexecuted instantiation: pqueue.c:PACKET_end Unexecuted instantiation: rec_layer_d1.c:PACKET_end Unexecuted instantiation: rec_layer_s3.c:PACKET_end Unexecuted instantiation: ssl3_buffer.c:PACKET_end Unexecuted instantiation: ssl3_record.c:PACKET_end Unexecuted instantiation: ssl3_record_tls13.c:PACKET_end Unexecuted instantiation: s3_cbc.c:PACKET_end Unexecuted instantiation: s3_enc.c:PACKET_end Unexecuted instantiation: s3_lib.c:PACKET_end Unexecuted instantiation: s3_msg.c:PACKET_end Unexecuted instantiation: ssl_cert.c:PACKET_end Unexecuted instantiation: ssl_ciph.c:PACKET_end Unexecuted instantiation: ssl_lib.c:PACKET_end Unexecuted instantiation: ssl_mcnf.c:PACKET_end Unexecuted instantiation: ssl_rsa.c:PACKET_end Unexecuted instantiation: t1_enc.c:PACKET_end Unexecuted instantiation: d1_msg.c:PACKET_end Unexecuted instantiation: dtls1_bitmap.c:PACKET_end Unexecuted instantiation: ssl_conf.c:PACKET_end |
53 | | |
54 | | /* |
55 | | * Returns a pointer to the PACKET's current position. |
56 | | * For use in non-PACKETized APIs. |
57 | | */ |
58 | | static ossl_inline const unsigned char *PACKET_data(const PACKET *pkt) |
59 | 0 | { |
60 | 0 | return pkt->curr; |
61 | 0 | } Unexecuted instantiation: ssl_asn1.c:PACKET_data Unexecuted instantiation: ssl_init.c:PACKET_data Unexecuted instantiation: ssl_sess.c:PACKET_data Unexecuted instantiation: ssl_txt.c:PACKET_data Unexecuted instantiation: extensions.c:PACKET_data Unexecuted instantiation: extensions_clnt.c:PACKET_data Unexecuted instantiation: extensions_cust.c:PACKET_data Unexecuted instantiation: extensions_srvr.c:PACKET_data Unexecuted instantiation: statem.c:PACKET_data Unexecuted instantiation: statem_clnt.c:PACKET_data Unexecuted instantiation: statem_dtls.c:PACKET_data Unexecuted instantiation: statem_lib.c:PACKET_data Unexecuted instantiation: statem_srvr.c:PACKET_data Unexecuted instantiation: t1_lib.c:PACKET_data Unexecuted instantiation: tls13_enc.c:PACKET_data Unexecuted instantiation: tls_srp.c:PACKET_data Unexecuted instantiation: d1_lib.c:PACKET_data Unexecuted instantiation: d1_srtp.c:PACKET_data Unexecuted instantiation: methods.c:PACKET_data Unexecuted instantiation: packet.c:PACKET_data Unexecuted instantiation: pqueue.c:PACKET_data Unexecuted instantiation: rec_layer_d1.c:PACKET_data Unexecuted instantiation: rec_layer_s3.c:PACKET_data Unexecuted instantiation: ssl3_buffer.c:PACKET_data Unexecuted instantiation: ssl3_record.c:PACKET_data Unexecuted instantiation: ssl3_record_tls13.c:PACKET_data Unexecuted instantiation: s3_cbc.c:PACKET_data Unexecuted instantiation: s3_enc.c:PACKET_data Unexecuted instantiation: s3_lib.c:PACKET_data Unexecuted instantiation: s3_msg.c:PACKET_data Unexecuted instantiation: ssl_cert.c:PACKET_data Unexecuted instantiation: ssl_ciph.c:PACKET_data Unexecuted instantiation: ssl_lib.c:PACKET_data Unexecuted instantiation: ssl_mcnf.c:PACKET_data Unexecuted instantiation: ssl_rsa.c:PACKET_data Unexecuted instantiation: t1_enc.c:PACKET_data Unexecuted instantiation: d1_msg.c:PACKET_data Unexecuted instantiation: dtls1_bitmap.c:PACKET_data Unexecuted instantiation: ssl_conf.c:PACKET_data |
62 | | |
63 | | /* |
64 | | * Initialise a PACKET with |len| bytes held in |buf|. This does not make a |
65 | | * copy of the data so |buf| must be present for the whole time that the PACKET |
66 | | * is being used. |
67 | | */ |
68 | | __owur static ossl_inline int PACKET_buf_init(PACKET *pkt, |
69 | | const unsigned char *buf, |
70 | | size_t len) |
71 | 0 | { |
72 | | /* Sanity check for negative values. */ |
73 | 0 | if (len > (size_t)(SIZE_MAX / 2)) |
74 | 0 | return 0; |
75 | | |
76 | 0 | pkt->curr = buf; |
77 | 0 | pkt->remaining = len; |
78 | 0 | return 1; |
79 | 0 | } Unexecuted instantiation: ssl_asn1.c:PACKET_buf_init Unexecuted instantiation: ssl_init.c:PACKET_buf_init Unexecuted instantiation: ssl_sess.c:PACKET_buf_init Unexecuted instantiation: ssl_txt.c:PACKET_buf_init Unexecuted instantiation: extensions.c:PACKET_buf_init Unexecuted instantiation: extensions_clnt.c:PACKET_buf_init Unexecuted instantiation: extensions_cust.c:PACKET_buf_init Unexecuted instantiation: extensions_srvr.c:PACKET_buf_init Unexecuted instantiation: statem.c:PACKET_buf_init Unexecuted instantiation: statem_clnt.c:PACKET_buf_init Unexecuted instantiation: statem_dtls.c:PACKET_buf_init Unexecuted instantiation: statem_lib.c:PACKET_buf_init Unexecuted instantiation: statem_srvr.c:PACKET_buf_init Unexecuted instantiation: t1_lib.c:PACKET_buf_init Unexecuted instantiation: tls13_enc.c:PACKET_buf_init Unexecuted instantiation: tls_srp.c:PACKET_buf_init Unexecuted instantiation: d1_lib.c:PACKET_buf_init Unexecuted instantiation: d1_srtp.c:PACKET_buf_init Unexecuted instantiation: methods.c:PACKET_buf_init Unexecuted instantiation: packet.c:PACKET_buf_init Unexecuted instantiation: pqueue.c:PACKET_buf_init Unexecuted instantiation: rec_layer_d1.c:PACKET_buf_init Unexecuted instantiation: rec_layer_s3.c:PACKET_buf_init Unexecuted instantiation: ssl3_buffer.c:PACKET_buf_init Unexecuted instantiation: ssl3_record.c:PACKET_buf_init Unexecuted instantiation: ssl3_record_tls13.c:PACKET_buf_init Unexecuted instantiation: s3_cbc.c:PACKET_buf_init Unexecuted instantiation: s3_enc.c:PACKET_buf_init Unexecuted instantiation: s3_lib.c:PACKET_buf_init Unexecuted instantiation: s3_msg.c:PACKET_buf_init Unexecuted instantiation: ssl_cert.c:PACKET_buf_init Unexecuted instantiation: ssl_ciph.c:PACKET_buf_init Unexecuted instantiation: ssl_lib.c:PACKET_buf_init Unexecuted instantiation: ssl_mcnf.c:PACKET_buf_init Unexecuted instantiation: ssl_rsa.c:PACKET_buf_init Unexecuted instantiation: t1_enc.c:PACKET_buf_init Unexecuted instantiation: d1_msg.c:PACKET_buf_init Unexecuted instantiation: dtls1_bitmap.c:PACKET_buf_init Unexecuted instantiation: ssl_conf.c:PACKET_buf_init |
80 | | |
81 | | /* Initialize a PACKET to hold zero bytes. */ |
82 | | static ossl_inline void PACKET_null_init(PACKET *pkt) |
83 | 0 | { |
84 | 0 | pkt->curr = NULL; |
85 | 0 | pkt->remaining = 0; |
86 | 0 | } Unexecuted instantiation: ssl_asn1.c:PACKET_null_init Unexecuted instantiation: ssl_init.c:PACKET_null_init Unexecuted instantiation: ssl_sess.c:PACKET_null_init Unexecuted instantiation: ssl_txt.c:PACKET_null_init Unexecuted instantiation: extensions.c:PACKET_null_init Unexecuted instantiation: extensions_clnt.c:PACKET_null_init Unexecuted instantiation: extensions_cust.c:PACKET_null_init Unexecuted instantiation: extensions_srvr.c:PACKET_null_init Unexecuted instantiation: statem.c:PACKET_null_init Unexecuted instantiation: statem_clnt.c:PACKET_null_init Unexecuted instantiation: statem_dtls.c:PACKET_null_init Unexecuted instantiation: statem_lib.c:PACKET_null_init Unexecuted instantiation: statem_srvr.c:PACKET_null_init Unexecuted instantiation: t1_lib.c:PACKET_null_init Unexecuted instantiation: tls13_enc.c:PACKET_null_init Unexecuted instantiation: tls_srp.c:PACKET_null_init Unexecuted instantiation: d1_lib.c:PACKET_null_init Unexecuted instantiation: d1_srtp.c:PACKET_null_init Unexecuted instantiation: methods.c:PACKET_null_init Unexecuted instantiation: packet.c:PACKET_null_init Unexecuted instantiation: pqueue.c:PACKET_null_init Unexecuted instantiation: rec_layer_d1.c:PACKET_null_init Unexecuted instantiation: rec_layer_s3.c:PACKET_null_init Unexecuted instantiation: ssl3_buffer.c:PACKET_null_init Unexecuted instantiation: ssl3_record.c:PACKET_null_init Unexecuted instantiation: ssl3_record_tls13.c:PACKET_null_init Unexecuted instantiation: s3_cbc.c:PACKET_null_init Unexecuted instantiation: s3_enc.c:PACKET_null_init Unexecuted instantiation: s3_lib.c:PACKET_null_init Unexecuted instantiation: s3_msg.c:PACKET_null_init Unexecuted instantiation: ssl_cert.c:PACKET_null_init Unexecuted instantiation: ssl_ciph.c:PACKET_null_init Unexecuted instantiation: ssl_lib.c:PACKET_null_init Unexecuted instantiation: ssl_mcnf.c:PACKET_null_init Unexecuted instantiation: ssl_rsa.c:PACKET_null_init Unexecuted instantiation: t1_enc.c:PACKET_null_init Unexecuted instantiation: d1_msg.c:PACKET_null_init Unexecuted instantiation: dtls1_bitmap.c:PACKET_null_init Unexecuted instantiation: ssl_conf.c:PACKET_null_init |
87 | | |
88 | | /* |
89 | | * Returns 1 if the packet has length |num| and its contents equal the |num| |
90 | | * bytes read from |ptr|. Returns 0 otherwise (lengths or contents not equal). |
91 | | * If lengths are equal, performs the comparison in constant time. |
92 | | */ |
93 | | __owur static ossl_inline int PACKET_equal(const PACKET *pkt, const void *ptr, |
94 | | size_t num) |
95 | 0 | { |
96 | 0 | if (PACKET_remaining(pkt) != num) |
97 | 0 | return 0; |
98 | 0 | return CRYPTO_memcmp(pkt->curr, ptr, num) == 0; |
99 | 0 | } Unexecuted instantiation: ssl_asn1.c:PACKET_equal Unexecuted instantiation: ssl_init.c:PACKET_equal Unexecuted instantiation: ssl_sess.c:PACKET_equal Unexecuted instantiation: ssl_txt.c:PACKET_equal Unexecuted instantiation: extensions.c:PACKET_equal Unexecuted instantiation: extensions_clnt.c:PACKET_equal Unexecuted instantiation: extensions_cust.c:PACKET_equal Unexecuted instantiation: extensions_srvr.c:PACKET_equal Unexecuted instantiation: statem.c:PACKET_equal Unexecuted instantiation: statem_clnt.c:PACKET_equal Unexecuted instantiation: statem_dtls.c:PACKET_equal Unexecuted instantiation: statem_lib.c:PACKET_equal Unexecuted instantiation: statem_srvr.c:PACKET_equal Unexecuted instantiation: t1_lib.c:PACKET_equal Unexecuted instantiation: tls13_enc.c:PACKET_equal Unexecuted instantiation: tls_srp.c:PACKET_equal Unexecuted instantiation: d1_lib.c:PACKET_equal Unexecuted instantiation: d1_srtp.c:PACKET_equal Unexecuted instantiation: methods.c:PACKET_equal Unexecuted instantiation: packet.c:PACKET_equal Unexecuted instantiation: pqueue.c:PACKET_equal Unexecuted instantiation: rec_layer_d1.c:PACKET_equal Unexecuted instantiation: rec_layer_s3.c:PACKET_equal Unexecuted instantiation: ssl3_buffer.c:PACKET_equal Unexecuted instantiation: ssl3_record.c:PACKET_equal Unexecuted instantiation: ssl3_record_tls13.c:PACKET_equal Unexecuted instantiation: s3_cbc.c:PACKET_equal Unexecuted instantiation: s3_enc.c:PACKET_equal Unexecuted instantiation: s3_lib.c:PACKET_equal Unexecuted instantiation: s3_msg.c:PACKET_equal Unexecuted instantiation: ssl_cert.c:PACKET_equal Unexecuted instantiation: ssl_ciph.c:PACKET_equal Unexecuted instantiation: ssl_lib.c:PACKET_equal Unexecuted instantiation: ssl_mcnf.c:PACKET_equal Unexecuted instantiation: ssl_rsa.c:PACKET_equal Unexecuted instantiation: t1_enc.c:PACKET_equal Unexecuted instantiation: d1_msg.c:PACKET_equal Unexecuted instantiation: dtls1_bitmap.c:PACKET_equal Unexecuted instantiation: ssl_conf.c:PACKET_equal |
100 | | |
101 | | /* |
102 | | * Peek ahead and initialize |subpkt| with the next |len| bytes read from |pkt|. |
103 | | * Data is not copied: the |subpkt| packet will share its underlying buffer with |
104 | | * the original |pkt|, so data wrapped by |pkt| must outlive the |subpkt|. |
105 | | */ |
106 | | __owur static ossl_inline int PACKET_peek_sub_packet(const PACKET *pkt, |
107 | | PACKET *subpkt, size_t len) |
108 | 0 | { |
109 | 0 | if (PACKET_remaining(pkt) < len) |
110 | 0 | return 0; |
111 | | |
112 | 0 | return PACKET_buf_init(subpkt, pkt->curr, len); |
113 | 0 | } Unexecuted instantiation: ssl_asn1.c:PACKET_peek_sub_packet Unexecuted instantiation: ssl_init.c:PACKET_peek_sub_packet Unexecuted instantiation: ssl_sess.c:PACKET_peek_sub_packet Unexecuted instantiation: ssl_txt.c:PACKET_peek_sub_packet Unexecuted instantiation: extensions.c:PACKET_peek_sub_packet Unexecuted instantiation: extensions_clnt.c:PACKET_peek_sub_packet Unexecuted instantiation: extensions_cust.c:PACKET_peek_sub_packet Unexecuted instantiation: extensions_srvr.c:PACKET_peek_sub_packet Unexecuted instantiation: statem.c:PACKET_peek_sub_packet Unexecuted instantiation: statem_clnt.c:PACKET_peek_sub_packet Unexecuted instantiation: statem_dtls.c:PACKET_peek_sub_packet Unexecuted instantiation: statem_lib.c:PACKET_peek_sub_packet Unexecuted instantiation: statem_srvr.c:PACKET_peek_sub_packet Unexecuted instantiation: t1_lib.c:PACKET_peek_sub_packet Unexecuted instantiation: tls13_enc.c:PACKET_peek_sub_packet Unexecuted instantiation: tls_srp.c:PACKET_peek_sub_packet Unexecuted instantiation: d1_lib.c:PACKET_peek_sub_packet Unexecuted instantiation: d1_srtp.c:PACKET_peek_sub_packet Unexecuted instantiation: methods.c:PACKET_peek_sub_packet Unexecuted instantiation: packet.c:PACKET_peek_sub_packet Unexecuted instantiation: pqueue.c:PACKET_peek_sub_packet Unexecuted instantiation: rec_layer_d1.c:PACKET_peek_sub_packet Unexecuted instantiation: rec_layer_s3.c:PACKET_peek_sub_packet Unexecuted instantiation: ssl3_buffer.c:PACKET_peek_sub_packet Unexecuted instantiation: ssl3_record.c:PACKET_peek_sub_packet Unexecuted instantiation: ssl3_record_tls13.c:PACKET_peek_sub_packet Unexecuted instantiation: s3_cbc.c:PACKET_peek_sub_packet Unexecuted instantiation: s3_enc.c:PACKET_peek_sub_packet Unexecuted instantiation: s3_lib.c:PACKET_peek_sub_packet Unexecuted instantiation: s3_msg.c:PACKET_peek_sub_packet Unexecuted instantiation: ssl_cert.c:PACKET_peek_sub_packet Unexecuted instantiation: ssl_ciph.c:PACKET_peek_sub_packet Unexecuted instantiation: ssl_lib.c:PACKET_peek_sub_packet Unexecuted instantiation: ssl_mcnf.c:PACKET_peek_sub_packet Unexecuted instantiation: ssl_rsa.c:PACKET_peek_sub_packet Unexecuted instantiation: t1_enc.c:PACKET_peek_sub_packet Unexecuted instantiation: d1_msg.c:PACKET_peek_sub_packet Unexecuted instantiation: dtls1_bitmap.c:PACKET_peek_sub_packet Unexecuted instantiation: ssl_conf.c:PACKET_peek_sub_packet |
114 | | |
115 | | /* |
116 | | * Initialize |subpkt| with the next |len| bytes read from |pkt|. Data is not |
117 | | * copied: the |subpkt| packet will share its underlying buffer with the |
118 | | * original |pkt|, so data wrapped by |pkt| must outlive the |subpkt|. |
119 | | */ |
120 | | __owur static ossl_inline int PACKET_get_sub_packet(PACKET *pkt, |
121 | | PACKET *subpkt, size_t len) |
122 | 0 | { |
123 | 0 | if (!PACKET_peek_sub_packet(pkt, subpkt, len)) |
124 | 0 | return 0; |
125 | | |
126 | 0 | packet_forward(pkt, len); |
127 | |
|
128 | 0 | return 1; |
129 | 0 | } Unexecuted instantiation: ssl_asn1.c:PACKET_get_sub_packet Unexecuted instantiation: ssl_init.c:PACKET_get_sub_packet Unexecuted instantiation: ssl_sess.c:PACKET_get_sub_packet Unexecuted instantiation: ssl_txt.c:PACKET_get_sub_packet Unexecuted instantiation: extensions.c:PACKET_get_sub_packet Unexecuted instantiation: extensions_clnt.c:PACKET_get_sub_packet Unexecuted instantiation: extensions_cust.c:PACKET_get_sub_packet Unexecuted instantiation: extensions_srvr.c:PACKET_get_sub_packet Unexecuted instantiation: statem.c:PACKET_get_sub_packet Unexecuted instantiation: statem_clnt.c:PACKET_get_sub_packet Unexecuted instantiation: statem_dtls.c:PACKET_get_sub_packet Unexecuted instantiation: statem_lib.c:PACKET_get_sub_packet Unexecuted instantiation: statem_srvr.c:PACKET_get_sub_packet Unexecuted instantiation: t1_lib.c:PACKET_get_sub_packet Unexecuted instantiation: tls13_enc.c:PACKET_get_sub_packet Unexecuted instantiation: tls_srp.c:PACKET_get_sub_packet Unexecuted instantiation: d1_lib.c:PACKET_get_sub_packet Unexecuted instantiation: d1_srtp.c:PACKET_get_sub_packet Unexecuted instantiation: methods.c:PACKET_get_sub_packet Unexecuted instantiation: packet.c:PACKET_get_sub_packet Unexecuted instantiation: pqueue.c:PACKET_get_sub_packet Unexecuted instantiation: rec_layer_d1.c:PACKET_get_sub_packet Unexecuted instantiation: rec_layer_s3.c:PACKET_get_sub_packet Unexecuted instantiation: ssl3_buffer.c:PACKET_get_sub_packet Unexecuted instantiation: ssl3_record.c:PACKET_get_sub_packet Unexecuted instantiation: ssl3_record_tls13.c:PACKET_get_sub_packet Unexecuted instantiation: s3_cbc.c:PACKET_get_sub_packet Unexecuted instantiation: s3_enc.c:PACKET_get_sub_packet Unexecuted instantiation: s3_lib.c:PACKET_get_sub_packet Unexecuted instantiation: s3_msg.c:PACKET_get_sub_packet Unexecuted instantiation: ssl_cert.c:PACKET_get_sub_packet Unexecuted instantiation: ssl_ciph.c:PACKET_get_sub_packet Unexecuted instantiation: ssl_lib.c:PACKET_get_sub_packet Unexecuted instantiation: ssl_mcnf.c:PACKET_get_sub_packet Unexecuted instantiation: ssl_rsa.c:PACKET_get_sub_packet Unexecuted instantiation: t1_enc.c:PACKET_get_sub_packet Unexecuted instantiation: d1_msg.c:PACKET_get_sub_packet Unexecuted instantiation: dtls1_bitmap.c:PACKET_get_sub_packet Unexecuted instantiation: ssl_conf.c:PACKET_get_sub_packet |
130 | | |
131 | | /* |
132 | | * Peek ahead at 2 bytes in network order from |pkt| and store the value in |
133 | | * |*data| |
134 | | */ |
135 | | __owur static ossl_inline int PACKET_peek_net_2(const PACKET *pkt, |
136 | | unsigned int *data) |
137 | 0 | { |
138 | 0 | if (PACKET_remaining(pkt) < 2) |
139 | 0 | return 0; |
140 | | |
141 | 0 | *data = ((unsigned int)(*pkt->curr)) << 8; |
142 | 0 | *data |= *(pkt->curr + 1); |
143 | |
|
144 | 0 | return 1; |
145 | 0 | } Unexecuted instantiation: ssl_asn1.c:PACKET_peek_net_2 Unexecuted instantiation: ssl_init.c:PACKET_peek_net_2 Unexecuted instantiation: ssl_sess.c:PACKET_peek_net_2 Unexecuted instantiation: ssl_txt.c:PACKET_peek_net_2 Unexecuted instantiation: extensions.c:PACKET_peek_net_2 Unexecuted instantiation: extensions_clnt.c:PACKET_peek_net_2 Unexecuted instantiation: extensions_cust.c:PACKET_peek_net_2 Unexecuted instantiation: extensions_srvr.c:PACKET_peek_net_2 Unexecuted instantiation: statem.c:PACKET_peek_net_2 Unexecuted instantiation: statem_clnt.c:PACKET_peek_net_2 Unexecuted instantiation: statem_dtls.c:PACKET_peek_net_2 Unexecuted instantiation: statem_lib.c:PACKET_peek_net_2 Unexecuted instantiation: statem_srvr.c:PACKET_peek_net_2 Unexecuted instantiation: t1_lib.c:PACKET_peek_net_2 Unexecuted instantiation: tls13_enc.c:PACKET_peek_net_2 Unexecuted instantiation: tls_srp.c:PACKET_peek_net_2 Unexecuted instantiation: d1_lib.c:PACKET_peek_net_2 Unexecuted instantiation: d1_srtp.c:PACKET_peek_net_2 Unexecuted instantiation: methods.c:PACKET_peek_net_2 Unexecuted instantiation: packet.c:PACKET_peek_net_2 Unexecuted instantiation: pqueue.c:PACKET_peek_net_2 Unexecuted instantiation: rec_layer_d1.c:PACKET_peek_net_2 Unexecuted instantiation: rec_layer_s3.c:PACKET_peek_net_2 Unexecuted instantiation: ssl3_buffer.c:PACKET_peek_net_2 Unexecuted instantiation: ssl3_record.c:PACKET_peek_net_2 Unexecuted instantiation: ssl3_record_tls13.c:PACKET_peek_net_2 Unexecuted instantiation: s3_cbc.c:PACKET_peek_net_2 Unexecuted instantiation: s3_enc.c:PACKET_peek_net_2 Unexecuted instantiation: s3_lib.c:PACKET_peek_net_2 Unexecuted instantiation: s3_msg.c:PACKET_peek_net_2 Unexecuted instantiation: ssl_cert.c:PACKET_peek_net_2 Unexecuted instantiation: ssl_ciph.c:PACKET_peek_net_2 Unexecuted instantiation: ssl_lib.c:PACKET_peek_net_2 Unexecuted instantiation: ssl_mcnf.c:PACKET_peek_net_2 Unexecuted instantiation: ssl_rsa.c:PACKET_peek_net_2 Unexecuted instantiation: t1_enc.c:PACKET_peek_net_2 Unexecuted instantiation: d1_msg.c:PACKET_peek_net_2 Unexecuted instantiation: dtls1_bitmap.c:PACKET_peek_net_2 Unexecuted instantiation: ssl_conf.c:PACKET_peek_net_2 |
146 | | |
147 | | /* Equivalent of n2s */ |
148 | | /* Get 2 bytes in network order from |pkt| and store the value in |*data| */ |
149 | | __owur static ossl_inline int PACKET_get_net_2(PACKET *pkt, unsigned int *data) |
150 | 0 | { |
151 | 0 | if (!PACKET_peek_net_2(pkt, data)) |
152 | 0 | return 0; |
153 | | |
154 | 0 | packet_forward(pkt, 2); |
155 | |
|
156 | 0 | return 1; |
157 | 0 | } Unexecuted instantiation: ssl_asn1.c:PACKET_get_net_2 Unexecuted instantiation: ssl_init.c:PACKET_get_net_2 Unexecuted instantiation: ssl_sess.c:PACKET_get_net_2 Unexecuted instantiation: ssl_txt.c:PACKET_get_net_2 Unexecuted instantiation: extensions.c:PACKET_get_net_2 Unexecuted instantiation: extensions_clnt.c:PACKET_get_net_2 Unexecuted instantiation: extensions_cust.c:PACKET_get_net_2 Unexecuted instantiation: extensions_srvr.c:PACKET_get_net_2 Unexecuted instantiation: statem.c:PACKET_get_net_2 Unexecuted instantiation: statem_clnt.c:PACKET_get_net_2 Unexecuted instantiation: statem_dtls.c:PACKET_get_net_2 Unexecuted instantiation: statem_lib.c:PACKET_get_net_2 Unexecuted instantiation: statem_srvr.c:PACKET_get_net_2 Unexecuted instantiation: t1_lib.c:PACKET_get_net_2 Unexecuted instantiation: tls13_enc.c:PACKET_get_net_2 Unexecuted instantiation: tls_srp.c:PACKET_get_net_2 Unexecuted instantiation: d1_lib.c:PACKET_get_net_2 Unexecuted instantiation: d1_srtp.c:PACKET_get_net_2 Unexecuted instantiation: methods.c:PACKET_get_net_2 Unexecuted instantiation: packet.c:PACKET_get_net_2 Unexecuted instantiation: pqueue.c:PACKET_get_net_2 Unexecuted instantiation: rec_layer_d1.c:PACKET_get_net_2 Unexecuted instantiation: rec_layer_s3.c:PACKET_get_net_2 Unexecuted instantiation: ssl3_buffer.c:PACKET_get_net_2 Unexecuted instantiation: ssl3_record.c:PACKET_get_net_2 Unexecuted instantiation: ssl3_record_tls13.c:PACKET_get_net_2 Unexecuted instantiation: s3_cbc.c:PACKET_get_net_2 Unexecuted instantiation: s3_enc.c:PACKET_get_net_2 Unexecuted instantiation: s3_lib.c:PACKET_get_net_2 Unexecuted instantiation: s3_msg.c:PACKET_get_net_2 Unexecuted instantiation: ssl_cert.c:PACKET_get_net_2 Unexecuted instantiation: ssl_ciph.c:PACKET_get_net_2 Unexecuted instantiation: ssl_lib.c:PACKET_get_net_2 Unexecuted instantiation: ssl_mcnf.c:PACKET_get_net_2 Unexecuted instantiation: ssl_rsa.c:PACKET_get_net_2 Unexecuted instantiation: t1_enc.c:PACKET_get_net_2 Unexecuted instantiation: d1_msg.c:PACKET_get_net_2 Unexecuted instantiation: dtls1_bitmap.c:PACKET_get_net_2 Unexecuted instantiation: ssl_conf.c:PACKET_get_net_2 |
158 | | |
159 | | /* Same as PACKET_get_net_2() but for a size_t */ |
160 | | __owur static ossl_inline int PACKET_get_net_2_len(PACKET *pkt, size_t *data) |
161 | 0 | { |
162 | 0 | unsigned int i; |
163 | 0 | int ret = PACKET_get_net_2(pkt, &i); |
164 | |
|
165 | 0 | if (ret) |
166 | 0 | *data = (size_t)i; |
167 | |
|
168 | 0 | return ret; |
169 | 0 | } Unexecuted instantiation: ssl_asn1.c:PACKET_get_net_2_len Unexecuted instantiation: ssl_init.c:PACKET_get_net_2_len Unexecuted instantiation: ssl_sess.c:PACKET_get_net_2_len Unexecuted instantiation: ssl_txt.c:PACKET_get_net_2_len Unexecuted instantiation: extensions.c:PACKET_get_net_2_len Unexecuted instantiation: extensions_clnt.c:PACKET_get_net_2_len Unexecuted instantiation: extensions_cust.c:PACKET_get_net_2_len Unexecuted instantiation: extensions_srvr.c:PACKET_get_net_2_len Unexecuted instantiation: statem.c:PACKET_get_net_2_len Unexecuted instantiation: statem_clnt.c:PACKET_get_net_2_len Unexecuted instantiation: statem_dtls.c:PACKET_get_net_2_len Unexecuted instantiation: statem_lib.c:PACKET_get_net_2_len Unexecuted instantiation: statem_srvr.c:PACKET_get_net_2_len Unexecuted instantiation: t1_lib.c:PACKET_get_net_2_len Unexecuted instantiation: tls13_enc.c:PACKET_get_net_2_len Unexecuted instantiation: tls_srp.c:PACKET_get_net_2_len Unexecuted instantiation: d1_lib.c:PACKET_get_net_2_len Unexecuted instantiation: d1_srtp.c:PACKET_get_net_2_len Unexecuted instantiation: methods.c:PACKET_get_net_2_len Unexecuted instantiation: packet.c:PACKET_get_net_2_len Unexecuted instantiation: pqueue.c:PACKET_get_net_2_len Unexecuted instantiation: rec_layer_d1.c:PACKET_get_net_2_len Unexecuted instantiation: rec_layer_s3.c:PACKET_get_net_2_len Unexecuted instantiation: ssl3_buffer.c:PACKET_get_net_2_len Unexecuted instantiation: ssl3_record.c:PACKET_get_net_2_len Unexecuted instantiation: ssl3_record_tls13.c:PACKET_get_net_2_len Unexecuted instantiation: s3_cbc.c:PACKET_get_net_2_len Unexecuted instantiation: s3_enc.c:PACKET_get_net_2_len Unexecuted instantiation: s3_lib.c:PACKET_get_net_2_len Unexecuted instantiation: s3_msg.c:PACKET_get_net_2_len Unexecuted instantiation: ssl_cert.c:PACKET_get_net_2_len Unexecuted instantiation: ssl_ciph.c:PACKET_get_net_2_len Unexecuted instantiation: ssl_lib.c:PACKET_get_net_2_len Unexecuted instantiation: ssl_mcnf.c:PACKET_get_net_2_len Unexecuted instantiation: ssl_rsa.c:PACKET_get_net_2_len Unexecuted instantiation: t1_enc.c:PACKET_get_net_2_len Unexecuted instantiation: d1_msg.c:PACKET_get_net_2_len Unexecuted instantiation: dtls1_bitmap.c:PACKET_get_net_2_len Unexecuted instantiation: ssl_conf.c:PACKET_get_net_2_len |
170 | | |
171 | | /* |
172 | | * Peek ahead at 3 bytes in network order from |pkt| and store the value in |
173 | | * |*data| |
174 | | */ |
175 | | __owur static ossl_inline int PACKET_peek_net_3(const PACKET *pkt, |
176 | | unsigned long *data) |
177 | 0 | { |
178 | 0 | if (PACKET_remaining(pkt) < 3) |
179 | 0 | return 0; |
180 | | |
181 | 0 | *data = ((unsigned long)(*pkt->curr)) << 16; |
182 | 0 | *data |= ((unsigned long)(*(pkt->curr + 1))) << 8; |
183 | 0 | *data |= *(pkt->curr + 2); |
184 | |
|
185 | 0 | return 1; |
186 | 0 | } Unexecuted instantiation: ssl_asn1.c:PACKET_peek_net_3 Unexecuted instantiation: ssl_init.c:PACKET_peek_net_3 Unexecuted instantiation: ssl_sess.c:PACKET_peek_net_3 Unexecuted instantiation: ssl_txt.c:PACKET_peek_net_3 Unexecuted instantiation: extensions.c:PACKET_peek_net_3 Unexecuted instantiation: extensions_clnt.c:PACKET_peek_net_3 Unexecuted instantiation: extensions_cust.c:PACKET_peek_net_3 Unexecuted instantiation: extensions_srvr.c:PACKET_peek_net_3 Unexecuted instantiation: statem.c:PACKET_peek_net_3 Unexecuted instantiation: statem_clnt.c:PACKET_peek_net_3 Unexecuted instantiation: statem_dtls.c:PACKET_peek_net_3 Unexecuted instantiation: statem_lib.c:PACKET_peek_net_3 Unexecuted instantiation: statem_srvr.c:PACKET_peek_net_3 Unexecuted instantiation: t1_lib.c:PACKET_peek_net_3 Unexecuted instantiation: tls13_enc.c:PACKET_peek_net_3 Unexecuted instantiation: tls_srp.c:PACKET_peek_net_3 Unexecuted instantiation: d1_lib.c:PACKET_peek_net_3 Unexecuted instantiation: d1_srtp.c:PACKET_peek_net_3 Unexecuted instantiation: methods.c:PACKET_peek_net_3 Unexecuted instantiation: packet.c:PACKET_peek_net_3 Unexecuted instantiation: pqueue.c:PACKET_peek_net_3 Unexecuted instantiation: rec_layer_d1.c:PACKET_peek_net_3 Unexecuted instantiation: rec_layer_s3.c:PACKET_peek_net_3 Unexecuted instantiation: ssl3_buffer.c:PACKET_peek_net_3 Unexecuted instantiation: ssl3_record.c:PACKET_peek_net_3 Unexecuted instantiation: ssl3_record_tls13.c:PACKET_peek_net_3 Unexecuted instantiation: s3_cbc.c:PACKET_peek_net_3 Unexecuted instantiation: s3_enc.c:PACKET_peek_net_3 Unexecuted instantiation: s3_lib.c:PACKET_peek_net_3 Unexecuted instantiation: s3_msg.c:PACKET_peek_net_3 Unexecuted instantiation: ssl_cert.c:PACKET_peek_net_3 Unexecuted instantiation: ssl_ciph.c:PACKET_peek_net_3 Unexecuted instantiation: ssl_lib.c:PACKET_peek_net_3 Unexecuted instantiation: ssl_mcnf.c:PACKET_peek_net_3 Unexecuted instantiation: ssl_rsa.c:PACKET_peek_net_3 Unexecuted instantiation: t1_enc.c:PACKET_peek_net_3 Unexecuted instantiation: d1_msg.c:PACKET_peek_net_3 Unexecuted instantiation: dtls1_bitmap.c:PACKET_peek_net_3 Unexecuted instantiation: ssl_conf.c:PACKET_peek_net_3 |
187 | | |
188 | | /* Equivalent of n2l3 */ |
189 | | /* Get 3 bytes in network order from |pkt| and store the value in |*data| */ |
190 | | __owur static ossl_inline int PACKET_get_net_3(PACKET *pkt, unsigned long *data) |
191 | 0 | { |
192 | 0 | if (!PACKET_peek_net_3(pkt, data)) |
193 | 0 | return 0; |
194 | | |
195 | 0 | packet_forward(pkt, 3); |
196 | |
|
197 | 0 | return 1; |
198 | 0 | } Unexecuted instantiation: ssl_asn1.c:PACKET_get_net_3 Unexecuted instantiation: ssl_init.c:PACKET_get_net_3 Unexecuted instantiation: ssl_sess.c:PACKET_get_net_3 Unexecuted instantiation: ssl_txt.c:PACKET_get_net_3 Unexecuted instantiation: extensions.c:PACKET_get_net_3 Unexecuted instantiation: extensions_clnt.c:PACKET_get_net_3 Unexecuted instantiation: extensions_cust.c:PACKET_get_net_3 Unexecuted instantiation: extensions_srvr.c:PACKET_get_net_3 Unexecuted instantiation: statem.c:PACKET_get_net_3 Unexecuted instantiation: statem_clnt.c:PACKET_get_net_3 Unexecuted instantiation: statem_dtls.c:PACKET_get_net_3 Unexecuted instantiation: statem_lib.c:PACKET_get_net_3 Unexecuted instantiation: statem_srvr.c:PACKET_get_net_3 Unexecuted instantiation: t1_lib.c:PACKET_get_net_3 Unexecuted instantiation: tls13_enc.c:PACKET_get_net_3 Unexecuted instantiation: tls_srp.c:PACKET_get_net_3 Unexecuted instantiation: d1_lib.c:PACKET_get_net_3 Unexecuted instantiation: d1_srtp.c:PACKET_get_net_3 Unexecuted instantiation: methods.c:PACKET_get_net_3 Unexecuted instantiation: packet.c:PACKET_get_net_3 Unexecuted instantiation: pqueue.c:PACKET_get_net_3 Unexecuted instantiation: rec_layer_d1.c:PACKET_get_net_3 Unexecuted instantiation: rec_layer_s3.c:PACKET_get_net_3 Unexecuted instantiation: ssl3_buffer.c:PACKET_get_net_3 Unexecuted instantiation: ssl3_record.c:PACKET_get_net_3 Unexecuted instantiation: ssl3_record_tls13.c:PACKET_get_net_3 Unexecuted instantiation: s3_cbc.c:PACKET_get_net_3 Unexecuted instantiation: s3_enc.c:PACKET_get_net_3 Unexecuted instantiation: s3_lib.c:PACKET_get_net_3 Unexecuted instantiation: s3_msg.c:PACKET_get_net_3 Unexecuted instantiation: ssl_cert.c:PACKET_get_net_3 Unexecuted instantiation: ssl_ciph.c:PACKET_get_net_3 Unexecuted instantiation: ssl_lib.c:PACKET_get_net_3 Unexecuted instantiation: ssl_mcnf.c:PACKET_get_net_3 Unexecuted instantiation: ssl_rsa.c:PACKET_get_net_3 Unexecuted instantiation: t1_enc.c:PACKET_get_net_3 Unexecuted instantiation: d1_msg.c:PACKET_get_net_3 Unexecuted instantiation: dtls1_bitmap.c:PACKET_get_net_3 Unexecuted instantiation: ssl_conf.c:PACKET_get_net_3 |
199 | | |
200 | | /* Same as PACKET_get_net_3() but for a size_t */ |
201 | | __owur static ossl_inline int PACKET_get_net_3_len(PACKET *pkt, size_t *data) |
202 | 0 | { |
203 | 0 | unsigned long i; |
204 | 0 | int ret = PACKET_get_net_3(pkt, &i); |
205 | |
|
206 | 0 | if (ret) |
207 | 0 | *data = (size_t)i; |
208 | |
|
209 | 0 | return ret; |
210 | 0 | } Unexecuted instantiation: ssl_asn1.c:PACKET_get_net_3_len Unexecuted instantiation: ssl_init.c:PACKET_get_net_3_len Unexecuted instantiation: ssl_sess.c:PACKET_get_net_3_len Unexecuted instantiation: ssl_txt.c:PACKET_get_net_3_len Unexecuted instantiation: extensions.c:PACKET_get_net_3_len Unexecuted instantiation: extensions_clnt.c:PACKET_get_net_3_len Unexecuted instantiation: extensions_cust.c:PACKET_get_net_3_len Unexecuted instantiation: extensions_srvr.c:PACKET_get_net_3_len Unexecuted instantiation: statem.c:PACKET_get_net_3_len Unexecuted instantiation: statem_clnt.c:PACKET_get_net_3_len Unexecuted instantiation: statem_dtls.c:PACKET_get_net_3_len Unexecuted instantiation: statem_lib.c:PACKET_get_net_3_len Unexecuted instantiation: statem_srvr.c:PACKET_get_net_3_len Unexecuted instantiation: t1_lib.c:PACKET_get_net_3_len Unexecuted instantiation: tls13_enc.c:PACKET_get_net_3_len Unexecuted instantiation: tls_srp.c:PACKET_get_net_3_len Unexecuted instantiation: d1_lib.c:PACKET_get_net_3_len Unexecuted instantiation: d1_srtp.c:PACKET_get_net_3_len Unexecuted instantiation: methods.c:PACKET_get_net_3_len Unexecuted instantiation: packet.c:PACKET_get_net_3_len Unexecuted instantiation: pqueue.c:PACKET_get_net_3_len Unexecuted instantiation: rec_layer_d1.c:PACKET_get_net_3_len Unexecuted instantiation: rec_layer_s3.c:PACKET_get_net_3_len Unexecuted instantiation: ssl3_buffer.c:PACKET_get_net_3_len Unexecuted instantiation: ssl3_record.c:PACKET_get_net_3_len Unexecuted instantiation: ssl3_record_tls13.c:PACKET_get_net_3_len Unexecuted instantiation: s3_cbc.c:PACKET_get_net_3_len Unexecuted instantiation: s3_enc.c:PACKET_get_net_3_len Unexecuted instantiation: s3_lib.c:PACKET_get_net_3_len Unexecuted instantiation: s3_msg.c:PACKET_get_net_3_len Unexecuted instantiation: ssl_cert.c:PACKET_get_net_3_len Unexecuted instantiation: ssl_ciph.c:PACKET_get_net_3_len Unexecuted instantiation: ssl_lib.c:PACKET_get_net_3_len Unexecuted instantiation: ssl_mcnf.c:PACKET_get_net_3_len Unexecuted instantiation: ssl_rsa.c:PACKET_get_net_3_len Unexecuted instantiation: t1_enc.c:PACKET_get_net_3_len Unexecuted instantiation: d1_msg.c:PACKET_get_net_3_len Unexecuted instantiation: dtls1_bitmap.c:PACKET_get_net_3_len Unexecuted instantiation: ssl_conf.c:PACKET_get_net_3_len |
211 | | |
212 | | /* |
213 | | * Peek ahead at 4 bytes in network order from |pkt| and store the value in |
214 | | * |*data| |
215 | | */ |
216 | | __owur static ossl_inline int PACKET_peek_net_4(const PACKET *pkt, |
217 | | unsigned long *data) |
218 | 0 | { |
219 | 0 | if (PACKET_remaining(pkt) < 4) |
220 | 0 | return 0; |
221 | | |
222 | 0 | *data = ((unsigned long)(*pkt->curr)) << 24; |
223 | 0 | *data |= ((unsigned long)(*(pkt->curr + 1))) << 16; |
224 | 0 | *data |= ((unsigned long)(*(pkt->curr + 2))) << 8; |
225 | 0 | *data |= *(pkt->curr + 3); |
226 | |
|
227 | 0 | return 1; |
228 | 0 | } Unexecuted instantiation: ssl_asn1.c:PACKET_peek_net_4 Unexecuted instantiation: ssl_init.c:PACKET_peek_net_4 Unexecuted instantiation: ssl_sess.c:PACKET_peek_net_4 Unexecuted instantiation: ssl_txt.c:PACKET_peek_net_4 Unexecuted instantiation: extensions.c:PACKET_peek_net_4 Unexecuted instantiation: extensions_clnt.c:PACKET_peek_net_4 Unexecuted instantiation: extensions_cust.c:PACKET_peek_net_4 Unexecuted instantiation: extensions_srvr.c:PACKET_peek_net_4 Unexecuted instantiation: statem.c:PACKET_peek_net_4 Unexecuted instantiation: statem_clnt.c:PACKET_peek_net_4 Unexecuted instantiation: statem_dtls.c:PACKET_peek_net_4 Unexecuted instantiation: statem_lib.c:PACKET_peek_net_4 Unexecuted instantiation: statem_srvr.c:PACKET_peek_net_4 Unexecuted instantiation: t1_lib.c:PACKET_peek_net_4 Unexecuted instantiation: tls13_enc.c:PACKET_peek_net_4 Unexecuted instantiation: tls_srp.c:PACKET_peek_net_4 Unexecuted instantiation: d1_lib.c:PACKET_peek_net_4 Unexecuted instantiation: d1_srtp.c:PACKET_peek_net_4 Unexecuted instantiation: methods.c:PACKET_peek_net_4 Unexecuted instantiation: packet.c:PACKET_peek_net_4 Unexecuted instantiation: pqueue.c:PACKET_peek_net_4 Unexecuted instantiation: rec_layer_d1.c:PACKET_peek_net_4 Unexecuted instantiation: rec_layer_s3.c:PACKET_peek_net_4 Unexecuted instantiation: ssl3_buffer.c:PACKET_peek_net_4 Unexecuted instantiation: ssl3_record.c:PACKET_peek_net_4 Unexecuted instantiation: ssl3_record_tls13.c:PACKET_peek_net_4 Unexecuted instantiation: s3_cbc.c:PACKET_peek_net_4 Unexecuted instantiation: s3_enc.c:PACKET_peek_net_4 Unexecuted instantiation: s3_lib.c:PACKET_peek_net_4 Unexecuted instantiation: s3_msg.c:PACKET_peek_net_4 Unexecuted instantiation: ssl_cert.c:PACKET_peek_net_4 Unexecuted instantiation: ssl_ciph.c:PACKET_peek_net_4 Unexecuted instantiation: ssl_lib.c:PACKET_peek_net_4 Unexecuted instantiation: ssl_mcnf.c:PACKET_peek_net_4 Unexecuted instantiation: ssl_rsa.c:PACKET_peek_net_4 Unexecuted instantiation: t1_enc.c:PACKET_peek_net_4 Unexecuted instantiation: d1_msg.c:PACKET_peek_net_4 Unexecuted instantiation: dtls1_bitmap.c:PACKET_peek_net_4 Unexecuted instantiation: ssl_conf.c:PACKET_peek_net_4 |
229 | | |
230 | | /* |
231 | | * Peek ahead at 8 bytes in network order from |pkt| and store the value in |
232 | | * |*data| |
233 | | */ |
234 | | __owur static ossl_inline int PACKET_peek_net_8(const PACKET *pkt, |
235 | | uint64_t *data) |
236 | 0 | { |
237 | 0 | if (PACKET_remaining(pkt) < 8) |
238 | 0 | return 0; |
239 | | |
240 | 0 | *data = ((uint64_t)(*pkt->curr)) << 56; |
241 | 0 | *data |= ((uint64_t)(*(pkt->curr + 1))) << 48; |
242 | 0 | *data |= ((uint64_t)(*(pkt->curr + 2))) << 40; |
243 | 0 | *data |= ((uint64_t)(*(pkt->curr + 3))) << 32; |
244 | 0 | *data |= ((uint64_t)(*(pkt->curr + 4))) << 24; |
245 | 0 | *data |= ((uint64_t)(*(pkt->curr + 5))) << 16; |
246 | 0 | *data |= ((uint64_t)(*(pkt->curr + 6))) << 8; |
247 | 0 | *data |= *(pkt->curr + 7); |
248 | |
|
249 | 0 | return 1; |
250 | 0 | } Unexecuted instantiation: ssl_asn1.c:PACKET_peek_net_8 Unexecuted instantiation: ssl_init.c:PACKET_peek_net_8 Unexecuted instantiation: ssl_sess.c:PACKET_peek_net_8 Unexecuted instantiation: ssl_txt.c:PACKET_peek_net_8 Unexecuted instantiation: extensions.c:PACKET_peek_net_8 Unexecuted instantiation: extensions_clnt.c:PACKET_peek_net_8 Unexecuted instantiation: extensions_cust.c:PACKET_peek_net_8 Unexecuted instantiation: extensions_srvr.c:PACKET_peek_net_8 Unexecuted instantiation: statem.c:PACKET_peek_net_8 Unexecuted instantiation: statem_clnt.c:PACKET_peek_net_8 Unexecuted instantiation: statem_dtls.c:PACKET_peek_net_8 Unexecuted instantiation: statem_lib.c:PACKET_peek_net_8 Unexecuted instantiation: statem_srvr.c:PACKET_peek_net_8 Unexecuted instantiation: t1_lib.c:PACKET_peek_net_8 Unexecuted instantiation: tls13_enc.c:PACKET_peek_net_8 Unexecuted instantiation: tls_srp.c:PACKET_peek_net_8 Unexecuted instantiation: d1_lib.c:PACKET_peek_net_8 Unexecuted instantiation: d1_srtp.c:PACKET_peek_net_8 Unexecuted instantiation: methods.c:PACKET_peek_net_8 Unexecuted instantiation: packet.c:PACKET_peek_net_8 Unexecuted instantiation: pqueue.c:PACKET_peek_net_8 Unexecuted instantiation: rec_layer_d1.c:PACKET_peek_net_8 Unexecuted instantiation: rec_layer_s3.c:PACKET_peek_net_8 Unexecuted instantiation: ssl3_buffer.c:PACKET_peek_net_8 Unexecuted instantiation: ssl3_record.c:PACKET_peek_net_8 Unexecuted instantiation: ssl3_record_tls13.c:PACKET_peek_net_8 Unexecuted instantiation: s3_cbc.c:PACKET_peek_net_8 Unexecuted instantiation: s3_enc.c:PACKET_peek_net_8 Unexecuted instantiation: s3_lib.c:PACKET_peek_net_8 Unexecuted instantiation: s3_msg.c:PACKET_peek_net_8 Unexecuted instantiation: ssl_cert.c:PACKET_peek_net_8 Unexecuted instantiation: ssl_ciph.c:PACKET_peek_net_8 Unexecuted instantiation: ssl_lib.c:PACKET_peek_net_8 Unexecuted instantiation: ssl_mcnf.c:PACKET_peek_net_8 Unexecuted instantiation: ssl_rsa.c:PACKET_peek_net_8 Unexecuted instantiation: t1_enc.c:PACKET_peek_net_8 Unexecuted instantiation: d1_msg.c:PACKET_peek_net_8 Unexecuted instantiation: dtls1_bitmap.c:PACKET_peek_net_8 Unexecuted instantiation: ssl_conf.c:PACKET_peek_net_8 |
251 | | |
252 | | /* Equivalent of n2l */ |
253 | | /* Get 4 bytes in network order from |pkt| and store the value in |*data| */ |
254 | | __owur static ossl_inline int PACKET_get_net_4(PACKET *pkt, unsigned long *data) |
255 | 0 | { |
256 | 0 | if (!PACKET_peek_net_4(pkt, data)) |
257 | 0 | return 0; |
258 | | |
259 | 0 | packet_forward(pkt, 4); |
260 | |
|
261 | 0 | return 1; |
262 | 0 | } Unexecuted instantiation: ssl_asn1.c:PACKET_get_net_4 Unexecuted instantiation: ssl_init.c:PACKET_get_net_4 Unexecuted instantiation: ssl_sess.c:PACKET_get_net_4 Unexecuted instantiation: ssl_txt.c:PACKET_get_net_4 Unexecuted instantiation: extensions.c:PACKET_get_net_4 Unexecuted instantiation: extensions_clnt.c:PACKET_get_net_4 Unexecuted instantiation: extensions_cust.c:PACKET_get_net_4 Unexecuted instantiation: extensions_srvr.c:PACKET_get_net_4 Unexecuted instantiation: statem.c:PACKET_get_net_4 Unexecuted instantiation: statem_clnt.c:PACKET_get_net_4 Unexecuted instantiation: statem_dtls.c:PACKET_get_net_4 Unexecuted instantiation: statem_lib.c:PACKET_get_net_4 Unexecuted instantiation: statem_srvr.c:PACKET_get_net_4 Unexecuted instantiation: t1_lib.c:PACKET_get_net_4 Unexecuted instantiation: tls13_enc.c:PACKET_get_net_4 Unexecuted instantiation: tls_srp.c:PACKET_get_net_4 Unexecuted instantiation: d1_lib.c:PACKET_get_net_4 Unexecuted instantiation: d1_srtp.c:PACKET_get_net_4 Unexecuted instantiation: methods.c:PACKET_get_net_4 Unexecuted instantiation: packet.c:PACKET_get_net_4 Unexecuted instantiation: pqueue.c:PACKET_get_net_4 Unexecuted instantiation: rec_layer_d1.c:PACKET_get_net_4 Unexecuted instantiation: rec_layer_s3.c:PACKET_get_net_4 Unexecuted instantiation: ssl3_buffer.c:PACKET_get_net_4 Unexecuted instantiation: ssl3_record.c:PACKET_get_net_4 Unexecuted instantiation: ssl3_record_tls13.c:PACKET_get_net_4 Unexecuted instantiation: s3_cbc.c:PACKET_get_net_4 Unexecuted instantiation: s3_enc.c:PACKET_get_net_4 Unexecuted instantiation: s3_lib.c:PACKET_get_net_4 Unexecuted instantiation: s3_msg.c:PACKET_get_net_4 Unexecuted instantiation: ssl_cert.c:PACKET_get_net_4 Unexecuted instantiation: ssl_ciph.c:PACKET_get_net_4 Unexecuted instantiation: ssl_lib.c:PACKET_get_net_4 Unexecuted instantiation: ssl_mcnf.c:PACKET_get_net_4 Unexecuted instantiation: ssl_rsa.c:PACKET_get_net_4 Unexecuted instantiation: t1_enc.c:PACKET_get_net_4 Unexecuted instantiation: d1_msg.c:PACKET_get_net_4 Unexecuted instantiation: dtls1_bitmap.c:PACKET_get_net_4 Unexecuted instantiation: ssl_conf.c:PACKET_get_net_4 |
263 | | |
264 | | /* Same as PACKET_get_net_4() but for a size_t */ |
265 | | __owur static ossl_inline int PACKET_get_net_4_len(PACKET *pkt, size_t *data) |
266 | 0 | { |
267 | 0 | unsigned long i; |
268 | 0 | int ret = PACKET_get_net_4(pkt, &i); |
269 | 0 |
|
270 | 0 | if (ret) |
271 | 0 | *data = (size_t)i; |
272 | 0 |
|
273 | 0 | return ret; |
274 | 0 | } Unexecuted instantiation: ssl_asn1.c:PACKET_get_net_4_len Unexecuted instantiation: ssl_init.c:PACKET_get_net_4_len Unexecuted instantiation: ssl_sess.c:PACKET_get_net_4_len Unexecuted instantiation: ssl_txt.c:PACKET_get_net_4_len Unexecuted instantiation: extensions.c:PACKET_get_net_4_len Unexecuted instantiation: extensions_clnt.c:PACKET_get_net_4_len Unexecuted instantiation: extensions_cust.c:PACKET_get_net_4_len Unexecuted instantiation: extensions_srvr.c:PACKET_get_net_4_len Unexecuted instantiation: statem.c:PACKET_get_net_4_len Unexecuted instantiation: statem_clnt.c:PACKET_get_net_4_len Unexecuted instantiation: statem_dtls.c:PACKET_get_net_4_len Unexecuted instantiation: statem_lib.c:PACKET_get_net_4_len Unexecuted instantiation: statem_srvr.c:PACKET_get_net_4_len Unexecuted instantiation: t1_lib.c:PACKET_get_net_4_len Unexecuted instantiation: tls13_enc.c:PACKET_get_net_4_len Unexecuted instantiation: tls_srp.c:PACKET_get_net_4_len Unexecuted instantiation: d1_lib.c:PACKET_get_net_4_len Unexecuted instantiation: d1_srtp.c:PACKET_get_net_4_len Unexecuted instantiation: methods.c:PACKET_get_net_4_len Unexecuted instantiation: packet.c:PACKET_get_net_4_len Unexecuted instantiation: pqueue.c:PACKET_get_net_4_len Unexecuted instantiation: rec_layer_d1.c:PACKET_get_net_4_len Unexecuted instantiation: rec_layer_s3.c:PACKET_get_net_4_len Unexecuted instantiation: ssl3_buffer.c:PACKET_get_net_4_len Unexecuted instantiation: ssl3_record.c:PACKET_get_net_4_len Unexecuted instantiation: ssl3_record_tls13.c:PACKET_get_net_4_len Unexecuted instantiation: s3_cbc.c:PACKET_get_net_4_len Unexecuted instantiation: s3_enc.c:PACKET_get_net_4_len Unexecuted instantiation: s3_lib.c:PACKET_get_net_4_len Unexecuted instantiation: s3_msg.c:PACKET_get_net_4_len Unexecuted instantiation: ssl_cert.c:PACKET_get_net_4_len Unexecuted instantiation: ssl_ciph.c:PACKET_get_net_4_len Unexecuted instantiation: ssl_lib.c:PACKET_get_net_4_len Unexecuted instantiation: ssl_mcnf.c:PACKET_get_net_4_len Unexecuted instantiation: ssl_rsa.c:PACKET_get_net_4_len Unexecuted instantiation: t1_enc.c:PACKET_get_net_4_len Unexecuted instantiation: d1_msg.c:PACKET_get_net_4_len Unexecuted instantiation: dtls1_bitmap.c:PACKET_get_net_4_len Unexecuted instantiation: ssl_conf.c:PACKET_get_net_4_len |
275 | | |
276 | | /* Get 8 bytes in network order from |pkt| and store the value in |*data| */ |
277 | | __owur static ossl_inline int PACKET_get_net_8(PACKET *pkt, uint64_t *data) |
278 | 0 | { |
279 | 0 | if (!PACKET_peek_net_8(pkt, data)) |
280 | 0 | return 0; |
281 | | |
282 | 0 | packet_forward(pkt, 8); |
283 | |
|
284 | 0 | return 1; |
285 | 0 | } Unexecuted instantiation: ssl_asn1.c:PACKET_get_net_8 Unexecuted instantiation: ssl_init.c:PACKET_get_net_8 Unexecuted instantiation: ssl_sess.c:PACKET_get_net_8 Unexecuted instantiation: ssl_txt.c:PACKET_get_net_8 Unexecuted instantiation: extensions.c:PACKET_get_net_8 Unexecuted instantiation: extensions_clnt.c:PACKET_get_net_8 Unexecuted instantiation: extensions_cust.c:PACKET_get_net_8 Unexecuted instantiation: extensions_srvr.c:PACKET_get_net_8 Unexecuted instantiation: statem.c:PACKET_get_net_8 Unexecuted instantiation: statem_clnt.c:PACKET_get_net_8 Unexecuted instantiation: statem_dtls.c:PACKET_get_net_8 Unexecuted instantiation: statem_lib.c:PACKET_get_net_8 Unexecuted instantiation: statem_srvr.c:PACKET_get_net_8 Unexecuted instantiation: t1_lib.c:PACKET_get_net_8 Unexecuted instantiation: tls13_enc.c:PACKET_get_net_8 Unexecuted instantiation: tls_srp.c:PACKET_get_net_8 Unexecuted instantiation: d1_lib.c:PACKET_get_net_8 Unexecuted instantiation: d1_srtp.c:PACKET_get_net_8 Unexecuted instantiation: methods.c:PACKET_get_net_8 Unexecuted instantiation: packet.c:PACKET_get_net_8 Unexecuted instantiation: pqueue.c:PACKET_get_net_8 Unexecuted instantiation: rec_layer_d1.c:PACKET_get_net_8 Unexecuted instantiation: rec_layer_s3.c:PACKET_get_net_8 Unexecuted instantiation: ssl3_buffer.c:PACKET_get_net_8 Unexecuted instantiation: ssl3_record.c:PACKET_get_net_8 Unexecuted instantiation: ssl3_record_tls13.c:PACKET_get_net_8 Unexecuted instantiation: s3_cbc.c:PACKET_get_net_8 Unexecuted instantiation: s3_enc.c:PACKET_get_net_8 Unexecuted instantiation: s3_lib.c:PACKET_get_net_8 Unexecuted instantiation: s3_msg.c:PACKET_get_net_8 Unexecuted instantiation: ssl_cert.c:PACKET_get_net_8 Unexecuted instantiation: ssl_ciph.c:PACKET_get_net_8 Unexecuted instantiation: ssl_lib.c:PACKET_get_net_8 Unexecuted instantiation: ssl_mcnf.c:PACKET_get_net_8 Unexecuted instantiation: ssl_rsa.c:PACKET_get_net_8 Unexecuted instantiation: t1_enc.c:PACKET_get_net_8 Unexecuted instantiation: d1_msg.c:PACKET_get_net_8 Unexecuted instantiation: dtls1_bitmap.c:PACKET_get_net_8 Unexecuted instantiation: ssl_conf.c:PACKET_get_net_8 |
286 | | |
287 | | /* Peek ahead at 1 byte from |pkt| and store the value in |*data| */ |
288 | | __owur static ossl_inline int PACKET_peek_1(const PACKET *pkt, |
289 | | unsigned int *data) |
290 | 0 | { |
291 | 0 | if (!PACKET_remaining(pkt)) |
292 | 0 | return 0; |
293 | | |
294 | 0 | *data = *pkt->curr; |
295 | |
|
296 | 0 | return 1; |
297 | 0 | } Unexecuted instantiation: ssl_asn1.c:PACKET_peek_1 Unexecuted instantiation: ssl_init.c:PACKET_peek_1 Unexecuted instantiation: ssl_sess.c:PACKET_peek_1 Unexecuted instantiation: ssl_txt.c:PACKET_peek_1 Unexecuted instantiation: extensions.c:PACKET_peek_1 Unexecuted instantiation: extensions_clnt.c:PACKET_peek_1 Unexecuted instantiation: extensions_cust.c:PACKET_peek_1 Unexecuted instantiation: extensions_srvr.c:PACKET_peek_1 Unexecuted instantiation: statem.c:PACKET_peek_1 Unexecuted instantiation: statem_clnt.c:PACKET_peek_1 Unexecuted instantiation: statem_dtls.c:PACKET_peek_1 Unexecuted instantiation: statem_lib.c:PACKET_peek_1 Unexecuted instantiation: statem_srvr.c:PACKET_peek_1 Unexecuted instantiation: t1_lib.c:PACKET_peek_1 Unexecuted instantiation: tls13_enc.c:PACKET_peek_1 Unexecuted instantiation: tls_srp.c:PACKET_peek_1 Unexecuted instantiation: d1_lib.c:PACKET_peek_1 Unexecuted instantiation: d1_srtp.c:PACKET_peek_1 Unexecuted instantiation: methods.c:PACKET_peek_1 Unexecuted instantiation: packet.c:PACKET_peek_1 Unexecuted instantiation: pqueue.c:PACKET_peek_1 Unexecuted instantiation: rec_layer_d1.c:PACKET_peek_1 Unexecuted instantiation: rec_layer_s3.c:PACKET_peek_1 Unexecuted instantiation: ssl3_buffer.c:PACKET_peek_1 Unexecuted instantiation: ssl3_record.c:PACKET_peek_1 Unexecuted instantiation: ssl3_record_tls13.c:PACKET_peek_1 Unexecuted instantiation: s3_cbc.c:PACKET_peek_1 Unexecuted instantiation: s3_enc.c:PACKET_peek_1 Unexecuted instantiation: s3_lib.c:PACKET_peek_1 Unexecuted instantiation: s3_msg.c:PACKET_peek_1 Unexecuted instantiation: ssl_cert.c:PACKET_peek_1 Unexecuted instantiation: ssl_ciph.c:PACKET_peek_1 Unexecuted instantiation: ssl_lib.c:PACKET_peek_1 Unexecuted instantiation: ssl_mcnf.c:PACKET_peek_1 Unexecuted instantiation: ssl_rsa.c:PACKET_peek_1 Unexecuted instantiation: t1_enc.c:PACKET_peek_1 Unexecuted instantiation: d1_msg.c:PACKET_peek_1 Unexecuted instantiation: dtls1_bitmap.c:PACKET_peek_1 Unexecuted instantiation: ssl_conf.c:PACKET_peek_1 |
298 | | |
299 | | /* Get 1 byte from |pkt| and store the value in |*data| */ |
300 | | __owur static ossl_inline int PACKET_get_1(PACKET *pkt, unsigned int *data) |
301 | 0 | { |
302 | 0 | if (!PACKET_peek_1(pkt, data)) |
303 | 0 | return 0; |
304 | | |
305 | 0 | packet_forward(pkt, 1); |
306 | |
|
307 | 0 | return 1; |
308 | 0 | } Unexecuted instantiation: ssl_asn1.c:PACKET_get_1 Unexecuted instantiation: ssl_init.c:PACKET_get_1 Unexecuted instantiation: ssl_sess.c:PACKET_get_1 Unexecuted instantiation: ssl_txt.c:PACKET_get_1 Unexecuted instantiation: extensions.c:PACKET_get_1 Unexecuted instantiation: extensions_clnt.c:PACKET_get_1 Unexecuted instantiation: extensions_cust.c:PACKET_get_1 Unexecuted instantiation: extensions_srvr.c:PACKET_get_1 Unexecuted instantiation: statem.c:PACKET_get_1 Unexecuted instantiation: statem_clnt.c:PACKET_get_1 Unexecuted instantiation: statem_dtls.c:PACKET_get_1 Unexecuted instantiation: statem_lib.c:PACKET_get_1 Unexecuted instantiation: statem_srvr.c:PACKET_get_1 Unexecuted instantiation: t1_lib.c:PACKET_get_1 Unexecuted instantiation: tls13_enc.c:PACKET_get_1 Unexecuted instantiation: tls_srp.c:PACKET_get_1 Unexecuted instantiation: d1_lib.c:PACKET_get_1 Unexecuted instantiation: d1_srtp.c:PACKET_get_1 Unexecuted instantiation: methods.c:PACKET_get_1 Unexecuted instantiation: packet.c:PACKET_get_1 Unexecuted instantiation: pqueue.c:PACKET_get_1 Unexecuted instantiation: rec_layer_d1.c:PACKET_get_1 Unexecuted instantiation: rec_layer_s3.c:PACKET_get_1 Unexecuted instantiation: ssl3_buffer.c:PACKET_get_1 Unexecuted instantiation: ssl3_record.c:PACKET_get_1 Unexecuted instantiation: ssl3_record_tls13.c:PACKET_get_1 Unexecuted instantiation: s3_cbc.c:PACKET_get_1 Unexecuted instantiation: s3_enc.c:PACKET_get_1 Unexecuted instantiation: s3_lib.c:PACKET_get_1 Unexecuted instantiation: s3_msg.c:PACKET_get_1 Unexecuted instantiation: ssl_cert.c:PACKET_get_1 Unexecuted instantiation: ssl_ciph.c:PACKET_get_1 Unexecuted instantiation: ssl_lib.c:PACKET_get_1 Unexecuted instantiation: ssl_mcnf.c:PACKET_get_1 Unexecuted instantiation: ssl_rsa.c:PACKET_get_1 Unexecuted instantiation: t1_enc.c:PACKET_get_1 Unexecuted instantiation: d1_msg.c:PACKET_get_1 Unexecuted instantiation: dtls1_bitmap.c:PACKET_get_1 Unexecuted instantiation: ssl_conf.c:PACKET_get_1 |
309 | | |
310 | | /* Same as PACKET_get_1() but for a size_t */ |
311 | | __owur static ossl_inline int PACKET_get_1_len(PACKET *pkt, size_t *data) |
312 | 0 | { |
313 | 0 | unsigned int i; |
314 | 0 | int ret = PACKET_get_1(pkt, &i); |
315 | |
|
316 | 0 | if (ret) |
317 | 0 | *data = (size_t)i; |
318 | |
|
319 | 0 | return ret; |
320 | 0 | } Unexecuted instantiation: ssl_asn1.c:PACKET_get_1_len Unexecuted instantiation: ssl_init.c:PACKET_get_1_len Unexecuted instantiation: ssl_sess.c:PACKET_get_1_len Unexecuted instantiation: ssl_txt.c:PACKET_get_1_len Unexecuted instantiation: extensions.c:PACKET_get_1_len Unexecuted instantiation: extensions_clnt.c:PACKET_get_1_len Unexecuted instantiation: extensions_cust.c:PACKET_get_1_len Unexecuted instantiation: extensions_srvr.c:PACKET_get_1_len Unexecuted instantiation: statem.c:PACKET_get_1_len Unexecuted instantiation: statem_clnt.c:PACKET_get_1_len Unexecuted instantiation: statem_dtls.c:PACKET_get_1_len Unexecuted instantiation: statem_lib.c:PACKET_get_1_len Unexecuted instantiation: statem_srvr.c:PACKET_get_1_len Unexecuted instantiation: t1_lib.c:PACKET_get_1_len Unexecuted instantiation: tls13_enc.c:PACKET_get_1_len Unexecuted instantiation: tls_srp.c:PACKET_get_1_len Unexecuted instantiation: d1_lib.c:PACKET_get_1_len Unexecuted instantiation: d1_srtp.c:PACKET_get_1_len Unexecuted instantiation: methods.c:PACKET_get_1_len Unexecuted instantiation: packet.c:PACKET_get_1_len Unexecuted instantiation: pqueue.c:PACKET_get_1_len Unexecuted instantiation: rec_layer_d1.c:PACKET_get_1_len Unexecuted instantiation: rec_layer_s3.c:PACKET_get_1_len Unexecuted instantiation: ssl3_buffer.c:PACKET_get_1_len Unexecuted instantiation: ssl3_record.c:PACKET_get_1_len Unexecuted instantiation: ssl3_record_tls13.c:PACKET_get_1_len Unexecuted instantiation: s3_cbc.c:PACKET_get_1_len Unexecuted instantiation: s3_enc.c:PACKET_get_1_len Unexecuted instantiation: s3_lib.c:PACKET_get_1_len Unexecuted instantiation: s3_msg.c:PACKET_get_1_len Unexecuted instantiation: ssl_cert.c:PACKET_get_1_len Unexecuted instantiation: ssl_ciph.c:PACKET_get_1_len Unexecuted instantiation: ssl_lib.c:PACKET_get_1_len Unexecuted instantiation: ssl_mcnf.c:PACKET_get_1_len Unexecuted instantiation: ssl_rsa.c:PACKET_get_1_len Unexecuted instantiation: t1_enc.c:PACKET_get_1_len Unexecuted instantiation: d1_msg.c:PACKET_get_1_len Unexecuted instantiation: dtls1_bitmap.c:PACKET_get_1_len Unexecuted instantiation: ssl_conf.c:PACKET_get_1_len |
321 | | |
322 | | /* |
323 | | * Peek ahead at 4 bytes in reverse network order from |pkt| and store the value |
324 | | * in |*data| |
325 | | */ |
326 | | __owur static ossl_inline int PACKET_peek_4(const PACKET *pkt, |
327 | | unsigned long *data) |
328 | 0 | { |
329 | 0 | if (PACKET_remaining(pkt) < 4) |
330 | 0 | return 0; |
331 | 0 |
|
332 | 0 | *data = *pkt->curr; |
333 | 0 | *data |= ((unsigned long)(*(pkt->curr + 1))) << 8; |
334 | 0 | *data |= ((unsigned long)(*(pkt->curr + 2))) << 16; |
335 | 0 | *data |= ((unsigned long)(*(pkt->curr + 3))) << 24; |
336 | 0 |
|
337 | 0 | return 1; |
338 | 0 | } Unexecuted instantiation: ssl_asn1.c:PACKET_peek_4 Unexecuted instantiation: ssl_init.c:PACKET_peek_4 Unexecuted instantiation: ssl_sess.c:PACKET_peek_4 Unexecuted instantiation: ssl_txt.c:PACKET_peek_4 Unexecuted instantiation: extensions.c:PACKET_peek_4 Unexecuted instantiation: extensions_clnt.c:PACKET_peek_4 Unexecuted instantiation: extensions_cust.c:PACKET_peek_4 Unexecuted instantiation: extensions_srvr.c:PACKET_peek_4 Unexecuted instantiation: statem.c:PACKET_peek_4 Unexecuted instantiation: statem_clnt.c:PACKET_peek_4 Unexecuted instantiation: statem_dtls.c:PACKET_peek_4 Unexecuted instantiation: statem_lib.c:PACKET_peek_4 Unexecuted instantiation: statem_srvr.c:PACKET_peek_4 Unexecuted instantiation: t1_lib.c:PACKET_peek_4 Unexecuted instantiation: tls13_enc.c:PACKET_peek_4 Unexecuted instantiation: tls_srp.c:PACKET_peek_4 Unexecuted instantiation: d1_lib.c:PACKET_peek_4 Unexecuted instantiation: d1_srtp.c:PACKET_peek_4 Unexecuted instantiation: methods.c:PACKET_peek_4 Unexecuted instantiation: packet.c:PACKET_peek_4 Unexecuted instantiation: pqueue.c:PACKET_peek_4 Unexecuted instantiation: rec_layer_d1.c:PACKET_peek_4 Unexecuted instantiation: rec_layer_s3.c:PACKET_peek_4 Unexecuted instantiation: ssl3_buffer.c:PACKET_peek_4 Unexecuted instantiation: ssl3_record.c:PACKET_peek_4 Unexecuted instantiation: ssl3_record_tls13.c:PACKET_peek_4 Unexecuted instantiation: s3_cbc.c:PACKET_peek_4 Unexecuted instantiation: s3_enc.c:PACKET_peek_4 Unexecuted instantiation: s3_lib.c:PACKET_peek_4 Unexecuted instantiation: s3_msg.c:PACKET_peek_4 Unexecuted instantiation: ssl_cert.c:PACKET_peek_4 Unexecuted instantiation: ssl_ciph.c:PACKET_peek_4 Unexecuted instantiation: ssl_lib.c:PACKET_peek_4 Unexecuted instantiation: ssl_mcnf.c:PACKET_peek_4 Unexecuted instantiation: ssl_rsa.c:PACKET_peek_4 Unexecuted instantiation: t1_enc.c:PACKET_peek_4 Unexecuted instantiation: d1_msg.c:PACKET_peek_4 Unexecuted instantiation: dtls1_bitmap.c:PACKET_peek_4 Unexecuted instantiation: ssl_conf.c:PACKET_peek_4 |
339 | | |
340 | | /* Equivalent of c2l */ |
341 | | /* |
342 | | * Get 4 bytes in reverse network order from |pkt| and store the value in |
343 | | * |*data| |
344 | | */ |
345 | | __owur static ossl_inline int PACKET_get_4(PACKET *pkt, unsigned long *data) |
346 | 0 | { |
347 | 0 | if (!PACKET_peek_4(pkt, data)) |
348 | 0 | return 0; |
349 | 0 |
|
350 | 0 | packet_forward(pkt, 4); |
351 | 0 |
|
352 | 0 | return 1; |
353 | 0 | } Unexecuted instantiation: ssl_asn1.c:PACKET_get_4 Unexecuted instantiation: ssl_init.c:PACKET_get_4 Unexecuted instantiation: ssl_sess.c:PACKET_get_4 Unexecuted instantiation: ssl_txt.c:PACKET_get_4 Unexecuted instantiation: extensions.c:PACKET_get_4 Unexecuted instantiation: extensions_clnt.c:PACKET_get_4 Unexecuted instantiation: extensions_cust.c:PACKET_get_4 Unexecuted instantiation: extensions_srvr.c:PACKET_get_4 Unexecuted instantiation: statem.c:PACKET_get_4 Unexecuted instantiation: statem_clnt.c:PACKET_get_4 Unexecuted instantiation: statem_dtls.c:PACKET_get_4 Unexecuted instantiation: statem_lib.c:PACKET_get_4 Unexecuted instantiation: statem_srvr.c:PACKET_get_4 Unexecuted instantiation: t1_lib.c:PACKET_get_4 Unexecuted instantiation: tls13_enc.c:PACKET_get_4 Unexecuted instantiation: tls_srp.c:PACKET_get_4 Unexecuted instantiation: d1_lib.c:PACKET_get_4 Unexecuted instantiation: d1_srtp.c:PACKET_get_4 Unexecuted instantiation: methods.c:PACKET_get_4 Unexecuted instantiation: packet.c:PACKET_get_4 Unexecuted instantiation: pqueue.c:PACKET_get_4 Unexecuted instantiation: rec_layer_d1.c:PACKET_get_4 Unexecuted instantiation: rec_layer_s3.c:PACKET_get_4 Unexecuted instantiation: ssl3_buffer.c:PACKET_get_4 Unexecuted instantiation: ssl3_record.c:PACKET_get_4 Unexecuted instantiation: ssl3_record_tls13.c:PACKET_get_4 Unexecuted instantiation: s3_cbc.c:PACKET_get_4 Unexecuted instantiation: s3_enc.c:PACKET_get_4 Unexecuted instantiation: s3_lib.c:PACKET_get_4 Unexecuted instantiation: s3_msg.c:PACKET_get_4 Unexecuted instantiation: ssl_cert.c:PACKET_get_4 Unexecuted instantiation: ssl_ciph.c:PACKET_get_4 Unexecuted instantiation: ssl_lib.c:PACKET_get_4 Unexecuted instantiation: ssl_mcnf.c:PACKET_get_4 Unexecuted instantiation: ssl_rsa.c:PACKET_get_4 Unexecuted instantiation: t1_enc.c:PACKET_get_4 Unexecuted instantiation: d1_msg.c:PACKET_get_4 Unexecuted instantiation: dtls1_bitmap.c:PACKET_get_4 Unexecuted instantiation: ssl_conf.c:PACKET_get_4 |
354 | | |
355 | | /* |
356 | | * Peek ahead at |len| bytes from the |pkt| and store a pointer to them in |
357 | | * |*data|. This just points at the underlying buffer that |pkt| is using. The |
358 | | * caller should not free this data directly (it will be freed when the |
359 | | * underlying buffer gets freed |
360 | | */ |
361 | | __owur static ossl_inline int PACKET_peek_bytes(const PACKET *pkt, |
362 | | const unsigned char **data, |
363 | | size_t len) |
364 | 0 | { |
365 | 0 | if (PACKET_remaining(pkt) < len) |
366 | 0 | return 0; |
367 | | |
368 | 0 | *data = pkt->curr; |
369 | |
|
370 | 0 | return 1; |
371 | 0 | } Unexecuted instantiation: ssl_asn1.c:PACKET_peek_bytes Unexecuted instantiation: ssl_init.c:PACKET_peek_bytes Unexecuted instantiation: ssl_sess.c:PACKET_peek_bytes Unexecuted instantiation: ssl_txt.c:PACKET_peek_bytes Unexecuted instantiation: extensions.c:PACKET_peek_bytes Unexecuted instantiation: extensions_clnt.c:PACKET_peek_bytes Unexecuted instantiation: extensions_cust.c:PACKET_peek_bytes Unexecuted instantiation: extensions_srvr.c:PACKET_peek_bytes Unexecuted instantiation: statem.c:PACKET_peek_bytes Unexecuted instantiation: statem_clnt.c:PACKET_peek_bytes Unexecuted instantiation: statem_dtls.c:PACKET_peek_bytes Unexecuted instantiation: statem_lib.c:PACKET_peek_bytes Unexecuted instantiation: statem_srvr.c:PACKET_peek_bytes Unexecuted instantiation: t1_lib.c:PACKET_peek_bytes Unexecuted instantiation: tls13_enc.c:PACKET_peek_bytes Unexecuted instantiation: tls_srp.c:PACKET_peek_bytes Unexecuted instantiation: d1_lib.c:PACKET_peek_bytes Unexecuted instantiation: d1_srtp.c:PACKET_peek_bytes Unexecuted instantiation: methods.c:PACKET_peek_bytes Unexecuted instantiation: packet.c:PACKET_peek_bytes Unexecuted instantiation: pqueue.c:PACKET_peek_bytes Unexecuted instantiation: rec_layer_d1.c:PACKET_peek_bytes Unexecuted instantiation: rec_layer_s3.c:PACKET_peek_bytes Unexecuted instantiation: ssl3_buffer.c:PACKET_peek_bytes Unexecuted instantiation: ssl3_record.c:PACKET_peek_bytes Unexecuted instantiation: ssl3_record_tls13.c:PACKET_peek_bytes Unexecuted instantiation: s3_cbc.c:PACKET_peek_bytes Unexecuted instantiation: s3_enc.c:PACKET_peek_bytes Unexecuted instantiation: s3_lib.c:PACKET_peek_bytes Unexecuted instantiation: s3_msg.c:PACKET_peek_bytes Unexecuted instantiation: ssl_cert.c:PACKET_peek_bytes Unexecuted instantiation: ssl_ciph.c:PACKET_peek_bytes Unexecuted instantiation: ssl_lib.c:PACKET_peek_bytes Unexecuted instantiation: ssl_mcnf.c:PACKET_peek_bytes Unexecuted instantiation: ssl_rsa.c:PACKET_peek_bytes Unexecuted instantiation: t1_enc.c:PACKET_peek_bytes Unexecuted instantiation: d1_msg.c:PACKET_peek_bytes Unexecuted instantiation: dtls1_bitmap.c:PACKET_peek_bytes Unexecuted instantiation: ssl_conf.c:PACKET_peek_bytes |
372 | | |
373 | | /* |
374 | | * Read |len| bytes from the |pkt| and store a pointer to them in |*data|. This |
375 | | * just points at the underlying buffer that |pkt| is using. The caller should |
376 | | * not free this data directly (it will be freed when the underlying buffer gets |
377 | | * freed |
378 | | */ |
379 | | __owur static ossl_inline int PACKET_get_bytes(PACKET *pkt, |
380 | | const unsigned char **data, |
381 | | size_t len) |
382 | 0 | { |
383 | 0 | if (!PACKET_peek_bytes(pkt, data, len)) |
384 | 0 | return 0; |
385 | | |
386 | 0 | packet_forward(pkt, len); |
387 | |
|
388 | 0 | return 1; |
389 | 0 | } Unexecuted instantiation: ssl_asn1.c:PACKET_get_bytes Unexecuted instantiation: ssl_init.c:PACKET_get_bytes Unexecuted instantiation: ssl_sess.c:PACKET_get_bytes Unexecuted instantiation: ssl_txt.c:PACKET_get_bytes Unexecuted instantiation: extensions.c:PACKET_get_bytes Unexecuted instantiation: extensions_clnt.c:PACKET_get_bytes Unexecuted instantiation: extensions_cust.c:PACKET_get_bytes Unexecuted instantiation: extensions_srvr.c:PACKET_get_bytes Unexecuted instantiation: statem.c:PACKET_get_bytes Unexecuted instantiation: statem_clnt.c:PACKET_get_bytes Unexecuted instantiation: statem_dtls.c:PACKET_get_bytes Unexecuted instantiation: statem_lib.c:PACKET_get_bytes Unexecuted instantiation: statem_srvr.c:PACKET_get_bytes Unexecuted instantiation: t1_lib.c:PACKET_get_bytes Unexecuted instantiation: tls13_enc.c:PACKET_get_bytes Unexecuted instantiation: tls_srp.c:PACKET_get_bytes Unexecuted instantiation: d1_lib.c:PACKET_get_bytes Unexecuted instantiation: d1_srtp.c:PACKET_get_bytes Unexecuted instantiation: methods.c:PACKET_get_bytes Unexecuted instantiation: packet.c:PACKET_get_bytes Unexecuted instantiation: pqueue.c:PACKET_get_bytes Unexecuted instantiation: rec_layer_d1.c:PACKET_get_bytes Unexecuted instantiation: rec_layer_s3.c:PACKET_get_bytes Unexecuted instantiation: ssl3_buffer.c:PACKET_get_bytes Unexecuted instantiation: ssl3_record.c:PACKET_get_bytes Unexecuted instantiation: ssl3_record_tls13.c:PACKET_get_bytes Unexecuted instantiation: s3_cbc.c:PACKET_get_bytes Unexecuted instantiation: s3_enc.c:PACKET_get_bytes Unexecuted instantiation: s3_lib.c:PACKET_get_bytes Unexecuted instantiation: s3_msg.c:PACKET_get_bytes Unexecuted instantiation: ssl_cert.c:PACKET_get_bytes Unexecuted instantiation: ssl_ciph.c:PACKET_get_bytes Unexecuted instantiation: ssl_lib.c:PACKET_get_bytes Unexecuted instantiation: ssl_mcnf.c:PACKET_get_bytes Unexecuted instantiation: ssl_rsa.c:PACKET_get_bytes Unexecuted instantiation: t1_enc.c:PACKET_get_bytes Unexecuted instantiation: d1_msg.c:PACKET_get_bytes Unexecuted instantiation: dtls1_bitmap.c:PACKET_get_bytes Unexecuted instantiation: ssl_conf.c:PACKET_get_bytes |
390 | | |
391 | | /* Peek ahead at |len| bytes from |pkt| and copy them to |data| */ |
392 | | __owur static ossl_inline int PACKET_peek_copy_bytes(const PACKET *pkt, |
393 | | unsigned char *data, |
394 | | size_t len) |
395 | 0 | { |
396 | 0 | if (PACKET_remaining(pkt) < len) |
397 | 0 | return 0; |
398 | | |
399 | 0 | memcpy(data, pkt->curr, len); |
400 | |
|
401 | 0 | return 1; |
402 | 0 | } Unexecuted instantiation: ssl_asn1.c:PACKET_peek_copy_bytes Unexecuted instantiation: ssl_init.c:PACKET_peek_copy_bytes Unexecuted instantiation: ssl_sess.c:PACKET_peek_copy_bytes Unexecuted instantiation: ssl_txt.c:PACKET_peek_copy_bytes Unexecuted instantiation: extensions.c:PACKET_peek_copy_bytes Unexecuted instantiation: extensions_clnt.c:PACKET_peek_copy_bytes Unexecuted instantiation: extensions_cust.c:PACKET_peek_copy_bytes Unexecuted instantiation: extensions_srvr.c:PACKET_peek_copy_bytes Unexecuted instantiation: statem.c:PACKET_peek_copy_bytes Unexecuted instantiation: statem_clnt.c:PACKET_peek_copy_bytes Unexecuted instantiation: statem_dtls.c:PACKET_peek_copy_bytes Unexecuted instantiation: statem_lib.c:PACKET_peek_copy_bytes Unexecuted instantiation: statem_srvr.c:PACKET_peek_copy_bytes Unexecuted instantiation: t1_lib.c:PACKET_peek_copy_bytes Unexecuted instantiation: tls13_enc.c:PACKET_peek_copy_bytes Unexecuted instantiation: tls_srp.c:PACKET_peek_copy_bytes Unexecuted instantiation: d1_lib.c:PACKET_peek_copy_bytes Unexecuted instantiation: d1_srtp.c:PACKET_peek_copy_bytes Unexecuted instantiation: methods.c:PACKET_peek_copy_bytes Unexecuted instantiation: packet.c:PACKET_peek_copy_bytes Unexecuted instantiation: pqueue.c:PACKET_peek_copy_bytes Unexecuted instantiation: rec_layer_d1.c:PACKET_peek_copy_bytes Unexecuted instantiation: rec_layer_s3.c:PACKET_peek_copy_bytes Unexecuted instantiation: ssl3_buffer.c:PACKET_peek_copy_bytes Unexecuted instantiation: ssl3_record.c:PACKET_peek_copy_bytes Unexecuted instantiation: ssl3_record_tls13.c:PACKET_peek_copy_bytes Unexecuted instantiation: s3_cbc.c:PACKET_peek_copy_bytes Unexecuted instantiation: s3_enc.c:PACKET_peek_copy_bytes Unexecuted instantiation: s3_lib.c:PACKET_peek_copy_bytes Unexecuted instantiation: s3_msg.c:PACKET_peek_copy_bytes Unexecuted instantiation: ssl_cert.c:PACKET_peek_copy_bytes Unexecuted instantiation: ssl_ciph.c:PACKET_peek_copy_bytes Unexecuted instantiation: ssl_lib.c:PACKET_peek_copy_bytes Unexecuted instantiation: ssl_mcnf.c:PACKET_peek_copy_bytes Unexecuted instantiation: ssl_rsa.c:PACKET_peek_copy_bytes Unexecuted instantiation: t1_enc.c:PACKET_peek_copy_bytes Unexecuted instantiation: d1_msg.c:PACKET_peek_copy_bytes Unexecuted instantiation: dtls1_bitmap.c:PACKET_peek_copy_bytes Unexecuted instantiation: ssl_conf.c:PACKET_peek_copy_bytes |
403 | | |
404 | | /* |
405 | | * Read |len| bytes from |pkt| and copy them to |data|. |
406 | | * The caller is responsible for ensuring that |data| can hold |len| bytes. |
407 | | */ |
408 | | __owur static ossl_inline int PACKET_copy_bytes(PACKET *pkt, |
409 | | unsigned char *data, size_t len) |
410 | 0 | { |
411 | 0 | if (!PACKET_peek_copy_bytes(pkt, data, len)) |
412 | 0 | return 0; |
413 | | |
414 | 0 | packet_forward(pkt, len); |
415 | |
|
416 | 0 | return 1; |
417 | 0 | } Unexecuted instantiation: ssl_asn1.c:PACKET_copy_bytes Unexecuted instantiation: ssl_init.c:PACKET_copy_bytes Unexecuted instantiation: ssl_sess.c:PACKET_copy_bytes Unexecuted instantiation: ssl_txt.c:PACKET_copy_bytes Unexecuted instantiation: extensions.c:PACKET_copy_bytes Unexecuted instantiation: extensions_clnt.c:PACKET_copy_bytes Unexecuted instantiation: extensions_cust.c:PACKET_copy_bytes Unexecuted instantiation: extensions_srvr.c:PACKET_copy_bytes Unexecuted instantiation: statem.c:PACKET_copy_bytes Unexecuted instantiation: statem_clnt.c:PACKET_copy_bytes Unexecuted instantiation: statem_dtls.c:PACKET_copy_bytes Unexecuted instantiation: statem_lib.c:PACKET_copy_bytes Unexecuted instantiation: statem_srvr.c:PACKET_copy_bytes Unexecuted instantiation: t1_lib.c:PACKET_copy_bytes Unexecuted instantiation: tls13_enc.c:PACKET_copy_bytes Unexecuted instantiation: tls_srp.c:PACKET_copy_bytes Unexecuted instantiation: d1_lib.c:PACKET_copy_bytes Unexecuted instantiation: d1_srtp.c:PACKET_copy_bytes Unexecuted instantiation: methods.c:PACKET_copy_bytes Unexecuted instantiation: packet.c:PACKET_copy_bytes Unexecuted instantiation: pqueue.c:PACKET_copy_bytes Unexecuted instantiation: rec_layer_d1.c:PACKET_copy_bytes Unexecuted instantiation: rec_layer_s3.c:PACKET_copy_bytes Unexecuted instantiation: ssl3_buffer.c:PACKET_copy_bytes Unexecuted instantiation: ssl3_record.c:PACKET_copy_bytes Unexecuted instantiation: ssl3_record_tls13.c:PACKET_copy_bytes Unexecuted instantiation: s3_cbc.c:PACKET_copy_bytes Unexecuted instantiation: s3_enc.c:PACKET_copy_bytes Unexecuted instantiation: s3_lib.c:PACKET_copy_bytes Unexecuted instantiation: s3_msg.c:PACKET_copy_bytes Unexecuted instantiation: ssl_cert.c:PACKET_copy_bytes Unexecuted instantiation: ssl_ciph.c:PACKET_copy_bytes Unexecuted instantiation: ssl_lib.c:PACKET_copy_bytes Unexecuted instantiation: ssl_mcnf.c:PACKET_copy_bytes Unexecuted instantiation: ssl_rsa.c:PACKET_copy_bytes Unexecuted instantiation: t1_enc.c:PACKET_copy_bytes Unexecuted instantiation: d1_msg.c:PACKET_copy_bytes Unexecuted instantiation: dtls1_bitmap.c:PACKET_copy_bytes Unexecuted instantiation: ssl_conf.c:PACKET_copy_bytes |
418 | | |
419 | | /* |
420 | | * Copy packet data to |dest|, and set |len| to the number of copied bytes. |
421 | | * If the packet has more than |dest_len| bytes, nothing is copied. |
422 | | * Returns 1 if the packet data fits in |dest_len| bytes, 0 otherwise. |
423 | | * Does not forward PACKET position (because it is typically the last thing |
424 | | * done with a given PACKET). |
425 | | */ |
426 | | __owur static ossl_inline int PACKET_copy_all(const PACKET *pkt, |
427 | | unsigned char *dest, |
428 | | size_t dest_len, size_t *len) |
429 | 0 | { |
430 | 0 | if (PACKET_remaining(pkt) > dest_len) { |
431 | 0 | *len = 0; |
432 | 0 | return 0; |
433 | 0 | } |
434 | 0 | *len = pkt->remaining; |
435 | 0 | memcpy(dest, pkt->curr, pkt->remaining); |
436 | 0 | return 1; |
437 | 0 | } Unexecuted instantiation: ssl_asn1.c:PACKET_copy_all Unexecuted instantiation: ssl_init.c:PACKET_copy_all Unexecuted instantiation: ssl_sess.c:PACKET_copy_all Unexecuted instantiation: ssl_txt.c:PACKET_copy_all Unexecuted instantiation: extensions.c:PACKET_copy_all Unexecuted instantiation: extensions_clnt.c:PACKET_copy_all Unexecuted instantiation: extensions_cust.c:PACKET_copy_all Unexecuted instantiation: extensions_srvr.c:PACKET_copy_all Unexecuted instantiation: statem.c:PACKET_copy_all Unexecuted instantiation: statem_clnt.c:PACKET_copy_all Unexecuted instantiation: statem_dtls.c:PACKET_copy_all Unexecuted instantiation: statem_lib.c:PACKET_copy_all Unexecuted instantiation: statem_srvr.c:PACKET_copy_all Unexecuted instantiation: t1_lib.c:PACKET_copy_all Unexecuted instantiation: tls13_enc.c:PACKET_copy_all Unexecuted instantiation: tls_srp.c:PACKET_copy_all Unexecuted instantiation: d1_lib.c:PACKET_copy_all Unexecuted instantiation: d1_srtp.c:PACKET_copy_all Unexecuted instantiation: methods.c:PACKET_copy_all Unexecuted instantiation: packet.c:PACKET_copy_all Unexecuted instantiation: pqueue.c:PACKET_copy_all Unexecuted instantiation: rec_layer_d1.c:PACKET_copy_all Unexecuted instantiation: rec_layer_s3.c:PACKET_copy_all Unexecuted instantiation: ssl3_buffer.c:PACKET_copy_all Unexecuted instantiation: ssl3_record.c:PACKET_copy_all Unexecuted instantiation: ssl3_record_tls13.c:PACKET_copy_all Unexecuted instantiation: s3_cbc.c:PACKET_copy_all Unexecuted instantiation: s3_enc.c:PACKET_copy_all Unexecuted instantiation: s3_lib.c:PACKET_copy_all Unexecuted instantiation: s3_msg.c:PACKET_copy_all Unexecuted instantiation: ssl_cert.c:PACKET_copy_all Unexecuted instantiation: ssl_ciph.c:PACKET_copy_all Unexecuted instantiation: ssl_lib.c:PACKET_copy_all Unexecuted instantiation: ssl_mcnf.c:PACKET_copy_all Unexecuted instantiation: ssl_rsa.c:PACKET_copy_all Unexecuted instantiation: t1_enc.c:PACKET_copy_all Unexecuted instantiation: d1_msg.c:PACKET_copy_all Unexecuted instantiation: dtls1_bitmap.c:PACKET_copy_all Unexecuted instantiation: ssl_conf.c:PACKET_copy_all |
438 | | |
439 | | /* |
440 | | * Copy |pkt| bytes to a newly allocated buffer and store a pointer to the |
441 | | * result in |*data|, and the length in |len|. |
442 | | * If |*data| is not NULL, the old data is OPENSSL_free'd. |
443 | | * If the packet is empty, or malloc fails, |*data| will be set to NULL. |
444 | | * Returns 1 if the malloc succeeds and 0 otherwise. |
445 | | * Does not forward PACKET position (because it is typically the last thing |
446 | | * done with a given PACKET). |
447 | | */ |
448 | | __owur static ossl_inline int PACKET_memdup(const PACKET *pkt, |
449 | | unsigned char **data, size_t *len) |
450 | 0 | { |
451 | 0 | size_t length; |
452 | |
|
453 | 0 | OPENSSL_free(*data); |
454 | 0 | *data = NULL; |
455 | 0 | *len = 0; |
456 | |
|
457 | 0 | length = PACKET_remaining(pkt); |
458 | |
|
459 | 0 | if (length == 0) |
460 | 0 | return 1; |
461 | | |
462 | 0 | *data = OPENSSL_memdup(pkt->curr, length); |
463 | 0 | if (*data == NULL) |
464 | 0 | return 0; |
465 | | |
466 | 0 | *len = length; |
467 | 0 | return 1; |
468 | 0 | } Unexecuted instantiation: ssl_asn1.c:PACKET_memdup Unexecuted instantiation: ssl_init.c:PACKET_memdup Unexecuted instantiation: ssl_sess.c:PACKET_memdup Unexecuted instantiation: ssl_txt.c:PACKET_memdup Unexecuted instantiation: extensions.c:PACKET_memdup Unexecuted instantiation: extensions_clnt.c:PACKET_memdup Unexecuted instantiation: extensions_cust.c:PACKET_memdup Unexecuted instantiation: extensions_srvr.c:PACKET_memdup Unexecuted instantiation: statem.c:PACKET_memdup Unexecuted instantiation: statem_clnt.c:PACKET_memdup Unexecuted instantiation: statem_dtls.c:PACKET_memdup Unexecuted instantiation: statem_lib.c:PACKET_memdup Unexecuted instantiation: statem_srvr.c:PACKET_memdup Unexecuted instantiation: t1_lib.c:PACKET_memdup Unexecuted instantiation: tls13_enc.c:PACKET_memdup Unexecuted instantiation: tls_srp.c:PACKET_memdup Unexecuted instantiation: d1_lib.c:PACKET_memdup Unexecuted instantiation: d1_srtp.c:PACKET_memdup Unexecuted instantiation: methods.c:PACKET_memdup Unexecuted instantiation: packet.c:PACKET_memdup Unexecuted instantiation: pqueue.c:PACKET_memdup Unexecuted instantiation: rec_layer_d1.c:PACKET_memdup Unexecuted instantiation: rec_layer_s3.c:PACKET_memdup Unexecuted instantiation: ssl3_buffer.c:PACKET_memdup Unexecuted instantiation: ssl3_record.c:PACKET_memdup Unexecuted instantiation: ssl3_record_tls13.c:PACKET_memdup Unexecuted instantiation: s3_cbc.c:PACKET_memdup Unexecuted instantiation: s3_enc.c:PACKET_memdup Unexecuted instantiation: s3_lib.c:PACKET_memdup Unexecuted instantiation: s3_msg.c:PACKET_memdup Unexecuted instantiation: ssl_cert.c:PACKET_memdup Unexecuted instantiation: ssl_ciph.c:PACKET_memdup Unexecuted instantiation: ssl_lib.c:PACKET_memdup Unexecuted instantiation: ssl_mcnf.c:PACKET_memdup Unexecuted instantiation: ssl_rsa.c:PACKET_memdup Unexecuted instantiation: t1_enc.c:PACKET_memdup Unexecuted instantiation: d1_msg.c:PACKET_memdup Unexecuted instantiation: dtls1_bitmap.c:PACKET_memdup Unexecuted instantiation: ssl_conf.c:PACKET_memdup |
469 | | |
470 | | /* |
471 | | * Read a C string from |pkt| and copy to a newly allocated, NUL-terminated |
472 | | * buffer. Store a pointer to the result in |*data|. |
473 | | * If |*data| is not NULL, the old data is OPENSSL_free'd. |
474 | | * If the data in |pkt| does not contain a NUL-byte, the entire data is |
475 | | * copied and NUL-terminated. |
476 | | * Returns 1 if the malloc succeeds and 0 otherwise. |
477 | | * Does not forward PACKET position (because it is typically the last thing done |
478 | | * with a given PACKET). |
479 | | */ |
480 | | __owur static ossl_inline int PACKET_strndup(const PACKET *pkt, char **data) |
481 | 0 | { |
482 | 0 | OPENSSL_free(*data); |
483 | | |
484 | | /* This will succeed on an empty packet, unless pkt->curr == NULL. */ |
485 | 0 | *data = OPENSSL_strndup((const char *)pkt->curr, PACKET_remaining(pkt)); |
486 | 0 | return (*data != NULL); |
487 | 0 | } Unexecuted instantiation: ssl_asn1.c:PACKET_strndup Unexecuted instantiation: ssl_init.c:PACKET_strndup Unexecuted instantiation: ssl_sess.c:PACKET_strndup Unexecuted instantiation: ssl_txt.c:PACKET_strndup Unexecuted instantiation: extensions.c:PACKET_strndup Unexecuted instantiation: extensions_clnt.c:PACKET_strndup Unexecuted instantiation: extensions_cust.c:PACKET_strndup Unexecuted instantiation: extensions_srvr.c:PACKET_strndup Unexecuted instantiation: statem.c:PACKET_strndup Unexecuted instantiation: statem_clnt.c:PACKET_strndup Unexecuted instantiation: statem_dtls.c:PACKET_strndup Unexecuted instantiation: statem_lib.c:PACKET_strndup Unexecuted instantiation: statem_srvr.c:PACKET_strndup Unexecuted instantiation: t1_lib.c:PACKET_strndup Unexecuted instantiation: tls13_enc.c:PACKET_strndup Unexecuted instantiation: tls_srp.c:PACKET_strndup Unexecuted instantiation: d1_lib.c:PACKET_strndup Unexecuted instantiation: d1_srtp.c:PACKET_strndup Unexecuted instantiation: methods.c:PACKET_strndup Unexecuted instantiation: packet.c:PACKET_strndup Unexecuted instantiation: pqueue.c:PACKET_strndup Unexecuted instantiation: rec_layer_d1.c:PACKET_strndup Unexecuted instantiation: rec_layer_s3.c:PACKET_strndup Unexecuted instantiation: ssl3_buffer.c:PACKET_strndup Unexecuted instantiation: ssl3_record.c:PACKET_strndup Unexecuted instantiation: ssl3_record_tls13.c:PACKET_strndup Unexecuted instantiation: s3_cbc.c:PACKET_strndup Unexecuted instantiation: s3_enc.c:PACKET_strndup Unexecuted instantiation: s3_lib.c:PACKET_strndup Unexecuted instantiation: s3_msg.c:PACKET_strndup Unexecuted instantiation: ssl_cert.c:PACKET_strndup Unexecuted instantiation: ssl_ciph.c:PACKET_strndup Unexecuted instantiation: ssl_lib.c:PACKET_strndup Unexecuted instantiation: ssl_mcnf.c:PACKET_strndup Unexecuted instantiation: ssl_rsa.c:PACKET_strndup Unexecuted instantiation: t1_enc.c:PACKET_strndup Unexecuted instantiation: d1_msg.c:PACKET_strndup Unexecuted instantiation: dtls1_bitmap.c:PACKET_strndup Unexecuted instantiation: ssl_conf.c:PACKET_strndup |
488 | | |
489 | | /* Returns 1 if |pkt| contains at least one 0-byte, 0 otherwise. */ |
490 | | static ossl_inline int PACKET_contains_zero_byte(const PACKET *pkt) |
491 | 0 | { |
492 | 0 | return memchr(pkt->curr, 0, pkt->remaining) != NULL; |
493 | 0 | } Unexecuted instantiation: ssl_asn1.c:PACKET_contains_zero_byte Unexecuted instantiation: ssl_init.c:PACKET_contains_zero_byte Unexecuted instantiation: ssl_sess.c:PACKET_contains_zero_byte Unexecuted instantiation: ssl_txt.c:PACKET_contains_zero_byte Unexecuted instantiation: extensions.c:PACKET_contains_zero_byte Unexecuted instantiation: extensions_clnt.c:PACKET_contains_zero_byte Unexecuted instantiation: extensions_cust.c:PACKET_contains_zero_byte Unexecuted instantiation: extensions_srvr.c:PACKET_contains_zero_byte Unexecuted instantiation: statem.c:PACKET_contains_zero_byte Unexecuted instantiation: statem_clnt.c:PACKET_contains_zero_byte Unexecuted instantiation: statem_dtls.c:PACKET_contains_zero_byte Unexecuted instantiation: statem_lib.c:PACKET_contains_zero_byte Unexecuted instantiation: statem_srvr.c:PACKET_contains_zero_byte Unexecuted instantiation: t1_lib.c:PACKET_contains_zero_byte Unexecuted instantiation: tls13_enc.c:PACKET_contains_zero_byte Unexecuted instantiation: tls_srp.c:PACKET_contains_zero_byte Unexecuted instantiation: d1_lib.c:PACKET_contains_zero_byte Unexecuted instantiation: d1_srtp.c:PACKET_contains_zero_byte Unexecuted instantiation: methods.c:PACKET_contains_zero_byte Unexecuted instantiation: packet.c:PACKET_contains_zero_byte Unexecuted instantiation: pqueue.c:PACKET_contains_zero_byte Unexecuted instantiation: rec_layer_d1.c:PACKET_contains_zero_byte Unexecuted instantiation: rec_layer_s3.c:PACKET_contains_zero_byte Unexecuted instantiation: ssl3_buffer.c:PACKET_contains_zero_byte Unexecuted instantiation: ssl3_record.c:PACKET_contains_zero_byte Unexecuted instantiation: ssl3_record_tls13.c:PACKET_contains_zero_byte Unexecuted instantiation: s3_cbc.c:PACKET_contains_zero_byte Unexecuted instantiation: s3_enc.c:PACKET_contains_zero_byte Unexecuted instantiation: s3_lib.c:PACKET_contains_zero_byte Unexecuted instantiation: s3_msg.c:PACKET_contains_zero_byte Unexecuted instantiation: ssl_cert.c:PACKET_contains_zero_byte Unexecuted instantiation: ssl_ciph.c:PACKET_contains_zero_byte Unexecuted instantiation: ssl_lib.c:PACKET_contains_zero_byte Unexecuted instantiation: ssl_mcnf.c:PACKET_contains_zero_byte Unexecuted instantiation: ssl_rsa.c:PACKET_contains_zero_byte Unexecuted instantiation: t1_enc.c:PACKET_contains_zero_byte Unexecuted instantiation: d1_msg.c:PACKET_contains_zero_byte Unexecuted instantiation: dtls1_bitmap.c:PACKET_contains_zero_byte Unexecuted instantiation: ssl_conf.c:PACKET_contains_zero_byte |
494 | | |
495 | | /* Move the current reading position forward |len| bytes */ |
496 | | __owur static ossl_inline int PACKET_forward(PACKET *pkt, size_t len) |
497 | 0 | { |
498 | 0 | if (PACKET_remaining(pkt) < len) |
499 | 0 | return 0; |
500 | | |
501 | 0 | packet_forward(pkt, len); |
502 | |
|
503 | 0 | return 1; |
504 | 0 | } Unexecuted instantiation: ssl_asn1.c:PACKET_forward Unexecuted instantiation: ssl_init.c:PACKET_forward Unexecuted instantiation: ssl_sess.c:PACKET_forward Unexecuted instantiation: ssl_txt.c:PACKET_forward Unexecuted instantiation: extensions.c:PACKET_forward Unexecuted instantiation: extensions_clnt.c:PACKET_forward Unexecuted instantiation: extensions_cust.c:PACKET_forward Unexecuted instantiation: extensions_srvr.c:PACKET_forward Unexecuted instantiation: statem.c:PACKET_forward Unexecuted instantiation: statem_clnt.c:PACKET_forward Unexecuted instantiation: statem_dtls.c:PACKET_forward Unexecuted instantiation: statem_lib.c:PACKET_forward Unexecuted instantiation: statem_srvr.c:PACKET_forward Unexecuted instantiation: t1_lib.c:PACKET_forward Unexecuted instantiation: tls13_enc.c:PACKET_forward Unexecuted instantiation: tls_srp.c:PACKET_forward Unexecuted instantiation: d1_lib.c:PACKET_forward Unexecuted instantiation: d1_srtp.c:PACKET_forward Unexecuted instantiation: methods.c:PACKET_forward Unexecuted instantiation: packet.c:PACKET_forward Unexecuted instantiation: pqueue.c:PACKET_forward Unexecuted instantiation: rec_layer_d1.c:PACKET_forward Unexecuted instantiation: rec_layer_s3.c:PACKET_forward Unexecuted instantiation: ssl3_buffer.c:PACKET_forward Unexecuted instantiation: ssl3_record.c:PACKET_forward Unexecuted instantiation: ssl3_record_tls13.c:PACKET_forward Unexecuted instantiation: s3_cbc.c:PACKET_forward Unexecuted instantiation: s3_enc.c:PACKET_forward Unexecuted instantiation: s3_lib.c:PACKET_forward Unexecuted instantiation: s3_msg.c:PACKET_forward Unexecuted instantiation: ssl_cert.c:PACKET_forward Unexecuted instantiation: ssl_ciph.c:PACKET_forward Unexecuted instantiation: ssl_lib.c:PACKET_forward Unexecuted instantiation: ssl_mcnf.c:PACKET_forward Unexecuted instantiation: ssl_rsa.c:PACKET_forward Unexecuted instantiation: t1_enc.c:PACKET_forward Unexecuted instantiation: d1_msg.c:PACKET_forward Unexecuted instantiation: dtls1_bitmap.c:PACKET_forward Unexecuted instantiation: ssl_conf.c:PACKET_forward |
505 | | |
506 | | /* |
507 | | * Reads a variable-length vector prefixed with a one-byte length, and stores |
508 | | * the contents in |subpkt|. |pkt| can equal |subpkt|. |
509 | | * Data is not copied: the |subpkt| packet will share its underlying buffer with |
510 | | * the original |pkt|, so data wrapped by |pkt| must outlive the |subpkt|. |
511 | | * Upon failure, the original |pkt| and |subpkt| are not modified. |
512 | | */ |
513 | | __owur static ossl_inline int PACKET_get_length_prefixed_1(PACKET *pkt, |
514 | | PACKET *subpkt) |
515 | 0 | { |
516 | 0 | unsigned int length; |
517 | 0 | const unsigned char *data; |
518 | 0 | PACKET tmp = *pkt; |
519 | 0 | if (!PACKET_get_1(&tmp, &length) || |
520 | 0 | !PACKET_get_bytes(&tmp, &data, (size_t)length)) { |
521 | 0 | return 0; |
522 | 0 | } |
523 | | |
524 | 0 | *pkt = tmp; |
525 | 0 | subpkt->curr = data; |
526 | 0 | subpkt->remaining = length; |
527 | |
|
528 | 0 | return 1; |
529 | 0 | } Unexecuted instantiation: ssl_asn1.c:PACKET_get_length_prefixed_1 Unexecuted instantiation: ssl_init.c:PACKET_get_length_prefixed_1 Unexecuted instantiation: ssl_sess.c:PACKET_get_length_prefixed_1 Unexecuted instantiation: ssl_txt.c:PACKET_get_length_prefixed_1 Unexecuted instantiation: extensions.c:PACKET_get_length_prefixed_1 Unexecuted instantiation: extensions_clnt.c:PACKET_get_length_prefixed_1 Unexecuted instantiation: extensions_cust.c:PACKET_get_length_prefixed_1 Unexecuted instantiation: extensions_srvr.c:PACKET_get_length_prefixed_1 Unexecuted instantiation: statem.c:PACKET_get_length_prefixed_1 Unexecuted instantiation: statem_clnt.c:PACKET_get_length_prefixed_1 Unexecuted instantiation: statem_dtls.c:PACKET_get_length_prefixed_1 Unexecuted instantiation: statem_lib.c:PACKET_get_length_prefixed_1 Unexecuted instantiation: statem_srvr.c:PACKET_get_length_prefixed_1 Unexecuted instantiation: t1_lib.c:PACKET_get_length_prefixed_1 Unexecuted instantiation: tls13_enc.c:PACKET_get_length_prefixed_1 Unexecuted instantiation: tls_srp.c:PACKET_get_length_prefixed_1 Unexecuted instantiation: d1_lib.c:PACKET_get_length_prefixed_1 Unexecuted instantiation: d1_srtp.c:PACKET_get_length_prefixed_1 Unexecuted instantiation: methods.c:PACKET_get_length_prefixed_1 Unexecuted instantiation: packet.c:PACKET_get_length_prefixed_1 Unexecuted instantiation: pqueue.c:PACKET_get_length_prefixed_1 Unexecuted instantiation: rec_layer_d1.c:PACKET_get_length_prefixed_1 Unexecuted instantiation: rec_layer_s3.c:PACKET_get_length_prefixed_1 Unexecuted instantiation: ssl3_buffer.c:PACKET_get_length_prefixed_1 Unexecuted instantiation: ssl3_record.c:PACKET_get_length_prefixed_1 Unexecuted instantiation: ssl3_record_tls13.c:PACKET_get_length_prefixed_1 Unexecuted instantiation: s3_cbc.c:PACKET_get_length_prefixed_1 Unexecuted instantiation: s3_enc.c:PACKET_get_length_prefixed_1 Unexecuted instantiation: s3_lib.c:PACKET_get_length_prefixed_1 Unexecuted instantiation: s3_msg.c:PACKET_get_length_prefixed_1 Unexecuted instantiation: ssl_cert.c:PACKET_get_length_prefixed_1 Unexecuted instantiation: ssl_ciph.c:PACKET_get_length_prefixed_1 Unexecuted instantiation: ssl_lib.c:PACKET_get_length_prefixed_1 Unexecuted instantiation: ssl_mcnf.c:PACKET_get_length_prefixed_1 Unexecuted instantiation: ssl_rsa.c:PACKET_get_length_prefixed_1 Unexecuted instantiation: t1_enc.c:PACKET_get_length_prefixed_1 Unexecuted instantiation: d1_msg.c:PACKET_get_length_prefixed_1 Unexecuted instantiation: dtls1_bitmap.c:PACKET_get_length_prefixed_1 Unexecuted instantiation: ssl_conf.c:PACKET_get_length_prefixed_1 |
530 | | |
531 | | /* |
532 | | * Like PACKET_get_length_prefixed_1, but additionally, fails when there are |
533 | | * leftover bytes in |pkt|. |
534 | | */ |
535 | | __owur static ossl_inline int PACKET_as_length_prefixed_1(PACKET *pkt, |
536 | | PACKET *subpkt) |
537 | 0 | { |
538 | 0 | unsigned int length; |
539 | 0 | const unsigned char *data; |
540 | 0 | PACKET tmp = *pkt; |
541 | 0 | if (!PACKET_get_1(&tmp, &length) || |
542 | 0 | !PACKET_get_bytes(&tmp, &data, (size_t)length) || |
543 | 0 | PACKET_remaining(&tmp) != 0) { |
544 | 0 | return 0; |
545 | 0 | } |
546 | | |
547 | 0 | *pkt = tmp; |
548 | 0 | subpkt->curr = data; |
549 | 0 | subpkt->remaining = length; |
550 | |
|
551 | 0 | return 1; |
552 | 0 | } Unexecuted instantiation: ssl_asn1.c:PACKET_as_length_prefixed_1 Unexecuted instantiation: ssl_init.c:PACKET_as_length_prefixed_1 Unexecuted instantiation: ssl_sess.c:PACKET_as_length_prefixed_1 Unexecuted instantiation: ssl_txt.c:PACKET_as_length_prefixed_1 Unexecuted instantiation: extensions.c:PACKET_as_length_prefixed_1 Unexecuted instantiation: extensions_clnt.c:PACKET_as_length_prefixed_1 Unexecuted instantiation: extensions_cust.c:PACKET_as_length_prefixed_1 Unexecuted instantiation: extensions_srvr.c:PACKET_as_length_prefixed_1 Unexecuted instantiation: statem.c:PACKET_as_length_prefixed_1 Unexecuted instantiation: statem_clnt.c:PACKET_as_length_prefixed_1 Unexecuted instantiation: statem_dtls.c:PACKET_as_length_prefixed_1 Unexecuted instantiation: statem_lib.c:PACKET_as_length_prefixed_1 Unexecuted instantiation: statem_srvr.c:PACKET_as_length_prefixed_1 Unexecuted instantiation: t1_lib.c:PACKET_as_length_prefixed_1 Unexecuted instantiation: tls13_enc.c:PACKET_as_length_prefixed_1 Unexecuted instantiation: tls_srp.c:PACKET_as_length_prefixed_1 Unexecuted instantiation: d1_lib.c:PACKET_as_length_prefixed_1 Unexecuted instantiation: d1_srtp.c:PACKET_as_length_prefixed_1 Unexecuted instantiation: methods.c:PACKET_as_length_prefixed_1 Unexecuted instantiation: packet.c:PACKET_as_length_prefixed_1 Unexecuted instantiation: pqueue.c:PACKET_as_length_prefixed_1 Unexecuted instantiation: rec_layer_d1.c:PACKET_as_length_prefixed_1 Unexecuted instantiation: rec_layer_s3.c:PACKET_as_length_prefixed_1 Unexecuted instantiation: ssl3_buffer.c:PACKET_as_length_prefixed_1 Unexecuted instantiation: ssl3_record.c:PACKET_as_length_prefixed_1 Unexecuted instantiation: ssl3_record_tls13.c:PACKET_as_length_prefixed_1 Unexecuted instantiation: s3_cbc.c:PACKET_as_length_prefixed_1 Unexecuted instantiation: s3_enc.c:PACKET_as_length_prefixed_1 Unexecuted instantiation: s3_lib.c:PACKET_as_length_prefixed_1 Unexecuted instantiation: s3_msg.c:PACKET_as_length_prefixed_1 Unexecuted instantiation: ssl_cert.c:PACKET_as_length_prefixed_1 Unexecuted instantiation: ssl_ciph.c:PACKET_as_length_prefixed_1 Unexecuted instantiation: ssl_lib.c:PACKET_as_length_prefixed_1 Unexecuted instantiation: ssl_mcnf.c:PACKET_as_length_prefixed_1 Unexecuted instantiation: ssl_rsa.c:PACKET_as_length_prefixed_1 Unexecuted instantiation: t1_enc.c:PACKET_as_length_prefixed_1 Unexecuted instantiation: d1_msg.c:PACKET_as_length_prefixed_1 Unexecuted instantiation: dtls1_bitmap.c:PACKET_as_length_prefixed_1 Unexecuted instantiation: ssl_conf.c:PACKET_as_length_prefixed_1 |
553 | | |
554 | | /* |
555 | | * Reads a variable-length vector prefixed with a two-byte length, and stores |
556 | | * the contents in |subpkt|. |pkt| can equal |subpkt|. |
557 | | * Data is not copied: the |subpkt| packet will share its underlying buffer with |
558 | | * the original |pkt|, so data wrapped by |pkt| must outlive the |subpkt|. |
559 | | * Upon failure, the original |pkt| and |subpkt| are not modified. |
560 | | */ |
561 | | __owur static ossl_inline int PACKET_get_length_prefixed_2(PACKET *pkt, |
562 | | PACKET *subpkt) |
563 | 0 | { |
564 | 0 | unsigned int length; |
565 | 0 | const unsigned char *data; |
566 | 0 | PACKET tmp = *pkt; |
567 | |
|
568 | 0 | if (!PACKET_get_net_2(&tmp, &length) || |
569 | 0 | !PACKET_get_bytes(&tmp, &data, (size_t)length)) { |
570 | 0 | return 0; |
571 | 0 | } |
572 | | |
573 | 0 | *pkt = tmp; |
574 | 0 | subpkt->curr = data; |
575 | 0 | subpkt->remaining = length; |
576 | |
|
577 | 0 | return 1; |
578 | 0 | } Unexecuted instantiation: ssl_asn1.c:PACKET_get_length_prefixed_2 Unexecuted instantiation: ssl_init.c:PACKET_get_length_prefixed_2 Unexecuted instantiation: ssl_sess.c:PACKET_get_length_prefixed_2 Unexecuted instantiation: ssl_txt.c:PACKET_get_length_prefixed_2 Unexecuted instantiation: extensions.c:PACKET_get_length_prefixed_2 Unexecuted instantiation: extensions_clnt.c:PACKET_get_length_prefixed_2 Unexecuted instantiation: extensions_cust.c:PACKET_get_length_prefixed_2 Unexecuted instantiation: extensions_srvr.c:PACKET_get_length_prefixed_2 Unexecuted instantiation: statem.c:PACKET_get_length_prefixed_2 Unexecuted instantiation: statem_clnt.c:PACKET_get_length_prefixed_2 Unexecuted instantiation: statem_dtls.c:PACKET_get_length_prefixed_2 Unexecuted instantiation: statem_lib.c:PACKET_get_length_prefixed_2 Unexecuted instantiation: statem_srvr.c:PACKET_get_length_prefixed_2 Unexecuted instantiation: t1_lib.c:PACKET_get_length_prefixed_2 Unexecuted instantiation: tls13_enc.c:PACKET_get_length_prefixed_2 Unexecuted instantiation: tls_srp.c:PACKET_get_length_prefixed_2 Unexecuted instantiation: d1_lib.c:PACKET_get_length_prefixed_2 Unexecuted instantiation: d1_srtp.c:PACKET_get_length_prefixed_2 Unexecuted instantiation: methods.c:PACKET_get_length_prefixed_2 Unexecuted instantiation: packet.c:PACKET_get_length_prefixed_2 Unexecuted instantiation: pqueue.c:PACKET_get_length_prefixed_2 Unexecuted instantiation: rec_layer_d1.c:PACKET_get_length_prefixed_2 Unexecuted instantiation: rec_layer_s3.c:PACKET_get_length_prefixed_2 Unexecuted instantiation: ssl3_buffer.c:PACKET_get_length_prefixed_2 Unexecuted instantiation: ssl3_record.c:PACKET_get_length_prefixed_2 Unexecuted instantiation: ssl3_record_tls13.c:PACKET_get_length_prefixed_2 Unexecuted instantiation: s3_cbc.c:PACKET_get_length_prefixed_2 Unexecuted instantiation: s3_enc.c:PACKET_get_length_prefixed_2 Unexecuted instantiation: s3_lib.c:PACKET_get_length_prefixed_2 Unexecuted instantiation: s3_msg.c:PACKET_get_length_prefixed_2 Unexecuted instantiation: ssl_cert.c:PACKET_get_length_prefixed_2 Unexecuted instantiation: ssl_ciph.c:PACKET_get_length_prefixed_2 Unexecuted instantiation: ssl_lib.c:PACKET_get_length_prefixed_2 Unexecuted instantiation: ssl_mcnf.c:PACKET_get_length_prefixed_2 Unexecuted instantiation: ssl_rsa.c:PACKET_get_length_prefixed_2 Unexecuted instantiation: t1_enc.c:PACKET_get_length_prefixed_2 Unexecuted instantiation: d1_msg.c:PACKET_get_length_prefixed_2 Unexecuted instantiation: dtls1_bitmap.c:PACKET_get_length_prefixed_2 Unexecuted instantiation: ssl_conf.c:PACKET_get_length_prefixed_2 |
579 | | |
580 | | /* |
581 | | * Like PACKET_get_length_prefixed_2, but additionally, fails when there are |
582 | | * leftover bytes in |pkt|. |
583 | | */ |
584 | | __owur static ossl_inline int PACKET_as_length_prefixed_2(PACKET *pkt, |
585 | | PACKET *subpkt) |
586 | 0 | { |
587 | 0 | unsigned int length; |
588 | 0 | const unsigned char *data; |
589 | 0 | PACKET tmp = *pkt; |
590 | |
|
591 | 0 | if (!PACKET_get_net_2(&tmp, &length) || |
592 | 0 | !PACKET_get_bytes(&tmp, &data, (size_t)length) || |
593 | 0 | PACKET_remaining(&tmp) != 0) { |
594 | 0 | return 0; |
595 | 0 | } |
596 | | |
597 | 0 | *pkt = tmp; |
598 | 0 | subpkt->curr = data; |
599 | 0 | subpkt->remaining = length; |
600 | |
|
601 | 0 | return 1; |
602 | 0 | } Unexecuted instantiation: ssl_asn1.c:PACKET_as_length_prefixed_2 Unexecuted instantiation: ssl_init.c:PACKET_as_length_prefixed_2 Unexecuted instantiation: ssl_sess.c:PACKET_as_length_prefixed_2 Unexecuted instantiation: ssl_txt.c:PACKET_as_length_prefixed_2 Unexecuted instantiation: extensions.c:PACKET_as_length_prefixed_2 Unexecuted instantiation: extensions_clnt.c:PACKET_as_length_prefixed_2 Unexecuted instantiation: extensions_cust.c:PACKET_as_length_prefixed_2 Unexecuted instantiation: extensions_srvr.c:PACKET_as_length_prefixed_2 Unexecuted instantiation: statem.c:PACKET_as_length_prefixed_2 Unexecuted instantiation: statem_clnt.c:PACKET_as_length_prefixed_2 Unexecuted instantiation: statem_dtls.c:PACKET_as_length_prefixed_2 Unexecuted instantiation: statem_lib.c:PACKET_as_length_prefixed_2 Unexecuted instantiation: statem_srvr.c:PACKET_as_length_prefixed_2 Unexecuted instantiation: t1_lib.c:PACKET_as_length_prefixed_2 Unexecuted instantiation: tls13_enc.c:PACKET_as_length_prefixed_2 Unexecuted instantiation: tls_srp.c:PACKET_as_length_prefixed_2 Unexecuted instantiation: d1_lib.c:PACKET_as_length_prefixed_2 Unexecuted instantiation: d1_srtp.c:PACKET_as_length_prefixed_2 Unexecuted instantiation: methods.c:PACKET_as_length_prefixed_2 Unexecuted instantiation: packet.c:PACKET_as_length_prefixed_2 Unexecuted instantiation: pqueue.c:PACKET_as_length_prefixed_2 Unexecuted instantiation: rec_layer_d1.c:PACKET_as_length_prefixed_2 Unexecuted instantiation: rec_layer_s3.c:PACKET_as_length_prefixed_2 Unexecuted instantiation: ssl3_buffer.c:PACKET_as_length_prefixed_2 Unexecuted instantiation: ssl3_record.c:PACKET_as_length_prefixed_2 Unexecuted instantiation: ssl3_record_tls13.c:PACKET_as_length_prefixed_2 Unexecuted instantiation: s3_cbc.c:PACKET_as_length_prefixed_2 Unexecuted instantiation: s3_enc.c:PACKET_as_length_prefixed_2 Unexecuted instantiation: s3_lib.c:PACKET_as_length_prefixed_2 Unexecuted instantiation: s3_msg.c:PACKET_as_length_prefixed_2 Unexecuted instantiation: ssl_cert.c:PACKET_as_length_prefixed_2 Unexecuted instantiation: ssl_ciph.c:PACKET_as_length_prefixed_2 Unexecuted instantiation: ssl_lib.c:PACKET_as_length_prefixed_2 Unexecuted instantiation: ssl_mcnf.c:PACKET_as_length_prefixed_2 Unexecuted instantiation: ssl_rsa.c:PACKET_as_length_prefixed_2 Unexecuted instantiation: t1_enc.c:PACKET_as_length_prefixed_2 Unexecuted instantiation: d1_msg.c:PACKET_as_length_prefixed_2 Unexecuted instantiation: dtls1_bitmap.c:PACKET_as_length_prefixed_2 Unexecuted instantiation: ssl_conf.c:PACKET_as_length_prefixed_2 |
603 | | |
604 | | /* |
605 | | * Reads a variable-length vector prefixed with a three-byte length, and stores |
606 | | * the contents in |subpkt|. |pkt| can equal |subpkt|. |
607 | | * Data is not copied: the |subpkt| packet will share its underlying buffer with |
608 | | * the original |pkt|, so data wrapped by |pkt| must outlive the |subpkt|. |
609 | | * Upon failure, the original |pkt| and |subpkt| are not modified. |
610 | | */ |
611 | | __owur static ossl_inline int PACKET_get_length_prefixed_3(PACKET *pkt, |
612 | | PACKET *subpkt) |
613 | 0 | { |
614 | 0 | unsigned long length; |
615 | 0 | const unsigned char *data; |
616 | 0 | PACKET tmp = *pkt; |
617 | 0 | if (!PACKET_get_net_3(&tmp, &length) || |
618 | 0 | !PACKET_get_bytes(&tmp, &data, (size_t)length)) { |
619 | 0 | return 0; |
620 | 0 | } |
621 | | |
622 | 0 | *pkt = tmp; |
623 | 0 | subpkt->curr = data; |
624 | 0 | subpkt->remaining = length; |
625 | |
|
626 | 0 | return 1; |
627 | 0 | } Unexecuted instantiation: ssl_asn1.c:PACKET_get_length_prefixed_3 Unexecuted instantiation: ssl_init.c:PACKET_get_length_prefixed_3 Unexecuted instantiation: ssl_sess.c:PACKET_get_length_prefixed_3 Unexecuted instantiation: ssl_txt.c:PACKET_get_length_prefixed_3 Unexecuted instantiation: extensions.c:PACKET_get_length_prefixed_3 Unexecuted instantiation: extensions_clnt.c:PACKET_get_length_prefixed_3 Unexecuted instantiation: extensions_cust.c:PACKET_get_length_prefixed_3 Unexecuted instantiation: extensions_srvr.c:PACKET_get_length_prefixed_3 Unexecuted instantiation: statem.c:PACKET_get_length_prefixed_3 Unexecuted instantiation: statem_clnt.c:PACKET_get_length_prefixed_3 Unexecuted instantiation: statem_dtls.c:PACKET_get_length_prefixed_3 Unexecuted instantiation: statem_lib.c:PACKET_get_length_prefixed_3 Unexecuted instantiation: statem_srvr.c:PACKET_get_length_prefixed_3 Unexecuted instantiation: t1_lib.c:PACKET_get_length_prefixed_3 Unexecuted instantiation: tls13_enc.c:PACKET_get_length_prefixed_3 Unexecuted instantiation: tls_srp.c:PACKET_get_length_prefixed_3 Unexecuted instantiation: d1_lib.c:PACKET_get_length_prefixed_3 Unexecuted instantiation: d1_srtp.c:PACKET_get_length_prefixed_3 Unexecuted instantiation: methods.c:PACKET_get_length_prefixed_3 Unexecuted instantiation: packet.c:PACKET_get_length_prefixed_3 Unexecuted instantiation: pqueue.c:PACKET_get_length_prefixed_3 Unexecuted instantiation: rec_layer_d1.c:PACKET_get_length_prefixed_3 Unexecuted instantiation: rec_layer_s3.c:PACKET_get_length_prefixed_3 Unexecuted instantiation: ssl3_buffer.c:PACKET_get_length_prefixed_3 Unexecuted instantiation: ssl3_record.c:PACKET_get_length_prefixed_3 Unexecuted instantiation: ssl3_record_tls13.c:PACKET_get_length_prefixed_3 Unexecuted instantiation: s3_cbc.c:PACKET_get_length_prefixed_3 Unexecuted instantiation: s3_enc.c:PACKET_get_length_prefixed_3 Unexecuted instantiation: s3_lib.c:PACKET_get_length_prefixed_3 Unexecuted instantiation: s3_msg.c:PACKET_get_length_prefixed_3 Unexecuted instantiation: ssl_cert.c:PACKET_get_length_prefixed_3 Unexecuted instantiation: ssl_ciph.c:PACKET_get_length_prefixed_3 Unexecuted instantiation: ssl_lib.c:PACKET_get_length_prefixed_3 Unexecuted instantiation: ssl_mcnf.c:PACKET_get_length_prefixed_3 Unexecuted instantiation: ssl_rsa.c:PACKET_get_length_prefixed_3 Unexecuted instantiation: t1_enc.c:PACKET_get_length_prefixed_3 Unexecuted instantiation: d1_msg.c:PACKET_get_length_prefixed_3 Unexecuted instantiation: dtls1_bitmap.c:PACKET_get_length_prefixed_3 Unexecuted instantiation: ssl_conf.c:PACKET_get_length_prefixed_3 |
628 | | |
629 | | /* Writeable packets */ |
630 | | |
631 | | typedef struct wpacket_sub WPACKET_SUB; |
632 | | struct wpacket_sub { |
633 | | /* The parent WPACKET_SUB if we have one or NULL otherwise */ |
634 | | WPACKET_SUB *parent; |
635 | | |
636 | | /* |
637 | | * Offset into the buffer where the length of this WPACKET goes. We use an |
638 | | * offset in case the buffer grows and gets reallocated. |
639 | | */ |
640 | | size_t packet_len; |
641 | | |
642 | | /* Number of bytes in the packet_len or 0 if we don't write the length */ |
643 | | size_t lenbytes; |
644 | | |
645 | | /* Number of bytes written to the buf prior to this packet starting */ |
646 | | size_t pwritten; |
647 | | |
648 | | /* Flags for this sub-packet */ |
649 | | unsigned int flags; |
650 | | }; |
651 | | |
652 | | typedef struct wpacket_st WPACKET; |
653 | | struct wpacket_st { |
654 | | /* The buffer where we store the output data */ |
655 | | BUF_MEM *buf; |
656 | | |
657 | | /* Fixed sized buffer which can be used as an alternative to buf */ |
658 | | unsigned char *staticbuf; |
659 | | |
660 | | /* |
661 | | * Offset into the buffer where we are currently writing. We use an offset |
662 | | * in case the buffer grows and gets reallocated. |
663 | | */ |
664 | | size_t curr; |
665 | | |
666 | | /* Number of bytes written so far */ |
667 | | size_t written; |
668 | | |
669 | | /* Maximum number of bytes we will allow to be written to this WPACKET */ |
670 | | size_t maxsize; |
671 | | |
672 | | /* Our sub-packets (always at least one if not finished) */ |
673 | | WPACKET_SUB *subs; |
674 | | }; |
675 | | |
676 | | /* Flags */ |
677 | | |
678 | | /* Default */ |
679 | | #define WPACKET_FLAGS_NONE 0 |
680 | | |
681 | | /* Error on WPACKET_close() if no data written to the WPACKET */ |
682 | 0 | #define WPACKET_FLAGS_NON_ZERO_LENGTH 1 |
683 | | |
684 | | /* |
685 | | * Abandon all changes on WPACKET_close() if no data written to the WPACKET, |
686 | | * i.e. this does not write out a zero packet length |
687 | | */ |
688 | 0 | #define WPACKET_FLAGS_ABANDON_ON_ZERO_LENGTH 2 |
689 | | |
690 | | |
691 | | /* |
692 | | * Initialise a WPACKET with the buffer in |buf|. The buffer must exist |
693 | | * for the whole time that the WPACKET is being used. Additionally |lenbytes| of |
694 | | * data is preallocated at the start of the buffer to store the length of the |
695 | | * WPACKET once we know it. |
696 | | */ |
697 | | int WPACKET_init_len(WPACKET *pkt, BUF_MEM *buf, size_t lenbytes); |
698 | | |
699 | | /* |
700 | | * Same as WPACKET_init_len except there is no preallocation of the WPACKET |
701 | | * length. |
702 | | */ |
703 | | int WPACKET_init(WPACKET *pkt, BUF_MEM *buf); |
704 | | |
705 | | /* |
706 | | * Same as WPACKET_init_len except we do not use a growable BUF_MEM structure. |
707 | | * A fixed buffer of memory |buf| of size |len| is used instead. A failure will |
708 | | * occur if you attempt to write beyond the end of the buffer |
709 | | */ |
710 | | int WPACKET_init_static_len(WPACKET *pkt, unsigned char *buf, size_t len, |
711 | | size_t lenbytes); |
712 | | /* |
713 | | * Set the flags to be applied to the current sub-packet |
714 | | */ |
715 | | int WPACKET_set_flags(WPACKET *pkt, unsigned int flags); |
716 | | |
717 | | /* |
718 | | * Closes the most recent sub-packet. It also writes out the length of the |
719 | | * packet to the required location (normally the start of the WPACKET) if |
720 | | * appropriate. The top level WPACKET should be closed using WPACKET_finish() |
721 | | * instead of this function. |
722 | | */ |
723 | | int WPACKET_close(WPACKET *pkt); |
724 | | |
725 | | /* |
726 | | * The same as WPACKET_close() but only for the top most WPACKET. Additionally |
727 | | * frees memory resources for this WPACKET. |
728 | | */ |
729 | | int WPACKET_finish(WPACKET *pkt); |
730 | | |
731 | | /* |
732 | | * Iterate through all the sub-packets and write out their lengths as if they |
733 | | * were being closed. The lengths will be overwritten with the final lengths |
734 | | * when the sub-packets are eventually closed (which may be different if more |
735 | | * data is added to the WPACKET). This function fails if a sub-packet is of 0 |
736 | | * length and WPACKET_FLAGS_ABANDON_ON_ZERO_LENGTH is set. |
737 | | */ |
738 | | int WPACKET_fill_lengths(WPACKET *pkt); |
739 | | |
740 | | /* |
741 | | * Initialise a new sub-packet. Additionally |lenbytes| of data is preallocated |
742 | | * at the start of the sub-packet to store its length once we know it. Don't |
743 | | * call this directly. Use the convenience macros below instead. |
744 | | */ |
745 | | int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes); |
746 | | |
747 | | /* |
748 | | * Convenience macros for calling WPACKET_start_sub_packet_len with different |
749 | | * lengths |
750 | | */ |
751 | | #define WPACKET_start_sub_packet_u8(pkt) \ |
752 | 0 | WPACKET_start_sub_packet_len__((pkt), 1) |
753 | | #define WPACKET_start_sub_packet_u16(pkt) \ |
754 | 0 | WPACKET_start_sub_packet_len__((pkt), 2) |
755 | | #define WPACKET_start_sub_packet_u24(pkt) \ |
756 | 0 | WPACKET_start_sub_packet_len__((pkt), 3) |
757 | | #define WPACKET_start_sub_packet_u32(pkt) \ |
758 | | WPACKET_start_sub_packet_len__((pkt), 4) |
759 | | |
760 | | /* |
761 | | * Same as WPACKET_start_sub_packet_len__() except no bytes are pre-allocated |
762 | | * for the sub-packet length. |
763 | | */ |
764 | | int WPACKET_start_sub_packet(WPACKET *pkt); |
765 | | |
766 | | /* |
767 | | * Allocate bytes in the WPACKET for the output. This reserves the bytes |
768 | | * and counts them as "written", but doesn't actually do the writing. A pointer |
769 | | * to the allocated bytes is stored in |*allocbytes|. |allocbytes| may be NULL. |
770 | | * WARNING: the allocated bytes must be filled in immediately, without further |
771 | | * WPACKET_* calls. If not then the underlying buffer may be realloc'd and |
772 | | * change its location. |
773 | | */ |
774 | | int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, |
775 | | unsigned char **allocbytes); |
776 | | |
777 | | /* |
778 | | * The same as WPACKET_allocate_bytes() except additionally a new sub-packet is |
779 | | * started for the allocated bytes, and then closed immediately afterwards. The |
780 | | * number of length bytes for the sub-packet is in |lenbytes|. Don't call this |
781 | | * directly. Use the convenience macros below instead. |
782 | | */ |
783 | | int WPACKET_sub_allocate_bytes__(WPACKET *pkt, size_t len, |
784 | | unsigned char **allocbytes, size_t lenbytes); |
785 | | |
786 | | /* |
787 | | * Convenience macros for calling WPACKET_sub_allocate_bytes with different |
788 | | * lengths |
789 | | */ |
790 | | #define WPACKET_sub_allocate_bytes_u8(pkt, len, bytes) \ |
791 | 0 | WPACKET_sub_allocate_bytes__((pkt), (len), (bytes), 1) |
792 | | #define WPACKET_sub_allocate_bytes_u16(pkt, len, bytes) \ |
793 | 0 | WPACKET_sub_allocate_bytes__((pkt), (len), (bytes), 2) |
794 | | #define WPACKET_sub_allocate_bytes_u24(pkt, len, bytes) \ |
795 | 0 | WPACKET_sub_allocate_bytes__((pkt), (len), (bytes), 3) |
796 | | #define WPACKET_sub_allocate_bytes_u32(pkt, len, bytes) \ |
797 | | WPACKET_sub_allocate_bytes__((pkt), (len), (bytes), 4) |
798 | | |
799 | | /* |
800 | | * The same as WPACKET_allocate_bytes() except the reserved bytes are not |
801 | | * actually counted as written. Typically this will be for when we don't know |
802 | | * how big arbitrary data is going to be up front, but we do know what the |
803 | | * maximum size will be. If this function is used, then it should be immediately |
804 | | * followed by a WPACKET_allocate_bytes() call before any other WPACKET |
805 | | * functions are called (unless the write to the allocated bytes is abandoned). |
806 | | * |
807 | | * For example: If we are generating a signature, then the size of that |
808 | | * signature may not be known in advance. We can use WPACKET_reserve_bytes() to |
809 | | * handle this: |
810 | | * |
811 | | * if (!WPACKET_sub_reserve_bytes_u16(&pkt, EVP_PKEY_size(pkey), &sigbytes1) |
812 | | * || EVP_SignFinal(md_ctx, sigbytes1, &siglen, pkey) <= 0 |
813 | | * || !WPACKET_sub_allocate_bytes_u16(&pkt, siglen, &sigbytes2) |
814 | | * || sigbytes1 != sigbytes2) |
815 | | * goto err; |
816 | | */ |
817 | | int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes); |
818 | | |
819 | | /* |
820 | | * The "reserve_bytes" equivalent of WPACKET_sub_allocate_bytes__() |
821 | | */ |
822 | | int WPACKET_sub_reserve_bytes__(WPACKET *pkt, size_t len, |
823 | | unsigned char **allocbytes, size_t lenbytes); |
824 | | |
825 | | /* |
826 | | * Convenience macros for WPACKET_sub_reserve_bytes with different lengths |
827 | | */ |
828 | | #define WPACKET_sub_reserve_bytes_u8(pkt, len, bytes) \ |
829 | | WPACKET_reserve_bytes__((pkt), (len), (bytes), 1) |
830 | | #define WPACKET_sub_reserve_bytes_u16(pkt, len, bytes) \ |
831 | 0 | WPACKET_sub_reserve_bytes__((pkt), (len), (bytes), 2) |
832 | | #define WPACKET_sub_reserve_bytes_u24(pkt, len, bytes) \ |
833 | | WPACKET_sub_reserve_bytes__((pkt), (len), (bytes), 3) |
834 | | #define WPACKET_sub_reserve_bytes_u32(pkt, len, bytes) \ |
835 | | WPACKET_sub_reserve_bytes__((pkt), (len), (bytes), 4) |
836 | | |
837 | | /* |
838 | | * Write the value stored in |val| into the WPACKET. The value will consume |
839 | | * |bytes| amount of storage. An error will occur if |val| cannot be |
840 | | * accommodated in |bytes| storage, e.g. attempting to write the value 256 into |
841 | | * 1 byte will fail. Don't call this directly. Use the convenience macros below |
842 | | * instead. |
843 | | */ |
844 | | int WPACKET_put_bytes__(WPACKET *pkt, uint64_t val, size_t bytes); |
845 | | |
846 | | /* |
847 | | * Convenience macros for calling WPACKET_put_bytes with different |
848 | | * lengths |
849 | | */ |
850 | | #define WPACKET_put_bytes_u8(pkt, val) \ |
851 | 0 | WPACKET_put_bytes__((pkt), (val), 1) |
852 | | #define WPACKET_put_bytes_u16(pkt, val) \ |
853 | 0 | WPACKET_put_bytes__((pkt), (val), 2) |
854 | | #define WPACKET_put_bytes_u24(pkt, val) \ |
855 | 0 | WPACKET_put_bytes__((pkt), (val), 3) |
856 | | #define WPACKET_put_bytes_u32(pkt, val) \ |
857 | 0 | WPACKET_put_bytes__((pkt), (val), 4) |
858 | | #define WPACKET_put_bytes_u64(pkt, val) \ |
859 | 0 | WPACKET_put_bytes__((pkt), (val), 8) |
860 | | |
861 | | /* Set a maximum size that we will not allow the WPACKET to grow beyond */ |
862 | | int WPACKET_set_max_size(WPACKET *pkt, size_t maxsize); |
863 | | |
864 | | /* Copy |len| bytes of data from |*src| into the WPACKET. */ |
865 | | int WPACKET_memcpy(WPACKET *pkt, const void *src, size_t len); |
866 | | |
867 | | /* Set |len| bytes of data to |ch| into the WPACKET. */ |
868 | | int WPACKET_memset(WPACKET *pkt, int ch, size_t len); |
869 | | |
870 | | /* |
871 | | * Copy |len| bytes of data from |*src| into the WPACKET and prefix with its |
872 | | * length (consuming |lenbytes| of data for the length). Don't call this |
873 | | * directly. Use the convenience macros below instead. |
874 | | */ |
875 | | int WPACKET_sub_memcpy__(WPACKET *pkt, const void *src, size_t len, |
876 | | size_t lenbytes); |
877 | | |
878 | | /* Convenience macros for calling WPACKET_sub_memcpy with different lengths */ |
879 | | #define WPACKET_sub_memcpy_u8(pkt, src, len) \ |
880 | 0 | WPACKET_sub_memcpy__((pkt), (src), (len), 1) |
881 | | #define WPACKET_sub_memcpy_u16(pkt, src, len) \ |
882 | 0 | WPACKET_sub_memcpy__((pkt), (src), (len), 2) |
883 | | #define WPACKET_sub_memcpy_u24(pkt, src, len) \ |
884 | 0 | WPACKET_sub_memcpy__((pkt), (src), (len), 3) |
885 | | #define WPACKET_sub_memcpy_u32(pkt, src, len) \ |
886 | | WPACKET_sub_memcpy__((pkt), (src), (len), 4) |
887 | | |
888 | | /* |
889 | | * Return the total number of bytes written so far to the underlying buffer |
890 | | * including any storage allocated for length bytes |
891 | | */ |
892 | | int WPACKET_get_total_written(WPACKET *pkt, size_t *written); |
893 | | |
894 | | /* |
895 | | * Returns the length of the current sub-packet. This excludes any bytes |
896 | | * allocated for the length itself. |
897 | | */ |
898 | | int WPACKET_get_length(WPACKET *pkt, size_t *len); |
899 | | |
900 | | /* |
901 | | * Returns a pointer to the current write location, but does not allocate any |
902 | | * bytes. |
903 | | */ |
904 | | unsigned char *WPACKET_get_curr(WPACKET *pkt); |
905 | | |
906 | | /* Release resources in a WPACKET if a failure has occurred. */ |
907 | | void WPACKET_cleanup(WPACKET *pkt); |
908 | | |
909 | | #endif /* OSSL_SSL_PACKET_LOCAL_H */ |