aboutsummaryrefslogtreecommitdiff
path: root/gost_crypt.c
diff options
context:
space:
mode:
authorDmitry Belyavskiy <beldmit@gmail.com>2016-03-10 20:17:41 +0300
committerDmitry Belyavskiy <beldmit@gmail.com>2016-03-10 20:17:41 +0300
commitc89b75723868791467e949c968988f8cab1c9cf9 (patch)
treedc32eb364e0ba9f6bf79a05393a7c8b546311c80 /gost_crypt.c
parentf1ea373ddb0bda0ffe871f1008512c0462e1155e (diff)
downloadgost-engine-c89b75723868791467e949c968988f8cab1c9cf9.zip
gost-engine-c89b75723868791467e949c968988f8cab1c9cf9.tar.gz
gost-engine-c89b75723868791467e949c968988f8cab1c9cf9.tar.bz2
Backport of the ctrl-function from the 1_1_0 branch
Diffstat (limited to 'gost_crypt.c')
-rw-r--r--gost_crypt.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/gost_crypt.c b/gost_crypt.c
index 8132a1e..8587bd1 100644
--- a/gost_crypt.c
+++ b/gost_crypt.c
@@ -558,7 +558,52 @@ int gost_cipher_ctl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr)
} else {
return 0;
}
+#ifdef EVP_CTRL_SET_SBOX
+ case EVP_CTRL_SET_SBOX:
+ if (ptr) {
+ struct ossl_gost_cipher_ctx *c = ctx->cipher_data;
+ int nid;
+ int cur_meshing;
+ int ret;
+
+ if (c == NULL) {
+ return -1;
+ }
+
+ if (c->count != 0) {
+ return -1;
+ }
+ nid = OBJ_txt2nid(ptr);
+ if (nid == NID_undef) {
+ return 0;
+ }
+
+ cur_meshing = c->key_meshing;
+ ret = gost_cipher_set_param(c, nid);
+ c->key_meshing = cur_meshing;
+ return ret;
+ } else {
+ return 0;
+ }
+#endif
+#ifdef EVP_CTRL_KEY_MESH
+ case EVP_CTRL_KEY_MESH:
+ {
+ struct ossl_gost_cipher_ctx *c = ctx->cipher_data;
+
+ if (c == NULL) {
+ return -1;
+ }
+
+ if (c->count != 0) {
+ return -1;
+ }
+
+ c->key_meshing = arg;
+ return 1;
+ }
+#endif
default:
GOSTerr(GOST_F_GOST_CIPHER_CTL,
GOST_R_UNSUPPORTED_CIPHER_CTL_COMMAND);