Skip to content
Open

ubsan #763

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/encauth/siv/siv.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ static LTC_INLINE int s_siv_S2V_T(siv_omac_ctx_t *ctx,
} else {
s_siv_dbl(D);
XMEMSET(&T, 0, sizeof(T));
XMEMCPY(&T, in, inlen);
if (inlen != 0) XMEMCPY(&T, in, inlen);
T.u.byte[inlen] = 0x80;
s_siv_xor_buf(D, &T);

Expand Down
2 changes: 2 additions & 0 deletions src/misc/compare_testvector.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ int ltc_compare_testvector(const void* is, const unsigned long is_len, const voi
int res = 0;
if(is_len != should_len) {
res = is_len > should_len ? -1 : 1;
} else if (is_len == 0 && (!is || !should)) {
res = 0;
} else {
res = XMEMCMP(is, should, is_len);
}
Expand Down
4 changes: 2 additions & 2 deletions src/pk/ec25519/tweetnacl.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ sv car25519(gf o)
o[i]+=(1LL<<16);
c=o[i]>>16;
o[(i+1)*(i<15)]+=c-1+37*(c-1)*(i==15);
o[i]-=c<<16;
o[i]-=((i64)(((u64)(c))<<16));
}
}

Expand Down Expand Up @@ -366,7 +366,7 @@ sv modL(u8 *r,i64 x[64])
for (j = i - 32;j < i - 12;++j) {
x[j] += carry - 16 * x[i] * L[j - (i - 32)];
carry = (x[j] + 128) >> 8;
x[j] -= carry << 8;
x[j] -= ((i64)(((u64)(carry)) << 8));
}
x[j] += carry;
x[i] = 0;
Expand Down
6 changes: 3 additions & 3 deletions src/pk/ec448/ec448_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@ static void s_gf448_carry(gf448 o)
for (i = 0; i < 15; ++i) {
c = o[i] >> 28;
o[i+1] += c;
o[i] -= c << 28;
o[i] -= ((long64)(((ulong64)(c)) << 28));
}
/* limb 15 overflow: 2^(28*16) = 2^448 == 2^224 + 1 */
c = o[15] >> 28;
o[0] += c; /* + c * 1 */
o[8] += c; /* + c * 2^224 */
o[15] -= c << 28;
o[15] -= ((long64)(((ulong64)(c)) << 28));
/* one more pass to settle the extra from limb 0 and 8 */
for (i = 0; i < 15; ++i) {
c = o[i] >> 28;
Expand Down Expand Up @@ -254,7 +254,7 @@ static void s_gf448_mul(gf448 o, const gf448 a, const gf448 b)
for (i = 0; i < 30; ++i) {
c = t[i] >> 28;
t[i+1] += c;
t[i] -= c << 28;
t[i] -= ((long64)(((ulong64)(c)) << 28));
}
t[14] += 2 * t[30];
t[6] += t[30];
Expand Down
Loading