/* loop over all test cases */ while (test_case != NULL) { /* check test case parameters */ if (test_case->tag_length_octets > SELF_TEST_TAG_BUF_OCTETS) { return srtp_err_status_bad_param;
}
/* allocate auth */
status = srtp_auth_type_alloc(at, &a, test_case->key_length_octets,
test_case->tag_length_octets); if (status) { return status;
}
/* initialize auth */
status = srtp_auth_init(a, test_case->key); if (status) {
srtp_auth_dealloc(a); return status;
}
status = srtp_auth_start(a); if (status) {
srtp_auth_dealloc(a); return status;
}
/* zeroize tag then compute */
octet_string_set_to_zero(tag, test_case->tag_length_octets);
status = srtp_auth_compute(a, test_case->data,
test_case->data_length_octets, tag); if (status) {
srtp_auth_dealloc(a); return status;
}
/* check the result */
status = srtp_err_status_ok; for (i = 0; i < test_case->tag_length_octets; i++) { if (tag[i] != test_case->tag[i]) {
status = srtp_err_status_algo_fail;
debug_print(srtp_mod_auth, "test case %d failed", case_num);
debug_print(srtp_mod_auth, " (mismatch at octet %d)", i);
}
} if (status) {
srtp_auth_dealloc(a); return srtp_err_status_algo_fail;
}
/* deallocate the auth function */
status = srtp_auth_dealloc(a); if (status) { return status;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.