text
stringlengths
14
100k
source
stringclasses
1 value
repo
stringclasses
810 values
language
stringclasses
13 values
<|fim_suffix|>ChaCha20Poly1305Selftest(void) { BYTE buf[3 + SYMCRYPT_POLY1305_RESULT_SIZE]; SYMCRYPT_ERROR err; if ( SymCryptChaCha20Poly1305Encrypt( SymCryptTestKey32, sizeof( SymCryptTestKey32 ), SymCryptTestMsg16, 12, ...
fim
winsiderss/systeminformer
c
<|fim_suffix|>P256; cbExpectedOid = sizeof(rgbOidP256); fDoNistEcDerDecode = TRUE; break; case SYMCRYPT_CACHED_ECURVE_ID_NIST_P384: pbExpectedOid = rgbOidP384; cbExpectedOid = sizeof(rgbOidP384); fDoNistEcDerDecode = TRUE; break...
fim
winsiderss/systeminformer
c
<|fim_suffix|>omputation. eckeyFlags |= SYMCRYPT_FLAG_KEY_NO_FIPS; } pkEphemeralEcKey = SymCryptEckeyAllocate( pkEcKey->pCurve ); if( pkEphemeralEcKey == NULL ) { scError = SYMCRYPT_MEMORY_ALLOCATION_FAILURE; goto cleanup; } scError = SymCryptEckeySetValueCompositeEncod...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // cpuid.c code for CPU feature detection based on CPUID // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // #include "precomp.h" #if (SYMCRYPT_CPU_ARM | SYMCRYPT_CPU_ARM64) & SYMCRYPT_MS_VC #include <excpt.h> #endif #if SYMCRYPT_CPU_X86 | SYMCRYPT_CPU_AMD64 // // RDRAN...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // cpuid_notry.c code for CPU feature detection based on CPUID for ARM64 // without the try except structure (used in boot environment) // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // #include "precomp.h" #if SYMCRYPT_CPU_ARM64 & SYMCRYPT_MS_VC #define ARM...
fim
winsiderss/systeminformer
c
<|fim_suffix|>e ) { result &= ~SYMCRYPT_CPU_FEATURE_NEON_PMULL; } // Check for SHA2 support has_feature = 0; len = sizeof(has_feature); if( sysctlbyname("hw.optional.arm.FEAT_SHA256", &has_feature, &len, NULL, 0) == 0 && has_feature ) { result &= ~SYMCRYPT_CPU_FEATURE_NEON_S...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // crt.c Chinese Remainder Theorem Algorithms // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // #include "precomp.h" SYMCRYPT_ERROR SYMCRYPT_CALL SymCryptCrtGenerateForTwoCoprimes( _In_ PCSYMCRYPT_MODULUS pmP, _In_ PCSYMCRYPT_MODULUS pmQ, UI...
fim
winsiderss/systeminformer
c
<|fim_suffix|>Result) PBYTE pbResult, SIZE_T cbResult, BOOLEAN bWipe) { SymCryptKeccakExtract(&pState->ks, pbResult, cbResult, bWipe); if (bWipe) { // If the state was wiped, set the state as if cSHAKE w...
fim
winsiderss/systeminformer
c
<|fim_suffix|>cSha512_256Algorithm; case SYMCRYPT_MAC_ID_HMAC_SHA3_224: return SymCryptHmacSha3_224Algorithm; case SYMCRYPT_MAC_ID_HMAC_SHA3_256: return SymCryptHmacSha3_256Algorithm; case SYMCRYPT_MAC_ID_HMAC_SHA3_384: return SymCryptHmacSha3_384Algorithm; ...
fim
winsiderss/systeminformer
c
<|fim_suffix|>E desxKnownKey[24] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x01, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18 }; static const BYTE desxKnownPlaintext[] = { 0xd9, 0xb6, 0xa1, 0x4e, 0xe6, 0x71, 0x4e, 0x17 }; static const BYTE desxKnow...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // dh.c DH functions // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // // #include "precomp.h" SYMCRYPT_ERROR SYMCRYPT_CALL SymCryptDhSecretAgreement( _In_ PCSYMCRYPT_DLKEY pkPrivate, _In_ <|fim_suffix|>= SymCryptSizeofModElem...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // dl_internal_groups.c Parameters for internally supported dl groups. // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // // #include "precomp.h" // Do not delete the following preprocessor directive. // It is used for folding the parameters. #if 1 /*********************...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // dlgroup.c Dlgroup functions // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // // #include "precomp.h" // Miller-Rabin iterations for prime generation #define DLGROUP_MR_ITERATIONS (64) // Default size for Q according to FIPS 186-3 static const struct _DSA_NBITS...
fim
winsiderss/systeminformer
c
// // dlkey.c Dlkey functions // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // // #include "precomp.h" PSYMCRYPT_DLKEY SYMCRYPT_CALL SymCryptDlkeyAllocate( _In_ PCSYMCRYPT_DLGROUP pDlgroup ) { PVOID p; SIZE_T cb; PSYMCRYPT_DLKEY res = NULL; ...
fim
winsiderss/systeminformer
c
<|fim_suffix|>ernal -= cbModelementP; peR = SymCryptModElementCreate(pbScratchInternal, cbModelementQ, pDlgroup->pmQ); pbScratchInternal += cbModelementQ; cbScratchInternal -= cbModelementQ; peS = SymCryptModElementCreate(pbScratchInternal, cbModelementQ, pDlgroup->pmQ); pbScratchInternal += cbModelementQ; cbS...
fim
winsiderss/systeminformer
c
<|fim_suffix|> { scError = SYMCRYPT_INVALID_ARGUMENT; goto cleanup; } // Check that the curve is the same for both keys if ( SymCryptEcurveIsSame( pkPrivate->pCurve, pkPublic->pCurve ) ) { pCurve = pkPrivate->pCurve; } else { scError = SYMCRYPT_INVALID_ARGUM...
fim
winsiderss/systeminformer
c
<|fim_suffix|> SymCryptTwistedEdwardsOnCurve, SymCryptTwistedEdwardsAdd, SymCryptTwistedEdwardsAddDiffNonZero, SymCryptTwistedEdwardsDouble, SymCryptTwistedEdwardsNegate, SymCryptEcpointScalarMulFixedWindow, SymCryptEcpointMultiScalarMulWnafWithInterleaving, ...
fim
winsiderss/systeminformer
c
// // ec_dsa.c ECDSA functions // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // // #include "precomp.h" /* Sections 7.2.7 and 7.2.8 of the 29 August 2000 IEEE Standard Specifications for Public-Key Cryptography, IEEE Std 1363-2000, list DSA versions of the elliptic curve...
fim
winsiderss/systeminformer
c
<|fim_suffix|>, //y 0x4F, 0xE3, 0x42, 0xE2, 0xFE, 0x1A, 0x7F, 0x9B, 0x8E, 0xE7, 0xEB, 0x4A, 0x7C, 0x0F, 0x9E, 0x16, 0x2B, 0xCE, 0x33, 0x57, 0x6B, 0x31, 0x5E, 0xCE, 0xCB, 0xB6, 0x40, 0x68, 0x37, 0xBF, 0x51, 0xF5, //q 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, ...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // ec_internal_curves.c Internally allocated elliptic curves. // // These curves are lazy-initialized. Currently only used // for composite algorithms to avoid per-key allocation overhead. // #include "precomp.h" static PCSYMCRYPT_ECURVE rgpCachedCurves[SYMCRYPT_CACH<|fim_suffix|>CACHED_ECURVE_ID ...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // ec_montgomery.c Montgomery Implementation // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // #include "precomp.h" VOID SYMCRYPT_CALL SymCryptMontgomeryFillScratchSpaces(_In_ PSYMCRYPT_ECURVE pCurve) { UINT32 nDigits = SymCryptDigitsFromBits( pCurve->FModBitsize ); ...
fim
winsiderss/systeminformer
c
<|fim_suffix|>L SymCryptEcpointScalarMulFixedWindow( _In_ PCSYMCRYPT_ECURVE pCurve, _In_ PCSYMCRYPT_INT piScalar, _In_opt_ PCSYMCRYPT_ECPOINT poSrc, UINT32 flags, _Out_ PSYMCRYPT_ECPOINT poDst, _Out_writes_bytes_( cbScratch )...
fim
winsiderss/systeminformer
c
<|fim_suffix|>e). // UINT32 SYMCRYPT_CALL SymCryptShortWeierstrassIsEqual( _In_ PCSYMCRYPT_ECURVE pCurve, _In_ PCSYMCRYPT_ECPOINT poSrc1, _In_ PCSYMCRYPT_ECPOINT poSrc2, UINT32 flags, _Out_writes_bytes_( cbScratch ) PBYTE pbScratch, ...
fim
winsiderss/systeminformer
c
<|fim_suffix|> PSYMCRYPT_MODELEMENT peSrcY = SYMCRYPT_INTERNAL_ECPOINT_COORDINATE( 1, pCurve, poSrc ); PSYMCRYPT_MODELEMENT peSrcZ = SYMCRYPT_INTERNAL_ECPOINT_COORDINATE( 2, pCurve, poSrc ); PSYMCRYPT_MODELEMENT peDstX = SYMCRYPT_INTERNAL_ECPOINT_COORDINATE( 0, pCurve, poDst ); PSYMCRYPT_MODELEMENT peDst...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // eckey.c Functions for the ECKEY object // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // // #include "precomp.h" PSYMCRYPT_ECKEY SYMCRYPT_CALL SymCryptEckeyAllocate( _In_ PCSYMCRYPT_ECURVE pCurve ) { PVOID p; SIZE_T cb; PSYMCRYPT...
fim
winsiderss/systeminformer
c
<|fim_suffix|> poDst->normalized = TRUE; } else if (coTo == SYMCRYPT_ECPOINT_COORDINATES_SINGLE_PROJECTIVE) { // Set Y to 1 (Ignore the second coordinate of the source point) peDst = SYMCRYPT_INTERNAL_ECPOINT_COORDINATE( 1, pCurve, poDst ); ...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // ecurve.c Ecurve functions // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // // #include "precomp.h" // Approximate number of consecutive operations with the modulus and the // (sub)group order of the curve. These numbers can trigger special optimizations // on the und...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // env_Win10Sgx.c // Platform-specific code for windows 10 SGX user mode. // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // #include "precomp.h" VOID SYMCRYPT_CALL SymCryptCpuidExCallback( int cpuInfo[4], int function_id, int subfunction_id ); SYMCRYPT_CPU_FEATURES SYMCRY...
fim
winsiderss/systeminformer
c
<|fim_suffix|>RAMETER( pSaveArea ); } #endif VOID SYMCRYPT_CALL SymCryptTestInjectErrorEnvGeneric( PBYTE pbBuf, SIZE_T cbBuf ) { // // This feature is only used during testing. In production it is always // an empty function that the compiler can optimize away. // UNREFERENCED_PARAMETER( pbBuf ...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // env_opteeTa.c // Platform-specific code for OPTEE TA. // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // #include "precomp.h" // OPTEE TA specific data #define TEE_ERROR_BAD_STATE 0xFFFF0007 typedef uint32_t TEE_Result; void TEE_Panic(TEE_Result panicCode...
fim
winsiderss/systeminformer
c
<|fim_suffix|>bBuf ); UNREFERENCED_PARAMETER( cbBuf ); } <|fim_prefix|>// // env_posixUserMode.c // Platform-specific code for POSIX-compatible systems (Linux, macOS, other Unix-likes) // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // #include "precomp.h" SYMCRYPT_CPU_FEATURES SYMCRY...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // env_windowsBootLib.c // Platform-specific code for windows boot library environment. // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // #pragma warning(push) #pragma warning(disable: 5103) // Arm64's wdm.h included below currently generate a lot of 5103 warnings #include ...
fim
winsiderss/systeminformer
c
<|fim_suffix|>PT_CPU_FEATURES) ~0; SymCryptInitEnvCommon( version ); } _Analysis_noreturn_ VOID SYMCRYPT_CALL SymCryptFatalEnvWindowsKernelDebugger( UINT32 fatalCode ) { UINT32 fatalCodeVar; SymCryptFatalIntercept( fatalCode ); // // Put the fatal code in a location where it shows up in the du...
fim
winsiderss/systeminformer
c
<|fim_suffix|>d inline this function and optimize it away. // UNREFERENCED_PARAMETER( pSaveArea ); return SYMCRYPT_NO_ERROR; } VOID SYMCRYPT_CALL SymCryptRestoreXmmEnvWindowsKernelmodeWin7nLater( _Inout_ PSYMCRYPT_EXTENDED_SAVE_DATA pSaveArea ) { // // In amd64 kernel mode there is no need to s...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // env_windowsKernelModeWin8_1nLater.c // Platform-specific code for windows kernel mode, Windows 8.1 and later // // On Win8.1 x86 you don't need to save the XMM registers. // This is the environment code we use, which has empty XMM save/restore routines // for optimal performance. It also supports th...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // env_windowsUserMode.c // Platform-specific code for windows user mode. // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // // #include "precomp.h" #pragma warning(push) #pragma warning(disable: 5103) // Arm64's wdm.h included below currently generate a lot of 5103 warning...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // env_windowsUserMode.c // Platform-specific code for windows user mode. // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // //#include "precomp.h" #pragma warning(push) #pragma warning(disable: 5103) // Arm64's wdm.h included below currently generate a lot of 5103 warnings...
fim
winsiderss/systeminformer
c
<|fim_suffix|>_FORCE_READ32( (volatile UINT32 *) p1 ) ^ SYMCRYPT_FORCE_READ32( (volatile UINT32 *) p2 ); p1 += 4; p2 += 4; cbBytes -= 4; } // We have to deal with the remaining bytes using a separate accumulator to work around an issue in the ARM64 compiler. if( cbBytes > 0 ) { ...
fim
winsiderss/systeminformer
c
<|fim_suffix|>t, flags, pbScratch, cbScratch ); return scError; } #endif // CPU_AMD64<|fim_prefix|>// // fdef_int.c INT functions for default number format // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // #include "precomp.h" #if (SYMCRYPT_CPU_AMD64 | SYMCRYPT_CPU_ARM64) #if !(S...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // fdef_general.c General functions of the default format. // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // // // #include "precomp.h" #include "smallPrimes32.h" // For SymCryptTestTrialdivisionMaxSmallPrime #if SYMCRYPT_CPU_AMD64 | SYMCRYPT_CPU_ARM64 #define SYM...
fim
winsiderss/systeminformer
c
<|fim_suffix|> cleanup: return; // label needs a statement to follow it... } VOID SYMCRYPT_CALL SymCryptFdefIntDivMod( _In_ PCSYMCRYPT_INT piSrc, _In_ PCSYMCRYPT_DIVISOR pdDivisor, _Out_opt_ PSYMCRYPT_INT p...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // fdef_int.c INT functions for default number format // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // #include "precomp.h" PSYMCRYPT_MODULUS SYMCRYPT_CALL SymCryptFdefModulusAllocate( UINT32 nDigits ) { PVOID p = NULL; UINT32 cb; ...
fim
winsiderss/systeminformer
c
<|fim_suffix|> cbData ) PCBYTE pbSrc, _Out_writes_( cbData ) PBYTE pbDst, SIZE_T cbData, _In_reads_( cbTag ) PCBYTE pbTag, ...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // gen_int.c Generic integer algorithms (not tied to low-level implementations) // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // #include "precomp.h" UINT64 SYMCRYPT_CALL SymCryptUint64Gcd( UINT64 a, UINT64 b, UINT32 flags ) { UINT64 swap; UINT64 tmp; UINT6...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // GHASH.c // // Implementation of the NIST SP800-38D GHASH function which is the // core authentication function for the GCM and GMAC modes. // // This implementation was done by Niels Ferguson for the RSA32.lib library in 2008, // and adapted to the SymCrypt library in 2009. // // Copyright (c) Micro...
fim
winsiderss/systeminformer
c
<|fim_suffix|>32( res, 1 ); \ res = vshrq_n_u32( res, 31 ); \ \ _T0 = veorq_u8( _T0, _T1 ); \ res = vextq_u8( res, res, 12 ); \ \ res = veorq_u8( res, _T0 ); \ }; #define REVERSE_BYTES( _in, _out )\ {\ __n128 _t;\ _t = vrev64q_u8( _in ); \ _out = vextq_u8( _t, _t, 8 ); \ } #endif // CPU_A...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // hash.c generic code used in many hash implementations. // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // #include "precomp.h" VOID SYMCRYPT_CALL SymCryptHashAppendInternal( _In_ PCSYMCRYPT_HASH pHash, _Inout_ ...
fim
winsiderss/systeminformer
c
// // hash_buffer_pattern.c // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // /* SymCryptXxxAppend( _Inout_ SYMCRYPT_Xxx_STATE * state, _In_reads_bytes_( cbData ) PCBYTE pbData, SIZE_T cbData ...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // hash_pattern.c // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // // // This is a file that is #included to define the // all-in-one hash function. // SYMCRYPT_NOINLINE VOID SYMCRYPT_CALL SYMCRYPT_Xxx( _In_reads_( cbData ) PCBYTE ...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // hkdf.c // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // // // This module contains the routines to implement the HKDF // function for the TLS protocol 1.3. It is used in // the protocol's key derivation function. // // #include "precomp.h" SYMCRYPT_ERROR SYMCRYPT_CALL...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // hkdf_selftest.c // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // #include "precom<|fim_suffix|>CryptTestMsg3[0], 3, rbResult, sizeof(pbResultHkdfSha512)); SymCryptInjectError(rbResult, sizeof(pbResultHkdfSha512)); if (memcmp(rbResult, pbResultHkdfSha51...
fim
winsiderss/systeminformer
c
<|fim_suffix|>e->pKey->outerState, &pState->hash ); SymCryptHashAppend( pHash, &pState->hash, innerRes, pHash->resultSize ); SymCryptHashResult( pHash, &pState->hash, pbResult, pHash->resultSize ); // // The SymCryptHashResult already wipes the hash state. // We only need to wipe our own buffer. ...
fim
winsiderss/systeminformer
c
<|fim_suffix|>TE pbResult ) { BYTE innerRes[SYMCRYPT_XXX_RESULT_SIZE]; SYMCRYPT_CHECK_MAGIC( pState ); // // We have to buffer the inner hash result. We can't put it directly in the // hash state data buffer as the Result() function wipes that buffer before returning. ...
fim
winsiderss/systeminformer
c
<|fim_suffix|> SymCryptTestMsg3, sizeof( SymCryptTestMsg3 ), res ); SymCryptInjectError( res, sizeof( res ) ); if( memcmp( res, hmacMd5Kat, sizeof( res ) ) != 0 ) { SymCryptFatal( 'hmd5'); } // // Normally we would wipe the expanded key structure here, // but as this is a selftes...
fim
winsiderss/systeminformer
c
// // HmacSha1.c // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // #include "precomp.h" // // This implementation of HMAC uses extensive knowledge of the internal workings of the // SHA1 implementation and uses internal routines. // This reduces the overhead per HMAC computation by up to ...
fim
winsiderss/systeminformer
c
<|fim_suffix|> BYTE res[SYMCRYPT_HMAC_SHA224_RESULT_SIZE]; SymCryptHmacSha224ExpandKey( &xKey, SymCryptTestKey32, 16 ); SymCryptHmacSha224( &xKey, SymCryptTestMsg3, sizeof( SymCryptTestMsg3 ), res ); SymCryptInjectError( res, sizeof( res ) ); if( memcmp( res, hmacSha224Kat, sizeof( res ) ) != 0 )...
fim
winsiderss/systeminformer
c
<|fim_suffix|> } // // Normally we would wipe the expanded key structure here, // but as this is a selftest with known data this is not needed. // } <|fim_prefix|>// // HmacSha256.c // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // #include "precomp.h" #define ALG SHA256...
fim
winsiderss/systeminformer
c
<|fim_suffix|>macSha384Algorithm_default = { SymCryptHmacSha384ExpandKey, SymCryptHmacSha384Init, SymCryptHmacSha384Append, SymCryptHmacSha384Result, sizeof(SYMCRYPT_HMAC_SHA384_EXPANDED_KEY), sizeof(SYMCRYPT_HMAC_SHA384_STATE), SYMCRYPT_HMAC_SHA384_RESULT_SIZE, &SymCryptSha384Algorithm,...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // HmacSha3_224.c // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // #include "precomp.h" SYMCRYPT_ERROR SYMCRYPT_CALL SymCryptHmacSha3_224ExpandKey( _Out_ PSYMCRYPT_HMAC_SHA3_224_EXPANDED_KEY pExpandedKey, _In_reads_opt_(cbKey) PCBYTE ...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // HmacSha3_256.c // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // #include "precomp.h" SYMCRYPT_ERROR SYMCRYPT_CALL SymCryptHmacSha3_256ExpandKey( _Out_ PSYMCRYPT_HMAC_SHA3_256_EXPANDED_KEY pExpandedKey, _In_reads_opt_(cbKey) PCBYTE ...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // HmacSha3_256.c // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // #include "precomp.h" SYMCRYPT_ERROR SYMCRYPT_CALL SymCryptHmacSha3_384ExpandKey( _Out_ PSYMCRYPT_HMAC_SHA3_384_EXPANDED_KEY pExpandedKey, _In_reads_opt_(cbKey) PCBYTE ...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // HmacSha3_256.c // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // #include "precomp.h" SYMCRYPT_ERROR SYMCRYPT_CALL SymCryptHmacSha3_512ExpandKey( _Out_ PSYMCRYPT_HMAC_SHA3_512_EXPANDED_KEY pExpandedKey, _In_reads_opt_(cbKey) PCBYTE ...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // HmacSha512.c // // Copyright (c) Microsoft Corporation. License<|fim_suffix|>state.dataLengthH = 0;} #include "hmac_pattern.c" #undef SET_DATALENGTH #undef Alg #undef ALG const SYMCRYPT_MAC SymCryptHmacSha512Algorithm_default = { SymCryptHmacSha512ExpandKey, SymCryptHmacSha512Init, SymC...
fim
winsiderss/systeminformer
c
// // HmacSha512_224.c // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // #include "precomp.h" #define SymCryptSha512_224AppendBlocks SymCryptSha512AppendBlocks #define ALG SHA512_224 #define Alg Sha512_224 #define SET_DATALENGTH( state, len ) {state.dataLengthL = len; state.dataLength...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // HmacSha512_256.c // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // #include "precomp.h" #define SymCryptSha512_256AppendBlocks SymCryptSha512AppendBlocks<|fim_suffix|> BYTE res[SYMCRYPT_HMAC_SHA512_256_RESULT_SIZE]; SymCryptHmacSha512_256ExpandKey( &xKey, SymC...
fim
winsiderss/systeminformer
c
<|fim_suffix|>x78, 0x2d, 0xc0, 0x82, 0x4b, 0x87, 0x97, 0xda, 0xf2, 0x36, 0xde, 0xe9, 0x35, 0x69, 0x2e, 0x50, 0x81, 0x0a, 0xea, 0x3b, 0x05, 0xaf, 0x1b, 0x82, 0x3b, 0xc8, 0xa1, 0x9e, 0xe9, 0x9c, 0x5f, 0xd5, 0x5a, 0x20, 0x92, 0x89, 0x46, 0xa4, 0xe4, 0x1a, 0xdd, 0x3d, 0xb6, 0x47, 0x4d, 0xf2, 0xa5, 0xfc, 0x73 };...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // kmac_pattern.c // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // // // This source file implements KMAC128 and KMAC256 // // See the symcrypt.h file for documentation on what the various functions do. // // // SymCryptKmac // VOID SYMCRYPT_CALL SYMCRYPT_Xxx( _...
fim
winsiderss/systeminformer
c
<|fim_suffix|>++ ) { pbResult[i] = pbSrc1[i] ^ pbSrc2[i]; } } #endif // // Generic LSB/MSBfirst load/store code for variable-sized buffers. // These implementations are inefficient and not side-channel safe. // This is sufficient for the current usage (typically to allow // callers to read/write RSA p...
fim
winsiderss/systeminformer
c
// // lms.c LMS implementation // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // #include "precomp.h" // // See the symcrypt.h file for documentation on what the various functions do. // static const PCSYMCRYPT_HASH* LmsHashObjects[] = { &SymCryptSha256Algorithm, // 0 &SymCr...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // Marvin32.c // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // // // This module contains the routines to implement the Marvin32 checksum function // // #include "precomp.h" // // See the symcrypt.h file for documentation on what the various functions do. // // // Defa...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // Md2.c // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // // // This module contains the routines to implement MD2 from RFC 1319 // // This is a new implementation, NOT based on the existing one in RSA32.lib, // which is the one from RSA data security. // // The implementat...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // Md4.c // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // // // This module contains the routines to implement MD4 from RFC 1320 // // // This is a new implementation, NOT based on the existing ones in RSA32.lib. // There are 2 versions in RSA32.lib, one from RSA data secu...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // Md5.c // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // // // This module contains the routines to implement MD5 from RFC 1321 // // // This is a new implementation, NOT based on the existing one in RSA32.lib, // which is the one from RSA data security. RFC-1321 also con...
fim
winsiderss/systeminformer
c
<|fim_suffix|>sh, pParams->cbCommitmentHash, TRUE ); if( !SymCryptEqual( recalculatedCommitmentHash, commitmentHash, pParams->cbCommitmentHash ) ) { scError = SYMCRYPT_SIGNATURE_VERIFICATION_FAILURE; goto cleanup; } cleanup: if( pTemps != NULL ) { SymCryptMlDsaTemporariesFr...
fim
winsiderss/systeminformer
c
// // mldsa_primitives.c ML-DSA low-level primitive implementations // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // #include "precomp.h" // // Q^-1 mod 2^32 - used in Montgomery reduction // #define SYMCRYPT_MLDSA_Q_INV (58728449) // // Inverse NTT fixup times R = (256^-1 << 32) mod Q...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // mlkem.c ML-KEM related functionality // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // #include "precomp.h" #define NROWS_MLKEM512 (2) #define NROWS_MLKEM768 (3) #define NROWS_MLKEM1024 (4) const SYMCRYPT_MLKEM_INTERNAL_PARAMS SymCryptMlKemInternalParamsMlKem512...
fim
winsiderss/systeminformer
c
// // mlkem_primitives.c ML-KEM related functionality // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // #include "precomp.h" // // Current approach is to represent polynomial ring elements as a 512-byte buffer (256 UINT16s). // // Coefficients are added and subtracted when polynomials a...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // modexp.c Modular exponentiation functions // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // #include "precomp.h" // // The windowed modular exponentiation algorithm works by generating a // side-channel table of all the powers of the base from 0 up to 2^W - 1 // where...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // paddingPkcs7.c Add/Remove PKCS7 padding // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // #include "p<|fim_suffix|>st) { pbDst[i] ^= (pbDst[i] ^ pbSrc[i]) & mask; } } cleanup: *pcbResult = cbResult; // Update scError with the ...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // ParHash.c // Code shared with all the parallel hash implementations // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // #include "precomp.h" SYMCRYPT_ERROR SYMCRYPT_CALL SymCryptParallelHashProcess_serial( _In_ ...
fim
winsiderss/systeminformer
c
// // pbkdf2.c // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // // // This module contains the routines to implement the pbkdf2 function // // #include "precomp.h" SYMCRYPT_ERROR SYMCRYPT_CALL SymCryptPbkdf2Derive( _In_ PCSYMCRYPT_PBKDF2_EXPANDED_KEY pExpandedKey,...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // pbkdf2_hmacsha1.c // // Copyright (c) Microsoft Corporation. Licensed under the MI<|fim_suffix|>static const UINT64 pbkdf2_IterationCnt = 5; static const BYTE pbkdf2_sha1Answer[] = { 0xef, 0xa9, 0xbf, 0xea, 0xa3, 0x4d, 0x70, 0x64, }; VOID SYMCRYPT_CALL SymCryptPbkdf2_HmacSha1SelfTest(void) ...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // pbkdf2_hmacsha256.c // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // #include "precomp.h" // // The PBKDF SHA-256 test // This is in a separate module to avoid pulling in<|fim_suffix|> SymCryptFatal('Pbk2'); } } <|fim_middle|> SHA-256 whenever we use PBKDF // ...
fim
winsiderss/systeminformer
c
// // Poly1305.c // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // #include "precomp.h" VOID SYMCRYPT_CALL SymCryptPoly1305ProcessBlocks( _Inout_ PSYMCRYPT_POLY1305_STATE pState, _In_reads_( cbData ) PCBYTE pbData, ...
fim
winsiderss/systeminformer
c
<|fim_suffix|>include <stdlib.h> #include <string.h> #include "..\inc\symcrypt.h" #include "sc_lib.h" #if SYMCRYPT_CPU_X86 | SYMCRYPT_CPU_AMD64 #include <wmmintrin.h> #include <immintrin.h> #if SYMCRYPT_GNUC #include <x86intrin.h> // required for definition of _rdseed64_step for GCC 8 and earlier ...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // primes.c // Primality tests and prime number generation // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // #include "precomp.h" UINT32 SYMCRYPT_CALL SymCryptIntMillerRabinPrimalityTest( _In_ PCSYMCRYPT_INT piSrc, ...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // Rc2.c // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // // // This module contains the routines to implement RC2 from RFC 2268 // // This is a new implementation, based on the RFC specification // and NOT based on the existing one in RSA32.lib, which is the one from RSA ...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // Rc4.c // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // // This is a new implementation, NOT based on the existing ones in RSA32.lib. // The algorithm specification is taken from "ARCFOUR Algorithm" internet // draft dated July 1999, and from memory. // #include "precomp...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // rdrand.c Support for RdRand instruction // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // #include "precomp.h" #if (SYMCRYPT_CPU_X86 | SYMCRYPT_CPU_AMD64) // only available on x86 and amd64 architectures #if SYMCRYPT_MS_VC && _MSC_VER < 1610 #error MSVC version lacks...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // rdseed.c Support for RdSeed instruction // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // #include "precomp.h" #if (SYMCRYPT_CPU_X86 | SYMCRYPT_CPU_AMD64) // only available on x86 and amd64 architectures. #if SYMCRYPT_MS_VC && _MSC_VER < 1610 #error MSVC version lacks...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // recoding.c Algorithms for recoding the factors / exponents in various implementations // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // // #include "precomp.h" // // The following is an adaptation of algorithm 6: "Protected // odd-only recoding algorithm for the fixed...
fim
winsiderss/systeminformer
c
<|fim_suffix|>BER_FORMAT_LSB_FIRST) { // To implement this revert the buffer properly scError = SYMCRYPT_NOT_IMPLEMENTED; goto cleanup; } scError = SYMCRYPT_NO_ERROR; cleanup: if (pbScratch!=NULL) { SymCryptWipe(pbScratch,cbScratch); SymCryptCallbackFree(pbS...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // rsa_padding.c RSA padding algorithms // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // #include "precomp.h" #define ASN1_SEQUENCE_BYTE (0x30) #define ASN1_OCTET_STRING_BYTE (0x04) #define PKCS_BLOCKTYPE_1 (0x01) // This is not used, added here for c...
fim
winsiderss/systeminformer
c
<|fim_suffix|>n_ PCSYMCRYPT_RSAKEY pkRsakey, _Out_writes_opt_(nCrtExponents) PBYTE * ppCrtExponents, _In_reads_(nCrtExponents) SIZE_T * pcbCrtExponents, UINT3...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // sc_lib_mldsa.h // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // // Internal ML-DSA definitions for the symcrypt library. // Always intended to be included as part of sc_lib.h // // // Modulus for ML-DSA // #define SYMCRYPT_MLDSA_Q (8380417) // // Montgomery multiplier ...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // sc_lib_mlkem.h // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // // Internal ML-KEM definitions for the symcrypt library. // Always intended to be included as part of sc_lib.h // //===================================================== // ML-KEM internal high level types...
fim
winsiderss/systeminformer
c
// // scsTools.c Support tools for writing side-channel safe code // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // #include "precomp.h" // // This code needs to process data in words, and we'd like to use 32-bit words on 32-bit // architectures and 64-bit words on 64-bit architectures. ...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // selftest.c // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // #include "precomp.h" <|fim_suffix|>14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, }; const BYTE SymCryptTestMsg16[16] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x9...
fim
winsiderss/systeminformer
c
<|fim_suffix|>I_HMAC_SHA2_384 | SYMCRYPT_SI_HMAC_SHA2_512 | \ SYMCRYPT_SI_HMAC_SHA3_256 | SYMCRYPT_SI_HMAC_SHA3_384 | SYMCRYPT_SI_HMAC_SHA3_512 ) }, { SYMCRYPT_SI_KDF_TLS_V12, SYMCRYPT_SI_PARAM1( SYMCRYPT_SI_SHA2_256 | SYMCRYPT_SI_SHA2_384 ) }, }; ...
fim
winsiderss/systeminformer
c
<|fim_prefix|>// // session.c code for Session API implementation // // Copyright (c) Microsoft Corporation. Licensed under the MIT license. // #include "precomp.h" SYMCRYPT_ERROR SYMCRYPT_CALL SymCryptSessionSenderInit( _Inout_ PSYMCRYPT_SESSION pSession, UINT32 senderId, ...
fim
winsiderss/systeminformer
c