VirtualBox

source: vbox/trunk/src/libs/openssl-3.0.7/crypto/conf/conf_sap.c@ 98929

Last change on this file since 98929 was 97372, checked in by vboxsync, 2 years ago

libs: Switch to openssl-3.0.7, bugref:10317

File size: 2.0 KB
Line 
1/*
2 * Copyright 2002-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#include <stdio.h>
11#include <openssl/crypto.h>
12#include "internal/cryptlib.h"
13#include "internal/conf.h"
14#include "conf_local.h"
15#include <openssl/x509.h>
16#include <openssl/asn1.h>
17#include <openssl/engine.h>
18
19#if defined(_WIN32) && !defined(__BORLANDC__)
20# define strdup _strdup
21#endif
22
23/*
24 * This is the automatic configuration loader: it is called automatically by
25 * OpenSSL when any of a number of standard initialisation functions are
26 * called, unless this is overridden by calling OPENSSL_no_config()
27 */
28
29static int openssl_configured = 0;
30
31#ifndef OPENSSL_NO_DEPRECATED_1_1_0
32void OPENSSL_config(const char *appname)
33{
34 OPENSSL_INIT_SETTINGS settings;
35
36 memset(&settings, 0, sizeof(settings));
37 if (appname != NULL)
38 settings.appname = strdup(appname);
39 settings.flags = DEFAULT_CONF_MFLAGS;
40 OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CONFIG, &settings);
41}
42#endif
43
44int ossl_config_int(const OPENSSL_INIT_SETTINGS *settings)
45{
46 int ret = 0;
47#if defined(OPENSSL_INIT_DEBUG) || !defined(OPENSSL_SYS_UEFI)
48 const char *filename;
49 const char *appname;
50 unsigned long flags;
51#endif
52
53 if (openssl_configured)
54 return 1;
55
56#if defined(OPENSSL_INIT_DEBUG) || !defined(OPENSSL_SYS_UEFI)
57 filename = settings ? settings->filename : NULL;
58 appname = settings ? settings->appname : NULL;
59 flags = settings ? settings->flags : DEFAULT_CONF_MFLAGS;
60#endif
61
62#ifdef OPENSSL_INIT_DEBUG
63 fprintf(stderr, "OPENSSL_INIT: ossl_config_int(%s, %s, %lu)\n",
64 filename, appname, flags);
65#endif
66
67#ifndef OPENSSL_SYS_UEFI
68 ret = CONF_modules_load_file(filename, appname, flags);
69#endif
70 openssl_configured = 1;
71 return ret;
72}
73
74void ossl_no_config_int(void)
75{
76 openssl_configured = 1;
77}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette