MCPcopy Create free account
hub / github.com/ValveSoftware/GameNetworkingSockets / SymmetricAuthDecryptRepeatedly

Function SymmetricAuthDecryptRepeatedly

tests/test_crypto.cpp:719–737  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Purpose: Performs specified # of symmetric descryptions -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

717// Purpose: Performs specified # of symmetric descryptions
718//-----------------------------------------------------------------------------
719void SymmetricAuthDecryptRepeatedly( int cIterations, AES_GCM_DecryptContext &ctxDec, uint8 *pubEncrypted, int cubEncrypted, uint8 *pubIV )
720{
721 int nBufSize = cubEncrypted + 32; // 16 = AES block size.. worst case for padded data
722 uint8 *pDecrypted = new uint8[ nBufSize ];
723
724 // try a bunch of iterations of symmetric encrypting big packets
725 for ( int iIteration = 0; iIteration < cIterations; iIteration++ )
726 {
727 uint cubOutput = nBufSize;
728 bool bRet = ctxDec.Decrypt(
729 pubEncrypted, cubEncrypted,
730 pubIV,
731 pDecrypted, &cubOutput,
732 nullptr, 0 );
733 CHECK( bRet ); // must succeed
734 }
735
736 delete [] pDecrypted;
737}
738
739//-----------------------------------------------------------------------------
740// Purpose: Tests symmetric crypto perf

Callers 1

Calls 1

DecryptMethod · 0.45

Tested by

no test coverage detected