Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:05:41

0001 /*
0002  * Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.
0003  *
0004  * Licensed under the Apache License 2.0 (the "License").  You may not use
0005  * this file except in compliance with the License.  You can obtain a copy
0006  * in the file LICENSE in the source distribution or at
0007  * https://www.openssl.org/source/license.html
0008  */
0009 
0010 #ifndef OPENSSL_DECODER_H
0011 # define OPENSSL_DECODER_H
0012 # pragma once
0013 
0014 # include <openssl/opensslconf.h>
0015 
0016 # ifndef OPENSSL_NO_STDIO
0017 #  include <stdio.h>
0018 # endif
0019 # include <stdarg.h>
0020 # include <stddef.h>
0021 # include <openssl/decodererr.h>
0022 # include <openssl/types.h>
0023 # include <openssl/core.h>
0024 
0025 # ifdef __cplusplus
0026 extern "C" {
0027 # endif
0028 
0029 OSSL_DECODER *OSSL_DECODER_fetch(OSSL_LIB_CTX *libctx, const char *name,
0030                                  const char *properties);
0031 int OSSL_DECODER_up_ref(OSSL_DECODER *encoder);
0032 void OSSL_DECODER_free(OSSL_DECODER *encoder);
0033 
0034 const OSSL_PROVIDER *OSSL_DECODER_get0_provider(const OSSL_DECODER *encoder);
0035 const char *OSSL_DECODER_get0_properties(const OSSL_DECODER *encoder);
0036 const char *OSSL_DECODER_get0_name(const OSSL_DECODER *decoder);
0037 const char *OSSL_DECODER_get0_description(const OSSL_DECODER *decoder);
0038 int OSSL_DECODER_is_a(const OSSL_DECODER *encoder, const char *name);
0039 
0040 void OSSL_DECODER_do_all_provided(OSSL_LIB_CTX *libctx,
0041                                   void (*fn)(OSSL_DECODER *encoder, void *arg),
0042                                   void *arg);
0043 int OSSL_DECODER_names_do_all(const OSSL_DECODER *encoder,
0044                               void (*fn)(const char *name, void *data),
0045                               void *data);
0046 const OSSL_PARAM *OSSL_DECODER_gettable_params(OSSL_DECODER *decoder);
0047 int OSSL_DECODER_get_params(OSSL_DECODER *decoder, OSSL_PARAM params[]);
0048 
0049 const OSSL_PARAM *OSSL_DECODER_settable_ctx_params(OSSL_DECODER *encoder);
0050 OSSL_DECODER_CTX *OSSL_DECODER_CTX_new(void);
0051 int OSSL_DECODER_CTX_set_params(OSSL_DECODER_CTX *ctx,
0052                                 const OSSL_PARAM params[]);
0053 void OSSL_DECODER_CTX_free(OSSL_DECODER_CTX *ctx);
0054 
0055 /* Utilities that help set specific parameters */
0056 int OSSL_DECODER_CTX_set_passphrase(OSSL_DECODER_CTX *ctx,
0057                                     const unsigned char *kstr, size_t klen);
0058 int OSSL_DECODER_CTX_set_pem_password_cb(OSSL_DECODER_CTX *ctx,
0059                                          pem_password_cb *cb, void *cbarg);
0060 int OSSL_DECODER_CTX_set_passphrase_cb(OSSL_DECODER_CTX *ctx,
0061                                        OSSL_PASSPHRASE_CALLBACK *cb,
0062                                        void *cbarg);
0063 int OSSL_DECODER_CTX_set_passphrase_ui(OSSL_DECODER_CTX *ctx,
0064                                        const UI_METHOD *ui_method,
0065                                        void *ui_data);
0066 
0067 /*
0068  * Utilities to read the object to decode, with the result sent to cb.
0069  * These will discover all provided methods
0070  */
0071 
0072 int OSSL_DECODER_CTX_set_selection(OSSL_DECODER_CTX *ctx, int selection);
0073 int OSSL_DECODER_CTX_set_input_type(OSSL_DECODER_CTX *ctx,
0074                                     const char *input_type);
0075 int OSSL_DECODER_CTX_set_input_structure(OSSL_DECODER_CTX *ctx,
0076                                          const char *input_structure);
0077 int OSSL_DECODER_CTX_add_decoder(OSSL_DECODER_CTX *ctx, OSSL_DECODER *decoder);
0078 int OSSL_DECODER_CTX_add_extra(OSSL_DECODER_CTX *ctx,
0079                                OSSL_LIB_CTX *libctx, const char *propq);
0080 int OSSL_DECODER_CTX_get_num_decoders(OSSL_DECODER_CTX *ctx);
0081 
0082 typedef struct ossl_decoder_instance_st OSSL_DECODER_INSTANCE;
0083 OSSL_DECODER *
0084 OSSL_DECODER_INSTANCE_get_decoder(OSSL_DECODER_INSTANCE *decoder_inst);
0085 void *
0086 OSSL_DECODER_INSTANCE_get_decoder_ctx(OSSL_DECODER_INSTANCE *decoder_inst);
0087 const char *
0088 OSSL_DECODER_INSTANCE_get_input_type(OSSL_DECODER_INSTANCE *decoder_inst);
0089 const char *
0090 OSSL_DECODER_INSTANCE_get_input_structure(OSSL_DECODER_INSTANCE *decoder_inst,
0091                                           int *was_set);
0092 
0093 typedef int OSSL_DECODER_CONSTRUCT(OSSL_DECODER_INSTANCE *decoder_inst,
0094                                    const OSSL_PARAM *params,
0095                                    void *construct_data);
0096 typedef void OSSL_DECODER_CLEANUP(void *construct_data);
0097 
0098 int OSSL_DECODER_CTX_set_construct(OSSL_DECODER_CTX *ctx,
0099                                    OSSL_DECODER_CONSTRUCT *construct);
0100 int OSSL_DECODER_CTX_set_construct_data(OSSL_DECODER_CTX *ctx,
0101                                         void *construct_data);
0102 int OSSL_DECODER_CTX_set_cleanup(OSSL_DECODER_CTX *ctx,
0103                                  OSSL_DECODER_CLEANUP *cleanup);
0104 OSSL_DECODER_CONSTRUCT *OSSL_DECODER_CTX_get_construct(OSSL_DECODER_CTX *ctx);
0105 void *OSSL_DECODER_CTX_get_construct_data(OSSL_DECODER_CTX *ctx);
0106 OSSL_DECODER_CLEANUP *OSSL_DECODER_CTX_get_cleanup(OSSL_DECODER_CTX *ctx);
0107 
0108 int OSSL_DECODER_export(OSSL_DECODER_INSTANCE *decoder_inst,
0109                         void *reference, size_t reference_sz,
0110                         OSSL_CALLBACK *export_cb, void *export_cbarg);
0111 
0112 int OSSL_DECODER_from_bio(OSSL_DECODER_CTX *ctx, BIO *in);
0113 #ifndef OPENSSL_NO_STDIO
0114 int OSSL_DECODER_from_fp(OSSL_DECODER_CTX *ctx, FILE *in);
0115 #endif
0116 int OSSL_DECODER_from_data(OSSL_DECODER_CTX *ctx, const unsigned char **pdata,
0117                            size_t *pdata_len);
0118 
0119 /*
0120  * Create the OSSL_DECODER_CTX with an associated type.  This will perform
0121  * an implicit OSSL_DECODER_fetch(), suitable for the object of that type.
0122  */
0123 OSSL_DECODER_CTX *
0124 OSSL_DECODER_CTX_new_for_pkey(EVP_PKEY **pkey,
0125                               const char *input_type,
0126                               const char *input_struct,
0127                               const char *keytype, int selection,
0128                               OSSL_LIB_CTX *libctx, const char *propquery);
0129 
0130 # ifdef __cplusplus
0131 }
0132 # endif
0133 #endif