| 114 | } |
| 115 | |
| 116 | void applyHmacKeyDerivationFunc(StreamCipherKey* cipherKey, HmacSha256StreamCipher* hmacGenerator, Arena& arena) { |
| 117 | uint8_t buf[cipherKey->size() + sizeof(uint64_t)]; |
| 118 | memcpy(&buf[0], cipherKey->data(), cipherKey->size()); |
| 119 | uint64_t seed = deterministicRandom()->randomUInt64(); |
| 120 | memcpy(&buf[0] + cipherKey->size(), &seed, sizeof(uint64_t)); |
| 121 | StringRef digest = hmacGenerator->digest(&buf[0], cipherKey->size() + sizeof(uint64_t), arena); |
| 122 | std::copy(digest.begin(), digest.end(), &buf[0]); |
| 123 | cipherKey->initializeKey(&buf[0], cipherKey->size()); |
| 124 | } |
| 125 | |
| 126 | EncryptionStreamCipher::EncryptionStreamCipher(const StreamCipherKey* key, const StreamCipher::IV& iv) |
| 127 | : cipher(StreamCipher(key->size())) { |
nothing calls this directly
no test coverage detected