Coverage Report

Created: 2026-09-12 06:55

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/openssl41/include/openssl/byteorder.h
Line
Count
Source
1
/*
2
 * Copyright 2025 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 OPENSSL_BYTEORDER_H
11
#define OPENSSL_BYTEORDER_H
12
#pragma once
13
14
#include <openssl/e_os2.h>
15
#include <string.h>
16
17
/*
18
 * "Modern" compilers do a decent job of optimising these functions to just a
19
 * couple of instruction ([swap +] store, or load [+ swap]) when either no
20
 * swapping is required, or a suitable swap instruction is available.
21
 */
22
23
#if defined(_MSC_VER) && _MSC_VER >= 1300
24
#include <stdlib.h>
25
#pragma intrinsic(_byteswap_ushort)
26
#pragma intrinsic(_byteswap_ulong)
27
#pragma intrinsic(_byteswap_uint64)
28
#define OSSL_HTOBE16(x) _byteswap_ushort(x)
29
#define OSSL_HTOBE32(x) _byteswap_ulong(x)
30
#define OSSL_HTOBE64(x) _byteswap_uint64(x)
31
#define OSSL_BE16TOH(x) _byteswap_ushort(x)
32
#define OSSL_BE32TOH(x) _byteswap_ulong(x)
33
#define OSSL_BE64TOH(x) _byteswap_uint64(x)
34
#define OSSL_HTOLE16(x) (x)
35
#define OSSL_HTOLE32(x) (x)
36
#define OSSL_HTOLE64(x) (x)
37
#define OSSL_LE16TOH(x) (x)
38
#define OSSL_LE32TOH(x) (x)
39
#define OSSL_LE64TOH(x) (x)
40
41
#elif defined(__GLIBC__) && defined(__GLIBC_PREREQ)
42
#if (__GLIBC_PREREQ(2, 19)) && defined(_DEFAULT_SOURCE)
43
#include <endian.h>
44
2.32k
#define OSSL_HTOBE16(x) htobe16(x)
45
1.46G
#define OSSL_HTOBE32(x) htobe32(x)
46
112M
#define OSSL_HTOBE64(x) htobe64(x)
47
12.1M
#define OSSL_BE16TOH(x) be16toh(x)
48
19.6k
#define OSSL_BE32TOH(x) be32toh(x)
49
#define OSSL_BE64TOH(x) be64toh(x)
50
739k
#define OSSL_HTOLE16(x) htole16(x)
51
1.00M
#define OSSL_HTOLE32(x) htole32(x)
52
18.8M
#define OSSL_HTOLE64(x) htole64(x)
53
1.12M
#define OSSL_LE16TOH(x) le16toh(x)
54
3.24M
#define OSSL_LE32TOH(x) le32toh(x)
55
32.0k
#define OSSL_LE64TOH(x) le64toh(x)
56
#endif
57
58
#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
59
#if defined(__OpenBSD__)
60
#include <sys/types.h>
61
#else
62
#include <sys/endian.h>
63
#endif
64
#define OSSL_HTOBE16(x) htobe16(x)
65
#define OSSL_HTOBE32(x) htobe32(x)
66
#define OSSL_HTOBE64(x) htobe64(x)
67
#define OSSL_BE16TOH(x) be16toh(x)
68
#define OSSL_BE32TOH(x) be32toh(x)
69
#define OSSL_BE64TOH(x) be64toh(x)
70
#define OSSL_HTOLE16(x) htole16(x)
71
#define OSSL_HTOLE32(x) htole32(x)
72
#define OSSL_HTOLE64(x) htole64(x)
73
#define OSSL_LE16TOH(x) le16toh(x)
74
#define OSSL_LE32TOH(x) le32toh(x)
75
#define OSSL_LE64TOH(x) le64toh(x)
76
77
#elif defined(__APPLE__)
78
#include <libkern/OSByteOrder.h>
79
#define OSSL_HTOBE16(x) OSSwapHostToBigInt16(x)
80
#define OSSL_HTOBE32(x) OSSwapHostToBigInt32(x)
81
#define OSSL_HTOBE64(x) OSSwapHostToBigInt64(x)
82
#define OSSL_BE16TOH(x) OSSwapBigToHostInt16(x)
83
#define OSSL_BE32TOH(x) OSSwapBigToHostInt32(x)
84
#define OSSL_BE64TOH(x) OSSwapBigToHostInt64(x)
85
#define OSSL_HTOLE16(x) OSSwapHostToLittleInt16(x)
86
#define OSSL_HTOLE32(x) OSSwapHostToLittleInt32(x)
87
#define OSSL_HTOLE64(x) OSSwapHostToLittleInt64(x)
88
#define OSSL_LE16TOH(x) OSSwapLittleToHostInt16(x)
89
#define OSSL_LE32TOH(x) OSSwapLittleToHostInt32(x)
90
#define OSSL_LE64TOH(x) OSSwapLittleToHostInt64(x)
91
92
#endif
93
94
static ossl_inline ossl_unused unsigned char *
95
OPENSSL_store_u16_le(unsigned char *out, uint16_t val)
96
739k
{
97
739k
#ifdef OSSL_HTOLE16
98
739k
    uint16_t t = OSSL_HTOLE16(val);
99
100
739k
    memcpy(out, (unsigned char *)&t, 2);
101
739k
    return out + 2;
102
#else
103
    *out++ = (val & 0xff);
104
    *out++ = (val >> 8) & 0xff;
105
    return out;
106
#endif
107
739k
}
Unexecuted instantiation: sha2_prov.c:OPENSSL_store_u16_le
Unexecuted instantiation: sha3_prov.c:OPENSSL_store_u16_le
Unexecuted instantiation: decode_der2key.c:OPENSSL_store_u16_le
Unexecuted instantiation: encode_key2any.c:OPENSSL_store_u16_le
Unexecuted instantiation: ml_dsa_codecs.c:OPENSSL_store_u16_le
Unexecuted instantiation: ml_kem_codecs.c:OPENSSL_store_u16_le
Unexecuted instantiation: a_strex.c:OPENSSL_store_u16_le
ml_dsa_encoders.c:OPENSSL_store_u16_le
Line
Count
Source
96
739k
{
97
739k
#ifdef OSSL_HTOLE16
98
739k
    uint16_t t = OSSL_HTOLE16(val);
99
100
739k
    memcpy(out, (unsigned char *)&t, 2);
101
739k
    return out + 2;
102
#else
103
    *out++ = (val & 0xff);
104
    *out++ = (val >> 8) & 0xff;
105
    return out;
106
#endif
107
739k
}
Unexecuted instantiation: ml_dsa_sample.c:OPENSSL_store_u16_le
Unexecuted instantiation: ml_kem.c:OPENSSL_store_u16_le
Unexecuted instantiation: sha512.c:OPENSSL_store_u16_le
Unexecuted instantiation: a_mbstr.c:OPENSSL_store_u16_le
Unexecuted instantiation: slh_adrs.c:OPENSSL_store_u16_le
Unexecuted instantiation: echconfiglist_parser.c:OPENSSL_store_u16_le
Unexecuted instantiation: ml-dsa.c:OPENSSL_store_u16_le
Unexecuted instantiation: ml-kem.c:OPENSSL_store_u16_le
Unexecuted instantiation: slh-dsa.c:OPENSSL_store_u16_le
108
109
static ossl_inline ossl_unused unsigned char *
110
OPENSSL_store_u16_be(unsigned char *out, uint16_t val)
111
2.32k
{
112
2.32k
#ifdef OSSL_HTOBE16
113
2.32k
    uint16_t t = OSSL_HTOBE16(val);
114
115
2.32k
    memcpy(out, (unsigned char *)&t, 2);
116
2.32k
    return out + 2;
117
#else
118
    *out++ = (val >> 8) & 0xff;
119
    *out++ = (val & 0xff);
120
    return out;
121
#endif
122
2.32k
}
Unexecuted instantiation: sha2_prov.c:OPENSSL_store_u16_be
Unexecuted instantiation: sha3_prov.c:OPENSSL_store_u16_be
Unexecuted instantiation: decode_der2key.c:OPENSSL_store_u16_be
Unexecuted instantiation: encode_key2any.c:OPENSSL_store_u16_be
ml_dsa_codecs.c:OPENSSL_store_u16_be
Line
Count
Source
111
94
{
112
94
#ifdef OSSL_HTOBE16
113
94
    uint16_t t = OSSL_HTOBE16(val);
114
115
94
    memcpy(out, (unsigned char *)&t, 2);
116
94
    return out + 2;
117
#else
118
    *out++ = (val >> 8) & 0xff;
119
    *out++ = (val & 0xff);
120
    return out;
121
#endif
122
94
}
ml_kem_codecs.c:OPENSSL_store_u16_be
Line
Count
Source
111
46
{
112
46
#ifdef OSSL_HTOBE16
113
46
    uint16_t t = OSSL_HTOBE16(val);
114
115
46
    memcpy(out, (unsigned char *)&t, 2);
116
46
    return out + 2;
117
#else
118
    *out++ = (val >> 8) & 0xff;
119
    *out++ = (val & 0xff);
120
    return out;
121
#endif
122
46
}
Unexecuted instantiation: a_strex.c:OPENSSL_store_u16_be
Unexecuted instantiation: ml_dsa_encoders.c:OPENSSL_store_u16_be
Unexecuted instantiation: ml_dsa_sample.c:OPENSSL_store_u16_be
Unexecuted instantiation: ml_kem.c:OPENSSL_store_u16_be
Unexecuted instantiation: sha512.c:OPENSSL_store_u16_be
Unexecuted instantiation: a_mbstr.c:OPENSSL_store_u16_be
Unexecuted instantiation: slh_adrs.c:OPENSSL_store_u16_be
echconfiglist_parser.c:OPENSSL_store_u16_be
Line
Count
Source
111
2.18k
{
112
2.18k
#ifdef OSSL_HTOBE16
113
2.18k
    uint16_t t = OSSL_HTOBE16(val);
114
115
2.18k
    memcpy(out, (unsigned char *)&t, 2);
116
2.18k
    return out + 2;
117
#else
118
    *out++ = (val >> 8) & 0xff;
119
    *out++ = (val & 0xff);
120
    return out;
121
#endif
122
2.18k
}
Unexecuted instantiation: ml-dsa.c:OPENSSL_store_u16_be
Unexecuted instantiation: ml-kem.c:OPENSSL_store_u16_be
Unexecuted instantiation: slh-dsa.c:OPENSSL_store_u16_be
123
124
static ossl_inline ossl_unused unsigned char *
125
OPENSSL_store_u32_le(unsigned char *out, uint32_t val)
126
1.00M
{
127
1.00M
#ifdef OSSL_HTOLE32
128
1.00M
    uint32_t t = OSSL_HTOLE32(val);
129
130
1.00M
    memcpy(out, (unsigned char *)&t, 4);
131
1.00M
    return out + 4;
132
#else
133
    *out++ = (val & 0xff);
134
    *out++ = (val >> 8) & 0xff;
135
    *out++ = (val >> 16) & 0xff;
136
    *out++ = (val >> 24) & 0xff;
137
    return out;
138
#endif
139
1.00M
}
Unexecuted instantiation: sha2_prov.c:OPENSSL_store_u32_le
Unexecuted instantiation: sha3_prov.c:OPENSSL_store_u32_le
Unexecuted instantiation: decode_der2key.c:OPENSSL_store_u32_le
Unexecuted instantiation: encode_key2any.c:OPENSSL_store_u32_le
Unexecuted instantiation: ml_dsa_codecs.c:OPENSSL_store_u32_le
Unexecuted instantiation: ml_kem_codecs.c:OPENSSL_store_u32_le
Unexecuted instantiation: a_strex.c:OPENSSL_store_u32_le
ml_dsa_encoders.c:OPENSSL_store_u32_le
Line
Count
Source
126
1.00M
{
127
1.00M
#ifdef OSSL_HTOLE32
128
1.00M
    uint32_t t = OSSL_HTOLE32(val);
129
130
1.00M
    memcpy(out, (unsigned char *)&t, 4);
131
1.00M
    return out + 4;
132
#else
133
    *out++ = (val & 0xff);
134
    *out++ = (val >> 8) & 0xff;
135
    *out++ = (val >> 16) & 0xff;
136
    *out++ = (val >> 24) & 0xff;
137
    return out;
138
#endif
139
1.00M
}
Unexecuted instantiation: ml_dsa_sample.c:OPENSSL_store_u32_le
Unexecuted instantiation: ml_kem.c:OPENSSL_store_u32_le
Unexecuted instantiation: sha512.c:OPENSSL_store_u32_le
Unexecuted instantiation: a_mbstr.c:OPENSSL_store_u32_le
Unexecuted instantiation: slh_adrs.c:OPENSSL_store_u32_le
Unexecuted instantiation: echconfiglist_parser.c:OPENSSL_store_u32_le
Unexecuted instantiation: ml-dsa.c:OPENSSL_store_u32_le
Unexecuted instantiation: ml-kem.c:OPENSSL_store_u32_le
Unexecuted instantiation: slh-dsa.c:OPENSSL_store_u32_le
140
141
static ossl_inline ossl_unused unsigned char *
142
OPENSSL_store_u32_be(unsigned char *out, uint32_t val)
143
1.46G
{
144
1.46G
#ifdef OSSL_HTOBE32
145
1.46G
    uint32_t t = OSSL_HTOBE32(val);
146
147
1.46G
    memcpy(out, (unsigned char *)&t, 4);
148
1.46G
    return out + 4;
149
#else
150
    *out++ = (val >> 24) & 0xff;
151
    *out++ = (val >> 16) & 0xff;
152
    *out++ = (val >> 8) & 0xff;
153
    *out++ = (val & 0xff);
154
    return out;
155
#endif
156
1.46G
}
Unexecuted instantiation: sha2_prov.c:OPENSSL_store_u32_be
Unexecuted instantiation: sha3_prov.c:OPENSSL_store_u32_be
Unexecuted instantiation: decode_der2key.c:OPENSSL_store_u32_be
Unexecuted instantiation: encode_key2any.c:OPENSSL_store_u32_be
ml_dsa_codecs.c:OPENSSL_store_u32_be
Line
Count
Source
143
188
{
144
188
#ifdef OSSL_HTOBE32
145
188
    uint32_t t = OSSL_HTOBE32(val);
146
147
188
    memcpy(out, (unsigned char *)&t, 4);
148
188
    return out + 4;
149
#else
150
    *out++ = (val >> 24) & 0xff;
151
    *out++ = (val >> 16) & 0xff;
152
    *out++ = (val >> 8) & 0xff;
153
    *out++ = (val & 0xff);
154
    return out;
155
#endif
156
188
}
ml_kem_codecs.c:OPENSSL_store_u32_be
Line
Count
Source
143
92
{
144
92
#ifdef OSSL_HTOBE32
145
92
    uint32_t t = OSSL_HTOBE32(val);
146
147
92
    memcpy(out, (unsigned char *)&t, 4);
148
92
    return out + 4;
149
#else
150
    *out++ = (val >> 24) & 0xff;
151
    *out++ = (val >> 16) & 0xff;
152
    *out++ = (val >> 8) & 0xff;
153
    *out++ = (val & 0xff);
154
    return out;
155
#endif
156
92
}
Unexecuted instantiation: a_strex.c:OPENSSL_store_u32_be
Unexecuted instantiation: ml_dsa_encoders.c:OPENSSL_store_u32_be
Unexecuted instantiation: ml_dsa_sample.c:OPENSSL_store_u32_be
Unexecuted instantiation: ml_kem.c:OPENSSL_store_u32_be
Unexecuted instantiation: sha512.c:OPENSSL_store_u32_be
Unexecuted instantiation: a_mbstr.c:OPENSSL_store_u32_be
slh_adrs.c:OPENSSL_store_u32_be
Line
Count
Source
143
1.46G
{
144
1.46G
#ifdef OSSL_HTOBE32
145
1.46G
    uint32_t t = OSSL_HTOBE32(val);
146
147
1.46G
    memcpy(out, (unsigned char *)&t, 4);
148
1.46G
    return out + 4;
149
#else
150
    *out++ = (val >> 24) & 0xff;
151
    *out++ = (val >> 16) & 0xff;
152
    *out++ = (val >> 8) & 0xff;
153
    *out++ = (val & 0xff);
154
    return out;
155
#endif
156
1.46G
}
Unexecuted instantiation: echconfiglist_parser.c:OPENSSL_store_u32_be
Unexecuted instantiation: ml-dsa.c:OPENSSL_store_u32_be
Unexecuted instantiation: ml-kem.c:OPENSSL_store_u32_be
Unexecuted instantiation: slh-dsa.c:OPENSSL_store_u32_be
157
158
static ossl_inline ossl_unused unsigned char *
159
OPENSSL_store_u64_le(unsigned char *out, uint64_t val)
160
18.8M
{
161
18.8M
#ifdef OSSL_HTOLE64
162
18.8M
    uint64_t t = OSSL_HTOLE64(val);
163
164
18.8M
    memcpy(out, (unsigned char *)&t, 8);
165
18.8M
    return out + 8;
166
#else
167
    *out++ = (val & 0xff);
168
    *out++ = (val >> 8) & 0xff;
169
    *out++ = (val >> 16) & 0xff;
170
    *out++ = (val >> 24) & 0xff;
171
    *out++ = (val >> 32) & 0xff;
172
    *out++ = (val >> 40) & 0xff;
173
    *out++ = (val >> 48) & 0xff;
174
    *out++ = (val >> 56) & 0xff;
175
    return out;
176
#endif
177
18.8M
}
Unexecuted instantiation: sha2_prov.c:OPENSSL_store_u64_le
Unexecuted instantiation: sha3_prov.c:OPENSSL_store_u64_le
Unexecuted instantiation: decode_der2key.c:OPENSSL_store_u64_le
Unexecuted instantiation: encode_key2any.c:OPENSSL_store_u64_le
Unexecuted instantiation: ml_dsa_codecs.c:OPENSSL_store_u64_le
Unexecuted instantiation: ml_kem_codecs.c:OPENSSL_store_u64_le
Unexecuted instantiation: a_strex.c:OPENSSL_store_u64_le
ml_dsa_encoders.c:OPENSSL_store_u64_le
Line
Count
Source
160
411k
{
161
411k
#ifdef OSSL_HTOLE64
162
411k
    uint64_t t = OSSL_HTOLE64(val);
163
164
411k
    memcpy(out, (unsigned char *)&t, 8);
165
411k
    return out + 8;
166
#else
167
    *out++ = (val & 0xff);
168
    *out++ = (val >> 8) & 0xff;
169
    *out++ = (val >> 16) & 0xff;
170
    *out++ = (val >> 24) & 0xff;
171
    *out++ = (val >> 32) & 0xff;
172
    *out++ = (val >> 40) & 0xff;
173
    *out++ = (val >> 48) & 0xff;
174
    *out++ = (val >> 56) & 0xff;
175
    return out;
176
#endif
177
411k
}
Unexecuted instantiation: ml_dsa_sample.c:OPENSSL_store_u64_le
ml_kem.c:OPENSSL_store_u64_le
Line
Count
Source
160
18.4M
{
161
18.4M
#ifdef OSSL_HTOLE64
162
18.4M
    uint64_t t = OSSL_HTOLE64(val);
163
164
18.4M
    memcpy(out, (unsigned char *)&t, 8);
165
18.4M
    return out + 8;
166
#else
167
    *out++ = (val & 0xff);
168
    *out++ = (val >> 8) & 0xff;
169
    *out++ = (val >> 16) & 0xff;
170
    *out++ = (val >> 24) & 0xff;
171
    *out++ = (val >> 32) & 0xff;
172
    *out++ = (val >> 40) & 0xff;
173
    *out++ = (val >> 48) & 0xff;
174
    *out++ = (val >> 56) & 0xff;
175
    return out;
176
#endif
177
18.4M
}
Unexecuted instantiation: sha512.c:OPENSSL_store_u64_le
Unexecuted instantiation: a_mbstr.c:OPENSSL_store_u64_le
Unexecuted instantiation: slh_adrs.c:OPENSSL_store_u64_le
Unexecuted instantiation: echconfiglist_parser.c:OPENSSL_store_u64_le
Unexecuted instantiation: ml-dsa.c:OPENSSL_store_u64_le
Unexecuted instantiation: ml-kem.c:OPENSSL_store_u64_le
Unexecuted instantiation: slh-dsa.c:OPENSSL_store_u64_le
178
179
static ossl_inline ossl_unused unsigned char *
180
OPENSSL_store_u64_be(unsigned char *out, uint64_t val)
181
112M
{
182
112M
#ifdef OSSL_HTOLE64
183
112M
    uint64_t t = OSSL_HTOBE64(val);
184
185
112M
    memcpy(out, (unsigned char *)&t, 8);
186
112M
    return out + 8;
187
#else
188
    *out++ = (val >> 56) & 0xff;
189
    *out++ = (val >> 48) & 0xff;
190
    *out++ = (val >> 40) & 0xff;
191
    *out++ = (val >> 32) & 0xff;
192
    *out++ = (val >> 24) & 0xff;
193
    *out++ = (val >> 16) & 0xff;
194
    *out++ = (val >> 8) & 0xff;
195
    *out++ = (val & 0xff);
196
    return out;
197
#endif
198
112M
}
Unexecuted instantiation: sha2_prov.c:OPENSSL_store_u64_be
Unexecuted instantiation: sha3_prov.c:OPENSSL_store_u64_be
Unexecuted instantiation: decode_der2key.c:OPENSSL_store_u64_be
Unexecuted instantiation: encode_key2any.c:OPENSSL_store_u64_be
Unexecuted instantiation: ml_dsa_codecs.c:OPENSSL_store_u64_be
Unexecuted instantiation: ml_kem_codecs.c:OPENSSL_store_u64_be
Unexecuted instantiation: a_strex.c:OPENSSL_store_u64_be
Unexecuted instantiation: ml_dsa_encoders.c:OPENSSL_store_u64_be
Unexecuted instantiation: ml_dsa_sample.c:OPENSSL_store_u64_be
Unexecuted instantiation: ml_kem.c:OPENSSL_store_u64_be
sha512.c:OPENSSL_store_u64_be
Line
Count
Source
181
112M
{
182
112M
#ifdef OSSL_HTOLE64
183
112M
    uint64_t t = OSSL_HTOBE64(val);
184
185
112M
    memcpy(out, (unsigned char *)&t, 8);
186
112M
    return out + 8;
187
#else
188
    *out++ = (val >> 56) & 0xff;
189
    *out++ = (val >> 48) & 0xff;
190
    *out++ = (val >> 40) & 0xff;
191
    *out++ = (val >> 32) & 0xff;
192
    *out++ = (val >> 24) & 0xff;
193
    *out++ = (val >> 16) & 0xff;
194
    *out++ = (val >> 8) & 0xff;
195
    *out++ = (val & 0xff);
196
    return out;
197
#endif
198
112M
}
Unexecuted instantiation: a_mbstr.c:OPENSSL_store_u64_be
slh_adrs.c:OPENSSL_store_u64_be
Line
Count
Source
181
34.6k
{
182
34.6k
#ifdef OSSL_HTOLE64
183
34.6k
    uint64_t t = OSSL_HTOBE64(val);
184
185
34.6k
    memcpy(out, (unsigned char *)&t, 8);
186
34.6k
    return out + 8;
187
#else
188
    *out++ = (val >> 56) & 0xff;
189
    *out++ = (val >> 48) & 0xff;
190
    *out++ = (val >> 40) & 0xff;
191
    *out++ = (val >> 32) & 0xff;
192
    *out++ = (val >> 24) & 0xff;
193
    *out++ = (val >> 16) & 0xff;
194
    *out++ = (val >> 8) & 0xff;
195
    *out++ = (val & 0xff);
196
    return out;
197
#endif
198
34.6k
}
Unexecuted instantiation: echconfiglist_parser.c:OPENSSL_store_u64_be
Unexecuted instantiation: ml-dsa.c:OPENSSL_store_u64_be
Unexecuted instantiation: ml-kem.c:OPENSSL_store_u64_be
Unexecuted instantiation: slh-dsa.c:OPENSSL_store_u64_be
199
200
static ossl_inline ossl_unused const unsigned char *
201
OPENSSL_load_u16_le(uint16_t *val, const unsigned char *in)
202
1.12M
{
203
1.12M
#ifdef OSSL_LE16TOH
204
1.12M
    uint16_t t;
205
206
1.12M
    memcpy((unsigned char *)&t, in, 2);
207
1.12M
    *val = OSSL_LE16TOH(t);
208
1.12M
    return in + 2;
209
#else
210
    uint16_t b0 = *in++;
211
    uint16_t b1 = *in++;
212
213
    *val = b0 | (b1 << 8);
214
    return in;
215
#endif
216
1.12M
}
Unexecuted instantiation: sha2_prov.c:OPENSSL_load_u16_le
Unexecuted instantiation: sha3_prov.c:OPENSSL_load_u16_le
Unexecuted instantiation: decode_der2key.c:OPENSSL_load_u16_le
Unexecuted instantiation: encode_key2any.c:OPENSSL_load_u16_le
Unexecuted instantiation: ml_dsa_codecs.c:OPENSSL_load_u16_le
Unexecuted instantiation: ml_kem_codecs.c:OPENSSL_load_u16_le
Unexecuted instantiation: a_strex.c:OPENSSL_load_u16_le
ml_dsa_encoders.c:OPENSSL_load_u16_le
Line
Count
Source
202
1.11M
{
203
1.11M
#ifdef OSSL_LE16TOH
204
1.11M
    uint16_t t;
205
206
1.11M
    memcpy((unsigned char *)&t, in, 2);
207
1.11M
    *val = OSSL_LE16TOH(t);
208
1.11M
    return in + 2;
209
#else
210
    uint16_t b0 = *in++;
211
    uint16_t b1 = *in++;
212
213
    *val = b0 | (b1 << 8);
214
    return in;
215
#endif
216
1.11M
}
Unexecuted instantiation: ml_dsa_sample.c:OPENSSL_load_u16_le
Unexecuted instantiation: ml_kem.c:OPENSSL_load_u16_le
Unexecuted instantiation: sha512.c:OPENSSL_load_u16_le
Unexecuted instantiation: a_mbstr.c:OPENSSL_load_u16_le
Unexecuted instantiation: slh_adrs.c:OPENSSL_load_u16_le
Unexecuted instantiation: echconfiglist_parser.c:OPENSSL_load_u16_le
ml-dsa.c:OPENSSL_load_u16_le
Line
Count
Source
202
2.47k
{
203
2.47k
#ifdef OSSL_LE16TOH
204
2.47k
    uint16_t t;
205
206
2.47k
    memcpy((unsigned char *)&t, in, 2);
207
2.47k
    *val = OSSL_LE16TOH(t);
208
2.47k
    return in + 2;
209
#else
210
    uint16_t b0 = *in++;
211
    uint16_t b1 = *in++;
212
213
    *val = b0 | (b1 << 8);
214
    return in;
215
#endif
216
2.47k
}
ml-kem.c:OPENSSL_load_u16_le
Line
Count
Source
202
1.04k
{
203
1.04k
#ifdef OSSL_LE16TOH
204
1.04k
    uint16_t t;
205
206
1.04k
    memcpy((unsigned char *)&t, in, 2);
207
1.04k
    *val = OSSL_LE16TOH(t);
208
1.04k
    return in + 2;
209
#else
210
    uint16_t b0 = *in++;
211
    uint16_t b1 = *in++;
212
213
    *val = b0 | (b1 << 8);
214
    return in;
215
#endif
216
1.04k
}
Unexecuted instantiation: slh-dsa.c:OPENSSL_load_u16_le
217
218
static ossl_inline ossl_unused const unsigned char *
219
OPENSSL_load_u16_be(uint16_t *val, const unsigned char *in)
220
12.1M
{
221
12.1M
#ifdef OSSL_LE16TOH
222
12.1M
    uint16_t t;
223
224
12.1M
    memcpy((unsigned char *)&t, in, 2);
225
12.1M
    *val = OSSL_BE16TOH(t);
226
12.1M
    return in + 2;
227
#else
228
    uint16_t b1 = *in++;
229
    uint16_t b0 = *in++;
230
231
    *val = b0 | (b1 << 8);
232
    return in;
233
#endif
234
12.1M
}
Unexecuted instantiation: sha2_prov.c:OPENSSL_load_u16_be
Unexecuted instantiation: sha3_prov.c:OPENSSL_load_u16_be
Unexecuted instantiation: decode_der2key.c:OPENSSL_load_u16_be
Unexecuted instantiation: encode_key2any.c:OPENSSL_load_u16_be
Unexecuted instantiation: ml_dsa_codecs.c:OPENSSL_load_u16_be
Unexecuted instantiation: ml_kem_codecs.c:OPENSSL_load_u16_be
a_strex.c:OPENSSL_load_u16_be
Line
Count
Source
220
46.5k
{
221
46.5k
#ifdef OSSL_LE16TOH
222
46.5k
    uint16_t t;
223
224
46.5k
    memcpy((unsigned char *)&t, in, 2);
225
46.5k
    *val = OSSL_BE16TOH(t);
226
46.5k
    return in + 2;
227
#else
228
    uint16_t b1 = *in++;
229
    uint16_t b0 = *in++;
230
231
    *val = b0 | (b1 << 8);
232
    return in;
233
#endif
234
46.5k
}
Unexecuted instantiation: ml_dsa_encoders.c:OPENSSL_load_u16_be
Unexecuted instantiation: ml_dsa_sample.c:OPENSSL_load_u16_be
Unexecuted instantiation: ml_kem.c:OPENSSL_load_u16_be
Unexecuted instantiation: sha512.c:OPENSSL_load_u16_be
a_mbstr.c:OPENSSL_load_u16_be
Line
Count
Source
220
12.0M
{
221
12.0M
#ifdef OSSL_LE16TOH
222
12.0M
    uint16_t t;
223
224
12.0M
    memcpy((unsigned char *)&t, in, 2);
225
12.0M
    *val = OSSL_BE16TOH(t);
226
12.0M
    return in + 2;
227
#else
228
    uint16_t b1 = *in++;
229
    uint16_t b0 = *in++;
230
231
    *val = b0 | (b1 << 8);
232
    return in;
233
#endif
234
12.0M
}
Unexecuted instantiation: slh_adrs.c:OPENSSL_load_u16_be
Unexecuted instantiation: echconfiglist_parser.c:OPENSSL_load_u16_be
Unexecuted instantiation: ml-dsa.c:OPENSSL_load_u16_be
Unexecuted instantiation: ml-kem.c:OPENSSL_load_u16_be
Unexecuted instantiation: slh-dsa.c:OPENSSL_load_u16_be
235
236
static ossl_inline ossl_unused const unsigned char *
237
OPENSSL_load_u32_le(uint32_t *val, const unsigned char *in)
238
3.24M
{
239
3.24M
#ifdef OSSL_LE32TOH
240
3.24M
    uint32_t t;
241
242
3.24M
    memcpy((unsigned char *)&t, in, 4);
243
3.24M
    *val = OSSL_LE32TOH(t);
244
3.24M
    return in + 4;
245
#else
246
    uint32_t b0 = *in++;
247
    uint32_t b1 = *in++;
248
    uint32_t b2 = *in++;
249
    uint32_t b3 = *in++;
250
251
    *val = b0 | (b1 << 8) | (b2 << 16) | (b3 << 24);
252
    return in;
253
#endif
254
3.24M
}
Unexecuted instantiation: sha2_prov.c:OPENSSL_load_u32_le
Unexecuted instantiation: sha3_prov.c:OPENSSL_load_u32_le
Unexecuted instantiation: decode_der2key.c:OPENSSL_load_u32_le
Unexecuted instantiation: encode_key2any.c:OPENSSL_load_u32_le
Unexecuted instantiation: ml_dsa_codecs.c:OPENSSL_load_u32_le
Unexecuted instantiation: ml_kem_codecs.c:OPENSSL_load_u32_le
Unexecuted instantiation: a_strex.c:OPENSSL_load_u32_le
ml_dsa_encoders.c:OPENSSL_load_u32_le
Line
Count
Source
238
3.24M
{
239
3.24M
#ifdef OSSL_LE32TOH
240
3.24M
    uint32_t t;
241
242
3.24M
    memcpy((unsigned char *)&t, in, 4);
243
3.24M
    *val = OSSL_LE32TOH(t);
244
3.24M
    return in + 4;
245
#else
246
    uint32_t b0 = *in++;
247
    uint32_t b1 = *in++;
248
    uint32_t b2 = *in++;
249
    uint32_t b3 = *in++;
250
251
    *val = b0 | (b1 << 8) | (b2 << 16) | (b3 << 24);
252
    return in;
253
#endif
254
3.24M
}
Unexecuted instantiation: ml_dsa_sample.c:OPENSSL_load_u32_le
Unexecuted instantiation: ml_kem.c:OPENSSL_load_u32_le
Unexecuted instantiation: sha512.c:OPENSSL_load_u32_le
Unexecuted instantiation: a_mbstr.c:OPENSSL_load_u32_le
Unexecuted instantiation: slh_adrs.c:OPENSSL_load_u32_le
Unexecuted instantiation: echconfiglist_parser.c:OPENSSL_load_u32_le
Unexecuted instantiation: ml-dsa.c:OPENSSL_load_u32_le
Unexecuted instantiation: ml-kem.c:OPENSSL_load_u32_le
Unexecuted instantiation: slh-dsa.c:OPENSSL_load_u32_le
255
256
static ossl_inline ossl_unused const unsigned char *
257
OPENSSL_load_u32_be(uint32_t *val, const unsigned char *in)
258
19.6k
{
259
19.6k
#ifdef OSSL_LE32TOH
260
19.6k
    uint32_t t;
261
262
19.6k
    memcpy((unsigned char *)&t, in, 4);
263
19.6k
    *val = OSSL_BE32TOH(t);
264
19.6k
    return in + 4;
265
#else
266
    uint32_t b3 = *in++;
267
    uint32_t b2 = *in++;
268
    uint32_t b1 = *in++;
269
    uint32_t b0 = *in++;
270
271
    *val = b0 | (b1 << 8) | (b2 << 16) | (b3 << 24);
272
    return in;
273
#endif
274
19.6k
}
Unexecuted instantiation: sha2_prov.c:OPENSSL_load_u32_be
Unexecuted instantiation: sha3_prov.c:OPENSSL_load_u32_be
Unexecuted instantiation: decode_der2key.c:OPENSSL_load_u32_be
Unexecuted instantiation: encode_key2any.c:OPENSSL_load_u32_be
ml_dsa_codecs.c:OPENSSL_load_u32_be
Line
Count
Source
258
249
{
259
249
#ifdef OSSL_LE32TOH
260
249
    uint32_t t;
261
262
249
    memcpy((unsigned char *)&t, in, 4);
263
249
    *val = OSSL_BE32TOH(t);
264
249
    return in + 4;
265
#else
266
    uint32_t b3 = *in++;
267
    uint32_t b2 = *in++;
268
    uint32_t b1 = *in++;
269
    uint32_t b0 = *in++;
270
271
    *val = b0 | (b1 << 8) | (b2 << 16) | (b3 << 24);
272
    return in;
273
#endif
274
249
}
ml_kem_codecs.c:OPENSSL_load_u32_be
Line
Count
Source
258
154
{
259
154
#ifdef OSSL_LE32TOH
260
154
    uint32_t t;
261
262
154
    memcpy((unsigned char *)&t, in, 4);
263
154
    *val = OSSL_BE32TOH(t);
264
154
    return in + 4;
265
#else
266
    uint32_t b3 = *in++;
267
    uint32_t b2 = *in++;
268
    uint32_t b1 = *in++;
269
    uint32_t b0 = *in++;
270
271
    *val = b0 | (b1 << 8) | (b2 << 16) | (b3 << 24);
272
    return in;
273
#endif
274
154
}
a_strex.c:OPENSSL_load_u32_be
Line
Count
Source
258
1.42k
{
259
1.42k
#ifdef OSSL_LE32TOH
260
1.42k
    uint32_t t;
261
262
1.42k
    memcpy((unsigned char *)&t, in, 4);
263
1.42k
    *val = OSSL_BE32TOH(t);
264
1.42k
    return in + 4;
265
#else
266
    uint32_t b3 = *in++;
267
    uint32_t b2 = *in++;
268
    uint32_t b1 = *in++;
269
    uint32_t b0 = *in++;
270
271
    *val = b0 | (b1 << 8) | (b2 << 16) | (b3 << 24);
272
    return in;
273
#endif
274
1.42k
}
Unexecuted instantiation: ml_dsa_encoders.c:OPENSSL_load_u32_be
Unexecuted instantiation: ml_dsa_sample.c:OPENSSL_load_u32_be
Unexecuted instantiation: ml_kem.c:OPENSSL_load_u32_be
Unexecuted instantiation: sha512.c:OPENSSL_load_u32_be
a_mbstr.c:OPENSSL_load_u32_be
Line
Count
Source
258
17.8k
{
259
17.8k
#ifdef OSSL_LE32TOH
260
17.8k
    uint32_t t;
261
262
17.8k
    memcpy((unsigned char *)&t, in, 4);
263
17.8k
    *val = OSSL_BE32TOH(t);
264
17.8k
    return in + 4;
265
#else
266
    uint32_t b3 = *in++;
267
    uint32_t b2 = *in++;
268
    uint32_t b1 = *in++;
269
    uint32_t b0 = *in++;
270
271
    *val = b0 | (b1 << 8) | (b2 << 16) | (b3 << 24);
272
    return in;
273
#endif
274
17.8k
}
Unexecuted instantiation: slh_adrs.c:OPENSSL_load_u32_be
Unexecuted instantiation: echconfiglist_parser.c:OPENSSL_load_u32_be
Unexecuted instantiation: ml-dsa.c:OPENSSL_load_u32_be
Unexecuted instantiation: ml-kem.c:OPENSSL_load_u32_be
Unexecuted instantiation: slh-dsa.c:OPENSSL_load_u32_be
275
276
static ossl_inline ossl_unused const unsigned char *
277
OPENSSL_load_u64_le(uint64_t *val, const unsigned char *in)
278
32.0k
{
279
32.0k
#ifdef OSSL_LE64TOH
280
32.0k
    uint64_t t;
281
282
32.0k
    memcpy((unsigned char *)&t, in, 8);
283
32.0k
    *val = OSSL_LE64TOH(t);
284
32.0k
    return in + 8;
285
#else
286
    uint64_t b0 = *in++;
287
    uint64_t b1 = *in++;
288
    uint64_t b2 = *in++;
289
    uint64_t b3 = *in++;
290
    uint64_t b4 = *in++;
291
    uint64_t b5 = *in++;
292
    uint64_t b6 = *in++;
293
    uint64_t b7 = *in++;
294
295
    *val = b0 | (b1 << 8) | (b2 << 16) | (b3 << 24)
296
        | (b4 << 32) | (b5 << 40) | (b6 << 48) | (b7 << 56);
297
    return in;
298
#endif
299
32.0k
}
Unexecuted instantiation: sha2_prov.c:OPENSSL_load_u64_le
Unexecuted instantiation: sha3_prov.c:OPENSSL_load_u64_le
Unexecuted instantiation: decode_der2key.c:OPENSSL_load_u64_le
Unexecuted instantiation: encode_key2any.c:OPENSSL_load_u64_le
Unexecuted instantiation: ml_dsa_codecs.c:OPENSSL_load_u64_le
Unexecuted instantiation: ml_kem_codecs.c:OPENSSL_load_u64_le
Unexecuted instantiation: a_strex.c:OPENSSL_load_u64_le
ml_dsa_encoders.c:OPENSSL_load_u64_le
Line
Count
Source
278
384
{
279
384
#ifdef OSSL_LE64TOH
280
384
    uint64_t t;
281
282
384
    memcpy((unsigned char *)&t, in, 8);
283
384
    *val = OSSL_LE64TOH(t);
284
384
    return in + 8;
285
#else
286
    uint64_t b0 = *in++;
287
    uint64_t b1 = *in++;
288
    uint64_t b2 = *in++;
289
    uint64_t b3 = *in++;
290
    uint64_t b4 = *in++;
291
    uint64_t b5 = *in++;
292
    uint64_t b6 = *in++;
293
    uint64_t b7 = *in++;
294
295
    *val = b0 | (b1 << 8) | (b2 << 16) | (b3 << 24)
296
        | (b4 << 32) | (b5 << 40) | (b6 << 48) | (b7 << 56);
297
    return in;
298
#endif
299
384
}
ml_dsa_sample.c:OPENSSL_load_u64_le
Line
Count
Source
278
4.92k
{
279
4.92k
#ifdef OSSL_LE64TOH
280
4.92k
    uint64_t t;
281
282
4.92k
    memcpy((unsigned char *)&t, in, 8);
283
4.92k
    *val = OSSL_LE64TOH(t);
284
4.92k
    return in + 8;
285
#else
286
    uint64_t b0 = *in++;
287
    uint64_t b1 = *in++;
288
    uint64_t b2 = *in++;
289
    uint64_t b3 = *in++;
290
    uint64_t b4 = *in++;
291
    uint64_t b5 = *in++;
292
    uint64_t b6 = *in++;
293
    uint64_t b7 = *in++;
294
295
    *val = b0 | (b1 << 8) | (b2 << 16) | (b3 << 24)
296
        | (b4 << 32) | (b5 << 40) | (b6 << 48) | (b7 << 56);
297
    return in;
298
#endif
299
4.92k
}
ml_kem.c:OPENSSL_load_u64_le
Line
Count
Source
278
26.7k
{
279
26.7k
#ifdef OSSL_LE64TOH
280
26.7k
    uint64_t t;
281
282
26.7k
    memcpy((unsigned char *)&t, in, 8);
283
26.7k
    *val = OSSL_LE64TOH(t);
284
26.7k
    return in + 8;
285
#else
286
    uint64_t b0 = *in++;
287
    uint64_t b1 = *in++;
288
    uint64_t b2 = *in++;
289
    uint64_t b3 = *in++;
290
    uint64_t b4 = *in++;
291
    uint64_t b5 = *in++;
292
    uint64_t b6 = *in++;
293
    uint64_t b7 = *in++;
294
295
    *val = b0 | (b1 << 8) | (b2 << 16) | (b3 << 24)
296
        | (b4 << 32) | (b5 << 40) | (b6 << 48) | (b7 << 56);
297
    return in;
298
#endif
299
26.7k
}
Unexecuted instantiation: sha512.c:OPENSSL_load_u64_le
Unexecuted instantiation: a_mbstr.c:OPENSSL_load_u64_le
Unexecuted instantiation: slh_adrs.c:OPENSSL_load_u64_le
Unexecuted instantiation: echconfiglist_parser.c:OPENSSL_load_u64_le
Unexecuted instantiation: ml-dsa.c:OPENSSL_load_u64_le
Unexecuted instantiation: ml-kem.c:OPENSSL_load_u64_le
Unexecuted instantiation: slh-dsa.c:OPENSSL_load_u64_le
300
301
static ossl_inline ossl_unused const unsigned char *
302
OPENSSL_load_u64_be(uint64_t *val, const unsigned char *in)
303
0
{
304
0
#ifdef OSSL_LE64TOH
305
0
    uint64_t t;
306
0
307
0
    memcpy((unsigned char *)&t, in, 8);
308
0
    *val = OSSL_BE64TOH(t);
309
0
    return in + 8;
310
0
#else
311
0
    uint64_t b7 = *in++;
312
0
    uint64_t b6 = *in++;
313
0
    uint64_t b5 = *in++;
314
0
    uint64_t b4 = *in++;
315
0
    uint64_t b3 = *in++;
316
0
    uint64_t b2 = *in++;
317
0
    uint64_t b1 = *in++;
318
0
    uint64_t b0 = *in++;
319
0
320
0
    *val = b0 | (b1 << 8) | (b2 << 16) | (b3 << 24)
321
0
        | (b4 << 32) | (b5 << 40) | (b6 << 48) | (b7 << 56);
322
0
    return in;
323
0
#endif
324
0
}
Unexecuted instantiation: sha2_prov.c:OPENSSL_load_u64_be
Unexecuted instantiation: sha3_prov.c:OPENSSL_load_u64_be
Unexecuted instantiation: decode_der2key.c:OPENSSL_load_u64_be
Unexecuted instantiation: encode_key2any.c:OPENSSL_load_u64_be
Unexecuted instantiation: ml_dsa_codecs.c:OPENSSL_load_u64_be
Unexecuted instantiation: ml_kem_codecs.c:OPENSSL_load_u64_be
Unexecuted instantiation: a_strex.c:OPENSSL_load_u64_be
Unexecuted instantiation: ml_dsa_encoders.c:OPENSSL_load_u64_be
Unexecuted instantiation: ml_dsa_sample.c:OPENSSL_load_u64_be
Unexecuted instantiation: ml_kem.c:OPENSSL_load_u64_be
Unexecuted instantiation: sha512.c:OPENSSL_load_u64_be
Unexecuted instantiation: a_mbstr.c:OPENSSL_load_u64_be
Unexecuted instantiation: slh_adrs.c:OPENSSL_load_u64_be
Unexecuted instantiation: echconfiglist_parser.c:OPENSSL_load_u64_be
Unexecuted instantiation: ml-dsa.c:OPENSSL_load_u64_be
Unexecuted instantiation: ml-kem.c:OPENSSL_load_u64_be
Unexecuted instantiation: slh-dsa.c:OPENSSL_load_u64_be
325
326
#undef OSSL_HTOBE16
327
#undef OSSL_HTOBE32
328
#undef OSSL_HTOBE64
329
#undef OSSL_BE16TOH
330
#undef OSSL_BE32TOH
331
#undef OSSL_BE64TOH
332
#undef OSSL_HTOLE16
333
#undef OSSL_HTOLE32
334
#undef OSSL_HTOLE64
335
#undef OSSL_LE16TOH
336
#undef OSSL_LE32TOH
337
#undef OSSL_LE64TOH
338
339
#endif