예제 #1
0
static int setkey(struct crypto_tfm *tfm, const u8 *key,
		  unsigned int keysize)
{
	struct salsa20_ctx *ctx = crypto_tfm_ctx(tfm);
	salsa20_keysetup(ctx, key, keysize*8, SALSA20_IV_SIZE*8);
	return 0;
}
예제 #2
0
파일: salsa.c 프로젝트: arpunk/WaspVM
wasp_salsa20_key wasp_make_salsa20_key( wasp_string seed ){
    int seedlen = wasp_string_length( seed );
    if( seedlen != 32 ) 
        wasp_errf( wasp_es_vm, "si", 
                           "Salsa20 keys must be 32 bytes long", seedlen );
    wasp_salsa20_key key = WASP_OBJALLOC( salsa20_key );

    salsa20_keysetup( & key->context, wasp_sf_string( seed ) );

    return key;
}