static void
_gost28147_set_key_tc26z(void *ctx, const uint8_t *key)
{
- gost28147_set_key(ctx, key);
gost28147_set_param(ctx, &gost28147_param_TC26_Z);
+ gost28147_set_key(ctx, key);
}
static void
_gost28147_set_key_cpa(void *ctx, const uint8_t *key)
{
- gost28147_set_key(ctx, key);
gost28147_set_param(ctx, &gost28147_param_CryptoPro_A);
+ gost28147_set_key(ctx, key);
}
static void
_gost28147_set_key_cpb(void *ctx, const uint8_t *key)
{
- gost28147_set_key(ctx, key);
gost28147_set_param(ctx, &gost28147_param_CryptoPro_B);
+ gost28147_set_key(ctx, key);
}
static void
_gost28147_set_key_cpc(void *ctx, const uint8_t *key)
{
- gost28147_set_key(ctx, key);
gost28147_set_param(ctx, &gost28147_param_CryptoPro_C);
+ gost28147_set_key(ctx, key);
}
static void
_gost28147_set_key_cpd(void *ctx, const uint8_t *key)
{
- gost28147_set_key(ctx, key);
gost28147_set_param(ctx, &gost28147_param_CryptoPro_D);
+ gost28147_set_key(ctx, key);
}
static void
ctx->key_count = 0;
}
-static void
-_gost28147_set_key(struct gost28147_ctx *ctx, const uint8_t *key)
+void
+gost28147_set_key(struct gost28147_ctx *ctx, const uint8_t *key)
{
unsigned i;
+ assert(key);
for (i = 0; i < 8; i++, key += 4)
ctx->key[i] = LE_READ_UINT32(key);
ctx->key_count = 0;
}
-void
-gost28147_set_key(struct gost28147_ctx *ctx, const uint8_t *key)
-{
- assert(key);
- _gost28147_set_key(ctx, key);
- gost28147_set_param(ctx, &gost28147_param_TC26_Z);
-}
-
void
gost28147_set_param(struct gost28147_ctx *ctx, const struct gost28147_param *param)
{
const uint8_t *key,
const struct gost28147_param *param)
{
- gost28147_set_key(&ctx->ctx, key);
gost28147_set_param(&ctx->ctx, param);
+ gost28147_set_key(&ctx->ctx, key);
ctx->bytes = 0;
}
assert(length == GOST28147_IMIT_KEY_SIZE);
assert(key);
- _gost28147_set_key(&ctx->cctx, key);
_gost28147_imit_reinit(ctx);
- if (!ctx->cctx.sbox)
- gost28147_set_param(&ctx->cctx, &gost28147_param_TC26_Z);
+ gost28147_set_key(&ctx->cctx, key);
}
void
static void
_wrap_gost28147_imit_set_key_tc26z(void *ctx, size_t len, const uint8_t * key)
{
- gost28147_imit_set_key(ctx, len, key);
gost28147_imit_set_param(ctx, &gost28147_param_TC26_Z);
+ gost28147_imit_set_key(ctx, len, key);
}
#endif