示例#1
0
PyMODINIT_FUNC
init_pycryptopp(void) {
    PyObject *module;

    module = Py_InitModule3("_pycryptopp", _pycryptopp_functions, _pycryptopp__doc__);
    if (!module)
      return;

    PyObject* version;

    /* a tuple of (Crypto++ version, extra-version) */
    #ifndef DISABLE_EMBEDDED_CRYPTOPP
    /* In the version of Crypto++ which is included in pycryptopp, there is a
       symbol named `cryptopp_extra_version' which is declared (external
       variable) in config.h and defined in cryptlib.cpp. Of course it is
       possible that the header file we've #include'd is from the
       embedded-in-pycryptopp version of Crypto++ but the dynamically linked
       library that we load is from an older version which doesn't have this
       symbol. In that case, the load will fail before we get this far. */
    version = Py_BuildValue("is", CRYPTOPP_VERSION, cryptopp_extra_version);
    #else
    version = Py_BuildValue("iO", CRYPTOPP_VERSION, Py_None);
    #endif

    int succ = PyModule_AddObject(module, "cryptopp_version", version);
    if (succ != 0)
        return;


    init_ecdsa(module);
    init_rsa(module);
    init_sha256(module);
    init_aes(module);
    init_xsalsa20(module);
}
示例#2
0
文件: asic.c 项目: zyh329/CEmu
static void plug_devices(void) {
    /* Port ranges 0x0 -> 0xF */
    port_map[0x0] = init_control();
    port_map[0x1] = init_flash();
    port_map[0x2] = init_sha256();
    port_map[0x3] = init_usb();
    port_map[0x4] = init_lcd();
    port_map[0x5] = init_intrpt();
    port_map[0x6] = init_watchdog();
    port_map[0x7] = init_gpt();
    port_map[0x8] = init_rtc();
    port_map[0x9] = init_protected();
    port_map[0xA] = init_keypad();
    port_map[0xB] = init_backlight();
    port_map[0xC] = init_cxxx();
    port_map[0xD] = init_dxxx();
    port_map[0xE] = init_exxx();
    port_map[0xF] = init_fxxx();

    reset_proc_count = 0;

    /* Populate reset callbacks */
    add_reset_proc(lcd_reset);
    add_reset_proc(keypad_reset);
    add_reset_proc(gpt_reset);
    add_reset_proc(rtc_reset);
    add_reset_proc(watchdog_reset);
    add_reset_proc(cpu_reset);

    gui_console_printf("[CEmu] Initialized APB...\n");
}