Coverage Report

Created: 2023-06-07 06:14

/src/wolfssl/wolfcrypt/src/misc.c
Line
Count
Source (jump to first uncovered line)
1
/* misc.c
2
 *
3
 * Copyright (C) 2006-2023 wolfSSL Inc.
4
 *
5
 * This file is part of wolfSSL.
6
 *
7
 * wolfSSL is free software; you can redistribute it and/or modify
8
 * it under the terms of the GNU General Public License as published by
9
 * the Free Software Foundation; either version 2 of the License, or
10
 * (at your option) any later version.
11
 *
12
 * wolfSSL is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 * GNU General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU General Public License
18
 * along with this program; if not, write to the Free Software
19
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
20
 */
21
/*
22
23
DESCRIPTION
24
This module implements the arithmetic-shift right, left, byte swapping, XOR,
25
masking and clearing memory logic.
26
27
*/
28
#ifdef HAVE_CONFIG_H
29
    #include <config.h>
30
#endif
31
32
#include <wolfssl/wolfcrypt/settings.h>
33
34
#ifndef WOLF_CRYPT_MISC_C
35
#define WOLF_CRYPT_MISC_C
36
37
#include <wolfssl/wolfcrypt/misc.h>
38
39
/* inlining these functions is a huge speed increase and a small size decrease,
40
   because the functions are smaller than function call setup/cleanup, e.g.,
41
   md5 benchmark is twice as fast with inline.  If you don't want it, then
42
   define NO_INLINE and compile this file into wolfssl, otherwise it's used as
43
   a source header
44
 */
45
46
/* Check for if compiling misc.c when not needed. */
47
#if !defined(WOLFSSL_MISC_INCLUDED) && !defined(NO_INLINE)
48
    #ifndef WOLFSSL_IGNORE_FILE_WARN
49
        #warning misc.c does not need to be compiled when using inline (NO_INLINE not defined)
50
    #endif
51
52
#else
53
54
55
#if defined(__ICCARM__)
56
    #include <intrinsics.h>
57
#endif
58
59
60
#ifdef INTEL_INTRINSICS
61
62
    #include <stdlib.h>      /* get intrinsic definitions */
63
64
    /* for non visual studio probably need no long version, 32 bit only
65
     * i.e., _rotl and _rotr */
66
    #pragma intrinsic(_lrotl, _lrotr)
67
68
    WC_MISC_STATIC WC_INLINE word32 rotlFixed(word32 x, word32 y)
69
    {
70
        return y ? _lrotl(x, y) : x;
71
    }
72
73
    WC_MISC_STATIC WC_INLINE word32 rotrFixed(word32 x, word32 y)
74
    {
75
        return y ? _lrotr(x, y) : x;
76
    }
77
78
#elif defined(__CCRX__)
79
80
    #include <builtin.h>      /* get intrinsic definitions */
81
82
    #if !defined(NO_INLINE)
83
84
    #define rotlFixed(x, y) _builtin_rotl(x, y)
85
86
    #define rotrFixed(x, y) _builtin_rotr(x, y)
87
88
    #else /* create real function */
89
90
    WC_MISC_STATIC WC_INLINE word32 rotlFixed(word32 x, word32 y)
91
    {
92
        return _builtin_rotl(x, y);
93
    }
94
95
    WC_MISC_STATIC WC_INLINE word32 rotrFixed(word32 x, word32 y)
96
    {
97
        return _builtin_rotr(x, y);
98
    }
99
100
    #endif
101
102
#else /* generic */
103
/* This routine performs a left circular arithmetic shift of <x> by <y> value. */
104
105
    WC_MISC_STATIC WC_INLINE word32 rotlFixed(word32 x, word32 y)
106
0
    {
107
0
        return (x << y) | (x >> (sizeof(y) * 8 - y));
108
0
    }
Unexecuted instantiation: ssl.c:rotlFixed
Unexecuted instantiation: tls.c:rotlFixed
Unexecuted instantiation: tls13.c:rotlFixed
Unexecuted instantiation: hmac.c:rotlFixed
Unexecuted instantiation: hash.c:rotlFixed
Unexecuted instantiation: kdf.c:rotlFixed
Unexecuted instantiation: random.c:rotlFixed
Unexecuted instantiation: sha256.c:rotlFixed
Unexecuted instantiation: rsa.c:rotlFixed
Unexecuted instantiation: sp_int.c:rotlFixed
Unexecuted instantiation: aes.c:rotlFixed
Unexecuted instantiation: sha.c:rotlFixed
Unexecuted instantiation: sha512.c:rotlFixed
Unexecuted instantiation: sha3.c:rotlFixed
Unexecuted instantiation: wolfmath.c:rotlFixed
Unexecuted instantiation: dh.c:rotlFixed
Unexecuted instantiation: asn.c:rotlFixed
Unexecuted instantiation: coding.c:rotlFixed
Unexecuted instantiation: poly1305.c:rotlFixed
Unexecuted instantiation: md5.c:rotlFixed
Unexecuted instantiation: chacha.c:rotlFixed
Unexecuted instantiation: ecc.c:rotlFixed
Unexecuted instantiation: internal.c:rotlFixed
Unexecuted instantiation: wc_encrypt.c:rotlFixed
Unexecuted instantiation: pwdbased.c:rotlFixed
109
110
/* This routine performs a right circular arithmetic shift of <x> by <y> value. */
111
    WC_MISC_STATIC WC_INLINE word32 rotrFixed(word32 x, word32 y)
112
0
    {
113
0
        return (x >> y) | (x << (sizeof(y) * 8 - y));
114
0
    }
Unexecuted instantiation: ssl.c:rotrFixed
Unexecuted instantiation: tls.c:rotrFixed
Unexecuted instantiation: tls13.c:rotrFixed
Unexecuted instantiation: hmac.c:rotrFixed
Unexecuted instantiation: hash.c:rotrFixed
Unexecuted instantiation: kdf.c:rotrFixed
Unexecuted instantiation: random.c:rotrFixed
Unexecuted instantiation: sha256.c:rotrFixed
Unexecuted instantiation: rsa.c:rotrFixed
Unexecuted instantiation: sp_int.c:rotrFixed
Unexecuted instantiation: aes.c:rotrFixed
Unexecuted instantiation: sha.c:rotrFixed
Unexecuted instantiation: sha512.c:rotrFixed
Unexecuted instantiation: sha3.c:rotrFixed
Unexecuted instantiation: wolfmath.c:rotrFixed
Unexecuted instantiation: dh.c:rotrFixed
Unexecuted instantiation: asn.c:rotrFixed
Unexecuted instantiation: coding.c:rotrFixed
Unexecuted instantiation: poly1305.c:rotrFixed
Unexecuted instantiation: md5.c:rotrFixed
Unexecuted instantiation: chacha.c:rotrFixed
Unexecuted instantiation: ecc.c:rotrFixed
Unexecuted instantiation: internal.c:rotrFixed
Unexecuted instantiation: wc_encrypt.c:rotrFixed
Unexecuted instantiation: pwdbased.c:rotrFixed
115
116
#endif
117
118
#ifdef WC_RC2
119
120
/* This routine performs a left circular arithmetic shift of <x> by <y> value */
121
WC_MISC_STATIC WC_INLINE word16 rotlFixed16(word16 x, word16 y)
122
{
123
    return (x << y) | (x >> (sizeof(y) * 8 - y));
124
}
125
126
127
/* This routine performs a right circular arithmetic shift of <x> by <y> value */
128
WC_MISC_STATIC WC_INLINE word16 rotrFixed16(word16 x, word16 y)
129
{
130
    return (x >> y) | (x << (sizeof(y) * 8 - y));
131
}
132
133
#endif /* WC_RC2 */
134
135
/* This routine performs a byte swap of 32-bit word value. */
136
#if defined(__CCRX__) && !defined(NO_INLINE) /* shortest version for CC-RX */
137
    #define ByteReverseWord32(value) _builtin_revl(value)
138
#else
139
WC_MISC_STATIC WC_INLINE word32 ByteReverseWord32(word32 value)
140
0
{
141
#ifdef PPC_INTRINSICS
142
    /* PPC: load reverse indexed instruction */
143
    return (word32)__lwbrx(&value,0);
144
#elif defined(__ICCARM__)
145
    return (word32)__REV(value);
146
#elif defined(KEIL_INTRINSICS)
147
    return (word32)__rev(value);
148
#elif defined(__CCRX__)
149
    return (word32)_builtin_revl(value);
150
#elif defined(WOLF_ALLOW_BUILTIN) && \
151
        defined(__GNUC_PREREQ) && __GNUC_PREREQ(4, 3)
152
    return (word32)__builtin_bswap32(value);
153
#elif defined(WOLFSSL_BYTESWAP32_ASM) && defined(__GNUC__) && \
154
      defined(__aarch64__)
155
    __asm__ volatile (
156
        "REV32 %0, %0  \n"
157
        : "+r" (value)
158
        :
159
    );
160
    return value;
161
#elif defined(WOLFSSL_BYTESWAP32_ASM) && defined(__GNUC__) && \
162
      (defined(__thumb__) || defined(__arm__))
163
    __asm__ volatile (
164
        "REV %0, %0  \n"
165
        : "+r" (value)
166
        :
167
    );
168
    return value;
169
#elif defined(FAST_ROTATE)
170
    /* 5 instructions with rotate instruction, 9 without */
171
0
    return (rotrFixed(value, 8U) & 0xff00ff00) |
172
0
           (rotlFixed(value, 8U) & 0x00ff00ff);
173
#else
174
    /* 6 instructions with rotate instruction, 8 without */
175
    value = ((value & 0xFF00FF00) >> 8) | ((value & 0x00FF00FF) << 8);
176
    return rotlFixed(value, 16U);
177
#endif
178
0
}
Unexecuted instantiation: ssl.c:ByteReverseWord32
Unexecuted instantiation: tls.c:ByteReverseWord32
Unexecuted instantiation: tls13.c:ByteReverseWord32
Unexecuted instantiation: hmac.c:ByteReverseWord32
Unexecuted instantiation: hash.c:ByteReverseWord32
Unexecuted instantiation: kdf.c:ByteReverseWord32
Unexecuted instantiation: random.c:ByteReverseWord32
Unexecuted instantiation: sha256.c:ByteReverseWord32
Unexecuted instantiation: rsa.c:ByteReverseWord32
Unexecuted instantiation: sp_int.c:ByteReverseWord32
Unexecuted instantiation: aes.c:ByteReverseWord32
Unexecuted instantiation: sha.c:ByteReverseWord32
Unexecuted instantiation: sha512.c:ByteReverseWord32
Unexecuted instantiation: sha3.c:ByteReverseWord32
Unexecuted instantiation: wolfmath.c:ByteReverseWord32
Unexecuted instantiation: dh.c:ByteReverseWord32
Unexecuted instantiation: asn.c:ByteReverseWord32
Unexecuted instantiation: coding.c:ByteReverseWord32
Unexecuted instantiation: poly1305.c:ByteReverseWord32
Unexecuted instantiation: md5.c:ByteReverseWord32
Unexecuted instantiation: chacha.c:ByteReverseWord32
Unexecuted instantiation: ecc.c:ByteReverseWord32
Unexecuted instantiation: internal.c:ByteReverseWord32
Unexecuted instantiation: wc_encrypt.c:ByteReverseWord32
Unexecuted instantiation: pwdbased.c:ByteReverseWord32
179
#endif /* __CCRX__ */
180
/* This routine performs a byte swap of words array of a given count. */
181
WC_MISC_STATIC WC_INLINE void ByteReverseWords(word32* out, const word32* in,
182
                                    word32 byteCount)
183
0
{
184
0
    word32 i;
185
186
0
#ifdef WOLFSSL_USE_ALIGN
187
0
    if ((((size_t)in & 0x3) == 0) &&
188
0
        (((size_t)out & 0x3) == 0))
189
0
#endif
190
0
    {
191
0
        word32 count = byteCount/(word32)sizeof(word32);
192
0
        for (i = 0; i < count; i++)
193
0
            out[i] = ByteReverseWord32(in[i]);
194
0
    }
195
0
#ifdef WOLFSSL_USE_ALIGN
196
0
    else {
197
0
        byte *in_bytes = (byte *)in;
198
0
        byte *out_bytes = (byte *)out;
199
0
        word32 scratch;
200
201
0
        byteCount &= ~0x3U;
202
203
0
        for (i = 0; i < byteCount; i += sizeof(word32)) {
204
0
            XMEMCPY(&scratch, in_bytes + i, sizeof(scratch));
205
0
            scratch = ByteReverseWord32(scratch);
206
0
            XMEMCPY(out_bytes + i, &scratch, sizeof(scratch));
207
0
        }
208
0
    }
209
0
#endif
210
0
}
Unexecuted instantiation: ssl.c:ByteReverseWords
Unexecuted instantiation: tls.c:ByteReverseWords
Unexecuted instantiation: tls13.c:ByteReverseWords
Unexecuted instantiation: hmac.c:ByteReverseWords
Unexecuted instantiation: hash.c:ByteReverseWords
Unexecuted instantiation: kdf.c:ByteReverseWords
Unexecuted instantiation: random.c:ByteReverseWords
Unexecuted instantiation: sha256.c:ByteReverseWords
Unexecuted instantiation: rsa.c:ByteReverseWords
Unexecuted instantiation: sp_int.c:ByteReverseWords
Unexecuted instantiation: aes.c:ByteReverseWords
Unexecuted instantiation: sha.c:ByteReverseWords
Unexecuted instantiation: sha512.c:ByteReverseWords
Unexecuted instantiation: sha3.c:ByteReverseWords
Unexecuted instantiation: wolfmath.c:ByteReverseWords
Unexecuted instantiation: dh.c:ByteReverseWords
Unexecuted instantiation: asn.c:ByteReverseWords
Unexecuted instantiation: coding.c:ByteReverseWords
Unexecuted instantiation: poly1305.c:ByteReverseWords
Unexecuted instantiation: md5.c:ByteReverseWords
Unexecuted instantiation: chacha.c:ByteReverseWords
Unexecuted instantiation: ecc.c:ByteReverseWords
Unexecuted instantiation: internal.c:ByteReverseWords
Unexecuted instantiation: wc_encrypt.c:ByteReverseWords
Unexecuted instantiation: pwdbased.c:ByteReverseWords
211
212
#if defined(WORD64_AVAILABLE) && !defined(WOLFSSL_NO_WORD64_OPS)
213
214
215
WC_MISC_STATIC WC_INLINE word64 rotlFixed64(word64 x, word64 y)
216
0
{
217
0
    return (x << y) | (x >> (sizeof(y) * 8 - y));
218
0
}
Unexecuted instantiation: ssl.c:rotlFixed64
Unexecuted instantiation: tls.c:rotlFixed64
Unexecuted instantiation: tls13.c:rotlFixed64
Unexecuted instantiation: hmac.c:rotlFixed64
Unexecuted instantiation: hash.c:rotlFixed64
Unexecuted instantiation: kdf.c:rotlFixed64
Unexecuted instantiation: random.c:rotlFixed64
Unexecuted instantiation: sha256.c:rotlFixed64
Unexecuted instantiation: rsa.c:rotlFixed64
Unexecuted instantiation: sp_int.c:rotlFixed64
Unexecuted instantiation: aes.c:rotlFixed64
Unexecuted instantiation: sha.c:rotlFixed64
Unexecuted instantiation: sha512.c:rotlFixed64
Unexecuted instantiation: sha3.c:rotlFixed64
Unexecuted instantiation: wolfmath.c:rotlFixed64
Unexecuted instantiation: dh.c:rotlFixed64
Unexecuted instantiation: asn.c:rotlFixed64
Unexecuted instantiation: coding.c:rotlFixed64
Unexecuted instantiation: poly1305.c:rotlFixed64
Unexecuted instantiation: md5.c:rotlFixed64
Unexecuted instantiation: chacha.c:rotlFixed64
Unexecuted instantiation: ecc.c:rotlFixed64
Unexecuted instantiation: internal.c:rotlFixed64
Unexecuted instantiation: wc_encrypt.c:rotlFixed64
Unexecuted instantiation: pwdbased.c:rotlFixed64
219
220
221
WC_MISC_STATIC WC_INLINE word64 rotrFixed64(word64 x, word64 y)
222
0
{
223
0
    return (x >> y) | (x << (sizeof(y) * 8 - y));
224
0
}
Unexecuted instantiation: ssl.c:rotrFixed64
Unexecuted instantiation: tls.c:rotrFixed64
Unexecuted instantiation: tls13.c:rotrFixed64
Unexecuted instantiation: hmac.c:rotrFixed64
Unexecuted instantiation: hash.c:rotrFixed64
Unexecuted instantiation: kdf.c:rotrFixed64
Unexecuted instantiation: random.c:rotrFixed64
Unexecuted instantiation: sha256.c:rotrFixed64
Unexecuted instantiation: rsa.c:rotrFixed64
Unexecuted instantiation: sp_int.c:rotrFixed64
Unexecuted instantiation: aes.c:rotrFixed64
Unexecuted instantiation: sha.c:rotrFixed64
Unexecuted instantiation: sha512.c:rotrFixed64
Unexecuted instantiation: sha3.c:rotrFixed64
Unexecuted instantiation: wolfmath.c:rotrFixed64
Unexecuted instantiation: dh.c:rotrFixed64
Unexecuted instantiation: asn.c:rotrFixed64
Unexecuted instantiation: coding.c:rotrFixed64
Unexecuted instantiation: poly1305.c:rotrFixed64
Unexecuted instantiation: md5.c:rotrFixed64
Unexecuted instantiation: chacha.c:rotrFixed64
Unexecuted instantiation: ecc.c:rotrFixed64
Unexecuted instantiation: internal.c:rotrFixed64
Unexecuted instantiation: wc_encrypt.c:rotrFixed64
Unexecuted instantiation: pwdbased.c:rotrFixed64
225
226
227
WC_MISC_STATIC WC_INLINE word64 ByteReverseWord64(word64 value)
228
0
{
229
#if defined(WOLF_ALLOW_BUILTIN) && defined(__GNUC_PREREQ) && __GNUC_PREREQ(4, 3)
230
    return (word64)__builtin_bswap64(value);
231
#elif defined(WOLFCRYPT_SLOW_WORD64)
232
    return (word64)((word64)ByteReverseWord32((word32) value)) << 32 |
233
        (word64)ByteReverseWord32((word32)(value   >> 32));
234
#else
235
0
    value = ((value & W64LIT(0xFF00FF00FF00FF00)) >> 8) |
236
0
        ((value & W64LIT(0x00FF00FF00FF00FF)) << 8);
237
0
    value = ((value & W64LIT(0xFFFF0000FFFF0000)) >> 16) |
238
0
        ((value & W64LIT(0x0000FFFF0000FFFF)) << 16);
239
0
    return rotlFixed64(value, 32U);
240
0
#endif
241
0
}
Unexecuted instantiation: ssl.c:ByteReverseWord64
Unexecuted instantiation: tls.c:ByteReverseWord64
Unexecuted instantiation: tls13.c:ByteReverseWord64
Unexecuted instantiation: hmac.c:ByteReverseWord64
Unexecuted instantiation: hash.c:ByteReverseWord64
Unexecuted instantiation: kdf.c:ByteReverseWord64
Unexecuted instantiation: random.c:ByteReverseWord64
Unexecuted instantiation: sha256.c:ByteReverseWord64
Unexecuted instantiation: rsa.c:ByteReverseWord64
Unexecuted instantiation: sp_int.c:ByteReverseWord64
Unexecuted instantiation: aes.c:ByteReverseWord64
Unexecuted instantiation: sha.c:ByteReverseWord64
Unexecuted instantiation: sha512.c:ByteReverseWord64
Unexecuted instantiation: sha3.c:ByteReverseWord64
Unexecuted instantiation: wolfmath.c:ByteReverseWord64
Unexecuted instantiation: dh.c:ByteReverseWord64
Unexecuted instantiation: asn.c:ByteReverseWord64
Unexecuted instantiation: coding.c:ByteReverseWord64
Unexecuted instantiation: poly1305.c:ByteReverseWord64
Unexecuted instantiation: md5.c:ByteReverseWord64
Unexecuted instantiation: chacha.c:ByteReverseWord64
Unexecuted instantiation: ecc.c:ByteReverseWord64
Unexecuted instantiation: internal.c:ByteReverseWord64
Unexecuted instantiation: wc_encrypt.c:ByteReverseWord64
Unexecuted instantiation: pwdbased.c:ByteReverseWord64
242
243
244
WC_MISC_STATIC WC_INLINE void ByteReverseWords64(word64* out, const word64* in,
245
                                      word32 byteCount)
246
0
{
247
0
    word32 count = byteCount/(word32)sizeof(word64), i;
248
249
0
    for (i = 0; i < count; i++)
250
0
        out[i] = ByteReverseWord64(in[i]);
251
252
0
}
Unexecuted instantiation: ssl.c:ByteReverseWords64
Unexecuted instantiation: tls.c:ByteReverseWords64
Unexecuted instantiation: tls13.c:ByteReverseWords64
Unexecuted instantiation: hmac.c:ByteReverseWords64
Unexecuted instantiation: hash.c:ByteReverseWords64
Unexecuted instantiation: kdf.c:ByteReverseWords64
Unexecuted instantiation: random.c:ByteReverseWords64
Unexecuted instantiation: sha256.c:ByteReverseWords64
Unexecuted instantiation: rsa.c:ByteReverseWords64
Unexecuted instantiation: sp_int.c:ByteReverseWords64
Unexecuted instantiation: aes.c:ByteReverseWords64
Unexecuted instantiation: sha.c:ByteReverseWords64
Unexecuted instantiation: sha512.c:ByteReverseWords64
Unexecuted instantiation: sha3.c:ByteReverseWords64
Unexecuted instantiation: wolfmath.c:ByteReverseWords64
Unexecuted instantiation: dh.c:ByteReverseWords64
Unexecuted instantiation: asn.c:ByteReverseWords64
Unexecuted instantiation: coding.c:ByteReverseWords64
Unexecuted instantiation: poly1305.c:ByteReverseWords64
Unexecuted instantiation: md5.c:ByteReverseWords64
Unexecuted instantiation: chacha.c:ByteReverseWords64
Unexecuted instantiation: ecc.c:ByteReverseWords64
Unexecuted instantiation: internal.c:ByteReverseWords64
Unexecuted instantiation: wc_encrypt.c:ByteReverseWords64
Unexecuted instantiation: pwdbased.c:ByteReverseWords64
253
254
#endif /* WORD64_AVAILABLE && !WOLFSSL_NO_WORD64_OPS */
255
256
#ifndef WOLFSSL_NO_XOR_OPS
257
/* This routine performs a bitwise XOR operation of <*r> and <*a> for <n> number
258
of wolfssl_words, placing the result in <*r>. */
259
WC_MISC_STATIC WC_INLINE void XorWordsOut(wolfssl_word** r,
260
                       const wolfssl_word** a, const wolfssl_word** b, word32 n)
261
0
{
262
0
    word32 i;
263
264
0
    for (i = 0; i < n; i++)
265
0
        *((*r)++) = *((*a)++) ^ *((*b)++);
266
0
}
Unexecuted instantiation: ssl.c:XorWordsOut
Unexecuted instantiation: tls.c:XorWordsOut
Unexecuted instantiation: tls13.c:XorWordsOut
Unexecuted instantiation: hmac.c:XorWordsOut
Unexecuted instantiation: hash.c:XorWordsOut
Unexecuted instantiation: kdf.c:XorWordsOut
Unexecuted instantiation: random.c:XorWordsOut
Unexecuted instantiation: sha256.c:XorWordsOut
Unexecuted instantiation: rsa.c:XorWordsOut
Unexecuted instantiation: sp_int.c:XorWordsOut
Unexecuted instantiation: aes.c:XorWordsOut
Unexecuted instantiation: sha.c:XorWordsOut
Unexecuted instantiation: sha512.c:XorWordsOut
Unexecuted instantiation: sha3.c:XorWordsOut
Unexecuted instantiation: wolfmath.c:XorWordsOut
Unexecuted instantiation: dh.c:XorWordsOut
Unexecuted instantiation: asn.c:XorWordsOut
Unexecuted instantiation: coding.c:XorWordsOut
Unexecuted instantiation: poly1305.c:XorWordsOut
Unexecuted instantiation: md5.c:XorWordsOut
Unexecuted instantiation: chacha.c:XorWordsOut
Unexecuted instantiation: ecc.c:XorWordsOut
Unexecuted instantiation: internal.c:XorWordsOut
Unexecuted instantiation: wc_encrypt.c:XorWordsOut
Unexecuted instantiation: pwdbased.c:XorWordsOut
267
268
/* This routine performs a bitwise XOR operation of <*buf> and <*mask> of n
269
counts, placing the result in <*buf>. */
270
271
WC_MISC_STATIC WC_INLINE void xorbufout(void* out, const void* buf,
272
                                        const void* mask, word32 count)
273
0
{
274
0
    word32      i;
275
0
    byte*       o;
276
0
    byte*       b;
277
0
    const byte* m;
278
279
0
    o = (byte*)out;
280
0
    b = (byte*)buf;
281
0
    m = (const byte*)mask;
282
283
284
0
    if (((wc_ptr_t)o) % WOLFSSL_WORD_SIZE ==
285
0
            ((wc_ptr_t)b) % WOLFSSL_WORD_SIZE &&
286
0
            ((wc_ptr_t)b) % WOLFSSL_WORD_SIZE ==
287
0
                        ((wc_ptr_t)m) % WOLFSSL_WORD_SIZE) {
288
        /* Alignment checks out. Possible to XOR words. */
289
        /* Move alignment so that it lines up with a
290
         * WOLFSSL_WORD_SIZE boundary */
291
0
        while (((wc_ptr_t)b) % WOLFSSL_WORD_SIZE != 0 && count > 0) {
292
0
            *(o++) = (byte)(*(b++) ^ *(m++));
293
0
            count--;
294
0
        }
295
0
        XorWordsOut( (wolfssl_word**)&o, (const wolfssl_word**)&b,
296
0
                     (const wolfssl_word**)&m, count / WOLFSSL_WORD_SIZE);
297
0
        count %= WOLFSSL_WORD_SIZE;
298
0
    }
299
300
0
    for (i = 0; i < count; i++)
301
0
        o[i] = (byte)(b[i] ^ m[i]);
302
0
}
Unexecuted instantiation: ssl.c:xorbufout
Unexecuted instantiation: tls.c:xorbufout
Unexecuted instantiation: tls13.c:xorbufout
Unexecuted instantiation: hmac.c:xorbufout
Unexecuted instantiation: hash.c:xorbufout
Unexecuted instantiation: kdf.c:xorbufout
Unexecuted instantiation: random.c:xorbufout
Unexecuted instantiation: sha256.c:xorbufout
Unexecuted instantiation: rsa.c:xorbufout
Unexecuted instantiation: sp_int.c:xorbufout
Unexecuted instantiation: aes.c:xorbufout
Unexecuted instantiation: sha.c:xorbufout
Unexecuted instantiation: sha512.c:xorbufout
Unexecuted instantiation: sha3.c:xorbufout
Unexecuted instantiation: wolfmath.c:xorbufout
Unexecuted instantiation: dh.c:xorbufout
Unexecuted instantiation: asn.c:xorbufout
Unexecuted instantiation: coding.c:xorbufout
Unexecuted instantiation: poly1305.c:xorbufout
Unexecuted instantiation: md5.c:xorbufout
Unexecuted instantiation: chacha.c:xorbufout
Unexecuted instantiation: ecc.c:xorbufout
Unexecuted instantiation: internal.c:xorbufout
Unexecuted instantiation: wc_encrypt.c:xorbufout
Unexecuted instantiation: pwdbased.c:xorbufout
303
304
/* This routine performs a bitwise XOR operation of <*r> and <*a> for <n> number
305
of wolfssl_words, placing the result in <*r>. */
306
WC_MISC_STATIC WC_INLINE void XorWords(wolfssl_word** r, const wolfssl_word** a,
307
                                       word32 n)
308
0
{
309
0
    word32 i;
310
311
0
    for (i = 0; i < n; i++)
312
0
        *((*r)++) ^= *((*a)++);
313
0
}
Unexecuted instantiation: ssl.c:XorWords
Unexecuted instantiation: tls.c:XorWords
Unexecuted instantiation: tls13.c:XorWords
Unexecuted instantiation: hmac.c:XorWords
Unexecuted instantiation: hash.c:XorWords
Unexecuted instantiation: kdf.c:XorWords
Unexecuted instantiation: random.c:XorWords
Unexecuted instantiation: sha256.c:XorWords
Unexecuted instantiation: rsa.c:XorWords
Unexecuted instantiation: sp_int.c:XorWords
Unexecuted instantiation: aes.c:XorWords
Unexecuted instantiation: sha.c:XorWords
Unexecuted instantiation: sha512.c:XorWords
Unexecuted instantiation: sha3.c:XorWords
Unexecuted instantiation: wolfmath.c:XorWords
Unexecuted instantiation: dh.c:XorWords
Unexecuted instantiation: asn.c:XorWords
Unexecuted instantiation: coding.c:XorWords
Unexecuted instantiation: poly1305.c:XorWords
Unexecuted instantiation: md5.c:XorWords
Unexecuted instantiation: chacha.c:XorWords
Unexecuted instantiation: ecc.c:XorWords
Unexecuted instantiation: internal.c:XorWords
Unexecuted instantiation: wc_encrypt.c:XorWords
Unexecuted instantiation: pwdbased.c:XorWords
314
315
/* This routine performs a bitwise XOR operation of <*buf> and <*mask> of n
316
counts, placing the result in <*buf>. */
317
318
WC_MISC_STATIC WC_INLINE void xorbuf(void* buf, const void* mask, word32 count)
319
0
{
320
0
    word32      i;
321
0
    byte*       b;
322
0
    const byte* m;
323
324
0
    b = (byte*)buf;
325
0
    m = (const byte*)mask;
326
327
0
    if (((wc_ptr_t)b) % WOLFSSL_WORD_SIZE ==
328
0
            ((wc_ptr_t)m) % WOLFSSL_WORD_SIZE) {
329
        /* Alignment checks out. Possible to XOR words. */
330
        /* Move alignment so that it lines up with a
331
         * WOLFSSL_WORD_SIZE boundary */
332
0
        while (((wc_ptr_t)buf) % WOLFSSL_WORD_SIZE != 0 && count > 0) {
333
0
            *(b++) ^= *(m++);
334
0
            count--;
335
0
        }
336
0
        XorWords( (wolfssl_word**)&b,
337
0
                  (const wolfssl_word**)&m, count / WOLFSSL_WORD_SIZE);
338
0
        count %= WOLFSSL_WORD_SIZE;
339
0
    }
340
341
0
    for (i = 0; i < count; i++)
342
0
        b[i] ^= m[i];
343
0
}
Unexecuted instantiation: ssl.c:xorbuf
Unexecuted instantiation: tls.c:xorbuf
Unexecuted instantiation: tls13.c:xorbuf
Unexecuted instantiation: hmac.c:xorbuf
Unexecuted instantiation: hash.c:xorbuf
Unexecuted instantiation: kdf.c:xorbuf
Unexecuted instantiation: random.c:xorbuf
Unexecuted instantiation: sha256.c:xorbuf
Unexecuted instantiation: rsa.c:xorbuf
Unexecuted instantiation: sp_int.c:xorbuf
Unexecuted instantiation: aes.c:xorbuf
Unexecuted instantiation: sha.c:xorbuf
Unexecuted instantiation: sha512.c:xorbuf
Unexecuted instantiation: sha3.c:xorbuf
Unexecuted instantiation: wolfmath.c:xorbuf
Unexecuted instantiation: dh.c:xorbuf
Unexecuted instantiation: asn.c:xorbuf
Unexecuted instantiation: coding.c:xorbuf
Unexecuted instantiation: poly1305.c:xorbuf
Unexecuted instantiation: md5.c:xorbuf
Unexecuted instantiation: chacha.c:xorbuf
Unexecuted instantiation: ecc.c:xorbuf
Unexecuted instantiation: internal.c:xorbuf
Unexecuted instantiation: wc_encrypt.c:xorbuf
Unexecuted instantiation: pwdbased.c:xorbuf
344
#endif
345
346
#ifndef WOLFSSL_NO_FORCE_ZERO
347
/* This routine fills the first len bytes of the memory area pointed by mem
348
   with zeros. It ensures compiler optimizations doesn't skip it  */
