Page MenuHomeWildfire Games

Use libsodium for crypto
ClosedPublic

Authored by Itms on Apr 2 2018, 3:44 PM.

Details

Summary

In preparation for D1029, we should include libsodium and use it where we can for cryptographic stuff.

This revision adds the lib for Windows and uses it for SHA256 hashing in the lobby. MD5 is not provided by libsodium.

You will need a recent version of libsodium, which might not be in your repos. I manually installed 1.0.16 on Jenkins.

Test Plan

Compile and test, verify that you can still connect to the lobby if you erase the hash stored in the config file and retype your password.

Check that building with premake4 still works (as it should still be supported in A23).

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Itms created this revision.Apr 2 2018, 3:44 PM
Itms planned changes to this revision.Apr 6 2018, 1:43 PM

Note to self: forgot to add a script for OSX, P117 has to be tested.

Itms updated this revision to Diff 6348.Apr 8 2018, 1:50 PM

Now with the OSX library build script.

Thanks in advance for testing! :)

Vulcan added a subscriber: Vulcan.Apr 8 2018, 1:55 PM

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/differential/362/display/redirect

Vulcan added a comment.Apr 8 2018, 3:09 PM

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/differential/363/display/redirect

Imarok added a subscriber: Imarok.EditedApr 8 2018, 4:53 PM

Doesn't work for me.
I get "Incorrect password or username" when trying to log into lobby.

Itms planned changes to this revision.Apr 8 2018, 5:10 PM

I seem to have made a mistake with pbkdf2. Looking into it...

Itms updated this revision to Diff 6350.Apr 8 2018, 5:47 PM

Don't use libsodium crypto_auth_hmacsha256, which does not match our implementation.

Vulcan added a comment.Apr 8 2018, 6:17 PM

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/differential/365/display/redirect

Imarok added a comment.Apr 8 2018, 7:06 PM

Works on linux. (tested with premake4, premake5 and premake5-debug)

Itms updated this revision to Diff 6353.Apr 8 2018, 11:10 PM

Fix empty binary files.

This revision was not accepted when it landed; it landed in state Needs Review.Apr 8 2018, 11:41 PM
Closed by commit rP21674: Use libsodium for cryptography. (authored by Itms). · Explain Why
This revision was automatically updated to reflect the committed changes.

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/differential/368/display/redirect