Skip to content

Commit 0c07a7f

Browse files
committed
correctly cast arguments
1 parent e88f608 commit 0c07a7f

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

Modules/_hashopenssl.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1366,8 +1366,8 @@ pbkdf2_hmac_impl(PyObject *module, const char *hash_name,
13661366
key = PyBytes_AS_STRING(key_obj);
13671367

13681368
Py_BEGIN_ALLOW_THREADS
1369-
retval = PKCS5_PBKDF2_HMAC((char*)password->buf, (int)password->len,
1370-
(unsigned char *)salt->buf, (int)salt->len,
1369+
retval = PKCS5_PBKDF2_HMAC((const char *)password->buf, (int)password->len,
1370+
(const unsigned char *)salt->buf, (int)salt->len,
13711371
iterations, digest, dklen,
13721372
(unsigned char *)key);
13731373
Py_END_ALLOW_THREADS
@@ -1551,8 +1551,8 @@ _hashlib_hmac_singleshot_impl(PyObject *module, Py_buffer *key,
15511551
Py_BEGIN_ALLOW_THREADS
15521552
result = HMAC(
15531553
evp,
1554-
(const void*)key->buf, (int)key->len,
1555-
(const unsigned char*)msg->buf, (int)msg->len,
1554+
(const void *)key->buf, (int)key->len,
1555+
(const unsigned char *)msg->buf, (size_t)msg->len,
15561556
md, &md_len
15571557
);
15581558
Py_END_ALLOW_THREADS
@@ -1686,11 +1686,15 @@ _hmac_update(HMACobject *self, PyObject *obj)
16861686
if (self->use_mutex) {
16871687
Py_BEGIN_ALLOW_THREADS
16881688
PyMutex_Lock(&self->mutex);
1689-
r = HMAC_Update(self->ctx, (const unsigned char*)view.buf, view.len);
1689+
r = HMAC_Update(self->ctx,
1690+
(const unsigned char *)view.buf,
1691+
(size_t)view.len);
16901692
PyMutex_Unlock(&self->mutex);
16911693
Py_END_ALLOW_THREADS
16921694
} else {
1693-
r = HMAC_Update(self->ctx, (const unsigned char*)view.buf, view.len);
1695+
r = HMAC_Update(self->ctx,
1696+
(const unsigned char *)view.buf,
1697+
(size_t)view.len);
16941698
}
16951699

16961700
PyBuffer_Release(&view);

0 commit comments

Comments
 (0)