1 1.1 christos /* 2 1.1 christos * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved. 3 1.1 christos * 4 1.1 christos * Licensed under the Apache License 2.0 (the "License"). You may not use 5 1.1 christos * this file except in compliance with the License. You can obtain a copy 6 1.1 christos * in the file LICENSE in the source distribution or at 7 1.1 christos * https://www.openssl.org/source/license.html 8 1.1 christos */ 9 1.1 christos 10 1.1 christos #include <stdlib.h> 11 1.1 christos #include "apps.h" 12 1.1 christos #include "../testutil.h" 13 1.1 christos 14 1.1 christos /* shim that avoids sucking in too much from apps/apps.c */ 15 1.1 christos 16 1.1 christos void *app_malloc(size_t sz, const char *what) 17 1.1 christos { 18 1.1 christos void *vp; 19 1.1 christos 20 1.1 christos /* 21 1.1 christos * This isn't ideal but it is what the app's app_malloc() does on failure. 22 1.1 christos * Instead of exiting with a failure, abort() is called which makes sure 23 1.1 christos * that there will be a good stack trace for debugging purposes. 24 1.1 christos */ 25 1.1 christos if (!TEST_ptr(vp = OPENSSL_malloc(sz))) { 26 1.1 christos TEST_info("Could not allocate %zu bytes for %s\n", sz, what); 27 1.1 christos abort(); 28 1.1 christos } 29 1.1 christos return vp; 30 1.1 christos } 31 1.1 christos 32 1.1 christos /* shim to prevent sucking in too much from apps */ 33 1.1 christos 34 1.1 christos int opt_legacy_okay(void) 35 1.1 christos { 36 1.1 christos return 1; 37 1.1 christos } 38 1.1 christos 39 1.1 christos /* 40 1.1 christos * These three functions are defined here so that they don't need to come from 41 1.1 christos * the apps source code and pull in a lot of additional things. 42 1.1 christos */ 43 1.1 christos int opt_provider_option_given(void) 44 1.1 christos { 45 1.1 christos return 0; 46 1.1 christos } 47 1.1 christos 48 1.1 christos const char *app_get0_propq(void) 49 1.1 christos { 50 1.1 christos return NULL; 51 1.1 christos } 52 1.1 christos 53 1.1 christos OSSL_LIB_CTX *app_get0_libctx(void) 54 1.1 christos { 55 1.1 christos return NULL; 56 1.1 christos } 57