Lines Matching +full:all +full:- +full:inputs +full:- +full:2

2  *  Copyright (C) 2017 - This file is part of libecc project
7 * Jean-Pierre FLORI <jean-pierre.flori@ssi.gouv.fr>
21 /* SHA-2 core processing. Returns 0 on success, -1 on error. */
34 a = ctx->sha384_state[0]; in sha384_process()
35 b = ctx->sha384_state[1]; in sha384_process()
36 c = ctx->sha384_state[2]; in sha384_process()
37 d = ctx->sha384_state[3]; in sha384_process()
38 e = ctx->sha384_state[4]; in sha384_process()
39 f = ctx->sha384_state[5]; in sha384_process()
40 g = ctx->sha384_state[6]; in sha384_process()
41 h = ctx->sha384_state[7]; in sha384_process()
54 ctx->sha384_state[0] += a; in sha384_process()
55 ctx->sha384_state[1] += b; in sha384_process()
56 ctx->sha384_state[2] += c; in sha384_process()
57 ctx->sha384_state[3] += d; in sha384_process()
58 ctx->sha384_state[4] += e; in sha384_process()
59 ctx->sha384_state[5] += f; in sha384_process()
60 ctx->sha384_state[6] += g; in sha384_process()
61 ctx->sha384_state[7] += h; in sha384_process()
69 /* Init hash function. Returns 0 on success, -1 on error. */
76 ctx->sha384_total[0] = ctx->sha384_total[1] = 0; in sha384_init()
77 ctx->sha384_state[0] = (u64)(0xCBBB9D5DC1059ED8); in sha384_init()
78 ctx->sha384_state[1] = (u64)(0x629A292A367CD507); in sha384_init()
79 ctx->sha384_state[2] = (u64)(0x9159015A3070DD17); in sha384_init()
80 ctx->sha384_state[3] = (u64)(0x152FECD8F70E5939); in sha384_init()
81 ctx->sha384_state[4] = (u64)(0x67332667FFC00B31); in sha384_init()
82 ctx->sha384_state[5] = (u64)(0x8EB44A8768581511); in sha384_init()
83 ctx->sha384_state[6] = (u64)(0xDB0C2E0D64F98FA7); in sha384_init()
84 ctx->sha384_state[7] = (u64)(0x47B5481DBEFA4FA4); in sha384_init()
87 ctx->magic = SHA384_HASH_MAGIC; in sha384_init()
94 /* Update hash function. Returns 0 on success, -1 on error. */
113 left = (ctx->sha384_total[0] & 0x7F); in sha384_update()
114 fill = (SHA384_BLOCK_SIZE - left); in sha384_update()
116 ADD_UINT128_UINT64(ctx->sha384_total[0], ctx->sha384_total[1], ilen); in sha384_update()
120 ret = local_memcpy(ctx->sha384_buffer + left, data_ptr, fill); EG(ret, err); in sha384_update()
121 ret = sha384_process(ctx, ctx->sha384_buffer); EG(ret, err); in sha384_update()
123 remain_ilen -= fill; in sha384_update()
130 remain_ilen -= SHA384_BLOCK_SIZE; in sha384_update()
134 ret = local_memcpy(ctx->sha384_buffer + left, data_ptr, remain_ilen); EG(ret, err); in sha384_update()
144 * Finalize hash function. Returns 0 on success, -1 on error. In all
151 u8 last_padded_block[2 * SHA384_BLOCK_SIZE]; in sha384_final()
161 block_present = (ctx->sha384_total[0] % SHA384_BLOCK_SIZE); in sha384_final()
164 ret = local_memcpy(last_padded_block, ctx->sha384_buffer, in sha384_final()
172 if (block_present > (SHA384_BLOCK_SIZE - 1 - (2 * sizeof(u64)))) { in sha384_final()
174 PUT_MUL8_UINT128_BE(ctx->sha384_total[0], ctx->sha384_total[1], in sha384_final()
176 2 * (SHA384_BLOCK_SIZE - sizeof(u64))); in sha384_final()
181 PUT_MUL8_UINT128_BE(ctx->sha384_total[0], ctx->sha384_total[1], in sha384_final()
183 SHA384_BLOCK_SIZE - (2 * sizeof(u64))); in sha384_final()
188 PUT_UINT64_BE(ctx->sha384_state[0], output, 0); in sha384_final()
189 PUT_UINT64_BE(ctx->sha384_state[1], output, 8); in sha384_final()
190 PUT_UINT64_BE(ctx->sha384_state[2], output, 16); in sha384_final()
191 PUT_UINT64_BE(ctx->sha384_state[3], output, 24); in sha384_final()
192 PUT_UINT64_BE(ctx->sha384_state[4], output, 32); in sha384_final()
193 PUT_UINT64_BE(ctx->sha384_state[5], output, 40); in sha384_final()
196 ctx->magic = WORD(0); in sha384_final()
206 * 'inputs' with the length of each buffer passed via 'ilens'. The function
207 * loops on pointers in 'inputs' until it finds a NULL pointer. The function
208 * returns 0 on success, -1 on error.
210 int sha384_scattered(const u8 **inputs, const u32 *ilens, in sha384_scattered() argument
217 MUST_HAVE((inputs != NULL) && (ilens != NULL) && (output != NULL), ret, err); in sha384_scattered()
221 while (inputs[pos] != NULL) { in sha384_scattered()
222 const u8 *buf = inputs[pos]; in sha384_scattered()