diff options
author | Guy Harris <guy@alum.mit.edu> | 2017-08-29 11:29:26 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-29 11:29:26 -0700 |
commit | b19c83b54e688461fe0cc3a6e77fb3ca86ee9a3c (patch) | |
tree | d485730061d3e39f556fb532ddffb22728e539dc /print-esp.c | |
parent | f3c52ca01e83448bdd44e63f1f74e9198ffc2e1b (diff) | |
download | tcpdump-b19c83b54e688461fe0cc3a6e77fb3ca86ee9a3c.tar.gz |
Update print-esp.c
Diffstat (limited to 'print-esp.c')
-rw-r--r-- | print-esp.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/print-esp.c b/print-esp.c index 9ac7d0be..748fb4a1 100644 --- a/print-esp.c +++ b/print-esp.c @@ -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); |