]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Update print-esp.c
authorGuy Harris <[email protected]>
Tue, 29 Aug 2017 18:29:26 +0000 (11:29 -0700)
committerGitHub <[email protected]>
Tue, 29 Aug 2017 18:29:26 +0000 (11:29 -0700)
print-esp.c

index 9ac7d0be64866ac90a831b00c46e795819fd8d11..748fb4a1486dcc43ed224e8fd00a4373f316856f 100644 (file)
@@ -734,19 +734,19 @@ esp_print(netdissect_options *ndo,
 
                        p = ivoff;
                        EVP_CipherInit(ctx, NULL, NULL, p, 0);
-                        len = ep - (p + ivlen);
-
-                        /* We need a block size */
-                        block_size = EVP_CIPHER_CTX_block_size(ctx);
-                        /* We need the buffer size to be multiple of a block size */
-                        output_buffer_size = len + (block_size - len % block_size);
-                        output_buffer = (u_char *)calloc(output_buffer_size, sizeof(u_char));
-                        /* EVP_Cipher output buffer should be different from the input one.
-                         * Also it should be of size that is multiple of cipher block size. */
-                        EVP_Cipher(ctx, output_buffer, p + ivlen, len);
+                       len = ep - (p + ivlen);
+
+                       /* We need a block size */
+                       block_size = EVP_CIPHER_CTX_block_size(ctx);
+                       /* We need the buffer size to be multiple of a block size */
+                       output_buffer_size = len + (block_size - len % block_size);
+                       output_buffer = (u_char *)calloc(output_buffer_size, sizeof(u_char));
+                       /* EVP_Cipher output buffer should be different from the input one.
+                        * Also it should be of size that is multiple of cipher block size. */
+                       EVP_Cipher(ctx, output_buffer, p + ivlen, len);
                        EVP_CIPHER_CTX_free(ctx);
-                        memcpy(p + ivlen, output_buffer, len);
-                        free(output_buffer);
+                       memcpy(p + ivlen, output_buffer, len);
+                       free(output_buffer);
                        advance = ivoff - (const u_char *)esp + ivlen;
                } else
                        advance = sizeof(struct newesp);