Skip to content

Commit 0d2b218

Browse files
committed
remove incorrect assertion
1 parent 9960ee2 commit 0d2b218

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

Modules/blake2module.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ new_Blake2Object(PyTypeObject *type)
415415
#define HACL_UPDATE(UPDATE_FUNC, STATE, BUF, LEN) \
416416
do { \
417417
HACL_UPDATE_LOOP(UPDATE_FUNC, STATE, BUF, LEN); \
418-
assert((Py_ssize_t)(LEN) <= (Py_ssize_t)UINT32_MAX); \
418+
/* cast to uint32_t is now safe */ \
419419
(void)UPDATE_FUNC(STATE, BUF, (uint32_t)LEN); \
420420
} while (0)
421421

Modules/md5module.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ update(Hacl_Hash_MD5_state_t *state, uint8_t *buf, Py_ssize_t len)
193193
buf += UINT32_MAX;
194194
}
195195
#endif
196-
assert(len <= (Py_ssize_t)UINT32_MAX);
196+
/* cast to uint32_t is now safe */
197197
(void)Hacl_Hash_MD5_update(state, buf, (uint32_t)len);
198198
}
199199

Modules/sha1module.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ update(Hacl_Hash_SHA1_state_t *state, uint8_t *buf, Py_ssize_t len)
186186
buf += UINT32_MAX;
187187
}
188188
#endif
189-
assert(len <= (Py_ssize_t)UINT32_MAX);
189+
/* cast to uint32_t is now safe */
190190
(void)Hacl_Hash_SHA1_update(state, buf, (uint32_t)len);
191191
}
192192

Modules/sha2module.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ update_256(Hacl_Hash_SHA2_state_t_256 *state, uint8_t *buf, Py_ssize_t len)
214214
buf += UINT32_MAX;
215215
}
216216
#endif
217-
assert(len <= (Py_ssize_t)UINT32_MAX);
217+
/* cast to uint32_t is now safe */
218218
(void)Hacl_Hash_SHA2_update_256(state, buf, (uint32_t)len);
219219
}
220220

@@ -233,7 +233,7 @@ update_512(Hacl_Hash_SHA2_state_t_512 *state, uint8_t *buf, Py_ssize_t len)
233233
buf += UINT32_MAX;
234234
}
235235
#endif
236-
assert(len <= (Py_ssize_t)UINT32_MAX);
236+
/* cast to uint32_t is now safe */
237237
(void)Hacl_Hash_SHA2_update_512(state, buf, (uint32_t)len);
238238
}
239239

Modules/sha3module.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ sha3_update(Hacl_Hash_SHA3_state_t *state, uint8_t *buf, Py_ssize_t len)
9898
buf += UINT32_MAX;
9999
}
100100
#endif
101-
assert(len <= (Py_ssize_t)UINT32_MAX);
101+
/* cast to uint32_t is now safe */
102102
(void)Hacl_Hash_SHA3_update(state, buf, (uint32_t)len);
103103
}
104104

0 commit comments

Comments
 (0)