Repository navigation
Minecraft 26.4 #1913
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
Draft
WouterGritter
wants to merge
18
commits into
dev/4.0.0
Choose a base branch
from
minecraft-26.4
base: dev/4.0.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,974
−234
Draft
Minecraft 26.4 #1913
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
70692bd
26.4-snapshot-1..5: Add Minecraft 26.4 protocol version
WouterGritter 6a07a1f
26.4-snapshot-1..5: Remove partial hashed seed from JoinGame and Respawn
WouterGritter cd73d8d
26.4-snapshot-1..5: Support transfer properties
WouterGritter 288a1ef
26.4-snapshot-1..5: Replay client mod list to backend servers
WouterGritter 2586605
26.4-snapshot-1..5: Drop config plugin messages while backend connect…
WouterGritter caf5c56
26.4-snapshot-1..5: Defer enabling compression until login is acknowl…
WouterGritter 56c40e7
26.4-snapshot-1..5: Defer enabling encryption until client applies op…
WouterGritter 9f04983
26.4-snapshot-6: Bump protocol version
WouterGritter 9499bf6
26.4-snapshot-8: Bump protocol version
WouterGritter 5a10a4d
26.4-snapshot-8: Renumber play packet IDs
WouterGritter bb0f42b
26.4-snapshot-8: Remove debug flag from JoinGame and Respawn
WouterGritter ac1193d
26.4-snapshot-8: Renumber command argument type IDs
WouterGritter fa674c0
26.4-snapshot-8: Update command suggestion and argument serialization
WouterGritter 8711d76
26.4-snapshot-9..10: Bump protocol version
WouterGritter 7644e34
26.4-snapshot-9..10: Split string argument type into word, quoted_str…
WouterGritter 2e71237
26.4-snapshot-9..10: Replace RSA login encryption with X25519 key exc…
WouterGritter 685e3ec
26.4-pre-1: Bump protocol version
WouterGritter 9bd706c
Native encryption support for 26.4+ with tests (TODO: rebuild macos n…
WouterGritter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,7 @@ JNIEXPORT jlong JNICALL | |
| Java_com_velocitypowered_natives_encryption_OpenSslCipherImpl_init(JNIEnv *env, | ||
| jclass clazz, | ||
| jbyteArray key, | ||
| jbyteArray iv, | ||
| jboolean encrypt) | ||
| { | ||
| jsize keyLen = (*env)->GetArrayLength(env, key); | ||
|
|
@@ -18,9 +19,9 @@ Java_com_velocitypowered_natives_encryption_OpenSslCipherImpl_init(JNIEnv *env, | |
| return 0; | ||
| } | ||
|
|
||
| EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new(); | ||
| if (ctx == NULL) { | ||
| throwException(env, "java/lang/OutOfMemoryError", "allocate cipher"); | ||
| jsize ivLen = (*env)->GetArrayLength(env, iv); | ||
| if (ivLen != 16) { | ||
| throwException(env, "java/lang/IllegalArgumentException", "IV not 16 bytes"); | ||
| return 0; | ||
| } | ||
|
|
||
|
|
@@ -32,16 +33,21 @@ Java_com_velocitypowered_natives_encryption_OpenSslCipherImpl_init(JNIEnv *env, | |
| return 0; | ||
| } | ||
|
|
||
| // But, you're saying, *why* are we using the key as the IV? After all, reusing the key as | ||
| // the IV defeats the entire point - we might as well just initialize it to all zeroes. | ||
| // | ||
| // You can blame Mojang. For the record, we also don't consider the Minecraft protocol | ||
| // encryption scheme to be secure, and it has reached the point where any serious cryptographic | ||
| // protocol needs a refresh. There are multiple obvious weaknesses, and this is far from the | ||
| // most serious. | ||
| // | ||
| // If you are using Minecraft in a security-sensitive application, *I don't know what to say.* | ||
| int result = EVP_CipherInit(ctx, EVP_aes_128_cfb8(), (byte*) keyBytes, (byte*) keyBytes, | ||
| jbyte ivBytes[16]; | ||
| (*env)->GetByteArrayRegion(env, iv, 0, ivLen, (jbyte*) ivBytes); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: |
||
| if ((*env)->ExceptionCheck(env)) { | ||
| return 0; | ||
| } | ||
|
|
||
| EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new(); | ||
| if (ctx == NULL) { | ||
| throwException(env, "java/lang/OutOfMemoryError", "allocate cipher"); | ||
| return 0; | ||
| } | ||
|
|
||
| // Before 26.4, the protocol used the shared secret as both the key and the IV. That is the | ||
| // caller's business now: the Java side passes the key as the IV for those older protocols. | ||
| int result = EVP_CipherInit(ctx, EVP_aes_128_cfb8(), (byte*) keyBytes, (byte*) ivBytes, | ||
| encrypt); | ||
| if (result != 1) { | ||
| EVP_CIPHER_CTX_free(ctx); | ||
|
|
||
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
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
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
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
Binary file modified
BIN
+4 KB
(150%)
native/src/main/resources/linux_aarch64/velocity-cipher-ossl11x.so
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
native/src/main/resources/linux_aarch64/velocity-cipher-ossl30x-musl.so
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
native/src/main/resources/linux_aarch64/velocity-cipher-ossl30x.so
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
native/src/main/resources/linux_x86_64/velocity-cipher-ossl11x.so
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
native/src/main/resources/linux_x86_64/velocity-cipher-ossl30x-musl.so
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
native/src/main/resources/linux_x86_64/velocity-cipher-ossl30x.so
Binary file not shown.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| TODO: REMOVE .gitkeep WHEN MACOS BINARIES ARE REBUILT |
Binary file not shown.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit:
GetArrayLengthon a null reference crashes the JVM instead of throwing. The only caller never passes null today, but a short null check that throwsNullPointerExceptionwould be cheap insurance (same injni_cipher_macos.c, and the same hazard already exists forkey).