Deleted Added
full compact
req.c (89837) req.c (100928)
1/* apps/req.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *

--- 269 unchanged lines hidden (view full) ---

278 ERR_clear_error();
279 (void)BIO_reset(in);
280 if ((xtmp=PEM_read_bio_X509(in,NULL,NULL,NULL)) == NULL)
281 {
282 BIO_printf(bio_err,"unable to load DSA parameters from file\n");
283 goto end;
284 }
285
1/* apps/req.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *

--- 269 unchanged lines hidden (view full) ---

278 ERR_clear_error();
279 (void)BIO_reset(in);
280 if ((xtmp=PEM_read_bio_X509(in,NULL,NULL,NULL)) == NULL)
281 {
282 BIO_printf(bio_err,"unable to load DSA parameters from file\n");
283 goto end;
284 }
285
286 dtmp=X509_get_pubkey(xtmp);
286 if ((dtmp=X509_get_pubkey(xtmp)) == NULL) goto end;
287 if (dtmp->type == EVP_PKEY_DSA)
288 dsa_params=DSAparams_dup(dtmp->pkey.dsa);
289 EVP_PKEY_free(dtmp);
290 X509_free(xtmp);
291 if (dsa_params == NULL)
292 {
293 BIO_printf(bio_err,"Certificate does not contain DSA parameters\n");
294 goto end;

--- 418 unchanged lines hidden (view full) ---

713 if (x509)
714 {
715 EVP_PKEY *tmppkey;
716 X509V3_CTX ext_ctx;
717 if ((x509ss=X509_new()) == NULL) goto end;
718
719 /* Set version to V3 */
720 if(!X509_set_version(x509ss, 2)) goto end;
287 if (dtmp->type == EVP_PKEY_DSA)
288 dsa_params=DSAparams_dup(dtmp->pkey.dsa);
289 EVP_PKEY_free(dtmp);
290 X509_free(xtmp);
291 if (dsa_params == NULL)
292 {
293 BIO_printf(bio_err,"Certificate does not contain DSA parameters\n");
294 goto end;

--- 418 unchanged lines hidden (view full) ---

713 if (x509)
714 {
715 EVP_PKEY *tmppkey;
716 X509V3_CTX ext_ctx;
717 if ((x509ss=X509_new()) == NULL) goto end;
718
719 /* Set version to V3 */
720 if(!X509_set_version(x509ss, 2)) goto end;
721 ASN1_INTEGER_set(X509_get_serialNumber(x509ss),0L);
721 if (!ASN1_INTEGER_set(X509_get_serialNumber(x509ss),0L)) goto end;
722
722
723 X509_set_issuer_name(x509ss,
724 X509_REQ_get_subject_name(req));
725 X509_gmtime_adj(X509_get_notBefore(x509ss),0);
726 X509_gmtime_adj(X509_get_notAfter(x509ss),
727 (long)60*60*24*days);
728 X509_set_subject_name(x509ss,
729 X509_REQ_get_subject_name(req));
723 if (!X509_set_issuer_name(x509ss, X509_REQ_get_subject_name(req))) goto end;
724 if (!X509_gmtime_adj(X509_get_notBefore(x509ss),0)) goto end;
725 if (!X509_gmtime_adj(X509_get_notAfter(x509ss), (long)60*60*24*days)) goto end;
726 if (!X509_set_subject_name(x509ss, X509_REQ_get_subject_name(req))) goto end;
730 tmppkey = X509_REQ_get_pubkey(req);
727 tmppkey = X509_REQ_get_pubkey(req);
731 X509_set_pubkey(x509ss,tmppkey);
728 if (!tmppkey || !X509_set_pubkey(x509ss,tmppkey)) goto end;
732 EVP_PKEY_free(tmppkey);
733
734 /* Set up V3 context struct */
735
736 X509V3_set_ctx(&ext_ctx, x509ss, x509ss, NULL, NULL, 0);
737 X509V3_set_conf_lhash(&ext_ctx, req_conf);
738
739 /* Add extensions */

--- 214 unchanged lines hidden (view full) ---

954
955 /* setup version number */
956 if (!X509_REQ_set_version(req,0L)) goto err; /* version 1 */
957
958 if(no_prompt) i = auto_info(req, dn_sk, attr_sk, attribs);
959 else i = prompt_info(req, dn_sk, dn_sect, attr_sk, attr_sect, attribs);
960 if(!i) goto err;
961
729 EVP_PKEY_free(tmppkey);
730
731 /* Set up V3 context struct */
732
733 X509V3_set_ctx(&ext_ctx, x509ss, x509ss, NULL, NULL, 0);
734 X509V3_set_conf_lhash(&ext_ctx, req_conf);
735
736 /* Add extensions */

--- 214 unchanged lines hidden (view full) ---

951
952 /* setup version number */
953 if (!X509_REQ_set_version(req,0L)) goto err; /* version 1 */
954
955 if(no_prompt) i = auto_info(req, dn_sk, attr_sk, attribs);
956 else i = prompt_info(req, dn_sk, dn_sect, attr_sk, attr_sect, attribs);
957 if(!i) goto err;
958
962 X509_REQ_set_pubkey(req,pkey);
959 if (!X509_REQ_set_pubkey(req,pkey)) goto err;
963
964 ret=1;
965err:
966 return(ret);
967 }
968
969
970static int prompt_info(X509_REQ *req,

--- 323 unchanged lines hidden ---
960
961 ret=1;
962err:
963 return(ret);
964 }
965
966
967static int prompt_info(X509_REQ *req,

--- 323 unchanged lines hidden ---