349
WC_MISC_STATIC WC_INLINE void ForceZero(void* mem, word32 len)
350
0
{
351
0
    volatile byte* z = (volatile byte*)mem;
352
353
0
#if (defined(WOLFSSL_X86_64_BUILD) || defined(WOLFSSL_AARCH64_BUILD)) \
354
0
            && defined(WORD64_AVAILABLE)
355
0
    volatile word64* w;
356
0
    #ifndef WOLFSSL_UNALIGNED_64BIT_ACCESS
357
0
        word32 l = (sizeof(word64) - ((size_t)z & (sizeof(word64)-1))) &
358
0
                                                             (sizeof(word64)-1);
359
360
0
        if (len < l) l = len;
361
0
        len -= l;
362
0
        while (l--) *z++ = 0;
363
0
    #endif
364
0
        for (w = (volatile word64*)z;
365
0
             len >= sizeof(*w);
366
0
             len -= (word32)sizeof(*w))
367
0
        {
368
0
            *w++ = 0;
369
0
        }
370
0
    z = (volatile byte*)w;
371
0
#endif
372
373
0
    while (len--) *z++ = 0;
374
0
}
Unexecuted instantiation: ssl.c:ForceZero
Unexecuted instantiation: tls.c:ForceZero
Unexecuted instantiation: tls13.c:ForceZero
Unexecuted instantiation: hmac.c:ForceZero
Unexecuted instantiation: hash.c:ForceZero
Unexecuted instantiation: kdf.c:ForceZero
Unexecuted instantiation: random.c:ForceZero
Unexecuted instantiation: sha256.c:ForceZero
Unexecuted instantiation: rsa.c:ForceZero
Unexecuted instantiation: sp_int.c:ForceZero
Unexecuted instantiation: aes.c:ForceZero
Unexecuted instantiation: sha.c:ForceZero
Unexecuted instantiation: sha512.c:ForceZero
Unexecuted instantiation: sha3.c:ForceZero
Unexecuted instantiation: wolfmath.c:ForceZero
Unexecuted instantiation: dh.c:ForceZero
Unexecuted instantiation: asn.c:ForceZero
Unexecuted instantiation: coding.c:ForceZero
Unexecuted instantiation: poly1305.c:ForceZero
Unexecuted instantiation: md5.c:ForceZero
Unexecuted instantiation: chacha.c:ForceZero
Unexecuted instantiation: ecc.c:ForceZero
Unexecuted instantiation: internal.c:ForceZero
Unexecuted instantiation: wc_encrypt.c:ForceZero
Unexecuted instantiation: pwdbased.c:ForceZero
375
#endif
376
377
378
#ifndef WOLFSSL_NO_CONST_CMP
379
/* check all length bytes for equality, return 0 on success */
380
WC_MISC_STATIC WC_INLINE int ConstantCompare(const byte* a, const byte* b,
381
                                             int length)
382
0
{
383
0
    int i;
384
0
    int compareSum = 0;
385
386
0
    for (i = 0; i < length; i++) {
387
0
        compareSum |= a[i] ^ b[i];
388
0
    }
389
390
0
    return compareSum;
391
0
}
Unexecuted instantiation: ssl.c:ConstantCompare
Unexecuted instantiation: tls.c:ConstantCompare
Unexecuted instantiation: tls13.c:ConstantCompare
Unexecuted instantiation: hmac.c:ConstantCompare
Unexecuted instantiation: hash.c:ConstantCompare
Unexecuted instantiation: kdf.c:ConstantCompare
Unexecuted instantiation: random.c:ConstantCompare
Unexecuted instantiation: sha256.c:ConstantCompare
Unexecuted instantiation: rsa.c:ConstantCompare
Unexecuted instantiation: sp_int.c:ConstantCompare
Unexecuted instantiation: aes.c:ConstantCompare
Unexecuted instantiation: sha.c:ConstantCompare
Unexecuted instantiation: sha512.c:ConstantCompare
Unexecuted instantiation: sha3.c:ConstantCompare
Unexecuted instantiation: wolfmath.c:ConstantCompare
Unexecuted instantiation: dh.c:ConstantCompare
Unexecuted instantiation: asn.c:ConstantCompare
Unexecuted instantiation: coding.c:ConstantCompare
Unexecuted instantiation: poly1305.c:ConstantCompare
Unexecuted instantiation: md5.c:ConstantCompare
Unexecuted instantiation: chacha.c:ConstantCompare
Unexecuted instantiation: ecc.c:ConstantCompare
Unexecuted instantiation: internal.c:ConstantCompare
Unexecuted instantiation: wc_encrypt.c:ConstantCompare
Unexecuted instantiation: pwdbased.c:ConstantCompare
392
#endif
393
394
395
#ifndef WOLFSSL_HAVE_MIN
396
    #define WOLFSSL_HAVE_MIN
397
    #if defined(HAVE_FIPS) && !defined(min) /* so ifdef check passes */
398
        #define min min
399
    #endif
400
    /* returns the smaller of a and b */
401
    WC_MISC_STATIC WC_INLINE word32 min(word32 a, word32 b)
402
0
    {
403
0
        return a > b ? b : a;
404
0
    }
Unexecuted instantiation: ssl.c:min
Unexecuted instantiation: tls.c:min
Unexecuted instantiation: tls13.c:min
Unexecuted instantiation: hmac.c:min
Unexecuted instantiation: hash.c:min
Unexecuted instantiation: kdf.c:min
Unexecuted instantiation: random.c:min
Unexecuted instantiation: sha256.c:min
Unexecuted instantiation: rsa.c:min
Unexecuted instantiation: sp_int.c:min
Unexecuted instantiation: aes.c:min
Unexecuted instantiation: sha.c:min
Unexecuted instantiation: sha512.c:min
Unexecuted instantiation: sha3.c:min
Unexecuted instantiation: wolfmath.c:min
Unexecuted instantiation: dh.c:min
Unexecuted instantiation: asn.c:min
Unexecuted instantiation: coding.c:min
Unexecuted instantiation: poly1305.c:min
Unexecuted instantiation: md5.c:min
Unexecuted instantiation: chacha.c:min
Unexecuted instantiation: ecc.c:min
Unexecuted instantiation: internal.c:min
Unexecuted instantiation: wc_encrypt.c:min
Unexecuted instantiation: pwdbased.c:min
405
#endif /* !WOLFSSL_HAVE_MIN */
406
407
#ifndef WOLFSSL_HAVE_MAX
408
    #define WOLFSSL_HAVE_MAX
409
    #if defined(HAVE_FIPS) && !defined(max) /* so ifdef check passes */
410
        #define max max
411
    #endif
412
    WC_MISC_STATIC WC_INLINE word32 max(word32 a, word32 b)
413
0
    {
414
0
        return a > b ? a : b;
415
0
    }
