mirror of
https://github.com/rock88/moonlight-nx
synced 2024-11-22 03:23:07 +00:00
Update moonlight-common-c (GFE 3.22 support)
This commit is contained in:
parent
1542a70656
commit
122dfabd1e
4 changed files with 31 additions and 2 deletions
2
Makefile
2
Makefile
|
@ -75,7 +75,7 @@ M_INCLUDES := \
|
|||
-I$(TOPDIR)/third_party/nanogui/ext/nanovg/src
|
||||
|
||||
DEFINES := -DNANOGUI_USE_OPENGL -DNVG_STB_IMAGE_IMPLEMENTATION -DNANOGUI_NO_GLFW \
|
||||
-DHAS_SOCKLEN_T -DHAS_POLL -DHAS_FCNTL -D_GNU_SOURCE -DUSE_MBEDTLS_CRYPTO -DMOONLIGHT_VERSION=\"$(MOONLIGHT_VERSION)\"
|
||||
-DHAS_SOCKLEN_T -DHAS_POLL -DHAS_FCNTL -DUSE_MBEDTLS_CRYPTO -DMOONLIGHT_VERSION=\"$(MOONLIGHT_VERSION)\"
|
||||
|
||||
CFLAGS := -g -Wall -fcompare-debug-second -O2 -ffunction-sections $(ARCH) $(DEFINES) $(INCLUDE) $(M_INCLUDES) -D__SWITCH__
|
||||
CXXFLAGS := $(CFLAGS) -std=gnu++17
|
||||
|
|
|
@ -88,6 +88,30 @@ int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
// TODO: This is correct?
|
||||
int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *impl, const unsigned char *key, const unsigned char *iv) {
|
||||
if (ctx && key != NULL && iv != NULL) {
|
||||
mbedtls_gcm_setkey(&ctx->ctx, MBEDTLS_CIPHER_ID_AES, key, ctx->iv_len * 8);
|
||||
mbedtls_gcm_starts(&ctx->ctx, MBEDTLS_GCM_DECRYPT, iv, ctx->iv_len, NULL, 0);
|
||||
ctx->iv = iv;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, const unsigned char *in, int inl) {
|
||||
if (ctx) {
|
||||
ctx->tag = (unsigned char*)malloc(ctx->iv_len);
|
||||
|
||||
mbedtls_gcm_crypt_and_tag(&ctx->ctx, MBEDTLS_GCM_DECRYPT, inl, ctx->iv, ctx->iv_len, NULL, 0, in, out, ctx->iv_len, ctx->tag);
|
||||
*outl = inl;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
int RAND_bytes(unsigned char *buf, int num) {
|
||||
Data rand = Data::random_bytes(num);
|
||||
for (int i = 0; i < num; i++) {
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#define EVP_CTRL_GCM_SET_IVLEN 0x9
|
||||
#define EVP_CTRL_GCM_GET_TAG 0x10
|
||||
#define EVP_CTRL_GCM_SET_TAG 0x11
|
||||
|
||||
typedef int EVP_CIPHER;
|
||||
typedef int ENGINE;
|
||||
|
@ -26,6 +27,10 @@ int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *im
|
|||
int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, const unsigned char *in, int inl);
|
||||
int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);
|
||||
|
||||
int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *impl, const unsigned char *key, const unsigned char *iv);
|
||||
int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, const unsigned char *in, int inl);
|
||||
int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
2
third_party/moonlight-common-c
vendored
2
third_party/moonlight-common-c
vendored
|
@ -1 +1 @@
|
|||
Subproject commit a64af8d8cf1e760759fba6026b10c6d4a5f2f3d7
|
||||
Subproject commit 5782246b30bfc11e659cf53b498886a924aa97d1
|
Loading…
Reference in a new issue