Skip to content

Commit 542738c

Browse files
committed
raise OverflowError instead of ValueError in 1-shot HMAC
1 parent dd80600 commit 542738c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Modules/hmacmodule.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,15 +332,15 @@ _hmac_compute_digest_impl(PyObject *module, PyObject *key, PyObject *msg,
332332
GET_BUFFER_VIEW_OR_ERROUT((KEY), &keyview); \
333333
if (!has_uint32_t_buffer_length(&keyview)) { \
334334
PyBuffer_Release(&keyview); \
335-
PyErr_SetString(PyExc_ValueError, \
335+
PyErr_SetString(PyExc_OverflowError, \
336336
"key length exceeds UINT32_MAX"); \
337337
return NULL; \
338338
} \
339339
GET_BUFFER_VIEW_OR_ERROUT((MSG), &msgview); \
340340
if (!has_uint32_t_buffer_length(&msgview)) { \
341341
PyBuffer_Release(&msgview); \
342342
PyBuffer_Release(&keyview); \
343-
PyErr_SetString(PyExc_ValueError, \
343+
PyErr_SetString(PyExc_OverflowError, \
344344
"message length exceeds UINT32_MAX"); \
345345
return NULL; \
346346
} \

0 commit comments

Comments
 (0)