mirror of
https://github.com/wownero/wownero.git
synced 2026-10-17 15:41:44 +02:00
device_trezor: reject incompatible firmware versions
This commit is contained in:
@@ -172,6 +172,8 @@ namespace trezor {
|
||||
pubkey = info.address;
|
||||
return true;
|
||||
|
||||
} catch(exc::FirmwareNotSupportedException const&){
|
||||
throw;
|
||||
} catch(std::exception const& e){
|
||||
MERROR("Get public address exception: " << e.what());
|
||||
return false;
|
||||
@@ -207,6 +209,8 @@ namespace trezor {
|
||||
|
||||
} catch(const exc::proto::CancelledException &){
|
||||
CHECK_AND_ASSERT_THROW_MES(false, "Key export rejected on device");
|
||||
} catch(exc::FirmwareNotSupportedException const&){
|
||||
throw;
|
||||
} catch(std::exception const& e){
|
||||
MERROR("Get secret keys exception: " << e.what());
|
||||
return false;
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
#include "device_trezor_base.hpp"
|
||||
#include "memwipe.h"
|
||||
#include <algorithm>
|
||||
#include <boost/algorithm/string/classification.hpp>
|
||||
#include <boost/algorithm/string/split.hpp>
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
@@ -240,6 +241,12 @@ namespace trezor {
|
||||
if (!m_features->has_initialized() || !m_features->initialized()){
|
||||
throw exc::TrezorException("Device is not initialized");
|
||||
}
|
||||
|
||||
// Reject firmware that doesn't have the Monero feature/capability
|
||||
const auto& capabilities = m_features->capabilities();
|
||||
if (std::find(capabilities.begin(), capabilities.end(), messages::management::Features::Capability_Monero) == capabilities.end()){
|
||||
throw exc::FirmwareNotSupportedException();
|
||||
}
|
||||
}
|
||||
|
||||
void device_trezor_base::call_ping_unsafe(){
|
||||
|
||||
@@ -118,6 +118,12 @@ namespace exc {
|
||||
ProtocolException(): CommunicationException("Trezor protocol error"){}
|
||||
};
|
||||
|
||||
class FirmwareNotSupportedException: public TrezorException {
|
||||
public:
|
||||
using TrezorException::TrezorException;
|
||||
FirmwareNotSupportedException(): TrezorException("Trezor firmware version does not support Monero"){}
|
||||
};
|
||||
|
||||
// Communication protocol namespace
|
||||
// Separated to distinguish between client and Trezor side exceptions.
|
||||
namespace proto {
|
||||
|
||||
Reference in New Issue
Block a user