]> www.wagner.pp.ru Git - openssl-gost/engine.git/blobdiff - gost_pmeth.c
Get rid of EVP_MD_CTRL_MAC_LEN
[openssl-gost/engine.git] / gost_pmeth.c
index 7eded878bd08f4b0bfb580a8acf678f77a4e7a15..41e53b67e2da2794977868dda2b20b7f81cc83fd 100644 (file)
 #include <openssl/ec.h>
 #include <openssl/err.h>
 #include <openssl/x509v3.h>     /* For string_to_hex */
+#include <openssl/opensslv.h>   /* For OPENSSL_VERSION_MAJOR */
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
 #include "gost_lcl.h"
 #include "e_gost_err.h"
 
+#define ossl3_const
+#ifdef OPENSSL_VERSION_MAJOR
+#undef ossl3_const
+#define ossl3_const const
+#endif
+
 /* -----init, cleanup, copy - uniform for all algs  --------------*/
 /* Allocates new gost_pmeth_data structure and assigns it as data */
 static int pkey_gost_init(EVP_PKEY_CTX *ctx)
@@ -53,7 +60,7 @@ static int pkey_gost_init(EVP_PKEY_CTX *ctx)
 }
 
 /* Copies contents of gost_pmeth_data structure */
-static int pkey_gost_copy(EVP_PKEY_CTX *dst, const EVP_PKEY_CTX *src)
+static int pkey_gost_copy(EVP_PKEY_CTX *dst, ossl3_const EVP_PKEY_CTX *src)
 {
     struct gost_pmeth_data *dst_data, *src_data;
     if (!pkey_gost_init(dst)) {
@@ -564,7 +571,7 @@ static void pkey_gost_mac_cleanup(EVP_PKEY_CTX *ctx)
         OPENSSL_free(data);
 }
 
-static int pkey_gost_mac_copy(EVP_PKEY_CTX *dst, const EVP_PKEY_CTX *src)
+static int pkey_gost_mac_copy(EVP_PKEY_CTX *dst, ossl3_const EVP_PKEY_CTX *src)
 {
     struct gost_mac_pmeth_data *dst_data, *src_data;
     if (!pkey_gost_mac_init(dst)) {
@@ -960,7 +967,7 @@ static int pkey_gost_mac_signctx(EVP_PKEY_CTX *ctx, unsigned char *sig,
     }
 
     EVP_MD_meth_get_ctrl(EVP_MD_CTX_md(mctx))
-        (mctx, EVP_MD_CTRL_MAC_LEN, data->mac_size, NULL);
+        (mctx, EVP_MD_CTRL_XOF_LEN, data->mac_size, NULL);
     ret = EVP_DigestFinal_ex(mctx, sig, &tmpsiglen);
     *siglen = data->mac_size;
     return ret;