summaryrefslogtreecommitdiff
path: root/print-esp.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2017-08-29 15:05:00 -0700
committerGuy Harris <guy@alum.mit.edu>2017-08-29 15:05:00 -0700
commitdcf755f49b563fa27692be89bde9b1bdef9c24ae (patch)
tree069da28061678e7592f06aa3654c0b49b27b4085 /print-esp.c
parent8205015f71629c5f11c3e067fcb744bbaecd57da (diff)
downloadtcpdump-dcf755f49b563fa27692be89bde9b1bdef9c24ae.tar.gz
Get rid of an unneeded variable.
We don't want to try to suppress warnings about discarding the const qualifier, as that's something we need to fix. Adding the extra variable doesn't suppress it on some platforms, so it's not useful there, and if it does suppress it, we don't want that. And we weren't doing it in the other case, anyway. Comment in both cases with an XXX comment about the cast.
Diffstat (limited to 'print-esp.c')
-rw-r--r--print-esp.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/print-esp.c b/print-esp.c
index 433b2214..38aa6663 100644
--- a/print-esp.c
+++ b/print-esp.c
@@ -156,7 +156,7 @@ int esp_print_decrypt_buffer_by_ikev2(netdissect_options *ndo,
{
struct sa_list *sa;
const u_char *iv;
- u_char *buf_mut, *output_buffer;
+ u_char *output_buffer;
int len, block_size, output_buffer_size;
EVP_CIPHER_CTX *ctx;
@@ -203,10 +203,11 @@ int esp_print_decrypt_buffer_by_ikev2(netdissect_options *ndo,
EVP_Cipher(ctx, output_buffer, buf, len);
EVP_CIPHER_CTX_free(ctx);
- buf_mut = (u_char*) buf;
- /* Of course this is wrong, because buf is a const buffer, but changing this
- * would require more complicated fix. */
- memcpy(buf_mut, output_buffer, len);
+ /*
+ * XXX - of course this is wrong, because buf is a const buffer,
+ * but changing this would require a more complicated fix.
+ */
+ memcpy(buf, output_buffer, len);
free(output_buffer);
ndo->ndo_packetp = buf;
@@ -745,6 +746,11 @@ esp_print(netdissect_options *ndo,
* 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);
+ /*
+ * XXX - of course this is wrong, because buf is a
+ * const buffer, but changing this would require a
+ * more complicated fix.
+ */
memcpy(p + ivlen, output_buffer, len);
free(output_buffer);
advance = ivoff - (const u_char *)esp + ivlen;