diff options
author | Jack Lloyd <[email protected]> | 2021-04-05 14:47:25 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2021-04-05 17:17:40 -0400 |
commit | fbe0dc71b02feb720b8e118252467bdbb294d4b6 (patch) | |
tree | a83584e29df9390ee4c9798a011d1224ead0fcf7 /src/lib | |
parent | bf58dd9c22dcde5e028b546a313591bc3a09a634 (diff) |
More make_unique
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/pbkdf/pbkdf.cpp | 6 | ||||
-rw-r--r-- | src/lib/pubkey/mce/code_based_key_gen.cpp | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/pbkdf/pbkdf.cpp b/src/lib/pbkdf/pbkdf.cpp index 5e28d3e47..e80f46cfe 100644 --- a/src/lib/pbkdf/pbkdf.cpp +++ b/src/lib/pbkdf/pbkdf.cpp @@ -32,10 +32,10 @@ std::unique_ptr<PBKDF> PBKDF::create(const std::string& algo_spec, if(provider.empty() || provider == "base") { if(auto mac = MessageAuthenticationCode::create("HMAC(" + req.arg(0) + ")")) - return std::unique_ptr<PBKDF>(new PKCS5_PBKDF2(mac.release())); + return std::make_unique<PKCS5_PBKDF2>(mac.release()); if(auto mac = MessageAuthenticationCode::create(req.arg(0))) - return std::unique_ptr<PBKDF>(new PKCS5_PBKDF2(mac.release())); + return std::make_unique<PKCS5_PBKDF2>(mac.release()); } return nullptr; @@ -46,7 +46,7 @@ std::unique_ptr<PBKDF> PBKDF::create(const std::string& algo_spec, if(req.algo_name() == "OpenPGP-S2K" && req.arg_count() == 1) { if(auto hash = HashFunction::create(req.arg(0))) - return std::unique_ptr<PBKDF>(new OpenPGP_S2K(hash.release())); + return std::make_unique<OpenPGP_S2K>(hash.release()); } #endif diff --git a/src/lib/pubkey/mce/code_based_key_gen.cpp b/src/lib/pubkey/mce/code_based_key_gen.cpp index c6fe3e2a5..ab965eff7 100644 --- a/src/lib/pubkey/mce/code_based_key_gen.cpp +++ b/src/lib/pubkey/mce/code_based_key_gen.cpp @@ -187,7 +187,7 @@ std::unique_ptr<binary_matrix> generate_R(std::vector<gf2m> &L, polyn_gf2m* g, c throw Invalid_State("McEliece keygen failed - could not bring matrix to row reduced echelon form"); } - std::unique_ptr<binary_matrix> result(new binary_matrix(code_length-r, r)) ; + auto result = std::make_unique<binary_matrix>(code_length - r, r); for(size_t i = 0; i < result->rows(); ++i) { for(size_t j = 0; j < result->columns(); ++j) |