namespace {
-class OTMBluetooth : public BluetoothMock {
+class CancellationMBluetooth : public BluetoothMock {
public:
using BluetoothMock::BluetoothMock;
CryptoBuffer decryptedAdvert;
auto transactionMaker = [&] {
- return BtAdvertScanner(
- std::make_unique<OTMBluetooth>(true,
- BleAdverts{
- {"FFF9", serviceData, IBluetooth::Scanning::STOP}
+ return BtAdvertScanner(std::make_unique<CancellationMBluetooth>(
+ true,
+ BleAdverts{
+ {"FFF9", serviceData, IBluetooth::Scanning::STOP}
}));
};
namespace {
-class OTMEncryptedTunnel : public MEncryptedTunnel {
+class CancellationMEncryptedTunnel : public MEncryptedTunnel {
public:
using MEncryptedTunnel::MEncryptedTunnel;
{
auto makeCMP = [&] {
CtapMessageProcessor cmp;
- cmp.SetEncryptedTunnel(std::make_unique<OTMEncryptedTunnel>(std::vector<CryptoBuffer>{
- ToBuffer(IPHONE_POST_HANDSHAKE_RESPONSE),
- ToBuffer(IPHONE_EXAMPLE_MAKE_CREDENTIAL_RAW_RESPONSE),
- }));
+ cmp.SetEncryptedTunnel(
+ std::make_unique<CancellationMEncryptedTunnel>(std::vector<CryptoBuffer>{
+ ToBuffer(IPHONE_POST_HANDSHAKE_RESPONSE),
+ ToBuffer(IPHONE_EXAMPLE_MAKE_CREDENTIAL_RAW_RESPONSE),
+ }));
return cmp;
};
TestCancelFromTheOtherThread<ICtapMessageProcessor>(
{
auto makeCMP = [&] {
CtapMessageProcessor cmp;
- cmp.SetEncryptedTunnel(std::make_unique<OTMEncryptedTunnel>(std::vector<CryptoBuffer>{
- ToBuffer(ANDROID_POST_HANDSHAKE_RESPONSE),
- ToBuffer(ANDROID_EXAMPLE_RAW_UPDATE_MSG),
- ToBuffer(ANDROID_EXAMPLE_MAKE_CREDENTIAL_RAW_RESPONSE),
- }));
+ cmp.SetEncryptedTunnel(
+ std::make_unique<CancellationMEncryptedTunnel>(std::vector<CryptoBuffer>{
+ ToBuffer(ANDROID_POST_HANDSHAKE_RESPONSE),
+ ToBuffer(ANDROID_EXAMPLE_RAW_UPDATE_MSG),
+ ToBuffer(ANDROID_EXAMPLE_MAKE_CREDENTIAL_RAW_RESPONSE),
+ }));
return cmp;
};
TestCancelFromTheOtherThread<ICtapMessageProcessor>(
{
auto makeCMP = [&] {
CtapMessageProcessor cmp;
- cmp.SetEncryptedTunnel(std::make_unique<OTMEncryptedTunnel>(std::vector<CryptoBuffer>{
- ToBuffer(IPHONE_POST_HANDSHAKE_RESPONSE),
- ToBuffer(IPHONE_EXAMPLE_GET_ASSERTION_RAW_RESPONSE),
- }));
+ cmp.SetEncryptedTunnel(
+ std::make_unique<CancellationMEncryptedTunnel>(std::vector<CryptoBuffer>{
+ ToBuffer(IPHONE_POST_HANDSHAKE_RESPONSE),
+ ToBuffer(IPHONE_EXAMPLE_GET_ASSERTION_RAW_RESPONSE),
+ }));
return cmp;
};
TestCancelFromTheOtherThread<ICtapMessageProcessor>(
{
auto makeCMP = [&] {
CtapMessageProcessor cmp;
- cmp.SetEncryptedTunnel(std::make_unique<OTMEncryptedTunnel>(std::vector<CryptoBuffer>{
- ToBuffer(ANDROID_POST_HANDSHAKE_RESPONSE),
- ToBuffer(ANDROID_EXAMPLE_RAW_UPDATE_MSG),
- ToBuffer(ANDROID_EXAMPLE_GET_ASSERTION_RAW_RESPONSE),
- }));
+ cmp.SetEncryptedTunnel(
+ std::make_unique<CancellationMEncryptedTunnel>(std::vector<CryptoBuffer>{
+ ToBuffer(ANDROID_POST_HANDSHAKE_RESPONSE),
+ ToBuffer(ANDROID_EXAMPLE_RAW_UPDATE_MSG),
+ ToBuffer(ANDROID_EXAMPLE_GET_ASSERTION_RAW_RESPONSE),
+ }));
return cmp;
};
TestCancelFromTheOtherThread<ICtapMessageProcessor>(
namespace {
-class OTMEchoTunnel : public ITunnel {
+class CancellationMEchoTunnel : public ITunnel {
public:
void Connect(const std::string &, std::optional<ExtraHttpHeader>) override
{
auto readerWriter = Crypto::Noise::SymmetricState::CipherState{
CryptoBuffer(Crypto::Noise::KEY_AND_HASH_LEN, 0x5f)};
auto makeEncryptedTunnel = [&] {
- return EncryptedTunnel(std::make_unique<OTMEchoTunnel>(), readerWriter, readerWriter);
+ return EncryptedTunnel(
+ std::make_unique<CancellationMEchoTunnel>(), readerWriter, readerWriter);
};
TestCancelFromTheOtherThread<IEncryptedTunnel>(
400, 40, makeEncryptedTunnel, [&](IEncryptedTunnel &encryptedTunnel) {
namespace {
-class OTConnectMTunnel : public ShouldNotBeUsedMTunnel {
+class CancellationConnectMTunnel : public ShouldNotBeUsedMTunnel {
public:
void Connect(const std::string &, std::optional<ExtraHttpHeader> = std::nullopt) override
{
TEST(Handshake, qr_initiated_connect)
{
- auto makeHandshake = [&] { return Handshake{std::make_unique<OTConnectMTunnel>()}; };
+ auto makeHandshake = [&] { return Handshake{std::make_unique<CancellationConnectMTunnel>()}; };
TestCancelFromTheOtherThread<IHandshake>(400, 40, makeHandshake, [&](IHandshake &handshake) {
handshake.QrInitiatedConnect({}, {}, {});
});
TEST(Handshake, state_assisted_connect)
{
- auto makeHandshake = [&] { return Handshake{std::make_unique<OTConnectMTunnel>()}; };
+ auto makeHandshake = [&] { return Handshake{std::make_unique<CancellationConnectMTunnel>()}; };
TestCancelFromTheOtherThread<IHandshake>(400, 40, makeHandshake, [&](IHandshake &handshake) {
handshake.StateAssistedConnect({}, {}, {});
});
namespace {
-class OTHandshakeMTunnel : public HandshakeMTunnel {
+class CancellationHandshakeMTunnel : public HandshakeMTunnel {
public:
- OTHandshakeMTunnel(CryptoBuffer psk,
- const Crypto::X9_62_P_256_Key *platformPubKey,
- const Crypto::X9_62_P_256_Key *authenticatorPrivKey,
- CryptoBuffer getInfoMsg)
+ CancellationHandshakeMTunnel(CryptoBuffer psk,
+ const Crypto::X9_62_P_256_Key *platformPubKey,
+ const Crypto::X9_62_P_256_Key *authenticatorPrivKey,
+ CryptoBuffer getInfoMsg)
: HandshakeMTunnel{std::move(psk), platformPubKey, authenticatorPrivKey, std::move(getInfoMsg)}
{
}
TEST(Handshake, qr_initiated_handshake_cancel_from_the_other_thread)
{
- auto test = QrInitiatedHandshakeTest<OTHandshakeMTunnel>{};
+ auto test = QrInitiatedHandshakeTest<CancellationHandshakeMTunnel>{};
auto makeHandshake = [&] { return test.MakeHandshake(); };
TestCancelFromTheOtherThread<IHandshake>(200, 20, makeHandshake, [&](IHandshake &handshake) {
test.RunAndTestHandshake(handshake);
TEST(Handshake, state_assisted_handshake_cancel_from_the_other_thread)
{
- auto test = StateAssistedHandshakeTest<OTHandshakeMTunnel>{};
+ auto test = StateAssistedHandshakeTest<CancellationHandshakeMTunnel>{};
auto makeHandshake = [&] { return test.MakeHandshake(); };
TestCancelFromTheOtherThread<IHandshake>(200, 20, makeHandshake, [&](IHandshake &handshake) {
test.RunAndTestHandshake(handshake);
namespace {
-class OTMQrCodeShower : public IQrCodeShower {
+class CancellationMQrCodeShower : public IQrCodeShower {
public:
void ShowQrCode(const CryptoBuffer &,
const CryptoBuffer &,
CancelFacilitator m_cancelFacilitator;
};
-class OTMHandshake : public IHandshake {
+class CancellationMHandshake : public IHandshake {
public:
void QrInitiatedConnect(const std::string &, const BufferView &, const BufferView &) override
{
nullptr,
nullptr,
{},
- std::make_unique<OTMQrCodeShower>(),
- std::make_unique<OTMBtAdvertScanner<&GenerateDecryptedBluetoothAdvert>>(),
- std::make_unique<OTMHandshake>(),
- std::make_unique<OTMCtapMessageProcessor>());
+ std::make_unique<CancellationMQrCodeShower>(),
+ std::make_unique<CancellationMBtAdvertScanner<&GenerateDecryptedBluetoothAdvert>>(),
+ std::make_unique<CancellationMHandshake>(),
+ std::make_unique<CancellationMCtapMessageProcessor>());
};
TestCancelFromTheOtherThread<ITransaction>(
400, 40, makeTransaction, [](ITransaction &transaction) {
namespace {
-class OTMHandshake : public IHandshake {
+class CancellationMHandshake : public IHandshake {
public:
void QrInitiatedConnect(const std::string &, const BufferView &, const BufferView &) override
{
auto makeTransaction = [&] {
return StateAssistedTransaction(
{},
- std::make_unique<OTMHandshake>(),
- std::make_unique<OTMBtAdvertScanner<&DecryptedBluetoothAdvert>>(),
- std::make_unique<OTMCtapMessageProcessor>());
+ std::make_unique<CancellationMHandshake>(),
+ std::make_unique<CancellationMBtAdvertScanner<&DecryptedBluetoothAdvert>>(),
+ std::make_unique<CancellationMCtapMessageProcessor>());
};
TestCancelFromTheOtherThread<ITransaction>(
400, 40, makeTransaction, [](ITransaction &transaction) {
};
template <CryptoBuffer (*decryptedAdvertGenerator)()>
-class OTMBtAdvertScanner : public IBtAdvertScanner {
+class CancellationMBtAdvertScanner : public IBtAdvertScanner {
public:
void AwaitAdvert(const CryptoBuffer & /*eidKey*/, CryptoBuffer &decryptedAdvert) override
{
CancelFacilitator m_cancelFacilitator;
};
-class OTMCtapMessageProcessor : public ICtapMessageProcessor {
+class CancellationMCtapMessageProcessor : public ICtapMessageProcessor {
public:
void SetEncryptedTunnel(std::unique_ptr<IEncryptedTunnel>) override {}