[AI] Fix GOST key blob computation NullPointerException (fixes #94)#227
Open
[AI] Fix GOST key blob computation NullPointerException (fixes #94)#227
Conversation
This fix addresses issue #94 where the GOST client key exchange fails with "Could not compute correct GOST key blob: using byte[0]" when connecting to OpenSSL with gost-engine. The issue occurred because: 1. The Point's field elements could be null when accessing X/Y coordinates 2. The convertPointToPublicKey method in GOSTUtils didn't handle null cases 3. The prepareKeyBlob method assumed coordinates were always initialized Changes made: - Added null checks in GOSTClientComputations.setClientPublicKey() to prevent setting null coordinates - Added comprehensive null checks in GOSTUtils.convertPointToPublicKey() for point, field elements, and coordinate data - Added null checks in prepareKeyBlob() before creating EC points - Added fallback handling in prepareEphemeralKey() for null public keys These changes ensure graceful handling of null values throughout the GOST key exchange process, preventing NullPointerExceptions while maintaining the existing error handling behavior.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changes
Test plan
mvn clean compilemvn spotless:applyThe fix ensures graceful handling of null values during GOST key exchange, preventing crashes while maintaining the existing error handling behavior where an empty byte array is used as fallback.