#include #include #include #include #include #include #include #include #include #include "u2f.hpp" #include "Constants.hpp" #include "U2FMessage.hpp" #include "U2F_CMD.hpp" #include "Storage.hpp" #include "U2F_Init_CMD.hpp" #include "U2F_Init_Response.hpp" #include "U2F_Msg_CMD.hpp" using namespace std; int main(int argc, char** argv) { Storage::init(); auto initFrame = U2F_Init_CMD::get(); U2F_Init_Response resp{}; resp.cid = 0xF1D0F1D0; resp.nonce = initFrame.nonce; resp.protocolVer = 2; resp.majorDevVer = 1; resp.minorDevVer = 0; resp.buildDevVer = 1; resp.capabilities = CAPFLAG_WINK; resp.write(); size_t msgCount = (argc == 2 ? stoul(argv[1]) : 3u); for (size_t i = 0; i < msgCount; i++) { auto reg = U2F_Msg_CMD::get(); cout << "U2F CMD ins: " << static_cast(reg->ins) << endl; reg->respond(); clog << "Fully responded" << endl; } /*auto m = U2FMessage::read(); cout << "U2F CMD: " << static_cast(m.cmd) << endl; for (const auto d : m.data) clog << static_cast(d) << endl;*/ Storage::save(); }