1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
/*
* Copyright 2024 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
*/
#include <openssl/indicator.h>
#include <openssl/core_names.h>
#include <openssl/params.h>
#include "internal/cryptlib.h"
#include "crypto/context.h"
typedef struct indicator_cb_st
{
OSSL_INDICATOR_CALLBACK *cb;
} INDICATOR_CB;
void *ossl_indicator_set_callback_new(OSSL_LIB_CTX *ctx)
{
INDICATOR_CB *cb;
cb = OPENSSL_zalloc(sizeof(*cb));
return cb;
}
void ossl_indicator_set_callback_free(void *cb)
{
OPENSSL_free(cb);
}
static INDICATOR_CB *get_indicator_callback(OSSL_LIB_CTX *libctx)
{
return ossl_lib_ctx_get_data(libctx, OSSL_LIB_CTX_INDICATOR_CB_INDEX);
}
void OSSL_INDICATOR_set_callback(OSSL_LIB_CTX *libctx,
OSSL_INDICATOR_CALLBACK *cb)
{
INDICATOR_CB *icb = get_indicator_callback(libctx);
if (icb != NULL)
icb->cb = cb;
}
void OSSL_INDICATOR_get_callback(OSSL_LIB_CTX *libctx,
OSSL_INDICATOR_CALLBACK **cb)
{
INDICATOR_CB *icb = get_indicator_callback(libctx);
if (cb != NULL)
*cb = (icb != NULL ? icb->cb : NULL);
}
|