aboutsummaryrefslogtreecommitdiff
path: root/gost_grasshopper_cipher.c
diff options
context:
space:
mode:
authorVitaly Chikunov <vt@altlinux.org>2018-07-25 09:13:22 +0300
committerVitaly Chikunov <vt@altlinux.org>2018-07-25 11:00:00 +0300
commiteb01b80247de3fa3848d58d7f2816aff8f396630 (patch)
tree1bfe42ad223e9717c10767875d60e21c66a9845b /gost_grasshopper_cipher.c
parent767ac3fdf61c3aaec9069a9a42bbb39b3b772574 (diff)
downloadgost-engine-eb01b80247de3fa3848d58d7f2816aff8f396630.zip
gost-engine-eb01b80247de3fa3848d58d7f2816aff8f396630.tar.gz
gost-engine-eb01b80247de3fa3848d58d7f2816aff8f396630.tar.bz2
Move openssl-1.0.2 shim layer here
Previously, we had shim layer in our openssl branch Could be squashed with 01d26132d156ba9fff7a8142d5a6899d7b2e6286
Diffstat (limited to 'gost_grasshopper_cipher.c')
-rw-r--r--gost_grasshopper_cipher.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/gost_grasshopper_cipher.c b/gost_grasshopper_cipher.c
index a1e2ce8..baf25fe 100644
--- a/gost_grasshopper_cipher.c
+++ b/gost_grasshopper_cipher.c
@@ -211,7 +211,7 @@ GRASSHOPPER_INLINE int gost_grasshopper_cipher_init_ctr(EVP_CIPHER_CTX* ctx, con
gost_grasshopper_cipher_ctx_ctr* c = EVP_CIPHER_CTX_get_cipher_data(ctx);
c->c.type = GRASSHOPPER_CIPHER_CTR;
- ctx->num = 0;
+ EVP_CIPHER_CTX_set_num(ctx, 0);
grasshopper_zero128(&c->partial_buffer);
@@ -310,7 +310,7 @@ int gost_grasshopper_cipher_do_ctr(EVP_CIPHER_CTX* ctx, unsigned char* out,
unsigned char* current_out = out;
grasshopper_w128_t* currentInputBlock;
grasshopper_w128_t* currentOutputBlock;
- unsigned int n = ctx->num;
+ unsigned int n = EVP_CIPHER_CTX_num(ctx);
size_t lasted;
size_t i;
@@ -319,7 +319,7 @@ int gost_grasshopper_cipher_do_ctr(EVP_CIPHER_CTX* ctx, unsigned char* out,
--inl;
n = (n + 1) % GRASSHOPPER_BLOCK_SIZE;
}
- ctx->num = n;
+ EVP_CIPHER_CTX_set_num(ctx, n);
size_t blocks = inl / GRASSHOPPER_BLOCK_SIZE;
grasshopper_w128_t* iv_buffer = (grasshopper_w128_t*) iv;
@@ -344,7 +344,7 @@ int gost_grasshopper_cipher_do_ctr(EVP_CIPHER_CTX* ctx, unsigned char* out,
for (i = 0; i < lasted; i++) {
currentOutputBlock->b[i] = c->partial_buffer.b[i] ^ currentInputBlock->b[i];
}
- ctx->num = i;
+ EVP_CIPHER_CTX_set_num(ctx, i);
ctr128_inc(iv_buffer->b);
}