Skip to content
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

Invalid MAC with i386 #72

Closed
pmaziere opened this issue Aug 20, 2018 · 11 comments
Closed

Invalid MAC with i386 #72

pmaziere opened this issue Aug 20, 2018 · 11 comments

Comments

@pmaziere
Copy link

For specific reasons , I have to work with an i386 computer running debian testing without iibsodium installed.
While giving a try to Paseto, I was hit with an "Invalid MAC" error when parsing the token, which lead me to #38.

After running the phpunit tests on current master HEAD, here is the final output:

Time: 1.8 hours, Memory: 18.00MB

There was 1 error:

1) FileTest::testSeal
SodiumException: Invalid MAC

/srv/www/local/sodium_compat/src/Crypto32.php:1003
/srv/www/local/sodium_compat/src/Crypto32.php:664
/srv/www/local/sodium_compat/src/Crypto32.php:519
/srv/www/local/sodium_compat/src/Compat.php:983
/srv/www/local/sodium_compat/tests/unit/FileTest.php:147

--

There was 1 failure:

1) FileTest::testBox
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-d1be33c603b2363bc2cda62795b458d34aba8d03a9c190fa5fe0c14603f57eb6b0db46a322a21fdef20498304d2fbc9d
+46679e2378061e778f9b1cf4f796f59822cf39d3017fc62464d5be2e2dbabd5648593477ef571af3732ff33dacf116af

/srv/www/local/sodium_compat/tests/unit/FileTest.php:43

ERRORS!
Tests: 173, Assertions: 6699, Errors: 1, Failures: 1, Skipped: 58.

I know that i386 targets are not high priority, but would it be possible for someone to have a look at these tests. Hopefully, it may result in a quick and easy fix.

thanks

@paragonie-scott
Copy link
Member

I'm worried this might be a Curve25519 bug, which is the slowest thing to test on 32-bit.

@paragonie-scott
Copy link
Member

Can you let me know if https://github.com/paragonie/sodium_compat/releases/tag/v1.6.4 fixed the issue for you?

@pmaziere
Copy link
Author

Still having the invalid MAC error in FileTest::testSeal, but the FileTest::testBox is now passed successfully

1) FileTest::testSeal
SodiumException: Invalid MAC

/srv/www/local/sodium_compat/src/Crypto32.php:1003
/srv/www/local/sodium_compat/src/Crypto32.php:664
/srv/www/local/sodium_compat/src/Crypto32.php:519
/srv/www/local/sodium_compat/src/Compat.php:983
/srv/www/local/sodium_compat/tests/unit/FileTest.php:147

ERRORS!
Tests: 173, Assertions: 6704, Errors: 1, Skipped: 58.

@pmaziere
Copy link
Author

pmaziere commented Sep 5, 2018

After installing a VM on a 64 bits intel computer, I confirm that tests are passed successfully for this architecture. But I have the same 'Invalid MAC' error as described in my initial post with my Paseto attempt, therefore in addition to this bug report, I guess I must have something wrong in my paseto related code.
And I can't affirm that my Paseto 'invalid MAC' error is related to the sodium_compat FileTest::testSeal 'Invalid MAC' error.

@paragonie-scott
Copy link
Member

It wouldn't be. PASETO doesn't touch the File API at all.

@pmaziere
Copy link
Author

pmaziere commented Sep 6, 2018

Ok, I confirm that the PASETO issue was unrelated to any sodium_compat bug. It is now fixed.

Anyway, I keep this bug opened since the FileTest::testSeal error is still pending. Maybe someone else could try to reproduce the bug, so that an isolated device specific issue can be ruled out.

@paragonie-scott
Copy link
Member

This fixes the unit tests on my Windows machine: c9ef28e

@paragonie-scott
Copy link
Member

This is fixed in v1.6.5.

@pmaziere
Copy link
Author

Not here (debian testing 64bit hosting an LXC guest running debian stretch 32bit)

1) FileTest::testSeal
SodiumException: Invalid MAC

/srv/www/local/sodium_compat/src/Crypto32.php:1003
/srv/www/local/sodium_compat/src/Crypto32.php:664
/srv/www/local/sodium_compat/src/Crypto32.php:519
/srv/www/local/sodium_compat/src/Compat.php:983
/srv/www/local/sodium_compat/tests/unit/FileTest.php:147

@paragonie-scott
Copy link
Member

Okay, I'm not able to reproduce this in v1.6.5 on my setup. I'll look into setting up a congruent system so I can study it further.

@pmaziere
Copy link
Author

Since you were not able to reproduce it, I cloned the repository from scratch and ran the tests again, with a fully successfull output this time.
Thanks for the time you spent on this bug, and for all your work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants