]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-esp.c
Merge branch 'master' of git+ssh://bpf.tcpdump.org/tcpdump/master/git/tcpdump
[tcpdump] / print-esp.c
index 7b2a9c75c15fa86ff9b25889e2744a7bde79c32d..ee04ea53e0cb09d0625c6b6584e0d0f06c1dfd11 100644 (file)
@@ -149,7 +149,7 @@ int esp_print_decrypt_buffer_by_ikev2(netdissect_options *ndo,
 
        /* initiator arg is any non-zero value */
        if(initiator) initiator=1;
-                                      
+
        /* see if we can find the SA, and if so, decode it */
        for (sa = ndo->ndo_sa_list_head; sa != NULL; sa = sa->next) {
                if (sa->spi == 0
@@ -184,7 +184,7 @@ int esp_print_decrypt_buffer_by_ikev2(netdissect_options *ndo,
        ndo->ndo_snapend = end;
 
        return 1;
-       
+
 }
 USES_APPLE_RST
 
@@ -243,12 +243,12 @@ int espprint_decode_hex(netdissect_options *ndo,
        int i;
 
        len = strlen(hex) / 2;
-               
+
        if (len > binbuf_len) {
                (*ndo->ndo_warning)(ndo, "secret is too big: %d\n", len);
                return 0;
        }
-               
+
        i = 0;
        while (hex[0] != '\0' && hex[1]!='\0') {
                binbuf[i] = hex2byte(ndo, hex);
@@ -272,14 +272,14 @@ espprint_decode_encalgo(netdissect_options *ndo,
        const EVP_CIPHER *evp;
        int authlen = 0;
        char *colon, *p;
-       
+
        colon = strchr(decode, ':');
        if (colon == NULL) {
                (*ndo->ndo_warning)(ndo, "failed to decode espsecret: %s\n", decode);
                return 0;
        }
        *colon = '\0';
-       
+
        if (strlen(decode) > strlen("-hmac96") &&
            !strcmp(decode + strlen(decode) - strlen("-hmac96"),
                    "-hmac96")) {
@@ -301,11 +301,11 @@ espprint_decode_encalgo(netdissect_options *ndo,
                sa->ivlen = 0;
                return 0;
        }
-       
+
        sa->evp = evp;
        sa->authlen = authlen;
        sa->ivlen = EVP_CIPHER_iv_length(evp);
-       
+
        colon++;
        if (colon[0] == '0' && colon[1] == 'x') {
                /* decode some hex! */
@@ -315,7 +315,7 @@ espprint_decode_encalgo(netdissect_options *ndo,
                if(sa->secretlen == 0) return 0;
        } else {
                i = strlen(colon);
-               
+
                if (i < sizeof(sa->secret)) {
                        memcpy(sa->secret, colon, i);
                        sa->secretlen = i;
@@ -345,7 +345,7 @@ espprint_decode_authalgo(netdissect_options *ndo,
                return 0;
        }
        *colon = '\0';
-       
+
        if(strcasecmp(colon,"sha1") == 0 ||
           strcasecmp(colon,"md5") == 0) {
                sa->authlen = 12;
@@ -364,21 +364,21 @@ static void esp_print_decode_ikeline(netdissect_options *ndo, char *line,
        int   ilen, rlen;
        char *authkey;
        char *enckey;
-       
+
        init = strsep(&line, " \t");
        icookie = strsep(&line, " \t");
        rcookie = strsep(&line, " \t");
        authkey = strsep(&line, " \t");
        enckey  = strsep(&line, " \t");
-       
+
        /* if any fields are missing */
        if(!init || !icookie || !rcookie || !authkey || !enckey) {
                (*ndo->ndo_warning)(ndo, "print_esp: failed to find all fields for ikev2 at %s:%u",
                                    file, lineno);
-               
+
                return;
        }
-       
+
        ilen = strlen(icookie);
        rlen = strlen(rcookie);
 
@@ -392,7 +392,7 @@ static void esp_print_decode_ikeline(netdissect_options *ndo, char *line,
 
                (*ndo->ndo_warning)(ndo, "init=%s icookie=%s(%u) rcookie=%s(%u)",
                                    init, icookie, ilen, rcookie, rlen);
-               
+
                return;
        }
 
@@ -407,7 +407,7 @@ static void esp_print_decode_ikeline(netdissect_options *ndo, char *line,
        if(!espprint_decode_encalgo(ndo, enckey, &sa1)) return;
 
        if(!espprint_decode_authalgo(ndo, authkey, &sa1)) return;
-       
+
        esp_print_addsa(ndo, &sa1, FALSE);
 }
 
@@ -473,27 +473,27 @@ static void esp_print_decode_onesecret(netdissect_options *ndo, char *line,
        if (spikey && strcasecmp(spikey, "ikev2") == 0) {
                esp_print_decode_ikeline(ndo, line, file, lineno);
                return;
-       } 
+       }
 
        if (spikey) {
-               
+
                char *spistr, *foo;
                u_int32_t spino;
                struct sockaddr_in *sin;
 #ifdef INET6
                struct sockaddr_in6 *sin6;
 #endif
-               
+
                spistr = strsep(&spikey, "@");
-               
+
                spino = strtoul(spistr, &foo, 0);
                if (spistr == foo || !spikey) {
                        (*ndo->ndo_warning)(ndo, "print_esp: failed to decode spi# %s\n", foo);
                        return;
                }
-               
+
                sa1.spi = spino;
-               
+
                sin = (struct sockaddr_in *)&sa1.daddr;
 #ifdef INET6
                sin6 = (struct sockaddr_in6 *)&sa1.daddr;
@@ -519,7 +519,7 @@ static void esp_print_decode_onesecret(netdissect_options *ndo, char *line,
                /* skip any blank spaces */
                while (isspace((unsigned char)*decode))
                        decode++;
-               
+
                if(!espprint_decode_encalgo(ndo, decode, &sa1)) {
                        return;
                }
@@ -688,7 +688,7 @@ esp_print(netdissect_options *ndo,
         */
        if (sa == NULL)
                sa = ndo->ndo_sa_default;
-       
+
        /* if not found fail */
        if (sa == NULL)
                goto fail;