Main Page | Data Structures | File List | Data Fields | Globals | Related Pages

session.c File Reference

#include <assert.h>
#include "common.h"
#include <pthread.h>
#include <openssl/evp.h>
#include <openssl/x509.h>
#include <openssl/bio.h>
#include <string.h>
#include "transforms.h"
#include "session.h"
#include "state.h"
#include "prf.h"
#include "encr.h"
#include "integ.h"
#include "auth.h"
#include "enums.h"

Functions

static char * base64_encode (const uint8_t *msg, int msglen, int *olen)
 Encode byte string into base64 form.
IKEv2SessionNewSession (struct ikev2_ctx *i2, uint64_t iSPI, uint64_t rSPI, int Type)
 Begin new IKEv2 session.
IKEv2SessionFindISession (struct ikev2_ctx *i2, uint64_t iSPI)
 Search a session with a given initiator SPI.
IKEv2SessionFindRSession (struct ikev2_ctx *i2, uint64_t rSPI)
 Search a session with a given responder SPI.
IKEv2SessionFindSessionByFastid (struct ikev2_ctx *i2, const char *fastid)
 Find session with given fastID which is ready to fast reconnect.
IKEv2SessionFindSession (struct ikev2_ctx *i2, uint64_t SPI)
 Search a session with a given SPI.
void FreeSession (struct IKEv2Session *s)
 Release all resources of IKEv2 session.
void FreeSessionList (struct IKEv2Session *s)
 Free whole session list.
int FreeSessionIfExpired (struct ikev2_ctx *i2, uint32_t currentTime)
 Free any session from list if last activity time was greater than ikev2_ctx.fastExpire.
void DeleteSession (struct ikev2_ctx *i2, struct IKEv2Session *s)
 Delete a session entry.
void ComputeSessionKeys (struct IKEv2Session *s)
 Compute all needed session keys.
void ComputeNewKeys (struct IKEv2Session *s, int dhex)
 Compute all needed session keys in case of rekeying.
ikev2_ctxCreate_ikev2_ctx ()
 Create an empty IKEv2 context structure with initialized mutex variable.
void Free_ikev2_ctx (struct ikev2_ctx *i2)
 Free IKEv2 context data.
void DumpIKEv2SessionKeys (const struct IKEv2Session *s)

Function Documentation

static char * base64_encode const uint8_t *  msg,
int  msglen,
int *  olen
[static]
 

Encode byte string into base64 form.

Parameters:
*msg input message
msglen input message length
*olen output message length
Returns:
Ptr to result message. User is responsible to free that memory.

void ComputeNewKeys struct IKEv2Session s,
int  dhex
 

Compute all needed session keys in case of rekeying.

Parameters:
*s IKEv2 session data
dhex is there a new dh exchange?

void ComputeSessionKeys struct IKEv2Session s  ) 
 

Compute all needed session keys.

Parameters:
*s IKEv2 session data

struct ikev2_ctx* Create_ikev2_ctx void   ) 
 

Create an empty IKEv2 context structure with initialized mutex variable.

Returns:
ptr to created IKEv2 context structure

void DeleteSession struct ikev2_ctx i2,
struct IKEv2Session s
 

Delete a session entry.

Parameters:
*i2 IKEv2 context data
*s session to delete

void DumpIKEv2SessionKeys const struct IKEv2Session s  ) 
 

struct IKEv2Session* FindISession struct ikev2_ctx i2,
uint64_t  iSPI
 

Search a session with a given initiator SPI.

Parameters:
*i2 IKEv2 context data
iSPI initiator SPI
Returns:
founded IKEv2 session or NULL if not found

struct IKEv2Session* FindRSession struct ikev2_ctx i2,
uint64_t  rSPI
 

Search a session with a given responder SPI.

Parameters:
*i2 IKEv2 context data
rSPI responder SPI
Returns:
founded IKEv2 session or NULL if not found

struct IKEv2Session* FindSession struct ikev2_ctx i2,
uint64_t  SPI
 

Search a session with a given SPI.

Parameters:
*i2 IKEv2 context data
SPI SPI
Returns:
founded IKEv2 session or NULL if not found

struct IKEv2Session* FindSessionByFastid struct ikev2_ctx i2,
const char *  fastid
 

Find session with given fastID which is ready to fast reconnect.

Parameters:
*i2 IKEv2 context data
fastid fastID string received from respondent
Returns:
founded IKEv2 session or NULL if not found

void Free_ikev2_ctx struct ikev2_ctx i2  ) 
 

Free IKEv2 context data.

Parameters:
*i2 IKEv2 context data

void FreeSession struct IKEv2Session s  ) 
 

Release all resources of IKEv2 session.

Parameters:
*s session to free

int FreeSessionIfExpired struct ikev2_ctx i2,
uint32_t  currentTime
 

Free any session from list if last activity time was greater than ikev2_ctx.fastExpire.

Parameters:
*i2 IKEv2 context data
currentTime current timestamp (i.e. time() result)
Returns:
number of deleted sessions

void FreeSessionList struct IKEv2Session s  ) 
 

Free whole session list.

Parameters:
*s head of the session list

struct IKEv2Session* NewSession struct ikev2_ctx i2,
uint64_t  iSPI,
uint64_t  rSPI,
int  Type
 

Begin new IKEv2 session.

Parameters:
*i2 IKEv2 context data
iSPI initiator SPI
rSPI responder SPI
Type session type - initiator or responder
Returns:
new IKEv2 session struct


Project hosted by: SourceForge.net Logo