Ejemplo n.º 1
0
int
tc_api_cipher_iterate(tc_api_cipher_iterator_fn fn, void *priv)
{
	int i;
	struct tc_cipher_chain *chain;
	int klen;
	int length;
	char buf[1024];

	if (fn == NULL) {
		errno = EFAULT;
		return TC_ERR;
	}

	for (i = 0, chain = tc_cipher_chains[0]; chain != NULL;
	     chain = tc_cipher_chains[++i]) {
		tc_cipher_chain_sprint(buf, sizeof(buf), chain);
		klen = tc_cipher_chain_klen(chain);
		length = tc_cipher_chain_length(chain);
		if ((fn(priv, buf, klen, length)) < 0)
			break;
	}

	return TC_OK;
}
Ejemplo n.º 2
0
void
print_info(struct tcplay_info *info)
{
	printf("Device:\t\t\t%s\n", info->dev);

	if (info->pbkdf_prf != NULL) {
		printf("PBKDF2 PRF:\t\t%s\n", info->pbkdf_prf->name);
		printf("PBKDF2 iterations:\t%d\n",
		    info->pbkdf_prf->iteration_count);
	}

	printf("Cipher:\t\t\t%s\n",
	    tc_cipher_chain_sprint(NULL, 0, info->cipher_chain));

	printf("Key Length:\t\t%d bits\n",
	    8*tc_cipher_chain_klen(info->cipher_chain));

	if (info->hdr != NULL) {
		printf("CRC Key Data:\t\t%#x\n", info->hdr->crc_keys);
		printf("Sector size:\t\t%d\n", info->hdr->sec_sz);
	} else {
		printf("Sector size:\t\t512\n");
	}
	printf("Volume size:\t\t%"DISKSZ_FMT" sectors\n", info->size);
#if 0
	/* Don't print this; it's always 0 and is rather confusing */
	printf("Volume offset:\t\t%"PRIu64"\n", (uint64_t)info->start);
#endif

#ifdef DEBUG
	printf("Vol Flags:\t\t%d\n", info->volflags);
#endif

	printf("IV offset:\t\t%"PRIu64" sectors\n",
	    (uint64_t)info->skip);
	printf("Block offset:\t\t%"PRIu64" sectors\n",
	    (uint64_t)info->offset);
}