mirror of
https://github.com/openssl/openssl.git
synced 2025-01-24 13:55:42 +08:00
32d3c3abf3
The most expensive part of using a PKEY decoder is the OSSL_DECODER_CTX_new_for_pkey() call. This builds up all of the decoder chains, which is a complex and time consuming operation. However, if no new providers have been loaded/unloaded since the last time it was called we can expect the same results for the same parameters. Note that this operation takes place *before* we event parse the data for decoding so it is not dependent on the parsed data at all. We introduce a cache for OSSL_DECODER_CTX objects. If we have been called with the same parameters then we just duplicate an existing OSSL_DECODER_CTX. This should be significantly faster than creating a new one every time. Partially addressed the issue in #15199 Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21426)
19 lines
565 B
C
19 lines
565 B
C
/*
|
|
* Copyright 2023 The OpenSSL Project Authors. All Rights Reserved.
|
|
*
|
|
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
|
* this file except in compliance with the License. You can obtain a copy
|
|
* in the file LICENSE in the source distribution or at
|
|
* https://www.openssl.org/source/license.html
|
|
*/
|
|
|
|
#ifndef OSSL_INTERNAL_DECODER_H
|
|
# define OSSL_INTERNAL_DECODER_H
|
|
# pragma once
|
|
|
|
void *ossl_decoder_cache_new(OSSL_LIB_CTX *ctx);
|
|
void ossl_decoder_cache_free(void *vcache);
|
|
int ossl_decoder_cache_flush(OSSL_LIB_CTX *libctx);
|
|
|
|
#endif
|