summaryrefslogtreecommitdiff
path: root/lib/nettle/gost/gost28147.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/nettle/gost/gost28147.c')
-rw-r--r--lib/nettle/gost/gost28147.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/lib/nettle/gost/gost28147.c b/lib/nettle/gost/gost28147.c
index d6a278ab09..8d648c1045 100644
--- a/lib/nettle/gost/gost28147.c
+++ b/lib/nettle/gost/gost28147.c
@@ -2292,25 +2292,18 @@ static void gost28147_key_mesh_cryptopro(struct gost28147_ctx *ctx)
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)
{
assert(param);
@@ -2419,8 +2412,8 @@ gost28147_cnt_init(struct gost28147_cnt_ctx *ctx,
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;
}
@@ -2487,10 +2480,8 @@ gost28147_imit_set_key(struct gost28147_imit_ctx *ctx,
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