charon-tkm: Register TKM private key on startup
This commit is contained in:
committed by
Tobias Brunner
parent
08d199fa3d
commit
c457128ab6
@@ -32,6 +32,7 @@
|
|||||||
#include <utils/backtrace.h>
|
#include <utils/backtrace.h>
|
||||||
#include <threading/thread.h>
|
#include <threading/thread.h>
|
||||||
#include <sa/keymat.h>
|
#include <sa/keymat.h>
|
||||||
|
#include <credentials/sets/mem_cred.h>
|
||||||
|
|
||||||
#include "tkm.h"
|
#include "tkm.h"
|
||||||
#include "tkm_nonceg.h"
|
#include "tkm_nonceg.h"
|
||||||
@@ -40,6 +41,7 @@
|
|||||||
#include "tkm_listener.h"
|
#include "tkm_listener.h"
|
||||||
#include "tkm_kernel_ipsec.h"
|
#include "tkm_kernel_ipsec.h"
|
||||||
#include "tkm_public_key.h"
|
#include "tkm_public_key.h"
|
||||||
|
#include "tkm_private_key.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TKM bus listener for IKE authorize events.
|
* TKM bus listener for IKE authorize events.
|
||||||
@@ -238,6 +240,10 @@ int main(int argc, char *argv[])
|
|||||||
dmn_name = "charon-tkm";
|
dmn_name = "charon-tkm";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* credential set and TKM private key */
|
||||||
|
mem_cred_t *creds;
|
||||||
|
tkm_private_key_t *key;
|
||||||
|
|
||||||
struct sigaction action;
|
struct sigaction action;
|
||||||
int status = SS_RC_INITIALIZATION_FAILED;
|
int status = SS_RC_INITIALIZATION_FAILED;
|
||||||
|
|
||||||
@@ -341,6 +347,12 @@ int main(int argc, char *argv[])
|
|||||||
listener = tkm_listener_create();
|
listener = tkm_listener_create();
|
||||||
charon->bus->add_listener(charon->bus, &listener->listener);
|
charon->bus->add_listener(charon->bus, &listener->listener);
|
||||||
|
|
||||||
|
/* register TKM private key */
|
||||||
|
creds = mem_cred_create();
|
||||||
|
key = tkm_private_key_init();
|
||||||
|
creds->add_key(creds, (private_key_t *)key);
|
||||||
|
lib->credmgr->add_set(lib->credmgr, (credential_set_t*)creds);
|
||||||
|
|
||||||
/* add handler for SEGV and ILL,
|
/* add handler for SEGV and ILL,
|
||||||
* INT and TERM are handled by sigwait() in run() */
|
* INT and TERM are handled by sigwait() in run() */
|
||||||
action.sa_handler = segv_handler;
|
action.sa_handler = segv_handler;
|
||||||
@@ -366,6 +378,7 @@ int main(int argc, char *argv[])
|
|||||||
status = 0;
|
status = 0;
|
||||||
charon->bus->remove_listener(charon->bus, &listener->listener);
|
charon->bus->remove_listener(charon->bus, &listener->listener);
|
||||||
listener->destroy(listener);
|
listener->destroy(listener);
|
||||||
|
creds->destroy(creds);
|
||||||
|
|
||||||
deinit:
|
deinit:
|
||||||
libcharon_deinit();
|
libcharon_deinit();
|
||||||
|
|||||||
Reference in New Issue
Block a user