mirror of https://github.com/openssl/openssl.git
				
				
				
			Updates from 1.0.0-stable.
This commit is contained in:
		
							parent
							
								
									22c98d4aad
								
							
						
					
					
						commit
						e5fa864f62
					
				
							
								
								
									
										8
									
								
								CHANGES
								
								
								
								
							
							
						
						
									
										8
									
								
								CHANGES
								
								
								
								
							|  | @ -4,6 +4,14 @@ | ||||||
| 
 | 
 | ||||||
|  Changes between 0.9.8k and 1.0  [xx XXX xxxx] |  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: |   *) 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 |      this allows the use of compression and extensions. Change default cipher | ||||||
|      string to remove SSLv2 ciphersuites. This effectively avoids ancient SSLv2 |      string to remove SSLv2 ciphersuites. This effectively avoids ancient SSLv2 | ||||||
|  |  | ||||||
							
								
								
									
										54
									
								
								apps/dgst.c
								
								
								
								
							
							
						
						
									
										54
									
								
								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 *sig_name, const char *md_name, | ||||||
| 	  const char *file,BIO *bmd); | 	  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, char **); | ||||||
| 
 | 
 | ||||||
| int MAIN(int argc, char **argv) | 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,"-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,"-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,"-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,"-signature file signature to verify\n"); | ||||||
| 		BIO_printf(bio_err,"-sigopt nm:v    signature parameter\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,"-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 | #ifndef OPENSSL_NO_ENGINE | ||||||
| 		BIO_printf(bio_err,"-engine e       use engine e, possibly a hardware device.\n"); | 		BIO_printf(bio_err,"-engine e       use engine e, possibly a hardware device.\n"); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 		BIO_printf(bio_err,"-%-14s to use the %s message digest algorithm (default)\n", | 		EVP_MD_do_all_sorted(list_md_fn, bio_err); | ||||||
| 			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 |  | ||||||
| 		goto end; | 		goto end; | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -179,7 +179,7 @@ int MAIN(int argc, char **argv) | ||||||
| 	pkey = PEM_read_bio_Parameters(in, NULL); | 	pkey = PEM_read_bio_Parameters(in, NULL); | ||||||
| 	if (!pkey) | 	if (!pkey) | ||||||
| 		{ | 		{ | ||||||
| 		BIO_printf(bio_err, "Error reading paramters\n"); | 		BIO_printf(bio_err, "Error reading parameters\n"); | ||||||
| 		ERR_print_errors(bio_err); | 		ERR_print_errors(bio_err); | ||||||
| 		goto end; | 		goto end; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
|  | @ -390,7 +390,7 @@ static void usage() | ||||||
| 	BIO_printf(bio_err, "Usage: pkeyutl [options]\n"); | 	BIO_printf(bio_err, "Usage: pkeyutl [options]\n"); | ||||||
| 	BIO_printf(bio_err, "-in file        input file\n"); | 	BIO_printf(bio_err, "-in file        input file\n"); | ||||||
| 	BIO_printf(bio_err, "-out file       output 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, "-inkey file     input key\n"); | ||||||
| 	BIO_printf(bio_err, "-keyform arg    private key format - default PEM\n"); | 	BIO_printf(bio_err, "-keyform arg    private key format - default PEM\n"); | ||||||
| 	BIO_printf(bio_err, "-pubin          input is a public key\n"); | 	BIO_printf(bio_err, "-pubin          input is a public key\n"); | ||||||
|  |  | ||||||
							
								
								
									
										10
									
								
								apps/req.c
								
								
								
								
							
							
						
						
									
										10
									
								
								apps/req.c
								
								
								
								
							|  | @ -365,11 +365,6 @@ int MAIN(int argc, char **argv) | ||||||
| 			serial = s2i_ASN1_INTEGER(NULL, *(++argv)); | 			serial = s2i_ASN1_INTEGER(NULL, *(++argv)); | ||||||
| 			if (!serial) goto bad; | 			if (!serial) goto bad; | ||||||
| 			} | 			} | ||||||
| 		else if ((md_alg=EVP_get_digestbyname(&((*argv)[1]))) != NULL) |  | ||||||
| 			{ |  | ||||||
| 			/* ok */ |  | ||||||
| 			digest=md_alg; |  | ||||||
| 			} |  | ||||||
| 		else if (strcmp(*argv,"-extensions") == 0) | 		else if (strcmp(*argv,"-extensions") == 0) | ||||||
| 			{ | 			{ | ||||||
| 			if (--argc < 1) goto bad; | 			if (--argc < 1) goto bad; | ||||||
|  | @ -380,6 +375,11 @@ int MAIN(int argc, char **argv) | ||||||
| 			if (--argc < 1) goto bad; | 			if (--argc < 1) goto bad; | ||||||
| 			req_exts = *(++argv); | 			req_exts = *(++argv); | ||||||
| 			} | 			} | ||||||
|  | 		else if ((md_alg=EVP_get_digestbyname(&((*argv)[1]))) != NULL) | ||||||
|  | 			{ | ||||||
|  | 			/* ok */ | ||||||
|  | 			digest=md_alg; | ||||||
|  | 			} | ||||||
| 		else | 		else | ||||||
| 			{ | 			{ | ||||||
| 			BIO_printf(bio_err,"unknown option %s\n",*argv); | 			BIO_printf(bio_err,"unknown option %s\n",*argv); | ||||||
|  |  | ||||||
|  | @ -159,6 +159,7 @@ extern "C" { | ||||||
| 
 | 
 | ||||||
| #define BIO_CTRL_DGRAM_SET_PEER           44 /* Destination for the data */ | #define BIO_CTRL_DGRAM_SET_PEER           44 /* Destination for the data */ | ||||||
| 
 | 
 | ||||||
|  | #define BIO_CTRL_DGRAM_SET_TIMEOUT        45 | ||||||
| 
 | 
 | ||||||
| /* modifiers */ | /* modifiers */ | ||||||
| #define BIO_FP_READ		0x02 | #define BIO_FP_READ		0x02 | ||||||
|  |  | ||||||
|  | @ -66,6 +66,10 @@ | ||||||
| 
 | 
 | ||||||
| #include <openssl/bio.h> | #include <openssl/bio.h> | ||||||
| 
 | 
 | ||||||
|  | #ifdef OPENSSL_SYS_WIN32 | ||||||
|  | #include <sys/timeb.h> | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
| #define IP_MTU      14 /* linux is lame */ | #define IP_MTU      14 /* linux is lame */ | ||||||
| 
 | 
 | ||||||
| #ifdef WATT32 | #ifdef WATT32 | ||||||
|  | @ -104,6 +108,8 @@ typedef struct bio_dgram_data_st | ||||||
| 	unsigned int connected; | 	unsigned int connected; | ||||||
| 	unsigned int _errno; | 	unsigned int _errno; | ||||||
| 	unsigned int mtu; | 	unsigned int mtu; | ||||||
|  | 	struct timeval hstimeoutdiff; | ||||||
|  | 	struct timeval hstimeout; | ||||||
| 	} bio_dgram_data; | 	} bio_dgram_data; | ||||||
| 
 | 
 | ||||||
| BIO_METHOD *BIO_s_datagram(void) | 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); | 				BIO_set_retry_read(b); | ||||||
| 				data->_errno = get_last_socket_error(); | 				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); | 	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)); |         memcpy(&(data->peer), to, sizeof(struct sockaddr)); | ||||||
|         break; |         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) | #if defined(SO_RCVTIMEO) | ||||||
| 	case BIO_CTRL_DGRAM_SET_RECV_TIMEOUT: | 	case BIO_CTRL_DGRAM_SET_RECV_TIMEOUT: | ||||||
| #ifdef OPENSSL_SYS_WINDOWS | #ifdef OPENSSL_SYS_WINDOWS | ||||||
|  | @ -360,6 +414,7 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr) | ||||||
| 			sizeof(struct timeval)) < 0) | 			sizeof(struct timeval)) < 0) | ||||||
| 			{ perror("setsockopt");	ret = -1; } | 			{ perror("setsockopt");	ret = -1; } | ||||||
| #endif | #endif | ||||||
|  | 		memcpy(&(data->hstimeoutdiff), ptr, sizeof(struct timeval)); | ||||||
| 		break; | 		break; | ||||||
| 	case BIO_CTRL_DGRAM_GET_RECV_TIMEOUT: | 	case BIO_CTRL_DGRAM_GET_RECV_TIMEOUT: | ||||||
| #ifdef OPENSSL_SYS_WINDOWS | #ifdef OPENSSL_SYS_WINDOWS | ||||||
|  |  | ||||||
|  | @ -69,12 +69,15 @@ static int sig_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, | ||||||
| 	if(operation == ASN1_OP_NEW_PRE) { | 	if(operation == ASN1_OP_NEW_PRE) { | ||||||
| 		DSA_SIG *sig; | 		DSA_SIG *sig; | ||||||
| 		sig = OPENSSL_malloc(sizeof(DSA_SIG)); | 		sig = OPENSSL_malloc(sizeof(DSA_SIG)); | ||||||
|  | 		if (!sig) | ||||||
|  | 			{ | ||||||
|  | 			DSAerr(DSA_F_SIG_CB, ERR_R_MALLOC_FAILURE); | ||||||
|  | 			return 0; | ||||||
|  | 			} | ||||||
| 		sig->r = NULL; | 		sig->r = NULL; | ||||||
| 		sig->s = NULL; | 		sig->s = NULL; | ||||||
| 		*pval = (ASN1_VALUE *)sig; | 		*pval = (ASN1_VALUE *)sig; | ||||||
| 		if(sig) return 2; | 		return 2; | ||||||
| 		DSAerr(DSA_F_SIG_CB, ERR_R_MALLOC_FAILURE); |  | ||||||
| 		return 0; |  | ||||||
| 	} | 	} | ||||||
| 	return 1; | 	return 1; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -421,6 +421,7 @@ int EVP_MD_type(const EVP_MD *md); | ||||||
| int EVP_MD_pkey_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_size(const EVP_MD *md); | ||||||
| int EVP_MD_block_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); | 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)) | #define EVP_MD_CTX_size(e)		EVP_MD_size(EVP_MD_CTX_md(e)) | ||||||
|  |  | ||||||
|  | @ -263,6 +263,11 @@ int EVP_MD_size(const EVP_MD *md) | ||||||
| 	return md->md_size; | 	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) | const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx) | ||||||
| 	{ | 	{ | ||||||
| 	if (!ctx) | 	if (!ctx) | ||||||
|  |  | ||||||
|  | @ -145,7 +145,7 @@ static void do_all_cipher_fn(const OBJ_NAME *nm, void *arg) | ||||||
| 	if (nm->alias) | 	if (nm->alias) | ||||||
| 		dc->fn(NULL, nm->name, nm->data, dc->arg); | 		dc->fn(NULL, nm->name, nm->data, dc->arg); | ||||||
| 	else | 	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, | 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) | 	if (nm->alias) | ||||||
| 		dc->fn(NULL, nm->name, nm->data, dc->arg); | 		dc->fn(NULL, nm->name, nm->data, dc->arg); | ||||||
| 	else | 	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, | void EVP_MD_do_all(void (*fn)(const EVP_MD *md, | ||||||
|  |  | ||||||
|  | @ -1124,7 +1124,7 @@ static int check_crl_path(X509_STORE_CTX *ctx, X509 *x) | ||||||
| 	/* Verify CRL issuer */ | 	/* Verify CRL issuer */ | ||||||
| 	ret = X509_verify_cert(&crl_ctx); | 	ret = X509_verify_cert(&crl_ctx); | ||||||
| 
 | 
 | ||||||
| 	if (!ret) | 	if (ret <= 0) | ||||||
| 		goto err; | 		goto err; | ||||||
| 
 | 
 | ||||||
| 	/* Check chain is acceptable */ | 	/* Check chain is acceptable */ | ||||||
|  |  | ||||||
|  | @ -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_NODE) | ||||||
|  | IMPLEMENT_STACK_OF(X509_POLICY_DATA) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -217,7 +217,7 @@ used). | ||||||
| 
 | 
 | ||||||
| =item B<-engine id> | =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, | 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 | thus initialising it if needed. The engine will then be set as the default | ||||||
| for all available algorithms. | for all available algorithms. | ||||||
|  |  | ||||||
|  | @ -251,6 +251,33 @@ cipher suites using MD5. | ||||||
| 
 | 
 | ||||||
| cipher suites using SHA1. | 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 | =back | ||||||
| 
 | 
 | ||||||
| =head1 CIPHER SUITE NAMES | =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 |  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 | =head2 Additional Export 1024 and other cipher suites | ||||||
| 
 | 
 | ||||||
| Note: these ciphers can also be used in SSL v3. | Note: these ciphers can also be used in SSL v3. | ||||||
|  |  | ||||||
|  | @ -36,17 +36,7 @@ B<openssl> B<cms> | ||||||
| [B<-CAfile file>] | [B<-CAfile file>] | ||||||
| [B<-CApath dir>] | [B<-CApath dir>] | ||||||
| [B<-md digest>] | [B<-md digest>] | ||||||
| [B<-des>] | [B<-[cipher]>] | ||||||
| [B<-des3>] |  | ||||||
| [B<-rc2-40>] |  | ||||||
| [B<-rc2-64>] |  | ||||||
| [B<-rc2-128>] |  | ||||||
| [B<-aes128>] |  | ||||||
| [B<-aes192>] |  | ||||||
| [B<-aes256>] |  | ||||||
| [B<-camellia128>] |  | ||||||
| [B<-camellia192>] |  | ||||||
| [B<-camellia256>] |  | ||||||
| [B<-nointern>] | [B<-nointern>] | ||||||
| [B<-no_signer_cert_verify>] | [B<-no_signer_cert_verify>] | ||||||
| [B<-nocerts>] | [B<-nocerts>] | ||||||
|  | @ -253,13 +243,13 @@ to each certificate. | ||||||
| digest algorithm to use when signing or resigning. If not present then the | 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). | 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 | the encryption algorithm to use. For example triple DES (168 bits) - B<-des3> | ||||||
| or 128 bit RC2, 128, 192 or 256 bit AES, or 128, 192 or 256 bit Camellia | or 256 bit AES - B<-aes256>. Any standard algorithm name (as used by the | ||||||
| respectively. Any other cipher name (as recognized by the |  | ||||||
| EVP_get_cipherbyname() function) can also be used preceded by a dash, for  | 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  | If not specified triple DES is used. Only used with B<-encrypt> and  | ||||||
| B<-EncryptedData_create> commands. | 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 | then many S/MIME mail clients check the signers certificate's email | ||||||
| address matches that specified in the From: address. | 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 | =back | ||||||
| 
 | 
 | ||||||
| =head1 NOTES | =head1 NOTES | ||||||
|  |  | ||||||
|  | @ -14,6 +14,7 @@ B<openssl> B<dgst> | ||||||
| [B<-binary>] | [B<-binary>] | ||||||
| [B<-out filename>] | [B<-out filename>] | ||||||
| [B<-sign filename>] | [B<-sign filename>] | ||||||
|  | [B<-keyform arg>] | ||||||
| [B<-passin arg>] | [B<-passin arg>] | ||||||
| [B<-verify filename>] | [B<-verify filename>] | ||||||
| [B<-prverify 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". | 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> | =item B<-passin arg> | ||||||
| 
 | 
 | ||||||
| the private key password source. For more information about the format of B<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". | 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)> | =item B<-rand file(s)> | ||||||
| 
 | 
 | ||||||
| a file or files containing random data used to seed the random number | a file or files containing random data used to seed the random number | ||||||
|  |  | ||||||
|  | @ -99,7 +99,7 @@ be loaded by calling the B<get_dh>I<numbits>B<()> function. | ||||||
| 
 | 
 | ||||||
| =item B<-engine id> | =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, | 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 | thus initialising it if needed. The engine will then be set as the default | ||||||
| for all available algorithms. | for all available algorithms. | ||||||
|  |  | ||||||
|  | @ -109,7 +109,7 @@ a public key. | ||||||
| 
 | 
 | ||||||
| =item B<-engine id> | =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<dsa> | ||||||
| to attempt to obtain a functional reference to the specified engine, | 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 | thus initialising it if needed. The engine will then be set as the default | ||||||
| for all available algorithms. | for all available algorithms. | ||||||
|  |  | ||||||
|  | @ -85,7 +85,7 @@ the input file (if any) is ignored. | ||||||
| 
 | 
 | ||||||
| =item B<-engine id> | =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<dsaparam> | ||||||
| to attempt to obtain a functional reference to the specified engine, | 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 | thus initialising it if needed. The engine will then be set as the default | ||||||
| for all available algorithms. | for all available algorithms. | ||||||
|  |  | ||||||
|  | @ -130,7 +130,7 @@ is currently not implemented in OpenSSL. | ||||||
| 
 | 
 | ||||||
| =item B<-engine id> | =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<ec> | ||||||
| to attempt to obtain a functional reference to the specified engine, | 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 | thus initialising it if needed. The engine will then be set as the default | ||||||
| for all available algorithms. | for all available algorithms. | ||||||
|  |  | ||||||
|  | @ -121,7 +121,7 @@ all others. | ||||||
| 
 | 
 | ||||||
| =item B<-engine id> | =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<ecparam> | ||||||
| to attempt to obtain a functional reference to the specified engine, | 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 | thus initialising it if needed. The engine will then be set as the default | ||||||
| for all available algorithms. | for all available algorithms. | ||||||
|  |  | ||||||
|  | @ -12,17 +12,24 @@ B<openssl enc -ciphername> | ||||||
| [B<-pass arg>] | [B<-pass arg>] | ||||||
| [B<-e>] | [B<-e>] | ||||||
| [B<-d>] | [B<-d>] | ||||||
| [B<-a>] | [B<-a/-base64>] | ||||||
| [B<-A>] | [B<-A>] | ||||||
| [B<-k password>] | [B<-k password>] | ||||||
| [B<-kfile filename>] | [B<-kfile filename>] | ||||||
| [B<-K key>] | [B<-K key>] | ||||||
| [B<-iv IV>] | [B<-iv IV>] | ||||||
|  | [B<-S salt>] | ||||||
|  | [B<-salt>] | ||||||
|  | [B<-nosalt>] | ||||||
|  | [B<-z>] | ||||||
|  | [B<-md>] | ||||||
| [B<-p>] | [B<-p>] | ||||||
| [B<-P>] | [B<-P>] | ||||||
| [B<-bufsize number>] | [B<-bufsize number>] | ||||||
| [B<-nopad>] | [B<-nopad>] | ||||||
| [B<-debug>] | [B<-debug>] | ||||||
|  | [B<-none>] | ||||||
|  | [B<-engine id>] | ||||||
| 
 | 
 | ||||||
| =head1 DESCRIPTION | =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 data is base64 encoded after encryption. If decryption is set then | ||||||
| the input data is base64 decoded before being decrypted. | the input data is base64 decoded before being decrypted. | ||||||
| 
 | 
 | ||||||
|  | =item B<-base64> | ||||||
|  | 
 | ||||||
|  | same as B<-a> | ||||||
|  | 
 | ||||||
| =item B<-A> | =item B<-A> | ||||||
| 
 | 
 | ||||||
| if the B<-a> option is set then base64 process the data on one line. | 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<filename>. | ||||||
| This is for compatibility with previous versions of OpenSSL. Superseded by | This is for compatibility with previous versions of OpenSSL. Superseded by | ||||||
| the B<-pass> argument. | 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> | =item B<-S salt> | ||||||
| 
 | 
 | ||||||
| the actual salt to use: this must be represented as a string comprised only | the actual salt to use: this must be represented as a string of hex digits. | ||||||
| of hex digits. |  | ||||||
| 
 | 
 | ||||||
| =item B<-K key> | =item B<-K key> | ||||||
| 
 | 
 | ||||||
|  | @ -131,12 +150,34 @@ disable standard block padding | ||||||
| 
 | 
 | ||||||
| debug the BIOs used for I/O. | 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 | =back | ||||||
| 
 | 
 | ||||||
| =head1 NOTES | =head1 NOTES | ||||||
| 
 | 
 | ||||||
| The program can be called either as B<openssl ciphername> or | The program can be called either as B<openssl ciphername> or | ||||||
| B<openssl enc -ciphername>. | B<openssl enc -ciphername>. 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. | 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 | =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<enc> command run with | ||||||
|  | unsupported options (for example B<openssl enc -help>) includes a | ||||||
|  | list of ciphers, supported by your versesion of OpenSSL, including | ||||||
|  | ones provided by configured engines. | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  base64             Base 64 |  base64             Base 64 | ||||||
| 
 | 
 | ||||||
|  bf-cbc             Blowfish in CBC mode |  bf-cbc             Blowfish in CBC mode | ||||||
|  | @ -203,6 +252,9 @@ Blowfish and RC5 algorithms use a 128 bit key. | ||||||
| 
 | 
 | ||||||
|  desx               DESX algorithm. |  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-cbc           IDEA algorithm in CBC mode | ||||||
|  idea               same as idea-cbc |  idea               same as idea-cbc | ||||||
|  idea-cfb           IDEA in CFB mode |  idea-cfb           IDEA in CFB mode | ||||||
|  |  | ||||||
|  | @ -40,7 +40,7 @@ all others. | ||||||
| 
 | 
 | ||||||
| =item B<-engine id> | =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<gendsa> | ||||||
| to attempt to obtain a functional reference to the specified engine, | 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 | thus initialising it if needed. The engine will then be set as the default | ||||||
| for all available algorithms. | for all available algorithms. | ||||||
|  |  | ||||||
|  | @ -47,7 +47,7 @@ name accepted by EVP_get_cipherbyname() is acceptable such as B<des3>. | ||||||
| 
 | 
 | ||||||
| =item B<-engine id> | =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<genpkey> | ||||||
| to attempt to obtain a functional reference to the specified engine, | 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 | 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 | for all available algorithms. If used this option should precede all other | ||||||
|  | @ -138,6 +138,37 @@ the EC curve to use. | ||||||
| 
 | 
 | ||||||
| =back | =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<paramset:name> | ||||||
|  | 
 | ||||||
|  | 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 | =head1 NOTES | ||||||
| 
 | 
 | ||||||
| The use of the genpkey program is encouraged over the algorithm specific | 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: | 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": | 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: | 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 |  						-pkeyopt rsa_keygen_pubexp:3 | ||||||
| 
 | 
 | ||||||
| Generate 1024 bit DSA parameters: | Generate 1024 bit DSA parameters: | ||||||
|  |  | ||||||
|  | @ -57,7 +57,7 @@ all others. | ||||||
| 
 | 
 | ||||||
| =item B<-engine id> | =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<genrsa> | ||||||
| to attempt to obtain a functional reference to the specified engine, | 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 | thus initialising it if needed. The engine will then be set as the default | ||||||
| for all available algorithms. | for all available algorithms. | ||||||
|  |  | ||||||
|  | @ -81,6 +81,10 @@ Certificate Authority (CA) Management. | ||||||
| 
 | 
 | ||||||
| Cipher Suite Description Determination. | Cipher Suite Description Determination. | ||||||
| 
 | 
 | ||||||
|  | =item L<B<cms>|cms(1)> | ||||||
|  | 
 | ||||||
|  | CMS (Cryptographic Message Syntax) utility | ||||||
|  | 
 | ||||||
| =item L<B<crl>|crl(1)> | =item L<B<crl>|crl(1)> | ||||||
| 
 | 
 | ||||||
| Certificate Revocation List (CRL) Management. | Certificate Revocation List (CRL) Management. | ||||||
|  | @ -98,6 +102,12 @@ Message Digest Calculation. | ||||||
| Diffie-Hellman Parameter Management. | Diffie-Hellman Parameter Management. | ||||||
| Obsoleted by L<B<dhparam>|dhparam(1)>. | Obsoleted by L<B<dhparam>|dhparam(1)>. | ||||||
| 
 | 
 | ||||||
|  | =item L<B<dhparam>|dhparam(1)> | ||||||
|  | 
 | ||||||
|  | Generation and Management of Diffie-Hellman Parameters. Superseded by  | ||||||
|  | L<B<genpkey>|genpkey(1)> and L<B<pkeyparam>|pkeyparam(1)> | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| =item L<B<dsa>|dsa(1)> | =item L<B<dsa>|dsa(1)> | ||||||
| 
 | 
 | ||||||
| DSA Data Management. | DSA Data Management. | ||||||
|  | @ -107,19 +117,26 @@ DSA Data Management. | ||||||
| DSA Parameter Generation and Management. Superseded by  | DSA Parameter Generation and Management. Superseded by  | ||||||
| L<B<genpkey>|genpkey(1)> and L<B<pkeyparam>|pkeyparam(1)> | L<B<genpkey>|genpkey(1)> and L<B<pkeyparam>|pkeyparam(1)> | ||||||
| 
 | 
 | ||||||
|  | =item L<B<ec>|ec(1)> | ||||||
|  | 
 | ||||||
|  | EC (Elliptic curve) key processing | ||||||
|  | 
 | ||||||
|  | =item L<B<ecparam>|ecparam(1)> | ||||||
|  | 
 | ||||||
|  | EC parameter manipulation and generation | ||||||
|  | 
 | ||||||
| =item L<B<enc>|enc(1)> | =item L<B<enc>|enc(1)> | ||||||
| 
 | 
 | ||||||
| Encoding with Ciphers. | Encoding with Ciphers. | ||||||
| 
 | 
 | ||||||
|  | =item L<B<engine>|engine(1)> | ||||||
|  | 
 | ||||||
|  | Engine (loadble module) information and manipulation. | ||||||
|  | 
 | ||||||
| =item L<B<errstr>|errstr(1)> | =item L<B<errstr>|errstr(1)> | ||||||
| 
 | 
 | ||||||
| Error Number to Error String Conversion. | Error Number to Error String Conversion. | ||||||
| 
 | 
 | ||||||
| =item L<B<dhparam>|dhparam(1)> |  | ||||||
| 
 |  | ||||||
| Generation and Management of Diffie-Hellman Parameters. Superseded by  |  | ||||||
| L<B<genpkey>|genpkey(1)> and L<B<pkeyparam>|pkeyparam(1)> |  | ||||||
| 
 |  | ||||||
| =item B<gendh> | =item B<gendh> | ||||||
| 
 | 
 | ||||||
| Generation of Diffie-Hellman Parameters. | Generation of Diffie-Hellman Parameters. | ||||||
|  | @ -138,6 +155,10 @@ Generation of Private Key or Parameters. | ||||||
| 
 | 
 | ||||||
| Generation of RSA Private Key. Superceded by L<B<genpkey>|genpkey(1)>. | Generation of RSA Private Key. Superceded by L<B<genpkey>|genpkey(1)>. | ||||||
| 
 | 
 | ||||||
|  | =item L<B<nseq>|nseq(1) | ||||||
|  | 
 | ||||||
|  | Create or examine a netscape certificate sequence | ||||||
|  | 
 | ||||||
| =item L<B<ocsp>|ocsp(1)> | =item L<B<ocsp>|ocsp(1)> | ||||||
| 
 | 
 | ||||||
| Online Certificate Status Protocol utility. | Online Certificate Status Protocol utility. | ||||||
|  | @ -158,14 +179,14 @@ PKCS#7 Data Management. | ||||||
| 
 | 
 | ||||||
| Public and private key management. | Public and private key management. | ||||||
| 
 | 
 | ||||||
| =item L<B<pkeyutl>|pkeyutl(1)> |  | ||||||
| 
 |  | ||||||
| Public key algorithm cryptographic operation utility. |  | ||||||
| 
 |  | ||||||
| =item L<B<pkeyparam>|pkeyparam(1)> | =item L<B<pkeyparam>|pkeyparam(1)> | ||||||
| 
 | 
 | ||||||
| Public key algorithm parameter management. | Public key algorithm parameter management. | ||||||
| 
 | 
 | ||||||
|  | =item L<B<pkeyutl>|pkeyutl(1)> | ||||||
|  | 
 | ||||||
|  | Public key algorithm cryptographic operation utility. | ||||||
|  | 
 | ||||||
| =item L<B<rand>|rand(1)> | =item L<B<rand>|rand(1)> | ||||||
| 
 | 
 | ||||||
| Generate pseudo-random bytes. | Generate pseudo-random bytes. | ||||||
|  | @ -178,6 +199,7 @@ PKCS#10 X.509 Certificate Signing Request (CSR) Management. | ||||||
| 
 | 
 | ||||||
| RSA key management. | RSA key management. | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
| =item L<B<rsautl>|rsautl(1)> | =item L<B<rsautl>|rsautl(1)> | ||||||
| 
 | 
 | ||||||
| RSA utility for signing, verification, encryption, and decryption. Superseded | RSA utility for signing, verification, encryption, and decryption. Superseded | ||||||
|  | @ -215,6 +237,10 @@ S/MIME mail processing. | ||||||
| 
 | 
 | ||||||
| Algorithm Speed Measurement. | Algorithm Speed Measurement. | ||||||
| 
 | 
 | ||||||
|  | =item L<B<spkac>|spkac(1)> | ||||||
|  | 
 | ||||||
|  | SPKAC printing and generating utility | ||||||
|  | 
 | ||||||
| =item L<B<ts>|ts(1)> | =item L<B<ts>|ts(1)> | ||||||
| 
 | 
 | ||||||
| Time Stamping Authority tool (client/server) | Time Stamping Authority tool (client/server) | ||||||
|  |  | ||||||
|  | @ -62,7 +62,7 @@ is B<-print_certs> is set). | ||||||
| 
 | 
 | ||||||
| =item B<-engine id> | =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<pkcs7> | ||||||
| to attempt to obtain a functional reference to the specified engine, | 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 | thus initialising it if needed. The engine will then be set as the default | ||||||
| for all available algorithms. | for all available algorithms. | ||||||
|  |  | ||||||
|  | @ -125,7 +125,7 @@ list of possible algorithms is included below. | ||||||
| 
 | 
 | ||||||
| =item B<-engine id> | =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<pkcs8> | ||||||
| to attempt to obtain a functional reference to the specified engine, | 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 | thus initialising it if needed. The engine will then be set as the default | ||||||
| for all available algorithms. | for all available algorithms. | ||||||
|  |  | ||||||
|  | @ -94,7 +94,7 @@ the input is a public key. | ||||||
| 
 | 
 | ||||||
| =item B<-engine id> | =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<pkey> | ||||||
| to attempt to obtain a functional reference to the specified engine, | 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 | thus initialising it if needed. The engine will then be set as the default | ||||||
| for all available algorithms. | for all available algorithms. | ||||||
|  |  | ||||||
|  | @ -43,7 +43,7 @@ do not output the encoded version of the parameters. | ||||||
| 
 | 
 | ||||||
| =item B<-engine id> | =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<pkeyparam> | ||||||
| to attempt to obtain a functional reference to the specified engine, | 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 | thus initialising it if needed. The engine will then be set as the default | ||||||
| for all available algorithms. | for all available algorithms. | ||||||
|  |  | ||||||
|  | @ -12,6 +12,7 @@ B<openssl> B<pkeyutl> | ||||||
| [B<-sigfile file>] | [B<-sigfile file>] | ||||||
| [B<-inkey file>] | [B<-inkey file>] | ||||||
| [B<-keyform PEM|DER>] | [B<-keyform PEM|DER>] | ||||||
|  | [B<-passin arg>] | ||||||
| [B<-peerkey file>] | [B<-peerkey file>] | ||||||
| [B<-peerform PEM|DER>] | [B<-peerform PEM|DER>] | ||||||
| [B<-pubin>] | [B<-pubin>] | ||||||
|  | @ -26,6 +27,7 @@ B<openssl> B<pkeyutl> | ||||||
| [B<-pkeyopt opt:value>] | [B<-pkeyopt opt:value>] | ||||||
| [B<-hexdump>] | [B<-hexdump>] | ||||||
| [B<-asn1parse>] | [B<-asn1parse>] | ||||||
|  | [B<-engine id>] | ||||||
| 
 | 
 | ||||||
| =head1 DESCRIPTION | =head1 DESCRIPTION | ||||||
| 
 | 
 | ||||||
|  | @ -52,7 +54,13 @@ the input key file, by default it should be a private key. | ||||||
| 
 | 
 | ||||||
| =item B<-keyform PEM|DER> | =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<arg> | ||||||
|  | see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| =item B<-peerkey file> | =item B<-peerkey file> | ||||||
| 
 | 
 | ||||||
|  | @ -60,7 +68,15 @@ the peer key file, used by key derivation (agreement) operations. | ||||||
| 
 | 
 | ||||||
| =item B<-peerform PEM|DER> | =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<id> string) will cause B<pkeyutl> | ||||||
|  | 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> | =item B<-pubin> | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -22,13 +22,13 @@ B<openssl> B<req> | ||||||
| [B<-new>] | [B<-new>] | ||||||
| [B<-rand file(s)>] | [B<-rand file(s)>] | ||||||
| [B<-newkey rsa:bits>] | [B<-newkey rsa:bits>] | ||||||
| [B<-newkey dsa:file>] |  | ||||||
| [B<-newkey alg:file>] | [B<-newkey alg:file>] | ||||||
| [B<-nodes>] | [B<-nodes>] | ||||||
| [B<-key filename>] | [B<-key filename>] | ||||||
| [B<-keyform PEM|DER>] | [B<-keyform PEM|DER>] | ||||||
| [B<-keyout filename>] | [B<-keyout filename>] | ||||||
| [B<-[md5|sha1|md2|mdc2]>] | [B<-keygen_engine id>] | ||||||
|  | [B<-[digest]>] | ||||||
| [B<-config filename>] | [B<-config filename>] | ||||||
| [B<-subj arg>] | [B<-subj arg>] | ||||||
| [B<-multivalue-rdn>] | [B<-multivalue-rdn>] | ||||||
|  | @ -36,11 +36,15 @@ B<openssl> B<req> | ||||||
| [B<-days n>] | [B<-days n>] | ||||||
| [B<-set_serial n>] | [B<-set_serial n>] | ||||||
| [B<-asn1-kludge>] | [B<-asn1-kludge>] | ||||||
|  | [B<-no-asn1-kludge>] | ||||||
| [B<-newhdr>] | [B<-newhdr>] | ||||||
| [B<-extensions section>] | [B<-extensions section>] | ||||||
| [B<-reqexts section>] | [B<-reqexts section>] | ||||||
| [B<-utf8>] | [B<-utf8>] | ||||||
| [B<-nameopt>] | [B<-nameopt>] | ||||||
|  | [B<-reqopt>] | ||||||
|  | [B<-subject>] | ||||||
|  | [B<-subj arg>] | ||||||
| [B<-batch>] | [B<-batch>] | ||||||
| [B<-verbose>] | [B<-verbose>] | ||||||
| [B<-engine id>] | [B<-engine id>] | ||||||
|  | @ -92,6 +96,11 @@ see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. | ||||||
| 
 | 
 | ||||||
