1/*
2 * Copyright 2020-2022 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 OSSL_CRYPTO_DECODER_H
11# define OSSL_CRYPTO_DECODER_H
12# pragma once
13
14# include <openssl/decoder.h>
15
16OSSL_DECODER *ossl_decoder_fetch_by_number(OSSL_LIB_CTX *libctx,
17                                                     int id,
18                                                     const char *properties);
19
20/*
21 * These are specially made for the 'file:' provider-native loader, which
22 * uses this to install a DER to anything decoder, which doesn't do much
23 * except read a DER blob and pass it on as a provider object abstraction
24 * (provider-object(7)).
25 */
26void *ossl_decoder_from_algorithm(int id, const OSSL_ALGORITHM *algodef,
27                                  OSSL_PROVIDER *prov);
28
29OSSL_DECODER_INSTANCE *
30ossl_decoder_instance_new(OSSL_DECODER *decoder, void *decoderctx);
31void ossl_decoder_instance_free(OSSL_DECODER_INSTANCE *decoder_inst);
32int ossl_decoder_ctx_add_decoder_inst(OSSL_DECODER_CTX *ctx,
33                                      OSSL_DECODER_INSTANCE *di);
34
35int ossl_decoder_ctx_setup_for_pkey(OSSL_DECODER_CTX *ctx,
36                                    EVP_PKEY **pkey, const char *keytype,
37                                    OSSL_LIB_CTX *libctx,
38                                    const char *propquery);
39
40int ossl_decoder_get_number(const OSSL_DECODER *encoder);
41int ossl_decoder_store_cache_flush(OSSL_LIB_CTX *libctx);
42int ossl_decoder_store_remove_all_provided(const OSSL_PROVIDER *prov);
43
44#endif
45