|
|
@ -83,7 +83,7 @@ STATIC mp_obj_t hashlib_sha256_update(mp_obj_t self_in, mp_obj_t arg); |
|
|
|
|
|
|
|
STATIC mp_obj_t hashlib_sha256_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { |
|
|
|
mp_arg_check_num(n_args, n_kw, 0, 1, false); |
|
|
|
mp_obj_hash_t *o = mp_obj_malloc_var(mp_obj_hash_t, char, sizeof(mbedtls_sha256_context), type); |
|
|
|
mp_obj_hash_t *o = mp_obj_malloc_var(mp_obj_hash_t, state, char, sizeof(mbedtls_sha256_context), type); |
|
|
|
o->final = false; |
|
|
|
mbedtls_sha256_init((mbedtls_sha256_context *)&o->state); |
|
|
|
mbedtls_sha256_starts_ret((mbedtls_sha256_context *)&o->state, 0); |
|
|
@ -118,7 +118,7 @@ STATIC mp_obj_t hashlib_sha256_digest(mp_obj_t self_in) { |
|
|
|
|
|
|
|
STATIC mp_obj_t hashlib_sha256_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { |
|
|
|
mp_arg_check_num(n_args, n_kw, 0, 1, false); |
|
|
|
mp_obj_hash_t *o = mp_obj_malloc_var(mp_obj_hash_t, char, sizeof(CRYAL_SHA256_CTX), type); |
|
|
|
mp_obj_hash_t *o = mp_obj_malloc_var(mp_obj_hash_t, state, char, sizeof(CRYAL_SHA256_CTX), type); |
|
|
|
o->final = false; |
|
|
|
sha256_init((CRYAL_SHA256_CTX *)o->state); |
|
|
|
if (n_args == 1) { |
|
|
@ -172,7 +172,7 @@ STATIC mp_obj_t hashlib_sha1_update(mp_obj_t self_in, mp_obj_t arg); |
|
|
|
#if MICROPY_SSL_AXTLS |
|
|
|
STATIC mp_obj_t hashlib_sha1_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { |
|
|
|
mp_arg_check_num(n_args, n_kw, 0, 1, false); |
|
|
|
mp_obj_hash_t *o = mp_obj_malloc_var(mp_obj_hash_t, char, sizeof(SHA1_CTX), type); |
|
|
|
mp_obj_hash_t *o = mp_obj_malloc_var(mp_obj_hash_t, state, char, sizeof(SHA1_CTX), type); |
|
|
|
o->final = false; |
|
|
|
SHA1_Init((SHA1_CTX *)o->state); |
|
|
|
if (n_args == 1) { |
|
|
@ -211,7 +211,7 @@ STATIC mp_obj_t hashlib_sha1_digest(mp_obj_t self_in) { |
|
|
|
|
|
|
|
STATIC mp_obj_t hashlib_sha1_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { |
|
|
|
mp_arg_check_num(n_args, n_kw, 0, 1, false); |
|
|
|
mp_obj_hash_t *o = mp_obj_malloc_var(mp_obj_hash_t, char, sizeof(mbedtls_sha1_context), type); |
|
|
|
mp_obj_hash_t *o = mp_obj_malloc_var(mp_obj_hash_t, state, char, sizeof(mbedtls_sha1_context), type); |
|
|
|
o->final = false; |
|
|
|
mbedtls_sha1_init((mbedtls_sha1_context *)o->state); |
|
|
|
mbedtls_sha1_starts_ret((mbedtls_sha1_context *)o->state); |
|
|
@ -266,7 +266,7 @@ STATIC mp_obj_t hashlib_md5_update(mp_obj_t self_in, mp_obj_t arg); |
|
|
|
#if MICROPY_SSL_AXTLS |
|
|
|
STATIC mp_obj_t hashlib_md5_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { |
|
|
|
mp_arg_check_num(n_args, n_kw, 0, 1, false); |
|
|
|
mp_obj_hash_t *o = mp_obj_malloc_var(mp_obj_hash_t, char, sizeof(MD5_CTX), type); |
|
|
|
mp_obj_hash_t *o = mp_obj_malloc_var(mp_obj_hash_t, state, char, sizeof(MD5_CTX), type); |
|
|
|
o->final = false; |
|
|
|
MD5_Init((MD5_CTX *)o->state); |
|
|
|
if (n_args == 1) { |
|
|
@ -305,7 +305,7 @@ STATIC mp_obj_t hashlib_md5_digest(mp_obj_t self_in) { |
|
|
|
|
|
|
|
STATIC mp_obj_t hashlib_md5_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { |
|
|
|
mp_arg_check_num(n_args, n_kw, 0, 1, false); |
|
|
|
mp_obj_hash_t *o = mp_obj_malloc_var(mp_obj_hash_t, char, sizeof(mbedtls_md5_context), type); |
|
|
|
mp_obj_hash_t *o = mp_obj_malloc_var(mp_obj_hash_t, state, char, sizeof(mbedtls_md5_context), type); |
|
|
|
o->final = false; |
|
|
|
mbedtls_md5_init((mbedtls_md5_context *)o->state); |
|
|
|
mbedtls_md5_starts_ret((mbedtls_md5_context *)o->state); |
|
|
|