| prints out the certificate request in text form. | 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> | =item B<-pubkey> | ||||||
| 
 | 
 | ||||||
| outputs the public key. | 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 | If the B<-key> option is not used it will generate a new RSA private | ||||||
| key using information specified in the configuration file. | 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</type0=value0/type1=value1/type2=...>, | ||||||
|  | characters may be escaped by \ (backslash), no spaces are skipped. | ||||||
|  | 
 | ||||||
| =item B<-rand file(s)> | =item B<-rand file(s)> | ||||||
| 
 | 
 | ||||||
| a file or files containing random data used to seed the random number | 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 | this option creates a new certificate request and a new private | ||||||
| key. The argument takes one of several forms. B<rsa:nbits>, where | key. The argument takes one of several forms. B<rsa:nbits>, where | ||||||
| B<nbits> is the number of bits, generates an RSA key B<nbits> | B<nbits> is the number of bits, generates an RSA key B<nbits> | ||||||
| in size. B<dsa:filename> generates a DSA key using the parameters | in size. If B<nbits> is omitted, i.e. B<-newkey rsa> specified, | ||||||
| in the file B<filename>. B<param:file> generates a key using the | the default key size, specified in the configuration file is used. | ||||||
| parameter file B<file>, the algorithm is determined by the | 
 | ||||||
