]> git.ipfire.org Git - thirdparty/openssl.git/blame - include/openssl/deserializer.h
SERIALIZER: No enc argument for OSSL_SERIALIZER_CTX_set_passphrase_cb()
[thirdparty/openssl.git] / include / openssl / deserializer.h
CommitLineData
c3e4c1f3
RL
1/*
2 * Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.
3 *
4 * Licensed under the Apache License 2.0 (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
8 */
9
10#ifndef OPENSSL_DESERIALIZER_H
11# define OPENSSL_DESERIALIZER_H
12# pragma once
13
14# include <openssl/opensslconf.h>
15
16# ifndef OPENSSL_NO_STDIO
17# include <stdio.h>
18# endif
19# include <stdarg.h>
20# include <stddef.h>
21# include <openssl/deserializererr.h>
22# include <openssl/types.h>
23# include <openssl/core.h>
24
25# ifdef __cplusplus
26extern "C" {
27# endif
28
29OSSL_DESERIALIZER *OSSL_DESERIALIZER_fetch(OPENSSL_CTX *libctx,
30 const char *name,
31 const char *properties);
32int OSSL_DESERIALIZER_up_ref(OSSL_DESERIALIZER *ser);
33void OSSL_DESERIALIZER_free(OSSL_DESERIALIZER *ser);
34
35const OSSL_PROVIDER *OSSL_DESERIALIZER_provider(const OSSL_DESERIALIZER *ser);
36const char *OSSL_DESERIALIZER_properties(const OSSL_DESERIALIZER *ser);
37int OSSL_DESERIALIZER_number(const OSSL_DESERIALIZER *ser);
38int OSSL_DESERIALIZER_is_a(const OSSL_DESERIALIZER *ser,
39 const char *name);
40
41void OSSL_DESERIALIZER_do_all_provided(OPENSSL_CTX *libctx,
42 void (*fn)(OSSL_DESERIALIZER *ser,
43 void *arg),
44 void *arg);
45void OSSL_DESERIALIZER_names_do_all(const OSSL_DESERIALIZER *ser,
46 void (*fn)(const char *name, void *data),
47 void *data);
48const OSSL_PARAM *OSSL_DESERIALIZER_gettable_params(OSSL_DESERIALIZER *deser);
49int OSSL_DESERIALIZER_get_params(OSSL_DESERIALIZER *deser, OSSL_PARAM params[]);
50
51const OSSL_PARAM *OSSL_DESERIALIZER_settable_ctx_params(OSSL_DESERIALIZER *ser);
52OSSL_DESERIALIZER_CTX *OSSL_DESERIALIZER_CTX_new(void);
53int OSSL_DESERIALIZER_CTX_set_params(OSSL_DESERIALIZER_CTX *ctx,
54 const OSSL_PARAM params[]);
55void OSSL_DESERIALIZER_CTX_free(OSSL_DESERIALIZER_CTX *ctx);
56
57/* Utilities that help set specific parameters */
58int OSSL_DESERIALIZER_CTX_set_cipher(OSSL_DESERIALIZER_CTX *ctx,
59 const char *cipher_name,
60 const char *propquery);
61int OSSL_DESERIALIZER_CTX_set_passphrase(OSSL_DESERIALIZER_CTX *ctx,
62 const unsigned char *kstr,
63 size_t klen);
45396db0 64int OSSL_DESERIALIZER_CTX_set_passphrase_cb(OSSL_DESERIALIZER_CTX *ctx,
c3e4c1f3
RL
65 pem_password_cb *cb, void *cbarg);
66int OSSL_DESERIALIZER_CTX_set_passphrase_ui(OSSL_DESERIALIZER_CTX *ctx,
67 const UI_METHOD *ui_method,
68 void *ui_data);
69
70/*
71 * Utilities to read the object to deserialize, with the result sent to cb.
72 * These will discover all provided methods
73 */
74
75int OSSL_DESERIALIZER_CTX_set_input_type(OSSL_DESERIALIZER_CTX *ctx,
76 const char *input_type);
77int OSSL_DESERIALIZER_CTX_add_deserializer(OSSL_DESERIALIZER_CTX *ctx,
78 OSSL_DESERIALIZER *deser);
79int OSSL_DESERIALIZER_CTX_add_extra(OSSL_DESERIALIZER_CTX *ctx,
80 OPENSSL_CTX *libctx, const char *propq);
81int OSSL_DESERIALIZER_CTX_num_deserializers(OSSL_DESERIALIZER_CTX *ctx);
82
83typedef struct ossl_deserializer_instance_st OSSL_DESERIALIZER_INSTANCE;
84typedef int (OSSL_DESERIALIZER_FINALIZER)
85 (OSSL_DESERIALIZER_INSTANCE *deser_inst,
86 const OSSL_PARAM *params, void *finalize_arg);
87typedef void (OSSL_DESERIALIZER_CLEANER)(void *finalize_arg);
88
89int OSSL_DESERIALIZER_CTX_set_finalizer(OSSL_DESERIALIZER_CTX *ctx,
90 OSSL_DESERIALIZER_FINALIZER *finalizer,
91 OSSL_DESERIALIZER_CLEANER *cleaner,
92 void *finalize_arg);
93
94int OSSL_DESERIALIZER_export(OSSL_DESERIALIZER_INSTANCE *deser_inst,
95 void *reference, size_t reference_sz,
96 OSSL_CALLBACK *export_cb, void *export_cbarg);
97
98OSSL_DESERIALIZER *OSSL_DESERIALIZER_INSTANCE_deserializer
99 (OSSL_DESERIALIZER_INSTANCE *deser_inst);
100void *OSSL_DESERIALIZER_INSTANCE_deserializer_ctx
101 (OSSL_DESERIALIZER_INSTANCE *deser_inst);
102
103int OSSL_DESERIALIZER_from_bio(OSSL_DESERIALIZER_CTX *ctx, BIO *in);
104#ifndef OPENSSL_NO_STDIO
105int OSSL_DESERIALIZER_from_fp(OSSL_DESERIALIZER_CTX *ctx, FILE *in);
106#endif
107
072a9fde
RL
108/*
109 * Create the OSSL_DESERIALIZER_CTX with an associated type. This will perform
110 * an implicit OSSL_DESERIALIZER_fetch(), suitable for the object of that type.
111 */
112OSSL_DESERIALIZER_CTX *
113OSSL_DESERIALIZER_CTX_new_by_EVP_PKEY(EVP_PKEY **pkey, const char *input_type,
114 OPENSSL_CTX *libctx,
115 const char *propquery);
116
c3e4c1f3
RL
117# ifdef __cplusplus
118}
119# endif
120#endif