[WebAuthN] Import CTAP HID message and packet structure from Chromium
authorjiewen_tan@apple.com <jiewen_tan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 9 Oct 2018 19:32:41 +0000 (19:32 +0000)
committerjiewen_tan@apple.com <jiewen_tan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 9 Oct 2018 19:32:41 +0000 (19:32 +0000)
commit40e770bfc362a278feb37aeefdbc19b90b0e8d4c
tree114142df98c8c4de0ceff252237552fd9f3f77ac
parentbb296161520b5d7e1be6457849848a4e72587551
[WebAuthN] Import CTAP HID message and packet structure from Chromium
https://bugs.webkit.org/show_bug.cgi?id=189289
<rdar://problem/44120310>

Reviewed by Brent Fulgham.

Source/WebCore:

This patch imports CTAP HID message and packet structure:
https://fidoalliance.org/specs/fido-v2.0-ps-20170927/fido-client-to-authenticator-protocol-v2.0-ps-20170927.html#message-and-packet-structure
from Chromium. With this library, WebKit can now turn binaries into messages that CTAP devices could understand.
This patch contains the following Chromium files and modifies them to fit into WebKit:
https://cs.chromium.org/chromium/src/device/fido/fido_constants.cc?l=1&rcl=1efcfbeaf4e4cedf58716e1982b5702770571a75
https://cs.chromium.org/chromium/src/device/fido/fido_constants.h?l=1&rcl=1efcfbeaf4e4cedf58716e1982b5702770571a75
https://cs.chromium.org/chromium/src/device/fido/hid/fido_hid_message.cc?l=1&rcl=387f3725de2842e0e6b7175a9b2ed472b0cf781a
https://cs.chromium.org/chromium/src/device/fido/hid/fido_hid_message.h?rcl=1efcfbeaf4e4cedf58716e1982b5702770571a75
https://cs.chromium.org/chromium/src/device/fido/hid/fido_hid_packet.cc?rcl=1efcfbeaf4e4cedf58716e1982b5702770571a75
https://cs.chromium.org/chromium/src/device/fido/hid/fido_hid_packet.h?rcl=1efcfbeaf4e4cedf58716e1982b5702770571a75
https://cs.chromium.org/chromium/src/device/fido/hid/fido_hid_message_unittest.cc?rcl=1efcfbeaf4e4cedf58716e1982b5702770571a75

Covered by API tests.

* Modules/webauthn/fido/FidoConstants.cpp: Added.
(fido::isFidoHidDeviceCommand):
* Modules/webauthn/fido/FidoConstants.h: Added.
* Modules/webauthn/fido/FidoHidMessage.cpp: Added.
(fido::FidoHidMessage::create):
(fido::FidoHidMessage::createFromSerializedData):
(fido::FidoHidMessage::messageComplete const):
(fido::FidoHidMessage::getMessagePayload const):
(fido::FidoHidMessage::popNextPacket):
(fido::FidoHidMessage::addContinuationPacket):
(fido::FidoHidMessage::numPackets const):
(fido::FidoHidMessage::FidoHidMessage):
* Modules/webauthn/fido/FidoHidMessage.h: Added.
* Modules/webauthn/fido/FidoHidPacket.cpp: Added.
(fido::FidoHidPacket::FidoHidPacket):
(fido::FidoHidInitPacket::createFromSerializedData):
(fido::FidoHidInitPacket::FidoHidInitPacket):
(fido::FidoHidInitPacket::getSerializedData const):
(fido::FidoHidContinuationPacket::createFromSerializedData):
(fido::FidoHidContinuationPacket::FidoHidContinuationPacket):
(fido::FidoHidContinuationPacket::getSerializedData const):
* Modules/webauthn/fido/FidoHidPacket.h: Added.
* Modules/webauthn/fido/FidoParsingUtils.cpp: Added.
(fido::getInitPacketData):
(fido::getContinuationPacketData):
* Modules/webauthn/fido/FidoParsingUtils.h: Added.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:

Tools:

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebCore/FidoHidMessageTest.cpp: Added.
(TestWebKitAPI::TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236976 268f45cc-cd09-0410-ab3c-d52691b4dbfc
14 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Modules/webauthn/fido/FidoConstants.cpp [new file with mode: 0644]
Source/WebCore/Modules/webauthn/fido/FidoConstants.h [new file with mode: 0644]
Source/WebCore/Modules/webauthn/fido/FidoHidMessage.cpp [new file with mode: 0644]
Source/WebCore/Modules/webauthn/fido/FidoHidMessage.h [new file with mode: 0644]
Source/WebCore/Modules/webauthn/fido/FidoHidPacket.cpp [new file with mode: 0644]
Source/WebCore/Modules/webauthn/fido/FidoHidPacket.h [new file with mode: 0644]
Source/WebCore/Modules/webauthn/fido/FidoParsingUtils.cpp [new file with mode: 0644]
Source/WebCore/Modules/webauthn/fido/FidoParsingUtils.h [new file with mode: 0644]
Source/WebCore/Sources.txt
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Tools/ChangeLog
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/WebCore/FidoHidMessageTest.cpp [new file with mode: 0644]