/src/wolfssl-sp-math-all-8bit/wolfcrypt/src/misc.c
Line | Count | Source (jump to first uncovered line) |
1 | | /* misc.c |
2 | | * |
3 | | * Copyright (C) 2006-2022 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 | | #ifdef NO_INLINE |
47 | | #define WC_STATIC |
48 | | #else |
49 | | #define WC_STATIC static |
50 | | #endif |
51 | | |
52 | | /* Check for if compiling misc.c when not needed. */ |
53 | | #if !defined(WOLFSSL_MISC_INCLUDED) && !defined(NO_INLINE) |
54 | | #ifndef WOLFSSL_IGNORE_FILE_WARN |
55 | | #warning misc.c does not need to be compiled when using inline (NO_INLINE not defined) |
56 | | #endif |
57 | | |
58 | | #else |
59 | | |
60 | | |
61 | | #if defined(__ICCARM__) |
62 | | #include <intrinsics.h> |
63 | | #endif |
64 | | |
65 | | |
66 | | #ifdef INTEL_INTRINSICS |
67 | | |
68 | | #include <stdlib.h> /* get intrinsic definitions */ |
69 | | |
70 | | /* for non visual studio probably need no long version, 32 bit only |
71 | | * i.e., _rotl and _rotr */ |
72 | | #pragma intrinsic(_lrotl, _lrotr) |
73 | | |
74 | | WC_STATIC WC_INLINE word32 rotlFixed(word32 x, word32 y) |
75 | | { |
76 | | return y ? _lrotl(x, y) : x; |
77 | | } |
78 | | |
79 | | WC_STATIC WC_INLINE word32 rotrFixed(word32 x, word32 y) |
80 | | { |
81 | | return y ? _lrotr(x, y) : x; |
82 | | } |
83 | | |
84 | | #elif defined(__CCRX__) |
85 | | |
86 | | #include <builtin.h> /* get intrinsic definitions */ |
87 | | |
88 | | #if !defined(NO_INLINE) |
89 | | |
90 | | #define rotlFixed(x, y) _builtin_rotl(x, y) |
91 | | |
92 | | #define rotrFixed(x, y) _builtin_rotr(x, y) |
93 | | |
94 | | #else /* create real function */ |
95 | | |
96 | | WC_STATIC WC_INLINE word32 rotlFixed(word32 x, word32 y) |
97 | | { |
98 | | return _builtin_rotl(x, y); |
99 | | } |
100 | | |
101 | | WC_STATIC WC_INLINE word32 rotrFixed(word32 x, word32 y) |
102 | | { |
103 | | return _builtin_rotr(x, y); |
104 | | } |
105 | | |
106 | | #endif |
107 | | |
108 | | #else /* generic */ |
109 | | /* This routine performs a left circular arithmetic shift of <x> by <y> value. */ |
110 | | |
111 | | WC_STATIC WC_INLINE word32 rotlFixed(word32 x, word32 y) |
112 | 411M | { |
113 | 411M | return (x << y) | (x >> (sizeof(y) * 8 - y)); |
114 | 411M | } Line | Count | Source | 112 | 758k | { | 113 | 758k | return (x << y) | (x >> (sizeof(y) * 8 - y)); | 114 | 758k | } |
Unexecuted instantiation: asn.c:rotlFixed Unexecuted instantiation: camellia.c:rotlFixed Line | Count | Source | 112 | 2.70M | { | 113 | 2.70M | return (x << y) | (x >> (sizeof(y) * 8 - y)); | 114 | 2.70M | } |
Unexecuted instantiation: chacha20_poly1305.c:rotlFixed Unexecuted instantiation: cmac.c:rotlFixed Unexecuted instantiation: coding.c:rotlFixed Unexecuted instantiation: curve25519.c:rotlFixed Unexecuted instantiation: curve448.c:rotlFixed Line | Count | Source | 112 | 10.5k | { | 113 | 10.5k | return (x << y) | (x >> (sizeof(y) * 8 - y)); | 114 | 10.5k | } |
Unexecuted instantiation: dh.c:rotlFixed Unexecuted instantiation: ecc.c:rotlFixed Unexecuted instantiation: ed25519.c:rotlFixed Unexecuted instantiation: ed448.c:rotlFixed Unexecuted instantiation: fe_448.c:rotlFixed Unexecuted instantiation: fe_operations.c:rotlFixed Unexecuted instantiation: ge_448.c:rotlFixed Unexecuted instantiation: ge_operations.c:rotlFixed Unexecuted instantiation: hash.c:rotlFixed Unexecuted instantiation: hmac.c:rotlFixed Unexecuted instantiation: kdf.c:rotlFixed Unexecuted instantiation: md2.c:rotlFixed Line | Count | Source | 112 | 624k | { | 113 | 624k | return (x << y) | (x >> (sizeof(y) * 8 - y)); | 114 | 624k | } |
Line | Count | Source | 112 | 35.1M | { | 113 | 35.1M | return (x << y) | (x >> (sizeof(y) * 8 - y)); | 114 | 35.1M | } |
Unexecuted instantiation: poly1305.c:rotlFixed Unexecuted instantiation: pwdbased.c:rotlFixed Line | Count | Source | 112 | 1.22M | { | 113 | 1.22M | return (x << y) | (x >> (sizeof(y) * 8 - y)); | 114 | 1.22M | } |
Unexecuted instantiation: ripemd.c:rotlFixed Unexecuted instantiation: rsa.c:rotlFixed Line | Count | Source | 112 | 235M | { | 113 | 235M | return (x << y) | (x >> (sizeof(y) * 8 - y)); | 114 | 235M | } |
Line | Count | Source | 112 | 135M | { | 113 | 135M | return (x << y) | (x >> (sizeof(y) * 8 - y)); | 114 | 135M | } |
Unexecuted instantiation: sha3.c:rotlFixed Unexecuted instantiation: sha512.c:rotlFixed Unexecuted instantiation: sp_int.c:rotlFixed Unexecuted instantiation: wc_encrypt.c:rotlFixed Unexecuted instantiation: wolfmath.c:rotlFixed Unexecuted instantiation: ssl.c:rotlFixed Unexecuted instantiation: tls.c:rotlFixed Unexecuted instantiation: tls13.c:rotlFixed Unexecuted instantiation: internal.c:rotlFixed |
115 | | |
116 | | /* This routine performs a right circular arithmetic shift of <x> by <y> value. */ |
117 | | WC_STATIC WC_INLINE word32 rotrFixed(word32 x, word32 y) |
118 | 3.87G | { |
119 | 3.87G | return (x >> y) | (x << (sizeof(y) * 8 - y)); |
120 | 3.87G | } Line | Count | Source | 118 | 758k | { | 119 | 758k | return (x >> y) | (x << (sizeof(y) * 8 - y)); | 120 | 758k | } |
Unexecuted instantiation: asn.c:rotrFixed Unexecuted instantiation: camellia.c:rotrFixed Unexecuted instantiation: chacha.c:rotrFixed Unexecuted instantiation: chacha20_poly1305.c:rotrFixed Unexecuted instantiation: cmac.c:rotrFixed Unexecuted instantiation: coding.c:rotrFixed Unexecuted instantiation: curve25519.c:rotrFixed Unexecuted instantiation: curve448.c:rotrFixed Line | Count | Source | 118 | 31.9k | { | 119 | 31.9k | return (x >> y) | (x << (sizeof(y) * 8 - y)); | 120 | 31.9k | } |
Unexecuted instantiation: dh.c:rotrFixed Unexecuted instantiation: ecc.c:rotrFixed Unexecuted instantiation: ed25519.c:rotrFixed Unexecuted instantiation: ed448.c:rotrFixed Unexecuted instantiation: fe_448.c:rotrFixed Unexecuted instantiation: fe_operations.c:rotrFixed Unexecuted instantiation: ge_448.c:rotrFixed Unexecuted instantiation: ge_operations.c:rotrFixed Unexecuted instantiation: hash.c:rotrFixed Unexecuted instantiation: hmac.c:rotrFixed Unexecuted instantiation: kdf.c:rotrFixed Unexecuted instantiation: md2.c:rotrFixed Unexecuted instantiation: md4.c:rotrFixed Unexecuted instantiation: md5.c:rotrFixed Unexecuted instantiation: poly1305.c:rotrFixed Unexecuted instantiation: pwdbased.c:rotrFixed Line | Count | Source | 118 | 1.22M | { | 119 | 1.22M | return (x >> y) | (x << (sizeof(y) * 8 - y)); | 120 | 1.22M | } |
Unexecuted instantiation: ripemd.c:rotrFixed Unexecuted instantiation: rsa.c:rotrFixed Line | Count | Source | 118 | 16.4M | { | 119 | 16.4M | return (x >> y) | (x << (sizeof(y) * 8 - y)); | 120 | 16.4M | } |
Line | Count | Source | 118 | 3.85G | { | 119 | 3.85G | return (x >> y) | (x << (sizeof(y) * 8 - y)); | 120 | 3.85G | } |
Unexecuted instantiation: sha3.c:rotrFixed Unexecuted instantiation: sha512.c:rotrFixed Unexecuted instantiation: sp_int.c:rotrFixed Unexecuted instantiation: wc_encrypt.c:rotrFixed Unexecuted instantiation: wolfmath.c:rotrFixed Unexecuted instantiation: ssl.c:rotrFixed Unexecuted instantiation: tls.c:rotrFixed Unexecuted instantiation: tls13.c:rotrFixed Unexecuted instantiation: internal.c:rotrFixed |
121 | | |
122 | | #endif |
123 | | |
124 | | #ifdef WC_RC2 |
125 | | |
126 | | /* This routine performs a left circular arithmetic shift of <x> by <y> value */ |
127 | | WC_STATIC WC_INLINE word16 rotlFixed16(word16 x, word16 y) |
128 | | { |
129 | | return (x << y) | (x >> (sizeof(y) * 8 - y)); |
130 | | } |
131 | | |
132 | | |
133 | | /* This routine performs a right circular arithmetic shift of <x> by <y> value */ |
134 | | WC_STATIC WC_INLINE word16 rotrFixed16(word16 x, word16 y) |
135 | | { |
136 | | return (x >> y) | (x << (sizeof(y) * 8 - y)); |
137 | | } |
138 | | |
139 | | #endif /* WC_RC2 */ |
140 | | |
141 | | /* This routine performs a byte swap of 32-bit word value. */ |
142 | | #if defined(__CCRX__) && !defined(NO_INLINE) /* shortest version for CC-RX */ |
143 | | #define ByteReverseWord32(value) _builtin_revl(value) |
144 | | #else |
145 | | WC_STATIC WC_INLINE word32 ByteReverseWord32(word32 value) |
146 | 154M | { |
147 | | #ifdef PPC_INTRINSICS |
148 | | /* PPC: load reverse indexed instruction */ |
149 | | return (word32)__lwbrx(&value,0); |
150 | | #elif defined(__ICCARM__) |
151 | | return (word32)__REV(value); |
152 | | #elif defined(KEIL_INTRINSICS) |
153 | | return (word32)__rev(value); |
154 | | #elif defined(__CCRX__) |
155 | | return (word32)_builtin_revl(value); |
156 | | #elif defined(WOLF_ALLOW_BUILTIN) && \ |
157 | | defined(__GNUC_PREREQ) && __GNUC_PREREQ(4, 3) |
158 | | return (word32)__builtin_bswap32(value); |
159 | | #elif defined(WOLFSSL_BYTESWAP32_ASM) && defined(__GNUC__) && \ |
160 | | defined(__aarch64__) |
161 | | __asm__ volatile ( |
162 | | "REV32 %0, %0 \n" |
163 | | : "+r" (value) |
164 | | : |
165 | | ); |
166 | | return value; |
167 | | #elif defined(WOLFSSL_BYTESWAP32_ASM) && defined(__GNUC__) && \ |
168 | | (defined(__thumb__) || defined(__arm__)) |
169 | | __asm__ volatile ( |
170 | | "REV %0, %0 \n" |
171 | | : "+r" (value) |
172 | | : |
173 | | ); |
174 | | return value; |
175 | | #elif defined(FAST_ROTATE) |
176 | | /* 5 instructions with rotate instruction, 9 without */ |
177 | 154M | return (rotrFixed(value, 8U) & 0xff00ff00) | |
178 | 154M | (rotlFixed(value, 8U) & 0x00ff00ff); |
179 | | #else |
180 | | /* 6 instructions with rotate instruction, 8 without */ |
181 | | value = ((value & 0xFF00FF00) >> 8) | ((value & 0x00FF00FF) << 8); |
182 | | return rotlFixed(value, 16U); |
183 | | #endif |
184 | 154M | } Line | Count | Source | 146 | 758k | { | 147 | | #ifdef PPC_INTRINSICS | 148 | | /* PPC: load reverse indexed instruction */ | 149 | | return (word32)__lwbrx(&value,0); | 150 | | #elif defined(__ICCARM__) | 151 | | return (word32)__REV(value); | 152 | | #elif defined(KEIL_INTRINSICS) | 153 | | return (word32)__rev(value); | 154 | | #elif defined(__CCRX__) | 155 | | return (word32)_builtin_revl(value); | 156 | | #elif defined(WOLF_ALLOW_BUILTIN) && \ | 157 | | defined(__GNUC_PREREQ) && __GNUC_PREREQ(4, 3) | 158 | | return (word32)__builtin_bswap32(value); | 159 | | #elif defined(WOLFSSL_BYTESWAP32_ASM) && defined(__GNUC__) && \ | 160 | | defined(__aarch64__) | 161 | | __asm__ volatile ( | 162 | | "REV32 %0, %0 \n" | 163 | | : "+r" (value) | 164 | | : | 165 | | ); | 166 | | return value; | 167 | | #elif defined(WOLFSSL_BYTESWAP32_ASM) && defined(__GNUC__) && \ | 168 | | (defined(__thumb__) || defined(__arm__)) | 169 | | __asm__ volatile ( | 170 | | "REV %0, %0 \n" | 171 | | : "+r" (value) | 172 | | : | 173 | | ); | 174 | | return value; | 175 | | #elif defined(FAST_ROTATE) | 176 | | /* 5 instructions with rotate instruction, 9 without */ | 177 | 758k | return (rotrFixed(value, 8U) & 0xff00ff00) | | 178 | 758k | (rotlFixed(value, 8U) & 0x00ff00ff); | 179 | | #else | 180 | | /* 6 instructions with rotate instruction, 8 without */ | 181 | | value = ((value & 0xFF00FF00) >> 8) | ((value & 0x00FF00FF) << 8); | 182 | | return rotlFixed(value, 16U); | 183 | | #endif | 184 | 758k | } |
Unexecuted instantiation: asn.c:ByteReverseWord32 Unexecuted instantiation: camellia.c:ByteReverseWord32 Unexecuted instantiation: chacha.c:ByteReverseWord32 Unexecuted instantiation: chacha20_poly1305.c:ByteReverseWord32 Unexecuted instantiation: cmac.c:ByteReverseWord32 Unexecuted instantiation: coding.c:ByteReverseWord32 Unexecuted instantiation: curve25519.c:ByteReverseWord32 Unexecuted instantiation: curve448.c:ByteReverseWord32 Line | Count | Source | 146 | 4.20k | { | 147 | | #ifdef PPC_INTRINSICS | 148 | | /* PPC: load reverse indexed instruction */ | 149 | | return (word32)__lwbrx(&value,0); | 150 | | #elif defined(__ICCARM__) | 151 | | return (word32)__REV(value); | 152 | | #elif defined(KEIL_INTRINSICS) | 153 | | return (word32)__rev(value); | 154 | | #elif defined(__CCRX__) | 155 | | return (word32)_builtin_revl(value); | 156 | | #elif defined(WOLF_ALLOW_BUILTIN) && \ | 157 | | defined(__GNUC_PREREQ) && __GNUC_PREREQ(4, 3) | 158 | | return (word32)__builtin_bswap32(value); | 159 | | #elif defined(WOLFSSL_BYTESWAP32_ASM) && defined(__GNUC__) && \ | 160 | | defined(__aarch64__) | 161 | | __asm__ volatile ( | 162 | | "REV32 %0, %0 \n" | 163 | | : "+r" (value) | 164 | | : | 165 | | ); | 166 | | return value; | 167 | | #elif defined(WOLFSSL_BYTESWAP32_ASM) && defined(__GNUC__) && \ | 168 | | (defined(__thumb__) || defined(__arm__)) | 169 | | __asm__ volatile ( | 170 | | "REV %0, %0 \n" | 171 | | : "+r" (value) | 172 | | : | 173 | | ); | 174 | | return value; | 175 | | #elif defined(FAST_ROTATE) | 176 | | /* 5 instructions with rotate instruction, 9 without */ | 177 | 4.20k | return (rotrFixed(value, 8U) & 0xff00ff00) | | 178 | 4.20k | (rotlFixed(value, 8U) & 0x00ff00ff); | 179 | | #else | 180 | | /* 6 instructions with rotate instruction, 8 without */ | 181 | | value = ((value & 0xFF00FF00) >> 8) | ((value & 0x00FF00FF) << 8); | 182 | | return rotlFixed(value, 16U); | 183 | | #endif | 184 | 4.20k | } |
Unexecuted instantiation: dh.c:ByteReverseWord32 Unexecuted instantiation: ecc.c:ByteReverseWord32 Unexecuted instantiation: ed25519.c:ByteReverseWord32 Unexecuted instantiation: ed448.c:ByteReverseWord32 Unexecuted instantiation: fe_448.c:ByteReverseWord32 Unexecuted instantiation: fe_operations.c:ByteReverseWord32 Unexecuted instantiation: ge_448.c:ByteReverseWord32 Unexecuted instantiation: ge_operations.c:ByteReverseWord32 Unexecuted instantiation: hash.c:ByteReverseWord32 Unexecuted instantiation: hmac.c:ByteReverseWord32 Unexecuted instantiation: kdf.c:ByteReverseWord32 Unexecuted instantiation: md2.c:ByteReverseWord32 Unexecuted instantiation: md4.c:ByteReverseWord32 Unexecuted instantiation: md5.c:ByteReverseWord32 Unexecuted instantiation: poly1305.c:ByteReverseWord32 Unexecuted instantiation: pwdbased.c:ByteReverseWord32 random.c:ByteReverseWord32 Line | Count | Source | 146 | 1.22M | { | 147 | | #ifdef PPC_INTRINSICS | 148 | | /* PPC: load reverse indexed instruction */ | 149 | | return (word32)__lwbrx(&value,0); | 150 | | #elif defined(__ICCARM__) | 151 | | return (word32)__REV(value); | 152 | | #elif defined(KEIL_INTRINSICS) | 153 | | return (word32)__rev(value); | 154 | | #elif defined(__CCRX__) | 155 | | return (word32)_builtin_revl(value); | 156 | | #elif defined(WOLF_ALLOW_BUILTIN) && \ | 157 | | defined(__GNUC_PREREQ) && __GNUC_PREREQ(4, 3) | 158 | | return (word32)__builtin_bswap32(value); | 159 | | #elif defined(WOLFSSL_BYTESWAP32_ASM) && defined(__GNUC__) && \ | 160 | | defined(__aarch64__) | 161 | | __asm__ volatile ( | 162 | | "REV32 %0, %0 \n" | 163 | | : "+r" (value) | 164 | | : | 165 | | ); | 166 | | return value; | 167 | | #elif defined(WOLFSSL_BYTESWAP32_ASM) && defined(__GNUC__) && \ | 168 | | (defined(__thumb__) || defined(__arm__)) | 169 | | __asm__ volatile ( | 170 | | "REV %0, %0 \n" | 171 | | : "+r" (value) | 172 | | : | 173 | | ); | 174 | | return value; | 175 | | #elif defined(FAST_ROTATE) | 176 | | /* 5 instructions with rotate instruction, 9 without */ | 177 | 1.22M | return (rotrFixed(value, 8U) & 0xff00ff00) | | 178 | 1.22M | (rotlFixed(value, 8U) & 0x00ff00ff); | 179 | | #else | 180 | | /* 6 instructions with rotate instruction, 8 without */ | 181 | | value = ((value & 0xFF00FF00) >> 8) | ((value & 0x00FF00FF) << 8); | 182 | | return rotlFixed(value, 16U); | 183 | | #endif | 184 | 1.22M | } |
Unexecuted instantiation: ripemd.c:ByteReverseWord32 Unexecuted instantiation: rsa.c:ByteReverseWord32 Line | Count | Source | 146 | 16.4M | { | 147 | | #ifdef PPC_INTRINSICS | 148 | | /* PPC: load reverse indexed instruction */ | 149 | | return (word32)__lwbrx(&value,0); | 150 | | #elif defined(__ICCARM__) | 151 | | return (word32)__REV(value); | 152 | | #elif defined(KEIL_INTRINSICS) | 153 | | return (word32)__rev(value); | 154 | | #elif defined(__CCRX__) | 155 | | return (word32)_builtin_revl(value); | 156 | | #elif defined(WOLF_ALLOW_BUILTIN) && \ | 157 | | defined(__GNUC_PREREQ) && __GNUC_PREREQ(4, 3) | 158 | | return (word32)__builtin_bswap32(value); | 159 | | #elif defined(WOLFSSL_BYTESWAP32_ASM) && defined(__GNUC__) && \ | 160 | | defined(__aarch64__) | 161 | | __asm__ volatile ( | 162 | | "REV32 %0, %0 \n" | 163 | | : "+r" (value) | 164 | | : | 165 | | ); | 166 | | return value; | 167 | | #elif defined(WOLFSSL_BYTESWAP32_ASM) && defined(__GNUC__) && \ | 168 | | (defined(__thumb__) || defined(__arm__)) | 169 | | __asm__ volatile ( | 170 | | "REV %0, %0 \n" | 171 | | : "+r" (value) | 172 | | : | 173 | | ); | 174 | | return value; | 175 | | #elif defined(FAST_ROTATE) | 176 | | /* 5 instructions with rotate instruction, 9 without */ | 177 | 16.4M | return (rotrFixed(value, 8U) & 0xff00ff00) | | 178 | 16.4M | (rotlFixed(value, 8U) & 0x00ff00ff); | 179 | | #else | 180 | | /* 6 instructions with rotate instruction, 8 without */ | 181 | | value = ((value & 0xFF00FF00) >> 8) | ((value & 0x00FF00FF) << 8); | 182 | | return rotlFixed(value, 16U); | 183 | | #endif | 184 | 16.4M | } |
sha256.c:ByteReverseWord32 Line | Count | Source | 146 | 135M | { | 147 | | #ifdef PPC_INTRINSICS | 148 | | /* PPC: load reverse indexed instruction */ | 149 | | return (word32)__lwbrx(&value,0); | 150 | | #elif defined(__ICCARM__) | 151 | | return (word32)__REV(value); | 152 | | #elif defined(KEIL_INTRINSICS) | 153 | | return (word32)__rev(value); | 154 | | #elif defined(__CCRX__) | 155 | | return (word32)_builtin_revl(value); | 156 | | #elif defined(WOLF_ALLOW_BUILTIN) && \ | 157 | | defined(__GNUC_PREREQ) && __GNUC_PREREQ(4, 3) | 158 | | return (word32)__builtin_bswap32(value); | 159 | | #elif defined(WOLFSSL_BYTESWAP32_ASM) && defined(__GNUC__) && \ | 160 | | defined(__aarch64__) | 161 | | __asm__ volatile ( | 162 | | "REV32 %0, %0 \n" | 163 | | : "+r" (value) | 164 | | : | 165 | | ); | 166 | | return value; | 167 | | #elif defined(WOLFSSL_BYTESWAP32_ASM) && defined(__GNUC__) && \ | 168 | | (defined(__thumb__) || defined(__arm__)) | 169 | | __asm__ volatile ( | 170 | | "REV %0, %0 \n" | 171 | | : "+r" (value) | 172 | | : | 173 | | ); | 174 | | return value; | 175 | | #elif defined(FAST_ROTATE) | 176 | | /* 5 instructions with rotate instruction, 9 without */ | 177 | 135M | return (rotrFixed(value, 8U) & 0xff00ff00) | | 178 | 135M | (rotlFixed(value, 8U) & 0x00ff00ff); | 179 | | #else | 180 | | /* 6 instructions with rotate instruction, 8 without */ | 181 | | value = ((value & 0xFF00FF00) >> 8) | ((value & 0x00FF00FF) << 8); | 182 | | return rotlFixed(value, 16U); | 183 | | #endif | 184 | 135M | } |
Unexecuted instantiation: sha3.c:ByteReverseWord32 Unexecuted instantiation: sha512.c:ByteReverseWord32 Unexecuted instantiation: sp_int.c:ByteReverseWord32 Unexecuted instantiation: wc_encrypt.c:ByteReverseWord32 Unexecuted instantiation: wolfmath.c:ByteReverseWord32 Unexecuted instantiation: ssl.c:ByteReverseWord32 Unexecuted instantiation: tls.c:ByteReverseWord32 Unexecuted instantiation: tls13.c:ByteReverseWord32 Unexecuted instantiation: internal.c:ByteReverseWord32 |
185 | | #endif /* __CCRX__ */ |
186 | | /* This routine performs a byte swap of words array of a given count. */ |
187 | | WC_STATIC WC_INLINE void ByteReverseWords(word32* out, const word32* in, |
188 | | word32 byteCount) |
189 | 11.6M | { |
190 | 11.6M | word32 count = byteCount/(word32)sizeof(word32), i; |
191 | | |
192 | 163M | for (i = 0; i < count; i++) |
193 | 152M | out[i] = ByteReverseWord32(in[i]); |
194 | | |
195 | 11.6M | } Line | Count | Source | 189 | 2.98k | { | 190 | 2.98k | word32 count = byteCount/(word32)sizeof(word32), i; | 191 | | | 192 | 20.2k | for (i = 0; i < count; i++) | 193 | 17.3k | out[i] = ByteReverseWord32(in[i]); | 194 | | | 195 | 2.98k | } |
Unexecuted instantiation: asn.c:ByteReverseWords Unexecuted instantiation: camellia.c:ByteReverseWords Unexecuted instantiation: chacha.c:ByteReverseWords Unexecuted instantiation: chacha20_poly1305.c:ByteReverseWords Unexecuted instantiation: cmac.c:ByteReverseWords Unexecuted instantiation: coding.c:ByteReverseWords Unexecuted instantiation: curve25519.c:ByteReverseWords Unexecuted instantiation: curve448.c:ByteReverseWords Unexecuted instantiation: des3.c:ByteReverseWords Unexecuted instantiation: dh.c:ByteReverseWords Unexecuted instantiation: ecc.c:ByteReverseWords Unexecuted instantiation: ed25519.c:ByteReverseWords Unexecuted instantiation: ed448.c:ByteReverseWords Unexecuted instantiation: fe_448.c:ByteReverseWords Unexecuted instantiation: fe_operations.c:ByteReverseWords Unexecuted instantiation: ge_448.c:ByteReverseWords Unexecuted instantiation: ge_operations.c:ByteReverseWords Unexecuted instantiation: hash.c:ByteReverseWords Unexecuted instantiation: hmac.c:ByteReverseWords Unexecuted instantiation: kdf.c:ByteReverseWords Unexecuted instantiation: md2.c:ByteReverseWords Unexecuted instantiation: md4.c:ByteReverseWords Unexecuted instantiation: md5.c:ByteReverseWords Unexecuted instantiation: poly1305.c:ByteReverseWords Unexecuted instantiation: pwdbased.c:ByteReverseWords Unexecuted instantiation: random.c:ByteReverseWords Unexecuted instantiation: ripemd.c:ByteReverseWords Unexecuted instantiation: rsa.c:ByteReverseWords Line | Count | Source | 189 | 1.14M | { | 190 | 1.14M | word32 count = byteCount/(word32)sizeof(word32), i; | 191 | | | 192 | 17.6M | for (i = 0; i < count; i++) | 193 | 16.4M | out[i] = ByteReverseWord32(in[i]); | 194 | | | 195 | 1.14M | } |
sha256.c:ByteReverseWords Line | Count | Source | 189 | 10.5M | { | 190 | 10.5M | word32 count = byteCount/(word32)sizeof(word32), i; | 191 | | | 192 | 146M | for (i = 0; i < count; i++) | 193 | 135M | out[i] = ByteReverseWord32(in[i]); | 194 | | | 195 | 10.5M | } |
Unexecuted instantiation: sha3.c:ByteReverseWords Unexecuted instantiation: sha512.c:ByteReverseWords Unexecuted instantiation: sp_int.c:ByteReverseWords Unexecuted instantiation: wc_encrypt.c:ByteReverseWords Unexecuted instantiation: wolfmath.c:ByteReverseWords Unexecuted instantiation: ssl.c:ByteReverseWords Unexecuted instantiation: tls.c:ByteReverseWords Unexecuted instantiation: tls13.c:ByteReverseWords Unexecuted instantiation: internal.c:ByteReverseWords |
196 | | |
197 | | #if defined(WORD64_AVAILABLE) && !defined(WOLFSSL_NO_WORD64_OPS) |
198 | | |
199 | | |
200 | | WC_STATIC WC_INLINE word64 rotlFixed64(word64 x, word64 y) |
201 | 7.04M | { |
202 | 7.04M | return (x << y) | (x >> (sizeof(y) * 8 - y)); |
203 | 7.04M | } Unexecuted instantiation: aes.c:rotlFixed64 Unexecuted instantiation: asn.c:rotlFixed64 Unexecuted instantiation: camellia.c:rotlFixed64 Unexecuted instantiation: chacha.c:rotlFixed64 Unexecuted instantiation: chacha20_poly1305.c:rotlFixed64 Unexecuted instantiation: cmac.c:rotlFixed64 Unexecuted instantiation: coding.c:rotlFixed64 Unexecuted instantiation: curve25519.c:rotlFixed64 Unexecuted instantiation: curve448.c:rotlFixed64 Unexecuted instantiation: des3.c:rotlFixed64 Unexecuted instantiation: dh.c:rotlFixed64 Unexecuted instantiation: ecc.c:rotlFixed64 Unexecuted instantiation: ed25519.c:rotlFixed64 Unexecuted instantiation: ed448.c:rotlFixed64 Unexecuted instantiation: fe_448.c:rotlFixed64 Unexecuted instantiation: fe_operations.c:rotlFixed64 Unexecuted instantiation: ge_448.c:rotlFixed64 Unexecuted instantiation: ge_operations.c:rotlFixed64 Unexecuted instantiation: hash.c:rotlFixed64 Unexecuted instantiation: hmac.c:rotlFixed64 Unexecuted instantiation: kdf.c:rotlFixed64 Unexecuted instantiation: md2.c:rotlFixed64 Unexecuted instantiation: md4.c:rotlFixed64 Unexecuted instantiation: md5.c:rotlFixed64 Unexecuted instantiation: poly1305.c:rotlFixed64 Unexecuted instantiation: pwdbased.c:rotlFixed64 Unexecuted instantiation: random.c:rotlFixed64 Unexecuted instantiation: ripemd.c:rotlFixed64 Unexecuted instantiation: rsa.c:rotlFixed64 Unexecuted instantiation: sha.c:rotlFixed64 Unexecuted instantiation: sha256.c:rotlFixed64 Unexecuted instantiation: sha3.c:rotlFixed64 Line | Count | Source | 201 | 7.04M | { | 202 | 7.04M | return (x << y) | (x >> (sizeof(y) * 8 - y)); | 203 | 7.04M | } |
Unexecuted instantiation: sp_int.c:rotlFixed64 Unexecuted instantiation: wc_encrypt.c:rotlFixed64 Unexecuted instantiation: wolfmath.c:rotlFixed64 Unexecuted instantiation: ssl.c:rotlFixed64 Unexecuted instantiation: tls.c:rotlFixed64 Unexecuted instantiation: tls13.c:rotlFixed64 Unexecuted instantiation: internal.c:rotlFixed64 |
204 | | |
205 | | |
206 | | WC_STATIC WC_INLINE word64 rotrFixed64(word64 x, word64 y) |
207 | 310M | { |
208 | 310M | return (x >> y) | (x << (sizeof(y) * 8 - y)); |
209 | 310M | } Unexecuted instantiation: aes.c:rotrFixed64 Unexecuted instantiation: asn.c:rotrFixed64 Unexecuted instantiation: camellia.c:rotrFixed64 Unexecuted instantiation: chacha.c:rotrFixed64 Unexecuted instantiation: chacha20_poly1305.c:rotrFixed64 Unexecuted instantiation: cmac.c:rotrFixed64 Unexecuted instantiation: coding.c:rotrFixed64 Unexecuted instantiation: curve25519.c:rotrFixed64 Unexecuted instantiation: curve448.c:rotrFixed64 Unexecuted instantiation: des3.c:rotrFixed64 Unexecuted instantiation: dh.c:rotrFixed64 Unexecuted instantiation: ecc.c:rotrFixed64 Unexecuted instantiation: ed25519.c:rotrFixed64 Unexecuted instantiation: ed448.c:rotrFixed64 Unexecuted instantiation: fe_448.c:rotrFixed64 Unexecuted instantiation: fe_operations.c:rotrFixed64 Unexecuted instantiation: ge_448.c:rotrFixed64 Unexecuted instantiation: ge_operations.c:rotrFixed64 Unexecuted instantiation: hash.c:rotrFixed64 Unexecuted instantiation: hmac.c:rotrFixed64 Unexecuted instantiation: kdf.c:rotrFixed64 Unexecuted instantiation: md2.c:rotrFixed64 Unexecuted instantiation: md4.c:rotrFixed64 Unexecuted instantiation: md5.c:rotrFixed64 Unexecuted instantiation: poly1305.c:rotrFixed64 Unexecuted instantiation: pwdbased.c:rotrFixed64 Unexecuted instantiation: random.c:rotrFixed64 Unexecuted instantiation: ripemd.c:rotrFixed64 Unexecuted instantiation: rsa.c:rotrFixed64 Unexecuted instantiation: sha.c:rotrFixed64 Unexecuted instantiation: sha256.c:rotrFixed64 Unexecuted instantiation: sha3.c:rotrFixed64 Line | Count | Source | 207 | 310M | { | 208 | 310M | return (x >> y) | (x << (sizeof(y) * 8 - y)); | 209 | 310M | } |
Unexecuted instantiation: sp_int.c:rotrFixed64 Unexecuted instantiation: wc_encrypt.c:rotrFixed64 Unexecuted instantiation: wolfmath.c:rotrFixed64 Unexecuted instantiation: ssl.c:rotrFixed64 Unexecuted instantiation: tls.c:rotrFixed64 Unexecuted instantiation: tls13.c:rotrFixed64 Unexecuted instantiation: internal.c:rotrFixed64 |
210 | | |
211 | | |
212 | | WC_STATIC WC_INLINE word64 ByteReverseWord64(word64 value) |
213 | 7.04M | { |
214 | | #if defined(WOLF_ALLOW_BUILTIN) && defined(__GNUC_PREREQ) && __GNUC_PREREQ(4, 3) |
215 | | return (word64)__builtin_bswap64(value); |
216 | | #elif defined(WOLFCRYPT_SLOW_WORD64) |
217 | | return (word64)((word64)ByteReverseWord32((word32) value)) << 32 | |
218 | | (word64)ByteReverseWord32((word32)(value >> 32)); |
219 | | #else |
220 | 7.04M | value = ((value & W64LIT(0xFF00FF00FF00FF00)) >> 8) | |
221 | 7.04M | ((value & W64LIT(0x00FF00FF00FF00FF)) << 8); |
222 | 7.04M | value = ((value & W64LIT(0xFFFF0000FFFF0000)) >> 16) | |
223 | 7.04M | ((value & W64LIT(0x0000FFFF0000FFFF)) << 16); |
224 | 7.04M | return rotlFixed64(value, 32U); |
225 | 7.04M | #endif |
226 | 7.04M | } Unexecuted instantiation: aes.c:ByteReverseWord64 Unexecuted instantiation: asn.c:ByteReverseWord64 Unexecuted instantiation: camellia.c:ByteReverseWord64 Unexecuted instantiation: chacha.c:ByteReverseWord64 Unexecuted instantiation: chacha20_poly1305.c:ByteReverseWord64 Unexecuted instantiation: cmac.c:ByteReverseWord64 Unexecuted instantiation: coding.c:ByteReverseWord64 Unexecuted instantiation: curve25519.c:ByteReverseWord64 Unexecuted instantiation: curve448.c:ByteReverseWord64 Unexecuted instantiation: des3.c:ByteReverseWord64 Unexecuted instantiation: dh.c:ByteReverseWord64 Unexecuted instantiation: ecc.c:ByteReverseWord64 Unexecuted instantiation: ed25519.c:ByteReverseWord64 Unexecuted instantiation: ed448.c:ByteReverseWord64 Unexecuted instantiation: fe_448.c:ByteReverseWord64 Unexecuted instantiation: fe_operations.c:ByteReverseWord64 Unexecuted instantiation: ge_448.c:ByteReverseWord64 Unexecuted instantiation: ge_operations.c:ByteReverseWord64 Unexecuted instantiation: hash.c:ByteReverseWord64 Unexecuted instantiation: hmac.c:ByteReverseWord64 Unexecuted instantiation: kdf.c:ByteReverseWord64 Unexecuted instantiation: md2.c:ByteReverseWord64 Unexecuted instantiation: md4.c:ByteReverseWord64 Unexecuted instantiation: md5.c:ByteReverseWord64 Unexecuted instantiation: poly1305.c:ByteReverseWord64 Unexecuted instantiation: pwdbased.c:ByteReverseWord64 Unexecuted instantiation: random.c:ByteReverseWord64 Unexecuted instantiation: ripemd.c:ByteReverseWord64 Unexecuted instantiation: rsa.c:ByteReverseWord64 Unexecuted instantiation: sha.c:ByteReverseWord64 Unexecuted instantiation: sha256.c:ByteReverseWord64 Unexecuted instantiation: sha3.c:ByteReverseWord64 sha512.c:ByteReverseWord64 Line | Count | Source | 213 | 7.04M | { | 214 | | #if defined(WOLF_ALLOW_BUILTIN) && defined(__GNUC_PREREQ) && __GNUC_PREREQ(4, 3) | 215 | | return (word64)__builtin_bswap64(value); | 216 | | #elif defined(WOLFCRYPT_SLOW_WORD64) | 217 | | return (word64)((word64)ByteReverseWord32((word32) value)) << 32 | | 218 | | (word64)ByteReverseWord32((word32)(value >> 32)); | 219 | | #else | 220 | 7.04M | value = ((value & W64LIT(0xFF00FF00FF00FF00)) >> 8) | | 221 | 7.04M | ((value & W64LIT(0x00FF00FF00FF00FF)) << 8); | 222 | 7.04M | value = ((value & W64LIT(0xFFFF0000FFFF0000)) >> 16) | | 223 | 7.04M | ((value & W64LIT(0x0000FFFF0000FFFF)) << 16); | 224 | 7.04M | return rotlFixed64(value, 32U); | 225 | 7.04M | #endif | 226 | 7.04M | } |
Unexecuted instantiation: sp_int.c:ByteReverseWord64 Unexecuted instantiation: wc_encrypt.c:ByteReverseWord64 Unexecuted instantiation: wolfmath.c:ByteReverseWord64 Unexecuted instantiation: ssl.c:ByteReverseWord64 Unexecuted instantiation: tls.c:ByteReverseWord64 Unexecuted instantiation: tls13.c:ByteReverseWord64 Unexecuted instantiation: internal.c:ByteReverseWord64 |
227 | | |
228 | | |
229 | | WC_STATIC WC_INLINE void ByteReverseWords64(word64* out, const word64* in, |
230 | | word32 byteCount) |
231 | 469k | { |
232 | 469k | word32 count = byteCount/(word32)sizeof(word64), i; |
233 | | |
234 | 7.51M | for (i = 0; i < count; i++) |
235 | 7.04M | out[i] = ByteReverseWord64(in[i]); |
236 | | |
237 | 469k | } Unexecuted instantiation: aes.c:ByteReverseWords64 Unexecuted instantiation: asn.c:ByteReverseWords64 Unexecuted instantiation: camellia.c:ByteReverseWords64 Unexecuted instantiation: chacha.c:ByteReverseWords64 Unexecuted instantiation: chacha20_poly1305.c:ByteReverseWords64 Unexecuted instantiation: cmac.c:ByteReverseWords64 Unexecuted instantiation: coding.c:ByteReverseWords64 Unexecuted instantiation: curve25519.c:ByteReverseWords64 Unexecuted instantiation: curve448.c:ByteReverseWords64 Unexecuted instantiation: des3.c:ByteReverseWords64 Unexecuted instantiation: dh.c:ByteReverseWords64 Unexecuted instantiation: ecc.c:ByteReverseWords64 Unexecuted instantiation: ed25519.c:ByteReverseWords64 Unexecuted instantiation: ed448.c:ByteReverseWords64 Unexecuted instantiation: fe_448.c:ByteReverseWords64 Unexecuted instantiation: fe_operations.c:ByteReverseWords64 Unexecuted instantiation: ge_448.c:ByteReverseWords64 Unexecuted instantiation: ge_operations.c:ByteReverseWords64 Unexecuted instantiation: hash.c:ByteReverseWords64 Unexecuted instantiation: hmac.c:ByteReverseWords64 Unexecuted instantiation: kdf.c:ByteReverseWords64 Unexecuted instantiation: md2.c:ByteReverseWords64 Unexecuted instantiation: md4.c:ByteReverseWords64 Unexecuted instantiation: md5.c:ByteReverseWords64 Unexecuted instantiation: poly1305.c:ByteReverseWords64 Unexecuted instantiation: pwdbased.c:ByteReverseWords64 Unexecuted instantiation: random.c:ByteReverseWords64 Unexecuted instantiation: ripemd.c:ByteReverseWords64 Unexecuted instantiation: rsa.c:ByteReverseWords64 Unexecuted instantiation: sha.c:ByteReverseWords64 Unexecuted instantiation: sha256.c:ByteReverseWords64 Unexecuted instantiation: sha3.c:ByteReverseWords64 sha512.c:ByteReverseWords64 Line | Count | Source | 231 | 469k | { | 232 | 469k | word32 count = byteCount/(word32)sizeof(word64), i; | 233 | | | 234 | 7.51M | for (i = 0; i < count; i++) | 235 | 7.04M | out[i] = ByteReverseWord64(in[i]); | 236 | | | 237 | 469k | } |
Unexecuted instantiation: sp_int.c:ByteReverseWords64 Unexecuted instantiation: wc_encrypt.c:ByteReverseWords64 Unexecuted instantiation: wolfmath.c:ByteReverseWords64 Unexecuted instantiation: ssl.c:ByteReverseWords64 Unexecuted instantiation: tls.c:ByteReverseWords64 Unexecuted instantiation: tls13.c:ByteReverseWords64 Unexecuted instantiation: internal.c:ByteReverseWords64 |
238 | | |
239 | | #endif /* WORD64_AVAILABLE && !WOLFSSL_NO_WORD64_OPS */ |
240 | | |
241 | | #ifndef WOLFSSL_NO_XOR_OPS |
242 | | /* This routine performs a bitwise XOR operation of <*r> and <*a> for <n> number |
243 | | of wolfssl_words, placing the result in <*r>. */ |
244 | | WC_STATIC WC_INLINE void XorWordsOut(wolfssl_word* r, const wolfssl_word* a, |
245 | | const wolfssl_word* b, word32 n) |
246 | 14.6k | { |
247 | 14.6k | word32 i; |
248 | | |
249 | 43.9k | for (i = 0; i < n; i++) r[i] = a[i] ^ b[i]; |
250 | 14.6k | } Line | Count | Source | 246 | 14.6k | { | 247 | 14.6k | word32 i; | 248 | | | 249 | 43.9k | for (i = 0; i < n; i++) r[i] = a[i] ^ b[i]; | 250 | 14.6k | } |
Unexecuted instantiation: asn.c:XorWordsOut Unexecuted instantiation: camellia.c:XorWordsOut Unexecuted instantiation: chacha.c:XorWordsOut Unexecuted instantiation: chacha20_poly1305.c:XorWordsOut Unexecuted instantiation: cmac.c:XorWordsOut Unexecuted instantiation: coding.c:XorWordsOut Unexecuted instantiation: curve25519.c:XorWordsOut Unexecuted instantiation: curve448.c:XorWordsOut Unexecuted instantiation: des3.c:XorWordsOut Unexecuted instantiation: dh.c:XorWordsOut Unexecuted instantiation: ecc.c:XorWordsOut Unexecuted instantiation: ed25519.c:XorWordsOut Unexecuted instantiation: ed448.c:XorWordsOut Unexecuted instantiation: fe_448.c:XorWordsOut Unexecuted instantiation: fe_operations.c:XorWordsOut Unexecuted instantiation: ge_448.c:XorWordsOut Unexecuted instantiation: ge_operations.c:XorWordsOut Unexecuted instantiation: hash.c:XorWordsOut Unexecuted instantiation: hmac.c:XorWordsOut Unexecuted instantiation: kdf.c:XorWordsOut Unexecuted instantiation: md2.c:XorWordsOut Unexecuted instantiation: md4.c:XorWordsOut Unexecuted instantiation: md5.c:XorWordsOut Unexecuted instantiation: poly1305.c:XorWordsOut Unexecuted instantiation: pwdbased.c:XorWordsOut Unexecuted instantiation: random.c:XorWordsOut Unexecuted instantiation: ripemd.c:XorWordsOut Unexecuted instantiation: rsa.c:XorWordsOut Unexecuted instantiation: sha.c:XorWordsOut Unexecuted instantiation: sha256.c:XorWordsOut Unexecuted instantiation: sha3.c:XorWordsOut Unexecuted instantiation: sha512.c:XorWordsOut Unexecuted instantiation: sp_int.c:XorWordsOut Unexecuted instantiation: wc_encrypt.c:XorWordsOut Unexecuted instantiation: wolfmath.c:XorWordsOut Unexecuted instantiation: ssl.c:XorWordsOut Unexecuted instantiation: tls.c:XorWordsOut Unexecuted instantiation: tls13.c:XorWordsOut Unexecuted instantiation: internal.c:XorWordsOut |
251 | | |
252 | | /* This routine performs a bitwise XOR operation of <*buf> and <*mask> of n |
253 | | counts, placing the result in <*buf>. */ |
254 | | |
255 | | WC_STATIC WC_INLINE void xorbufout(void*out, const void* buf, const void* mask, |
256 | | word32 count) |
257 | 56.6k | { |
258 | 56.6k | if (((wc_ptr_t)out | (wc_ptr_t)buf | (wc_ptr_t)mask | count) % |
259 | 56.6k | WOLFSSL_WORD_SIZE == 0) |
260 | 14.6k | XorWordsOut( (wolfssl_word*)out, (wolfssl_word*)buf, |
261 | 14.6k | (const wolfssl_word*)mask, count / WOLFSSL_WORD_SIZE); |
262 | 42.0k | else { |
263 | 42.0k | word32 i; |
264 | 42.0k | byte* o = (byte*)out; |
265 | 42.0k | byte* b = (byte*)buf; |
266 | 42.0k | const byte* m = (const byte*)mask; |
267 | | |
268 | 700k | for (i = 0; i < count; i++) o[i] = b[i] ^ m[i]; |
269 | 42.0k | } |
270 | 56.6k | } Line | Count | Source | 257 | 56.6k | { | 258 | 56.6k | if (((wc_ptr_t)out | (wc_ptr_t)buf | (wc_ptr_t)mask | count) % | 259 | 56.6k | WOLFSSL_WORD_SIZE == 0) | 260 | 14.6k | XorWordsOut( (wolfssl_word*)out, (wolfssl_word*)buf, | 261 | 14.6k | (const wolfssl_word*)mask, count / WOLFSSL_WORD_SIZE); | 262 | 42.0k | else { | 263 | 42.0k | word32 i; | 264 | 42.0k | byte* o = (byte*)out; | 265 | 42.0k | byte* b = (byte*)buf; | 266 | 42.0k | const byte* m = (const byte*)mask; | 267 | | | 268 | 700k | for (i = 0; i < count; i++) o[i] = b[i] ^ m[i]; | 269 | 42.0k | } | 270 | 56.6k | } |
Unexecuted instantiation: asn.c:xorbufout Unexecuted instantiation: camellia.c:xorbufout Unexecuted instantiation: chacha.c:xorbufout Unexecuted instantiation: chacha20_poly1305.c:xorbufout Unexecuted instantiation: cmac.c:xorbufout Unexecuted instantiation: coding.c:xorbufout Unexecuted instantiation: curve25519.c:xorbufout Unexecuted instantiation: curve448.c:xorbufout Unexecuted instantiation: des3.c:xorbufout Unexecuted instantiation: dh.c:xorbufout Unexecuted instantiation: ecc.c:xorbufout Unexecuted instantiation: ed25519.c:xorbufout Unexecuted instantiation: ed448.c:xorbufout Unexecuted instantiation: fe_448.c:xorbufout Unexecuted instantiation: fe_operations.c:xorbufout Unexecuted instantiation: ge_448.c:xorbufout Unexecuted instantiation: ge_operations.c:xorbufout Unexecuted instantiation: hash.c:xorbufout Unexecuted instantiation: hmac.c:xorbufout Unexecuted instantiation: kdf.c:xorbufout Unexecuted instantiation: md2.c:xorbufout Unexecuted instantiation: md4.c:xorbufout Unexecuted instantiation: md5.c:xorbufout Unexecuted instantiation: poly1305.c:xorbufout Unexecuted instantiation: pwdbased.c:xorbufout Unexecuted instantiation: random.c:xorbufout Unexecuted instantiation: ripemd.c:xorbufout Unexecuted instantiation: rsa.c:xorbufout Unexecuted instantiation: sha.c:xorbufout Unexecuted instantiation: sha256.c:xorbufout Unexecuted instantiation: sha3.c:xorbufout Unexecuted instantiation: sha512.c:xorbufout Unexecuted instantiation: sp_int.c:xorbufout Unexecuted instantiation: wc_encrypt.c:xorbufout Unexecuted instantiation: wolfmath.c:xorbufout Unexecuted instantiation: ssl.c:xorbufout Unexecuted instantiation: tls.c:xorbufout Unexecuted instantiation: tls13.c:xorbufout Unexecuted instantiation: internal.c:xorbufout |
271 | | |
272 | | /* This routine performs a bitwise XOR operation of <*r> and <*a> for <n> number |
273 | | of wolfssl_words, placing the result in <*r>. */ |
274 | | WC_STATIC WC_INLINE void XorWords(wolfssl_word* r, const wolfssl_word* a, word32 n) |
275 | 54.9k | { |
276 | 54.9k | word32 i; |
277 | | |
278 | 183k | for (i = 0; i < n; i++) r[i] ^= a[i]; |
279 | 54.9k | } Line | Count | Source | 275 | 52.9k | { | 276 | 52.9k | word32 i; | 277 | | | 278 | 163k | for (i = 0; i < n; i++) r[i] ^= a[i]; | 279 | 52.9k | } |
Unexecuted instantiation: asn.c:XorWords Unexecuted instantiation: camellia.c:XorWords Unexecuted instantiation: chacha.c:XorWords Unexecuted instantiation: chacha20_poly1305.c:XorWords Unexecuted instantiation: cmac.c:XorWords Unexecuted instantiation: coding.c:XorWords Unexecuted instantiation: curve25519.c:XorWords Unexecuted instantiation: curve448.c:XorWords Line | Count | Source | 275 | 1.04k | { | 276 | 1.04k | word32 i; | 277 | | | 278 | 2.08k | for (i = 0; i < n; i++) r[i] ^= a[i]; | 279 | 1.04k | } |
Unexecuted instantiation: dh.c:XorWords Unexecuted instantiation: ecc.c:XorWords Unexecuted instantiation: ed25519.c:XorWords Unexecuted instantiation: ed448.c:XorWords Unexecuted instantiation: fe_448.c:XorWords Unexecuted instantiation: fe_operations.c:XorWords Unexecuted instantiation: ge_448.c:XorWords Unexecuted instantiation: ge_operations.c:XorWords Unexecuted instantiation: hash.c:XorWords Unexecuted instantiation: hmac.c:XorWords Line | Count | Source | 275 | 1.03k | { | 276 | 1.03k | word32 i; | 277 | | | 278 | 17.5k | for (i = 0; i < n; i++) r[i] ^= a[i]; | 279 | 1.03k | } |
Unexecuted instantiation: md2.c:XorWords Unexecuted instantiation: md4.c:XorWords Unexecuted instantiation: md5.c:XorWords Unexecuted instantiation: poly1305.c:XorWords Unexecuted instantiation: pwdbased.c:XorWords Unexecuted instantiation: random.c:XorWords Unexecuted instantiation: ripemd.c:XorWords Unexecuted instantiation: rsa.c:XorWords Unexecuted instantiation: sha.c:XorWords Unexecuted instantiation: sha256.c:XorWords Unexecuted instantiation: sha3.c:XorWords Unexecuted instantiation: sha512.c:XorWords Unexecuted instantiation: sp_int.c:XorWords Unexecuted instantiation: wc_encrypt.c:XorWords Unexecuted instantiation: wolfmath.c:XorWords Unexecuted instantiation: ssl.c:XorWords Unexecuted instantiation: tls.c:XorWords Unexecuted instantiation: tls13.c:XorWords Unexecuted instantiation: internal.c:XorWords |
280 | | |
281 | | /* This routine performs a bitwise XOR operation of <*buf> and <*mask> of n |
282 | | counts, placing the result in <*buf>. */ |
283 | | |
284 | | WC_STATIC WC_INLINE void xorbuf(void* buf, const void* mask, word32 count) |
285 | 99.0k | { |
286 | 99.0k | if (((wc_ptr_t)buf | (wc_ptr_t)mask | count) % WOLFSSL_WORD_SIZE == 0) |
287 | 54.9k | XorWords( (wolfssl_word*)buf, |
288 | 54.9k | (const wolfssl_word*)mask, count / WOLFSSL_WORD_SIZE); |
289 | 44.1k | else { |
290 | 44.1k | word32 i; |
291 | 44.1k | byte* b = (byte*)buf; |
292 | 44.1k | const byte* m = (const byte*)mask; |
293 | | |
294 | 780k | for (i = 0; i < count; i++) b[i] ^= m[i]; |
295 | 44.1k | } |
296 | 99.0k | } Line | Count | Source | 285 | 95.9k | { | 286 | 95.9k | if (((wc_ptr_t)buf | (wc_ptr_t)mask | count) % WOLFSSL_WORD_SIZE == 0) | 287 | 52.9k | XorWords( (wolfssl_word*)buf, | 288 | 52.9k | (const wolfssl_word*)mask, count / WOLFSSL_WORD_SIZE); | 289 | 43.0k | else { | 290 | 43.0k | word32 i; | 291 | 43.0k | byte* b = (byte*)buf; | 292 | 43.0k | const byte* m = (const byte*)mask; | 293 | | | 294 | 729k | for (i = 0; i < count; i++) b[i] ^= m[i]; | 295 | 43.0k | } | 296 | 95.9k | } |
Unexecuted instantiation: asn.c:xorbuf Unexecuted instantiation: camellia.c:xorbuf Unexecuted instantiation: chacha.c:xorbuf Unexecuted instantiation: chacha20_poly1305.c:xorbuf Unexecuted instantiation: cmac.c:xorbuf Unexecuted instantiation: coding.c:xorbuf Unexecuted instantiation: curve25519.c:xorbuf Unexecuted instantiation: curve448.c:xorbuf Line | Count | Source | 285 | 1.04k | { | 286 | 1.04k | if (((wc_ptr_t)buf | (wc_ptr_t)mask | count) % WOLFSSL_WORD_SIZE == 0) | 287 | 1.04k | XorWords( (wolfssl_word*)buf, | 288 | 1.04k | (const wolfssl_word*)mask, count / WOLFSSL_WORD_SIZE); | 289 | 0 | else { | 290 | 0 | word32 i; | 291 | 0 | byte* b = (byte*)buf; | 292 | 0 | const byte* m = (const byte*)mask; | 293 | |
| 294 | 0 | for (i = 0; i < count; i++) b[i] ^= m[i]; | 295 | 0 | } | 296 | 1.04k | } |
Unexecuted instantiation: dh.c:xorbuf Unexecuted instantiation: ecc.c:xorbuf Unexecuted instantiation: ed25519.c:xorbuf Unexecuted instantiation: ed448.c:xorbuf Unexecuted instantiation: fe_448.c:xorbuf Unexecuted instantiation: fe_operations.c:xorbuf Unexecuted instantiation: ge_448.c:xorbuf Unexecuted instantiation: ge_operations.c:xorbuf Unexecuted instantiation: hash.c:xorbuf Unexecuted instantiation: hmac.c:xorbuf Line | Count | Source | 285 | 2.07k | { | 286 | 2.07k | if (((wc_ptr_t)buf | (wc_ptr_t)mask | count) % WOLFSSL_WORD_SIZE == 0) | 287 | 1.03k | XorWords( (wolfssl_word*)buf, | 288 | 1.03k | (const wolfssl_word*)mask, count / WOLFSSL_WORD_SIZE); | 289 | 1.04k | else { | 290 | 1.04k | word32 i; | 291 | 1.04k | byte* b = (byte*)buf; | 292 | 1.04k | const byte* m = (const byte*)mask; | 293 | | | 294 | 50.7k | for (i = 0; i < count; i++) b[i] ^= m[i]; | 295 | 1.04k | } | 296 | 2.07k | } |
Unexecuted instantiation: md2.c:xorbuf Unexecuted instantiation: md4.c:xorbuf Unexecuted instantiation: md5.c:xorbuf Unexecuted instantiation: poly1305.c:xorbuf Unexecuted instantiation: pwdbased.c:xorbuf Unexecuted instantiation: random.c:xorbuf Unexecuted instantiation: ripemd.c:xorbuf Unexecuted instantiation: rsa.c:xorbuf Unexecuted instantiation: sha.c:xorbuf Unexecuted instantiation: sha256.c:xorbuf Unexecuted instantiation: sha3.c:xorbuf Unexecuted instantiation: sha512.c:xorbuf Unexecuted instantiation: sp_int.c:xorbuf Unexecuted instantiation: wc_encrypt.c:xorbuf Unexecuted instantiation: wolfmath.c:xorbuf Unexecuted instantiation: ssl.c:xorbuf Unexecuted instantiation: tls.c:xorbuf Unexecuted instantiation: tls13.c:xorbuf Unexecuted instantiation: internal.c:xorbuf |
297 | | #endif |
298 | | |
299 | | #ifndef WOLFSSL_NO_FORCE_ZERO |
300 | | /* This routine fills the first len bytes of the memory area pointed by mem |
301 | | with zeros. It ensures compiler optimizations doesn't skip it */ |
302 | | WC_STATIC WC_INLINE void ForceZero(void* mem, word32 len) |
303 | 497k | { |
304 | 497k | volatile byte* z = (volatile byte*)mem; |
305 | | |
306 | 497k | #if (defined(WOLFSSL_X86_64_BUILD) || defined(WOLFSSL_AARCH64_BUILD)) \ |
307 | 497k | && defined(WORD64_AVAILABLE) |
308 | 497k | volatile word64* w; |
309 | 497k | #ifndef WOLFSSL_UNALIGNED_64BIT_ACCESS |
310 | 497k | word32 l = (sizeof(word64) - ((size_t)z & (sizeof(word64)-1))) & |
311 | 497k | (sizeof(word64)-1); |
312 | | |
313 | 497k | if (len < l) l = len; |
314 | 497k | len -= l; |
315 | 524k | while (l--) *z++ = 0; |
316 | 497k | #endif |
317 | 24.9M | for (w = (volatile word64*)z; len >= sizeof(*w); len -= sizeof(*w)) |
318 | 24.4M | *w++ = 0; |
319 | 497k | z = (volatile byte*)w; |
320 | 497k | #endif |
321 | | |
322 | 1.59M | while (len--) *z++ = 0; |
323 | 497k | } Line | Count | Source | 303 | 2.38k | { | 304 | 2.38k | volatile byte* z = (volatile byte*)mem; | 305 | | | 306 | 2.38k | #if (defined(WOLFSSL_X86_64_BUILD) || defined(WOLFSSL_AARCH64_BUILD)) \ | 307 | 2.38k | && defined(WORD64_AVAILABLE) | 308 | 2.38k | volatile word64* w; | 309 | 2.38k | #ifndef WOLFSSL_UNALIGNED_64BIT_ACCESS | 310 | 2.38k | word32 l = (sizeof(word64) - ((size_t)z & (sizeof(word64)-1))) & | 311 | 2.38k | (sizeof(word64)-1); | 312 | | | 313 | 2.38k | if (len < l) l = len; | 314 | 2.38k | len -= l; | 315 | 11.1k | while (l--) *z++ = 0; | 316 | 2.38k | #endif | 317 | 4.71k | for (w = (volatile word64*)z; len >= sizeof(*w); len -= sizeof(*w)) | 318 | 2.33k | *w++ = 0; | 319 | 2.38k | z = (volatile byte*)w; | 320 | 2.38k | #endif | 321 | | | 322 | 4.95k | while (len--) *z++ = 0; | 323 | 2.38k | } |
Unexecuted instantiation: asn.c:ForceZero Unexecuted instantiation: camellia.c:ForceZero Unexecuted instantiation: chacha.c:ForceZero Unexecuted instantiation: chacha20_poly1305.c:ForceZero Unexecuted instantiation: cmac.c:ForceZero Unexecuted instantiation: coding.c:ForceZero Line | Count | Source | 303 | 768 | { | 304 | 768 | volatile byte* z = (volatile byte*)mem; | 305 | | | 306 | 768 | #if (defined(WOLFSSL_X86_64_BUILD) || defined(WOLFSSL_AARCH64_BUILD)) \ | 307 | 768 | && defined(WORD64_AVAILABLE) | 308 | 768 | volatile word64* w; | 309 | 768 | #ifndef WOLFSSL_UNALIGNED_64BIT_ACCESS | 310 | 768 | word32 l = (sizeof(word64) - ((size_t)z & (sizeof(word64)-1))) & | 311 | 768 | (sizeof(word64)-1); | 312 | | | 313 | 768 | if (len < l) l = len; | 314 | 768 | len -= l; | 315 | 6.14k | while (l--) *z++ = 0; | 316 | 768 | #endif | 317 | 3.07k | for (w = (volatile word64*)z; len >= sizeof(*w); len -= sizeof(*w)) | 318 | 2.30k | *w++ = 0; | 319 | 768 | z = (volatile byte*)w; | 320 | 768 | #endif | 321 | | | 322 | 1.53k | while (len--) *z++ = 0; | 323 | 768 | } |
Line | Count | Source | 303 | 505 | { | 304 | 505 | volatile byte* z = (volatile byte*)mem; | 305 | | | 306 | 505 | #if (defined(WOLFSSL_X86_64_BUILD) || defined(WOLFSSL_AARCH64_BUILD)) \ | 307 | 505 | && defined(WORD64_AVAILABLE) | 308 | 505 | volatile word64* w; | 309 | 505 | #ifndef WOLFSSL_UNALIGNED_64BIT_ACCESS | 310 | 505 | word32 l = (sizeof(word64) - ((size_t)z & (sizeof(word64)-1))) & | 311 | 505 | (sizeof(word64)-1); | 312 | | | 313 | 505 | if (len < l) l = len; | 314 | 505 | len -= l; | 315 | 505 | while (l--) *z++ = 0; | 316 | 505 | #endif | 317 | 4.04k | for (w = (volatile word64*)z; len >= sizeof(*w); len -= sizeof(*w)) | 318 | 3.53k | *w++ = 0; | 319 | 505 | z = (volatile byte*)w; | 320 | 505 | #endif | 321 | | | 322 | 505 | while (len--) *z++ = 0; | 323 | 505 | } |
Unexecuted instantiation: des3.c:ForceZero Unexecuted instantiation: dh.c:ForceZero Line | Count | Source | 303 | 63.4k | { | 304 | 63.4k | volatile byte* z = (volatile byte*)mem; | 305 | | | 306 | 63.4k | #if (defined(WOLFSSL_X86_64_BUILD) || defined(WOLFSSL_AARCH64_BUILD)) \ | 307 | 63.4k | && defined(WORD64_AVAILABLE) | 308 | 63.4k | volatile word64* w; | 309 | 63.4k | #ifndef WOLFSSL_UNALIGNED_64BIT_ACCESS | 310 | 63.4k | word32 l = (sizeof(word64) - ((size_t)z & (sizeof(word64)-1))) & | 311 | 63.4k | (sizeof(word64)-1); | 312 | | | 313 | 63.4k | if (len < l) l = len; | 314 | 63.4k | len -= l; | 315 | 63.4k | while (l--) *z++ = 0; | 316 | 63.4k | #endif | 317 | 19.4M | for (w = (volatile word64*)z; len >= sizeof(*w); len -= sizeof(*w)) | 318 | 19.4M | *w++ = 0; | 319 | 63.4k | z = (volatile byte*)w; | 320 | 63.4k | #endif | 321 | | | 322 | 109k | while (len--) *z++ = 0; | 323 | 63.4k | } |
Line | Count | Source | 303 | 7.63k | { | 304 | 7.63k | volatile byte* z = (volatile byte*)mem; | 305 | | | 306 | 7.63k | #if (defined(WOLFSSL_X86_64_BUILD) || defined(WOLFSSL_AARCH64_BUILD)) \ | 307 | 7.63k | && defined(WORD64_AVAILABLE) | 308 | 7.63k | volatile word64* w; | 309 | 7.63k | #ifndef WOLFSSL_UNALIGNED_64BIT_ACCESS | 310 | 7.63k | word32 l = (sizeof(word64) - ((size_t)z & (sizeof(word64)-1))) & | 311 | 7.63k | (sizeof(word64)-1); | 312 | | | 313 | 7.63k | if (len < l) l = len; | 314 | 7.63k | len -= l; | 315 | 7.63k | while (l--) *z++ = 0; | 316 | 7.63k | #endif | 317 | 355k | for (w = (volatile word64*)z; len >= sizeof(*w); len -= sizeof(*w)) | 318 | 347k | *w++ = 0; | 319 | 7.63k | z = (volatile byte*)w; | 320 | 7.63k | #endif | 321 | | | 322 | 7.63k | while (len--) *z++ = 0; | 323 | 7.63k | } |
Line | Count | Source | 303 | 6.29k | { | 304 | 6.29k | volatile byte* z = (volatile byte*)mem; | 305 | | | 306 | 6.29k | #if (defined(WOLFSSL_X86_64_BUILD) || defined(WOLFSSL_AARCH64_BUILD)) \ | 307 | 6.29k | && defined(WORD64_AVAILABLE) | 308 | 6.29k | volatile word64* w; | 309 | 6.29k | #ifndef WOLFSSL_UNALIGNED_64BIT_ACCESS | 310 | 6.29k | word32 l = (sizeof(word64) - ((size_t)z & (sizeof(word64)-1))) & | 311 | 6.29k | (sizeof(word64)-1); | 312 | | | 313 | 6.29k | if (len < l) l = len; | 314 | 6.29k | len -= l; | 315 | 6.29k | while (l--) *z++ = 0; | 316 | 6.29k | #endif | 317 | 490k | for (w = (volatile word64*)z; len >= sizeof(*w); len -= sizeof(*w)) | 318 | 484k | *w++ = 0; | 319 | 6.29k | z = (volatile byte*)w; | 320 | 6.29k | #endif | 321 | | | 322 | 6.29k | while (len--) *z++ = 0; | 323 | 6.29k | } |
Unexecuted instantiation: fe_448.c:ForceZero Unexecuted instantiation: fe_operations.c:ForceZero Unexecuted instantiation: ge_448.c:ForceZero Unexecuted instantiation: ge_operations.c:ForceZero Unexecuted instantiation: hash.c:ForceZero Unexecuted instantiation: hmac.c:ForceZero Unexecuted instantiation: md2.c:ForceZero Unexecuted instantiation: md4.c:ForceZero Unexecuted instantiation: md5.c:ForceZero Unexecuted instantiation: poly1305.c:ForceZero Unexecuted instantiation: pwdbased.c:ForceZero Line | Count | Source | 303 | 304k | { | 304 | 304k | volatile byte* z = (volatile byte*)mem; | 305 | | | 306 | 304k | #if (defined(WOLFSSL_X86_64_BUILD) || defined(WOLFSSL_AARCH64_BUILD)) \ | 307 | 304k | && defined(WORD64_AVAILABLE) | 308 | 304k | volatile word64* w; | 309 | 304k | #ifndef WOLFSSL_UNALIGNED_64BIT_ACCESS | 310 | 304k | word32 l = (sizeof(word64) - ((size_t)z & (sizeof(word64)-1))) & | 311 | 304k | (sizeof(word64)-1); | 312 | | | 313 | 304k | if (len < l) l = len; | 314 | 304k | len -= l; | 315 | 304k | while (l--) *z++ = 0; | 316 | 304k | #endif | 317 | 1.85M | for (w = (volatile word64*)z; len >= sizeof(*w); len -= sizeof(*w)) | 318 | 1.54M | *w++ = 0; | 319 | 304k | z = (volatile byte*)w; | 320 | 304k | #endif | 321 | | | 322 | 1.34M | while (len--) *z++ = 0; | 323 | 304k | } |
Unexecuted instantiation: ripemd.c:ForceZero Unexecuted instantiation: sha.c:ForceZero Unexecuted instantiation: sha256.c:ForceZero Unexecuted instantiation: sha3.c:ForceZero Line | Count | Source | 303 | 47.6k | { | 304 | 47.6k | volatile byte* z = (volatile byte*)mem; | 305 | | | 306 | 47.6k | #if (defined(WOLFSSL_X86_64_BUILD) || defined(WOLFSSL_AARCH64_BUILD)) \ | 307 | 47.6k | && defined(WORD64_AVAILABLE) | 308 | 47.6k | volatile word64* w; | 309 | 47.6k | #ifndef WOLFSSL_UNALIGNED_64BIT_ACCESS | 310 | 47.6k | word32 l = (sizeof(word64) - ((size_t)z & (sizeof(word64)-1))) & | 311 | 47.6k | (sizeof(word64)-1); | 312 | | | 313 | 47.6k | if (len < l) l = len; | 314 | 47.6k | len -= l; | 315 | 47.6k | while (l--) *z++ = 0; | 316 | 47.6k | #endif | 317 | 620k | for (w = (volatile word64*)z; len >= sizeof(*w); len -= sizeof(*w)) | 318 | 572k | *w++ = 0; | 319 | 47.6k | z = (volatile byte*)w; | 320 | 47.6k | #endif | 321 | | | 322 | 47.6k | while (len--) *z++ = 0; | 323 | 47.6k | } |
Line | Count | Source | 303 | 46.0k | { | 304 | 46.0k | volatile byte* z = (volatile byte*)mem; | 305 | | | 306 | 46.0k | #if (defined(WOLFSSL_X86_64_BUILD) || defined(WOLFSSL_AARCH64_BUILD)) \ | 307 | 46.0k | && defined(WORD64_AVAILABLE) | 308 | 46.0k | volatile word64* w; | 309 | 46.0k | #ifndef WOLFSSL_UNALIGNED_64BIT_ACCESS | 310 | 46.0k | word32 l = (sizeof(word64) - ((size_t)z & (sizeof(word64)-1))) & | 311 | 46.0k | (sizeof(word64)-1); | 312 | | | 313 | 46.0k | if (len < l) l = len; | 314 | 46.0k | len -= l; | 315 | 59.1k | while (l--) *z++ = 0; | 316 | 46.0k | #endif | 317 | 115k | for (w = (volatile word64*)z; len >= sizeof(*w); len -= sizeof(*w)) | 318 | 69.0k | *w++ = 0; | 319 | 46.0k | z = (volatile byte*)w; | 320 | 46.0k | #endif | 321 | | | 322 | 54.6k | while (len--) *z++ = 0; | 323 | 46.0k | } |
Unexecuted instantiation: wc_encrypt.c:ForceZero Unexecuted instantiation: wolfmath.c:ForceZero Line | Count | Source | 303 | 18.0k | { | 304 | 18.0k | volatile byte* z = (volatile byte*)mem; | 305 | | | 306 | 18.0k | #if (defined(WOLFSSL_X86_64_BUILD) || defined(WOLFSSL_AARCH64_BUILD)) \ | 307 | 18.0k | && defined(WORD64_AVAILABLE) | 308 | 18.0k | volatile word64* w; | 309 | 18.0k | #ifndef WOLFSSL_UNALIGNED_64BIT_ACCESS | 310 | 18.0k | word32 l = (sizeof(word64) - ((size_t)z & (sizeof(word64)-1))) & | 311 | 18.0k | (sizeof(word64)-1); | 312 | | | 313 | 18.0k | if (len < l) l = len; | 314 | 18.0k | len -= l; | 315 | 18.0k | while (l--) *z++ = 0; | 316 | 18.0k | #endif | 317 | 2.08M | for (w = (volatile word64*)z; len >= sizeof(*w); len -= sizeof(*w)) | 318 | 2.06M | *w++ = 0; | 319 | 18.0k | z = (volatile byte*)w; | 320 | 18.0k | #endif | 321 | | | 322 | 18.0k | while (len--) *z++ = 0; | 323 | 18.0k | } |
|
324 | | #endif |
325 | | |
326 | | |
327 | | #ifndef WOLFSSL_NO_CONST_CMP |
328 | | /* check all length bytes for equality, return 0 on success */ |
329 | | WC_STATIC WC_INLINE int ConstantCompare(const byte* a, const byte* b, int length) |
330 | 1.27M | { |
331 | 1.27M | int i; |
332 | 1.27M | int compareSum = 0; |
333 | | |
334 | 29.0M | for (i = 0; i < length; i++) { |
335 | 27.7M | compareSum |= a[i] ^ b[i]; |
336 | 27.7M | } |
337 | | |
338 | 1.27M | return compareSum; |
339 | 1.27M | } Line | Count | Source | 330 | 1.31k | { | 331 | 1.31k | int i; | 332 | 1.31k | int compareSum = 0; | 333 | | | 334 | 22.1k | for (i = 0; i < length; i++) { | 335 | 20.8k | compareSum |= a[i] ^ b[i]; | 336 | 20.8k | } | 337 | | | 338 | 1.31k | return compareSum; | 339 | 1.31k | } |
Unexecuted instantiation: asn.c:ConstantCompare Unexecuted instantiation: camellia.c:ConstantCompare Unexecuted instantiation: chacha.c:ConstantCompare Unexecuted instantiation: chacha20_poly1305.c:ConstantCompare Unexecuted instantiation: cmac.c:ConstantCompare Unexecuted instantiation: coding.c:ConstantCompare Unexecuted instantiation: curve25519.c:ConstantCompare Unexecuted instantiation: curve448.c:ConstantCompare Unexecuted instantiation: des3.c:ConstantCompare Unexecuted instantiation: dh.c:ConstantCompare Unexecuted instantiation: ecc.c:ConstantCompare ed25519.c:ConstantCompare Line | Count | Source | 330 | 2.29k | { | 331 | 2.29k | int i; | 332 | 2.29k | int compareSum = 0; | 333 | | | 334 | 75.6k | for (i = 0; i < length; i++) { | 335 | 73.3k | compareSum |= a[i] ^ b[i]; | 336 | 73.3k | } | 337 | | | 338 | 2.29k | return compareSum; | 339 | 2.29k | } |
Line | Count | Source | 330 | 1.75k | { | 331 | 1.75k | int i; | 332 | 1.75k | int compareSum = 0; | 333 | | | 334 | 101k | for (i = 0; i < length; i++) { | 335 | 99.8k | compareSum |= a[i] ^ b[i]; | 336 | 99.8k | } | 337 | | | 338 | 1.75k | return compareSum; | 339 | 1.75k | } |
Unexecuted instantiation: fe_448.c:ConstantCompare fe_operations.c:ConstantCompare Line | Count | Source | 330 | 4.53k | { | 331 | 4.53k | int i; | 332 | 4.53k | int compareSum = 0; | 333 | | | 334 | 149k | for (i = 0; i < length; i++) { | 335 | 145k | compareSum |= a[i] ^ b[i]; | 336 | 145k | } | 337 | | | 338 | 4.53k | return compareSum; | 339 | 4.53k | } |
Unexecuted instantiation: ge_448.c:ConstantCompare Unexecuted instantiation: ge_operations.c:ConstantCompare Unexecuted instantiation: hash.c:ConstantCompare Unexecuted instantiation: hmac.c:ConstantCompare Unexecuted instantiation: kdf.c:ConstantCompare Unexecuted instantiation: md2.c:ConstantCompare Unexecuted instantiation: md4.c:ConstantCompare Unexecuted instantiation: md5.c:ConstantCompare Unexecuted instantiation: poly1305.c:ConstantCompare Unexecuted instantiation: pwdbased.c:ConstantCompare Line | Count | Source | 330 | 1.25M | { | 331 | 1.25M | int i; | 332 | 1.25M | int compareSum = 0; | 333 | | | 334 | 28.6M | for (i = 0; i < length; i++) { | 335 | 27.3M | compareSum |= a[i] ^ b[i]; | 336 | 27.3M | } | 337 | | | 338 | 1.25M | return compareSum; | 339 | 1.25M | } |
Unexecuted instantiation: ripemd.c:ConstantCompare Unexecuted instantiation: rsa.c:ConstantCompare Unexecuted instantiation: sha.c:ConstantCompare Unexecuted instantiation: sha256.c:ConstantCompare Unexecuted instantiation: sha3.c:ConstantCompare Unexecuted instantiation: sha512.c:ConstantCompare Unexecuted instantiation: sp_int.c:ConstantCompare Unexecuted instantiation: wc_encrypt.c:ConstantCompare Unexecuted instantiation: wolfmath.c:ConstantCompare Unexecuted instantiation: ssl.c:ConstantCompare Unexecuted instantiation: tls.c:ConstantCompare Line | Count | Source | 330 | 3.18k | { | 331 | 3.18k | int i; | 332 | 3.18k | int compareSum = 0; | 333 | | | 334 | 54.4k | for (i = 0; i < length; i++) { | 335 | 51.2k | compareSum |= a[i] ^ b[i]; | 336 | 51.2k | } | 337 | | | 338 | 3.18k | return compareSum; | 339 | 3.18k | } |
internal.c:ConstantCompare Line | Count | Source | 330 | 31 | { | 331 | 31 | int i; | 332 | 31 | int compareSum = 0; | 333 | | | 334 | 712 | for (i = 0; i < length; i++) { | 335 | 681 | compareSum |= a[i] ^ b[i]; | 336 | 681 | } | 337 | | | 338 | 31 | return compareSum; | 339 | 31 | } |
|
340 | | #endif |
341 | | |
342 | | |
343 | | #ifndef WOLFSSL_HAVE_MIN |
344 | | #define WOLFSSL_HAVE_MIN |
345 | | #if defined(HAVE_FIPS) && !defined(min) /* so ifdef check passes */ |
346 | | #define min min |
347 | | #endif |
348 | | /* returns the smaller of a and b */ |
349 | | WC_STATIC WC_INLINE word32 min(word32 a, word32 b) |
350 | 5.79M | { |
351 | 5.79M | return a > b ? b : a; |
352 | 5.79M | } Unexecuted instantiation: aes.c:min Line | Count | Source | 350 | 32 | { | 351 | 32 | return a > b ? b : a; | 352 | 32 | } |
Unexecuted instantiation: camellia.c:min Unexecuted instantiation: chacha.c:min Unexecuted instantiation: chacha20_poly1305.c:min Unexecuted instantiation: cmac.c:min Unexecuted instantiation: coding.c:min Unexecuted instantiation: curve25519.c:min Unexecuted instantiation: curve448.c:min Unexecuted instantiation: des3.c:min Line | Count | Source | 350 | 59.6k | { | 351 | 59.6k | return a > b ? b : a; | 352 | 59.6k | } |
Unexecuted instantiation: ecc.c:min Unexecuted instantiation: ed25519.c:min Unexecuted instantiation: ed448.c:min Unexecuted instantiation: fe_448.c:min Unexecuted instantiation: fe_operations.c:min Unexecuted instantiation: ge_448.c:min Unexecuted instantiation: ge_operations.c:min Unexecuted instantiation: hash.c:min Line | Count | Source | 350 | 18.8k | { | 351 | 18.8k | return a > b ? b : a; | 352 | 18.8k | } |
Line | Count | Source | 350 | 4.81k | { | 351 | 4.81k | return a > b ? b : a; | 352 | 4.81k | } |
Unexecuted instantiation: md2.c:min Line | Count | Source | 350 | 13.0k | { | 351 | 13.0k | return a > b ? b : a; | 352 | 13.0k | } |
Line | Count | Source | 350 | 90.8k | { | 351 | 90.8k | return a > b ? b : a; | 352 | 90.8k | } |
Unexecuted instantiation: poly1305.c:min Unexecuted instantiation: pwdbased.c:min Line | Count | Source | 350 | 1.16M | { | 351 | 1.16M | return a > b ? b : a; | 352 | 1.16M | } |
Unexecuted instantiation: ripemd.c:min Unexecuted instantiation: rsa.c:min Line | Count | Source | 350 | 301k | { | 351 | 301k | return a > b ? b : a; | 352 | 301k | } |
Line | Count | Source | 350 | 3.87M | { | 351 | 3.87M | return a > b ? b : a; | 352 | 3.87M | } |
Unexecuted instantiation: sha3.c:min Line | Count | Source | 350 | 241k | { | 351 | 241k | return a > b ? b : a; | 352 | 241k | } |
Unexecuted instantiation: sp_int.c:min Unexecuted instantiation: wc_encrypt.c:min Unexecuted instantiation: wolfmath.c:min Line | Count | Source | 350 | 602 | { | 351 | 602 | return a > b ? b : a; | 352 | 602 | } |
Unexecuted instantiation: tls.c:min Line | Count | Source | 350 | 573 | { | 351 | 573 | return a > b ? b : a; | 352 | 573 | } |
Line | Count | Source | 350 | 11.2k | { | 351 | 11.2k | return a > b ? b : a; | 352 | 11.2k | } |
|
353 | | #endif /* !WOLFSSL_HAVE_MIN */ |
354 | | |
355 | | #ifndef WOLFSSL_HAVE_MAX |
356 | | #define WOLFSSL_HAVE_MAX |
357 | | #if defined(HAVE_FIPS) && !defined(max) /* so ifdef check passes */ |
358 | | #define max max |
359 | | #endif |
360 | | WC_STATIC WC_INLINE word32 max(word32 a, word32 b) |
361 | 0 | { |
362 | 0 | return a > b ? a : b; |
363 | 0 | } Unexecuted instantiation: aes.c:max Unexecuted instantiation: asn.c:max Unexecuted instantiation: camellia.c:max Unexecuted instantiation: chacha.c:max Unexecuted instantiation: chacha20_poly1305.c:max Unexecuted instantiation: cmac.c:max Unexecuted instantiation: coding.c:max Unexecuted instantiation: curve25519.c:max Unexecuted instantiation: curve448.c:max Unexecuted instantiation: des3.c:max Unexecuted instantiation: dh.c:max Unexecuted instantiation: ecc.c:max Unexecuted instantiation: ed25519.c:max Unexecuted instantiation: ed448.c:max Unexecuted instantiation: fe_448.c:max Unexecuted instantiation: fe_operations.c:max Unexecuted instantiation: ge_448.c:max Unexecuted instantiation: ge_operations.c:max Unexecuted instantiation: hash.c:max Unexecuted instantiation: hmac.c:max Unexecuted instantiation: kdf.c:max Unexecuted instantiation: md2.c:max Unexecuted instantiation: md4.c:max Unexecuted instantiation: md5.c:max Unexecuted instantiation: poly1305.c:max Unexecuted instantiation: pwdbased.c:max Unexecuted instantiation: random.c:max Unexecuted instantiation: ripemd.c:max Unexecuted instantiation: rsa.c:max Unexecuted instantiation: sha.c:max Unexecuted instantiation: sha256.c:max Unexecuted instantiation: sha3.c:max Unexecuted instantiation: sha512.c:max Unexecuted instantiation: sp_int.c:max Unexecuted instantiation: wc_encrypt.c:max Unexecuted instantiation: wolfmath.c:max Unexecuted instantiation: ssl.c:max Unexecuted instantiation: tls.c:max Unexecuted instantiation: tls13.c:max Unexecuted instantiation: internal.c:max |
364 | | #endif /* !WOLFSSL_HAVE_MAX */ |
365 | | |
366 | | #ifndef WOLFSSL_NO_INT_ENCODE |
367 | | /* converts a 32 bit integer to 24 bit */ |
368 | | WC_STATIC WC_INLINE void c32to24(word32 in, word24 out) |
369 | 69.4k | { |
370 | 69.4k | out[0] = (in >> 16) & 0xff; |
371 | 69.4k | out[1] = (in >> 8) & 0xff; |
372 | 69.4k | out[2] = in & 0xff; |
373 | 69.4k | } Unexecuted instantiation: aes.c:c32to24 Unexecuted instantiation: asn.c:c32to24 Unexecuted instantiation: camellia.c:c32to24 Unexecuted instantiation: chacha.c:c32to24 Unexecuted instantiation: chacha20_poly1305.c:c32to24 Unexecuted instantiation: cmac.c:c32to24 Unexecuted instantiation: coding.c:c32to24 Unexecuted instantiation: curve25519.c:c32to24 Unexecuted instantiation: curve448.c:c32to24 Unexecuted instantiation: des3.c:c32to24 Unexecuted instantiation: dh.c:c32to24 Unexecuted instantiation: ecc.c:c32to24 Unexecuted instantiation: ed25519.c:c32to24 Unexecuted instantiation: ed448.c:c32to24 Unexecuted instantiation: fe_448.c:c32to24 Unexecuted instantiation: fe_operations.c:c32to24 Unexecuted instantiation: ge_448.c:c32to24 Unexecuted instantiation: ge_operations.c:c32to24 Unexecuted instantiation: hash.c:c32to24 Unexecuted instantiation: hmac.c:c32to24 Unexecuted instantiation: kdf.c:c32to24 Unexecuted instantiation: md2.c:c32to24 Unexecuted instantiation: md4.c:c32to24 Unexecuted instantiation: md5.c:c32to24 Unexecuted instantiation: poly1305.c:c32to24 Unexecuted instantiation: pwdbased.c:c32to24 Unexecuted instantiation: random.c:c32to24 Unexecuted instantiation: ripemd.c:c32to24 Unexecuted instantiation: rsa.c:c32to24 Unexecuted instantiation: sha.c:c32to24 Unexecuted instantiation: sha256.c:c32to24 Unexecuted instantiation: sha3.c:c32to24 Unexecuted instantiation: sha512.c:c32to24 Unexecuted instantiation: sp_int.c:c32to24 Unexecuted instantiation: wc_encrypt.c:c32to24 Unexecuted instantiation: wolfmath.c:c32to24 Unexecuted instantiation: ssl.c:c32to24 Unexecuted instantiation: tls.c:c32to24 Line | Count | Source | 369 | 6.77k | { | 370 | 6.77k | out[0] = (in >> 16) & 0xff; | 371 | 6.77k | out[1] = (in >> 8) & 0xff; | 372 | 6.77k | out[2] = in & 0xff; | 373 | 6.77k | } |
Line | Count | Source | 369 | 62.6k | { | 370 | 62.6k | out[0] = (in >> 16) & 0xff; | 371 | 62.6k | out[1] = (in >> 8) & 0xff; | 372 | 62.6k | out[2] = in & 0xff; | 373 | 62.6k | } |
|
374 | | |
375 | | /* convert 16 bit integer to opaque */ |
376 | | WC_STATIC WC_INLINE void c16toa(word16 wc_u16, byte* c) |
377 | 426k | { |
378 | 426k | c[0] = (wc_u16 >> 8) & 0xff; |
379 | 426k | c[1] = wc_u16 & 0xff; |
380 | 426k | } Unexecuted instantiation: aes.c:c16toa Unexecuted instantiation: asn.c:c16toa Unexecuted instantiation: camellia.c:c16toa Unexecuted instantiation: chacha.c:c16toa Unexecuted instantiation: chacha20_poly1305.c:c16toa Unexecuted instantiation: cmac.c:c16toa Unexecuted instantiation: coding.c:c16toa Unexecuted instantiation: curve25519.c:c16toa Unexecuted instantiation: curve448.c:c16toa Unexecuted instantiation: des3.c:c16toa Unexecuted instantiation: dh.c:c16toa Unexecuted instantiation: ecc.c:c16toa Unexecuted instantiation: ed25519.c:c16toa Unexecuted instantiation: ed448.c:c16toa Unexecuted instantiation: fe_448.c:c16toa Unexecuted instantiation: fe_operations.c:c16toa Unexecuted instantiation: ge_448.c:c16toa Unexecuted instantiation: ge_operations.c:c16toa Unexecuted instantiation: hash.c:c16toa Unexecuted instantiation: hmac.c:c16toa Unexecuted instantiation: kdf.c:c16toa Unexecuted instantiation: md2.c:c16toa Unexecuted instantiation: md4.c:c16toa Unexecuted instantiation: md5.c:c16toa Unexecuted instantiation: poly1305.c:c16toa Unexecuted instantiation: pwdbased.c:c16toa Unexecuted instantiation: random.c:c16toa Unexecuted instantiation: ripemd.c:c16toa Unexecuted instantiation: rsa.c:c16toa Unexecuted instantiation: sha.c:c16toa Unexecuted instantiation: sha256.c:c16toa Unexecuted instantiation: sha3.c:c16toa Unexecuted instantiation: sha512.c:c16toa Unexecuted instantiation: sp_int.c:c16toa Unexecuted instantiation: wc_encrypt.c:c16toa Unexecuted instantiation: wolfmath.c:c16toa Unexecuted instantiation: ssl.c:c16toa Line | Count | Source | 377 | 326k | { | 378 | 326k | c[0] = (wc_u16 >> 8) & 0xff; | 379 | 326k | c[1] = wc_u16 & 0xff; | 380 | 326k | } |
Line | Count | Source | 377 | 10.7k | { | 378 | 10.7k | c[0] = (wc_u16 >> 8) & 0xff; | 379 | 10.7k | c[1] = wc_u16 & 0xff; | 380 | 10.7k | } |
Line | Count | Source | 377 | 88.8k | { | 378 | 88.8k | c[0] = (wc_u16 >> 8) & 0xff; | 379 | 88.8k | c[1] = wc_u16 & 0xff; | 380 | 88.8k | } |
|
381 | | |
382 | | /* convert 32 bit integer to opaque */ |
383 | | WC_STATIC WC_INLINE void c32toa(word32 wc_u32, byte* c) |
384 | 5.33M | { |
385 | 5.33M | c[0] = (wc_u32 >> 24) & 0xff; |
386 | 5.33M | c[1] = (wc_u32 >> 16) & 0xff; |
387 | 5.33M | c[2] = (wc_u32 >> 8) & 0xff; |
388 | 5.33M | c[3] = wc_u32 & 0xff; |
389 | 5.33M | } Unexecuted instantiation: aes.c:c32toa Unexecuted instantiation: asn.c:c32toa Unexecuted instantiation: camellia.c:c32toa Unexecuted instantiation: chacha.c:c32toa Unexecuted instantiation: chacha20_poly1305.c:c32toa Unexecuted instantiation: cmac.c:c32toa Unexecuted instantiation: coding.c:c32toa Unexecuted instantiation: curve25519.c:c32toa Unexecuted instantiation: curve448.c:c32toa Unexecuted instantiation: des3.c:c32toa Unexecuted instantiation: dh.c:c32toa Unexecuted instantiation: ecc.c:c32toa Unexecuted instantiation: ed25519.c:c32toa Unexecuted instantiation: ed448.c:c32toa Unexecuted instantiation: fe_448.c:c32toa Unexecuted instantiation: fe_operations.c:c32toa Unexecuted instantiation: ge_448.c:c32toa Unexecuted instantiation: ge_operations.c:c32toa Unexecuted instantiation: hash.c:c32toa Unexecuted instantiation: hmac.c:c32toa Unexecuted instantiation: kdf.c:c32toa Unexecuted instantiation: md2.c:c32toa Unexecuted instantiation: md4.c:c32toa Unexecuted instantiation: md5.c:c32toa Unexecuted instantiation: poly1305.c:c32toa Unexecuted instantiation: pwdbased.c:c32toa Unexecuted instantiation: random.c:c32toa Unexecuted instantiation: ripemd.c:c32toa Unexecuted instantiation: rsa.c:c32toa Unexecuted instantiation: sha.c:c32toa Unexecuted instantiation: sha256.c:c32toa Unexecuted instantiation: sha3.c:c32toa Unexecuted instantiation: sha512.c:c32toa Unexecuted instantiation: sp_int.c:c32toa Unexecuted instantiation: wc_encrypt.c:c32toa Unexecuted instantiation: wolfmath.c:c32toa Unexecuted instantiation: ssl.c:c32toa Line | Count | Source | 384 | 2.92k | { | 385 | 2.92k | c[0] = (wc_u32 >> 24) & 0xff; | 386 | 2.92k | c[1] = (wc_u32 >> 16) & 0xff; | 387 | 2.92k | c[2] = (wc_u32 >> 8) & 0xff; | 388 | 2.92k | c[3] = wc_u32 & 0xff; | 389 | 2.92k | } |
Line | Count | Source | 384 | 13.3k | { | 385 | 13.3k | c[0] = (wc_u32 >> 24) & 0xff; | 386 | 13.3k | c[1] = (wc_u32 >> 16) & 0xff; | 387 | 13.3k | c[2] = (wc_u32 >> 8) & 0xff; | 388 | 13.3k | c[3] = wc_u32 & 0xff; | 389 | 13.3k | } |
Line | Count | Source | 384 | 5.31M | { | 385 | 5.31M | c[0] = (wc_u32 >> 24) & 0xff; | 386 | 5.31M | c[1] = (wc_u32 >> 16) & 0xff; | 387 | 5.31M | c[2] = (wc_u32 >> 8) & 0xff; | 388 | 5.31M | c[3] = wc_u32 & 0xff; | 389 | 5.31M | } |
|
390 | | #endif |
391 | | |
392 | | #ifndef WOLFSSL_NO_INT_DECODE |
393 | | /* convert a 24 bit integer into a 32 bit one */ |
394 | | WC_STATIC WC_INLINE void c24to32(const word24 wc_u24, word32* wc_u32) |
395 | 100k | { |
396 | 100k | *wc_u32 = ((word32)wc_u24[0] << 16) | (wc_u24[1] << 8) | wc_u24[2]; |
397 | 100k | } Unexecuted instantiation: aes.c:c24to32 Unexecuted instantiation: asn.c:c24to32 Unexecuted instantiation: camellia.c:c24to32 Unexecuted instantiation: chacha.c:c24to32 Unexecuted instantiation: chacha20_poly1305.c:c24to32 Unexecuted instantiation: cmac.c:c24to32 Unexecuted instantiation: coding.c:c24to32 Unexecuted instantiation: curve25519.c:c24to32 Unexecuted instantiation: curve448.c:c24to32 Unexecuted instantiation: des3.c:c24to32 Unexecuted instantiation: dh.c:c24to32 Unexecuted instantiation: ecc.c:c24to32 Unexecuted instantiation: ed25519.c:c24to32 Unexecuted instantiation: ed448.c:c24to32 Unexecuted instantiation: fe_448.c:c24to32 Unexecuted instantiation: fe_operations.c:c24to32 Unexecuted instantiation: ge_448.c:c24to32 Unexecuted instantiation: ge_operations.c:c24to32 Unexecuted instantiation: hash.c:c24to32 Unexecuted instantiation: hmac.c:c24to32 Unexecuted instantiation: kdf.c:c24to32 Unexecuted instantiation: md2.c:c24to32 Unexecuted instantiation: md4.c:c24to32 Unexecuted instantiation: md5.c:c24to32 Unexecuted instantiation: poly1305.c:c24to32 Unexecuted instantiation: pwdbased.c:c24to32 Unexecuted instantiation: random.c:c24to32 Unexecuted instantiation: ripemd.c:c24to32 Unexecuted instantiation: rsa.c:c24to32 Unexecuted instantiation: sha.c:c24to32 Unexecuted instantiation: sha256.c:c24to32 Unexecuted instantiation: sha3.c:c24to32 Unexecuted instantiation: sha512.c:c24to32 Unexecuted instantiation: sp_int.c:c24to32 Unexecuted instantiation: wc_encrypt.c:c24to32 Unexecuted instantiation: wolfmath.c:c24to32 Unexecuted instantiation: ssl.c:c24to32 Unexecuted instantiation: tls.c:c24to32 Line | Count | Source | 395 | 12.7k | { | 396 | 12.7k | *wc_u32 = ((word32)wc_u24[0] << 16) | (wc_u24[1] << 8) | wc_u24[2]; | 397 | 12.7k | } |
Line | Count | Source | 395 | 87.8k | { | 396 | 87.8k | *wc_u32 = ((word32)wc_u24[0] << 16) | (wc_u24[1] << 8) | wc_u24[2]; | 397 | 87.8k | } |
|
398 | | |
399 | | |
400 | | /* convert opaque to 24 bit integer */ |
401 | | WC_STATIC WC_INLINE void ato24(const byte* c, word32* wc_u24) |
402 | 0 | { |
403 | 0 | *wc_u24 = ((word32)c[0] << 16) | (c[1] << 8) | c[2]; |
404 | 0 | } Unexecuted instantiation: aes.c:ato24 Unexecuted instantiation: asn.c:ato24 Unexecuted instantiation: camellia.c:ato24 Unexecuted instantiation: chacha.c:ato24 Unexecuted instantiation: chacha20_poly1305.c:ato24 Unexecuted instantiation: cmac.c:ato24 Unexecuted instantiation: coding.c:ato24 Unexecuted instantiation: curve25519.c:ato24 Unexecuted instantiation: curve448.c:ato24 Unexecuted instantiation: des3.c:ato24 Unexecuted instantiation: dh.c:ato24 Unexecuted instantiation: ecc.c:ato24 Unexecuted instantiation: ed25519.c:ato24 Unexecuted instantiation: ed448.c:ato24 Unexecuted instantiation: fe_448.c:ato24 Unexecuted instantiation: fe_operations.c:ato24 Unexecuted instantiation: ge_448.c:ato24 Unexecuted instantiation: ge_operations.c:ato24 Unexecuted instantiation: hash.c:ato24 Unexecuted instantiation: hmac.c:ato24 Unexecuted instantiation: kdf.c:ato24 Unexecuted instantiation: md2.c:ato24 Unexecuted instantiation: md4.c:ato24 Unexecuted instantiation: md5.c:ato24 Unexecuted instantiation: poly1305.c:ato24 Unexecuted instantiation: pwdbased.c:ato24 Unexecuted instantiation: random.c:ato24 Unexecuted instantiation: ripemd.c:ato24 Unexecuted instantiation: rsa.c:ato24 Unexecuted instantiation: sha.c:ato24 Unexecuted instantiation: sha256.c:ato24 Unexecuted instantiation: sha3.c:ato24 Unexecuted instantiation: sha512.c:ato24 Unexecuted instantiation: sp_int.c:ato24 Unexecuted instantiation: wc_encrypt.c:ato24 Unexecuted instantiation: wolfmath.c:ato24 Unexecuted instantiation: ssl.c:ato24 Unexecuted instantiation: tls.c:ato24 Unexecuted instantiation: tls13.c:ato24 Unexecuted instantiation: internal.c:ato24 |
405 | | |
406 | | /* convert opaque to 16 bit integer */ |
407 | | WC_STATIC WC_INLINE void ato16(const byte* c, word16* wc_u16) |
408 | 547k | { |
409 | 547k | *wc_u16 = (word16) ((c[0] << 8) | (c[1])); |
410 | 547k | } Unexecuted instantiation: aes.c:ato16 Unexecuted instantiation: asn.c:ato16 Unexecuted instantiation: camellia.c:ato16 Unexecuted instantiation: chacha.c:ato16 Unexecuted instantiation: chacha20_poly1305.c:ato16 Unexecuted instantiation: cmac.c:ato16 Unexecuted instantiation: coding.c:ato16 Unexecuted instantiation: curve25519.c:ato16 Unexecuted instantiation: curve448.c:ato16 Unexecuted instantiation: des3.c:ato16 Unexecuted instantiation: dh.c:ato16 Unexecuted instantiation: ecc.c:ato16 Unexecuted instantiation: ed25519.c:ato16 Unexecuted instantiation: ed448.c:ato16 Unexecuted instantiation: fe_448.c:ato16 Unexecuted instantiation: fe_operations.c:ato16 Unexecuted instantiation: ge_448.c:ato16 Unexecuted instantiation: ge_operations.c:ato16 Unexecuted instantiation: hash.c:ato16 Unexecuted instantiation: hmac.c:ato16 Unexecuted instantiation: kdf.c:ato16 Unexecuted instantiation: md2.c:ato16 Unexecuted instantiation: md4.c:ato16 Unexecuted instantiation: md5.c:ato16 Unexecuted instantiation: poly1305.c:ato16 Unexecuted instantiation: pwdbased.c:ato16 Unexecuted instantiation: random.c:ato16 Unexecuted instantiation: ripemd.c:ato16 Unexecuted instantiation: rsa.c:ato16 Unexecuted instantiation: sha.c:ato16 Unexecuted instantiation: sha256.c:ato16 Unexecuted instantiation: sha3.c:ato16 Unexecuted instantiation: sha512.c:ato16 Unexecuted instantiation: sp_int.c:ato16 Unexecuted instantiation: wc_encrypt.c:ato16 Unexecuted instantiation: wolfmath.c:ato16 Unexecuted instantiation: ssl.c:ato16 Line | Count | Source | 408 | 346k | { | 409 | 346k | *wc_u16 = (word16) ((c[0] << 8) | (c[1])); | 410 | 346k | } |
Line | Count | Source | 408 | 8.79k | { | 409 | 8.79k | *wc_u16 = (word16) ((c[0] << 8) | (c[1])); | 410 | 8.79k | } |
Line | Count | Source | 408 | 192k | { | 409 | 192k | *wc_u16 = (word16) ((c[0] << 8) | (c[1])); | 410 | 192k | } |
|
411 | | |
412 | | /* convert opaque to 32 bit integer */ |
413 | | WC_STATIC WC_INLINE void ato32(const byte* c, word32* wc_u32) |
414 | 0 | { |
415 | 0 | *wc_u32 = ((word32)c[0] << 24) | ((word32)c[1] << 16) | (c[2] << 8) | c[3]; |
416 | 0 | } Unexecuted instantiation: aes.c:ato32 Unexecuted instantiation: asn.c:ato32 Unexecuted instantiation: camellia.c:ato32 Unexecuted instantiation: chacha.c:ato32 Unexecuted instantiation: chacha20_poly1305.c:ato32 Unexecuted instantiation: cmac.c:ato32 Unexecuted instantiation: coding.c:ato32 Unexecuted instantiation: curve25519.c:ato32 Unexecuted instantiation: curve448.c:ato32 Unexecuted instantiation: des3.c:ato32 Unexecuted instantiation: dh.c:ato32 Unexecuted instantiation: ecc.c:ato32 Unexecuted instantiation: ed25519.c:ato32 Unexecuted instantiation: ed448.c:ato32 Unexecuted instantiation: fe_448.c:ato32 Unexecuted instantiation: fe_operations.c:ato32 Unexecuted instantiation: ge_448.c:ato32 Unexecuted instantiation: ge_operations.c:ato32 Unexecuted instantiation: hash.c:ato32 Unexecuted instantiation: hmac.c:ato32 Unexecuted instantiation: kdf.c:ato32 Unexecuted instantiation: md2.c:ato32 Unexecuted instantiation: md4.c:ato32 Unexecuted instantiation: md5.c:ato32 Unexecuted instantiation: poly1305.c:ato32 Unexecuted instantiation: pwdbased.c:ato32 Unexecuted instantiation: random.c:ato32 Unexecuted instantiation: ripemd.c:ato32 Unexecuted instantiation: rsa.c:ato32 Unexecuted instantiation: sha.c:ato32 Unexecuted instantiation: sha256.c:ato32 Unexecuted instantiation: sha3.c:ato32 Unexecuted instantiation: sha512.c:ato32 Unexecuted instantiation: sp_int.c:ato32 Unexecuted instantiation: wc_encrypt.c:ato32 Unexecuted instantiation: wolfmath.c:ato32 Unexecuted instantiation: ssl.c:ato32 Unexecuted instantiation: tls13.c:ato32 |
417 | | |
418 | | |
419 | | WC_STATIC WC_INLINE word32 btoi(byte b) |
420 | 460k | { |
421 | 460k | return (word32)(b - 0x30); |
422 | 460k | } Unexecuted instantiation: aes.c:btoi Line | Count | Source | 420 | 460k | { | 421 | 460k | return (word32)(b - 0x30); | 422 | 460k | } |
Unexecuted instantiation: camellia.c:btoi Unexecuted instantiation: chacha.c:btoi Unexecuted instantiation: chacha20_poly1305.c:btoi Unexecuted instantiation: cmac.c:btoi Unexecuted instantiation: coding.c:btoi Unexecuted instantiation: curve25519.c:btoi Unexecuted instantiation: curve448.c:btoi Unexecuted instantiation: des3.c:btoi Unexecuted instantiation: dh.c:btoi Unexecuted instantiation: ecc.c:btoi Unexecuted instantiation: ed25519.c:btoi Unexecuted instantiation: ed448.c:btoi Unexecuted instantiation: fe_448.c:btoi Unexecuted instantiation: fe_operations.c:btoi Unexecuted instantiation: ge_448.c:btoi Unexecuted instantiation: ge_operations.c:btoi Unexecuted instantiation: hash.c:btoi Unexecuted instantiation: hmac.c:btoi Unexecuted instantiation: kdf.c:btoi Unexecuted instantiation: md2.c:btoi Unexecuted instantiation: md4.c:btoi Unexecuted instantiation: md5.c:btoi Unexecuted instantiation: poly1305.c:btoi Unexecuted instantiation: pwdbased.c:btoi Unexecuted instantiation: random.c:btoi Unexecuted instantiation: ripemd.c:btoi Unexecuted instantiation: rsa.c:btoi Unexecuted instantiation: sha.c:btoi Unexecuted instantiation: sha256.c:btoi Unexecuted instantiation: sha3.c:btoi Unexecuted instantiation: sha512.c:btoi Unexecuted instantiation: sp_int.c:btoi Unexecuted instantiation: wc_encrypt.c:btoi Unexecuted instantiation: wolfmath.c:btoi Unexecuted instantiation: ssl.c:btoi Unexecuted instantiation: tls.c:btoi Unexecuted instantiation: tls13.c:btoi Unexecuted instantiation: internal.c:btoi |
423 | | #endif |
424 | | |
425 | | WC_STATIC WC_INLINE signed char HexCharToByte(char ch) |
426 | 39.7M | { |
427 | 39.7M | signed char ret = (signed char)ch; |
428 | 39.7M | if (ret >= '0' && ret <= '9') |
429 | 17.9M | ret -= '0'; |
430 | 21.8M | else if (ret >= 'A' && ret <= 'F') |
431 | 19.1M | ret -= 'A' - 10; |
432 | 2.70M | else if (ret >= 'a' && ret <= 'f') |
433 | 2.70M | ret -= 'a' - 10; |
434 | 1.32k | else |
435 | 1.32k | ret = -1; /* error case - return code must be signed */ |
436 | 39.7M | return ret; |
437 | 39.7M | } Unexecuted instantiation: aes.c:HexCharToByte Unexecuted instantiation: asn.c:HexCharToByte Unexecuted instantiation: camellia.c:HexCharToByte Unexecuted instantiation: chacha.c:HexCharToByte Unexecuted instantiation: chacha20_poly1305.c:HexCharToByte Unexecuted instantiation: cmac.c:HexCharToByte Unexecuted instantiation: coding.c:HexCharToByte Unexecuted instantiation: curve25519.c:HexCharToByte Unexecuted instantiation: curve448.c:HexCharToByte Unexecuted instantiation: des3.c:HexCharToByte Unexecuted instantiation: dh.c:HexCharToByte Unexecuted instantiation: ecc.c:HexCharToByte Unexecuted instantiation: ed25519.c:HexCharToByte Unexecuted instantiation: ed448.c:HexCharToByte Unexecuted instantiation: fe_448.c:HexCharToByte Unexecuted instantiation: fe_operations.c:HexCharToByte Unexecuted instantiation: ge_448.c:HexCharToByte Unexecuted instantiation: ge_operations.c:HexCharToByte Unexecuted instantiation: hash.c:HexCharToByte Unexecuted instantiation: hmac.c:HexCharToByte Unexecuted instantiation: kdf.c:HexCharToByte Unexecuted instantiation: md2.c:HexCharToByte Unexecuted instantiation: md4.c:HexCharToByte Unexecuted instantiation: md5.c:HexCharToByte Unexecuted instantiation: poly1305.c:HexCharToByte Unexecuted instantiation: pwdbased.c:HexCharToByte Unexecuted instantiation: random.c:HexCharToByte Unexecuted instantiation: ripemd.c:HexCharToByte Unexecuted instantiation: rsa.c:HexCharToByte Unexecuted instantiation: sha.c:HexCharToByte Unexecuted instantiation: sha256.c:HexCharToByte Unexecuted instantiation: sha3.c:HexCharToByte Unexecuted instantiation: sha512.c:HexCharToByte Line | Count | Source | 426 | 39.7M | { | 427 | 39.7M | signed char ret = (signed char)ch; | 428 | 39.7M | if (ret >= '0' && ret <= '9') | 429 | 17.9M | ret -= '0'; | 430 | 21.8M | else if (ret >= 'A' && ret <= 'F') | 431 | 19.1M | ret -= 'A' - 10; | 432 | 2.70M | else if (ret >= 'a' && ret <= 'f') | 433 | 2.70M | ret -= 'a' - 10; | 434 | 1.32k | else | 435 | 1.32k | ret = -1; /* error case - return code must be signed */ | 436 | 39.7M | return ret; | 437 | 39.7M | } |
Unexecuted instantiation: wc_encrypt.c:HexCharToByte Unexecuted instantiation: wolfmath.c:HexCharToByte Unexecuted instantiation: ssl.c:HexCharToByte Unexecuted instantiation: tls.c:HexCharToByte Unexecuted instantiation: tls13.c:HexCharToByte Unexecuted instantiation: internal.c:HexCharToByte |
438 | | |
439 | | WC_STATIC WC_INLINE char ByteToHex(byte in) |
440 | 2.14M | { |
441 | 2.14M | static const char kHexChar[] = { '0', '1', '2', '3', '4', '5', '6', '7', |
442 | 2.14M | '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; |
443 | 2.14M | return (char)(kHexChar[in & 0xF]); |
444 | 2.14M | } Unexecuted instantiation: aes.c:ByteToHex Unexecuted instantiation: asn.c:ByteToHex Unexecuted instantiation: camellia.c:ByteToHex Unexecuted instantiation: chacha.c:ByteToHex Unexecuted instantiation: chacha20_poly1305.c:ByteToHex Unexecuted instantiation: cmac.c:ByteToHex Unexecuted instantiation: coding.c:ByteToHex Unexecuted instantiation: curve25519.c:ByteToHex Unexecuted instantiation: curve448.c:ByteToHex Unexecuted instantiation: des3.c:ByteToHex Unexecuted instantiation: dh.c:ByteToHex Unexecuted instantiation: ecc.c:ByteToHex Unexecuted instantiation: ed25519.c:ByteToHex Unexecuted instantiation: ed448.c:ByteToHex Unexecuted instantiation: fe_448.c:ByteToHex Unexecuted instantiation: fe_operations.c:ByteToHex Unexecuted instantiation: ge_448.c:ByteToHex Unexecuted instantiation: ge_operations.c:ByteToHex Unexecuted instantiation: hash.c:ByteToHex Unexecuted instantiation: hmac.c:ByteToHex Unexecuted instantiation: kdf.c:ByteToHex Unexecuted instantiation: md2.c:ByteToHex Unexecuted instantiation: md4.c:ByteToHex Unexecuted instantiation: md5.c:ByteToHex Unexecuted instantiation: poly1305.c:ByteToHex Unexecuted instantiation: pwdbased.c:ByteToHex Unexecuted instantiation: random.c:ByteToHex Unexecuted instantiation: ripemd.c:ByteToHex Unexecuted instantiation: rsa.c:ByteToHex Unexecuted instantiation: sha.c:ByteToHex Unexecuted instantiation: sha256.c:ByteToHex Unexecuted instantiation: sha3.c:ByteToHex Unexecuted instantiation: sha512.c:ByteToHex Line | Count | Source | 440 | 2.14M | { | 441 | 2.14M | static const char kHexChar[] = { '0', '1', '2', '3', '4', '5', '6', '7', | 442 | 2.14M | '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; | 443 | 2.14M | return (char)(kHexChar[in & 0xF]); | 444 | 2.14M | } |
Unexecuted instantiation: wc_encrypt.c:ByteToHex Unexecuted instantiation: wolfmath.c:ByteToHex Unexecuted instantiation: ssl.c:ByteToHex Unexecuted instantiation: tls.c:ByteToHex Unexecuted instantiation: tls13.c:ByteToHex Unexecuted instantiation: internal.c:ByteToHex |
445 | | |
446 | | WC_STATIC WC_INLINE int ByteToHexStr(byte in, char* out) |
447 | 0 | { |
448 | 0 | if (out == NULL) |
449 | 0 | return -1; |
450 | | |
451 | 0 | out[0] = ByteToHex(in >> 4); |
452 | 0 | out[1] = ByteToHex(in & 0xf); |
453 | 0 | return 0; |
454 | 0 | } Unexecuted instantiation: aes.c:ByteToHexStr Unexecuted instantiation: asn.c:ByteToHexStr Unexecuted instantiation: camellia.c:ByteToHexStr Unexecuted instantiation: chacha.c:ByteToHexStr Unexecuted instantiation: chacha20_poly1305.c:ByteToHexStr Unexecuted instantiation: cmac.c:ByteToHexStr Unexecuted instantiation: coding.c:ByteToHexStr Unexecuted instantiation: curve25519.c:ByteToHexStr Unexecuted instantiation: curve448.c:ByteToHexStr Unexecuted instantiation: des3.c:ByteToHexStr Unexecuted instantiation: dh.c:ByteToHexStr Unexecuted instantiation: ecc.c:ByteToHexStr Unexecuted instantiation: ed25519.c:ByteToHexStr Unexecuted instantiation: ed448.c:ByteToHexStr Unexecuted instantiation: fe_448.c:ByteToHexStr Unexecuted instantiation: fe_operations.c:ByteToHexStr Unexecuted instantiation: ge_448.c:ByteToHexStr Unexecuted instantiation: ge_operations.c:ByteToHexStr Unexecuted instantiation: hash.c:ByteToHexStr Unexecuted instantiation: hmac.c:ByteToHexStr Unexecuted instantiation: kdf.c:ByteToHexStr Unexecuted instantiation: md2.c:ByteToHexStr Unexecuted instantiation: md4.c:ByteToHexStr Unexecuted instantiation: md5.c:ByteToHexStr Unexecuted instantiation: poly1305.c:ByteToHexStr Unexecuted instantiation: pwdbased.c:ByteToHexStr Unexecuted instantiation: random.c:ByteToHexStr Unexecuted instantiation: ripemd.c:ByteToHexStr Unexecuted instantiation: rsa.c:ByteToHexStr Unexecuted instantiation: sha.c:ByteToHexStr Unexecuted instantiation: sha256.c:ByteToHexStr Unexecuted instantiation: sha3.c:ByteToHexStr Unexecuted instantiation: sha512.c:ByteToHexStr Unexecuted instantiation: sp_int.c:ByteToHexStr Unexecuted instantiation: wc_encrypt.c:ByteToHexStr Unexecuted instantiation: wolfmath.c:ByteToHexStr Unexecuted instantiation: ssl.c:ByteToHexStr Unexecuted instantiation: tls.c:ByteToHexStr Unexecuted instantiation: tls13.c:ByteToHexStr Unexecuted instantiation: internal.c:ByteToHexStr |
455 | | |
456 | | #ifndef WOLFSSL_NO_CT_OPS |
457 | | /* Constant time - mask set when a > b. */ |
458 | | WC_STATIC WC_INLINE byte ctMaskGT(int a, int b) |
459 | 41.0k | { |
460 | 41.0k | return (byte)((((word32)a - b - 1) >> 31) - 1); |
461 | 41.0k | } Unexecuted instantiation: aes.c:ctMaskGT Unexecuted instantiation: asn.c:ctMaskGT Unexecuted instantiation: camellia.c:ctMaskGT Unexecuted instantiation: chacha.c:ctMaskGT Unexecuted instantiation: chacha20_poly1305.c:ctMaskGT Unexecuted instantiation: cmac.c:ctMaskGT Unexecuted instantiation: coding.c:ctMaskGT Unexecuted instantiation: curve25519.c:ctMaskGT Unexecuted instantiation: curve448.c:ctMaskGT Unexecuted instantiation: des3.c:ctMaskGT Unexecuted instantiation: dh.c:ctMaskGT Unexecuted instantiation: ecc.c:ctMaskGT Unexecuted instantiation: ed25519.c:ctMaskGT Unexecuted instantiation: ed448.c:ctMaskGT Unexecuted instantiation: fe_448.c:ctMaskGT Unexecuted instantiation: fe_operations.c:ctMaskGT Unexecuted instantiation: ge_448.c:ctMaskGT Unexecuted instantiation: ge_operations.c:ctMaskGT Unexecuted instantiation: hash.c:ctMaskGT Unexecuted instantiation: hmac.c:ctMaskGT Unexecuted instantiation: kdf.c:ctMaskGT Unexecuted instantiation: md2.c:ctMaskGT Unexecuted instantiation: md4.c:ctMaskGT Unexecuted instantiation: md5.c:ctMaskGT Unexecuted instantiation: poly1305.c:ctMaskGT Unexecuted instantiation: pwdbased.c:ctMaskGT Unexecuted instantiation: random.c:ctMaskGT Unexecuted instantiation: ripemd.c:ctMaskGT Line | Count | Source | 459 | 7.52k | { | 460 | 7.52k | return (byte)((((word32)a - b - 1) >> 31) - 1); | 461 | 7.52k | } |
Unexecuted instantiation: sha.c:ctMaskGT Unexecuted instantiation: sha256.c:ctMaskGT Unexecuted instantiation: sha3.c:ctMaskGT Unexecuted instantiation: sha512.c:ctMaskGT Unexecuted instantiation: sp_int.c:ctMaskGT Unexecuted instantiation: wc_encrypt.c:ctMaskGT Unexecuted instantiation: wolfmath.c:ctMaskGT Unexecuted instantiation: ssl.c:ctMaskGT Line | Count | Source | 459 | 33.4k | { | 460 | 33.4k | return (byte)((((word32)a - b - 1) >> 31) - 1); | 461 | 33.4k | } |
Unexecuted instantiation: tls13.c:ctMaskGT Line | Count | Source | 459 | 63 | { | 460 | 63 | return (byte)((((word32)a - b - 1) >> 31) - 1); | 461 | 63 | } |
|
462 | | |
463 | | /* Constant time - mask set when a >= b. */ |
464 | | WC_STATIC WC_INLINE byte ctMaskGTE(int a, int b) |
465 | 11.2k | { |
466 | 11.2k | return (byte)((((word32)a - b ) >> 31) - 1); |
467 | 11.2k | } Unexecuted instantiation: aes.c:ctMaskGTE Unexecuted instantiation: asn.c:ctMaskGTE Unexecuted instantiation: camellia.c:ctMaskGTE Unexecuted instantiation: chacha.c:ctMaskGTE Unexecuted instantiation: chacha20_poly1305.c:ctMaskGTE Unexecuted instantiation: cmac.c:ctMaskGTE Unexecuted instantiation: coding.c:ctMaskGTE Unexecuted instantiation: curve25519.c:ctMaskGTE Unexecuted instantiation: curve448.c:ctMaskGTE Unexecuted instantiation: des3.c:ctMaskGTE Unexecuted instantiation: dh.c:ctMaskGTE Unexecuted instantiation: ecc.c:ctMaskGTE Unexecuted instantiation: ed25519.c:ctMaskGTE Unexecuted instantiation: ed448.c:ctMaskGTE Unexecuted instantiation: fe_448.c:ctMaskGTE Unexecuted instantiation: fe_operations.c:ctMaskGTE Unexecuted instantiation: ge_448.c:ctMaskGTE Unexecuted instantiation: ge_operations.c:ctMaskGTE Unexecuted instantiation: hash.c:ctMaskGTE Unexecuted instantiation: hmac.c:ctMaskGTE Unexecuted instantiation: kdf.c:ctMaskGTE Unexecuted instantiation: md2.c:ctMaskGTE Unexecuted instantiation: md4.c:ctMaskGTE Unexecuted instantiation: md5.c:ctMaskGTE Unexecuted instantiation: poly1305.c:ctMaskGTE Unexecuted instantiation: pwdbased.c:ctMaskGTE Unexecuted instantiation: random.c:ctMaskGTE Unexecuted instantiation: ripemd.c:ctMaskGTE Unexecuted instantiation: rsa.c:ctMaskGTE Unexecuted instantiation: sha.c:ctMaskGTE Unexecuted instantiation: sha256.c:ctMaskGTE Unexecuted instantiation: sha3.c:ctMaskGTE Unexecuted instantiation: sha512.c:ctMaskGTE Unexecuted instantiation: sp_int.c:ctMaskGTE Unexecuted instantiation: wc_encrypt.c:ctMaskGTE Unexecuted instantiation: wolfmath.c:ctMaskGTE Unexecuted instantiation: ssl.c:ctMaskGTE Unexecuted instantiation: tls.c:ctMaskGTE Unexecuted instantiation: tls13.c:ctMaskGTE Line | Count | Source | 465 | 11.2k | { | 466 | 11.2k | return (byte)((((word32)a - b ) >> 31) - 1); | 467 | 11.2k | } |
|
468 | | |
469 | | /* Constant time - mask set when a >= b. */ |
470 | | WC_STATIC WC_INLINE int ctMaskIntGTE(int a, int b) |
471 | 126 | { |
472 | 126 | return (int)((((word32)a - b ) >> 31) - 1); |
473 | 126 | } Unexecuted instantiation: aes.c:ctMaskIntGTE Unexecuted instantiation: asn.c:ctMaskIntGTE Unexecuted instantiation: camellia.c:ctMaskIntGTE Unexecuted instantiation: chacha.c:ctMaskIntGTE Unexecuted instantiation: chacha20_poly1305.c:ctMaskIntGTE Unexecuted instantiation: cmac.c:ctMaskIntGTE Unexecuted instantiation: coding.c:ctMaskIntGTE Unexecuted instantiation: curve25519.c:ctMaskIntGTE Unexecuted instantiation: curve448.c:ctMaskIntGTE Unexecuted instantiation: des3.c:ctMaskIntGTE Unexecuted instantiation: dh.c:ctMaskIntGTE Unexecuted instantiation: ecc.c:ctMaskIntGTE Unexecuted instantiation: ed25519.c:ctMaskIntGTE Unexecuted instantiation: ed448.c:ctMaskIntGTE Unexecuted instantiation: fe_448.c:ctMaskIntGTE Unexecuted instantiation: fe_operations.c:ctMaskIntGTE Unexecuted instantiation: ge_448.c:ctMaskIntGTE Unexecuted instantiation: ge_operations.c:ctMaskIntGTE Unexecuted instantiation: hash.c:ctMaskIntGTE Unexecuted instantiation: hmac.c:ctMaskIntGTE Unexecuted instantiation: kdf.c:ctMaskIntGTE Unexecuted instantiation: md2.c:ctMaskIntGTE Unexecuted instantiation: md4.c:ctMaskIntGTE Unexecuted instantiation: md5.c:ctMaskIntGTE Unexecuted instantiation: poly1305.c:ctMaskIntGTE Unexecuted instantiation: pwdbased.c:ctMaskIntGTE Unexecuted instantiation: random.c:ctMaskIntGTE Unexecuted instantiation: ripemd.c:ctMaskIntGTE Unexecuted instantiation: rsa.c:ctMaskIntGTE Unexecuted instantiation: sha.c:ctMaskIntGTE Unexecuted instantiation: sha256.c:ctMaskIntGTE Unexecuted instantiation: sha3.c:ctMaskIntGTE Unexecuted instantiation: sha512.c:ctMaskIntGTE Unexecuted instantiation: sp_int.c:ctMaskIntGTE Unexecuted instantiation: wc_encrypt.c:ctMaskIntGTE Unexecuted instantiation: wolfmath.c:ctMaskIntGTE Unexecuted instantiation: ssl.c:ctMaskIntGTE Unexecuted instantiation: tls.c:ctMaskIntGTE Unexecuted instantiation: tls13.c:ctMaskIntGTE Line | Count | Source | 471 | 126 | { | 472 | 126 | return (int)((((word32)a - b ) >> 31) - 1); | 473 | 126 | } |
|
474 | | |
475 | | /* Constant time - mask set when a < b. */ |
476 | | WC_STATIC WC_INLINE byte ctMaskLT(int a, int b) |
477 | 35.6k | { |
478 | 35.6k | return (byte)((((word32)b - a - 1) >> 31) - 1); |
479 | 35.6k | } Unexecuted instantiation: aes.c:ctMaskLT Unexecuted instantiation: asn.c:ctMaskLT Unexecuted instantiation: camellia.c:ctMaskLT Unexecuted instantiation: chacha.c:ctMaskLT Unexecuted instantiation: chacha20_poly1305.c:ctMaskLT Unexecuted instantiation: cmac.c:ctMaskLT Unexecuted instantiation: coding.c:ctMaskLT Unexecuted instantiation: curve25519.c:ctMaskLT Unexecuted instantiation: curve448.c:ctMaskLT Unexecuted instantiation: des3.c:ctMaskLT Unexecuted instantiation: dh.c:ctMaskLT Unexecuted instantiation: ecc.c:ctMaskLT Unexecuted instantiation: ed25519.c:ctMaskLT Unexecuted instantiation: ed448.c:ctMaskLT Unexecuted instantiation: fe_448.c:ctMaskLT Unexecuted instantiation: fe_operations.c:ctMaskLT Unexecuted instantiation: ge_448.c:ctMaskLT Unexecuted instantiation: ge_operations.c:ctMaskLT Unexecuted instantiation: hash.c:ctMaskLT Unexecuted instantiation: hmac.c:ctMaskLT Unexecuted instantiation: kdf.c:ctMaskLT Unexecuted instantiation: md2.c:ctMaskLT Unexecuted instantiation: md4.c:ctMaskLT Unexecuted instantiation: md5.c:ctMaskLT Unexecuted instantiation: poly1305.c:ctMaskLT Unexecuted instantiation: pwdbased.c:ctMaskLT Unexecuted instantiation: random.c:ctMaskLT Unexecuted instantiation: ripemd.c:ctMaskLT Line | Count | Source | 477 | 7.52k | { | 478 | 7.52k | return (byte)((((word32)b - a - 1) >> 31) - 1); | 479 | 7.52k | } |
Unexecuted instantiation: sha.c:ctMaskLT Unexecuted instantiation: sha256.c:ctMaskLT Unexecuted instantiation: sha3.c:ctMaskLT Unexecuted instantiation: sha512.c:ctMaskLT Unexecuted instantiation: sp_int.c:ctMaskLT Unexecuted instantiation: wc_encrypt.c:ctMaskLT Unexecuted instantiation: wolfmath.c:ctMaskLT Unexecuted instantiation: ssl.c:ctMaskLT Line | Count | Source | 477 | 16.9k | { | 478 | 16.9k | return (byte)((((word32)b - a - 1) >> 31) - 1); | 479 | 16.9k | } |
Unexecuted instantiation: tls13.c:ctMaskLT Line | Count | Source | 477 | 11.2k | { | 478 | 11.2k | return (byte)((((word32)b - a - 1) >> 31) - 1); | 479 | 11.2k | } |
|
480 | | |
481 | | /* Constant time - mask set when a <= b. */ |
482 | | WC_STATIC WC_INLINE byte ctMaskLTE(int a, int b) |
483 | 17.9k | { |
484 | 17.9k | return (byte)((((word32)b - a ) >> 31) - 1); |
485 | 17.9k | } Unexecuted instantiation: aes.c:ctMaskLTE Unexecuted instantiation: asn.c:ctMaskLTE Unexecuted instantiation: camellia.c:ctMaskLTE Unexecuted instantiation: chacha.c:ctMaskLTE Unexecuted instantiation: chacha20_poly1305.c:ctMaskLTE Unexecuted instantiation: cmac.c:ctMaskLTE Unexecuted instantiation: coding.c:ctMaskLTE Unexecuted instantiation: curve25519.c:ctMaskLTE Unexecuted instantiation: curve448.c:ctMaskLTE Unexecuted instantiation: des3.c:ctMaskLTE Unexecuted instantiation: dh.c:ctMaskLTE Unexecuted instantiation: ecc.c:ctMaskLTE Unexecuted instantiation: ed25519.c:ctMaskLTE Unexecuted instantiation: ed448.c:ctMaskLTE Unexecuted instantiation: fe_448.c:ctMaskLTE Unexecuted instantiation: fe_operations.c:ctMaskLTE Unexecuted instantiation: ge_448.c:ctMaskLTE Unexecuted instantiation: ge_operations.c:ctMaskLTE Unexecuted instantiation: hash.c:ctMaskLTE Unexecuted instantiation: hmac.c:ctMaskLTE Unexecuted instantiation: kdf.c:ctMaskLTE Unexecuted instantiation: md2.c:ctMaskLTE Unexecuted instantiation: md4.c:ctMaskLTE Unexecuted instantiation: md5.c:ctMaskLTE Unexecuted instantiation: poly1305.c:ctMaskLTE Unexecuted instantiation: pwdbased.c:ctMaskLTE Unexecuted instantiation: random.c:ctMaskLTE Unexecuted instantiation: ripemd.c:ctMaskLTE Line | Count | Source | 483 | 7.52k | { | 484 | 7.52k | return (byte)((((word32)b - a ) >> 31) - 1); | 485 | 7.52k | } |
Unexecuted instantiation: sha.c:ctMaskLTE Unexecuted instantiation: sha256.c:ctMaskLTE Unexecuted instantiation: sha3.c:ctMaskLTE Unexecuted instantiation: sha512.c:ctMaskLTE Unexecuted instantiation: sp_int.c:ctMaskLTE Unexecuted instantiation: wc_encrypt.c:ctMaskLTE Unexecuted instantiation: wolfmath.c:ctMaskLTE Unexecuted instantiation: ssl.c:ctMaskLTE Unexecuted instantiation: tls.c:ctMaskLTE Unexecuted instantiation: tls13.c:ctMaskLTE Line | Count | Source | 483 | 10.4k | { | 484 | 10.4k | return (byte)((((word32)b - a ) >> 31) - 1); | 485 | 10.4k | } |
|
486 | | |
487 | | /* Constant time - mask set when a == b. */ |
488 | | WC_STATIC WC_INLINE byte ctMaskEq(int a, int b) |
489 | 16.9k | { |
490 | 16.9k | return (byte)(~ctMaskGT(a, b)) & (byte)(~ctMaskLT(a, b)); |
491 | 16.9k | } Unexecuted instantiation: aes.c:ctMaskEq Unexecuted instantiation: asn.c:ctMaskEq Unexecuted instantiation: camellia.c:ctMaskEq Unexecuted instantiation: chacha.c:ctMaskEq Unexecuted instantiation: chacha20_poly1305.c:ctMaskEq Unexecuted instantiation: cmac.c:ctMaskEq Unexecuted instantiation: coding.c:ctMaskEq Unexecuted instantiation: curve25519.c:ctMaskEq Unexecuted instantiation: curve448.c:ctMaskEq Unexecuted instantiation: des3.c:ctMaskEq Unexecuted instantiation: dh.c:ctMaskEq Unexecuted instantiation: ecc.c:ctMaskEq Unexecuted instantiation: ed25519.c:ctMaskEq Unexecuted instantiation: ed448.c:ctMaskEq Unexecuted instantiation: fe_448.c:ctMaskEq Unexecuted instantiation: fe_operations.c:ctMaskEq Unexecuted instantiation: ge_448.c:ctMaskEq Unexecuted instantiation: ge_operations.c:ctMaskEq Unexecuted instantiation: hash.c:ctMaskEq Unexecuted instantiation: hmac.c:ctMaskEq Unexecuted instantiation: kdf.c:ctMaskEq Unexecuted instantiation: md2.c:ctMaskEq Unexecuted instantiation: md4.c:ctMaskEq Unexecuted instantiation: md5.c:ctMaskEq Unexecuted instantiation: poly1305.c:ctMaskEq Unexecuted instantiation: pwdbased.c:ctMaskEq Unexecuted instantiation: random.c:ctMaskEq Unexecuted instantiation: ripemd.c:ctMaskEq Unexecuted instantiation: rsa.c:ctMaskEq Unexecuted instantiation: sha.c:ctMaskEq Unexecuted instantiation: sha256.c:ctMaskEq Unexecuted instantiation: sha3.c:ctMaskEq Unexecuted instantiation: sha512.c:ctMaskEq Unexecuted instantiation: sp_int.c:ctMaskEq Unexecuted instantiation: wc_encrypt.c:ctMaskEq Unexecuted instantiation: wolfmath.c:ctMaskEq Unexecuted instantiation: ssl.c:ctMaskEq Line | Count | Source | 489 | 16.9k | { | 490 | 16.9k | return (byte)(~ctMaskGT(a, b)) & (byte)(~ctMaskLT(a, b)); | 491 | 16.9k | } |
Unexecuted instantiation: tls13.c:ctMaskEq Unexecuted instantiation: internal.c:ctMaskEq |
492 | | |
493 | | /* Constant time - sets 16 bit integer mask when a > b */ |
494 | | WC_STATIC WC_INLINE word16 ctMask16GT(int a, int b) |
495 | 0 | { |
496 | 0 | return (word16)((((word32)a - b - 1) >> 31) - 1); |
497 | 0 | } Unexecuted instantiation: aes.c:ctMask16GT Unexecuted instantiation: asn.c:ctMask16GT Unexecuted instantiation: camellia.c:ctMask16GT Unexecuted instantiation: chacha.c:ctMask16GT Unexecuted instantiation: chacha20_poly1305.c:ctMask16GT Unexecuted instantiation: cmac.c:ctMask16GT Unexecuted instantiation: coding.c:ctMask16GT Unexecuted instantiation: curve25519.c:ctMask16GT Unexecuted instantiation: curve448.c:ctMask16GT Unexecuted instantiation: des3.c:ctMask16GT Unexecuted instantiation: dh.c:ctMask16GT Unexecuted instantiation: ecc.c:ctMask16GT Unexecuted instantiation: ed25519.c:ctMask16GT Unexecuted instantiation: ed448.c:ctMask16GT Unexecuted instantiation: fe_448.c:ctMask16GT Unexecuted instantiation: fe_operations.c:ctMask16GT Unexecuted instantiation: ge_448.c:ctMask16GT Unexecuted instantiation: ge_operations.c:ctMask16GT Unexecuted instantiation: hash.c:ctMask16GT Unexecuted instantiation: hmac.c:ctMask16GT Unexecuted instantiation: kdf.c:ctMask16GT Unexecuted instantiation: md2.c:ctMask16GT Unexecuted instantiation: md4.c:ctMask16GT Unexecuted instantiation: md5.c:ctMask16GT Unexecuted instantiation: poly1305.c:ctMask16GT Unexecuted instantiation: pwdbased.c:ctMask16GT Unexecuted instantiation: random.c:ctMask16GT Unexecuted instantiation: ripemd.c:ctMask16GT Unexecuted instantiation: rsa.c:ctMask16GT Unexecuted instantiation: sha.c:ctMask16GT Unexecuted instantiation: sha256.c:ctMask16GT Unexecuted instantiation: sha3.c:ctMask16GT Unexecuted instantiation: sha512.c:ctMask16GT Unexecuted instantiation: sp_int.c:ctMask16GT Unexecuted instantiation: wc_encrypt.c:ctMask16GT Unexecuted instantiation: wolfmath.c:ctMask16GT Unexecuted instantiation: ssl.c:ctMask16GT Unexecuted instantiation: tls.c:ctMask16GT Unexecuted instantiation: tls13.c:ctMask16GT Unexecuted instantiation: internal.c:ctMask16GT |
498 | | |
499 | | /* Constant time - sets 16 bit integer mask when a >= b */ |
500 | | WC_STATIC WC_INLINE word16 ctMask16GTE(int a, int b) |
501 | 0 | { |
502 | 0 | return (word16)((((word32)a - b ) >> 31) - 1); |
503 | 0 | } Unexecuted instantiation: aes.c:ctMask16GTE Unexecuted instantiation: asn.c:ctMask16GTE Unexecuted instantiation: camellia.c:ctMask16GTE Unexecuted instantiation: chacha.c:ctMask16GTE Unexecuted instantiation: chacha20_poly1305.c:ctMask16GTE Unexecuted instantiation: cmac.c:ctMask16GTE Unexecuted instantiation: coding.c:ctMask16GTE Unexecuted instantiation: curve25519.c:ctMask16GTE Unexecuted instantiation: curve448.c:ctMask16GTE Unexecuted instantiation: des3.c:ctMask16GTE Unexecuted instantiation: dh.c:ctMask16GTE Unexecuted instantiation: ecc.c:ctMask16GTE Unexecuted instantiation: ed25519.c:ctMask16GTE Unexecuted instantiation: ed448.c:ctMask16GTE Unexecuted instantiation: fe_448.c:ctMask16GTE Unexecuted instantiation: fe_operations.c:ctMask16GTE Unexecuted instantiation: ge_448.c:ctMask16GTE Unexecuted instantiation: ge_operations.c:ctMask16GTE Unexecuted instantiation: hash.c:ctMask16GTE Unexecuted instantiation: hmac.c:ctMask16GTE Unexecuted instantiation: kdf.c:ctMask16GTE Unexecuted instantiation: md2.c:ctMask16GTE Unexecuted instantiation: md4.c:ctMask16GTE Unexecuted instantiation: md5.c:ctMask16GTE Unexecuted instantiation: poly1305.c:ctMask16GTE Unexecuted instantiation: pwdbased.c:ctMask16GTE Unexecuted instantiation: random.c:ctMask16GTE Unexecuted instantiation: ripemd.c:ctMask16GTE Unexecuted instantiation: rsa.c:ctMask16GTE Unexecuted instantiation: sha.c:ctMask16GTE Unexecuted instantiation: sha256.c:ctMask16GTE Unexecuted instantiation: sha3.c:ctMask16GTE Unexecuted instantiation: sha512.c:ctMask16GTE Unexecuted instantiation: sp_int.c:ctMask16GTE Unexecuted instantiation: wc_encrypt.c:ctMask16GTE Unexecuted instantiation: wolfmath.c:ctMask16GTE Unexecuted instantiation: ssl.c:ctMask16GTE Unexecuted instantiation: tls.c:ctMask16GTE Unexecuted instantiation: tls13.c:ctMask16GTE Unexecuted instantiation: internal.c:ctMask16GTE |
504 | | |
505 | | /* Constant time - sets 16 bit integer mask when a < b. */ |
506 | | WC_STATIC WC_INLINE word16 ctMask16LT(int a, int b) |
507 | 0 | { |
508 | 0 | return (word16)((((word32)b - a - 1) >> 31) - 1); |
509 | 0 | } Unexecuted instantiation: aes.c:ctMask16LT Unexecuted instantiation: asn.c:ctMask16LT Unexecuted instantiation: camellia.c:ctMask16LT Unexecuted instantiation: chacha.c:ctMask16LT Unexecuted instantiation: chacha20_poly1305.c:ctMask16LT Unexecuted instantiation: cmac.c:ctMask16LT Unexecuted instantiation: coding.c:ctMask16LT Unexecuted instantiation: curve25519.c:ctMask16LT Unexecuted instantiation: curve448.c:ctMask16LT Unexecuted instantiation: des3.c:ctMask16LT Unexecuted instantiation: dh.c:ctMask16LT Unexecuted instantiation: ecc.c:ctMask16LT Unexecuted instantiation: ed25519.c:ctMask16LT Unexecuted instantiation: ed448.c:ctMask16LT Unexecuted instantiation: fe_448.c:ctMask16LT Unexecuted instantiation: fe_operations.c:ctMask16LT Unexecuted instantiation: ge_448.c:ctMask16LT Unexecuted instantiation: ge_operations.c:ctMask16LT Unexecuted instantiation: hash.c:ctMask16LT Unexecuted instantiation: hmac.c:ctMask16LT Unexecuted instantiation: kdf.c:ctMask16LT Unexecuted instantiation: md2.c:ctMask16LT Unexecuted instantiation: md4.c:ctMask16LT Unexecuted instantiation: md5.c:ctMask16LT Unexecuted instantiation: poly1305.c:ctMask16LT Unexecuted instantiation: pwdbased.c:ctMask16LT Unexecuted instantiation: random.c:ctMask16LT Unexecuted instantiation: ripemd.c:ctMask16LT Unexecuted instantiation: rsa.c:ctMask16LT Unexecuted instantiation: sha.c:ctMask16LT Unexecuted instantiation: sha256.c:ctMask16LT Unexecuted instantiation: sha3.c:ctMask16LT Unexecuted instantiation: sha512.c:ctMask16LT Unexecuted instantiation: sp_int.c:ctMask16LT Unexecuted instantiation: wc_encrypt.c:ctMask16LT Unexecuted instantiation: wolfmath.c:ctMask16LT Unexecuted instantiation: ssl.c:ctMask16LT Unexecuted instantiation: tls.c:ctMask16LT Unexecuted instantiation: tls13.c:ctMask16LT Unexecuted instantiation: internal.c:ctMask16LT |
510 | | |
511 | | /* Constant time - sets 16 bit integer mask when a <= b. */ |
512 | | WC_STATIC WC_INLINE word16 ctMask16LTE(int a, int b) |
513 | 0 | { |
514 | 0 | return (word16)((((word32)b - a ) >> 31) - 1); |
515 | 0 | } Unexecuted instantiation: aes.c:ctMask16LTE Unexecuted instantiation: asn.c:ctMask16LTE Unexecuted instantiation: camellia.c:ctMask16LTE Unexecuted instantiation: chacha.c:ctMask16LTE Unexecuted instantiation: chacha20_poly1305.c:ctMask16LTE Unexecuted instantiation: cmac.c:ctMask16LTE Unexecuted instantiation: coding.c:ctMask16LTE Unexecuted instantiation: curve25519.c:ctMask16LTE Unexecuted instantiation: curve448.c:ctMask16LTE Unexecuted instantiation: des3.c:ctMask16LTE Unexecuted instantiation: dh.c:ctMask16LTE Unexecuted instantiation: ecc.c:ctMask16LTE Unexecuted instantiation: ed25519.c:ctMask16LTE Unexecuted instantiation: ed448.c:ctMask16LTE Unexecuted instantiation: fe_448.c:ctMask16LTE Unexecuted instantiation: fe_operations.c:ctMask16LTE Unexecuted instantiation: ge_448.c:ctMask16LTE Unexecuted instantiation: ge_operations.c:ctMask16LTE Unexecuted instantiation: hash.c:ctMask16LTE Unexecuted instantiation: hmac.c:ctMask16LTE Unexecuted instantiation: kdf.c:ctMask16LTE Unexecuted instantiation: md2.c:ctMask16LTE Unexecuted instantiation: md4.c:ctMask16LTE Unexecuted instantiation: md5.c:ctMask16LTE Unexecuted instantiation: poly1305.c:ctMask16LTE Unexecuted instantiation: pwdbased.c:ctMask16LTE Unexecuted instantiation: random.c:ctMask16LTE Unexecuted instantiation: ripemd.c:ctMask16LTE Unexecuted instantiation: rsa.c:ctMask16LTE Unexecuted instantiation: sha.c:ctMask16LTE Unexecuted instantiation: sha256.c:ctMask16LTE Unexecuted instantiation: sha3.c:ctMask16LTE Unexecuted instantiation: sha512.c:ctMask16LTE Unexecuted instantiation: sp_int.c:ctMask16LTE Unexecuted instantiation: wc_encrypt.c:ctMask16LTE Unexecuted instantiation: wolfmath.c:ctMask16LTE Unexecuted instantiation: ssl.c:ctMask16LTE Unexecuted instantiation: tls.c:ctMask16LTE Unexecuted instantiation: tls13.c:ctMask16LTE Unexecuted instantiation: internal.c:ctMask16LTE |
516 | | |
517 | | /* Constant time - sets 16 bit integer mask when a == b. */ |
518 | | WC_STATIC WC_INLINE word16 ctMask16Eq(int a, int b) |
519 | 0 | { |
520 | 0 | return (word16)(~ctMask16GT(a, b)) & (word16)(~ctMask16LT(a, b)); |
521 | 0 | } Unexecuted instantiation: aes.c:ctMask16Eq Unexecuted instantiation: asn.c:ctMask16Eq Unexecuted instantiation: camellia.c:ctMask16Eq Unexecuted instantiation: chacha.c:ctMask16Eq Unexecuted instantiation: chacha20_poly1305.c:ctMask16Eq Unexecuted instantiation: cmac.c:ctMask16Eq Unexecuted instantiation: coding.c:ctMask16Eq Unexecuted instantiation: curve25519.c:ctMask16Eq Unexecuted instantiation: curve448.c:ctMask16Eq Unexecuted instantiation: des3.c:ctMask16Eq Unexecuted instantiation: dh.c:ctMask16Eq Unexecuted instantiation: ecc.c:ctMask16Eq Unexecuted instantiation: ed25519.c:ctMask16Eq Unexecuted instantiation: ed448.c:ctMask16Eq Unexecuted instantiation: fe_448.c:ctMask16Eq Unexecuted instantiation: fe_operations.c:ctMask16Eq Unexecuted instantiation: ge_448.c:ctMask16Eq Unexecuted instantiation: ge_operations.c:ctMask16Eq Unexecuted instantiation: hash.c:ctMask16Eq Unexecuted instantiation: hmac.c:ctMask16Eq Unexecuted instantiation: kdf.c:ctMask16Eq Unexecuted instantiation: md2.c:ctMask16Eq Unexecuted instantiation: md4.c:ctMask16Eq Unexecuted instantiation: md5.c:ctMask16Eq Unexecuted instantiation: poly1305.c:ctMask16Eq Unexecuted instantiation: pwdbased.c:ctMask16Eq Unexecuted instantiation: random.c:ctMask16Eq Unexecuted instantiation: ripemd.c:ctMask16Eq Unexecuted instantiation: rsa.c:ctMask16Eq Unexecuted instantiation: sha.c:ctMask16Eq Unexecuted instantiation: sha256.c:ctMask16Eq Unexecuted instantiation: sha3.c:ctMask16Eq Unexecuted instantiation: sha512.c:ctMask16Eq Unexecuted instantiation: sp_int.c:ctMask16Eq Unexecuted instantiation: wc_encrypt.c:ctMask16Eq Unexecuted instantiation: wolfmath.c:ctMask16Eq Unexecuted instantiation: ssl.c:ctMask16Eq Unexecuted instantiation: tls.c:ctMask16Eq Unexecuted instantiation: tls13.c:ctMask16Eq Unexecuted instantiation: internal.c:ctMask16Eq |
522 | | |
523 | | /* Constant time - mask set when a != b. */ |
524 | | WC_STATIC WC_INLINE byte ctMaskNotEq(int a, int b) |
525 | 7.52k | { |
526 | 7.52k | return (byte)ctMaskGT(a, b) | (byte)ctMaskLT(a, b); |
527 | 7.52k | } Unexecuted instantiation: aes.c:ctMaskNotEq Unexecuted instantiation: asn.c:ctMaskNotEq Unexecuted instantiation: camellia.c:ctMaskNotEq Unexecuted instantiation: chacha.c:ctMaskNotEq Unexecuted instantiation: chacha20_poly1305.c:ctMaskNotEq Unexecuted instantiation: cmac.c:ctMaskNotEq Unexecuted instantiation: coding.c:ctMaskNotEq Unexecuted instantiation: curve25519.c:ctMaskNotEq Unexecuted instantiation: curve448.c:ctMaskNotEq Unexecuted instantiation: des3.c:ctMaskNotEq Unexecuted instantiation: dh.c:ctMaskNotEq Unexecuted instantiation: ecc.c:ctMaskNotEq Unexecuted instantiation: ed25519.c:ctMaskNotEq Unexecuted instantiation: ed448.c:ctMaskNotEq Unexecuted instantiation: fe_448.c:ctMaskNotEq Unexecuted instantiation: fe_operations.c:ctMaskNotEq Unexecuted instantiation: ge_448.c:ctMaskNotEq Unexecuted instantiation: ge_operations.c:ctMaskNotEq Unexecuted instantiation: hash.c:ctMaskNotEq Unexecuted instantiation: hmac.c:ctMaskNotEq Unexecuted instantiation: kdf.c:ctMaskNotEq Unexecuted instantiation: md2.c:ctMaskNotEq Unexecuted instantiation: md4.c:ctMaskNotEq Unexecuted instantiation: md5.c:ctMaskNotEq Unexecuted instantiation: poly1305.c:ctMaskNotEq Unexecuted instantiation: pwdbased.c:ctMaskNotEq Unexecuted instantiation: random.c:ctMaskNotEq Unexecuted instantiation: ripemd.c:ctMaskNotEq Line | Count | Source | 525 | 7.52k | { | 526 | 7.52k | return (byte)ctMaskGT(a, b) | (byte)ctMaskLT(a, b); | 527 | 7.52k | } |
Unexecuted instantiation: sha.c:ctMaskNotEq Unexecuted instantiation: sha256.c:ctMaskNotEq Unexecuted instantiation: sha3.c:ctMaskNotEq Unexecuted instantiation: sha512.c:ctMaskNotEq Unexecuted instantiation: sp_int.c:ctMaskNotEq Unexecuted instantiation: wc_encrypt.c:ctMaskNotEq Unexecuted instantiation: wolfmath.c:ctMaskNotEq Unexecuted instantiation: ssl.c:ctMaskNotEq Unexecuted instantiation: tls.c:ctMaskNotEq Unexecuted instantiation: tls13.c:ctMaskNotEq Unexecuted instantiation: internal.c:ctMaskNotEq |
528 | | |
529 | | /* Constant time - select a when mask is set and b otherwise. */ |
530 | | WC_STATIC WC_INLINE byte ctMaskSel(byte m, byte a, byte b) |
531 | 18.2k | { |
532 | 18.2k | return (byte)((b & ((byte)~(word32)m)) | (a & m)); |
533 | 18.2k | } Unexecuted instantiation: aes.c:ctMaskSel Unexecuted instantiation: asn.c:ctMaskSel Unexecuted instantiation: camellia.c:ctMaskSel Unexecuted instantiation: chacha.c:ctMaskSel Unexecuted instantiation: chacha20_poly1305.c:ctMaskSel Unexecuted instantiation: cmac.c:ctMaskSel Unexecuted instantiation: coding.c:ctMaskSel Unexecuted instantiation: curve25519.c:ctMaskSel Unexecuted instantiation: curve448.c:ctMaskSel Unexecuted instantiation: des3.c:ctMaskSel Unexecuted instantiation: dh.c:ctMaskSel Unexecuted instantiation: ecc.c:ctMaskSel Unexecuted instantiation: ed25519.c:ctMaskSel Unexecuted instantiation: ed448.c:ctMaskSel Unexecuted instantiation: fe_448.c:ctMaskSel Unexecuted instantiation: fe_operations.c:ctMaskSel Unexecuted instantiation: ge_448.c:ctMaskSel Unexecuted instantiation: ge_operations.c:ctMaskSel Unexecuted instantiation: hash.c:ctMaskSel Unexecuted instantiation: hmac.c:ctMaskSel Unexecuted instantiation: kdf.c:ctMaskSel Unexecuted instantiation: md2.c:ctMaskSel Unexecuted instantiation: md4.c:ctMaskSel Unexecuted instantiation: md5.c:ctMaskSel Unexecuted instantiation: poly1305.c:ctMaskSel Unexecuted instantiation: pwdbased.c:ctMaskSel Unexecuted instantiation: random.c:ctMaskSel Unexecuted instantiation: ripemd.c:ctMaskSel Unexecuted instantiation: rsa.c:ctMaskSel Unexecuted instantiation: sha.c:ctMaskSel Unexecuted instantiation: sha256.c:ctMaskSel Unexecuted instantiation: sha3.c:ctMaskSel Unexecuted instantiation: sha512.c:ctMaskSel Unexecuted instantiation: sp_int.c:ctMaskSel Unexecuted instantiation: wc_encrypt.c:ctMaskSel Unexecuted instantiation: wolfmath.c:ctMaskSel Unexecuted instantiation: ssl.c:ctMaskSel Line | Count | Source | 531 | 18.2k | { | 532 | 18.2k | return (byte)((b & ((byte)~(word32)m)) | (a & m)); | 533 | 18.2k | } |
Unexecuted instantiation: tls13.c:ctMaskSel Unexecuted instantiation: internal.c:ctMaskSel |
534 | | |
535 | | /* Constant time - select integer a when mask is set and integer b otherwise. */ |
536 | | WC_STATIC WC_INLINE int ctMaskSelInt(byte m, int a, int b) |
537 | 15.0k | { |
538 | 15.0k | return (b & (~(signed int)(signed char)m)) | |
539 | 15.0k | (a & ( (signed int)(signed char)m)); |
540 | 15.0k | } Unexecuted instantiation: aes.c:ctMaskSelInt Unexecuted instantiation: asn.c:ctMaskSelInt Unexecuted instantiation: camellia.c:ctMaskSelInt Unexecuted instantiation: chacha.c:ctMaskSelInt Unexecuted instantiation: chacha20_poly1305.c:ctMaskSelInt Unexecuted instantiation: cmac.c:ctMaskSelInt Unexecuted instantiation: coding.c:ctMaskSelInt Unexecuted instantiation: curve25519.c:ctMaskSelInt Unexecuted instantiation: curve448.c:ctMaskSelInt Unexecuted instantiation: des3.c:ctMaskSelInt Unexecuted instantiation: dh.c:ctMaskSelInt Unexecuted instantiation: ecc.c:ctMaskSelInt Unexecuted instantiation: ed25519.c:ctMaskSelInt Unexecuted instantiation: ed448.c:ctMaskSelInt Unexecuted instantiation: fe_448.c:ctMaskSelInt Unexecuted instantiation: fe_operations.c:ctMaskSelInt Unexecuted instantiation: ge_448.c:ctMaskSelInt Unexecuted instantiation: ge_operations.c:ctMaskSelInt Unexecuted instantiation: hash.c:ctMaskSelInt Unexecuted instantiation: hmac.c:ctMaskSelInt Unexecuted instantiation: kdf.c:ctMaskSelInt Unexecuted instantiation: md2.c:ctMaskSelInt Unexecuted instantiation: md4.c:ctMaskSelInt Unexecuted instantiation: md5.c:ctMaskSelInt Unexecuted instantiation: poly1305.c:ctMaskSelInt Unexecuted instantiation: pwdbased.c:ctMaskSelInt Unexecuted instantiation: random.c:ctMaskSelInt Unexecuted instantiation: ripemd.c:ctMaskSelInt Line | Count | Source | 537 | 15.0k | { | 538 | 15.0k | return (b & (~(signed int)(signed char)m)) | | 539 | 15.0k | (a & ( (signed int)(signed char)m)); | 540 | 15.0k | } |
Unexecuted instantiation: sha.c:ctMaskSelInt Unexecuted instantiation: sha256.c:ctMaskSelInt Unexecuted instantiation: sha3.c:ctMaskSelInt Unexecuted instantiation: sha512.c:ctMaskSelInt Unexecuted instantiation: sp_int.c:ctMaskSelInt Unexecuted instantiation: wc_encrypt.c:ctMaskSelInt Unexecuted instantiation: wolfmath.c:ctMaskSelInt Unexecuted instantiation: ssl.c:ctMaskSelInt Unexecuted instantiation: tls.c:ctMaskSelInt Unexecuted instantiation: tls13.c:ctMaskSelInt Unexecuted instantiation: internal.c:ctMaskSelInt |
541 | | |
542 | | /* Constant time - bit set when a <= b. */ |
543 | | WC_STATIC WC_INLINE byte ctSetLTE(int a, int b) |
544 | 63 | { |
545 | 63 | return (byte)(((word32)a - b - 1) >> 31); |
546 | 63 | } Unexecuted instantiation: aes.c:ctSetLTE Unexecuted instantiation: asn.c:ctSetLTE Unexecuted instantiation: camellia.c:ctSetLTE Unexecuted instantiation: chacha.c:ctSetLTE Unexecuted instantiation: chacha20_poly1305.c:ctSetLTE Unexecuted instantiation: cmac.c:ctSetLTE Unexecuted instantiation: coding.c:ctSetLTE Unexecuted instantiation: curve25519.c:ctSetLTE Unexecuted instantiation: curve448.c:ctSetLTE Unexecuted instantiation: des3.c:ctSetLTE Unexecuted instantiation: dh.c:ctSetLTE Unexecuted instantiation: ecc.c:ctSetLTE Unexecuted instantiation: ed25519.c:ctSetLTE Unexecuted instantiation: ed448.c:ctSetLTE Unexecuted instantiation: fe_448.c:ctSetLTE Unexecuted instantiation: fe_operations.c:ctSetLTE Unexecuted instantiation: ge_448.c:ctSetLTE Unexecuted instantiation: ge_operations.c:ctSetLTE Unexecuted instantiation: hash.c:ctSetLTE Unexecuted instantiation: hmac.c:ctSetLTE Unexecuted instantiation: kdf.c:ctSetLTE Unexecuted instantiation: md2.c:ctSetLTE Unexecuted instantiation: md4.c:ctSetLTE Unexecuted instantiation: md5.c:ctSetLTE Unexecuted instantiation: poly1305.c:ctSetLTE Unexecuted instantiation: pwdbased.c:ctSetLTE Unexecuted instantiation: random.c:ctSetLTE Unexecuted instantiation: ripemd.c:ctSetLTE Unexecuted instantiation: rsa.c:ctSetLTE Unexecuted instantiation: sha.c:ctSetLTE Unexecuted instantiation: sha256.c:ctSetLTE Unexecuted instantiation: sha3.c:ctSetLTE Unexecuted instantiation: sha512.c:ctSetLTE Unexecuted instantiation: sp_int.c:ctSetLTE Unexecuted instantiation: wc_encrypt.c:ctSetLTE Unexecuted instantiation: wolfmath.c:ctSetLTE Unexecuted instantiation: ssl.c:ctSetLTE Line | Count | Source | 544 | 63 | { | 545 | 63 | return (byte)(((word32)a - b - 1) >> 31); | 546 | 63 | } |
Unexecuted instantiation: tls13.c:ctSetLTE Unexecuted instantiation: internal.c:ctSetLTE |
547 | | |
548 | | /* Constant time - conditionally copy size bytes from src to dst if mask is set |
549 | | */ |
550 | | WC_STATIC WC_INLINE void ctMaskCopy(byte mask, byte* dst, byte* src, |
551 | | word16 size) |
552 | 0 | { |
553 | 0 | int i; |
554 | 0 | for (i = 0; i < size; ++i) { |
555 | 0 | dst[i] ^= (dst[i] ^ src[i]) & mask; |
556 | 0 | } |
557 | 0 | } Unexecuted instantiation: aes.c:ctMaskCopy Unexecuted instantiation: asn.c:ctMaskCopy Unexecuted instantiation: camellia.c:ctMaskCopy Unexecuted instantiation: chacha.c:ctMaskCopy Unexecuted instantiation: chacha20_poly1305.c:ctMaskCopy Unexecuted instantiation: cmac.c:ctMaskCopy Unexecuted instantiation: coding.c:ctMaskCopy Unexecuted instantiation: curve25519.c:ctMaskCopy Unexecuted instantiation: curve448.c:ctMaskCopy Unexecuted instantiation: des3.c:ctMaskCopy Unexecuted instantiation: dh.c:ctMaskCopy Unexecuted instantiation: ecc.c:ctMaskCopy Unexecuted instantiation: ed25519.c:ctMaskCopy Unexecuted instantiation: ed448.c:ctMaskCopy Unexecuted instantiation: fe_448.c:ctMaskCopy Unexecuted instantiation: fe_operations.c:ctMaskCopy Unexecuted instantiation: ge_448.c:ctMaskCopy Unexecuted instantiation: ge_operations.c:ctMaskCopy Unexecuted instantiation: hash.c:ctMaskCopy Unexecuted instantiation: hmac.c:ctMaskCopy Unexecuted instantiation: kdf.c:ctMaskCopy Unexecuted instantiation: md2.c:ctMaskCopy Unexecuted instantiation: md4.c:ctMaskCopy Unexecuted instantiation: md5.c:ctMaskCopy Unexecuted instantiation: poly1305.c:ctMaskCopy Unexecuted instantiation: pwdbased.c:ctMaskCopy Unexecuted instantiation: random.c:ctMaskCopy Unexecuted instantiation: ripemd.c:ctMaskCopy Unexecuted instantiation: rsa.c:ctMaskCopy Unexecuted instantiation: sha.c:ctMaskCopy Unexecuted instantiation: sha256.c:ctMaskCopy Unexecuted instantiation: sha3.c:ctMaskCopy Unexecuted instantiation: sha512.c:ctMaskCopy Unexecuted instantiation: sp_int.c:ctMaskCopy Unexecuted instantiation: wc_encrypt.c:ctMaskCopy Unexecuted instantiation: wolfmath.c:ctMaskCopy Unexecuted instantiation: ssl.c:ctMaskCopy Unexecuted instantiation: tls.c:ctMaskCopy Unexecuted instantiation: tls13.c:ctMaskCopy Unexecuted instantiation: internal.c:ctMaskCopy |
558 | | |
559 | | #endif |
560 | | |
561 | | #if defined(WOLFSSL_W64_WRAPPER) |
562 | | #if defined(WORD64_AVAILABLE) && !defined(WOLFSSL_W64_WRAPPER_TEST) |
563 | | WC_STATIC WC_INLINE void w64Increment(w64wrapper *n) { |
564 | | n->n++; |
565 | | } |
566 | | |
567 | | WC_STATIC WC_INLINE void w64Decrement(w64wrapper *n) { |
568 | | n->n--; |
569 | | } |
570 | | |
571 | | WC_STATIC WC_INLINE byte w64Equal(w64wrapper a, w64wrapper b) { |
572 | | return (a.n == b.n); |
573 | | } |
574 | | |
575 | | WC_STATIC WC_INLINE word32 w64GetLow32(w64wrapper n) { |
576 | | return (word32)n.n; |
577 | | } |
578 | | |
579 | | WC_STATIC WC_INLINE word32 w64GetHigh32(w64wrapper n) { |
580 | | return (word32)(n.n >> 32); |
581 | | } |
582 | | |
583 | | WC_STATIC WC_INLINE void w64SetLow32(w64wrapper *n, word32 low) { |
584 | | n->n = (n->n & (~(word64)(0xffffffff))) | low; |
585 | | } |
586 | | |
587 | | WC_STATIC WC_INLINE w64wrapper w64Add32(w64wrapper a, word32 b, byte *wrap) { |
588 | | a.n = a.n + b; |
589 | | if (a.n < b && wrap != NULL) |
590 | | *wrap = 1; |
591 | | |
592 | | return a; |
593 | | } |
594 | | |
595 | | WC_STATIC WC_INLINE w64wrapper w64Sub32(w64wrapper a, word32 b, byte *wrap) |
596 | | { |
597 | | if (a.n < b && wrap != NULL) |
598 | | *wrap = 1; |
599 | | a.n = a.n - b; |
600 | | return a; |
601 | | } |
602 | | |
603 | | WC_STATIC WC_INLINE byte w64GT(w64wrapper a, w64wrapper b) |
604 | | { |
605 | | return a.n > b.n; |
606 | | } |
607 | | |
608 | | WC_STATIC WC_INLINE byte w64IsZero(w64wrapper a) |
609 | | { |
610 | | return a.n == 0; |
611 | | } |
612 | | |
613 | | WC_STATIC WC_INLINE void c64toa(const w64wrapper *a, byte *out) |
614 | | { |
615 | | #ifdef BIG_ENDIAN_ORDER |
616 | | XMEMCPY(out, &a->n, sizeof(a->n)); |
617 | | #else |
618 | | word64 _out; |
619 | | _out = ByteReverseWord64(a->n); |
620 | | XMEMCPY(out, &_out, sizeof(_out)); |
621 | | #endif /* BIG_ENDIAN_ORDER */ |
622 | | } |
623 | | |
624 | | WC_STATIC WC_INLINE void ato64(const byte *in, w64wrapper *w64) |
625 | | { |
626 | | #ifdef BIG_ENDIAN_ORDER |
627 | | XMEMCPY(&w64->n, in, sizeof(w64->n)); |
628 | | #else |
629 | | word64 _in; |
630 | | XMEMCPY(&_in, in, sizeof(_in)); |
631 | | w64->n = ByteReverseWord64(_in); |
632 | | #endif /* BIG_ENDIAN_ORDER */ |
633 | | } |
634 | | |
635 | | WC_STATIC WC_INLINE w64wrapper w64From32(word32 hi, word32 lo) |
636 | | { |
637 | | w64wrapper ret; |
638 | | ret.n = ((word64)hi << 32) | lo; |
639 | | return ret; |
640 | | } |
641 | | |
642 | | WC_STATIC WC_INLINE byte w64GTE(w64wrapper a, w64wrapper b) |
643 | | { |
644 | | return a.n >= b.n; |
645 | | } |
646 | | |
647 | | WC_STATIC WC_INLINE byte w64LT(w64wrapper a, w64wrapper b) |
648 | | { |
649 | | return a.n < b.n; |
650 | | } |
651 | | |
652 | | WC_STATIC WC_INLINE w64wrapper w64Sub(w64wrapper a, w64wrapper b) |
653 | | { |
654 | | a.n -= b.n; |
655 | | return a; |
656 | | } |
657 | | |
658 | | WC_STATIC WC_INLINE void w64Zero(w64wrapper *a) |
659 | | { |
660 | | a->n = 0; |
661 | | } |
662 | | |
663 | | #else |
664 | | WC_STATIC WC_INLINE void w64Increment(w64wrapper *n) |
665 | | { |
666 | | n->n[1]++; |
667 | | if (n->n[1] == 0) |
668 | | n->n[0]++; |
669 | | } |
670 | | |
671 | | WC_STATIC WC_INLINE void w64Decrement(w64wrapper *n) { |
672 | | if (n->n[1] == 0) |
673 | | n->n[0]--; |
674 | | n->n[1]--; |
675 | | } |
676 | | |
677 | | WC_STATIC WC_INLINE byte w64Equal(w64wrapper a, w64wrapper b) |
678 | | { |
679 | | return (a.n[0] == b.n[0] && a.n[1] == b.n[1]); |
680 | | } |
681 | | |
682 | | WC_STATIC WC_INLINE word32 w64GetLow32(w64wrapper n) { |
683 | | return n.n[1]; |
684 | | } |
685 | | |
686 | | WC_STATIC WC_INLINE word32 w64GetHigh32(w64wrapper n) { |
687 | | return n.n[0]; |
688 | | } |
689 | | |
690 | | WC_STATIC WC_INLINE void w64SetLow32(w64wrapper *n, word32 low) |
691 | | { |
692 | | n->n[1] = low; |
693 | | } |
694 | | |
695 | | WC_STATIC WC_INLINE w64wrapper w64Add32(w64wrapper a, word32 b, byte *wrap) |
696 | | { |
697 | | a.n[1] = a.n[1] + b; |
698 | | if (a.n[1] < b) { |
699 | | a.n[0]++; |
700 | | if (wrap != NULL && a.n[0] == 0) |
701 | | *wrap = 1; |
702 | | } |
703 | | |
704 | | return a; |
705 | | } |
706 | | |
707 | | WC_STATIC WC_INLINE w64wrapper w64Sub32(w64wrapper a, word32 b, byte *wrap) |
708 | | { |
709 | | byte _underflow = 0; |
710 | | if (a.n[1] < b) |
711 | | _underflow = 1; |
712 | | |
713 | | a.n[1] -= b; |
714 | | if (_underflow) { |
715 | | if (a.n[0] == 0 && wrap != NULL) |
716 | | *wrap = 1; |
717 | | a.n[0]--; |
718 | | } |
719 | | |
720 | | return a; |
721 | | } |
722 | | |
723 | | WC_STATIC WC_INLINE w64wrapper w64Sub(w64wrapper a, w64wrapper b) |
724 | | { |
725 | | if (a.n[1] < b.n[1]) |
726 | | a.n[0]--; |
727 | | a.n[1] -= b.n[1]; |
728 | | a.n[0] -= b.n[0]; |
729 | | return a; |
730 | | } |
731 | | |
732 | | WC_STATIC WC_INLINE void w64Zero(w64wrapper *a) |
733 | | { |
734 | | a->n[0] = a->n[1] = 0; |
735 | | } |
736 | | |
737 | | WC_STATIC WC_INLINE byte w64GT(w64wrapper a, w64wrapper b) |
738 | | { |
739 | | if (a.n[0] > b.n[0]) |
740 | | return 1; |
741 | | if (a.n[0] == b.n[0]) |
742 | | return a.n[1] > b.n[1]; |
743 | | return 0; |
744 | | } |
745 | | |
746 | | WC_STATIC WC_INLINE byte w64GTE(w64wrapper a, w64wrapper b) |
747 | | { |
748 | | if (a.n[0] > b.n[0]) |
749 | | return 1; |
750 | | if (a.n[0] == b.n[0]) |
751 | | return a.n[1] >= b.n[1]; |
752 | | return 0; |
753 | | } |
754 | | |
755 | | WC_STATIC WC_INLINE byte w64IsZero(w64wrapper a) |
756 | | { |
757 | | return a.n[0] == 0 && a.n[1] == 0; |
758 | | } |
759 | | |
760 | | WC_STATIC WC_INLINE void c64toa(w64wrapper *a, byte *out) |
761 | | { |
762 | | #ifdef BIG_ENDIAN_ORDER |
763 | | word32 *_out = (word32*)(out); |
764 | | _out[0] = a->n[0]; |
765 | | _out[1] = a->n[1]; |
766 | | #else |
767 | | c32toa(a->n[0], out); |
768 | | c32toa(a->n[1], out + 4); |
769 | | #endif /* BIG_ENDIAN_ORDER */ |
770 | | } |
771 | | |
772 | | WC_STATIC WC_INLINE void ato64(const byte *in, w64wrapper *w64) |
773 | | { |
774 | | #ifdef BIG_ENDIAN_ORDER |
775 | | const word32 *_in = (const word32*)(in); |
776 | | w64->n[0] = *_in; |
777 | | w64->n[1] = *(_in + 1); |
778 | | #else |
779 | | ato32(in, &w64->n[0]); |
780 | | ato32(in + 4, &w64->n[1]); |
781 | | #endif /* BIG_ENDIAN_ORDER */ |
782 | | } |
783 | | |
784 | | WC_STATIC WC_INLINE w64wrapper w64From32(word32 hi, word32 lo) |
785 | | { |
786 | | w64wrapper w64; |
787 | | w64.n[0] = hi; |
788 | | w64.n[1] = lo; |
789 | | return w64; |
790 | | } |
791 | | |
792 | | WC_STATIC WC_INLINE byte w64LT(w64wrapper a, w64wrapper b) |
793 | | { |
794 | | if (a.n[0] < b.n[0]) |
795 | | return 1; |
796 | | if (a.n[0] == b.n[0]) |
797 | | return a.n[1] < b.n[1]; |
798 | | |
799 | | return 0; |
800 | | } |
801 | | |
802 | | #endif /* WORD64_AVAILABLE && !WOLFSSL_W64_WRAPPER_TEST */ |
803 | | #endif /* WOLFSSL_W64_WRAPPER */ |
804 | | |
805 | | #if defined(HAVE_SESSION_TICKET) || !defined(NO_CERTS) || \ |
806 | | !defined(NO_SESSION_CACHE) |
807 | | /* Make a word from the front of random hash */ |
808 | | WC_STATIC WC_INLINE word32 MakeWordFromHash(const byte* hashID) |
809 | 2.79k | { |
810 | 2.79k | return ((word32)hashID[0] << 24) | ((word32)hashID[1] << 16) | |
811 | 2.79k | ((word32)hashID[2] << 8) | (word32)hashID[3]; |
812 | 2.79k | } Unexecuted instantiation: aes.c:MakeWordFromHash Unexecuted instantiation: asn.c:MakeWordFromHash Unexecuted instantiation: camellia.c:MakeWordFromHash Unexecuted instantiation: chacha.c:MakeWordFromHash Unexecuted instantiation: chacha20_poly1305.c:MakeWordFromHash Unexecuted instantiation: cmac.c:MakeWordFromHash Unexecuted instantiation: coding.c:MakeWordFromHash Unexecuted instantiation: curve25519.c:MakeWordFromHash Unexecuted instantiation: curve448.c:MakeWordFromHash Unexecuted instantiation: des3.c:MakeWordFromHash Unexecuted instantiation: dh.c:MakeWordFromHash Unexecuted instantiation: ecc.c:MakeWordFromHash Unexecuted instantiation: ed25519.c:MakeWordFromHash Unexecuted instantiation: ed448.c:MakeWordFromHash Unexecuted instantiation: fe_448.c:MakeWordFromHash Unexecuted instantiation: fe_operations.c:MakeWordFromHash Unexecuted instantiation: ge_448.c:MakeWordFromHash Unexecuted instantiation: ge_operations.c:MakeWordFromHash Unexecuted instantiation: hash.c:MakeWordFromHash Unexecuted instantiation: hmac.c:MakeWordFromHash Unexecuted instantiation: kdf.c:MakeWordFromHash Unexecuted instantiation: md2.c:MakeWordFromHash Unexecuted instantiation: md4.c:MakeWordFromHash Unexecuted instantiation: md5.c:MakeWordFromHash Unexecuted instantiation: poly1305.c:MakeWordFromHash Unexecuted instantiation: pwdbased.c:MakeWordFromHash Unexecuted instantiation: random.c:MakeWordFromHash Unexecuted instantiation: ripemd.c:MakeWordFromHash Unexecuted instantiation: rsa.c:MakeWordFromHash Unexecuted instantiation: sha.c:MakeWordFromHash Unexecuted instantiation: sha256.c:MakeWordFromHash Unexecuted instantiation: sha3.c:MakeWordFromHash Unexecuted instantiation: sha512.c:MakeWordFromHash Unexecuted instantiation: sp_int.c:MakeWordFromHash Unexecuted instantiation: wc_encrypt.c:MakeWordFromHash Unexecuted instantiation: wolfmath.c:MakeWordFromHash Line | Count | Source | 809 | 2.79k | { | 810 | 2.79k | return ((word32)hashID[0] << 24) | ((word32)hashID[1] << 16) | | 811 | 2.79k | ((word32)hashID[2] << 8) | (word32)hashID[3]; | 812 | 2.79k | } |
Unexecuted instantiation: tls.c:MakeWordFromHash Unexecuted instantiation: tls13.c:MakeWordFromHash Unexecuted instantiation: internal.c:MakeWordFromHash |
813 | | #endif /* HAVE_SESSION_TICKET || !NO_CERTS || !NO_SESSION_CACHE */ |
814 | | |
815 | | |
816 | | #if !defined(NO_SESSION_CACHE) || defined(HAVE_SESSION_TICKET) |
817 | | |
818 | | #include <wolfssl/wolfcrypt/hash.h> |
819 | | |
820 | | /* some session IDs aren't random after all, let's make them random */ |
821 | | WC_STATIC WC_INLINE word32 HashObject(const byte* o, word32 len, int* error) |
822 | 602 | { |
823 | 602 | byte digest[WC_MAX_DIGEST_SIZE]; |
824 | | |
825 | 602 | #ifndef NO_MD5 |
826 | 602 | *error = wc_Md5Hash(o, len, digest); |
827 | | #elif !defined(NO_SHA) |
828 | | *error = wc_ShaHash(o, len, digest); |
829 | | #elif !defined(NO_SHA256) |
830 | | *error = wc_Sha256Hash(o, len, digest); |
831 | | #else |
832 | | #error "We need a digest to hash the session IDs" |
833 | | #endif |
834 | | |
835 | 602 | return *error == 0 ? MakeWordFromHash(digest) : 0; /* 0 on failure */ |
836 | 602 | } Unexecuted instantiation: aes.c:HashObject Unexecuted instantiation: asn.c:HashObject Unexecuted instantiation: camellia.c:HashObject Unexecuted instantiation: chacha.c:HashObject Unexecuted instantiation: chacha20_poly1305.c:HashObject Unexecuted instantiation: cmac.c:HashObject Unexecuted instantiation: coding.c:HashObject Unexecuted instantiation: curve25519.c:HashObject Unexecuted instantiation: curve448.c:HashObject Unexecuted instantiation: des3.c:HashObject Unexecuted instantiation: dh.c:HashObject Unexecuted instantiation: ecc.c:HashObject Unexecuted instantiation: ed25519.c:HashObject Unexecuted instantiation: ed448.c:HashObject Unexecuted instantiation: fe_448.c:HashObject Unexecuted instantiation: fe_operations.c:HashObject Unexecuted instantiation: ge_448.c:HashObject Unexecuted instantiation: ge_operations.c:HashObject Unexecuted instantiation: hash.c:HashObject Unexecuted instantiation: hmac.c:HashObject Unexecuted instantiation: kdf.c:HashObject Unexecuted instantiation: md2.c:HashObject Unexecuted instantiation: md4.c:HashObject Unexecuted instantiation: md5.c:HashObject Unexecuted instantiation: poly1305.c:HashObject Unexecuted instantiation: pwdbased.c:HashObject Unexecuted instantiation: random.c:HashObject Unexecuted instantiation: ripemd.c:HashObject Unexecuted instantiation: rsa.c:HashObject Unexecuted instantiation: sha.c:HashObject Unexecuted instantiation: sha256.c:HashObject Unexecuted instantiation: sha3.c:HashObject Unexecuted instantiation: sha512.c:HashObject Unexecuted instantiation: sp_int.c:HashObject Unexecuted instantiation: wc_encrypt.c:HashObject Unexecuted instantiation: wolfmath.c:HashObject Line | Count | Source | 822 | 602 | { | 823 | 602 | byte digest[WC_MAX_DIGEST_SIZE]; | 824 | | | 825 | 602 | #ifndef NO_MD5 | 826 | 602 | *error = wc_Md5Hash(o, len, digest); | 827 | | #elif !defined(NO_SHA) | 828 | | *error = wc_ShaHash(o, len, digest); | 829 | | #elif !defined(NO_SHA256) | 830 | | *error = wc_Sha256Hash(o, len, digest); | 831 | | #else | 832 | | #error "We need a digest to hash the session IDs" | 833 | | #endif | 834 | | | 835 | 602 | return *error == 0 ? MakeWordFromHash(digest) : 0; /* 0 on failure */ | 836 | 602 | } |
Unexecuted instantiation: tls.c:HashObject Unexecuted instantiation: tls13.c:HashObject Unexecuted instantiation: internal.c:HashObject |
837 | | #endif /* !NO_SESSION_CACHE || HAVE_SESSION_TICKET */ |
838 | | |
839 | | #undef WC_STATIC |
840 | | |
841 | | #endif /* !WOLFSSL_MISC_INCLUDED && !NO_INLINE */ |
842 | | |
843 | | #endif /* WOLF_CRYPT_MISC_C */ |