Debian Codegraph @

external/blake3/blake3_portable.c

raw symbols SCIP
1 #cxx . . $ `<file>/external/blake3/blake3_portable.c`/include "blake3_impl.h"cxx . . $ `<file>/external/blake3/blake3_impl.h`/
2 #include <string.h>
3
4 INLINEcxx . . $ `external/blake3/blake3_impl.h:32:9`! uint32_tcxx . . $ uint32_t# rotr32cxx . . $ rotr32(83f10ac8959d5577).(uint32_tcxx . . $ uint32_t# w, uint32_tcxx . . $ uint32_t# c) {
5 return (w >> c) | (w << (32 - c));
6 }
7
8 INLINEcxx . . $ `external/blake3/blake3_impl.h:32:9`! void gcxx . . $ g(91b051fbe1b42daf).(uint32_tcxx . . $ uint32_t# *state, size_t a, size_t b, size_t c, size_t d,
9 uint32_tcxx . . $ uint32_t# x, uint32_tcxx . . $ uint32_t# y) {
10 state[a] = state[a] + state[b] + x;
11 state[d] = rotr32cxx . . $ rotr32(83f10ac8959d5577).(state[d] ^ state[a], 16);
12 state[c] = state[c] + state[d];
13 state[b] = rotr32cxx . . $ rotr32(83f10ac8959d5577).(state[b] ^ state[c], 12);
14 state[a] = state[a] + state[b] + y;
15 state[d] = rotr32cxx . . $ rotr32(83f10ac8959d5577).(state[d] ^ state[a], 8);
16 state[c] = state[c] + state[d];
17 state[b] = rotr32cxx . . $ rotr32(83f10ac8959d5577).(state[b] ^ state[c], 7);
18 }
19
20 INLINEcxx . . $ `external/blake3/blake3_impl.h:32:9`! void round_fncxx . . $ round_fn(f4cfe29cf1609e36).(uint32_tcxx . . $ uint32_t# state[16], const uint32_tcxx . . $ uint32_t# *msg, size_t round) {
21 // Select the message schedule based on the round.
22 const uint8_tcxx . . $ uint8_t# *schedule = MSG_SCHEDULEcxx . . $ MSG_SCHEDULE.[round];
23
24 // Mix the columns.
25 gcxx . . $ g(91b051fbe1b42daf).(state, 0, 4, 8, 12, msg[schedule[0]], msg[schedule[1]]);
26 gcxx . . $ g(91b051fbe1b42daf).(state, 1, 5, 9, 13, msg[schedule[2]], msg[schedule[3]]);
27 gcxx . . $ g(91b051fbe1b42daf).(state, 2, 6, 10, 14, msg[schedule[4]], msg[schedule[5]]);
28 gcxx . . $ g(91b051fbe1b42daf).(state, 3, 7, 11, 15, msg[schedule[6]], msg[schedule[7]]);
29
30 // Mix the rows.
31 gcxx . . $ g(91b051fbe1b42daf).(state, 0, 5, 10, 15, msg[schedule[8]], msg[schedule[9]]);
32 gcxx . . $ g(91b051fbe1b42daf).(state, 1, 6, 11, 12, msg[schedule[10]], msg[schedule[11]]);
33 gcxx . . $ g(91b051fbe1b42daf).(state, 2, 7, 8, 13, msg[schedule[12]], msg[schedule[13]]);
34 gcxx . . $ g(91b051fbe1b42daf).(state, 3, 4, 9, 14, msg[schedule[14]], msg[schedule[15]]);
35 }
36
37 INLINEcxx . . $ `external/blake3/blake3_impl.h:32:9`! void compress_precxx . . $ compress_pre(115d4c0576d80858).(uint32_tcxx . . $ uint32_t# state[16], const uint32_tcxx . . $ uint32_t# cv[8],
38 const uint8_tcxx . . $ uint8_t# block[BLAKE3_BLOCK_LENcxx . . $ `external/blake3/blake3.h:44:9`!],
39 uint8_tcxx . . $ uint8_t# block_len, uint64_tcxx . . $ uint64_t# counter, uint8_tcxx . . $ uint8_t# flags) {
40 uint32_tcxx . . $ uint32_t# block_words[16];
41 block_words[0] = load32cxx . . $ load32(b11f534102b1ad6).(block + 4 * 0);
42 block_words[1] = load32cxx . . $ load32(b11f534102b1ad6).(block + 4 * 1);
43 block_words[2] = load32cxx . . $ load32(b11f534102b1ad6).(block + 4 * 2);
44 block_words[3] = load32cxx . . $ load32(b11f534102b1ad6).(block + 4 * 3);
45 block_words[4] = load32cxx . . $ load32(b11f534102b1ad6).(block + 4 * 4);
46 block_words[5] = load32cxx . . $ load32(b11f534102b1ad6).(block + 4 * 5);
47 block_words[6] = load32cxx . . $ load32(b11f534102b1ad6).(block + 4 * 6);
48 block_words[7] = load32cxx . . $ load32(b11f534102b1ad6).(block + 4 * 7);
49 block_words[8] = load32cxx . . $ load32(b11f534102b1ad6).(block + 4 * 8);
50 block_words[9] = load32cxx . . $ load32(b11f534102b1ad6).(block + 4 * 9);
51 block_words[10] = load32cxx . . $ load32(b11f534102b1ad6).(block + 4 * 10);
52 block_words[11] = load32cxx . . $ load32(b11f534102b1ad6).(block + 4 * 11);
53 block_words[12] = load32cxx . . $ load32(b11f534102b1ad6).(block + 4 * 12);
54 block_words[13] = load32cxx . . $ load32(b11f534102b1ad6).(block + 4 * 13);
55 block_words[14] = load32cxx . . $ load32(b11f534102b1ad6).(block + 4 * 14);
56 block_words[15] = load32cxx . . $ load32(b11f534102b1ad6).(block + 4 * 15);
57
58 state[0] = cv[0];
59 state[1] = cv[1];
60 state[2] = cv[2];
61 state[3] = cv[3];
62 state[4] = cv[4];
63 state[5] = cv[5];
64 state[6] = cv[6];
65 state[7] = cv[7];
66 state[8] = IVcxx . . $ IV.[0];
67 state[9] = IVcxx . . $ IV.[1];
68 state[10] = IVcxx . . $ IV.[2];
69 state[11] = IVcxx . . $ IV.[3];
70 state[12] = counter_lowcxx . . $ counter_low(ea88b852781e8a38).(counter);
71 state[13] = counter_highcxx . . $ counter_high(ea88b852781e8a38).(counter);
72 state[14] = (uint32_tcxx . . $ uint32_t#)block_len;
73 state[15] = (uint32_tcxx . . $ uint32_t#)flags;
74
75 round_fncxx . . $ round_fn(f4cfe29cf1609e36).(state, &block_words[0], 0);
76 round_fncxx . . $ round_fn(f4cfe29cf1609e36).(state, &block_words[0], 1);
77 round_fncxx . . $ round_fn(f4cfe29cf1609e36).(state, &block_words[0], 2);
78 round_fncxx . . $ round_fn(f4cfe29cf1609e36).(state, &block_words[0], 3);
79 round_fncxx . . $ round_fn(f4cfe29cf1609e36).(state, &block_words[0], 4);
80 round_fncxx . . $ round_fn(f4cfe29cf1609e36).(state, &block_words[0], 5);
81 round_fncxx . . $ round_fn(f4cfe29cf1609e36).(state, &block_words[0], 6);
82 }
83
84 void blake3_compress_in_place_portablecxx . . $ blake3_compress_in_place_portable(389a45aab4533bf).(uint32_tcxx . . $ uint32_t# cv[8],
85 const uint8_tcxx . . $ uint8_t# block[BLAKE3_BLOCK_LENcxx . . $ `external/blake3/blake3.h:44:9`!],
86 uint8_tcxx . . $ uint8_t# block_len, uint64_tcxx . . $ uint64_t# counter,
87 uint8_tcxx . . $ uint8_t# flags) {
88 uint32_tcxx . . $ uint32_t# state[16];
89 compress_precxx . . $ compress_pre(115d4c0576d80858).(state, cv, block, block_len, counter, flags);
90 cv[0] = state[0] ^ state[8];
91 cv[1] = state[1] ^ state[9];
92 cv[2] = state[2] ^ state[10];
93 cv[3] = state[3] ^ state[11];
94 cv[4] = state[4] ^ state[12];
95 cv[5] = state[5] ^ state[13];
96 cv[6] = state[6] ^ state[14];
97 cv[7] = state[7] ^ state[15];
98 }
99
100 void blake3_compress_xof_portablecxx . . $ blake3_compress_xof_portable(bd57d77544a3558d).(const uint32_tcxx . . $ uint32_t# cv[8],
101 const uint8_tcxx . . $ uint8_t# block[BLAKE3_BLOCK_LENcxx . . $ `external/blake3/blake3.h:44:9`!],
102 uint8_tcxx . . $ uint8_t# block_len, uint64_tcxx . . $ uint64_t# counter,
103 uint8_tcxx . . $ uint8_t# flags, uint8_tcxx . . $ uint8_t# out[64]) {
104 uint32_tcxx . . $ uint32_t# state[16];
105 compress_precxx . . $ compress_pre(115d4c0576d80858).(state, cv, block, block_len, counter, flags);
106
107 store32cxx . . $ store32(67abb4dd43ac34c5).(&out[0 * 4], state[0] ^ state[8]);
108 store32cxx . . $ store32(67abb4dd43ac34c5).(&out[1 * 4], state[1] ^ state[9]);
109 store32cxx . . $ store32(67abb4dd43ac34c5).(&out[2 * 4], state[2] ^ state[10]);
110 store32cxx . . $ store32(67abb4dd43ac34c5).(&out[3 * 4], state[3] ^ state[11]);
111 store32cxx . . $ store32(67abb4dd43ac34c5).(&out[4 * 4], state[4] ^ state[12]);
112 store32cxx . . $ store32(67abb4dd43ac34c5).(&out[5 * 4], state[5] ^ state[13]);
113 store32cxx . . $ store32(67abb4dd43ac34c5).(&out[6 * 4], state[6] ^ state[14]);
114 store32cxx . . $ store32(67abb4dd43ac34c5).(&out[7 * 4], state[7] ^ state[15]);
115 store32cxx . . $ store32(67abb4dd43ac34c5).(&out[8 * 4], state[8] ^ cv[0]);
116 store32cxx . . $ store32(67abb4dd43ac34c5).(&out[9 * 4], state[9] ^ cv[1]);
117 store32cxx . . $ store32(67abb4dd43ac34c5).(&out[10 * 4], state[10] ^ cv[2]);
118 store32cxx . . $ store32(67abb4dd43ac34c5).(&out[11 * 4], state[11] ^ cv[3]);
119 store32cxx . . $ store32(67abb4dd43ac34c5).(&out[12 * 4], state[12] ^ cv[4]);
120 store32cxx . . $ store32(67abb4dd43ac34c5).(&out[13 * 4], state[13] ^ cv[5]);
121 store32cxx . . $ store32(67abb4dd43ac34c5).(&out[14 * 4], state[14] ^ cv[6]);
122 store32cxx . . $ store32(67abb4dd43ac34c5).(&out[15 * 4], state[15] ^ cv[7]);
123 }
124
125 INLINEcxx . . $ `external/blake3/blake3_impl.h:32:9`! void hash_one_portablecxx . . $ hash_one_portable(a39325e3b1f31274).(const uint8_tcxx . . $ uint8_t# *input, size_t blocks,
126 const uint32_tcxx . . $ uint32_t# key[8], uint64_tcxx . . $ uint64_t# counter,
127 uint8_tcxx . . $ uint8_t# flags, uint8_tcxx . . $ uint8_t# flags_start,
128 uint8_tcxx . . $ uint8_t# flags_end, uint8_tcxx . . $ uint8_t# out[BLAKE3_OUT_LENcxx . . $ `external/blake3/blake3.h:43:9`!]) {
129 uint32_tcxx . . $ uint32_t# cv[8];
130 memcpycxx . . $ memcpy(cc817cb175f282d).(cv, key, BLAKE3_KEY_LENcxx . . $ `external/blake3/blake3.h:42:9`!);
131 uint8_tcxx . . $ uint8_t# block_flags = flags | flags_start;
132 while (blocks > 0) {
133 if (blocks == 1) {
134 block_flags |= flags_end;
135 }
136 blake3_compress_in_place_portablecxx . . $ blake3_compress_in_place_portable(389a45aab4533bf).(cv, input, BLAKE3_BLOCK_LENcxx . . $ `external/blake3/blake3.h:44:9`!, counter,
137 block_flags);
138 input = &input[BLAKE3_BLOCK_LENcxx . . $ `external/blake3/blake3.h:44:9`!];
139 blocks -= 1;
140 block_flags = flags;
141 }
142 store_cv_wordscxx . . $ store_cv_words(3dae8022d7d56a90).(out, cv);
143 }
144
145 void blake3_hash_many_portablecxx . . $ blake3_hash_many_portable(6d9d480067751c4).(const uint8_tcxx . . $ uint8_t# *const *inputs, size_t num_inputs,
146 size_t blocks, const uint32_tcxx . . $ uint32_t# key[8],
147 uint64_tcxx . . $ uint64_t# counter, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! increment_counter,
148 uint8_tcxx . . $ uint8_t# flags, uint8_tcxx . . $ uint8_t# flags_start,
149 uint8_tcxx . . $ uint8_t# flags_end, uint8_tcxx . . $ uint8_t# *out) {
150 while (num_inputs > 0) {
151 hash_one_portablecxx . . $ hash_one_portable(a39325e3b1f31274).(inputs[0], blocks, key, counter, flags, flags_start,
152 flags_end, out);
153 if (increment_counter) {
154 counter += 1;
155 }
156 inputs += 1;
157 num_inputs -= 1;
158 out = &out[BLAKE3_OUT_LENcxx . . $ `external/blake3/blake3.h:43:9`!];
159 }
160 }