embedded IPsec source code documentation


esp_test.c File Reference


Detailed Description

Testing ESP encapsulation and decapsulation.

Author:
Niklaus Schild <n.schild@gmx.ch>
OUTLINE:

IMPLEMENTATION:

NOTES:

This document is part of embedded IPsec
Copyright (c) 2003 Niklaus Schild and Christian Scheurer, HTI Biel/Bienne
All rights reserved.


Definition in file esp_test.c.

#include <string.h>
#include "ipsec/util.h"
#include "ipsec/debug.h"
#include "testing/structural/structural_test.h"
#include "ipsec/sa.h"
#include "ipsec/esp.h"

Go to the source code of this file.

Functions

int test_esp_decapsulate (void)
int test_esp_encapsulate (void)
void esp_test (test_result *global_results)

Variables

unsigned char enc_esp_packet1 [484]
unsigned char dec_esp_packet1 [448]
unsigned char enc_esp_packet2 [100]
unsigned char dec_esp_packet2 [64]
unsigned char esp_packet_tmp [500]
sad_entry packet1_sa
sad_entry packet2_sa


Function Documentation

void esp_test test_result global_results  ) 
 

Main test function for the ESP tests. It does nothing but calling the subtests one after the other.

Definition at line 355 of file esp_test.c.

int test_esp_decapsulate void   ) 
 

Check if ESP decapsulation works (used for IPsec inbound processing). 6 tests are performed here

Definition at line 215 of file esp_test.c.

int test_esp_encapsulate void   ) 
 

Checks if ESP encapsulation works (used for IPsec outbound processing) 6 tests

Definition at line 278 of file esp_test.c.


Variable Documentation

unsigned char dec_esp_packet1[448]
 

Definition at line 104 of file esp_test.c.

unsigned char dec_esp_packet2[64]
 

Initial value:

{
        
    0x45, 0x00, 0x00, 0x3C, 
        0x58, 0xDF, 0x40, 0x00, 
        0x40, 0x06, 0x5E, 0x61, 
        0xC0, 0xA8, 0x01, 0x28,
    0xC0, 0xA8, 0x01, 0x03, 
                
        0x80, 0x0A, 0x00, 0x50, 0x47, 0x67, 0xC8, 0xD1, 0x00, 0x00, 0x00, 0x00,
    0xA0, 0x02, 0x7E, 0xB8, 0xEB, 0x81, 0x00, 0x00, 0x02, 0x04, 0x3F, 0x5C, 0x04, 0x02, 0x08, 0x0A,
    0x00, 0x07, 0x90, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x03, 0x00, 
        
        0x01, 0x02,
        
        0x02, 
        
        0x04,
}

Definition at line 173 of file esp_test.c.

unsigned char enc_esp_packet1[484]
 

Definition at line 58 of file esp_test.c.

unsigned char enc_esp_packet2[100]
 

Initial value:

{
        
    0x45, 0x00, 0x00, 0x64, 
        0x79, 0x30, 0x00, 0x00, 
        0x40, 0x32, 0x7D, 0xBC, 
        0xC0, 0xA8, 0x01, 0x28,
    0xC0, 0xA8, 0x01, 0x03, 
        
        0x00, 0x00, 0x10, 0x06, 
        0x00, 0x00, 0x00, 0x01, 
        
        0x87, 0xC5, 0xBA, 0x8C,
    0x6F, 0x31, 0xEE, 0x1E, 
        
        0xFB, 0xCE, 0x75, 0xD2, 0xD4, 0x16, 0x25, 0x8A, 0x92, 0xB8, 0x63, 0x09,
    0xBB, 0x88, 0x7E, 0x10, 0x50, 0x2B, 0x23, 0x2F, 0xF6, 0x51, 0xF2, 0x2B, 0x82, 0xAA, 0xE5, 0xD3,
    0x5D, 0x4C, 0xFB, 0xCF, 0x87, 0xFB, 0xAD, 0x9F, 0x28, 0x1D, 0xFF, 0x90, 0xDD, 0x43, 0x6B, 0x04,
    0xBC, 0xFB, 0xD4, 0x47, 0x36, 0xBC, 0x24, 0x20, 0x71, 0x00, 0x44, 0x07, 0xC2, 0x49, 0xEB, 0x48,
    0x26, 0xA4, 0xA7, 0x87,
}

Definition at line 151 of file esp_test.c.

unsigned char esp_packet_tmp[500]
 

Definition at line 193 of file esp_test.c.

sad_entry packet1_sa
 

Initial value:

 {      SAD_ENTRY(      192,168,1,40, 255,255,255,255, 
                                                        0x001006, 
                                                        IPSEC_PROTO_ESP, IPSEC_TUNNEL, 
                                                        IPSEC_3DES, 
                                                        0x01, 0x23, 0x45, 0x67, 0x01, 0x23, 0x45, 0x67, 0x01, 0x23, 0x45, 0x67, 0x01, 0x23, 0x45, 0x67, 0x01, 0x23, 0x45, 0x67, 0x01, 0x23, 0x45, 0x67, 
                                                        0,  
                                                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)}

Definition at line 195 of file esp_test.c.

sad_entry packet2_sa
 

Initial value:

 {      SAD_ENTRY(      192,168,1,3, 255,255,255,255, 
                                                        0x001006, 
                                                        IPSEC_PROTO_ESP, IPSEC_TUNNEL, 
                                                        IPSEC_3DES, 
                                                        0x01, 0x23, 0x45, 0x67, 0x01, 0x23, 0x45, 0x67, 0x01, 0x23, 0x45, 0x67, 0x01, 0x23, 0x45, 0x67, 0x01, 0x23, 0x45, 0x67, 0x01, 0x23, 0x45, 0x67, 
                                                        0,  
                                                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)}

Definition at line 203 of file esp_test.c.


Copyright 2003 by Christian Scheurer and Niklaus Schild