forked from SpigotMC/BungeeCord
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
132 additions
and
37 deletions.
There are no files selected for viewing
This file contains 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 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 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 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,19 @@ | ||
// Header to check for SSE 2, SSSE 3, and SSE 4.2 support in compression natives | ||
// GCC only! | ||
|
||
#ifndef _INCLUDE_CPUID_HELPER_H | ||
#define _INCLUDE_CPUID_HELPER_H | ||
|
||
#include <stdbool.h> | ||
#include <cpuid.h> | ||
|
||
static inline bool checkCompressionNativesSupport() { | ||
unsigned int eax, ebx, ecx, edx; | ||
if(__get_cpuid(1, &eax, &ebx, &ecx, &edx)) { | ||
return (edx & bit_SSE2) != 0 && (ecx & bit_SSSE3) != 0 && (ecx & bit_SSE4_2) != 0; | ||
}else { | ||
return false; | ||
} | ||
} | ||
|
||
#endif // _INCLUDE_CPUID_HELPER_H |
This file contains 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,31 @@ | ||
|
||
// This is a hack to deal with a glitch that happens when mbedtls is compiled against glibc | ||
// but then run on a linux distro that uses musl libc. This implementation of the zeroize | ||
// is compatible with both glibc and musl without requiring the library to be recompiled. | ||
|
||
// I checked with a disassembler and for BungeeCord's usage of the library, implementing | ||
// this function as a static function only resulted in 2 different subroutines referencing | ||
// different versions of memset_func, so we might as well keep things simple and use a | ||
// static function here instead of requiring the mbedtls makefile to be modified to add | ||
// additional source files. | ||
|
||
#ifndef _INCLUDE_MBEDTLS_CUSTOM_CONFIG_H | ||
#define _INCLUDE_MBEDTLS_CUSTOM_CONFIG_H | ||
|
||
#include <string.h> | ||
|
||
#define MBEDTLS_PLATFORM_ZEROIZE_ALT | ||
|
||
#define mbedtls_platform_zeroize mbedtls_platform_zeroize_impl | ||
|
||
// hack to prevent compilers from optimizing the memset away | ||
static void *(*const volatile memset_func)(void *, int, size_t) = memset; | ||
|
||
static void mbedtls_platform_zeroize_impl(void *buf, size_t len) { | ||
if (len > 0) { | ||
memset_func(buf, 0, len); | ||
} | ||
} | ||
|
||
#endif // _INCLUDE_MBEDTLS_CUSTOM_CONFIG_H | ||
|
8 changes: 8 additions & 0 deletions
8
native/src/main/c/net_md_5_bungee_jni_zlib_NativeCompressImpl.h
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 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 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 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 not shown.
Binary file not shown.
This file contains 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 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 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 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 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 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 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 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 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 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