diff options
Diffstat (limited to 'legacy_support/keymaster_passthrough_engine.cpp')
-rw-r--r-- | legacy_support/keymaster_passthrough_engine.cpp | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/legacy_support/keymaster_passthrough_engine.cpp b/legacy_support/keymaster_passthrough_engine.cpp index ed22320..d966d71 100644 --- a/legacy_support/keymaster_passthrough_engine.cpp +++ b/legacy_support/keymaster_passthrough_engine.cpp @@ -45,33 +45,35 @@ class TKeymasterPassthroughEngine : public KeymasterPassthroughEngine { explicit TKeymasterPassthroughEngine(const KeymasterDeviceType* km_device) : km_device_(km_device) { rsa_encrypt_op_factory_.reset( - new opfactory_t(KM_ALGORITHM_RSA, KM_PURPOSE_ENCRYPT, km_device_)); + new (std::nothrow) opfactory_t(KM_ALGORITHM_RSA, KM_PURPOSE_ENCRYPT, km_device_)); rsa_decrypt_op_factory_.reset( - new opfactory_t(KM_ALGORITHM_RSA, KM_PURPOSE_DECRYPT, km_device_)); - rsa_sign_op_factory_.reset(new opfactory_t(KM_ALGORITHM_RSA, KM_PURPOSE_SIGN, km_device_)); + new (std::nothrow) opfactory_t(KM_ALGORITHM_RSA, KM_PURPOSE_DECRYPT, km_device_)); + rsa_sign_op_factory_.reset(new (std::nothrow) + opfactory_t(KM_ALGORITHM_RSA, KM_PURPOSE_SIGN, km_device_)); rsa_verify_op_factory_.reset( - new opfactory_t(KM_ALGORITHM_RSA, KM_PURPOSE_VERIFY, km_device_)); + new (std::nothrow) opfactory_t(KM_ALGORITHM_RSA, KM_PURPOSE_VERIFY, km_device_)); ec_encrypt_op_factory_.reset( - new opfactory_t(KM_ALGORITHM_EC, KM_PURPOSE_ENCRYPT, km_device_)); + new (std::nothrow) opfactory_t(KM_ALGORITHM_EC, KM_PURPOSE_ENCRYPT, km_device_)); ec_decrypt_op_factory_.reset( - new opfactory_t(KM_ALGORITHM_EC, KM_PURPOSE_DECRYPT, km_device_)); - ec_sign_op_factory_.reset(new opfactory_t(KM_ALGORITHM_EC, KM_PURPOSE_SIGN, km_device_)); + new (std::nothrow) opfactory_t(KM_ALGORITHM_EC, KM_PURPOSE_DECRYPT, km_device_)); + ec_sign_op_factory_.reset(new (std::nothrow) + opfactory_t(KM_ALGORITHM_EC, KM_PURPOSE_SIGN, km_device_)); ec_verify_op_factory_.reset( - new opfactory_t(KM_ALGORITHM_EC, KM_PURPOSE_VERIFY, km_device_)); + new (std::nothrow) opfactory_t(KM_ALGORITHM_EC, KM_PURPOSE_VERIFY, km_device_)); ec_derive_op_factory_.reset( - new opfactory_t(KM_ALGORITHM_EC, KM_PURPOSE_DERIVE_KEY, km_device_)); + new (std::nothrow) opfactory_t(KM_ALGORITHM_EC, KM_PURPOSE_DERIVE_KEY, km_device_)); aes_encrypt_op_factory_.reset( - new opfactory_t(KM_ALGORITHM_AES, KM_PURPOSE_ENCRYPT, km_device_)); + new (std::nothrow) opfactory_t(KM_ALGORITHM_AES, KM_PURPOSE_ENCRYPT, km_device_)); aes_decrypt_op_factory_.reset( - new opfactory_t(KM_ALGORITHM_AES, KM_PURPOSE_DECRYPT, km_device_)); - triple_des_encrypt_op_factory_.reset( - new opfactory_t(KM_ALGORITHM_TRIPLE_DES, KM_PURPOSE_ENCRYPT, km_device_)); - triple_des_decrypt_op_factory_.reset( - new opfactory_t(KM_ALGORITHM_TRIPLE_DES, KM_PURPOSE_DECRYPT, km_device_)); + new (std::nothrow) opfactory_t(KM_ALGORITHM_AES, KM_PURPOSE_DECRYPT, km_device_)); + triple_des_encrypt_op_factory_.reset(new (std::nothrow) opfactory_t( + KM_ALGORITHM_TRIPLE_DES, KM_PURPOSE_ENCRYPT, km_device_)); + triple_des_decrypt_op_factory_.reset(new (std::nothrow) opfactory_t( + KM_ALGORITHM_TRIPLE_DES, KM_PURPOSE_DECRYPT, km_device_)); hmac_sign_op_factory_.reset( - new opfactory_t(KM_ALGORITHM_HMAC, KM_PURPOSE_SIGN, km_device_)); + new (std::nothrow) opfactory_t(KM_ALGORITHM_HMAC, KM_PURPOSE_SIGN, km_device_)); hmac_verify_op_factory_.reset( - new opfactory_t(KM_ALGORITHM_HMAC, KM_PURPOSE_VERIFY, km_device_)); + new (std::nothrow) opfactory_t(KM_ALGORITHM_HMAC, KM_PURPOSE_VERIFY, km_device_)); } virtual ~TKeymasterPassthroughEngine() { // QUIRK: we only take ownership if this is a KM2 device. @@ -294,10 +296,10 @@ keymaster_error_t TKeymasterPassthroughEngine<keymaster2_device_t>::ImportKey( typedef UniquePtr<KeymasterPassthroughEngine> engine_ptr_t; engine_ptr_t KeymasterPassthroughEngine::createInstance(const keymaster1_device_t* dev) { - return engine_ptr_t(new TKeymasterPassthroughEngine<keymaster1_device_t>(dev)); + return engine_ptr_t(new (std::nothrow) TKeymasterPassthroughEngine<keymaster1_device_t>(dev)); } engine_ptr_t KeymasterPassthroughEngine::createInstance(const keymaster2_device_t* dev) { - return engine_ptr_t(new TKeymasterPassthroughEngine<keymaster2_device_t>(dev)); + return engine_ptr_t(new (std::nothrow) TKeymasterPassthroughEngine<keymaster2_device_t>(dev)); } } // namespace keymaster |