Home | History | Annotate | Download | only in unittests

Lines Matching refs:tpm

16 /// TPM non volatile memory API unit tests.
42 Tpm2CtxObj tpm(&Prng::Generate, &my_prng, nullptr, epid2params);
61 if (kEpidNoErr != Tpm2NvRead(tpm, nv_index, sizeof(data), 0, &data)) {
63 Tpm2NvDefineSpace(tpm, nv_index, sizeof(MembershipCredential)));
67 Tpm2NvWrite(tpm, nv_index, sizeof(credential), 0, &credential));
70 EXPECT_EQ(kEpidNoErr, Tpm2NvRead(tpm, nv_index, sizeof(data), 0, &data));
72 THROW_ON_EPIDERR(Tpm2NvUndefineSpace(tpm, nv_index));
78 Tpm2CtxObj tpm(&Prng::Generate, &my_prng, nullptr, epid2params);
87 Tpm2NvDefineSpace(tpm, nv_index, data1_src.size() + data2_src.size()));
90 Tpm2NvWrite(tpm, nv_index, data1_src.size(), 0, data1_src.data()));
92 Tpm2NvWrite(tpm, nv_index, data2_src.size(),
96 Tpm2NvRead(tpm, nv_index, data1_dst.size(), 0, data1_dst.data()));
100 Tpm2NvRead(tpm, nv_index, data2_dst.size(),
103 THROW_ON_EPIDERR(Tpm2NvUndefineSpace(tpm, nv_index));
117 Tpm2CtxObj tpm(&Prng::Generate, &my_prng, nullptr, epid2params);
120 Tpm2NvDefineSpace(tpm, nv_index, sizeof(MembershipCredential)));
121 THROW_ON_EPIDERR(Tpm2NvUndefineSpace(tpm, nv_index));
127 Tpm2CtxObj tpm(&Prng::Generate, &my_prng, nullptr, epid2params);
130 Tpm2NvDefineSpace(tpm, nv_index, sizeof(MembershipCredential)));
132 Tpm2NvDefineSpace(tpm, nv_index, sizeof(MembershipCredential)));
133 THROW_ON_EPIDERR(Tpm2NvUndefineSpace(tpm, nv_index));
146 Tpm2CtxObj tpm(&Prng::Generate, &my_prng, nullptr, epid2params);
149 THROW_ON_EPIDERR(Tpm2NvDefineSpace(tpm, nv_index, sizeof(data)));
150 EXPECT_EQ(kEpidNoErr, Tpm2NvUndefineSpace(tpm, nv_index));
151 EXPECT_EQ(kEpidBadArgErr, Tpm2NvRead(tpm, nv_index, sizeof(data), 0, &data));
157 Tpm2CtxObj tpm(&Prng::Generate, &my_prng, nullptr, epid2params);
160 EXPECT_EQ(kEpidNoErr, Tpm2NvDefineSpace(tpm, nv_index, sizeof(data)));
161 EXPECT_EQ(kEpidNoErr, Tpm2NvUndefineSpace(tpm, nv_index));
162 EXPECT_EQ(kEpidBadArgErr, Tpm2NvUndefineSpace(tpm, nv_index));
170 Tpm2CtxObj tpm(&Prng::Generate, &my_prng, nullptr, epid2params);
173 Tpm2NvDefineSpace(tpm, nv_index, sizeof(MembershipCredential)));
179 Tpm2NvWrite(tpm, nv_index, sizeof(data), 0, nullptr));
180 THROW_ON_EPIDERR(Tpm2NvUndefineSpace(tpm, nv_index));
186 Tpm2CtxObj tpm(&Prng::Generate, &my_prng, nullptr, epid2params);
189 Tpm2NvDefineSpace(tpm, nv_index, sizeof(MembershipCredential)));
192 EXPECT_EQ(kEpidNoErr, Tpm2NvWrite(tpm, nv_index, sizeof(data), 0, &data));
193 EXPECT_EQ(kEpidNoErr, Tpm2NvWrite(tpm, nv_index, sizeof(data) - 1, 1, &data));
194 THROW_ON_EPIDERR(Tpm2NvUndefineSpace(tpm, nv_index));
200 Tpm2CtxObj tpm(&Prng::Generate, &my_prng, nullptr, epid2params);
203 Tpm2NvDefineSpace(tpm, nv_index, sizeof(MembershipCredential)));
206 EXPECT_EQ(kEpidBadArgErr, Tpm2NvWrite(tpm, nv_index, sizeof(data), 1, &data));
208 Tpm2NvWrite(tpm, nv_index, sizeof(data) + 1, 1, &data));
210 Tpm2NvWrite(tpm, nv_index, 1, sizeof(MembershipCredential), &data));
211 THROW_ON_EPIDERR(Tpm2NvUndefineSpace(tpm, nv_index));
217 Tpm2CtxObj tpm(&Prng::Generate, &my_prng, nullptr, epid2params);
220 Tpm2NvDefineSpace(tpm, nv_index, sizeof(MembershipCredential)));
223 EXPECT_EQ(kEpidBadArgErr, Tpm2NvWrite(tpm, nv_index, 0, 0, &data));
224 THROW_ON_EPIDERR(Tpm2NvUndefineSpace(tpm, nv_index));
230 Tpm2CtxObj tpm(&Prng::Generate, &my_prng, nullptr, epid2params);
234 EXPECT_EQ(kEpidBadArgErr, Tpm2NvWrite(tpm, nv_index, 1, 0, &data));
242 Tpm2CtxObj tpm(&Prng::Generate, &my_prng, nullptr, epid2params);
245 Tpm2NvDefineSpace(tpm, nv_index, sizeof(MembershipCredential)));
251 Tpm2NvRead(tpm, nv_index, sizeof(data), 0, nullptr));
252 THROW_ON_EPIDERR(Tpm2NvUndefineSpace(tpm, nv_index));
258 Tpm2CtxObj tpm(&Prng::Generate, &my_prng, nullptr, epid2params);
262 THROW_ON_EPIDERR(Tpm2NvDefineSpace(tpm, nv_index, data_src.size()));
264 Tpm2NvWrite(tpm, nv_index, data_src.size(), 0, data_src.data()));
266 EXPECT_EQ(kEpidNoErr, Tpm2NvRead(tpm, nv_index, 3, 0, data_dst.data()));
267 EXPECT_EQ(kEpidNoErr, Tpm2NvRead(tpm, nv_index, data_src.size() - 3, 3,
269 THROW_ON_EPIDERR(Tpm2NvUndefineSpace(tpm, nv_index));
276 Tpm2CtxObj tpm(&Prng::Generate, &my_prng, nullptr, epid2params);
279 Tpm2NvDefineSpace(tpm, nv_index, sizeof(MembershipCredential)));
282 EXPECT_EQ(kEpidBadArgErr, Tpm2NvRead(tpm, nv_index, sizeof(data), 0, &data));
283 THROW_ON_EPIDERR(Tpm2NvUndefineSpace(tpm, nv_index));
289 Tpm2CtxObj tpm(&Prng::Generate, &my_prng, nullptr, epid2params);
292 Tpm2NvDefineSpace(tpm, nv_index, sizeof(MembershipCredential)));
295 EXPECT_EQ(kEpidBadArgErr, Tpm2NvRead(tpm, nv_index, sizeof(data), 1, &data));
297 Tpm2NvRead(tpm, nv_index, sizeof(data) + 1, 0, &data));
299 Tpm2NvRead(tpm, nv_index, 1, sizeof(MembershipCredential), &data));
300 THROW_ON_EPIDERR(Tpm2NvUndefineSpace(tpm, nv_index));
306 Tpm2CtxObj tpm(&Prng::Generate, &my_prng, nullptr, epid2params);
309 Tpm2NvDefineSpace(tpm, nv_index, sizeof(MembershipCredential)));
312 EXPECT_EQ(kEpidBadArgErr, Tpm2NvRead(tpm, nv_index, 0, 0, &data));
313 THROW_ON_EPIDERR(Tpm2NvUndefineSpace(tpm, nv_index));
319 Tpm2CtxObj tpm(&Prng::Generate, &my_prng, nullptr, epid2params);
323 EXPECT_EQ(kEpidBadArgErr, Tpm2NvRead(tpm, nv_index, 1, 0, &data));