Chromium Code Reviews| Index: device/u2f/u2f_apdu_command.h |
| diff --git a/device/u2f/u2f_apdu_command.h b/device/u2f/u2f_apdu_command.h |
| index 06cd95e81cdf1c37c43cbc6ebfe55790a04e72c8..49f7cf2177bbb9de103fd7364d56df7f2b10bccf 100644 |
| --- a/device/u2f/u2f_apdu_command.h |
| +++ b/device/u2f/u2f_apdu_command.h |
| @@ -37,6 +37,16 @@ class U2fApduCommand : public base::RefCountedThreadSafe<U2fApduCommand> { |
| void set_response_length(size_t response_length) { |
| response_length_ = response_length; |
| } |
| + static scoped_refptr<U2fApduCommand> BuildRegisterCommand( |
|
juanlang (chromium.org)
2017/01/28 00:08:39
Maybe remove Command? The caller will be using U2f
Reilly Grant (use Gerrit)
2017/01/28 00:29:29
I suggest U2fApduCommand::CreateRegister to match
Casey Piper
2017/01/30 21:51:41
Done.
Casey Piper
2017/01/30 21:51:41
Acknowledged.
|
| + const std::vector<uint8_t>& appid_digest, |
| + const std::vector<uint8_t>& challenge_digest); |
| + static scoped_refptr<U2fApduCommand> BuildGetVersionCommand(); |
|
juanlang (chromium.org)
2017/01/28 00:08:39
Remove Get, it's cleaner that way.
Casey Piper
2017/01/30 21:51:41
Done.
|
| + // Early U2F drafts defined a non-ISO 7816-4 conforming layout |
| + static scoped_refptr<U2fApduCommand> BuildGetLegacyVersionCommand(); |
|
juanlang (chromium.org)
2017/01/28 00:08:39
Ditto.
Casey Piper
2017/01/30 21:51:41
Done.
|
| + static scoped_refptr<U2fApduCommand> BuildSignCommand( |
| + const std::vector<uint8_t>& appid_digest, |
| + const std::vector<uint8_t>& challenge_digest, |
| + const std::vector<uint8_t>& key_handle); |
| private: |
| friend class base::RefCountedThreadSafe<U2fApduCommand>; |
| @@ -44,6 +54,7 @@ class U2fApduCommand : public base::RefCountedThreadSafe<U2fApduCommand> { |
| FRIEND_TEST_ALL_PREFIXES(U2fApduTest, TestDeserializeBasic); |
| FRIEND_TEST_ALL_PREFIXES(U2fApduTest, TestDeserializeComplex); |
| FRIEND_TEST_ALL_PREFIXES(U2fApduTest, TestSerializeEdgeCases); |
| + FRIEND_TEST_ALL_PREFIXES(U2fApduTest, TestBuildApdu); |
| static constexpr size_t kApduMinHeader = 4; |
| static constexpr size_t kApduMaxHeader = 7; |
| @@ -55,6 +66,18 @@ class U2fApduCommand : public base::RefCountedThreadSafe<U2fApduCommand> { |
| static constexpr size_t kApduMaxResponseLength = 65536; |
| static constexpr size_t kApduMaxLength = |
| kApduMaxDataLength + kApduMaxHeader + 2; |
| + // APDU instructions |
| + static constexpr uint8_t kInsU2fEnroll = 0x01; |
| + static constexpr uint8_t kInsU2fSign = 0x02; |
| + static constexpr uint8_t kInsU2fVersion = 0x03; |
| + // P1 instructions |
| + static constexpr uint8_t kP1TupRequired = 0x01; |
| + static constexpr uint8_t kP1TupConsumed = 0x02; |
| + static constexpr uint8_t kP1TupRequiredConsumed = |
| + kP1TupRequired | kP1TupConsumed; |
| + static constexpr size_t kMaxKeyHandleLength = 255; |
| + static constexpr size_t kChallengeDigestLen = 32; |
| + static constexpr size_t kAppIdDigestLen = 32; |
| U2fApduCommand(); |
| U2fApduCommand(uint8_t cla, |