Skip to content

use constant-time comparison for srp-6a evidence messages - #2406

Open
rootvector2 wants to merge 1 commit into
bcgit:mainfrom
rootvector2:srp-evidence-constant-time
Open

use constant-time comparison for srp-6a evidence messages#2406
rootvector2 wants to merge 1 commit into
bcgit:mainfrom
rootvector2:srp-evidence-constant-time

Conversation

@rootvector2

Copy link
Copy Markdown
Contributor

SRP6Server.verifyClientEvidenceMessage and SRP6Client.verifyServerEvidenceMessage check the peer's evidence message (M1/M2, a keyed authenticator derived from the shared secret S) with BigInteger.equals, which walks the magnitude words and returns at the first difference, so the compare time depends on how many leading bytes match a value the unauthenticated peer is trying to guess. Switched both to Arrays.constantTimeAreEqual over the fixed encodings, matching the sibling JPAKEUtil MacTag check, in the lightweight crypto.agreement.srp package and the BCTLS tls.crypto.impl.jcajce.srp copies. Found while auditing the SRP path after the recent createBlindedExponent modPow hardening in these same classes; the accept/reject result is unchanged and SRP6Test now covers the evidence-verification path.

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

Successfully merging this pull request may close these issues.

1 participant