2016-04-04 18:48:48 +00:00
|
|
|
/*
|
2018-02-26 13:06:10 +00:00
|
|
|
* This file is part of the TREZOR project, https://trezor.io/
|
2016-04-04 18:48:48 +00:00
|
|
|
*
|
2018-02-26 13:06:10 +00:00
|
|
|
* Copyright (c) SatoshiLabs
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2016-04-04 18:48:48 +00:00
|
|
|
*/
|
|
|
|
|
2019-03-29 15:26:02 +00:00
|
|
|
#include <stdint.h>
|
2016-04-04 18:48:48 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "py/runtime.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"
|
2017-12-13 19:47:12 +00:00
|
|
|
#include "modtrezorcrypto-blake256.h"
|
2017-02-28 17:44:33 +00:00
|
|
|
#include "modtrezorcrypto-blake2b.h"
|
2016-11-01 16:31:24 +00:00
|
|
|
#include "modtrezorcrypto-blake2s.h"
|
2018-01-02 17:57:23 +00:00
|
|
|
#include "modtrezorcrypto-chacha20poly1305.h"
|
2017-12-19 20:54:22 +00:00
|
|
|
#include "modtrezorcrypto-crc.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"
|
2018-06-30 22:15:01 +00:00
|
|
|
#include "modtrezorcrypto-groestl.h"
|
2019-03-29 15:26:02 +00:00
|
|
|
#include "modtrezorcrypto-monero.h"
|
2018-03-12 12:21:41 +00:00
|
|
|
#include "modtrezorcrypto-nem.h"
|
2019-03-29 15:26:02 +00:00
|
|
|
#include "modtrezorcrypto-nist256p1.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"
|
2017-04-03 19:29:52 +00:00
|
|
|
#include "modtrezorcrypto-rfc6979.h"
|
2016-04-15 17:44:26 +00:00
|
|
|
#include "modtrezorcrypto-ripemd160.h"
|
2016-04-27 11:53:37 +00:00
|
|
|
#include "modtrezorcrypto-secp256k1.h"
|
2016-11-05 14:26:28 +00:00
|
|
|
#include "modtrezorcrypto-sha1.h"
|
2016-04-15 17:44:26 +00:00
|
|
|
#include "modtrezorcrypto-sha256.h"
|
2016-04-20 17:40:08 +00:00
|
|
|
#include "modtrezorcrypto-sha3-256.h"
|
|
|
|
#include "modtrezorcrypto-sha3-512.h"
|
2019-03-29 15:26:02 +00:00
|
|
|
#include "modtrezorcrypto-sha512.h"
|
2019-04-12 09:41:32 +00:00
|
|
|
#include "modtrezorcrypto-shamir.h"
|
2016-04-04 18:48:48 +00:00
|
|
|
|
2017-06-14 16:47:38 +00:00
|
|
|
STATIC const mp_rom_map_elem_t mp_module_trezorcrypto_globals_table[] = {
|
2019-03-29 15:26:02 +00:00
|
|
|
{MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_trezorcrypto)},
|
|
|
|
{MP_ROM_QSTR(MP_QSTR_aes), MP_ROM_PTR(&mod_trezorcrypto_AES_type)},
|
|
|
|
{MP_ROM_QSTR(MP_QSTR_bip32), MP_ROM_PTR(&mod_trezorcrypto_bip32_module)},
|
|
|
|
{MP_ROM_QSTR(MP_QSTR_bip39), MP_ROM_PTR(&mod_trezorcrypto_bip39_module)},
|
|
|
|
{MP_ROM_QSTR(MP_QSTR_blake256),
|
|
|
|
MP_ROM_PTR(&mod_trezorcrypto_Blake256_type)},
|
|
|
|
{MP_ROM_QSTR(MP_QSTR_blake2b), MP_ROM_PTR(&mod_trezorcrypto_Blake2b_type)},
|
|
|
|
{MP_ROM_QSTR(MP_QSTR_blake2s), MP_ROM_PTR(&mod_trezorcrypto_Blake2s_type)},
|
|
|
|
{MP_ROM_QSTR(MP_QSTR_chacha20poly1305),
|
|
|
|
MP_ROM_PTR(&mod_trezorcrypto_ChaCha20Poly1305_type)},
|
|
|
|
{MP_ROM_QSTR(MP_QSTR_crc), MP_ROM_PTR(&mod_trezorcrypto_crc_module)},
|
|
|
|
{MP_ROM_QSTR(MP_QSTR_curve25519),
|
|
|
|
MP_ROM_PTR(&mod_trezorcrypto_curve25519_module)},
|
|
|
|
{MP_ROM_QSTR(MP_QSTR_ed25519),
|
|
|
|
MP_ROM_PTR(&mod_trezorcrypto_ed25519_module)},
|
|
|
|
{MP_ROM_QSTR(MP_QSTR_monero), MP_ROM_PTR(&mod_trezorcrypto_monero_module)},
|
|
|
|
{MP_ROM_QSTR(MP_QSTR_nist256p1),
|
|
|
|
MP_ROM_PTR(&mod_trezorcrypto_nist256p1_module)},
|
|
|
|
{MP_ROM_QSTR(MP_QSTR_groestl512),
|
|
|
|
MP_ROM_PTR(&mod_trezorcrypto_Groestl512_type)},
|
|
|
|
{MP_ROM_QSTR(MP_QSTR_nem), MP_ROM_PTR(&mod_trezorcrypto_nem_module)},
|
|
|
|
{MP_ROM_QSTR(MP_QSTR_pbkdf2), MP_ROM_PTR(&mod_trezorcrypto_Pbkdf2_type)},
|
|
|
|
{MP_ROM_QSTR(MP_QSTR_random), MP_ROM_PTR(&mod_trezorcrypto_random_module)},
|
|
|
|
{MP_ROM_QSTR(MP_QSTR_rfc6979), MP_ROM_PTR(&mod_trezorcrypto_Rfc6979_type)},
|
|
|
|
{MP_ROM_QSTR(MP_QSTR_ripemd160),
|
|
|
|
MP_ROM_PTR(&mod_trezorcrypto_Ripemd160_type)},
|
|
|
|
{MP_ROM_QSTR(MP_QSTR_secp256k1),
|
|
|
|
MP_ROM_PTR(&mod_trezorcrypto_secp256k1_module)},
|
|
|
|
{MP_ROM_QSTR(MP_QSTR_sha1), MP_ROM_PTR(&mod_trezorcrypto_Sha1_type)},
|
|
|
|
{MP_ROM_QSTR(MP_QSTR_sha256), MP_ROM_PTR(&mod_trezorcrypto_Sha256_type)},
|
|
|
|
{MP_ROM_QSTR(MP_QSTR_sha512), MP_ROM_PTR(&mod_trezorcrypto_Sha512_type)},
|
|
|
|
{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)},
|
2019-04-12 09:41:32 +00:00
|
|
|
{MP_ROM_QSTR(MP_QSTR_shamir), MP_ROM_PTR(&mod_trezorcrypto_shamir_module)},
|
2016-04-04 18:48:48 +00:00
|
|
|
};
|
2019-03-29 15:26:02 +00:00
|
|
|
STATIC MP_DEFINE_CONST_DICT(mp_module_trezorcrypto_globals,
|
|
|
|
mp_module_trezorcrypto_globals_table);
|
2016-04-04 18:48:48 +00:00
|
|
|
|
2017-06-14 16:47:38 +00:00
|
|
|
const mp_obj_module_t mp_module_trezorcrypto = {
|
2019-03-29 15:26:02 +00:00
|
|
|
.base = {&mp_type_module},
|
2017-06-14 16:47:38 +00:00
|
|
|
.globals = (mp_obj_dict_t*)&mp_module_trezorcrypto_globals,
|
2016-04-04 18:48:48 +00:00
|
|
|
};
|
|
|
|
|
2019-03-29 15:26:02 +00:00
|
|
|
#endif // MICROPY_PY_TREZORCRYPTO
|