Not able to compile packet-pkcs12-template.c
Hello all,
I am new to wireshark development. I have been able to setup build environment on Cent OS7 and compile wireshark source.
But then I proceeded to make couple of changes in packet-pkcs12-template.c. I got a compile error. I fixed it but I still get the error. Changes to other dissectors like packet-xxx.c (non-asn1 generated) were compiled successfully. I then made random changes in this file to see if the compiler is really looking at the modified file. Surprisingly I do not get other errors I was expecting before the original error. I keep getting the same first error even after fixing it.
I wonder there is something that I don't know about modifying and compiling *-template.c files.
I am badly in need of help. Let me know if you need any details.
Thanks in advance.
[ 7%] Built target dissectors-corba
[ 7%] Building C object epan/dissectors/CMakeFiles/dissectors.dir/packet-pkcs12.c.o
./asn1/pkcs12/packet-pkcs12-template.c: In function 'PBE_decrypt_data':
./asn1/pkcs12/packet-pkcs12-template.c:344:2: error: passing argument 2 of 'tvb_new_child_real_data' discards 'const' qualifier from pointer target type [-Werror]
In file included from /root/wireshark/epan/proto.h:35:0,
from /root/wireshark/epan/packet.h:14,
from ./asn1/pkcs12/packet-pkcs12-template.c:18:
/root/wireshark/epan/tvbuff.h:150:25: note: expected 'guint8 *' but argument is of type 'const guint8 *'
WS_DLL_PUBLIC tvbuff_t *tvb_new_child_real_data(tvbuff_t *parent,
^
cc1: all warnings being treated as errors
make[2]: *** [epan/dissectors/CMakeFiles/dissectors.dir/packet-pkcs12.c.o] Error 1
make[1]: *** [epan/dissectors/CMakeFiles/dissectors.dir/all] Error 2
make: *** [all] Error 2
packet-pkcs12.c does not get generated as I see the old timestamp on this.
In packet-pkcs12-template.c, I make following change in PBE_decrypt_data() to get additional compile error:
*AKAKKSLD;
clear_tvb = tvb_new_child_real_data(encrypted_tvb,(guint8AMIT *)clear_data, datalen, datalen);*
Originally I was trying to remove the const type casting for the 2nd parameter of the function call tvb_new_child_real_data, which I fixed in function definition/declaration etc. but I kept getting the above compile error. So I edited the file to introduce more error and I suspect that those errors are not even looked at by compiler.
I cloned the source from https://github.com/wireshark/wireshark.
Updated the original question with additional information requested.