[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.21 and 1.22

version 1.21, 2021/10/23 11:36:44 version 1.22, 2021/12/12 20:42:37
Line 1049 
Line 1049 
                 EVP_PKEY *tpubkey;                  EVP_PKEY *tpubkey;
   
                 if (req_config.x509)                  if (req_config.x509)
                         tpubkey = X509_get_pubkey(x509ss);                          tpubkey = X509_get0_pubkey(x509ss);
                 else                  else
                         tpubkey = X509_REQ_get_pubkey(req);                          tpubkey = X509_REQ_get0_pubkey(req);
                 if (tpubkey == NULL) {                  if (tpubkey == NULL) {
                         fprintf(stdout, "Modulus=unavailable\n");                          fprintf(stdout, "Modulus=unavailable\n");
                         goto end;                          goto end;
                 }                  }
                 fprintf(stdout, "Modulus=");                  fprintf(stdout, "Modulus=");
                 if (EVP_PKEY_base_id(tpubkey) == EVP_PKEY_RSA)                  if (EVP_PKEY_base_id(tpubkey) == EVP_PKEY_RSA) {
                         BN_print(out, tpubkey->pkey.rsa->n);                          const BIGNUM *n = NULL;
                 else  
                           RSA_get0_key(EVP_PKEY_get0_RSA(tpubkey), &n, NULL, NULL);
   
                           BN_print(out, n);
                   } else
                         fprintf(stdout, "Wrong Algorithm type");                          fprintf(stdout, "Wrong Algorithm type");
                 EVP_PKEY_free(tpubkey);  
                 fprintf(stdout, "\n");                  fprintf(stdout, "\n");
         }          }
         if (!req_config.noout && !req_config.x509) {          if (!req_config.noout && !req_config.x509) {
Line 1760 
Line 1763 
 do_X509_sign(BIO * err, X509 * x, EVP_PKEY * pkey, const EVP_MD * md,  do_X509_sign(BIO * err, X509 * x, EVP_PKEY * pkey, const EVP_MD * md,
     STACK_OF(OPENSSL_STRING) * sigopts)      STACK_OF(OPENSSL_STRING) * sigopts)
 {  {
           EVP_MD_CTX *mctx;
         int rv;          int rv;
         EVP_MD_CTX mctx;  
         EVP_MD_CTX_init(&mctx);          if ((mctx = EVP_MD_CTX_new()) == NULL)
         rv = do_sign_init(err, &mctx, pkey, md, sigopts);                  return 0;
   
           rv = do_sign_init(err, mctx, pkey, md, sigopts);
         if (rv > 0)          if (rv > 0)
                 rv = X509_sign_ctx(x, &mctx);                  rv = X509_sign_ctx(x, mctx);
         EVP_MD_CTX_cleanup(&mctx);  
         return rv > 0 ? 1 : 0;          EVP_MD_CTX_free(mctx);
   
           return rv > 0;
 }  }
   
   
Line 1775 
Line 1783 
 do_X509_REQ_sign(BIO * err, X509_REQ * x, EVP_PKEY * pkey, const EVP_MD * md,  do_X509_REQ_sign(BIO * err, X509_REQ * x, EVP_PKEY * pkey, const EVP_MD * md,
     STACK_OF(OPENSSL_STRING) * sigopts)      STACK_OF(OPENSSL_STRING) * sigopts)
 {  {
           EVP_MD_CTX *mctx;
         int rv;          int rv;
         EVP_MD_CTX mctx;  
         EVP_MD_CTX_init(&mctx);          if ((mctx = EVP_MD_CTX_new()) == NULL)
         rv = do_sign_init(err, &mctx, pkey, md, sigopts);                  return 0;
   
           rv = do_sign_init(err, mctx, pkey, md, sigopts);
         if (rv > 0)          if (rv > 0)
                 rv = X509_REQ_sign_ctx(x, &mctx);                  rv = X509_REQ_sign_ctx(x, mctx);
         EVP_MD_CTX_cleanup(&mctx);  
         return rv > 0 ? 1 : 0;          EVP_MD_CTX_free(mctx);
   
           return rv > 0;
 }  }
   
   
Line 1792 
Line 1805 
     STACK_OF(OPENSSL_STRING) * sigopts)      STACK_OF(OPENSSL_STRING) * sigopts)
 {  {
         int rv;          int rv;
         EVP_MD_CTX mctx;          EVP_MD_CTX *mctx;
         EVP_MD_CTX_init(&mctx);  
         rv = do_sign_init(err, &mctx, pkey, md, sigopts);          if ((mctx = EVP_MD_CTX_new()) == NULL)
                   return 0;
   
           rv = do_sign_init(err, mctx, pkey, md, sigopts);
         if (rv > 0)          if (rv > 0)
                 rv = X509_CRL_sign_ctx(x, &mctx);                  rv = X509_CRL_sign_ctx(x, mctx);
         EVP_MD_CTX_cleanup(&mctx);  
         return rv > 0 ? 1 : 0;          EVP_MD_CTX_free(mctx);
   
           return rv > 0;
 }  }
   
 static unsigned long  static unsigned long

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