public static int rijndael_set_key(rijndael_ctx *ctx, byte *key, int bits)
{
int rounds;
rounds = rijndaelKeySetupEnc(ctx->ek, key, bits);
if (rounds == 0)
return -1;
if (rijndaelKeySetupDec(ctx->dk, key, bits) != rounds)
return -1;
ctx->Nr = rounds;
ctx->enc_only = 0;
return 0;
}