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