| 472 | |
| 473 | |
| 474 | bool cConnection::SendEncryptedData(SOCKET a_Socket, cAESCFBEncryptor & a_Encryptor, const char * a_Data, size_t a_Size, const char * a_Peer) |
| 475 | { |
| 476 | DataLog(a_Data, a_Size, "Encrypting %d bytes to %s", a_Size, a_Peer); |
| 477 | const Byte * Data = (const Byte *)a_Data; |
| 478 | while (a_Size > 0) |
| 479 | { |
| 480 | Byte Buffer[64 KiB]; |
| 481 | size_t NumBytes = (a_Size > sizeof(Buffer)) ? sizeof(Buffer) : a_Size; |
| 482 | a_Encryptor.ProcessData(Buffer, Data, NumBytes); |
| 483 | bool res = SendData(a_Socket, (const char *)Buffer, NumBytes, a_Peer); |
| 484 | if (!res) |
| 485 | { |
| 486 | return false; |
| 487 | } |
| 488 | Data += NumBytes; |
| 489 | a_Size -= NumBytes; |
| 490 | } |
| 491 | return true; |
| 492 | } |
| 493 | |
| 494 | |
| 495 |
nothing calls this directly
no test coverage detected