aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndreas Steffen <andreas.steffen@strongswan.org>2011-11-28 00:53:24 +0100
committerAndreas Steffen <andreas.steffen@strongswan.org>2011-11-28 21:24:00 +0100
commitdb08702326bdccf09d08c2f5015b3d518cbe7dbb (patch)
tree08eeba139856040c78ccb473e923570adb2027cd /src
parentf2a521e7953342e3c9fb7d2742faa55ba015bf8a (diff)
downloadstrongswan-db08702326bdccf09d08c2f5015b3d518cbe7dbb.tar.bz2
strongswan-db08702326bdccf09d08c2f5015b3d518cbe7dbb.tar.xz
automatically registering component measurements
Diffstat (limited to 'src')
-rw-r--r--src/libpts/plugins/imc_attestation/imc_attestation_process.c2
-rw-r--r--src/libpts/plugins/imv_attestation/data.sql786
-rw-r--r--src/libpts/plugins/imv_attestation/imv_attestation_build.c3
-rw-r--r--src/libpts/plugins/imv_attestation/imv_attestation_process.c5
-rw-r--r--src/libpts/plugins/imv_attestation/imv_attestation_state.c19
-rw-r--r--src/libpts/plugins/imv_attestation/imv_attestation_state.h6
-rw-r--r--src/libpts/pts/components/ita/ita_comp_ima.c91
-rw-r--r--src/libpts/pts/components/ita/ita_comp_ima.h6
-rw-r--r--src/libpts/pts/components/ita/ita_comp_tboot.c89
-rw-r--r--src/libpts/pts/components/ita/ita_comp_tboot.h6
-rw-r--r--src/libpts/pts/components/ita/ita_comp_tgrub.c20
-rw-r--r--src/libpts/pts/components/ita/ita_comp_tgrub.h6
-rw-r--r--src/libpts/pts/components/pts_component.h10
-rw-r--r--src/libpts/pts/components/pts_component_manager.c5
-rw-r--r--src/libpts/pts/components/pts_component_manager.h8
-rw-r--r--src/libpts/pts/pts.h4
-rw-r--r--src/libpts/pts/pts_database.c56
-rw-r--r--src/libpts/pts/pts_database.h32
18 files changed, 304 insertions, 850 deletions
diff --git a/src/libpts/plugins/imc_attestation/imc_attestation_process.c b/src/libpts/plugins/imc_attestation/imc_attestation_process.c
index a93a9509a..1f81c2068 100644
--- a/src/libpts/plugins/imc_attestation/imc_attestation_process.c
+++ b/src/libpts/plugins/imc_attestation/imc_attestation_process.c
@@ -377,7 +377,7 @@ bool imc_attestation_process(pa_tnc_attr_t *attr, linked_list_t *attr_list,
"support sub component measurements");
return FALSE;
}
- comp = pts_components->create(pts_components, name, depth);
+ comp = pts_components->create(pts_components, name, depth, NULL);
if (!comp)
{
DBG2(DBG_IMC, " not registered: no evidence provided");
diff --git a/src/libpts/plugins/imv_attestation/data.sql b/src/libpts/plugins/imv_attestation/data.sql
index 20a8e40f5..e6e03627a 100644
--- a/src/libpts/plugins/imv_attestation/data.sql
+++ b/src/libpts/plugins/imv_attestation/data.sql
@@ -1303,789 +1303,3 @@ INSERT INTO key_component (
1, 2, 0, 2
);
-/* Component Hashes */
-
-/* ITA TBOOT Functional Component */
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 2, 2, 1, 17, 32768, X'9704353630674bfe21b86b64a7b0f99c297cf902'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 2, 2, 2, 18, 32768, X'8397d8048ee36d7955e38da16fc33e86ef61d6b0'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 2, 1, 1, 17, 32768, X'd537d437f058136eb3d7be517dbe7647b623c619'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 2, 1, 2, 18, 32768, X'160d2b04d11eb225fb148615b699081869e15b6c'
-);
-
-/* ITA IMA Functional Component */
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 1, 0, 32768, X'4d894eef0ae7cb124740df4f6c5c35aa0fe7dae8'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 2, 0, 32768, X'f2c846e7f335f7b9e9dd0a44f48c48e1986750c7'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 3, 0, 32768, X'db0b68f3ad06b5c0c35deb56af22b8f0bc23ea50'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 4, 0, 32768, X'a662680c8564f92cf20c5857d781ed3f0806da5d'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 5, 0, 32768, X'10bfa817da3a9e5760fbe78f216502e8ca4f94ef'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 6, 0, 32768, X'd0e1af1be845f570e44612613c4ddf3f08996151'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 7, 0, 32768, X'f05553c39e8130c7bb5db6cd6a6bf627311a9b01'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 8, 0, 32768, X'96ef1ad4efc5be2b894a12e5bffddcd496044a08'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 9, 0, 32768, X'e9055f2050b99b9127b6feef3164cb8ead8eb2eb'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 10, 0, 32768, X'6f8150aa3423544ea59ea10025993e660568cc08'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 11, 0, 32768, X'f843e55c9061fec89f2aeb369a74b73fe8eb09e4'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 12, 0, 32768, X'1d1efd1cb89be96f8fdf20ee0b67a89670659208'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 13, 0, 32768, X'f907598ec6fcc5779ff9091ba0925c1d58500352'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 14, 0, 32768, X'42f32d6fba099b0eea2e9a480dc8d4482e20412e'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 15, 0, 32768, X'e8a7cd52522ebacf4637a2b875494cda1c26bd8c'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 16, 0, 32768, X'd62d2c550fd06cae76f3e9c4d63f5fc22e34d4fe'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 17, 0, 32768, X'dc1293a87cab43024a4eaeb684a0186e33dacfe3'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 18, 0, 32768, X'03df488f642a9614ed718bf149fb7289d124189a'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 19, 0, 32768, X'46f1426433c57ee44b5593584308f8b7ac414e17'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 20, 0, 32768, X'1a837850cff01cd311948abd611174fa5699804b'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 21, 0, 32768, X'1c15052b28ac97e6e1cd0b4671fe75607c07de02'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 22, 0, 32768, X'1839bc8b6cd9351565a6bacb57f0e35562962cba'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 23, 0, 32768, X'f428189580a77b142b3de6cd3c183cb0a24dba6f'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 24, 0, 32768, X'f9b7302c9212a5398057ddea9c7506b265c3276f'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 25, 0, 32768, X'3af5d2929b9606b94b404a45deed9a9d673f49b7'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 26, 0, 32768, X'51a7df78bd7a23399b2824ec053f2abe5e4ee049'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 27, 0, 32768, X'2a3675f5efce9151670e9d4ec41e2edf4708d336'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 28, 0, 32768, X'a0cc14b4fde29d7251673af434b2ab246e5acf5a'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 29, 0, 32768, X'5932b35ba45894e65d6aa1afbe2101f677e17000'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 30, 0, 32768, X'ee12ad673d19d8f436ea7832e64935a0ddf9930e'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 31, 0, 32768, X'7bd9b4947ae9b600e6a2d61ead80104d878bb9d2'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 32, 0, 32768, X'849c60fc7b366717aea2295a37b341e40626dd28'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 33, 0, 32768, X'cdd448834760041cc30edd09f41ae36cbf9459ef'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 34, 0, 32768, X'9471225809633ae61f2693711cd878ba2ac59ef9'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 35, 0, 32768, X'4aaa26a4d1389b2400138269d3415bb492cc4312'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 36, 0, 32768, X'a08b0c957c8f741e273e8aa9a88d87b32b860228'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 37, 0, 32768, X'7ecbc26a2272256969e4c626998570c7e013be9c'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 38, 0, 32768, X'12dcf52c5a92b64dd5113031379f27b9f42d5c49'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 39, 0, 32768, X'ca1b8cc8e8ee8b209fc7b55656c3f6ac0b8f86fd'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 40, 0, 32768, X'8566865ae43d19574e85f9f3b6376715ffb3c707'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 41, 0, 32768, X'39c9fda07d57fc185b37bac70ba1068d6e7c41d3'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 42, 0, 32768, X'96a2c8b6caf11da5a37b41706217d4e94bb627c0'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 43, 0, 32768, X'6ee8c5a500af82a1fdf42e5122196fad4f2bbc06'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 44, 0, 32768, X'd2f71dff59d0ab86d0ada6ea288227602d6cf371'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 45, 0, 32768, X'095c8df0b106947e2c62a4458b13f38c6fc4f982'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 46, 0, 32768, X'706071d37157e1030900df60e6efaf897fbab1ec'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 47, 0, 32768, X'97f093c5ab5e2baf9b6f1473b631d3db2595fe99'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 48, 0, 32768, X'c12dd08ffbb4c09e3c282dd7f94cdcc9148ab866'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 49, 0, 32768, X'fb3df3be6d847db26e07eb61312bdc533bda53d2'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 50, 0, 32768, X'88195da5656b80c68bd3e131fb673b197281c2b0'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 51, 0, 32768, X'28353744f0fab757b1a870de007b6c8821d4723e'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 52, 0, 32768, X'9338b619160d4fb1a844acc95b0556b3d6109a77'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 53, 0, 32768, X'cd7f42895c6e4f9752f8b34184059d7ad4e5e6ce'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 54, 0, 32768, X'da5611278bf6855a44e5b1b5d62c76822a81674d'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 55, 0, 32768, X'eb4148c57806114b755416ba96b282fcc99ac2d1'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 56, 0, 32768, X'5e05f61508a391480dc83f741920a5de059546bc'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 57, 0, 32768, X'a23b279883915b0dc3313081924366ea5e75bdc1'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 58, 2, 32768, X'ef7511b5248557ae637f46b552f8af59020f2b00'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 59, 2, 32768, X'6240c588a2d7740f5c2c9523bff7d98334998d77'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 60, 2, 32768, X'808ce28868d844d547e0c2cc4271c14be2a568b6'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 61, 2, 32768, X'd736a206033ecbefc09e909f0d2d72c38d49d50b'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 62, 2, 32768, X'387a7087c3159f7d0a6388d722c200a599b4703b'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 63, 2, 32768, X'b6a679dda488042eee3cf9a525a9ae88b9514229'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 64, 2, 32768, X'693b89dc96682f85b389208ec052f4853fd971eb'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 65, 2, 32768, X'e4b83a6888c69eeb1c65c7ff50ee39897ca51008'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 66, 2, 32768, X'9e0735ad94f4d10faa43f75d02c4edb9b7eb91d4'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 67, 2, 32768, X'881dd3cb2f1f0e3323bf8c5586dfaba2ffcb1a55'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 68, 2, 32768, X'6461d3771999c3a4b3c15bf4e38da30b91bc1b17'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 69, 6, 32768, X'fcad787f7771637d659638d92b5eee9385b3d7b9'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 70, 0, 32768, X'4b90d9178efc5cf9a9ddf4f8bcc49008785d76ec'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 71, 2, 32768, X'e79e468b1921b2293a80c5917efa6a45c379e810'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 72, 2, 32768, X'be1bdec0aa74b4dcb079943e70528096cca985f8'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 73, 2, 32768, X'bc3a1d50aaffa207d2e6645228bb4f1cd40c88e0'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 74, 2, 32768, X'96ea8b0ccfb43fa6da4e98d8f51609cf8eabd91e'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 75, 2, 32768, X'd05ef7250cc103540601fb8956c89c3ba1f47a4e'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 76, 2, 32768, X'd5c28da6b58a66fba125e99c6b6d0e36a1b18315'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 77, 2, 32768, X'0ba611dd45de9acbe3d0da0d2e478e4aa77ff515'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 78, 4, 32768, X'9b4d80cfefc7d5576c4d9f224872505896ef2798'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 79, 2, 32768, X'e79e468b1921b2293a80c5917efa6a45c379e810'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 80, 2, 32768, X'be1bdec0aa74b4dcb079943e70528096cca985f8'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 81, 2, 32768, X'e79e468b1921b2293a80c5917efa6a45c379e810'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 82, 2, 32768, X'be1bdec0aa74b4dcb079943e70528096cca985f8'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 83, 1, 32768, X'230b3bf13c752834decf47f5a86a75582abee51c'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 84, 1, 32768, X'61f59f7782bb39610dbb6b1f57033c161810a267'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 85, 1, 32768, X'c744cac6af7621524fc3a2b0a9a135a32b33c81b'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 86, 1, 32768, X'8a7532af1862f9f61ed08d2b92b82a2ecc99c54f'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 87, 1, 32768, X'ba8fa710d303b3b2a594cba1cb73797c970ffa0b'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 88, 1, 32768, X'a46c5c8b58e67fbe9d3203bae335c0e39f68eff9'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 89, 1, 32768, X'67476198f63603b84afa235970611cd614560cf2'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 90, 2, 32768, X'cdf4d79ac0a10d46a1d9d7ec9642883c71f77fc7'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 91, 2, 32768, X'436067385bf6cd43e2f65f8d70d264af8fca876d'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 92, 2, 32768, X'4916c4e9f1e91b34bd8acef1f827f0b444bdb858'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 93, 2, 32768, X'c66007c47ea62816006d220bbb8fc9d5681c4cc6'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 94, 2, 32768, X'85782c59534d3915298da3da35101891a84be99e'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 95, 2, 32768, X'335f1897c44fef511bed7eb4394375bc2a36dbc3'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 96, 2, 32768, X'82ca255a4c2655eca1516b4249dcdd1edb892eef'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 97, 2, 32768, X'1086445009abbad955b9e915be04ac9afc74567d'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 98, 2, 32768, X'18fe7ae42869e2b3b11bf67215ef4f1c2e260251'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 99, 2, 32768, X'061efe921cad309990e63ed35a7b833e2eabfd2f'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 100, 2, 32768, X'aab5803005883807e91538fdc71968edf81f367c'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 101, 2, 32768, X'aab5803005883807e91538fdc71968edf81f367c'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 102, 2, 32768, X'0ba199b3cd6991a884fe30f40e89d3d603aa5cbd'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 103, 2, 32768, X'0ba199b3cd6991a884fe30f40e89d3d603aa5cbd'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 104, 2, 32768, X'2a5aa44e77a223d701a53b0f9af6d13cf8443b2a'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 105, 2, 32768, X'2a5aa44e77a223d701a53b0f9af6d13cf8443b2a'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 106, 2, 32768, X'c32ab71e81421207255b2665316a9049ddff3653'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 107, 2, 32768, X'c32ab71e81421207255b2665316a9049ddff3653'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 108, 2, 32768, X'cafaeff88886bf0d07b0a6527341da22c08b609d'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 109, 2, 32768, X'cafaeff88886bf0d07b0a6527341da22c08b609d'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 110, 2, 32768, X'68d74b6eacdc3360615744c6aaddb357df9bdbec'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 111, 2, 32768, X'68d74b6eacdc3360615744c6aaddb357df9bdbec'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 112, 2, 32768, X'ac254b04f277ca7e887a4141bf5ed0cf62600d10'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 113, 2, 32768, X'ac254b04f277ca7e887a4141bf5ed0cf62600d10'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 114, 1, 32768, X'4f135c9ee49ca7fbfea079e5d6714802f0405407'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 115, 0, 32768, X'9069ca78e7450a285173431b3e52c5c25299e473'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 116, 1, 32768, X'9069ca78e7450a285173431b3e52c5c25299e473'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 117, 2, 32768, X'9069ca78e7450a285173431b3e52c5c25299e473'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 118, 3, 32768, X'9069ca78e7450a285173431b3e52c5c25299e473'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 119, 4, 32768, X'9069ca78e7450a285173431b3e52c5c25299e473'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 120, 5, 32768, X'9069ca78e7450a285173431b3e52c5c25299e473'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 121, 6, 32768, X'9069ca78e7450a285173431b3e52c5c25299e473'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 122, 7, 32768, X'9069ca78e7450a285173431b3e52c5c25299e473'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 123, 4, 32768, X'c1e25c3f6b0dc78d57296aa2870ca6f782ccf80f'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 124, 4, 32768, X'67a0a98bc4d6321142895a4d938b342f6959c1a9'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 125, 4, 32768, X'06d60b3a0dee9bb9beb2f0b04aff2e75bd1d2860'
-);
-
-INSERT INTO component_hashes (
- component, key, seq_no, pcr, algo, hash
-) VALUES (
- 3, 1, 126, 5, 32768, X'1b87003b6c7d90483713c90100cca3e62392b9bc'
-);
-
diff --git a/src/libpts/plugins/imv_attestation/imv_attestation_build.c b/src/libpts/plugins/imv_attestation/imv_attestation_build.c
index c2447cd9f..2477924b2 100644
--- a/src/libpts/plugins/imv_attestation/imv_attestation_build.c
+++ b/src/libpts/plugins/imv_attestation/imv_attestation_build.c
@@ -243,7 +243,8 @@ bool imv_attestation_build(pa_tnc_msg_t *msg,
comp_name = pts_comp_func_name_create(vid, name, qualifier);
comp_name->log(comp_name, " ");
- comp = pts_components->create(pts_components, comp_name, depth);
+ comp = pts_components->create(pts_components, comp_name,
+ depth, pts_db);
if (!comp)
{
DBG2(DBG_IMV, " not registered: removed from request");
diff --git a/src/libpts/plugins/imv_attestation/imv_attestation_process.c b/src/libpts/plugins/imv_attestation/imv_attestation_process.c
index a50810b67..805a08c25 100644
--- a/src/libpts/plugins/imv_attestation/imv_attestation_process.c
+++ b/src/libpts/plugins/imv_attestation/imv_attestation_process.c
@@ -284,7 +284,7 @@ bool imv_attestation_process(pa_tnc_attr_t *attr, linked_list_t *attr_list,
DBG1(DBG_IMV, " no entry found for component evidence request");
break;
}
- status = comp->verify(comp, pts, pts_db, evidence);
+ status = comp->verify(comp, pts, evidence);
switch (status)
{
@@ -348,6 +348,9 @@ bool imv_attestation_process(pa_tnc_attr_t *attr, linked_list_t *attr_list,
}
DBG2(DBG_IMV, "TPM Quote Info signature verification successful");
free(quote_info.ptr);
+
+ /* Finalize any pending measurement registrations */
+ attestation_state->check_off_registrations(attestation_state);
}
if (attr_cast->get_evid_sig(attr_cast, &evid_sig))
diff --git a/src/libpts/plugins/imv_attestation/imv_attestation_state.c b/src/libpts/plugins/imv_attestation/imv_attestation_state.c
index 207347980..d2e5211ff 100644
--- a/src/libpts/plugins/imv_attestation/imv_attestation_state.c
+++ b/src/libpts/plugins/imv_attestation/imv_attestation_state.c
@@ -287,6 +287,24 @@ METHOD(imv_attestation_state_t, check_off_component, pts_component_t*,
return found;
}
+METHOD(imv_attestation_state_t, check_off_registrations, void,
+ private_imv_attestation_state_t *this)
+{
+ enumerator_t *enumerator;
+ pts_component_t *entry;
+
+ enumerator = this->components->create_enumerator(this->components);
+ while (enumerator->enumerate(enumerator, &entry))
+ {
+ if (entry->check_off_registrations(entry))
+ {
+ this->components->remove_at(this->components, enumerator);
+ entry->destroy(entry);
+ }
+ }
+ enumerator->destroy(enumerator);
+}
+
METHOD(imv_attestation_state_t, get_component_count, int,
private_imv_attestation_state_t *this)
{
@@ -331,6 +349,7 @@ imv_state_t *imv_attestation_state_create(TNC_ConnectionID connection_id)
.get_file_meas_request_count = _get_file_meas_request_count,
.add_component = _add_component,
.check_off_component = _check_off_component,
+ .check_off_registrations = _check_off_registrations,
.get_component_count = _get_component_count,
.get_measurement_error = _get_measurement_error,
.set_measurement_error = _set_measurement_error,
diff --git a/src/libpts/plugins/imv_attestation/imv_attestation_state.h b/src/libpts/plugins/imv_attestation/imv_attestation_state.h
index eec388f31..7125438a2 100644
--- a/src/libpts/plugins/imv_attestation/imv_attestation_state.h
+++ b/src/libpts/plugins/imv_attestation/imv_attestation_state.h
@@ -24,6 +24,7 @@
#include <imv/imv_state.h>
#include <pts/pts.h>
+#include <pts/components/pts_component.h>
#include <library.h>
typedef struct imv_attestation_state_t imv_attestation_state_t;
@@ -126,6 +127,11 @@ struct imv_attestation_state_t {
pts_comp_func_name_t *name);
/**
+ * Tell the Functional Components to finalize any measurement registrations
+ */
+ void (*check_off_registrations)(imv_attestation_state_t *this);
+
+ /**
* Indicates if a file measurement error occurred
*
* @return TRUE in case of measurement error
diff --git a/src/libpts/pts/components/ita/ita_comp_ima.c b/src/libpts/pts/components/ita/ita_comp_ima.c
index 808a59580..2c9b66a30 100644
--- a/src/libpts/pts/components/ita/ita_comp_ima.c
+++ b/src/libpts/pts/components/ita/ita_comp_ima.c
@@ -57,11 +57,21 @@ struct pts_ita_comp_ima_t {
u_int32_t depth;
/**
+ * PTS measurement database
+ */
+ pts_database_t *pts_db;
+
+ /**
* AIK keyid
*/
chunk_t keyid;
/**
+ * Component is registering measurements
+ */
+ bool is_registering;
+
+ /**
* IMA BIOS measurement time
*/
time_t bios_measurement_time;
@@ -253,8 +263,7 @@ METHOD(pts_component_t, measure, status_t,
}
METHOD(pts_component_t, verify, status_t,
- pts_ita_comp_ima_t *this, pts_t *pts, pts_database_t *pts_db,
- pts_comp_evidence_t *evidence)
+ pts_ita_comp_ima_t *this, pts_t *pts, pts_comp_evidence_t *evidence)
{
bool has_pcr_info;
u_int32_t extended_pcr, vid, name;
@@ -265,7 +274,7 @@ METHOD(pts_component_t, verify, status_t,
chunk_t measurement, pcr_before, pcr_after;
measurement = evidence->get_measurement(evidence, &extended_pcr,
- &algo, &transform, &measurement_time);
+ &algo, &transform, &measurement_time);
if (!this->keyid.ptr)
{
@@ -275,13 +284,13 @@ METHOD(pts_component_t, verify, status_t,
}
this->keyid = chunk_clone(this->keyid);
- if (!pts_db)
+ if (!this->pts_db)
{
DBG1(DBG_PTS, "pts database not available");
return FAILED;
}
- if (!pts_db->get_comp_measurement_count(pts_db, this->name, this->keyid,
- algo, &this->count))
+ if (this->pts_db->get_comp_measurement_count(this->pts_db, this->name,
+ this->keyid, algo, &this->count) != SUCCESS)
{
return FAILED;
}
@@ -289,20 +298,37 @@ METHOD(pts_component_t, verify, status_t,
name = this->name->get_name(this->name);
names = pts_components->get_comp_func_names(pts_components, vid);
- if (this->count == 0)
+ if (this->count)
{
- DBG1(DBG_PTS, "no %N '%N' functional component evidence measurements "
- "available", pen_names, vid, names, name);
- return FAILED;
+ DBG1(DBG_PTS, "checking %d %N '%N' functional component evidence "
+ "measurements", this->count, pen_names, vid, names, name);
}
- DBG1(DBG_PTS, "checking %d %N '%N' functional component evidence measurements",
- this->count, pen_names, vid, names, name);
+ else
+ {
+ DBG1(DBG_PTS, "registering %N '%N' functional component evidence "
+ "measurements", pen_names, vid, names, name);
+ this->is_registering = TRUE;
}
+ }
- if (pts_db->check_comp_measurement(pts_db, measurement, this->name,
- this->keyid, ++this->seq_no, extended_pcr, algo) != SUCCESS)
+ if (this->is_registering)
{
- return FAILED;
+ if (this->pts_db->insert_comp_measurement(this->pts_db, measurement,
+ this->name, this->keyid, ++this->seq_no,
+ extended_pcr, algo) != SUCCESS)
+ {
+ return FAILED;
+ }
+ this->count = this->seq_no + 1;
+ }
+ else
+ {
+ if (this->pts_db->check_comp_measurement(this->pts_db, measurement,
+ this->name, this->keyid, ++this->seq_no,
+ extended_pcr, algo) != SUCCESS)
+ {
+ return FAILED;
+ }
}
has_pcr_info = evidence->get_pcr_info(evidence, &pcr_before, &pcr_after);
@@ -317,15 +343,43 @@ METHOD(pts_component_t, verify, status_t,
return (this->seq_no < this->count) ? NEED_MORE : SUCCESS;
}
+METHOD(pts_component_t, check_off_registrations, bool,
+ pts_ita_comp_ima_t *this)
+{
+ u_int32_t vid, name;
+ enum_name_t *names;
+
+ if (!this->is_registering)
+ {
+ return FALSE;
+ }
+
+ /* Finalize registration */
+ this->is_registering = FALSE;
+
+ vid = this->name->get_vendor_id(this->name);
+ name = this->name->get_name(this->name);
+ names = pts_components->get_comp_func_names(pts_components, vid);
+ DBG1(DBG_PTS, "registered %d %N '%N' functional component evidence "
+ "measurements", this->seq_no, pen_names, vid, names, name);
+ return TRUE;
+}
+
METHOD(pts_component_t, destroy, void,
pts_ita_comp_ima_t *this)
{
- int i;
+ int i, count;
for (i = 0; i < IMA_PCR_MAX; i++)
{
free(this->pcrs[i].ptr);
}
+ if (this->is_registering)
+ {
+ count = this->pts_db->delete_comp_measurements(this->pts_db, this->name,
+ this->keyid);
+ DBG1(DBG_PTS, " deleted %d measurements", count);
+ }
this->list->destroy_function(this->list, (void *)free_entry);
this->name->destroy(this->name);
free(this->keyid.ptr);
@@ -335,7 +389,8 @@ METHOD(pts_component_t, destroy, void,
/**
* See header
*/
-pts_component_t *pts_ita_comp_ima_create(u_int8_t qualifier, u_int32_t depth)
+pts_component_t *pts_ita_comp_ima_create(u_int8_t qualifier, u_int32_t depth,
+ pts_database_t *pts_db)
{
pts_ita_comp_ima_t *this;
int i;
@@ -347,11 +402,13 @@ pts_component_t *pts_ita_comp_ima_create(u_int8_t qualifier, u_int32_t depth)
.get_depth = _get_depth,
.measure = _measure,
.verify = _verify,
+ .check_off_registrations = _check_off_registrations,
.destroy = _destroy,
},
.name = pts_comp_func_name_create(PEN_ITA, PTS_ITA_COMP_FUNC_NAME_IMA,
qualifier),
.depth = depth,
+ .pts_db = pts_db,
.list = linked_list_create(),
);
diff --git a/src/libpts/pts/components/ita/ita_comp_ima.h b/src/libpts/pts/components/ita/ita_comp_ima.h
index 429351827..1ca27e6f0 100644
--- a/src/libpts/pts/components/ita/ita_comp_ima.h
+++ b/src/libpts/pts/components/ita/ita_comp_ima.h
@@ -27,8 +27,10 @@
* Create a PTS ITS Functional Component object
*
* @param qualifier PTS Component Functional Name Qualifier
- *
+ * @param depth Sub-component depth
+ * @param pts_db PTS measurement database
*/
-pts_component_t* pts_ita_comp_ima_create(u_int8_t qualifier, u_int32_t depth);
+pts_component_t* pts_ita_comp_ima_create(u_int8_t qualifier, u_int32_t depth,
+ pts_database_t *pts_db);
#endif /** PTS_ITA_COMP_IMA_H_ @}*/
diff --git a/src/libpts/pts/components/ita/ita_comp_tboot.c b/src/libpts/pts/components/ita/ita_comp_tboot.c
index 67ad2d432..c61132562 100644
--- a/src/libpts/pts/components/ita/ita_comp_tboot.c
+++ b/src/libpts/pts/components/ita/ita_comp_tboot.c
@@ -47,11 +47,21 @@ struct pts_ita_comp_tboot_t {
u_int32_t depth;
/**
+ * PTS measurement database
+ */
+ pts_database_t *pts_db;
+
+ /**
* AIK keyid
*/
chunk_t keyid;
/**
+ * Component is registering measurements
+ */
+ bool is_registering;
+
+ /**
* Time of TBOOT measurement
*/
time_t measurement_time;
@@ -156,8 +166,7 @@ METHOD(pts_component_t, measure, status_t,
}
METHOD(pts_component_t, verify, status_t,
- pts_ita_comp_tboot_t *this, pts_t *pts, pts_database_t *pts_db,
- pts_comp_evidence_t *evidence)
+ pts_ita_comp_tboot_t *this, pts_t *pts, pts_comp_evidence_t *evidence)
{
bool has_pcr_info;
u_int32_t extended_pcr, vid, name;
@@ -178,13 +187,13 @@ METHOD(pts_component_t, verify, status_t,
}
this->keyid = chunk_clone(this->keyid);
- if (!pts_db)
+ if (!this->pts_db)
{
DBG1(DBG_PTS, "pts database not available");
return FAILED;
}
- if (!pts_db->get_comp_measurement_count(pts_db, this->name, this->keyid,
- algo, &this->count))
+ if (this->pts_db->get_comp_measurement_count(this->pts_db, this->name,
+ this->keyid, algo, &this->count) != SUCCESS)
{
return FAILED;
}
@@ -192,20 +201,37 @@ METHOD(pts_component_t, verify, status_t,
name = this->name->get_name(this->name);
names = pts_components->get_comp_func_names(pts_components, vid);
- if (this->count == 0)
+ if (this->count)
{
- DBG1(DBG_PTS, "no %N '%N' functional component evidence measurements "
- "available", pen_names, vid, names, name);
- return FAILED;
+ DBG1(DBG_PTS, "checking %d %N '%N' functional component evidence "
+ "measurements", this->count, pen_names, vid, names, name);
}
- DBG1(DBG_PTS, "checking %d %N '%N' functional component evidence measurements",
- this->count, pen_names, vid, names, name);
+ else
+ {
+ DBG1(DBG_PTS, "registering %N '%N' functional component evidence "
+ "measurements", pen_names, vid, names, name);
+ this->is_registering = TRUE;
}
+ }
- if (pts_db->check_comp_measurement(pts_db, measurement, this->name,
- this->keyid, ++this->seq_no, extended_pcr, algo) != SUCCESS)
+ if (this->is_registering)
{
- return FAILED;
+ if (this->pts_db->insert_comp_measurement(this->pts_db, measurement,
+ this->name, this->keyid, ++this->seq_no,
+ extended_pcr, algo) != SUCCESS)
+ {
+ return FAILED;
+ }
+ this->count = this->seq_no + 1;
+ }
+ else
+ {
+ if (this->pts_db->check_comp_measurement(this->pts_db, measurement,
+ this->name, this->keyid, ++this->seq_no,
+ extended_pcr, algo) != SUCCESS)
+ {
+ return FAILED;
+ }
}
has_pcr_info = evidence->get_pcr_info(evidence, &pcr_before, &pcr_after);
@@ -220,9 +246,39 @@ METHOD(pts_component_t, verify, status_t,
return (this->seq_no < this->count) ? NEED_MORE : SUCCESS;
}
+METHOD(pts_component_t, check_off_registrations, bool,
+ pts_ita_comp_tboot_t *this)
+{
+ u_int32_t vid, name;
+ enum_name_t *names;
+
+ if (!this->is_registering)
+ {
+ return FALSE;
+ }
+
+ /* Finalize registration */
+ this->is_registering = FALSE;
+
+ vid = this->name->get_vendor_id(this->name);
+ name = this->name->get_name(this->name);
+ names = pts_components->get_comp_func_names(pts_components, vid);
+ DBG1(DBG_PTS, "registered %d %N '%N' functional component evidence "
+ "measurements", this->seq_no, pen_names, vid, names, name);
+ return TRUE;
+}
+
METHOD(pts_component_t, destroy, void,
pts_ita_comp_tboot_t *this)
{
+ int count;
+
+ if (this->is_registering)
+ {
+ count = this->pts_db->delete_comp_measurements(this->pts_db, this->name,
+ this->keyid);
+ DBG1(DBG_PTS, " deleted %d measurements", count);
+ }
this->name->destroy(this->name);
free(this->keyid.ptr);
free(this);
@@ -231,7 +287,8 @@ METHOD(pts_component_t, destroy, void,
/**
* See header
*/
-pts_component_t *pts_ita_comp_tboot_create(u_int8_t qualifier, u_int32_t depth)
+pts_component_t *pts_ita_comp_tboot_create(u_int8_t qualifier, u_int32_t depth,
+ pts_database_t *pts_db)
{
pts_ita_comp_tboot_t *this;
@@ -242,11 +299,13 @@ pts_component_t *pts_ita_comp_tboot_create(u_int8_t qualifier, u_int32_t depth)
.get_depth = _get_depth,
.measure = _measure,
.verify = _verify,
+ .check_off_registrations = _check_off_registrations,
.destroy = _destroy,
},
.name = pts_comp_func_name_create(PEN_ITA, PTS_ITA_COMP_FUNC_NAME_TBOOT,
qualifier),
.depth = depth,
+ .pts_db = pts_db,
);
return &this->public;
diff --git a/src/libpts/pts/components/ita/ita_comp_tboot.h b/src/libpts/pts/components/ita/ita_comp_tboot.h
index 8fba1125a..39554fbc7 100644
--- a/src/libpts/pts/components/ita/ita_comp_tboot.h
+++ b/src/libpts/pts/components/ita/ita_comp_tboot.h
@@ -27,8 +27,10 @@
* Create a PTS ITS Functional Component object
*
* @param qualifier PTS Component Functional Name Qualifier
- *
+ * @param depth Sub-component depth
+ * @param pts_db PTS measurement database
*/
-pts_component_t* pts_ita_comp_tboot_create(u_int8_t qualifier, u_int32_t depth);
+pts_component_t* pts_ita_comp_tboot_create(u_int8_t qualifier, u_int32_t depth,
+ pts_database_t *pts_db);
#endif /** PTS_ITA_COMP_TBOOT_H_ @}*/
diff --git a/src/libpts/pts/components/ita/ita_comp_tgrub.c b/src/libpts/pts/components/ita/ita_comp_tgrub.c
index 168f116dc..a1b2cd066 100644
--- a/src/libpts/pts/components/ita/ita_comp_tgrub.c
+++ b/src/libpts/pts/components/ita/ita_comp_tgrub.c
@@ -44,6 +44,12 @@ struct pts_ita_comp_tgrub_t {
* Sub-component depth
*/
u_int32_t depth;
+
+ /**
+ * PTS measurement database
+ */
+ pts_database_t *pts_db;
+
};
METHOD(pts_component_t, get_comp_func_name, pts_comp_func_name_t*,
@@ -106,8 +112,7 @@ METHOD(pts_component_t, measure, status_t,
}
METHOD(pts_component_t, verify, status_t,
- pts_ita_comp_tgrub_t *this, pts_t *pts, pts_database_t *pts_db,
- pts_comp_evidence_t *evidence)
+ pts_ita_comp_tgrub_t *this, pts_t *pts, pts_comp_evidence_t *evidence)
{
bool has_pcr_info;
u_int32_t extended_pcr;
@@ -137,6 +142,12 @@ METHOD(pts_component_t, verify, status_t,
return SUCCESS;
}
+METHOD(pts_component_t, check_off_registrations, bool,
+ pts_ita_comp_tgrub_t *this)
+{
+ return FALSE;
+}
+
METHOD(pts_component_t, destroy, void,
pts_ita_comp_tgrub_t *this)
{
@@ -147,7 +158,8 @@ METHOD(pts_component_t, destroy, void,
/**
* See header
*/
-pts_component_t *pts_ita_comp_tgrub_create(u_int8_t qualifier, u_int32_t depth)
+pts_component_t *pts_ita_comp_tgrub_create(u_int8_t qualifier, u_int32_t depth,
+ pts_database_t *pts_db)
{
pts_ita_comp_tgrub_t *this;
@@ -158,11 +170,13 @@ pts_component_t *pts_ita_comp_tgrub_create(u_int8_t qualifier, u_int32_t depth)
.get_depth = _get_depth,
.measure = _measure,
.verify = _verify,
+ .check_off_registrations = _check_off_registrations,
.destroy = _destroy,
},
.name = pts_comp_func_name_create(PEN_ITA, PTS_ITA_COMP_FUNC_NAME_TGRUB,
qualifier),
.depth = depth,
+ .pts_db = pts_db,
);
return &this->public;
diff --git a/src/libpts/pts/components/ita/ita_comp_tgrub.h b/src/libpts/pts/components/ita/ita_comp_tgrub.h
index 3c0ba0203..52ecc325c 100644
--- a/src/libpts/pts/components/ita/ita_comp_tgrub.h
+++ b/src/libpts/pts/components/ita/ita_comp_tgrub.h
@@ -27,8 +27,10 @@
* Create a PTS ITS Functional Component object
*
* @param qualifier PTS Component Functional Name Qualifier
- *
+ * @param depth Sub-component depth
+ * @param pts_db PTS measurement database
*/
-pts_component_t* pts_ita_comp_tgrub_create(u_int8_t qualifier, u_int32_t depth);
+pts_component_t* pts_ita_comp_tgrub_create(u_int8_t qualifier, u_int32_t depth,
+ pts_database_t *pts_db);
#endif /** PTS_ITA_COMP_TGRUB_H_ @}*/
diff --git a/src/libpts/pts/components/pts_component.h b/src/libpts/pts/components/pts_component.h
index 42e592f3f..524ff332d 100644
--- a/src/libpts/pts/components/pts_component.h
+++ b/src/libpts/pts/components/pts_component.h
@@ -70,14 +70,20 @@ struct pts_component_t {
* Verify the evidence measurements of the PTS Functional Component
*
* @param pts PTS interface
- * @param pts_db PTS measurement database
* @param evidence component evidence measurement to be verified
* @return status return code
*/
status_t (*verify)(pts_component_t *this, pts_t *pts,
- pts_database_t *pts_db,
pts_comp_evidence_t *evidence);
+
+ /**
+ * Tell the PTS Functional Component to finalize pending registrations
+ *
+ * @return TRUE if there are pending registrations
+ */
+ bool (*check_off_registrations)(pts_component_t *this);
+
/**
* Destroys a pts_component_t object.
*/
diff --git a/src/libpts/pts/components/pts_component_manager.c b/src/libpts/pts/components/pts_component_manager.c
index 5f11e41a7..8ac4767bf 100644
--- a/src/libpts/pts/components/pts_component_manager.c
+++ b/src/libpts/pts/components/pts_component_manager.c
@@ -253,7 +253,7 @@ METHOD(pts_component_manager_t, get_qualifier, u_int8_t,
METHOD(pts_component_manager_t, create, pts_component_t*,
private_pts_component_manager_t *this,
- pts_comp_func_name_t *name, u_int32_t depth)
+ pts_comp_func_name_t *name, u_int32_t depth, pts_database_t *pts_db)
{
enumerator_t *enumerator, *e2;
vendor_entry_t *entry;
@@ -270,7 +270,8 @@ METHOD(pts_component_manager_t, create, pts_component_t*,
{
if (entry2->name == name->get_name(name) && entry2->create)
{
- component = entry2->create(name->get_qualifier(name), depth);
+ component = entry2->create(name->get_qualifier(name),
+ depth, pts_db);
break;
}
}
diff --git a/src/libpts/pts/components/pts_component_manager.h b/src/libpts/pts/components/pts_component_manager.h
index c37794915..0079d0e26 100644
--- a/src/libpts/pts/components/pts_component_manager.h
+++ b/src/libpts/pts/components/pts_component_manager.h
@@ -23,6 +23,7 @@
typedef struct pts_component_manager_t pts_component_manager_t;
+#include "pts/pts_database.h"
#include "pts/components/pts_component.h"
#include "pts/components/pts_comp_func_name.h"
@@ -30,7 +31,8 @@ typedef struct pts_component_manager_t pts_component_manager_t;
#include <pen/pen.h>
typedef pts_component_t* (*pts_component_create_t)(u_int8_t qualifier,
- u_int32_t depth);
+ u_int32_t depth,
+ pts_database_t *pts_db);
/**
* Manages PTS Functional Components
@@ -102,10 +104,12 @@ struct pts_component_manager_t {
*
* @param name Component Functional Name
* @param depth Sub-component Depth
+ * @param pts_db PTS measurement database
* @return Component object if supported, NULL else
*/
pts_component_t* (*create)(pts_component_manager_t *this,
- pts_comp_func_name_t *name, u_int32_t depth);
+ pts_comp_func_name_t *name, u_int32_t depth,
+ pts_database_t *pts_db);
/**
* Destroys a pts_component_manager_t object.
diff --git a/src/libpts/pts/pts.h b/src/libpts/pts/pts.h
index 327b1a13d..e1cba9180 100644
--- a/src/libpts/pts/pts.h
+++ b/src/libpts/pts/pts.h
@@ -32,10 +32,6 @@ typedef struct pts_t pts_t;
#include "pts_req_func_comp_evid.h"
#include "pts_simple_evid_final.h"
#include "components/pts_comp_func_name.h"
-#include "components/tcg/tcg_comp_func_name.h"
-#include "components/ita/ita_comp_func_name.h"
-#include "components/ita/ita_comp_tboot.h"
-#include "components/ita/ita_comp_tgrub.h"
#include <library.h>
#include <utils/linked_list.h>
diff --git a/src/libpts/pts/pts_database.c b/src/libpts/pts/pts_database.c
index d91a408cf..c34b12cea 100644
--- a/src/libpts/pts/pts_database.c
+++ b/src/libpts/pts/pts_database.c
@@ -167,13 +167,53 @@ METHOD(pts_database_t, check_comp_measurement, status_t,
return status;
}
-METHOD(pts_database_t, get_comp_measurement_count, bool,
+METHOD(pts_database_t, insert_comp_measurement, status_t,
+ private_pts_database_t *this, chunk_t measurement,
+ pts_comp_func_name_t *comp_name, chunk_t keyid,
+ int seq_no, int pcr, pts_meas_algorithms_t algo)
+{
+ int id;
+
+ if (this->db->execute(this->db, &id,
+ "INSERT INTO component_hashes "
+ "(component, key, seq_no, pcr, algo, hash) VALUES ("
+ "(SELECT id FROM components"
+ " WHERE vendor_id = ? AND name = ? AND qualifier = ?), "
+ "(SELECT id FROM keys WHERE keyid = ?), ?, ?, ?, ?)",
+ DB_INT, comp_name->get_vendor_id(comp_name),
+ DB_INT, comp_name->get_name(comp_name),
+ DB_INT, comp_name->get_qualifier(comp_name),
+ DB_BLOB, keyid, DB_INT, seq_no, DB_INT, pcr,
+ DB_INT, algo, DB_BLOB, measurement) == 1)
+ {
+ return SUCCESS;
+ }
+
+ DBG1(DBG_PTS, "could not insert component measurement into database");
+ return FAILED;
+}
+
+METHOD(pts_database_t, delete_comp_measurements, int,
+ private_pts_database_t *this, pts_comp_func_name_t *comp_name, chunk_t keyid)
+{
+ return this->db->execute(this->db, NULL,
+ "DELETE FROM component_hashes WHERE "
+ "component = (SELECT id FROM components"
+ " WHERE vendor_id = ? AND name = ? AND qualifier = ?) AND "
+ "key = (SELECT id FROM keys WHERE keyid = ?))",
+ DB_INT, comp_name->get_vendor_id(comp_name),
+ DB_INT, comp_name->get_name(comp_name),
+ DB_INT, comp_name->get_qualifier(comp_name),
+ DB_BLOB, keyid);
+}
+
+METHOD(pts_database_t, get_comp_measurement_count, status_t,
private_pts_database_t *this, pts_comp_func_name_t *comp_name,
chunk_t keyid, pts_meas_algorithms_t algo, int *count)
{
enumerator_t *e;
int kid;
- bool success = TRUE;
+ status_t status = SUCCESS;
/* Initialize count */
*count = 0;
@@ -184,13 +224,13 @@ METHOD(pts_database_t, get_comp_measurement_count, bool,
if (!e)
{
DBG1(DBG_PTS, "no database query enumerator returned");
- return FALSE;
+ return FAILED;
}
if (!e->enumerate(e, &kid))
{
DBG1(DBG_PTS, "AIK %#B is not registered in database", &keyid);
e->destroy(e);
- return FALSE;
+ return FAILED;
}
e->destroy(e);
@@ -207,16 +247,16 @@ METHOD(pts_database_t, get_comp_measurement_count, bool,
if (!e)
{
DBG1(DBG_PTS, "no database query enumerator returned");
- return FALSE;
+ return FAILED;
}
if (!e->enumerate(e, count))
{
DBG1(DBG_PTS, "no component measurement count returned from database");
- success = FALSE;
+ status = FAILED;
}
e->destroy(e);
- return success;
+ return status;
}
METHOD(pts_database_t, destroy, void,
@@ -240,6 +280,8 @@ pts_database_t *pts_database_create(char *uri)
.create_comp_evid_enumerator = _create_comp_evid_enumerator,
.create_file_hash_enumerator = _create_file_hash_enumerator,
.check_comp_measurement = _check_comp_measurement,
+ .insert_comp_measurement = _insert_comp_measurement,
+ .delete_comp_measurements = _delete_comp_measurements,
.get_comp_measurement_count = _get_comp_measurement_count,
.destroy = _destroy,
},
diff --git a/src/libpts/pts/pts_database.h b/src/libpts/pts/pts_database.h
index 61c00a1e9..dd87a5be3 100644
--- a/src/libpts/pts/pts_database.h
+++ b/src/libpts/pts/pts_database.h
@@ -82,21 +82,47 @@ struct pts_database_t {
* @param seq_no Measurement sequence number
* @param prc Number of the PCR the measurement was extended into
* @param algo Hash algorithm used for measurement
- * @return return code
+ * @return SUCCESS if check was successful
*/
status_t (*check_comp_measurement)(pts_database_t *this, chunk_t measurement,
pts_comp_func_name_t *comp_name, chunk_t keyid,
int seq_no, int pcr, pts_meas_algorithms_t algo);
/**
+ * Insert a functional component measurement into the database
+ *
+ * @param measurement measurement hash
+ * @param comp_name Component Functional Name
+ * @param keyid SHA-1 hash of AIK public key info
+ * @param seq_no Measurement sequence number
+ * @param prc Number of the PCR the measurement was extended into
+ * @param algo Hash algorithm used for measurement
+ * @return SUCCESS if INSERT was successful
+ */
+ status_t (*insert_comp_measurement)(pts_database_t *this, chunk_t measurement,
+ pts_comp_func_name_t *comp_name, chunk_t keyid,
+ int seq_no, int pcr, pts_meas_algorithms_t algo);
+
+ /**
+ * Delete functional component measurements from the database
+ *
+ * @param comp_name Component Functional Name
+ * @param keyid SHA-1 hash of AIK public key info
+ * @return number of deleted measurement entries
+ */
+ int (*delete_comp_measurements)(pts_database_t *this,
+ pts_comp_func_name_t *comp_name, chunk_t keyid);
+
+ /**
* Get the number of measurements for a functional component and AIK
*
* @param comp_name Component Functional Name
* @param keyid SHA-1 hash of AIK public key info
* @param algo Hash algorithm used for measurement
- * @return measurement count
+ * @param count measurement count
+ * @return SUCCESS if COUNT was successful
*/
- bool (*get_comp_measurement_count)(pts_database_t *this,
+ status_t (*get_comp_measurement_count)(pts_database_t *this,
pts_comp_func_name_t *comp_name, chunk_t keyid,
pts_meas_algorithms_t algo, int *count);