-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'gnutls_certificate_set_x509_key_file' and similar functions causes crash: An invalid parameter was passed to a function that considers invalid #23
Comments
Have you tried replacing the 'e' with 'N' for windows platforms and see if that helps. If you have a small test program you can post that can be used to demonstrate the bug and test fixes then that would be useful to help incorporate a fix. |
I tried deleting "e" and it solved the problem but i got lots of memory related issues (and they have no relation with that) which made whole library unusable. Not sure if that memory errors are my fault or a bug with the project but the crash with that particular thing is fixed by removing "e". |
Hi Sibras! Just as an addition to this issue: One of the functions that Harbour (the platform I'm using) implements is an fopen() call that mimics the standard windows/linux library fopen(cFile, cMode) call and the gnutls library also uses that same call, but the mode argument is different in the gnutls library call. The gnutls library has support for an extended mode string that in addition to the usual “r”, “w” and “a” arguments also has support for “b”, “x” and “e” arguments. As nearly as I can tell, these arguments are dealt with in the gnutls file fopen.c, (under the function rpl_fopen() but fopen.c doesn’t appear to be mentioned in the .vcproj file that SMP implements, and I'm not sure that I'm decoding the various .h files and macros that are involved in re-routing the gnutls fopen() function to rpl_fopen() I’m an okay-ish C programmer, but not nearly good enough to decode the multiple layers of .h files, project files that seem to be involved in determining whether or not fopen.c should be included and what (if any) macros should be defined. Could you take a look at this and advise me how I can get this issue resolved. Thanks for your help! |
Unfortunately its rather difficult to get it to work as gnulib requires to be able to hijack the system fopen with its own, but its own also requires to hijack other system functions (fdopen etc.) which makes it a bit complicated. The issue is that gnutls is using a gnulib submodule to define helper functions, as these are pulled in from a submodule they cant be directly modified by this project as otherwise I would just delete the "e" and call it a day. The "e" doesnt have the same meaning on windows and so can be just removed without issue which would be the easiest way to go about it. |
Hi Matthew! Removing the "e" does resolve the specific error, but leaves other assertions in place, so gnutls is no longer usable in Windows. I'll look for a different solution - probably Botan to start. Thanks for getting back to me. |
I had this issue too :( I replaced these calls by gnutls_certificate_set_x509_trust_mem with a custom file loading and it worked fine :) |
Finally, even though I patch that, nothing is working as expected (it hangs in handshake) :( Please are these binaries of GNU TLS working for someone under Windows ? Thanks :) |
@Sibras |
Ive update the repo to version 3.8.7 and as part of that Ive modifed the project to use the gnulib implementation of open/close/read/write (and a few others). This should handle the crash in |
@Sibras Thank you for your work! |
@Sibras there is a test that hang in curl. I will try to give a small example with curl that can reproduce the problem: Also you can compile it with vcpkg on windows: then: cd installed\x64-windows\tools\curl
curl -Iv --ca-native https://curl.se/ More info, you can ask in the PR I open on curl: |
If you can make make a mininal reproducable test program then ill take a look at it and see if i can debug what the issue is |
I don't have the knowledge to do minimal reproducible example for you. |
When I call
gnutls_certificate_allocate_credentials
to agnutls_certificate_credentials_t
and then callgnutls_certificate_set_x509_key_file
on the same struct, it crashes the program. I don't think it's a mainstream GnuTLS problem because exact same code works fine on Linux.Your Environment
The text was updated successfully, but these errors were encountered: