Added code to work around key load failures.

If a key is evicted it may not be possible to reload it. In this case
tcsd will return TCS_E_KM_LOADFAILED from an operation that uses a
private key. The workaround is to unload and load the key again with a
new handle. In order to isolate the handle churn to a single layer,
TSS handles are virtualized in TPMUtilityImpl.

BUG=chrome-os-partner:13878
TEST=Ran all unit tests and relevant autotests.
     Manually attempted to reproduced the problem and verified that the
     reload logic was operating correctly. This condition is evidenced
     by a warning in the syslog: "TCS load failure: attempting to reload
     key.".

Change-Id: I3961456db3ac383a2721a9d0c102a4ae3dac1642
Reviewed-on: https://gerrit.chromium.org/gerrit/33023
Reviewed-by: Kees Cook <keescook@chromium.org>
Commit-Ready: Darren Krahn <dkrahn@chromium.org>
Tested-by: Darren Krahn <dkrahn@chromium.org>
2 files changed
tree: b7984b16762c61f9152aa29c7519352fff45a6f8
  1. pkcs11/
  2. attributes.cc
  3. attributes.h
  4. attributes.proto
  5. chaps.cc
  6. chaps.h
  7. chaps_adaptor.cc
  8. chaps_adaptor.h
  9. chaps_client.cc
  10. chaps_factory.h
  11. chaps_factory_impl.cc
  12. chaps_factory_impl.h
  13. chaps_factory_mock.cc
  14. chaps_factory_mock.h
  15. chaps_interface.h
  16. chaps_interface.xml
  17. chaps_proxy.cc
  18. chaps_proxy.h
  19. chaps_proxy_mock.cc
  20. chaps_proxy_mock.h
  21. chaps_service.cc
  22. chaps_service.h
  23. chaps_service_redirect.cc
  24. chaps_service_redirect.h
  25. chaps_service_test.cc
  26. chaps_test.cc
  27. chaps_utility.cc
  28. chaps_utility.h
  29. chapsd.cc
  30. chapsd.conf
  31. chapsd_test.cc
  32. common.mk
  33. handle_generator.h
  34. handle_generator_mock.h
  35. LICENSE
  36. login_event_client.cc
  37. login_event_client.h
  38. login_event_listener.h
  39. Makefile
  40. object.h
  41. object_impl.cc
  42. object_impl.h
  43. object_importer.h
  44. object_importer_mock.cc
  45. object_importer_mock.h
  46. object_mock.cc
  47. object_mock.h
  48. object_policy.h
  49. object_policy_cert.cc
  50. object_policy_cert.h
  51. object_policy_common.cc
  52. object_policy_common.h
  53. object_policy_data.cc
  54. object_policy_data.h
  55. object_policy_key.cc
  56. object_policy_key.h
  57. object_policy_mock.cc
  58. object_policy_mock.h
  59. object_policy_private_key.cc
  60. object_policy_private_key.h
  61. object_policy_public_key.cc
  62. object_policy_public_key.h
  63. object_policy_secret_key.cc
  64. object_policy_secret_key.h
  65. object_policy_test.cc
  66. object_pool.h
  67. object_pool_impl.cc
  68. object_pool_impl.h
  69. object_pool_mock.cc
  70. object_pool_mock.h
  71. object_pool_test.cc
  72. object_store.h
  73. object_store_fake.h
  74. object_store_impl.cc
  75. object_store_impl.h
  76. object_store_mock.cc
  77. object_store_mock.h
  78. object_store_test.cc
  79. object_test.cc
  80. opencryptoki_importer.cc
  81. opencryptoki_importer.h
  82. opencryptoki_importer_test.cc
  83. opencryptoki_sample_token.tgz
  84. org.chromium.Chaps.conf
  85. org.chromium.Chaps.service
  86. OWNERS
  87. p11_replay.cc
  88. README
  89. session.h
  90. session_impl.cc
  91. session_impl.h
  92. session_mock.cc
  93. session_mock.h
  94. session_test.cc
  95. slot_manager.h
  96. slot_manager_impl.cc
  97. slot_manager_impl.h
  98. slot_manager_mock.cc
  99. slot_manager_mock.h
  100. slot_manager_test.cc
  101. tpm_utility.h
  102. tpm_utility_impl.cc
  103. tpm_utility_impl.h
  104. tpm_utility_mock.cc
  105. tpm_utility_mock.h
  106. tpm_utility_test.cc