/src/libgcrypt/cipher/bufhelp.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* bufhelp.h - Some buffer manipulation helpers |
2 | | * Copyright (C) 2012-2017 Jussi Kivilinna <jussi.kivilinna@iki.fi> |
3 | | * |
4 | | * This file is part of Libgcrypt. |
5 | | * |
6 | | * Libgcrypt is free software; you can redistribute it and/or modify |
7 | | * it under the terms of the GNU Lesser General Public License as |
8 | | * published by the Free Software Foundation; either version 2.1 of |
9 | | * the License, or (at your option) any later version. |
10 | | * |
11 | | * Libgcrypt is distributed in the hope that it will be useful, |
12 | | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | | * GNU Lesser General Public License for more details. |
15 | | * |
16 | | * You should have received a copy of the GNU Lesser General Public |
17 | | * License along with this program; if not, see <http://www.gnu.org/licenses/>. |
18 | | */ |
19 | | #ifndef GCRYPT_BUFHELP_H |
20 | | #define GCRYPT_BUFHELP_H |
21 | | |
22 | | |
23 | | #include "g10lib.h" |
24 | | #include "bithelp.h" |
25 | | #include "const-time.h" |
26 | | |
27 | | |
28 | | #undef BUFHELP_UNALIGNED_ACCESS |
29 | | #if defined(HAVE_GCC_ATTRIBUTE_PACKED) && \ |
30 | | defined(HAVE_GCC_ATTRIBUTE_ALIGNED) && \ |
31 | | defined(HAVE_GCC_ATTRIBUTE_MAY_ALIAS) |
32 | | /* Compiler is supports attributes needed for automatically issuing unaligned |
33 | | memory access instructions. |
34 | | */ |
35 | | # define BUFHELP_UNALIGNED_ACCESS 1 |
36 | | #endif |
37 | | |
38 | | |
39 | | #ifndef BUFHELP_UNALIGNED_ACCESS |
40 | | |
41 | | /* Functions for loading and storing unaligned u32 values of different |
42 | | endianness. */ |
43 | | static inline u32 buf_get_be32(const void *_buf) |
44 | | { |
45 | | const byte *in = _buf; |
46 | | return ((u32)in[0] << 24) | ((u32)in[1] << 16) | \ |
47 | | ((u32)in[2] << 8) | (u32)in[3]; |
48 | | } |
49 | | |
50 | | static inline u32 buf_get_le32(const void *_buf) |
51 | | { |
52 | | const byte *in = _buf; |
53 | | return ((u32)in[3] << 24) | ((u32)in[2] << 16) | \ |
54 | | ((u32)in[1] << 8) | (u32)in[0]; |
55 | | } |
56 | | |
57 | | static inline void buf_put_be32(void *_buf, u32 val) |
58 | | { |
59 | | byte *out = _buf; |
60 | | out[0] = val >> 24; |
61 | | out[1] = val >> 16; |
62 | | out[2] = val >> 8; |
63 | | out[3] = val; |
64 | | } |
65 | | |
66 | | static inline void buf_put_le32(void *_buf, u32 val) |
67 | | { |
68 | | byte *out = _buf; |
69 | | out[3] = val >> 24; |
70 | | out[2] = val >> 16; |
71 | | out[1] = val >> 8; |
72 | | out[0] = val; |
73 | | } |
74 | | |
75 | | |
76 | | /* Functions for loading and storing unaligned u64 values of different |
77 | | endianness. */ |
78 | | static inline u64 buf_get_be64(const void *_buf) |
79 | | { |
80 | | const byte *in = _buf; |
81 | | return ((u64)in[0] << 56) | ((u64)in[1] << 48) | \ |
82 | | ((u64)in[2] << 40) | ((u64)in[3] << 32) | \ |
83 | | ((u64)in[4] << 24) | ((u64)in[5] << 16) | \ |
84 | | ((u64)in[6] << 8) | (u64)in[7]; |
85 | | } |
86 | | |
87 | | static inline u64 buf_get_le64(const void *_buf) |
88 | | { |
89 | | const byte *in = _buf; |
90 | | return ((u64)in[7] << 56) | ((u64)in[6] << 48) | \ |
91 | | ((u64)in[5] << 40) | ((u64)in[4] << 32) | \ |
92 | | ((u64)in[3] << 24) | ((u64)in[2] << 16) | \ |
93 | | ((u64)in[1] << 8) | (u64)in[0]; |
94 | | } |
95 | | |
96 | | static inline void buf_put_be64(void *_buf, u64 val) |
97 | | { |
98 | | byte *out = _buf; |
99 | | out[0] = val >> 56; |
100 | | out[1] = val >> 48; |
101 | | out[2] = val >> 40; |
102 | | out[3] = val >> 32; |
103 | | out[4] = val >> 24; |
104 | | out[5] = val >> 16; |
105 | | out[6] = val >> 8; |
106 | | out[7] = val; |
107 | | } |
108 | | |
109 | | static inline void buf_put_le64(void *_buf, u64 val) |
110 | | { |
111 | | byte *out = _buf; |
112 | | out[7] = val >> 56; |
113 | | out[6] = val >> 48; |
114 | | out[5] = val >> 40; |
115 | | out[4] = val >> 32; |
116 | | out[3] = val >> 24; |
117 | | out[2] = val >> 16; |
118 | | out[1] = val >> 8; |
119 | | out[0] = val; |
120 | | } |
121 | | |
122 | | #else /*BUFHELP_UNALIGNED_ACCESS*/ |
123 | | |
124 | | typedef struct bufhelp_u32_s |
125 | | { |
126 | | u32 a; |
127 | | } __attribute__((packed, aligned(1), may_alias)) bufhelp_u32_t; |
128 | | |
129 | | /* Functions for loading and storing unaligned u32 values of different |
130 | | endianness. */ |
131 | | static inline u32 buf_get_be32(const void *_buf) |
132 | 460k | { |
133 | 460k | return be_bswap32(((const bufhelp_u32_t *)_buf)->a); |
134 | 460k | } Unexecuted instantiation: md4.c:buf_get_be32 Unexecuted instantiation: md5.c:buf_get_be32 Line | Count | Source | 132 | 400k | { | 133 | 400k | return be_bswap32(((const bufhelp_u32_t *)_buf)->a); | 134 | 400k | } |
Unexecuted instantiation: rmd160.c:buf_get_be32 Unexecuted instantiation: sha1.c:buf_get_be32 Unexecuted instantiation: sha256.c:buf_get_be32 Unexecuted instantiation: sha512.c:buf_get_be32 Unexecuted instantiation: sm3.c:buf_get_be32 Unexecuted instantiation: stribog.c:buf_get_be32 Unexecuted instantiation: tiger.c:buf_get_be32 Unexecuted instantiation: whirlpool.c:buf_get_be32 Unexecuted instantiation: blake2.c:buf_get_be32 Unexecuted instantiation: cipher.c:buf_get_be32 Unexecuted instantiation: crc.c:buf_get_be32 Line | Count | Source | 132 | 866 | { | 133 | 866 | return be_bswap32(((const bufhelp_u32_t *)_buf)->a); | 134 | 866 | } |
Unexecuted instantiation: gost28147.c:buf_get_be32 Unexecuted instantiation: gostr3411-94.c:buf_get_be32 Unexecuted instantiation: hash-common.c:buf_get_be32 Unexecuted instantiation: idea.c:buf_get_be32 Unexecuted instantiation: kdf.c:buf_get_be32 Unexecuted instantiation: keccak.c:buf_get_be32 Unexecuted instantiation: mac-hmac.c:buf_get_be32 Unexecuted instantiation: mac-poly1305.c:buf_get_be32 Unexecuted instantiation: poly1305.c:buf_get_be32 Unexecuted instantiation: random-drbg.c:buf_get_be32 Unexecuted instantiation: rfc2268.c:buf_get_be32 Unexecuted instantiation: rijndael.c:buf_get_be32 Unexecuted instantiation: salsa20.c:buf_get_be32 Unexecuted instantiation: scrypt.c:buf_get_be32 Line | Count | Source | 132 | 1.64k | { | 133 | 1.64k | return be_bswap32(((const bufhelp_u32_t *)_buf)->a); | 134 | 1.64k | } |
Unexecuted instantiation: serpent.c:buf_get_be32 Line | Count | Source | 132 | 6.10k | { | 133 | 6.10k | return be_bswap32(((const bufhelp_u32_t *)_buf)->a); | 134 | 6.10k | } |
Unexecuted instantiation: twofish.c:buf_get_be32 Unexecuted instantiation: arcfour.c:buf_get_be32 Line | Count | Source | 132 | 25.3k | { | 133 | 25.3k | return be_bswap32(((const bufhelp_u32_t *)_buf)->a); | 134 | 25.3k | } |
Unexecuted instantiation: blowfish.c:buf_get_be32 Unexecuted instantiation: camellia-glue.c:buf_get_be32 Line | Count | Source | 132 | 25.6k | { | 133 | 25.6k | return be_bswap32(((const bufhelp_u32_t *)_buf)->a); | 134 | 25.6k | } |
Line | Count | Source | 132 | 348 | { | 133 | 348 | return be_bswap32(((const bufhelp_u32_t *)_buf)->a); | 134 | 348 | } |
Unexecuted instantiation: chacha20.c:buf_get_be32 Unexecuted instantiation: cipher-aeswrap.c:buf_get_be32 Unexecuted instantiation: cipher-cbc.c:buf_get_be32 Unexecuted instantiation: cipher-ccm.c:buf_get_be32 Unexecuted instantiation: cipher-cfb.c:buf_get_be32 Unexecuted instantiation: cipher-cmac.c:buf_get_be32 Unexecuted instantiation: cipher-ctr.c:buf_get_be32 Unexecuted instantiation: cipher-eax.c:buf_get_be32 Unexecuted instantiation: cipher-gcm-siv.c:buf_get_be32 Unexecuted instantiation: cipher-gcm.c:buf_get_be32 Unexecuted instantiation: cipher-ocb.c:buf_get_be32 Unexecuted instantiation: cipher-ofb.c:buf_get_be32 Unexecuted instantiation: cipher-poly1305.c:buf_get_be32 Unexecuted instantiation: cipher-siv.c:buf_get_be32 Unexecuted instantiation: cipher-xts.c:buf_get_be32 Unexecuted instantiation: ec-nist.c:buf_get_be32 Unexecuted instantiation: rijndael-padlock.c:buf_get_be32 Unexecuted instantiation: rijndael-vaes.c:buf_get_be32 |
135 | | |
136 | | static inline u32 buf_get_le32(const void *_buf) |
137 | 32.8M | { |
138 | 32.8M | return le_bswap32(((const bufhelp_u32_t *)_buf)->a); |
139 | 32.8M | } Line | Count | Source | 137 | 8.09M | { | 138 | 8.09M | return le_bswap32(((const bufhelp_u32_t *)_buf)->a); | 139 | 8.09M | } |
Line | Count | Source | 137 | 5.64M | { | 138 | 5.64M | return le_bswap32(((const bufhelp_u32_t *)_buf)->a); | 139 | 5.64M | } |
Line | Count | Source | 137 | 3.79M | { | 138 | 3.79M | return le_bswap32(((const bufhelp_u32_t *)_buf)->a); | 139 | 3.79M | } |
Line | Count | Source | 137 | 11.3M | { | 138 | 11.3M | return le_bswap32(((const bufhelp_u32_t *)_buf)->a); | 139 | 11.3M | } |
Unexecuted instantiation: sha1.c:buf_get_le32 Unexecuted instantiation: sha256.c:buf_get_le32 Unexecuted instantiation: sha512.c:buf_get_le32 Unexecuted instantiation: sm3.c:buf_get_le32 Unexecuted instantiation: stribog.c:buf_get_le32 Unexecuted instantiation: tiger.c:buf_get_le32 Unexecuted instantiation: whirlpool.c:buf_get_le32 Line | Count | Source | 137 | 17.2k | { | 138 | 17.2k | return le_bswap32(((const bufhelp_u32_t *)_buf)->a); | 139 | 17.2k | } |
Unexecuted instantiation: cipher.c:buf_get_le32 Unexecuted instantiation: crc.c:buf_get_le32 Unexecuted instantiation: des.c:buf_get_le32 Line | Count | Source | 137 | 4.75k | { | 138 | 4.75k | return le_bswap32(((const bufhelp_u32_t *)_buf)->a); | 139 | 4.75k | } |
gostr3411-94.c:buf_get_le32 Line | Count | Source | 137 | 3.90M | { | 138 | 3.90M | return le_bswap32(((const bufhelp_u32_t *)_buf)->a); | 139 | 3.90M | } |
Unexecuted instantiation: hash-common.c:buf_get_le32 Unexecuted instantiation: idea.c:buf_get_le32 Unexecuted instantiation: kdf.c:buf_get_le32 Unexecuted instantiation: keccak.c:buf_get_le32 Unexecuted instantiation: mac-hmac.c:buf_get_le32 Unexecuted instantiation: mac-poly1305.c:buf_get_le32 Unexecuted instantiation: poly1305.c:buf_get_le32 Unexecuted instantiation: random-drbg.c:buf_get_le32 Unexecuted instantiation: rfc2268.c:buf_get_le32 Unexecuted instantiation: rijndael.c:buf_get_le32 Unexecuted instantiation: salsa20.c:buf_get_le32 Unexecuted instantiation: scrypt.c:buf_get_le32 Unexecuted instantiation: seed.c:buf_get_le32 Line | Count | Source | 137 | 28.4k | { | 138 | 28.4k | return le_bswap32(((const bufhelp_u32_t *)_buf)->a); | 139 | 28.4k | } |
Unexecuted instantiation: sm4.c:buf_get_le32 Unexecuted instantiation: twofish.c:buf_get_le32 Unexecuted instantiation: arcfour.c:buf_get_le32 Unexecuted instantiation: aria.c:buf_get_le32 Unexecuted instantiation: blowfish.c:buf_get_le32 Unexecuted instantiation: camellia-glue.c:buf_get_le32 Unexecuted instantiation: camellia.c:buf_get_le32 Unexecuted instantiation: cast5.c:buf_get_le32 Unexecuted instantiation: chacha20.c:buf_get_le32 Unexecuted instantiation: cipher-aeswrap.c:buf_get_le32 Unexecuted instantiation: cipher-cbc.c:buf_get_le32 Unexecuted instantiation: cipher-ccm.c:buf_get_le32 cipher-cfb.c:buf_get_le32 Line | Count | Source | 137 | 624 | { | 138 | 624 | return le_bswap32(((const bufhelp_u32_t *)_buf)->a); | 139 | 624 | } |
Unexecuted instantiation: cipher-cmac.c:buf_get_le32 cipher-ctr.c:buf_get_le32 Line | Count | Source | 137 | 88 | { | 138 | 88 | return le_bswap32(((const bufhelp_u32_t *)_buf)->a); | 139 | 88 | } |
Unexecuted instantiation: cipher-eax.c:buf_get_le32 Unexecuted instantiation: cipher-gcm-siv.c:buf_get_le32 Unexecuted instantiation: cipher-gcm.c:buf_get_le32 Unexecuted instantiation: cipher-ocb.c:buf_get_le32 cipher-ofb.c:buf_get_le32 Line | Count | Source | 137 | 4 | { | 138 | 4 | return le_bswap32(((const bufhelp_u32_t *)_buf)->a); | 139 | 4 | } |
Unexecuted instantiation: cipher-poly1305.c:buf_get_le32 Unexecuted instantiation: cipher-siv.c:buf_get_le32 Unexecuted instantiation: cipher-xts.c:buf_get_le32 Unexecuted instantiation: ec-nist.c:buf_get_le32 Unexecuted instantiation: rijndael-padlock.c:buf_get_le32 Unexecuted instantiation: rijndael-vaes.c:buf_get_le32 |
140 | | |
141 | | static inline void buf_put_be32(void *_buf, u32 val) |
142 | 1.64M | { |
143 | 1.64M | bufhelp_u32_t *out = _buf; |
144 | 1.64M | out->a = be_bswap32(val); |
145 | 1.64M | } Unexecuted instantiation: md4.c:buf_put_be32 Unexecuted instantiation: md5.c:buf_put_be32 Line | Count | Source | 142 | 800k | { | 143 | 800k | bufhelp_u32_t *out = _buf; | 144 | 800k | out->a = be_bswap32(val); | 145 | 800k | } |
Unexecuted instantiation: rmd160.c:buf_put_be32 Line | Count | Source | 142 | 122k | { | 143 | 122k | bufhelp_u32_t *out = _buf; | 144 | 122k | out->a = be_bswap32(val); | 145 | 122k | } |
Line | Count | Source | 142 | 540k | { | 143 | 540k | bufhelp_u32_t *out = _buf; | 144 | 540k | out->a = be_bswap32(val); | 145 | 540k | } |
Unexecuted instantiation: sha512.c:buf_put_be32 Line | Count | Source | 142 | 99.6k | { | 143 | 99.6k | bufhelp_u32_t *out = _buf; | 144 | 99.6k | out->a = be_bswap32(val); | 145 | 99.6k | } |
Unexecuted instantiation: stribog.c:buf_put_be32 Unexecuted instantiation: tiger.c:buf_put_be32 Unexecuted instantiation: whirlpool.c:buf_put_be32 Unexecuted instantiation: blake2.c:buf_put_be32 Unexecuted instantiation: cipher.c:buf_put_be32 Line | Count | Source | 142 | 9.44k | { | 143 | 9.44k | bufhelp_u32_t *out = _buf; | 144 | 9.44k | out->a = be_bswap32(val); | 145 | 9.44k | } |
Line | Count | Source | 142 | 388 | { | 143 | 388 | bufhelp_u32_t *out = _buf; | 144 | 388 | out->a = be_bswap32(val); | 145 | 388 | } |
Unexecuted instantiation: gost28147.c:buf_put_be32 Unexecuted instantiation: gostr3411-94.c:buf_put_be32 Unexecuted instantiation: hash-common.c:buf_put_be32 Unexecuted instantiation: idea.c:buf_put_be32 Line | Count | Source | 142 | 11.9k | { | 143 | 11.9k | bufhelp_u32_t *out = _buf; | 144 | 11.9k | out->a = be_bswap32(val); | 145 | 11.9k | } |
Unexecuted instantiation: keccak.c:buf_put_be32 Unexecuted instantiation: mac-hmac.c:buf_put_be32 Unexecuted instantiation: mac-poly1305.c:buf_put_be32 Unexecuted instantiation: poly1305.c:buf_put_be32 Unexecuted instantiation: random-drbg.c:buf_put_be32 Unexecuted instantiation: rfc2268.c:buf_put_be32 Unexecuted instantiation: rijndael.c:buf_put_be32 Unexecuted instantiation: salsa20.c:buf_put_be32 Unexecuted instantiation: scrypt.c:buf_put_be32 Line | Count | Source | 142 | 1.61k | { | 143 | 1.61k | bufhelp_u32_t *out = _buf; | 144 | 1.61k | out->a = be_bswap32(val); | 145 | 1.61k | } |
Unexecuted instantiation: serpent.c:buf_put_be32 Line | Count | Source | 142 | 6.08k | { | 143 | 6.08k | bufhelp_u32_t *out = _buf; | 144 | 6.08k | out->a = be_bswap32(val); | 145 | 6.08k | } |
Unexecuted instantiation: twofish.c:buf_put_be32 Unexecuted instantiation: arcfour.c:buf_put_be32 Line | Count | Source | 142 | 25.1k | { | 143 | 25.1k | bufhelp_u32_t *out = _buf; | 144 | 25.1k | out->a = be_bswap32(val); | 145 | 25.1k | } |
Unexecuted instantiation: blowfish.c:buf_put_be32 Unexecuted instantiation: camellia-glue.c:buf_put_be32 Line | Count | Source | 142 | 25.6k | { | 143 | 25.6k | bufhelp_u32_t *out = _buf; | 144 | 25.6k | out->a = be_bswap32(val); | 145 | 25.6k | } |
Unexecuted instantiation: cast5.c:buf_put_be32 Unexecuted instantiation: chacha20.c:buf_put_be32 Unexecuted instantiation: cipher-aeswrap.c:buf_put_be32 Unexecuted instantiation: cipher-cbc.c:buf_put_be32 Unexecuted instantiation: cipher-ccm.c:buf_put_be32 Unexecuted instantiation: cipher-cfb.c:buf_put_be32 Unexecuted instantiation: cipher-cmac.c:buf_put_be32 Unexecuted instantiation: cipher-ctr.c:buf_put_be32 Unexecuted instantiation: cipher-eax.c:buf_put_be32 Unexecuted instantiation: cipher-gcm-siv.c:buf_put_be32 Unexecuted instantiation: cipher-gcm.c:buf_put_be32 Unexecuted instantiation: cipher-ocb.c:buf_put_be32 Unexecuted instantiation: cipher-ofb.c:buf_put_be32 Unexecuted instantiation: cipher-poly1305.c:buf_put_be32 Unexecuted instantiation: cipher-siv.c:buf_put_be32 Unexecuted instantiation: cipher-xts.c:buf_put_be32 Unexecuted instantiation: ec-nist.c:buf_put_be32 Unexecuted instantiation: rijndael-padlock.c:buf_put_be32 Unexecuted instantiation: rijndael-vaes.c:buf_put_be32 |
146 | | |
147 | | static inline void buf_put_le32(void *_buf, u32 val) |
148 | 560k | { |
149 | 560k | bufhelp_u32_t *out = _buf; |
150 | 560k | out->a = le_bswap32(val); |
151 | 560k | } Line | Count | Source | 148 | 52.5k | { | 149 | 52.5k | bufhelp_u32_t *out = _buf; | 150 | 52.5k | out->a = le_bswap32(val); | 151 | 52.5k | } |
Line | Count | Source | 148 | 66.4k | { | 149 | 66.4k | bufhelp_u32_t *out = _buf; | 150 | 66.4k | out->a = le_bswap32(val); | 151 | 66.4k | } |
Unexecuted instantiation: mpicoder.c:buf_put_le32 Line | Count | Source | 148 | 89.5k | { | 149 | 89.5k | bufhelp_u32_t *out = _buf; | 150 | 89.5k | out->a = le_bswap32(val); | 151 | 89.5k | } |
Unexecuted instantiation: sha1.c:buf_put_le32 Unexecuted instantiation: sha256.c:buf_put_le32 Unexecuted instantiation: sha512.c:buf_put_le32 Unexecuted instantiation: sm3.c:buf_put_le32 Unexecuted instantiation: stribog.c:buf_put_le32 Line | Count | Source | 148 | 16.2k | { | 149 | 16.2k | bufhelp_u32_t *out = _buf; | 150 | 16.2k | out->a = le_bswap32(val); | 151 | 16.2k | } |
Unexecuted instantiation: whirlpool.c:buf_put_le32 Line | Count | Source | 148 | 196k | { | 149 | 196k | bufhelp_u32_t *out = _buf; | 150 | 196k | out->a = le_bswap32(val); | 151 | 196k | } |
Unexecuted instantiation: cipher.c:buf_put_le32 Line | Count | Source | 148 | 16.6k | { | 149 | 16.6k | bufhelp_u32_t *out = _buf; | 150 | 16.6k | out->a = le_bswap32(val); | 151 | 16.6k | } |
Unexecuted instantiation: des.c:buf_put_le32 Line | Count | Source | 148 | 4.71k | { | 149 | 4.71k | bufhelp_u32_t *out = _buf; | 150 | 4.71k | out->a = le_bswap32(val); | 151 | 4.71k | } |
Unexecuted instantiation: gostr3411-94.c:buf_put_le32 Unexecuted instantiation: hash-common.c:buf_put_le32 Unexecuted instantiation: idea.c:buf_put_le32 Line | Count | Source | 148 | 89.0k | { | 149 | 89.0k | bufhelp_u32_t *out = _buf; | 150 | 89.0k | out->a = le_bswap32(val); | 151 | 89.0k | } |
Unexecuted instantiation: keccak.c:buf_put_le32 Unexecuted instantiation: mac-hmac.c:buf_put_le32 Unexecuted instantiation: mac-poly1305.c:buf_put_le32 Unexecuted instantiation: poly1305.c:buf_put_le32 Unexecuted instantiation: random-drbg.c:buf_put_le32 Unexecuted instantiation: rfc2268.c:buf_put_le32 Unexecuted instantiation: rijndael.c:buf_put_le32 Unexecuted instantiation: salsa20.c:buf_put_le32 Unexecuted instantiation: scrypt.c:buf_put_le32 Unexecuted instantiation: seed.c:buf_put_le32 Line | Count | Source | 148 | 28.3k | { | 149 | 28.3k | bufhelp_u32_t *out = _buf; | 150 | 28.3k | out->a = le_bswap32(val); | 151 | 28.3k | } |
Unexecuted instantiation: sm4.c:buf_put_le32 Unexecuted instantiation: twofish.c:buf_put_le32 Unexecuted instantiation: arcfour.c:buf_put_le32 Unexecuted instantiation: aria.c:buf_put_le32 Unexecuted instantiation: blowfish.c:buf_put_le32 Unexecuted instantiation: camellia-glue.c:buf_put_le32 Unexecuted instantiation: camellia.c:buf_put_le32 Unexecuted instantiation: cast5.c:buf_put_le32 Unexecuted instantiation: chacha20.c:buf_put_le32 Unexecuted instantiation: cipher-aeswrap.c:buf_put_le32 Unexecuted instantiation: cipher-cbc.c:buf_put_le32 Unexecuted instantiation: cipher-ccm.c:buf_put_le32 cipher-cfb.c:buf_put_le32 Line | Count | Source | 148 | 488 | { | 149 | 488 | bufhelp_u32_t *out = _buf; | 150 | 488 | out->a = le_bswap32(val); | 151 | 488 | } |
Unexecuted instantiation: cipher-cmac.c:buf_put_le32 cipher-ctr.c:buf_put_le32 Line | Count | Source | 148 | 44 | { | 149 | 44 | bufhelp_u32_t *out = _buf; | 150 | 44 | out->a = le_bswap32(val); | 151 | 44 | } |
Unexecuted instantiation: cipher-eax.c:buf_put_le32 Unexecuted instantiation: cipher-gcm-siv.c:buf_put_le32 Unexecuted instantiation: cipher-gcm.c:buf_put_le32 Unexecuted instantiation: cipher-ocb.c:buf_put_le32 cipher-ofb.c:buf_put_le32 Line | Count | Source | 148 | 2 | { | 149 | 2 | bufhelp_u32_t *out = _buf; | 150 | 2 | out->a = le_bswap32(val); | 151 | 2 | } |
Unexecuted instantiation: cipher-poly1305.c:buf_put_le32 Unexecuted instantiation: cipher-siv.c:buf_put_le32 Unexecuted instantiation: cipher-xts.c:buf_put_le32 Unexecuted instantiation: ec-nist.c:buf_put_le32 Unexecuted instantiation: rijndael-padlock.c:buf_put_le32 Unexecuted instantiation: rijndael-vaes.c:buf_put_le32 |
152 | | |
153 | | |
154 | | typedef struct bufhelp_u64_s |
155 | | { |
156 | | u64 a; |
157 | | } __attribute__((packed, aligned(1), may_alias)) bufhelp_u64_t; |
158 | | |
159 | | /* Functions for loading and storing unaligned u64 values of different |
160 | | endianness. */ |
161 | | static inline u64 buf_get_be64(const void *_buf) |
162 | 9.03k | { |
163 | 9.03k | return be_bswap64(((const bufhelp_u64_t *)_buf)->a); |
164 | 9.03k | } Unexecuted instantiation: md4.c:buf_get_be64 Unexecuted instantiation: md5.c:buf_get_be64 Line | Count | Source | 162 | 8.71k | { | 163 | 8.71k | return be_bswap64(((const bufhelp_u64_t *)_buf)->a); | 164 | 8.71k | } |
Unexecuted instantiation: rmd160.c:buf_get_be64 Unexecuted instantiation: sha1.c:buf_get_be64 Unexecuted instantiation: sha256.c:buf_get_be64 Unexecuted instantiation: sha512.c:buf_get_be64 Unexecuted instantiation: sm3.c:buf_get_be64 Unexecuted instantiation: stribog.c:buf_get_be64 Unexecuted instantiation: tiger.c:buf_get_be64 Unexecuted instantiation: whirlpool.c:buf_get_be64 Unexecuted instantiation: blake2.c:buf_get_be64 Unexecuted instantiation: cipher.c:buf_get_be64 Unexecuted instantiation: crc.c:buf_get_be64 Unexecuted instantiation: des.c:buf_get_be64 Unexecuted instantiation: gost28147.c:buf_get_be64 Unexecuted instantiation: gostr3411-94.c:buf_get_be64 Unexecuted instantiation: hash-common.c:buf_get_be64 Unexecuted instantiation: idea.c:buf_get_be64 Unexecuted instantiation: kdf.c:buf_get_be64 Unexecuted instantiation: keccak.c:buf_get_be64 Unexecuted instantiation: mac-hmac.c:buf_get_be64 Unexecuted instantiation: mac-poly1305.c:buf_get_be64 Unexecuted instantiation: poly1305.c:buf_get_be64 Unexecuted instantiation: random-drbg.c:buf_get_be64 Unexecuted instantiation: rfc2268.c:buf_get_be64 Unexecuted instantiation: rijndael.c:buf_get_be64 Unexecuted instantiation: salsa20.c:buf_get_be64 Unexecuted instantiation: scrypt.c:buf_get_be64 Unexecuted instantiation: seed.c:buf_get_be64 Unexecuted instantiation: serpent.c:buf_get_be64 Unexecuted instantiation: sm4.c:buf_get_be64 Unexecuted instantiation: twofish.c:buf_get_be64 Unexecuted instantiation: arcfour.c:buf_get_be64 Line | Count | Source | 162 | 206 | { | 163 | 206 | return be_bswap64(((const bufhelp_u64_t *)_buf)->a); | 164 | 206 | } |
Unexecuted instantiation: blowfish.c:buf_get_be64 Unexecuted instantiation: camellia-glue.c:buf_get_be64 Unexecuted instantiation: camellia.c:buf_get_be64 Unexecuted instantiation: cast5.c:buf_get_be64 Unexecuted instantiation: chacha20.c:buf_get_be64 Unexecuted instantiation: cipher-aeswrap.c:buf_get_be64 Unexecuted instantiation: cipher-cbc.c:buf_get_be64 Unexecuted instantiation: cipher-ccm.c:buf_get_be64 Unexecuted instantiation: cipher-cfb.c:buf_get_be64 Unexecuted instantiation: cipher-cmac.c:buf_get_be64 cipher-ctr.c:buf_get_be64 Line | Count | Source | 162 | 116 | { | 163 | 116 | return be_bswap64(((const bufhelp_u64_t *)_buf)->a); | 164 | 116 | } |
Unexecuted instantiation: cipher-eax.c:buf_get_be64 Unexecuted instantiation: cipher-gcm-siv.c:buf_get_be64 Unexecuted instantiation: cipher-gcm.c:buf_get_be64 Unexecuted instantiation: cipher-ocb.c:buf_get_be64 Unexecuted instantiation: cipher-ofb.c:buf_get_be64 Unexecuted instantiation: cipher-poly1305.c:buf_get_be64 Unexecuted instantiation: cipher-siv.c:buf_get_be64 Unexecuted instantiation: cipher-xts.c:buf_get_be64 Unexecuted instantiation: ec-nist.c:buf_get_be64 Unexecuted instantiation: rijndael-padlock.c:buf_get_be64 Unexecuted instantiation: rijndael-vaes.c:buf_get_be64 |
165 | | |
166 | | static inline u64 buf_get_le64(const void *_buf) |
167 | 112M | { |
168 | 112M | return le_bswap64(((const bufhelp_u64_t *)_buf)->a); |
169 | 112M | } Unexecuted instantiation: md4.c:buf_get_le64 Unexecuted instantiation: md5.c:buf_get_le64 Unexecuted instantiation: mpicoder.c:buf_get_le64 Unexecuted instantiation: rmd160.c:buf_get_le64 Unexecuted instantiation: sha1.c:buf_get_le64 Unexecuted instantiation: sha256.c:buf_get_le64 Unexecuted instantiation: sha512.c:buf_get_le64 Unexecuted instantiation: sm3.c:buf_get_le64 Line | Count | Source | 167 | 5.85M | { | 168 | 5.85M | return le_bswap64(((const bufhelp_u64_t *)_buf)->a); | 169 | 5.85M | } |
Line | Count | Source | 167 | 2.64M | { | 168 | 2.64M | return le_bswap64(((const bufhelp_u64_t *)_buf)->a); | 169 | 2.64M | } |
Unexecuted instantiation: whirlpool.c:buf_get_le64 Line | Count | Source | 167 | 20.9M | { | 168 | 20.9M | return le_bswap64(((const bufhelp_u64_t *)_buf)->a); | 169 | 20.9M | } |
Unexecuted instantiation: cipher.c:buf_get_le64 Unexecuted instantiation: crc.c:buf_get_le64 Unexecuted instantiation: des.c:buf_get_le64 Unexecuted instantiation: gost28147.c:buf_get_le64 Unexecuted instantiation: gostr3411-94.c:buf_get_le64 Unexecuted instantiation: hash-common.c:buf_get_le64 Unexecuted instantiation: idea.c:buf_get_le64 Unexecuted instantiation: kdf.c:buf_get_le64 Line | Count | Source | 167 | 876k | { | 168 | 876k | return le_bswap64(((const bufhelp_u64_t *)_buf)->a); | 169 | 876k | } |
Unexecuted instantiation: mac-hmac.c:buf_get_le64 Unexecuted instantiation: mac-poly1305.c:buf_get_le64 Unexecuted instantiation: poly1305.c:buf_get_le64 Unexecuted instantiation: random-drbg.c:buf_get_le64 Unexecuted instantiation: rfc2268.c:buf_get_le64 Unexecuted instantiation: rijndael.c:buf_get_le64 Unexecuted instantiation: salsa20.c:buf_get_le64 Line | Count | Source | 167 | 1.14M | { | 168 | 1.14M | return le_bswap64(((const bufhelp_u64_t *)_buf)->a); | 169 | 1.14M | } |
Unexecuted instantiation: seed.c:buf_get_le64 Unexecuted instantiation: serpent.c:buf_get_le64 Unexecuted instantiation: sm4.c:buf_get_le64 Unexecuted instantiation: twofish.c:buf_get_le64 Unexecuted instantiation: arcfour.c:buf_get_le64 Line | Count | Source | 167 | 25.1k | { | 168 | 25.1k | return le_bswap64(((const bufhelp_u64_t *)_buf)->a); | 169 | 25.1k | } |
Unexecuted instantiation: blowfish.c:buf_get_le64 camellia-glue.c:buf_get_le64 Line | Count | Source | 167 | 80 | { | 168 | 80 | return le_bswap64(((const bufhelp_u64_t *)_buf)->a); | 169 | 80 | } |
Unexecuted instantiation: camellia.c:buf_get_le64 Line | Count | Source | 167 | 513 | { | 168 | 513 | return le_bswap64(((const bufhelp_u64_t *)_buf)->a); | 169 | 513 | } |
Unexecuted instantiation: chacha20.c:buf_get_le64 Unexecuted instantiation: cipher-aeswrap.c:buf_get_le64 cipher-cbc.c:buf_get_le64 Line | Count | Source | 167 | 125 | { | 168 | 125 | return le_bswap64(((const bufhelp_u64_t *)_buf)->a); | 169 | 125 | } |
Unexecuted instantiation: cipher-ccm.c:buf_get_le64 cipher-cfb.c:buf_get_le64 Line | Count | Source | 167 | 914 | { | 168 | 914 | return le_bswap64(((const bufhelp_u64_t *)_buf)->a); | 169 | 914 | } |
cipher-cmac.c:buf_get_le64 Line | Count | Source | 167 | 143k | { | 168 | 143k | return le_bswap64(((const bufhelp_u64_t *)_buf)->a); | 169 | 143k | } |
cipher-ctr.c:buf_get_le64 Line | Count | Source | 167 | 112 | { | 168 | 112 | return le_bswap64(((const bufhelp_u64_t *)_buf)->a); | 169 | 112 | } |
Unexecuted instantiation: cipher-eax.c:buf_get_le64 Unexecuted instantiation: cipher-gcm-siv.c:buf_get_le64 Unexecuted instantiation: cipher-gcm.c:buf_get_le64 Unexecuted instantiation: cipher-ocb.c:buf_get_le64 cipher-ofb.c:buf_get_le64 Line | Count | Source | 167 | 466 | { | 168 | 466 | return le_bswap64(((const bufhelp_u64_t *)_buf)->a); | 169 | 466 | } |
Unexecuted instantiation: cipher-poly1305.c:buf_get_le64 Unexecuted instantiation: cipher-siv.c:buf_get_le64 Unexecuted instantiation: cipher-xts.c:buf_get_le64 Line | Count | Source | 167 | 81.0M | { | 168 | 81.0M | return le_bswap64(((const bufhelp_u64_t *)_buf)->a); | 169 | 81.0M | } |
Unexecuted instantiation: rijndael-padlock.c:buf_get_le64 Unexecuted instantiation: rijndael-vaes.c:buf_get_le64 |
170 | | |
171 | | static inline void buf_put_be64(void *_buf, u64 val) |
172 | 848k | { |
173 | 848k | bufhelp_u64_t *out = _buf; |
174 | 848k | out->a = be_bswap64(val); |
175 | 848k | } Unexecuted instantiation: md4.c:buf_put_be64 Unexecuted instantiation: md5.c:buf_put_be64 Line | Count | Source | 172 | 420k | { | 173 | 420k | bufhelp_u64_t *out = _buf; | 174 | 420k | out->a = be_bswap64(val); | 175 | 420k | } |
Unexecuted instantiation: rmd160.c:buf_put_be64 Unexecuted instantiation: sha1.c:buf_put_be64 Unexecuted instantiation: sha256.c:buf_put_be64 Line | Count | Source | 172 | 327k | { | 173 | 327k | bufhelp_u64_t *out = _buf; | 174 | 327k | out->a = be_bswap64(val); | 175 | 327k | } |
Unexecuted instantiation: sm3.c:buf_put_be64 Unexecuted instantiation: stribog.c:buf_put_be64 Unexecuted instantiation: tiger.c:buf_put_be64 Line | Count | Source | 172 | 100k | { | 173 | 100k | bufhelp_u64_t *out = _buf; | 174 | 100k | out->a = be_bswap64(val); | 175 | 100k | } |
Unexecuted instantiation: blake2.c:buf_put_be64 Unexecuted instantiation: cipher.c:buf_put_be64 Unexecuted instantiation: crc.c:buf_put_be64 Unexecuted instantiation: des.c:buf_put_be64 Unexecuted instantiation: gost28147.c:buf_put_be64 Unexecuted instantiation: gostr3411-94.c:buf_put_be64 Unexecuted instantiation: hash-common.c:buf_put_be64 Unexecuted instantiation: idea.c:buf_put_be64 Unexecuted instantiation: kdf.c:buf_put_be64 Unexecuted instantiation: keccak.c:buf_put_be64 Unexecuted instantiation: mac-hmac.c:buf_put_be64 Unexecuted instantiation: mac-poly1305.c:buf_put_be64 Unexecuted instantiation: poly1305.c:buf_put_be64 Unexecuted instantiation: random-drbg.c:buf_put_be64 Unexecuted instantiation: rfc2268.c:buf_put_be64 Unexecuted instantiation: rijndael.c:buf_put_be64 Unexecuted instantiation: salsa20.c:buf_put_be64 Unexecuted instantiation: scrypt.c:buf_put_be64 Unexecuted instantiation: seed.c:buf_put_be64 Unexecuted instantiation: serpent.c:buf_put_be64 Unexecuted instantiation: sm4.c:buf_put_be64 Unexecuted instantiation: twofish.c:buf_put_be64 Unexecuted instantiation: arcfour.c:buf_put_be64 Line | Count | Source | 172 | 206 | { | 173 | 206 | bufhelp_u64_t *out = _buf; | 174 | 206 | out->a = be_bswap64(val); | 175 | 206 | } |
Unexecuted instantiation: blowfish.c:buf_put_be64 Unexecuted instantiation: camellia-glue.c:buf_put_be64 Unexecuted instantiation: camellia.c:buf_put_be64 Unexecuted instantiation: cast5.c:buf_put_be64 Unexecuted instantiation: chacha20.c:buf_put_be64 Unexecuted instantiation: cipher-aeswrap.c:buf_put_be64 Unexecuted instantiation: cipher-cbc.c:buf_put_be64 Unexecuted instantiation: cipher-ccm.c:buf_put_be64 Unexecuted instantiation: cipher-cfb.c:buf_put_be64 Unexecuted instantiation: cipher-cmac.c:buf_put_be64 cipher-ctr.c:buf_put_be64 Line | Count | Source | 172 | 116 | { | 173 | 116 | bufhelp_u64_t *out = _buf; | 174 | 116 | out->a = be_bswap64(val); | 175 | 116 | } |
Unexecuted instantiation: cipher-eax.c:buf_put_be64 Unexecuted instantiation: cipher-gcm-siv.c:buf_put_be64 Unexecuted instantiation: cipher-gcm.c:buf_put_be64 Unexecuted instantiation: cipher-ocb.c:buf_put_be64 Unexecuted instantiation: cipher-ofb.c:buf_put_be64 Unexecuted instantiation: cipher-poly1305.c:buf_put_be64 Unexecuted instantiation: cipher-siv.c:buf_put_be64 Unexecuted instantiation: cipher-xts.c:buf_put_be64 Unexecuted instantiation: ec-nist.c:buf_put_be64 Unexecuted instantiation: rijndael-padlock.c:buf_put_be64 Unexecuted instantiation: rijndael-vaes.c:buf_put_be64 |
176 | | |
177 | | static inline void buf_put_le64(void *_buf, u64 val) |
178 | 21.9M | { |
179 | 21.9M | bufhelp_u64_t *out = _buf; |
180 | 21.9M | out->a = le_bswap64(val); |
181 | 21.9M | } Unexecuted instantiation: md4.c:buf_put_le64 Unexecuted instantiation: md5.c:buf_put_le64 Unexecuted instantiation: mpicoder.c:buf_put_le64 Unexecuted instantiation: rmd160.c:buf_put_le64 Unexecuted instantiation: sha1.c:buf_put_le64 Unexecuted instantiation: sha256.c:buf_put_le64 Unexecuted instantiation: sha512.c:buf_put_le64 Unexecuted instantiation: sm3.c:buf_put_le64 Unexecuted instantiation: stribog.c:buf_put_le64 Line | Count | Source | 178 | 24.3k | { | 179 | 24.3k | bufhelp_u64_t *out = _buf; | 180 | 24.3k | out->a = le_bswap64(val); | 181 | 24.3k | } |
Unexecuted instantiation: whirlpool.c:buf_put_le64 Line | Count | Source | 178 | 21.0M | { | 179 | 21.0M | bufhelp_u64_t *out = _buf; | 180 | 21.0M | out->a = le_bswap64(val); | 181 | 21.0M | } |
Unexecuted instantiation: cipher.c:buf_put_le64 Unexecuted instantiation: crc.c:buf_put_le64 Unexecuted instantiation: des.c:buf_put_le64 Unexecuted instantiation: gost28147.c:buf_put_le64 Unexecuted instantiation: gostr3411-94.c:buf_put_le64 Unexecuted instantiation: hash-common.c:buf_put_le64 Unexecuted instantiation: idea.c:buf_put_le64 Unexecuted instantiation: kdf.c:buf_put_le64 Line | Count | Source | 178 | 143k | { | 179 | 143k | bufhelp_u64_t *out = _buf; | 180 | 143k | out->a = le_bswap64(val); | 181 | 143k | } |
Unexecuted instantiation: mac-hmac.c:buf_put_le64 Unexecuted instantiation: mac-poly1305.c:buf_put_le64 Unexecuted instantiation: poly1305.c:buf_put_le64 Unexecuted instantiation: random-drbg.c:buf_put_le64 Unexecuted instantiation: rfc2268.c:buf_put_le64 Unexecuted instantiation: rijndael.c:buf_put_le64 Unexecuted instantiation: salsa20.c:buf_put_le64 Line | Count | Source | 178 | 570k | { | 179 | 570k | bufhelp_u64_t *out = _buf; | 180 | 570k | out->a = le_bswap64(val); | 181 | 570k | } |
Unexecuted instantiation: seed.c:buf_put_le64 Unexecuted instantiation: serpent.c:buf_put_le64 Unexecuted instantiation: sm4.c:buf_put_le64 Unexecuted instantiation: twofish.c:buf_put_le64 Unexecuted instantiation: arcfour.c:buf_put_le64 Line | Count | Source | 178 | 12.7k | { | 179 | 12.7k | bufhelp_u64_t *out = _buf; | 180 | 12.7k | out->a = le_bswap64(val); | 181 | 12.7k | } |
Unexecuted instantiation: blowfish.c:buf_put_le64 camellia-glue.c:buf_put_le64 Line | Count | Source | 178 | 52 | { | 179 | 52 | bufhelp_u64_t *out = _buf; | 180 | 52 | out->a = le_bswap64(val); | 181 | 52 | } |
Unexecuted instantiation: camellia.c:buf_put_le64 Line | Count | Source | 178 | 342 | { | 179 | 342 | bufhelp_u64_t *out = _buf; | 180 | 342 | out->a = le_bswap64(val); | 181 | 342 | } |
Unexecuted instantiation: chacha20.c:buf_put_le64 Unexecuted instantiation: cipher-aeswrap.c:buf_put_le64 cipher-cbc.c:buf_put_le64 Line | Count | Source | 178 | 83 | { | 179 | 83 | bufhelp_u64_t *out = _buf; | 180 | 83 | out->a = le_bswap64(val); | 181 | 83 | } |
Unexecuted instantiation: cipher-ccm.c:buf_put_le64 cipher-cfb.c:buf_put_le64 Line | Count | Source | 178 | 843 | { | 179 | 843 | bufhelp_u64_t *out = _buf; | 180 | 843 | out->a = le_bswap64(val); | 181 | 843 | } |
cipher-cmac.c:buf_put_le64 Line | Count | Source | 178 | 71.8k | { | 179 | 71.8k | bufhelp_u64_t *out = _buf; | 180 | 71.8k | out->a = le_bswap64(val); | 181 | 71.8k | } |
cipher-ctr.c:buf_put_le64 Line | Count | Source | 178 | 56 | { | 179 | 56 | bufhelp_u64_t *out = _buf; | 180 | 56 | out->a = le_bswap64(val); | 181 | 56 | } |
Unexecuted instantiation: cipher-eax.c:buf_put_le64 Unexecuted instantiation: cipher-gcm-siv.c:buf_put_le64 Unexecuted instantiation: cipher-gcm.c:buf_put_le64 Unexecuted instantiation: cipher-ocb.c:buf_put_le64 cipher-ofb.c:buf_put_le64 Line | Count | Source | 178 | 233 | { | 179 | 233 | bufhelp_u64_t *out = _buf; | 180 | 233 | out->a = le_bswap64(val); | 181 | 233 | } |
Unexecuted instantiation: cipher-poly1305.c:buf_put_le64 Unexecuted instantiation: cipher-siv.c:buf_put_le64 Unexecuted instantiation: cipher-xts.c:buf_put_le64 Unexecuted instantiation: ec-nist.c:buf_put_le64 Unexecuted instantiation: rijndael-padlock.c:buf_put_le64 Unexecuted instantiation: rijndael-vaes.c:buf_put_le64 |
182 | | |
183 | | #endif /*BUFHELP_UNALIGNED_ACCESS*/ |
184 | | |
185 | | |
186 | | /* Host-endian get/put macros */ |
187 | | #ifdef WORDS_BIGENDIAN |
188 | | # define buf_get_he32 buf_get_be32 |
189 | | # define buf_put_he32 buf_put_be32 |
190 | | # define buf_get_he64 buf_get_be64 |
191 | | # define buf_put_he64 buf_put_be64 |
192 | | #else |
193 | 716 | # define buf_get_he32 buf_get_le32 |
194 | 534 | # define buf_put_he32 buf_put_le32 |
195 | 1.31M | # define buf_get_he64 buf_get_le64 |
196 | 656k | # define buf_put_he64 buf_put_le64 |
197 | | #endif |
198 | | |
199 | | |
200 | | |
201 | | /* Optimized function for small buffer copying */ |
202 | | static inline void |
203 | | buf_cpy(void *_dst, const void *_src, size_t len) |
204 | 3.14M | { |
205 | 3.14M | byte *dst = _dst; |
206 | 3.14M | const byte *src = _src; |
207 | | |
208 | 3.14M | #if __GNUC__ >= 4 |
209 | 3.14M | if (!__builtin_constant_p (len)) |
210 | 3.14M | { |
211 | 3.14M | if (UNLIKELY(len == 0)) |
212 | 72 | return; |
213 | 3.14M | memcpy(_dst, _src, len); |
214 | 3.14M | return; |
215 | 3.14M | } |
216 | 0 | #endif |
217 | | |
218 | 0 | while (len >= sizeof(u64)) |
219 | 0 | { |
220 | 0 | buf_put_he64(dst, buf_get_he64(src)); |
221 | 0 | dst += sizeof(u64); |
222 | 0 | src += sizeof(u64); |
223 | 0 | len -= sizeof(u64); |
224 | 0 | } |
225 | |
|
226 | 0 | if (len >= sizeof(u32)) |
227 | 0 | { |
228 | 0 | buf_put_he32(dst, buf_get_he32(src)); |
229 | 0 | dst += sizeof(u32); |
230 | 0 | src += sizeof(u32); |
231 | 0 | len -= sizeof(u32); |
232 | 0 | } |
233 | | |
234 | | /* Handle tail. */ |
235 | 0 | for (; len; len--) |
236 | 0 | *dst++ = *src++; |
237 | 0 | } Unexecuted instantiation: md4.c:buf_cpy Unexecuted instantiation: md5.c:buf_cpy Unexecuted instantiation: mpicoder.c:buf_cpy Unexecuted instantiation: rmd160.c:buf_cpy Unexecuted instantiation: sha1.c:buf_cpy Unexecuted instantiation: sha256.c:buf_cpy Unexecuted instantiation: sha512.c:buf_cpy Unexecuted instantiation: sm3.c:buf_cpy Unexecuted instantiation: stribog.c:buf_cpy Unexecuted instantiation: tiger.c:buf_cpy Unexecuted instantiation: whirlpool.c:buf_cpy Line | Count | Source | 204 | 2.77M | { | 205 | 2.77M | byte *dst = _dst; | 206 | 2.77M | const byte *src = _src; | 207 | | | 208 | 2.77M | #if __GNUC__ >= 4 | 209 | 2.77M | if (!__builtin_constant_p (len)) | 210 | 2.77M | { | 211 | 2.77M | if (UNLIKELY(len == 0)) | 212 | 0 | return; | 213 | 2.77M | memcpy(_dst, _src, len); | 214 | 2.77M | return; | 215 | 2.77M | } | 216 | 0 | #endif | 217 | | | 218 | 0 | while (len >= sizeof(u64)) | 219 | 0 | { | 220 | 0 | buf_put_he64(dst, buf_get_he64(src)); | 221 | 0 | dst += sizeof(u64); | 222 | 0 | src += sizeof(u64); | 223 | 0 | len -= sizeof(u64); | 224 | 0 | } | 225 | |
| 226 | 0 | if (len >= sizeof(u32)) | 227 | 0 | { | 228 | 0 | buf_put_he32(dst, buf_get_he32(src)); | 229 | 0 | dst += sizeof(u32); | 230 | 0 | src += sizeof(u32); | 231 | 0 | len -= sizeof(u32); | 232 | 0 | } | 233 | | | 234 | | /* Handle tail. */ | 235 | 0 | for (; len; len--) | 236 | 0 | *dst++ = *src++; | 237 | 0 | } |
Unexecuted instantiation: cipher.c:buf_cpy Unexecuted instantiation: crc.c:buf_cpy Unexecuted instantiation: des.c:buf_cpy Unexecuted instantiation: gost28147.c:buf_cpy Unexecuted instantiation: gostr3411-94.c:buf_cpy Line | Count | Source | 204 | 300k | { | 205 | 300k | byte *dst = _dst; | 206 | 300k | const byte *src = _src; | 207 | | | 208 | 300k | #if __GNUC__ >= 4 | 209 | 300k | if (!__builtin_constant_p (len)) | 210 | 300k | { | 211 | 300k | if (UNLIKELY(len == 0)) | 212 | 0 | return; | 213 | 300k | memcpy(_dst, _src, len); | 214 | 300k | return; | 215 | 300k | } | 216 | 0 | #endif | 217 | | | 218 | 0 | while (len >= sizeof(u64)) | 219 | 0 | { | 220 | 0 | buf_put_he64(dst, buf_get_he64(src)); | 221 | 0 | dst += sizeof(u64); | 222 | 0 | src += sizeof(u64); | 223 | 0 | len -= sizeof(u64); | 224 | 0 | } | 225 | |
| 226 | 0 | if (len >= sizeof(u32)) | 227 | 0 | { | 228 | 0 | buf_put_he32(dst, buf_get_he32(src)); | 229 | 0 | dst += sizeof(u32); | 230 | 0 | src += sizeof(u32); | 231 | 0 | len -= sizeof(u32); | 232 | 0 | } | 233 | | | 234 | | /* Handle tail. */ | 235 | 0 | for (; len; len--) | 236 | 0 | *dst++ = *src++; | 237 | 0 | } |
Unexecuted instantiation: idea.c:buf_cpy Unexecuted instantiation: kdf.c:buf_cpy Unexecuted instantiation: keccak.c:buf_cpy Line | Count | Source | 204 | 59.5k | { | 205 | 59.5k | byte *dst = _dst; | 206 | 59.5k | const byte *src = _src; | 207 | | | 208 | 59.5k | #if __GNUC__ >= 4 | 209 | 59.5k | if (!__builtin_constant_p (len)) | 210 | 59.5k | { | 211 | 59.5k | if (UNLIKELY(len == 0)) | 212 | 0 | return; | 213 | 59.5k | memcpy(_dst, _src, len); | 214 | 59.5k | return; | 215 | 59.5k | } | 216 | 0 | #endif | 217 | | | 218 | 0 | while (len >= sizeof(u64)) | 219 | 0 | { | 220 | 0 | buf_put_he64(dst, buf_get_he64(src)); | 221 | 0 | dst += sizeof(u64); | 222 | 0 | src += sizeof(u64); | 223 | 0 | len -= sizeof(u64); | 224 | 0 | } | 225 | |
| 226 | 0 | if (len >= sizeof(u32)) | 227 | 0 | { | 228 | 0 | buf_put_he32(dst, buf_get_he32(src)); | 229 | 0 | dst += sizeof(u32); | 230 | 0 | src += sizeof(u32); | 231 | 0 | len -= sizeof(u32); | 232 | 0 | } | 233 | | | 234 | | /* Handle tail. */ | 235 | 0 | for (; len; len--) | 236 | 0 | *dst++ = *src++; | 237 | 0 | } |
Unexecuted instantiation: mac-poly1305.c:buf_cpy Unexecuted instantiation: poly1305.c:buf_cpy Unexecuted instantiation: random-drbg.c:buf_cpy Unexecuted instantiation: rfc2268.c:buf_cpy Unexecuted instantiation: rijndael.c:buf_cpy Unexecuted instantiation: salsa20.c:buf_cpy Unexecuted instantiation: scrypt.c:buf_cpy Unexecuted instantiation: seed.c:buf_cpy Unexecuted instantiation: serpent.c:buf_cpy Unexecuted instantiation: sm4.c:buf_cpy Unexecuted instantiation: twofish.c:buf_cpy Unexecuted instantiation: arcfour.c:buf_cpy Unexecuted instantiation: aria.c:buf_cpy Unexecuted instantiation: blowfish.c:buf_cpy Unexecuted instantiation: camellia-glue.c:buf_cpy Unexecuted instantiation: camellia.c:buf_cpy Unexecuted instantiation: cast5.c:buf_cpy Unexecuted instantiation: chacha20.c:buf_cpy Unexecuted instantiation: cipher-aeswrap.c:buf_cpy Unexecuted instantiation: cipher-cbc.c:buf_cpy Unexecuted instantiation: cipher-ccm.c:buf_cpy Unexecuted instantiation: cipher-cfb.c:buf_cpy Line | Count | Source | 204 | 1.41k | { | 205 | 1.41k | byte *dst = _dst; | 206 | 1.41k | const byte *src = _src; | 207 | | | 208 | 1.41k | #if __GNUC__ >= 4 | 209 | 1.41k | if (!__builtin_constant_p (len)) | 210 | 1.41k | { | 211 | 1.41k | if (UNLIKELY(len == 0)) | 212 | 72 | return; | 213 | 1.34k | memcpy(_dst, _src, len); | 214 | 1.34k | return; | 215 | 1.41k | } | 216 | 0 | #endif | 217 | | | 218 | 0 | while (len >= sizeof(u64)) | 219 | 0 | { | 220 | 0 | buf_put_he64(dst, buf_get_he64(src)); | 221 | 0 | dst += sizeof(u64); | 222 | 0 | src += sizeof(u64); | 223 | 0 | len -= sizeof(u64); | 224 | 0 | } | 225 | |
| 226 | 0 | if (len >= sizeof(u32)) | 227 | 0 | { | 228 | 0 | buf_put_he32(dst, buf_get_he32(src)); | 229 | 0 | dst += sizeof(u32); | 230 | 0 | src += sizeof(u32); | 231 | 0 | len -= sizeof(u32); | 232 | 0 | } | 233 | | | 234 | | /* Handle tail. */ | 235 | 0 | for (; len; len--) | 236 | 0 | *dst++ = *src++; | 237 | 0 | } |
Line | Count | Source | 204 | 58 | { | 205 | 58 | byte *dst = _dst; | 206 | 58 | const byte *src = _src; | 207 | | | 208 | 58 | #if __GNUC__ >= 4 | 209 | 58 | if (!__builtin_constant_p (len)) | 210 | 58 | { | 211 | 58 | if (UNLIKELY(len == 0)) | 212 | 0 | return; | 213 | 58 | memcpy(_dst, _src, len); | 214 | 58 | return; | 215 | 58 | } | 216 | 0 | #endif | 217 | | | 218 | 0 | while (len >= sizeof(u64)) | 219 | 0 | { | 220 | 0 | buf_put_he64(dst, buf_get_he64(src)); | 221 | 0 | dst += sizeof(u64); | 222 | 0 | src += sizeof(u64); | 223 | 0 | len -= sizeof(u64); | 224 | 0 | } | 225 | |
| 226 | 0 | if (len >= sizeof(u32)) | 227 | 0 | { | 228 | 0 | buf_put_he32(dst, buf_get_he32(src)); | 229 | 0 | dst += sizeof(u32); | 230 | 0 | src += sizeof(u32); | 231 | 0 | len -= sizeof(u32); | 232 | 0 | } | 233 | | | 234 | | /* Handle tail. */ | 235 | 0 | for (; len; len--) | 236 | 0 | *dst++ = *src++; | 237 | 0 | } |
Unexecuted instantiation: cipher-eax.c:buf_cpy Unexecuted instantiation: cipher-gcm-siv.c:buf_cpy Line | Count | Source | 204 | 52 | { | 205 | 52 | byte *dst = _dst; | 206 | 52 | const byte *src = _src; | 207 | | | 208 | 52 | #if __GNUC__ >= 4 | 209 | 52 | if (!__builtin_constant_p (len)) | 210 | 52 | { | 211 | 52 | if (UNLIKELY(len == 0)) | 212 | 0 | return; | 213 | 52 | memcpy(_dst, _src, len); | 214 | 52 | return; | 215 | 52 | } | 216 | 0 | #endif | 217 | | | 218 | 0 | while (len >= sizeof(u64)) | 219 | 0 | { | 220 | 0 | buf_put_he64(dst, buf_get_he64(src)); | 221 | 0 | dst += sizeof(u64); | 222 | 0 | src += sizeof(u64); | 223 | 0 | len -= sizeof(u64); | 224 | 0 | } | 225 | |
| 226 | 0 | if (len >= sizeof(u32)) | 227 | 0 | { | 228 | 0 | buf_put_he32(dst, buf_get_he32(src)); | 229 | 0 | dst += sizeof(u32); | 230 | 0 | src += sizeof(u32); | 231 | 0 | len -= sizeof(u32); | 232 | 0 | } | 233 | | | 234 | | /* Handle tail. */ | 235 | 0 | for (; len; len--) | 236 | 0 | *dst++ = *src++; | 237 | 0 | } |
Unexecuted instantiation: cipher-ocb.c:buf_cpy Unexecuted instantiation: cipher-ofb.c:buf_cpy Unexecuted instantiation: cipher-poly1305.c:buf_cpy Unexecuted instantiation: cipher-siv.c:buf_cpy Unexecuted instantiation: cipher-xts.c:buf_cpy Unexecuted instantiation: ec-nist.c:buf_cpy Unexecuted instantiation: rijndael-padlock.c:buf_cpy Unexecuted instantiation: rijndael-vaes.c:buf_cpy |
238 | | |
239 | | |
240 | | /* Optimized function for buffer xoring */ |
241 | | static inline void |
242 | | buf_xor(void *_dst, const void *_src1, const void *_src2, size_t len) |
243 | 49.1k | { |
244 | 49.1k | byte *dst = _dst; |
245 | 49.1k | const byte *src1 = _src1; |
246 | 49.1k | const byte *src2 = _src2; |
247 | | |
248 | 619k | while (len >= sizeof(u64)) |
249 | 570k | { |
250 | 570k | buf_put_he64(dst, buf_get_he64(src1) ^ buf_get_he64(src2)); |
251 | 570k | dst += sizeof(u64); |
252 | 570k | src1 += sizeof(u64); |
253 | 570k | src2 += sizeof(u64); |
254 | 570k | len -= sizeof(u64); |
255 | 570k | } |
256 | | |
257 | 49.1k | if (len > sizeof(u32)) |
258 | 46 | { |
259 | 46 | buf_put_he32(dst, buf_get_he32(src1) ^ buf_get_he32(src2)); |
260 | 46 | dst += sizeof(u32); |
261 | 46 | src1 += sizeof(u32); |
262 | 46 | src2 += sizeof(u32); |
263 | 46 | len -= sizeof(u32); |
264 | 46 | } |
265 | | |
266 | | /* Handle tail. */ |
267 | 49.2k | for (; len; len--) |
268 | 162 | *dst++ = *src1++ ^ *src2++; |
269 | 49.1k | } Unexecuted instantiation: md4.c:buf_xor Unexecuted instantiation: md5.c:buf_xor Unexecuted instantiation: mpicoder.c:buf_xor Unexecuted instantiation: rmd160.c:buf_xor Unexecuted instantiation: sha1.c:buf_xor Unexecuted instantiation: sha256.c:buf_xor Unexecuted instantiation: sha512.c:buf_xor Unexecuted instantiation: sm3.c:buf_xor Unexecuted instantiation: stribog.c:buf_xor Unexecuted instantiation: tiger.c:buf_xor Unexecuted instantiation: whirlpool.c:buf_xor Unexecuted instantiation: blake2.c:buf_xor Unexecuted instantiation: cipher.c:buf_xor Unexecuted instantiation: crc.c:buf_xor Unexecuted instantiation: des.c:buf_xor Unexecuted instantiation: gost28147.c:buf_xor Unexecuted instantiation: gostr3411-94.c:buf_xor Unexecuted instantiation: hash-common.c:buf_xor Unexecuted instantiation: idea.c:buf_xor Unexecuted instantiation: kdf.c:buf_xor Unexecuted instantiation: keccak.c:buf_xor Unexecuted instantiation: mac-hmac.c:buf_xor Unexecuted instantiation: mac-poly1305.c:buf_xor Unexecuted instantiation: poly1305.c:buf_xor Unexecuted instantiation: random-drbg.c:buf_xor Unexecuted instantiation: rfc2268.c:buf_xor Unexecuted instantiation: rijndael.c:buf_xor Unexecuted instantiation: salsa20.c:buf_xor Line | Count | Source | 243 | 49.0k | { | 244 | 49.0k | byte *dst = _dst; | 245 | 49.0k | const byte *src1 = _src1; | 246 | 49.0k | const byte *src2 = _src2; | 247 | | | 248 | 619k | while (len >= sizeof(u64)) | 249 | 570k | { | 250 | 570k | buf_put_he64(dst, buf_get_he64(src1) ^ buf_get_he64(src2)); | 251 | 570k | dst += sizeof(u64); | 252 | 570k | src1 += sizeof(u64); | 253 | 570k | src2 += sizeof(u64); | 254 | 570k | len -= sizeof(u64); | 255 | 570k | } | 256 | | | 257 | 49.0k | if (len > sizeof(u32)) | 258 | 0 | { | 259 | 0 | buf_put_he32(dst, buf_get_he32(src1) ^ buf_get_he32(src2)); | 260 | 0 | dst += sizeof(u32); | 261 | 0 | src1 += sizeof(u32); | 262 | 0 | src2 += sizeof(u32); | 263 | 0 | len -= sizeof(u32); | 264 | 0 | } | 265 | | | 266 | | /* Handle tail. */ | 267 | 49.0k | for (; len; len--) | 268 | 0 | *dst++ = *src1++ ^ *src2++; | 269 | 49.0k | } |
Unexecuted instantiation: seed.c:buf_xor Unexecuted instantiation: serpent.c:buf_xor Unexecuted instantiation: sm4.c:buf_xor Unexecuted instantiation: twofish.c:buf_xor Unexecuted instantiation: arcfour.c:buf_xor Unexecuted instantiation: aria.c:buf_xor Unexecuted instantiation: blowfish.c:buf_xor Unexecuted instantiation: camellia-glue.c:buf_xor Unexecuted instantiation: camellia.c:buf_xor Unexecuted instantiation: cast5.c:buf_xor Unexecuted instantiation: chacha20.c:buf_xor Unexecuted instantiation: cipher-aeswrap.c:buf_xor Unexecuted instantiation: cipher-cbc.c:buf_xor Unexecuted instantiation: cipher-ccm.c:buf_xor Unexecuted instantiation: cipher-cfb.c:buf_xor Unexecuted instantiation: cipher-cmac.c:buf_xor Line | Count | Source | 243 | 72 | { | 244 | 72 | byte *dst = _dst; | 245 | 72 | const byte *src1 = _src1; | 246 | 72 | const byte *src2 = _src2; | 247 | | | 248 | 128 | while (len >= sizeof(u64)) | 249 | 56 | { | 250 | 56 | buf_put_he64(dst, buf_get_he64(src1) ^ buf_get_he64(src2)); | 251 | 56 | dst += sizeof(u64); | 252 | 56 | src1 += sizeof(u64); | 253 | 56 | src2 += sizeof(u64); | 254 | 56 | len -= sizeof(u64); | 255 | 56 | } | 256 | | | 257 | 72 | if (len > sizeof(u32)) | 258 | 44 | { | 259 | 44 | buf_put_he32(dst, buf_get_he32(src1) ^ buf_get_he32(src2)); | 260 | 44 | dst += sizeof(u32); | 261 | 44 | src1 += sizeof(u32); | 262 | 44 | src2 += sizeof(u32); | 263 | 44 | len -= sizeof(u32); | 264 | 44 | } | 265 | | | 266 | | /* Handle tail. */ | 267 | 180 | for (; len; len--) | 268 | 108 | *dst++ = *src1++ ^ *src2++; | 269 | 72 | } |
Unexecuted instantiation: cipher-eax.c:buf_xor Unexecuted instantiation: cipher-gcm-siv.c:buf_xor Unexecuted instantiation: cipher-gcm.c:buf_xor Unexecuted instantiation: cipher-ocb.c:buf_xor Line | Count | Source | 243 | 15 | { | 244 | 15 | byte *dst = _dst; | 245 | 15 | const byte *src1 = _src1; | 246 | 15 | const byte *src2 = _src2; | 247 | | | 248 | 30 | while (len >= sizeof(u64)) | 249 | 15 | { | 250 | 15 | buf_put_he64(dst, buf_get_he64(src1) ^ buf_get_he64(src2)); | 251 | 15 | dst += sizeof(u64); | 252 | 15 | src1 += sizeof(u64); | 253 | 15 | src2 += sizeof(u64); | 254 | 15 | len -= sizeof(u64); | 255 | 15 | } | 256 | | | 257 | 15 | if (len > sizeof(u32)) | 258 | 2 | { | 259 | 2 | buf_put_he32(dst, buf_get_he32(src1) ^ buf_get_he32(src2)); | 260 | 2 | dst += sizeof(u32); | 261 | 2 | src1 += sizeof(u32); | 262 | 2 | src2 += sizeof(u32); | 263 | 2 | len -= sizeof(u32); | 264 | 2 | } | 265 | | | 266 | | /* Handle tail. */ | 267 | 69 | for (; len; len--) | 268 | 54 | *dst++ = *src1++ ^ *src2++; | 269 | 15 | } |
Unexecuted instantiation: cipher-poly1305.c:buf_xor Unexecuted instantiation: cipher-siv.c:buf_xor Unexecuted instantiation: cipher-xts.c:buf_xor Unexecuted instantiation: ec-nist.c:buf_xor Unexecuted instantiation: rijndael-padlock.c:buf_xor Unexecuted instantiation: rijndael-vaes.c:buf_xor |
270 | | |
271 | | |
272 | | /* Optimized function for buffer xoring with two destination buffers. Used |
273 | | mainly by CFB mode encryption. */ |
274 | | static inline void |
275 | | buf_xor_2dst(void *_dst1, void *_dst2, const void *_src, size_t len) |
276 | 276 | { |
277 | 276 | byte *dst1 = _dst1; |
278 | 276 | byte *dst2 = _dst2; |
279 | 276 | const byte *src = _src; |
280 | | |
281 | 384 | while (len >= sizeof(u64)) |
282 | 108 | { |
283 | 108 | u64 temp = buf_get_he64(dst2) ^ buf_get_he64(src); |
284 | 108 | buf_put_he64(dst2, temp); |
285 | 108 | buf_put_he64(dst1, temp); |
286 | 108 | dst2 += sizeof(u64); |
287 | 108 | dst1 += sizeof(u64); |
288 | 108 | src += sizeof(u64); |
289 | 108 | len -= sizeof(u64); |
290 | 108 | } |
291 | | |
292 | 276 | if (len >= sizeof(u32)) |
293 | 108 | { |
294 | 108 | u32 temp = buf_get_he32(dst2) ^ buf_get_he32(src); |
295 | 108 | buf_put_he32(dst2, temp); |
296 | 108 | buf_put_he32(dst1, temp); |
297 | 108 | dst2 += sizeof(u32); |
298 | 108 | dst1 += sizeof(u32); |
299 | 108 | src += sizeof(u32); |
300 | 108 | len -= sizeof(u32); |
301 | 108 | } |
302 | | |
303 | | /* Handle tail. */ |
304 | 544 | for (; len; len--) |
305 | 268 | *dst1++ = (*dst2++ ^= *src++); |
306 | 276 | } Unexecuted instantiation: md4.c:buf_xor_2dst Unexecuted instantiation: md5.c:buf_xor_2dst Unexecuted instantiation: mpicoder.c:buf_xor_2dst Unexecuted instantiation: rmd160.c:buf_xor_2dst Unexecuted instantiation: sha1.c:buf_xor_2dst Unexecuted instantiation: sha256.c:buf_xor_2dst Unexecuted instantiation: sha512.c:buf_xor_2dst Unexecuted instantiation: sm3.c:buf_xor_2dst Unexecuted instantiation: stribog.c:buf_xor_2dst Unexecuted instantiation: tiger.c:buf_xor_2dst Unexecuted instantiation: whirlpool.c:buf_xor_2dst Unexecuted instantiation: blake2.c:buf_xor_2dst Unexecuted instantiation: cipher.c:buf_xor_2dst Unexecuted instantiation: crc.c:buf_xor_2dst Unexecuted instantiation: des.c:buf_xor_2dst Unexecuted instantiation: gost28147.c:buf_xor_2dst Unexecuted instantiation: gostr3411-94.c:buf_xor_2dst Unexecuted instantiation: hash-common.c:buf_xor_2dst Unexecuted instantiation: idea.c:buf_xor_2dst Unexecuted instantiation: kdf.c:buf_xor_2dst Unexecuted instantiation: keccak.c:buf_xor_2dst Unexecuted instantiation: mac-hmac.c:buf_xor_2dst Unexecuted instantiation: mac-poly1305.c:buf_xor_2dst Unexecuted instantiation: poly1305.c:buf_xor_2dst Unexecuted instantiation: random-drbg.c:buf_xor_2dst Unexecuted instantiation: rfc2268.c:buf_xor_2dst Unexecuted instantiation: rijndael.c:buf_xor_2dst Unexecuted instantiation: salsa20.c:buf_xor_2dst Unexecuted instantiation: scrypt.c:buf_xor_2dst Unexecuted instantiation: seed.c:buf_xor_2dst Unexecuted instantiation: serpent.c:buf_xor_2dst Unexecuted instantiation: sm4.c:buf_xor_2dst Unexecuted instantiation: twofish.c:buf_xor_2dst Unexecuted instantiation: arcfour.c:buf_xor_2dst Unexecuted instantiation: aria.c:buf_xor_2dst Unexecuted instantiation: blowfish.c:buf_xor_2dst Unexecuted instantiation: camellia-glue.c:buf_xor_2dst Unexecuted instantiation: camellia.c:buf_xor_2dst Unexecuted instantiation: cast5.c:buf_xor_2dst Unexecuted instantiation: chacha20.c:buf_xor_2dst Unexecuted instantiation: cipher-aeswrap.c:buf_xor_2dst Unexecuted instantiation: cipher-cbc.c:buf_xor_2dst Unexecuted instantiation: cipher-ccm.c:buf_xor_2dst cipher-cfb.c:buf_xor_2dst Line | Count | Source | 276 | 276 | { | 277 | 276 | byte *dst1 = _dst1; | 278 | 276 | byte *dst2 = _dst2; | 279 | 276 | const byte *src = _src; | 280 | | | 281 | 384 | while (len >= sizeof(u64)) | 282 | 108 | { | 283 | 108 | u64 temp = buf_get_he64(dst2) ^ buf_get_he64(src); | 284 | 108 | buf_put_he64(dst2, temp); | 285 | 108 | buf_put_he64(dst1, temp); | 286 | 108 | dst2 += sizeof(u64); | 287 | 108 | dst1 += sizeof(u64); | 288 | 108 | src += sizeof(u64); | 289 | 108 | len -= sizeof(u64); | 290 | 108 | } | 291 | | | 292 | 276 | if (len >= sizeof(u32)) | 293 | 108 | { | 294 | 108 | u32 temp = buf_get_he32(dst2) ^ buf_get_he32(src); | 295 | 108 | buf_put_he32(dst2, temp); | 296 | 108 | buf_put_he32(dst1, temp); | 297 | 108 | dst2 += sizeof(u32); | 298 | 108 | dst1 += sizeof(u32); | 299 | 108 | src += sizeof(u32); | 300 | 108 | len -= sizeof(u32); | 301 | 108 | } | 302 | | | 303 | | /* Handle tail. */ | 304 | 544 | for (; len; len--) | 305 | 268 | *dst1++ = (*dst2++ ^= *src++); | 306 | 276 | } |
Unexecuted instantiation: cipher-cmac.c:buf_xor_2dst Unexecuted instantiation: cipher-ctr.c:buf_xor_2dst Unexecuted instantiation: cipher-eax.c:buf_xor_2dst Unexecuted instantiation: cipher-gcm-siv.c:buf_xor_2dst Unexecuted instantiation: cipher-gcm.c:buf_xor_2dst Unexecuted instantiation: cipher-ocb.c:buf_xor_2dst Unexecuted instantiation: cipher-ofb.c:buf_xor_2dst Unexecuted instantiation: cipher-poly1305.c:buf_xor_2dst Unexecuted instantiation: cipher-siv.c:buf_xor_2dst Unexecuted instantiation: cipher-xts.c:buf_xor_2dst Unexecuted instantiation: ec-nist.c:buf_xor_2dst Unexecuted instantiation: rijndael-padlock.c:buf_xor_2dst Unexecuted instantiation: rijndael-vaes.c:buf_xor_2dst |
307 | | |
308 | | |
309 | | /* Optimized function for combined buffer xoring and copying. Used by mainly |
310 | | CBC mode decryption. */ |
311 | | static inline void |
312 | | buf_xor_n_copy_2(void *_dst_xor, const void *_src_xor, void *_srcdst_cpy, |
313 | | const void *_src_cpy, size_t len) |
314 | 472 | { |
315 | 472 | byte *dst_xor = _dst_xor; |
316 | 472 | byte *srcdst_cpy = _srcdst_cpy; |
317 | 472 | const byte *src_xor = _src_xor; |
318 | 472 | const byte *src_cpy = _src_cpy; |
319 | | |
320 | 513 | while (len >= sizeof(u64)) |
321 | 41 | { |
322 | 41 | u64 temp = buf_get_he64(src_cpy); |
323 | 41 | buf_put_he64(dst_xor, buf_get_he64(srcdst_cpy) ^ buf_get_he64(src_xor)); |
324 | 41 | buf_put_he64(srcdst_cpy, temp); |
325 | 41 | dst_xor += sizeof(u64); |
326 | 41 | srcdst_cpy += sizeof(u64); |
327 | 41 | src_xor += sizeof(u64); |
328 | 41 | src_cpy += sizeof(u64); |
329 | 41 | len -= sizeof(u64); |
330 | 41 | } |
331 | | |
332 | 472 | if (len >= sizeof(u32)) |
333 | 136 | { |
334 | 136 | u32 temp = buf_get_he32(src_cpy); |
335 | 136 | buf_put_he32(dst_xor, buf_get_he32(srcdst_cpy) ^ buf_get_he32(src_xor)); |
336 | 136 | buf_put_he32(srcdst_cpy, temp); |
337 | 136 | dst_xor += sizeof(u32); |
338 | 136 | srcdst_cpy += sizeof(u32); |
339 | 136 | src_xor += sizeof(u32); |
340 | 136 | src_cpy += sizeof(u32); |
341 | 136 | len -= sizeof(u32); |
342 | 136 | } |
343 | | |
344 | | /* Handle tail. */ |
345 | 1.09k | for (; len; len--) |
346 | 621 | { |
347 | 621 | byte temp = *src_cpy++; |
348 | 621 | *dst_xor++ = *srcdst_cpy ^ *src_xor++; |
349 | 621 | *srcdst_cpy++ = temp; |
350 | 621 | } |
351 | 472 | } Unexecuted instantiation: md4.c:buf_xor_n_copy_2 Unexecuted instantiation: md5.c:buf_xor_n_copy_2 Unexecuted instantiation: mpicoder.c:buf_xor_n_copy_2 Unexecuted instantiation: rmd160.c:buf_xor_n_copy_2 Unexecuted instantiation: sha1.c:buf_xor_n_copy_2 Unexecuted instantiation: sha256.c:buf_xor_n_copy_2 Unexecuted instantiation: sha512.c:buf_xor_n_copy_2 Unexecuted instantiation: sm3.c:buf_xor_n_copy_2 Unexecuted instantiation: stribog.c:buf_xor_n_copy_2 Unexecuted instantiation: tiger.c:buf_xor_n_copy_2 Unexecuted instantiation: whirlpool.c:buf_xor_n_copy_2 Unexecuted instantiation: blake2.c:buf_xor_n_copy_2 Unexecuted instantiation: cipher.c:buf_xor_n_copy_2 Unexecuted instantiation: crc.c:buf_xor_n_copy_2 Unexecuted instantiation: des.c:buf_xor_n_copy_2 Unexecuted instantiation: gost28147.c:buf_xor_n_copy_2 Unexecuted instantiation: gostr3411-94.c:buf_xor_n_copy_2 Unexecuted instantiation: hash-common.c:buf_xor_n_copy_2 Unexecuted instantiation: idea.c:buf_xor_n_copy_2 Unexecuted instantiation: kdf.c:buf_xor_n_copy_2 Unexecuted instantiation: keccak.c:buf_xor_n_copy_2 Unexecuted instantiation: mac-hmac.c:buf_xor_n_copy_2 Unexecuted instantiation: mac-poly1305.c:buf_xor_n_copy_2 Unexecuted instantiation: poly1305.c:buf_xor_n_copy_2 Unexecuted instantiation: random-drbg.c:buf_xor_n_copy_2 Unexecuted instantiation: rfc2268.c:buf_xor_n_copy_2 Unexecuted instantiation: rijndael.c:buf_xor_n_copy_2 Unexecuted instantiation: salsa20.c:buf_xor_n_copy_2 Unexecuted instantiation: scrypt.c:buf_xor_n_copy_2 Unexecuted instantiation: seed.c:buf_xor_n_copy_2 Unexecuted instantiation: serpent.c:buf_xor_n_copy_2 Unexecuted instantiation: sm4.c:buf_xor_n_copy_2 Unexecuted instantiation: twofish.c:buf_xor_n_copy_2 Unexecuted instantiation: arcfour.c:buf_xor_n_copy_2 Unexecuted instantiation: aria.c:buf_xor_n_copy_2 Unexecuted instantiation: blowfish.c:buf_xor_n_copy_2 Unexecuted instantiation: camellia-glue.c:buf_xor_n_copy_2 Unexecuted instantiation: camellia.c:buf_xor_n_copy_2 Unexecuted instantiation: cast5.c:buf_xor_n_copy_2 Unexecuted instantiation: chacha20.c:buf_xor_n_copy_2 Unexecuted instantiation: cipher-aeswrap.c:buf_xor_n_copy_2 Unexecuted instantiation: cipher-cbc.c:buf_xor_n_copy_2 Unexecuted instantiation: cipher-ccm.c:buf_xor_n_copy_2 cipher-cfb.c:buf_xor_n_copy_2 Line | Count | Source | 314 | 472 | { | 315 | 472 | byte *dst_xor = _dst_xor; | 316 | 472 | byte *srcdst_cpy = _srcdst_cpy; | 317 | 472 | const byte *src_xor = _src_xor; | 318 | 472 | const byte *src_cpy = _src_cpy; | 319 | | | 320 | 513 | while (len >= sizeof(u64)) | 321 | 41 | { | 322 | 41 | u64 temp = buf_get_he64(src_cpy); | 323 | 41 | buf_put_he64(dst_xor, buf_get_he64(srcdst_cpy) ^ buf_get_he64(src_xor)); | 324 | 41 | buf_put_he64(srcdst_cpy, temp); | 325 | 41 | dst_xor += sizeof(u64); | 326 | 41 | srcdst_cpy += sizeof(u64); | 327 | 41 | src_xor += sizeof(u64); | 328 | 41 | src_cpy += sizeof(u64); | 329 | 41 | len -= sizeof(u64); | 330 | 41 | } | 331 | | | 332 | 472 | if (len >= sizeof(u32)) | 333 | 136 | { | 334 | 136 | u32 temp = buf_get_he32(src_cpy); | 335 | 136 | buf_put_he32(dst_xor, buf_get_he32(srcdst_cpy) ^ buf_get_he32(src_xor)); | 336 | 136 | buf_put_he32(srcdst_cpy, temp); | 337 | 136 | dst_xor += sizeof(u32); | 338 | 136 | srcdst_cpy += sizeof(u32); | 339 | 136 | src_xor += sizeof(u32); | 340 | 136 | src_cpy += sizeof(u32); | 341 | 136 | len -= sizeof(u32); | 342 | 136 | } | 343 | | | 344 | | /* Handle tail. */ | 345 | 1.09k | for (; len; len--) | 346 | 621 | { | 347 | 621 | byte temp = *src_cpy++; | 348 | 621 | *dst_xor++ = *srcdst_cpy ^ *src_xor++; | 349 | 621 | *srcdst_cpy++ = temp; | 350 | 621 | } | 351 | 472 | } |
Unexecuted instantiation: cipher-cmac.c:buf_xor_n_copy_2 Unexecuted instantiation: cipher-ctr.c:buf_xor_n_copy_2 Unexecuted instantiation: cipher-eax.c:buf_xor_n_copy_2 Unexecuted instantiation: cipher-gcm-siv.c:buf_xor_n_copy_2 Unexecuted instantiation: cipher-gcm.c:buf_xor_n_copy_2 Unexecuted instantiation: cipher-ocb.c:buf_xor_n_copy_2 Unexecuted instantiation: cipher-ofb.c:buf_xor_n_copy_2 Unexecuted instantiation: cipher-poly1305.c:buf_xor_n_copy_2 Unexecuted instantiation: cipher-siv.c:buf_xor_n_copy_2 Unexecuted instantiation: cipher-xts.c:buf_xor_n_copy_2 Unexecuted instantiation: ec-nist.c:buf_xor_n_copy_2 Unexecuted instantiation: rijndael-padlock.c:buf_xor_n_copy_2 Unexecuted instantiation: rijndael-vaes.c:buf_xor_n_copy_2 |
352 | | |
353 | | |
354 | | /* Optimized function for combined buffer xoring and copying. Used by mainly |
355 | | CFB mode decryption. */ |
356 | | static inline void |
357 | | buf_xor_n_copy(void *_dst_xor, void *_srcdst_cpy, const void *_src, size_t len) |
358 | 472 | { |
359 | 472 | buf_xor_n_copy_2(_dst_xor, _src, _srcdst_cpy, _src, len); |
360 | 472 | } Unexecuted instantiation: md4.c:buf_xor_n_copy Unexecuted instantiation: md5.c:buf_xor_n_copy Unexecuted instantiation: mpicoder.c:buf_xor_n_copy Unexecuted instantiation: rmd160.c:buf_xor_n_copy Unexecuted instantiation: sha1.c:buf_xor_n_copy Unexecuted instantiation: sha256.c:buf_xor_n_copy Unexecuted instantiation: sha512.c:buf_xor_n_copy Unexecuted instantiation: sm3.c:buf_xor_n_copy Unexecuted instantiation: stribog.c:buf_xor_n_copy Unexecuted instantiation: tiger.c:buf_xor_n_copy Unexecuted instantiation: whirlpool.c:buf_xor_n_copy Unexecuted instantiation: blake2.c:buf_xor_n_copy Unexecuted instantiation: cipher.c:buf_xor_n_copy Unexecuted instantiation: crc.c:buf_xor_n_copy Unexecuted instantiation: des.c:buf_xor_n_copy Unexecuted instantiation: gost28147.c:buf_xor_n_copy Unexecuted instantiation: gostr3411-94.c:buf_xor_n_copy Unexecuted instantiation: hash-common.c:buf_xor_n_copy Unexecuted instantiation: idea.c:buf_xor_n_copy Unexecuted instantiation: kdf.c:buf_xor_n_copy Unexecuted instantiation: keccak.c:buf_xor_n_copy Unexecuted instantiation: mac-hmac.c:buf_xor_n_copy Unexecuted instantiation: mac-poly1305.c:buf_xor_n_copy Unexecuted instantiation: poly1305.c:buf_xor_n_copy Unexecuted instantiation: random-drbg.c:buf_xor_n_copy Unexecuted instantiation: rfc2268.c:buf_xor_n_copy Unexecuted instantiation: rijndael.c:buf_xor_n_copy Unexecuted instantiation: salsa20.c:buf_xor_n_copy Unexecuted instantiation: scrypt.c:buf_xor_n_copy Unexecuted instantiation: seed.c:buf_xor_n_copy Unexecuted instantiation: serpent.c:buf_xor_n_copy Unexecuted instantiation: sm4.c:buf_xor_n_copy Unexecuted instantiation: twofish.c:buf_xor_n_copy Unexecuted instantiation: arcfour.c:buf_xor_n_copy Unexecuted instantiation: aria.c:buf_xor_n_copy Unexecuted instantiation: blowfish.c:buf_xor_n_copy Unexecuted instantiation: camellia-glue.c:buf_xor_n_copy Unexecuted instantiation: camellia.c:buf_xor_n_copy Unexecuted instantiation: cast5.c:buf_xor_n_copy Unexecuted instantiation: chacha20.c:buf_xor_n_copy Unexecuted instantiation: cipher-aeswrap.c:buf_xor_n_copy Unexecuted instantiation: cipher-cbc.c:buf_xor_n_copy Unexecuted instantiation: cipher-ccm.c:buf_xor_n_copy cipher-cfb.c:buf_xor_n_copy Line | Count | Source | 358 | 472 | { | 359 | 472 | buf_xor_n_copy_2(_dst_xor, _src, _srcdst_cpy, _src, len); | 360 | 472 | } |
Unexecuted instantiation: cipher-cmac.c:buf_xor_n_copy Unexecuted instantiation: cipher-ctr.c:buf_xor_n_copy Unexecuted instantiation: cipher-eax.c:buf_xor_n_copy Unexecuted instantiation: cipher-gcm-siv.c:buf_xor_n_copy Unexecuted instantiation: cipher-gcm.c:buf_xor_n_copy Unexecuted instantiation: cipher-ocb.c:buf_xor_n_copy Unexecuted instantiation: cipher-ofb.c:buf_xor_n_copy Unexecuted instantiation: cipher-poly1305.c:buf_xor_n_copy Unexecuted instantiation: cipher-siv.c:buf_xor_n_copy Unexecuted instantiation: cipher-xts.c:buf_xor_n_copy Unexecuted instantiation: ec-nist.c:buf_xor_n_copy Unexecuted instantiation: rijndael-padlock.c:buf_xor_n_copy Unexecuted instantiation: rijndael-vaes.c:buf_xor_n_copy |
361 | | |
362 | | |
363 | | /* Constant-time compare of two buffers. Returns 1 if buffers are equal, |
364 | | and 0 if buffers differ. */ |
365 | | static inline int |
366 | | buf_eq_const(const void *a, const void *b, size_t len) |
367 | 0 | { |
368 | 0 | return ct_memequal (a, b, len); |
369 | 0 | } Unexecuted instantiation: md4.c:buf_eq_const Unexecuted instantiation: md5.c:buf_eq_const Unexecuted instantiation: mpicoder.c:buf_eq_const Unexecuted instantiation: rmd160.c:buf_eq_const Unexecuted instantiation: sha1.c:buf_eq_const Unexecuted instantiation: sha256.c:buf_eq_const Unexecuted instantiation: sha512.c:buf_eq_const Unexecuted instantiation: sm3.c:buf_eq_const Unexecuted instantiation: stribog.c:buf_eq_const Unexecuted instantiation: tiger.c:buf_eq_const Unexecuted instantiation: whirlpool.c:buf_eq_const Unexecuted instantiation: blake2.c:buf_eq_const Unexecuted instantiation: cipher.c:buf_eq_const Unexecuted instantiation: crc.c:buf_eq_const Unexecuted instantiation: des.c:buf_eq_const Unexecuted instantiation: gost28147.c:buf_eq_const Unexecuted instantiation: gostr3411-94.c:buf_eq_const Unexecuted instantiation: hash-common.c:buf_eq_const Unexecuted instantiation: idea.c:buf_eq_const Unexecuted instantiation: kdf.c:buf_eq_const Unexecuted instantiation: keccak.c:buf_eq_const Unexecuted instantiation: mac-hmac.c:buf_eq_const Unexecuted instantiation: mac-poly1305.c:buf_eq_const Unexecuted instantiation: poly1305.c:buf_eq_const Unexecuted instantiation: random-drbg.c:buf_eq_const Unexecuted instantiation: rfc2268.c:buf_eq_const Unexecuted instantiation: rijndael.c:buf_eq_const Unexecuted instantiation: salsa20.c:buf_eq_const Unexecuted instantiation: scrypt.c:buf_eq_const Unexecuted instantiation: seed.c:buf_eq_const Unexecuted instantiation: serpent.c:buf_eq_const Unexecuted instantiation: sm4.c:buf_eq_const Unexecuted instantiation: twofish.c:buf_eq_const Unexecuted instantiation: arcfour.c:buf_eq_const Unexecuted instantiation: aria.c:buf_eq_const Unexecuted instantiation: blowfish.c:buf_eq_const Unexecuted instantiation: camellia-glue.c:buf_eq_const Unexecuted instantiation: camellia.c:buf_eq_const Unexecuted instantiation: cast5.c:buf_eq_const Unexecuted instantiation: chacha20.c:buf_eq_const Unexecuted instantiation: cipher-aeswrap.c:buf_eq_const Unexecuted instantiation: cipher-cbc.c:buf_eq_const Unexecuted instantiation: cipher-ccm.c:buf_eq_const Unexecuted instantiation: cipher-cfb.c:buf_eq_const Unexecuted instantiation: cipher-cmac.c:buf_eq_const Unexecuted instantiation: cipher-ctr.c:buf_eq_const Unexecuted instantiation: cipher-eax.c:buf_eq_const Unexecuted instantiation: cipher-gcm-siv.c:buf_eq_const Unexecuted instantiation: cipher-gcm.c:buf_eq_const Unexecuted instantiation: cipher-ocb.c:buf_eq_const Unexecuted instantiation: cipher-ofb.c:buf_eq_const Unexecuted instantiation: cipher-poly1305.c:buf_eq_const Unexecuted instantiation: cipher-siv.c:buf_eq_const Unexecuted instantiation: cipher-xts.c:buf_eq_const Unexecuted instantiation: ec-nist.c:buf_eq_const Unexecuted instantiation: rijndael-padlock.c:buf_eq_const Unexecuted instantiation: rijndael-vaes.c:buf_eq_const |
370 | | |
371 | | |
372 | | #endif /*GCRYPT_BUFHELP_H*/ |