mirror of
https://github.com/wownero/wownero.git
synced 2026-11-18 22:35:33 +01:00
device_trezor: reject incompatible firmware versions
This commit is contained in:
@@ -172,6 +172,8 @@ namespace trezor {
|
|||||||
pubkey = info.address;
|
pubkey = info.address;
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
} catch(exc::FirmwareNotSupportedException const&){
|
||||||
|
throw;
|
||||||
} catch(std::exception const& e){
|
} catch(std::exception const& e){
|
||||||
MERROR("Get public address exception: " << e.what());
|
MERROR("Get public address exception: " << e.what());
|
||||||
return false;
|
return false;
|
||||||
@@ -207,6 +209,8 @@ namespace trezor {
|
|||||||
|
|
||||||
} catch(const exc::proto::CancelledException &){
|
} catch(const exc::proto::CancelledException &){
|
||||||
CHECK_AND_ASSERT_THROW_MES(false, "Key export rejected on device");
|
CHECK_AND_ASSERT_THROW_MES(false, "Key export rejected on device");
|
||||||
|
} catch(exc::FirmwareNotSupportedException const&){
|
||||||
|
throw;
|
||||||
} catch(std::exception const& e){
|
} catch(std::exception const& e){
|
||||||
MERROR("Get secret keys exception: " << e.what());
|
MERROR("Get secret keys exception: " << e.what());
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
#include "device_trezor_base.hpp"
|
#include "device_trezor_base.hpp"
|
||||||
#include "memwipe.h"
|
#include "memwipe.h"
|
||||||
|
#include <algorithm>
|
||||||
#include <boost/algorithm/string/classification.hpp>
|
#include <boost/algorithm/string/classification.hpp>
|
||||||
#include <boost/algorithm/string/split.hpp>
|
#include <boost/algorithm/string/split.hpp>
|
||||||
#include <boost/algorithm/string/predicate.hpp>
|
#include <boost/algorithm/string/predicate.hpp>
|
||||||
@@ -240,6 +241,12 @@ namespace trezor {
|
|||||||
if (!m_features->has_initialized() || !m_features->initialized()){
|
if (!m_features->has_initialized() || !m_features->initialized()){
|
||||||
throw exc::TrezorException("Device is not 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(){
|
void device_trezor_base::call_ping_unsafe(){
|
||||||
|
|||||||
@@ -118,6 +118,12 @@ namespace exc {
|
|||||||
ProtocolException(): CommunicationException("Trezor protocol error"){}
|
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
|
// Communication protocol namespace
|
||||||
// Separated to distinguish between client and Trezor side exceptions.
|
// Separated to distinguish between client and Trezor side exceptions.
|
||||||
namespace proto {
|
namespace proto {
|
||||||
|
|||||||
Reference in New Issue
Block a user