static int ui_read(UI *ui, UI_STRING *uis)
{
    switch (UI_get_string_type(uis)) {
    case UIT_PROMPT:
        {
            char result[PEM_BUFSIZE];
            const struct pem_password_cb_data *data =
                UI_method_get_ex_data(UI_get_method(ui),
                                      ui_method_data_index());
            int maxsize = UI_get_result_maxsize(uis);
            int len = data->cb(result,
                               maxsize > PEM_BUFSIZE ? PEM_BUFSIZE : maxsize,
                               data->rwflag, UI_get0_user_data(ui));
            if (len <= 0)
                return len;
            if (UI_set_result(ui, uis, result) >= 0)
                return 1;
            return 0;
        }
    case UIT_VERIFY:
    case UIT_NONE:
    case UIT_BOOLEAN:
    case UIT_INFO:
    case UIT_ERROR:
        break;
    }
    return 1;
}
['static int ui_read(UI *ui, UI_STRING *uis)\n{\n    switch (UI_get_string_type(uis)) {\n    case UIT_PROMPT:\n        {\n            char result[PEM_BUFSIZE];\n            const struct pem_password_cb_data *data =\n                UI_method_get_ex_data(UI_get_method(ui),\n                                      ui_method_data_index());\n            int maxsize = UI_get_result_maxsize(uis);\n            int len = data->cb(result,\n                               maxsize > PEM_BUFSIZE ? PEM_BUFSIZE : maxsize,\n                               data->rwflag, UI_get0_user_data(ui));\n            if (len <= 0)\n                return len;\n            if (UI_set_result(ui, uis, result) >= 0)\n                return 1;\n            return 0;\n        }\n    case UIT_VERIFY:\n    case UIT_NONE:\n    case UIT_BOOLEAN:\n    case UIT_INFO:\n    case UIT_ERROR:\n        break;\n    }\n    return 1;\n}', 'enum UI_string_types UI_get_string_type(UI_STRING *uis)\n{\n    return uis->type;\n}', 'const UI_METHOD *UI_get_method(UI *ui)\n{\n    return ui->meth;\n}', 'static int ui_method_data_index()\n{\n    static int idx = -1;\n    if (idx == -1)\n        idx = CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_UI_METHOD,\n                                      0, NULL,\n                                      ui_new_method_data,\n                                      ui_dup_method_data,\n                                      ui_free_method_data);\n    return idx;\n}', 'const void *UI_method_get_ex_data(const UI_METHOD *method, int idx)\n{\n    return CRYPTO_get_ex_data(&method->ex_data, idx);\n}', 'void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx)\n{\n    if (ad->sk == NULL || idx >= sk_void_num(ad->sk))\n        return NULL;\n    return sk_void_value(ad->sk, idx);\n}', 'int UI_get_result_maxsize(UI_STRING *uis)\n{\n    switch (uis->type) {\n    case UIT_PROMPT:\n    case UIT_VERIFY:\n        return uis->_.string_data.result_maxsize;\n    case UIT_NONE:\n    case UIT_INFO:\n    case UIT_ERROR:\n    case UIT_BOOLEAN:\n        break;\n    }\n    return -1;\n}']