openssl 3.2.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/CONTRIBUTING.md +180 -29
 - data/History.md +114 -1
 - data/README.md +11 -7
 - data/ext/openssl/extconf.rb +7 -9
 - data/ext/openssl/openssl_missing.c +1 -1
 - data/ext/openssl/openssl_missing.h +1 -1
 - data/ext/openssl/ossl.c +7 -9
 - data/ext/openssl/ossl.h +12 -8
 - data/ext/openssl/ossl_asn1.c +65 -261
 - data/ext/openssl/ossl_asn1.h +1 -19
 - data/ext/openssl/ossl_bio.c +1 -1
 - data/ext/openssl/ossl_bio.h +1 -1
 - data/ext/openssl/ossl_bn.c +12 -12
 - data/ext/openssl/ossl_bn.h +1 -2
 - data/ext/openssl/ossl_cipher.c +24 -9
 - data/ext/openssl/ossl_cipher.h +1 -4
 - data/ext/openssl/ossl_config.c +10 -9
 - data/ext/openssl/ossl_config.h +1 -1
 - data/ext/openssl/ossl_digest.c +39 -20
 - data/ext/openssl/ossl_digest.h +1 -4
 - data/ext/openssl/ossl_engine.c +3 -3
 - data/ext/openssl/ossl_engine.h +1 -4
 - data/ext/openssl/ossl_hmac.c +3 -3
 - data/ext/openssl/ossl_hmac.h +1 -4
 - data/ext/openssl/ossl_kdf.c +5 -5
 - data/ext/openssl/ossl_ns_spki.c +8 -8
 - data/ext/openssl/ossl_ns_spki.h +1 -5
 - data/ext/openssl/ossl_ocsp.c +8 -8
 - data/ext/openssl/ossl_ocsp.h +1 -8
 - data/ext/openssl/ossl_pkcs12.c +54 -3
 - data/ext/openssl/ossl_pkcs12.h +1 -4
 - data/ext/openssl/ossl_pkcs7.c +79 -22
 - data/ext/openssl/ossl_pkcs7.h +2 -22
 - data/ext/openssl/ossl_pkey.c +1 -1
 - data/ext/openssl/ossl_pkey.h +3 -14
 - data/ext/openssl/ossl_pkey_dh.c +2 -2
 - data/ext/openssl/ossl_pkey_dsa.c +2 -2
 - data/ext/openssl/ossl_pkey_ec.c +6 -6
 - data/ext/openssl/ossl_pkey_rsa.c +2 -2
 - data/ext/openssl/ossl_provider.c +1 -1
 - data/ext/openssl/ossl_rand.c +3 -3
 - data/ext/openssl/ossl_rand.h +1 -4
 - data/ext/openssl/ossl_ssl.c +71 -52
 - data/ext/openssl/ossl_ssl.h +1 -1
 - data/ext/openssl/ossl_ts.c +73 -15
 - data/ext/openssl/ossl_ts.h +1 -1
 - data/ext/openssl/ossl_x509.c +1 -1
 - data/ext/openssl/ossl_x509.h +1 -20
 - data/ext/openssl/ossl_x509attr.c +25 -26
 - data/ext/openssl/ossl_x509cert.c +42 -3
 - data/ext/openssl/ossl_x509crl.c +8 -4
 - data/ext/openssl/ossl_x509ext.c +3 -3
 - data/ext/openssl/ossl_x509name.c +3 -3
 - data/ext/openssl/ossl_x509req.c +8 -4
 - data/ext/openssl/ossl_x509revoked.c +2 -2
 - data/ext/openssl/ossl_x509store.c +16 -11
 - data/lib/openssl/asn1.rb +188 -0
 - data/lib/openssl/bn.rb +1 -1
 - data/lib/openssl/buffering.rb +24 -9
 - data/lib/openssl/cipher.rb +1 -1
 - data/lib/openssl/digest.rb +1 -1
 - data/lib/openssl/marshal.rb +1 -1
 - data/lib/openssl/ssl.rb +67 -4
 - data/lib/openssl/version.rb +1 -1
 - data/lib/openssl/x509.rb +6 -6
 - data/lib/openssl.rb +2 -1
 - metadata +6 -4
 - /data/{LICENSE.txt → COPYING} +0 -0
 
    
        data/ext/openssl/ossl_ts.c
    CHANGED
    
    | 
         @@ -5,7 +5,7 @@ 
     | 
|
| 
       5 
5 
     | 
    
         
             
             */
         
     | 
| 
       6 
6 
     | 
    
         
             
            /*
         
     | 
| 
       7 
7 
     | 
    
         
             
             * This program is licenced under the same licence as Ruby.
         
     | 
| 
       8 
     | 
    
         
            -
             * (See the file ' 
     | 
| 
      
 8 
     | 
    
         
            +
             * (See the file 'COPYING'.)
         
     | 
| 
       9 
9 
     | 
    
         
             
             */
         
     | 
| 
       10 
10 
     | 
    
         
             
            #include "ossl.h"
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
         @@ -161,8 +161,11 @@ get_asn1obj(ASN1_OBJECT *obj) 
     | 
|
| 
       161 
161 
     | 
    
         
             
                    ret = rb_str_new2(OBJ_nid2sn(nid));
         
     | 
| 
       162 
162 
     | 
    
         
             
                else{
         
     | 
| 
       163 
163 
     | 
    
         
             
                    if (!(out = BIO_new(BIO_s_mem())))
         
     | 
| 
       164 
     | 
    
         
            -
                        ossl_raise( 
     | 
| 
       165 
     | 
    
         
            -
                    i2a_ASN1_OBJECT(out, obj) 
     | 
| 
      
 164 
     | 
    
         
            +
                        ossl_raise(eTimestampError, "BIO_new(BIO_s_mem())");
         
     | 
| 
      
 165 
     | 
    
         
            +
                    if (i2a_ASN1_OBJECT(out, obj) <= 0) {
         
     | 
| 
      
 166 
     | 
    
         
            +
                        BIO_free(out);
         
     | 
| 
      
 167 
     | 
    
         
            +
                        ossl_raise(eTimestampError, "i2a_ASN1_OBJECT");
         
     | 
| 
      
 168 
     | 
    
         
            +
                    }
         
     | 
| 
       166 
169 
     | 
    
         
             
                    ret = ossl_membio2str(out);
         
     | 
| 
       167 
170 
     | 
    
         
             
                }
         
     | 
| 
       168 
171 
     | 
    
         | 
| 
         @@ -503,6 +506,25 @@ ossl_ts_req_to_der(VALUE self) 
     | 
|
| 
       503 
506 
     | 
    
         
             
                return asn1_to_der((void *)req, (int (*)(void *, unsigned char **))i2d_TS_REQ);
         
     | 
| 
       504 
507 
     | 
    
         
             
            }
         
     | 
| 
       505 
508 
     | 
    
         | 
| 
      
 509 
     | 
    
         
            +
            static VALUE
         
     | 
| 
      
 510 
     | 
    
         
            +
            ossl_ts_req_to_text(VALUE self)
         
     | 
| 
      
 511 
     | 
    
         
            +
            {
         
     | 
| 
      
 512 
     | 
    
         
            +
                TS_REQ *req;
         
     | 
| 
      
 513 
     | 
    
         
            +
                BIO *out;
         
     | 
| 
      
 514 
     | 
    
         
            +
             
     | 
| 
      
 515 
     | 
    
         
            +
                GetTSRequest(self, req);
         
     | 
| 
      
 516 
     | 
    
         
            +
             
     | 
| 
      
 517 
     | 
    
         
            +
                out = BIO_new(BIO_s_mem());
         
     | 
| 
      
 518 
     | 
    
         
            +
                if (!out) ossl_raise(eTimestampError, NULL);
         
     | 
| 
      
 519 
     | 
    
         
            +
             
     | 
| 
      
 520 
     | 
    
         
            +
                if (!TS_REQ_print_bio(out, req)) {
         
     | 
| 
      
 521 
     | 
    
         
            +
                    BIO_free(out);
         
     | 
| 
      
 522 
     | 
    
         
            +
                    ossl_raise(eTimestampError, NULL);
         
     | 
| 
      
 523 
     | 
    
         
            +
                }
         
     | 
| 
      
 524 
     | 
    
         
            +
             
     | 
| 
      
 525 
     | 
    
         
            +
                return ossl_membio2str(out);
         
     | 
| 
      
 526 
     | 
    
         
            +
            }
         
     | 
| 
      
 527 
     | 
    
         
            +
             
     | 
| 
       506 
528 
     | 
    
         
             
            static VALUE
         
     | 
| 
       507 
529 
     | 
    
         
             
            ossl_ts_resp_alloc(VALUE klass)
         
     | 
| 
       508 
530 
     | 
    
         
             
            {
         
     | 
| 
         @@ -672,21 +694,12 @@ static VALUE 
     | 
|
| 
       672 
694 
     | 
    
         
             
            ossl_ts_resp_get_token(VALUE self)
         
     | 
| 
       673 
695 
     | 
    
         
             
            {
         
     | 
| 
       674 
696 
     | 
    
         
             
                TS_RESP *resp;
         
     | 
| 
       675 
     | 
    
         
            -
                PKCS7 *p7 
     | 
| 
       676 
     | 
    
         
            -
                VALUE obj;
         
     | 
| 
      
 697 
     | 
    
         
            +
                PKCS7 *p7;
         
     | 
| 
       677 
698 
     | 
    
         | 
| 
       678 
699 
     | 
    
         
             
                GetTSResponse(self, resp);
         
     | 
| 
       679 
700 
     | 
    
         
             
                if (!(p7 = TS_RESP_get_token(resp)))
         
     | 
| 
       680 
701 
     | 
    
         
             
                    return Qnil;
         
     | 
| 
       681 
     | 
    
         
            -
             
     | 
| 
       682 
     | 
    
         
            -
                obj = NewPKCS7(cPKCS7);
         
     | 
| 
       683 
     | 
    
         
            -
             
     | 
| 
       684 
     | 
    
         
            -
                if (!(copy = PKCS7_dup(p7)))
         
     | 
| 
       685 
     | 
    
         
            -
                    ossl_raise(eTimestampError, NULL);
         
     | 
| 
       686 
     | 
    
         
            -
             
     | 
| 
       687 
     | 
    
         
            -
                SetPKCS7(obj, copy);
         
     | 
| 
       688 
     | 
    
         
            -
             
     | 
| 
       689 
     | 
    
         
            -
                return obj;
         
     | 
| 
      
 702 
     | 
    
         
            +
                return ossl_pkcs7_new(p7);
         
     | 
| 
       690 
703 
     | 
    
         
             
            }
         
     | 
| 
       691 
704 
     | 
    
         | 
| 
       692 
705 
     | 
    
         
             
            /*
         
     | 
| 
         @@ -757,6 +770,25 @@ ossl_ts_resp_to_der(VALUE self) 
     | 
|
| 
       757 
770 
     | 
    
         
             
                return asn1_to_der((void *)resp, (int (*)(void *, unsigned char **))i2d_TS_RESP);
         
     | 
| 
       758 
771 
     | 
    
         
             
            }
         
     | 
| 
       759 
772 
     | 
    
         | 
| 
      
 773 
     | 
    
         
            +
            static VALUE
         
     | 
| 
      
 774 
     | 
    
         
            +
            ossl_ts_resp_to_text(VALUE self)
         
     | 
| 
      
 775 
     | 
    
         
            +
            {
         
     | 
| 
      
 776 
     | 
    
         
            +
                TS_RESP *resp;
         
     | 
| 
      
 777 
     | 
    
         
            +
                BIO *out;
         
     | 
| 
      
 778 
     | 
    
         
            +
             
     | 
| 
      
 779 
     | 
    
         
            +
                GetTSResponse(self, resp);
         
     | 
| 
      
 780 
     | 
    
         
            +
             
     | 
| 
      
 781 
     | 
    
         
            +
                out = BIO_new(BIO_s_mem());
         
     | 
| 
      
 782 
     | 
    
         
            +
                if (!out) ossl_raise(eTimestampError, NULL);
         
     | 
| 
      
 783 
     | 
    
         
            +
             
     | 
| 
      
 784 
     | 
    
         
            +
                if (!TS_RESP_print_bio(out, resp)) {
         
     | 
| 
      
 785 
     | 
    
         
            +
                    BIO_free(out);
         
     | 
| 
      
 786 
     | 
    
         
            +
                    ossl_raise(eTimestampError, NULL);
         
     | 
| 
      
 787 
     | 
    
         
            +
                }
         
     | 
| 
      
 788 
     | 
    
         
            +
             
     | 
| 
      
 789 
     | 
    
         
            +
                return ossl_membio2str(out);
         
     | 
| 
      
 790 
     | 
    
         
            +
            }
         
     | 
| 
      
 791 
     | 
    
         
            +
             
     | 
| 
       760 
792 
     | 
    
         
             
            /*
         
     | 
| 
       761 
793 
     | 
    
         
             
             * Verifies a timestamp token by checking the signature, validating the
         
     | 
| 
       762 
794 
     | 
    
         
             
             * certificate chain implied by tsa_certificate and by checking conformance to
         
     | 
| 
         @@ -1073,6 +1105,25 @@ ossl_ts_token_info_to_der(VALUE self) 
     | 
|
| 
       1073 
1105 
     | 
    
         
             
                return asn1_to_der((void *)info, (int (*)(void *, unsigned char **))i2d_TS_TST_INFO);
         
     | 
| 
       1074 
1106 
     | 
    
         
             
            }
         
     | 
| 
       1075 
1107 
     | 
    
         | 
| 
      
 1108 
     | 
    
         
            +
            static VALUE
         
     | 
| 
      
 1109 
     | 
    
         
            +
            ossl_ts_token_info_to_text(VALUE self)
         
     | 
| 
      
 1110 
     | 
    
         
            +
            {
         
     | 
| 
      
 1111 
     | 
    
         
            +
                TS_TST_INFO *info;
         
     | 
| 
      
 1112 
     | 
    
         
            +
                BIO *out;
         
     | 
| 
      
 1113 
     | 
    
         
            +
             
     | 
| 
      
 1114 
     | 
    
         
            +
                GetTSTokenInfo(self, info);
         
     | 
| 
      
 1115 
     | 
    
         
            +
             
     | 
| 
      
 1116 
     | 
    
         
            +
                out = BIO_new(BIO_s_mem());
         
     | 
| 
      
 1117 
     | 
    
         
            +
                if (!out) ossl_raise(eTimestampError, NULL);
         
     | 
| 
      
 1118 
     | 
    
         
            +
             
     | 
| 
      
 1119 
     | 
    
         
            +
                if (!TS_TST_INFO_print_bio(out, info)) {
         
     | 
| 
      
 1120 
     | 
    
         
            +
                    BIO_free(out);
         
     | 
| 
      
 1121 
     | 
    
         
            +
                    ossl_raise(eTimestampError, NULL);
         
     | 
| 
      
 1122 
     | 
    
         
            +
                }
         
     | 
| 
      
 1123 
     | 
    
         
            +
             
     | 
| 
      
 1124 
     | 
    
         
            +
                return ossl_membio2str(out);
         
     | 
| 
      
 1125 
     | 
    
         
            +
            }
         
     | 
| 
      
 1126 
     | 
    
         
            +
             
     | 
| 
       1076 
1127 
     | 
    
         
             
            static ASN1_INTEGER *
         
     | 
| 
       1077 
1128 
     | 
    
         
             
            ossl_tsfac_serial_cb(struct TS_resp_ctx *ctx, void *data)
         
     | 
| 
       1078 
1129 
     | 
    
         
             
            {
         
     | 
| 
         @@ -1356,6 +1407,7 @@ Init_ossl_ts(void) 
     | 
|
| 
       1356 
1407 
     | 
    
         
             
                rb_define_method(cTimestampResponse, "token_info", ossl_ts_resp_get_token_info, 0);
         
     | 
| 
       1357 
1408 
     | 
    
         
             
                rb_define_method(cTimestampResponse, "tsa_certificate", ossl_ts_resp_get_tsa_certificate, 0);
         
     | 
| 
       1358 
1409 
     | 
    
         
             
                rb_define_method(cTimestampResponse, "to_der", ossl_ts_resp_to_der, 0);
         
     | 
| 
      
 1410 
     | 
    
         
            +
                rb_define_method(cTimestampResponse, "to_text", ossl_ts_resp_to_text, 0);
         
     | 
| 
       1359 
1411 
     | 
    
         
             
                rb_define_method(cTimestampResponse, "verify", ossl_ts_resp_verify, -1);
         
     | 
| 
       1360 
1412 
     | 
    
         | 
| 
       1361 
1413 
     | 
    
         
             
                /* Document-class: OpenSSL::Timestamp::TokenInfo
         
     | 
| 
         @@ -1374,6 +1426,7 @@ Init_ossl_ts(void) 
     | 
|
| 
       1374 
1426 
     | 
    
         
             
                rb_define_method(cTimestampTokenInfo, "ordering", ossl_ts_token_info_get_ordering, 0);
         
     | 
| 
       1375 
1427 
     | 
    
         
             
                rb_define_method(cTimestampTokenInfo, "nonce", ossl_ts_token_info_get_nonce, 0);
         
     | 
| 
       1376 
1428 
     | 
    
         
             
                rb_define_method(cTimestampTokenInfo, "to_der", ossl_ts_token_info_to_der, 0);
         
     | 
| 
      
 1429 
     | 
    
         
            +
                rb_define_method(cTimestampTokenInfo, "to_text", ossl_ts_token_info_to_text, 0);
         
     | 
| 
       1377 
1430 
     | 
    
         | 
| 
       1378 
1431 
     | 
    
         
             
                /* Document-class: OpenSSL::Timestamp::Request
         
     | 
| 
       1379 
1432 
     | 
    
         
             
                 * Allows to create timestamp requests or parse existing ones. A Request is
         
     | 
| 
         @@ -1399,6 +1452,7 @@ Init_ossl_ts(void) 
     | 
|
| 
       1399 
1452 
     | 
    
         
             
                rb_define_method(cTimestampRequest, "cert_requested=", ossl_ts_req_set_cert_requested, 1);
         
     | 
| 
       1400 
1453 
     | 
    
         
             
                rb_define_method(cTimestampRequest, "cert_requested?", ossl_ts_req_get_cert_requested, 0);
         
     | 
| 
       1401 
1454 
     | 
    
         
             
                rb_define_method(cTimestampRequest, "to_der", ossl_ts_req_to_der, 0);
         
     | 
| 
      
 1455 
     | 
    
         
            +
                rb_define_method(cTimestampRequest, "to_text", ossl_ts_req_to_text, 0);
         
     | 
| 
       1402 
1456 
     | 
    
         | 
| 
       1403 
1457 
     | 
    
         
             
                /*
         
     | 
| 
       1404 
1458 
     | 
    
         
             
                 * Indicates a successful response. Equal to +0+.
         
     | 
| 
         @@ -1535,5 +1589,9 @@ Init_ossl_ts(void) 
     | 
|
| 
       1535 
1589 
     | 
    
         
             
                rb_attr(cTimestampFactory, rb_intern_const("additional_certs"), 1, 1, 0);
         
     | 
| 
       1536 
1590 
     | 
    
         
             
                rb_define_method(cTimestampFactory, "create_timestamp", ossl_tsfac_create_ts, 3);
         
     | 
| 
       1537 
1591 
     | 
    
         
             
            }
         
     | 
| 
       1538 
     | 
    
         
            -
             
     | 
| 
      
 1592 
     | 
    
         
            +
            #else /* OPENSSL_NO_TS */
         
     | 
| 
      
 1593 
     | 
    
         
            +
            void
         
     | 
| 
      
 1594 
     | 
    
         
            +
            Init_ossl_ts(void)
         
     | 
| 
      
 1595 
     | 
    
         
            +
            {
         
     | 
| 
      
 1596 
     | 
    
         
            +
            }
         
     | 
| 
       1539 
1597 
     | 
    
         
             
            #endif
         
     | 
    
        data/ext/openssl/ossl_ts.h
    CHANGED
    
    
    
        data/ext/openssl/ossl_x509.c
    CHANGED
    
    
    
        data/ext/openssl/ossl_x509.h
    CHANGED
    
    | 
         @@ -5,7 +5,7 @@ 
     | 
|
| 
       5 
5 
     | 
    
         
             
             */
         
     | 
| 
       6 
6 
     | 
    
         
             
            /*
         
     | 
| 
       7 
7 
     | 
    
         
             
             * This program is licensed under the same licence as Ruby.
         
     | 
| 
       8 
     | 
    
         
            -
             * (See the file ' 
     | 
| 
      
 8 
     | 
    
         
            +
             * (See the file 'COPYING'.)
         
     | 
| 
       9 
9 
     | 
    
         
             
             */
         
     | 
| 
       10 
10 
     | 
    
         
             
            #if !defined(_OSSL_X509_H_)
         
     | 
| 
       11 
11 
     | 
    
         
             
            #define _OSSL_X509_H_
         
     | 
| 
         @@ -28,7 +28,6 @@ void Init_ossl_x509(void); 
     | 
|
| 
       28 
28 
     | 
    
         
             
             * X509Attr
         
     | 
| 
       29 
29 
     | 
    
         
             
             */
         
     | 
| 
       30 
30 
     | 
    
         
             
            extern VALUE cX509Attr;
         
     | 
| 
       31 
     | 
    
         
            -
            extern VALUE eX509AttrError;
         
     | 
| 
       32 
31 
     | 
    
         | 
| 
       33 
32 
     | 
    
         
             
            VALUE ossl_x509attr_new(X509_ATTRIBUTE *);
         
     | 
| 
       34 
33 
     | 
    
         
             
            X509_ATTRIBUTE *GetX509AttrPtr(VALUE);
         
     | 
| 
         @@ -38,7 +37,6 @@ void Init_ossl_x509attr(void); 
     | 
|
| 
       38 
37 
     | 
    
         
             
             * X509Cert
         
     | 
| 
       39 
38 
     | 
    
         
             
             */
         
     | 
| 
       40 
39 
     | 
    
         
             
            extern VALUE cX509Cert;
         
     | 
| 
       41 
     | 
    
         
            -
            extern VALUE eX509CertError;
         
     | 
| 
       42 
40 
     | 
    
         | 
| 
       43 
41 
     | 
    
         
             
            VALUE ossl_x509_new(X509 *);
         
     | 
| 
       44 
42 
     | 
    
         
             
            X509 *GetX509CertPtr(VALUE);
         
     | 
| 
         @@ -48,9 +46,6 @@ void Init_ossl_x509cert(void); 
     | 
|
| 
       48 
46 
     | 
    
         
             
            /*
         
     | 
| 
       49 
47 
     | 
    
         
             
             * X509CRL
         
     | 
| 
       50 
48 
     | 
    
         
             
             */
         
     | 
| 
       51 
     | 
    
         
            -
            extern VALUE cX509CRL;
         
     | 
| 
       52 
     | 
    
         
            -
            extern VALUE eX509CRLError;
         
     | 
| 
       53 
     | 
    
         
            -
             
     | 
| 
       54 
49 
     | 
    
         
             
            VALUE ossl_x509crl_new(X509_CRL *);
         
     | 
| 
       55 
50 
     | 
    
         
             
            X509_CRL *GetX509CRLPtr(VALUE);
         
     | 
| 
       56 
51 
     | 
    
         
             
            void Init_ossl_x509crl(void);
         
     | 
| 
         @@ -59,8 +54,6 @@ void Init_ossl_x509crl(void); 
     | 
|
| 
       59 
54 
     | 
    
         
             
             * X509Extension
         
     | 
| 
       60 
55 
     | 
    
         
             
             */
         
     | 
| 
       61 
56 
     | 
    
         
             
            extern VALUE cX509Ext;
         
     | 
| 
       62 
     | 
    
         
            -
            extern VALUE cX509ExtFactory;
         
     | 
| 
       63 
     | 
    
         
            -
            extern VALUE eX509ExtError;
         
     | 
| 
       64 
57 
     | 
    
         | 
| 
       65 
58 
     | 
    
         
             
            VALUE ossl_x509ext_new(X509_EXTENSION *);
         
     | 
| 
       66 
59 
     | 
    
         
             
            X509_EXTENSION *GetX509ExtPtr(VALUE);
         
     | 
| 
         @@ -69,9 +62,6 @@ void Init_ossl_x509ext(void); 
     | 
|
| 
       69 
62 
     | 
    
         
             
            /*
         
     | 
| 
       70 
63 
     | 
    
         
             
             * X509Name
         
     | 
| 
       71 
64 
     | 
    
         
             
             */
         
     | 
| 
       72 
     | 
    
         
            -
            extern VALUE cX509Name;
         
     | 
| 
       73 
     | 
    
         
            -
            extern VALUE eX509NameError;
         
     | 
| 
       74 
     | 
    
         
            -
             
     | 
| 
       75 
65 
     | 
    
         
             
            VALUE ossl_x509name_new(X509_NAME *);
         
     | 
| 
       76 
66 
     | 
    
         
             
            X509_NAME *GetX509NamePtr(VALUE);
         
     | 
| 
       77 
67 
     | 
    
         
             
            void Init_ossl_x509name(void);
         
     | 
| 
         @@ -79,9 +69,6 @@ void Init_ossl_x509name(void); 
     | 
|
| 
       79 
69 
     | 
    
         
             
            /*
         
     | 
| 
       80 
70 
     | 
    
         
             
             * X509Request
         
     | 
| 
       81 
71 
     | 
    
         
             
             */
         
     | 
| 
       82 
     | 
    
         
            -
            extern VALUE cX509Req;
         
     | 
| 
       83 
     | 
    
         
            -
            extern VALUE eX509ReqError;
         
     | 
| 
       84 
     | 
    
         
            -
             
     | 
| 
       85 
72 
     | 
    
         
             
            X509_REQ *GetX509ReqPtr(VALUE);
         
     | 
| 
       86 
73 
     | 
    
         
             
            void Init_ossl_x509req(void);
         
     | 
| 
       87 
74 
     | 
    
         | 
| 
         @@ -89,7 +76,6 @@ void Init_ossl_x509req(void); 
     | 
|
| 
       89 
76 
     | 
    
         
             
             * X509Revoked
         
     | 
| 
       90 
77 
     | 
    
         
             
             */
         
     | 
| 
       91 
78 
     | 
    
         
             
            extern VALUE cX509Rev;
         
     | 
| 
       92 
     | 
    
         
            -
            extern VALUE eX509RevError;
         
     | 
| 
       93 
79 
     | 
    
         | 
| 
       94 
80 
     | 
    
         
             
            VALUE ossl_x509revoked_new(X509_REVOKED *);
         
     | 
| 
       95 
81 
     | 
    
         
             
            X509_REVOKED *DupX509RevokedPtr(VALUE);
         
     | 
| 
         @@ -98,12 +84,7 @@ void Init_ossl_x509revoked(void); 
     | 
|
| 
       98 
84 
     | 
    
         
             
            /*
         
     | 
| 
       99 
85 
     | 
    
         
             
             * X509Store and X509StoreContext
         
     | 
| 
       100 
86 
     | 
    
         
             
             */
         
     | 
| 
       101 
     | 
    
         
            -
            extern VALUE cX509Store;
         
     | 
| 
       102 
     | 
    
         
            -
            extern VALUE cX509StoreContext;
         
     | 
| 
       103 
     | 
    
         
            -
            extern VALUE eX509StoreError;
         
     | 
| 
       104 
     | 
    
         
            -
             
     | 
| 
       105 
87 
     | 
    
         
             
            X509_STORE *GetX509StorePtr(VALUE);
         
     | 
| 
       106 
     | 
    
         
            -
             
     | 
| 
       107 
88 
     | 
    
         
             
            void Init_ossl_x509store(void);
         
     | 
| 
       108 
89 
     | 
    
         | 
| 
       109 
90 
     | 
    
         
             
            /*
         
     | 
    
        data/ext/openssl/ossl_x509attr.c
    CHANGED
    
    | 
         @@ -5,7 +5,7 @@ 
     | 
|
| 
       5 
5 
     | 
    
         
             
             */
         
     | 
| 
       6 
6 
     | 
    
         
             
            /*
         
     | 
| 
       7 
7 
     | 
    
         
             
             * This program is licensed under the same licence as Ruby.
         
     | 
| 
       8 
     | 
    
         
            -
             * (See the file ' 
     | 
| 
      
 8 
     | 
    
         
            +
             * (See the file 'COPYING'.)
         
     | 
| 
       9 
9 
     | 
    
         
             
             */
         
     | 
| 
       10 
10 
     | 
    
         
             
            #include "ossl.h"
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
         @@ -28,7 +28,7 @@ 
     | 
|
| 
       28 
28 
     | 
    
         
             
             * Classes
         
     | 
| 
       29 
29 
     | 
    
         
             
             */
         
     | 
| 
       30 
30 
     | 
    
         
             
            VALUE cX509Attr;
         
     | 
| 
       31 
     | 
    
         
            -
            VALUE eX509AttrError;
         
     | 
| 
      
 31 
     | 
    
         
            +
            static VALUE eX509AttrError;
         
     | 
| 
       32 
32 
     | 
    
         | 
| 
       33 
33 
     | 
    
         
             
            static void
         
     | 
| 
       34 
34 
     | 
    
         
             
            ossl_x509attr_free(void *ptr)
         
     | 
| 
         @@ -201,37 +201,36 @@ static VALUE 
     | 
|
| 
       201 
201 
     | 
    
         
             
            ossl_x509attr_set_value(VALUE self, VALUE value)
         
     | 
| 
       202 
202 
     | 
    
         
             
            {
         
     | 
| 
       203 
203 
     | 
    
         
             
                X509_ATTRIBUTE *attr;
         
     | 
| 
       204 
     | 
    
         
            -
                 
     | 
| 
       205 
     | 
    
         
            -
                int i, asn1_tag;
         
     | 
| 
      
 204 
     | 
    
         
            +
                GetX509Attr(self, attr);
         
     | 
| 
       206 
205 
     | 
    
         | 
| 
       207 
206 
     | 
    
         
             
                OSSL_Check_Kind(value, cASN1Data);
         
     | 
| 
       208 
     | 
    
         
            -
                 
     | 
| 
       209 
     | 
    
         
            -
                 
     | 
| 
       210 
     | 
    
         
            -
                 
     | 
| 
       211 
     | 
    
         
            -
             
     | 
| 
       212 
     | 
    
         
            -
             
     | 
| 
       213 
     | 
    
         
            -
            	ossl_raise(eASN1Error, "ASN1::Set has non-array value");
         
     | 
| 
      
 207 
     | 
    
         
            +
                VALUE der = ossl_to_der(value);
         
     | 
| 
      
 208 
     | 
    
         
            +
                const unsigned char *p = (const unsigned char *)RSTRING_PTR(der);
         
     | 
| 
      
 209 
     | 
    
         
            +
                STACK_OF(ASN1_TYPE) *sk = d2i_ASN1_SET_ANY(NULL, &p, RSTRING_LEN(der));
         
     | 
| 
      
 210 
     | 
    
         
            +
                if (!sk)
         
     | 
| 
      
 211 
     | 
    
         
            +
                    ossl_raise(eX509AttrError, "attribute value must be ASN1::Set");
         
     | 
| 
       214 
212 
     | 
    
         | 
| 
       215 
     | 
    
         
            -
                GetX509Attr(self, attr);
         
     | 
| 
       216 
213 
     | 
    
         
             
                if (X509_ATTRIBUTE_count(attr)) { /* populated, reset first */
         
     | 
| 
       217 
     | 
    
         
            -
             
     | 
| 
       218 
     | 
    
         
            -
             
     | 
| 
       219 
     | 
    
         
            -
             
     | 
| 
       220 
     | 
    
         
            -
             
     | 
| 
       221 
     | 
    
         
            -
             
     | 
| 
       222 
     | 
    
         
            -
             
     | 
| 
       223 
     | 
    
         
            -
             
     | 
| 
      
 214 
     | 
    
         
            +
                    ASN1_OBJECT *obj = X509_ATTRIBUTE_get0_object(attr);
         
     | 
| 
      
 215 
     | 
    
         
            +
                    X509_ATTRIBUTE *new_attr = X509_ATTRIBUTE_create_by_OBJ(NULL, obj, 0, NULL, -1);
         
     | 
| 
      
 216 
     | 
    
         
            +
                    if (!new_attr) {
         
     | 
| 
      
 217 
     | 
    
         
            +
                        sk_ASN1_TYPE_pop_free(sk, ASN1_TYPE_free);
         
     | 
| 
      
 218 
     | 
    
         
            +
                        ossl_raise(eX509AttrError, "X509_ATTRIBUTE_create_by_OBJ");
         
     | 
| 
      
 219 
     | 
    
         
            +
                    }
         
     | 
| 
      
 220 
     | 
    
         
            +
                    SetX509Attr(self, new_attr);
         
     | 
| 
      
 221 
     | 
    
         
            +
                    X509_ATTRIBUTE_free(attr);
         
     | 
| 
      
 222 
     | 
    
         
            +
                    attr = new_attr;
         
     | 
| 
       224 
223 
     | 
    
         
             
                }
         
     | 
| 
       225 
224 
     | 
    
         | 
| 
       226 
     | 
    
         
            -
                for (i = 0; i <  
     | 
| 
       227 
     | 
    
         
            -
             
     | 
| 
       228 
     | 
    
         
            -
             
     | 
| 
       229 
     | 
    
         
            -
             
     | 
| 
       230 
     | 
    
         
            -
             
     | 
| 
       231 
     | 
    
         
            -
             
     | 
| 
       232 
     | 
    
         
            -
             
     | 
| 
       233 
     | 
    
         
            -
            	ASN1_TYPE_free(a1type);
         
     | 
| 
      
 225 
     | 
    
         
            +
                for (int i = 0; i < sk_ASN1_TYPE_num(sk); i++) {
         
     | 
| 
      
 226 
     | 
    
         
            +
                    ASN1_TYPE *a1type = sk_ASN1_TYPE_value(sk, i);
         
     | 
| 
      
 227 
     | 
    
         
            +
                    if (!X509_ATTRIBUTE_set1_data(attr, ASN1_TYPE_get(a1type),
         
     | 
| 
      
 228 
     | 
    
         
            +
                                                  a1type->value.ptr, -1)) {
         
     | 
| 
      
 229 
     | 
    
         
            +
                        sk_ASN1_TYPE_pop_free(sk, ASN1_TYPE_free);
         
     | 
| 
      
 230 
     | 
    
         
            +
                        ossl_raise(eX509AttrError, "X509_ATTRIBUTE_set1_data");
         
     | 
| 
      
 231 
     | 
    
         
            +
                    }
         
     | 
| 
       234 
232 
     | 
    
         
             
                }
         
     | 
| 
      
 233 
     | 
    
         
            +
                sk_ASN1_TYPE_pop_free(sk, ASN1_TYPE_free);
         
     | 
| 
       235 
234 
     | 
    
         | 
| 
       236 
235 
     | 
    
         
             
                return value;
         
     | 
| 
       237 
236 
     | 
    
         
             
            }
         
     | 
    
        data/ext/openssl/ossl_x509cert.c
    CHANGED
    
    | 
         @@ -5,7 +5,7 @@ 
     | 
|
| 
       5 
5 
     | 
    
         
             
             */
         
     | 
| 
       6 
6 
     | 
    
         
             
            /*
         
     | 
| 
       7 
7 
     | 
    
         
             
             * This program is licensed under the same licence as Ruby.
         
     | 
| 
       8 
     | 
    
         
            -
             * (See the file ' 
     | 
| 
      
 8 
     | 
    
         
            +
             * (See the file 'COPYING'.)
         
     | 
| 
       9 
9 
     | 
    
         
             
             */
         
     | 
| 
       10 
10 
     | 
    
         
             
            #include "ossl.h"
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
         @@ -28,7 +28,7 @@ 
     | 
|
| 
       28 
28 
     | 
    
         
             
             * Classes
         
     | 
| 
       29 
29 
     | 
    
         
             
             */
         
     | 
| 
       30 
30 
     | 
    
         
             
            VALUE cX509Cert;
         
     | 
| 
       31 
     | 
    
         
            -
            VALUE eX509CertError;
         
     | 
| 
      
 31 
     | 
    
         
            +
            static VALUE eX509CertError;
         
     | 
| 
       32 
32 
     | 
    
         | 
| 
       33 
33 
     | 
    
         
             
            static void
         
     | 
| 
       34 
34 
     | 
    
         
             
            ossl_x509_free(void *ptr)
         
     | 
| 
         @@ -539,7 +539,11 @@ ossl_x509_sign(VALUE self, VALUE key, VALUE digest) 
     | 
|
| 
       539 
539 
     | 
    
         
             
                const EVP_MD *md;
         
     | 
| 
       540 
540 
     | 
    
         | 
| 
       541 
541 
     | 
    
         
             
                pkey = GetPrivPKeyPtr(key); /* NO NEED TO DUP */
         
     | 
| 
       542 
     | 
    
         
            -
                 
     | 
| 
      
 542 
     | 
    
         
            +
                if (NIL_P(digest)) {
         
     | 
| 
      
 543 
     | 
    
         
            +
                    md = NULL; /* needed for some key types, e.g. Ed25519 */
         
     | 
| 
      
 544 
     | 
    
         
            +
                } else {
         
     | 
| 
      
 545 
     | 
    
         
            +
                    md = ossl_evp_get_digestbyname(digest);
         
     | 
| 
      
 546 
     | 
    
         
            +
                }
         
     | 
| 
       543 
547 
     | 
    
         
             
                GetX509(self, x509);
         
     | 
| 
       544 
548 
     | 
    
         
             
                if (!X509_sign(x509, pkey, md)) {
         
     | 
| 
       545 
549 
     | 
    
         
             
            	ossl_raise(eX509CertError, NULL);
         
     | 
| 
         @@ -707,6 +711,38 @@ ossl_x509_eq(VALUE self, VALUE other) 
     | 
|
| 
       707 
711 
     | 
    
         
             
                return !X509_cmp(a, b) ? Qtrue : Qfalse;
         
     | 
| 
       708 
712 
     | 
    
         
             
            }
         
     | 
| 
       709 
713 
     | 
    
         | 
| 
      
 714 
     | 
    
         
            +
            #ifdef HAVE_I2D_RE_X509_TBS
         
     | 
| 
      
 715 
     | 
    
         
            +
            /*
         
     | 
| 
      
 716 
     | 
    
         
            +
             * call-seq:
         
     | 
| 
      
 717 
     | 
    
         
            +
             *    cert.tbs_bytes => string
         
     | 
| 
      
 718 
     | 
    
         
            +
             *
         
     | 
| 
      
 719 
     | 
    
         
            +
             * Returns the DER-encoded bytes of the certificate's to be signed certificate.
         
     | 
| 
      
 720 
     | 
    
         
            +
             * This is mainly useful for validating embedded certificate transparency signatures.
         
     | 
| 
      
 721 
     | 
    
         
            +
             */
         
     | 
| 
      
 722 
     | 
    
         
            +
            static VALUE
         
     | 
| 
      
 723 
     | 
    
         
            +
            ossl_x509_tbs_bytes(VALUE self)
         
     | 
| 
      
 724 
     | 
    
         
            +
            {
         
     | 
| 
      
 725 
     | 
    
         
            +
                X509 *x509;
         
     | 
| 
      
 726 
     | 
    
         
            +
                int len;
         
     | 
| 
      
 727 
     | 
    
         
            +
                unsigned char *p0;
         
     | 
| 
      
 728 
     | 
    
         
            +
                VALUE str;
         
     | 
| 
      
 729 
     | 
    
         
            +
             
     | 
| 
      
 730 
     | 
    
         
            +
                GetX509(self, x509);
         
     | 
| 
      
 731 
     | 
    
         
            +
                len = i2d_re_X509_tbs(x509, NULL);
         
     | 
| 
      
 732 
     | 
    
         
            +
                if (len <= 0) {
         
     | 
| 
      
 733 
     | 
    
         
            +
                    ossl_raise(eX509CertError, "i2d_re_X509_tbs");
         
     | 
| 
      
 734 
     | 
    
         
            +
                }
         
     | 
| 
      
 735 
     | 
    
         
            +
                str = rb_str_new(NULL, len);
         
     | 
| 
      
 736 
     | 
    
         
            +
                p0 = (unsigned char *)RSTRING_PTR(str);
         
     | 
| 
      
 737 
     | 
    
         
            +
                if (i2d_re_X509_tbs(x509, &p0) <= 0) {
         
     | 
| 
      
 738 
     | 
    
         
            +
                    ossl_raise(eX509CertError, "i2d_re_X509_tbs");
         
     | 
| 
      
 739 
     | 
    
         
            +
                }
         
     | 
| 
      
 740 
     | 
    
         
            +
                ossl_str_adjust(str, p0);
         
     | 
| 
      
 741 
     | 
    
         
            +
             
     | 
| 
      
 742 
     | 
    
         
            +
                return str;
         
     | 
| 
      
 743 
     | 
    
         
            +
            }
         
     | 
| 
      
 744 
     | 
    
         
            +
            #endif
         
     | 
| 
      
 745 
     | 
    
         
            +
             
     | 
| 
       710 
746 
     | 
    
         
             
            struct load_chained_certificates_arguments {
         
     | 
| 
       711 
747 
     | 
    
         
             
                VALUE certificates;
         
     | 
| 
       712 
748 
     | 
    
         
             
                X509 *certificate;
         
     | 
| 
         @@ -999,4 +1035,7 @@ Init_ossl_x509cert(void) 
     | 
|
| 
       999 
1035 
     | 
    
         
             
                rb_define_method(cX509Cert, "add_extension", ossl_x509_add_extension, 1);
         
     | 
| 
       1000 
1036 
     | 
    
         
             
                rb_define_method(cX509Cert, "inspect", ossl_x509_inspect, 0);
         
     | 
| 
       1001 
1037 
     | 
    
         
             
                rb_define_method(cX509Cert, "==", ossl_x509_eq, 1);
         
     | 
| 
      
 1038 
     | 
    
         
            +
            #ifdef HAVE_I2D_RE_X509_TBS
         
     | 
| 
      
 1039 
     | 
    
         
            +
                rb_define_method(cX509Cert, "tbs_bytes", ossl_x509_tbs_bytes, 0);
         
     | 
| 
      
 1040 
     | 
    
         
            +
            #endif
         
     | 
| 
       1002 
1041 
     | 
    
         
             
            }
         
     | 
    
        data/ext/openssl/ossl_x509crl.c
    CHANGED
    
    | 
         @@ -5,7 +5,7 @@ 
     | 
|
| 
       5 
5 
     | 
    
         
             
             */
         
     | 
| 
       6 
6 
     | 
    
         
             
            /*
         
     | 
| 
       7 
7 
     | 
    
         
             
             * This program is licensed under the same licence as Ruby.
         
     | 
| 
       8 
     | 
    
         
            -
             * (See the file ' 
     | 
| 
      
 8 
     | 
    
         
            +
             * (See the file 'COPYING'.)
         
     | 
| 
       9 
9 
     | 
    
         
             
             */
         
     | 
| 
       10 
10 
     | 
    
         
             
            #include "ossl.h"
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
         @@ -27,8 +27,8 @@ 
     | 
|
| 
       27 
27 
     | 
    
         
             
            /*
         
     | 
| 
       28 
28 
     | 
    
         
             
             * Classes
         
     | 
| 
       29 
29 
     | 
    
         
             
             */
         
     | 
| 
       30 
     | 
    
         
            -
            VALUE cX509CRL;
         
     | 
| 
       31 
     | 
    
         
            -
            VALUE eX509CRLError;
         
     | 
| 
      
 30 
     | 
    
         
            +
            static VALUE cX509CRL;
         
     | 
| 
      
 31 
     | 
    
         
            +
            static VALUE eX509CRLError;
         
     | 
| 
       32 
32 
     | 
    
         | 
| 
       33 
33 
     | 
    
         
             
            static void
         
     | 
| 
       34 
34 
     | 
    
         
             
            ossl_x509crl_free(void *ptr)
         
     | 
| 
         @@ -350,7 +350,11 @@ ossl_x509crl_sign(VALUE self, VALUE key, VALUE digest) 
     | 
|
| 
       350 
350 
     | 
    
         | 
| 
       351 
351 
     | 
    
         
             
                GetX509CRL(self, crl);
         
     | 
| 
       352 
352 
     | 
    
         
             
                pkey = GetPrivPKeyPtr(key); /* NO NEED TO DUP */
         
     | 
| 
       353 
     | 
    
         
            -
                 
     | 
| 
      
 353 
     | 
    
         
            +
                if (NIL_P(digest)) {
         
     | 
| 
      
 354 
     | 
    
         
            +
            	md = NULL; /* needed for some key types, e.g. Ed25519 */
         
     | 
| 
      
 355 
     | 
    
         
            +
                } else {
         
     | 
| 
      
 356 
     | 
    
         
            +
            	md = ossl_evp_get_digestbyname(digest);
         
     | 
| 
      
 357 
     | 
    
         
            +
                }
         
     | 
| 
       354 
358 
     | 
    
         
             
                if (!X509_CRL_sign(crl, pkey, md)) {
         
     | 
| 
       355 
359 
     | 
    
         
             
            	ossl_raise(eX509CRLError, NULL);
         
     | 
| 
       356 
360 
     | 
    
         
             
                }
         
     | 
    
        data/ext/openssl/ossl_x509ext.c
    CHANGED
    
    | 
         @@ -5,7 +5,7 @@ 
     | 
|
| 
       5 
5 
     | 
    
         
             
             */
         
     | 
| 
       6 
6 
     | 
    
         
             
            /*
         
     | 
| 
       7 
7 
     | 
    
         
             
             * This program is licensed under the same licence as Ruby.
         
     | 
| 
       8 
     | 
    
         
            -
             * (See the file ' 
     | 
| 
      
 8 
     | 
    
         
            +
             * (See the file 'COPYING'.)
         
     | 
| 
       9 
9 
     | 
    
         
             
             */
         
     | 
| 
       10 
10 
     | 
    
         
             
            #include "ossl.h"
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
         @@ -41,8 +41,8 @@ 
     | 
|
| 
       41 
41 
     | 
    
         
             
             * Classes
         
     | 
| 
       42 
42 
     | 
    
         
             
             */
         
     | 
| 
       43 
43 
     | 
    
         
             
            VALUE cX509Ext;
         
     | 
| 
       44 
     | 
    
         
            -
            VALUE cX509ExtFactory;
         
     | 
| 
       45 
     | 
    
         
            -
            VALUE eX509ExtError;
         
     | 
| 
      
 44 
     | 
    
         
            +
            static VALUE cX509ExtFactory;
         
     | 
| 
      
 45 
     | 
    
         
            +
            static VALUE eX509ExtError;
         
     | 
| 
       46 
46 
     | 
    
         | 
| 
       47 
47 
     | 
    
         
             
            static void
         
     | 
| 
       48 
48 
     | 
    
         
             
            ossl_x509ext_free(void *ptr)
         
     | 
    
        data/ext/openssl/ossl_x509name.c
    CHANGED
    
    | 
         @@ -5,7 +5,7 @@ 
     | 
|
| 
       5 
5 
     | 
    
         
             
             */
         
     | 
| 
       6 
6 
     | 
    
         
             
            /*
         
     | 
| 
       7 
7 
     | 
    
         
             
             * This program is licensed under the same licence as Ruby.
         
     | 
| 
       8 
     | 
    
         
            -
             * (See the file ' 
     | 
| 
      
 8 
     | 
    
         
            +
             * (See the file 'COPYING'.)
         
     | 
| 
       9 
9 
     | 
    
         
             
             */
         
     | 
| 
       10 
10 
     | 
    
         
             
            #include "ossl.h"
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
         @@ -32,8 +32,8 @@ 
     | 
|
| 
       32 
32 
     | 
    
         
             
            /*
         
     | 
| 
       33 
33 
     | 
    
         
             
             * Classes
         
     | 
| 
       34 
34 
     | 
    
         
             
             */
         
     | 
| 
       35 
     | 
    
         
            -
            VALUE cX509Name;
         
     | 
| 
       36 
     | 
    
         
            -
            VALUE eX509NameError;
         
     | 
| 
      
 35 
     | 
    
         
            +
            static VALUE cX509Name;
         
     | 
| 
      
 36 
     | 
    
         
            +
            static VALUE eX509NameError;
         
     | 
| 
       37 
37 
     | 
    
         | 
| 
       38 
38 
     | 
    
         
             
            static void
         
     | 
| 
       39 
39 
     | 
    
         
             
            ossl_x509name_free(void *ptr)
         
     | 
    
        data/ext/openssl/ossl_x509req.c
    CHANGED
    
    | 
         @@ -5,7 +5,7 @@ 
     | 
|
| 
       5 
5 
     | 
    
         
             
             */
         
     | 
| 
       6 
6 
     | 
    
         
             
            /*
         
     | 
| 
       7 
7 
     | 
    
         
             
             * This program is licensed under the same licence as Ruby.
         
     | 
| 
       8 
     | 
    
         
            -
             * (See the file ' 
     | 
| 
      
 8 
     | 
    
         
            +
             * (See the file 'COPYING'.)
         
     | 
| 
       9 
9 
     | 
    
         
             
             */
         
     | 
| 
       10 
10 
     | 
    
         
             
            #include "ossl.h"
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
         @@ -27,8 +27,8 @@ 
     | 
|
| 
       27 
27 
     | 
    
         
             
            /*
         
     | 
| 
       28 
28 
     | 
    
         
             
             * Classes
         
     | 
| 
       29 
29 
     | 
    
         
             
             */
         
     | 
| 
       30 
     | 
    
         
            -
            VALUE cX509Req;
         
     | 
| 
       31 
     | 
    
         
            -
            VALUE eX509ReqError;
         
     | 
| 
      
 30 
     | 
    
         
            +
            static VALUE cX509Req;
         
     | 
| 
      
 31 
     | 
    
         
            +
            static VALUE eX509ReqError;
         
     | 
| 
       32 
32 
     | 
    
         | 
| 
       33 
33 
     | 
    
         
             
            static void
         
     | 
| 
       34 
34 
     | 
    
         
             
            ossl_x509req_free(void *ptr)
         
     | 
| 
         @@ -312,7 +312,11 @@ ossl_x509req_sign(VALUE self, VALUE key, VALUE digest) 
     | 
|
| 
       312 
312 
     | 
    
         | 
| 
       313 
313 
     | 
    
         
             
                GetX509Req(self, req);
         
     | 
| 
       314 
314 
     | 
    
         
             
                pkey = GetPrivPKeyPtr(key); /* NO NEED TO DUP */
         
     | 
| 
       315 
     | 
    
         
            -
                 
     | 
| 
      
 315 
     | 
    
         
            +
                if (NIL_P(digest)) {
         
     | 
| 
      
 316 
     | 
    
         
            +
                    md = NULL; /* needed for some key types, e.g. Ed25519 */
         
     | 
| 
      
 317 
     | 
    
         
            +
                } else {
         
     | 
| 
      
 318 
     | 
    
         
            +
                    md = ossl_evp_get_digestbyname(digest);
         
     | 
| 
      
 319 
     | 
    
         
            +
                }
         
     | 
| 
       316 
320 
     | 
    
         
             
                if (!X509_REQ_sign(req, pkey, md)) {
         
     | 
| 
       317 
321 
     | 
    
         
             
            	ossl_raise(eX509ReqError, NULL);
         
     | 
| 
       318 
322 
     | 
    
         
             
                }
         
     | 
| 
         @@ -5,7 +5,7 @@ 
     | 
|
| 
       5 
5 
     | 
    
         
             
             */
         
     | 
| 
       6 
6 
     | 
    
         
             
            /*
         
     | 
| 
       7 
7 
     | 
    
         
             
             * This program is licensed under the same licence as Ruby.
         
     | 
| 
       8 
     | 
    
         
            -
             * (See the file ' 
     | 
| 
      
 8 
     | 
    
         
            +
             * (See the file 'COPYING'.)
         
     | 
| 
       9 
9 
     | 
    
         
             
             */
         
     | 
| 
       10 
10 
     | 
    
         
             
            #include "ossl.h"
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
         @@ -28,7 +28,7 @@ 
     | 
|
| 
       28 
28 
     | 
    
         
             
             * Classes
         
     | 
| 
       29 
29 
     | 
    
         
             
             */
         
     | 
| 
       30 
30 
     | 
    
         
             
            VALUE cX509Rev;
         
     | 
| 
       31 
     | 
    
         
            -
            VALUE eX509RevError;
         
     | 
| 
      
 31 
     | 
    
         
            +
            static VALUE eX509RevError;
         
     | 
| 
       32 
32 
     | 
    
         | 
| 
       33 
33 
     | 
    
         
             
            static void
         
     | 
| 
       34 
34 
     | 
    
         
             
            ossl_x509rev_free(void *ptr)
         
     | 
| 
         @@ -5,7 +5,7 @@ 
     | 
|
| 
       5 
5 
     | 
    
         
             
             */
         
     | 
| 
       6 
6 
     | 
    
         
             
            /*
         
     | 
| 
       7 
7 
     | 
    
         
             
             * This program is licensed under the same licence as Ruby.
         
     | 
| 
       8 
     | 
    
         
            -
             * (See the file ' 
     | 
| 
      
 8 
     | 
    
         
            +
             * (See the file 'COPYING'.)
         
     | 
| 
       9 
9 
     | 
    
         
             
             */
         
     | 
| 
       10 
10 
     | 
    
         
             
            #include "ossl.h"
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
         @@ -108,9 +108,9 @@ ossl_verify_cb_call(VALUE proc, int ok, X509_STORE_CTX *ctx) 
     | 
|
| 
       108 
108 
     | 
    
         
             
            /*
         
     | 
| 
       109 
109 
     | 
    
         
             
             * Classes
         
     | 
| 
       110 
110 
     | 
    
         
             
             */
         
     | 
| 
       111 
     | 
    
         
            -
            VALUE cX509Store;
         
     | 
| 
       112 
     | 
    
         
            -
            VALUE cX509StoreContext;
         
     | 
| 
       113 
     | 
    
         
            -
            VALUE eX509StoreError;
         
     | 
| 
      
 111 
     | 
    
         
            +
            static VALUE cX509Store;
         
     | 
| 
      
 112 
     | 
    
         
            +
            static VALUE cX509StoreContext;
         
     | 
| 
      
 113 
     | 
    
         
            +
            static VALUE eX509StoreError;
         
     | 
| 
       114 
114 
     | 
    
         | 
| 
       115 
115 
     | 
    
         
             
            static void
         
     | 
| 
       116 
116 
     | 
    
         
             
            ossl_x509store_mark(void *ptr)
         
     | 
| 
         @@ -223,7 +223,6 @@ ossl_x509store_initialize(int argc, VALUE *argv, VALUE self) 
     | 
|
| 
       223 
223 
     | 
    
         
             
                rb_iv_set(self, "@error", Qnil);
         
     | 
| 
       224 
224 
     | 
    
         
             
                rb_iv_set(self, "@error_string", Qnil);
         
     | 
| 
       225 
225 
     | 
    
         
             
                rb_iv_set(self, "@chain", Qnil);
         
     | 
| 
       226 
     | 
    
         
            -
                rb_iv_set(self, "@time", Qnil);
         
     | 
| 
       227 
226 
     | 
    
         | 
| 
       228 
227 
     | 
    
         
             
                return self;
         
     | 
| 
       229 
228 
     | 
    
         
             
            }
         
     | 
| 
         @@ -329,7 +328,16 @@ ossl_x509store_set_trust(VALUE self, VALUE trust) 
     | 
|
| 
       329 
328 
     | 
    
         
             
            static VALUE
         
     | 
| 
       330 
329 
     | 
    
         
             
            ossl_x509store_set_time(VALUE self, VALUE time)
         
     | 
| 
       331 
330 
     | 
    
         
             
            {
         
     | 
| 
       332 
     | 
    
         
            -
                 
     | 
| 
      
 331 
     | 
    
         
            +
                X509_STORE *store;
         
     | 
| 
      
 332 
     | 
    
         
            +
                X509_VERIFY_PARAM *param;
         
     | 
| 
      
 333 
     | 
    
         
            +
             
     | 
| 
      
 334 
     | 
    
         
            +
                GetX509Store(self, store);
         
     | 
| 
      
 335 
     | 
    
         
            +
            #ifdef HAVE_X509_STORE_GET0_PARAM
         
     | 
| 
      
 336 
     | 
    
         
            +
                param = X509_STORE_get0_param(store);
         
     | 
| 
      
 337 
     | 
    
         
            +
            #else
         
     | 
| 
      
 338 
     | 
    
         
            +
                param = store->param;
         
     | 
| 
      
 339 
     | 
    
         
            +
            #endif
         
     | 
| 
      
 340 
     | 
    
         
            +
                X509_VERIFY_PARAM_set_time(param, NUM2LONG(rb_Integer(time)));
         
     | 
| 
       333 
341 
     | 
    
         
             
                return time;
         
     | 
| 
       334 
342 
     | 
    
         
             
            }
         
     | 
| 
       335 
343 
     | 
    
         | 
| 
         @@ -564,7 +572,6 @@ ossl_x509stctx_new(X509_STORE_CTX *ctx) 
     | 
|
| 
       564 
572 
     | 
    
         
             
            static VALUE ossl_x509stctx_set_flags(VALUE, VALUE);
         
     | 
| 
       565 
573 
     | 
    
         
             
            static VALUE ossl_x509stctx_set_purpose(VALUE, VALUE);
         
     | 
| 
       566 
574 
     | 
    
         
             
            static VALUE ossl_x509stctx_set_trust(VALUE, VALUE);
         
     | 
| 
       567 
     | 
    
         
            -
            static VALUE ossl_x509stctx_set_time(VALUE, VALUE);
         
     | 
| 
       568 
575 
     | 
    
         | 
| 
       569 
576 
     | 
    
         
             
            /*
         
     | 
| 
       570 
577 
     | 
    
         
             
             * call-seq:
         
     | 
| 
         @@ -575,7 +582,7 @@ static VALUE ossl_x509stctx_set_time(VALUE, VALUE); 
     | 
|
| 
       575 
582 
     | 
    
         
             
            static VALUE
         
     | 
| 
       576 
583 
     | 
    
         
             
            ossl_x509stctx_initialize(int argc, VALUE *argv, VALUE self)
         
     | 
| 
       577 
584 
     | 
    
         
             
            {
         
     | 
| 
       578 
     | 
    
         
            -
                VALUE store, cert, chain 
     | 
| 
      
 585 
     | 
    
         
            +
                VALUE store, cert, chain;
         
     | 
| 
       579 
586 
     | 
    
         
             
                X509_STORE_CTX *ctx;
         
     | 
| 
       580 
587 
     | 
    
         
             
                X509_STORE *x509st;
         
     | 
| 
       581 
588 
     | 
    
         
             
                X509 *x509 = NULL;
         
     | 
| 
         @@ -599,8 +606,6 @@ ossl_x509stctx_initialize(int argc, VALUE *argv, VALUE self) 
     | 
|
| 
       599 
606 
     | 
    
         
             
                    sk_X509_pop_free(x509s, X509_free);
         
     | 
| 
       600 
607 
     | 
    
         
             
                    ossl_raise(eX509StoreError, "X509_STORE_CTX_init");
         
     | 
| 
       601 
608 
     | 
    
         
             
                }
         
     | 
| 
       602 
     | 
    
         
            -
                if (!NIL_P(t = rb_iv_get(store, "@time")))
         
     | 
| 
       603 
     | 
    
         
            -
            	ossl_x509stctx_set_time(self, t);
         
     | 
| 
       604 
609 
     | 
    
         
             
                rb_iv_set(self, "@verify_callback", rb_iv_get(store, "@verify_callback"));
         
     | 
| 
       605 
610 
     | 
    
         
             
                rb_iv_set(self, "@cert", cert);
         
     | 
| 
       606 
611 
     | 
    
         | 
| 
         @@ -631,7 +636,7 @@ ossl_x509stctx_verify(VALUE self) 
     | 
|
| 
       631 
636 
     | 
    
         
             
                    ossl_clear_error();
         
     | 
| 
       632 
637 
     | 
    
         
             
                    return Qfalse;
         
     | 
| 
       633 
638 
     | 
    
         
             
                  default:
         
     | 
| 
       634 
     | 
    
         
            -
                    ossl_raise( 
     | 
| 
      
 639 
     | 
    
         
            +
                    ossl_raise(eX509StoreError, "X509_verify_cert");
         
     | 
| 
       635 
640 
     | 
    
         
             
                }
         
     | 
| 
       636 
641 
     | 
    
         
             
            }
         
     | 
| 
       637 
642 
     | 
    
         |