From e5fa864f62c096536d700d977a5eb924ad293304 Mon Sep 17 00:00:00 2001 From: "Dr. Stephen Henson" Date: Wed, 15 Apr 2009 15:27:03 +0000 Subject: [PATCH] Updates from 1.0.0-stable. --- CHANGES | 8 +++ apps/dgst.c | 54 ++++++++---------- apps/pkeyparam.c | 2 +- apps/pkeyutl.c | 2 +- apps/req.c | 10 ++-- crypto/bio/bio.h | 1 + crypto/bio/bss_dgram.c | 55 ++++++++++++++++++ crypto/dsa/dsa_asn1.c | 9 ++- crypto/evp/evp.h | 1 + crypto/evp/evp_lib.c | 5 ++ crypto/evp/names.c | 4 +- crypto/x509/x509_vfy.c | 2 +- crypto/x509v3/v3_cpols.c | 1 + doc/apps/ca.pod | 2 +- doc/apps/ciphers.pod | 37 +++++++++++++ doc/apps/cms.pod | 27 ++++----- doc/apps/dgst.pod | 47 ++++++++++++++++ doc/apps/dhparam.pod | 2 +- doc/apps/dsa.pod | 2 +- doc/apps/dsaparam.pod | 2 +- doc/apps/ec.pod | 2 +- doc/apps/ecparam.pod | 2 +- doc/apps/enc.pod | 60 ++++++++++++++++++-- doc/apps/gendsa.pod | 2 +- doc/apps/genpkey.pod | 39 +++++++++++-- doc/apps/genrsa.pod | 2 +- doc/apps/openssl.pod | 44 ++++++++++++--- doc/apps/pkcs7.pod | 2 +- doc/apps/pkcs8.pod | 2 +- doc/apps/pkey.pod | 2 +- doc/apps/pkeyparam.pod | 2 +- doc/apps/pkeyutl.pod | 20 ++++++- doc/apps/req.pod | 78 +++++++++++++++++++++----- doc/apps/rsa.pod | 2 +- doc/apps/s_client.pod | 7 ++- doc/apps/s_server.pod | 2 +- doc/apps/smime.pod | 27 ++++----- doc/apps/speed.pod | 2 +- doc/apps/spkac.pod | 2 +- doc/apps/ts.pod | 2 +- doc/apps/verify.pod | 69 +++++++++++++++++++++++ doc/apps/x509.pod | 2 +- engines/ccgost/e_gost_err.c | 1 + engines/ccgost/e_gost_err.h | 1 + engines/ccgost/gost_crypt.c | 5 +- ssl/d1_both.c | 107 +++++++++++++++++++++++++++--------- ssl/d1_clnt.c | 10 ++++ ssl/d1_lib.c | 13 ++++- ssl/d1_pkt.c | 72 ++++++++++++++++++++---- ssl/d1_srvr.c | 14 +++++ ssl/dtls1.h | 24 ++++++++ ssl/ssl_locl.h | 2 + util/libeay.num | 1 + util/mkerr.pl | 82 +++++++++++++++++++++++++-- util/mkstack.pl | 16 +++++- util/selftest.pl | 4 +- util/ssleay.num | 6 +- 57 files changed, 826 insertions(+), 177 deletions(-) diff --git a/CHANGES b/CHANGES index dff85b2b6e..93282bf639 100644 --- a/CHANGES +++ b/CHANGES @@ -4,6 +4,14 @@ Changes between 0.9.8k and 1.0 [xx XXX xxxx] + *) Add "missing" function EVP_MD_flags() (without this the only way to + retrieve a digest flags is by accessing the structure directly. Update + EVP_MD_do_all*() and EVP_CIPHER_do_all*() to include the name a digest + or cipher is registered as in the "from" argument. Print out all + registered digests in the dgst usage message instead of manually + attempting to work them out. + [Steve Henson] + *) If no SSLv2 ciphers are used don't use an SSLv2 compatible client hello: this allows the use of compression and extensions. Change default cipher string to remove SSLv2 ciphersuites. This effectively avoids ancient SSLv2 diff --git a/apps/dgst.c b/apps/dgst.c index 6a6e7ba6cf..59814908c1 100644 --- a/apps/dgst.c +++ b/apps/dgst.c @@ -79,6 +79,26 @@ int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout, const char *sig_name, const char *md_name, const char *file,BIO *bmd); +static void list_md_fn(const EVP_MD *m, + const char *from, const char *to, void *arg) + { + const char *mname; + /* Skip aliases */ + if (!m) + return; + mname = OBJ_nid2ln(EVP_MD_type(m)); + /* Skip shortnames */ + if (strcmp(from, mname)) + return; + /* Skip clones */ + if (EVP_MD_flags(m) & EVP_MD_FLAG_PKEY_DIGEST) + return; + if (strchr(mname, ' ')) + mname= EVP_MD_name(m); + BIO_printf(arg, "-%-14s to use the %s message digest algorithm\n", + mname, mname); + } + int MAIN(int, char **); int MAIN(int argc, char **argv) @@ -249,43 +269,17 @@ int MAIN(int argc, char **argv) BIO_printf(bio_err,"-verify file verify a signature using public key in file\n"); BIO_printf(bio_err,"-prverify file verify a signature using private key in file\n"); BIO_printf(bio_err,"-keyform arg key file format (PEM or ENGINE)\n"); + BIO_printf(bio_err,"-out filename output to filename rather than stdout\n"); BIO_printf(bio_err,"-signature file signature to verify\n"); BIO_printf(bio_err,"-sigopt nm:v signature parameter\n"); BIO_printf(bio_err,"-hmac key create hashed MAC with key\n"); + BIO_printf(bio_err,"-mac algorithm create MAC (not neccessarily HMAC)\n"); + BIO_printf(bio_err,"-macopt nm:v MAC algorithm parameters or key\n"); #ifndef OPENSSL_NO_ENGINE BIO_printf(bio_err,"-engine e use engine e, possibly a hardware device.\n"); #endif - BIO_printf(bio_err,"-%-14s to use the %s message digest algorithm (default)\n", - LN_md5,LN_md5); - BIO_printf(bio_err,"-%-14s to use the %s message digest algorithm\n", - LN_md4,LN_md4); - BIO_printf(bio_err,"-%-14s to use the %s message digest algorithm\n", - LN_md2,LN_md2); -#ifndef OPENSSL_NO_SHA - BIO_printf(bio_err,"-%-14s to use the %s message digest algorithm\n", - LN_sha1,LN_sha1); -#ifndef OPENSSL_NO_SHA256 - BIO_printf(bio_err,"-%-14s to use the %s message digest algorithm\n", - LN_sha224,LN_sha224); - BIO_printf(bio_err,"-%-14s to use the %s message digest algorithm\n", - LN_sha256,LN_sha256); -#endif -#ifndef OPENSSL_NO_SHA512 - BIO_printf(bio_err,"-%-14s to use the %s message digest algorithm\n", - LN_sha384,LN_sha384); - BIO_printf(bio_err,"-%-14s to use the %s message digest algorithm\n", - LN_sha512,LN_sha512); -#endif -#endif - BIO_printf(bio_err,"-%-14s to use the %s message digest algorithm\n", - LN_mdc2,LN_mdc2); - BIO_printf(bio_err,"-%-14s to use the %s message digest algorithm\n", - LN_ripemd160,LN_ripemd160); -#ifndef OPENSSL_NO_WHIRLPOOL - BIO_printf(bio_err,"-%-14s to use the %s message digest algorithm\n", - SN_whirlpool,SN_whirlpool); -#endif + EVP_MD_do_all_sorted(list_md_fn, bio_err); goto end; } diff --git a/apps/pkeyparam.c b/apps/pkeyparam.c index 4319eb4de5..7f18010f9d 100644 --- a/apps/pkeyparam.c +++ b/apps/pkeyparam.c @@ -179,7 +179,7 @@ int MAIN(int argc, char **argv) pkey = PEM_read_bio_Parameters(in, NULL); if (!pkey) { - BIO_printf(bio_err, "Error reading paramters\n"); + BIO_printf(bio_err, "Error reading parameters\n"); ERR_print_errors(bio_err); goto end; } diff --git a/apps/pkeyutl.c b/apps/pkeyutl.c index b808e1ef49..22a6c4bf39 100644 --- a/apps/pkeyutl.c +++ b/apps/pkeyutl.c @@ -390,7 +390,7 @@ static void usage() BIO_printf(bio_err, "Usage: pkeyutl [options]\n"); BIO_printf(bio_err, "-in file input file\n"); BIO_printf(bio_err, "-out file output file\n"); - BIO_printf(bio_err, "-signature file signature file (verify operation only)\n"); + BIO_printf(bio_err, "-sigfile file signature file (verify operation only)\n"); BIO_printf(bio_err, "-inkey file input key\n"); BIO_printf(bio_err, "-keyform arg private key format - default PEM\n"); BIO_printf(bio_err, "-pubin input is a public key\n"); diff --git a/apps/req.c b/apps/req.c index e728d5bf95..3b4ab28e5d 100644 --- a/apps/req.c +++ b/apps/req.c @@ -365,11 +365,6 @@ int MAIN(int argc, char **argv) serial = s2i_ASN1_INTEGER(NULL, *(++argv)); if (!serial) goto bad; } - else if ((md_alg=EVP_get_digestbyname(&((*argv)[1]))) != NULL) - { - /* ok */ - digest=md_alg; - } else if (strcmp(*argv,"-extensions") == 0) { if (--argc < 1) goto bad; @@ -380,6 +375,11 @@ int MAIN(int argc, char **argv) if (--argc < 1) goto bad; req_exts = *(++argv); } + else if ((md_alg=EVP_get_digestbyname(&((*argv)[1]))) != NULL) + { + /* ok */ + digest=md_alg; + } else { BIO_printf(bio_err,"unknown option %s\n",*argv); diff --git a/crypto/bio/bio.h b/crypto/bio/bio.h index ea5323d20f..3371342fc1 100644 --- a/crypto/bio/bio.h +++ b/crypto/bio/bio.h @@ -159,6 +159,7 @@ extern "C" { #define BIO_CTRL_DGRAM_SET_PEER 44 /* Destination for the data */ +#define BIO_CTRL_DGRAM_SET_TIMEOUT 45 /* modifiers */ #define BIO_FP_READ 0x02 diff --git a/crypto/bio/bss_dgram.c b/crypto/bio/bss_dgram.c index c3da6dc82f..dde0abe05a 100644 --- a/crypto/bio/bss_dgram.c +++ b/crypto/bio/bss_dgram.c @@ -66,6 +66,10 @@ #include +#ifdef OPENSSL_SYS_WIN32 +#include +#endif + #define IP_MTU 14 /* linux is lame */ #ifdef WATT32 @@ -104,6 +108,8 @@ typedef struct bio_dgram_data_st unsigned int connected; unsigned int _errno; unsigned int mtu; + struct timeval hstimeoutdiff; + struct timeval hstimeout; } bio_dgram_data; BIO_METHOD *BIO_s_datagram(void) @@ -196,6 +202,30 @@ static int dgram_read(BIO *b, char *out, int outl) BIO_set_retry_read(b); data->_errno = get_last_socket_error(); } + memset(&(data->hstimeout), 0, sizeof(struct timeval)); + } + else + { + if (data->hstimeout.tv_sec > 0 || data->hstimeout.tv_usec > 0) + { + struct timeval curtime; +#ifdef OPENSSL_SYS_WIN32 + struct _timeb tb; + _ftime(&tb); + curtime.tv_sec = (long)tb.time; + curtime.tv_usec = (long)tb.millitm * 1000; +#else + gettimeofday(&curtime, NULL); +#endif + + if (curtime.tv_sec >= data->hstimeout.tv_sec && + curtime.tv_usec >= data->hstimeout.tv_usec) + { + data->_errno = EAGAIN; + ret = -1; + memset(&(data->hstimeout), 0, sizeof(struct timeval)); + } + } } } return(ret); @@ -345,6 +375,30 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr) memcpy(&(data->peer), to, sizeof(struct sockaddr)); break; + case BIO_CTRL_DGRAM_SET_TIMEOUT: + if (num > 0) + { +#ifdef OPENSSL_SYS_WIN32 + struct _timeb tb; + _ftime(&tb); + data->hstimeout.tv_sec = (long)tb.time; + data->hstimeout.tv_usec = (long)tb.millitm * 1000; +#else + gettimeofday(&(data->hstimeout), NULL); +#endif + data->hstimeout.tv_sec += data->hstimeoutdiff.tv_sec; + data->hstimeout.tv_usec += data->hstimeoutdiff.tv_usec; + if (data->hstimeout.tv_usec >= 1000000) + { + data->hstimeout.tv_sec++; + data->hstimeout.tv_usec -= 1000000; + } + } + else + { + memset(&(data->hstimeout), 0, sizeof(struct timeval)); + } + break; #if defined(SO_RCVTIMEO) case BIO_CTRL_DGRAM_SET_RECV_TIMEOUT: #ifdef OPENSSL_SYS_WINDOWS @@ -360,6 +414,7 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr) sizeof(struct timeval)) < 0) { perror("setsockopt"); ret = -1; } #endif + memcpy(&(data->hstimeoutdiff), ptr, sizeof(struct timeval)); break; case BIO_CTRL_DGRAM_GET_RECV_TIMEOUT: #ifdef OPENSSL_SYS_WINDOWS diff --git a/crypto/dsa/dsa_asn1.c b/crypto/dsa/dsa_asn1.c index 084bd451c6..8277a74be2 100644 --- a/crypto/dsa/dsa_asn1.c +++ b/crypto/dsa/dsa_asn1.c @@ -69,12 +69,15 @@ static int sig_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, if(operation == ASN1_OP_NEW_PRE) { DSA_SIG *sig; sig = OPENSSL_malloc(sizeof(DSA_SIG)); + if (!sig) + { + DSAerr(DSA_F_SIG_CB, ERR_R_MALLOC_FAILURE); + return 0; + } sig->r = NULL; sig->s = NULL; *pval = (ASN1_VALUE *)sig; - if(sig) return 2; - DSAerr(DSA_F_SIG_CB, ERR_R_MALLOC_FAILURE); - return 0; + return 2; } return 1; } diff --git a/crypto/evp/evp.h b/crypto/evp/evp.h index a73f7434b8..4eecdbeea7 100644 --- a/crypto/evp/evp.h +++ b/crypto/evp/evp.h @@ -421,6 +421,7 @@ int EVP_MD_type(const EVP_MD *md); int EVP_MD_pkey_type(const EVP_MD *md); int EVP_MD_size(const EVP_MD *md); int EVP_MD_block_size(const EVP_MD *md); +unsigned long EVP_MD_flags(const EVP_MD *md); const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx); #define EVP_MD_CTX_size(e) EVP_MD_size(EVP_MD_CTX_md(e)) diff --git a/crypto/evp/evp_lib.c b/crypto/evp/evp_lib.c index d815bc6d6f..b92a6626fa 100644 --- a/crypto/evp/evp_lib.c +++ b/crypto/evp/evp_lib.c @@ -263,6 +263,11 @@ int EVP_MD_size(const EVP_MD *md) return md->md_size; } +unsigned long EVP_MD_flags(const EVP_MD *md) + { + return md->flags; + } + const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx) { if (!ctx) diff --git a/crypto/evp/names.c b/crypto/evp/names.c index feaf80dfe8..7e4d742a66 100644 --- a/crypto/evp/names.c +++ b/crypto/evp/names.c @@ -145,7 +145,7 @@ static void do_all_cipher_fn(const OBJ_NAME *nm, void *arg) if (nm->alias) dc->fn(NULL, nm->name, nm->data, dc->arg); else - dc->fn((const EVP_CIPHER *)nm->data, NULL, NULL, dc->arg); + dc->fn((const EVP_CIPHER *)nm->data, nm->name, NULL, dc->arg); } void EVP_CIPHER_do_all(void (*fn)(const EVP_CIPHER *ciph, @@ -179,7 +179,7 @@ static void do_all_md_fn(const OBJ_NAME *nm, void *arg) if (nm->alias) dc->fn(NULL, nm->name, nm->data, dc->arg); else - dc->fn((const EVP_MD *)nm->data, NULL, NULL, dc->arg); + dc->fn((const EVP_MD *)nm->data, nm->name, NULL, dc->arg); } void EVP_MD_do_all(void (*fn)(const EVP_MD *md, diff --git a/crypto/x509/x509_vfy.c b/crypto/x509/x509_vfy.c index f662124d76..9ff66cff13 100644 --- a/crypto/x509/x509_vfy.c +++ b/crypto/x509/x509_vfy.c @@ -1124,7 +1124,7 @@ static int check_crl_path(X509_STORE_CTX *ctx, X509 *x) /* Verify CRL issuer */ ret = X509_verify_cert(&crl_ctx); - if (!ret) + if (ret <= 0) goto err; /* Check chain is acceptable */ diff --git a/crypto/x509v3/v3_cpols.c b/crypto/x509v3/v3_cpols.c index b452ac4e53..1f0798b946 100644 --- a/crypto/x509v3/v3_cpols.c +++ b/crypto/x509v3/v3_cpols.c @@ -453,4 +453,5 @@ void X509_POLICY_NODE_print(BIO *out, X509_POLICY_NODE *node, int indent) IMPLEMENT_STACK_OF(X509_POLICY_NODE) +IMPLEMENT_STACK_OF(X509_POLICY_DATA) diff --git a/doc/apps/ca.pod b/doc/apps/ca.pod index 2ffffaaab0..9ff0cc3612 100644 --- a/doc/apps/ca.pod +++ b/doc/apps/ca.pod @@ -217,7 +217,7 @@ used). =item B<-engine id> -specifying an engine (by it's unique B string) will cause B +specifying an engine (by its unique B string) will cause B to attempt to obtain a functional reference to the specified engine, thus initialising it if needed. The engine will then be set as the default for all available algorithms. diff --git a/doc/apps/ciphers.pod b/doc/apps/ciphers.pod index 22c219bbfb..7c6608d67d 100644 --- a/doc/apps/ciphers.pod +++ b/doc/apps/ciphers.pod @@ -251,6 +251,33 @@ cipher suites using MD5. cipher suites using SHA1. +=item B + +cipher suites using GOST R 34.10 (either 2001 or 94) for authenticaction +(needs an engine supporting GOST algorithms). + +=item B + +cipher suites using GOST R 34.10-2001 authentication. + +=item B + +cipher suites using GOST R 34.10-94 authentication (note that R 34.10-94 +standard has been expired so use GOST R 34.10-2001) + +=item B + +cipher suites, using VKO 34.10 key exchange, specified in the RFC 4357. + +=item B + +cipher suites, using HMAC based on GOST R 34.11-94. + +=item B + +cipher suites using GOST 28147-89 MAC B HMAC. + + =back =head1 CIPHER SUITE NAMES @@ -376,6 +403,16 @@ e.g. DES-CBC3-SHA. In these cases, RSA authentication is used. TLS_DH_anon_WITH_SEED_CBC_SHA ADH-SEED-SHA +=head2 GOST ciphersuites from draft-chudov-cryptopro-cptls, extending TLS v1.0 + +Note: these ciphers require an engine which including GOST cryptographic +algorithms, such as the B engine, included in the OpenSSL distribution. + + TLS_GOSTR341094_WITH_28147_CNT_IMIT GOST94-GOST89-GOST89 + TLS_GOSTR341001_WITH_28147_CNT_IMIT GOST2001-GOST89-GOST89 + TLS_GOSTR341094_WITH_NULL_GOSTR3411 GOST94-NULL-GOST94 + TLS_GOSTR341001_WITH_NULL_GOSTR3411 GOST2001-NULL-GOST94 + =head2 Additional Export 1024 and other cipher suites Note: these ciphers can also be used in SSL v3. diff --git a/doc/apps/cms.pod b/doc/apps/cms.pod index 7bc7e65e40..520279eeab 100644 --- a/doc/apps/cms.pod +++ b/doc/apps/cms.pod @@ -36,17 +36,7 @@ B B [B<-CAfile file>] [B<-CApath dir>] [B<-md digest>] -[B<-des>] -[B<-des3>] -[B<-rc2-40>] -[B<-rc2-64>] -[B<-rc2-128>] -[B<-aes128>] -[B<-aes192>] -[B<-aes256>] -[B<-camellia128>] -[B<-camellia192>] -[B<-camellia256>] +[B<-[cipher]>] [B<-nointern>] [B<-no_signer_cert_verify>] [B<-nocerts>] @@ -253,13 +243,13 @@ to each certificate. digest algorithm to use when signing or resigning. If not present then the default digest algorithm for the signing key will be used (usually SHA1). -=item B<-des -des3 -rc2-40 -rc2-64 -rc2-128 -aes128 -aes192 -aes256 -camellia128 -camellia192 -camellia256> +=item B<-[cipher]> -the encryption algorithm to use. DES (56 bits), triple DES (168 bits), 40, 64 -or 128 bit RC2, 128, 192 or 256 bit AES, or 128, 192 or 256 bit Camellia -respectively. Any other cipher name (as recognized by the +the encryption algorithm to use. For example triple DES (168 bits) - B<-des3> +or 256 bit AES - B<-aes256>. Any standard algorithm name (as used by the EVP_get_cipherbyname() function) can also be used preceded by a dash, for -example B<-aes_128_cbc>. +example B<-aes_128_cbc>. See L|enc(1)> for a list of ciphers +supported by your version of OpenSSL. If not specified triple DES is used. Only used with B<-encrypt> and B<-EncryptedData_create> commands. @@ -411,6 +401,11 @@ portion of a message so they may be included manually. If signing then many S/MIME mail clients check the signers certificate's email address matches that specified in the From: address. +=item B<-purpose, -ignore_critical, -issuer_checks, -crl_check, -crl_check_all, -policy_check, -extended_crl, -x509_strict, -policy> + +Set various certificate chain valiadition option. See the +L|verify(1)> manual page for details. + =back =head1 NOTES diff --git a/doc/apps/dgst.pod b/doc/apps/dgst.pod index 908cd2a6d6..b035edf08e 100644 --- a/doc/apps/dgst.pod +++ b/doc/apps/dgst.pod @@ -14,6 +14,7 @@ B B [B<-binary>] [B<-out filename>] [B<-sign filename>] +[B<-keyform arg>] [B<-passin arg>] [B<-verify filename>] [B<-prverify filename>] @@ -61,6 +62,23 @@ filename to output to, or standard output by default. digitally sign the digest using the private key in "filename". +=item B<-keyform arg> + +Specifies the key format to sign digest with. Only PEM and ENGINE +formats are supported by the B command. + +=item B<-engine id> + +Use engine B for operations (including private key storage). +This engine is not used as source for digest algorithms, unless it is +also specified in the configuration file. + +=item B<-sigopt nm:v> + +Pass options to the signature algorithm during sign or verify operations. +Names and values of these options are algorithm-specific. + + =item B<-passin arg> the private key password source. For more information about the format of B @@ -83,6 +101,35 @@ the actual signature to verify. create a hashed MAC using "key". +=item B<-mac alg> + +create MAC (keyed Message Authentication Code). The most popular MAC +algorithm is HMAC (hash-based MAC), but there are other MAC algorithms +which are not based on hash, for instance B algorithm, +supported by B engine. MAC keys and other options should be set +via B<-macopt> parameter. + +=item B<-macopt nm:v> + +Passes options to MAC algorithm, specified by B<-mac> key. +Following options are supported by both by B and B: + +=over 8 + +=item B + +Specifies MAC key as alphnumeric string (use if key contain printable +characters only). String length must conform to any restrictions of +the MAC algorithm for example exactly 32 chars for gost-mac. + +=item B + +Specifies MAC key in hexadecimal form (two hex digits per byte). +Key length must conform to any restrictions of the MAC algorithm +for example exactly 32 chars for gost-mac. + +=back + =item B<-rand file(s)> a file or files containing random data used to seed the random number diff --git a/doc/apps/dhparam.pod b/doc/apps/dhparam.pod index c31db95a47..9edb4ff4e1 100644 --- a/doc/apps/dhparam.pod +++ b/doc/apps/dhparam.pod @@ -99,7 +99,7 @@ be loaded by calling the BIB<()> function. =item B<-engine id> -specifying an engine (by it's unique B string) will cause B +specifying an engine (by its unique B string) will cause B to attempt to obtain a functional reference to the specified engine, thus initialising it if needed. The engine will then be set as the default for all available algorithms. diff --git a/doc/apps/dsa.pod b/doc/apps/dsa.pod index ed06b8806d..ddbc9327fa 100644 --- a/doc/apps/dsa.pod +++ b/doc/apps/dsa.pod @@ -109,7 +109,7 @@ a public key. =item B<-engine id> -specifying an engine (by it's unique B string) will cause B +specifying an engine (by its unique B string) will cause B to attempt to obtain a functional reference to the specified engine, thus initialising it if needed. The engine will then be set as the default for all available algorithms. diff --git a/doc/apps/dsaparam.pod b/doc/apps/dsaparam.pod index b9b1b93b42..ba5ec4d72c 100644 --- a/doc/apps/dsaparam.pod +++ b/doc/apps/dsaparam.pod @@ -85,7 +85,7 @@ the input file (if any) is ignored. =item B<-engine id> -specifying an engine (by it's unique B string) will cause B +specifying an engine (by its unique B string) will cause B to attempt to obtain a functional reference to the specified engine, thus initialising it if needed. The engine will then be set as the default for all available algorithms. diff --git a/doc/apps/ec.pod b/doc/apps/ec.pod index 1d4a36dbf4..ba6dc4689b 100644 --- a/doc/apps/ec.pod +++ b/doc/apps/ec.pod @@ -130,7 +130,7 @@ is currently not implemented in OpenSSL. =item B<-engine id> -specifying an engine (by it's unique B string) will cause B +specifying an engine (by its unique B string) will cause B to attempt to obtain a functional reference to the specified engine, thus initialising it if needed. The engine will then be set as the default for all available algorithms. diff --git a/doc/apps/ecparam.pod b/doc/apps/ecparam.pod index 1a12105da7..788c074d7b 100644 --- a/doc/apps/ecparam.pod +++ b/doc/apps/ecparam.pod @@ -121,7 +121,7 @@ all others. =item B<-engine id> -specifying an engine (by it's unique B string) will cause B +specifying an engine (by its unique B string) will cause B to attempt to obtain a functional reference to the specified engine, thus initialising it if needed. The engine will then be set as the default for all available algorithms. diff --git a/doc/apps/enc.pod b/doc/apps/enc.pod index 4391c93360..018365ba40 100644 --- a/doc/apps/enc.pod +++ b/doc/apps/enc.pod @@ -12,17 +12,24 @@ B [B<-pass arg>] [B<-e>] [B<-d>] -[B<-a>] +[B<-a/-base64>] [B<-A>] [B<-k password>] [B<-kfile filename>] [B<-K key>] [B<-iv IV>] +[B<-S salt>] +[B<-salt>] +[B<-nosalt>] +[B<-z>] +[B<-md>] [B<-p>] [B<-P>] [B<-bufsize number>] [B<-nopad>] [B<-debug>] +[B<-none>] +[B<-engine id>] =head1 DESCRIPTION @@ -74,6 +81,10 @@ base64 process the data. This means that if encryption is taking place the data is base64 encoded after encryption. If decryption is set then the input data is base64 decoded before being decrypted. +=item B<-base64> + +same as B<-a> + =item B<-A> if the B<-a> option is set then base64 process the data on one line. @@ -89,10 +100,18 @@ read the password to derive the key from the first line of B. This is for compatibility with previous versions of OpenSSL. Superseded by the B<-pass> argument. +=item B<-nosalt> + +do not use a salt + +=item B<-salt> + +use salt (randomly generated or provide with B<-S> option) when +encrypting (this is the default). + =item B<-S salt> -the actual salt to use: this must be represented as a string comprised only -of hex digits. +the actual salt to use: this must be represented as a string of hex digits. =item B<-K key> @@ -131,12 +150,34 @@ disable standard block padding debug the BIOs used for I/O. +=item B<-z> + +Compress or decompress clear text using zlib before encryption or after +decryption. This option exists only if OpenSSL with compiled with zlib +or zlib-dynamic option. + +=item B<-none> + +Use NULL cipher (no encryption or decryption of input). + =back =head1 NOTES The program can be called either as B or -B. +B. But the first form doesn't work with +engine-provided ciphers, because this form is processed before the +configuration file is read and any ENGINEs loaded. + +Engines which provide entirely new encryption algorithms (such as ccgost +engine which provides gost89 algorithm) should be configured in the +configuration file. Engines, specified in the command line using -engine +options can only be used for hadrware-assisted implementations of +ciphers, which are supported by OpenSSL core or other engine, specified +in the configuration file. + +When enc command lists supported ciphers, ciphers provided by engines, +specified in the configuration files are listed too. A password will be prompted for to derive the key and IV if necessary. @@ -169,6 +210,14 @@ Blowfish and RC5 algorithms use a 128 bit key. =head1 SUPPORTED CIPHERS +Note that some of these ciphers can be disabled at compile time +and some are available only if an appropriate engine is configured +in the configuration file. The output of the B command run with +unsupported options (for example B) includes a +list of ciphers, supported by your versesion of OpenSSL, including +ones provided by configured engines. + + base64 Base 64 bf-cbc Blowfish in CBC mode @@ -203,6 +252,9 @@ Blowfish and RC5 algorithms use a 128 bit key. desx DESX algorithm. + gost89 GOST 28147-89 in CFB mode (provided by ccgost engine) + gost89-cnt `GOST 28147-89 in CNT mode (provided by ccgost engine) + idea-cbc IDEA algorithm in CBC mode idea same as idea-cbc idea-cfb IDEA in CFB mode diff --git a/doc/apps/gendsa.pod b/doc/apps/gendsa.pod index 2c56cc7888..8c7f114ca0 100644 --- a/doc/apps/gendsa.pod +++ b/doc/apps/gendsa.pod @@ -40,7 +40,7 @@ all others. =item B<-engine id> -specifying an engine (by it's unique B string) will cause B +specifying an engine (by its unique B string) will cause B to attempt to obtain a functional reference to the specified engine, thus initialising it if needed. The engine will then be set as the default for all available algorithms. diff --git a/doc/apps/genpkey.pod b/doc/apps/genpkey.pod index 69c7a051fe..1611b5ca78 100644 --- a/doc/apps/genpkey.pod +++ b/doc/apps/genpkey.pod @@ -47,7 +47,7 @@ name accepted by EVP_get_cipherbyname() is acceptable such as B. =item B<-engine id> -specifying an engine (by it's unique B string) will cause B +specifying an engine (by its unique B string) will cause B to attempt to obtain a functional reference to the specified engine, thus initialising it if needed. The engine will then be set as the default for all available algorithms. If used this option should precede all other @@ -138,6 +138,37 @@ the EC curve to use. =back +=head1 GOST2001 KEY GENERATION AND PARAMETER OPTIONS + +Gost 2001 support is not enabled by default. To enable this algorithm, +one should load the ccgost engine in the OpenSSL configuration file. +See README.gost file in the engines/ccgost directiry of the source +distribution for more details. + +Use of a parameter file for the GOST R 34.10 algorithm is optional. +Parameters can be specified during key generation directly as well as +during generation of parameter file. + +=over 4 + +=item B + +Specifies GOST R 34.10-2001 parameter set according to RFC 4357. +Parameter set can be specified using abbreviated name, object short name or +numeric OID. Following parameter sets are supported: + + paramset OID Usage + A 1.2.643.2.2.35.1 Signature + B 1.2.643.2.2.35.2 Signature + C 1.2.643.2.2.35.3 Signature + XA 1.2.643.2.2.36.0 Key exchange + XB 1.2.643.2.2.36.1 Key exchange + test 1.2.643.2.2.35.0 Test purposes + +=back + + + =head1 NOTES The use of the genpkey program is encouraged over the algorithm specific @@ -148,15 +179,15 @@ can be used. Generate an RSA private key using default parameters: - openssl genpkey -algoritm RSA -out key.pem + openssl genpkey -algorithm RSA -out key.pem Encrypt output private key using 128 bit AES and the passphrase "hello": - openssl genpkey -algoritm RSA -out key.pem -aes-128-cbc -pass pass:hello + openssl genpkey -algorithm RSA -out key.pem -aes-128-cbc -pass pass:hello Generate a 2048 bit RSA key using 3 as the public exponent: - openssl genpkey -algoritm RSA -out key.pem -pkeyopt rsa_keygen_bits:2048 \ + openssl genpkey -algorithm RSA -out key.pem -pkeyopt rsa_keygen_bits:2048 \ -pkeyopt rsa_keygen_pubexp:3 Generate 1024 bit DSA parameters: diff --git a/doc/apps/genrsa.pod b/doc/apps/genrsa.pod index 25af4d1475..7dcac2a779 100644 --- a/doc/apps/genrsa.pod +++ b/doc/apps/genrsa.pod @@ -57,7 +57,7 @@ all others. =item B<-engine id> -specifying an engine (by it's unique B string) will cause B +specifying an engine (by its unique B string) will cause B to attempt to obtain a functional reference to the specified engine, thus initialising it if needed. The engine will then be set as the default for all available algorithms. diff --git a/doc/apps/openssl.pod b/doc/apps/openssl.pod index fad99029bc..2b83c35b9e 100644 --- a/doc/apps/openssl.pod +++ b/doc/apps/openssl.pod @@ -81,6 +81,10 @@ Certificate Authority (CA) Management. Cipher Suite Description Determination. +=item L|cms(1)> + +CMS (Cryptographic Message Syntax) utility + =item L|crl(1)> Certificate Revocation List (CRL) Management. @@ -98,6 +102,12 @@ Message Digest Calculation. Diffie-Hellman Parameter Management. Obsoleted by L|dhparam(1)>. +=item L|dhparam(1)> + +Generation and Management of Diffie-Hellman Parameters. Superseded by +L|genpkey(1)> and L|pkeyparam(1)> + + =item L|dsa(1)> DSA Data Management. @@ -107,18 +117,25 @@ DSA Data Management. DSA Parameter Generation and Management. Superseded by L|genpkey(1)> and L|pkeyparam(1)> +=item L|ec(1)> + +EC (Elliptic curve) key processing + +=item L|ecparam(1)> + +EC parameter manipulation and generation + =item L|enc(1)> Encoding with Ciphers. -=item L|errstr(1)> +=item L|engine(1)> -Error Number to Error String Conversion. +Engine (loadble module) information and manipulation. -=item L|dhparam(1)> +=item L|errstr(1)> -Generation and Management of Diffie-Hellman Parameters. Superseded by -L|genpkey(1)> and L|pkeyparam(1)> +Error Number to Error String Conversion. =item B @@ -138,6 +155,10 @@ Generation of Private Key or Parameters. Generation of RSA Private Key. Superceded by L|genpkey(1)>. +=item L|nseq(1) + +Create or examine a netscape certificate sequence + =item L|ocsp(1)> Online Certificate Status Protocol utility. @@ -158,14 +179,14 @@ PKCS#7 Data Management. Public and private key management. -=item L|pkeyutl(1)> - -Public key algorithm cryptographic operation utility. - =item L|pkeyparam(1)> Public key algorithm parameter management. +=item L|pkeyutl(1)> + +Public key algorithm cryptographic operation utility. + =item L|rand(1)> Generate pseudo-random bytes. @@ -178,6 +199,7 @@ PKCS#10 X.509 Certificate Signing Request (CSR) Management. RSA key management. + =item L|rsautl(1)> RSA utility for signing, verification, encryption, and decryption. Superseded @@ -215,6 +237,10 @@ S/MIME mail processing. Algorithm Speed Measurement. +=item L|spkac(1)> + +SPKAC printing and generating utility + =item L|ts(1)> Time Stamping Authority tool (client/server) diff --git a/doc/apps/pkcs7.pod b/doc/apps/pkcs7.pod index a0a636328b..acfb8100f0 100644 --- a/doc/apps/pkcs7.pod +++ b/doc/apps/pkcs7.pod @@ -62,7 +62,7 @@ is B<-print_certs> is set). =item B<-engine id> -specifying an engine (by it's unique B string) will cause B +specifying an engine (by its unique B string) will cause B to attempt to obtain a functional reference to the specified engine, thus initialising it if needed. The engine will then be set as the default for all available algorithms. diff --git a/doc/apps/pkcs8.pod b/doc/apps/pkcs8.pod index 68ecd65b10..84abee78f3 100644 --- a/doc/apps/pkcs8.pod +++ b/doc/apps/pkcs8.pod @@ -125,7 +125,7 @@ list of possible algorithms is included below. =item B<-engine id> -specifying an engine (by it's unique B string) will cause B +specifying an engine (by its unique B string) will cause B to attempt to obtain a functional reference to the specified engine, thus initialising it if needed. The engine will then be set as the default for all available algorithms. diff --git a/doc/apps/pkey.pod b/doc/apps/pkey.pod index 6bd1fc1ba4..4851223f3f 100644 --- a/doc/apps/pkey.pod +++ b/doc/apps/pkey.pod @@ -94,7 +94,7 @@ the input is a public key. =item B<-engine id> -specifying an engine (by it's unique B string) will cause B +specifying an engine (by its unique B string) will cause B to attempt to obtain a functional reference to the specified engine, thus initialising it if needed. The engine will then be set as the default for all available algorithms. diff --git a/doc/apps/pkeyparam.pod b/doc/apps/pkeyparam.pod index 453fd027f8..154f6721af 100644 --- a/doc/apps/pkeyparam.pod +++ b/doc/apps/pkeyparam.pod @@ -43,7 +43,7 @@ do not output the encoded version of the parameters. =item B<-engine id> -specifying an engine (by it's unique B string) will cause B +specifying an engine (by its unique B string) will cause B to attempt to obtain a functional reference to the specified engine, thus initialising it if needed. The engine will then be set as the default for all available algorithms. diff --git a/doc/apps/pkeyutl.pod b/doc/apps/pkeyutl.pod index 74055df2e6..27be9a9007 100644 --- a/doc/apps/pkeyutl.pod +++ b/doc/apps/pkeyutl.pod @@ -12,6 +12,7 @@ B B [B<-sigfile file>] [B<-inkey file>] [B<-keyform PEM|DER>] +[B<-passin arg>] [B<-peerkey file>] [B<-peerform PEM|DER>] [B<-pubin>] @@ -26,6 +27,7 @@ B B [B<-pkeyopt opt:value>] [B<-hexdump>] [B<-asn1parse>] +[B<-engine id>] =head1 DESCRIPTION @@ -52,7 +54,13 @@ the input key file, by default it should be a private key. =item B<-keyform PEM|DER> -the key format PEM or DER. +the key format PEM, DER or ENGINE. + +=item B<-passin arg> + +the input key password source. For more information about the format of B +see the B section in L. + =item B<-peerkey file> @@ -60,7 +68,15 @@ the peer key file, used by key derivation (agreement) operations. =item B<-peerform PEM|DER> -the peer key format PEM or DER. +the peer key format PEM, DER or ENGINE. + +=item B<-engine id> + +specifying an engine (by its unique B string) will cause B +to attempt to obtain a functional reference to the specified engine, +thus initialising it if needed. The engine will then be set as the default +for all available algorithms. + =item B<-pubin> diff --git a/doc/apps/req.pod b/doc/apps/req.pod index 2ba16b45d6..ff48bbdf28 100644 --- a/doc/apps/req.pod +++ b/doc/apps/req.pod @@ -22,13 +22,13 @@ B B [B<-new>] [B<-rand file(s)>] [B<-newkey rsa:bits>] -[B<-newkey dsa:file>] [B<-newkey alg:file>] [B<-nodes>] [B<-key filename>] [B<-keyform PEM|DER>] [B<-keyout filename>] -[B<-[md5|sha1|md2|mdc2]>] +[B<-keygen_engine id>] +[B<-[digest]>] [B<-config filename>] [B<-subj arg>] [B<-multivalue-rdn>] @@ -36,11 +36,15 @@ B B [B<-days n>] [B<-set_serial n>] [B<-asn1-kludge>] +[B<-no-asn1-kludge>] [B<-newhdr>] [B<-extensions section>] [B<-reqexts section>] [B<-utf8>] [B<-nameopt>] +[B<-reqopt>] +[B<-subject>] +[B<-subj arg>] [B<-batch>] [B<-verbose>] [B<-engine id>] @@ -92,6 +96,11 @@ see the B section in L. prints out the certificate request in text form. +=item B<-subject> + +prints out the request subject (or certificate subject if B<-x509> is +specified) + =item B<-pubkey> outputs the public key. @@ -119,6 +128,13 @@ in the configuration file and any requested extensions. If the B<-key> option is not used it will generate a new RSA private key using information specified in the configuration file. +=item B<-subj arg> + +Replaces subject field of input request with specified data and outputs +modified request. The arg must be formatted as +I, +characters may be escaped by \ (backslash), no spaces are skipped. + =item B<-rand file(s)> a file or files containing random data used to seed the random number @@ -132,12 +148,26 @@ all others. this option creates a new certificate request and a new private key. The argument takes one of several forms. B, where B is the number of bits, generates an RSA key B -in size. B generates a DSA key using the parameters -in the file B. B generates a key using the -parameter file B, the algorithm is determined by the -parameters. B use algorithm B and parameter file -B the two algorithms must match or an error occurs. B just -uses algorithm B. +in size. If B is omitted, i.e. B<-newkey rsa> specified, +the default key size, specified in the configuration file is used. + +All other algorithms support the B<-newkey alg:file> form, where file may be +an algorithm parameter file, created by the B command +or and X.509 certificate for a key with approriate algorithm. + +B generates a key using the parameter file or certificate B, +the algorithm is determined by the parameters. B use algorithm +B and parameter file B: the two algorithms must match or an +error occurs. B just uses algorithm B, and parameters, +if neccessary should be specified via B<-pkeyopt> parameter. + +B generates a DSA key using the parameters +in the file B. B generates EC key (usable both with +ECDSA or ECDH algorithms), B generates GOST R +34.10-2001 key (requires B engine configured in the configuration +file). If just B is specified a parameter set should be +specified by B<-pkeyopt paramset:X> + =item B<-pkeyopt opt:value> @@ -167,11 +197,15 @@ configuration file is used. if this option is specified then if a private key is created it will not be encrypted. -=item B<-[md5|sha1|md2|mdc2]> +=item B<-[digest]> + +this specifies the message digest to sign the request with (such as +B<-md5>, B<-sha1>). This overrides the digest algorithm specified in +the configuration file. -this specifies the message digest to sign the request with. This -overrides the digest algorithm specified in the configuration file. -This option is ignored for DSA requests: they always use SHA1. +Some public key algorithms may override this choice. For instance, DSA +signatures always use SHA1, GOST R 34.10 signatures always use +GOST R 34.11-94 (B<-md_gost94>). =item B<-config filename> @@ -239,6 +273,15 @@ B