shill: vpn: Add PKCS#11 to OpenVPN.
This includes both setting up relevant openvpn options and passing a TPM token /
pin through the management interface. Also, refactor a bit the InitOptions code
to ease testing and readability and some OpenVPNDriver unit test cleanup.
BUG=chromium-os:28948
TEST=unit tests
Change-Id: Iff65d9b4ae29defdf02f1da4ebb4845d1050e144
Reviewed-on: https://gerrit.chromium.org/gerrit/19587
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Ready: Darin Petkov <petkov@chromium.org>
diff --git a/openvpn_management_server.h b/openvpn_management_server.h
index 42a2734..b4cd33f 100644
--- a/openvpn_management_server.h
+++ b/openvpn_management_server.h
@@ -40,11 +40,14 @@
FRIEND_TEST(OpenVPNManagementServerTest, OnInput);
FRIEND_TEST(OpenVPNManagementServerTest, OnReady);
FRIEND_TEST(OpenVPNManagementServerTest, OnReadyAcceptFail);
+ FRIEND_TEST(OpenVPNManagementServerTest, ParseNeedPasswordTag);
FRIEND_TEST(OpenVPNManagementServerTest, PerformStaticChallenge);
FRIEND_TEST(OpenVPNManagementServerTest, PerformStaticChallengeNoCreds);
FRIEND_TEST(OpenVPNManagementServerTest, ProcessInfoMessage);
FRIEND_TEST(OpenVPNManagementServerTest, ProcessMessage);
FRIEND_TEST(OpenVPNManagementServerTest, ProcessNeedPasswordMessageAuthSC);
+ FRIEND_TEST(OpenVPNManagementServerTest, ProcessNeedPasswordMessageTPMToken);
+ FRIEND_TEST(OpenVPNManagementServerTest, ProcessNeedPasswordMessageUnknown);
FRIEND_TEST(OpenVPNManagementServerTest, ProcessStateMessage);
FRIEND_TEST(OpenVPNManagementServerTest, Send);
FRIEND_TEST(OpenVPNManagementServerTest, SendPassword);
@@ -52,6 +55,8 @@
FRIEND_TEST(OpenVPNManagementServerTest, SendUsername);
FRIEND_TEST(OpenVPNManagementServerTest, Start);
FRIEND_TEST(OpenVPNManagementServerTest, Stop);
+ FRIEND_TEST(OpenVPNManagementServerTest, SupplyTPMToken);
+ FRIEND_TEST(OpenVPNManagementServerTest, SupplyTPMTokenNoPIN);
// IO handler callbacks.
void OnReady(int fd);
@@ -68,7 +73,10 @@
bool ProcessFailedPasswordMessage(const std::string &message);
bool ProcessStateMessage(const std::string &message);
- void PerformStaticChallenge();
+ void PerformStaticChallenge(const std::string &tag);
+ void SupplyTPMToken(const std::string &tag);
+
+ static std::string ParseNeedPasswordTag(const std::string &message);
OpenVPNDriver *driver_;
GLib *glib_;