1 bienvenue! herzlich willkommen! welcome! christian scheurer ingenieur fh in informatik embedded...

Post on 06-Apr-2016

214 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

1

Bienvenue!Herzlich willkommen!

Welcome!

Christian ScheurerIngenieur FH in InformatikEmbedded World Conference

Nürnberg, 17. Februar 2004

2

• Motivation und Ziele• Design und Implementation• Testen• Ergebnisse

Inhalt

3

Motivation & Ziele

4

• Offene IPsec Implementation ausgelegt für low-end embedded Systeme

• Interoperabilität mit andern IPsec Systemen

Motivation & Ziele

5

Design & Implementation

6

• IPsec verstehen– Literatur: Big Book of IPsec RFCs– Praktische Tests mit FreeS/WAN

• Entwicklungsumgebung– PC mit Keil uVision IDE und Sniffer– PC mit Debian Linux und FreeS/WAN– C167-Board und 10Mbit Ethernet Hub

Vorbereitung

7

3DES CBC encrypt3DES CBC decrypt

HMAC-MD5HMAC-SHA1

AH encapsulate

AH check

ESP decapsulate

ESP encapsulate

SAD lookupSPD lookupSPD lookup

IPsec Output

IPsec Input

cs8900 outputcs8900 input

IP input

IP output

IPsec I/O

SAD

ESP

AH

Cryptolibrary

SPD

IPsecDeviceDriver

TCP/IPStack

cs8900NetworkDriver

Design

embedded IPsecModule

8

• Reihenfolge Implementation:1.) Anbindung an TCP/IP Stack2.) Konfigurationsdatenbanken3.) Crypto Funktionen4.) AH Protokoll5.) ESP Protokoll6.) AntiReplay, ...

Design

9

3DES CBC encrypt3DES CBC decrypt

HMAC-MD5HMAC-SHA1

AH encapsulate

AH check

ESP decapsulate

ESP encapsulate

SAD lookupSPD lookupSPD lookup

IPsec Output

IPsec Input

cs8900 outputcs8900 input

IP input

IP output

IPsec I/O

SAD

ESP

AH

Cryptolibrary

SPD

IPsecDeviceDriver

TCP/IPStack

cs8900NetworkDriver

ipsecdev/ipsec - Module

„ipsecdev“

10

lwIP TCP/IP Stack

lwIP – a light weight TCP/IP Stack

TCP/IP Stack

CS8900 Driver Device Driver

I P Layer

cs8900_ input() cs8900_output()

ip_ input() ip_output()

input output

Ethernet

11

1.) Anbindung an TCP/IP Stack

TrafficInterception

I Pseclibrary

Device Driver

I P Layer

I Psec Driveripsecdev_ input() ipsecdev_output()

cs8900_ input() cs8900_output()

ip_ input() ip_output()

input output

ipse

c_in

put(

)

ipse

c_ou

tput

()

Ethernet

IPsec LibraryIPsec Driver

12

3DES CBC encrypt3DES CBC decrypt

HMAC-MD5HMAC-SHA1

AH encapsulate

AH check

ESP decapsulate

ESP encapsulate

SAD lookupSPD lookupSPD lookup

IPsec Output

IPsec Input

cs8900 outputcs8900 input

IP input

IP output

IPsec I/O

SAD

ESP

AH

Cryptolibrary

SPD

IPsecDeviceDriver

TCP/IPStack

cs8900NetworkDriver

Datenbank - Module

SPD und SAD

13

2.) SAD und SPD

Network Interface

Inbound

SPD

SAD

embedded IPsec

11

11

Outbound

SPD

SAD

11

11

1

*1

1 1 1

14

Security Policy Database

• Welche Pakete werden verarbeitet?– DISCARD

– BYPASS

– APPLY

15

Security Policy Database

Beispiel einer SPD Konfiguration

16

Security Association Database

• Wie werden Pakete verarbeitet?– Tunnel oder Transport Mode – AH oder ESP – Algorithmen und Keys– Security Parameter Index

17

Security Association Database

Beispiel einer SAD Konfiguration

18

Outbound Processing

Datenfluss beiOutbound Processing

SPDlookup

encapsulateIPsec packet

device driveroutput

BYPASS

DISCARD

audi

tabl

e ev

ents

ipsecdev_output()

cs8900_output()

IP output

APPLYip_output()SA

19

3DES CBC encrypt3DES CBC decrypt

HMAC-MD5HMAC-SHA1

AH encapsulate

AH check

ESP decapsulate

ESP encapsulate

SAD lookupSPD lookupSPD lookup

IPsec Output

IPsec Input

cs8900 outputcs8900 input

IP input

IP output

IPsec I/O

SAD

ESP

AH

Cryptolibrary

SPD

IPsecDeviceDriver

TCP/IPStack