Unexecuted instantiation: ssl.c:max
Unexecuted instantiation: tls.c:max
Unexecuted instantiation: tls13.c:max
Unexecuted instantiation: hmac.c:max
Unexecuted instantiation: hash.c:max
Unexecuted instantiation: kdf.c:max
Unexecuted instantiation: random.c:max
Unexecuted instantiation: sha256.c:max
Unexecuted instantiation: rsa.c:max
Unexecuted instantiation: sp_int.c:max
Unexecuted instantiation: aes.c:max
Unexecuted instantiation: sha.c:max
Unexecuted instantiation: sha512.c:max
Unexecuted instantiation: sha3.c:max
Unexecuted instantiation: wolfmath.c:max
Unexecuted instantiation: dh.c:max
Unexecuted instantiation: asn.c:max
Unexecuted instantiation: coding.c:max
Unexecuted instantiation: poly1305.c:max
Unexecuted instantiation: md5.c:max
Unexecuted instantiation: chacha.c:max
Unexecuted instantiation: ecc.c:max
Unexecuted instantiation: internal.c:max
Unexecuted instantiation: wc_encrypt.c:max
Unexecuted instantiation: pwdbased.c:max
416
#endif /* !WOLFSSL_HAVE_MAX */
417
418
#ifndef WOLFSSL_NO_INT_ENCODE
419
/* converts a 32 bit integer to 24 bit */
420
WC_MISC_STATIC WC_INLINE void c32to24(word32 in, word24 out)
421
0
{
422
0
    out[0] = (byte)((in >> 16) & 0xff);
423
0
    out[1] = (byte)((in >>  8) & 0xff);
424
0
    out[2] =  (byte)(in        & 0xff);
425
0
}
Unexecuted instantiation: ssl.c:c32to24
Unexecuted instantiation: tls.c:c32to24
Unexecuted instantiation: tls13.c:c32to24
Unexecuted instantiation: hmac.c:c32to24
Unexecuted instantiation: hash.c:c32to24
Unexecuted instantiation: kdf.c:c32to24
Unexecuted instantiation: random.c:c32to24
Unexecuted instantiation: sha256.c:c32to24
Unexecuted instantiation: rsa.c:c32to24
Unexecuted instantiation: sp_int.c:c32to24
Unexecuted instantiation: aes.c:c32to24
Unexecuted instantiation: sha.c:c32to24
Unexecuted instantiation: sha512.c:c32to24
Unexecuted instantiation: sha3.c:c32to24
Unexecuted instantiation: wolfmath.c:c32to24
Unexecuted instantiation: dh.c:c32to24
Unexecuted instantiation: asn.c:c32to24
Unexecuted instantiation: coding.c:c32to24
Unexecuted instantiation: poly1305.c:c32to24
Unexecuted instantiation: md5.c:c32to24
Unexecuted instantiation: chacha.c:c32to24
Unexecuted instantiation: ecc.c:c32to24
Unexecuted instantiation: internal.c:c32to24
Unexecuted instantiation: wc_encrypt.c:c32to24
Unexecuted instantiation: pwdbased.c:c32to24
426
427
/* convert 16 bit integer to opaque */
428
WC_MISC_STATIC WC_INLINE void c16toa(word16 wc_u16, byte* c)
429
0
{
430
0
    c[0] = (byte)((wc_u16 >> 8) & 0xff);
431
0
    c[1] =  (byte)(wc_u16       & 0xff);
432
0
}
Unexecuted instantiation: ssl.c:c16toa
Unexecuted instantiation: tls.c:c16toa
Unexecuted instantiation: tls13.c:c16toa
Unexecuted instantiation: hmac.c:c16toa
Unexecuted instantiation: hash.c:c16toa
Unexecuted instantiation: kdf.c:c16toa
Unexecuted instantiation: random.c:c16toa
Unexecuted instantiation: sha256.c:c16toa
Unexecuted instantiation: rsa.c:c16toa
Unexecuted instantiation: sp_int.c:c16toa
Unexecuted instantiation: aes.c:c16toa
Unexecuted instantiation: sha.c:c16toa
Unexecuted instantiation: sha512.c:c16toa
Unexecuted instantiation: sha3.c:c16toa
Unexecuted instantiation: wolfmath.c:c16toa
Unexecuted instantiation: dh.c:c16toa
Unexecuted instantiation: asn.c:c16toa
Unexecuted instantiation: coding.c:c16toa
Unexecuted instantiation: poly1305.c:c16toa
Unexecuted instantiation: md5.c:c16toa
Unexecuted instantiation: chacha.c:c16toa
Unexecuted instantiation: ecc.c:c16toa
Unexecuted instantiation: internal.c:c16toa
Unexecuted instantiation: wc_encrypt.c:c16toa
Unexecuted instantiation: pwdbased.c:c16toa
433
434
/* convert 32 bit integer to opaque */
435
WC_MISC_STATIC WC_INLINE void c32toa(word32 wc_u32, byte* c)
436
0
{
437
0
    c[0] = (byte)((wc_u32 >> 24) & 0xff);
438
0
    c[1] = (byte)((wc_u32 >> 16) & 0xff);
439
0
    c[2] = (byte)((wc_u32 >>  8) & 0xff);
440
0
    c[3] =  (byte)(wc_u32        & 0xff);
441
0
}
Unexecuted instantiation: ssl.c:c32toa
Unexecuted instantiation: tls.c:c32toa
Unexecuted instantiation: tls13.c:c32toa
Unexecuted instantiation: hmac.c:c32toa
Unexecuted instantiation: hash.c:c32toa
Unexecuted instantiation: kdf.c:c32toa
Unexecuted instantiation: random.c:c32toa
Unexecuted instantiation: sha256.c:c32toa
Unexecuted instantiation: rsa.c:c32toa
Unexecuted instantiation: sp_int.c:c32toa
Unexecuted instantiation: aes.c:c32toa
Unexecuted instantiation: sha.c:c32toa
Unexecuted instantiation: sha512.c:c32toa
Unexecuted instantiation: sha3.c:c32toa
Unexecuted instantiation: wolfmath.c:c32toa
Unexecuted instantiation: dh.c:c32toa
Unexecuted instantiation: asn.c:c32toa
Unexecuted instantiation: coding.c:c32toa
Unexecuted instantiation: poly1305.c:c32toa
Unexecuted instantiation: md5.c:c32toa
Unexecuted instantiation: chacha.c:c32toa
Unexecuted instantiation: ecc.c:c32toa
Unexecuted instantiation: internal.c:c32toa
Unexecuted instantiation: wc_encrypt.c:c32toa
Unexecuted instantiation: pwdbased.c:c32toa
442
#endif
443
444
#ifndef WOLFSSL_NO_INT_DECODE
445
/* convert a 24 bit integer into a 32 bit one */
446
WC_MISC_STATIC WC_INLINE void c24to32(const word24 wc_u24, word32* wc_u32)
447
0
{
448
0
    *wc_u32 = ((word32)wc_u24[0] << 16) |
449
0
              ((word32)wc_u24[1] << 8) |
450
0
               (word32)wc_u24[2];
451
0
}
Unexecuted instantiation: ssl.c:c24to32
Unexecuted instantiation: tls.c:c24to32
Unexecuted instantiation: tls13.c:c24to32
Unexecuted instantiation: hmac.c:c24to32
Unexecuted instantiation: hash.c:c24to32
Unexecuted instantiation: kdf.c:c24to32
Unexecuted instantiation: random.c:c24to32
Unexecuted instantiation: sha256.c:c24to32
Unexecuted instantiation: rsa.c:c24to32
Unexecuted instantiation: sp_int.c:c24to32
Unexecuted instantiation: aes.c:c24to32
Unexecuted instantiation: sha.c:c24to32
Unexecuted instantiation: sha512.c:c24to32
Unexecuted instantiation: sha3.c:c24to32
Unexecuted instantiation: wolfmath.c:c24to32
Unexecuted instantiation: dh.c:c24to32
Unexecuted instantiation: asn.c:c24to32
Unexecuted instantiation: coding.c:c24to32
Unexecuted instantiation: poly1305.c:c24to32
Unexecuted instantiation: md5.c:c24to32
Unexecuted instantiation: chacha.c:c24to32
Unexecuted instantiation: ecc.c:c24to32
Unexecuted instantiation: internal.c:c24to32
Unexecuted instantiation: wc_encrypt.c:c24to32
Unexecuted instantiation: pwdbased.c:c24to32
452
453
454
/* convert opaque to 24 bit integer */
455
WC_MISC_STATIC WC_INLINE void ato24(const byte* c, word32* wc_u24)
456
0
{
457
0
    *wc_u24 = ((word32)c[0] << 16) | ((word32)c[1] << 8) | c[2];
458
0
}
Unexecuted instantiation: ssl.c:ato24
Unexecuted instantiation: tls.c:ato24
Unexecuted instantiation: tls13.c:ato24
Unexecuted instantiation: hmac.c:ato24
Unexecuted instantiation: hash.c:ato24
Unexecuted instantiation: kdf.c:ato24
Unexecuted instantiation: random.c:ato24
Unexecuted instantiation: sha256.c:ato24
Unexecuted instantiation: rsa.c:ato24
Unexecuted instantiation: sp_int.c:ato24
Unexecuted instantiation: aes.c:ato24
Unexecuted instantiation: sha.c:ato24
Unexecuted instantiation: sha512.c:ato24
Unexecuted instantiation: sha3.c:ato24
Unexecuted instantiation: wolfmath.c:ato24
Unexecuted instantiation: dh.c:ato24
Unexecuted instantiation: asn.c:ato24
Unexecuted instantiation: coding.c:ato24
Unexecuted instantiation: poly1305.c:ato24
Unexecuted instantiation: md5.c:ato24
Unexecuted instantiation: chacha.c:ato24
Unexecuted instantiation: ecc.c:ato24
Unexecuted instantiation: internal.c:ato24
Unexecuted instantiation: wc_encrypt.c:ato24
Unexecuted instantiation: pwdbased.c:ato24
459
460
/* convert opaque to 16 bit integer */
461
WC_MISC_STATIC WC_INLINE void ato16(const byte* c, word16* wc_u16)
462
0
{
463
0
    *wc_u16 = (word16) ((c[0] << 8) | (c[1]));
464
0
}
Unexecuted instantiation: ssl.c:ato16
Unexecuted instantiation: tls.c:ato16
Unexecuted instantiation: tls13.c:ato16
Unexecuted instantiation: hmac.c:ato16
Unexecuted instantiation: hash.c:ato16
Unexecuted instantiation: kdf.c:ato16
Unexecuted instantiation: random.c:ato16
Unexecuted instantiation: sha256.c:ato16
Unexecuted instantiation: rsa.c:ato16
Unexecuted instantiation: sp_int.c:ato16
Unexecuted instantiation: aes.c:ato16
Unexecuted instantiation: sha.c:ato16
Unexecuted instantiation: sha512.c:ato16
Unexecuted instantiation: sha3.c:ato16
Unexecuted instantiation: wolfmath.c:ato16
Unexecuted instantiation: dh.c:ato16
Unexecuted instantiation: asn.c:ato16
Unexecuted instantiation: coding.c:ato16
Unexecuted instantiation: poly1305.c:ato16
Unexecuted instantiation: md5.c:ato16
Unexecuted instantiation: chacha.c:ato16
Unexecuted instantiation: ecc.c:ato16
Unexecuted instantiation: internal.c:ato16
Unexecuted instantiation: wc_encrypt.c:ato16
Unexecuted instantiation: pwdbased.c:ato16
465
466
/* convert opaque to 32 bit integer */
467
WC_MISC_STATIC WC_INLINE void ato32(const byte* c, word32* wc_u32)
468
0
{
469
0
    *wc_u32 = ((word32)c[0] << 24) |
470
0
              ((word32)c[1] << 16) |
471
0
              ((word32)c[2] << 8) |
472
0
               (word32)c[3];
473
0
}
Unexecuted instantiation: ssl.c:ato32
Unexecuted instantiation: tls.c:ato32
Unexecuted instantiation: tls13.c:ato32
Unexecuted instantiation: hmac.c:ato32
Unexecuted instantiation: hash.c:ato32
Unexecuted instantiation: kdf.c:ato32
Unexecuted instantiation: random.c:ato32
Unexecuted instantiation: sha256.c:ato32
Unexecuted instantiation: rsa.c:ato32
Unexecuted instantiation: sp_int.c:ato32
Unexecuted instantiation: aes.c:ato32
Unexecuted instantiation: sha.c:ato32
Unexecuted instantiation: sha512.c:ato32
Unexecuted instantiation: sha3.c:ato32
Unexecuted instantiation: wolfmath.c:ato32
Unexecuted instantiation: dh.c:ato32
Unexecuted instantiation: asn.c:ato32
Unexecuted instantiation: coding.c:ato32
Unexecuted instantiation: poly1305.c:ato32
Unexecuted instantiation: md5.c:ato32
Unexecuted instantiation: chacha.c:ato32
Unexecuted instantiation: ecc.c:ato32
Unexecuted instantiation: internal.c:ato32
Unexecuted instantiation: wc_encrypt.c:ato32
Unexecuted instantiation: pwdbased.c:ato32
474
475
476
WC_MISC_STATIC WC_INLINE word32 btoi(byte b)
477
0
{
478
0
    return (word32)(b - 0x30);
479
0
}
Unexecuted instantiation: ssl.c:btoi
Unexecuted instantiation: tls.c:btoi
Unexecuted instantiation: tls13.c:btoi
Unexecuted instantiation: hmac.c:btoi
Unexecuted instantiation: hash.c:btoi
Unexecuted instantiation: kdf.c:btoi
Unexecuted instantiation: random.c:btoi
Unexecuted instantiation: sha256.c:btoi
Unexecuted instantiation: rsa.c:btoi
Unexecuted instantiation: sp_int.c:btoi
Unexecuted instantiation: aes.c:btoi
Unexecuted instantiation: sha.c:btoi
Unexecuted instantiation: sha512.c:btoi
Unexecuted instantiation: sha3.c:btoi
Unexecuted instantiation: wolfmath.c:btoi
Unexecuted instantiation: dh.c:btoi
Unexecuted instantiation: asn.c:btoi
Unexecuted instantiation: coding.c:btoi
Unexecuted instantiation: poly1305.c:btoi
Unexecuted instantiation: md5.c:btoi
Unexecuted instantiation: chacha.c:btoi
Unexecuted instantiation: ecc.c:btoi
Unexecuted instantiation: internal.c:btoi
Unexecuted instantiation: wc_encrypt.c:btoi
Unexecuted instantiation: pwdbased.c:btoi
480
#endif
481
482
WC_MISC_STATIC WC_INLINE signed char HexCharToByte(char ch)
483
0
{
484
0
    signed char ret = (signed char)ch;
485
0
    if (ret >= '0' && ret <= '9')
486
0
        ret -= '0';
487
0
    else if (ret >= 'A' && ret <= 'F')
488
0
        ret -= 'A' - 10;
489
0
    else if (ret >= 'a' && ret <= 'f')
490
0
        ret -= 'a' - 10;
491
0
    else
492
0
        ret = -1; /* error case - return code must be signed */
493
0
    return ret;
494
0
}
Unexecuted instantiation: ssl.c:HexCharToByte
Unexecuted instantiation: tls.c:HexCharToByte
Unexecuted instantiation: tls13.c:HexCharToByte
Unexecuted instantiation: hmac.c:HexCharToByte
Unexecuted instantiation: hash.c:HexCharToByte
Unexecuted instantiation: kdf.c:HexCharToByte
Unexecuted instantiation: random.c:HexCharToByte
Unexecuted instantiation: sha256.c:HexCharToByte
Unexecuted instantiation: rsa.c:HexCharToByte
Unexecuted instantiation: sp_int.c:HexCharToByte
Unexecuted instantiation: aes.c:HexCharToByte
Unexecuted instantiation: sha.c:HexCharToByte
Unexecuted instantiation: sha512.c:HexCharToByte
Unexecuted instantiation: sha3.c:HexCharToByte
Unexecuted instantiation: wolfmath.c:HexCharToByte
Unexecuted instantiation: dh.c:HexCharToByte
Unexecuted instantiation: asn.c:HexCharToByte
Unexecuted instantiation: coding.c:HexCharToByte
Unexecuted instantiation: poly1305.c:HexCharToByte
Unexecuted instantiation: md5.c:HexCharToByte
Unexecuted instantiation: chacha.c:HexCharToByte
Unexecuted instantiation: ecc.c:HexCharToByte
Unexecuted instantiation: internal.c:HexCharToByte
Unexecuted instantiation: wc_encrypt.c:HexCharToByte
Unexecuted instantiation: pwdbased.c:HexCharToByte
495
496
WC_MISC_STATIC WC_INLINE char ByteToHex(byte in)
497
0
{
498
0
    static const char kHexChar[] = { '0', '1', '2', '3', '4', '5', '6', '7',
499
0
                                     '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
500
0
    return (char)(kHexChar[in & 0xF]);
501
0
}
Unexecuted instantiation: ssl.c:ByteToHex
Unexecuted instantiation: tls.c:ByteToHex
Unexecuted instantiation: tls13.c:ByteToHex
Unexecuted instantiation: hmac.c:ByteToHex
Unexecuted instantiation: hash.c:ByteToHex
Unexecuted instantiation: kdf.c:ByteToHex
Unexecuted instantiation: random.c:ByteToHex
Unexecuted instantiation: sha256.c:ByteToHex
Unexecuted instantiation: rsa.c:ByteToHex
Unexecuted instantiation: sp_int.c:ByteToHex
Unexecuted instantiation: aes.c:ByteToHex
Unexecuted instantiation: sha.c:ByteToHex
Unexecuted instantiation: sha512.c:ByteToHex
Unexecuted instantiation: sha3.c:ByteToHex
Unexecuted instantiation: wolfmath.c:ByteToHex
Unexecuted instantiation: dh.c:ByteToHex
Unexecuted instantiation: asn.c:ByteToHex
Unexecuted instantiation: coding.c:ByteToHex
Unexecuted instantiation: poly1305.c:ByteToHex
Unexecuted instantiation: md5.c:ByteToHex
Unexecuted instantiation: chacha.c:ByteToHex
Unexecuted instantiation: ecc.c:ByteToHex
Unexecuted instantiation: internal.c:ByteToHex
Unexecuted instantiation: wc_encrypt.c:ByteToHex
Unexecuted instantiation: pwdbased.c:ByteToHex
502
503
WC_MISC_STATIC WC_INLINE int ByteToHexStr(byte in, char* out)
504
0
{
505
0
    if (out == NULL)
506
0
        return -1;
507
0
508
0
    out[0] = ByteToHex((byte)(in >> 4));
509
0
    out[1] = ByteToHex((byte)(in & 0xf));
510
0
    return 0;
511
0
}
Unexecuted instantiation: ssl.c:ByteToHexStr
Unexecuted instantiation: tls.c:ByteToHexStr
Unexecuted instantiation: tls13.c:ByteToHexStr
Unexecuted instantiation: hmac.c:ByteToHexStr
Unexecuted instantiation: hash.c:ByteToHexStr
Unexecuted instantiation: kdf.c:ByteToHexStr
Unexecuted instantiation: random.c:ByteToHexStr
Unexecuted instantiation: sha256.c:ByteToHexStr
Unexecuted instantiation: rsa.c:ByteToHexStr
Unexecuted instantiation: sp_int.c:ByteToHexStr
Unexecuted instantiation: aes.c:ByteToHexStr
Unexecuted instantiation: sha.c:ByteToHexStr
Unexecuted instantiation: sha512.c:ByteToHexStr
Unexecuted instantiation: sha3.c:ByteToHexStr
Unexecuted instantiation: wolfmath.c:ByteToHexStr
Unexecuted instantiation: dh.c:ByteToHexStr
Unexecuted instantiation: asn.c:ByteToHexStr
Unexecuted instantiation: coding.c:ByteToHexStr
Unexecuted instantiation: poly1305.c:ByteToHexStr
Unexecuted instantiation: md5.c:ByteToHexStr
Unexecuted instantiation: chacha.c:ByteToHexStr
Unexecuted instantiation: ecc.c:ByteToHexStr
Unexecuted instantiation: internal.c:ByteToHexStr
Unexecuted instantiation: wc_encrypt.c:ByteToHexStr
Unexecuted instantiation: pwdbased.c:ByteToHexStr
512
513
#ifndef WOLFSSL_NO_CT_OPS
514
/* Constant time - mask set when a > b. */
515
WC_MISC_STATIC WC_INLINE byte ctMaskGT(int a, int b)
516
0
{
517
0
    return (byte)((((word32)a - (word32)b - 1) >> 31) - 1);
518
0
}
Unexecuted instantiation: ssl.c:ctMaskGT
Unexecuted instantiation: tls.c:ctMaskGT
Unexecuted instantiation: tls13.c:ctMaskGT
Unexecuted instantiation: hmac.c:ctMaskGT
Unexecuted instantiation: hash.c:ctMaskGT
Unexecuted instantiation: kdf.c:ctMaskGT
Unexecuted instantiation: random.c:ctMaskGT
Unexecuted instantiation: sha256.c:ctMaskGT
Unexecuted instantiation: rsa.c:ctMaskGT
Unexecuted instantiation: sp_int.c:ctMaskGT
Unexecuted instantiation: aes.c:ctMaskGT
Unexecuted instantiation: sha.c:ctMaskGT
Unexecuted instantiation: sha512.c:ctMaskGT
Unexecuted instantiation: sha3.c:ctMaskGT
Unexecuted instantiation: wolfmath.c:ctMaskGT
Unexecuted instantiation: dh.c:ctMaskGT
Unexecuted instantiation: asn.c:ctMaskGT
Unexecuted instantiation: coding.c:ctMaskGT
Unexecuted instantiation: poly1305.c:ctMaskGT
Unexecuted instantiation: md5.c:ctMaskGT
Unexecuted instantiation: chacha.c:ctMaskGT
Unexecuted instantiation: ecc.c:ctMaskGT
Unexecuted instantiation: internal.c:ctMaskGT
Unexecuted instantiation: wc_encrypt.c:ctMaskGT
Unexecuted instantiation: pwdbased.c:ctMaskGT
519
520
/* Constant time - mask set when a >= b. */
521
WC_MISC_STATIC WC_INLINE byte ctMaskGTE(int a, int b)
522
0
{
523
0
    return (byte)((((word32)a - (word32)b) >> 31) - 1);
524
0
}
Unexecuted instantiation: ssl.c:ctMaskGTE
Unexecuted instantiation: tls.c:ctMaskGTE
Unexecuted instantiation: tls13.c:ctMaskGTE
Unexecuted instantiation: hmac.c:ctMaskGTE
Unexecuted instantiation: hash.c:ctMaskGTE
Unexecuted instantiation: kdf.c:ctMaskGTE
Unexecuted instantiation: random.c:ctMaskGTE
Unexecuted instantiation: sha256.c:ctMaskGTE
Unexecuted instantiation: rsa.c:ctMaskGTE
Unexecuted instantiation: sp_int.c:ctMaskGTE
Unexecuted instantiation: aes.c:ctMaskGTE
Unexecuted instantiation: sha.c:ctMaskGTE
Unexecuted instantiation: sha512.c:ctMaskGTE
Unexecuted instantiation: sha3.c:ctMaskGTE
Unexecuted instantiation: wolfmath.c:ctMaskGTE
Unexecuted instantiation: dh.c:ctMaskGTE
Unexecuted instantiation: asn.c:ctMaskGTE
Unexecuted instantiation: coding.c:ctMaskGTE
Unexecuted instantiation: poly1305.c:ctMaskGTE
Unexecuted instantiation: md5.c:ctMaskGTE
Unexecuted instantiation: chacha.c:ctMaskGTE
Unexecuted instantiation: ecc.c:ctMaskGTE
Unexecuted instantiation: internal.c:ctMaskGTE
Unexecuted instantiation: wc_encrypt.c:ctMaskGTE
Unexecuted instantiation: pwdbased.c:ctMaskGTE
525
526
/* Constant time - mask set when a >= b. */
527
WC_MISC_STATIC WC_INLINE int ctMaskIntGTE(int a, int b)
528
0
{
529
0
    return (int)((((word32)a - (word32)b) >> 31) - 1);
530
0
}
Unexecuted instantiation: ssl.c:ctMaskIntGTE
Unexecuted instantiation: tls.c:ctMaskIntGTE
Unexecuted instantiation: tls13.c:ctMaskIntGTE
Unexecuted instantiation: hmac.c:ctMaskIntGTE
Unexecuted instantiation: hash.c:ctMaskIntGTE
Unexecuted instantiation: kdf.c:ctMaskIntGTE
Unexecuted instantiation: random.c:ctMaskIntGTE
Unexecuted instantiation: sha256.c:ctMaskIntGTE
Unexecuted instantiation: rsa.c:ctMaskIntGTE
Unexecuted instantiation: sp_int.c:ctMaskIntGTE
Unexecuted instantiation: aes.c:ctMaskIntGTE
Unexecuted instantiation: sha.c:ctMaskIntGTE
Unexecuted instantiation: sha512.c:ctMaskIntGTE
Unexecuted instantiation: sha3.c:ctMaskIntGTE
Unexecuted instantiation: wolfmath.c:ctMaskIntGTE
Unexecuted instantiation: dh.c:ctMaskIntGTE
Unexecuted instantiation: asn.c:ctMaskIntGTE
Unexecuted instantiation: coding.c:ctMaskIntGTE
Unexecuted instantiation: poly1305.c:ctMaskIntGTE
Unexecuted instantiation: md5.c:ctMaskIntGTE
Unexecuted instantiation: chacha.c:ctMaskIntGTE
Unexecuted instantiation: ecc.c:ctMaskIntGTE
Unexecuted instantiation: internal.c:ctMaskIntGTE
Unexecuted instantiation: wc_encrypt.c:ctMaskIntGTE
Unexecuted instantiation: pwdbased.c:ctMaskIntGTE
531
532
/* Constant time - mask set when a < b. */
533
WC_MISC_STATIC WC_INLINE byte ctMaskLT(int a, int b)
534
0
{
535
0
    return (byte)((((word32)b - (word32)a - 1) >> 31) - 1);
536
0
}
Unexecuted instantiation: ssl.c:ctMaskLT
Unexecuted instantiation: tls.c:ctMaskLT
Unexecuted instantiation: tls13.c:ctMaskLT
Unexecuted instantiation: hmac.c:ctMaskLT
Unexecuted instantiation: hash.c:ctMaskLT
Unexecuted instantiation: kdf.c:ctMaskLT
Unexecuted instantiation: random.c:ctMaskLT
Unexecuted instantiation: sha256.c:ctMaskLT
Unexecuted instantiation: rsa.c:ctMaskLT
Unexecuted instantiation: sp_int.c:ctMaskLT
Unexecuted instantiation: aes.c:ctMaskLT
Unexecuted instantiation: sha.c:ctMaskLT
Unexecuted instantiation: sha512.c:ctMaskLT
Unexecuted instantiation: sha3.c:ctMaskLT
Unexecuted instantiation: wolfmath.c:ctMaskLT
Unexecuted instantiation: dh.c:ctMaskLT
Unexecuted instantiation: asn.c:ctMaskLT
Unexecuted instantiation: coding.c:ctMaskLT
Unexecuted instantiation: poly1305.c:ctMaskLT
Unexecuted instantiation: md5.c:ctMaskLT
Unexecuted instantiation: chacha.c:ctMaskLT
Unexecuted instantiation: ecc.c:ctMaskLT
Unexecuted instantiation: internal.c:ctMaskLT
Unexecuted instantiation: wc_encrypt.c:ctMaskLT
Unexecuted instantiation: pwdbased.c:ctMaskLT
537
538
/* Constant time - mask set when a <= b. */
539
WC_MISC_STATIC WC_INLINE byte ctMaskLTE(int a, int b)
540
0
{
541
0
    return (byte)((((word32)b - (word32)a) >> 31) - 1);
542
0
}
Unexecuted instantiation: ssl.c:ctMaskLTE
Unexecuted instantiation: tls.c:ctMaskLTE
Unexecuted instantiation: tls13.c:ctMaskLTE
Unexecuted instantiation: hmac.c:ctMaskLTE
Unexecuted instantiation: hash.c:ctMaskLTE
Unexecuted instantiation: kdf.c:ctMaskLTE
Unexecuted instantiation: random.c:ctMaskLTE
Unexecuted instantiation: sha256.c:ctMaskLTE
Unexecuted instantiation: rsa.c:ctMaskLTE
Unexecuted instantiation: sp_int.c:ctMaskLTE
Unexecuted instantiation: aes.c:ctMaskLTE
Unexecuted instantiation: sha.c:ctMaskLTE
Unexecuted instantiation: sha512.c:ctMaskLTE
Unexecuted instantiation: sha3.c:ctMaskLTE
Unexecuted instantiation: wolfmath.c:ctMaskLTE
Unexecuted instantiation: dh.c:ctMaskLTE
Unexecuted instantiation: asn.c:ctMaskLTE
Unexecuted instantiation: coding.c:ctMaskLTE
Unexecuted instantiation: poly1305.c:ctMaskLTE
Unexecuted instantiation: md5.c:ctMaskLTE
Unexecuted instantiation: chacha.c:ctMaskLTE
Unexecuted instantiation: ecc.c:ctMaskLTE
Unexecuted instantiation: internal.c:ctMaskLTE
Unexecuted instantiation: wc_encrypt.c:ctMaskLTE
Unexecuted instantiation: pwdbased.c:ctMaskLTE
543
544
/* Constant time - mask set when a == b. */
545
WC_MISC_STATIC WC_INLINE byte ctMaskEq(int a, int b)
546
0
{
547
0
    return (byte)((byte)(~ctMaskGT(a, b)) & (byte)(~ctMaskLT(a, b)));
548
0
}
Unexecuted instantiation: ssl.c:ctMaskEq
Unexecuted instantiation: tls.c:ctMaskEq
Unexecuted instantiation: tls13.c:ctMaskEq
Unexecuted instantiation: hmac.c:ctMaskEq
Unexecuted instantiation: hash.c:ctMaskEq
Unexecuted instantiation: kdf.c:ctMaskEq
Unexecuted instantiation: random.c:ctMaskEq
Unexecuted instantiation: sha256.c:ctMaskEq
Unexecuted instantiation: rsa.c:ctMaskEq
Unexecuted instantiation: sp_int.c:ctMaskEq
Unexecuted instantiation: aes.c:ctMaskEq
Unexecuted instantiation: sha.c:ctMaskEq
Unexecuted instantiation: sha512.c:ctMaskEq
Unexecuted instantiation: sha3.c:ctMaskEq
Unexecuted instantiation: wolfmath.c:ctMaskEq
Unexecuted instantiation: dh.c:ctMaskEq
Unexecuted instantiation: asn.c:ctMaskEq
Unexecuted instantiation: coding.c:ctMaskEq
Unexecuted instantiation: poly1305.c:ctMaskEq
Unexecuted instantiation: md5.c:ctMaskEq
Unexecuted instantiation: chacha.c:ctMaskEq
Unexecuted instantiation: ecc.c:ctMaskEq
Unexecuted instantiation: internal.c:ctMaskEq
Unexecuted instantiation: wc_encrypt.c:ctMaskEq
Unexecuted instantiation: pwdbased.c:ctMaskEq
549
550
/* Constant time - sets 16 bit integer mask when a > b */
551
WC_MISC_STATIC WC_INLINE word16 ctMask16GT(int a, int b)
552
0
{
553
0
    return (word16)((((word32)a - (word32)b - 1) >> 31) - 1);
554
0
}
Unexecuted instantiation: ssl.c:ctMask16GT
Unexecuted instantiation: tls.c:ctMask16GT
Unexecuted instantiation: tls13.c:ctMask16GT
Unexecuted instantiation: hmac.c:ctMask16GT
Unexecuted instantiation: hash.c:ctMask16GT
Unexecuted instantiation: kdf.c:ctMask16GT
Unexecuted instantiation: random.c:ctMask16GT
Unexecuted instantiation: sha256.c:ctMask16GT
Unexecuted instantiation: rsa.c:ctMask16GT
Unexecuted instantiation: sp_int.c:ctMask16GT
Unexecuted instantiation: aes.c:ctMask16GT
Unexecuted instantiation: sha.c:ctMask16GT
Unexecuted instantiation: sha512.c:ctMask16GT
Unexecuted instantiation: sha3.c:ctMask16GT
Unexecuted instantiation: wolfmath.c:ctMask16GT
Unexecuted instantiation: dh.c:ctMask16GT
Unexecuted instantiation: asn.c:ctMask16GT
Unexecuted instantiation: coding.c:ctMask16GT
Unexecuted instantiation: poly1305.c:ctMask16GT
Unexecuted instantiation: md5.c:ctMask16GT
Unexecuted instantiation: chacha.c:ctMask16GT
Unexecuted instantiation: ecc.c:ctMask16GT
Unexecuted instantiation: internal.c:ctMask16GT
Unexecuted instantiation: wc_encrypt.c:ctMask16GT
Unexecuted instantiation: pwdbased.c:ctMask16GT
555
556
/* Constant time - sets 16 bit integer mask when a >= b */
557
WC_MISC_STATIC WC_INLINE word16 ctMask16GTE(int a, int b)
558
0
{
559
0
    return (word16)((((word32)a - (word32)b) >> 31) - 1);
560
0
}
Unexecuted instantiation: ssl.c:ctMask16GTE
Unexecuted instantiation: tls.c:ctMask16GTE
Unexecuted instantiation: tls13.c:ctMask16GTE
Unexecuted instantiation: hmac.c:ctMask16GTE
Unexecuted instantiation: hash.c:ctMask16GTE
Unexecuted instantiation: kdf.c:ctMask16GTE
Unexecuted instantiation: random.c:ctMask16GTE
Unexecuted instantiation: sha256.c:ctMask16GTE
Unexecuted instantiation: rsa.c:ctMask16GTE
Unexecuted instantiation: sp_int.c:ctMask16GTE
Unexecuted instantiation: aes.c:ctMask16GTE
Unexecuted instantiation: sha.c:ctMask16GTE
Unexecuted instantiation: sha512.c:ctMask16GTE
Unexecuted instantiation: sha3.c:ctMask16GTE
Unexecuted instantiation: wolfmath.c:ctMask16GTE
Unexecuted instantiation: dh.c:ctMask16GTE
Unexecuted instantiation: asn.c:ctMask16GTE
Unexecuted instantiation: coding.c:ctMask16GTE
Unexecuted instantiation: poly1305.c:ctMask16GTE
Unexecuted instantiation: md5.c:ctMask16GTE
Unexecuted instantiation: chacha.c:ctMask16GTE
Unexecuted instantiation: ecc.c:ctMask16GTE
Unexecuted instantiation: internal.c:ctMask16GTE
Unexecuted instantiation: wc_encrypt.c:ctMask16GTE
Unexecuted instantiation: pwdbased.c:ctMask16GTE
561
562
/* Constant time - sets 16 bit integer mask when a < b. */
563
WC_MISC_STATIC WC_INLINE word16 ctMask16LT(int a, int b)
564
0
{
565
0
    return (word16)((((word32)b - (word32)a - 1) >> 31) - 1);
566
0
}
Unexecuted instantiation: ssl.c:ctMask16LT
Unexecuted instantiation: tls.c:ctMask16LT
Unexecuted instantiation: tls13.c:ctMask16LT
Unexecuted instantiation: hmac.c:ctMask16LT
Unexecuted instantiation: hash.c:ctMask16LT
Unexecuted instantiation: kdf.c:ctMask16LT
Unexecuted instantiation: random.c:ctMask16LT
Unexecuted instantiation: sha256.c:ctMask16LT
Unexecuted instantiation: rsa.c:ctMask16LT
Unexecuted instantiation: sp_int.c:ctMask16LT
Unexecuted instantiation: aes.c:ctMask16LT
Unexecuted instantiation: sha.c:ctMask16LT
Unexecuted instantiation: sha512.c:ctMask16LT
Unexecuted instantiation: sha3.c:ctMask16LT
Unexecuted instantiation: wolfmath.c:ctMask16LT
Unexecuted instantiation: dh.c:ctMask16LT
Unexecuted instantiation: asn.c:ctMask16LT
Unexecuted instantiation: coding.c:ctMask16LT
Unexecuted instantiation: poly1305.c:ctMask16LT
Unexecuted instantiation: md5.c:ctMask16LT
Unexecuted instantiation: chacha.c:ctMask16LT
Unexecuted instantiation: ecc.c:ctMask16LT
Unexecuted instantiation: internal.c:ctMask16LT
Unexecuted instantiation: wc_encrypt.c:ctMask16LT
Unexecuted instantiation: pwdbased.c:ctMask16LT
567
568
/* Constant time - sets 16 bit integer mask when a <= b. */
569
WC_MISC_STATIC WC_INLINE word16 ctMask16LTE(int a, int b)
570
0
{
571
0
    return (word16)((((word32)b - (word32)a) >> 31) - 1);
572
0
}
Unexecuted instantiation: ssl.c:ctMask16LTE
Unexecuted instantiation: tls.c:ctMask16LTE
Unexecuted instantiation: tls13.c:ctMask16LTE
Unexecuted instantiation: hmac.c:ctMask16LTE
Unexecuted instantiation: hash.c:ctMask16LTE
Unexecuted instantiation: kdf.c:ctMask16LTE
Unexecuted instantiation: random.c:ctMask16LTE
Unexecuted instantiation: sha256.c:ctMask16LTE
Unexecuted instantiation: rsa.c:ctMask16LTE
Unexecuted instantiation: sp_int.c:ctMask16LTE
Unexecuted instantiation: aes.c:ctMask16LTE
Unexecuted instantiation: sha.c:ctMask16LTE
Unexecuted instantiation: sha512.c:ctMask16LTE
Unexecuted instantiation: sha3.c:ctMask16LTE
Unexecuted instantiation: wolfmath.c:ctMask16LTE
Unexecuted instantiation: dh.c:ctMask16LTE
Unexecuted instantiation: asn.c:ctMask16LTE
Unexecuted instantiation: coding.c:ctMask16LTE
Unexecuted instantiation: poly1305.c:ctMask16LTE
Unexecuted instantiation: md5.c:ctMask16LTE
Unexecuted instantiation: chacha.c:ctMask16LTE
Unexecuted instantiation: ecc.c:ctMask16LTE
Unexecuted instantiation: internal.c:ctMask16LTE
Unexecuted instantiation: wc_encrypt.c:ctMask16LTE
Unexecuted instantiation: pwdbased.c:ctMask16LTE
573
574
/* Constant time - sets 16 bit integer mask when a == b. */
575
WC_MISC_STATIC WC_INLINE word16 ctMask16Eq(int a, int b)
576
0
{
577
0
    return (word16)((word16)(~ctMask16GT(a, b)) & (word16)(~ctMask16LT(a, b)));
578
0
}
Unexecuted instantiation: ssl.c:ctMask16Eq
Unexecuted instantiation: tls.c:ctMask16Eq
Unexecuted instantiation: tls13.c:ctMask16Eq
Unexecuted instantiation: hmac.c:ctMask16Eq
Unexecuted instantiation: hash.c:ctMask16Eq
Unexecuted instantiation: kdf.c:ctMask16Eq
Unexecuted instantiation: random.c:ctMask16Eq
Unexecuted instantiation: sha256.c:ctMask16Eq
Unexecuted instantiation: rsa.c:ctMask16Eq
Unexecuted instantiation: sp_int.c:ctMask16Eq
Unexecuted instantiation: aes.c:ctMask16Eq
Unexecuted instantiation: sha.c:ctMask16Eq
Unexecuted instantiation: sha512.c:ctMask16Eq
Unexecuted instantiation: sha3.c:ctMask16Eq
Unexecuted instantiation: wolfmath.c:ctMask16Eq
Unexecuted instantiation: dh.c:ctMask16Eq
Unexecuted instantiation: asn.c:ctMask16Eq
Unexecuted instantiation: coding.c:ctMask16Eq
Unexecuted instantiation: poly1305.c:ctMask16Eq
Unexecuted instantiation: md5.c:ctMask16Eq
Unexecuted instantiation: chacha.c:ctMask16Eq
Unexecuted instantiation: ecc.c:ctMask16Eq
Unexecuted instantiation: internal.c:ctMask16Eq
Unexecuted instantiation: wc_encrypt.c:ctMask16Eq
Unexecuted instantiation: pwdbased.c:ctMask16Eq
579
580
/* Constant time - mask set when a != b. */
581
WC_MISC_STATIC WC_INLINE byte ctMaskNotEq(int a, int b)
582
0
{
583
0
    return (byte)((byte)ctMaskGT(a, b) | (byte)ctMaskLT(a, b));
584
0
}
Unexecuted instantiation: ssl.c:ctMaskNotEq
Unexecuted instantiation: tls.c:ctMaskNotEq
Unexecuted instantiation: tls13.c:ctMaskNotEq
Unexecuted instantiation: hmac.c:ctMaskNotEq
Unexecuted instantiation: hash.c:ctMaskNotEq
Unexecuted instantiation: kdf.c:ctMaskNotEq
Unexecuted instantiation: random.c:ctMaskNotEq
Unexecuted instantiation: sha256.c:ctMaskNotEq
Unexecuted instantiation: rsa.c:ctMaskNotEq
Unexecuted instantiation: sp_int.c:ctMaskNotEq
Unexecuted instantiation: aes.c:ctMaskNotEq
Unexecuted instantiation: sha.c:ctMaskNotEq
Unexecuted instantiation: sha512.c:ctMaskNotEq
Unexecuted instantiation: sha3.c:ctMaskNotEq
Unexecuted instantiation: wolfmath.c:ctMaskNotEq
Unexecuted instantiation: dh.c:ctMaskNotEq
Unexecuted instantiation: asn.c:ctMaskNotEq
Unexecuted instantiation: coding.c:ctMaskNotEq
Unexecuted instantiation: poly1305.c:ctMaskNotEq
Unexecuted instantiation: md5.c:ctMaskNotEq
Unexecuted instantiation: chacha.c:ctMaskNotEq
Unexecuted instantiation: ecc.c:ctMaskNotEq
Unexecuted instantiation: internal.c:ctMaskNotEq
Unexecuted instantiation: wc_encrypt.c:ctMaskNotEq
Unexecuted instantiation: pwdbased.c:ctMaskNotEq
585
586
/* Constant time - select a when mask is set and b otherwise. */
587
WC_MISC_STATIC WC_INLINE byte ctMaskSel(byte m, byte a, byte b)
588
0
{
589
0
    return (byte)((b & ((byte)~(word32)m)) | (a & m));
590
0
}
Unexecuted instantiation: ssl.c:ctMaskSel
Unexecuted instantiation: tls.c:ctMaskSel
Unexecuted instantiation: tls13.c:ctMaskSel
Unexecuted instantiation: hmac.c:ctMaskSel
Unexecuted instantiation: hash.c:ctMaskSel
Unexecuted instantiation: kdf.c:ctMaskSel
Unexecuted instantiation: random.c:ctMaskSel
Unexecuted instantiation: sha256.c:ctMaskSel
Unexecuted instantiation: rsa.c:ctMaskSel
Unexecuted instantiation: sp_int.c:ctMaskSel
Unexecuted instantiation: aes.c:ctMaskSel
Unexecuted instantiation: sha.c:ctMaskSel
Unexecuted instantiation: sha512.c:ctMaskSel
Unexecuted instantiation: sha3.c:ctMaskSel
Unexecuted instantiation: wolfmath.c:ctMaskSel
Unexecuted instantiation: dh.c:ctMaskSel
Unexecuted instantiation: asn.c:ctMaskSel
Unexecuted instantiation: coding.c:ctMaskSel
Unexecuted instantiation: poly1305.c:ctMaskSel
Unexecuted instantiation: md5.c:ctMaskSel
Unexecuted instantiation: chacha.c:ctMaskSel
Unexecuted instantiation: ecc.c:ctMaskSel
Unexecuted instantiation: internal.c:ctMaskSel
Unexecuted instantiation: wc_encrypt.c:ctMaskSel
Unexecuted instantiation: pwdbased.c:ctMaskSel
591
592
/* Constant time - select integer a when mask is set and integer b otherwise. */
593
WC_MISC_STATIC WC_INLINE int ctMaskSelInt(byte m, int a, int b)
594
0
{
595
0
    return (b & (~(signed int)(signed char)m)) |
596
0
           (a & ( (signed int)(signed char)m));
597
0
}
Unexecuted instantiation: ssl.c:ctMaskSelInt
Unexecuted instantiation: tls.c:ctMaskSelInt
Unexecuted instantiation: tls13.c:ctMaskSelInt
Unexecuted instantiation: hmac.c:ctMaskSelInt
Unexecuted instantiation: hash.c:ctMaskSelInt
Unexecuted instantiation: kdf.c:ctMaskSelInt
Unexecuted instantiation: random.c:ctMaskSelInt
Unexecuted instantiation: sha256.c:ctMaskSelInt
Unexecuted instantiation: rsa.c:ctMaskSelInt
Unexecuted instantiation: sp_int.c:ctMaskSelInt
Unexecuted instantiation: aes.c:ctMaskSelInt
Unexecuted instantiation: sha.c:ctMaskSelInt
Unexecuted instantiation: sha512.c:ctMaskSelInt
Unexecuted instantiation: sha3.c:ctMaskSelInt
Unexecuted instantiation: wolfmath.c:ctMaskSelInt
Unexecuted instantiation: dh.c:ctMaskSelInt
Unexecuted instantiation: asn.c:ctMaskSelInt
Unexecuted instantiation: coding.c:ctMaskSelInt
Unexecuted instantiation: poly1305.c:ctMaskSelInt
Unexecuted instantiation: md5.c:ctMaskSelInt
Unexecuted instantiation: chacha.c:ctMaskSelInt
Unexecuted instantiation: ecc.c:ctMaskSelInt
Unexecuted instantiation: internal.c:ctMaskSelInt
Unexecuted instantiation: wc_encrypt.c:ctMaskSelInt
Unexecuted instantiation: pwdbased.c:ctMaskSelInt
598
599
/* Constant time - select word32 a when mask is set and word32 b otherwise. */
600
WC_MISC_STATIC WC_INLINE word32 ctMaskSelWord32(byte m, word32 a, word32 b)
601
0
{
602
0
    return (((word32)b & (word32)(~(signed int)(signed char)m)) |
603
0
            ((word32)a & (word32)( (signed int)(signed char)m)));
604
0
}
Unexecuted instantiation: ssl.c:ctMaskSelWord32
Unexecuted instantiation: tls.c:ctMaskSelWord32
Unexecuted instantiation: tls13.c:ctMaskSelWord32
Unexecuted instantiation: hmac.c:ctMaskSelWord32
Unexecuted instantiation: hash.c:ctMaskSelWord32
Unexecuted instantiation: kdf.c:ctMaskSelWord32
Unexecuted instantiation: random.c:ctMaskSelWord32
Unexecuted instantiation: sha256.c:ctMaskSelWord32
Unexecuted instantiation: rsa.c:ctMaskSelWord32
Unexecuted instantiation: sp_int.c:ctMaskSelWord32
Unexecuted instantiation: aes.c:ctMaskSelWord32
Unexecuted instantiation: sha.c:ctMaskSelWord32
Unexecuted instantiation: sha512.c:ctMaskSelWord32
Unexecuted instantiation: sha3.c:ctMaskSelWord32
Unexecuted instantiation: wolfmath.c:ctMaskSelWord32
Unexecuted instantiation: dh.c:ctMaskSelWord32
Unexecuted instantiation: asn.c:ctMaskSelWord32
Unexecuted instantiation: coding.c:ctMaskSelWord32
Unexecuted instantiation: poly1305.c:ctMaskSelWord32
Unexecuted instantiation: md5.c:ctMaskSelWord32
Unexecuted instantiation: chacha.c:ctMaskSelWord32
Unexecuted instantiation: ecc.c:ctMaskSelWord32
Unexecuted instantiation: internal.c:ctMaskSelWord32
Unexecuted instantiation: wc_encrypt.c:ctMaskSelWord32
Unexecuted instantiation: pwdbased.c:ctMaskSelWord32
605
606
/* Constant time - bit set when a <= b. */
607
WC_MISC_STATIC WC_INLINE byte ctSetLTE(int a, int b)
608
0
{
609
0
    return (byte)(((word32)a - (word32)b - 1) >> 31);
610
0
}
Unexecuted instantiation: ssl.c:ctSetLTE
Unexecuted instantiation: tls.c:ctSetLTE
Unexecuted instantiation: tls13.c:ctSetLTE
Unexecuted instantiation: hmac.c:ctSetLTE
Unexecuted instantiation: hash.c:ctSetLTE
Unexecuted instantiation: kdf.c:ctSetLTE
Unexecuted instantiation: random.c:ctSetLTE
Unexecuted instantiation: sha256.c:ctSetLTE
Unexecuted instantiation: rsa.c:ctSetLTE
Unexecuted instantiation: sp_int.c:ctSetLTE
Unexecuted instantiation: aes.c:ctSetLTE
Unexecuted instantiation: sha.c:ctSetLTE
Unexecuted instantiation: sha512.c:ctSetLTE
Unexecuted instantiation: sha3.c:ctSetLTE
Unexecuted instantiation: wolfmath.c:ctSetLTE
Unexecuted instantiation: dh.c:ctSetLTE
Unexecuted instantiation: asn.c:ctSetLTE
Unexecuted instantiation: coding.c:ctSetLTE
Unexecuted instantiation: poly1305.c:ctSetLTE
Unexecuted instantiation: md5.c:ctSetLTE
Unexecuted instantiation: chacha.c:ctSetLTE
Unexecuted instantiation: ecc.c:ctSetLTE
Unexecuted instantiation: internal.c:ctSetLTE
Unexecuted instantiation: wc_encrypt.c:ctSetLTE
Unexecuted instantiation: pwdbased.c:ctSetLTE
611
612
/* Constant time - conditionally copy size bytes from src to dst if mask is set
613
 */
614
WC_MISC_STATIC WC_INLINE void ctMaskCopy(byte mask, byte* dst, byte* src,
615
    word16 size)
616
0
{
617
0
    int i;
618
0
    for (i = 0; i < size; ++i) {
619
0
        dst[i] ^= (dst[i] ^ src[i]) & mask;
620
0
    }
621
0
}
Unexecuted instantiation: ssl.c:ctMaskCopy
Unexecuted instantiation: tls.c:ctMaskCopy
Unexecuted instantiation: tls13.c:ctMaskCopy
Unexecuted instantiation: hmac.c:ctMaskCopy
Unexecuted instantiation: hash.c:ctMaskCopy
Unexecuted instantiation: kdf.c:ctMaskCopy
Unexecuted instantiation: random.c:ctMaskCopy
Unexecuted instantiation: sha256.c:ctMaskCopy
Unexecuted instantiation: rsa.c:ctMaskCopy
Unexecuted instantiation: sp_int.c:ctMaskCopy
Unexecuted instantiation: aes.c:ctMaskCopy
Unexecuted instantiation: sha.c:ctMaskCopy
Unexecuted instantiation: sha512.c:ctMaskCopy
Unexecuted instantiation: sha3.c:ctMaskCopy
Unexecuted instantiation: wolfmath.c:ctMaskCopy
Unexecuted instantiation: dh.c:ctMaskCopy
Unexecuted instantiation: asn.c:ctMaskCopy
Unexecuted instantiation: coding.c:ctMaskCopy
Unexecuted instantiation: poly1305.c:ctMaskCopy
Unexecuted instantiation: md5.c:ctMaskCopy
Unexecuted instantiation: chacha.c:ctMaskCopy
Unexecuted instantiation: ecc.c:ctMaskCopy
Unexecuted instantiation: internal.c:ctMaskCopy
Unexecuted instantiation: wc_encrypt.c:ctMaskCopy
Unexecuted instantiation: pwdbased.c:ctMaskCopy
622
623
#endif
624
625
#if defined(WOLFSSL_W64_WRAPPER)
626
#if defined(WORD64_AVAILABLE) && !defined(WOLFSSL_W64_WRAPPER_TEST)
627
0
WC_MISC_STATIC WC_INLINE void w64Increment(w64wrapper *n) {
628
0
    n->n++;
629
0
}
Unexecuted instantiation: ssl.c:w64Increment
Unexecuted instantiation: tls.c:w64Increment
Unexecuted instantiation: tls13.c:w64Increment
Unexecuted instantiation: hmac.c:w64Increment
Unexecuted instantiation: hash.c:w64Increment
Unexecuted instantiation: kdf.c:w64Increment
Unexecuted instantiation: random.c:w64Increment
Unexecuted instantiation: sha256.c:w64Increment
Unexecuted instantiation: rsa.c:w64Increment
Unexecuted instantiation: sp_int.c:w64Increment
Unexecuted instantiation: aes.c:w64Increment
Unexecuted instantiation: sha.c:w64Increment
Unexecuted instantiation: sha512.c:w64Increment
Unexecuted instantiation: sha3.c:w64Increment
Unexecuted instantiation: wolfmath.c:w64Increment
Unexecuted instantiation: dh.c:w64Increment
Unexecuted instantiation: asn.c:w64Increment
Unexecuted instantiation: coding.c:w64Increment
Unexecuted instantiation: poly1305.c:w64Increment
Unexecuted instantiation: md5.c:w64Increment
Unexecuted instantiation: chacha.c:w64Increment
Unexecuted instantiation: ecc.c:w64Increment
Unexecuted instantiation: internal.c:w64Increment
Unexecuted instantiation: wc_encrypt.c:w64Increment
Unexecuted instantiation: pwdbased.c:w64Increment
630
631
0
WC_MISC_STATIC WC_INLINE void w64Decrement(w64wrapper *n) {
632
0
    n->n--;
633
0
}
Unexecuted instantiation: ssl.c:w64Decrement
Unexecuted instantiation: tls.c:w64Decrement
Unexecuted instantiation: tls13.c:w64Decrement
Unexecuted instantiation: hmac.c:w64Decrement
Unexecuted instantiation: hash.c:w64Decrement
Unexecuted instantiation: kdf.c:w64Decrement
Unexecuted instantiation: random.c:w64Decrement
Unexecuted instantiation: sha256.c:w64Decrement
Unexecuted instantiation: rsa.c:w64Decrement
Unexecuted instantiation: sp_int.c:w64Decrement
Unexecuted instantiation: aes.c:w64Decrement
Unexecuted instantiation: sha.c:w64Decrement
Unexecuted instantiation: sha512.c:w64Decrement
Unexecuted instantiation: sha3.c:w64Decrement
Unexecuted instantiation: wolfmath.c:w64Decrement
Unexecuted instantiation: dh.c:w64Decrement
Unexecuted instantiation: asn.c:w64Decrement
Unexecuted instantiation: coding.c:w64Decrement
Unexecuted instantiation: poly1305.c:w64Decrement
Unexecuted instantiation: md5.c:w64Decrement
Unexecuted instantiation: chacha.c:w64Decrement
Unexecuted instantiation: ecc.c:w64Decrement
Unexecuted instantiation: internal.c:w64Decrement
Unexecuted instantiation: wc_encrypt.c:w64Decrement
Unexecuted instantiation: pwdbased.c:w64Decrement
634
635
0
WC_MISC_STATIC WC_INLINE byte w64Equal(w64wrapper a, w64wrapper b) {
636
0
    return (a.n == b.n);
637
0
}
Unexecuted instantiation: ssl.c:w64Equal
Unexecuted instantiation: tls.c:w64Equal
Unexecuted instantiation: tls13.c:w64Equal
Unexecuted instantiation: hmac.c:w64Equal
Unexecuted instantiation: hash.c:w64Equal
Unexecuted instantiation: kdf.c:w64Equal
Unexecuted instantiation: random.c:w64Equal
Unexecuted instantiation: sha256.c:w64Equal
Unexecuted instantiation: rsa.c:w64Equal
Unexecuted instantiation: sp_int.c:w64Equal
Unexecuted instantiation: aes.c:w64Equal
Unexecuted instantiation: sha.c:w64Equal
Unexecuted instantiation: sha512.c:w64Equal
Unexecuted instantiation: sha3.c:w64Equal
Unexecuted instantiation: wolfmath.c:w64Equal
Unexecuted instantiation: dh.c:w64Equal
Unexecuted instantiation: asn.c:w64Equal
Unexecuted instantiation: coding.c:w64Equal
Unexecuted instantiation: poly1305.c:w64Equal
Unexecuted instantiation: md5.c:w64Equal
Unexecuted instantiation: chacha.c:w64Equal
Unexecuted instantiation: ecc.c:w64Equal
Unexecuted instantiation: internal.c:w64Equal
Unexecuted instantiation: wc_encrypt.c:w64Equal
Unexecuted instantiation: pwdbased.c:w64Equal
638
639
0
WC_MISC_STATIC WC_INLINE word32 w64GetLow32(w64wrapper n) {
640
0
    return (word32)n.n;
641
0
}
Unexecuted instantiation: ssl.c:w64GetLow32
Unexecuted instantiation: tls.c:w64GetLow32
Unexecuted instantiation: tls13.c:w64GetLow32
Unexecuted instantiation: hmac.c:w64GetLow32
Unexecuted instantiation: hash.c:w64GetLow32
Unexecuted instantiation: kdf.c:w64GetLow32
Unexecuted instantiation: random.c:w64GetLow32
Unexecuted instantiation: sha256.c:w64GetLow32
Unexecuted instantiation: rsa.c:w64GetLow32
Unexecuted instantiation: sp_int.c:w64GetLow32
Unexecuted instantiation: aes.c:w64GetLow32
Unexecuted instantiation: sha.c:w64GetLow32
Unexecuted instantiation: sha512.c:w64GetLow32
Unexecuted instantiation: sha3.c:w64GetLow32
Unexecuted instantiation: wolfmath.c:w64GetLow32
Unexecuted instantiation: dh.c:w64GetLow32
Unexecuted instantiation: asn.c:w64GetLow32
Unexecuted instantiation: coding.c:w64GetLow32
Unexecuted instantiation: poly1305.c:w64GetLow32
Unexecuted instantiation: md5.c:w64GetLow32
Unexecuted instantiation: chacha.c:w64GetLow32
Unexecuted instantiation: ecc.c:w64GetLow32
Unexecuted instantiation: internal.c:w64GetLow32
Unexecuted instantiation: wc_encrypt.c:w64GetLow32
Unexecuted instantiation: pwdbased.c:w64GetLow32
642
643
0
WC_MISC_STATIC WC_INLINE word32 w64GetHigh32(w64wrapper n) {
644
0
    return (word32)(n.n >> 32);
645
0
}
Unexecuted instantiation: ssl.c:w64GetHigh32
Unexecuted instantiation: tls.c:w64GetHigh32
Unexecuted instantiation: tls13.c:w64GetHigh32
Unexecuted instantiation: hmac.c:w64GetHigh32
Unexecuted instantiation: hash.c:w64GetHigh32
Unexecuted instantiation: kdf.c:w64GetHigh32
Unexecuted instantiation: random.c:w64GetHigh32
Unexecuted instantiation: sha256.c:w64GetHigh32
Unexecuted instantiation: rsa.c:w64GetHigh32
Unexecuted instantiation: sp_int.c:w64GetHigh32
Unexecuted instantiation: aes.c:w64GetHigh32
Unexecuted instantiation: sha.c:w64GetHigh32
Unexecuted instantiation: sha512.c:w64GetHigh32
Unexecuted instantiation: sha3.c:w64GetHigh32
Unexecuted instantiation: wolfmath.c:w64GetHigh32
Unexecuted instantiation: dh.c:w64GetHigh32
Unexecuted instantiation: asn.c:w64GetHigh32
Unexecuted instantiation: coding.c:w64GetHigh32
Unexecuted instantiation: poly1305.c:w64GetHigh32
Unexecuted instantiation: md5.c:w64GetHigh32
Unexecuted instantiation: chacha.c:w64GetHigh32
Unexecuted instantiation: ecc.c:w64GetHigh32
Unexecuted instantiation: internal.c:w64GetHigh32
Unexecuted instantiation: wc_encrypt.c:w64GetHigh32
Unexecuted instantiation: pwdbased.c:w64GetHigh32
646
647
0
WC_MISC_STATIC WC_INLINE void w64SetLow32(w64wrapper *n, word32 low) {
648
0
    n->n = (n->n & (~(word64)(0xffffffff))) | low;
649
0
}
Unexecuted instantiation: ssl.c:w64SetLow32
Unexecuted instantiation: tls.c:w64SetLow32
Unexecuted instantiation: tls13.c:w64SetLow32
Unexecuted instantiation: hmac.c:w64SetLow32
Unexecuted instantiation: hash.c:w64SetLow32
Unexecuted instantiation: kdf.c:w64SetLow32
Unexecuted instantiation: random.c:w64SetLow32
Unexecuted instantiation: sha256.c:w64SetLow32
Unexecuted instantiation: rsa.c:w64SetLow32
Unexecuted instantiation: sp_int.c:w64SetLow32
Unexecuted instantiation: aes.c:w64SetLow32
Unexecuted instantiation: sha.c:w64SetLow32
Unexecuted instantiation: sha512.c:w64SetLow32
Unexecuted instantiation: sha3.c:w64SetLow32
Unexecuted instantiation: wolfmath.c:w64SetLow32
Unexecuted instantiation: dh.c:w64SetLow32
Unexecuted instantiation: asn.c:w64SetLow32
Unexecuted instantiation: coding.c:w64SetLow32
Unexecuted instantiation: poly1305.c:w64SetLow32
Unexecuted instantiation: md5.c:w64SetLow32
Unexecuted instantiation: chacha.c:w64SetLow32
Unexecuted instantiation: ecc.c:w64SetLow32
Unexecuted instantiation: internal.c:w64SetLow32
Unexecuted instantiation: wc_encrypt.c:w64SetLow32
Unexecuted instantiation: pwdbased.c:w64SetLow32
650
651
WC_MISC_STATIC WC_INLINE w64wrapper w64Add32(w64wrapper a, word32 b, byte *wrap)
652
0
{
653
0
    a.n = a.n + b;
654
0
    if (a.n < b && wrap != NULL)
655
0
        *wrap = 1;
656
0
657
0
    return a;
658
0
}
Unexecuted instantiation: ssl.c:w64Add32
Unexecuted instantiation: tls.c:w64Add32
Unexecuted instantiation: tls13.c:w64Add32
Unexecuted instantiation: hmac.c:w64Add32
Unexecuted instantiation: hash.c:w64Add32
Unexecuted instantiation: kdf.c:w64Add32
Unexecuted instantiation: random.c:w64Add32
Unexecuted instantiation: sha256.c:w64Add32
Unexecuted instantiation: rsa.c:w64Add32
Unexecuted instantiation: sp_int.c:w64Add32
Unexecuted instantiation: aes.c:w64Add32
Unexecuted instantiation: sha.c:w64Add32
Unexecuted instantiation: sha512.c:w64Add32
Unexecuted instantiation: sha3.c:w64Add32
Unexecuted instantiation: wolfmath.c:w64Add32
Unexecuted instantiation: dh.c:w64Add32
Unexecuted instantiation: asn.c:w64Add32
Unexecuted instantiation: coding.c:w64Add32
Unexecuted instantiation: poly1305.c:w64Add32
Unexecuted instantiation: md5.c:w64Add32
Unexecuted instantiation: chacha.c:w64Add32
Unexecuted instantiation: ecc.c:w64Add32
Unexecuted instantiation: internal.c:w64Add32
Unexecuted instantiation: wc_encrypt.c:w64Add32
Unexecuted instantiation: pwdbased.c:w64Add32
659
660
WC_MISC_STATIC WC_INLINE w64wrapper w64Sub32(w64wrapper a, word32 b, byte *wrap)
661
0
{
662
0
    if (a.n < b && wrap != NULL)
663
0
        *wrap = 1;
664
0
    a.n = a.n - b;
665
0
    return a;
666
0
}
Unexecuted instantiation: ssl.c:w64Sub32
Unexecuted instantiation: tls.c:w64Sub32
Unexecuted instantiation: tls13.c:w64Sub32
Unexecuted instantiation: hmac.c:w64Sub32
Unexecuted instantiation: hash.c:w64Sub32
Unexecuted instantiation: kdf.c:w64Sub32
Unexecuted instantiation: random.c:w64Sub32
Unexecuted instantiation: sha256.c:w64Sub32
Unexecuted instantiation: rsa.c:w64Sub32
Unexecuted instantiation: sp_int.c:w64Sub32
Unexecuted instantiation: aes.c:w64Sub32
Unexecuted instantiation: sha.c:w64Sub32
Unexecuted instantiation: sha512.c:w64Sub32
Unexecuted instantiation: sha3.c:w64Sub32
Unexecuted instantiation: wolfmath.c:w64Sub32
Unexecuted instantiation: dh.c:w64Sub32
Unexecuted instantiation: asn.c:w64Sub32
Unexecuted instantiation: coding.c:w64Sub32
Unexecuted instantiation: poly1305.c:w64Sub32
Unexecuted instantiation: md5.c:w64Sub32
Unexecuted instantiation: chacha.c:w64Sub32
Unexecuted instantiation: ecc.c:w64Sub32
Unexecuted instantiation: internal.c:w64Sub32
Unexecuted instantiation: wc_encrypt.c:w64Sub32
Unexecuted instantiation: pwdbased.c:w64Sub32
667
668
WC_MISC_STATIC WC_INLINE byte w64GT(w64wrapper a, w64wrapper b)
669
0
{
670
0
    return a.n > b.n;
671
0
}
Unexecuted instantiation: ssl.c:w64GT
Unexecuted instantiation: tls.c:w64GT
Unexecuted instantiation: tls13.c:w64GT
Unexecuted instantiation: hmac.c:w64GT
Unexecuted instantiation: hash.c:w64GT
Unexecuted instantiation: kdf.c:w64GT
Unexecuted instantiation: random.c:w64GT
Unexecuted instantiation: sha256.c:w64GT
Unexecuted instantiation: rsa.c:w64GT
Unexecuted instantiation: sp_int.c:w64GT
Unexecuted instantiation: aes.c:w64GT
Unexecuted instantiation: sha.c:w64GT
Unexecuted instantiation: sha512.c:w64GT
Unexecuted instantiation: sha3.c:w64GT
Unexecuted instantiation: wolfmath.c:w64GT
Unexecuted instantiation: dh.c:w64GT
Unexecuted instantiation: asn.c:w64GT
Unexecuted instantiation: coding.c:w64GT
Unexecuted instantiation: poly1305.c:w64GT
Unexecuted instantiation: md5.c:w64GT
Unexecuted instantiation: chacha.c:w64GT
Unexecuted instantiation: ecc.c:w64GT
Unexecuted instantiation: internal.c:w64GT
Unexecuted instantiation: wc_encrypt.c:w64GT
Unexecuted instantiation: pwdbased.c:w64GT
672
673
WC_MISC_STATIC WC_INLINE byte w64IsZero(w64wrapper a)
674
0
{
675
0
    return a.n == 0;
676
0
}
Unexecuted instantiation: ssl.c:w64IsZero
Unexecuted instantiation: tls.c:w64IsZero
Unexecuted instantiation: tls13.c:w64IsZero
Unexecuted instantiation: hmac.c:w64IsZero
Unexecuted instantiation: hash.c:w64IsZero
Unexecuted instantiation: kdf.c:w64IsZero
Unexecuted instantiation: random.c:w64IsZero
Unexecuted instantiation: sha256.c:w64IsZero
Unexecuted instantiation: rsa.c:w64IsZero
Unexecuted instantiation: sp_int.c:w64IsZero
Unexecuted instantiation: aes.c:w64IsZero
Unexecuted instantiation: sha.c:w64IsZero
Unexecuted instantiation: sha512.c:w64IsZero
Unexecuted instantiation: sha3.c:w64IsZero
Unexecuted instantiation: wolfmath.c:w64IsZero
Unexecuted instantiation: dh.c:w64IsZero
Unexecuted instantiation: asn.c:w64IsZero
Unexecuted instantiation: coding.c:w64IsZero
Unexecuted instantiation: poly1305.c:w64IsZero
Unexecuted instantiation: md5.c:w64IsZero
Unexecuted instantiation: chacha.c:w64IsZero
Unexecuted instantiation: ecc.c:w64IsZero
Unexecuted instantiation: internal.c:w64IsZero
Unexecuted instantiation: wc_encrypt.c:w64IsZero
Unexecuted instantiation: pwdbased.c:w64IsZero
677
678
WC_MISC_STATIC WC_INLINE void c64toa(const w64wrapper *a, byte *out)
679
0
{
680
0
#ifdef BIG_ENDIAN_ORDER
681
0
    XMEMCPY(out, &a->n, sizeof(a->n));
682
0
#else
683
0
    word64 _out;
684
0
    _out = ByteReverseWord64(a->n);
685
0
    XMEMCPY(out, &_out, sizeof(_out));
686
0
#endif /* BIG_ENDIAN_ORDER */
687
0
}
Unexecuted instantiation: ssl.c:c64toa
Unexecuted instantiation: tls.c:c64toa
Unexecuted instantiation: tls13.c:c64toa
Unexecuted instantiation: hmac.c:c64toa
Unexecuted instantiation: hash.c:c64toa
Unexecuted instantiation: kdf.c:c64toa
Unexecuted instantiation: random.c:c64toa
Unexecuted instantiation: sha256.c:c64toa
Unexecuted instantiation: rsa.c:c64toa
Unexecuted instantiation: sp_int.c:c64toa
Unexecuted instantiation: aes.c:c64toa
Unexecuted instantiation: sha.c:c64toa
Unexecuted instantiation: sha512.c:c64toa
Unexecuted instantiation: sha3.c:c64toa
Unexecuted instantiation: wolfmath.c:c64toa
Unexecuted instantiation: dh.c:c64toa
Unexecuted instantiation: asn.c:c64toa
Unexecuted instantiation: coding.c:c64toa
Unexecuted instantiation: poly1305.c:c64toa
Unexecuted instantiation: md5.c:c64toa
Unexecuted instantiation: chacha.c:c64toa
Unexecuted instantiation: ecc.c:c64toa
Unexecuted instantiation: internal.c:c64toa
Unexecuted instantiation: wc_encrypt.c:c64toa
Unexecuted instantiation: pwdbased.c:c64toa
688
689
WC_MISC_STATIC WC_INLINE void ato64(const byte *in, w64wrapper *w64)
690
0
{
691
0
#ifdef BIG_ENDIAN_ORDER
692
0
    XMEMCPY(&w64->n, in, sizeof(w64->n));
693
0
#else
694
0
    word64 _in;
695
0
    XMEMCPY(&_in, in, sizeof(_in));
696
0
    w64->n = ByteReverseWord64(_in);
697
0
#endif /* BIG_ENDIAN_ORDER */
698
0
}
Unexecuted instantiation: ssl.c:ato64
Unexecuted instantiation: tls.c:ato64
Unexecuted instantiation: tls13.c:ato64
Unexecuted instantiation: hmac.c:ato64
Unexecuted instantiation: hash.c:ato64
Unexecuted instantiation: kdf.c:ato64
Unexecuted instantiation: random.c:ato64
Unexecuted instantiation: sha256.c:ato64
Unexecuted instantiation: rsa.c:ato64
Unexecuted instantiation: sp_int.c:ato64
Unexecuted instantiation: aes.c:ato64
Unexecuted instantiation: sha.c:ato64
Unexecuted instantiation: sha512.c:ato64
Unexecuted instantiation: sha3.c:ato64
Unexecuted instantiation: wolfmath.c:ato64
Unexecuted instantiation: dh.c:ato64
Unexecuted instantiation: asn.c:ato64
Unexecuted instantiation: coding.c:ato64
Unexecuted instantiation: poly1305.c:ato64
Unexecuted instantiation: md5.c:ato64
Unexecuted instantiation: chacha.c:ato64
Unexecuted instantiation: ecc.c:ato64
Unexecuted instantiation: internal.c:ato64
Unexecuted instantiation: wc_encrypt.c:ato64
Unexecuted instantiation: pwdbased.c:ato64
699
700
WC_MISC_STATIC WC_INLINE w64wrapper w64From32(word32 hi, word32 lo)
701
0
{
702
0
    w64wrapper ret;
703
0
    ret.n = ((word64)hi << 32) | lo;
704
0
    return ret;
705
0
}
Unexecuted instantiation: ssl.c:w64From32
Unexecuted instantiation: tls.c:w64From32
Unexecuted instantiation: tls13.c:w64From32
Unexecuted instantiation: hmac.c:w64From32
Unexecuted instantiation: hash.c:w64From32
Unexecuted instantiation: kdf.c:w64From32
Unexecuted instantiation: random.c:w64From32
Unexecuted instantiation: sha256.c:w64From32
Unexecuted instantiation: rsa.c:w64From32
Unexecuted instantiation: sp_int.c:w64From32
Unexecuted instantiation: aes.c:w64From32
Unexecuted instantiation: sha.c:w64From32
Unexecuted instantiation: sha512.c:w64From32
Unexecuted instantiation: sha3.c:w64From32
Unexecuted instantiation: wolfmath.c:w64From32
Unexecuted instantiation: dh.c:w64From32
Unexecuted instantiation: asn.c:w64From32
Unexecuted instantiation: coding.c:w64From32
Unexecuted instantiation: poly1305.c:w64From32
Unexecuted instantiation: md5.c:w64From32
Unexecuted instantiation: chacha.c:w64From32
Unexecuted instantiation: ecc.c:w64From32
Unexecuted instantiation: internal.c:w64From32
Unexecuted instantiation: wc_encrypt.c:w64From32
Unexecuted instantiation: pwdbased.c:w64From32
706
707
WC_MISC_STATIC WC_INLINE byte w64GTE(w64wrapper a, w64wrapper b)
708
0
{
709
0
    return a.n >= b.n;
710
0
}
Unexecuted instantiation: ssl.c:w64GTE
Unexecuted instantiation: tls.c:w64GTE
Unexecuted instantiation: tls13.c:w64GTE
Unexecuted instantiation: hmac.c:w64GTE
Unexecuted instantiation: hash.c:w64GTE
Unexecuted instantiation: kdf.c:w64GTE
Unexecuted instantiation: random.c:w64GTE
Unexecuted instantiation: sha256.c:w64GTE
Unexecuted instantiation: rsa.c:w64GTE
Unexecuted instantiation: sp_int.c:w64GTE
Unexecuted instantiation: aes.c:w64GTE
Unexecuted instantiation: sha.c:w64GTE
Unexecuted instantiation: sha512.c:w64GTE
Unexecuted instantiation: sha3.c:w64GTE
Unexecuted instantiation: wolfmath.c:w64GTE
Unexecuted instantiation: dh.c:w64GTE
Unexecuted instantiation: asn.c:w64GTE
Unexecuted instantiation: coding.c:w64GTE
Unexecuted instantiation: poly1305.c:w64GTE
Unexecuted instantiation: md5.c:w64GTE
Unexecuted instantiation: chacha.c:w64GTE
Unexecuted instantiation: ecc.c:w64GTE
Unexecuted instantiation: internal.c:w64GTE
Unexecuted instantiation: wc_encrypt.c:w64GTE
Unexecuted instantiation: pwdbased.c:w64GTE
711
712
WC_MISC_STATIC WC_INLINE byte w64LT(w64wrapper a, w64wrapper b)
713
0
{
714
0
    return a.n < b.n;
715
0
}
Unexecuted instantiation: ssl.c:w64LT
Unexecuted instantiation: tls.c:w64LT
Unexecuted instantiation: tls13.c:w64LT
Unexecuted instantiation: hmac.c:w64LT
Unexecuted instantiation: hash.c:w64LT
Unexecuted instantiation: kdf.c:w64LT
Unexecuted instantiation: random.c:w64LT
Unexecuted instantiation: sha256.c:w64LT
Unexecuted instantiation: rsa.c:w64LT
Unexecuted instantiation: sp_int.c:w64LT
Unexecuted instantiation: aes.c:w64LT
Unexecuted instantiation: sha.c:w64LT
Unexecuted instantiation: sha512.c:w64LT
Unexecuted instantiation: sha3.c:w64LT
Unexecuted instantiation: wolfmath.c:w64LT
Unexecuted instantiation: dh.c:w64LT
Unexecuted instantiation: asn.c:w64LT
Unexecuted instantiation: coding.c:w64LT
Unexecuted instantiation: poly1305.c:w64LT
Unexecuted instantiation: md5.c:w64LT
Unexecuted instantiation: chacha.c:w64LT
Unexecuted instantiation: ecc.c:w64LT
Unexecuted instantiation: internal.c:w64LT
Unexecuted instantiation: wc_encrypt.c:w64LT
Unexecuted instantiation: pwdbased.c:w64LT
716
717
WC_MISC_STATIC WC_INLINE w64wrapper w64Sub(w64wrapper a, w64wrapper b)
718
0
{
719
0
    a.n -= b.n;
720
0
    return a;
721
0
}
Unexecuted instantiation: ssl.c:w64Sub
Unexecuted instantiation: tls.c:w64Sub
Unexecuted instantiation: tls13.c:w64Sub
Unexecuted instantiation: hmac.c:w64Sub
Unexecuted instantiation: hash.c:w64Sub
Unexecuted instantiation: kdf.c:w64Sub
Unexecuted instantiation: random.c:w64Sub
Unexecuted instantiation: sha256.c:w64Sub
Unexecuted instantiation: rsa.c:w64Sub
Unexecuted instantiation: sp_int.c:w64Sub
Unexecuted instantiation: aes.c:w64Sub
Unexecuted instantiation: sha.c:w64Sub
Unexecuted instantiation: sha512.c:w64Sub
Unexecuted instantiation: sha3.c:w64Sub
Unexecuted instantiation: wolfmath.c:w64Sub
Unexecuted instantiation: dh.c:w64Sub
Unexecuted instantiation: asn.c:w64Sub
Unexecuted instantiation: coding.c:w64Sub
Unexecuted instantiation: poly1305.c:w64Sub
Unexecuted instantiation: md5.c:w64Sub
Unexecuted instantiation: chacha.c:w64Sub
Unexecuted instantiation: ecc.c:w64Sub
Unexecuted instantiation: internal.c:w64Sub
Unexecuted instantiation: wc_encrypt.c:w64Sub
Unexecuted instantiation: pwdbased.c:w64Sub
722
723
WC_MISC_STATIC WC_INLINE void w64Zero(w64wrapper *a)
724
0
{
725
0
    a->n = 0;
726
0
}
Unexecuted instantiation: ssl.c:w64Zero
Unexecuted instantiation: tls.c:w64Zero
Unexecuted instantiation: tls13.c:w64Zero
Unexecuted instantiation: hmac.c:w64Zero
Unexecuted instantiation: hash.c:w64Zero
Unexecuted instantiation: kdf.c:w64Zero
Unexecuted instantiation: random.c:w64Zero
Unexecuted instantiation: sha256.c:w64Zero
Unexecuted instantiation: rsa.c:w64Zero
Unexecuted instantiation: sp_int.c:w64Zero
Unexecuted instantiation: aes.c:w64Zero
Unexecuted instantiation: sha.c:w64Zero
Unexecuted instantiation: sha512.c:w64Zero
Unexecuted instantiation: sha3.c:w64Zero
Unexecuted instantiation: wolfmath.c:w64Zero
Unexecuted instantiation: dh.c:w64Zero
Unexecuted instantiation: asn.c:w64Zero
Unexecuted instantiation: coding.c:w64Zero
Unexecuted instantiation: poly1305.c:w64Zero
Unexecuted instantiation: md5.c:w64Zero
Unexecuted instantiation: chacha.c:w64Zero
Unexecuted instantiation: ecc.c:w64Zero
Unexecuted instantiation: internal.c:w64Zero
Unexecuted instantiation: wc_encrypt.c:w64Zero
Unexecuted instantiation: pwdbased.c:w64Zero
727
728
#else
729
WC_MISC_STATIC WC_INLINE void w64Increment(w64wrapper *n)
730
{
731
    n->n[1]++;
732
    if (n->n[1] == 0)
733
        n->n[0]++;
734
}
735
736
WC_MISC_STATIC WC_INLINE void w64Decrement(w64wrapper *n) {
737
    if (n->n[1] == 0)
738
        n->n[0]--;
739
    n->n[1]--;
740
}
741
742
WC_MISC_STATIC WC_INLINE byte w64Equal(w64wrapper a, w64wrapper b)
743
{
744
    return (a.n[0] == b.n[0] && a.n[1] == b.n[1]);
745
}
746
747
WC_MISC_STATIC WC_INLINE word32 w64GetLow32(w64wrapper n) {
748
    return n.n[1];
749
}
750
751
WC_MISC_STATIC WC_INLINE word32 w64GetHigh32(w64wrapper n) {
752
    return n.n[0];
753
}
754
755
WC_MISC_STATIC WC_INLINE void w64SetLow32(w64wrapper *n, word32 low)
756
{
757
    n->n[1] = low;
758
}
759
760
WC_MISC_STATIC WC_INLINE w64wrapper w64Add32(w64wrapper a, word32 b, byte *wrap)
761
{
762
    a.n[1] = a.n[1] + b;
763
    if (a.n[1] < b) {
764
        a.n[0]++;
765
        if (wrap != NULL && a.n[0] == 0)
766
                *wrap = 1;
767
    }
768
769
    return a;
770
}
771
772
WC_MISC_STATIC WC_INLINE w64wrapper w64Sub32(w64wrapper a, word32 b, byte *wrap)
773
{
774
    byte _underflow = 0;
775
    if (a.n[1] < b)
776
        _underflow = 1;
777
778
    a.n[1] -= b;
779
    if (_underflow) {
780
        if (a.n[0] == 0 && wrap != NULL)
781
            *wrap = 1;
782
        a.n[0]--;
783
    }
784
785
    return a;
786
}
787
788
WC_MISC_STATIC WC_INLINE w64wrapper w64Sub(w64wrapper a, w64wrapper b)
789
{
790
    if (a.n[1] < b.n[1])
791
        a.n[0]--;
792
    a.n[1] -= b.n[1];
793
    a.n[0] -= b.n[0];
794
    return a;
795
}
796
797
WC_MISC_STATIC WC_INLINE void w64Zero(w64wrapper *a)
798
{
799
    a->n[0] = a->n[1] = 0;
800
}
801
802
WC_MISC_STATIC WC_INLINE byte w64GT(w64wrapper a, w64wrapper b)
803
{
804
    if (a.n[0] > b.n[0])
805
        return 1;
806
    if (a.n[0] == b.n[0])
807
        return a.n[1] > b.n[1];
808
    return 0;
809
}
810
811
WC_MISC_STATIC WC_INLINE byte w64GTE(w64wrapper a, w64wrapper b)
812
{
813
    if (a.n[0] > b.n[0])
814
        return 1;
815
    if (a.n[0] == b.n[0])
816
        return a.n[1] >= b.n[1];
817
    return 0;
818
}
819
820
WC_MISC_STATIC WC_INLINE byte w64IsZero(w64wrapper a)
821
{
822
    return a.n[0] == 0 && a.n[1] == 0;
823
}
824
825
WC_MISC_STATIC WC_INLINE void c64toa(w64wrapper *a, byte *out)
826
{
827
#ifdef BIG_ENDIAN_ORDER
828
    word32 *_out = (word32*)(out);
829
    _out[0] = a->n[0];
830
    _out[1] = a->n[1];
831
#else
832
    c32toa(a->n[0], out);
833
    c32toa(a->n[1], out + 4);
834
#endif /* BIG_ENDIAN_ORDER */
835
}
836
837
WC_MISC_STATIC WC_INLINE void ato64(const byte *in, w64wrapper *w64)
838
{
839
#ifdef BIG_ENDIAN_ORDER
840
    const word32 *_in = (const word32*)(in);
841
    w64->n[0] = *_in;
842
    w64->n[1] = *(_in + 1);
843
#else
844
    ato32(in, &w64->n[0]);
845
    ato32(in + 4, &w64->n[1]);
846
#endif /* BIG_ENDIAN_ORDER */
847
}
848
849
WC_MISC_STATIC WC_INLINE w64wrapper w64From32(word32 hi, word32 lo)
850
{
851
    w64wrapper w64;
852
    w64.n[0] = hi;
853
    w64.n[1] = lo;
854
    return w64;
855
}
856
857
WC_MISC_STATIC WC_INLINE byte w64LT(w64wrapper a, w64wrapper b)
858
{
859
    if (a.n[0] < b.n[0])
860
        return 1;
861
    if (a.n[0] == b.n[0])
862
        return a.n[1] < b.n[1];
863
864
    return 0;
865
}
866
867
#endif /* WORD64_AVAILABLE && !WOLFSSL_W64_WRAPPER_TEST */
868
#endif /* WOLFSSL_W64_WRAPPER */
869
870
#if defined(HAVE_SESSION_TICKET) || !defined(NO_CERTS) || \
871
    !defined(NO_SESSION_CACHE)
872
/* Make a word from the front of random hash */
873
WC_MISC_STATIC WC_INLINE word32 MakeWordFromHash(const byte* hashID)
874
0
{
875
0
    return ((word32)hashID[0] << 24) | ((word32)hashID[1] << 16) |
876
0
           ((word32)hashID[2] <<  8) |  (word32)hashID[3];
877
0
}
Unexecuted instantiation: ssl.c:MakeWordFromHash
Unexecuted instantiation: tls.c:MakeWordFromHash
Unexecuted instantiation: tls13.c:MakeWordFromHash
Unexecuted instantiation: hmac.c:MakeWordFromHash
Unexecuted instantiation: hash.c:MakeWordFromHash
Unexecuted instantiation: kdf.c:MakeWordFromHash
Unexecuted instantiation: random.c:MakeWordFromHash
Unexecuted instantiation: sha256.c:MakeWordFromHash
Unexecuted instantiation: rsa.c:MakeWordFromHash
Unexecuted instantiation: sp_int.c:MakeWordFromHash
Unexecuted instantiation: aes.c:MakeWordFromHash
Unexecuted instantiation: sha.c:MakeWordFromHash
Unexecuted instantiation: sha512.c:MakeWordFromHash
Unexecuted instantiation: sha3.c:MakeWordFromHash
Unexecuted instantiation: wolfmath.c:MakeWordFromHash
Unexecuted instantiation: dh.c:MakeWordFromHash
Unexecuted instantiation: asn.c:MakeWordFromHash
Unexecuted instantiation: coding.c:MakeWordFromHash
Unexecuted instantiation: poly1305.c:MakeWordFromHash
Unexecuted instantiation: md5.c:MakeWordFromHash
Unexecuted instantiation: chacha.c:MakeWordFromHash
Unexecuted instantiation: ecc.c:MakeWordFromHash
Unexecuted instantiation: internal.c:MakeWordFromHash
Unexecuted instantiation: wc_encrypt.c:MakeWordFromHash
Unexecuted instantiation: pwdbased.c:MakeWordFromHash
878
#endif /* HAVE_SESSION_TICKET || !NO_CERTS || !NO_SESSION_CACHE */
879
880
881
#if !defined(WOLFCRYPT_ONLY) && !defined(NO_HASH_WRAPPER) && \
882
    (!defined(NO_SESSION_CACHE) || defined(HAVE_SESSION_TICKET))
883
884
#include <wolfssl/wolfcrypt/hash.h>
885
886
/* some session IDs aren't random after all, let's make them random */
887
WC_MISC_STATIC WC_INLINE word32 HashObject(const byte* o, word32 len,
888
                                           int* error)
889
0
{
890
0
    byte digest[WC_MAX_DIGEST_SIZE];
891
892
0
#ifndef NO_MD5
893
0
    *error =  wc_Md5Hash(o, len, digest);
894
#elif !defined(NO_SHA)
895
    *error =  wc_ShaHash(o, len, digest);
896
#elif !defined(NO_SHA256)
897
    *error =  wc_Sha256Hash(o, len, digest);
898
#else
899
    #error "We need a digest to hash the session IDs"
900
#endif
901
902
0
    return *error == 0 ? MakeWordFromHash(digest) : 0; /* 0 on failure */
903
0
}
Unexecuted instantiation: ssl.c:HashObject
Unexecuted instantiation: tls.c:HashObject
Unexecuted instantiation: tls13.c:HashObject
Unexecuted instantiation: hmac.c:HashObject
Unexecuted instantiation: hash.c:HashObject
Unexecuted instantiation: kdf.c:HashObject
Unexecuted instantiation: random.c:HashObject
Unexecuted instantiation: sha256.c:HashObject
Unexecuted instantiation: rsa.c:HashObject
Unexecuted instantiation: sp_int.c:HashObject
Unexecuted instantiation: aes.c:HashObject
Unexecuted instantiation: sha.c:HashObject
Unexecuted instantiation: sha512.c:HashObject
Unexecuted instantiation: sha3.c:HashObject
Unexecuted instantiation: wolfmath.c:HashObject
Unexecuted instantiation: dh.c:HashObject
Unexecuted instantiation: asn.c:HashObject
Unexecuted instantiation: coding.c:HashObject
Unexecuted instantiation: poly1305.c:HashObject
Unexecuted instantiation: md5.c:HashObject
Unexecuted instantiation: chacha.c:HashObject
Unexecuted instantiation: ecc.c:HashObject
Unexecuted instantiation: internal.c:HashObject
Unexecuted instantiation: wc_encrypt.c:HashObject
Unexecuted instantiation: pwdbased.c:HashObject
904
#endif /* WOLFCRYPT_ONLY && !NO_HASH_WRAPPER &&
905
        * (!NO_SESSION_CACHE || HAVE_SESSION_TICKET) */
906
907
#endif /* !WOLFSSL_MISC_INCLUDED && !NO_INLINE */
908
909
#endif /* WOLF_CRYPT_MISC_C */