Mir

Code review comment for lp:~mir-team/mir/public-cookie-api

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

+// FIXME Remove me when we are no longer returning 8 byte MACS
+// We assert that what we return is 8 bytes, so lets test for that for now!
+TEST(MirCookieFactory, assert_8_bytes_for_mac)
+{
+ std::vector<uint8_t> secret{ 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0xde, 0x01 };
+ auto factory = mir::cookie::CookieFactory::create_from_secret(secret);
+ uint64_t mock_timestamp{0x322322322332};
+ auto mac = factory->timestamp_to_mac(mock_timestamp);
+
+ EXPECT_EQ(mac.size(), sizeof(uint64_t));
+}

sizeof(uint64_t) is not a synonym for 8 - although platforms with 16bit characters are of little interest to us.

« Back to merge proposal