cs8900NetworkDriver

AH/ESP/Crypto - Module

AH und ESP

20

• Crypto Funktionen von OpenSSL– DES, 3DES– HMAC-MD5-96, HMAC-SHA1-96

• Für MCU optimierte Versionen– Dmitry Basko‘s DES

• http://www.dbasko.com – Graham Cole‘s MD5

• http://www.programmersheaven.com/zone5/cat27/index.htm

3.) Crypto Library

21

4.) Authentication Header

unencrypted IP packet

IP header IP payloadfree headroom

free tailroom

one contiguous block of RAM

authenticated IP packetfree headroom

free tailroomIC

V

Nex

t hea

der,

Leng

th,

SP

I,S

eq N

r

deca

psul

atio

n

new

IPhe

ader

encapsulation

AH in IP packet (tunnel mode)

AHheader

AH payload

22

5.) Encapsulating Security Payload

unencrypted IP packet

IP header IP payloadfree headroom

free tailroom

one contiguous block of RAM

encrypted and padded IP packetfree headroom

free tailroomIVS

PI

Seq

Nr.

ICV

Pad

ding

,P

add.

Len

,ne

xt H

eade

r

decr

yptio

n /

deca

psul

atio

n

new

IPhe

ader

encryption /encapsulation

ESP in IP packet (tunnel mode)

ESPheader

ESP payload

23

Speicherverwaltung

free memoryspace

free memoryspace

lengthpayload

p bufhe ade r

pbufdata space

IP header

TCP header

payload

len gth

next

free memoryspace

free memoryspace

lengthpayload

pbufhe ade r

pbufdata space

le n gth

next

IPsec header

outer I P header

inner packet

padding & ICV

24

Testen

25

• Test-Konzept

Testen

IPsec ModuleImplementation

Functional Test

Structural Test

Sample Application

Automated TestScripts

embedded IPsecRelease Version

1.

2.

3.

26

• Structural Tests

Testen

TST sa_test_sad_lookup() : SUCCESS : TST sa_test_sad_get_spi(): SUCCESS : TST sa_test_spd_flush() : NOT IMPL. : TST sa_test_sad_flush() : NOT IMPL. :

TST test_esp_decapsulate : SUCCESS : TST test_esp_encapsulate : SUCCESS :

MSG main : structural testing finished:MSG main : o 100.00% correct (92 of 92 tests passed)MSG main : o 82.61% complete (19 of 23 functions implemented)

27

• Functional Tests

Testen

IP layer

IPsec driver

Network Driver

Transport Layer

Application Layer

IP layer

IPsec driver

Network Driver

Transport Layer

Application LayerInject applicationdata: e.g webpage

Compare withexpected result

Inject IPsecpackets

Compare withexpected result

Bottom

-up Test

Top-dow

n Test

28

Ergebnisse

29

• Grösse

Ergebnisse

05'000

10'00015'00020'00025'00030'00035'00040'000

size

[by

tes]

IPSE

CIP

SECD

EV AH ESP SA D

ESM

D5

SHA1

UTI

L

RAMROMCode

Protokolle und DBtotal 18kB

Crypto Library aufOpenSSL Basistotal 90kB

30

• Performance

Ergebnisse

0

200

400

600

800

1000

1200

64 128 256 512 768 1024 1280Payload size [bytes]

Roun

d-tr

ip ti

me

[ms]

non-IPsecAH HMAC-MD5AH HMAC-SHA1ESP 3DESESP 3DES HMAC-MD5ESP 3DES HMAC-SHA1

64 BytesOhne: 5 mS

AH-MD5: 19 mSESP-3DES: 60 mS

512 BytesOhne: 8 mS

AH-MD5: 38 mSESP-3DES: 351 mS

1280 BytesOhne: 13 mS

AH-MD5: 165 mSESP-3DES: 851 mS

31

• Einsatzgebiete– Vernetzte Sensoren– Gebührenzähler

Ergebnisse

Protokoll Round-Trip Time[1024 Bytes] Durchsatz Anwendung

AH-MD5 60 mS ca. 25 kB/s DatenESP-3DES 685 mS ca. 2.5 kB/s HTMLESP-3DES-MD5 733 mS ca. 2 kB/s Email

32

• Interoperabilität

Ergebnisse

33

• Arbeitsaufwand ca. 1‘000h

Ergebnisse

0

10

20

30

40

50

60

70

1 2 3 4 5 6 7 8Zeit (Wochen)

Auf

wan

d (S

tund

en)

AdminCodeTestsDocTotal

34

• Weitergeführt als Projekt

– Niklaus Schildhttp://www.hta-bi.bfh.ch/Projects/ipsec/

– Christian Scheurerhttp://www.christianscheurer.ch

Zukunft

35

Merci! Es folgt die Demo

top related