示例#1
0
void testrun_test_serpent(void){
	uint8_t key[32];
	serpent_ctx_t ctx;
	uint8_t i;
	memset(key, 0, 16);
	serpent_init(key, 128, &ctx);
	for(i=0; i<33; ++i){
		cli_putstr_P(PSTR("\r\n subkekey "));	
		cli_hexdump(&i, 1);
		cli_putstr_P(PSTR(" : "));	
		cli_hexdump(ctx.k[i], 16);
	}
}
void testrun_serpent256(void){
	uint8_t key[32];
	uint8_t data[16];
	serpent_ctx_t ctx;
	memset(key, 0, 32);
	memset(data, 0, 16);
	key[0] = 0x80;
	cli_putstr("\r\n== small test Serpent-256 ==");
	cli_putstr("\r\n  key    = ");
	cli_hexdump(key, 32);
	cli_putstr("\r\n  plain  = ");
	cli_hexdump(data, 16);
	serpent_init(key, 256, &ctx);
	serpent_enc(data, &ctx);
	cli_putstr("\r\n  cipher = ");
	cli_hexdump(data, 16);
}
示例#3
0
void SERPENT_set_key(unsigned char *key, int keysize, SERPENT_KEY *serpent_key)
{
    serpent_init(serpent_key, key, (keysize/8));
}
示例#4
0
/*****************************************************************************
 *  additional validation-functions											 *
 *****************************************************************************/
void serpent_genctx_dummy(uint8_t *key, uint16_t keysize, void *ctx){
	serpent_init(key, keysize&0xff, ctx);
}