GCC Bugzilla – Attachment 53055 Details for
Bug 105782
emission of inefficient movxtod/movdtox with -mvis3
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
The problematic function, adapted for standalone compilation
blake2b-monocypher-standalone.c (text/x-csrc), 3.51 KB, created by
Koakuma
on 2022-05-30 23:22:51 UTC
(
hide
)
Description:
The problematic function, adapted for standalone compilation
Filename:
MIME Type:
Creator:
Koakuma
Created:
2022-05-30 23:22:51 UTC
Size:
3.51 KB
patch
obsolete
>// Adapted from monocypher 3.1.2 >// https://monocypher.org/download/monocypher-3.1.2.tar.gz > >#include <stddef.h> >#include <stdint.h> > >typedef struct { > uint64_t hash[8]; > uint64_t input_offset[2]; > uint64_t input[16]; > size_t input_idx; > size_t hash_size; >} crypto_blake2b_ctx; > >static const uint64_t iv[8] = { > 0x6a09e667f3bcc908, 0xbb67ae8584caa73b, > 0x3c6ef372fe94f82b, 0xa54ff53a5f1d36f1, > 0x510e527fade682d1, 0x9b05688c2b3e6c1f, > 0x1f83d9abfb41bd6b, 0x5be0cd19137e2179, >}; > >static uint64_t rotr64(uint64_t x, uint64_t n) { return (x >> n) ^ (x << (64 - n)); } > >void blake2b_compress(crypto_blake2b_ctx *ctx, int is_last_block) >{ > static const uint8_t sigma[12][16] = { > { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, > { 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 }, > { 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4 }, > { 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 }, > { 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13 }, > { 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 }, > { 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11 }, > { 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10 }, > { 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5 }, > { 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13, 0 }, > { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, > { 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 }, > }; > > // init work vector > uint64_t v0 = ctx->hash[0]; uint64_t v8 = iv[0]; > uint64_t v1 = ctx->hash[1]; uint64_t v9 = iv[1]; > uint64_t v2 = ctx->hash[2]; uint64_t v10 = iv[2]; > uint64_t v3 = ctx->hash[3]; uint64_t v11 = iv[3]; > uint64_t v4 = ctx->hash[4]; uint64_t v12 = iv[4] ^ ctx->input_offset[0]; > uint64_t v5 = ctx->hash[5]; uint64_t v13 = iv[5] ^ ctx->input_offset[1]; > uint64_t v6 = ctx->hash[6]; uint64_t v14 = iv[6] ^ (uint64_t)~(is_last_block - 1); > uint64_t v7 = ctx->hash[7]; uint64_t v15 = iv[7]; > > // mangle work vector > uint64_t *input = ctx->input; >#define BLAKE2_G(a, b, c, d, x, y) \ > a += b + x; d = rotr64(d ^ a, 32); \ > c += d; b = rotr64(b ^ c, 24); \ > a += b + y; d = rotr64(d ^ a, 16); \ > c += d; b = rotr64(b ^ c, 63) >#define BLAKE2_ROUND(i) \ > BLAKE2_G(v0, v4, v8 , v12, input[sigma[i][ 0]], input[sigma[i][ 1]]); \ > BLAKE2_G(v1, v5, v9 , v13, input[sigma[i][ 2]], input[sigma[i][ 3]]); \ > BLAKE2_G(v2, v6, v10, v14, input[sigma[i][ 4]], input[sigma[i][ 5]]); \ > BLAKE2_G(v3, v7, v11, v15, input[sigma[i][ 6]], input[sigma[i][ 7]]); \ > BLAKE2_G(v0, v5, v10, v15, input[sigma[i][ 8]], input[sigma[i][ 9]]); \ > BLAKE2_G(v1, v6, v11, v12, input[sigma[i][10]], input[sigma[i][11]]); \ > BLAKE2_G(v2, v7, v8 , v13, input[sigma[i][12]], input[sigma[i][13]]); \ > BLAKE2_G(v3, v4, v9 , v14, input[sigma[i][14]], input[sigma[i][15]]) > > BLAKE2_ROUND(0); BLAKE2_ROUND(1); BLAKE2_ROUND(2); BLAKE2_ROUND(3); > BLAKE2_ROUND(4); BLAKE2_ROUND(5); BLAKE2_ROUND(6); BLAKE2_ROUND(7); > BLAKE2_ROUND(8); BLAKE2_ROUND(9); BLAKE2_ROUND(10); BLAKE2_ROUND(11); > > // update hash > ctx->hash[0] ^= v0 ^ v8; ctx->hash[1] ^= v1 ^ v9; > ctx->hash[2] ^= v2 ^ v10; ctx->hash[3] ^= v3 ^ v11; > ctx->hash[4] ^= v4 ^ v12; ctx->hash[5] ^= v5 ^ v13; > ctx->hash[6] ^= v6 ^ v14; ctx->hash[7] ^= v7 ^ v15; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 105782
: 53055 |
53066