2016-04-04 18:48:48 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) Pavol Rusnak, SatoshiLabs
|
|
|
|
*
|
2016-05-28 12:37:32 +00:00
|
|
|
* Licensed under TREZOR License
|
|
|
|
* see LICENSE file for details
|
2016-04-04 18:48:48 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#include "py/nlr.h"
|
|
|
|
#include "py/runtime.h"
|
|
|
|
#include "py/binary.h"
|
|
|
|
|
|
|
|
#if MICROPY_PY_TREZORCRYPTO
|
|
|
|
|
2016-09-21 18:37:04 +00:00
|
|
|
#include "modtrezorcrypto-aes.h"
|
2016-10-06 12:00:57 +00:00
|
|
|
#include "modtrezorcrypto-bip32.h"
|
2016-05-13 18:33:14 +00:00
|
|
|
#include "modtrezorcrypto-bip39.h"
|
2016-11-01 16:31:24 +00:00
|
|
|
#include "modtrezorcrypto-blake2s.h"
|
2016-10-21 22:51:52 +00:00
|
|
|
#include "modtrezorcrypto-curve25519.h"
|
2016-04-27 00:36:59 +00:00
|
|
|
#include "modtrezorcrypto-ed25519.h"
|
2016-05-01 00:03:31 +00:00
|
|
|
#include "modtrezorcrypto-pbkdf2.h"
|
2016-06-01 15:48:32 +00:00
|
|
|
#include "modtrezorcrypto-random.h"
|
2016-04-15 17:44:26 +00:00
|
|
|
#include "modtrezorcrypto-ripemd160.h"
|
2016-04-27 11:53:37 +00:00
|
|
|
#include "modtrezorcrypto-nist256p1.h"
|
|
|
|
#include "modtrezorcrypto-secp256k1.h"
|
2016-04-15 17:44:26 +00:00
|
|
|
#include "modtrezorcrypto-sha256.h"
|
|
|
|
#include "modtrezorcrypto-sha512.h"
|
2016-04-20 17:40:08 +00:00
|
|
|
#include "modtrezorcrypto-sha3-256.h"
|
|
|
|
#include "modtrezorcrypto-sha3-512.h"
|
2016-05-30 15:10:05 +00:00
|
|
|
#include "modtrezorcrypto-ssss.h"
|
2016-04-04 18:48:48 +00:00
|
|
|
|
|
|
|
STATIC const mp_rom_map_elem_t mp_module_TrezorCrypto_globals_table[] = {
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_TrezorCrypto) },
|
2016-09-21 18:37:04 +00:00
|
|
|
{ MP_ROM_QSTR(MP_QSTR_AES), MP_ROM_PTR(&mod_TrezorCrypto_AES_type) },
|
2016-10-06 12:00:57 +00:00
|
|
|
{ MP_ROM_QSTR(MP_QSTR_Bip32), MP_ROM_PTR(&mod_TrezorCrypto_Bip32_type) },
|
2016-05-13 18:33:14 +00:00
|
|
|
{ MP_ROM_QSTR(MP_QSTR_Bip39), MP_ROM_PTR(&mod_TrezorCrypto_Bip39_type) },
|
2016-11-01 16:31:24 +00:00
|
|
|
{ MP_ROM_QSTR(MP_QSTR_Blake2s), MP_ROM_PTR(&mod_TrezorCrypto_Blake2s_type) },
|
2016-10-21 22:51:52 +00:00
|
|
|
{ MP_ROM_QSTR(MP_QSTR_Curve25519), MP_ROM_PTR(&mod_TrezorCrypto_Curve25519_type) },
|
2016-04-27 00:36:59 +00:00
|
|
|
{ MP_ROM_QSTR(MP_QSTR_Ed25519), MP_ROM_PTR(&mod_TrezorCrypto_Ed25519_type) },
|
2016-04-27 11:53:37 +00:00
|
|
|
{ MP_ROM_QSTR(MP_QSTR_Nist256p1), MP_ROM_PTR(&mod_TrezorCrypto_Nist256p1_type) },
|
2016-05-01 00:03:31 +00:00
|
|
|
{ MP_ROM_QSTR(MP_QSTR_Pbkdf2), MP_ROM_PTR(&mod_TrezorCrypto_Pbkdf2_type) },
|
2016-06-01 15:48:32 +00:00
|
|
|
{ MP_ROM_QSTR(MP_QSTR_Random), MP_ROM_PTR(&mod_TrezorCrypto_Random_type) },
|
2016-04-13 18:41:33 +00:00
|
|
|
{ MP_ROM_QSTR(MP_QSTR_Ripemd160), MP_ROM_PTR(&mod_TrezorCrypto_Ripemd160_type) },
|
2016-04-27 11:53:37 +00:00
|
|
|
{ MP_ROM_QSTR(MP_QSTR_Secp256k1), MP_ROM_PTR(&mod_TrezorCrypto_Secp256k1_type) },
|
2016-04-11 08:12:05 +00:00
|
|
|
{ MP_ROM_QSTR(MP_QSTR_Sha256), MP_ROM_PTR(&mod_TrezorCrypto_Sha256_type) },
|
2016-04-12 16:09:23 +00:00
|
|
|
{ MP_ROM_QSTR(MP_QSTR_Sha512), MP_ROM_PTR(&mod_TrezorCrypto_Sha512_type) },
|
2016-04-20 17:40:08 +00:00
|
|
|
{ MP_ROM_QSTR(MP_QSTR_Sha3_256), MP_ROM_PTR(&mod_TrezorCrypto_Sha3_256_type) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_Sha3_512), MP_ROM_PTR(&mod_TrezorCrypto_Sha3_512_type) },
|
2016-05-30 15:10:05 +00:00
|
|
|
{ MP_ROM_QSTR(MP_QSTR_SSSS), MP_ROM_PTR(&mod_TrezorCrypto_SSSS_type) },
|
2016-04-04 18:48:48 +00:00
|
|
|
};
|
|
|
|
STATIC MP_DEFINE_CONST_DICT(mp_module_TrezorCrypto_globals, mp_module_TrezorCrypto_globals_table);
|
|
|
|
|
|
|
|
const mp_obj_module_t mp_module_TrezorCrypto = {
|
|
|
|
.base = { &mp_type_module },
|
|
|
|
.globals = (mp_obj_dict_t*)&mp_module_TrezorCrypto_globals,
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // MICROPY_PY_TREZORCRYPTO
|