| parameters. B<algname:file> use algorithm B<algname> and parameter file | All other algorithms support the B<-newkey alg:file> form, where file may be | ||||||
| B<file> the two algorithms must match or an error occurs. B<algname> just | an algorithm parameter file, created by the B<genpkey -genparam> command | ||||||
| uses algorithm B<algname>. | or and X.509 certificate for a key with approriate algorithm. | ||||||
|  | 
 | ||||||
|  | B<param:file> generates a key using the parameter file or certificate B<file>, | ||||||
|  | the algorithm is determined by the parameters. B<algname:file> use algorithm | ||||||
|  | B<algname> and parameter file B<file>: the two algorithms must match or an | ||||||
|  | error occurs. B<algname> just uses algorithm B<algname>, and parameters, | ||||||
|  | if neccessary should be specified via B<-pkeyopt> parameter. | ||||||
|  | 
 | ||||||
|  | B<dsa:filename> generates a DSA key using the parameters | ||||||
|  | in the file B<filename>. B<ec:filename> generates EC key (usable both with | ||||||
|  | ECDSA or ECDH algorithms), B<gost2001:filename> generates GOST R | ||||||
|  | 34.10-2001 key (requires B<ccgost> engine configured in the configuration | ||||||
|  | file). If just B<gost2001> is specified a parameter set should be | ||||||
|  | specified by B<-pkeyopt paramset:X> | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| =item B<-pkeyopt opt:value> | =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 | if this option is specified then if a private key is created it | ||||||
| will not be encrypted. | will not be encrypted. | ||||||
| 
 | 
 | ||||||
| =item B<-[md5|sha1|md2|mdc2]> | =item B<-[digest]> | ||||||
| 
 | 
 | ||||||
| this specifies the message digest to sign the request with. This | this specifies the message digest to sign the request with (such as | ||||||
| overrides the digest algorithm specified in the configuration file. | B<-md5>, B<-sha1>). This overrides the digest algorithm specified in | ||||||
| This option is ignored for DSA requests: they always use SHA1. | the configuration file. | ||||||
|  | 
 | ||||||
|  | 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> | =item B<-config filename> | ||||||
| 
 | 
 | ||||||
|  | @ -239,6 +273,15 @@ B<option> argument can be a single option or multiple options separated by | ||||||
| commas.  Alternatively the B<-nameopt> switch may be used more than once to | commas.  Alternatively the B<-nameopt> switch may be used more than once to | ||||||
| set multiple options. See the L<x509(1)|x509(1)> manual page for details. | set multiple options. See the L<x509(1)|x509(1)> manual page for details. | ||||||
| 
 | 
 | ||||||
|  | =item B<-reqopt> | ||||||
|  | 
 | ||||||
|  | customise the output format used with B<-text>. The B<option> argument can be | ||||||
|  | a single option or multiple options separated by commas.  | ||||||
|  | 
 | ||||||
|  | See discission of the  B<-certopt> parameter in the L<B<x509>|x509(1)> | ||||||
|  | command. | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| =item B<-asn1-kludge> | =item B<-asn1-kludge> | ||||||
| 
 | 
 | ||||||
| by default the B<req> command outputs certificate requests containing | by default the B<req> command outputs certificate requests containing | ||||||
|  | @ -254,6 +297,10 @@ B<SET OF> whereas the correct form does. | ||||||
| 
 | 
 | ||||||
| It should be noted that very few CAs still require the use of this option. | It should be noted that very few CAs still require the use of this option. | ||||||
| 
 | 
 | ||||||
|  | =item B<-no-asn1-kludge> | ||||||
|  | 
 | ||||||
|  | Reverses effect of B<-asn1-kludge> | ||||||
|  | 
 | ||||||
| =item B<-newhdr> | =item B<-newhdr> | ||||||
| 
 | 
 | ||||||
| Adds the word B<NEW> to the PEM file header and footer lines on the outputed | Adds the word B<NEW> to the PEM file header and footer lines on the outputed | ||||||
|  | @ -269,11 +316,16 @@ print extra details about the operations being performed. | ||||||
| 
 | 
 | ||||||
| =item B<-engine id> | =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<req> | ||||||
| to attempt to obtain a functional reference to the specified engine, | 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 | thus initialising it if needed. The engine will then be set as the default | ||||||
| for all available algorithms. | for all available algorithms. | ||||||
| 
 | 
 | ||||||
|  | =item B<-keygen_engine id> | ||||||
|  | 
 | ||||||
|  | specifies an engine (by its unique B<id> string) which would be used | ||||||
|  | for key generation operations. | ||||||
|  | 
 | ||||||
| =back | =back | ||||||
| 
 | 
 | ||||||
| =head1 CONFIGURATION FILE FORMAT | =head1 CONFIGURATION FILE FORMAT | ||||||
|  |  | ||||||
|  | @ -120,7 +120,7 @@ the input is a public key. | ||||||
| 
 | 
 | ||||||
| =item B<-engine id> | =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<rsa> | ||||||
| to attempt to obtain a functional reference to the specified engine, | 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 | thus initialising it if needed. The engine will then be set as the default | ||||||
| for all available algorithms. | for all available algorithms. | ||||||
|  |  | ||||||
|  | @ -101,6 +101,11 @@ also used when building the client certificate chain. | ||||||
| A file containing trusted certificates to use during server authentication | A file containing trusted certificates to use during server authentication | ||||||
| and to use when attempting to build the client certificate chain. | and to use when attempting to build the client certificate chain. | ||||||
| 
 | 
 | ||||||
|  | =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. | ||||||
|  | 
 | ||||||
| =item B<-reconnect> | =item B<-reconnect> | ||||||
| 
 | 
 | ||||||
| reconnects to the same server 5 times using the same session ID, this can | reconnects to the same server 5 times using the same session ID, this can | ||||||
|  | @ -219,7 +224,7 @@ connection from this session. | ||||||
| 
 | 
 | ||||||
| =item B<-engine id> | =item B<-engine id> | ||||||
| 
 | 
 | ||||||
| specifying an engine (by it's unique B<id> string) will cause B<s_client> | specifying an engine (by its unique B<id> string) will cause B<s_client> | ||||||
| to attempt to obtain a functional reference to the specified engine, | 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 | thus initialising it if needed. The engine will then be set as the default | ||||||
| for all available algorithms. | for all available algorithms. | ||||||
|  |  | ||||||
|  | @ -256,7 +256,7 @@ are part of the HTTP response line and headers must end with CRLF). | ||||||
| 
 | 
 | ||||||
| =item B<-engine id> | =item B<-engine id> | ||||||
| 
 | 
 | ||||||
| specifying an engine (by it's unique B<id> string) will cause B<s_server> | specifying an engine (by its unique B<id> string) will cause B<s_server> | ||||||
| to attempt to obtain a functional reference to the specified engine, | 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 | thus initialising it if needed. The engine will then be set as the default | ||||||
| for all available algorithms. | for all available algorithms. | ||||||
|  |  | ||||||
|  | @ -13,17 +13,7 @@ B<openssl> B<smime> | ||||||
| [B<-resign>] | [B<-resign>] | ||||||
| [B<-verify>] | [B<-verify>] | ||||||
| [B<-pk7out>] | [B<-pk7out>] | ||||||
| [B<-des>] | [B<-[cipher]>] | ||||||
| [B<-des3>] |  | ||||||
| [B<-rc2-40>] |  | ||||||
| [B<-rc2-64>] |  | ||||||
| [B<-rc2-128>] |  | ||||||
| [B<-aes128>] |  | ||||||
| [B<-aes192>] |  | ||||||
| [B<-aes256>] |  | ||||||
| [B<-camellia128>] |  | ||||||
| [B<-camellia192>] |  | ||||||
| [B<-camellia256>] |  | ||||||
| [B<-in file>] | [B<-in file>] | ||||||
| [B<-certfile file>] | [B<-certfile file>] | ||||||
| [B<-signer file>] | [B<-signer file>] | ||||||
|  | @ -161,13 +151,13 @@ to each certificate. | ||||||
| digest algorithm to use when signing or resigning. If not present then the | 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). | 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 | the encryption algorithm to use. For example DES  (56 bits) - B<-des>, | ||||||
| or 128 bit RC2, 128, 192 or 256 bit AES, or 128, 192 or 256 bit Camellia | triple DES (168 bits) - B<-des3>, | ||||||
| respectively. Any other cipher name (as recognized by the |  | ||||||
| EVP_get_cipherbyname() function) can also be used preceded by a dash, for  | 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 list of ciphers | ||||||
|  | supported by your version of OpenSSL. | ||||||
| 
 | 
 | ||||||
| If not specified 40 bit RC2 is used. Only used with B<-encrypt>. | If not specified 40 bit RC2 is used. Only used with B<-encrypt>. | ||||||
| 
 | 
 | ||||||
|  | @ -269,6 +259,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 | then many S/MIME mail clients check the signers certificate's email | ||||||
| address matches that specified in the From: address. | 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 options of certificate chain verification. See | ||||||
|  | L<B<verify>|verify(1)> manual page for details. | ||||||
|  | 
 | ||||||
| =back | =back | ||||||
| 
 | 
 | ||||||
| =head1 NOTES | =head1 NOTES | ||||||
|  |  | ||||||
|  | @ -44,7 +44,7 @@ This command is used to test the performance of cryptographic algorithms. | ||||||
| 
 | 
 | ||||||
| =item B<-engine id> | =item B<-engine id> | ||||||
| 
 | 
 | ||||||
| specifying an engine (by it's unique B<id> string) will cause B<speed> | specifying an engine (by its unique B<id> string) will cause B<speed> | ||||||
| to attempt to obtain a functional reference to the specified engine, | 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 | thus initialising it if needed. The engine will then be set as the default | ||||||
| for all available algorithms. | for all available algorithms. | ||||||
|  |  | ||||||
|  | @ -81,7 +81,7 @@ verifies the digital signature on the supplied SPKAC. | ||||||
| 
 | 
 | ||||||
| =item B<-engine id> | =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<spkac> | ||||||
| to attempt to obtain a functional reference to the specified engine, | 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 | thus initialising it if needed. The engine will then be set as the default | ||||||
| for all available algorithms. | for all available algorithms. | ||||||
|  |  | ||||||
|  | @ -265,7 +265,7 @@ instead of DER. (Optional) | ||||||
| 
 | 
 | ||||||
| =item B<-engine> id | =item B<-engine> id | ||||||
| 
 | 
 | ||||||
| Specifying an engine (by it's unique B<id> string) will cause B<ts> | Specifying an engine (by its unique B<id> string) will cause B<ts> | ||||||
| to attempt to obtain a functional reference to the specified engine, | 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 | thus initialising it if needed. The engine will then be set as the default | ||||||
| for all available algorithms. Default is builtin. (Optional) | for all available algorithms. Default is builtin. (Optional) | ||||||
|  |  | ||||||
|  | @ -10,6 +10,18 @@ B<openssl> B<verify> | ||||||
| [B<-CApath directory>] | [B<-CApath directory>] | ||||||
| [B<-CAfile file>] | [B<-CAfile file>] | ||||||
| [B<-purpose purpose>] | [B<-purpose purpose>] | ||||||
|  | [B<-policy arg>] | ||||||
|  | [B<-ignore_critical>] | ||||||
|  | [B<-crl_check>] | ||||||
|  | [B<-crl_check_all>] | ||||||
|  | [B<-policy_check>] | ||||||
|  | [B<-explicit_policy>] | ||||||
|  | [B<-inhibit_any>] | ||||||
|  | [B<-inhibit_map>] | ||||||
|  | [B<-x509_strict>] | ||||||
|  | [B<-extended_crl>] | ||||||
|  | [B<-use_deltas>] | ||||||
|  | [B<-policy_print>] | ||||||
| [B<-untrusted file>] | [B<-untrusted file>] | ||||||
| [B<-help>] | [B<-help>] | ||||||
| [B<-issuer_checks>] | [B<-issuer_checks>] | ||||||
|  | @ -66,6 +78,63 @@ certificate was rejected. However the presence of rejection messages | ||||||
| does not itself imply that anything is wrong: during the normal | does not itself imply that anything is wrong: during the normal | ||||||
| verify process several rejections may take place. | verify process several rejections may take place. | ||||||
| 
 | 
 | ||||||
|  | =item B<-policy arg> | ||||||
|  | 
 | ||||||
|  | Enable policy processing and add B<arg> to the user-initial-policy-set | ||||||
|  | (see RFC3280 et al). The policy B<arg> can be an object name an OID in numeric | ||||||
|  | form. This argument can appear more than once. | ||||||
|  | 
 | ||||||
|  | =item B<-policy_check> | ||||||
|  | 
 | ||||||
|  | Enables certificate policy processing. | ||||||
|  | 
 | ||||||
|  | =item B<-explicit_policy> | ||||||
|  | 
 | ||||||
|  | Set policy variable require-explicit-policy (see RFC3280 et al). | ||||||
|  | 
 | ||||||
|  | =item B<-inhibit_any> | ||||||
|  | 
 | ||||||
|  | Set policy variable inhibit-any-policy (see RFC3280 et al). | ||||||
|  | 
 | ||||||
|  | =item B<-inhibit_map> | ||||||
|  | 
 | ||||||
|  | Set policy variable inhibit-policy-mapping (see RFC3280 et al). | ||||||
|  | 
 | ||||||
|  | =item B<-policy_print> | ||||||
|  | 
 | ||||||
|  | Print out diagnostics, related to policy checking | ||||||
|  | 
 | ||||||
|  | =item B<-crl_check> | ||||||
|  | 
 | ||||||
|  | Checks end entity certificate validity by attempting to lookup a valid CRL. | ||||||
|  | If a valid CRL cannot be found an error occurs.  | ||||||
|  | 
 | ||||||
|  | =item B<-crl_check_all> | ||||||
|  | 
 | ||||||
|  | Checks the validity of B<all> certificates in the chain by attempting | ||||||
|  | to lookup valid CRLs. | ||||||
|  | 
 | ||||||
|  | =item B<-ignore_critical> | ||||||
|  | 
 | ||||||
|  | Normally if an unhandled critical extension is present which is not | ||||||
|  | supported by OpenSSL the certificate is rejected (as required by | ||||||
|  | RFC3280 et al). If this option is set critical extensions are | ||||||
|  | ignored. | ||||||
|  | 
 | ||||||
|  | =item B<-x509_strict> | ||||||
|  | 
 | ||||||
|  | Disable workarounds for broken certificates which have to be disabled | ||||||
|  | for strict X.509 compliance. | ||||||
|  | 
 | ||||||
|  | =item B<-extended_crl> | ||||||
|  | 
 | ||||||
|  | Enable extended CRL features such as indirect CRLs and alternate CRL | ||||||
|  | signing keys. | ||||||
|  | 
 | ||||||
|  | =item B<-use_deltas> | ||||||
|  | 
 | ||||||
|  | Enable support for delta CRLs. | ||||||
|  | 
 | ||||||
| =item B<-> | =item B<-> | ||||||
| 
 | 
 | ||||||
| marks the last option. All arguments following this are assumed to be | marks the last option. All arguments following this are assumed to be | ||||||
|  |  | ||||||
|  | @ -104,7 +104,7 @@ then this option has no effect: SHA1 is always used with DSA keys. | ||||||
| 
 | 
 | ||||||
| =item B<-engine id> | =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<x509> | ||||||
| to attempt to obtain a functional reference to the specified engine, | 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 | thus initialising it if needed. The engine will then be set as the default | ||||||
| for all available algorithms. | for all available algorithms. | ||||||
|  |  | ||||||
|  | @ -86,6 +86,7 @@ static ERR_STRING_DATA GOST_str_functs[]= | ||||||
| {ERR_FUNC(GOST_F_GOST_DO_SIGN),	"GOST_DO_SIGN"}, | {ERR_FUNC(GOST_F_GOST_DO_SIGN),	"GOST_DO_SIGN"}, | ||||||
| {ERR_FUNC(GOST_F_GOST_DO_VERIFY),	"GOST_DO_VERIFY"}, | {ERR_FUNC(GOST_F_GOST_DO_VERIFY),	"GOST_DO_VERIFY"}, | ||||||
| {ERR_FUNC(GOST_F_GOST_IMIT_CTRL),	"GOST_IMIT_CTRL"}, | {ERR_FUNC(GOST_F_GOST_IMIT_CTRL),	"GOST_IMIT_CTRL"}, | ||||||
|  | {ERR_FUNC(GOST_F_GOST_IMIT_FINAL),	"GOST_IMIT_FINAL"}, | ||||||
| {ERR_FUNC(GOST_F_GOST_IMIT_UPDATE),	"GOST_IMIT_UPDATE"}, | {ERR_FUNC(GOST_F_GOST_IMIT_UPDATE),	"GOST_IMIT_UPDATE"}, | ||||||
| {ERR_FUNC(GOST_F_PARAM_COPY_GOST01),	"PARAM_COPY_GOST01"}, | {ERR_FUNC(GOST_F_PARAM_COPY_GOST01),	"PARAM_COPY_GOST01"}, | ||||||
| {ERR_FUNC(GOST_F_PARAM_COPY_GOST94),	"PARAM_COPY_GOST94"}, | {ERR_FUNC(GOST_F_PARAM_COPY_GOST94),	"PARAM_COPY_GOST94"}, | ||||||
|  |  | ||||||
|  | @ -87,6 +87,7 @@ void ERR_GOST_error(int function, int reason, char *file, int line); | ||||||
| #define GOST_F_GOST_DO_SIGN				 112 | #define GOST_F_GOST_DO_SIGN				 112 | ||||||
| #define GOST_F_GOST_DO_VERIFY				 113 | #define GOST_F_GOST_DO_VERIFY				 113 | ||||||
| #define GOST_F_GOST_IMIT_CTRL				 114 | #define GOST_F_GOST_IMIT_CTRL				 114 | ||||||
|  | #define GOST_F_GOST_IMIT_FINAL				 140 | ||||||
| #define GOST_F_GOST_IMIT_UPDATE				 115 | #define GOST_F_GOST_IMIT_UPDATE				 115 | ||||||
| #define GOST_F_PARAM_COPY_GOST01			 116 | #define GOST_F_PARAM_COPY_GOST01			 116 | ||||||
| #define GOST_F_PARAM_COPY_GOST94			 117 | #define GOST_F_PARAM_COPY_GOST94			 117 | ||||||
|  |  | ||||||
|  | @ -550,7 +550,10 @@ int gost_imit_update(EVP_MD_CTX *ctx, const void *data, size_t count) | ||||||
| int gost_imit_final(EVP_MD_CTX *ctx,unsigned char *md) | int gost_imit_final(EVP_MD_CTX *ctx,unsigned char *md) | ||||||
| 	{ | 	{ | ||||||
| 	struct ossl_gost_imit_ctx *c = ctx->md_data; | 	struct ossl_gost_imit_ctx *c = ctx->md_data; | ||||||
| 	if (!c->key_set) return 0; | 	if (!c->key_set) { | ||||||
|  | 		GOSTerr(GOST_F_GOST_IMIT_FINAL, GOST_R_MAC_KEY_NOT_SET); | ||||||
|  | 		return 0; | ||||||
|  | 	} | ||||||
| 	if (c->bytes_left) | 	if (c->bytes_left) | ||||||
| 		{ | 		{ | ||||||
| 		int i; | 		int i; | ||||||
|  |  | ||||||
|  | @ -136,7 +136,6 @@ static unsigned char *dtls1_write_message_header(SSL *s, | ||||||
| static void dtls1_set_message_header_int(SSL *s, unsigned char mt, | static void dtls1_set_message_header_int(SSL *s, unsigned char mt, | ||||||
| 	unsigned long len, unsigned short seq_num, unsigned long frag_off,  | 	unsigned long len, unsigned short seq_num, unsigned long frag_off,  | ||||||
| 	unsigned long frag_len); | 	unsigned long frag_len); | ||||||
| static int dtls1_retransmit_buffered_messages(SSL *s); |  | ||||||
| static long dtls1_get_message_fragment(SSL *s, int st1, int stn,  | static long dtls1_get_message_fragment(SSL *s, int st1, int stn,  | ||||||
| 	long max, int *ok); | 	long max, int *ok); | ||||||
| 
 | 
 | ||||||
|  | @ -574,20 +573,19 @@ dtls1_process_out_of_seq_message(SSL *s, struct hm_header_st* msg_hdr, int *ok) | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
|  | 	if (frag_len) | ||||||
|  | 		{ | ||||||
| 		frag = dtls1_hm_fragment_new(frag_len); | 		frag = dtls1_hm_fragment_new(frag_len); | ||||||
| 		if ( frag == NULL) | 		if ( frag == NULL) | ||||||
| 			goto err; | 			goto err; | ||||||
| 
 | 
 | ||||||
| 		memcpy(&(frag->msg_header), msg_hdr, sizeof(*msg_hdr)); | 		memcpy(&(frag->msg_header), msg_hdr, sizeof(*msg_hdr)); | ||||||
| 
 | 
 | ||||||
| 	if (frag_len) |  | ||||||
| 		{ |  | ||||||
| 		/* read the body of the fragment (header has already been read */ | 		/* read the body of the fragment (header has already been read */ | ||||||
| 		i = s->method->ssl_read_bytes(s,SSL3_RT_HANDSHAKE, | 		i = s->method->ssl_read_bytes(s,SSL3_RT_HANDSHAKE, | ||||||
| 			frag->fragment,frag_len,0); | 			frag->fragment,frag_len,0); | ||||||
| 		if (i<=0 || (unsigned long)i!=frag_len) | 		if (i<=0 || (unsigned long)i!=frag_len) | ||||||
| 			goto err; | 			goto err; | ||||||
| 		} |  | ||||||
| 
 | 
 | ||||||
| 		memset(seq64be,0,sizeof(seq64be)); | 		memset(seq64be,0,sizeof(seq64be)); | ||||||
| 		seq64be[6] = (unsigned char)(msg_hdr->seq>>8); | 		seq64be[6] = (unsigned char)(msg_hdr->seq>>8); | ||||||
|  | @ -598,6 +596,8 @@ dtls1_process_out_of_seq_message(SSL *s, struct hm_header_st* msg_hdr, int *ok) | ||||||
| 			goto err; | 			goto err; | ||||||
| 
 | 
 | ||||||
| 		pqueue_insert(s->d1->buffered_messages, item); | 		pqueue_insert(s->d1->buffered_messages, item); | ||||||
|  | 		} | ||||||
|  | 
 | ||||||
| 	return DTLS1_HM_FRAGMENT_RETRY; | 	return DTLS1_HM_FRAGMENT_RETRY; | ||||||
| 
 | 
 | ||||||
| err: | err: | ||||||
|  | @ -931,8 +931,21 @@ int dtls1_read_failed(SSL *s, int code) | ||||||
| 	return dtls1_retransmit_buffered_messages(s) ; | 	return dtls1_retransmit_buffered_messages(s) ; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | int | ||||||
|  | dtls1_get_queue_priority(unsigned short seq, int is_ccs) | ||||||
|  | 	{ | ||||||
|  | 	/* The index of the retransmission queue actually is the message sequence number,
 | ||||||
|  | 	 * since the queue only contains messages of a single handshake. However, the | ||||||
|  | 	 * ChangeCipherSpec has no message sequence number and so using only the sequence | ||||||
|  | 	 * will result in the CCS and Finished having the same index. To prevent this, | ||||||
|  | 	 * the sequence number is multiplied by 2. In case of a CCS 1 is subtracted. | ||||||
|  | 	 * This does not only differ CSS and Finished, it also maintains the order of the | ||||||
|  | 	 * index (important for priority queues) and fits in the unsigned short variable. | ||||||
|  | 	 */	 | ||||||
|  | 	return seq * 2 - is_ccs; | ||||||
|  | 	} | ||||||
| 
 | 
 | ||||||
| static int | int | ||||||
| dtls1_retransmit_buffered_messages(SSL *s) | dtls1_retransmit_buffered_messages(SSL *s) | ||||||
| 	{ | 	{ | ||||||
| 	pqueue sent = s->d1->sent_messages; | 	pqueue sent = s->d1->sent_messages; | ||||||
|  | @ -946,8 +959,9 @@ dtls1_retransmit_buffered_messages(SSL *s) | ||||||
| 	for ( item = pqueue_next(&iter); item != NULL; item = pqueue_next(&iter)) | 	for ( item = pqueue_next(&iter); item != NULL; item = pqueue_next(&iter)) | ||||||
| 		{ | 		{ | ||||||
| 		frag = (hm_fragment *)item->data; | 		frag = (hm_fragment *)item->data; | ||||||
| 		if ( dtls1_retransmit_message(s, frag->msg_header.seq, 0, &found) <= 0 && | 			if ( dtls1_retransmit_message(s, | ||||||
| 			found) | 				dtls1_get_queue_priority(frag->msg_header.seq, frag->msg_header.is_ccs), | ||||||
|  | 				0, &found) <= 0 && found) | ||||||
| 			{ | 			{ | ||||||
| 			fprintf(stderr, "dtls1_retransmit_message() failed\n"); | 			fprintf(stderr, "dtls1_retransmit_message() failed\n"); | ||||||
| 			return -1; | 			return -1; | ||||||
|  | @ -963,7 +977,6 @@ dtls1_buffer_message(SSL *s, int is_ccs) | ||||||
| 	pitem *item; | 	pitem *item; | ||||||
| 	hm_fragment *frag; | 	hm_fragment *frag; | ||||||
| 	unsigned char seq64be[8]; | 	unsigned char seq64be[8]; | ||||||
| 	unsigned int epoch = s->d1->w_epoch; |  | ||||||
| 
 | 
 | ||||||
| 	/* this function is called immediately after a message has 
 | 	/* this function is called immediately after a message has 
 | ||||||
| 	 * been serialized */ | 	 * been serialized */ | ||||||
|  | @ -977,7 +990,6 @@ dtls1_buffer_message(SSL *s, int is_ccs) | ||||||
| 		{ | 		{ | ||||||
| 		OPENSSL_assert(s->d1->w_msg_hdr.msg_len +  | 		OPENSSL_assert(s->d1->w_msg_hdr.msg_len +  | ||||||
| 			DTLS1_CCS_HEADER_LENGTH == (unsigned int)s->init_num); | 			DTLS1_CCS_HEADER_LENGTH == (unsigned int)s->init_num); | ||||||
| 		epoch++; |  | ||||||
| 		} | 		} | ||||||
| 	else | 	else | ||||||
| 		{ | 		{ | ||||||
|  | @ -992,11 +1004,18 @@ dtls1_buffer_message(SSL *s, int is_ccs) | ||||||
| 	frag->msg_header.frag_len = s->d1->w_msg_hdr.msg_len; | 	frag->msg_header.frag_len = s->d1->w_msg_hdr.msg_len; | ||||||
| 	frag->msg_header.is_ccs = is_ccs; | 	frag->msg_header.is_ccs = is_ccs; | ||||||
| 
 | 
 | ||||||
|  | 	/* save current state*/ | ||||||
|  | 	frag->msg_header.saved_retransmit_state.enc_write_ctx = s->enc_write_ctx; | ||||||
|  | 	frag->msg_header.saved_retransmit_state.write_hash = s->write_hash; | ||||||
|  | 	frag->msg_header.saved_retransmit_state.compress = s->compress; | ||||||
|  | 	frag->msg_header.saved_retransmit_state.session = s->session; | ||||||
|  | 	frag->msg_header.saved_retransmit_state.epoch = s->d1->w_epoch; | ||||||
|  | 	 | ||||||
| 	memset(seq64be,0,sizeof(seq64be)); | 	memset(seq64be,0,sizeof(seq64be)); | ||||||
| 	seq64be[0] = (unsigned char)(epoch>>8); | 	seq64be[6] = (unsigned char)(dtls1_get_queue_priority(frag->msg_header.seq, | ||||||
| 	seq64be[1] = (unsigned char)(epoch); | 														  frag->msg_header.is_ccs)>>8); | ||||||
| 	seq64be[6] = (unsigned char)(frag->msg_header.seq>>8); | 	seq64be[7] = (unsigned char)(dtls1_get_queue_priority(frag->msg_header.seq, | ||||||
| 	seq64be[7] = (unsigned char)(frag->msg_header.seq); | 														  frag->msg_header.is_ccs)); | ||||||
| 
 | 
 | ||||||
| 	item = pitem_new(seq64be, frag); | 	item = pitem_new(seq64be, frag); | ||||||
| 	if ( item == NULL) | 	if ( item == NULL) | ||||||
|  | @ -1025,6 +1044,8 @@ dtls1_retransmit_message(SSL *s, unsigned short seq, unsigned long frag_off, | ||||||
| 	hm_fragment *frag ; | 	hm_fragment *frag ; | ||||||
| 	unsigned long header_length; | 	unsigned long header_length; | ||||||
| 	unsigned char seq64be[8]; | 	unsigned char seq64be[8]; | ||||||
|  | 	struct dtls1_retransmit_state saved_state; | ||||||
|  | 	unsigned char save_write_sequence[8]; | ||||||
| 
 | 
 | ||||||
| 	/*
 | 	/*
 | ||||||
| 	  OPENSSL_assert(s->init_num == 0); | 	  OPENSSL_assert(s->init_num == 0); | ||||||
|  | @ -1060,9 +1081,45 @@ dtls1_retransmit_message(SSL *s, unsigned short seq, unsigned long frag_off, | ||||||
| 		frag->msg_header.msg_len, frag->msg_header.seq, 0,  | 		frag->msg_header.msg_len, frag->msg_header.seq, 0,  | ||||||
| 		frag->msg_header.frag_len); | 		frag->msg_header.frag_len); | ||||||
| 
 | 
 | ||||||
|  | 	/* save current state */ | ||||||
|  | 	saved_state.enc_write_ctx = s->enc_write_ctx; | ||||||
|  | 	saved_state.write_hash = s->write_hash; | ||||||
|  | 	saved_state.compress = s->compress; | ||||||
|  | 	saved_state.session = s->session; | ||||||
|  | 	saved_state.epoch = s->d1->w_epoch; | ||||||
|  | 	saved_state.epoch = s->d1->w_epoch; | ||||||
|  | 	 | ||||||
| 	s->d1->retransmitting = 1; | 	s->d1->retransmitting = 1; | ||||||
|  | 	 | ||||||
|  | 	/* restore state in which the message was originally sent */ | ||||||
|  | 	s->enc_write_ctx = frag->msg_header.saved_retransmit_state.enc_write_ctx; | ||||||
|  | 	s->write_hash = frag->msg_header.saved_retransmit_state.write_hash; | ||||||
|  | 	s->compress = frag->msg_header.saved_retransmit_state.compress; | ||||||
|  | 	s->session = frag->msg_header.saved_retransmit_state.session; | ||||||
|  | 	s->d1->w_epoch = frag->msg_header.saved_retransmit_state.epoch; | ||||||
|  | 	 | ||||||
|  | 	if (frag->msg_header.saved_retransmit_state.epoch == saved_state.epoch - 1) | ||||||
|  | 	{ | ||||||
|  | 		memcpy(save_write_sequence, s->s3->write_sequence, sizeof(s->s3->write_sequence)); | ||||||
|  | 		memcpy(s->s3->write_sequence, s->d1->last_write_sequence, sizeof(s->s3->write_sequence)); | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
| 	ret = dtls1_do_write(s, frag->msg_header.is_ccs ?  | 	ret = dtls1_do_write(s, frag->msg_header.is_ccs ?  | ||||||
| 						 SSL3_RT_CHANGE_CIPHER_SPEC : SSL3_RT_HANDSHAKE); | 						 SSL3_RT_CHANGE_CIPHER_SPEC : SSL3_RT_HANDSHAKE); | ||||||
|  | 	 | ||||||
|  | 	/* restore current state */ | ||||||
|  | 	s->enc_write_ctx = saved_state.enc_write_ctx; | ||||||
|  | 	s->write_hash = saved_state.write_hash; | ||||||
|  | 	s->compress = saved_state.compress; | ||||||
|  | 	s->session = saved_state.session; | ||||||
|  | 	s->d1->w_epoch = saved_state.epoch; | ||||||
|  | 	 | ||||||
|  | 	if (frag->msg_header.saved_retransmit_state.epoch == saved_state.epoch - 1) | ||||||
|  | 	{ | ||||||
|  | 		memcpy(s->d1->last_write_sequence, s->s3->write_sequence, sizeof(s->s3->write_sequence)); | ||||||
|  | 		memcpy(s->s3->write_sequence, save_write_sequence, sizeof(s->s3->write_sequence)); | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
| 	s->d1->retransmitting = 0; | 	s->d1->retransmitting = 0; | ||||||
| 
 | 
 | ||||||
| 	(void)BIO_flush(SSL_get_wbio(s)); | 	(void)BIO_flush(SSL_get_wbio(s)); | ||||||
|  |  | ||||||
|  | @ -229,6 +229,7 @@ int dtls1_connect(SSL *s) | ||||||
| 			/* every DTLS ClientHello resets Finished MAC */ | 			/* every DTLS ClientHello resets Finished MAC */ | ||||||
| 			ssl3_init_finished_mac(s); | 			ssl3_init_finished_mac(s); | ||||||
| 
 | 
 | ||||||
|  | 			BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SET_TIMEOUT, 1, NULL); | ||||||
| 			ret=dtls1_client_hello(s); | 			ret=dtls1_client_hello(s); | ||||||
| 			if (ret <= 0) goto end; | 			if (ret <= 0) goto end; | ||||||
| 
 | 
 | ||||||
|  | @ -254,6 +255,7 @@ int dtls1_connect(SSL *s) | ||||||
| 			if (ret <= 0) goto end; | 			if (ret <= 0) goto end; | ||||||
| 			else | 			else | ||||||
| 				{ | 				{ | ||||||
|  | 				BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SET_TIMEOUT, 0, NULL); | ||||||
| 				if (s->hit) | 				if (s->hit) | ||||||
| 					s->state=SSL3_ST_CR_FINISHED_A; | 					s->state=SSL3_ST_CR_FINISHED_A; | ||||||
| 				else | 				else | ||||||
|  | @ -268,6 +270,7 @@ int dtls1_connect(SSL *s) | ||||||
| 			ret = dtls1_get_hello_verify(s); | 			ret = dtls1_get_hello_verify(s); | ||||||
| 			if ( ret <= 0) | 			if ( ret <= 0) | ||||||
| 				goto end; | 				goto end; | ||||||
|  | 			BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SET_TIMEOUT, 0, NULL); | ||||||
| 			if ( s->d1->send_cookie) /* start again, with a cookie */ | 			if ( s->d1->send_cookie) /* start again, with a cookie */ | ||||||
| 				s->state=SSL3_ST_CW_CLNT_HELLO_A; | 				s->state=SSL3_ST_CW_CLNT_HELLO_A; | ||||||
| 			else | 			else | ||||||
|  | @ -329,6 +332,7 @@ int dtls1_connect(SSL *s) | ||||||
| 		case SSL3_ST_CW_CERT_B: | 		case SSL3_ST_CW_CERT_B: | ||||||
| 		case SSL3_ST_CW_CERT_C: | 		case SSL3_ST_CW_CERT_C: | ||||||
| 		case SSL3_ST_CW_CERT_D: | 		case SSL3_ST_CW_CERT_D: | ||||||
|  | 			BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SET_TIMEOUT, 1, NULL); | ||||||
| 			ret=dtls1_send_client_certificate(s); | 			ret=dtls1_send_client_certificate(s); | ||||||
| 			if (ret <= 0) goto end; | 			if (ret <= 0) goto end; | ||||||
| 			s->state=SSL3_ST_CW_KEY_EXCH_A; | 			s->state=SSL3_ST_CW_KEY_EXCH_A; | ||||||
|  | @ -337,6 +341,7 @@ int dtls1_connect(SSL *s) | ||||||
| 
 | 
 | ||||||
| 		case SSL3_ST_CW_KEY_EXCH_A: | 		case SSL3_ST_CW_KEY_EXCH_A: | ||||||
| 		case SSL3_ST_CW_KEY_EXCH_B: | 		case SSL3_ST_CW_KEY_EXCH_B: | ||||||
|  | 			BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SET_TIMEOUT, 1, NULL); | ||||||
| 			ret=dtls1_send_client_key_exchange(s); | 			ret=dtls1_send_client_key_exchange(s); | ||||||
| 			if (ret <= 0) goto end; | 			if (ret <= 0) goto end; | ||||||
| 			/* EAY EAY EAY need to check for DH fix cert
 | 			/* EAY EAY EAY need to check for DH fix cert
 | ||||||
|  | @ -358,6 +363,7 @@ int dtls1_connect(SSL *s) | ||||||
| 
 | 
 | ||||||
| 		case SSL3_ST_CW_CERT_VRFY_A: | 		case SSL3_ST_CW_CERT_VRFY_A: | ||||||
| 		case SSL3_ST_CW_CERT_VRFY_B: | 		case SSL3_ST_CW_CERT_VRFY_B: | ||||||
|  | 			BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SET_TIMEOUT, 1, NULL); | ||||||
| 			ret=dtls1_send_client_verify(s); | 			ret=dtls1_send_client_verify(s); | ||||||
| 			if (ret <= 0) goto end; | 			if (ret <= 0) goto end; | ||||||
| 			s->state=SSL3_ST_CW_CHANGE_A; | 			s->state=SSL3_ST_CW_CHANGE_A; | ||||||
|  | @ -367,6 +373,7 @@ int dtls1_connect(SSL *s) | ||||||
| 
 | 
 | ||||||
| 		case SSL3_ST_CW_CHANGE_A: | 		case SSL3_ST_CW_CHANGE_A: | ||||||
| 		case SSL3_ST_CW_CHANGE_B: | 		case SSL3_ST_CW_CHANGE_B: | ||||||
|  | 			BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SET_TIMEOUT, 1, NULL); | ||||||
| 			ret=dtls1_send_change_cipher_spec(s, | 			ret=dtls1_send_change_cipher_spec(s, | ||||||
| 				SSL3_ST_CW_CHANGE_A,SSL3_ST_CW_CHANGE_B); | 				SSL3_ST_CW_CHANGE_A,SSL3_ST_CW_CHANGE_B); | ||||||
| 			if (ret <= 0) goto end; | 			if (ret <= 0) goto end; | ||||||
|  | @ -401,6 +408,7 @@ int dtls1_connect(SSL *s) | ||||||
| 
 | 
 | ||||||
| 		case SSL3_ST_CW_FINISHED_A: | 		case SSL3_ST_CW_FINISHED_A: | ||||||
| 		case SSL3_ST_CW_FINISHED_B: | 		case SSL3_ST_CW_FINISHED_B: | ||||||
|  | 			BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SET_TIMEOUT, 1, NULL); | ||||||
| 			ret=dtls1_send_finished(s, | 			ret=dtls1_send_finished(s, | ||||||
| 				SSL3_ST_CW_FINISHED_A,SSL3_ST_CW_FINISHED_B, | 				SSL3_ST_CW_FINISHED_A,SSL3_ST_CW_FINISHED_B, | ||||||
| 				s->method->ssl3_enc->client_finished_label, | 				s->method->ssl3_enc->client_finished_label, | ||||||
|  | @ -433,6 +441,7 @@ int dtls1_connect(SSL *s) | ||||||
| 			ret=ssl3_get_finished(s,SSL3_ST_CR_FINISHED_A, | 			ret=ssl3_get_finished(s,SSL3_ST_CR_FINISHED_A, | ||||||
| 				SSL3_ST_CR_FINISHED_B); | 				SSL3_ST_CR_FINISHED_B); | ||||||
| 			if (ret <= 0) goto end; | 			if (ret <= 0) goto end; | ||||||
|  | 			BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SET_TIMEOUT, 0, NULL); | ||||||
| 
 | 
 | ||||||
| 			if (s->hit) | 			if (s->hit) | ||||||
| 				s->state=SSL3_ST_CW_CHANGE_A; | 				s->state=SSL3_ST_CW_CHANGE_A; | ||||||
|  | @ -488,6 +497,7 @@ int dtls1_connect(SSL *s) | ||||||
| 
 | 
 | ||||||
| 			/* done with handshaking */ | 			/* done with handshaking */ | ||||||
| 			s->d1->handshake_read_seq  = 0; | 			s->d1->handshake_read_seq  = 0; | ||||||
|  | 			s->d1->next_handshake_write_seq = 0; | ||||||
| 			goto end; | 			goto end; | ||||||
| 			/* break; */ | 			/* break; */ | ||||||
| 			 | 			 | ||||||
|  |  | ||||||
							
								
								
									
										13
									
								
								ssl/d1_lib.c
								
								
								
								
							
							
						
						
									
										13
									
								
								ssl/d1_lib.c
								
								
								
								
							|  | @ -98,6 +98,7 @@ int dtls1_new(SSL *s) | ||||||
| 	d1->processed_rcds.q=pqueue_new(); | 	d1->processed_rcds.q=pqueue_new(); | ||||||
| 	d1->buffered_messages = pqueue_new(); | 	d1->buffered_messages = pqueue_new(); | ||||||
| 	d1->sent_messages=pqueue_new(); | 	d1->sent_messages=pqueue_new(); | ||||||
|  | 	d1->buffered_app_data.q=pqueue_new(); | ||||||
| 
 | 
 | ||||||
| 	if ( s->server) | 	if ( s->server) | ||||||
| 		{ | 		{ | ||||||
|  | @ -105,12 +106,13 @@ int dtls1_new(SSL *s) | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 	if( ! d1->unprocessed_rcds.q || ! d1->processed_rcds.q  | 	if( ! d1->unprocessed_rcds.q || ! d1->processed_rcds.q  | ||||||
|         || ! d1->buffered_messages || ! d1->sent_messages) |         || ! d1->buffered_messages || ! d1->sent_messages || ! d1->buffered_app_data.q) | ||||||
| 		{ | 		{ | ||||||
|         if ( d1->unprocessed_rcds.q) pqueue_free(d1->unprocessed_rcds.q); |         if ( d1->unprocessed_rcds.q) pqueue_free(d1->unprocessed_rcds.q); | ||||||
|         if ( d1->processed_rcds.q) pqueue_free(d1->processed_rcds.q); |         if ( d1->processed_rcds.q) pqueue_free(d1->processed_rcds.q); | ||||||
|         if ( d1->buffered_messages) pqueue_free(d1->buffered_messages); |         if ( d1->buffered_messages) pqueue_free(d1->buffered_messages); | ||||||
| 		if ( d1->sent_messages) pqueue_free(d1->sent_messages); | 		if ( d1->sent_messages) pqueue_free(d1->sent_messages); | ||||||
|  | 		if ( d1->buffered_app_data.q) pqueue_free(d1->buffered_app_data.q); | ||||||
| 		OPENSSL_free(d1); | 		OPENSSL_free(d1); | ||||||
| 		return (0); | 		return (0); | ||||||
| 		} | 		} | ||||||
|  | @ -159,6 +161,15 @@ void dtls1_free(SSL *s) | ||||||
|         } |         } | ||||||
| 	pqueue_free(s->d1->sent_messages); | 	pqueue_free(s->d1->sent_messages); | ||||||
| 
 | 
 | ||||||
|  | 	while ( (item = pqueue_pop(s->d1->buffered_app_data.q)) != NULL) | ||||||
|  | 		{ | ||||||
|  | 		frag = (hm_fragment *)item->data; | ||||||
|  | 		OPENSSL_free(frag->fragment); | ||||||
|  | 		OPENSSL_free(frag); | ||||||
|  | 		pitem_free(item); | ||||||
|  | 		} | ||||||
|  | 	pqueue_free(s->d1->buffered_app_data.q); | ||||||
|  | 
 | ||||||
| 	OPENSSL_free(s->d1); | 	OPENSSL_free(s->d1); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
							
								
								
									
										60
									
								
								ssl/d1_pkt.c
								
								
								
								
							
							
						
						
									
										60
									
								
								ssl/d1_pkt.c
								
								
								
								
							|  | @ -746,6 +746,23 @@ start: | ||||||
| 	 * s->s3->rrec.length,  - number of bytes. */ | 	 * s->s3->rrec.length,  - number of bytes. */ | ||||||
| 	rr = &(s->s3->rrec); | 	rr = &(s->s3->rrec); | ||||||
| 
 | 
 | ||||||
|  | 	/* We are not handshaking and have no data yet,
 | ||||||
|  | 	 * so process data buffered during the last handshake | ||||||
|  | 	 * in advance, if any. | ||||||
|  | 	 */ | ||||||
|  | 	if (s->state == SSL_ST_OK && rr->length == 0) | ||||||
|  | 		{ | ||||||
|  | 		pitem *item; | ||||||
|  | 		item = pqueue_pop(s->d1->buffered_app_data.q); | ||||||
|  | 		if (item) | ||||||
|  | 			{ | ||||||
|  | 			dtls1_copy_record(s, item); | ||||||
|  | 
 | ||||||
|  | 			OPENSSL_free(item->data); | ||||||
|  | 			pitem_free(item); | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 		 | ||||||
| 	/* get new packet if necessary */ | 	/* get new packet if necessary */ | ||||||
| 	if ((rr->length == 0) || (s->rstate == SSL_ST_READ_BODY)) | 	if ((rr->length == 0) || (s->rstate == SSL_ST_READ_BODY)) | ||||||
| 		{ | 		{ | ||||||
|  | @ -767,9 +784,14 @@ start: | ||||||
| 	                               * reset by ssl3_get_finished */ | 	                               * reset by ssl3_get_finished */ | ||||||
| 		&& (rr->type != SSL3_RT_HANDSHAKE)) | 		&& (rr->type != SSL3_RT_HANDSHAKE)) | ||||||
| 		{ | 		{ | ||||||
| 		al=SSL_AD_UNEXPECTED_MESSAGE; | 		/* We now have application data between CCS and Finished.
 | ||||||
| 		SSLerr(SSL_F_DTLS1_READ_BYTES,SSL_R_DATA_BETWEEN_CCS_AND_FINISHED); | 		 * Most likely the packets were reordered on their way, so | ||||||
| 		goto err; | 		 * buffer the application data for later processing rather | ||||||
|  | 		 * than dropping the connection. | ||||||
|  | 		 */ | ||||||
|  | 		dtls1_buffer_record(s, &(s->d1->buffered_app_data), 0); | ||||||
|  | 		rr->length = 0; | ||||||
|  | 		goto start; | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 	/* If the other end has shut down, throw anything we read away
 | 	/* If the other end has shut down, throw anything we read away
 | ||||||
|  | @ -839,16 +861,29 @@ start: | ||||||
| 			dest = s->d1->alert_fragment; | 			dest = s->d1->alert_fragment; | ||||||
| 			dest_len = &s->d1->alert_fragment_len; | 			dest_len = &s->d1->alert_fragment_len; | ||||||
| 			} | 			} | ||||||
|                 /* else it's a CCS message, or it's wrong */ | 		/* else it's a CCS message, or application data or wrong */ | ||||||
| 		else if (rr->type != SSL3_RT_CHANGE_CIPHER_SPEC) | 		else if (rr->type != SSL3_RT_CHANGE_CIPHER_SPEC) | ||||||
| 			{ | 			{ | ||||||
|  | 			/* Application data while renegotiating
 | ||||||
|  | 			 * is allowed. Try again reading. | ||||||
|  | 			 */ | ||||||
|  | 			if (rr->type == SSL3_RT_APPLICATION_DATA) | ||||||
|  | 				{ | ||||||
|  | 				BIO *bio; | ||||||
|  | 				s->s3->in_read_app_data=2; | ||||||
|  | 				bio=SSL_get_rbio(s); | ||||||
|  | 				s->rwstate=SSL_READING; | ||||||
|  | 				BIO_clear_retry_flags(bio); | ||||||
|  | 				BIO_set_retry_read(bio); | ||||||
|  | 				return(-1); | ||||||
|  | 				} | ||||||
|  | 
 | ||||||
| 			/* Not certain if this is the right error handling */ | 			/* Not certain if this is the right error handling */ | ||||||
| 			al=SSL_AD_UNEXPECTED_MESSAGE; | 			al=SSL_AD_UNEXPECTED_MESSAGE; | ||||||
| 			SSLerr(SSL_F_DTLS1_READ_BYTES,SSL_R_UNEXPECTED_RECORD); | 			SSLerr(SSL_F_DTLS1_READ_BYTES,SSL_R_UNEXPECTED_RECORD); | ||||||
| 			goto f_err; | 			goto f_err; | ||||||
| 			} | 			} | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| 		if (dest_maxlen > 0) | 		if (dest_maxlen > 0) | ||||||
| 			{ | 			{ | ||||||
|             /* XDTLS:  In a pathalogical case, the Client Hello
 |             /* XDTLS:  In a pathalogical case, the Client Hello
 | ||||||
|  | @ -985,7 +1020,9 @@ start: | ||||||
| 				n2s(p, seq); | 				n2s(p, seq); | ||||||
| 				n2l3(p, frag_off); | 				n2l3(p, frag_off); | ||||||
| 
 | 
 | ||||||
| 				dtls1_retransmit_message(s, seq, frag_off, &found); | 				dtls1_retransmit_message(s, | ||||||
|  | 										 dtls1_get_queue_priority(frag->msg_header.seq, 0), | ||||||
|  | 										 frag_off, &found); | ||||||
| 				if ( ! found  && SSL_in_init(s)) | 				if ( ! found  && SSL_in_init(s)) | ||||||
| 					{ | 					{ | ||||||
| 					/* fprintf( stderr,"in init = %d\n", SSL_in_init(s)); */ | 					/* fprintf( stderr,"in init = %d\n", SSL_in_init(s)); */ | ||||||
|  | @ -1074,6 +1111,16 @@ start: | ||||||
| 			goto start; | 			goto start; | ||||||
| 			} | 			} | ||||||
| 
 | 
 | ||||||
|  | 		/* If we are server, we may have a repeated FINISHED of the
 | ||||||
|  | 		 * client here, then retransmit our CCS and FINISHED. | ||||||
|  | 		 */ | ||||||
|  | 		if (msg_hdr.type == SSL3_MT_FINISHED) | ||||||
|  | 			{ | ||||||
|  | 			dtls1_retransmit_buffered_messages(s); | ||||||
|  | 			rr->length = 0; | ||||||
|  | 			goto start; | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
| 		if (((s->state&SSL_ST_MASK) == SSL_ST_OK) && | 		if (((s->state&SSL_ST_MASK) == SSL_ST_OK) && | ||||||
| 			!(s->s3->flags & SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS)) | 			!(s->s3->flags & SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS)) | ||||||
| 			{ | 			{ | ||||||
|  | @ -1728,6 +1775,7 @@ dtls1_reset_seq_numbers(SSL *s, int rw) | ||||||
| 	else | 	else | ||||||
| 		{ | 		{ | ||||||
| 		seq = s->s3->write_sequence; | 		seq = s->s3->write_sequence; | ||||||
|  | 		memcpy(s->d1->last_write_sequence, seq, sizeof(s->s3->write_sequence)); | ||||||
| 		s->d1->w_epoch++; | 		s->d1->w_epoch++; | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -249,6 +249,7 @@ int dtls1_accept(SSL *s) | ||||||
| 		case SSL3_ST_SW_HELLO_REQ_B: | 		case SSL3_ST_SW_HELLO_REQ_B: | ||||||
| 
 | 
 | ||||||
| 			s->shutdown=0; | 			s->shutdown=0; | ||||||
|  | 			BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SET_TIMEOUT, 1, NULL); | ||||||
| 			ret=dtls1_send_hello_request(s); | 			ret=dtls1_send_hello_request(s); | ||||||
| 			if (ret <= 0) goto end; | 			if (ret <= 0) goto end; | ||||||
| 			s->s3->tmp.next_state=SSL3_ST_SW_HELLO_REQ_C; | 			s->s3->tmp.next_state=SSL3_ST_SW_HELLO_REQ_C; | ||||||
|  | @ -269,6 +270,7 @@ int dtls1_accept(SSL *s) | ||||||
| 			s->shutdown=0; | 			s->shutdown=0; | ||||||
| 			ret=ssl3_get_client_hello(s); | 			ret=ssl3_get_client_hello(s); | ||||||
| 			if (ret <= 0) goto end; | 			if (ret <= 0) goto end; | ||||||
|  | 			BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SET_TIMEOUT, 0, NULL); | ||||||
| 			s->new_session = 2; | 			s->new_session = 2; | ||||||
| 
 | 
 | ||||||
| 			if (s->d1->send_cookie) | 			if (s->d1->send_cookie) | ||||||
|  | @ -282,6 +284,7 @@ int dtls1_accept(SSL *s) | ||||||
| 		case DTLS1_ST_SW_HELLO_VERIFY_REQUEST_A: | 		case DTLS1_ST_SW_HELLO_VERIFY_REQUEST_A: | ||||||
| 		case DTLS1_ST_SW_HELLO_VERIFY_REQUEST_B: | 		case DTLS1_ST_SW_HELLO_VERIFY_REQUEST_B: | ||||||
| 
 | 
 | ||||||
|  | 			BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SET_TIMEOUT, 1, NULL); | ||||||
| 			ret = dtls1_send_hello_verify_request(s); | 			ret = dtls1_send_hello_verify_request(s); | ||||||
| 			if ( ret <= 0) goto end; | 			if ( ret <= 0) goto end; | ||||||
| 			s->d1->send_cookie = 0; | 			s->d1->send_cookie = 0; | ||||||
|  | @ -294,6 +297,7 @@ int dtls1_accept(SSL *s) | ||||||
| 			 | 			 | ||||||
| 		case SSL3_ST_SW_SRVR_HELLO_A: | 		case SSL3_ST_SW_SRVR_HELLO_A: | ||||||
| 		case SSL3_ST_SW_SRVR_HELLO_B: | 		case SSL3_ST_SW_SRVR_HELLO_B: | ||||||
|  | 			BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SET_TIMEOUT, 1, NULL); | ||||||
| 			ret=dtls1_send_server_hello(s); | 			ret=dtls1_send_server_hello(s); | ||||||
| 			if (ret <= 0) goto end; | 			if (ret <= 0) goto end; | ||||||
| 
 | 
 | ||||||
|  | @ -309,6 +313,7 @@ int dtls1_accept(SSL *s) | ||||||
| 			/* Check if it is anon DH */ | 			/* Check if it is anon DH */ | ||||||
| 			if (!(s->s3->tmp.new_cipher->algorithm_auth & SSL_aNULL)) | 			if (!(s->s3->tmp.new_cipher->algorithm_auth & SSL_aNULL)) | ||||||
| 				{ | 				{ | ||||||
|  | 				BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SET_TIMEOUT, 1, NULL); | ||||||
| 				ret=dtls1_send_server_certificate(s); | 				ret=dtls1_send_server_certificate(s); | ||||||
| 				if (ret <= 0) goto end; | 				if (ret <= 0) goto end; | ||||||
| 				} | 				} | ||||||
|  | @ -350,6 +355,7 @@ int dtls1_accept(SSL *s) | ||||||
| 				) | 				) | ||||||
| 			    ) | 			    ) | ||||||
| 				{ | 				{ | ||||||
|  | 				BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SET_TIMEOUT, 1, NULL); | ||||||
| 				ret=dtls1_send_server_key_exchange(s); | 				ret=dtls1_send_server_key_exchange(s); | ||||||
| 				if (ret <= 0) goto end; | 				if (ret <= 0) goto end; | ||||||
| 				} | 				} | ||||||
|  | @ -386,6 +392,7 @@ int dtls1_accept(SSL *s) | ||||||
| 			else | 			else | ||||||
| 				{ | 				{ | ||||||
| 				s->s3->tmp.cert_request=1; | 				s->s3->tmp.cert_request=1; | ||||||
|  | 				BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SET_TIMEOUT, 1, NULL); | ||||||
| 				ret=dtls1_send_certificate_request(s); | 				ret=dtls1_send_certificate_request(s); | ||||||
| 				if (ret <= 0) goto end; | 				if (ret <= 0) goto end; | ||||||
| #ifndef NETSCAPE_HANG_BUG | #ifndef NETSCAPE_HANG_BUG | ||||||
|  | @ -400,6 +407,7 @@ int dtls1_accept(SSL *s) | ||||||
| 
 | 
 | ||||||
| 		case SSL3_ST_SW_SRVR_DONE_A: | 		case SSL3_ST_SW_SRVR_DONE_A: | ||||||
| 		case SSL3_ST_SW_SRVR_DONE_B: | 		case SSL3_ST_SW_SRVR_DONE_B: | ||||||
|  | 			BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SET_TIMEOUT, 1, NULL); | ||||||
| 			ret=dtls1_send_server_done(s); | 			ret=dtls1_send_server_done(s); | ||||||
| 			if (ret <= 0) goto end; | 			if (ret <= 0) goto end; | ||||||
| 			s->s3->tmp.next_state=SSL3_ST_SR_CERT_A; | 			s->s3->tmp.next_state=SSL3_ST_SR_CERT_A; | ||||||
|  | @ -427,6 +435,7 @@ int dtls1_accept(SSL *s) | ||||||
| 			ret = ssl3_check_client_hello(s); | 			ret = ssl3_check_client_hello(s); | ||||||
| 			if (ret <= 0) | 			if (ret <= 0) | ||||||
| 				goto end; | 				goto end; | ||||||
|  | 			BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SET_TIMEOUT, 0, NULL); | ||||||
| 			if (ret == 2) | 			if (ret == 2) | ||||||
| 				s->state = SSL3_ST_SR_CLNT_HELLO_C; | 				s->state = SSL3_ST_SR_CLNT_HELLO_C; | ||||||
| 			else { | 			else { | ||||||
|  | @ -434,6 +443,7 @@ int dtls1_accept(SSL *s) | ||||||
| 				 * have not asked for it :-) */ | 				 * have not asked for it :-) */ | ||||||
| 				ret=ssl3_get_client_certificate(s); | 				ret=ssl3_get_client_certificate(s); | ||||||
| 				if (ret <= 0) goto end; | 				if (ret <= 0) goto end; | ||||||
|  | 				BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SET_TIMEOUT, 0, NULL); | ||||||
| 				s->init_num=0; | 				s->init_num=0; | ||||||
| 				s->state=SSL3_ST_SR_KEY_EXCH_A; | 				s->state=SSL3_ST_SR_KEY_EXCH_A; | ||||||
| 			} | 			} | ||||||
|  | @ -443,6 +453,7 @@ int dtls1_accept(SSL *s) | ||||||
| 		case SSL3_ST_SR_KEY_EXCH_B: | 		case SSL3_ST_SR_KEY_EXCH_B: | ||||||
| 			ret=ssl3_get_client_key_exchange(s); | 			ret=ssl3_get_client_key_exchange(s); | ||||||
| 			if (ret <= 0) goto end; | 			if (ret <= 0) goto end; | ||||||
|  | 			BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SET_TIMEOUT, 0, NULL); | ||||||
| 			s->state=SSL3_ST_SR_CERT_VRFY_A; | 			s->state=SSL3_ST_SR_CERT_VRFY_A; | ||||||
| 			s->init_num=0; | 			s->init_num=0; | ||||||
| 
 | 
 | ||||||
|  | @ -463,6 +474,7 @@ int dtls1_accept(SSL *s) | ||||||
| 			/* we should decide if we expected this one */ | 			/* we should decide if we expected this one */ | ||||||
| 			ret=ssl3_get_cert_verify(s); | 			ret=ssl3_get_cert_verify(s); | ||||||
| 			if (ret <= 0) goto end; | 			if (ret <= 0) goto end; | ||||||
|  | 			BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SET_TIMEOUT, 0, NULL); | ||||||
| 
 | 
 | ||||||
| 			s->state=SSL3_ST_SR_FINISHED_A; | 			s->state=SSL3_ST_SR_FINISHED_A; | ||||||
| 			s->init_num=0; | 			s->init_num=0; | ||||||
|  | @ -473,6 +485,7 @@ int dtls1_accept(SSL *s) | ||||||
| 			ret=ssl3_get_finished(s,SSL3_ST_SR_FINISHED_A, | 			ret=ssl3_get_finished(s,SSL3_ST_SR_FINISHED_A, | ||||||
| 				SSL3_ST_SR_FINISHED_B); | 				SSL3_ST_SR_FINISHED_B); | ||||||
| 			if (ret <= 0) goto end; | 			if (ret <= 0) goto end; | ||||||
|  | 			BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SET_TIMEOUT, 0, NULL); | ||||||
| 			if (s->hit) | 			if (s->hit) | ||||||
| 				s->state=SSL_ST_OK; | 				s->state=SSL_ST_OK; | ||||||
| 			else | 			else | ||||||
|  | @ -555,6 +568,7 @@ int dtls1_accept(SSL *s) | ||||||
| 			s->d1->handshake_read_seq = 0; | 			s->d1->handshake_read_seq = 0; | ||||||
| 			/* next message is server hello */ | 			/* next message is server hello */ | ||||||
| 			s->d1->handshake_write_seq = 0; | 			s->d1->handshake_write_seq = 0; | ||||||
|  | 			s->d1->next_handshake_write_seq = 0; | ||||||
| 			goto end; | 			goto end; | ||||||
| 			/* break; */ | 			/* break; */ | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
							
								
								
									
										24
									
								
								ssl/dtls1.h
								
								
								
								
							
							
						
						
									
										24
									
								
								ssl/dtls1.h
								
								
								
								
							|  | @ -102,6 +102,19 @@ typedef struct dtls1_bitmap_st | ||||||
| 					   encoding */ | 					   encoding */ | ||||||
| 	} DTLS1_BITMAP; | 	} DTLS1_BITMAP; | ||||||
| 
 | 
 | ||||||
|  | struct dtls1_retransmit_state | ||||||
|  | 	{ | ||||||
|  | 	EVP_CIPHER_CTX *enc_write_ctx;	/* cryptographic state */ | ||||||
|  | 	EVP_MD_CTX *write_hash;			/* used for mac generation */ | ||||||
|  | #ifndef OPENSSL_NO_COMP | ||||||
|  | 	COMP_CTX *compress;				/* compression */ | ||||||
|  | #else | ||||||
|  | 	char *compress;	 | ||||||
|  | #endif | ||||||
|  | 	SSL_SESSION *session; | ||||||
|  | 	unsigned short epoch; | ||||||
|  | 	}; | ||||||
|  | 
 | ||||||
| struct hm_header_st | struct hm_header_st | ||||||
| 	{ | 	{ | ||||||
| 	unsigned char type; | 	unsigned char type; | ||||||
|  | @ -110,6 +123,7 @@ struct hm_header_st | ||||||
| 	unsigned long frag_off; | 	unsigned long frag_off; | ||||||
| 	unsigned long frag_len; | 	unsigned long frag_len; | ||||||
| 	unsigned int is_ccs; | 	unsigned int is_ccs; | ||||||
|  | 	struct dtls1_retransmit_state saved_retransmit_state; | ||||||
| 	}; | 	}; | ||||||
| 
 | 
 | ||||||
| struct ccs_header_st | struct ccs_header_st | ||||||
|  | @ -169,6 +183,9 @@ typedef struct dtls1_state_st | ||||||
| 
 | 
 | ||||||
| 	unsigned short handshake_read_seq; | 	unsigned short handshake_read_seq; | ||||||
| 
 | 
 | ||||||
|  | 	/* save last sequence number for retransmissions */ | ||||||
|  | 	unsigned char last_write_sequence[8]; | ||||||
|  | 
 | ||||||
| 	/* Received handshake records (processed and unprocessed) */ | 	/* Received handshake records (processed and unprocessed) */ | ||||||
| 	record_pqueue unprocessed_rcds; | 	record_pqueue unprocessed_rcds; | ||||||
| 	record_pqueue processed_rcds; | 	record_pqueue processed_rcds; | ||||||
|  | @ -179,6 +196,13 @@ typedef struct dtls1_state_st | ||||||
| 	/* Buffered (sent) handshake records */ | 	/* Buffered (sent) handshake records */ | ||||||
| 	pqueue sent_messages; | 	pqueue sent_messages; | ||||||
| 
 | 
 | ||||||
|  | 	/* Buffered application records.
 | ||||||
|  | 	 * Only for records between CCS and Finished | ||||||
|  | 	 * to prevent either protocol violation or | ||||||
|  | 	 * unnecessary message loss. | ||||||
|  | 	 */ | ||||||
|  | 	record_pqueue buffered_app_data; | ||||||
|  | 
 | ||||||
| 	unsigned int mtu; /* max wire packet size */ | 	unsigned int mtu; /* max wire packet size */ | ||||||
| 
 | 
 | ||||||
| 	struct hm_header_st w_msg_hdr; | 	struct hm_header_st w_msg_hdr; | ||||||
|  |  | ||||||
|  | @ -935,6 +935,8 @@ int dtls1_read_failed(SSL *s, int code); | ||||||
| int dtls1_buffer_message(SSL *s, int ccs); | int dtls1_buffer_message(SSL *s, int ccs); | ||||||
| int dtls1_retransmit_message(SSL *s, unsigned short seq,  | int dtls1_retransmit_message(SSL *s, unsigned short seq,  | ||||||
| 	unsigned long frag_off, int *found); | 	unsigned long frag_off, int *found); | ||||||
|  | int dtls1_get_queue_priority(unsigned short seq, int is_ccs); | ||||||
|  | int dtls1_retransmit_buffered_messages(SSL *s); | ||||||
| void dtls1_clear_record_buffer(SSL *s); | void dtls1_clear_record_buffer(SSL *s); | ||||||
| void dtls1_get_message_header(unsigned char *data, struct hm_header_st *msg_hdr); | void dtls1_get_message_header(unsigned char *data, struct hm_header_st *msg_hdr); | ||||||
| void dtls1_get_ccs_header(unsigned char *data, struct ccs_header_st *ccs_hdr); | void dtls1_get_ccs_header(unsigned char *data, struct ccs_header_st *ccs_hdr); | ||||||
|  |  | ||||||
|  | @ -4159,3 +4159,4 @@ TS_REQ_get_ext_by_OBJ                   4533	EXIST::FUNCTION: | ||||||
| TS_CONF_set_signer_cert                 4534	EXIST::FUNCTION: | TS_CONF_set_signer_cert                 4534	EXIST::FUNCTION: | ||||||
| X509_NAME_hash_old                      4535	EXIST::FUNCTION: | X509_NAME_hash_old                      4535	EXIST::FUNCTION: | ||||||
| ASN1_TIME_set_string                    4536	EXIST::FUNCTION: | ASN1_TIME_set_string                    4536	EXIST::FUNCTION: | ||||||
|  | EVP_MD_flags                            4537	EXIST::FUNCTION: | ||||||
|  |  | ||||||
|  | @ -44,6 +44,71 @@ while (@ARGV) { | ||||||
| 	} elsif($arg eq "-write") { | 	} elsif($arg eq "-write") { | ||||||
| 		$dowrite = 1; | 		$dowrite = 1; | ||||||
| 		shift @ARGV; | 		shift @ARGV; | ||||||
|  | 	} elsif($arg eq "-help" || $arg eq "-h" || $arg eq "-?" || $arg eq "--help") { | ||||||
|  | 		print STDERR <<"EOF"; | ||||||
|  | mkerr.pl [options] ... | ||||||
|  | 
 | ||||||
|  | Options: | ||||||
|  | 
 | ||||||
|  |   -conf F       Use the config file F instead of the default one: | ||||||
|  |                   crypto/err/openssl.ec | ||||||
|  | 
 | ||||||
|  |   -hprefix P    Prepend the filenames in generated #include <header> | ||||||
|  |                 statements with prefix P. Default: 'openssl/' (without | ||||||
|  |                 the quotes, naturally) | ||||||
|  | 
 | ||||||
|  |   -debug        Turn on debugging verbose output on stderr. | ||||||
|  | 
 | ||||||
|  |   -rebuild      Rebuild all header and C source files, irrespective of the | ||||||
|  |                 fact if any error or function codes have been added/removed. | ||||||
|  |                 Default: only update files for libraries which saw change | ||||||
|  |                          (of course, this requires '-write' as well, or no | ||||||
|  |                           files will be touched!) | ||||||
|  | 
 | ||||||
|  |   -recurse      scan a preconfigured set of directories / files for error and | ||||||
|  |                 function codes: | ||||||
|  |                   (<crypto/*.c>, <crypto/*/*.c>, <ssl/*.c>, <apps/*.c>) | ||||||
|  |                 When this option is NOT specified, the filelist is taken from | ||||||
|  |                 the commandline instead. Here, wildcards may be embedded. (Be | ||||||
|  |                 sure to escape those to prevent the shell from expanding them | ||||||
|  |                 for you when you wish mkerr.pl to do so instead.) | ||||||
|  |                 Default: take file list to scan from the command line. | ||||||
|  | 
 | ||||||
|  |   -reindex      Discard the numeric values previously assigned to the error | ||||||
|  |                 and function codes as extracted from the scanned header files; | ||||||
|  |                 instead renumber all of them starting from 100. (Note that | ||||||
|  |                 the numbers assigned through 'R' records in the config file | ||||||
|  |                 remain intact.) | ||||||
|  |                 Default: keep previously assigned numbers. (You are warned | ||||||
|  |                          when collisions are detected.) | ||||||
|  | 
 | ||||||
|  |   -nostatic     Generates a different source code, where these additional  | ||||||
|  |                 functions are generated for each library specified in the | ||||||
|  |                 config file: | ||||||
|  |                   void ERR_load_<LIB>_strings(void); | ||||||
|  |                   void ERR_unload_<LIB>_strings(void); | ||||||
|  |                   void ERR_<LIB>_error(int f, int r, char *fn, int ln); | ||||||
|  |                   #define <LIB>err(f,r) ERR_<LIB>_error(f,r,__FILE__,__LINE__) | ||||||
|  |                 while the code facilitates the use of these in an environment | ||||||
|  |                 where the error support routines are dynamically loaded at  | ||||||
|  |                 runtime. | ||||||
|  |                 Default: 'static' code generation. | ||||||
|  | 
 | ||||||
|  |   -staticloader Prefix generated functions with the 'static' scope modifier. | ||||||
|  |                 Default: don't write any scope modifier prefix. | ||||||
|  | 
 | ||||||
|  |   -write        Actually (over)write the generated code to the header and C  | ||||||
|  |                 source files as assigned to each library through the config  | ||||||
|  |                 file. | ||||||
|  |                 Default: don't write. | ||||||
|  | 
 | ||||||
|  |   -help / -h / -? / --help            Show this help text. | ||||||
|  | 
 | ||||||
|  |   ...           Additional arguments are added to the file list to scan, | ||||||
|  |                 assuming '-recurse' was NOT specified on the command line. | ||||||
|  | 
 | ||||||
|  | EOF | ||||||
|  | 		exit 1; | ||||||
| 	} else { | 	} else { | ||||||
| 		last; | 		last; | ||||||
| 	} | 	} | ||||||
|  | @ -69,8 +134,8 @@ while(<IN>) | ||||||
| 		$cskip{$3} = $1; | 		$cskip{$3} = $1; | ||||||
| 		if($3 ne "NONE") { | 		if($3 ne "NONE") { | ||||||
| 			$csrc{$1} = $3; | 			$csrc{$1} = $3; | ||||||
| 			$fmax{$1} = 99; | 			$fmax{$1} = 100; | ||||||
| 			$rmax{$1} = 99; | 			$rmax{$1} = 100; | ||||||
| 			$fassigned{$1} = ":"; | 			$fassigned{$1} = ":"; | ||||||
| 			$rassigned{$1} = ":"; | 			$rassigned{$1} = ":"; | ||||||
| 			$fnew{$1} = 0; | 			$fnew{$1} = 0; | ||||||
|  | @ -196,7 +261,7 @@ while (($hdr, $lib) = each %libinc) | ||||||
| 			if($1 eq "R") { | 			if($1 eq "R") { | ||||||
| 				$rcodes{$name} = $code; | 				$rcodes{$name} = $code; | ||||||
| 				if ($rassigned{$lib} =~ /:$code:/) { | 				if ($rassigned{$lib} =~ /:$code:/) { | ||||||
| 					print STDERR "!! ERROR: $lib reason code $code assigned twice\n"; | 					print STDERR "!! ERROR: $lib reason code $code assigned twice (collision at $name)\n"; | ||||||
| 					++$errcount; | 					++$errcount; | ||||||
| 				} | 				} | ||||||
| 				$rassigned{$lib} .= "$code:"; | 				$rassigned{$lib} .= "$code:"; | ||||||
|  | @ -206,7 +271,7 @@ while (($hdr, $lib) = each %libinc) | ||||||
| 				} | 				} | ||||||
| 			} else { | 			} else { | ||||||
| 				if ($fassigned{$lib} =~ /:$code:/) { | 				if ($fassigned{$lib} =~ /:$code:/) { | ||||||
| 					print STDERR "!! ERROR: $lib function code $code assigned twice\n"; | 					print STDERR "!! ERROR: $lib function code $code assigned twice (collision at $name)\n"; | ||||||
| 					++$errcount; | 					++$errcount; | ||||||
| 				} | 				} | ||||||
| 				$fassigned{$lib} .= "$code:"; | 				$fassigned{$lib} .= "$code:"; | ||||||
|  | @ -263,6 +328,9 @@ foreach $file (@source) { | ||||||
| 	print STDERR "File loaded: ".$file."\r" if $debug; | 	print STDERR "File loaded: ".$file."\r" if $debug; | ||||||
| 	open(IN, "<$file") || die "Can't open source file $file\n"; | 	open(IN, "<$file") || die "Can't open source file $file\n"; | ||||||
| 	while(<IN>) { | 	while(<IN>) { | ||||||
|  | 		# skip obsoleted source files entirely! | ||||||
|  | 		last if(/^#error\s+obsolete/); | ||||||
|  | 
 | ||||||
| 		if(/(([A-Z0-9]+)_F_([A-Z0-9_]+))/) { | 		if(/(([A-Z0-9]+)_F_([A-Z0-9_]+))/) { | ||||||
| 			next unless exists $csrc{$2}; | 			next unless exists $csrc{$2}; | ||||||
| 			next if($1 eq "BIO_F_BUFFER_CTX"); | 			next if($1 eq "BIO_F_BUFFER_CTX"); | ||||||
|  | @ -272,6 +340,7 @@ foreach $file (@source) { | ||||||
| 				$fnew{$2}++; | 				$fnew{$2}++; | ||||||
| 			} | 			} | ||||||
| 			$notrans{$1} = 1 unless exists $ftrans{$3}; | 			$notrans{$1} = 1 unless exists $ftrans{$3}; | ||||||
|  | 			print STDERR "Function: $1\t= $fcodes{$1} (lib: $2, name: $3)\n" if $debug;  | ||||||
| 		} | 		} | ||||||
| 		if(/(([A-Z0-9]+)_R_[A-Z0-9_]+)/) { | 		if(/(([A-Z0-9]+)_R_[A-Z0-9_]+)/) { | ||||||
| 			next unless exists $csrc{$2}; | 			next unless exists $csrc{$2}; | ||||||
|  | @ -280,6 +349,7 @@ foreach $file (@source) { | ||||||
| 				$rcodes{$1} = "X"; | 				$rcodes{$1} = "X"; | ||||||
| 				$rnew{$2}++; | 				$rnew{$2}++; | ||||||
| 			} | 			} | ||||||
|  | 			print STDERR "Reason: $1\t= $rcodes{$1} (lib: $2)\n" if $debug;  | ||||||
| 		}  | 		}  | ||||||
| 	} | 	} | ||||||
| 	close IN; | 	close IN; | ||||||
|  | @ -321,7 +391,7 @@ foreach $lib (keys %csrc) | ||||||
| 	} else { | 	} else { | ||||||
| 	    push @out, | 	    push @out, | ||||||
| "/* ====================================================================\n", | "/* ====================================================================\n", | ||||||
| " * Copyright (c) 2001-2008 The OpenSSL Project.  All rights reserved.\n", | " * Copyright (c) 2001-2009 The OpenSSL Project.  All rights reserved.\n", | ||||||
| " *\n", | " *\n", | ||||||
| " * Redistribution and use in source and binary forms, with or without\n", | " * Redistribution and use in source and binary forms, with or without\n", | ||||||
| " * modification, are permitted provided that the following conditions\n", | " * modification, are permitted provided that the following conditions\n", | ||||||
|  | @ -506,7 +576,7 @@ EOF | ||||||
| 	print OUT <<"EOF"; | 	print OUT <<"EOF"; | ||||||
| /* $cfile */ | /* $cfile */ | ||||||
| /* ==================================================================== | /* ==================================================================== | ||||||
|  * Copyright (c) 1999-2008 The OpenSSL Project.  All rights reserved. |  * Copyright (c) 1999-2009 The OpenSSL Project.  All rights reserved. | ||||||
|  * |  * | ||||||
|  * Redistribution and use in source and binary forms, with or without |  * Redistribution and use in source and binary forms, with or without | ||||||
|  * modification, are permitted provided that the following conditions |  * modification, are permitted provided that the following conditions | ||||||
|  |  | ||||||
|  | @ -90,7 +90,6 @@ while(<IN>) { | ||||||
| #define sk_${type_thing}_set_cmp_func(st, cmp) SKM_sk_set_cmp_func($type_thing, (st), (cmp)) | #define sk_${type_thing}_set_cmp_func(st, cmp) SKM_sk_set_cmp_func($type_thing, (st), (cmp)) | ||||||
| #define sk_${type_thing}_dup(st) SKM_sk_dup($type_thing, st) | #define sk_${type_thing}_dup(st) SKM_sk_dup($type_thing, st) | ||||||
| #define sk_${type_thing}_pop_free(st, free_func) SKM_sk_pop_free($type_thing, (st), (free_func)) | #define sk_${type_thing}_pop_free(st, free_func) SKM_sk_pop_free($type_thing, (st), (free_func)) | ||||||
| #define sk_${type_thing}_free(st) SKM_sk_free($type_thing, (st)) |  | ||||||
| #define sk_${type_thing}_shift(st) SKM_sk_shift($type_thing, (st)) | #define sk_${type_thing}_shift(st) SKM_sk_shift($type_thing, (st)) | ||||||
| #define sk_${type_thing}_pop(st) SKM_sk_pop($type_thing, (st)) | #define sk_${type_thing}_pop(st) SKM_sk_pop($type_thing, (st)) | ||||||
| #define sk_${type_thing}_sort(st) SKM_sk_sort($type_thing, (st)) | #define sk_${type_thing}_sort(st) SKM_sk_sort($type_thing, (st)) | ||||||
|  | @ -112,6 +111,21 @@ EOF | ||||||
| #define sk_${t1}_pop_free(st, free_func) sk_pop_free(CHECKED_PTR_OF(STACK_OF($t1), st), CHECKED_SK_FREE_FUNC2($t1, free_func)) | #define sk_${t1}_pop_free(st, free_func) sk_pop_free(CHECKED_PTR_OF(STACK_OF($t1), st), CHECKED_SK_FREE_FUNC2($t1, free_func)) | ||||||
| #define sk_${t1}_insert(st, val, i) sk_insert(CHECKED_PTR_OF(STACK_OF($t1), st), CHECKED_PTR_OF($t2, val), i) | #define sk_${t1}_insert(st, val, i) sk_insert(CHECKED_PTR_OF(STACK_OF($t1), st), CHECKED_PTR_OF($t2, val), i) | ||||||
| #define sk_${t1}_free(st) SKM_sk_free(${t1}, st) | #define sk_${t1}_free(st) SKM_sk_free(${t1}, st) | ||||||
|  | #define sk_${t1}_set(st, i, val) sk_set((_STACK *)CHECKED_PTR_OF(STACK_OF($t1), st), i, CHECKED_PTR_OF($t2, val)) | ||||||
|  | #define sk_${t1}_zero(st) SKM_sk_zero($t1, (st)) | ||||||
|  | #define sk_${t1}_unshift(st, val) sk_unshift((_STACK *)CHECKED_PTR_OF(STACK_OF($t1), st), CHECKED_PTR_OF($t2, val)) | ||||||
|  | #define sk_${t1}_find_ex(st, val) sk_find_ex((_STACK *)CHECKED_CONST_PTR_OF(STACK_OF($t1), st), CHECKED_CONST_PTR_OF($t2, val)) | ||||||
|  | #define sk_${t1}_delete(st, i) SKM_sk_delete($t1, (st), (i)) | ||||||
|  | #define sk_${t1}_delete_ptr(st, ptr) ($t1 *)sk_delete_ptr((_STACK *)CHECKED_PTR_OF(STACK_OF($t1), st), CHECKED_PTR_OF($t2, ptr)) | ||||||
|  | #define sk_${t1}_set_cmp_func(st, cmp)  \\ | ||||||
|  | 	((int (*)(const $t2 * const *,const $t2 * const *)) \\ | ||||||
|  | 	sk_set_cmp_func((_STACK *)CHECKED_PTR_OF(STACK_OF($t1), st), CHECKED_SK_CMP_FUNC($t2, cmp))) | ||||||
|  | #define sk_${t1}_dup(st) SKM_sk_dup($t1, st) | ||||||
|  | #define sk_${t1}_shift(st) SKM_sk_shift($t1, (st)) | ||||||
|  | #define sk_${t1}_pop(st) ($t2 *)sk_pop((_STACK *)CHECKED_PTR_OF(STACK_OF($t1), st)) | ||||||
|  | #define sk_${t1}_sort(st) SKM_sk_sort($t1, (st)) | ||||||
|  | #define sk_${t1}_is_sorted(st) SKM_sk_is_sorted($t1, (st)) | ||||||
|  | 
 | ||||||
| EOF | EOF | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -78,7 +78,7 @@ print OUT "\n"; | ||||||
| 
 | 
 | ||||||
| print "Checking compiler...\n"; | print "Checking compiler...\n"; | ||||||
| if (open(TEST,">cctest.c")) { | if (open(TEST,">cctest.c")) { | ||||||
|     print TEST "#include <stdio.h>\n#include <errno.h>\nmain(){printf(\"Hello world\\n\");}\n"; |     print TEST "#include <stdio.h>\n#include <stdlib.h>\n#include <errno.h>\nmain(){printf(\"Hello world\\n\");}\n"; | ||||||
|     close(TEST); |     close(TEST); | ||||||
|     system("$cc -o cctest cctest.c"); |     system("$cc -o cctest cctest.c"); | ||||||
|     if (`./cctest` !~ /Hello world/) { |     if (`./cctest` !~ /Hello world/) { | ||||||
|  | @ -96,7 +96,7 @@ if (open(TEST,">cctest.c")) { | ||||||
|     print OUT "Can't create cctest.c\n"; |     print OUT "Can't create cctest.c\n"; | ||||||
| } | } | ||||||
| if (open(TEST,">cctest.c")) { | if (open(TEST,">cctest.c")) { | ||||||
|     print TEST "#include <openssl/opensslv.h>\nmain(){printf(OPENSSL_VERSION_TEXT);}\n"; |     print TEST "#include <stdio.h>\n#include <stdlib.h>\n#include <openssl/opensslv.h>\nmain(){printf(OPENSSL_VERSION_TEXT);}\n"; | ||||||
|     close(TEST); |     close(TEST); | ||||||
|     system("$cc -o cctest -Iinclude cctest.c"); |     system("$cc -o cctest -Iinclude cctest.c"); | ||||||
|     $cctest = `./cctest`; |     $cctest = `./cctest`; | ||||||
|  |  | ||||||
|  | @ -98,9 +98,9 @@ SSLeay_add_ssl_algorithms               109	NOEXIST::FUNCTION: | ||||||
| SSLv23_client_method                    110	EXIST::FUNCTION:RSA | SSLv23_client_method                    110	EXIST::FUNCTION:RSA | ||||||
| SSLv23_method                           111	EXIST::FUNCTION:RSA | SSLv23_method                           111	EXIST::FUNCTION:RSA | ||||||
| SSLv23_server_method                    112	EXIST::FUNCTION:RSA | SSLv23_server_method                    112	EXIST::FUNCTION:RSA | ||||||
| SSLv2_client_method                     113	EXIST::FUNCTION:RSA | SSLv2_client_method                     113	EXIST::FUNCTION:RSA,SSL2 | ||||||
| SSLv2_method                            114	EXIST::FUNCTION:RSA | SSLv2_method                            114	EXIST::FUNCTION:RSA,SSL2 | ||||||
| SSLv2_server_method                     115	EXIST::FUNCTION:RSA | SSLv2_server_method                     115	EXIST::FUNCTION:RSA,SSL2 | ||||||
| SSLv3_client_method                     116	EXIST::FUNCTION: | SSLv3_client_method                     116	EXIST::FUNCTION: | ||||||
| SSLv3_method                            117	EXIST::FUNCTION: | SSLv3_method                            117	EXIST::FUNCTION: | ||||||
| SSLv3_server_method                     118	EXIST::FUNCTION: | SSLv3_server_method                     118	EXIST::FUNCTION: | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue