2016-05-18 02:18:30 +08:00
|
|
|
/*
|
2020-04-23 20:55:52 +08:00
|
|
|
* Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
|
2001-10-21 01:56:36 +08:00
|
|
|
*
|
2018-12-06 20:00:26 +08:00
|
|
|
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
2016-05-18 02:18:30 +08:00
|
|
|
* this file except in compliance with the License. You can obtain a copy
|
|
|
|
* in the file LICENSE in the source distribution or at
|
|
|
|
* https://www.openssl.org/source/license.html
|
2001-10-21 01:56:36 +08:00
|
|
|
*/
|
1998-12-21 18:52:47 +08:00
|
|
|
|
2019-09-28 06:45:57 +08:00
|
|
|
#ifndef OSSL_APPS_H
|
|
|
|
# define OSSL_APPS_H
|
2015-01-22 11:40:55 +08:00
|
|
|
|
2017-09-01 06:50:03 +08:00
|
|
|
# include "e_os.h" /* struct timeval for DTLS */
|
2017-08-24 07:05:07 +08:00
|
|
|
# include "internal/nelem.h"
|
2020-04-21 20:08:49 +08:00
|
|
|
# include "internal/sockets.h" /* for openssl_fdset() */
|
2015-05-02 22:01:33 +08:00
|
|
|
# include <assert.h>
|
2015-01-22 11:40:55 +08:00
|
|
|
|
2020-05-28 19:53:48 +08:00
|
|
|
# include <stdarg.h>
|
2018-03-06 04:18:04 +08:00
|
|
|
# include <sys/types.h>
|
2018-03-06 03:40:02 +08:00
|
|
|
# ifndef OPENSSL_NO_POSIX_IO
|
|
|
|
# include <sys/stat.h>
|
|
|
|
# include <fcntl.h>
|
|
|
|
# endif
|
|
|
|
|
2015-09-17 10:17:55 +08:00
|
|
|
# include <openssl/e_os2.h>
|
2019-09-28 06:45:46 +08:00
|
|
|
# include <openssl/types.h>
|
2015-01-22 11:40:55 +08:00
|
|
|
# include <openssl/bio.h>
|
|
|
|
# include <openssl/x509.h>
|
|
|
|
# include <openssl/conf.h>
|
|
|
|
# include <openssl/txt_db.h>
|
2016-03-19 02:30:20 +08:00
|
|
|
# include <openssl/engine.h>
|
|
|
|
# include <openssl/ocsp.h>
|
2019-10-31 06:39:35 +08:00
|
|
|
# include <openssl/http.h>
|
2016-03-18 00:53:11 +08:00
|
|
|
# include <signal.h>
|
2018-08-16 10:36:01 +08:00
|
|
|
# include "apps_ui.h"
|
|
|
|
# include "opt.h"
|
|
|
|
# include "fmt.h"
|
2019-03-03 17:27:10 +08:00
|
|
|
# include "platform.h"
|
1998-12-21 18:52:47 +08:00
|
|
|
|
2016-02-14 20:02:15 +08:00
|
|
|
/*
|
|
|
|
* quick macro when you need to pass an unsigned char instead of a char.
|
|
|
|
* this is true for some implementations of the is*() functions, for
|
|
|
|
* example.
|
|
|
|
*/
|
2017-08-29 01:14:47 +08:00
|
|
|
# define _UC(c) ((unsigned char)(c))
|
2016-02-14 20:02:15 +08:00
|
|
|
|
2017-07-05 22:58:48 +08:00
|
|
|
void app_RAND_load_conf(CONF *c, const char *section);
|
|
|
|
void app_RAND_write(void);
|
1999-10-26 09:56:29 +08:00
|
|
|
|
1998-12-21 18:52:47 +08:00
|
|
|
extern char *default_config_file;
|
Big apps cleanup (option-parsing, etc)
This is merges the old "rsalz-monolith" branch over to master. The biggest
change is that option parsing switch from cascasding 'else if strcmp("-foo")'
to a utility routine and somethin akin to getopt. Also, an error in the
command line no longer prints the full summary; use -help (or --help :)
for that. There have been many other changes and code-cleanup, see
bullet list below.
Special thanks to Matt for the long and detailed code review.
TEMPORARY:
For now, comment out CRYPTO_mem_leaks() at end of main
Tickets closed:
RT3515: Use 3DES in pkcs12 if built with no-rc2
RT1766: s_client -reconnect and -starttls broke
RT2932: Catch write errors
RT2604: port should be 'unsigned short'
RT2983: total_bytes undeclared #ifdef RENEG
RT1523: Add -nocert to fix output in x509 app
RT3508: Remove unused variable introduced by b09eb24
RT3511: doc fix; req default serial is random
RT1325,2973: Add more extensions to c_rehash
RT2119,3407: Updated to dgst.pod
RT2379: Additional typo fix
RT2693: Extra include of string.h
RT2880: HFS is case-insensitive filenames
RT3246: req command prints version number wrong
Other changes; incompatibilities marked with *:
Add SCSV support
Add -misalign to speed command
Make dhparam, dsaparam, ecparam, x509 output C in proper style
Make some internal ocsp.c functions void
Only display cert usages with -help in verify
Use global bio_err, remove "BIO*err" parameter from functions
For filenames, - always means stdin (or stdout as appropriate)
Add aliases for -des/aes "wrap" ciphers.
*Remove support for IISSGC (server gated crypto)
*The undocumented OCSP -header flag is now "-header name=value"
*Documented the OCSP -header flag
Reviewed-by: Matt Caswell <matt@openssl.org>
2015-04-25 03:26:15 +08:00
|
|
|
extern BIO *bio_in;
|
|
|
|
extern BIO *bio_out;
|
1998-12-21 18:52:47 +08:00
|
|
|
extern BIO *bio_err;
|
2017-06-21 18:58:10 +08:00
|
|
|
extern const unsigned char tls13_aes128gcmsha256_id[];
|
|
|
|
extern const unsigned char tls13_aes256gcmsha384_id[];
|
2017-09-12 23:19:09 +08:00
|
|
|
extern BIO_ADDR *ourpeer;
|
|
|
|
|
2015-09-06 18:20:12 +08:00
|
|
|
BIO *dup_bio_in(int format);
|
|
|
|
BIO *dup_bio_out(int format);
|
2016-03-22 01:30:30 +08:00
|
|
|
BIO *dup_bio_err(int format);
|
2015-09-04 18:49:06 +08:00
|
|
|
BIO *bio_open_owner(const char *filename, int format, int private);
|
|
|
|
BIO *bio_open_default(const char *filename, char mode, int format);
|
|
|
|
BIO *bio_open_default_quiet(const char *filename, char mode, int format);
|
2017-12-28 01:29:36 +08:00
|
|
|
CONF *app_load_config_bio(BIO *in, const char *filename);
|
2015-05-29 14:07:10 +08:00
|
|
|
CONF *app_load_config(const char *filename);
|
|
|
|
CONF *app_load_config_quiet(const char *filename);
|
|
|
|
int app_load_modules(const CONF *config);
|
2020-07-23 15:40:40 +08:00
|
|
|
CONF *app_load_config_modules(const char *configfile);
|
Big apps cleanup (option-parsing, etc)
This is merges the old "rsalz-monolith" branch over to master. The biggest
change is that option parsing switch from cascasding 'else if strcmp("-foo")'
to a utility routine and somethin akin to getopt. Also, an error in the
command line no longer prints the full summary; use -help (or --help :)
for that. There have been many other changes and code-cleanup, see
bullet list below.
Special thanks to Matt for the long and detailed code review.
TEMPORARY:
For now, comment out CRYPTO_mem_leaks() at end of main
Tickets closed:
RT3515: Use 3DES in pkcs12 if built with no-rc2
RT1766: s_client -reconnect and -starttls broke
RT2932: Catch write errors
RT2604: port should be 'unsigned short'
RT2983: total_bytes undeclared #ifdef RENEG
RT1523: Add -nocert to fix output in x509 app
RT3508: Remove unused variable introduced by b09eb24
RT3511: doc fix; req default serial is random
RT1325,2973: Add more extensions to c_rehash
RT2119,3407: Updated to dgst.pod
RT2379: Additional typo fix
RT2693: Extra include of string.h
RT2880: HFS is case-insensitive filenames
RT3246: req command prints version number wrong
Other changes; incompatibilities marked with *:
Add SCSV support
Add -misalign to speed command
Make dhparam, dsaparam, ecparam, x509 output C in proper style
Make some internal ocsp.c functions void
Only display cert usages with -help in verify
Use global bio_err, remove "BIO*err" parameter from functions
For filenames, - always means stdin (or stdout as appropriate)
Add aliases for -des/aes "wrap" ciphers.
*Remove support for IISSGC (server gated crypto)
*The undocumented OCSP -header flag is now "-header name=value"
*Documented the OCSP -header flag
Reviewed-by: Matt Caswell <matt@openssl.org>
2015-04-25 03:26:15 +08:00
|
|
|
void unbuffer(FILE *fp);
|
2015-10-06 21:04:11 +08:00
|
|
|
void wait_for_async(SSL *s);
|
2016-05-20 18:53:26 +08:00
|
|
|
# if defined(OPENSSL_SYS_MSDOS)
|
|
|
|
int has_stdin_waiting(void);
|
|
|
|
# endif
|
1998-12-21 18:52:47 +08:00
|
|
|
|
2016-08-17 19:34:22 +08:00
|
|
|
void corrupt_signature(const ASN1_STRING *signature);
|
2016-08-19 23:21:21 +08:00
|
|
|
int set_cert_times(X509 *x, const char *startdate, const char *enddate,
|
|
|
|
int days);
|
2016-08-16 21:06:48 +08:00
|
|
|
|
2015-01-22 11:40:55 +08:00
|
|
|
typedef struct args_st {
|
Big apps cleanup (option-parsing, etc)
This is merges the old "rsalz-monolith" branch over to master. The biggest
change is that option parsing switch from cascasding 'else if strcmp("-foo")'
to a utility routine and somethin akin to getopt. Also, an error in the
command line no longer prints the full summary; use -help (or --help :)
for that. There have been many other changes and code-cleanup, see
bullet list below.
Special thanks to Matt for the long and detailed code review.
TEMPORARY:
For now, comment out CRYPTO_mem_leaks() at end of main
Tickets closed:
RT3515: Use 3DES in pkcs12 if built with no-rc2
RT1766: s_client -reconnect and -starttls broke
RT2932: Catch write errors
RT2604: port should be 'unsigned short'
RT2983: total_bytes undeclared #ifdef RENEG
RT1523: Add -nocert to fix output in x509 app
RT3508: Remove unused variable introduced by b09eb24
RT3511: doc fix; req default serial is random
RT1325,2973: Add more extensions to c_rehash
RT2119,3407: Updated to dgst.pod
RT2379: Additional typo fix
RT2693: Extra include of string.h
RT2880: HFS is case-insensitive filenames
RT3246: req command prints version number wrong
Other changes; incompatibilities marked with *:
Add SCSV support
Add -misalign to speed command
Make dhparam, dsaparam, ecparam, x509 output C in proper style
Make some internal ocsp.c functions void
Only display cert usages with -help in verify
Use global bio_err, remove "BIO*err" parameter from functions
For filenames, - always means stdin (or stdout as appropriate)
Add aliases for -des/aes "wrap" ciphers.
*Remove support for IISSGC (server gated crypto)
*The undocumented OCSP -header flag is now "-header name=value"
*Documented the OCSP -header flag
Reviewed-by: Matt Caswell <matt@openssl.org>
2015-04-25 03:26:15 +08:00
|
|
|
int size;
|
|
|
|
int argc;
|
|
|
|
char **argv;
|
2015-01-22 11:40:55 +08:00
|
|
|
} ARGS;
|
2006-04-17 20:22:13 +08:00
|
|
|
|
2018-12-12 01:31:55 +08:00
|
|
|
/* We need both wrap and the "real" function because libcrypto uses both. */
|
|
|
|
int wrap_password_callback(char *buf, int bufsiz, int verify, void *cb_data);
|
2001-06-20 00:26:30 +08:00
|
|
|
|
Big apps cleanup (option-parsing, etc)
This is merges the old "rsalz-monolith" branch over to master. The biggest
change is that option parsing switch from cascasding 'else if strcmp("-foo")'
to a utility routine and somethin akin to getopt. Also, an error in the
command line no longer prints the full summary; use -help (or --help :)
for that. There have been many other changes and code-cleanup, see
bullet list below.
Special thanks to Matt for the long and detailed code review.
TEMPORARY:
For now, comment out CRYPTO_mem_leaks() at end of main
Tickets closed:
RT3515: Use 3DES in pkcs12 if built with no-rc2
RT1766: s_client -reconnect and -starttls broke
RT2932: Catch write errors
RT2604: port should be 'unsigned short'
RT2983: total_bytes undeclared #ifdef RENEG
RT1523: Add -nocert to fix output in x509 app
RT3508: Remove unused variable introduced by b09eb24
RT3511: doc fix; req default serial is random
RT1325,2973: Add more extensions to c_rehash
RT2119,3407: Updated to dgst.pod
RT2379: Additional typo fix
RT2693: Extra include of string.h
RT2880: HFS is case-insensitive filenames
RT3246: req command prints version number wrong
Other changes; incompatibilities marked with *:
Add SCSV support
Add -misalign to speed command
Make dhparam, dsaparam, ecparam, x509 output C in proper style
Make some internal ocsp.c functions void
Only display cert usages with -help in verify
Use global bio_err, remove "BIO*err" parameter from functions
For filenames, - always means stdin (or stdout as appropriate)
Add aliases for -des/aes "wrap" ciphers.
*Remove support for IISSGC (server gated crypto)
*The undocumented OCSP -header flag is now "-header name=value"
*Documented the OCSP -header flag
Reviewed-by: Matt Caswell <matt@openssl.org>
2015-04-25 03:26:15 +08:00
|
|
|
int chopup_args(ARGS *arg, char *buf);
|
1999-11-12 09:42:25 +08:00
|
|
|
int dump_cert_text(BIO *out, X509 *x);
|
2020-03-23 15:30:37 +08:00
|
|
|
void print_name(BIO *out, const char *title, const X509_NAME *nm,
|
2015-01-22 11:40:55 +08:00
|
|
|
unsigned long lflags);
|
2016-06-14 21:49:05 +08:00
|
|
|
void print_bignum_var(BIO *, const BIGNUM *, const char*,
|
|
|
|
int, unsigned char *);
|
Big apps cleanup (option-parsing, etc)
This is merges the old "rsalz-monolith" branch over to master. The biggest
change is that option parsing switch from cascasding 'else if strcmp("-foo")'
to a utility routine and somethin akin to getopt. Also, an error in the
command line no longer prints the full summary; use -help (or --help :)
for that. There have been many other changes and code-cleanup, see
bullet list below.
Special thanks to Matt for the long and detailed code review.
TEMPORARY:
For now, comment out CRYPTO_mem_leaks() at end of main
Tickets closed:
RT3515: Use 3DES in pkcs12 if built with no-rc2
RT1766: s_client -reconnect and -starttls broke
RT2932: Catch write errors
RT2604: port should be 'unsigned short'
RT2983: total_bytes undeclared #ifdef RENEG
RT1523: Add -nocert to fix output in x509 app
RT3508: Remove unused variable introduced by b09eb24
RT3511: doc fix; req default serial is random
RT1325,2973: Add more extensions to c_rehash
RT2119,3407: Updated to dgst.pod
RT2379: Additional typo fix
RT2693: Extra include of string.h
RT2880: HFS is case-insensitive filenames
RT3246: req command prints version number wrong
Other changes; incompatibilities marked with *:
Add SCSV support
Add -misalign to speed command
Make dhparam, dsaparam, ecparam, x509 output C in proper style
Make some internal ocsp.c functions void
Only display cert usages with -help in verify
Use global bio_err, remove "BIO*err" parameter from functions
For filenames, - always means stdin (or stdout as appropriate)
Add aliases for -des/aes "wrap" ciphers.
*Remove support for IISSGC (server gated crypto)
*The undocumented OCSP -header flag is now "-header name=value"
*Documented the OCSP -header flag
Reviewed-by: Matt Caswell <matt@openssl.org>
2015-04-25 03:26:15 +08:00
|
|
|
void print_array(BIO *, const char *, int, const unsigned char *);
|
2017-04-26 00:25:42 +08:00
|
|
|
int set_nameopt(const char *arg);
|
|
|
|
unsigned long get_nameopt(void);
|
2000-10-06 19:51:47 +08:00
|
|
|
int set_cert_ex(unsigned long *flags, const char *arg);
|
2000-07-28 09:58:15 +08:00
|
|
|
int set_name_ex(unsigned long *flags, const char *arg);
|
2001-03-16 10:04:17 +08:00
|
|
|
int set_ext_copy(int *copy_type, const char *arg);
|
|
|
|
int copy_extensions(X509 *x, X509_REQ *req, int copy_type);
|
2020-05-06 19:51:50 +08:00
|
|
|
char *get_passwd(const char *pass, const char *desc);
|
2016-08-05 05:52:22 +08:00
|
|
|
int app_passwd(const char *arg1, const char *arg2, char **pass1, char **pass2);
|
Big apps cleanup (option-parsing, etc)
This is merges the old "rsalz-monolith" branch over to master. The biggest
change is that option parsing switch from cascasding 'else if strcmp("-foo")'
to a utility routine and somethin akin to getopt. Also, an error in the
command line no longer prints the full summary; use -help (or --help :)
for that. There have been many other changes and code-cleanup, see
bullet list below.
Special thanks to Matt for the long and detailed code review.
TEMPORARY:
For now, comment out CRYPTO_mem_leaks() at end of main
Tickets closed:
RT3515: Use 3DES in pkcs12 if built with no-rc2
RT1766: s_client -reconnect and -starttls broke
RT2932: Catch write errors
RT2604: port should be 'unsigned short'
RT2983: total_bytes undeclared #ifdef RENEG
RT1523: Add -nocert to fix output in x509 app
RT3508: Remove unused variable introduced by b09eb24
RT3511: doc fix; req default serial is random
RT1325,2973: Add more extensions to c_rehash
RT2119,3407: Updated to dgst.pod
RT2379: Additional typo fix
RT2693: Extra include of string.h
RT2880: HFS is case-insensitive filenames
RT3246: req command prints version number wrong
Other changes; incompatibilities marked with *:
Add SCSV support
Add -misalign to speed command
Make dhparam, dsaparam, ecparam, x509 output C in proper style
Make some internal ocsp.c functions void
Only display cert usages with -help in verify
Use global bio_err, remove "BIO*err" parameter from functions
For filenames, - always means stdin (or stdout as appropriate)
Add aliases for -des/aes "wrap" ciphers.
*Remove support for IISSGC (server gated crypto)
*The undocumented OCSP -header flag is now "-header name=value"
*Documented the OCSP -header flag
Reviewed-by: Matt Caswell <matt@openssl.org>
2015-04-25 03:26:15 +08:00
|
|
|
int add_oid_section(CONF *conf);
|
2017-12-16 03:50:37 +08:00
|
|
|
X509_REQ *load_csr(const char *file, int format, const char *desc);
|
2020-05-06 19:51:50 +08:00
|
|
|
X509 *load_cert_pass(const char *uri, int maybe_stdin,
|
|
|
|
const char *pass, const char *desc);
|
|
|
|
/* the format parameter is meanwhile not needed anymore and thus ignored */
|
|
|
|
X509 *load_cert(const char *uri, int format, const char *desc);
|
|
|
|
X509_CRL *load_crl(const char *uri, int format, const char *desc);
|
|
|
|
void cleanse(char *str);
|
|
|
|
void clear_free(char *str);
|
|
|
|
EVP_PKEY *load_key(const char *uri, int format, int maybe_stdin,
|
2017-12-16 03:50:37 +08:00
|
|
|
const char *pass, ENGINE *e, const char *desc);
|
2020-05-06 19:51:50 +08:00
|
|
|
EVP_PKEY *load_pubkey(const char *uri, int format, int maybe_stdin,
|
2017-12-16 03:50:37 +08:00
|
|
|
const char *pass, ENGINE *e, const char *desc);
|
2016-01-16 13:08:38 +08:00
|
|
|
int load_certs(const char *file, STACK_OF(X509) **certs, int format,
|
2017-12-16 03:50:37 +08:00
|
|
|
const char *pass, const char *desc);
|
2016-01-16 13:08:38 +08:00
|
|
|
int load_crls(const char *file, STACK_OF(X509_CRL) **crls, int format,
|
2017-12-16 03:50:37 +08:00
|
|
|
const char *pass, const char *desc);
|
2020-05-06 19:51:50 +08:00
|
|
|
int load_key_cert_crl(const char *uri, int maybe_stdin,
|
|
|
|
const char *pass, const char *desc,
|
2020-07-30 16:09:43 +08:00
|
|
|
EVP_PKEY **ppkey, EVP_PKEY **ppubkey,
|
|
|
|
X509 **pcert, X509_CRL **pcrl);
|
2019-03-07 22:26:34 +08:00
|
|
|
X509_STORE *setup_verify(const char *CAfile, int noCAfile,
|
|
|
|
const char *CApath, int noCApath,
|
|
|
|
const char *CAstore, int noCAstore);
|
|
|
|
__owur int ctx_set_verify_locations(SSL_CTX *ctx,
|
|
|
|
const char *CAfile, int noCAfile,
|
|
|
|
const char *CApath, int noCApath,
|
|
|
|
const char *CAstore, int noCAstore);
|
2016-03-09 11:12:25 +08:00
|
|
|
|
2017-08-29 01:14:47 +08:00
|
|
|
# ifndef OPENSSL_NO_CT
|
2016-03-11 07:10:02 +08:00
|
|
|
|
2016-03-09 11:12:25 +08:00
|
|
|
/*
|
|
|
|
* Sets the file to load the Certificate Transparency log list from.
|
|
|
|
* If path is NULL, loads from the default file path.
|
|
|
|
* Returns 1 on success, 0 otherwise.
|
|
|
|
*/
|
2016-03-05 03:51:43 +08:00
|
|
|
__owur int ctx_set_ctlog_list_file(SSL_CTX *ctx, const char *path);
|
2016-03-02 21:34:05 +08:00
|
|
|
|
2017-08-29 01:14:47 +08:00
|
|
|
# endif
|
2016-03-11 07:10:02 +08:00
|
|
|
|
2017-08-29 01:14:47 +08:00
|
|
|
ENGINE *setup_engine_methods(const char *id, unsigned int methods, int debug);
|
|
|
|
# define setup_engine(e, debug) setup_engine_methods(e, (unsigned int)-1, debug)
|
2016-09-29 05:39:18 +08:00
|
|
|
void release_engine(ENGINE *e);
|
2016-10-20 01:49:22 +08:00
|
|
|
|
2015-01-22 11:40:55 +08:00
|
|
|
# ifndef OPENSSL_NO_OCSP
|
Big apps cleanup (option-parsing, etc)
This is merges the old "rsalz-monolith" branch over to master. The biggest
change is that option parsing switch from cascasding 'else if strcmp("-foo")'
to a utility routine and somethin akin to getopt. Also, an error in the
command line no longer prints the full summary; use -help (or --help :)
for that. There have been many other changes and code-cleanup, see
bullet list below.
Special thanks to Matt for the long and detailed code review.
TEMPORARY:
For now, comment out CRYPTO_mem_leaks() at end of main
Tickets closed:
RT3515: Use 3DES in pkcs12 if built with no-rc2
RT1766: s_client -reconnect and -starttls broke
RT2932: Catch write errors
RT2604: port should be 'unsigned short'
RT2983: total_bytes undeclared #ifdef RENEG
RT1523: Add -nocert to fix output in x509 app
RT3508: Remove unused variable introduced by b09eb24
RT3511: doc fix; req default serial is random
RT1325,2973: Add more extensions to c_rehash
RT2119,3407: Updated to dgst.pod
RT2379: Additional typo fix
RT2693: Extra include of string.h
RT2880: HFS is case-insensitive filenames
RT3246: req command prints version number wrong
Other changes; incompatibilities marked with *:
Add SCSV support
Add -misalign to speed command
Make dhparam, dsaparam, ecparam, x509 output C in proper style
Make some internal ocsp.c functions void
Only display cert usages with -help in verify
Use global bio_err, remove "BIO*err" parameter from functions
For filenames, - always means stdin (or stdout as appropriate)
Add aliases for -des/aes "wrap" ciphers.
*Remove support for IISSGC (server gated crypto)
*The undocumented OCSP -header flag is now "-header name=value"
*Documented the OCSP -header flag
Reviewed-by: Matt Caswell <matt@openssl.org>
2015-04-25 03:26:15 +08:00
|
|
|
OCSP_RESPONSE *process_responder(OCSP_REQUEST *req,
|
2015-01-22 11:40:55 +08:00
|
|
|
const char *host, const char *path,
|
|
|
|
const char *port, int use_ssl,
|
2015-08-10 23:37:48 +08:00
|
|
|
STACK_OF(CONF_VALUE) *headers,
|
2015-01-22 11:40:55 +08:00
|
|
|
int req_timeout);
|
|
|
|
# endif
|
2007-09-27 05:56:59 +08:00
|
|
|
|
2001-07-13 04:41:51 +08:00
|
|
|
/* Functions defined in ca.c and also used in ocsp.c */
|
|
|
|
int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold,
|
2015-01-22 11:40:55 +08:00
|
|
|
ASN1_GENERALIZEDTIME **pinvtm, const char *str);
|
|
|
|
|
|
|
|
# define DB_type 0
|
|
|
|
# define DB_exp_date 1
|
|
|
|
# define DB_rev_date 2
|
|
|
|
# define DB_serial 3 /* index - unique */
|
|
|
|
# define DB_file 4
|
|
|
|
# define DB_name 5 /* index - unique when active and not
|
|
|
|
* disabled */
|
|
|
|
# define DB_NUMBER 6
|
|
|
|
|
2016-08-06 20:19:03 +08:00
|
|
|
# define DB_TYPE_REV 'R' /* Revoked */
|
|
|
|
# define DB_TYPE_EXP 'E' /* Expired */
|
|
|
|
# define DB_TYPE_VAL 'V' /* Valid ; inserted with: ca ... -valid */
|
|
|
|
# define DB_TYPE_SUSP 'S' /* Suspended */
|
2015-01-22 11:40:55 +08:00
|
|
|
|
|
|
|
typedef struct db_attr_st {
|
|
|
|
int unique_subject;
|
|
|
|
} DB_ATTR;
|
|
|
|
typedef struct ca_db_st {
|
|
|
|
DB_ATTR attributes;
|
|
|
|
TXT_DB *db;
|
2018-03-06 03:40:02 +08:00
|
|
|
char *dbfname;
|
|
|
|
# ifndef OPENSSL_NO_POSIX_IO
|
|
|
|
struct stat dbst;
|
|
|
|
# endif
|
2015-01-22 11:40:55 +08:00
|
|
|
} CA_DB;
|
2003-04-04 00:33:03 +08:00
|
|
|
|
2020-05-28 19:53:48 +08:00
|
|
|
void app_bail_out(char *fmt, ...);
|
2015-05-01 05:48:31 +08:00
|
|
|
void* app_malloc(int sz, const char *what);
|
2016-08-05 05:52:22 +08:00
|
|
|
BIGNUM *load_serial(const char *serialfile, int create, ASN1_INTEGER **retai);
|
|
|
|
int save_serial(const char *serialfile, const char *suffix, const BIGNUM *serial,
|
2015-01-22 11:40:55 +08:00
|
|
|
ASN1_INTEGER **retai);
|
2016-08-05 05:52:22 +08:00
|
|
|
int rotate_serial(const char *serialfile, const char *new_suffix,
|
|
|
|
const char *old_suffix);
|
2004-04-20 20:05:26 +08:00
|
|
|
int rand_serial(BIGNUM *b, ASN1_INTEGER *ai);
|
2016-08-05 05:52:22 +08:00
|
|
|
CA_DB *load_index(const char *dbfile, DB_ATTR *dbattr);
|
2003-04-04 00:33:03 +08:00
|
|
|
int index_index(CA_DB *db);
|
2005-04-06 03:11:19 +08:00
|
|
|
int save_index(const char *dbfile, const char *suffix, CA_DB *db);
|
2015-01-22 11:40:55 +08:00
|
|
|
int rotate_index(const char *dbfile, const char *new_suffix,
|
|
|
|
const char *old_suffix);
|
2003-04-04 00:33:03 +08:00
|
|
|
void free_index(CA_DB *db);
|
2015-01-22 11:40:55 +08:00
|
|
|
# define index_name_cmp_noconst(a, b) \
|
|
|
|
index_name_cmp((const OPENSSL_CSTRING *)CHECKED_PTR_OF(OPENSSL_STRING, a), \
|
|
|
|
(const OPENSSL_CSTRING *)CHECKED_PTR_OF(OPENSSL_STRING, b))
|
2009-07-28 05:10:00 +08:00
|
|
|
int index_name_cmp(const OPENSSL_CSTRING *a, const OPENSSL_CSTRING *b);
|
2005-04-16 02:29:33 +08:00
|
|
|
int parse_yesno(const char *str, int def);
|
2001-07-13 04:41:51 +08:00
|
|
|
|
2020-06-27 16:28:45 +08:00
|
|
|
X509_NAME *parse_name(const char *str, int chtype, int multirdn,
|
|
|
|
const char *desc);
|
2015-04-29 23:27:08 +08:00
|
|
|
void policies_print(X509_STORE_CTX *ctx);
|
2006-04-09 06:25:47 +08:00
|
|
|
int bio_to_mem(unsigned char **out, int maxlen, BIO *in);
|
2016-02-02 13:37:41 +08:00
|
|
|
int pkey_ctrl_string(EVP_PKEY_CTX *ctx, const char *value);
|
2020-03-11 06:05:09 +08:00
|
|
|
int x509_ctrl_string(X509 *x, const char *value);
|
|
|
|
int x509_req_ctrl_string(X509_REQ *x, const char *value);
|
Big apps cleanup (option-parsing, etc)
This is merges the old "rsalz-monolith" branch over to master. The biggest
change is that option parsing switch from cascasding 'else if strcmp("-foo")'
to a utility routine and somethin akin to getopt. Also, an error in the
command line no longer prints the full summary; use -help (or --help :)
for that. There have been many other changes and code-cleanup, see
bullet list below.
Special thanks to Matt for the long and detailed code review.
TEMPORARY:
For now, comment out CRYPTO_mem_leaks() at end of main
Tickets closed:
RT3515: Use 3DES in pkcs12 if built with no-rc2
RT1766: s_client -reconnect and -starttls broke
RT2932: Catch write errors
RT2604: port should be 'unsigned short'
RT2983: total_bytes undeclared #ifdef RENEG
RT1523: Add -nocert to fix output in x509 app
RT3508: Remove unused variable introduced by b09eb24
RT3511: doc fix; req default serial is random
RT1325,2973: Add more extensions to c_rehash
RT2119,3407: Updated to dgst.pod
RT2379: Additional typo fix
RT2693: Extra include of string.h
RT2880: HFS is case-insensitive filenames
RT3246: req command prints version number wrong
Other changes; incompatibilities marked with *:
Add SCSV support
Add -misalign to speed command
Make dhparam, dsaparam, ecparam, x509 output C in proper style
Make some internal ocsp.c functions void
Only display cert usages with -help in verify
Use global bio_err, remove "BIO*err" parameter from functions
For filenames, - always means stdin (or stdout as appropriate)
Add aliases for -des/aes "wrap" ciphers.
*Remove support for IISSGC (server gated crypto)
*The undocumented OCSP -header flag is now "-header name=value"
*Documented the OCSP -header flag
Reviewed-by: Matt Caswell <matt@openssl.org>
2015-04-25 03:26:15 +08:00
|
|
|
int init_gen_str(EVP_PKEY_CTX **pctx,
|
2020-06-16 11:04:57 +08:00
|
|
|
const char *algname, ENGINE *e, int do_param,
|
|
|
|
OPENSSL_CTX *libctx, const char *propq);
|
Big apps cleanup (option-parsing, etc)
This is merges the old "rsalz-monolith" branch over to master. The biggest
change is that option parsing switch from cascasding 'else if strcmp("-foo")'
to a utility routine and somethin akin to getopt. Also, an error in the
command line no longer prints the full summary; use -help (or --help :)
for that. There have been many other changes and code-cleanup, see
bullet list below.
Special thanks to Matt for the long and detailed code review.
TEMPORARY:
For now, comment out CRYPTO_mem_leaks() at end of main
Tickets closed:
RT3515: Use 3DES in pkcs12 if built with no-rc2
RT1766: s_client -reconnect and -starttls broke
RT2932: Catch write errors
RT2604: port should be 'unsigned short'
RT2983: total_bytes undeclared #ifdef RENEG
RT1523: Add -nocert to fix output in x509 app
RT3508: Remove unused variable introduced by b09eb24
RT3511: doc fix; req default serial is random
RT1325,2973: Add more extensions to c_rehash
RT2119,3407: Updated to dgst.pod
RT2379: Additional typo fix
RT2693: Extra include of string.h
RT2880: HFS is case-insensitive filenames
RT3246: req command prints version number wrong
Other changes; incompatibilities marked with *:
Add SCSV support
Add -misalign to speed command
Make dhparam, dsaparam, ecparam, x509 output C in proper style
Make some internal ocsp.c functions void
Only display cert usages with -help in verify
Use global bio_err, remove "BIO*err" parameter from functions
For filenames, - always means stdin (or stdout as appropriate)
Add aliases for -des/aes "wrap" ciphers.
*Remove support for IISSGC (server gated crypto)
*The undocumented OCSP -header flag is now "-header name=value"
*Documented the OCSP -header flag
Reviewed-by: Matt Caswell <matt@openssl.org>
2015-04-25 03:26:15 +08:00
|
|
|
int do_X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md,
|
2015-01-22 11:40:55 +08:00
|
|
|
STACK_OF(OPENSSL_STRING) *sigopts);
|
2020-03-11 06:08:59 +08:00
|
|
|
int do_X509_verify(X509 *x, EVP_PKEY *pkey, STACK_OF(OPENSSL_STRING) *vfyopts);
|
Big apps cleanup (option-parsing, etc)
This is merges the old "rsalz-monolith" branch over to master. The biggest
change is that option parsing switch from cascasding 'else if strcmp("-foo")'
to a utility routine and somethin akin to getopt. Also, an error in the
command line no longer prints the full summary; use -help (or --help :)
for that. There have been many other changes and code-cleanup, see
bullet list below.
Special thanks to Matt for the long and detailed code review.
TEMPORARY:
For now, comment out CRYPTO_mem_leaks() at end of main
Tickets closed:
RT3515: Use 3DES in pkcs12 if built with no-rc2
RT1766: s_client -reconnect and -starttls broke
RT2932: Catch write errors
RT2604: port should be 'unsigned short'
RT2983: total_bytes undeclared #ifdef RENEG
RT1523: Add -nocert to fix output in x509 app
RT3508: Remove unused variable introduced by b09eb24
RT3511: doc fix; req default serial is random
RT1325,2973: Add more extensions to c_rehash
RT2119,3407: Updated to dgst.pod
RT2379: Additional typo fix
RT2693: Extra include of string.h
RT2880: HFS is case-insensitive filenames
RT3246: req command prints version number wrong
Other changes; incompatibilities marked with *:
Add SCSV support
Add -misalign to speed command
Make dhparam, dsaparam, ecparam, x509 output C in proper style
Make some internal ocsp.c functions void
Only display cert usages with -help in verify
Use global bio_err, remove "BIO*err" parameter from functions
For filenames, - always means stdin (or stdout as appropriate)
Add aliases for -des/aes "wrap" ciphers.
*Remove support for IISSGC (server gated crypto)
*The undocumented OCSP -header flag is now "-header name=value"
*Documented the OCSP -header flag
Reviewed-by: Matt Caswell <matt@openssl.org>
2015-04-25 03:26:15 +08:00
|
|
|
int do_X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md,
|
2015-01-22 11:40:55 +08:00
|
|
|
STACK_OF(OPENSSL_STRING) *sigopts);
|
2020-03-11 06:05:09 +08:00
|
|
|
int do_X509_REQ_verify(X509_REQ *x, EVP_PKEY *pkey,
|
|
|
|
STACK_OF(OPENSSL_STRING) *vfyopts);
|
Big apps cleanup (option-parsing, etc)
This is merges the old "rsalz-monolith" branch over to master. The biggest
change is that option parsing switch from cascasding 'else if strcmp("-foo")'
to a utility routine and somethin akin to getopt. Also, an error in the
command line no longer prints the full summary; use -help (or --help :)
for that. There have been many other changes and code-cleanup, see
bullet list below.
Special thanks to Matt for the long and detailed code review.
TEMPORARY:
For now, comment out CRYPTO_mem_leaks() at end of main
Tickets closed:
RT3515: Use 3DES in pkcs12 if built with no-rc2
RT1766: s_client -reconnect and -starttls broke
RT2932: Catch write errors
RT2604: port should be 'unsigned short'
RT2983: total_bytes undeclared #ifdef RENEG
RT1523: Add -nocert to fix output in x509 app
RT3508: Remove unused variable introduced by b09eb24
RT3511: doc fix; req default serial is random
RT1325,2973: Add more extensions to c_rehash
RT2119,3407: Updated to dgst.pod
RT2379: Additional typo fix
RT2693: Extra include of string.h
RT2880: HFS is case-insensitive filenames
RT3246: req command prints version number wrong
Other changes; incompatibilities marked with *:
Add SCSV support
Add -misalign to speed command
Make dhparam, dsaparam, ecparam, x509 output C in proper style
Make some internal ocsp.c functions void
Only display cert usages with -help in verify
Use global bio_err, remove "BIO*err" parameter from functions
For filenames, - always means stdin (or stdout as appropriate)
Add aliases for -des/aes "wrap" ciphers.
*Remove support for IISSGC (server gated crypto)
*The undocumented OCSP -header flag is now "-header name=value"
*Documented the OCSP -header flag
Reviewed-by: Matt Caswell <matt@openssl.org>
2015-04-25 03:26:15 +08:00
|
|
|
int do_X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md,
|
2015-01-22 11:40:55 +08:00
|
|
|
STACK_OF(OPENSSL_STRING) *sigopts);
|
2017-06-13 21:28:45 +08:00
|
|
|
|
2008-11-16 20:47:12 +08:00
|
|
|
extern char *psk_key;
|
2017-06-13 21:28:45 +08:00
|
|
|
|
2002-05-20 00:31:10 +08:00
|
|
|
|
2016-03-05 21:47:55 +08:00
|
|
|
unsigned char *next_protos_parse(size_t *outlen, const char *in);
|
2012-06-04 06:00:21 +08:00
|
|
|
|
2012-10-08 23:10:07 +08:00
|
|
|
void print_cert_checks(BIO *bio, X509 *x,
|
2015-01-22 11:40:55 +08:00
|
|
|
const char *checkhost,
|
|
|
|
const char *checkemail, const char *checkip);
|
2012-10-08 23:10:07 +08:00
|
|
|
|
2012-12-07 02:43:40 +08:00
|
|
|
void store_setup_crl_download(X509_STORE *st);
|
|
|
|
|
2019-10-31 06:39:35 +08:00
|
|
|
typedef struct app_http_tls_info_st {
|
|
|
|
const char *server;
|
|
|
|
const char *port;
|
|
|
|
int use_proxy;
|
|
|
|
long timeout;
|
|
|
|
SSL_CTX *ssl_ctx;
|
|
|
|
} APP_HTTP_TLS_INFO;
|
|
|
|
BIO *app_http_tls_cb(BIO *hbio, /* APP_HTTP_TLS_INFO */ void *arg,
|
|
|
|
int connect, int detail);
|
|
|
|
# ifndef OPENSSL_NO_SOCK
|
|
|
|
ASN1_VALUE *app_http_get_asn1(const char *url, const char *proxy,
|
2020-02-20 01:00:26 +08:00
|
|
|
const char *no_proxy, SSL_CTX *ssl_ctx,
|
2019-10-31 06:39:35 +08:00
|
|
|
const STACK_OF(CONF_VALUE) *headers,
|
|
|
|
long timeout, const char *expected_content_type,
|
|
|
|
const ASN1_ITEM *it);
|
|
|
|
ASN1_VALUE *app_http_post_asn1(const char *host, const char *port,
|
|
|
|
const char *path, const char *proxy,
|
2020-02-20 01:00:26 +08:00
|
|
|
const char *no_proxy, SSL_CTX *ctx,
|
2019-10-31 06:39:35 +08:00
|
|
|
const STACK_OF(CONF_VALUE) *headers,
|
|
|
|
const char *content_type,
|
|
|
|
ASN1_VALUE *req, const ASN1_ITEM *req_it,
|
|
|
|
long timeout, const ASN1_ITEM *rsp_it);
|
|
|
|
# endif
|
|
|
|
|
2015-01-22 11:40:55 +08:00
|
|
|
# define EXT_COPY_NONE 0
|
|
|
|
# define EXT_COPY_ADD 1
|
|
|
|
# define EXT_COPY_ALL 2
|
|
|
|
|
|
|
|
# define NETSCAPE_CERT_HDR "certificate"
|
|
|
|
|
|
|
|
# define APP_PASS_LEN 1024
|
|
|
|
|
2017-08-17 03:49:25 +08:00
|
|
|
/*
|
|
|
|
* IETF RFC 5280 says serial number must be <= 20 bytes. Use 159 bits
|
|
|
|
* so that the first bit will never be one, so that the DER encoding
|
|
|
|
* rules won't force a leading octet.
|
|
|
|
*/
|
|
|
|
# define SERIAL_RAND_BITS 159
|
2004-04-20 20:05:26 +08:00
|
|
|
|
2005-11-04 17:30:55 +08:00
|
|
|
int app_isdir(const char *);
|
Big apps cleanup (option-parsing, etc)
This is merges the old "rsalz-monolith" branch over to master. The biggest
change is that option parsing switch from cascasding 'else if strcmp("-foo")'
to a utility routine and somethin akin to getopt. Also, an error in the
command line no longer prints the full summary; use -help (or --help :)
for that. There have been many other changes and code-cleanup, see
bullet list below.
Special thanks to Matt for the long and detailed code review.
TEMPORARY:
For now, comment out CRYPTO_mem_leaks() at end of main
Tickets closed:
RT3515: Use 3DES in pkcs12 if built with no-rc2
RT1766: s_client -reconnect and -starttls broke
RT2932: Catch write errors
RT2604: port should be 'unsigned short'
RT2983: total_bytes undeclared #ifdef RENEG
RT1523: Add -nocert to fix output in x509 app
RT3508: Remove unused variable introduced by b09eb24
RT3511: doc fix; req default serial is random
RT1325,2973: Add more extensions to c_rehash
RT2119,3407: Updated to dgst.pod
RT2379: Additional typo fix
RT2693: Extra include of string.h
RT2880: HFS is case-insensitive filenames
RT3246: req command prints version number wrong
Other changes; incompatibilities marked with *:
Add SCSV support
Add -misalign to speed command
Make dhparam, dsaparam, ecparam, x509 output C in proper style
Make some internal ocsp.c functions void
Only display cert usages with -help in verify
Use global bio_err, remove "BIO*err" parameter from functions
For filenames, - always means stdin (or stdout as appropriate)
Add aliases for -des/aes "wrap" ciphers.
*Remove support for IISSGC (server gated crypto)
*The undocumented OCSP -header flag is now "-header name=value"
*Documented the OCSP -header flag
Reviewed-by: Matt Caswell <matt@openssl.org>
2015-04-25 03:26:15 +08:00
|
|
|
int app_access(const char *, int flag);
|
2016-09-15 17:20:18 +08:00
|
|
|
int fileno_stdin(void);
|
|
|
|
int fileno_stdout(void);
|
2015-01-22 11:40:55 +08:00
|
|
|
int raw_read_stdin(void *, int);
|
|
|
|
int raw_write_stdout(const void *, int);
|
2005-11-06 19:40:59 +08:00
|
|
|
|
2015-01-22 11:40:55 +08:00
|
|
|
# define TM_START 0
|
|
|
|
# define TM_STOP 1
|
|
|
|
double app_tminterval(int stop, int usertime);
|
2010-07-28 18:06:55 +08:00
|
|
|
|
2017-02-10 05:20:59 +08:00
|
|
|
void make_uppercase(char *string);
|
|
|
|
|
2016-08-02 03:30:57 +08:00
|
|
|
typedef struct verify_options_st {
|
|
|
|
int depth;
|
|
|
|
int quiet;
|
|
|
|
int error;
|
|
|
|
int return_error;
|
|
|
|
} VERIFY_CB_ARGS;
|
|
|
|
|
|
|
|
extern VERIFY_CB_ARGS verify_args;
|
2015-09-05 20:32:58 +08:00
|
|
|
|
2020-07-23 15:40:40 +08:00
|
|
|
OPENSSL_CTX *app_create_libctx(void);
|
|
|
|
OPENSSL_CTX *app_get0_libctx(void);
|
2019-08-24 16:56:34 +08:00
|
|
|
OSSL_PARAM *app_params_new_from_opts(STACK_OF(OPENSSL_STRING) *opts,
|
|
|
|
const OSSL_PARAM *paramdefs);
|
|
|
|
void app_params_free(OSSL_PARAM *params);
|
2020-07-23 15:40:40 +08:00
|
|
|
int app_provider_load(OPENSSL_CTX *libctx, const char *provider_name);
|
2020-04-09 10:47:46 +08:00
|
|
|
void app_providers_cleanup(void);
|
2019-08-24 16:56:34 +08:00
|
|
|
|
2020-07-24 20:53:27 +08:00
|
|
|
OPENSSL_CTX *app_get0_libctx(void);
|
|
|
|
const char *app_get0_propq(void);
|
|
|
|
|
2010-07-28 18:06:55 +08:00
|
|
|
#endif
|