-
-
Notifications
You must be signed in to change notification settings - Fork 162
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
small band aid fix for password generation on windows #276
Conversation
creates a new function rand in the util class that calls bcryptgenrandom from the win32 api when running on windows and falls back to qrand on other platforms
Don't know if this function can fail for other reasons then incorrect parameters (not enough entropy maybe?). Falling back to qrand is not very useful a proper fix will require more changes further up the stack.
Aparently bcrypt is not available on Windows as-per standard.
Any idea how to install it from within |
It's an issue with mingw in appveyor then. Bcrypt is included with windows since vista. I have the latest mingw from qt installer installed and it has the bcrypt.h/lib included. |
I'm downloading a Windows VM from modern.ie to check this one out :) Would like to have a working appveyor (since it does the windows builds so I don't have to) before merging. |
The header file doesn't come bundled with windows only the dll. The header file comes from the mingw package. |
On my computer It's found in C:\Qt\Tools\mingw530_32\i686-w64-mingw32\include\bcrypt.h |
If you can't get it working a work around would be to use LoadLibrary/GetProcAddress to load the library instead. |
Possible fix. The path on your appveyor thing should include C:\Qt\Tools\mingw530_32\bin not C:\MinGW\bin From line 30 in the log. I'm pretty sure this is it now. It's what Qt Creator does aswell. |
That did the trick! |
Uses BCryptGenRandom win32 api function but still falls back to qrand. A proper fix would require more changes further up the stack maybe a dialog with retry and cancel button if password generation should fail. Could also be extended to use other apis on other platforms e.g. /dev/random on linux. Does this sound worthwhile or is it being work on elsewhere?