]> www.wagner.pp.ru Git - openssl-gost/engine.git/blobdiff - gost89.c
modernize ctrl function for magma & kuznechik TLS usage
[openssl-gost/engine.git] / gost89.c
index 337204b8c91f79ac2a2042a3267c567bedf03254..90d5515d9c7041c7305a9279afe69fe85350532d 100644 (file)
--- a/gost89.c
+++ b/gost89.c
@@ -484,6 +484,10 @@ void magma_key(gost_ctx * c, const byte * k)
     }
 }
 
+void magma_master_key(gost_ctx *c, const byte *k) {
+    memcpy(c->master_key, k, sizeof(c->master_key));
+}
+
 /* Retrieve 256-bit gost89 key from context */
 void gost_get_key(gost_ctx * c, byte * k)
 {
@@ -520,6 +524,7 @@ void gost_init(gost_ctx * c, const gost_subst_block * b)
 /* Cleans up key from context */
 void gost_destroy(gost_ctx * c)
 {
+    OPENSSL_cleanse(c->master_key, sizeof(c->master_key));
     OPENSSL_cleanse(c->key, sizeof(c->key));
     OPENSSL_cleanse(c->mask, sizeof(c->mask));
 }