MCPcopy Create free account
hub / github.com/WiVRn/WiVRn / pbkdf2

Function pbkdf2

common/crypto.cpp:508–525  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

506}
507
508std::vector<uint8_t> pbkdf2(std::string pass, std::string salt, std::span<uint8_t> secret, size_t size)
509{
510 std::array params{
511 OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SALT, salt.data(), salt.size()),
512 OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_PASSWORD, pass.data(), pass.size()),
513 OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SECRET, secret.data(), secret.size()),
514 OSSL_PARAM_construct_end(),
515 };
516
517 details::kdf_context kdf{"PBKDF2"};
518
519 std::vector<uint8_t> result;
520 result.resize(size);
521 if (EVP_KDF_derive(kdf, result.data(), size, params.data()) != 1)
522 throw_openssl_error();
523
524 return result;
525}
526
527} // namespace crypto

Callers 1

secretsMethod · 0.85

Calls 4

throw_openssl_errorFunction · 0.70
dataMethod · 0.45
sizeMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected