diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2009-04-15 15:27:03 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2009-04-15 15:27:03 +0000 |
commit | e5fa864f62c096536d700d977a5eb924ad293304 (patch) | |
tree | f97991450654a74c8f8ace4ea11e88a1c055818f | |
parent | 22c98d4aad76f39ab19e5b63e1448c7d28ca7617 (diff) |
Updates from 1.0.0-stable.
57 files changed, 826 insertions, 177 deletions
@@ -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 <openssl/bio.h> +#ifdef OPENSSL_SYS_WIN32 +#include <sys/timeb.h> +#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<id> string) will cause B<req> +specifying an engine (by its unique B<id> string) will cause B<ca> 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<aGOST> + +cipher suites using GOST R 34.10 (either 2001 or 94) for authenticaction +(needs an engine supporting GOST algorithms). + +=item B<aGOST01> + +cipher suites using GOST R 34.10-2001 authentication. + +=item B<aGOST94> + +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<kGOST> + +cipher suites, using VKO 34.10 key exchange, specified in the RFC 4357. + +=item B<GOST94> + +cipher suites, using HMAC based on GOST R 34.11-94. + +=item B<GOST89MAC> + +cipher suites using GOST 28147-89 MAC B<instead of> 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<ccgost> 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<openssl> B<cms> [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<B<enc>|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<B<verify>|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<openssl> B<dgst> [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<dgst> command. + +=item B<-engine id> + +Use engine B<id> 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<arg> @@ -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<gost-mac> algorithm, +supported by B<ccgost> 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<HMAC> and B<gost-mac>: + +=over 8 + +=item B<key:string> + +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<hexkey:string> + +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 B<get_dh>I<numbits>B<()> function. =item B<-engine id> -specifying an engine (by it's unique B<id> string) will cause B<req> +specifying an engine (by its unique B<id> string) will cause B<dhparam> 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< |