Skip to content

Commit a3012ee

Browse files
committed
This adds CMS support to the Ruby layer.
The CMS_ContentInfo object can be used. Access to the CMS_SignedInfo structure exists, but it can not be created or freed, as it is just a pointer into CMS_ContentInfo stack. feat: added NOINTERN and NO_SIGNER_CERT_VERIFY flags feat: look for CMS_sign, and set HAVE_CMS_SIGN if present, enabling CMS support
1 parent 434ef74 commit a3012ee

File tree

8 files changed

+642
-1
lines changed

8 files changed

+642
-1
lines changed

ext/openssl/extconf.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ def find_openssl_library
143143
# added in 1.1.0, currently not in LibreSSL
144144
have_func("EVP_PBE_scrypt(\"\", 0, (unsigned char *)\"\", 0, 0, 0, 0, 0, NULL, 0)", evp_h)
145145

146+
# look for CMS code, normally included, but some variations compile it out
147+
have_func("CMS_sign", ssl_h)
148+
146149
# added in OpenSSL 1.1.1 and LibreSSL 3.5.0, then removed in LibreSSL 4.0.0
147150
have_func("EVP_PKEY_check(NULL)", evp_h)
148151

ext/openssl/ossl.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,6 +1044,9 @@ Init_openssl(void)
10441044
Init_ossl_ocsp();
10451045
Init_ossl_pkcs12();
10461046
Init_ossl_pkcs7();
1047+
#if defined(HAVE_CMS_SIGN)
1048+
Init_ossl_cms();
1049+
#endif
10471050
Init_ossl_pkey();
10481051
Init_ossl_provider();
10491052
Init_ossl_rand();

ext/openssl/ossl.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
#include <openssl/ssl.h>
3232
#include <openssl/pkcs12.h>
3333
#include <openssl/pkcs7.h>
34+
#include <openssl/cms.h>
35+
#include <openssl/hmac.h>
3436
#include <openssl/rand.h>
3537
#include <openssl/conf.h>
3638
#ifndef OPENSSL_NO_TS
@@ -193,6 +195,7 @@ extern VALUE dOSSL;
193195
#include "ossl_ocsp.h"
194196
#include "ossl_pkcs12.h"
195197
#include "ossl_pkcs7.h"
198+
#include "ossl_cms.h"
196199
#include "ossl_pkey.h"
197200
#include "ossl_provider.h"
198201
#include "ossl_rand.h"

0 commit comments

Comments
 (0)