-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathAdd-extra-PKCS-encoding-and-decoding-to-OpensslLibFull.patch
More file actions
128 lines (120 loc) · 5.44 KB
/
Add-extra-PKCS-encoding-and-decoding-to-OpensslLibFull.patch
File metadata and controls
128 lines (120 loc) · 5.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
From 7052e9b9182947997cd90f65d8448f5e8e8a34ae Mon Sep 17 00:00:00 2001
From: Pete Batard <pete@akeo.ie>
Date: Mon, 27 Jan 2025 19:24:05 +0000
Subject: [PATCH] Add extra PKCS encoding and decoding to OpensslLibFull
---
.../Library/OpensslLib/OpensslLibFull.inf | 34 ++++++++++++++++---
.../Library/OpensslLib/OpensslStub/uefiprov.c | 10 ++++++
2 files changed, 39 insertions(+), 5 deletions(-)
diff --git a/CryptoPkg/Library/OpensslLib/OpensslLibFull.inf b/CryptoPkg/Library/OpensslLib/OpensslLibFull.inf
index 32c79c39bb..7349a55d45 100644
--- a/CryptoPkg/Library/OpensslLib/OpensslLibFull.inf
+++ b/CryptoPkg/Library/OpensslLib/OpensslLibFull.inf
@@ -1,6 +1,6 @@
## @file
-# This module provides OpenSSL Library implementation with ECC and TLS
-# features.
+# This module provides OpenSSL Library implementation with ECC, TLS and
+# extra PKCS encoding and decoding features.
#
# This library should be used if a module module needs ECC in TLS, or
# asymmetric cryptography services such as X509 certificate or PEM format
@@ -25,7 +25,7 @@
DEFINE OPENSSL_PATH = openssl
DEFINE OPENSSL_GEN_PATH = OpensslGen
- DEFINE OPENSSL_FLAGS = -DL_ENDIAN -DOPENSSL_SMALL_FOOTPRINT -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DOPENSSL_NO_ASM
+ DEFINE OPENSSL_FLAGS = -DL_ENDIAN -DOPENSSL_SMALL_FOOTPRINT -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DOPENSSL_NO_ASM -DOPENSSL_SYS_UEFI
DEFINE OPENSSL_FLAGS_NOASM =
#
@@ -244,6 +244,10 @@
$(OPENSSL_PATH)/crypto/ec/ecx_backend.c
$(OPENSSL_PATH)/crypto/ec/ecx_key.c
$(OPENSSL_PATH)/crypto/ec/ecx_meth.c
+ $(OPENSSL_PATH)/crypto/encode_decode/encoder_err.c
+ $(OPENSSL_PATH)/crypto/encode_decode/encoder_lib.c
+ $(OPENSSL_PATH)/crypto/encode_decode/encoder_meth.c
+ $(OPENSSL_PATH)/crypto/encode_decode/encoder_pkey.c
$(OPENSSL_PATH)/crypto/encode_decode/decoder_err.c
$(OPENSSL_PATH)/crypto/encode_decode/decoder_lib.c
$(OPENSSL_PATH)/crypto/encode_decode/decoder_meth.c
@@ -426,6 +430,22 @@
$(OPENSSL_PATH)/crypto/pkcs7/pk7_mime.c
$(OPENSSL_PATH)/crypto/pkcs7/pk7_smime.c
$(OPENSSL_PATH)/crypto/pkcs7/pkcs7err.c
+ $(OPENSSL_PATH)/crypto/pkcs12/p12_add.c
+ $(OPENSSL_PATH)/crypto/pkcs12/p12_asn.c
+ $(OPENSSL_PATH)/crypto/pkcs12/p12_attr.c
+ $(OPENSSL_PATH)/crypto/pkcs12/p12_crpt.c
+ $(OPENSSL_PATH)/crypto/pkcs12/p12_crt.c
+ $(OPENSSL_PATH)/crypto/pkcs12/p12_decr.c
+ $(OPENSSL_PATH)/crypto/pkcs12/p12_init.c
+ $(OPENSSL_PATH)/crypto/pkcs12/p12_key.c
+ $(OPENSSL_PATH)/crypto/pkcs12/p12_kiss.c
+ $(OPENSSL_PATH)/crypto/pkcs12/p12_mutl.c
+ $(OPENSSL_PATH)/crypto/pkcs12/p12_npas.c
+ $(OPENSSL_PATH)/crypto/pkcs12/p12_p8d.c
+ $(OPENSSL_PATH)/crypto/pkcs12/p12_p8e.c
+ $(OPENSSL_PATH)/crypto/pkcs12/p12_sbag.c
+ $(OPENSSL_PATH)/crypto/pkcs12/p12_utl.c
+ $(OPENSSL_PATH)/crypto/pkcs12/pk12err.c
$(OPENSSL_PATH)/crypto/property/defn_cache.c
$(OPENSSL_PATH)/crypto/property/property.c
$(OPENSSL_PATH)/crypto/property/property_err.c
@@ -592,6 +612,10 @@
$(OPENSSL_PATH)/providers/implementations/encode_decode/decode_pem2der.c
$(OPENSSL_PATH)/providers/implementations/encode_decode/decode_pvk2key.c
$(OPENSSL_PATH)/providers/implementations/encode_decode/decode_spki2typespki.c
+ $(OPENSSL_PATH)/providers/implementations/encode_decode/encode_key2any.c
+ $(OPENSSL_PATH)/providers/implementations/encode_decode/encode_key2blob.c
+ $(OPENSSL_PATH)/providers/implementations/encode_decode/encode_key2ms.c
+ $(OPENSSL_PATH)/providers/implementations/encode_decode/encode_key2text.c
$(OPENSSL_PATH)/providers/implementations/encode_decode/endecoder_common.c
$(OPENSSL_PATH)/providers/implementations/exchange/dh_exch.c
$(OPENSSL_PATH)/providers/implementations/exchange/ecdh_exch.c
@@ -705,10 +729,10 @@
# OpensslStub/SslNull.c
# OpensslStub/EcSm2Null.c
OpensslStub/uefiprov.c
- OpensslStub/EncoderNull.c
+# OpensslStub/EncoderNull.c
OpensslStub/SslStatServNull.c
OpensslStub/SslExtServNull.c
- OpensslStub/Pkcs12Null.c
+# OpensslStub/Pkcs12Null.c
[Packages]
MdePkg/MdePkg.dec
diff --git a/CryptoPkg/Library/OpensslLib/OpensslStub/uefiprov.c b/CryptoPkg/Library/OpensslLib/OpensslStub/uefiprov.c
index f2af6a49d8..32e7e7233b 100644
--- a/CryptoPkg/Library/OpensslLib/OpensslStub/uefiprov.c
+++ b/CryptoPkg/Library/OpensslLib/OpensslStub/uefiprov.c
@@ -167,6 +167,7 @@ static const OSSL_ALGORITHM deflt_kdfs[] = {
{ PROV_NAMES_PBKDF2, "provider=default", ossl_kdf_pbkdf2_functions },
{ PROV_NAMES_SSHKDF, "provider=default", ossl_kdf_sshkdf_functions },
{ PROV_NAMES_TLS1_PRF, "provider=default", ossl_kdf_tls1_prf_functions },
+ { PROV_NAMES_PKCS12KDF, "provider=default", ossl_kdf_pkcs12_functions },
{ NULL, NULL, NULL }
};
@@ -233,6 +234,13 @@ static const OSSL_ALGORITHM deflt_decoder[] = {
#undef DECODER_PROVIDER
};
+static const OSSL_ALGORITHM deflt_encoder[] = {
+#define ENCODER_PROVIDER "default"
+#include "encoders.inc"
+ { NULL, NULL, NULL }
+#undef ENCODER_PROVIDER
+};
+
static const OSSL_ALGORITHM *deflt_query(void *provctx, int operation_id,
int *no_cache)
{
@@ -258,6 +266,8 @@ static const OSSL_ALGORITHM *deflt_query(void *provctx, int operation_id,
return deflt_asym_cipher;
case OSSL_OP_DECODER:
return deflt_decoder;
+ case OSSL_OP_ENCODER:
+ return deflt_encoder;
}
return NULL;
}
--
2.45.2.windows.1