Message ID | 1413970840-27212-1-git-send-email-ivan.hu@canonical.com |
---|---|
State | Rejected |
Headers | show |
On 22/10/14 10:40, Ivan Hu wrote: > This test deletes the test authenticated variable and checks if it still exists. > > Signed-off-by: Ivan Hu <ivan.hu@canonical.com> > --- > src/uefi/uefirtauthvar/uefirtauthvar.c | 53 ++++++++++++++++++++++++++++++++ > 1 file changed, 53 insertions(+) > > diff --git a/src/uefi/uefirtauthvar/uefirtauthvar.c b/src/uefi/uefirtauthvar/uefirtauthvar.c > index 0d98f33..fc123f3 100644 > --- a/src/uefi/uefirtauthvar/uefirtauthvar.c > +++ b/src/uefi/uefirtauthvar/uefirtauthvar.c > @@ -464,6 +464,58 @@ static int uefirtauthvar_test6(fwts_framework *fw) > return FWTS_ERROR; > } > > +/* > + * Delete the test authenticated variable. > + */ > +static int uefirtauthvar_test7(fwts_framework *fw) > +{ > + long ioret; > + int supcheck; > + > + uint8_t data[getvar_buf_size]; > + uint64_t getdatasize = sizeof(data); > + uint64_t status; > + uint32_t attributestest; > + > + ioret = setvar(>estguid, attributes, sizeof(AuthVarDel), AuthVarDel, &status); > + > + if (ioret == -1) { > + supcheck = check_fw_support(fw, status); > + if (supcheck != FWTS_OK) > + return supcheck; > + > + fwts_failed(fw, LOG_LEVEL_HIGH, > + "UEFIDelAuthVar", > + "Failed to delete autheticated variable with UEFI " > + "runtime service."); > + fwts_uefi_print_status_info(fw, status); > + return FWTS_ERROR; > + } > + > + ioret = getvar(>estguid, &attributestest, &getdatasize, data, &status); > + if (ioret == -1) { > + if (status == EFI_NOT_FOUND) { > + fwts_passed(fw, "Delete authenticated variable tests passed."); > + return FWTS_OK; > + } > + > + fwts_failed(fw, LOG_LEVEL_MEDIUM, > + "UEFIDelAuthVar", > + "Failed to get authenticated variable with UEFI " > + "runtime service."); > + fwts_uefi_print_status_info(fw, status); > + return FWTS_ERROR; > + } > + > + fwts_failed(fw, LOG_LEVEL_HIGH, > + "UEFIDelAuthVar", > + "Failed to delete autheticated variable still get the test" > + "autheticated variable."); > + > + return FWTS_ERROR; > +} > + > + > static fwts_framework_minor_test uefirtauthvar_tests[] = { > { uefirtauthvar_test1, "Create authenticated variable test." }, > { uefirtauthvar_test2, "Authenticated variable test with the same authenticated variable." }, > @@ -471,6 +523,7 @@ static fwts_framework_minor_test uefirtauthvar_tests[] = { > { uefirtauthvar_test4, "Append authenticated variable test." }, > { uefirtauthvar_test5, "Update authenticated variable test." }, > { uefirtauthvar_test6, "Authenticated variable test with old authenticated variable." }, > + { uefirtauthvar_test7, "Delete authenticated variable test." }, > { NULL, NULL } > }; > > Acked-by: Colin Ian King <colin.king@canonical.com>
Typos, will resend patch. On 10/23/2014 12:05 AM, Colin Ian King wrote: > On 22/10/14 10:40, Ivan Hu wrote: >> This test deletes the test authenticated variable and checks if it still exists. >> >> Signed-off-by: Ivan Hu <ivan.hu@canonical.com> >> --- >> src/uefi/uefirtauthvar/uefirtauthvar.c | 53 ++++++++++++++++++++++++++++++++ >> 1 file changed, 53 insertions(+) >> >> diff --git a/src/uefi/uefirtauthvar/uefirtauthvar.c b/src/uefi/uefirtauthvar/uefirtauthvar.c >> index 0d98f33..fc123f3 100644 >> --- a/src/uefi/uefirtauthvar/uefirtauthvar.c >> +++ b/src/uefi/uefirtauthvar/uefirtauthvar.c >> @@ -464,6 +464,58 @@ static int uefirtauthvar_test6(fwts_framework *fw) >> return FWTS_ERROR; >> } >> >> +/* >> + * Delete the test authenticated variable. >> + */ >> +static int uefirtauthvar_test7(fwts_framework *fw) >> +{ >> + long ioret; >> + int supcheck; >> + >> + uint8_t data[getvar_buf_size]; >> + uint64_t getdatasize = sizeof(data); >> + uint64_t status; >> + uint32_t attributestest; >> + >> + ioret = setvar(>estguid, attributes, sizeof(AuthVarDel), AuthVarDel, &status); >> + >> + if (ioret == -1) { >> + supcheck = check_fw_support(fw, status); >> + if (supcheck != FWTS_OK) >> + return supcheck; >> + >> + fwts_failed(fw, LOG_LEVEL_HIGH, >> + "UEFIDelAuthVar", >> + "Failed to delete autheticated variable with UEFI " >> + "runtime service."); >> + fwts_uefi_print_status_info(fw, status); >> + return FWTS_ERROR; >> + } >> + >> + ioret = getvar(>estguid, &attributestest, &getdatasize, data, &status); >> + if (ioret == -1) { >> + if (status == EFI_NOT_FOUND) { >> + fwts_passed(fw, "Delete authenticated variable tests passed."); >> + return FWTS_OK; >> + } >> + >> + fwts_failed(fw, LOG_LEVEL_MEDIUM, >> + "UEFIDelAuthVar", >> + "Failed to get authenticated variable with UEFI " >> + "runtime service."); >> + fwts_uefi_print_status_info(fw, status); >> + return FWTS_ERROR; >> + } >> + >> + fwts_failed(fw, LOG_LEVEL_HIGH, >> + "UEFIDelAuthVar", >> + "Failed to delete autheticated variable still get the test" >> + "autheticated variable."); >> + >> + return FWTS_ERROR; >> +} >> + >> + >> static fwts_framework_minor_test uefirtauthvar_tests[] = { >> { uefirtauthvar_test1, "Create authenticated variable test." }, >> { uefirtauthvar_test2, "Authenticated variable test with the same authenticated variable." }, >> @@ -471,6 +523,7 @@ static fwts_framework_minor_test uefirtauthvar_tests[] = { >> { uefirtauthvar_test4, "Append authenticated variable test." }, >> { uefirtauthvar_test5, "Update authenticated variable test." }, >> { uefirtauthvar_test6, "Authenticated variable test with old authenticated variable." }, >> + { uefirtauthvar_test7, "Delete authenticated variable test." }, >> { NULL, NULL } >> }; >> >> > Acked-by: Colin Ian King <colin.king@canonical.com> >
diff --git a/src/uefi/uefirtauthvar/uefirtauthvar.c b/src/uefi/uefirtauthvar/uefirtauthvar.c index 0d98f33..fc123f3 100644 --- a/src/uefi/uefirtauthvar/uefirtauthvar.c +++ b/src/uefi/uefirtauthvar/uefirtauthvar.c @@ -464,6 +464,58 @@ static int uefirtauthvar_test6(fwts_framework *fw) return FWTS_ERROR; } +/* + * Delete the test authenticated variable. + */ +static int uefirtauthvar_test7(fwts_framework *fw) +{ + long ioret; + int supcheck; + + uint8_t data[getvar_buf_size]; + uint64_t getdatasize = sizeof(data); + uint64_t status; + uint32_t attributestest; + + ioret = setvar(>estguid, attributes, sizeof(AuthVarDel), AuthVarDel, &status); + + if (ioret == -1) { + supcheck = check_fw_support(fw, status); + if (supcheck != FWTS_OK) + return supcheck; + + fwts_failed(fw, LOG_LEVEL_HIGH, + "UEFIDelAuthVar", + "Failed to delete autheticated variable with UEFI " + "runtime service."); + fwts_uefi_print_status_info(fw, status); + return FWTS_ERROR; + } + + ioret = getvar(>estguid, &attributestest, &getdatasize, data, &status); + if (ioret == -1) { + if (status == EFI_NOT_FOUND) { + fwts_passed(fw, "Delete authenticated variable tests passed."); + return FWTS_OK; + } + + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "UEFIDelAuthVar", + "Failed to get authenticated variable with UEFI " + "runtime service."); + fwts_uefi_print_status_info(fw, status); + return FWTS_ERROR; + } + + fwts_failed(fw, LOG_LEVEL_HIGH, + "UEFIDelAuthVar", + "Failed to delete autheticated variable still get the test" + "autheticated variable."); + + return FWTS_ERROR; +} + + static fwts_framework_minor_test uefirtauthvar_tests[] = { { uefirtauthvar_test1, "Create authenticated variable test." }, { uefirtauthvar_test2, "Authenticated variable test with the same authenticated variable." }, @@ -471,6 +523,7 @@ static fwts_framework_minor_test uefirtauthvar_tests[] = { { uefirtauthvar_test4, "Append authenticated variable test." }, { uefirtauthvar_test5, "Update authenticated variable test." }, { uefirtauthvar_test6, "Authenticated variable test with old authenticated variable." }, + { uefirtauthvar_test7, "Delete authenticated variable test." }, { NULL, NULL } };
This test deletes the test authenticated variable and checks if it still exists. Signed-off-by: Ivan Hu <ivan.hu@canonical.com> --- src/uefi/uefirtauthvar/uefirtauthvar.c | 53 ++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+)