source
code documentation
sa_test.c File Reference
Detailed Description
Test functions for Security Association Database.
- Author:
- Niklaus Schild <n.schild@gmx.ch>
OUTLINE:
This file contains test functions used to verify the SA code.
IMPLEMENTATION:
There are no implementation hints to be mentioned.
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 sa_test.c.
#include <string.h>
#include "ipsec/util.h"
#include "ipsec/debug.h"
#include "testing/structural/structural_test.h"
#include "ipsec/sa.h"
Go to the source code of this file.
Define Documentation
#define MAX_IP_ADD_LENGTH (15)
|
|
Function Documentation
|
Main test function for the SA tests. It does nothing but calling the subtests one after the other.
Definition at line 887 of file sa_test.c. |
int test_sad_add |
( |
void |
|
) |
|
|
int test_sad_del |
( |
void |
|
) |
|
|
int test_sad_flush |
( |
void |
|
) |
|
|
int test_sad_get_spi |
( |
void |
|
) |
|
|
|
Check if SPI lookup in the SAD works. 2 tests are performed here.
Definition at line 836 of file sa_test.c. |
int test_sad_lookup |
( |
void |
|
) |
|
|
|
Check if the Security Association Database (SAD) lookup function works. 4 tests are performed here
Definition at line 777 of file sa_test.c. |
int test_spd_add |
( |
void |
|
) |
|
|
|
Test adding of SPD entries 5 tests are performed here
Definition at line 425 of file sa_test.c. |
int test_spd_del |
( |
void |
|
) |
|
|
|
Test removing of SPD entries 10 tests are performed here
Definition at line 544 of file sa_test.c. |
int test_spd_flush |
( |
void |
|
) |
|
|
int test_spd_get_free |
( |
void |
|
) |
|
|
|
Check if SPD lookup for free entries works. 4 tests are performed here.
Definition at line 345 of file sa_test.c. |
int test_spd_init |
( |
void |
|
) |
|
|
|
Check if the SPD initialization works correctly. 16 tests are performed here.
Definition at line 210 of file sa_test.c. |
int test_spd_lookup |
( |
void |
|
) |
|
|
|
Check if the Security Policy Database (SPD) lookup function works. 6 tests are performed here.
Definition at line 703 of file sa_test.c. |
Variable Documentation
|
Initial value:
{
0x45, 0x00, 0x00, 0x68, 0x79, 0x9C, 0x00, 0x00, 0x40, 0x33, 0x7D, 0x4B, 0xC0, 0xA8, 0x01, 0x28,
0xC0, 0xA8, 0x01, 0x03, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x10, 0x09, 0x00, 0x00, 0x00, 0x01,
0x45, 0x2F, 0x1D, 0xE9, 0xEE, 0x8B, 0x41, 0x26, 0x44, 0x51, 0xCC, 0x8D, 0x45, 0x00, 0x00, 0x3C,
}
Definition at line 196 of file sa_test.c. |
|
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,
}
Definition at line 190 of file sa_test.c. |
|
Initial value: {
{ SAD_ENTRY( 192,168,1,1, 255,255,255,255,
0x1001,
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),
SAD_ENTRY( 192,168,1,2, 255,255,255,255,
0x1002,
IPSEC_PROTO_AH, IPSEC_TUNNEL,
0,
0x01, 0x23, 0x45, 0x67, 0x01, 0x23, 0x45, 0x67, 0x01, 0x23, 0x45, 0x67, 0x01, 0x23, 0x45, 0x67, 0x01, 0x23, 0x45 , 0x67, 0x01, 0x23, 0x45, 0x67,
IPSEC_HMAC_MD5,
0x01, 0x23, 0x45, 0x67, 0x01, 0x23, 0x45, 0x67, 0x01, 0x23, 0x45, 0x67, 0x01, 0x23, 0x45, 0x67, 0, 0, 0, 0),
SAD_ENTRY( 192,168,156,189, 255,255,255,255,
0x0010002,
IPSEC_PROTO_AH, IPSEC_TUNNEL,
0,
0x01, 0x23, 0x45, 0x67, 0x01, 0x23, 0x45, 0x67, 0x01, 0x23, 0x45, 0x67, 0x01, 0x23, 0x45, 0x67, 0x01, 0x23, 0x45 , 0x67, 0x01, 0x23, 0x45, 0x67,
IPSEC_HMAC_SHA1,
0x01, 0x23, 0x45, 0x67, 0x01, 0x23, 0x45, 0x67, 0x01, 0x23, 0x45, 0x67, 0x01, 0x23, 0x45, 0x67, 0, 0, 0, 0)}
}
Definition at line 60 of file sa_test.c. |
|
Initial value: {
{ SPD_ENTRY( 204,152,189,116, 255,255,255,0, 147,87,70,105, 255,255,255,255, IPSEC_PROTO_TCP, 21, 0, POLICY_DISCARD, 0)},
{ SPD_ENTRY( 147,87,70,105, 255,255,255,255, 204,152,189,116, 255,255,255,255, IPSEC_PROTO_TCP, 0, 21, POLICY_APPLY, 0)},
{ SPD_ENTRY( 147,87,70,250, 255,255,255,0, 255,255,255,255, 255,255,255,255, IPSEC_PROTO_UDP, 0, 0, POLICY_APPLY, 0)},
{ SPD_ENTRY( 192,168,1,0, 255,255,255,0, 192,168,1,3, 255,255,255,255, IPSEC_PROTO_AH, 0, 0, POLICY_APPLY, 0)},
{ SPD_ENTRY( 192,168,1,40, 255,255,255,255, 192,168,1,3, 255,255,255,255, IPSEC_PROTO_ESP, 0, 0, POLICY_APPLY, 0)},
{ SPD_ENTRY( 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0, 0, 0, POLICY_BYPASS, 0)}
}
Definition at line 87 of file sa_test.c. |
|
Initial value:
{
0x45, 0x00, 0x00, 0x68, 0x79, 0x9C, 0x00, 0x00, 0x40, 0x33, 0x7D, 0x4B, 0xC0, 0xA8, 0x01, 0x28,
0xC0, 0xA8, 0x01, 0x03,
}
Definition at line 169 of file sa_test.c. |
|
Initial value:
{
0x45, 0x00, 0x00, 0x46, 0x8E, 0xF2, 0x40, 0x00, 0x31, 0x06, 0x56, 0xF2, 0xCA, 0x92, 0xB0, 0x74,
0x93, 0x57, 0x46, 0x69, 0x00, 0x15, 0x11, 0xEF, 0x38, 0x57, 0xC8, 0x7F, 0xEC, 0x0F, 0x03, 0x14,
0x50, 0x18, 0x16, 0xD0, 0x76, 0x2A, 0x00, 0x00, 0x32, 0x30, 0x30, 0x20, 0x50, 0x4F, 0x52, 0x54,
0x20, 0x63, 0x6F, 0x6D, 0x6D, 0x61, 0x6E, 0x64, 0x20, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73,
0x66, 0x75, 0x6C, 0x2E, 0x0D, 0x0A,
}
Definition at line 181 of file sa_test.c. |
|
Initial value:
{
0x45, 0x00, 0x00, 0x64, 0x79, 0x30, 0x00, 0x00, 0x40, 0x32, 0x7D, 0xBC, 0xC0, 0xA8, 0x01, 0x28,
0xC0, 0xA8, 0x01, 0x03,
}
Definition at line 175 of file sa_test.c. |
|
Initial value:
{
0x45, 0x00, 0x00, 0x46, 0x8E, 0xF2, 0x40, 0x00, 0x31, 0x06, 0x56, 0xF2, 0xCC, 0x98, 0xBD, 0x74,
0x93, 0x57, 0x46, 0x69, 0x00, 0x15, 0x11, 0xEF, 0x38, 0x57, 0xC8, 0x7F, 0xEC, 0x0F, 0x03, 0x14,
0x50, 0x18, 0x16, 0xD0, 0x76, 0x2A, 0x00, 0x00, 0x32, 0x30, 0x30, 0x20, 0x50, 0x4F, 0x52, 0x54,
0x20, 0x63, 0x6F, 0x6D, 0x6D, 0x61, 0x6E, 0x64, 0x20, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73,
0x66, 0x75, 0x6C, 0x2E, 0x0D, 0x0A,
}
Definition at line 145 of file sa_test.c. |
|
Initial value:
{
0x45, 0x00, 0x00, 0x43, 0xB6, 0x8F, 0x40, 0x00, 0x80, 0x06, 0x00, 0x00, 0x93, 0x57, 0x46, 0x69,
0xCC, 0x98, 0xBD, 0x74, 0x11, 0xEF, 0x00, 0x15, 0xEC, 0x0F, 0x02, 0xF9, 0x38, 0x57, 0xC8, 0x7F,
0x50, 0x18, 0xFF, 0x62, 0x64, 0x03, 0x00, 0x00, 0x50, 0x4F, 0x52, 0x54, 0x20, 0x31, 0x34, 0x37,
0x2C, 0x38, 0x37, 0x2C, 0x37, 0x30, 0x2C, 0x31, 0x30, 0x35, 0x2C, 0x31, 0x37, 0x2C, 0x32, 0x34,
0x30, 0x0D, 0x0A,
}
Definition at line 154 of file sa_test.c. |
|
Initial value:
{
0x45, 0xC0, 0x02, 0x14, 0x00, 0x00, 0x00, 0x00, 0x02, 0x11, 0xDB, 0xC8, 0x93, 0x57, 0x46, 0xFA,
0xFF, 0xFF, 0xFF, 0xFF, 0x02, 0x08, 0x02, 0x08, 0x02, 0x00, 0x96, 0x98,
}
Definition at line 163 of file sa_test.c. |
|
Initial value: {
{ SAD_ENTRY( 192,168,156,189, 255,255,255,255,
0x100000,
IPSEC_PROTO_AH, 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,
IPSEC_HMAC_SHA1,
0x01, 0x23, 0x45, 0x67, 0x01, 0x23, 0x45, 0x67, 0x01, 0x23, 0x45, 0x67, 0x01, 0x23, 0x45, 0x67, 0, 0, 0, 0),
SAD_ENTRY( 192,168,156,189, 255,255,255,255,
0x100000,
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,
IPSEC_HMAC_SHA1,
0x01, 0x23, 0x45, 0x67, 0x01, 0x23, 0x45, 0x67, 0x01, 0x23, 0x45, 0x67, 0x01, 0x23, 0x45, 0x67, 0, 0, 0, 0),
SAD_ENTRY( 192,168,156,189, 255,255,255,255,
0x100000,
IPSEC_PROTO_AH, IPSEC_TUNNEL,
0,
0x01, 0x23, 0x45, 0x67, 0x01, 0x23, 0x45, 0x67, 0x01, 0x23, 0x45, 0x67, 0x01, 0x23, 0x45, 0x67, 0x01, 0x23, 0x45 , 0x67, 0x01, 0x23, 0x45, 0x67,
IPSEC_HMAC_SHA1,
0x01, 0x23, 0x45, 0x67, 0x01, 0x23, 0x45, 0x67, 0x01, 0x23, 0x45, 0x67, 0x01, 0x23, 0x45, 0x67, 0, 0, 0, 0)}
}
Definition at line 101 of file sa_test.c. |
|
Initial value: {
{ SPD_ENTRY( 192,168,1,1, 255,255,255,255, 192,168,1,3, 255,255,255,255, IPSEC_PROTO_ICMP, 0, 0, POLICY_APPLY, 0)},
{ SPD_ENTRY( 192,168,1,2, 255,255,255,255, 192,168,1,3, 255,255,255,255, 0, 0, 80, POLICY_DISCARD, 0)},
{ SPD_ENTRY( 192,168,1,2, 255,255,255,255, 192,168,1,3, 255,255,255,255, 0, 0, 0, POLICY_BYPASS, 0)},
{ SPD_ENTRY( 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0, 0, 0, POLICY_BYPASS, 0)}
}
Definition at line 128 of file sa_test.c. |
|