[BACK]Return to req.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / openssl

Diff for /src/usr.bin/openssl/req.c between version 1.22 and 1.23

version 1.22, 2021/12/12 20:42:37 version 1.23, 2022/02/03 17:44:04
Line 879 
Line 879 
                 }                  }
                 if (req_config.x509) {                  if (req_config.x509) {
                         EVP_PKEY *tmppkey;                          EVP_PKEY *tmppkey;
   
                         X509V3_CTX ext_ctx;                          X509V3_CTX ext_ctx;
                         if ((x509ss = X509_new()) == NULL)                          if ((x509ss = X509_new()) == NULL)
                                 goto end;                                  goto end;
Line 904 
Line 905 
                                 goto end;                                  goto end;
                         if (!X509_set_subject_name(x509ss, X509_REQ_get_subject_name(req)))                          if (!X509_set_subject_name(x509ss, X509_REQ_get_subject_name(req)))
                                 goto end;                                  goto end;
                         tmppkey = X509_REQ_get_pubkey(req);                          if ((tmppkey = X509_REQ_get0_pubkey(req)) == NULL)
                         if (!tmppkey || !X509_set_pubkey(x509ss, tmppkey))  
                                 goto end;                                  goto end;
                         EVP_PKEY_free(tmppkey);                          if (!X509_set_pubkey(x509ss, tmppkey))
                                   goto end;
   
                         /* Set up V3 context struct */                          /* Set up V3 context struct */
   
Line 984 
Line 985 
                 }                  }
         }          }
         if (req_config.verify && !req_config.x509) {          if (req_config.verify && !req_config.x509) {
                 int tmp = 0;                  EVP_PKEY *pubkey = pkey;
   
                 if (pkey == NULL) {                  if (pubkey == NULL)
                         pkey = X509_REQ_get_pubkey(req);                          pubkey = X509_REQ_get0_pubkey(req);
                         tmp = 1;                  if (pubkey == NULL)
                         if (pkey == NULL)                          goto end;
                                 goto end;                  i = X509_REQ_verify(req, pubkey);
                 }  
                 i = X509_REQ_verify(req, pkey);  
                 if (tmp) {  
                         EVP_PKEY_free(pkey);  
                         pkey = NULL;  
                 }  
                 if (i < 0) {                  if (i < 0) {
                         goto end;                          goto end;
                 } else if (i == 0) {                  } else if (i == 0) {
Line 1024 
Line 1019 
   
         if (req_config.pubkey) {          if (req_config.pubkey) {
                 EVP_PKEY *tpubkey;                  EVP_PKEY *tpubkey;
                 tpubkey = X509_REQ_get_pubkey(req);  
                 if (tpubkey == NULL) {                  if ((tpubkey = X509_REQ_get0_pubkey(req)) == NULL) {
                         BIO_printf(bio_err, "Error getting public key\n");                          BIO_printf(bio_err, "Error getting public key\n");
                         ERR_print_errors(bio_err);                          ERR_print_errors(bio_err);
                         goto end;                          goto end;
                 }                  }
                 PEM_write_bio_PUBKEY(out, tpubkey);                  PEM_write_bio_PUBKEY(out, tpubkey);
                 EVP_PKEY_free(tpubkey);  
         }          }
         if (req_config.text) {          if (req_config.text) {
                 if (req_config.x509)                  if (req_config.x509)

Legend:
Removed from v.1.22  
changed lines
  Added in v.1.23