]>
git.saurik.com Git - apple/network_cmds.git/blob - tcpdump.tproj/print-skip.c
d9f505991c21a978e09d041efd919b406039fadc
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
7 * Reserved. This file contains Original Code and/or Modifications of
8 * Original Code as defined in and that are subject to the Apple Public
9 * Source License Version 1.0 (the 'License'). You may not use this file
10 * except in compliance with the License. Please obtain a copy of the
11 * License at http://www.apple.com/publicsource and read it before using
14 * The Original Code and all software distributed under the License are
15 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
19 * License for the specific language governing rights and limitations
22 * @APPLE_LICENSE_HEADER_END@
24 /* $OpenBSD: print-skip.c,v 1.2 1996/07/13 11:01:29 mickey Exp $ */
27 * Copyright (c) 1995 Sun Microsystems, Inc.
28 * All rights reserved.
30 * Permission is hereby granted, without written agreement and without
31 * license or royalty fees, to use, copy, modify, and distribute this
32 * software and its documentation for any purpose, provided that the
33 * above copyright notice and the following two paragraphs appear in
34 * all copies of this software.
36 * IN NO EVENT SHALL SUN MICROSYSTEMS, INC. BE LIABLE TO ANY PARTY FOR
37 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
38 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
39 * SUN MICROSYSTEMS, INC. HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
42 * SUN MICROSYSTEMS, INC. SPECIFICALLY DISCLAIMS ANY WARRANTIES,
43 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
44 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
45 * THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND SUN
46 * MICROSYSTEMS, INC. HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT,
47 * UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
50 #include <sys/param.h>
52 #include <sys/types.h>
54 #include <netinet/in.h>
55 #include <netinet/in_systm.h>
56 #include <netinet/ip.h>
57 #include <netinet/ip_var.h>
58 #include <netinet/tcp.h>
59 #include <netinet/tcpip.h>
65 #include "interface.h"
66 #include "addrtoname.h"
68 #define MAX_ALGS (256)
72 const int skip_max_algs
= MAX_ALGS
;
74 char *old_skip_crypt_algs
[MAX_ALGS
] = {
79 "rc4(128bit)", /* 4 */
85 "simplecrypt" /* 10 */
90 skip_alg_to_name(char *table
[], int alg
)
92 if (alg
> skip_max_algs
) {
98 if (table
[alg
] == NULL
) {
101 if (strlen(table
[alg
]) == 0) {
102 return ("<unknown>");
108 * This is what an OLD skip encrypted-authenticated packet looks like:
112 * ---------------------------------
114 * / Clear IP Header /
115 * | | IP protocol = IPSP
116 * ---------------------------------
120 * ---------------------------------
122 * / Protected IPSP Payload /
125 * ---------------------------------
128 * The format of the IPSP header for encrypted-encapsulated mode is shown below. * The fields are transmitted from left to right.
131 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
132 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
133 * | Ver. |E|A|C|S|B|R| zero |
134 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
135 * | Kij alg. | Kp alg. | reserved |
136 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
137 * | Optional boxid field |
138 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
139 * | Kp encrypted in Kij... (typically 8-16 bytes)
140 * +-+-+-+-+-+-+-+-+-+-+-+-+-+
141 * | Message Indicator (e.g IV)... (typically 8-16 bytes)
142 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
143 * | Protected IPSP Payload...
144 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
148 * Ver.: protocol version
149 * E: 1 if packet is encrypted, 0 otherwise
150 * A: 1 if packet is authenticated, 0 otherwise
151 * C: 1 if packet is compressed before encryption, 0 otherwise
152 * S: 1 if packet is sequenced, 0 otherwise
153 * B: 1 if packet is tunneled (header contains boxid), 0 otherwise
154 * R: reserved (should be 0 until specified)
158 * per-algorithm encrytped key sizes...
160 unsigned char old_skip_ekp_sizes
[MAX_ALGS
] = {
164 8, /* RC4 (40 bit) */
165 16, /* RC4 (128 bit) */
174 * per-algorithm message indicator sizes...
176 unsigned char old_skip_mid_sizes
[MAX_ALGS
] = {
190 void skip_print_old(register const u_char
*bp
, register int length
,
196 unsigned char kij_alg
, kp_alg
, *c
;
205 printf("SKIP: *** OLD SKIP ***\n");
206 printf("OSKIP: %s>%s:%d",ipaddr_string(&ip
->ip_src
),
207 ipaddr_string(&ip
->ip_dst
),length
);
210 printf("\nOSKIP: SAID byte 1= 0x%02x\n",*p
);
211 printf("OSKIP: xxxx .... = version %d\n", (int) (*p
& 0xf0) >> 4);
213 printf("OSKIP: .... 1... = encrypted\n");
215 printf("OSKIP: .... 0... = not encrypted\n");
219 printf("OSKIP: .... .1.. = authenticated\n");
221 printf("OSKIP: .... .0.. = not authenticated\n");
225 printf("OSKIP: .... ..1. = compressed\n");
227 printf("OSKIP: .... ..0. = not compressed\n");
231 printf("OSKIP: .... ...1 = sequenced\n");
233 printf("OSKIP: .... ...0 = not sequenced\n");
238 printf("OSKIP: SAID byte 2 = 0x%02x\n", *p
);
242 printf("OSKIP: 1... .... = Node ID present\n");
245 printf("OSKIP: 0... .... = no Node ID present\n");
249 printf("OSKIP: .1.. .... = <reserved should be zero>\n");
251 printf("OSKIP: .0.. .... = <reserved should be zero>\n");
255 printf("OSKIP: ..1. .... = <reserved should be zero>\n");
257 printf("OSKIP: ..0. .... = <reserved should be zero>\n");
261 printf("OSKIP: ...1 .... = <reserved should be zero>\n");
263 printf("OSKIP: ...0 .... = <reserved should be zero>\n");
266 printf("OSKIP: SAID byte 3 = 0x%02x\n", *p
);
269 printf("OSKIP: SAID byte 4 = 0x%02x\n", *p
);
274 printf("OSKIP: Kij alg (key encryption algorithm) = 0x%02x (%s)\n",
275 kij_alg
, skip_alg_to_name(old_skip_crypt_algs
,kij_alg
));
280 printf("OSKIP: Kp alg (traffic encryption algorithm) = 0x%02x (%s)\n",
281 kp_alg
, skip_alg_to_name(old_skip_crypt_algs
,kp_alg
));
286 * the skip reserved field
288 printf("OSKIP: reserved byte 1 = 0x%02x\n", *p
++);
289 printf("OSKIP: reserved byte 2 = 0x%02x\n", *p
++);
295 if ((end
- p
) < sizeof(boxid
)) {
298 c
= (unsigned char *) &boxid
;
304 printf("OSKIP: Node ID = 0x%08x\n", ntohl(boxid
));
308 * encrypted kp (ekp) field
312 * do this with a for-loop to avoid alignment problems and the
313 * overhead of calling bcopy()
315 len
= old_skip_ekp_sizes
[kp_alg
];
316 if ((unsigned short) (end
- p
) < len
) {
320 printf("OSKIP: encrypted Kp: ");
321 for (i
= 0; i
< len
; i
++) {
322 printf("%02x ", (unsigned char) *p
++);
327 * message indicator (mid) field
329 len
= old_skip_mid_sizes
[kp_alg
];
330 if ((unsigned short) (end
- p
) < len
) {
333 printf("OSKIP: message indicator field: ");
334 for (i
= 0; i
< len
; i
++) {
335 printf("%02x ", (unsigned char) *p
++);
343 * The following part is (c) by G. Caronni -- 29.11.95
345 * This code is in the public domain; do with it what you wish.
347 * NO WARRANTY, NO SUPPORT, NO NOTHING!
352 * This is what a NEW skip encrypted-authenticated packet looks like:
356 * ---------------------------------
358 * / Clear IP Header /
359 * | | IP protocol = SKIP
360 * ---------------------------------
364 * ---------------------------------
366 * | Auth Header & payload |
368 * ---------------------------------
370 * | ESP header and SPI |
372 * ---------------------------------
374 * / Protected ESP Payload /
376 * ---------------------------------
379 * The format of the SKIP header for encrypted-encapsulated mode is shown below. * The fields are transmitted from left to right.
382 * 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
383 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
384 * | Ver | Rsvd | Source NSID | Dest NSID | NEXT HEADER |
385 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
387 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
388 * | Kij Alg | Crypt Alg | MAC Alg | Comp Alg |
389 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
390 * | Kp encrypted in Kijn... (typically 8-16 bytes)
391 * +-+-+-+-+-+-+-+-+-+-+-+-+-+
392 * | Source Master Key-ID (If Source NSID is non-zero)
393 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
394 * | Destination Master Key-ID (If Dest NSID is non-zero)
395 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
404 * per name space key ID sizes...
406 unsigned char skip_nsid_sizes
[MAX_ALGS
] = {
408 4, /* 1 IP v4 Address Space */
409 4, /* 2 POSIX/XOPEN User Ids */
410 16, /* 3 IPv6 Address Space */
411 16, /* 4 MD5 of DNS Names */
412 16, /* 5 MD5 of ISO ASN.1 DN encoding */
413 16, /* 6 MD5 of US Social Security number */
414 6, /* 7 802.x MAC Address */
415 16, /* 8 MD5 of public Value */
416 16, /* 9 MD5 of RFC822 Mailbox Address */
417 16, /* 10 MD5 of Bank Account # */
418 16, /* 11 MD5 of NIS Name */
423 * per Kp algorithm encrypted Kp sizes... (Kij alg does not matter for now)
425 unsigned char skip_ekp_sizes
[MAX_ALGS
] = {
428 24, /* 2 3 key triple DES-EDE-CBC */
435 0, /* 9 */ /* 10 .. 249 */
436 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
437 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
438 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
439 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
440 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
441 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
443 16, /* 251 RC4-128 */
444 8, /* 252 simple crypt */
452 * per-algorithm NSID names ...
454 char *skip_nsid_names
[MAX_ALGS
] = {
457 "Posix/Xopen UID", /* 2 */
460 "MD5 ASN.1 DN", /* 5 */
461 "MD5 U.S. Soc. #", /* 6 */
463 "MD5 DH Public Key",/* 8 */
464 "MD5 RFC822 Mail", /* 9 */
465 "MD5 Bank Account", /* 10 */
466 "MD5 NIS Name", /* 11 */
471 * per-algorithm Kij alg names ...
473 char *skip_kij_names
[MAX_ALGS
] = {
476 "3DES3-EDE-CBC", /* 2 */
481 /* for padding of ekp */
483 char skip_kij_sizes
[MAX_ALGS
] = {
486 8, /* 2 3des3-ede-cbc */
492 * per-algorithm Crypt alg names ...
494 char *skip_crypt_names
[MAX_ALGS
] = {
497 "3 key DES-EDE-CBC", /* 2 */
504 "", /* 9 */ /* 10 .. 249 */
505 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
506 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
507 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
508 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
509 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
510 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
513 "simple crypt", /* 252 */
514 "IDEA CBC", /* 253 */
521 * per-algorithm Auth alg names ...
523 char *skip_auth_names
[MAX_ALGS
] = {
526 "DES-CBC MAC", /* 2 */
531 char skip_auth_sizes
[MAX_ALGS
] = {
533 16, /* 1 keyed MD5 */
534 8, /* 2 DES-CBC MAC */
535 20, /* 3 Keyed SHA */
540 * per-algorithm Crypt alg IV sizes ...
542 char skip_crypt_sizes
[MAX_ALGS
] = {
545 8, /* 2 3key DES-EDE-CBC */
552 0, /* 9 */ /* 10 .. 249 */
553 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
554 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
555 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
556 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
557 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
558 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
561 8, /* 252 simple crypt */
562 8, /* 253 IDEA CBC */
569 #define IPPROTO_ESP 50
572 #define IPPROTO_AH 51
575 #define IPPROTO_SKIP 57
577 #ifndef IPPROTO_OSKIP
578 #define IPPROTO_OSKIP 79
581 static int expected_auth_size
=0;
582 static int expected_iv_size
=0;
584 char *skip_protocol_name(int p
)
587 case IPPROTO_IP
: return "IP";
588 case IPPROTO_ICMP
: return "ICMP";
589 case IPPROTO_IGMP
: return "IGMP";
590 case IPPROTO_ENCAP
: return "ENCAP";
591 case IPPROTO_TCP
: return "TCP";
592 case IPPROTO_EGP
: return "EGP";
593 case IPPROTO_UDP
: return "UDP";
594 case IPPROTO_ESP
: return "ESP";
595 case IPPROTO_AH
: return "AH";
596 case IPPROTO_SKIP
: return "SKIP";
597 case IPPROTO_ND
: return "ND";
598 case IPPROTO_OSKIP
: return "OLD-SKIP";
599 case IPPROTO_RAW
: return "RAW IP";
600 default: return "<unknown>";
604 void skip_print_next(u_char nxt
, const u_char
*p
, int len
, const u_char
*bp2
)
607 case IPPROTO_IP
: ip_print(p
,len
); break;
608 case IPPROTO_ICMP
: icmp_print(p
,bp2
); break;
609 case IPPROTO_TCP
: tcp_print(p
,len
,bp2
); break;
610 case IPPROTO_UDP
: udp_print(p
,len
,bp2
); break;
611 case IPPROTO_ESP
: esp_print(p
,len
,bp2
); break;
612 case IPPROTO_AH
: ah_print(p
,len
,bp2
); break;
613 case IPPROTO_SKIP
: skip_print(p
,len
,bp2
); break;
618 void skip_print(register const u_char
*bp
, register int length
,
624 unsigned char kij_alg
, crypt_alg
, auth_alg
, snsid
, dnsid
, nxt
;
632 end
=bp
+length
<snapend
?bp
+length
:snapend
;
634 printf("%s>%s:%d SKIP",ipaddr_string(&ip
->ip_src
),
635 ipaddr_string(&ip
->ip_dst
),length
);
640 if ((unsigned short) (end
- p
) < 4) {
641 printf("[SKIP|] (truncated)\n");
645 printf("\nSKIP: version\t\t\t%d\n", (int) (*p
& 0xf0) >> 4);
647 printf("SKIP: version byte \t\treserved,\tis now 0x%x\n",
652 printf("SKIP: Source NSID\t\t0x%02x\t\t%s\n",
653 snsid
, skip_alg_to_name(skip_nsid_names
,snsid
));
657 printf("SKIP: Destination NSID\t\t0x%02x\t\t%s\n",
658 dnsid
, skip_alg_to_name(skip_nsid_names
,dnsid
));
662 printf("SKIP: Next Protocol Field\t0x%02x\t\t%s\n", nxt
,
663 skip_protocol_name(nxt
));
667 if ((unsigned short) (end
- p
) < 4) {
668 printf("[SKIP|] (truncated)\n");
676 full_n
=(((365*25+6)*24)+n
)*3600;
677 printf("SKIP: Counter n Field\t\t0x%08x\t%s", n
,
678 asctime(gmtime(&full_n
)));
681 if ((unsigned short) (end
- p
) < 4) {
682 printf("[SKIP|] (truncated)\n");
687 printf("SKIP: Kij alg (key encryption)\t0x%02x\t\t%s\n",
688 kij_alg
, skip_alg_to_name(skip_kij_names
,kij_alg
));
692 expected_iv_size
=skip_crypt_sizes
[crypt_alg
];
693 printf("SKIP: Crypt Alg\t\t\t0x%02x\t\t%s\n",
694 crypt_alg
, skip_alg_to_name(skip_crypt_names
,crypt_alg
));
698 expected_auth_size
=skip_auth_sizes
[auth_alg
];
699 printf("SKIP: Auth Alg\t\t\t0x%02x\t\t%s\n",
700 auth_alg
, skip_alg_to_name(skip_auth_names
,auth_alg
));
703 if (*p
) printf("SKIP: compression\t\treserved,\tis now0x%02x\n",
708 * encrypted kp (ekp) field
711 if (kij_alg
==0 && (crypt_alg
|| auth_alg
)) {
712 printf("Warning: Kij Alg. undefined, but Auth. or Crypt. used!");
713 printf("Warning: Assuming empty Kp\n");
714 crypt_alg
=auth_alg
=0;
717 * do this with a for-loop to avoid alignment problems and the
718 * overhead of calling bcopy()
720 len
= skip_ekp_sizes
[crypt_alg
];
721 len
= len
>(int)skip_auth_sizes
[auth_alg
]?len
:skip_auth_sizes
[auth_alg
];
722 if (len
&& skip_kij_sizes
[kij_alg
] && len
% skip_kij_sizes
[kij_alg
]) {
723 len
+= skip_kij_sizes
[kij_alg
] - (len%skip_kij_sizes
[kij_alg
]);
725 if ((unsigned short) (end
- p
) < len
) {
726 printf("[SKIP|] (truncated)\n");
730 printf("SKIP: Encrypted Kp\t\t");
731 for (i
= 0; i
< len
; i
++) {
732 printf("%02x ", (unsigned char) *p
++);
739 * Source Master Key-ID field
741 if ((end
- p
) < skip_nsid_sizes
[snsid
]) {
742 printf("[SKIP|] (truncated)\n");
745 printf("SKIP: Source Master Key-ID\t");
747 printf("%s",ipaddr_string(p
));
748 p
+=skip_nsid_sizes
[snsid
];
750 for (i
= 0; i
< skip_nsid_sizes
[snsid
]; i
++) {
751 printf("%02x ", (unsigned char) *p
++);
759 * Destination Master Key-ID field
761 if ((end
- p
) < skip_nsid_sizes
[dnsid
]) {
762 printf("[SKIP|] (truncated)\n");
765 printf("SKIP: Dest. Master Key-ID\t");
767 printf("%s",ipaddr_string(p
));
768 p
+=skip_nsid_sizes
[dnsid
];
770 for (i
= 0; i
< skip_nsid_sizes
[dnsid
]; i
++) {
771 printf("%02x ", (unsigned char) *p
++);
776 if (p
<end
) skip_print_next(nxt
,p
,end
-p
,bp2
);
777 else printf("(truncated)\n");
782 void ah_print(register const u_char
*bp
, register int length
,
794 end
=bp
+length
<snapend
?bp
+length
:snapend
;
797 printf("SKIP-AH: %s>%s:%d",ipaddr_string(&ip
->ip_src
),
798 ipaddr_string(&ip
->ip_dst
),length
);
803 printf("[SKIP-AH|]\n");
808 printf("\nSKIP-AH: Next Protocol Field\t0x%02x\t\t%s\n", nxt
,
809 skip_protocol_name(nxt
));
813 printf("SKIP-AH: length\t\t\t%d\n", len
);
817 if (*p
) printf("SKIP-AH: byte 3\t\t\treserved,\tis now0x%02x\n",
820 if (*p
) printf("SKIP-AH: byte 4\t\t\treserved,\tis now0x%02x\n",
825 printf("[SKIP-AH|]\n");
833 printf("SKIP-AH: SPI\t\t\t0x%08x\t", spi
);
835 printf("NO association\n");
837 printf("SKIP association\n");
838 if (expected_auth_size
) {
839 if (expected_auth_size
!= len
) {
840 printf("Warning: Length does not match SKIP Auth Alg!\n");
842 expected_auth_size
=0;
844 } else if (spi
<256) {
845 printf("UNKNOWN association\n");
847 printf("DYNAMIC association\n");
854 * authentication data
857 if ((unsigned short) (end
- p
) < len
) {
858 printf("[SKIP-AH|] (truncated)\n");
862 printf("SKIP-AH: Authentication Data\t");
863 for (i
= 0; i
< len
; i
++) {
864 printf("%02x ", (unsigned char) *p
++);
865 if (i
<len
-1 && (i
+1)%16
==0) printf("\n\t\t\t\t");
869 if (p
<end
) skip_print_next(nxt
,p
,end
-p
,bp2
);
870 else printf("(truncated)\n");
874 void esp_print(register const u_char
*bp
, register int length
,
885 end
=bp
+length
<snapend
?bp
+length
:snapend
;
888 printf("SKIP-ESP: %s>%s:%d",ipaddr_string(&ip
->ip_src
),
889 ipaddr_string(&ip
->ip_dst
),length
);
894 printf("[SKIP-ESP|]\n");
901 printf("\nSKIP-ESP: SPI\t\t\t0x%08x\t", spi
);
903 printf("NO association\n");
906 printf("SKIP association\n");
907 len
=expected_iv_size
;
908 if (!expected_iv_size
) {
909 printf("Warning: IV size not defined by SKIP Crypt Alg!\n");
910 } else expected_iv_size
=0;
911 } else if (spi
<256) {
912 printf("UNKNOWN association\n");
915 printf("DYNAMIC association\n");
925 if ((unsigned short) (end
- p
) < len
) {
926 printf("[SKIP-ESP|] (truncated)\n");
930 printf("SKIP-ESP: Initalization Vector\t");
932 for (i
= 0; i
< len
; i
++) {
933 printf("%02x ", (unsigned char) *p
++);
934 if (i
<len
-1 && (i
+1)%16
==0) printf("\n\t\t\t\t");
937 printf("UNDEFINED (unknown algorithm)");
941 /* no further analysis is possible without decrypting */