summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--extmod/crypto-algorithms/sha256.c8
-rw-r--r--extmod/crypto-algorithms/sha256.h8
-rw-r--r--extmod/moduhashlib.c8
3 files changed, 12 insertions, 12 deletions
diff --git a/extmod/crypto-algorithms/sha256.c b/extmod/crypto-algorithms/sha256.c
index bbc30ece7e..82e5d9c7bd 100644
--- a/extmod/crypto-algorithms/sha256.c
+++ b/extmod/crypto-algorithms/sha256.c
@@ -41,7 +41,7 @@ static const WORD k[64] = {
};
/*********************** FUNCTION DEFINITIONS ***********************/
-static void sha256_transform(SHA256_CTX *ctx, const BYTE data[])
+static void sha256_transform(CRYAL_SHA256_CTX *ctx, const BYTE data[])
{
WORD a, b, c, d, e, f, g, h, i, j, t1, t2, m[64];
@@ -82,7 +82,7 @@ static void sha256_transform(SHA256_CTX *ctx, const BYTE data[])
ctx->state[7] += h;
}
-void sha256_init(SHA256_CTX *ctx)
+void sha256_init(CRYAL_SHA256_CTX *ctx)
{
ctx->datalen = 0;
ctx->bitlen = 0;
@@ -96,7 +96,7 @@ void sha256_init(SHA256_CTX *ctx)
ctx->state[7] = 0x5be0cd19;
}
-void sha256_update(SHA256_CTX *ctx, const BYTE data[], size_t len)
+void sha256_update(CRYAL_SHA256_CTX *ctx, const BYTE data[], size_t len)
{
WORD i;
@@ -111,7 +111,7 @@ void sha256_update(SHA256_CTX *ctx, const BYTE data[], size_t len)
}
}
-void sha256_final(SHA256_CTX *ctx, BYTE hash[])
+void sha256_final(CRYAL_SHA256_CTX *ctx, BYTE hash[])
{
WORD i;
diff --git a/extmod/crypto-algorithms/sha256.h b/extmod/crypto-algorithms/sha256.h
index 7123a30dd4..caa1f81020 100644
--- a/extmod/crypto-algorithms/sha256.h
+++ b/extmod/crypto-algorithms/sha256.h
@@ -24,11 +24,11 @@ typedef struct {
WORD datalen;
unsigned long long bitlen;
WORD state[8];
-} SHA256_CTX;
+} CRYAL_SHA256_CTX;
/*********************** FUNCTION DECLARATIONS **********************/
-void sha256_init(SHA256_CTX *ctx);
-void sha256_update(SHA256_CTX *ctx, const BYTE data[], size_t len);
-void sha256_final(SHA256_CTX *ctx, BYTE hash[]);
+void sha256_init(CRYAL_SHA256_CTX *ctx);
+void sha256_update(CRYAL_SHA256_CTX *ctx, const BYTE data[], size_t len);
+void sha256_final(CRYAL_SHA256_CTX *ctx, BYTE hash[]);
#endif // SHA256_H
diff --git a/extmod/moduhashlib.c b/extmod/moduhashlib.c
index 7b0d25e80b..a824bd0eb3 100644
--- a/extmod/moduhashlib.c
+++ b/extmod/moduhashlib.c
@@ -43,9 +43,9 @@ STATIC mp_obj_t hash_update(mp_obj_t self_in, mp_obj_t arg);
STATIC mp_obj_t hash_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 0, 1, false);
- mp_obj_hash_t *o = m_new_obj_var(mp_obj_hash_t, char, sizeof(SHA256_CTX));
+ mp_obj_hash_t *o = m_new_obj_var(mp_obj_hash_t, char, sizeof(CRYAL_SHA256_CTX));
o->base.type = MP_OBJ_TO_PTR(type_in);
- sha256_init((SHA256_CTX*)o->state);
+ sha256_init((CRYAL_SHA256_CTX*)o->state);
if (n_args == 1) {
hash_update(MP_OBJ_FROM_PTR(o), args[0]);
}
@@ -56,7 +56,7 @@ STATIC mp_obj_t hash_update(mp_obj_t self_in, mp_obj_t arg) {
mp_obj_hash_t *self = MP_OBJ_TO_PTR(self_in);
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(arg, &bufinfo, MP_BUFFER_READ);
- sha256_update((SHA256_CTX*)self->state, bufinfo.buf, bufinfo.len);
+ sha256_update((CRYAL_SHA256_CTX*)self->state, bufinfo.buf, bufinfo.len);
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_2(hash_update_obj, hash_update);
@@ -65,7 +65,7 @@ STATIC mp_obj_t hash_digest(mp_obj_t self_in) {
mp_obj_hash_t *self = MP_OBJ_TO_PTR(self_in);
vstr_t vstr;
vstr_init_len(&vstr, SHA256_BLOCK_SIZE);
- sha256_final((SHA256_CTX*)self->state, (byte*)vstr.buf);
+ sha256_final((CRYAL_SHA256_CTX*)self->state, (byte*)vstr.buf);
return mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr);
}
MP_DEFINE_CONST_FUN_OBJ_1(hash_digest_obj, hash_digest);