Skip to content
This repository was archived by the owner on Sep 6, 2023. It is now read-only.

Commit a9517c0

Browse files
committedOct 5, 2017
Call initialization function on sha1 and sha256 ... Fixes #194
Add in calls to mbedtls_sha1_starts() and mbedtls_sha256_starts()
1 parent d0e11f7 commit a9517c0

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed
 

Diff for: ‎ports/esp32/moduhashlib.c

+2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ STATIC mp_obj_t sha256_make_new(const mp_obj_type_t *type,
4646
mp_obj_hash_t *o = m_new_obj_var(mp_obj_hash_t, char, sizeof(union sha_ctxs));
4747
o->base.type = type;
4848
mbedtls_sha256_init(&o->state.sha256);
49+
mbedtls_sha256_starts(&o->state.sha256, 0);
4950
if (n_args == 1) {
5051
sha256_update(MP_OBJ_FROM_PTR(o), args[0]);
5152
}
@@ -58,6 +59,7 @@ STATIC mp_obj_t sha1_make_new(const mp_obj_type_t *type,
5859
mp_obj_hash_t *o = m_new_obj_var(mp_obj_hash_t, char, sizeof(union sha_ctxs));
5960
o->base.type = type;
6061
mbedtls_sha1_init(&o->state.sha1);
62+
mbedtls_sha1_starts(&o->state.sha1);
6163
if (n_args == 1) {
6264
sha1_update(MP_OBJ_FROM_PTR(o), args[0]);
6365
}

0 commit comments

Comments
 (0)
This repository has been archived.