summaryrefslogtreecommitdiffstatshomepage
path: root/extmod/moducryptolib.c
diff options
context:
space:
mode:
Diffstat (limited to 'extmod/moducryptolib.c')
-rw-r--r--extmod/moducryptolib.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/extmod/moducryptolib.c b/extmod/moducryptolib.c
index 0c9701024e..2299477259 100644
--- a/extmod/moducryptolib.c
+++ b/extmod/moducryptolib.c
@@ -27,7 +27,7 @@
#include "py/mpconfig.h"
-#if MICROPY_PY_UCRYPTOLIB
+#if MICROPY_PY_CRYPTOLIB
#include <assert.h>
#include <string.h>
@@ -90,7 +90,7 @@ typedef struct _mp_obj_aes_t {
} mp_obj_aes_t;
static inline bool is_ctr_mode(int block_mode) {
- #if MICROPY_PY_UCRYPTOLIB_CTR
+ #if MICROPY_PY_CRYPTOLIB_CTR
return block_mode == UCRYPTOLIB_MODE_CTR;
#else
return false;
@@ -140,7 +140,7 @@ STATIC void aes_process_cbc_impl(AES_CTX_IMPL *ctx, const uint8_t *in, uint8_t *
}
}
-#if MICROPY_PY_UCRYPTOLIB_CTR
+#if MICROPY_PY_CRYPTOLIB_CTR
// axTLS doesn't have CTR support out of the box. This implements the counter part using the ECB primitive.
STATIC void aes_process_ctr_impl(AES_CTX_IMPL *ctx, const uint8_t *in, uint8_t *out, size_t in_len, struct ctr_params *ctr_params) {
size_t n = ctr_params->offset;
@@ -203,7 +203,7 @@ STATIC void aes_process_cbc_impl(AES_CTX_IMPL *ctx, const uint8_t *in, uint8_t *
mbedtls_aes_crypt_cbc(&ctx->u.mbedtls_ctx, encrypt ? MBEDTLS_AES_ENCRYPT : MBEDTLS_AES_DECRYPT, in_len, ctx->iv, in, out);
}
-#if MICROPY_PY_UCRYPTOLIB_CTR
+#if MICROPY_PY_CRYPTOLIB_CTR
STATIC void aes_process_ctr_impl(AES_CTX_IMPL *ctx, const uint8_t *in, uint8_t *out, size_t in_len, struct ctr_params *ctr_params) {
mbedtls_aes_crypt_ctr(&ctx->u.mbedtls_ctx, in_len, &ctr_params->offset, ctx->iv, ctr_params->encrypted_counter, in, out);
}
@@ -219,7 +219,7 @@ STATIC mp_obj_t cryptolib_aes_make_new(const mp_obj_type_t *type, size_t n_args,
switch (block_mode) {
case UCRYPTOLIB_MODE_ECB:
case UCRYPTOLIB_MODE_CBC:
- #if MICROPY_PY_UCRYPTOLIB_CTR
+ #if MICROPY_PY_CRYPTOLIB_CTR
case UCRYPTOLIB_MODE_CTR:
#endif
break;
@@ -318,7 +318,7 @@ STATIC mp_obj_t aes_process(size_t n_args, const mp_obj_t *args, bool encrypt) {
aes_process_cbc_impl(&self->ctx, in_bufinfo.buf, out_buf_ptr, in_bufinfo.len, encrypt);
break;
- #if MICROPY_PY_UCRYPTOLIB_CTR
+ #if MICROPY_PY_CRYPTOLIB_CTR
case UCRYPTOLIB_MODE_CTR:
aes_process_ctr_impl(&self->ctx, in_bufinfo.buf, out_buf_ptr, in_bufinfo.len,
ctr_params_from_aes(self));
@@ -359,10 +359,10 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
STATIC const mp_rom_map_elem_t mp_module_cryptolib_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_cryptolib) },
{ MP_ROM_QSTR(MP_QSTR_aes), MP_ROM_PTR(&cryptolib_aes_type) },
- #if MICROPY_PY_UCRYPTOLIB_CONSTS
+ #if MICROPY_PY_CRYPTOLIB_CONSTS
{ MP_ROM_QSTR(MP_QSTR_MODE_ECB), MP_ROM_INT(UCRYPTOLIB_MODE_ECB) },
{ MP_ROM_QSTR(MP_QSTR_MODE_CBC), MP_ROM_INT(UCRYPTOLIB_MODE_CBC) },
- #if MICROPY_PY_UCRYPTOLIB_CTR
+ #if MICROPY_PY_CRYPTOLIB_CTR
{ MP_ROM_QSTR(MP_QSTR_MODE_CTR), MP_ROM_INT(UCRYPTOLIB_MODE_CTR) },
#endif
#endif
@@ -377,4 +377,4 @@ const mp_obj_module_t mp_module_cryptolib = {
MP_REGISTER_MODULE(MP_QSTR_cryptolib, mp_module_cryptolib);
-#endif // MICROPY_PY_UCRYPTOLIB
+#endif // MICROPY_PY_CRYPTOLIB