diff options
Diffstat (limited to 'src/mongo/client/sasl_scram_client_conversation.cpp')
-rw-r--r-- | src/mongo/client/sasl_scram_client_conversation.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/mongo/client/sasl_scram_client_conversation.cpp b/src/mongo/client/sasl_scram_client_conversation.cpp index c0f38495822..8947068f3da 100644 --- a/src/mongo/client/sasl_scram_client_conversation.cpp +++ b/src/mongo/client/sasl_scram_client_conversation.cpp @@ -82,14 +82,10 @@ StatusWith<bool> SaslSCRAMClientConversation::_firstStep(std::string* outputData } // Create text-based nonce as base64 encoding of a binary blob of length multiple of 3 - const int nonceLenQWords = 3; + static constexpr size_t nonceLenQWords = 3; uint64_t binaryNonce[nonceLenQWords]; - unique_ptr<SecureRandom> sr(SecureRandom::create()); - - binaryNonce[0] = sr->nextInt64(); - binaryNonce[1] = sr->nextInt64(); - binaryNonce[2] = sr->nextInt64(); + SecureRandom().fill(binaryNonce, sizeof(binaryNonce)); std::string user = _saslClientSession->getParameter(SaslClientSession::parameterUser).toString(); |