Exemplo n.º 1
0
int yk_check_firmware_version(YK_KEY *k)
{
	YK_STATUS st;

	if (!yk_get_status(k, &st))
		return 0;

	return yk_check_firmware_version2(&st);
}
static void _test_yk_firmware(void)
{
	size_t i;
	for(i = 0; i < sizeof(supported) / sizeof(struct versions); i++) {
		int rc;
		YK_STATUS *st = _test_init_st(supported[i].major, supported[i].minor, supported[i].build);
		printf("testing: %d.%d.%d\n", supported[i].major, supported[i].minor, supported[i].build);
		rc = yk_check_firmware_version2(st);
		if(supported[i].support == true) {
			assert(rc == 1);
		} else {
			assert(yk_errno == YK_EFIRMWARE);
			assert(rc == 0);
		}
		ykds_free(st);
	}
}