Skip to content

Commit

Permalink
Merge BoringSSL '7ac94aa': More -Wshorten-64-to-32 fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
briansmith committed Sep 24, 2023
2 parents ba1c0f5 + 7ac94aa commit 6678808
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions crypto/poly1305/poly1305.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ void CRYPTO_poly1305_update(poly1305_state *statep, const uint8_t *in,

void CRYPTO_poly1305_finish(poly1305_state *statep, uint8_t mac[16]) {
struct poly1305_state_st *state = poly1305_aligned_state(statep);
uint64_t f0, f1, f2, f3;
uint32_t g0, g1, g2, g3, g4;
uint32_t b, nb;

Expand Down Expand Up @@ -276,14 +275,14 @@ void CRYPTO_poly1305_finish(poly1305_state *statep, uint8_t mac[16]) {
state->h3 = (state->h3 & nb) | (g3 & b);
state->h4 = (state->h4 & nb) | (g4 & b);

f0 = ((state->h0) | (state->h1 << 26)) +
(uint64_t)CRYPTO_load_u32_le(&state->key[0]);
f1 = ((state->h1 >> 6) | (state->h2 << 20)) +
(uint64_t)CRYPTO_load_u32_le(&state->key[4]);
f2 = ((state->h2 >> 12) | (state->h3 << 14)) +
(uint64_t)CRYPTO_load_u32_le(&state->key[8]);
f3 = ((state->h3 >> 18) | (state->h4 << 8)) +
(uint64_t)CRYPTO_load_u32_le(&state->key[12]);
uint64_t f0 = ((state->h0) | (state->h1 << 26)) +
(uint64_t)CRYPTO_load_u32_le(&state->key[0]);
uint64_t f1 = ((state->h1 >> 6) | (state->h2 << 20)) +
(uint64_t)CRYPTO_load_u32_le(&state->key[4]);
uint64_t f2 = ((state->h2 >> 12) | (state->h3 << 14)) +
(uint64_t)CRYPTO_load_u32_le(&state->key[8]);
uint64_t f3 = ((state->h3 >> 18) | (state->h4 << 8)) +
(uint64_t)CRYPTO_load_u32_le(&state->key[12]);

CRYPTO_store_u32_le(&mac[0], (uint32_t)f0);
f1 += (f0 >> 32);
Expand Down

0 comments on commit 6678808

Please sign in to comment.