Changeset View
Changeset View
Standalone View
Standalone View
src/client/client-model.cpp
| Show First 20 Lines • Show All 260 Lines • ▼ Show 20 Lines | std::size_t ClientModel::numOneTimeKeysNeeded() const | ||||
| // Keep half of max supported number of keys | // Keep half of max supported number of keys | ||||
| int numUploadedKeys = crypto.uploadedOneTimeKeysCount(CryptoConstants::signedCurve25519); | int numUploadedKeys = crypto.uploadedOneTimeKeysCount(CryptoConstants::signedCurve25519); | ||||
| int numKeysNeeded = crypto.maxNumberOfOneTimeKeys() / 2 | int numKeysNeeded = crypto.maxNumberOfOneTimeKeys() / 2 | ||||
| - numUploadedKeys; | - numUploadedKeys; | ||||
| // Subtract the number of existing one-time keys, in case | // Subtract the number of existing one-time keys, in case | ||||
| // the previous upload was not successful. | // the previous upload was not successful. | ||||
| int numKeysToGenerate = numKeysNeeded - crypto.numUnpublishedOneTimeKeys(); | int numKeysToGenerate = numKeysNeeded - crypto.numUnpublishedOneTimeKeys(); | ||||
| if (numKeysToGenerate < 0) { | |||||
| numKeysToGenerate = 0; | |||||
| } | |||||
| return numKeysToGenerate; | return numKeysToGenerate; | ||||
| } | } | ||||
| std::size_t EncryptMegOlmEventAction::maxRandomSize() | std::size_t EncryptMegOlmEventAction::maxRandomSize() | ||||
| { | { | ||||
| return Crypto::rotateMegOlmSessionRandomSize(); | return Crypto::rotateMegOlmSessionRandomSize(); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 146 Lines • Show Last 20 Lines | |||||