Skip to content

Commit 5fd72f0

Browse files
committed
force safe downcast to uint32_t in hmac_new_initial_state
1 parent c86d51e commit 5fd72f0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Modules/hmacmodule.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -750,8 +750,9 @@ hmac_new_initial_state(HMACObject *self, uint8_t *key, Py_ssize_t len)
750750
}
751751
#endif
752752
assert(self->kind != Py_hmac_kind_hash_unknown);
753+
// cast to uint32_t is now safe even on 32-bit platforms
754+
self->state = _hacl_hmac_state_new(self->kind, key, (uint32_t)len);
753755
// _hacl_hmac_state_new() may set an exception on error
754-
self->state = _hacl_hmac_state_new(self->kind, key, len);
755756
return self->state == NULL ? -1 : 0;
756757
}
757758

0 commit comments

Comments
 (0)