mirror of
https://github.com/utmapp/swtpm.git
synced 2026-12-01 07:53:17 -10:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ce16c32b1a | ||
|
|
28f4893a1d |
No files matched your search
@@ -8,3 +8,10 @@ swtpmincludedir = $(includedir)/swtpm
|
||||
|
||||
swtpminclude_HEADERS = \
|
||||
tpm_ioctl.h
|
||||
|
||||
if SHARED_LIBRARY_BUILD
|
||||
|
||||
swtpminclude_HEADERS += \
|
||||
swtpm.h
|
||||
|
||||
endif
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* swtpm.h
|
||||
*
|
||||
* (c) Copyright IBM Corporation 2023.
|
||||
*
|
||||
* This file is licensed under the terms of the 3-clause BSD license
|
||||
*/
|
||||
#ifndef _SWTPM_H_
|
||||
#define _SWTPM_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <libtpms/tpm_library.h>
|
||||
|
||||
struct swtpm_options {
|
||||
int sizeOfStruct;
|
||||
TPMLIB_TPMVersion tpmversion;
|
||||
const char *key;
|
||||
const char *migkey;
|
||||
const char *log;
|
||||
const char *pid;
|
||||
const char *locality;
|
||||
const char *tpmstate;
|
||||
const char *ctrlch;
|
||||
const char *server;
|
||||
const char *flags;
|
||||
const char *seccomp;
|
||||
const char *migration;
|
||||
};
|
||||
|
||||
int swtpm_start(struct swtpm_options *options);
|
||||
void swtpm_stop(void);
|
||||
|
||||
#endif /* _SWTPM_H_ */
|
||||
@@ -103,12 +103,7 @@ lib_LTLIBRARIES = libswtpm.la
|
||||
libswtpm_la_DEPENDENCIES = libswtpm_libtpms.la
|
||||
|
||||
libswtpm_la_SOURCES = \
|
||||
daemonize.c \
|
||||
swtpm.c \
|
||||
swtpm_chardev.c
|
||||
if WITH_CUSE
|
||||
libswtpm_la_SOURCES += cuse_tpm.c
|
||||
endif
|
||||
swtpm_library.c
|
||||
|
||||
libswtpm_la_CFLAGS = \
|
||||
-I$(top_builddir)/include \
|
||||
|
||||
+20
-20
@@ -286,7 +286,7 @@ static const OptionDesc migration_opt_desc[] = {
|
||||
* Returns 0 on success, -1 on failure.
|
||||
*/
|
||||
int
|
||||
handle_log_options(char *options)
|
||||
handle_log_options(const char *options)
|
||||
{
|
||||
char *error = NULL;
|
||||
const char *logfile = NULL, *logprefix = NULL;
|
||||
@@ -358,7 +358,7 @@ error:
|
||||
* Returns 0 on success, -1 on failure.
|
||||
*/
|
||||
static int
|
||||
parse_key_options(char *options, unsigned char *key, size_t maxkeylen,
|
||||
parse_key_options(const char *options, unsigned char *key, size_t maxkeylen,
|
||||
size_t *keylen, enum encryption_mode *encmode)
|
||||
{
|
||||
OptionValues *ovs = NULL;
|
||||
@@ -472,7 +472,7 @@ error:
|
||||
* Returns 0 on success, -1 on failure.
|
||||
*/
|
||||
int
|
||||
handle_key_options(char *options)
|
||||
handle_key_options(const char *options)
|
||||
{
|
||||
enum encryption_mode encmode = ENCRYPTION_MODE_UNKNOWN;
|
||||
unsigned char key[256/8];
|
||||
@@ -508,7 +508,7 @@ error:
|
||||
* Returns 0 on success, -1 on failure.
|
||||
*/
|
||||
int
|
||||
handle_migration_key_options(char *options)
|
||||
handle_migration_key_options(const char *options)
|
||||
{
|
||||
enum encryption_mode encmode = ENCRYPTION_MODE_UNKNOWN;
|
||||
unsigned char key[256/8];
|
||||
@@ -546,7 +546,7 @@ error:
|
||||
* Returns 0 on success, -1 on failure.
|
||||
*/
|
||||
static int
|
||||
parse_pid_options(char *options, char **pidfile, int *pidfilefd)
|
||||
parse_pid_options(const char *options, char **pidfile, int *pidfilefd)
|
||||
{
|
||||
OptionValues *ovs = NULL;
|
||||
char *error = NULL;
|
||||
@@ -604,7 +604,7 @@ error:
|
||||
* Returns 0 on success, -1 on failure.
|
||||
*/
|
||||
int
|
||||
handle_pid_options(char *options)
|
||||
handle_pid_options(const char *options)
|
||||
{
|
||||
char *pidfile = NULL;
|
||||
int pidfilefd = -1;
|
||||
@@ -638,7 +638,7 @@ handle_pid_options(char *options)
|
||||
* Returns 0 on success, -1 on failure.
|
||||
*/
|
||||
static int
|
||||
parse_tpmstate_options(char *options, char **tpmstatedir, mode_t *mode,
|
||||
parse_tpmstate_options(const char *options, char **tpmstatedir, mode_t *mode,
|
||||
char **tpmbackend_uri)
|
||||
{
|
||||
OptionValues *ovs = NULL;
|
||||
@@ -696,7 +696,7 @@ error:
|
||||
* Returns 0 on success, -1 on failure.
|
||||
*/
|
||||
int
|
||||
handle_tpmstate_options(char *options)
|
||||
handle_tpmstate_options(const char *options)
|
||||
{
|
||||
char *tpmstatedir = NULL;
|
||||
char *tpmbackend_uri = NULL;
|
||||
@@ -933,7 +933,7 @@ error:
|
||||
*
|
||||
* Returns 0 on success, -1 on failure.
|
||||
*/
|
||||
static int parse_ctrlchannel_options(char *options, struct ctrlchannel **cc,
|
||||
static int parse_ctrlchannel_options(const char *options, struct ctrlchannel **cc,
|
||||
uint32_t *mainloop_flags)
|
||||
{
|
||||
OptionValues *ovs = NULL;
|
||||
@@ -1058,7 +1058,7 @@ error:
|
||||
*
|
||||
* Returns 0 on success, -1 on failure.
|
||||
*/
|
||||
int handle_ctrlchannel_options(char *options, struct ctrlchannel **cc,
|
||||
int handle_ctrlchannel_options(const char *options, struct ctrlchannel **cc,
|
||||
uint32_t *mainloop_flag)
|
||||
{
|
||||
if (!options)
|
||||
@@ -1078,7 +1078,7 @@ int handle_ctrlchannel_options(char *options, struct ctrlchannel **cc,
|
||||
*
|
||||
* Returns 0 on success, -1 on failure.
|
||||
*/
|
||||
static int parse_server_options(char *options, struct server **c)
|
||||
static int parse_server_options(const char *options, struct server **c)
|
||||
{
|
||||
OptionValues *ovs = NULL;
|
||||
char *error = NULL;
|
||||
@@ -1201,7 +1201,7 @@ error:
|
||||
*
|
||||
* Returns 0 on success, -1 on failure.
|
||||
*/
|
||||
int handle_server_options(char *options, struct server **c)
|
||||
int handle_server_options(const char *options, struct server **c)
|
||||
{
|
||||
if (!options)
|
||||
return 0;
|
||||
@@ -1212,7 +1212,7 @@ int handle_server_options(char *options, struct server **c)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int parse_locality_options(char *options, uint32_t *flags)
|
||||
static int parse_locality_options(const char *options, uint32_t *flags)
|
||||
{
|
||||
OptionValues *ovs = NULL;
|
||||
char *error = NULL;
|
||||
@@ -1247,7 +1247,7 @@ error:
|
||||
*
|
||||
* Returns 0 on success, -1 on failure.
|
||||
*/
|
||||
int handle_locality_options(char *options, uint32_t *flags)
|
||||
int handle_locality_options(const char *options, uint32_t *flags)
|
||||
{
|
||||
*flags = 0;
|
||||
|
||||
@@ -1260,7 +1260,7 @@ int handle_locality_options(char *options, uint32_t *flags)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int parse_flags_options(char *options, bool *need_init_cmd,
|
||||
static int parse_flags_options(const char *options, bool *need_init_cmd,
|
||||
uint16_t *startupType, bool *disable_auto_shutdown)
|
||||
{
|
||||
OptionValues *ovs = NULL;
|
||||
@@ -1308,7 +1308,7 @@ error:
|
||||
*
|
||||
* Returns 0 on success, -1 on failure.
|
||||
*/
|
||||
int handle_flags_options(char *options, bool *need_init_cmd,
|
||||
int handle_flags_options(const char *options, bool *need_init_cmd,
|
||||
uint16_t *startupType, bool *disable_auto_shutdown)
|
||||
{
|
||||
if (!options)
|
||||
@@ -1322,7 +1322,7 @@ int handle_flags_options(char *options, bool *need_init_cmd,
|
||||
}
|
||||
|
||||
#ifdef WITH_SECCOMP
|
||||
static int parse_seccomp_options(char *options, unsigned int *seccomp_action)
|
||||
static int parse_seccomp_options(const char *options, unsigned int *seccomp_action)
|
||||
{
|
||||
OptionValues *ovs = NULL;
|
||||
char *error = NULL;
|
||||
@@ -1369,7 +1369,7 @@ error:
|
||||
*
|
||||
* Returns 0 on success, -1 on failure.
|
||||
*/
|
||||
int handle_seccomp_options(char *options, unsigned int *seccomp_action)
|
||||
int handle_seccomp_options(const char *options, unsigned int *seccomp_action)
|
||||
{
|
||||
*seccomp_action = SWTPM_SECCOMP_ACTION_KILL;
|
||||
|
||||
@@ -1383,7 +1383,7 @@ int handle_seccomp_options(char *options, unsigned int *seccomp_action)
|
||||
}
|
||||
#endif /* WITH_SECCOMP */
|
||||
|
||||
static int parse_migration_options(char *options, bool *incoming_migration,
|
||||
static int parse_migration_options(const char *options, bool *incoming_migration,
|
||||
bool *release_lock_outgoing)
|
||||
{
|
||||
OptionValues *ovs = NULL;
|
||||
@@ -1420,7 +1420,7 @@ error:
|
||||
*
|
||||
* Return 0 on success, -1 on failure.
|
||||
*/
|
||||
int handle_migration_options(char *options, bool *incoming_migration,
|
||||
int handle_migration_options(const char *options, bool *incoming_migration,
|
||||
bool *release_lock_outgoing)
|
||||
{
|
||||
*incoming_migration = false;
|
||||
|
||||
+12
-12
@@ -43,29 +43,29 @@
|
||||
|
||||
#include "compiler_dependencies.h"
|
||||
|
||||
int handle_log_options(char *options);
|
||||
int handle_key_options(char *options);
|
||||
int handle_migration_key_options(char *options);
|
||||
int handle_pid_options(char *options);
|
||||
int handle_tpmstate_options(char *options);
|
||||
int handle_log_options(const char *options);
|
||||
int handle_key_options(const char *options);
|
||||
int handle_migration_key_options(const char *options);
|
||||
int handle_pid_options(const char *options);
|
||||
int handle_tpmstate_options(const char *options);
|
||||
struct ctrlchannel;
|
||||
int handle_ctrlchannel_options(char *options, struct ctrlchannel **cc,
|
||||
int handle_ctrlchannel_options(const char *options, struct ctrlchannel **cc,
|
||||
uint32_t *mainloop_flag);
|
||||
struct server;
|
||||
int handle_server_options(char *options, struct server **s);
|
||||
int handle_locality_options(char *options, uint32_t *flags);
|
||||
int handle_flags_options(char *options, bool *need_init_cmd,
|
||||
int handle_server_options(const char *options, struct server **s);
|
||||
int handle_locality_options(const char *options, uint32_t *flags);
|
||||
int handle_flags_options(const char *options, bool *need_init_cmd,
|
||||
uint16_t *startupType, bool *disable_auto_shutdown);
|
||||
#ifdef WITH_SECCOMP
|
||||
int handle_seccomp_options(char *options, unsigned int *seccomp_action);
|
||||
int handle_seccomp_options(const char *options, unsigned int *seccomp_action);
|
||||
#else
|
||||
static inline int handle_seccomp_options(char *options SWTPM_ATTR_UNUSED,
|
||||
static inline int handle_seccomp_options(const char *options SWTPM_ATTR_UNUSED,
|
||||
unsigned int *seccomp_action SWTPM_ATTR_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
int handle_migration_options(char *options, bool *incoming_migration,
|
||||
int handle_migration_options(const char *options, bool *incoming_migration,
|
||||
bool *release_lock_outgoing);
|
||||
|
||||
#endif /* _SWTPM_COMMON_H_ */
|
||||
|
||||
+1
-1
@@ -205,7 +205,7 @@ option_value_add(OptionValues *ovs, const OptionDesc optdesc, const char *val,
|
||||
* Returns the parse options, types, and values in OptionValues.
|
||||
*/
|
||||
OptionValues *
|
||||
options_parse(char *opts, const OptionDesc optdesc[], char **error)
|
||||
options_parse(const char *opts, const OptionDesc optdesc[], char **error)
|
||||
{
|
||||
char *saveptr;
|
||||
char *tok;
|
||||
|
||||
+1
-1
@@ -81,7 +81,7 @@ typedef struct {
|
||||
.name = NULL, \
|
||||
}
|
||||
|
||||
OptionValues *options_parse(char *opts, const OptionDesc optdesc[],
|
||||
OptionValues *options_parse(const char *opts, const OptionDesc optdesc[],
|
||||
char **error);
|
||||
void option_values_free(OptionValues *ov);
|
||||
const char *option_get_string(OptionValues *ovs, const char *name,
|
||||
|
||||
@@ -0,0 +1,238 @@
|
||||
/********************************************************************************/
|
||||
/* */
|
||||
/* TPM Main Program */
|
||||
/* Written by Ken Goldman, Stefan Berger */
|
||||
/* IBM Thomas J. Watson Research Center */
|
||||
/* */
|
||||
/* (c) Copyright IBM Corporation 2006, 2010, 2016, 2019. */
|
||||
/* */
|
||||
/* All rights reserved. */
|
||||
/* */
|
||||
/* Redistribution and use in source and binary forms, with or without */
|
||||
/* modification, are permitted provided that the following conditions are */
|
||||
/* met: */
|
||||
/* */
|
||||
/* Redistributions of source code must retain the above copyright notice, */
|
||||
/* this list of conditions and the following disclaimer. */
|
||||
/* */
|
||||
/* Redistributions in binary form must reproduce the above copyright */
|
||||
/* notice, this list of conditions and the following disclaimer in the */
|
||||
/* documentation and/or other materials provided with the distribution. */
|
||||
/* */
|
||||
/* Neither the names of the IBM Corporation nor the names of its */
|
||||
/* contributors may be used to endorse or promote products derived from */
|
||||
/* this software without specific prior written permission. */
|
||||
/* */
|
||||
/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
|
||||
/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
|
||||
/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */
|
||||
/* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
|
||||
/* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
|
||||
/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
|
||||
/* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
|
||||
/* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */
|
||||
/* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
|
||||
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */
|
||||
/* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
|
||||
/********************************************************************************/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <getopt.h>
|
||||
#include <errno.h>
|
||||
#include <poll.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdbool.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <libtpms/tpm_error.h>
|
||||
#include <libtpms/tpm_library.h>
|
||||
#include <libtpms/tpm_memory.h>
|
||||
#include <swtpm/swtpm.h>
|
||||
|
||||
#include "main.h"
|
||||
#include "swtpm_debug.h"
|
||||
#include "swtpm_io.h"
|
||||
#include "swtpm_nvstore.h"
|
||||
#include "server.h"
|
||||
#include "common.h"
|
||||
#include "logging.h"
|
||||
#include "pidfile.h"
|
||||
#include "tpmlib.h"
|
||||
#include "utils.h"
|
||||
#include "mainloop.h"
|
||||
#include "ctrlchannel.h"
|
||||
#include "tpmstate.h"
|
||||
#include "sys_dependencies.h"
|
||||
#include "seccomp_profile.h"
|
||||
#include "options.h"
|
||||
|
||||
/* local variables */
|
||||
static int notify_fd[2] = {-1, -1};
|
||||
|
||||
static struct libtpms_callbacks callbacks = {
|
||||
.sizeOfStruct = sizeof(struct libtpms_callbacks),
|
||||
.tpm_nvram_init = SWTPM_NVRAM_Init,
|
||||
.tpm_nvram_loaddata = SWTPM_NVRAM_LoadData,
|
||||
.tpm_nvram_storedata = SWTPM_NVRAM_StoreData,
|
||||
.tpm_nvram_deletename = SWTPM_NVRAM_DeleteName,
|
||||
.tpm_io_init = SWTPM_IO_Init,
|
||||
.tpm_io_getlocality = mainloop_cb_get_locality,
|
||||
};
|
||||
|
||||
void swtpm_stop(void)
|
||||
{
|
||||
TPM_DEBUG("Terminating...\n");
|
||||
if (write(notify_fd[1], "T", 1) < 0) {
|
||||
logprintf(STDERR_FILENO, "Error: sigterm notification failed: %s\n",
|
||||
strerror(errno));
|
||||
}
|
||||
mainloop_terminate = true;
|
||||
}
|
||||
|
||||
static void swtpm_cleanup(struct ctrlchannel *cc, struct server *server)
|
||||
{
|
||||
pidfile_remove();
|
||||
ctrlchannel_free(cc);
|
||||
server_free(server);
|
||||
log_global_free();
|
||||
tpmstate_global_free();
|
||||
SWTPM_NVRAM_Shutdown();
|
||||
}
|
||||
|
||||
int swtpm_start(struct swtpm_options *options)
|
||||
{
|
||||
TPM_RESULT rc = 0;
|
||||
struct mainLoopParams mlp = {
|
||||
.cc = NULL,
|
||||
.flags = 0,
|
||||
.fd = -1,
|
||||
.locality_flags = 0,
|
||||
.tpmversion = TPMLIB_TPM_VERSION_1_2,
|
||||
.startupType = _TPM_ST_NONE,
|
||||
.lastCommand = TPM_ORDINAL_NONE,
|
||||
.disable_auto_shutdown = false,
|
||||
.incoming_migration = false,
|
||||
.storage_locked = false,
|
||||
};
|
||||
struct server *server = NULL;
|
||||
bool need_init_cmd = true;
|
||||
#ifdef DEBUG
|
||||
time_t start_time;
|
||||
#endif
|
||||
unsigned int seccomp_action;
|
||||
|
||||
if (!options || options->sizeOfStruct != sizeof(*options)) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
mlp.tpmversion = options->tpmversion;
|
||||
|
||||
log_set_prefix("swtpm: ");
|
||||
|
||||
if (handle_log_options(options->log) < 0)
|
||||
return EXIT_FAILURE;
|
||||
|
||||
if (tpmlib_choose_tpm_version(mlp.tpmversion) != TPM_SUCCESS)
|
||||
return EXIT_FAILURE;
|
||||
|
||||
if (handle_ctrlchannel_options(options->ctrlch, &mlp.cc, &mlp.flags) < 0 ||
|
||||
handle_server_options(options->server, &server) < 0) {
|
||||
goto exit_failure;
|
||||
}
|
||||
|
||||
tpmstate_set_version(mlp.tpmversion);
|
||||
|
||||
if (handle_key_options(options->key) < 0 ||
|
||||
handle_migration_key_options(options->migkey) < 0 ||
|
||||
handle_pid_options(options->pid) < 0 ||
|
||||
handle_locality_options(options->locality, &mlp.locality_flags) < 0 ||
|
||||
handle_tpmstate_options(options->tpmstate) < 0 ||
|
||||
handle_seccomp_options(options->seccomp, &seccomp_action) < 0 ||
|
||||
handle_flags_options(options->flags, &need_init_cmd,
|
||||
&mlp.startupType, &mlp.disable_auto_shutdown) < 0 ||
|
||||
handle_migration_options(options->migration, &mlp.incoming_migration,
|
||||
&mlp.release_lock_outgoing) < 0) {
|
||||
goto exit_failure;
|
||||
}
|
||||
|
||||
if (server) {
|
||||
if (server_get_fd(server) >= 0) {
|
||||
mlp.fd = server_set_fd(server, -1);
|
||||
SWTPM_IO_SetSocketFD(mlp.fd);
|
||||
}
|
||||
|
||||
mlp.flags |= MAIN_LOOP_FLAG_KEEP_CONNECTION;
|
||||
if ((server_get_flags(server) & SERVER_FLAG_DISCONNECT))
|
||||
mlp.flags &= ~MAIN_LOOP_FLAG_KEEP_CONNECTION;
|
||||
|
||||
if ((server_get_flags(server) & SERVER_FLAG_FD_GIVEN))
|
||||
mlp.flags |= MAIN_LOOP_FLAG_TERMINATE | MAIN_LOOP_FLAG_USE_FD;
|
||||
}
|
||||
|
||||
if (pidfile_write(getpid()) < 0) {
|
||||
goto exit_failure;
|
||||
}
|
||||
|
||||
setvbuf(stdout, 0, _IONBF, 0); /* output may be going through pipe */
|
||||
|
||||
#ifdef DEBUG
|
||||
/* initialization */
|
||||
start_time = time(NULL);
|
||||
#endif
|
||||
|
||||
TPM_DEBUG("main: Initializing TPM at %s", ctime(&start_time));
|
||||
|
||||
tpmlib_debug_libtpms_parameters(mlp.tpmversion);
|
||||
|
||||
if ((rc = tpmlib_register_callbacks(&callbacks)))
|
||||
goto error_no_tpm;
|
||||
|
||||
if (!need_init_cmd) {
|
||||
mlp.storage_locked = !mlp.incoming_migration;
|
||||
|
||||
if ((rc = tpmlib_start(0, mlp.tpmversion, mlp.storage_locked)))
|
||||
goto error_no_tpm;
|
||||
tpm_running = true;
|
||||
}
|
||||
|
||||
if (pipe(notify_fd) < 0)
|
||||
goto error_no_pipe;
|
||||
|
||||
if (create_seccomp_profile(false, seccomp_action) < 0)
|
||||
goto error_seccomp_profile;
|
||||
|
||||
rc = mainLoop(&mlp, notify_fd[0]);
|
||||
|
||||
error_seccomp_profile:
|
||||
uninstall_sighandlers();
|
||||
|
||||
error_no_pipe:
|
||||
TPMLIB_Terminate();
|
||||
|
||||
error_no_tpm:
|
||||
close(notify_fd[0]);
|
||||
notify_fd[0] = -1;
|
||||
close(notify_fd[1]);
|
||||
notify_fd[1] = -1;
|
||||
|
||||
swtpm_cleanup(mlp.cc, server);
|
||||
|
||||
/* Fatal initialization errors cause the program to abort */
|
||||
if (rc == 0) {
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
else {
|
||||
TPM_DEBUG("main: TPM initialization failure %08x, exiting\n", rc);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
exit_failure:
|
||||
swtpm_cleanup(mlp.cc, server);
|
||||
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
Reference in new issue
Block a user