mirror of
https://abf.rosa.ru/djam/libressl.git
synced 2025-02-23 08:02:54 +00:00
70 lines
2.2 KiB
Diff
70 lines
2.2 KiB
Diff
From fbd3052d4bda0a41383a04ac78e9bd0147655130 Mon Sep 17 00:00:00 2001
|
|
From: Dmitry Baryshkov <dbaryshkov@gmail.com>
|
|
Date: Thu, 19 Mar 2020 18:13:42 +0300
|
|
Subject: [PATCH 52/87] gost: restore CMS support
|
|
|
|
Restore CMS support dropped few years ago when CMS support was removed
|
|
from LibreSSL.
|
|
|
|
Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
|
|
---
|
|
src/lib/libcrypto/gost/gostr341001_ameth.c | 15 ++++++++++++++-
|
|
src/lib/libcrypto/gost/gostr341001_pmeth.c | 5 +++++
|
|
2 files changed, 19 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/src/lib/libcrypto/gost/gostr341001_ameth.c b/src/lib/libcrypto/gost/gostr341001_ameth.c
|
|
index 880c17cea..2efb001fc 100644
|
|
--- a/src/lib/libcrypto/gost/gostr341001_ameth.c
|
|
+++ b/src/lib/libcrypto/gost/gostr341001_ameth.c
|
|
@@ -59,6 +59,9 @@
|
|
#include <openssl/ec.h>
|
|
#include <openssl/err.h>
|
|
#include <openssl/x509.h>
|
|
+#ifndef OPENSSL_NO_CMS
|
|
+#include <openssl/cms.h>
|
|
+#endif
|
|
#include <openssl/gost.h>
|
|
|
|
|
|
@@ -776,11 +779,21 @@ pkey_ctrl_gost01(EVP_PKEY *pkey, int op, long arg1, void *arg2)
|
|
int digest = GOST_KEY_get_digest(pkey->pkey.gost);
|
|
|
|
switch (op) {
|
|
+#ifndef OPENSSL_NO_CMS
|
|
+ case ASN1_PKEY_CTRL_CMS_SIGN:
|
|
+ if (arg1 == 0)
|
|
+ CMS_SignerInfo_get0_algs(arg2, NULL, NULL,
|
|
+ &alg1, &alg2);
|
|
+ break;
|
|
+ case ASN1_PKEY_CTRL_CMS_ENVELOPE:
|
|
+ if (arg1 == 0)
|
|
+ CMS_RecipientInfo_ktri_get0_algs(arg2, NULL, NULL, &alg3);
|
|
+ break;
|
|
+#endif
|
|
case ASN1_PKEY_CTRL_PKCS7_SIGN:
|
|
if (arg1 == 0)
|
|
PKCS7_SIGNER_INFO_get0_algs(arg2, NULL, &alg1, &alg2);
|
|
break;
|
|
-
|
|
case ASN1_PKEY_CTRL_PKCS7_ENCRYPT:
|
|
if (arg1 == 0)
|
|
PKCS7_RECIP_INFO_get0_alg(arg2, &alg3);
|
|
diff --git a/src/lib/libcrypto/gost/gostr341001_pmeth.c b/src/lib/libcrypto/gost/gostr341001_pmeth.c
|
|
index 455337232..ce4658b13 100644
|
|
--- a/src/lib/libcrypto/gost/gostr341001_pmeth.c
|
|
+++ b/src/lib/libcrypto/gost/gostr341001_pmeth.c
|
|
@@ -831,6 +831,11 @@ pkey_gost01_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)
|
|
case EVP_PKEY_CTRL_PKCS7_DECRYPT:
|
|
case EVP_PKEY_CTRL_PKCS7_SIGN:
|
|
case EVP_PKEY_CTRL_DIGESTINIT:
|
|
+#ifndef OPENSSL_NO_CMS
|
|
+ case EVP_PKEY_CTRL_CMS_ENCRYPT:
|
|
+ case EVP_PKEY_CTRL_CMS_DECRYPT:
|
|
+ case EVP_PKEY_CTRL_CMS_SIGN:
|
|
+#endif
|
|
return 1;
|
|
|
|
case EVP_PKEY_CTRL_GOST_PARAMSET:
|
|
--
|
|
2.17.1
|
|
|