toxcore
toxcore copied to clipboard
Strange behavior tox_pass_encrypt function
I encountered a problem when using tox_pass_encrypt functions in your project. I receive an exception "Access violation" in different places. Places of occurrence of this exception changed after changing the code. After experimenting in a debugger I have come to the conclusion that alignment of stack is 16 bytes before calling tox_pass_encrypt solves the problem.
I wrote a test application. It was found that the problem arises after a call tox_new function. Test code I think the same problem was there https://github.com/irungentoo/toxcore/issues/1312
OS: Windows 7 64 bit (toxcore 32 bit) libtoxcore: Make as instructed Compiling
Test application build in MSYS:
gcc *.c -I../release/include/ -L./../release/lib/ -llibtox -o test.exe
UPD Problem does not repeat if I turn off UDP.
options.udp_enabled = false;
Error appears in escrypt_kdf_sse function (ESP is not aligned 16 byte)

This is probably because of stack alignment in 32-bit Windows programs built with MinGW. It is described here and can be fixed by recompiling the program and all of its dependent libraries with -mstackrealign flag.