Lines Matching refs:data
16 void ossl_pw_clear_passphrase_data(struct ossl_passphrase_data_st *data) in ossl_pw_clear_passphrase_data() argument
18 if (data != NULL) { in ossl_pw_clear_passphrase_data()
19 if (data->type == is_expl_passphrase) in ossl_pw_clear_passphrase_data()
20 OPENSSL_clear_free(data->_.expl_passphrase.passphrase_copy, in ossl_pw_clear_passphrase_data()
21 data->_.expl_passphrase.passphrase_len); in ossl_pw_clear_passphrase_data()
22 ossl_pw_clear_passphrase_cache(data); in ossl_pw_clear_passphrase_data()
23 memset(data, 0, sizeof(*data)); in ossl_pw_clear_passphrase_data()
27 void ossl_pw_clear_passphrase_cache(struct ossl_passphrase_data_st *data) in ossl_pw_clear_passphrase_cache() argument
29 OPENSSL_clear_free(data->cached_passphrase, data->cached_passphrase_len); in ossl_pw_clear_passphrase_cache()
30 data->cached_passphrase = NULL; in ossl_pw_clear_passphrase_cache()
33 int ossl_pw_set_passphrase(struct ossl_passphrase_data_st *data, in ossl_pw_set_passphrase() argument
37 if (!ossl_assert(data != NULL && passphrase != NULL)) { in ossl_pw_set_passphrase()
41 ossl_pw_clear_passphrase_data(data); in ossl_pw_set_passphrase()
42 data->type = is_expl_passphrase; in ossl_pw_set_passphrase()
43 data->_.expl_passphrase.passphrase_copy = in ossl_pw_set_passphrase()
46 if (data->_.expl_passphrase.passphrase_copy == NULL) in ossl_pw_set_passphrase()
48 data->_.expl_passphrase.passphrase_len = passphrase_len; in ossl_pw_set_passphrase()
52 int ossl_pw_set_pem_password_cb(struct ossl_passphrase_data_st *data, in ossl_pw_set_pem_password_cb() argument
55 if (!ossl_assert(data != NULL && cb != NULL)) { in ossl_pw_set_pem_password_cb()
59 ossl_pw_clear_passphrase_data(data); in ossl_pw_set_pem_password_cb()
60 data->type = is_pem_password; in ossl_pw_set_pem_password_cb()
61 data->_.pem_password.password_cb = cb; in ossl_pw_set_pem_password_cb()
62 data->_.pem_password.password_cbarg = cbarg; in ossl_pw_set_pem_password_cb()
66 int ossl_pw_set_ossl_passphrase_cb(struct ossl_passphrase_data_st *data, in ossl_pw_set_ossl_passphrase_cb() argument
69 if (!ossl_assert(data != NULL && cb != NULL)) { in ossl_pw_set_ossl_passphrase_cb()
73 ossl_pw_clear_passphrase_data(data); in ossl_pw_set_ossl_passphrase_cb()
74 data->type = is_ossl_passphrase; in ossl_pw_set_ossl_passphrase_cb()
75 data->_.ossl_passphrase.passphrase_cb = cb; in ossl_pw_set_ossl_passphrase_cb()
76 data->_.ossl_passphrase.passphrase_cbarg = cbarg; in ossl_pw_set_ossl_passphrase_cb()
80 int ossl_pw_set_ui_method(struct ossl_passphrase_data_st *data, in ossl_pw_set_ui_method() argument
83 if (!ossl_assert(data != NULL && ui_method != NULL)) { in ossl_pw_set_ui_method()
87 ossl_pw_clear_passphrase_data(data); in ossl_pw_set_ui_method()
88 data->type = is_ui_method; in ossl_pw_set_ui_method()
89 data->_.ui_method.ui_method = ui_method; in ossl_pw_set_ui_method()
90 data->_.ui_method.ui_method_data = ui_data; in ossl_pw_set_ui_method()
94 int ossl_pw_enable_passphrase_caching(struct ossl_passphrase_data_st *data) in ossl_pw_enable_passphrase_caching() argument
96 data->flag_cache_passphrase = 1; in ossl_pw_enable_passphrase_caching()
100 int ossl_pw_disable_passphrase_caching(struct ossl_passphrase_data_st *data) in ossl_pw_disable_passphrase_caching() argument
102 data->flag_cache_passphrase = 0; in ossl_pw_disable_passphrase_caching()
206 struct ossl_passphrase_data_st *data) in ossl_pw_get_passphrase() argument
219 if (data->type == is_expl_passphrase) { in ossl_pw_get_passphrase()
220 source = data->_.expl_passphrase.passphrase_copy; in ossl_pw_get_passphrase()
221 source_len = data->_.expl_passphrase.passphrase_len; in ossl_pw_get_passphrase()
222 } else if (data->flag_cache_passphrase && data->cached_passphrase != NULL) { in ossl_pw_get_passphrase()
223 source = data->cached_passphrase; in ossl_pw_get_passphrase()
224 source_len = data->cached_passphrase_len; in ossl_pw_get_passphrase()
237 if (data->type == is_ossl_passphrase) { in ossl_pw_get_passphrase()
238 OSSL_PASSPHRASE_CALLBACK *cb = data->_.ossl_passphrase.passphrase_cb; in ossl_pw_get_passphrase()
239 void *cbarg = data->_.ossl_passphrase.passphrase_cbarg; in ossl_pw_get_passphrase()
254 prompt_info = p->data; in ossl_pw_get_passphrase()
257 if (data->type == is_pem_password) { in ossl_pw_get_passphrase()
259 pem_password_cb *cb = data->_.pem_password.password_cb; in ossl_pw_get_passphrase()
263 ui_data = data->_.pem_password.password_cbarg; in ossl_pw_get_passphrase()
269 } else if (data->type == is_ui_method) { in ossl_pw_get_passphrase()
270 ui_method = data->_.ui_method.ui_method; in ossl_pw_get_passphrase()
271 ui_data = data->_.ui_method.ui_method_data; in ossl_pw_get_passphrase()
286 if (ret && data->flag_cache_passphrase) { in ossl_pw_get_passphrase()
287 if (data->cached_passphrase == NULL in ossl_pw_get_passphrase()
288 || *pass_len > data->cached_passphrase_len) { in ossl_pw_get_passphrase()
290 OPENSSL_clear_realloc(data->cached_passphrase, in ossl_pw_get_passphrase()
291 data->cached_passphrase_len, in ossl_pw_get_passphrase()
298 data->cached_passphrase = new_cache; in ossl_pw_get_passphrase()
300 memcpy(data->cached_passphrase, pass, *pass_len); in ossl_pw_get_passphrase()
301 data->cached_passphrase[*pass_len] = '\0'; in ossl_pw_get_passphrase()
302 data->cached_passphrase_len = *pass_len; in ossl_pw_get_passphrase()
317 params[0].data = (void *)info; in ossl_pw_get_password()