Added more wrapped function and wrapped libs to nss3+friends (for #466, but still unstable)

This commit is contained in:
ptitSeb 2021-09-21 20:58:50 +02:00
parent cd6cb2352f
commit 852f6af362
25 changed files with 517 additions and 35 deletions

View File

@ -392,6 +392,9 @@ set(WRAPPEDS
"${BOX86_ROOT}/src/wrapped/wrappedsmime3.c"
"${BOX86_ROOT}/src/wrapped/wrappednssutil3.c"
"${BOX86_ROOT}/src/wrapped/wrappednss3.c"
"${BOX86_ROOT}/src/wrapped/wrappedplds4.c"
"${BOX86_ROOT}/src/wrapped/wrappedplc4.c"
"${BOX86_ROOT}/src/wrapped/wrappedssl3.c"
)
if(ANDROID)
list(APPEND WRAPPEDS

View File

@ -140,6 +140,9 @@ GO("libnspr4.so", nspr4)
GO("libsmime3.so", smime3)
GO("libnssutil3.so", nssutil3)
GO("libnss3.so", nss3)
GO("libplds4.so", plds4)
GO("libplc4.so", plc4)
GO("libssl3.so", ssl3)
#ifdef ANDROID
GO("libc.so", libc)

View File

@ -371,6 +371,7 @@
#() iFpwp
#() iFpii
#() iFpiu
#() iFpil
#() iFpiL
#() iFpip
#() iFpiV
@ -1537,6 +1538,7 @@
#() iFppiiuui
#() iFppiipii
#() iFppiipiL
#() iFppiippp
#() iFppiuppi
#() iFppipiip
#() iFppipipi
@ -3382,6 +3384,8 @@ wrappedpango:
- pango_attribute_init
wrappedpangocairo:
wrappedpangoft2:
wrappedplc4:
wrappedplds4:
wrappedpng12:
- vFppp:
- png_set_read_fn
@ -3778,6 +3782,8 @@ wrappedsmime3:
- SEC_PKCS12Encode
- pFpppp:
- SEC_PKCS12CreateExportContext
- pFppppppp:
- NSS_CMSMessage_CreateFromDER
- pFpppppppp:
- SEC_PKCS12DecoderStart
- pFppppppppppp:
@ -3807,6 +3813,10 @@ wrappedsmpeg2:
- SMPEG_new_data
- pFppii:
- SMPEG_new_rwops
wrappedssl3:
- iFppp:
- SSL_AuthCertificateHook
- SSL_BadCertHook
wrappedtcmallocminimal:
- iFpL:
- munmap

View File

@ -0,0 +1,8 @@
/*******************************************************************
* File automatically generated by rebuild_wrappers.py (v2.0.0.10) *
*******************************************************************/
#ifndef __wrappedplc4DEFS_H_
#define __wrappedplc4DEFS_H_
#endif // __wrappedplc4DEFS_H_

View File

@ -0,0 +1,17 @@
/*******************************************************************
* File automatically generated by rebuild_wrappers.py (v2.0.0.10) *
*******************************************************************/
#ifndef __wrappedplc4TYPES_H_
#define __wrappedplc4TYPES_H_
#ifndef LIBNAME
#error You should only #include this file inside a wrapped*.c file
#endif
#ifndef ADDED_FUNCTIONS
#define ADDED_FUNCTIONS()
#endif
#define SUPER() ADDED_FUNCTIONS()
#endif // __wrappedplc4TYPES_H_

View File

@ -0,0 +1,8 @@
/*******************************************************************
* File automatically generated by rebuild_wrappers.py (v2.0.0.10) *
*******************************************************************/
#ifndef __wrappedplc4UNDEFS_H_
#define __wrappedplc4UNDEFS_H_
#endif // __wrappedplc4UNDEFS_H_

View File

@ -0,0 +1,8 @@
/*******************************************************************
* File automatically generated by rebuild_wrappers.py (v2.0.0.10) *
*******************************************************************/
#ifndef __wrappedplds4DEFS_H_
#define __wrappedplds4DEFS_H_
#endif // __wrappedplds4DEFS_H_

View File

@ -0,0 +1,17 @@
/*******************************************************************
* File automatically generated by rebuild_wrappers.py (v2.0.0.10) *
*******************************************************************/
#ifndef __wrappedplds4TYPES_H_
#define __wrappedplds4TYPES_H_
#ifndef LIBNAME
#error You should only #include this file inside a wrapped*.c file
#endif
#ifndef ADDED_FUNCTIONS
#define ADDED_FUNCTIONS()
#endif
#define SUPER() ADDED_FUNCTIONS()
#endif // __wrappedplds4TYPES_H_

View File

@ -0,0 +1,8 @@
/*******************************************************************
* File automatically generated by rebuild_wrappers.py (v2.0.0.10) *
*******************************************************************/
#ifndef __wrappedplds4UNDEFS_H_
#define __wrappedplds4UNDEFS_H_
#endif // __wrappedplds4UNDEFS_H_

View File

@ -14,6 +14,7 @@
typedef int32_t (*iFpp_t)(void*, void*);
typedef int32_t (*iFppp_t)(void*, void*, void*);
typedef void* (*pFpppp_t)(void*, void*, void*, void*);
typedef void* (*pFppppppp_t)(void*, void*, void*, void*, void*, void*, void*);
typedef void* (*pFpppppppp_t)(void*, void*, void*, void*, void*, void*, void*, void*);
typedef void* (*pFppppppppppp_t)(void*, void*, void*, void*, void*, void*, void*, void*, void*, void*, void*);
@ -21,6 +22,7 @@ typedef void* (*pFppppppppppp_t)(void*, void*, void*, void*, void*, void*, void*
GO(SEC_PKCS12DecoderValidateBags, iFpp_t) \
GO(SEC_PKCS12Encode, iFppp_t) \
GO(SEC_PKCS12CreateExportContext, pFpppp_t) \
GO(NSS_CMSMessage_CreateFromDER, pFppppppp_t) \
GO(SEC_PKCS12DecoderStart, pFpppppppp_t) \
GO(NSS_CMSEncoder_Start, pFppppppppppp_t)

View File

@ -0,0 +1,8 @@
/*******************************************************************
* File automatically generated by rebuild_wrappers.py (v2.0.0.10) *
*******************************************************************/
#ifndef __wrappedssl3DEFS_H_
#define __wrappedssl3DEFS_H_
#endif // __wrappedssl3DEFS_H_

View File

@ -0,0 +1,20 @@
/*******************************************************************
* File automatically generated by rebuild_wrappers.py (v2.0.0.10) *
*******************************************************************/
#ifndef __wrappedssl3TYPES_H_
#define __wrappedssl3TYPES_H_
#ifndef LIBNAME
#error You should only #include this file inside a wrapped*.c file
#endif
#ifndef ADDED_FUNCTIONS
#define ADDED_FUNCTIONS()
#endif
typedef int32_t (*iFppp_t)(void*, void*, void*);
#define SUPER() ADDED_FUNCTIONS() \
GO(SSL_AuthCertificateHook, iFppp_t) \
GO(SSL_BadCertHook, iFppp_t)
#endif // __wrappedssl3TYPES_H_

View File

@ -0,0 +1,8 @@
/*******************************************************************
* File automatically generated by rebuild_wrappers.py (v2.0.0.10) *
*******************************************************************/
#ifndef __wrappedssl3UNDEFS_H_
#define __wrappedssl3UNDEFS_H_
#endif // __wrappedssl3UNDEFS_H_

View File

@ -443,6 +443,7 @@ typedef int32_t (*iFfff_t)(float, float, float);
typedef int32_t (*iFpwp_t)(void*, int16_t, void*);
typedef int32_t (*iFpii_t)(void*, int32_t, int32_t);
typedef int32_t (*iFpiu_t)(void*, int32_t, uint32_t);
typedef int32_t (*iFpil_t)(void*, int32_t, intptr_t);
typedef int32_t (*iFpiL_t)(void*, int32_t, uintptr_t);
typedef int32_t (*iFpip_t)(void*, int32_t, void*);
typedef int32_t (*iFpiV_t)(void*, int32_t, void*);
@ -1609,6 +1610,7 @@ typedef int32_t (*iFpLipipi_t)(void*, uintptr_t, int32_t, void*, int32_t, void*,
typedef int32_t (*iFppiiuui_t)(void*, void*, int32_t, int32_t, uint32_t, uint32_t, int32_t);
typedef int32_t (*iFppiipii_t)(void*, void*, int32_t, int32_t, void*, int32_t, int32_t);
typedef int32_t (*iFppiipiL_t)(void*, void*, int32_t, int32_t, void*, int32_t, uintptr_t);
typedef int32_t (*iFppiippp_t)(void*, void*, int32_t, int32_t, void*, void*, void*);
typedef int32_t (*iFppiuppi_t)(void*, void*, int32_t, uint32_t, void*, void*, int32_t);
typedef int32_t (*iFppipiip_t)(void*, void*, int32_t, void*, int32_t, int32_t, void*);
typedef int32_t (*iFppipipi_t)(void*, void*, int32_t, void*, int32_t, void*, int32_t);
@ -2481,6 +2483,7 @@ void iFfff(x86emu_t *emu, uintptr_t fcn) { iFfff_t fn = (iFfff_t)fcn; R_EAX=fn(*
void iFpwp(x86emu_t *emu, uintptr_t fcn) { iFpwp_t fn = (iFpwp_t)fcn; R_EAX=fn(*(void**)(R_ESP + 4), *(int16_t*)(R_ESP + 8), *(void**)(R_ESP + 12)); }
void iFpii(x86emu_t *emu, uintptr_t fcn) { iFpii_t fn = (iFpii_t)fcn; R_EAX=fn(*(void**)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(int32_t*)(R_ESP + 12)); }
void iFpiu(x86emu_t *emu, uintptr_t fcn) { iFpiu_t fn = (iFpiu_t)fcn; R_EAX=fn(*(void**)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(uint32_t*)(R_ESP + 12)); }
void iFpil(x86emu_t *emu, uintptr_t fcn) { iFpil_t fn = (iFpil_t)fcn; R_EAX=fn(*(void**)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(intptr_t*)(R_ESP + 12)); }
void iFpiL(x86emu_t *emu, uintptr_t fcn) { iFpiL_t fn = (iFpiL_t)fcn; R_EAX=fn(*(void**)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(uintptr_t*)(R_ESP + 12)); }
void iFpip(x86emu_t *emu, uintptr_t fcn) { iFpip_t fn = (iFpip_t)fcn; R_EAX=fn(*(void**)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(void**)(R_ESP + 12)); }
void iFpiV(x86emu_t *emu, uintptr_t fcn) { iFpiV_t fn = (iFpiV_t)fcn; R_EAX=fn(*(void**)(R_ESP + 4), *(int32_t*)(R_ESP + 8), (void*)(R_ESP + 12)); }
@ -3647,6 +3650,7 @@ void iFpLipipi(x86emu_t *emu, uintptr_t fcn) { iFpLipipi_t fn = (iFpLipipi_t)fcn
void iFppiiuui(x86emu_t *emu, uintptr_t fcn) { iFppiiuui_t fn = (iFppiiuui_t)fcn; R_EAX=fn(*(void**)(R_ESP + 4), *(void**)(R_ESP + 8), *(int32_t*)(R_ESP + 12), *(int32_t*)(R_ESP + 16), *(uint32_t*)(R_ESP + 20), *(uint32_t*)(R_ESP + 24), *(int32_t*)(R_ESP + 28)); }
void iFppiipii(x86emu_t *emu, uintptr_t fcn) { iFppiipii_t fn = (iFppiipii_t)fcn; R_EAX=fn(*(void**)(R_ESP + 4), *(void**)(R_ESP + 8), *(int32_t*)(R_ESP + 12), *(int32_t*)(R_ESP + 16), *(void**)(R_ESP + 20), *(int32_t*)(R_ESP + 24), *(int32_t*)(R_ESP + 28)); }
void iFppiipiL(x86emu_t *emu, uintptr_t fcn) { iFppiipiL_t fn = (iFppiipiL_t)fcn; R_EAX=fn(*(void**)(R_ESP + 4), *(void**)(R_ESP + 8), *(int32_t*)(R_ESP + 12), *(int32_t*)(R_ESP + 16), *(void**)(R_ESP + 20), *(int32_t*)(R_ESP + 24), *(uintptr_t*)(R_ESP + 28)); }
void iFppiippp(x86emu_t *emu, uintptr_t fcn) { iFppiippp_t fn = (iFppiippp_t)fcn; R_EAX=fn(*(void**)(R_ESP + 4), *(void**)(R_ESP + 8), *(int32_t*)(R_ESP + 12), *(int32_t*)(R_ESP + 16), *(void**)(R_ESP + 20), *(void**)(R_ESP + 24), *(void**)(R_ESP + 28)); }
void iFppiuppi(x86emu_t *emu, uintptr_t fcn) { iFppiuppi_t fn = (iFppiuppi_t)fcn; R_EAX=fn(*(void**)(R_ESP + 4), *(void**)(R_ESP + 8), *(int32_t*)(R_ESP + 12), *(uint32_t*)(R_ESP + 16), *(void**)(R_ESP + 20), *(void**)(R_ESP + 24), *(int32_t*)(R_ESP + 28)); }
void iFppipiip(x86emu_t *emu, uintptr_t fcn) { iFppipiip_t fn = (iFppipiip_t)fcn; R_EAX=fn(*(void**)(R_ESP + 4), *(void**)(R_ESP + 8), *(int32_t*)(R_ESP + 12), *(void**)(R_ESP + 16), *(int32_t*)(R_ESP + 20), *(int32_t*)(R_ESP + 24), *(void**)(R_ESP + 28)); }
void iFppipipi(x86emu_t *emu, uintptr_t fcn) { iFppipipi_t fn = (iFppipipi_t)fcn; R_EAX=fn(*(void**)(R_ESP + 4), *(void**)(R_ESP + 8), *(int32_t*)(R_ESP + 12), *(void**)(R_ESP + 16), *(int32_t*)(R_ESP + 20), *(void**)(R_ESP + 24), *(int32_t*)(R_ESP + 28)); }

View File

@ -403,6 +403,7 @@ void iFfff(x86emu_t *emu, uintptr_t fnc);
void iFpwp(x86emu_t *emu, uintptr_t fnc);
void iFpii(x86emu_t *emu, uintptr_t fnc);
void iFpiu(x86emu_t *emu, uintptr_t fnc);
void iFpil(x86emu_t *emu, uintptr_t fnc);
void iFpiL(x86emu_t *emu, uintptr_t fnc);
void iFpip(x86emu_t *emu, uintptr_t fnc);
void iFpiV(x86emu_t *emu, uintptr_t fnc);
@ -1569,6 +1570,7 @@ void iFpLipipi(x86emu_t *emu, uintptr_t fnc);
void iFppiiuui(x86emu_t *emu, uintptr_t fnc);
void iFppiipii(x86emu_t *emu, uintptr_t fnc);
void iFppiipiL(x86emu_t *emu, uintptr_t fnc);
void iFppiippp(x86emu_t *emu, uintptr_t fnc);
void iFppiuppi(x86emu_t *emu, uintptr_t fnc);
void iFppipiip(x86emu_t *emu, uintptr_t fnc);
void iFppipipi(x86emu_t *emu, uintptr_t fnc);

View File

@ -42,7 +42,7 @@
//GO(PR_Cleanup,
//GO(PR_ClearInterrupt,
//GO(PR_ClearThreadGCAble,
//GO(PR_Close,
GO(PR_Close, iFp)
//GO(PR_CloseDir,
//GO(PR_CloseFileMap,
//GO(PR_CloseSemaphore,
@ -150,7 +150,7 @@
//GO(PR_GetDirectorySepartor,
//GO(PR_GetEnv,
//GO(PR_GetEnvSecure,
//GO(PR_GetError,
GO(PR_GetError, iFv)
//GO(PR_GetErrorText,
//GO(PR_GetErrorTextLength,
//GO(PR_GetFileInfo,
@ -214,12 +214,12 @@
//GO(PR_ImportFile,
//GO(PR_ImportFileMapFromString,
//GO(PR_ImportPipe,
//GO(PR_ImportTCPSocket,
GO(PR_ImportTCPSocket, pFi)
//GO(PR_ImportUDPSocket,
//GO(PR_IncrementCounter,
GO(PR_Init, vFiii)
//GO(PR_Initialize,
//GO(PR_Initialized,
GO(PR_Initialized, iFv)
//GO(PR_InitializeNetAddr,
//GO(PR_Interrupt,
//GO(PR_IntervalNow,
@ -267,7 +267,7 @@ GO(PR_Init, vFiii)
//GO(PR_NotifyAll,
//GO(PR_NotifyAllCondVar,
//GO(PR_NotifyCondVar,
//GO(PR_Now,
GO(PR_Now, pFv)
//GO(PR_ntohl,
//GO(PR_ntohll,
//GO(PR_ntohs,
@ -304,7 +304,7 @@ GO(PR_Init, vFiii)
//GO(PR_QueueJob_Read,
//GO(PR_QueueJob_Timer,
//GO(PR_QueueJob_Write,
//GO(PR_Read,
GO(PR_Read, iFppi)
//GO(PR_ReadDir,
//GO(PR_Realloc,
//GO(PR_RecordTraceEntries,
@ -340,7 +340,7 @@ GO(PR_Init, vFiii)
//GO(PR_SetLogFile,
//GO(PR_SetNetAddr,
//GO(PR_SetPollableEvent,
//GO(PR_SetSocketOption,
GO(PR_SetSocketOption, iFpp)
//GO(PR_SetStdioRedirect,
//GO(PR_SetSysfdTableSize,
//GO(PR_SetThreadAffinityMask,
@ -395,7 +395,7 @@ GO(PR_Init, vFiii)
//GO(PR_WaitRecvReady,
//GO(PR_WaitSem,
//GO(PR_WaitSemaphore,
//GO(PR_Write,
GO(PR_Write, iFppi)
//GO(PR_Writev,
//GO(PR_Yield,
//GO(PT_FPrintStats,

View File

@ -29,7 +29,7 @@
//DATA(CERT_CertificateTemplate,
//GO(CERT_CertListFromCert,
//GO(CERT_CertTimesValid,
//GO(CERT_ChangeCertTrust,
GO(CERT_ChangeCertTrust, iFppp)
//GO(CERT_CheckCertUsage,
//GO(CERT_CheckCertValidTimes,
//GO(CERT_CheckNameSpace,
@ -79,10 +79,10 @@
//GO(CERT_DecodeUserNotice,
//GO(CERT_DerNameToAscii,
//GO(CERT_DestroyCertArray,
//GO(CERT_DestroyCertificate,
//GO(CERT_DestroyCertificateList,
GO(CERT_DestroyCertificate, vFp)
GO(CERT_DestroyCertificateList, vFp)
//GO(CERT_DestroyCertificatePoliciesExtension,
//GO(CERT_DestroyCertificateRequest,
GO(CERT_DestroyCertificateRequest, vFp)
//GO(CERT_DestroyCertList,
//GO(CERT_DestroyCERTRevocationFlags,
//GO(CERT_DestroyName,
@ -149,7 +149,7 @@
//GO(CERT_GenTime2FormattedAscii,
//GO(CERT_GetAVATag,
//GO(CERT_GetCertChainFromCert,
//GO(CERT_GetCertEmailAddress,
GO(CERT_GetCertEmailAddress, pFp)
//GO(CERT_GetCertificateDer,
//GO(CERT_GetCertificateNames,
//GO(CERT_GetCertificateRequestExtensions,
@ -160,21 +160,21 @@
//GO(CERT_GetCertNicknames,
//GO(CERT_GetCertTimes,
//GO(CERT_GetCertTrust,
//GO(CERT_GetCertUid,
GO(CERT_GetCertUid, pFp)
//GO(CERT_GetClassicOCSPDisabledPolicy,
//GO(CERT_GetClassicOCSPEnabledHardFailurePolicy,
//GO(CERT_GetClassicOCSPEnabledSoftFailurePolicy,
//GO(CERT_GetCommonName,
GO(CERT_GetCommonName, pFp)
//GO(CERT_GetConstrainedCertificateNames,
//GO(CERT_GetCountryName,
GO(CERT_GetCountryName, pFp)
//GO(CERT_GetDBContentVersion,
//GO(CERT_GetDefaultCertDB,
//GO(CERT_GetDomainComponentName,
GO(CERT_GetDefaultCertDB, pFv)
GO(CERT_GetDomainComponentName, pFp)
//GO(CERT_GetEncodedOCSPResponse,
//GO(CERT_GetFirstEmailAddress,
//GO(CERT_GetGeneralNameTypeFromString,
//GO(CERT_GetImposedNameConstraints,
//GO(CERT_GetLocalityName,
GO(CERT_GetLocalityName, pFp)
//GO(CERT_GetNextEmailAddress,
//GO(CERT_GetNextGeneralName,
//GO(CERT_GetNextNameConstraint,
@ -182,14 +182,14 @@
//GO(CERT_GetOCSPResponseStatus,
//GO(CERT_GetOCSPStatusForCertID,
//GO(CERT_GetOidString,
//GO(CERT_GetOrgName,
//GO(CERT_GetOrgUnitName,
GO(CERT_GetOrgName, pFp)
GO(CERT_GetOrgUnitName, pFp)
//GO(CERT_GetPKIXVerifyNistRevocationPolicy,
//GO(CERT_GetPrevGeneralName,
//GO(CERT_GetPrevNameConstraint,
//GO(CERT_GetSlopTime,
//GO(CERT_GetSSLCACerts,
//GO(CERT_GetStateName,
GO(CERT_GetStateName, pFp)
//GO(CERT_GetSubjectNameDigest,
//GO(CERT_GetSubjectPublicKeyDigest,
//GO(CERT_GetUsePKIXForValidation,
@ -240,7 +240,7 @@ DATA(CERT_NameTemplate, 4*sizeof(void*))
//GO(__CERT_TraversePermCertsForNickname,
//GO(__CERT_TraversePermCertsForSubject,
//GO(CERT_UncacheCRL,
//GO(CERT_VerifyCACertForUsage,
GO(CERT_VerifyCACertForUsage, iFppiippp)
//GO(CERT_VerifyCert,
//GO(CERT_VerifyCertificate,
//GO(CERT_VerifyCertificateNow,
@ -330,7 +330,7 @@ DATA(CERT_NameTemplate, 4*sizeof(void*))
//GO(NSS_Get_SEC_UTF8StringTemplate,
//GO(NSS_Get_sgn_DigestInfoTemplate,
//GO(NSS_GetVersion,
//GO(NSS_Init,
GO(NSS_Init, iFp)
//GO(NSS_InitContext,
//GO(NSS_Initialize,
//GO(__nss_InitLock,
@ -349,7 +349,7 @@ GO(NSS_NoDB_Init, iFp)
//GO(NSSRWLock_New,
//GO(NSSRWLock_UnlockRead,
//GO(NSSRWLock_UnlockWrite,
//GO(NSS_Shutdown,
GO(NSS_Shutdown, iFv)
//GO(NSS_ShutdownContext,
//GO(NSS_UnregisterShutdown,
GO(NSS_VersionCheck, iFp)
@ -765,7 +765,7 @@ DATA(SEC_IA5StringTemplate, 4*sizeof(void*)) //R type
//GO(SECMOD_AddNewModuleEx,
//GO(SECMOD_CancelWait,
//GO(SECMOD_CanDeleteInternalModule,
//GO(SECMOD_CloseUserDB,
GO(SECMOD_CloseUserDB, iFp)
//GO(SECMOD_CreateModule,
//GO(SECMOD_CreateModuleEx,
//GO(SECMOD_DeleteInternalModule,

18
src/wrapped/wrappedplc4.c Executable file
View File

@ -0,0 +1,18 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _GNU_SOURCE /* See feature_test_macros(7) */
#include <dlfcn.h>
#include "wrappedlibs.h"
#include "wrapper.h"
#include "bridge.h"
#include "librarian/library_private.h"
#include "x86emu.h"
const char* plc4Name = "libplc4.so";
#define LIBNAME plc4
#include "wrappedlib_init.h"

View File

@ -0,0 +1,44 @@
#if !(defined(GO) && defined(GOM) && defined(GO2) && defined(DATA))
#error Meh....
#endif
//GO(PL_Base64Decode,
//GO(PL_Base64Encode,
//GO(PL_CreateLongOptState,
//GO(PL_CreateOptState,
//GO(PL_DestroyOptState,
//GO(PL_FPrintError,
//GO(PL_GetNextOpt,
//GO(PL_PrintError,
//GO(PL_strcasecmp,
//GO(PL_strcaserstr,
//GO(PL_strcasestr,
//GO(PL_strcat,
//GO(PL_strcatn,
//GO(PL_strchr,
//GO(PL_strcmp,
//GO(PL_strcpy,
//GO(PL_strdup,
//GO(PL_strfree,
//GO(PL_strlen,
//GO(PL_strncasecmp,
//GO(PL_strncaserstr,
//GO(PL_strncasestr,
//GO(PL_strncat,
//GO(PL_strnchr,
//GO(PL_strncmp,
//GO(PL_strncpy,
//GO(PL_strncpyz,
//GO(PL_strndup,
//GO(PL_strnlen,
//GO(PL_strnpbrk,
//GO(PL_strnprbrk,
//GO(PL_strnrchr,
//GO(PL_strnrstr,
//GO(PL_strnstr,
//GO(PL_strpbrk,
//GO(PL_strprbrk,
//GO(PL_strrchr,
//GO(PL_strrstr,
//GO(PL_strstr,
//GO(PL_strtok_r,

18
src/wrapped/wrappedplds4.c Executable file
View File

@ -0,0 +1,18 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _GNU_SOURCE /* See feature_test_macros(7) */
#include <dlfcn.h>
#include "wrappedlibs.h"
#include "wrapper.h"
#include "bridge.h"
#include "librarian/library_private.h"
#include "x86emu.h"
const char* plds4Name = "libplds4.so";
#define LIBNAME plds4
#include "wrappedlib_init.h"

View File

@ -0,0 +1,29 @@
#if !(defined(GO) && defined(GOM) && defined(GO2) && defined(DATA))
#error Meh....
#endif
//GO(PL_ArenaAllocate,
//GO(PL_ArenaFinish,
//GO(PL_ArenaGrow,
//GO(PL_ArenaRelease,
//GO(PL_ClearArenaPool,
//GO(PL_CompactArenaPool,
//GO(PL_CompareStrings,
//GO(PL_CompareValues,
//GO(PL_FinishArenaPool,
//GO(PL_FreeArenaPool,
//GO(PL_HashString,
//GO(PL_HashTableAdd,
//GO(PL_HashTableDestroy,
//GO(PL_HashTableDump,
//GO(PL_HashTableEnumerateEntries,
//GO(PL_HashTableLookup,
//GO(PL_HashTableLookupConst,
//GO(PL_HashTableRawAdd,
//GO(PL_HashTableRawLookup,
//GO(PL_HashTableRawLookupConst,
//GO(PL_HashTableRawRemove,
//GO(PL_HashTableRemove,
//GO(PL_InitArenaPool,
//GO(PL_NewHashTable,
//GO(PL_SizeOfArenaPoolExcludingPool,

View File

@ -305,6 +305,16 @@ EXPORT void* my_NSS_CMSEncoder_Start(x86emu_t* emu, void* cmsg, void* outputf, v
find_NSSCMSGetDecryptKeyCallback_Fct(decryptcb), decryptarg, detached, items);
}
EXPORT void* my_NSS_CMSMessage_CreateFromDER(x86emu_t* emu, void* msg, void* cb, void* cb_arg,
void* pwfn, void* pwfn_arg, void* decrypt, void* decrypt_arg)
{
smime3_my_t* my = (smime3_my_t*)my_lib->priv.w.p2;
return my->NSS_CMSMessage_CreateFromDER(msg, find_NSSCMSContentCallback_Fct(cb), cb_arg,
find_PK11PasswordFunc_Fct(pwfn), pwfn_arg,
find_NSSCMSGetDecryptKeyCallback_Fct(decrypt), decrypt_arg);
}
#define CUSTOM_INIT \
lib->priv.w.p2 = getSmime3My(lib);

View File

@ -3,13 +3,13 @@
#endif
//GO(CERT_ConvertAndDecodeCertificate,
//GO(CERT_DecodeCertFromPackage,
GO(CERT_DecodeCertFromPackage, pFpi)
//GO(CERT_DecodeCertPackage,
//GO(NSS_CMSContentInfo_GetBulkKey,
//GO(NSS_CMSContentInfo_GetBulkKeySize,
//GO(NSS_CMSContentInfo_GetContent,
GO(NSS_CMSContentInfo_GetContent, pFp)
//GO(NSS_CMSContentInfo_GetContentEncAlgTag,
//GO(NSS_CMSContentInfo_GetContentTypeTag,
GO(NSS_CMSContentInfo_GetContentTypeTag, iFp)
//GO(NSS_CMSContentInfo_SetBulkKey,
//GO(NSS_CMSContentInfo_SetContent,
//GO(NSS_CMSContentInfo_SetContent_Data,
@ -49,9 +49,9 @@ GOM(NSS_CMSEncoder_Start, pFEppppppppppp)
//GO(NSS_CMSMessage_ContentLevelCount,
//GO(NSS_CMSMessage_Copy,
GO(NSS_CMSMessage_Create, pFp)
//GO(NSS_CMSMessage_CreateFromDER,
GOM(NSS_CMSMessage_CreateFromDER, pFEppppppp)
GO(NSS_CMSMessage_Destroy, vFp)
//GO(NSS_CMSMessage_GetContent,
GO(NSS_CMSMessage_GetContent, pFp)
GO(NSS_CMSMessage_GetContentInfo, pFp)
//GO(NSS_CMSMessage_IsEncrypted,
//GO(NSS_CMSMessage_IsSigned,
@ -77,12 +77,12 @@ GO(NSS_CMSSignedData_Destroy, vFp)
//GO(NSS_CMSSignedData_GetDigestAlgs,
//GO(NSS_CMSSignedData_GetSignerInfo,
//GO(NSS_CMSSignedData_HasDigests,
//GO(NSS_CMSSignedData_ImportCerts,
GO(NSS_CMSSignedData_ImportCerts, iFppii)
//GO(NSS_CMSSignedData_SetDigests,
//GO(NSS_CMSSignedData_SetDigestValue,
//GO(NSS_CMSSignedData_SignerInfoCount,
//GO(NSS_CMSSignedData_VerifyCertsOnly,
//GO(NSS_CMSSignedData_VerifySignerInfo,
GO(NSS_CMSSignedData_SignerInfoCount, iFpi)
GO(NSS_CMSSignedData_VerifyCertsOnly, iFppp)
GO(NSS_CMSSignedData_VerifySignerInfo, iFpipi)
//GO(NSS_CMSSignerInfo_AddMSSMIMEEncKeyPrefs,
//GO(NSS_CMSSignerInfo_AddSigningTime,
//GO(NSS_CMSSignerInfo_AddSMIMECaps,

128
src/wrapped/wrappedssl3.c Executable file
View File

@ -0,0 +1,128 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _GNU_SOURCE /* See feature_test_macros(7) */
#include <dlfcn.h>
#include "wrappedlibs.h"
#include "debug.h"
#include "wrapper.h"
#include "bridge.h"
#include "librarian/library_private.h"
#include "x86emu.h"
#include "emu/x86emu_private.h"
#include "callback.h"
#include "librarian.h"
#include "box86context.h"
#include "emu/x86emu_private.h"
#include "myalign.h"
const char* ssl3Name = "libssl3.so";
#define LIBNAME ssl3
static library_t *my_lib = NULL;
#include "generated/wrappedssl3types.h"
typedef struct ssl3_my_s {
// functions
#define GO(A, B) B A;
SUPER()
#undef GO
} ssl3_my_t;
void* getSsl3My(library_t* lib)
{
my_lib = lib;
ssl3_my_t* my = (ssl3_my_t*)calloc(1, sizeof(ssl3_my_t));
#define GO(A, W) my->A = (W)dlsym(lib->priv.w.lib, #A);
SUPER()
#undef GO
return my;
}
void freeSsl3My(void* lib)
{
//ssl3_my_t *my = (ssl3_my_t *)lib;
}
#undef SUPER
#define SUPER() \
GO(0) \
GO(1) \
GO(2) \
GO(3) \
GO(4)
// SSLBadCertHandler ...
#define GO(A) \
static uintptr_t my_SSLBadCertHandler_fct_##A = 0; \
static int my_SSLBadCertHandler_##A(void* a, void* b) \
{ \
return RunFunction(my_context, my_SSLBadCertHandler_fct_##A, 2, a, b); \
}
SUPER()
#undef GO
static void* find_SSLBadCertHandler_Fct(void* fct)
{
if(!fct) return fct;
if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct);
#define GO(A) if(my_SSLBadCertHandler_fct_##A == (uintptr_t)fct) return my_SSLBadCertHandler_##A;
SUPER()
#undef GO
#define GO(A) if(my_SSLBadCertHandler_fct_##A == 0) {my_SSLBadCertHandler_fct_##A = (uintptr_t)fct; return my_SSLBadCertHandler_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for ssl3 SSLBadCertHandler callback\n");
return NULL;
}
// SSLAuthCertificate ...
#define GO(A) \
static uintptr_t my_SSLAuthCertificate_fct_##A = 0; \
static int my_SSLAuthCertificate_##A(void* a, void* b, int c, int d) \
{ \
return RunFunction(my_context, my_SSLAuthCertificate_fct_##A, 4, a, b, c, d); \
}
SUPER()
#undef GO
static void* find_SSLAuthCertificate_Fct(void* fct)
{
if(!fct) return fct;
if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct);
#define GO(A) if(my_SSLAuthCertificate_fct_##A == (uintptr_t)fct) return my_SSLAuthCertificate_##A;
SUPER()
#undef GO
#define GO(A) if(my_SSLAuthCertificate_fct_##A == 0) {my_SSLAuthCertificate_fct_##A = (uintptr_t)fct; return my_SSLAuthCertificate_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for ssl3 SSLAuthCertificate callback\n");
return NULL;
}
#undef SUPER
EXPORT int my_SSL_BadCertHook(x86emu_t* emu, void* fd, void* f, void* arg)
{
ssl3_my_t* my = (ssl3_my_t*)my_lib->priv.w.p2;
return my->SSL_BadCertHook(fd, find_SSLBadCertHandler_Fct(f), arg);
}
EXPORT int my_SSL_AuthCertificateHook(x86emu_t* emu, void* fd, void* f, void* arg)
{
ssl3_my_t* my = (ssl3_my_t*)my_lib->priv.w.p2;
return my->SSL_AuthCertificateHook(fd, find_SSLBadCertHandler_Fct(f), arg);
}
#define CUSTOM_INIT \
lib->priv.w.p2 = getSsl3My(lib);
#define CUSTOM_FINI \
freeSsl3My(lib->priv.w.p2); \
free(lib->priv.w.p2);
#include "wrappedlib_init.h"

109
src/wrapped/wrappedssl3_private.h Executable file
View File

@ -0,0 +1,109 @@
#if !(defined(GO) && defined(GOM) && defined(GO2) && defined(DATA))
#error Meh....
#endif
//GO(DTLS_GetHandshakeTimeout,
//GO(DTLS_ImportFD,
//GO(NSS_CmpCertChainWCANames,
//GO(NSS_FindCertKEAType,
//GO(NSS_GetClientAuthData,
GO(NSS_SetDomesticPolicy, iFv)
//GO(NSS_SetExportPolicy,
//GO(NSS_SetFrancePolicy,
//GO(NSSSSL_GetVersion,
//GO(NSSSSL_VersionCheck,
//GO(SSL_AlertReceivedCallback,
//GO(SSL_AlertSentCallback,
GO(SSL_AuthCertificate, iFppii)
//GO(SSL_AuthCertificateComplete,
GOM(SSL_AuthCertificateHook, iFEppp)
GOM(SSL_BadCertHook, iFEppp)
//GO(SSL_CanBypass,
//GO(SSL_CertDBHandleSet,
//GO(SSL_CipherPolicyGet,
//GO(SSL_CipherPolicySet,
//GO(SSL_CipherPrefGet,
//GO(SSL_CipherPrefGetDefault,
//GO(SSL_CipherPrefSet,
//GO(SSL_CipherPrefSetDefault,
//GO(SSL_ClearSessionCache,
//GO(SSL_ConfigMPServerSIDCache,
//GO(SSL_ConfigSecureServer,
//GO(SSL_ConfigSecureServerWithCertChain,
//GO(SSL_ConfigServerCert,
//GO(SSL_ConfigServerSessionIDCache,
//GO(SSL_ConfigServerSessionIDCacheWithOpt,
//GO(SSL_DataPending,
//GO(SSL_DHEGroupPrefSet,
//GO(SSL_EnableWeakDHEPrimeGroup,
//GO(SSL_ExportEarlyKeyingMaterial,
//GO(SSL_ExportKeyingMaterial,
GO(SSL_ForceHandshake, iFp)
//GO(SSL_ForceHandshakeWithTimeout,
//GO(SSL_GetChannelInfo,
//GO(SSL_GetCipherSuiteInfo,
//GO(SSL_GetClientAuthDataHook,
//GO(SSL_GetExperimentalAPI,
//GO(SSL_GetImplementedCiphers,
//GO(SSL_GetMaxServerCacheLocks,
//GO(SSL_GetNegotiatedHostInfo,
//GO(SSL_GetNextProto,
//GO(SSL_GetNumImplementedCiphers,
//GO(SSL_GetPreliminaryChannelInfo,
//GO(SSL_GetSessionID,
//GO(SSL_GetSRTPCipher,
//GO(SSL_GetStatistics,
//GO(SSL_HandshakeCallback,
//GO(SSL_HandshakeNegotiatedExtension,
GO(SSL_ImportFD, pFpp)
//GO(SSL_InheritMPServerSIDCache,
//GO(SSL_InvalidateSession,
//GO(SSL_LocalCertificate,
//GO(SSL_NamedGroupConfig,
//GO(SSL_OptionGet,
//GO(SSL_OptionGetDefault,
GO(SSL_OptionSet, iFpil)
//GO(SSL_OptionSetDefault,
//GO(SSL_PeerCertificate,
//GO(SSL_PeerCertificateChain,
//GO(SSL_PeerSignedCertTimestamps,
//GO(SSL_PeerStapledOCSPResponses,
//GO(SSL_PreencryptedFileToStream,
//GO(SSL_PreencryptedStreamToFile,
//GO(SSL_RecommendedCanFalseStart,
//GO(SSL_ReconfigFD,
//GO(SSL_ReHandshake,
//GO(SSL_ReHandshakeWithTimeout,
GO(SSL_ResetHandshake, iFpi)
//GO(SSL_RestartHandshakeAfterCertReq,
//GO(SSL_RestartHandshakeAfterServerCert,
//GO(SSL_RevealCert,
//GO(SSL_RevealPinArg,
//GO(SSL_RevealURL,
//GO(SSL_SecurityStatus,
//GO(SSL_SendAdditionalKeyShares,
//GO(SSL_SetCanFalseStartCallback,
//GO(SSL_SetDowngradeCheckVersion,
//GO(SSL_SetMaxServerCacheLocks,
//GO(SSL_SetNextProtoCallback,
//GO(SSL_SetNextProtoNego,
//GO(SSL_SetPKCS11PinArg,
//GO(SSL_SetSessionTicketKeyPair,
//GO(SSL_SetSignedCertTimestamps,
//GO(SSL_SetSockPeerID,
//GO(SSL_SetSRTPCiphers,
//GO(SSL_SetStapledOCSPResponses,
//GO(SSL_SetTrustAnchors,
GO(SSL_SetURL, iFpp)
//GO(SSL_ShutdownServerSessionIDCache,
//GO(SSL_SignatureMaxCount,
//GO(SSL_SignaturePrefGet,
//GO(SSL_SignaturePrefSet,
//GO(SSL_SignatureSchemePrefGet,
//GO(SSL_SignatureSchemePrefSet,
//GO(SSL_SNISocketConfigHook,
//GO(SSL_VersionRangeGet,
//GO(SSL_VersionRangeGetDefault,
//GO(SSL_VersionRangeGetSupported,
//GO(SSL_VersionRangeSet,
//GO(SSL_VersionRangeSetDefault,