Lines Matching refs:ctx
513 return_type aes_set_key( const uint8_t key[], length_type keylen, aes_context ctx[1] )
524 ctx->rnd = 0;
527 block_copy_nn(ctx->ksch, key, keylen);
529 ctx->rnd = (hi >> 4) - 1;
533 t0 = ctx->ksch[cc - 4];
534 t1 = ctx->ksch[cc - 3];
535 t2 = ctx->ksch[cc - 2];
536 t3 = ctx->ksch[cc - 1];
554 ctx->ksch[cc + 0] = ctx->ksch[tt + 0] ^ t0;
555 ctx->ksch[cc + 1] = ctx->ksch[tt + 1] ^ t1;
556 ctx->ksch[cc + 2] = ctx->ksch[tt + 2] ^ t2;
557 ctx->ksch[cc + 3] = ctx->ksch[tt + 3] ^ t3;
568 return_type aes_encrypt( const uint8_t in[N_BLOCK], uint8_t out[N_BLOCK], const aes_context ctx[1]…
570 if( ctx->rnd )
573 copy_and_key( s1, in, ctx->ksch );
575 for( r = 1 ; r < ctx->rnd ; ++r )
579 add_round_key( s1, ctx->ksch + r * N_BLOCK);
584 copy_and_key( s1, s2, ctx->ksch + r * N_BLOCK);
588 copy_and_key( out, s1, ctx->ksch + r * N_BLOCK );
598 int32_t n_block, uint8_t iv[N_BLOCK], const aes_context ctx[1] )
604 if(aes_encrypt(iv, iv, ctx) != EXIT_SUCCESS)
620 return_type aes_decrypt( const uint8_t in[N_BLOCK], uint8_t out[N_BLOCK], const aes_context ctx[1] )
622 if( ctx->rnd )
625 copy_and_key( s1, in, ctx->ksch + ctx->rnd * N_BLOCK );
628 for( r = ctx->rnd ; --r ; )
631 add_round_key( s1, ctx->ksch + r * N_BLOCK );
636 copy_and_key( s2, s1, ctx->ksch + r * N_BLOCK );
640 copy_and_key( out, s1, ctx->ksch );
650 int32_t n_block, uint8_t iv[N_BLOCK], const aes_context ctx[1] )
657 if(aes_decrypt(in, out, ctx) != EXIT_SUCCESS)