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

Function SymmetricAuthEncryptRepeatedly

tests/test_crypto.cpp:696–714  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

694// Purpose: Performs specified # of symmetric encryptions
695//-----------------------------------------------------------------------------
696void SymmetricAuthEncryptRepeatedly( int cIterations, AES_GCM_EncryptContext &ctxEnc, uint8 *pubData, int cubToEncrypt, uint8 *pubIV )
697{
698 int nBufSize = cubToEncrypt + 32; // 16 = AES block size.. worst case for padded data
699 uint8 *pEncrypted = new uint8[ nBufSize ];
700
701 // try a bunch of iterations of symmetric encrypting big packets
702 for ( int iIteration = 0; iIteration < cIterations; iIteration++ )
703 {
704 uint cubEncrypted = nBufSize;
705 bool bRet = ctxEnc.Encrypt(
706 &pubData[iIteration], cubToEncrypt,
707 pubIV,
708 pEncrypted, &cubEncrypted,
709 nullptr, 0 );
710 CHECK( bRet ); // must succeed
711 }
712
713 delete [] pEncrypted;
714}
715
716//-----------------------------------------------------------------------------
717// Purpose: Performs specified # of symmetric descryptions

Callers 1

Calls 1

EncryptMethod · 0.45

Tested by

no test coverage detected