/* * Copyright 2021 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 #include #include #include #include #include #include #include "testutil.h" static int dummy_decoder_decode(void *ctx, OSSL_CORE_BIO *cin, int selection, OSSL_CALLBACK *object_cb, void *object_cbarg, OSSL_PASSPHRASE_CALLBACK *pw_cb, void *pw_cbarg) { return 0; } static const OSSL_DISPATCH dummy_decoder_functions[] = { { OSSL_FUNC_DECODER_DECODE, (void (*)(void))dummy_decoder_decode }, { 0, NULL } }; static const OSSL_ALGORITHM dummy_decoders[] = { { "DUMMY", "provider=dummy,input=pem", dummy_decoder_functions }, { NULL, NULL, NULL } }; static int dummy_encoder_encode(void *ctx, OSSL_CORE_BIO *out, const void *obj_raw, const OSSL_PARAM obj_abstract[], int selection, OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg) { return 0; } static const OSSL_DISPATCH dummy_encoder_functions[] = { { OSSL_FUNC_DECODER_DECODE, (void (*)(void))dummy_encoder_encode }, { 0, NULL } }; static const OSSL_ALGORITHM dummy_encoders[] = { { "DUMMY", "provider=dummy,output=pem", dummy_encoder_functions }, { NULL, NULL, NULL } }; static void *dummy_store_open(void *provctx, const char *uri) { return NULL; } static int dummy_store_load(void *loaderctx, OSSL_CALLBACK *object_cb, void *object_cbarg, OSSL_PASSPHRASE_CALLBACK *pw_cb, void *pw_cbarg) { return 0; } static int dumm_store_eof(void *loaderctx) { return 0; } static int dummy_store_close(void *loaderctx) { return 0; } static const OSSL_DISPATCH dummy_store_functions[] = { { OSSL_FUNC_STORE_OPEN, (void (*)(void))dummy_store_open }, { OSSL_FUNC_STORE_LOAD, (void (*)(void))dummy_store_load }, { OSSL_FUNC_STORE_EOF, (void (*)(void))dumm_store_eof }, { OSSL_FUNC_STORE_CLOSE, (void (*)(void))dummy_store_close }, { 0, NULL } }; static const OSSL_ALGORITHM dummy_store[] = { { "DUMMY", "provider=dummy", dummy_store_functions }, { NULL, NULL, NULL } }; static void *dummy_rand_newctx(void *provctx, void *parent, const OSSL_DISPATCH *parent_calls) { return provctx; } static void dummy_rand_freectx(void *vctx) { } static int dummy_rand_instantiate(void *vdrbg, unsigned int strength, int prediction_resistance, const unsigned char *pstr, size_t pstr_len, const OSSL_PARAM params[]) { return 1; } static int dummy_rand_uninstantiate(void *vdrbg) { return 1; } static int dummy_rand_generate(void *vctx, unsigned char *out, size_t outlen, unsigned int strength, int prediction_resistance, const unsigned char *addin, size_t addin_len) { size_t i; for (i = 0; i