Compare commits
	
		
			2395 Commits
		
	
	
		
			OpenSSL-en
			...
			OpenSSL_0_
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					782ded56e5 | ||
| 
						 | 
					8e458d52b5 | ||
| 
						 | 
					1f475c1f6f | ||
| 
						 | 
					bc9867e672 | ||
| 
						 | 
					412fd4708d | ||
| 
						 | 
					273c624442 | ||
| 
						 | 
					8b591c2f8e | ||
| 
						 | 
					8f4a23e3b7 | ||
| 
						 | 
					c83d8e2ba6 | ||
| 
						 | 
					6afc70be84 | ||
| 
						 | 
					f503c2c9e6 | ||
| 
						 | 
					7656893d51 | ||
| 
						 | 
					ff38d68237 | ||
| 
						 | 
					aff3e60754 | ||
| 
						 | 
					8196d87371 | ||
| 
						 | 
					61b1ad197a | ||
| 
						 | 
					293bb4b1b8 | ||
| 
						 | 
					29ca164513 | ||
| 
						 | 
					97d58eadbf | ||
| 
						 | 
					0bf23d9b20 | ||
| 
						 | 
					813f256783 | ||
| 
						 | 
					8cdeec9f54 | ||
| 
						 | 
					bfa96bc20e | ||
| 
						 | 
					082cd4e564 | ||
| 
						 | 
					6f17f16fd5 | ||
| 
						 | 
					2115a89212 | ||
| 
						 | 
					84034f7aec | ||
| 
						 | 
					acce40c585 | ||
| 
						 | 
					af3ec1e24e | ||
| 
						 | 
					6dc78bf7e8 | ||
| 
						 | 
					f275683ae8 | ||
| 
						 | 
					ce4f169ff9 | ||
| 
						 | 
					c566205319 | ||
| 
						 | 
					da91e37d37 | ||
| 
						 | 
					2758c44398 | ||
| 
						 | 
					eaf6c61c9f | ||
| 
						 | 
					4e056a2894 | ||
| 
						 | 
					4c53d11d7f | ||
| 
						 | 
					f60b017da8 | ||
| 
						 | 
					1d647444e3 | ||
| 
						 | 
					08634f1156 | ||
| 
						 | 
					c1eeb6078f | ||
| 
						 | 
					a50d6a801f | ||
| 
						 | 
					953db08416 | ||
| 
						 | 
					0439a5a8a7 | ||
| 
						 | 
					0a5942093e | ||
| 
						 | 
					d78254aa28 | ||
| 
						 | 
					af67804bef | ||
| 
						 | 
					8ffe66b4ce | ||
| 
						 | 
					d62ec8362a | ||
| 
						 | 
					35a6db8640 | ||
| 
						 | 
					56dc24d483 | ||
| 
						 | 
					84d828ab70 | ||
| 
						 | 
					259b33d5a3 | ||
| 
						 | 
					cfae3d94e9 | ||
| 
						 | 
					6393c09cda | ||
| 
						 | 
					9421f1ab9c | ||
| 
						 | 
					b9c23cca01 | ||
| 
						 | 
					5bf0d0ea1e | ||
| 
						 | 
					c863201780 | ||
| 
						 | 
					cb21d001c9 | ||
| 
						 | 
					769f74b818 | ||
| 
						 | 
					c7faede37b | ||
| 
						 | 
					64051a3a71 | ||
| 
						 | 
					d4e573f305 | ||
| 
						 | 
					8260eded07 | ||
| 
						 | 
					e20afbb340 | ||
| 
						 | 
					2b2ab52354 | ||
| 
						 | 
					402b4a784d | ||
| 
						 | 
					651e7ddf7e | ||
| 
						 | 
					40bace2da6 | ||
| 
						 | 
					8d6e60486f | ||
| 
						 | 
					1f30946481 | ||
| 
						 | 
					e89c82f549 | ||
| 
						 | 
					b1697f189b | ||
| 
						 | 
					812d100d06 | ||
| 
						 | 
					17a202add7 | ||
| 
						 | 
					b759742352 | ||
| 
						 | 
					3bd16a8902 | ||
| 
						 | 
					555d75252a | ||
| 
						 | 
					eaad02a747 | ||
| 
						 | 
					475e4d23bd | ||
| 
						 | 
					bf4ae6dcfa | ||
| 
						 | 
					97101fafd5 | ||
| 
						 | 
					17d4f07658 | ||
| 
						 | 
					403f1bdc70 | ||
| 
						 | 
					5ec797f263 | ||
| 
						 | 
					d574d83993 | ||
| 
						 | 
					83411793b6 | ||
| 
						 | 
					5b1aea7afe | ||
| 
						 | 
					65caee44ff | ||
| 
						 | 
					327e113775 | ||
| 
						 | 
					58f3009aba | ||
| 
						 | 
					738554331b | ||
| 
						 | 
					b193f29a9b | ||
| 
						 | 
					3f083ef0eb | ||
| 
						 | 
					17ed6c06a7 | ||
| 
						 | 
					c112323dd5 | ||
| 
						 | 
					0709385d3c | ||
| 
						 | 
					7ab58bf012 | ||
| 
						 | 
					54a656ef08 | ||
| 
						 | 
					8f797f14b8 | ||
| 
						 | 
					cd10ba9c39 | ||
| 
						 | 
					c0d64de660 | ||
| 
						 | 
					96a3369c4a | ||
| 
						 | 
					c1ce8cf3b8 | ||
| 
						 | 
					e8ad570e3f | ||
| 
						 | 
					ad1ddf413c | ||
| 
						 | 
					2d780dfd81 | ||
| 
						 | 
					b6fee5c2fb | ||
| 
						 | 
					e2c2152be9 | ||
| 
						 | 
					10fa047622 | ||
| 
						 | 
					919b2a9673 | ||
| 
						 | 
					024a20905d | ||
| 
						 | 
					04f0a6ba39 | ||
| 
						 | 
					eb43641dd3 | ||
| 
						 | 
					69ba8a00ad | ||
| 
						 | 
					f6a0c4f853 | ||
| 
						 | 
					040ade9bee | ||
| 
						 | 
					d479dc1d02 | ||
| 
						 | 
					7fb8d254fe | ||
| 
						 | 
					c99935e32c | ||
| 
						 | 
					2232e262bf | ||
| 
						 | 
					137e7e3aa1 | ||
| 
						 | 
					ba36b61d3d | ||
| 
						 | 
					ccb13ded84 | ||
| 
						 | 
					46ce790727 | ||
| 
						 | 
					9ea1b87862 | ||
| 
						 | 
					9831d941ca | ||
| 
						 | 
					707ceb29e0 | ||
| 
						 | 
					688cf84d1f | ||
| 
						 | 
					3d470fc7b7 | ||
| 
						 | 
					69ce48c307 | ||
| 
						 | 
					edb7b28a00 | ||
| 
						 | 
					06b7c8d5ba | ||
| 
						 | 
					c4efde7403 | ||
| 
						 | 
					a1edc87664 | ||
| 
						 | 
					6722b62b36 | ||
| 
						 | 
					7d80b27949 | ||
| 
						 | 
					9cbc3356e7 | ||
| 
						 | 
					d742bd882e | ||
| 
						 | 
					97a06ad9ef | ||
| 
						 | 
					756b9a0046 | ||
| 
						 | 
					9161c2ff51 | ||
| 
						 | 
					96c930dd2f | ||
| 
						 | 
					21f8cf65e6 | ||
| 
						 | 
					8bcc049399 | ||
| 
						 | 
					95900b8592 | ||
| 
						 | 
					c81a15099a | ||
| 
						 | 
					20a50cb517 | ||
| 
						 | 
					a8c125550c | ||
| 
						 | 
					3782350c14 | ||
| 
						 | 
					a71a482250 | ||
| 
						 | 
					d6257073aa | ||
| 
						 | 
					8b6ee018c2 | ||
| 
						 | 
					ddff68bee7 | ||
| 
						 | 
					ddab3c9327 | ||
| 
						 | 
					491659c436 | ||
| 
						 | 
					6a9a7ff259 | ||
| 
						 | 
					8d6fc30bc7 | ||
| 
						 | 
					56824b9658 | ||
| 
						 | 
					f7cd5462c9 | ||
| 
						 | 
					892e9625d3 | ||
| 
						 | 
					e2916b2540 | ||
| 
						 | 
					d268511c84 | ||
| 
						 | 
					1810d2088e | ||
| 
						 | 
					d618f703ec | ||
| 
						 | 
					190467767e | ||
| 
						 | 
					896e4fef30 | ||
| 
						 | 
					8d699c8c93 | ||
| 
						 | 
					38c7271a39 | ||
| 
						 | 
					e2a93e38d6 | ||
| 
						 | 
					5e3247d8bc | ||
| 
						 | 
					41c2fb962c | ||
| 
						 | 
					b53e44e572 | ||
| 
						 | 
					e5f4d8279d | ||
| 
						 | 
					455bacd4d3 | ||
| 
						 | 
					86e8b56ac4 | ||
| 
						 | 
					e85cbdad7a | ||
| 
						 | 
					bff1567623 | ||
| 
						 | 
					db199abd9e | ||
| 
						 | 
					b6d0defb98 | ||
| 
						 | 
					c752563e43 | ||
| 
						 | 
					ad22b914d6 | ||
| 
						 | 
					f216fae545 | ||
| 
						 | 
					242823c9bc | ||
| 
						 | 
					0eae6cd5f2 | ||
| 
						 | 
					40efa67248 | ||
| 
						 | 
					0bf707e346 | ||
| 
						 | 
					769fedc3ad | ||
| 
						 | 
					9c3db400dc | ||
| 
						 | 
					96a2c35d91 | ||
| 
						 | 
					d9ec9d990f | ||
| 
						 | 
					f9fde13590 | ||
| 
						 | 
					74174b9d05 | ||
| 
						 | 
					b5148cf1f7 | ||
| 
						 | 
					90a617e050 | ||
| 
						 | 
					259cdf2af9 | ||
| 
						 | 
					6c950e0dc9 | ||
| 
						 | 
					62dd6f161a | ||
| 
						 | 
					6aba658cd8 | ||
| 
						 | 
					89eda1fc01 | ||
| 
						 | 
					accb0c6edb | ||
| 
						 | 
					bbec79a0c1 | ||
| 
						 | 
					e0db2eed8d | ||
| 
						 | 
					6f7ba4be1f | ||
| 
						 | 
					2ccb522c5b | ||
| 
						 | 
					00a357ab20 | ||
| 
						 | 
					8ee4845b65 | ||
| 
						 | 
					19b8d06a79 | ||
| 
						 | 
					5c6bf03117 | ||
| 
						 | 
					f72ed6153b | ||
| 
						 | 
					0bf76767b0 | ||
| 
						 | 
					d652a0957f | ||
| 
						 | 
					fbcd27907b | ||
| 
						 | 
					a551bea52e | ||
| 
						 | 
					6cb686208e | ||
| 
						 | 
					732c9fe179 | ||
| 
						 | 
					bd1fb77245 | ||
| 
						 | 
					d610d27f30 | ||
| 
						 | 
					4f99ab58f7 | ||
| 
						 | 
					339abc9bd9 | ||
| 
						 | 
					4407fbc2d4 | ||
| 
						 | 
					96b35c9e26 | ||
| 
						 | 
					27f08d6d48 | ||
| 
						 | 
					907a8f1e6e | ||
| 
						 | 
					e1c191fe44 | ||
| 
						 | 
					a9e0953900 | ||
| 
						 | 
					9597027693 | ||
| 
						 | 
					5aa3429c5d | ||
| 
						 | 
					ffd418f217 | ||
| 
						 | 
					78f41a4e89 | ||
| 
						 | 
					76dcae8020 | ||
| 
						 | 
					0711be1696 | ||
| 
						 | 
					190ef122b2 | ||
| 
						 | 
					7521ab3d0b | ||
| 
						 | 
					0587ec2645 | ||
| 
						 | 
					b76d66fbf6 | ||
| 
						 | 
					06f851f721 | ||
| 
						 | 
					f6661d391c | ||
| 
						 | 
					284b216b3a | ||
| 
						 | 
					dc74e7d5d7 | ||
| 
						 | 
					3d76ceddff | ||
| 
						 | 
					05dbe6ee1f | ||
| 
						 | 
					871d0f5126 | ||
| 
						 | 
					5be1264b7e | ||
| 
						 | 
					b963f807be | ||
| 
						 | 
					314c667050 | ||
| 
						 | 
					005bbb52ff | ||
| 
						 | 
					28c8a911bd | ||
| 
						 | 
					a690102da2 | ||
| 
						 | 
					437d1ed49f | ||
| 
						 | 
					12fd8be2c4 | ||
| 
						 | 
					8258f7b361 | ||
| 
						 | 
					e15ea3d9e1 | ||
| 
						 | 
					09db11783d | ||
| 
						 | 
					677532629d | ||
| 
						 | 
					f6733ae577 | ||
| 
						 | 
					57d8ff79b2 | ||
| 
						 | 
					2d2ca3aab1 | ||
| 
						 | 
					cfc7620572 | ||
| 
						 | 
					4b14ed760d | ||
| 
						 | 
					79a6260a11 | ||
| 
						 | 
					a0bf8f2008 | ||
| 
						 | 
					408bf2f0c4 | ||
| 
						 | 
					874fee478c | ||
| 
						 | 
					90d9a69bb1 | ||
| 
						 | 
					9a01bc0732 | ||
| 
						 | 
					4006c56036 | ||
| 
						 | 
					dbcc560717 | ||
| 
						 | 
					1729588435 | ||
| 
						 | 
					6f7c2cb31e | ||
| 
						 | 
					a4629f4136 | ||
| 
						 | 
					449d39f41c | ||
| 
						 | 
					56b5f687e4 | ||
| 
						 | 
					caa4f47f61 | ||
| 
						 | 
					36757b4438 | ||
| 
						 | 
					75871dda4b | ||
| 
						 | 
					506fec1a95 | ||
| 
						 | 
					aae329c447 | ||
| 
						 | 
					02acf1409e | ||
| 
						 | 
					6ac3309c74 | ||
| 
						 | 
					1b15cfa11d | ||
| 
						 | 
					76dfca879f | ||
| 
						 | 
					7cdc7bacea | ||
| 
						 | 
					fbd78b5c08 | ||
| 
						 | 
					fbcd0da597 | ||
| 
						 | 
					665dc3924d | ||
| 
						 | 
					4bdacff25b | ||
| 
						 | 
					ecd45314b8 | ||
| 
						 | 
					3e06fb754e | ||
| 
						 | 
					84236041c1 | ||
| 
						 | 
					b2e20a31ea | ||
| 
						 | 
					38e19a4220 | ||
| 
						 | 
					f28164fefd | ||
| 
						 | 
					8d44d96ec3 | ||
| 
						 | 
					2eaabb718b | ||
| 
						 | 
					5572f482e7 | ||
| 
						 | 
					707e098687 | ||
| 
						 | 
					729f0a277e | ||
| 
						 | 
					88de74ad83 | ||
| 
						 | 
					c55d759168 | ||
| 
						 | 
					97b8718f15 | ||
| 
						 | 
					b7910992d8 | ||
| 
						 | 
					cf3b8b52f1 | ||
| 
						 | 
					388a6f937f | ||
| 
						 | 
					42b06fbaca | ||
| 
						 | 
					a61050ad96 | ||
| 
						 | 
					2245cd87d4 | ||
| 
						 | 
					c199837c54 | ||
| 
						 | 
					83699c4784 | ||
| 
						 | 
					30afcc072a | ||
| 
						 | 
					baaeac3036 | ||
| 
						 | 
					832f9304fd | ||
| 
						 | 
					fa4bde98d2 | ||
| 
						 | 
					d19370b617 | ||
| 
						 | 
					ca80756c70 | ||
| 
						 | 
					8376acbf7f | ||
| 
						 | 
					ef0baf60aa | ||
| 
						 | 
					12a2ff9625 | ||
| 
						 | 
					7ba3a4c3d2 | ||
| 
						 | 
					29e48c18b7 | ||
| 
						 | 
					292a217b51 | ||
| 
						 | 
					982dfb7d10 | ||
| 
						 | 
					104117c5e7 | ||
| 
						 | 
					7ab3c662e3 | ||
| 
						 | 
					8c4b69d3ab | ||
| 
						 | 
					4fd5e85a18 | ||
| 
						 | 
					0e2cc42cfb | ||
| 
						 | 
					e9a9211e75 | ||
| 
						 | 
					1e5c205ccb | ||
| 
						 | 
					4c82171a8e | ||
| 
						 | 
					88c80b3e75 | ||
| 
						 | 
					d438845ac8 | ||
| 
						 | 
					b1d495b2c4 | ||
| 
						 | 
					27bad5ad3d | ||
| 
						 | 
					6b7a46b721 | ||
| 
						 | 
					6a89a25c27 | ||
| 
						 | 
					001ab3abad | ||
| 
						 | 
					ff90d659e6 | ||
| 
						 | 
					ec8ad2bb96 | ||
| 
						 | 
					8f841c70c4 | ||
| 
						 | 
					5fbb02fcb1 | ||
| 
						 | 
					4e1b50e219 | ||
| 
						 | 
					052c0f276e | ||
| 
						 | 
					d7b2342a6a | ||
| 
						 | 
					7e9db7cefc | ||
| 
						 | 
					d30e4c5b0b | ||
| 
						 | 
					9de6bb8abc | ||
| 
						 | 
					72e04bd13f | ||
| 
						 | 
					4ec0448122 | ||
| 
						 | 
					842d8e209b | ||
| 
						 | 
					292fcd5c7b | ||
| 
						 | 
					74e3931f84 | ||
| 
						 | 
					12dadc555f | ||
| 
						 | 
					1e7e392419 | ||
| 
						 | 
					b75b2225e5 | ||
| 
						 | 
					12f27bd414 | ||
| 
						 | 
					e11b82c337 | ||
| 
						 | 
					69deec58fb | ||
| 
						 | 
					1e976bdc46 | ||
| 
						 | 
					9946fceb9d | ||
| 
						 | 
					6fed88113b | ||
| 
						 | 
					04ad43af9e | ||
| 
						 | 
					97ebe047d0 | ||
| 
						 | 
					fc6a6a1030 | ||
| 
						 | 
					3d840c827f | ||
| 
						 | 
					a2a1a04e53 | ||
| 
						 | 
					f86abc2e80 | ||
| 
						 | 
					227aec9a0f | ||
| 
						 | 
					7104c376ae | ||
| 
						 | 
					b0165ce439 | ||
| 
						 | 
					0638ced5cc | ||
| 
						 | 
					3c8756f024 | ||
| 
						 | 
					e984b2af64 | ||
| 
						 | 
					70e96dcf59 | ||
| 
						 | 
					2c696b2ddc | ||
| 
						 | 
					1801bc0658 | ||
| 
						 | 
					ebbad107bf | ||
| 
						 | 
					9a48b07ee4 | ||
| 
						 | 
					230fd6b7b6 | ||
| 
						 | 
					20b33a015f | ||
| 
						 | 
					293d5082c7 | ||
| 
						 | 
					fc0ab2eac2 | ||
| 
						 | 
					64cb996206 | ||
| 
						 | 
					929f116733 | ||
| 
						 | 
					ba5ba5490d | ||
| 
						 | 
					413f2b2247 | ||
| 
						 | 
					b8565a9af9 | ||
| 
						 | 
					fbf4c7b4f1 | ||
| 
						 | 
					99542d8763 | ||
| 
						 | 
					94960c8421 | ||
| 
						 | 
					b3c1d18d03 | ||
| 
						 | 
					6859cf7459 | ||
| 
						 | 
					6c8aec60ca | ||
| 
						 | 
					2018681b33 | ||
| 
						 | 
					c0ca52952e | ||
| 
						 | 
					e204516178 | ||
| 
						 | 
					39d727d0c3 | ||
| 
						 | 
					153aecf91a | ||
| 
						 | 
					6319853811 | ||
| 
						 | 
					cd98ab6491 | ||
| 
						 | 
					6b3a385f85 | ||
| 
						 | 
					b3823ac64b | ||
| 
						 | 
					27a80b7906 | ||
| 
						 | 
					5d9470ff8e | ||
| 
						 | 
					4e33db9a3f | ||
| 
						 | 
					e78f137899 | ||
| 
						 | 
					ca9a114f7a | ||
| 
						 | 
					40e66398db | ||
| 
						 | 
					ce1dc2e9b2 | ||
| 
						 | 
					b4b62004a6 | ||
| 
						 | 
					6e32d0a74b | ||
| 
						 | 
					f7eb95852c | ||
| 
						 | 
					a4f53a1c73 | ||
| 
						 | 
					a90ae02454 | ||
| 
						 | 
					4c8f79a33e | ||
| 
						 | 
					7cc6ec7af7 | ||
| 
						 | 
					c2bbf275b2 | ||
| 
						 | 
					9226e2187c | ||
| 
						 | 
					12a296edfc | ||
| 
						 | 
					48921e00fc | ||
| 
						 | 
					e696a05791 | ||
| 
						 | 
					f804930150 | ||
| 
						 | 
					3403caf3da | ||
| 
						 | 
					4a13e4b36c | ||
| 
						 | 
					b7fb041f31 | ||
| 
						 | 
					ba11121731 | ||
| 
						 | 
					ed5e37c309 | ||
| 
						 | 
					65b1d31df5 | ||
| 
						 | 
					a98beb3a2d | ||
| 
						 | 
					b499ed06d2 | ||
| 
						 | 
					f627c159b1 | ||
| 
						 | 
					6ff7c95843 | ||
| 
						 | 
					535cedf136 | ||
| 
						 | 
					3a00964dd3 | ||
| 
						 | 
					41cc7096b8 | ||
| 
						 | 
					c237de058f | ||
| 
						 | 
					e2aeb8174b | ||
| 
						 | 
					34f1f2a81c | ||
| 
						 | 
					c96f0fd2d1 | ||
| 
						 | 
					8aefe253a7 | ||
| 
						 | 
					7e31164ae0 | ||
| 
						 | 
					ad55f581f9 | ||
| 
						 | 
					d4a8f90cab | ||
| 
						 | 
					41ab00bedf | ||
| 
						 | 
					a69d50b02d | ||
| 
						 | 
					fc85ac20c7 | ||
| 
						 | 
					e88479243c | ||
| 
						 | 
					c787525ac8 | ||
| 
						 | 
					ed7443661c | ||
| 
						 | 
					9a2601033d | ||
| 
						 | 
					3d2aa62cb6 | ||
| 
						 | 
					9925249ba5 | ||
| 
						 | 
					fbb311a7d2 | ||
| 
						 | 
					d7041ea5de | ||
| 
						 | 
					f309c1ae50 | ||
| 
						 | 
					82a20fb0f0 | ||
| 
						 | 
					68a9ee13e8 | ||
| 
						 | 
					a64f08f3dd | ||
| 
						 | 
					428112ef10 | ||
| 
						 | 
					64376cd8ff | ||
| 
						 | 
					384897f46b | ||
| 
						 | 
					cc8aa08b02 | ||
| 
						 | 
					08e60fc0ff | ||
| 
						 | 
					1c4e4e4f56 | ||
| 
						 | 
					3f6db7f518 | ||
| 
						 | 
					ea050a6eb3 | ||
| 
						 | 
					bde63f803a | ||
| 
						 | 
					8435a755fd | ||
| 
						 | 
					52c29b7b99 | ||
| 
						 | 
					e73308638a | ||
| 
						 | 
					1ac3419ef6 | ||
| 
						 | 
					c6bf63da7c | ||
| 
						 | 
					0fd05a2f0f | ||
| 
						 | 
					1e9858a28b | ||
| 
						 | 
					1fd0338b49 | ||
| 
						 | 
					8f4a09e531 | ||
| 
						 | 
					b2be73e4e8 | ||
| 
						 | 
					3b2f77d88e | ||
| 
						 | 
					52ccf9e1c1 | ||
| 
						 | 
					37f5fcf85c | ||
| 
						 | 
					5e947727a9 | ||
| 
						 | 
					f742e497dd | ||
| 
						 | 
					d7bd58cf36 | ||
| 
						 | 
					dcc426fcfe | ||
| 
						 | 
					7eb18f1237 | ||
| 
						 | 
					b84e473d63 | ||
| 
						 | 
					265e892fed | ||
| 
						 | 
					4aecd67d04 | ||
| 
						 | 
					623e9e66c0 | ||
| 
						 | 
					74a25e9cd9 | ||
| 
						 | 
					90f5a2b6fe | ||
| 
						 | 
					bf625abe29 | ||
| 
						 | 
					d020139db7 | ||
| 
						 | 
					b44069730b | ||
| 
						 | 
					749d055eba | ||
| 
						 | 
					49a0f77867 | ||
| 
						 | 
					f84acec8ea | ||
| 
						 | 
					2af52de7b5 | ||
| 
						 | 
					d3b282e01f | ||
| 
						 | 
					85d9e2f2f0 | ||
| 
						 | 
					629d860cbc | ||
| 
						 | 
					056cc163f5 | ||
| 
						 | 
					04ed3994e2 | ||
| 
						 | 
					6100502726 | ||
| 
						 | 
					e09efcf71a | ||
| 
						 | 
					763b4dcc66 | ||
| 
						 | 
					a1f09ea8f8 | ||
| 
						 | 
					83348e0b80 | ||
| 
						 | 
					bce625987d | ||
| 
						 | 
					f13ddd5d0a | ||
| 
						 | 
					18a31aa861 | ||
| 
						 | 
					b2a4e959c9 | ||
| 
						 | 
					f17ef241d1 | ||
| 
						 | 
					aa1e56b0b9 | ||
| 
						 | 
					7ef524ea1c | ||
| 
						 | 
					0c7141a343 | ||
| 
						 | 
					5488bb6197 | ||
| 
						 | 
					8e28c67155 | ||
| 
						 | 
					3c1a6f441b | ||
| 
						 | 
					97d640e1f0 | ||
| 
						 | 
					36969082bb | ||
| 
						 | 
					ddf7602425 | ||
| 
						 | 
					4fde69b066 | ||
| 
						 | 
					fd9a4dbe94 | ||
| 
						 | 
					f0db0ed35d | ||
| 
						 | 
					6d24cbf452 | ||
| 
						 | 
					5454829ae6 | ||
| 
						 | 
					da0bca6466 | ||
| 
						 | 
					4705bd9b37 | ||
| 
						 | 
					5bd90983bc | ||
| 
						 | 
					329f981582 | ||
| 
						 | 
					cece7adcee | ||
| 
						 | 
					74cc4903ef | ||
| 
						 | 
					41fdcfa71e | ||
| 
						 | 
					60cc56b1a9 | ||
| 
						 | 
					f912e9293f | ||
| 
						 | 
					56939728b7 | ||
| 
						 | 
					ea26226046 | ||
| 
						 | 
					17f6279317 | ||
| 
						 | 
					d3c32ffbcc | ||
| 
						 | 
					e172d60ddb | ||
| 
						 | 
					1d2a3fe246 | ||
| 
						 | 
					f8fe7fa491 | ||
| 
						 | 
					00c8546d21 | ||
| 
						 | 
					fbe792f0ac | ||
| 
						 | 
					14a7cfb32a | ||
| 
						 | 
					7a8645d171 | ||
| 
						 | 
					31e441a805 | ||
| 
						 | 
					5bf738737d | ||
| 
						 | 
					c4a28caa32 | ||
| 
						 | 
					415e03aa6f | ||
| 
						 | 
					c3eb0c1e7f | ||
| 
						 | 
					ac120e20e3 | ||
| 
						 | 
					d18f681310 | ||
| 
						 | 
					ea5214328b | ||
| 
						 | 
					3f90e45079 | ||
| 
						 | 
					9dcc441a5f | ||
| 
						 | 
					0833a40d13 | ||
| 
						 | 
					ab1a01e9b2 | ||
| 
						 | 
					db4f691f9f | ||
| 
						 | 
					d28735a05b | ||
| 
						 | 
					183847747a | ||
| 
						 | 
					bac6012308 | ||
| 
						 | 
					f1e1d6d6af | ||
| 
						 | 
					aaa384ca1a | ||
| 
						 | 
					f908226898 | ||
| 
						 | 
					b012127a99 | ||
| 
						 | 
					909abce800 | ||
| 
						 | 
					33d4e690cc | ||
| 
						 | 
					848c849584 | ||
| 
						 | 
					102c8f47bf | ||
| 
						 | 
					d3bcbba45c | ||
| 
						 | 
					0903e56196 | ||
| 
						 | 
					95ecacf8a2 | ||
| 
						 | 
					be8a280e0b | ||
| 
						 | 
					6fb60a84dd | ||
| 
						 | 
					5af7d1a3b8 | ||
| 
						 | 
					35b73a1f20 | ||
| 
						 | 
					9e4f9b36fc | ||
| 
						 | 
					84d7e365a0 | ||
| 
						 | 
					64c3da230f | ||
| 
						 | 
					7793f30e09 | ||
| 
						 | 
					714df32e33 | ||
| 
						 | 
					1dc920c8de | ||
| 
						 | 
					16dc1cfb5c | ||
| 
						 | 
					819ff32dc4 | ||
| 
						 | 
					5574e0ed41 | ||
| 
						 | 
					265a9e2c5d | ||
| 
						 | 
					b0b3b11dbf | ||
| 
						 | 
					042e57d562 | ||
| 
						 | 
					c578208d63 | ||
| 
						 | 
					ba8fb52183 | ||
| 
						 | 
					038461a61b | ||
| 
						 | 
					f6f9961819 | ||
| 
						 | 
					716c94492a | ||
| 
						 | 
					e74e9c48de | ||
| 
						 | 
					a4f335ba3e | ||
| 
						 | 
					179add2b07 | ||
| 
						 | 
					456bc309d8 | ||
| 
						 | 
					90832c891e | ||
| 
						 | 
					dc2ab9f4fa | ||
| 
						 | 
					a7535a2727 | ||
| 
						 | 
					162d858a90 | ||
| 
						 | 
					44c09667ff | ||
| 
						 | 
					da9b972466 | ||
| 
						 | 
					13ac37d01a | ||
| 
						 | 
					c2decc56b0 | ||
| 
						 | 
					bd45950f4a | ||
| 
						 | 
					1649d5fee1 | ||
| 
						 | 
					f70cf11819 | ||
| 
						 | 
					f8279b8ea3 | ||
| 
						 | 
					5575f781ad | ||
| 
						 | 
					76b8f839c2 | ||
| 
						 | 
					0472883cc2 | ||
| 
						 | 
					8d37f07e09 | ||
| 
						 | 
					87e8feca95 | ||
| 
						 | 
					450c73d98b | ||
| 
						 | 
					e70a39830c | ||
| 
						 | 
					2ead4a5df6 | ||
| 
						 | 
					ba25198517 | ||
| 
						 | 
					6297bcd74c | ||
| 
						 | 
					dd7ab82e75 | ||
| 
						 | 
					addafc08a5 | ||
| 
						 | 
					c046fffa16 | ||
| 
						 | 
					3aecef7697 | ||
| 
						 | 
					b218af2b27 | ||
| 
						 | 
					e970fa0022 | ||
| 
						 | 
					458bb156bf | ||
| 
						 | 
					bca9dc2a51 | ||
| 
						 | 
					3720ea24f0 | ||
| 
						 | 
					77c46bbf29 | ||
| 
						 | 
					72a37c03be | ||
| 
						 | 
					02750ff56f | ||
| 
						 | 
					93d1969c78 | ||
| 
						 | 
					0bee0e6294 | ||
| 
						 | 
					6178bb8fe9 | ||
| 
						 | 
					12593e6f45 | ||
| 
						 | 
					819a040f44 | ||
| 
						 | 
					5b195b5a0e | ||
| 
						 | 
					546405bece | ||
| 
						 | 
					4289131ae6 | ||
| 
						 | 
					b721e1e239 | ||
| 
						 | 
					f013c7f2a6 | ||
| 
						 | 
					6cf2012a4d | ||
| 
						 | 
					e459ebaed1 | ||
| 
						 | 
					1cc67fa80c | ||
| 
						 | 
					eefa6e4e2b | ||
| 
						 | 
					6d9116f83d | ||
| 
						 | 
					e9e3ce40c5 | ||
| 
						 | 
					56d84db1d4 | ||
| 
						 | 
					8be4e173e8 | ||
| 
						 | 
					648765ba2f | ||
| 
						 | 
					16758de0a2 | ||
| 
						 | 
					c6ccf055ba | ||
| 
						 | 
					f19b6474fe | ||
| 
						 | 
					1649d85d10 | ||
| 
						 | 
					2f6f2970c4 | ||
| 
						 | 
					f227a1af7d | ||
| 
						 | 
					cd72dcd925 | ||
| 
						 | 
					7a5ed919ad | ||
| 
						 | 
					799d7a34cf | ||
| 
						 | 
					20adcfa058 | ||
| 
						 | 
					4408572079 | ||
| 
						 | 
					31b5b999c7 | ||
| 
						 | 
					f8bcfb5d5a | ||
| 
						 | 
					02b7ec88bb | ||
| 
						 | 
					0af9a89cef | ||
| 
						 | 
					44e9c2617a | ||
| 
						 | 
					b61739874e | ||
| 
						 | 
					db802c60e3 | ||
| 
						 | 
					73957bd323 | ||
| 
						 | 
					503f3b1a21 | ||
| 
						 | 
					81f1338613 | ||
| 
						 | 
					402bcde847 | ||
| 
						 | 
					90baf2a92d | ||
| 
						 | 
					ec9ea6a3c8 | ||
| 
						 | 
					7e6617611f | ||
| 
						 | 
					13793a0ddf | ||
| 
						 | 
					b334853d72 | ||
| 
						 | 
					ca6dde5d3d | ||
| 
						 | 
					4b5d50e26b | ||
| 
						 | 
					8e6cbcd7c0 | ||
| 
						 | 
					6d454e6ab2 | ||
| 
						 | 
					9335a5f7c0 | ||
| 
						 | 
					4f0e09aa67 | ||
| 
						 | 
					32bf74e30e | ||
| 
						 | 
					e921bbf9f6 | ||
| 
						 | 
					6643f275e2 | ||
| 
						 | 
					205a4a9571 | ||
| 
						 | 
					cd4c36adb8 | ||
| 
						 | 
					44279d4638 | ||
| 
						 | 
					311e209931 | ||
| 
						 | 
					9f1c3d7392 | ||
| 
						 | 
					fe5eb6707f | ||
| 
						 | 
					362be34a2f | ||
| 
						 | 
					f5db08e57a | ||
| 
						 | 
					ec7f13d375 | ||
| 
						 | 
					8cfdb960f0 | ||
| 
						 | 
					ec27c2ac97 | ||
| 
						 | 
					ebccb429de | ||
| 
						 | 
					b97c854e15 | ||
| 
						 | 
					7dbed652fc | ||
| 
						 | 
					bdbbf930aa | ||
| 
						 | 
					6789b41d86 | ||
| 
						 | 
					5254b53e97 | ||
| 
						 | 
					8adc3e5db7 | ||
| 
						 | 
					0487cb234c | ||
| 
						 | 
					80e1495b99 | ||
| 
						 | 
					041843e47e | ||
| 
						 | 
					4810644f65 | ||
| 
						 | 
					c2aa4f2081 | ||
| 
						 | 
					d24d873e17 | ||
| 
						 | 
					b23f50e67e | ||
| 
						 | 
					7fe03ed3a3 | ||
| 
						 | 
					7728770623 | ||
| 
						 | 
					9466fa6750 | ||
| 
						 | 
					279c36564f | ||
| 
						 | 
					cead7f36da | ||
| 
						 | 
					50d1c3fd85 | ||
| 
						 | 
					cbecb3ac37 | ||
| 
						 | 
					5dbd3efce7 | ||
| 
						 | 
					ed712101ea | ||
| 
						 | 
					876811e2af | ||
| 
						 | 
					015eb65963 | ||
| 
						 | 
					b57c98df7b | ||
| 
						 | 
					c4da6dd38a | ||
| 
						 | 
					afafa3e15c | ||
| 
						 | 
					2edcb4ac71 | ||
| 
						 | 
					150f2d8d24 | ||
| 
						 | 
					0c4d9b2fbc | ||
| 
						 | 
					a6545f0566 | ||
| 
						 | 
					5012158adf | ||
| 
						 | 
					5fc041cca0 | ||
| 
						 | 
					5c9396e37c | ||
| 
						 | 
					089cd046af | ||
| 
						 | 
					7b63c0fa8c | ||
| 
						 | 
					7e8852c549 | ||
| 
						 | 
					063a8905bf | ||
| 
						 | 
					4064a85205 | ||
| 
						 | 
					3a9fef60a1 | ||
| 
						 | 
					cd7562091d | ||
| 
						 | 
					d1d0be3cd2 | ||
| 
						 | 
					be9419edf4 | ||
| 
						 | 
					2c8ad4f1af | ||
| 
						 | 
					a729d47d41 | ||
| 
						 | 
					121dea3f85 | ||
| 
						 | 
					6abf827f25 | ||
| 
						 | 
					ea4f109c99 | ||
| 
						 | 
					5af9fcaf35 | ||
| 
						 | 
					7650934f21 | ||
| 
						 | 
					5736d40dad | ||
| 
						 | 
					0dfd83b9f4 | ||
| 
						 | 
					40c5cae24a | ||
| 
						 | 
					8e10dea8ec | ||
| 
						 | 
					cce9396dc9 | ||
| 
						 | 
					a69e8ea1a1 | ||
| 
						 | 
					47f3eafb8d | ||
| 
						 | 
					1f656724f6 | ||
| 
						 | 
					53fc93dda6 | ||
| 
						 | 
					ca55c617e5 | ||
| 
						 | 
					17085b022c | ||
| 
						 | 
					9063e375e8 | ||
| 
						 | 
					4367eb8706 | ||
| 
						 | 
					97c9760f61 | ||
| 
						 | 
					0a8a99785b | ||
| 
						 | 
					df60710ea8 | ||
| 
						 | 
					a9d96b98cb | ||
| 
						 | 
					5d2edd2659 | ||
| 
						 | 
					ae689b6b27 | ||
| 
						 | 
					a558ae9496 | ||
| 
						 | 
					60d160da2d | ||
| 
						 | 
					d58a949aae | ||
| 
						 | 
					05086644c4 | ||
| 
						 | 
					00e608c89d | ||
| 
						 | 
					fb96d9d90d | ||
| 
						 | 
					b4dfd76a4c | ||
| 
						 | 
					e1a32c1807 | ||
| 
						 | 
					ea9a52d124 | ||
| 
						 | 
					5585f4eca4 | ||
| 
						 | 
					75cc5e05ad | ||
| 
						 | 
					e8b4d05f61 | ||
| 
						 | 
					84ae14d754 | ||
| 
						 | 
					0df748e7e2 | ||
| 
						 | 
					1fbcfbe693 | ||
| 
						 | 
					a9e897adc3 | ||
| 
						 | 
					34ab17b669 | ||
| 
						 | 
					fc0f3ad254 | ||
| 
						 | 
					a1fbe27123 | ||
| 
						 | 
					4942ef6f0e | ||
| 
						 | 
					1c45b1fef3 | ||
| 
						 | 
					9ae08a9c04 | ||
| 
						 | 
					e003386793 | ||
| 
						 | 
					76f8a1f51d | ||
| 
						 | 
					a533b89c9f | ||
| 
						 | 
					9d358821e5 | ||
| 
						 | 
					a2ffad81c8 | ||
| 
						 | 
					a6c6874a1a | ||
| 
						 | 
					a947f2d2b6 | ||
| 
						 | 
					081cdf3f63 | ||
| 
						 | 
					94e19e7111 | ||
| 
						 | 
					dbf5b18a99 | ||
| 
						 | 
					04677ce024 | ||
| 
						 | 
					0b3f7afaed | ||
| 
						 | 
					407adb5b17 | ||
| 
						 | 
					da0616cd13 | ||
| 
						 | 
					d6e8f6ae2b | ||
| 
						 | 
					af629a19d7 | ||
| 
						 | 
					1c02ca537a | ||
| 
						 | 
					9a3eaa1117 | ||
| 
						 | 
					3f2f3d4264 | ||
| 
						 | 
					c4c2c61e8c | ||
| 
						 | 
					7a68e6aad1 | ||
| 
						 | 
					5f3d6f70f6 | ||
| 
						 | 
					f27fa54388 | ||
| 
						 | 
					ece0bdf1fd | ||
| 
						 | 
					97e4b1883e | ||
| 
						 | 
					a2b38b3022 | ||
| 
						 | 
					48acb9e08a | ||
| 
						 | 
					d51092f42b | ||
| 
						 | 
					e5706ccbde | ||
| 
						 | 
					bdb6171334 | ||
| 
						 | 
					9a82ef5255 | ||
| 
						 | 
					4a1dcb2d03 | ||
| 
						 | 
					1d4547a43d | ||
| 
						 | 
					ef92312b41 | ||
| 
						 | 
					65ee74fbc7 | ||
| 
						 | 
					4673461789 | ||
| 
						 | 
					c21506ba02 | ||
| 
						 | 
					2f8275c52d | ||
| 
						 | 
					39ebb51bba | ||
| 
						 | 
					d7227da9a8 | ||
| 
						 | 
					00f1628eac | ||
| 
						 | 
					c69d103956 | ||
| 
						 | 
					ab805194a6 | ||
| 
						 | 
					4fac53a757 | ||
| 
						 | 
					d56f92ee78 | ||
| 
						 | 
					d5492d9b47 | ||
| 
						 | 
					11198b78a2 | ||
| 
						 | 
					451dc18f10 | ||
| 
						 | 
					573a568dd0 | ||
| 
						 | 
					127dca46a0 | ||
| 
						 | 
					ff3dd00370 | ||
| 
						 | 
					e888074bb4 | ||
| 
						 | 
					2028c2800a | ||
| 
						 | 
					1ef5026ef9 | ||
| 
						 | 
					fd8766b67e | ||
| 
						 | 
					40889b9cd3 | ||
| 
						 | 
					7d210e5194 | ||
| 
						 | 
					99889b46c9 | ||
| 
						 | 
					2e674fc611 | ||
| 
						 | 
					82869b3c8d | ||
| 
						 | 
					5cfd3419c6 | ||
| 
						 | 
					e8233e699b | ||
| 
						 | 
					9efd4fb891 | ||
| 
						 | 
					b2e85f9d93 | ||
| 
						 | 
					04cc76660a | ||
| 
						 | 
					e1f7ea25d2 | ||
| 
						 | 
					f10581829d | ||
| 
						 | 
					8586df1efb | ||
| 
						 | 
					78af3b274f | ||
| 
						 | 
					b8e0e12399 | ||
| 
						 | 
					254ef80db1 | ||
| 
						 | 
					f9de8446a0 | ||
| 
						 | 
					facd9a2024 | ||
| 
						 | 
					d15711efc6 | ||
| 
						 | 
					25ace3ed25 | ||
| 
						 | 
					461f00dd53 | ||
| 
						 | 
					012c86ab74 | ||
| 
						 | 
					458c29175e | ||
| 
						 | 
					8a5dbb0a2e | ||
| 
						 | 
					22f03eaedf | ||
| 
						 | 
					532203cdb0 | ||
| 
						 | 
					d467c74954 | ||
| 
						 | 
					870d3d5595 | ||
| 
						 | 
					c6c0e4cb32 | ||
| 
						 | 
					8f6f347848 | ||
| 
						 | 
					c4c745ccb8 | ||
| 
						 | 
					0f7b63c834 | ||
| 
						 | 
					3b66e34e74 | ||
| 
						 | 
					345731731a | ||
| 
						 | 
					2250f475fc | ||
| 
						 | 
					b2c04539a1 | ||
| 
						 | 
					d13363af60 | ||
| 
						 | 
					ed703912b2 | ||
| 
						 | 
					b6fc2386f0 | ||
| 
						 | 
					2cddcd1dbb | ||
| 
						 | 
					9f353dd662 | ||
| 
						 | 
					231360a3b7 | ||
| 
						 | 
					b49053cae2 | ||
| 
						 | 
					65ac3faff6 | ||
| 
						 | 
					778252741e | ||
| 
						 | 
					c8062c3a5e | ||
| 
						 | 
					05c08fc708 | ||
| 
						 | 
					96e40d97cc | ||
| 
						 | 
					0990a0851a | ||
| 
						 | 
					4b3743c85a | ||
| 
						 | 
					bb0db9c491 | ||
| 
						 | 
					5795665a7d | ||
| 
						 | 
					88f1be140c | ||
| 
						 | 
					966a753997 | ||
| 
						 | 
					fc16b228fd | ||
| 
						 | 
					0f829bd111 | ||
| 
						 | 
					a5b2ccaaad | ||
| 
						 | 
					5dd352c916 | ||
| 
						 | 
					a5200a1b8f | ||
| 
						 | 
					3c204aaf50 | ||
| 
						 | 
					6631a7e7f1 | ||
| 
						 | 
					010da5c015 | ||
| 
						 | 
					3ae184d31f | ||
| 
						 | 
					3e975124f3 | ||
| 
						 | 
					74c467f9f2 | ||
| 
						 | 
					1b97c938e9 | ||
| 
						 | 
					fbb56e5b1d | ||
| 
						 | 
					b3e2acac4e | ||
| 
						 | 
					78055aa6a5 | ||
| 
						 | 
					403fa0dc53 | ||
| 
						 | 
					e6bd5e8a6d | ||
| 
						 | 
					f918c330a9 | ||
| 
						 | 
					94f1b50c0f | ||
| 
						 | 
					7f52f77efe | ||
| 
						 | 
					bd54d55c1d | ||
| 
						 | 
					90b480f2af | ||
| 
						 | 
					09c70c3261 | ||
| 
						 | 
					578c33c010 | ||
| 
						 | 
					1ed0c6621b | ||
| 
						 | 
					d6a821b9d7 | ||
| 
						 | 
					5f8453587e | ||
| 
						 | 
					7d8b5c530f | ||
| 
						 | 
					d6e2d12c74 | ||
| 
						 | 
					2033da0b23 | ||
| 
						 | 
					305a1afcf7 | ||
| 
						 | 
					c4ac954c59 | ||
| 
						 | 
					9cdf87f194 | ||
| 
						 | 
					2640aec227 | ||
| 
						 | 
					a81e9d3dc4 | ||
| 
						 | 
					a1037ce3bc | ||
| 
						 | 
					6b7e0a9987 | ||
| 
						 | 
					249737e53d | ||
| 
						 | 
					8b57fb1208 | ||
| 
						 | 
					2962243d19 | ||
| 
						 | 
					c70573dee1 | ||
| 
						 | 
					6c98ed520d | ||
| 
						 | 
					dbdc5d14d3 | ||
| 
						 | 
					6cbe638294 | ||
| 
						 | 
					37ceea7333 | ||
| 
						 | 
					07c08ed42c | ||
| 
						 | 
					17b226a672 | ||
| 
						 | 
					374b227226 | ||
| 
						 | 
					8c4a5016ce | ||
| 
						 | 
					f33ca23e2f | ||
| 
						 | 
					6d79659dd7 | ||
| 
						 | 
					1056275825 | ||
| 
						 | 
					9634acedaf | ||
| 
						 | 
					c56fb0f1a3 | ||
| 
						 | 
					08241a5814 | ||
| 
						 | 
					3a4b0bed49 | ||
| 
						 | 
					84f4e33ea3 | ||
| 
						 | 
					3d27b1fa85 | ||
| 
						 | 
					b093ef7445 | ||
| 
						 | 
					6298bf9073 | ||
| 
						 | 
					9a26adf598 | ||
| 
						 | 
					405ac901c9 | ||
| 
						 | 
					721ccb6cf5 | ||
| 
						 | 
					64ad04eb2d | ||
| 
						 | 
					ba05727773 | ||
| 
						 | 
					349b293353 | ||
| 
						 | 
					fd91256316 | ||
| 
						 | 
					f9332da521 | ||
| 
						 | 
					a9a025d08c | ||
| 
						 | 
					156516ce44 | ||
| 
						 | 
					157e44a799 | ||
| 
						 | 
					b605e3ada3 | ||
| 
						 | 
					02cbedc387 | ||
| 
						 | 
					e5d814d040 | ||
| 
						 | 
					b09f4fb271 | ||
| 
						 | 
					1f4eada3b4 | ||
| 
						 | 
					b935754cb0 | ||
| 
						 | 
					7d2ff3f081 | ||
| 
						 | 
					396bc53593 | ||
| 
						 | 
					25a87e82d4 | ||
| 
						 | 
					e400753ed8 | ||
| 
						 | 
					0984fcf118 | ||
| 
						 | 
					18cc99ac17 | ||
| 
						 | 
					1522c23470 | ||
| 
						 | 
					2341e303da | ||
| 
						 | 
					dca142029c | ||
| 
						 | 
					7711de24f9 | ||
| 
						 | 
					7448f5e5ed | ||
| 
						 | 
					eee6c81af8 | ||
| 
						 | 
					b89670ef0e | ||
| 
						 | 
					45caf9c50c | ||
| 
						 | 
					0fccb00b5b | ||
| 
						 | 
					ace2ca484b | ||
| 
						 | 
					72da660ddb | ||
| 
						 | 
					7dc584ed91 | ||
| 
						 | 
					855f0b4f2f | ||
| 
						 | 
					46ffee4792 | ||
| 
						 | 
					c0a953650b | ||
| 
						 | 
					2bf30d6b47 | ||
| 
						 | 
					685e7d7225 | ||
| 
						 | 
					0424fe1a8f | ||
| 
						 | 
					544a2aea4b | ||
| 
						 | 
					38dbcb2248 | ||
| 
						 | 
					bb3a69f801 | ||
| 
						 | 
					60e5f36d27 | ||
| 
						 | 
					55db40d3e0 | ||
| 
						 | 
					f1fbf15116 | ||
| 
						 | 
					2469361c0f | ||
| 
						 | 
					9bdbdda261 | ||
| 
						 | 
					6fa865a325 | ||
| 
						 | 
					ad2057500a | ||
| 
						 | 
					e9ba69631b | ||
| 
						 | 
					d0e3726ca4 | ||
| 
						 | 
					75a46764e5 | ||
| 
						 | 
					d80a8d1919 | ||
| 
						 | 
					d0ff2a237b | ||
| 
						 | 
					6e5dd63c77 | ||
| 
						 | 
					4eceda658b | ||
| 
						 | 
					1c511bdb7c | ||
| 
						 | 
					dc014d43af | ||
| 
						 | 
					f9bd76e4f7 | ||
| 
						 | 
					2f9cf160e4 | ||
| 
						 | 
					336c35dc9e | ||
| 
						 | 
					e74e0dedcd | ||
| 
						 | 
					dcf6eb2a9e | ||
| 
						 | 
					72b5215645 | ||
| 
						 | 
					7d2980f09e | ||
| 
						 | 
					06bed64317 | ||
| 
						 | 
					f1fe6fa6e4 | ||
| 
						 | 
					c559759265 | ||
| 
						 | 
					ecb7a9c73a | ||
| 
						 | 
					b4000e8ad8 | ||
| 
						 | 
					21d5ed98d5 | ||
| 
						 | 
					aebe0396e9 | ||
| 
						 | 
					4e9a77cf26 | ||
| 
						 | 
					e9a182fa30 | ||
| 
						 | 
					14ef32631c | ||
| 
						 | 
					b6db386ffd | ||
| 
						 | 
					2c975b501d | ||
| 
						 | 
					500f07c8de | ||
| 
						 | 
					279fe3b1c5 | ||
| 
						 | 
					98a9092af1 | ||
| 
						 | 
					ae936dae90 | ||
| 
						 | 
					87108f5af9 | ||
| 
						 | 
					67166dc05c | ||
| 
						 | 
					aa9fed8cc2 | ||
| 
						 | 
					f257d984b7 | ||
| 
						 | 
					b889d6a8e8 | ||
| 
						 | 
					442eb8a4c3 | ||
| 
						 | 
					46805f696d | ||
| 
						 | 
					47234cd3d2 | ||
| 
						 | 
					29f6a99432 | ||
| 
						 | 
					2c8d0dccfc | ||
| 
						 | 
					a4f576a378 | ||
| 
						 | 
					1f13793b1a | ||
| 
						 | 
					3def5a010e | ||
| 
						 | 
					08130eb158 | ||
| 
						 | 
					294bd1e2f3 | ||
| 
						 | 
					253ef2187c | ||
| 
						 | 
					b27dfeacc9 | ||
| 
						 | 
					fb0f53b2e0 | ||
| 
						 | 
					c0455cbb18 | ||
| 
						 | 
					baa521bef5 | ||
| 
						 | 
					17e2c77a77 | ||
| 
						 | 
					7bcf65a125 | ||
| 
						 | 
					b52f3818f4 | ||
| 
						 | 
					306009bb6a | ||
| 
						 | 
					cc12975514 | ||
| 
						 | 
					9738f395c6 | ||
| 
						 | 
					d4294c8984 | ||
| 
						 | 
					dfc5336975 | ||
| 
						 | 
					8df61b5011 | ||
| 
						 | 
					f1e6643751 | ||
| 
						 | 
					4cea95a547 | ||
| 
						 | 
					6991bf196c | ||
| 
						 | 
					b23b3272dc | ||
| 
						 | 
					822a4c1bdb | ||
| 
						 | 
					1696aa1891 | ||
| 
						 | 
					52407725c9 | ||
| 
						 | 
					a5868b3fe2 | ||
| 
						 | 
					81da3c3319 | ||
| 
						 | 
					4edfacb983 | ||
| 
						 | 
					c6efe6f59e | ||
| 
						 | 
					7729bc2634 | ||
| 
						 | 
					69a305d434 | ||
| 
						 | 
					35c2b3a9ac | ||
| 
						 | 
					ab5b1cf86b | ||
| 
						 | 
					af9675e75a | ||
| 
						 | 
					c33387749b | ||
| 
						 | 
					c9ca65b469 | ||
| 
						 | 
					8b2f9cdfad | ||
| 
						 | 
					8e078f45e0 | ||
| 
						 | 
					01682a8b3c | ||
| 
						 | 
					8b07f23c30 | ||
| 
						 | 
					45932ad508 | ||
| 
						 | 
					ce94682ce1 | ||
| 
						 | 
					2d7ab7e9ea | ||
| 
						 | 
					f84ffd0130 | ||
| 
						 | 
					6176df94ed | ||
| 
						 | 
					a8f8788248 | ||
| 
						 | 
					300e3d7c73 | ||
| 
						 | 
					d5d007abe3 | ||
| 
						 | 
					365c6e4661 | ||
| 
						 | 
					151457ab16 | ||
| 
						 | 
					1dc03ef706 | ||
| 
						 | 
					dde3e83129 | ||
| 
						 | 
					8f182fdc69 | ||
| 
						 | 
					1064acafc4 | ||
| 
						 | 
					d4a67e3186 | ||
| 
						 | 
					ff8e412ceb | ||
| 
						 | 
					e9cbcb1d98 | ||
| 
						 | 
					18e10315e5 | ||
| 
						 | 
					ea7fc0311c | ||
| 
						 | 
					e9caaa4ad9 | ||
| 
						 | 
					30911232c1 | ||
| 
						 | 
					a6198b9ed1 | ||
| 
						 | 
					2940a1298e | ||
| 
						 | 
					a7be294ed7 | ||
| 
						 | 
					617f461c9d | ||
| 
						 | 
					f916052eab | ||
| 
						 | 
					2fb3f002d0 | ||
| 
						 | 
					1dcb6c994f | ||
| 
						 | 
					a9ab63c01c | ||
| 
						 | 
					82b0bf0b87 | ||
| 
						 | 
					f89db4020f | ||
| 
						 | 
					393c09659e | ||
| 
						 | 
					3a7cef3e76 | ||
| 
						 | 
					592c0e0273 | ||
| 
						 | 
					08b977b5a5 | ||
| 
						 | 
					2d96549cd0 | ||
| 
						 | 
					b48892d403 | ||
| 
						 | 
					85fb12d554 | ||
| 
						 | 
					b975183c41 | ||
| 
						 | 
					7b907f0bb5 | ||
| 
						 | 
					083100e2ab | ||
| 
						 | 
					9dfcad117c | ||
| 
						 | 
					241d2ba1da | ||
| 
						 | 
					e4fb49775b | ||
| 
						 | 
					7018feed88 | ||
| 
						 | 
					381a146dc6 | ||
| 
						 | 
					9be529f12d | ||
| 
						 | 
					b4a262832a | ||
| 
						 | 
					f5e5277908 | ||
| 
						 | 
					c991c6e710 | ||
| 
						 | 
					6d498d478e | ||
| 
						 | 
					e1f4319279 | ||
| 
						 | 
					d0561b5c2d | ||
| 
						 | 
					4f4b192402 | ||
| 
						 | 
					2826fcc851 | ||
| 
						 | 
					0ae1661ba2 | ||
| 
						 | 
					4e9ef338fc | ||
| 
						 | 
					d16e1131b4 | ||
| 
						 | 
					37562f753a | ||
| 
						 | 
					a18894d159 | ||
| 
						 | 
					248252682c | ||
| 
						 | 
					dfee50ecd9 | ||
| 
						 | 
					cc3586028e | ||
| 
						 | 
					10189984f9 | ||
| 
						 | 
					f60df86c89 | ||
| 
						 | 
					d8425465a3 | ||
| 
						 | 
					bc7a3a9e99 | ||
| 
						 | 
					1fc02dcf6a | ||
| 
						 | 
					d3cbf7d86a | ||
| 
						 | 
					313bf45e42 | ||
| 
						 | 
					83d092f785 | ||
| 
						 | 
					ce34d0ac09 | ||
| 
						 | 
					4825092bbe | ||
| 
						 | 
					4e9dd6b0f5 | ||
| 
						 | 
					bbd79bdf03 | ||
| 
						 | 
					b6ccbffe2b | ||
| 
						 | 
					a096e9b719 | ||
| 
						 | 
					ddab25a90d | ||
| 
						 | 
					1aecc34e9e | ||
| 
						 | 
					ffbe98b763 | ||
| 
						 | 
					75b9c0044c | ||
| 
						 | 
					d7a9bb0a2a | ||
| 
						 | 
					0d81c69b8e | ||
| 
						 | 
					600b77a93f | ||
| 
						 | 
					401cd0af0f | ||
| 
						 | 
					39335c356b | ||
| 
						 | 
					c7b41e67f0 | ||
| 
						 | 
					a3c62bb737 | ||
| 
						 | 
					003144a8e8 | ||
| 
						 | 
					af1cb47e65 | ||
| 
						 | 
					e8e7fbdb16 | ||
| 
						 | 
					2f6263a696 | ||
| 
						 | 
					d5c21afd4b | ||
| 
						 | 
					35748f40d6 | ||
| 
						 | 
					1afa967909 | ||
| 
						 | 
					ed62478192 | ||
| 
						 | 
					9e7733a743 | ||
| 
						 | 
					85b7b80434 | ||
| 
						 | 
					fe0f662310 | ||
| 
						 | 
					fc0bdd1aa8 | ||
| 
						 | 
					90453438ff | ||
| 
						 | 
					e9dad4048f | ||
| 
						 | 
					2e63f3b733 | ||
| 
						 | 
					125cc35b59 | ||
| 
						 | 
					ddba94214f | ||
| 
						 | 
					e9f970891d | ||
| 
						 | 
					a89cf50c59 | ||
| 
						 | 
					7e58aa7d71 | ||
| 
						 | 
					f90c544039 | ||
| 
						 | 
					be3d90de02 | ||
| 
						 | 
					82652aaf17 | ||
| 
						 | 
					afcf54a5c9 | ||
| 
						 | 
					17d6bb8158 | ||
| 
						 | 
					3671e38af4 | ||
| 
						 | 
					11c26ecf81 | ||
| 
						 | 
					99d5b23023 | ||
| 
						 | 
					611ba3f4a1 | ||
| 
						 | 
					4fc3946111 | ||
| 
						 | 
					af28dd6c75 | ||
| 
						 | 
					e79ec456be | ||
| 
						 | 
					3e268d2717 | ||
| 
						 | 
					59a941e4a4 | ||
| 
						 | 
					a7cd5f3f38 | ||
| 
						 | 
					c46acbacde | ||
| 
						 | 
					304d90425f | ||
| 
						 | 
					0bdbc5a86e | ||
| 
						 | 
					bfaa8a89e1 | ||
| 
						 | 
					abecef77cf | ||
| 
						 | 
					de941e289e | ||
| 
						 | 
					b74dfe6e8e | ||
| 
						 | 
					1d28453529 | ||
| 
						 | 
					d80f6e0f8c | ||
| 
						 | 
					690ecff795 | ||
| 
						 | 
					234c73767d | ||
| 
						 | 
					13962f0b15 | ||
| 
						 | 
					2fc1f3dd48 | ||
| 
						 | 
					497810cae7 | ||
| 
						 | 
					f2cbb15468 | ||
| 
						 | 
					e38e8b29f8 | ||
| 
						 | 
					cbc9d9713d | ||
| 
						 | 
					c03ceadfbd | ||
| 
						 | 
					98fa4fe8c5 | ||
| 
						 | 
					e50baf58ab | ||
| 
						 | 
					0b4c91c0fc | ||
| 
						 | 
					b9b43196e1 | ||
| 
						 | 
					1750ec5c52 | ||
| 
						 | 
					bf6a9e66d6 | ||
| 
						 | 
					c77bd28775 | ||
| 
						 | 
					0c372b94f7 | ||
| 
						 | 
					1619add90c | ||
| 
						 | 
					a1a4e8b6bb | ||
| 
						 | 
					26e1237380 | ||
| 
						 | 
					25f350a058 | ||
| 
						 | 
					4882171df5 | ||
| 
						 | 
					121cb9ee38 | ||
| 
						 | 
					931627e6a0 | ||
| 
						 | 
					bc173b9fb0 | ||
| 
						 | 
					274a2c9970 | ||
| 
						 | 
					006fcc22a8 | ||
| 
						 | 
					4fd9c70f06 | ||
| 
						 | 
					709c51c424 | ||
| 
						 | 
					9bc448546e | ||
| 
						 | 
					91aeab0de3 | ||
| 
						 | 
					0dc092334b | ||
| 
						 | 
					c913cf446f | ||
| 
						 | 
					36c194638e | ||
| 
						 | 
					45fb737950 | ||
| 
						 | 
					a01273bae3 | ||
| 
						 | 
					a88f39457b | ||
| 
						 | 
					2bbaab4a24 | ||
| 
						 | 
					2c17323e15 | ||
| 
						 | 
					870694b3da | ||
| 
						 | 
					1a8f4b57a9 | ||
| 
						 | 
					87a4b4d1f4 | ||
| 
						 | 
					022b31a8c8 | ||
| 
						 | 
					8ecf5104b3 | ||
| 
						 | 
					2b3aeffbbd | ||
| 
						 | 
					dd6b494eb3 | ||
| 
						 | 
					2c2f9e2cc3 | ||
| 
						 | 
					2d9b1b3ffa | ||
| 
						 | 
					f070480275 | ||
| 
						 | 
					49f1597de2 | ||
| 
						 | 
					c9bea5bad3 | ||
| 
						 | 
					b44e425f39 | ||
| 
						 | 
					296324ea03 | ||
| 
						 | 
					93683c3cf8 | ||
| 
						 | 
					fa41e86a28 | ||
| 
						 | 
					9e77b7075a | ||
| 
						 | 
					a08ee55e2d | ||
| 
						 | 
					5c7f9a627f | ||
| 
						 | 
					3bac6d9479 | ||
| 
						 | 
					bc3e3472c1 | ||
| 
						 | 
					5c5143de48 | ||
| 
						 | 
					c8cd7d9e0f | ||
| 
						 | 
					66bd86e2c2 | ||
| 
						 | 
					e0a6cdcf30 | ||
| 
						 | 
					487fe20490 | ||
| 
						 | 
					a0ecb9b8fc | ||
| 
						 | 
					80d9b1ccd7 | ||
| 
						 | 
					4bf4bc784f | ||
| 
						 | 
					69c48301e0 | ||
| 
						 | 
					2be9b88135 | ||
| 
						 | 
					9437fef8cc | ||
| 
						 | 
					16b0384bd2 | ||
| 
						 | 
					98fa4fce09 | ||
| 
						 | 
					1ec1d17e16 | ||
| 
						 | 
					87ebdd8a71 | ||
| 
						 | 
					1e11df0dc3 | ||
| 
						 | 
					7d68189d8a | ||
| 
						 | 
					421d474332 | ||
| 
						 | 
					26414ee013 | ||
| 
						 | 
					58060fa11b | ||
| 
						 | 
					5c62f68e14 | ||
| 
						 | 
					cea698f19c | ||
| 
						 | 
					0d22b5dace | ||
| 
						 | 
					48781ef7f7 | ||
| 
						 | 
					023ec151df | ||
| 
						 | 
					59dbdb51dc | ||
| 
						 | 
					92d1bc09cb | ||
| 
						 | 
					6d1a837df7 | ||
| 
						 | 
					21f422ca5e | ||
| 
						 | 
					d62bfb39cd | ||
| 
						 | 
					291ae60b52 | ||
| 
						 | 
					ce4b274aa1 | ||
| 
						 | 
					3b79d2789d | ||
| 
						 | 
					334f1842fc | ||
| 
						 | 
					b12540520d | ||
| 
						 | 
					bb9dcc99cf | ||
| 
						 | 
					0d7b9b8b7e | ||
| 
						 | 
					3d59821134 | ||
| 
						 | 
					31188ee1a8 | ||
| 
						 | 
					cae111287b | ||
| 
						 | 
					e36e473859 | ||
| 
						 | 
					4a3e6bce79 | ||
| 
						 | 
					a3829cb720 | ||
| 
						 | 
					d7fb66aa82 | ||
| 
						 | 
					344b3b5ce1 | ||
| 
						 | 
					3f7cf29124 | ||
| 
						 | 
					63dc69fef6 | ||
| 
						 | 
					e84be9b495 | ||
| 
						 | 
					cfe1c195c4 | ||
| 
						 | 
					3a3ca3f515 | ||
| 
						 | 
					032c49b8b3 | ||
| 
						 | 
					3208ff58ca | ||
| 
						 | 
					6707d22a40 | ||
| 
						 | 
					3647bee263 | ||
| 
						 | 
					0cd8572b2d | ||
| 
						 | 
					7c2831ac90 | ||
| 
						 | 
					e2aebccba1 | ||
| 
						 | 
					de603b75fc | ||
| 
						 | 
					3e563bcea7 | ||
| 
						 | 
					1244be2eda | ||
| 
						 | 
					92f91ff48b | ||
| 
						 | 
					9f0a373b51 | ||
| 
						 | 
					b3dfaaa143 | ||
| 
						 | 
					b0701709c1 | ||
| 
						 | 
					5b7848a345 | ||
| 
						 | 
					34aa216a65 | ||
| 
						 | 
					915c6a21ba | ||
| 
						 | 
					a76a29f233 | ||
| 
						 | 
					4e06ab75e8 | ||
| 
						 | 
					58706d595b | ||
| 
						 | 
					236be53269 | ||
| 
						 | 
					1fc1bd382b | ||
| 
						 | 
					26147fb954 | ||
| 
						 | 
					a60033f106 | ||
| 
						 | 
					3613e6fc57 | ||
| 
						 | 
					f8e21776f9 | ||
| 
						 | 
					006723cf76 | ||
| 
						 | 
					bd53a054b1 | ||
| 
						 | 
					aa89bcd279 | ||
| 
						 | 
					f19759a182 | ||
| 
						 | 
					d009bcbfb6 | ||
| 
						 | 
					211b8685d3 | ||
| 
						 | 
					4b71f63ac0 | ||
| 
						 | 
					3adb8c3854 | ||
| 
						 | 
					02e666d59f | ||
| 
						 | 
					5b2d6ff07e | ||
| 
						 | 
					877b2fbd3c | ||
| 
						 | 
					afeab58a3c | ||
| 
						 | 
					744c49a81b | ||
| 
						 | 
					9c75b2d931 | ||
| 
						 | 
					54d11e6057 | ||
| 
						 | 
					9c5b91fd0b | ||
| 
						 | 
					290d3eab76 | ||
| 
						 | 
					46dae77c23 | ||
| 
						 | 
					3d7ba69a05 | ||
| 
						 | 
					a6cd870784 | ||
| 
						 | 
					58133d22a8 | ||
| 
						 | 
					330e5c5460 | ||
| 
						 | 
					97879bcd57 | ||
| 
						 | 
					ab519c8262 | ||
| 
						 | 
					ab1dee1efc | ||
| 
						 | 
					e072aa535d | ||
| 
						 | 
					48f9859d2a | ||
| 
						 | 
					48b5083ca0 | ||
| 
						 | 
					cd64618674 | ||
| 
						 | 
					65f29a78b2 | ||
| 
						 | 
					5d7e960adf | ||
| 
						 | 
					c363b5a62f | ||
| 
						 | 
					60ed0f94ed | ||
| 
						 | 
					f38f8d94a9 | ||
| 
						 | 
					679eb352e0 | ||
| 
						 | 
					f0d6ee6be8 | ||
| 
						 | 
					80bbb6578e | ||
| 
						 | 
					19cc0f0ab4 | ||
| 
						 | 
					14e14ea68c | ||
| 
						 | 
					834d37ed86 | ||
| 
						 | 
					adcc235ef6 | ||
| 
						 | 
					86a0d0234d | ||
| 
						 | 
					4598be561a | ||
| 
						 | 
					af5db47e99 | ||
| 
						 | 
					fb67f40f04 | ||
| 
						 | 
					e65991f977 | ||
| 
						 | 
					3e83e686ba | ||
| 
						 | 
					48033c3242 | ||
| 
						 | 
					8f06b00373 | ||
| 
						 | 
					1dea1f4509 | ||
| 
						 | 
					44411db8e0 | ||
| 
						 | 
					23ac7a1407 | ||
| 
						 | 
					dda640835f | ||
| 
						 | 
					aa1f5b3581 | ||
| 
						 | 
					6cc3700314 | ||
| 
						 | 
					d9d3a69595 | ||
| 
						 | 
					cc1489d2f2 | ||
| 
						 | 
					016029c69f | ||
| 
						 | 
					516b848286 | ||
| 
						 | 
					f9adfa6d4e | ||
| 
						 | 
					85b1fce1ef | ||
| 
						 | 
					c4202285ef | ||
| 
						 | 
					da566db150 | ||
| 
						 | 
					be37dc73f6 | ||
| 
						 | 
					49e045482a | ||
| 
						 | 
					d8309efc72 | ||
| 
						 | 
					f43acc8a50 | ||
| 
						 | 
					976b2c9c2f | ||
| 
						 | 
					b74d2cda28 | ||
| 
						 | 
					ba47f5c9b0 | ||
| 
						 | 
					cc5dd9f14e | ||
| 
						 | 
					4d94ae00d5 | ||
| 
						 | 
					60d8bae30d | ||
| 
						 | 
					0caec9e8f8 | ||
| 
						 | 
					4f85a2e21e | ||
| 
						 | 
					945e15a253 | ||
| 
						 | 
					fbfcdc4cef | ||
| 
						 | 
					1fe198b6f9 | ||
| 
						 | 
					78d6603aad | ||
| 
						 | 
					7241ae1a0a | ||
| 
						 | 
					5f58d6a5e0 | ||
| 
						 | 
					acfe628b6e | ||
| 
						 | 
					182d8435f0 | ||
| 
						 | 
					4de920c91d | ||
| 
						 | 
					3cd039dd8f | ||
| 
						 | 
					81269a81ee | ||
| 
						 | 
					3537525e00 | ||
| 
						 | 
					d38f3ad1ee | ||
| 
						 | 
					e083f91497 | ||
| 
						 | 
					ba2cad19cf | ||
| 
						 | 
					db0a1efcc9 | ||
| 
						 | 
					9074521458 | ||
| 
						 | 
					f924200e1b | ||
| 
						 | 
					de2f6e4dae | ||
| 
						 | 
					44bdb056d4 | ||
| 
						 | 
					c31bbf1e68 | ||
| 
						 | 
					5e68f8ce15 | ||
| 
						 | 
					b9a3ef4c6e | ||
| 
						 | 
					1955b87423 | ||
| 
						 | 
					866eedb936 | ||
| 
						 | 
					f701551f36 | ||
| 
						 | 
					adc4df3616 | ||
| 
						 | 
					1199e2d8cf | ||
| 
						 | 
					0f180d1d1d | ||
| 
						 | 
					072569e0f1 | ||
| 
						 | 
					ba9786e4b8 | ||
| 
						 | 
					613599ffff | ||
| 
						 | 
					c9c21d3b89 | ||
| 
						 | 
					d0d046eca2 | ||
| 
						 | 
					2a81428489 | ||
| 
						 | 
					7073e9e2a0 | ||
| 
						 | 
					d866df33a1 | ||
| 
						 | 
					b77fcddb6b | ||
| 
						 | 
					f6fbd470e3 | ||
| 
						 | 
					63810d8566 | ||
| 
						 | 
					123c401967 | ||
| 
						 | 
					a3fffd648b | ||
| 
						 | 
					2d57b73a50 | ||
| 
						 | 
					f14845d999 | ||
| 
						 | 
					80bb905d3d | ||
| 
						 | 
					a297985f42 | ||
| 
						 | 
					404dcc5e8e | ||
| 
						 | 
					8242a6a9fc | ||
| 
						 | 
					17bcb8d465 | ||
| 
						 | 
					72165799a8 | ||
| 
						 | 
					f1c2a9de45 | ||
| 
						 | 
					52b66a622d | ||
| 
						 | 
					273db408a8 | ||
| 
						 | 
					957b6db3b1 | ||
| 
						 | 
					a14e2d9dfe | ||
| 
						 | 
					a8b94d6409 | ||
| 
						 | 
					fe19c448f0 | ||
| 
						 | 
					fcf6473199 | ||
| 
						 | 
					1285221370 | ||
| 
						 | 
					5dcf517d84 | ||
| 
						 | 
					9b2f486c9e | ||
| 
						 | 
					24995f3a10 | ||
| 
						 | 
					0fc5cf0870 | ||
| 
						 | 
					f78d4a35f8 | ||
| 
						 | 
					df5eaa8a52 | ||
| 
						 | 
					6ce46d69f5 | ||
| 
						 | 
					575e664a7c | ||
| 
						 | 
					7389c848d4 | ||
| 
						 | 
					4d393410f3 | ||
| 
						 | 
					bd69750360 | ||
| 
						 | 
					c9501c223f | ||
| 
						 | 
					9dd5ae6553 | ||
| 
						 | 
					e1e876072d | ||
| 
						 | 
					dd2589494f | ||
| 
						 | 
					1cfa8a397f | ||
| 
						 | 
					bdae099862 | ||
| 
						 | 
					cca28b291c | ||
| 
						 | 
					062d3e39e7 | ||
| 
						 | 
					e29f478a7a | ||
| 
						 | 
					1b58b616e3 | ||
| 
						 | 
					c70d381775 | ||
| 
						 | 
					508d8b1617 | ||
| 
						 | 
					8c74b5e56c | ||
| 
						 | 
					c59ba5b528 | ||
| 
						 | 
					45d87a1ffe | ||
| 
						 | 
					a3feb21bbe | ||
| 
						 | 
					37530362fa | ||
| 
						 | 
					fd69886aed | ||
| 
						 | 
					fd795679bb | ||
| 
						 | 
					e523f5f389 | ||
| 
						 | 
					e4dd79bbc8 | ||
| 
						 | 
					bc37d996fc | ||
| 
						 | 
					31cafe53c9 | ||
| 
						 | 
					dc4ddcd2bb | ||
| 
						 | 
					5256b021f3 | ||
| 
						 | 
					1bb68d62ab | ||
| 
						 | 
					4ab1e7ceaf | ||
| 
						 | 
					06623ff028 | ||
| 
						 | 
					67d48c8cc8 | ||
| 
						 | 
					d59fb0dd2f | ||
| 
						 | 
					245f44e2ab | ||
| 
						 | 
					e5d6528a12 | ||
| 
						 | 
					980afccf98 | ||
| 
						 | 
					9bd2cd745f | ||
| 
						 | 
					015fbde807 | ||
| 
						 | 
					ba1b888384 | ||
| 
						 | 
					6f9079fd50 | ||
| 
						 | 
					c938563a81 | ||
| 
						 | 
					40928698bb | ||
| 
						 | 
					138d8ab0c7 | ||
| 
						 | 
					47cc5525a2 | ||
| 
						 | 
					67fec850e1 | ||
| 
						 | 
					82db6e1646 | ||
| 
						 | 
					e7227322b3 | ||
| 
						 | 
					a5595fde9a | ||
| 
						 | 
					95f8c7195c | ||
| 
						 | 
					dcbbf83dba | ||
| 
						 | 
					3c89d78dba | ||
| 
						 | 
					84fcd6f83e | ||
| 
						 | 
					a92ae07091 | ||
| 
						 | 
					68809d3969 | ||
| 
						 | 
					d6a89fcf88 | ||
| 
						 | 
					ef5f6a08ff | ||
| 
						 | 
					7c517a04b1 | ||
| 
						 | 
					d78e52987e | ||
| 
						 | 
					755cc53a6e | ||
| 
						 | 
					1226c472b7 | ||
| 
						 | 
					4d7072f4b5 | ||
| 
						 | 
					b5348a095d | ||
| 
						 | 
					66df02fd98 | ||
| 
						 | 
					206eb6a11d | ||
| 
						 | 
					f11fd3f4e1 | ||
| 
						 | 
					29b108f939 | ||
| 
						 | 
					31106cc750 | ||
| 
						 | 
					ff3fa48fc7 | ||
| 
						 | 
					87166e1fb6 | ||
| 
						 | 
					f3e24baddf | ||
| 
						 | 
					a6977ee73d | ||
| 
						 | 
					d4704d5245 | ||
| 
						 | 
					8f0edcb3d2 | ||
| 
						 | 
					35e25255e0 | ||
| 
						 | 
					c3fbf5d9a8 | ||
| 
						 | 
					55e42c93a8 | ||
| 
						 | 
					6a0dec9584 | ||
| 
						 | 
					21a85f1977 | ||
| 
						 | 
					322de0c8c1 | ||
| 
						 | 
					6a9af68b56 | ||
| 
						 | 
					b6e4dac217 | ||
| 
						 | 
					8a0a9392ab | ||
| 
						 | 
					bcbe4e5254 | ||
| 
						 | 
					47ff5c6279 | ||
| 
						 | 
					898f856c44 | ||
| 
						 | 
					883b0c2274 | ||
| 
						 | 
					4f94d1a8b1 | ||
| 
						 | 
					1d4581c2dd | ||
| 
						 | 
					c05940edc7 | ||
| 
						 | 
					c507a16e49 | ||
| 
						 | 
					308f028e28 | ||
| 
						 | 
					e4a6cf421a | ||
| 
						 | 
					329636d6e3 | ||
| 
						 | 
					9163b8fb23 | ||
| 
						 | 
					a542db90c6 | ||
| 
						 | 
					a7ce69dbd7 | ||
| 
						 | 
					9d93ce246c | ||
| 
						 | 
					76c4336c43 | ||
| 
						 | 
					e71adb85c5 | ||
| 
						 | 
					033c51f0a3 | ||
| 
						 | 
					452d1595a6 | ||
| 
						 | 
					0d197a833c | ||
| 
						 | 
					e0031b80ee | ||
| 
						 | 
					b19941ab05 | ||
| 
						 | 
					752938daab | ||
| 
						 | 
					c78515f55e | ||
| 
						 | 
					3ba1f11147 | ||
| 
						 | 
					bbc206fdf7 | ||
| 
						 | 
					2bd065dfbe | ||
| 
						 | 
					6d7dbc12f2 | ||
| 
						 | 
					83c40e7fc0 | ||
| 
						 | 
					b5fe234588 | ||
| 
						 | 
					e1a00d7d1d | ||
| 
						 | 
					acf60ef707 | ||
| 
						 | 
					c85a157854 | ||
| 
						 | 
					0c5d16e4f5 | ||
| 
						 | 
					bd2af5e707 | ||
| 
						 | 
					58d55afa6f | ||
| 
						 | 
					6343e2fac3 | ||
| 
						 | 
					b476df64a1 | ||
| 
						 | 
					1d46b6b3b9 | ||
| 
						 | 
					bbb35447c4 | ||
| 
						 | 
					6276f1e100 | ||
| 
						 | 
					5b8a57ecae | ||
| 
						 | 
					817dfc18a3 | ||
| 
						 | 
					0b0b2a8087 | ||
| 
						 | 
					c23d16ac19 | ||
| 
						 | 
					1b28ed575b | ||
| 
						 | 
					135c0af1bb | ||
| 
						 | 
					475918410b | ||
| 
						 | 
					3102792161 | ||
| 
						 | 
					a291182757 | ||
| 
						 | 
					b26ca3408c | ||
| 
						 | 
					83978bd37a | ||
| 
						 | 
					a3790c0d01 | ||
| 
						 | 
					63b6090f7c | ||
| 
						 | 
					c5571db0c2 | ||
| 
						 | 
					e0457d5f7c | ||
| 
						 | 
					ae52ec9869 | ||
| 
						 | 
					0b33bc6b72 | ||
| 
						 | 
					7aa983c6db | ||
| 
						 | 
					2b90b1f344 | ||
| 
						 | 
					65123f8064 | ||
| 
						 | 
					1d8634b110 | ||
| 
						 | 
					29e0c30c2a | ||
| 
						 | 
					cf82191d77 | ||
| 
						 | 
					3a8a0a3945 | ||
| 
						 | 
					c5d4ab7e35 | ||
| 
						 | 
					b955dbd325 | ||
| 
						 | 
					45582d1e2b | ||
| 
						 | 
					60c50cbf9c | ||
| 
						 | 
					3a3619b46a | ||
| 
						 | 
					b83eddc578 | ||
| 
						 | 
					7f558334ad | ||
| 
						 | 
					6229a5607c | ||
| 
						 | 
					6acc3b9689 | ||
| 
						 | 
					66aa856698 | ||
| 
						 | 
					f559f31bef | ||
| 
						 | 
					3210b4fd14 | ||
| 
						 | 
					a7b42009c4 | ||
| 
						 | 
					7b5ffd6834 | ||
| 
						 | 
					9b55da73ca | ||
| 
						 | 
					e7156ff2e8 | ||
| 
						 | 
					437db75b94 | ||
| 
						 | 
					1586365835 | ||
| 
						 | 
					7d5b04db4e | ||
| 
						 | 
					48b0cf8b10 | ||
| 
						 | 
					b693f941fd | ||
| 
						 | 
					c602e7f4e8 | ||
| 
						 | 
					1fc6d41bf6 | ||
| 
						 | 
					a41477f92e | ||
| 
						 | 
					5f68c5feef | ||
| 
						 | 
					ee84a5a7fb | ||
| 
						 | 
					66d3e7481e | ||
| 
						 | 
					0e21156333 | ||
| 
						 | 
					f533b7780e | ||
| 
						 | 
					cc2f5a8022 | ||
| 
						 | 
					b441bf9226 | ||
| 
						 | 
					2a9aca32dc | ||
| 
						 | 
					89da653fa6 | ||
| 
						 | 
					af50b58c3f | ||
| 
						 | 
					4d635a7001 | ||
| 
						 | 
					ce15d5a9dc | ||
| 
						 | 
					ba1c602281 | ||
| 
						 | 
					cfc781be6e | ||
| 
						 | 
					84acc3c2bc | ||
| 
						 | 
					c2e4f17c1a | ||
| 
						 | 
					979689aa5c | ||
| 
						 | 
					a3faebd104 | ||
| 
						 | 
					025c7737b2 | ||
| 
						 | 
					513d4b4c16 | ||
| 
						 | 
					7ef701519b | ||
| 
						 | 
					50d194af4d | ||
| 
						 | 
					287973746e | ||
| 
						 | 
					f1558bb424 | ||
| 
						 | 
					6ca487992b | ||
| 
						 | 
					cf3a5cebd7 | ||
| 
						 | 
					a661b65357 | ||
| 
						 | 
					98e6654938 | ||
| 
						 | 
					cecd263878 | ||
| 
						 | 
					31fe950d2b | ||
| 
						 | 
					db6a87d8cc | ||
| 
						 | 
					7beb408771 | ||
| 
						 | 
					51008ffce1 | ||
| 
						 | 
					3811eed8d5 | ||
| 
						 | 
					581f1c8494 | ||
| 
						 | 
					41ebed27fa | ||
| 
						 | 
					bf21446a2a | ||
| 
						 | 
					e72d734d5f | ||
| 
						 | 
					20d2186c87 | ||
| 
						 | 
					9ba3ec9176 | ||
| 
						 | 
					8f71fb8d98 | ||
| 
						 | 
					48948d53b6 | ||
| 
						 | 
					dbec19622e | ||
| 
						 | 
					2ce15df528 | ||
| 
						 | 
					681bfae499 | ||
| 
						 | 
					5dd955dcd2 | ||
| 
						 | 
					56fa8e69cf | ||
| 
						 | 
					67d0738aba | ||
| 
						 | 
					b8a61e7362 | ||
| 
						 | 
					dd5e774664 | ||
| 
						 | 
					6b86bad5ef | ||
| 
						 | 
					712557128b | ||
| 
						 | 
					3009e9f9ef | ||
| 
						 | 
					b30245dae0 | ||
| 
						 | 
					116daf4c2f | ||
| 
						 | 
					cb40bdaf57 | ||
| 
						 | 
					4b12506891 | ||
| 
						 | 
					cf98440178 | ||
| 
						 | 
					c500d44735 | ||
| 
						 | 
					18eda73234 | ||
| 
						 | 
					7526e2c043 | ||
| 
						 | 
					6d52f260bf | ||
| 
						 | 
					752f2b6785 | ||
| 
						 | 
					e1c279b63d | ||
| 
						 | 
					467889703a | ||
| 
						 | 
					3a457cca86 | ||
| 
						 | 
					285046ec51 | ||
| 
						 | 
					f8000b9345 | ||
| 
						 | 
					77a8eb352f | ||
| 
						 | 
					114697bef3 | ||
| 
						 | 
					2aa9043ad3 | ||
| 
						 | 
					1a095560f7 | ||
| 
						 | 
					f329b8d73b | ||
| 
						 | 
					3d90a32429 | ||
| 
						 | 
					e3a7463c5d | ||
| 
						 | 
					796c6eadcb | ||
| 
						 | 
					b485e5b7e3 | ||
| 
						 | 
					d1cc7b8f22 | ||
| 
						 | 
					1cf9d58cb4 | ||
| 
						 | 
					0cff933416 | ||
| 
						 | 
					c41b29e5db | ||
| 
						 | 
					65fb3fa630 | ||
| 
						 | 
					0b0f08dbc7 | ||
| 
						 | 
					5c32657c80 | ||
| 
						 | 
					07cee70258 | ||
| 
						 | 
					4ba163cbf9 | ||
| 
						 | 
					2bfb2398e3 | ||
| 
						 | 
					a4a8f7b3ef | ||
| 
						 | 
					34c66925aa | ||
| 
						 | 
					cb7fd76f57 | ||
| 
						 | 
					de822715b2 | ||
| 
						 | 
					89f534e1d3 | ||
| 
						 | 
					d46c1a8126 | ||
| 
						 | 
					e32587d5a6 | ||
| 
						 | 
					7876e4488f | ||
| 
						 | 
					1a19f83d4c | ||
| 
						 | 
					db8c838c6a | ||
| 
						 | 
					37da54b10e | ||
| 
						 | 
					0fea7ed4a4 | ||
| 
						 | 
					dbeac560aa | ||
| 
						 | 
					89eeccacde | ||
| 
						 | 
					c9fc143972 | ||
| 
						 | 
					004aa803a9 | ||
| 
						 | 
					c921a5e1d4 | ||
| 
						 | 
					0b4b9a11f5 | ||
| 
						 | 
					d7e0299792 | ||
| 
						 | 
					9dfdf0ad1d | ||
| 
						 | 
					3b04cdd706 | ||
| 
						 | 
					11a57c7be5 | ||
| 
						 | 
					b370230b78 | ||
| 
						 | 
					50a381b789 | ||
| 
						 | 
					534aaf3731 | ||
| 
						 | 
					6dc5d570d0 | ||
| 
						 | 
					cb78486d97 | ||
| 
						 | 
					9c9aa4f145 | ||
| 
						 | 
					b6d1e52d45 | ||
| 
						 | 
					f185e725a0 | ||
| 
						 | 
					591ccf586d | ||
| 
						 | 
					b7061c61b0 | ||
| 
						 | 
					8a428200a6 | ||
| 
						 | 
					10b2328fea | ||
| 
						 | 
					98c2a26ea6 | ||
| 
						 | 
					965b6dad44 | ||
| 
						 | 
					a3d8c0fc5d | ||
| 
						 | 
					a32d795aae | ||
| 
						 | 
					ef3dc028ef | ||
| 
						 | 
					2413a3975f | ||
| 
						 | 
					3b0b5abae3 | ||
| 
						 | 
					b49124f6d9 | ||
| 
						 | 
					2260ad21fb | ||
| 
						 | 
					6b0e9facf4 | ||
| 
						 | 
					c404ff7955 | ||
| 
						 | 
					8e2f6b79ea | ||
| 
						 | 
					ee60d9fb28 | ||
| 
						 | 
					be6d77005f | ||
| 
						 | 
					b263b66746 | ||
| 
						 | 
					5294dd705d | ||
| 
						 | 
					2b67158673 | ||
| 
						 | 
					db744f8950 | ||
| 
						 | 
					e059b19ddb | ||
| 
						 | 
					997a54c981 | ||
| 
						 | 
					b78e502104 | ||
| 
						 | 
					b6d0054a52 | ||
| 
						 | 
					117df10db4 | ||
| 
						 | 
					d300bcca7f | ||
| 
						 | 
					d59c3e5046 | ||
| 
						 | 
					6d8566f2eb | ||
| 
						 | 
					4e1b0d8904 | ||
| 
						 | 
					8ce2912fbc | ||
| 
						 | 
					1372965e2e | ||
| 
						 | 
					1a1422643b | ||
| 
						 | 
					409960491d | ||
| 
						 | 
					96bd6f730a | ||
| 
						 | 
					c0f5dd070b | ||
| 
						 | 
					9d7a8d3578 | ||
| 
						 | 
					4dec4f646d | ||
| 
						 | 
					2cb924b052 | ||
| 
						 | 
					51ac0cfe44 | ||
| 
						 | 
					16e819e1d8 | ||
| 
						 | 
					1023cfe70d | ||
| 
						 | 
					8e0a2d8461 | ||
| 
						 | 
					e13ae96d7c | ||
| 
						 | 
					9f29ec4721 | ||
| 
						 | 
					b9a20b5057 | ||
| 
						 | 
					c2222c2ea2 | ||
| 
						 | 
					336da5642d | ||
| 
						 | 
					8573fa1806 | ||
| 
						 | 
					a52c2fb296 | ||
| 
						 | 
					41450b27f2 | ||
| 
						 | 
					e72d5983f2 | ||
| 
						 | 
					5a85385387 | ||
| 
						 | 
					5e54b4f364 | ||
| 
						 | 
					5ba372b17c | ||
| 
						 | 
					f9b0f47c0c | ||
| 
						 | 
					4deeadf7dc | ||
| 
						 | 
					384eff877c | ||
| 
						 | 
					68dbba9817 | ||
| 
						 | 
					ea7150b070 | ||
| 
						 | 
					cb42ce0b67 | ||
| 
						 | 
					e8330cf5ac | ||
| 
						 | 
					7d34470458 | ||
| 
						 | 
					f1047cebea | ||
| 
						 | 
					da8a2e6f90 | ||
| 
						 | 
					546ec5a9b3 | ||
| 
						 | 
					e3fefbfd56 | ||
| 
						 | 
					3b80e3aa9e | ||
| 
						 | 
					14cfde9c83 | ||
| 
						 | 
					9cabef963c | ||
| 
						 | 
					ce9eab79a7 | ||
| 
						 | 
					e9e202cfa8 | ||
| 
						 | 
					d83ae69455 | ||
| 
						 | 
					bb4f7a8d52 | ||
| 
						 | 
					619b2c03dc | ||
| 
						 | 
					aa4c2de10e | ||
| 
						 | 
					6c36f7a9f2 | ||
| 
						 | 
					78f7923580 | ||
| 
						 | 
					978ebf0141 | ||
| 
						 | 
					a9ed4da8eb | ||
| 
						 | 
					e1a4814cd4 | ||
| 
						 | 
					3cad81f6fe | ||
| 
						 | 
					4450107afb | ||
| 
						 | 
					908efd3b73 | ||
| 
						 | 
					1a7691c059 | ||
| 
						 | 
					f524ddbe04 | ||
| 
						 | 
					541814c403 | ||
| 
						 | 
					5013540224 | ||
| 
						 | 
					94cb5ee63c | ||
| 
						 | 
					fc9c61bc3b | ||
| 
						 | 
					e815d3015e | ||
| 
						 | 
					dc2a33d680 | ||
| 
						 | 
					7ba45bf133 | ||
| 
						 | 
					d98a4b7366 | ||
| 
						 | 
					889a54c467 | ||
| 
						 | 
					9d07fd03e3 | ||
| 
						 | 
					a8a1878256 | ||
| 
						 | 
					5b46eee0f5 | ||
| 
						 | 
					e5e6a94fbf | ||
| 
						 | 
					d9ff889073 | ||
| 
						 | 
					e4decc418a | ||
| 
						 | 
					cf5bfbfc21 | ||
| 
						 | 
					567fef894e | ||
| 
						 | 
					6ee2a1365e | ||
| 
						 | 
					435037d4e4 | ||
| 
						 | 
					c5de8996cc | ||
| 
						 | 
					2dc5383a20 | ||
| 
						 | 
					9391f97715 | ||
| 
						 | 
					5b16639538 | ||
| 
						 | 
					1738bb61e1 | ||
| 
						 | 
					91b3f0e691 | ||
| 
						 | 
					6ac4e8bd6e | ||
| 
						 | 
					983495c4b2 | ||
| 
						 | 
					931a23a5a5 | ||
| 
						 | 
					72849dce81 | ||
| 
						 | 
					2618893114 | ||
| 
						 | 
					36026dfc01 | ||
| 
						 | 
					79aa04ef27 | ||
| 
						 | 
					3a0799977b | ||
| 
						 | 
					e19ea55783 | ||
| 
						 | 
					8716dbea40 | ||
| 
						 | 
					e9bc66c84f | ||
| 
						 | 
					c078798c60 | ||
| 
						 | 
					de73cca923 | ||
| 
						 | 
					b1051789d6 | ||
| 
						 | 
					4db73c1bb8 | ||
| 
						 | 
					3ae34e3a8c | ||
| 
						 | 
					1f3b65801b | ||
| 
						 | 
					5e2c4e23f4 | ||
| 
						 | 
					35780c2139 | ||
| 
						 | 
					ceff5fec5a | ||
| 
						 | 
					4897dc4056 | ||
| 
						 | 
					35e33f0e52 | ||
| 
						 | 
					a844e27baa | ||
| 
						 | 
					0783bf151c | ||
| 
						 | 
					566bdf2bda | ||
| 
						 | 
					eb6dc02b23 | ||
| 
						 | 
					78435364ec | ||
| 
						 | 
					5cbc2e8bc1 | ||
| 
						 | 
					e7cf7fcd21 | ||
| 
						 | 
					bb8aab0211 | ||
| 
						 | 
					0fbf5f7102 | ||
| 
						 | 
					f1b2807478 | ||
| 
						 | 
					faacb092f8 | ||
| 
						 | 
					b439a74620 | ||
| 
						 | 
					3132ab8ce6 | ||
| 
						 | 
					bfd7bb3eb6 | ||
| 
						 | 
					11c8f0b79d | ||
| 
						 | 
					c4068186ac | ||
| 
						 | 
					0a93a68020 | ||
| 
						 | 
					f2ab7d1392 | ||
| 
						 | 
					c41ab9ade5 | ||
| 
						 | 
					141e584998 | ||
| 
						 | 
					336736ef35 | ||
| 
						 | 
					df7cb13525 | ||
| 
						 | 
					d93eb21c7c | ||
| 
						 | 
					a403188f92 | ||
| 
						 | 
					82b2230527 | ||
| 
						 | 
					a8a004987c | ||
| 
						 | 
					0e36019977 | ||
| 
						 | 
					354c3ace73 | ||
| 
						 | 
					52129c0b0b | ||
| 
						 | 
					a52877a2f1 | ||
| 
						 | 
					cdd7c3ce92 | ||
| 
						 | 
					c1497b4d19 | ||
| 
						 | 
					b2ed462934 | ||
| 
						 | 
					bb766a0ad6 | ||
| 
						 | 
					b65f851318 | ||
| 
						 | 
					35bf35411c | ||
| 
						 | 
					54fbc77dc8 | ||
| 
						 | 
					9e09eebf94 | ||
| 
						 | 
					45a2f93906 | ||
| 
						 | 
					6982c0da4e | ||
| 
						 | 
					b7727ee616 | ||
| 
						 | 
					f0446ca8d7 | ||
| 
						 | 
					6bc847e49e | ||
| 
						 | 
					3f1c4e49a3 | ||
| 
						 | 
					37a7cd1a11 | ||
| 
						 | 
					3a2d9c4dd0 | ||
| 
						 | 
					e51d1321fc | ||
| 
						 | 
					b9fdb3eb99 | ||
| 
						 | 
					d66ace9da5 | ||
| 
						 | 
					db75357110 | ||
| 
						 | 
					0713f8abe6 | ||
| 
						 | 
					93d9121a77 | ||
| 
						 | 
					92dad6cc84 | ||
| 
						 | 
					61454a9f8c | ||
| 
						 | 
					bb2297a41d | ||
| 
						 | 
					75e98d0563 | ||
| 
						 | 
					e9eb000c53 | ||
| 
						 | 
					1ba01caaa3 | ||
| 
						 | 
					5cd6571fae | ||
| 
						 | 
					6383bbe525 | ||
| 
						 | 
					06da6e4977 | ||
| 
						 | 
					b72faddc47 | ||
| 
						 | 
					d92f0bb6e9 | ||
| 
						 | 
					710e5d5639 | ||
| 
						 | 
					6da980e2b5 | ||
| 
						 | 
					37f599bcec | ||
| 
						 | 
					8408f4fbc7 | ||
| 
						 | 
					534164ef90 | ||
| 
						 | 
					e32c852e1e | ||
| 
						 | 
					dbfc0f8c2b | ||
| 
						 | 
					3728974460 | ||
| 
						 | 
					fdc2bbcacb | ||
| 
						 | 
					c2a3358b60 | ||
| 
						 | 
					882e891284 | ||
| 
						 | 
					05bbf78afd | ||
| 
						 | 
					99ecb90a99 | ||
| 
						 | 
					dbad169019 | ||
| 
						 | 
					3ba5d1cf2e | ||
| 
						 | 
					be2e2c3297 | ||
| 
						 | 
					ed0015284b | ||
| 
						 | 
					6d03b73e35 | ||
| 
						 | 
					622d3d3592 | ||
| 
						 | 
					0e06354402 | ||
| 
						 | 
					62c271610b | ||
| 
						 | 
					db089ad60d | ||
| 
						 | 
					1f0c9ad7e1 | ||
| 
						 | 
					06efc222f9 | ||
| 
						 | 
					de3333bae4 | ||
| 
						 | 
					924875e53b | ||
| 
						 | 
					3a64458217 | ||
| 
						 | 
					ea71c22731 | ||
| 
						 | 
					dc706cd35f | ||
| 
						 | 
					1241126adf | ||
| 
						 | 
					19da130053 | ||
| 
						 | 
					a75b191502 | ||
| 
						 | 
					e5cb260365 | ||
| 
						 | 
					6aecef815c | ||
| 
						 | 
					daba492c3a | ||
| 
						 | 
					24cff6ced5 | ||
| 
						 | 
					ac7b42610f | ||
| 
						 | 
					7abe76e1bd | ||
| 
						 | 
					7bc03ded12 | ||
| 
						 | 
					ea3b8af50a | ||
| 
						 | 
					badb910f3c | ||
| 
						 | 
					3866752e7e | ||
| 
						 | 
					3e3dac9f97 | ||
| 
						 | 
					397ba0f08a | ||
| 
						 | 
					07ad8f5d17 | ||
| 
						 | 
					47c3448a97 | ||
| 
						 | 
					4db48ec0bd | ||
| 
						 | 
					c518ade1fd | ||
| 
						 | 
					acdf4afb91 | ||
| 
						 | 
					6d3dec92fb | ||
| 
						 | 
					2d3b6a5be7 | ||
| 
						 | 
					81d1998e09 | ||
| 
						 | 
					6b46ca135a | ||
| 
						 | 
					fa293e4e4b | ||
| 
						 | 
					24cbf3efc6 | ||
| 
						 | 
					534a1ed0cb | ||
| 
						 | 
					ee306a1332 | ||
| 
						 | 
					45442167b0 | ||
| 
						 | 
					131645ecce | ||
| 
						 | 
					f1ca5f5b89 | ||
| 
						 | 
					e452de9d87 | ||
| 
						 | 
					a0256f462a | ||
| 
						 | 
					82d5d46c14 | ||
| 
						 | 
					0665dd6852 | ||
| 
						 | 
					98fc09b18a | ||
| 
						 | 
					192ebef8cf | ||
| 
						 | 
					b01ab14338 | ||
| 
						 | 
					2a96235bf7 | ||
| 
						 | 
					1cf9bf00f4 | ||
| 
						 | 
					a5224c3420 | ||
| 
						 | 
					af436bc158 | ||
| 
						 | 
					ab603c6987 | ||
| 
						 | 
					9c11a0e541 | ||
| 
						 | 
					8de83bf876 | ||
| 
						 | 
					679df234b7 | ||
| 
						 | 
					26eaab0990 | ||
| 
						 | 
					7be96d7c9f | ||
| 
						 | 
					d11493934c | ||
| 
						 | 
					c62da732a4 | ||
| 
						 | 
					a1a63a4239 | ||
| 
						 | 
					103a434386 | ||
| 
						 | 
					567671e291 | ||
| 
						 | 
					d8a750ee7f | ||
| 
						 | 
					9c10b2c8d3 | ||
| 
						 | 
					56a106115f | ||
| 
						 | 
					e9ad0d2c31 | ||
| 
						 | 
					97639f0d73 | ||
| 
						 | 
					e3a4f8b84c | ||
| 
						 | 
					7e99812432 | ||
| 
						 | 
					2a1ef75435 | ||
| 
						 | 
					c148d70978 | ||
| 
						 | 
					7b6055d1af | ||
| 
						 | 
					f31b12503e | ||
| 
						 | 
					f82197ad75 | ||
| 
						 | 
					3f37e73bae | ||
| 
						 | 
					0774f470d9 | ||
| 
						 | 
					d7a9e91688 | ||
| 
						 | 
					601cb9be20 | ||
| 
						 | 
					f3229ee19a | ||
| 
						 | 
					219a3580b7 | ||
| 
						 | 
					d63c6bd397 | ||
| 
						 | 
					fdb61e583a | ||
| 
						 | 
					b8e2f83ae6 | ||
| 
						 | 
					93dbd83570 | ||
| 
						 | 
					5be022712a | ||
| 
						 | 
					43f9391bcc | ||
| 
						 | 
					c1c971654b | ||
| 
						 | 
					72b1072fbd | ||
| 
						 | 
					3bfd99bfbb | ||
| 
						 | 
					a169e82065 | ||
| 
						 | 
					c80410c50c | ||
| 
						 | 
					dc01b6b1f2 | ||
| 
						 | 
					b7a26e6daf | ||
| 
						 | 
					ce16450a89 | ||
| 
						 | 
					9d2e51c199 | ||
| 
						 | 
					1e325f6149 | ||
| 
						 | 
					c458a33196 | ||
| 
						 | 
					7953b8ff1b | ||
| 
						 | 
					b1460627f3 | ||
| 
						 | 
					5abc8ae6f9 | ||
| 
						 | 
					6a184a6098 | ||
| 
						 | 
					3d5e97f560 | ||
| 
						 | 
					54c7559a7e | ||
| 
						 | 
					0c9de428ae | ||
| 
						 | 
					f13def508c | ||
| 
						 | 
					1ae6ddac91 | ||
| 
						 | 
					55dcfa421c | ||
| 
						 | 
					c04f8cf44a | ||
| 
						 | 
					870d986131 | ||
| 
						 | 
					4f272c17f5 | ||
| 
						 | 
					fd3e027faa | ||
| 
						 | 
					235dd0a22a | ||
| 
						 | 
					b589977b9e | ||
| 
						 | 
					291e4a6ebe | ||
| 
						 | 
					2d2ed9dffd | ||
| 
						 | 
					8ada6e7705 | ||
| 
						 | 
					7f657f342a | ||
| 
						 | 
					20e8f0ee27 | ||
| 
						 | 
					429266b7e4 | ||
| 
						 | 
					2c7bc88d78 | ||
| 
						 | 
					54f7ebe789 | ||
| 
						 | 
					dd499e74de | ||
| 
						 | 
					19a6e8b32c | ||
| 
						 | 
					ed5538dc2b | ||
| 
						 | 
					b8ffcf49ed | ||
| 
						 | 
					eb929eef14 | ||
| 
						 | 
					2cd3ad9bdd | ||
| 
						 | 
					323f289c48 | ||
| 
						 | 
					a45e4a5537 | ||
| 
						 | 
					b7fe2f9675 | ||
| 
						 | 
					6dcd1c9109 | ||
| 
						 | 
					2fe5adc36c | ||
| 
						 | 
					839590f576 | ||
| 
						 | 
					e0a8d1f94e | ||
| 
						 | 
					9ad0f6812f | ||
| 
						 | 
					a3376fe8fc | ||
| 
						 | 
					3cc1f498a1 | ||
| 
						 | 
					c6c0035ea5 | ||
| 
						 | 
					531d630b5c | ||
| 
						 | 
					853b1eb424 | ||
| 
						 | 
					09a2615fb2 | ||
| 
						 | 
					285b42756a | ||
| 
						 | 
					508f15cdab | ||
| 
						 | 
					52c0d30078 | ||
| 
						 | 
					10997ee8ab | ||
| 
						 | 
					8a774dc9a6 | ||
| 
						 | 
					200bc9e3e8 | ||
| 
						 | 
					7dd0ee0495 | ||
| 
						 | 
					76569fc662 | ||
| 
						 | 
					f2a253e0dd | ||
| 
						 | 
					0ad0eaf61c | ||
| 
						 | 
					47b0f48dd9 | ||
| 
						 | 
					44e48abc44 | ||
| 
						 | 
					f420de027f | ||
| 
						 | 
					ecf186065c | ||
| 
						 | 
					20e021bf41 | ||
| 
						 | 
					8ca2ae775d | ||
| 
						 | 
					ee8aa8217a | ||
| 
						 | 
					2b49dd1e8f | ||
| 
						 | 
					30a54b9085 | ||
| 
						 | 
					1e7e62f8cd | ||
| 
						 | 
					5352823fbf | ||
| 
						 | 
					20251f01ea | ||
| 
						 | 
					528f6b81db | ||
| 
						 | 
					27bfba299e | ||
| 
						 | 
					1690863acc | ||
| 
						 | 
					397211323c | ||
| 
						 | 
					a87f50fb5a | ||
| 
						 | 
					31bc51c8cf | ||
| 
						 | 
					be487c429e | ||
| 
						 | 
					80340f1fe9 | ||
| 
						 | 
					d918f85146 | ||
| 
						 | 
					a95541d61e | ||
| 
						 | 
					30b4c2724e | ||
| 
						 | 
					2adc929367 | ||
| 
						 | 
					7e97837274 | ||
| 
						 | 
					4cb73bf8e4 | ||
| 
						 | 
					79bb8d0077 | ||
| 
						 | 
					6c1a3e4f58 | ||
| 
						 | 
					76c919c1a3 | ||
| 
						 | 
					98405f240b | ||
| 
						 | 
					181355616e | ||
| 
						 | 
					b49a5b2dc0 | ||
| 
						 | 
					713f226114 | ||
| 
						 | 
					d57d85ff35 | ||
| 
						 | 
					74daa124c2 | ||
| 
						 | 
					b8e35bd66e | ||
| 
						 | 
					e8734731d3 | ||
| 
						 | 
					9e0fcabeca | ||
| 
						 | 
					6482dec1bb | ||
| 
						 | 
					81b5eeed6a | ||
| 
						 | 
					365359dd79 | ||
| 
						 | 
					2757be06de | ||
| 
						 | 
					d0afe49d3e | ||
| 
						 | 
					81b31b7087 | ||
| 
						 | 
					2643b122fc | ||
| 
						 | 
					88db657ac2 | ||
| 
						 | 
					1f0af2c073 | ||
| 
						 | 
					2ed2d1515e | ||
| 
						 | 
					bb5b16a36c | ||
| 
						 | 
					5892855c5f | ||
| 
						 | 
					a6e859e9ec | ||
| 
						 | 
					99c65cef0f | ||
| 
						 | 
					496da8b918 | ||
| 
						 | 
					739862384c | ||
| 
						 | 
					0a647c2b8b | ||
| 
						 | 
					429e4f0de8 | ||
| 
						 | 
					2d10c7156c | ||
| 
						 | 
					299053becd | ||
| 
						 | 
					1449bda052 | ||
| 
						 | 
					56bb1a7c83 | ||
| 
						 | 
					96aaf806d8 | ||
| 
						 | 
					d70e5100c0 | ||
| 
						 | 
					4831e626aa | ||
| 
						 | 
					33ab4699ba | ||
| 
						 | 
					595cc5b4b8 | ||
| 
						 | 
					29fb08c2de | ||
| 
						 | 
					7babdf2029 | ||
| 
						 | 
					4b3270f78e | ||
| 
						 | 
					3351b8d007 | ||
| 
						 | 
					4b49bf6a93 | ||
| 
						 | 
					926a56bfe3 | ||
| 
						 | 
					d6f188be71 | ||
| 
						 | 
					016cadfb54 | ||
| 
						 | 
					bdee69f718 | ||
| 
						 | 
					ff43e2e155 | ||
| 
						 | 
					f53948856e | ||
| 
						 | 
					14056ee2ee | ||
| 
						 | 
					b545dc6775 | ||
| 
						 | 
					027902999e | ||
| 
						 | 
					9a310a5d4e | ||
| 
						 | 
					a63d5eaab2 | ||
| 
						 | 
					6af59bc095 | ||
| 
						 | 
					24cc290b85 | ||
| 
						 | 
					8e264a933f | ||
| 
						 | 
					f0b54fefe9 | ||
| 
						 | 
					cf2d9e09b3 | ||
| 
						 | 
					d02408ad8a | ||
| 
						 | 
					7ae551fd03 | ||
| 
						 | 
					c2e45f6ddf | ||
| 
						 | 
					f9a4ad4fa6 | ||
| 
						 | 
					10645a4f13 | ||
| 
						 | 
					06cb0353e5 | ||
| 
						 | 
					b41f836e5f | ||
| 
						 | 
					26a81abffc | ||
| 
						 | 
					ab03b0df4c | ||
| 
						 | 
					e5a77633cf | ||
| 
						 | 
					6f8a82c7af | ||
| 
						 | 
					7a7f47ea80 | ||
| 
						 | 
					0ce5f3e4f5 | ||
| 
						 | 
					21023745e2 | ||
| 
						 | 
					a679116f6f | ||
| 
						 | 
					3988bb34aa | ||
| 
						 | 
					9e78e6c3f8 | ||
| 
						 | 
					3caff6092a | ||
| 
						 | 
					0d96bf8950 | ||
| 
						 | 
					91dc71f98d | ||
| 
						 | 
					b7b6c047ca | ||
| 
						 | 
					0ea659475c | ||
| 
						 | 
					1e20bb0648 | ||
| 
						 | 
					c962479bdf | ||
| 
						 | 
					b31ccc362c | ||
| 
						 | 
					0cd5866726 | ||
| 
						 | 
					2a8a10eda6 | ||
| 
						 | 
					f11bc84080 | ||
| 
						 | 
					e2f3ae1252 | ||
| 
						 | 
					40fcda292f | ||
| 
						 | 
					59bc3126c5 | ||
| 
						 | 
					4d6115a5cc | ||
| 
						 | 
					3a25b96caf | ||
| 
						 | 
					6e6d04e29a | ||
| 
						 | 
					48ff225300 | ||
| 
						 | 
					a4a9d97a3e | ||
| 
						 | 
					404f952aa3 | ||
| 
						 | 
					dcd87618ab | ||
| 
						 | 
					d54bf14559 | ||
| 
						 | 
					ea3a429efe | ||
| 
						 | 
					e3f1223fe4 | ||
| 
						 | 
					7ef6e3fe2f | ||
| 
						 | 
					197322455d | ||
| 
						 | 
					4f19a0672b | ||
| 
						 | 
					854e076df8 | ||
| 
						 | 
					cb2a0e1319 | ||
| 
						 | 
					638b0d4277 | ||
| 
						 | 
					f2346808de | ||
| 
						 | 
					d7818facb9 | ||
| 
						 | 
					bcf95a2183 | ||
| 
						 | 
					f7181a9179 | ||
| 
						 | 
					9237ba8b66 | ||
| 
						 | 
					95874603b0 | ||
| 
						 | 
					ed2e24d564 | ||
| 
						 | 
					c9fd77e9dd | ||
| 
						 | 
					a9d2bc4902 | ||
| 
						 | 
					c3bdbcf639 | ||
| 
						 | 
					d9a770e6ea | ||
| 
						 | 
					35feed50f0 | ||
| 
						 | 
					a116afa42e | ||
| 
						 | 
					b4542fb307 | ||
| 
						 | 
					1f224bf029 | ||
| 
						 | 
					4d231b4359 | ||
| 
						 | 
					ac0f1d0b14 | ||
| 
						 | 
					124d8cf701 | ||
| 
						 | 
					7d0d0996aa | ||
| 
						 | 
					9cddbf14db | ||
| 
						 | 
					5f1fddbbe7 | ||
| 
						 | 
					027e257b1d | ||
| 
						 | 
					93f117003e | ||
| 
						 | 
					42748c084e | ||
| 
						 | 
					77dd9c1850 | ||
| 
						 | 
					83d968df60 | ||
| 
						 | 
					4ac881ede3 | ||
| 
						 | 
					ccd2cd3e64 | ||
| 
						 | 
					6186ef9338 | ||
| 
						 | 
					6bcac6e578 | ||
| 
						 | 
					967d95f096 | ||
| 
						 | 
					26c7750827 | ||
| 
						 | 
					5a16d270ab | ||
| 
						 | 
					3a465d5ec9 | ||
| 
						 | 
					413a4a0461 | ||
| 
						 | 
					a95d2c5133 | ||
| 
						 | 
					1876cc32ae | ||
| 
						 | 
					4e2a08ddd4 | ||
| 
						 | 
					61e2c34a10 | ||
| 
						 | 
					e56b54a376 | ||
| 
						 | 
					0da945bb20 | ||
| 
						 | 
					69443d0da0 | ||
| 
						 | 
					e4dc18d7e5 | ||
| 
						 | 
					3f86a2b147 | ||
| 
						 | 
					fd664b9fc6 | ||
| 
						 | 
					722ca2781c | ||
| 
						 | 
					1c72eebf89 | ||
| 
						 | 
					69ce8bb952 | ||
| 
						 | 
					50b8ba0201 | ||
| 
						 | 
					c9fd9152bd | ||
| 
						 | 
					f891abccf2 | ||
| 
						 | 
					e2effdbc6b | ||
| 
						 | 
					b10ae320f7 | ||
| 
						 | 
					5d3ab9b096 | ||
| 
						 | 
					4fea8145e2 | ||
| 
						 | 
					884e26080f | ||
| 
						 | 
					9946491fcc | ||
| 
						 | 
					ae6dfff5bf | ||
| 
						 | 
					307bf4dae2 | ||
| 
						 | 
					96d65fc022 | ||
| 
						 | 
					080b8cadfa | ||
| 
						 | 
					7cdd2aa128 | ||
| 
						 | 
					7d7672f119 | ||
| 
						 | 
					6a5b52efa0 | ||
| 
						 | 
					6d864b7030 | ||
| 
						 | 
					71a39dd4be | ||
| 
						 | 
					500230ee94 | ||
| 
						 | 
					347177e052 | ||
| 
						 | 
					b7883fbb6e | ||
| 
						 | 
					a77e023ab4 | ||
| 
						 | 
					812cb5638c | ||
| 
						 | 
					77a0f1d727 | ||
| 
						 | 
					b9a18f3b8d | ||
| 
						 | 
					73aeb61c3f | ||
| 
						 | 
					3041903844 | ||
| 
						 | 
					ad8ee98617 | ||
| 
						 | 
					bc29d0e5d4 | ||
| 
						 | 
					f89aebb1c4 | ||
| 
						 | 
					1d7fb4f0c5 | ||
| 
						 | 
					81a6c7817f | ||
| 
						 | 
					5238fccc15 | ||
| 
						 | 
					fba9046490 | ||
| 
						 | 
					8a2908a24a | ||
| 
						 | 
					e8b12f7a6f | ||
| 
						 | 
					271da5a2e0 | ||
| 
						 | 
					26fbabf3d1 | ||
| 
						 | 
					37cdcb4d8a | ||
| 
						 | 
					57b6534e53 | ||
| 
						 | 
					8bf49ea170 | ||
| 
						 | 
					02ee8626fb | ||
| 
						 | 
					6276e5b41b | ||
| 
						 | 
					51740b12ae | ||
| 
						 | 
					6e6783056e | ||
| 
						 | 
					791bd0cd2b | ||
| 
						 | 
					e890dcdb19 | ||
| 
						 | 
					5ddcb8664a | ||
| 
						 | 
					09c4b4e0b7 | ||
| 
						 | 
					368101778e | ||
| 
						 | 
					535d79da63 | ||
| 
						 | 
					4f69172d25 | 
@@ -1,3 +1,4 @@
 | 
				
			|||||||
 | 
					openssl.pc
 | 
				
			||||||
Makefile.ssl
 | 
					Makefile.ssl
 | 
				
			||||||
MINFO
 | 
					MINFO
 | 
				
			||||||
makefile.one
 | 
					makefile.one
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										300
									
								
								FAQ
									
									
									
									
									
								
							
							
						
						
									
										300
									
								
								FAQ
									
									
									
									
									
								
							@@ -8,6 +8,8 @@ OpenSSL  -  Frequently Asked Questions
 | 
				
			|||||||
* How can I contact the OpenSSL developers?
 | 
					* How can I contact the OpenSSL developers?
 | 
				
			||||||
* Where can I get a compiled version of OpenSSL?
 | 
					* Where can I get a compiled version of OpenSSL?
 | 
				
			||||||
* Why aren't tools like 'autoconf' and 'libtool' used?
 | 
					* Why aren't tools like 'autoconf' and 'libtool' used?
 | 
				
			||||||
 | 
					* What is an 'engine' version?
 | 
				
			||||||
 | 
					* How do I check the authenticity of the OpenSSL distribution?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[LEGAL] Legal questions
 | 
					[LEGAL] Legal questions
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -17,6 +19,7 @@ OpenSSL  -  Frequently Asked Questions
 | 
				
			|||||||
[USER] Questions on using the OpenSSL applications
 | 
					[USER] Questions on using the OpenSSL applications
 | 
				
			||||||
 | 
					
 | 
				
			||||||
* Why do I get a "PRNG not seeded" error message?
 | 
					* Why do I get a "PRNG not seeded" error message?
 | 
				
			||||||
 | 
					* Why do I get an "unable to write 'random state'" error message?
 | 
				
			||||||
* How do I create certificates or certificate requests?
 | 
					* How do I create certificates or certificate requests?
 | 
				
			||||||
* Why can't I create certificate requests?
 | 
					* Why can't I create certificate requests?
 | 
				
			||||||
* Why does <SSL program> fail with a certificate verify error?
 | 
					* Why does <SSL program> fail with a certificate verify error?
 | 
				
			||||||
@@ -26,15 +29,21 @@ OpenSSL  -  Frequently Asked Questions
 | 
				
			|||||||
* How can I remove the passphrase on a private key?
 | 
					* How can I remove the passphrase on a private key?
 | 
				
			||||||
* Why can't I use OpenSSL certificates with SSL client authentication?
 | 
					* Why can't I use OpenSSL certificates with SSL client authentication?
 | 
				
			||||||
* Why does my browser give a warning about a mismatched hostname?
 | 
					* Why does my browser give a warning about a mismatched hostname?
 | 
				
			||||||
 | 
					* How do I install a CA certificate into a browser?
 | 
				
			||||||
 | 
					* Why is OpenSSL x509 DN output not conformant to RFC2253?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[BUILD] Questions about building and testing OpenSSL
 | 
					[BUILD] Questions about building and testing OpenSSL
 | 
				
			||||||
 | 
					
 | 
				
			||||||
* Why does the linker complain about undefined symbols?
 | 
					* Why does the linker complain about undefined symbols?
 | 
				
			||||||
* Why does the OpenSSL test fail with "bc: command not found"?
 | 
					* Why does the OpenSSL test fail with "bc: command not found"?
 | 
				
			||||||
* Why does the OpenSSL test fail with "bc: 1 no implemented"?
 | 
					* Why does the OpenSSL test fail with "bc: 1 no implemented"?
 | 
				
			||||||
* Why does the OpenSSL compilation fail on Alpha True64 Unix?
 | 
					* Why does the OpenSSL test fail with "bc: stack empty"?
 | 
				
			||||||
 | 
					* Why does the OpenSSL compilation fail on Alpha Tru64 Unix?
 | 
				
			||||||
* Why does the OpenSSL compilation fail with "ar: command not found"?
 | 
					* Why does the OpenSSL compilation fail with "ar: command not found"?
 | 
				
			||||||
* Why does the OpenSSL compilation fail on Win32 with VC++?
 | 
					* Why does the OpenSSL compilation fail on Win32 with VC++?
 | 
				
			||||||
 | 
					* What is special about OpenSSL on Redhat?
 | 
				
			||||||
 | 
					* Why does the OpenSSL compilation fail on MacOS X?
 | 
				
			||||||
 | 
					* Why does the OpenSSL test suite fail on MacOS X?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[PROG] Questions about programming with OpenSSL
 | 
					[PROG] Questions about programming with OpenSSL
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -47,6 +56,8 @@ OpenSSL  -  Frequently Asked Questions
 | 
				
			|||||||
* Why do I get errors about unknown algorithms?
 | 
					* Why do I get errors about unknown algorithms?
 | 
				
			||||||
* Why can't the OpenSSH configure script detect OpenSSL?
 | 
					* Why can't the OpenSSH configure script detect OpenSSL?
 | 
				
			||||||
* Can I use OpenSSL's SSL library with non-blocking I/O?
 | 
					* Can I use OpenSSL's SSL library with non-blocking I/O?
 | 
				
			||||||
 | 
					* Why doesn't my server application receive a client certificate?
 | 
				
			||||||
 | 
					* Why does compilation fail due to an undefined symbol NID_uniqueIdentifier?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
===============================================================================
 | 
					===============================================================================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -55,7 +66,7 @@ OpenSSL  -  Frequently Asked Questions
 | 
				
			|||||||
* Which is the current version of OpenSSL?
 | 
					* Which is the current version of OpenSSL?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
The current version is available from <URL: http://www.openssl.org>.
 | 
					The current version is available from <URL: http://www.openssl.org>.
 | 
				
			||||||
OpenSSL 0.9.6 was released on September 24th, 2000.
 | 
					OpenSSL 0.9.6g was released on August 9, 2002.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
In addition to the current stable release, you can also access daily
 | 
					In addition to the current stable release, you can also access daily
 | 
				
			||||||
snapshots of the OpenSSL development version at <URL:
 | 
					snapshots of the OpenSSL development version at <URL:
 | 
				
			||||||
@@ -119,6 +130,25 @@ A number of Linux and *BSD distributions include OpenSSL.
 | 
				
			|||||||
autoconf will probably be used in future OpenSSL versions. If it was
 | 
					autoconf will probably be used in future OpenSSL versions. If it was
 | 
				
			||||||
less Unix-centric, it might have been used much earlier.
 | 
					less Unix-centric, it might have been used much earlier.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* What is an 'engine' version?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					With version 0.9.6 OpenSSL was extended to interface to external crypto
 | 
				
			||||||
 | 
					hardware. This was realized in a special release '0.9.6-engine'. With
 | 
				
			||||||
 | 
					version 0.9.7 (not yet released) the changes were merged into the main
 | 
				
			||||||
 | 
					development line, so that the special release is no longer necessary.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* How do I check the authenticity of the OpenSSL distribution?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					We provide MD5 digests and ASC signatures of each tarball.
 | 
				
			||||||
 | 
					Use MD5 to check that a tarball from a mirror site is identical:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   md5sum TARBALL | awk '{print $1;}' | cmp - TARBALL.md5
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					You can check authenticity using pgp or gpg. You need the OpenSSL team
 | 
				
			||||||
 | 
					member public key used to sign it (download it from a key server). Then
 | 
				
			||||||
 | 
					just do:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   pgp TARBALL.asc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[LEGAL] =======================================================================
 | 
					[LEGAL] =======================================================================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -144,7 +174,7 @@ holders claim that you infringe on their rights if you use OpenSSL with
 | 
				
			|||||||
their software on operating systems that don't normally include OpenSSL.
 | 
					their software on operating systems that don't normally include OpenSSL.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
If you develop open source software that uses OpenSSL, you may find it
 | 
					If you develop open source software that uses OpenSSL, you may find it
 | 
				
			||||||
useful to choose an other license than the GPL, or state explicitely that
 | 
					useful to choose an other license than the GPL, or state explicitly that
 | 
				
			||||||
"This program is released under the GPL with the additional exemption that
 | 
					"This program is released under the GPL with the additional exemption that
 | 
				
			||||||
compiling, linking, and/or using OpenSSL is allowed."  If you are using
 | 
					compiling, linking, and/or using OpenSSL is allowed."  If you are using
 | 
				
			||||||
GPL software developed by others, you may want to ask the copyright holder
 | 
					GPL software developed by others, you may want to ask the copyright holder
 | 
				
			||||||
@@ -160,6 +190,7 @@ correctly.  Many open source operating systems provide a "randomness
 | 
				
			|||||||
device" that serves this purpose.  On other systems, applications have
 | 
					device" that serves this purpose.  On other systems, applications have
 | 
				
			||||||
to call the RAND_add() or RAND_seed() function with appropriate data
 | 
					to call the RAND_add() or RAND_seed() function with appropriate data
 | 
				
			||||||
before generating keys or performing public key encryption.
 | 
					before generating keys or performing public key encryption.
 | 
				
			||||||
 | 
					(These functions initialize the pseudo-random number generator, PRNG.)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Some broken applications do not do this.  As of version 0.9.5, the
 | 
					Some broken applications do not do this.  As of version 0.9.5, the
 | 
				
			||||||
OpenSSL functions that need randomness report an error if the random
 | 
					OpenSSL functions that need randomness report an error if the random
 | 
				
			||||||
@@ -169,25 +200,60 @@ application you are using.  It is likely that it never worked
 | 
				
			|||||||
correctly.  OpenSSL 0.9.5 and later make the error visible by refusing
 | 
					correctly.  OpenSSL 0.9.5 and later make the error visible by refusing
 | 
				
			||||||
to perform potentially insecure encryption.
 | 
					to perform potentially insecure encryption.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
On systems without /dev/urandom, it is a good idea to use the Entropy
 | 
					On systems without /dev/urandom and /dev/random, it is a good idea to
 | 
				
			||||||
Gathering Demon; see the RAND_egd() manpage for details.
 | 
					use the Entropy Gathering Demon (EGD); see the RAND_egd() manpage for
 | 
				
			||||||
 | 
					details.  Starting with version 0.9.7, OpenSSL will automatically look
 | 
				
			||||||
 | 
					for an EGD socket at /var/run/egd-pool, /dev/egd-pool, /etc/egd-pool and
 | 
				
			||||||
 | 
					/etc/entropy.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Most components of the openssl command line tool try to use the
 | 
					Most components of the openssl command line utility automatically try
 | 
				
			||||||
file $HOME/.rnd (or $RANDFILE, if this environment variable is set)
 | 
					to seed the random number generator from a file.  The name of the
 | 
				
			||||||
for seeding the PRNG.  If this file does not exist or is too short,
 | 
					default seeding file is determined as follows: If environment variable
 | 
				
			||||||
the "PRNG not seeded" error message may occur.
 | 
					RANDFILE is set, then it names the seeding file.  Otherwise if
 | 
				
			||||||
 | 
					environment variable HOME is set, then the seeding file is $HOME/.rnd.
 | 
				
			||||||
 | 
					If neither RANDFILE nor HOME is set, versions up to OpenSSL 0.9.6 will
 | 
				
			||||||
 | 
					use file .rnd in the current directory while OpenSSL 0.9.6a uses no
 | 
				
			||||||
 | 
					default seeding file at all.  OpenSSL 0.9.6b and later will behave
 | 
				
			||||||
 | 
					similarly to 0.9.6a, but will use a default of "C:\" for HOME on
 | 
				
			||||||
 | 
					Windows systems if the environment variable has not been set.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[Note to OpenSSL 0.9.5 users: The command "openssl rsa" in version
 | 
					If the default seeding file does not exist or is too short, the "PRNG
 | 
				
			||||||
0.9.5 does not do this and will fail on systems without /dev/urandom
 | 
					not seeded" error message may occur.
 | 
				
			||||||
when trying to password-encrypt an RSA key!  This is a bug in the
 | 
					
 | 
				
			||||||
library; try a later version instead.]
 | 
					The openssl command line utility will write back a new state to the
 | 
				
			||||||
 | 
					default seeding file (and create this file if necessary) unless
 | 
				
			||||||
 | 
					there was no sufficient seeding.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Pointing $RANDFILE to an Entropy Gathering Daemon socket does not work.
 | 
				
			||||||
 | 
					Use the "-rand" option of the OpenSSL command line tools instead.
 | 
				
			||||||
 | 
					The $RANDFILE environment variable and $HOME/.rnd are only used by the
 | 
				
			||||||
 | 
					OpenSSL command line tools. Applications using the OpenSSL library
 | 
				
			||||||
 | 
					provide their own configuration options to specify the entropy source,
 | 
				
			||||||
 | 
					please check out the documentation coming the with application.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
For Solaris 2.6, Tim Nibbe <tnibbe@sprint.net> and others have suggested
 | 
					For Solaris 2.6, Tim Nibbe <tnibbe@sprint.net> and others have suggested
 | 
				
			||||||
installing the SUNski package from Sun patch 105710-01 (Sparc) which
 | 
					installing the SUNski package from Sun patch 105710-01 (Sparc) which
 | 
				
			||||||
adds a /dev/random device and make sure it gets used, usually through
 | 
					adds a /dev/random device and make sure it gets used, usually through
 | 
				
			||||||
$RANDFILE.  There are probably similar patches for the other Solaris
 | 
					$RANDFILE.  There are probably similar patches for the other Solaris
 | 
				
			||||||
versions.  However, be warned that /dev/random is usually a blocking
 | 
					versions.  An official statement from Sun with respect to /dev/random
 | 
				
			||||||
device, which may have some effects on OpenSSL.
 | 
					support can be found at
 | 
				
			||||||
 | 
					  http://sunsolve.sun.com/pub-cgi/retrieve.pl?doc=fsrdb/27606&zone_32=SUNWski
 | 
				
			||||||
 | 
					However, be warned that /dev/random is usually a blocking device, which
 | 
				
			||||||
 | 
					may have some effects on OpenSSL.
 | 
				
			||||||
 | 
					A third party /dev/random solution for Solaris is available at
 | 
				
			||||||
 | 
					  http://www.cosy.sbg.ac.at/~andi/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* Why do I get an "unable to write 'random state'" error message?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Sometimes the openssl command line utility does not abort with
 | 
				
			||||||
 | 
					a "PRNG not seeded" error message, but complains that it is
 | 
				
			||||||
 | 
					"unable to write 'random state'".  This message refers to the
 | 
				
			||||||
 | 
					default seeding file (see previous answer).  A possible reason
 | 
				
			||||||
 | 
					is that no default filename is known because neither RANDFILE
 | 
				
			||||||
 | 
					nor HOME is set.  (Versions up to 0.9.6 used file ".rnd" in the
 | 
				
			||||||
 | 
					current directory in this case, but this has changed with 0.9.6a.)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
* How do I create certificates or certificate requests?
 | 
					* How do I create certificates or certificate requests?
 | 
				
			||||||
@@ -264,7 +330,7 @@ there is little point presenting a certificate which the server will
 | 
				
			|||||||
reject.
 | 
					reject.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
The solution is to add the relevant CA certificate to your servers "trusted
 | 
					The solution is to add the relevant CA certificate to your servers "trusted
 | 
				
			||||||
CA list". How you do this depends on the server sofware in uses. You can
 | 
					CA list". How you do this depends on the server software in uses. You can
 | 
				
			||||||
print out the servers list of acceptable CAs using the OpenSSL s_client tool:
 | 
					print out the servers list of acceptable CAs using the OpenSSL s_client tool:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
openssl s_client -connect www.some.host:443 -prexit
 | 
					openssl s_client -connect www.some.host:443 -prexit
 | 
				
			||||||
@@ -283,6 +349,33 @@ Browsers expect the server's hostname to match the value in the commonName
 | 
				
			|||||||
(CN) field of the certificate. If it does not then you get a warning.
 | 
					(CN) field of the certificate. If it does not then you get a warning.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* How do I install a CA certificate into a browser?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The usual way is to send the DER encoded certificate to the browser as
 | 
				
			||||||
 | 
					MIME type application/x-x509-ca-cert, for example by clicking on an appropriate
 | 
				
			||||||
 | 
					link. On MSIE certain extensions such as .der or .cacert may also work, or you
 | 
				
			||||||
 | 
					can import the certificate using the certificate import wizard.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					You can convert a certificate to DER form using the command:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					openssl x509 -in ca.pem -outform DER -out ca.der
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Occasionally someone suggests using a command such as:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					openssl pkcs12 -export -out cacert.p12 -in cacert.pem -inkey cakey.pem
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					DO NOT DO THIS! This command will give away your CAs private key and
 | 
				
			||||||
 | 
					reduces its security to zero: allowing anyone to forge certificates in
 | 
				
			||||||
 | 
					whatever name they choose.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* Why is OpenSSL x509 DN output not conformant to RFC2253?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The ways to print out the oneline format of the DN (Distinguished Name) have
 | 
				
			||||||
 | 
					been extended in version 0.9.7 of OpenSSL. Using the new X509_NAME_print_ex()
 | 
				
			||||||
 | 
					interface, the "-nameopt" option could be introduded. See the manual
 | 
				
			||||||
 | 
					page of the "openssl x509" commandline tool for details. The old behaviour
 | 
				
			||||||
 | 
					has however been left as default for the sake of compatibility.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[BUILD] =======================================================================
 | 
					[BUILD] =======================================================================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
* Why does the linker complain about undefined symbols?
 | 
					* Why does the linker complain about undefined symbols?
 | 
				
			||||||
@@ -326,9 +419,20 @@ and compile/install it.  GNU bc (see http://www.gnu.org/software/software.html
 | 
				
			|||||||
for download instructions) can be safely used, for example.
 | 
					for download instructions) can be safely used, for example.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
* Why does the OpenSSL compilation fail on Alpha True64 Unix?
 | 
					* Why does the OpenSSL test fail with "bc: stack empty"?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
On some Alpha installations running True64 Unix and Compaq C, the compilation
 | 
					On some DG/ux versions, bc seems to have a too small stack for calculations
 | 
				
			||||||
 | 
					that the OpenSSL bntest throws at it.  This gets triggered when you run the
 | 
				
			||||||
 | 
					test suite (using "make test").  The message returned is "bc: stack empty".
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The best way to deal with this is to find another implementation of bc
 | 
				
			||||||
 | 
					and compile/install it.  GNU bc (see http://www.gnu.org/software/software.html
 | 
				
			||||||
 | 
					for download instructions) can be safely used, for example.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* Why does the OpenSSL compilation fail on Alpha Tru64 Unix?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					On some Alpha installations running Tru64 Unix and Compaq C, the compilation
 | 
				
			||||||
of crypto/sha/sha_dgst.c fails with the message 'Fatal:  Insufficient virtual
 | 
					of crypto/sha/sha_dgst.c fails with the message 'Fatal:  Insufficient virtual
 | 
				
			||||||
memory to continue compilation.'  As far as the tests have shown, this may be
 | 
					memory to continue compilation.'  As far as the tests have shown, this may be
 | 
				
			||||||
a compiler bug.  What happens is that it eats up a lot of resident memory
 | 
					a compiler bug.  What happens is that it eats up a lot of resident memory
 | 
				
			||||||
@@ -390,6 +494,64 @@ under 'Program Files').  This needs to be done prior to running NMAKE,
 | 
				
			|||||||
and the changes are only valid for the current DOS session.
 | 
					and the changes are only valid for the current DOS session.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* What is special about OpenSSL on Redhat?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Red Hat Linux (release 7.0 and later) include a preinstalled limited
 | 
				
			||||||
 | 
					version of OpenSSL. For patent reasons, support for IDEA, RC5 and MDC2
 | 
				
			||||||
 | 
					is disabled in this version. The same may apply to other Linux distributions.
 | 
				
			||||||
 | 
					Users may therefore wish to install more or all of the features left out.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					To do this you MUST ensure that you do not overwrite the openssl that is in
 | 
				
			||||||
 | 
					/usr/bin on your Red Hat machine. Several packages depend on this file,
 | 
				
			||||||
 | 
					including sendmail and ssh. /usr/local/bin is a good alternative choice. The
 | 
				
			||||||
 | 
					libraries that come with Red Hat 7.0 onwards have different names and so are
 | 
				
			||||||
 | 
					not affected. (eg For Red Hat 7.2 they are /lib/libssl.so.0.9.6b and
 | 
				
			||||||
 | 
					/lib/libcrypto.so.0.9.6b with symlinks /lib/libssl.so.2 and
 | 
				
			||||||
 | 
					/lib/libcrypto.so.2 respectively).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Please note that we have been advised by Red Hat attempting to recompile the
 | 
				
			||||||
 | 
					openssl rpm with all the cryptography enabled will not work. All other
 | 
				
			||||||
 | 
					packages depend on the original Red Hat supplied openssl package. It is also
 | 
				
			||||||
 | 
					worth noting that due to the way Red Hat supplies its packages, updates to
 | 
				
			||||||
 | 
					openssl on each distribution never change the package version, only the
 | 
				
			||||||
 | 
					build number. For example, on Red Hat 7.1, the latest openssl package has
 | 
				
			||||||
 | 
					version number 0.9.6 and build number 9 even though it contains all the
 | 
				
			||||||
 | 
					relevant updates in packages up to and including 0.9.6b.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					A possible way around this is to persuade Red Hat to produce a non-US
 | 
				
			||||||
 | 
					version of Red Hat Linux.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					FYI: Patent numbers and expiry dates of US patents:
 | 
				
			||||||
 | 
					MDC-2: 4,908,861 13/03/2007
 | 
				
			||||||
 | 
					IDEA:  5,214,703 25/05/2010
 | 
				
			||||||
 | 
					RC5:   5,724,428 03/03/2015
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* Why does the OpenSSL compilation fail on MacOS X?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					If the failure happens when trying to build the "openssl" binary, with
 | 
				
			||||||
 | 
					a large number of undefined symbols, it's very probable that you have
 | 
				
			||||||
 | 
					OpenSSL 0.9.6b delivered with the operating system (you can find out by
 | 
				
			||||||
 | 
					running '/usr/bin/openssl version') and that you were trying to build
 | 
				
			||||||
 | 
					OpenSSL 0.9.7 or newer.  The problem is that the loader ('ld') in
 | 
				
			||||||
 | 
					MacOS X has a misfeature that's quite difficult to go around.
 | 
				
			||||||
 | 
					Look in the file PROBLEMS for a more detailed explanation and for possible
 | 
				
			||||||
 | 
					solutions.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* Why does the OpenSSL test suite fail on MacOS X?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					If the failure happens when running 'make test' and the RC4 test fails,
 | 
				
			||||||
 | 
					it's very probable that you have OpenSSL 0.9.6b delivered with the
 | 
				
			||||||
 | 
					operating system (you can find out by running '/usr/bin/openssl version')
 | 
				
			||||||
 | 
					and that you were trying to build OpenSSL 0.9.6d.  The problem is that
 | 
				
			||||||
 | 
					the loader ('ld') in MacOS X has a misfeature that's quite difficult to
 | 
				
			||||||
 | 
					go around and has linked the programs "openssl" and the test programs
 | 
				
			||||||
 | 
					with /usr/lib/libcrypto.dylib and /usr/lib/libssl.dylib instead of the
 | 
				
			||||||
 | 
					libraries you just built.
 | 
				
			||||||
 | 
					Look in the file PROBLEMS for a more detailed explanation and for possible
 | 
				
			||||||
 | 
					solutions.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[PROG] ========================================================================
 | 
					[PROG] ========================================================================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
* Is OpenSSL thread-safe?
 | 
					* Is OpenSSL thread-safe?
 | 
				
			||||||
@@ -406,10 +568,43 @@ OpenSSL.  This is described in the threads(3) manpage.
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
* I've compiled a program under Windows and it crashes: why?
 | 
					* I've compiled a program under Windows and it crashes: why?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
This is usually because you've missed the comment in INSTALL.W32. You
 | 
					This is usually because you've missed the comment in INSTALL.W32.
 | 
				
			||||||
must link with the multithreaded DLL version of the VC++ runtime library
 | 
					Your application must link against the same version of the Win32
 | 
				
			||||||
otherwise the conflict will cause a program to crash: typically on the
 | 
					C-Runtime against which your openssl libraries were linked.  The
 | 
				
			||||||
first BIO related read or write operation.
 | 
					default version for OpenSSL is /MD - "Multithreaded DLL".
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					If you are using Microsoft Visual C++'s IDE (Visual Studio), in
 | 
				
			||||||
 | 
					many cases, your new project most likely defaulted to "Debug
 | 
				
			||||||
 | 
					Singlethreaded" - /ML.  This is NOT interchangeable with /MD and your
 | 
				
			||||||
 | 
					program will crash, typically on the first BIO related read or write
 | 
				
			||||||
 | 
					operation.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					For each of the six possible link stage configurations within Win32,
 | 
				
			||||||
 | 
					your application must link  against the same by which OpenSSL was
 | 
				
			||||||
 | 
					built.  If you are using MS Visual C++ (Studio) this can be changed
 | 
				
			||||||
 | 
					by:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					1.  Select Settings... from the Project Menu.
 | 
				
			||||||
 | 
					2.  Select the C/C++ Tab.
 | 
				
			||||||
 | 
					3.  Select "Code Generation from the "Category" drop down list box
 | 
				
			||||||
 | 
					4.  Select the Appropriate library (see table below) from the "Use
 | 
				
			||||||
 | 
					    run-time library" drop down list box.  Perform this step for both
 | 
				
			||||||
 | 
					    your debug and release versions of your application (look at the
 | 
				
			||||||
 | 
					    top left of the settings panel to change between the two)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Single Threaded           /ML        -  MS VC++ often defaults to
 | 
				
			||||||
 | 
					                                            this for the release
 | 
				
			||||||
 | 
					                                            version of a new project.
 | 
				
			||||||
 | 
					    Debug Single Threaded     /MLd       -  MS VC++ often defaults to
 | 
				
			||||||
 | 
					                                            this for the debug version
 | 
				
			||||||
 | 
					                                            of a new project.
 | 
				
			||||||
 | 
					    Multithreaded             /MT
 | 
				
			||||||
 | 
					    Debug Multithreaded       /MTd
 | 
				
			||||||
 | 
					    Multithreaded DLL         /MD        -  OpenSSL defaults to this.
 | 
				
			||||||
 | 
					    Debug Multithreaded DLL   /MDd
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Note that debug and release libraries are NOT interchangeable.  If you
 | 
				
			||||||
 | 
					built OpenSSL with /MD your application must use /MD and cannot use /MDd.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
* How do I read or write a DER encoded buffer using the ASN1 functions?
 | 
					* How do I read or write a DER encoded buffer using the ASN1 functions?
 | 
				
			||||||
@@ -490,44 +685,16 @@ OpenSSL_add_all_algorithms(). See the manual page for more information.
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
* Why can't the OpenSSH configure script detect OpenSSL?
 | 
					* Why can't the OpenSSH configure script detect OpenSSL?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
There is a problem with OpenSSH 1.2.2p1, in that the configure script
 | 
					Several reasons for problems with the automatic detection exist.
 | 
				
			||||||
can't find the installed OpenSSL libraries.  The problem is actually
 | 
					OpenSSH requires at least version 0.9.5a of the OpenSSL libraries.
 | 
				
			||||||
a small glitch that is easily solved with the following patch to be
 | 
					Sometimes the distribution has installed an older version in the system
 | 
				
			||||||
applied to the OpenSSH distribution:
 | 
					locations that is detected instead of a new one installed. The OpenSSL
 | 
				
			||||||
 | 
					library might have been compiled for another CPU or another mode (32/64 bits).
 | 
				
			||||||
----- snip:start -----
 | 
					Permissions might be wrong.
 | 
				
			||||||
--- openssh-1.2.2p1/configure.in.orig	Thu Mar 23 18:56:58 2000
 | 
					 | 
				
			||||||
+++ openssh-1.2.2p1/configure.in	Thu Mar 23 18:55:05 2000
 | 
					 | 
				
			||||||
@@ -152,10 +152,10 @@
 | 
					 | 
				
			||||||
 AC_MSG_CHECKING([for OpenSSL/SSLeay directory])
 | 
					 | 
				
			||||||
 for ssldir in "" $tryssldir /usr /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg /opt /opt/openssl ; do
 | 
					 | 
				
			||||||
 	if test ! -z "$ssldir" ; then
 | 
					 | 
				
			||||||
-		LIBS="$saved_LIBS -L$ssldir"
 | 
					 | 
				
			||||||
+		LIBS="$saved_LIBS -L$ssldir/lib"
 | 
					 | 
				
			||||||
 		CFLAGS="$CFLAGS -I$ssldir/include"
 | 
					 | 
				
			||||||
 		if test "x$need_dash_r" = "x1" ; then
 | 
					 | 
				
			||||||
-			LIBS="$LIBS -R$ssldir"
 | 
					 | 
				
			||||||
+			LIBS="$LIBS -R$ssldir/lib"
 | 
					 | 
				
			||||||
 		fi
 | 
					 | 
				
			||||||
 	fi
 | 
					 | 
				
			||||||
 	LIBS="$LIBS -lcrypto"
 | 
					 | 
				
			||||||
--- openssh-1.2.2p1/configure.orig	Thu Mar 23 18:55:02 2000
 | 
					 | 
				
			||||||
+++ openssh-1.2.2p1/configure	Thu Mar 23 18:57:08 2000
 | 
					 | 
				
			||||||
@@ -1890,10 +1890,10 @@
 | 
					 | 
				
			||||||
 echo "configure:1891: checking for OpenSSL/SSLeay directory" >&5
 | 
					 | 
				
			||||||
 for ssldir in "" $tryssldir /usr /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg /opt /opt/openssl ; do
 | 
					 | 
				
			||||||
 	if test ! -z "$ssldir" ; then
 | 
					 | 
				
			||||||
-		LIBS="$saved_LIBS -L$ssldir"
 | 
					 | 
				
			||||||
+		LIBS="$saved_LIBS -L$ssldir/lib"
 | 
					 | 
				
			||||||
 		CFLAGS="$CFLAGS -I$ssldir/include"
 | 
					 | 
				
			||||||
 		if test "x$need_dash_r" = "x1" ; then
 | 
					 | 
				
			||||||
-			LIBS="$LIBS -R$ssldir"
 | 
					 | 
				
			||||||
+			LIBS="$LIBS -R$ssldir/lib"
 | 
					 | 
				
			||||||
 		fi
 | 
					 | 
				
			||||||
 	fi
 | 
					 | 
				
			||||||
 	LIBS="$LIBS -lcrypto"
 | 
					 | 
				
			||||||
----- snip:end -----
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The general answer is to check the config.log file generated when running
 | 
				
			||||||
 | 
					the OpenSSH configure script. It should contain the detailed information
 | 
				
			||||||
 | 
					on why the OpenSSL library was not detected or considered incompatible.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
* Can I use OpenSSL's SSL library with non-blocking I/O?
 | 
					* Can I use OpenSSL's SSL library with non-blocking I/O?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -543,5 +710,20 @@ requiring a bi-directional message exchange; both SSL_read() and
 | 
				
			|||||||
SSL_write() will try to continue any pending handshake.
 | 
					SSL_write() will try to continue any pending handshake.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* Why doesn't my server application receive a client certificate?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Due to the TLS protocol definition, a client will only send a certificate,
 | 
				
			||||||
 | 
					if explicitly asked by the server. Use the SSL_VERIFY_PEER flag of the
 | 
				
			||||||
 | 
					SSL_CTX_set_verify() function to enable the use of client certificates.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* Why does compilation fail due to an undefined symbol NID_uniqueIdentifier?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					For OpenSSL 0.9.7 the OID table was extended and corrected. In earlier
 | 
				
			||||||
 | 
					versions, uniqueIdentifier was incorrectly used for X.509 certificates.
 | 
				
			||||||
 | 
					The correct name according to RFC2256 (LDAP) is x500UniqueIdentifier.
 | 
				
			||||||
 | 
					Change your code to use the new name when compiling against OpenSSL 0.9.7.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
===============================================================================
 | 
					===============================================================================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										45
									
								
								INSTALL
									
									
									
									
									
								
							
							
						
						
									
										45
									
								
								INSTALL
									
									
									
									
									
								
							@@ -2,13 +2,18 @@
 | 
				
			|||||||
 INSTALLATION ON THE UNIX PLATFORM
 | 
					 INSTALLATION ON THE UNIX PLATFORM
 | 
				
			||||||
 ---------------------------------
 | 
					 ---------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 [Installation on Windows, OpenVMS and MacOS (before MacOS X) is described
 | 
					 [Installation on DOS (with djgpp), Windows, OpenVMS and MacOS (before MacOS X)
 | 
				
			||||||
  in INSTALL.W32, INSTALL.VMS and INSTALL.MacOS.]
 | 
					  is described in INSTALL.DJGPP, INSTALL.W32, INSTALL.VMS and INSTALL.MacOS.
 | 
				
			||||||
 | 
					  This document describes installation on operating systems in the Unix
 | 
				
			||||||
 | 
					  family.]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 To install OpenSSL, you will need:
 | 
					 To install OpenSSL, you will need:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  * make
 | 
				
			||||||
  * Perl 5
 | 
					  * Perl 5
 | 
				
			||||||
  * an ANSI C compiler
 | 
					  * an ANSI C compiler
 | 
				
			||||||
 | 
					  * a development environment in form of development libraries and C
 | 
				
			||||||
 | 
					    header files
 | 
				
			||||||
  * a supported Unix operating system
 | 
					  * a supported Unix operating system
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 Quick Start
 | 
					 Quick Start
 | 
				
			||||||
@@ -50,6 +55,15 @@
 | 
				
			|||||||
                This will usually require additional system-dependent options!
 | 
					                This will usually require additional system-dependent options!
 | 
				
			||||||
                See "Note on multi-threading" below.
 | 
					                See "Note on multi-threading" below.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  no-zlib       Don't try to build with support for zlib compression and
 | 
				
			||||||
 | 
					                decompression.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  zlib          Build with support for zlib compression/decompression.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  zlib-dynamic  Like "zlib", but has OpenSSL load the zlib library dynamically
 | 
				
			||||||
 | 
					                when needed.  This is only supported on systems where loading
 | 
				
			||||||
 | 
					                of shared libraries is supported.  This is the default choice.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  no-shared     Don't try to create shared libraries.
 | 
					  no-shared     Don't try to create shared libraries.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  shared        In addition to the usual static libraries, create shared
 | 
					  shared        In addition to the usual static libraries, create shared
 | 
				
			||||||
@@ -125,8 +139,11 @@
 | 
				
			|||||||
     the failure that aren't problems in OpenSSL itself (like missing
 | 
					     the failure that aren't problems in OpenSSL itself (like missing
 | 
				
			||||||
     standard headers).  If it is a problem with OpenSSL itself, please
 | 
					     standard headers).  If it is a problem with OpenSSL itself, please
 | 
				
			||||||
     report the problem to <openssl-bugs@openssl.org> (note that your
 | 
					     report the problem to <openssl-bugs@openssl.org> (note that your
 | 
				
			||||||
     message will be forwarded to a public mailing list).  Include the
 | 
					     message will be recorded in the request tracker publicly readable
 | 
				
			||||||
     output of "make report" in your message.
 | 
					     via http://www.openssl.org/rt2.html and will be forwarded to a public
 | 
				
			||||||
 | 
					     mailing list). Include the output of "make report" in your message.
 | 
				
			||||||
 | 
					     Please check out the request tracker. Maybe the bug was already
 | 
				
			||||||
 | 
					     reported or has already been fixed.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
     [If you encounter assembler error messages, try the "no-asm"
 | 
					     [If you encounter assembler error messages, try the "no-asm"
 | 
				
			||||||
     configuration option as an immediate fix.]
 | 
					     configuration option as an immediate fix.]
 | 
				
			||||||
@@ -144,7 +161,8 @@
 | 
				
			|||||||
     try removing any compiler optimization flags from the CFLAGS line
 | 
					     try removing any compiler optimization flags from the CFLAGS line
 | 
				
			||||||
     in Makefile.ssl and run "make clean; make". Please send a bug
 | 
					     in Makefile.ssl and run "make clean; make". Please send a bug
 | 
				
			||||||
     report to <openssl-bugs@openssl.org>, including the output of
 | 
					     report to <openssl-bugs@openssl.org>, including the output of
 | 
				
			||||||
     "make report".
 | 
					     "make report" in order to be added to the request tracker at
 | 
				
			||||||
 | 
					     http://www.openssl.org/rt2.html.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  4. If everything tests ok, install OpenSSL with
 | 
					  4. If everything tests ok, install OpenSSL with
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -266,6 +284,11 @@
 | 
				
			|||||||
 Note on shared libraries
 | 
					 Note on shared libraries
 | 
				
			||||||
 ------------------------
 | 
					 ------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 Shared library is currently an experimental feature.  The only reason to
 | 
				
			||||||
 | 
					 have them would be to conserve memory on systems where several program
 | 
				
			||||||
 | 
					 are using OpenSSL.  Binary backward compatibility can't be guaranteed
 | 
				
			||||||
 | 
					 before OpenSSL version 1.0.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 For some systems, the OpenSSL Configure script knows what is needed to
 | 
					 For some systems, the OpenSSL Configure script knows what is needed to
 | 
				
			||||||
 build shared libraries for libcrypto and libssl.  On these systems,
 | 
					 build shared libraries for libcrypto and libssl.  On these systems,
 | 
				
			||||||
 the shared libraries are currently not created by default, but giving
 | 
					 the shared libraries are currently not created by default, but giving
 | 
				
			||||||
@@ -273,3 +296,15 @@
 | 
				
			|||||||
 targets for shared library creation, like linux-shared.  Those targets
 | 
					 targets for shared library creation, like linux-shared.  Those targets
 | 
				
			||||||
 can currently be used on their own just as well, but this is expected
 | 
					 can currently be used on their own just as well, but this is expected
 | 
				
			||||||
 to change in future versions of OpenSSL.
 | 
					 to change in future versions of OpenSSL.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 Note on random number generation
 | 
				
			||||||
 | 
					 --------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 Availability of cryptographically secure random numbers is required for
 | 
				
			||||||
 | 
					 secret key generation. OpenSSL provides several options to seed the
 | 
				
			||||||
 | 
					 internal PRNG. If not properly seeded, the internal PRNG will refuse
 | 
				
			||||||
 | 
					 to deliver random bytes and a "PRNG not seeded error" will occur.
 | 
				
			||||||
 | 
					 On systems without /dev/urandom (or similar) device, it may be necessary
 | 
				
			||||||
 | 
					 to install additional support software to obtain random seed.
 | 
				
			||||||
 | 
					 Please check out the manual pages for RAND_add(), RAND_bytes(), RAND_egd(),
 | 
				
			||||||
 | 
					 and the FAQ for more information.
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										32
									
								
								INSTALL.DJGPP
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								INSTALL.DJGPP
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,32 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					 INSTALLATION ON THE DOS PLATFORM WITH DJGPP
 | 
				
			||||||
 | 
					 -------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 Openssl has been ported to DOS, but only with long filename support. If
 | 
				
			||||||
 | 
					 you wish to compile on native DOS with 8+3 filenames, you will have to
 | 
				
			||||||
 | 
					 tweak the installation yourself, including renaming files with illegal
 | 
				
			||||||
 | 
					 or duplicate names.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 You should have a full DJGPP environment installed, including the
 | 
				
			||||||
 | 
					 latest versions of DJGPP, GCC, BINUTILS, BASH, etc. This package
 | 
				
			||||||
 | 
					 requires that PERL and BC also be installed.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 All of these can be obtained from the usual DJGPP mirror sites, such as
 | 
				
			||||||
 | 
					 "ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp". You also need to have
 | 
				
			||||||
 | 
					 the WATT-32 networking package installed before you try to compile
 | 
				
			||||||
 | 
					 openssl. This can be obtained from "http://www.bgnett.no/~giva/". The
 | 
				
			||||||
 | 
					 Makefile assumes that the WATT-32 code is in directory "watt32" under
 | 
				
			||||||
 | 
					 /dev/env/DJDIR.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 To compile openssl, start your BASH shell. Then configure for DOS by
 | 
				
			||||||
 | 
					 running "./Configure" with appropriate arguments. The basic syntax for
 | 
				
			||||||
 | 
					 DOS is:
 | 
				
			||||||
 | 
					 ./Configure no-threads --prefix=/dev/env/DJDIR DJGPP
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					 You may run out of DPMI selectors when running in a DOS box under
 | 
				
			||||||
 | 
					 Windows. If so, just close the BASH shell, go back to Windows, and
 | 
				
			||||||
 | 
					 restart BASH. Then run "make" again.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 Building openssl under DJGPP has been tested with DJGPP 2.03,
 | 
				
			||||||
 | 
					 GCC 2.952, GCC 2.953, perl 5.005_02 and perl 5.006_01.
 | 
				
			||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
OpenSSL - Port To The Macintosh
 | 
					OpenSSL - Port To The Macintosh OS 9 or Earlier
 | 
				
			||||||
===============================
 | 
					===============================================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Thanks to Roy Wood <roy@centricsystems.ca> initial support for MacOS (pre
 | 
					Thanks to Roy Wood <roy@centricsystems.ca> initial support for Mac OS (pre
 | 
				
			||||||
X) is now provided. "Initial" means that unlike other platforms where you
 | 
					X) is now provided. "Initial" means that unlike other platforms where you
 | 
				
			||||||
get an SDK and a "swiss army" openssl application, on Macintosh you only
 | 
					get an SDK and a "swiss army" openssl application, on Macintosh you only
 | 
				
			||||||
get one sample application which fetches a page over HTTPS(*) and dumps it
 | 
					get one sample application which fetches a page over HTTPS(*) and dumps it
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										31
									
								
								INSTALL.OS2
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								INSTALL.OS2
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,31 @@
 | 
				
			|||||||
 | 
					 
 | 
				
			||||||
 | 
					 Installation on OS/2
 | 
				
			||||||
 | 
					 --------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 You need to have the following tools installed:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  * EMX GCC
 | 
				
			||||||
 | 
					  * PERL
 | 
				
			||||||
 | 
					  * GNU make
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 To build the makefile, run
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 > os2\os2-emx
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 This will configure OpenSSL and create OS2-EMX.mak which you then use to 
 | 
				
			||||||
 | 
					 build the OpenSSL libraries & programs by running
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 > make -f os2-emx.mak
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 If that finishes successfully you will find the libraries and programs in the
 | 
				
			||||||
 | 
					 "out" directory.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 Alternatively, you can make a dynamic build that puts the library code into
 | 
				
			||||||
 | 
					 crypto.dll and ssl.dll by running
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 > make -f os2-emx-dll.mak
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 This will build the above mentioned dlls and a matching pair of import
 | 
				
			||||||
 | 
					 libraries in the "out_dll" directory along with the set of test programs
 | 
				
			||||||
 | 
					 and the openssl application.
 | 
				
			||||||
							
								
								
									
										22
									
								
								INSTALL.VMS
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								INSTALL.VMS
									
									
									
									
									
								
							@@ -8,6 +8,7 @@ Intro:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
This file is divided in the following parts:
 | 
					This file is divided in the following parts:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Requirements			- Mandatory reading.
 | 
				
			||||||
  Checking the distribution	- Mandatory reading.
 | 
					  Checking the distribution	- Mandatory reading.
 | 
				
			||||||
  Compilation			- Mandatory reading.
 | 
					  Compilation			- Mandatory reading.
 | 
				
			||||||
  Logical names			- Mandatory reading.
 | 
					  Logical names			- Mandatory reading.
 | 
				
			||||||
@@ -19,15 +20,24 @@ This file is divided in the following parts:
 | 
				
			|||||||
  TODO				- Things that are to come.
 | 
					  TODO				- Things that are to come.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Requirements:
 | 
				
			||||||
 | 
					=============
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					To build and install OpenSSL, you will need:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 * DEC C or some other ANSI C compiler.  VAX C is *not* supported.
 | 
				
			||||||
 | 
					   [Note: OpenSSL has only been tested with DEC C.  Compiling with 
 | 
				
			||||||
 | 
					    a different ANSI C compiler may require some work]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Checking the distribution:
 | 
					Checking the distribution:
 | 
				
			||||||
==========================
 | 
					==========================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
There have been reports of places where the distribution didn't quite get
 | 
					There have been reports of places where the distribution didn't quite get
 | 
				
			||||||
through, for example if you've copied the tree from a NFS-mounted unix
 | 
					through, for example if you've copied the tree from a NFS-mounted Unix
 | 
				
			||||||
mount point.
 | 
					mount point.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
The easiest way to check if everything got through as it should is to check
 | 
					The easiest way to check if everything got through as it should is to check
 | 
				
			||||||
for oen of the following files:
 | 
					for one of the following files:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	[.CRYPTO]OPENSSLCONF.H_IN
 | 
						[.CRYPTO]OPENSSLCONF.H_IN
 | 
				
			||||||
	[.CRYPTO]OPENSSLCONF_H.IN
 | 
						[.CRYPTO]OPENSSLCONF_H.IN
 | 
				
			||||||
@@ -59,7 +69,7 @@ for a command procedure name xxx-LIB.COM (in the library directories)
 | 
				
			|||||||
or MAKExxx.COM (in the program directories) and read the comments at
 | 
					or MAKExxx.COM (in the program directories) and read the comments at
 | 
				
			||||||
the top to understand how to use them.  However, if you want to
 | 
					the top to understand how to use them.  However, if you want to
 | 
				
			||||||
compile all you can get, the simplest is to use MAKEVMS.COM in the top
 | 
					compile all you can get, the simplest is to use MAKEVMS.COM in the top
 | 
				
			||||||
directory.  The syntax is trhe following:
 | 
					directory.  The syntax is the following:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @MAKEVMS <option> <rsaref-p> <debug-p> [<compiler>]
 | 
					  @MAKEVMS <option> <rsaref-p> <debug-p> [<compiler>]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -69,7 +79,7 @@ directory.  The syntax is trhe following:
 | 
				
			|||||||
      CONFIG    Just build the "[.CRYPTO]OPENSSLCONF.H" file.
 | 
					      CONFIG    Just build the "[.CRYPTO]OPENSSLCONF.H" file.
 | 
				
			||||||
      BUILDINF  Just build the "[.INCLUDE]BUILDINF.H" file.
 | 
					      BUILDINF  Just build the "[.INCLUDE]BUILDINF.H" file.
 | 
				
			||||||
      SOFTLINKS Just copies some files, to simulate Unix soft links.
 | 
					      SOFTLINKS Just copies some files, to simulate Unix soft links.
 | 
				
			||||||
      BUILDALL  Same as ALL, except CONFIG, BUILDINF and SOFTILNKS aren't done.
 | 
					      BUILDALL  Same as ALL, except CONFIG, BUILDINF and SOFTLINKS aren't done.
 | 
				
			||||||
      RSAREF    Just build the "[.xxx.EXE.RSAREF]LIBRSAGLUE.OLB" library.
 | 
					      RSAREF    Just build the "[.xxx.EXE.RSAREF]LIBRSAGLUE.OLB" library.
 | 
				
			||||||
      CRYPTO    Just build the "[.xxx.EXE.CRYPTO]LIBCRYPTO.OLB" library.
 | 
					      CRYPTO    Just build the "[.xxx.EXE.CRYPTO]LIBCRYPTO.OLB" library.
 | 
				
			||||||
      SSL       Just build the "[.xxx.EXE.SSL]LIBSSL.OLB" library.
 | 
					      SSL       Just build the "[.xxx.EXE.SSL]LIBSSL.OLB" library.
 | 
				
			||||||
@@ -82,7 +92,7 @@ directory.  The syntax is trhe following:
 | 
				
			|||||||
      RSAREF    compile using the RSAREF Library
 | 
					      RSAREF    compile using the RSAREF Library
 | 
				
			||||||
      NORSAREF  compile without using RSAREF
 | 
					      NORSAREF  compile without using RSAREF
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Note 0: The RASREF library IS NO LONGER NEEDED.  The RSA patent
 | 
					Note 0: The RSAREF library IS NO LONGER NEEDED.  The RSA patent
 | 
				
			||||||
        expires September 20, 2000, and RSA Security chose to make
 | 
					        expires September 20, 2000, and RSA Security chose to make
 | 
				
			||||||
        the algorithm public domain two weeks before that.
 | 
					        the algorithm public domain two weeks before that.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -254,7 +264,7 @@ following before you start compiling:
 | 
				
			|||||||
The USER_CCDISABLEWARNINGS is there because otherwise, DEC C will complain
 | 
					The USER_CCDISABLEWARNINGS is there because otherwise, DEC C will complain
 | 
				
			||||||
that those macros have been changed.
 | 
					that those macros have been changed.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Note: Currently, this is only usefull for library compilation.  The
 | 
					Note: Currently, this is only useful for library compilation.  The
 | 
				
			||||||
      programs will still be linked with the current version of the
 | 
					      programs will still be linked with the current version of the
 | 
				
			||||||
      C library shareable image, and will thus complain if they are
 | 
					      C library shareable image, and will thus complain if they are
 | 
				
			||||||
      faced with an older version of the same C library shareable image.
 | 
					      faced with an older version of the same C library shareable image.
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										87
									
								
								INSTALL.W32
									
									
									
									
									
								
							
							
						
						
									
										87
									
								
								INSTALL.W32
									
									
									
									
									
								
							@@ -2,16 +2,21 @@
 | 
				
			|||||||
 INSTALLATION ON THE WIN32 PLATFORM
 | 
					 INSTALLATION ON THE WIN32 PLATFORM
 | 
				
			||||||
 ----------------------------------
 | 
					 ----------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 Heres a few comments about building OpenSSL in Windows environments. Most of
 | 
					 [Instructions for building for Windows CE can be found in INSTALL.WCE]
 | 
				
			||||||
 this is tested on Win32 but it may also work in Win 3.1 with some
 | 
					
 | 
				
			||||||
 | 
					 Heres a few comments about building OpenSSL in Windows environments.  Most
 | 
				
			||||||
 | 
					 of this is tested on Win32 but it may also work in Win 3.1 with some
 | 
				
			||||||
 modification.
 | 
					 modification.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 You need Perl for Win32 (available from http://www.activestate.com/ActivePerl)
 | 
					 You need Perl for Win32.  Unless you will build on Cygwin, you will need
 | 
				
			||||||
 | 
					 ActiveState Perl, available from http://www.activestate.com/ActivePerl.
 | 
				
			||||||
 | 
					 For Cygwin users, there's more info in the Cygwin section.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 and one of the following C compilers:
 | 
					 and one of the following C compilers:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  * Visual C++
 | 
					  * Visual C++
 | 
				
			||||||
  * Borland C
 | 
					  * Borland C
 | 
				
			||||||
  * GNU C (Mingw32 or Cygwin32)
 | 
					  * GNU C (Mingw32 or Cygwin)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 If you want to compile in the assembly language routines with Visual C++ then
 | 
					 If you want to compile in the assembly language routines with Visual C++ then
 | 
				
			||||||
 you will need an assembler. This is worth doing because it will result in
 | 
					 you will need an assembler. This is worth doing because it will result in
 | 
				
			||||||
@@ -78,8 +83,9 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 There are various changes you can make to the Win32 compile environment. By
 | 
					 There are various changes you can make to the Win32 compile environment. By
 | 
				
			||||||
 default the library is not compiled with debugging symbols. If you add 'debug'
 | 
					 default the library is not compiled with debugging symbols. If you add 'debug'
 | 
				
			||||||
 to the mk1mk.pl lines in the do_* batch file then debugging symbols will be
 | 
					 to the mk1mf.pl lines in the do_* batch file then debugging symbols will be
 | 
				
			||||||
 compiled in.
 | 
					 compiled in. Note that mk1mf.pl expects the platform to be the last argument
 | 
				
			||||||
 | 
					 on the command line, so 'debug' must appear before that, as all other options.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 The default Win32 environment is to leave out any Windows NT specific
 | 
					 The default Win32 environment is to leave out any Windows NT specific
 | 
				
			||||||
 features.
 | 
					 features.
 | 
				
			||||||
@@ -91,6 +97,18 @@
 | 
				
			|||||||
 You can also build a static version of the library using the Makefile
 | 
					 You can also build a static version of the library using the Makefile
 | 
				
			||||||
 ms\nt.mak
 | 
					 ms\nt.mak
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 Borland C++ builder 5
 | 
				
			||||||
 | 
					 ---------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 * Configure for building with Borland Builder:
 | 
				
			||||||
 | 
					   > perl Configure BC-32
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 * Create the appropriate makefile
 | 
				
			||||||
 | 
					   > ms\do_nasm
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 * Build
 | 
				
			||||||
 | 
					   > make -f ms\bcb.mak
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 Borland C++ builder 3 and 4
 | 
					 Borland C++ builder 3 and 4
 | 
				
			||||||
 ---------------------------
 | 
					 ---------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -109,10 +127,10 @@
 | 
				
			|||||||
 * Compiler installation:
 | 
					 * Compiler installation:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   Mingw32 is available from <ftp://ftp.xraylith.wisc.edu/pub/khan/
 | 
					   Mingw32 is available from <ftp://ftp.xraylith.wisc.edu/pub/khan/
 | 
				
			||||||
   gnu-win32/mingw32/gcc-2.95.2/gcc-2.95.2-msvcrt.exe>. GNU make is at
 | 
					   gnu-win32/mingw32/gcc-2.95.2/gcc-2.95.2-msvcrt.exe>. Extract it
 | 
				
			||||||
   <ftp://agnes.dida.physik.uni-essen.de/home/janjaap/mingw32/binaries/
 | 
					   to a directory such as C:\gcc-2.95.2 and add c:\gcc-2.95.2\bin to
 | 
				
			||||||
   make-3.76.1.zip>. Install both of them in C:\egcs-1.1.2 and run
 | 
					   the PATH environment variable in "System Properties"; or edit and
 | 
				
			||||||
   C:\egcs-1.1.2\mingw32.bat to set the PATH.
 | 
					   run C:\gcc-2.95.2\mingw32.bat to set the PATH.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 * Compile OpenSSL:
 | 
					 * Compile OpenSSL:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -134,28 +152,30 @@
 | 
				
			|||||||
   > cd out
 | 
					   > cd out
 | 
				
			||||||
   > ..\ms\test
 | 
					   > ..\ms\test
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 GNU C (CygWin32)
 | 
					 GNU C (Cygwin)
 | 
				
			||||||
 ---------------
 | 
					 --------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 CygWin32 provides a bash shell and GNU tools environment running on
 | 
					 Cygwin provides a bash shell and GNU tools environment running
 | 
				
			||||||
 NT 4.0, Windows 9x and Windows 2000. Consequently, a make of OpenSSL
 | 
					 on NT 4.0, Windows 9x, Windows ME, Windows 2000, and Windows XP.
 | 
				
			||||||
 with CygWin is closer to a GNU bash environment such as Linux rather
 | 
					 Consequently, a make of OpenSSL with Cygwin is closer to a GNU
 | 
				
			||||||
 than other W32 makes that are based on a single makefile approach.
 | 
					 bash environment such as Linux than to other W32 makes which are
 | 
				
			||||||
 CygWin32 implements Posix/Unix calls through cygwin1.dll, and is
 | 
					 based on a single makefile approach. Cygwin implements Posix/Unix
 | 
				
			||||||
 contrasted to Mingw32 which links dynamically to msvcrt.dll or
 | 
					 calls through cygwin1.dll, and is contrasted to Mingw32 which links
 | 
				
			||||||
 crtdll.dll.
 | 
					 dynamically to msvcrt.dll or crtdll.dll.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 To build OpenSSL using CygWin32:
 | 
					 To build OpenSSL using Cygwin:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 * Install CygWin32 (see http://sourceware.cygnus.com/cygwin)
 | 
					 * Install Cygwin (see http://cygwin.com/)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 * Install Perl and ensure it is in the path
 | 
					 * Install Perl and ensure it is in the path (recent Cygwin perl 
 | 
				
			||||||
 | 
					   (version 5.6.1-2 of the latter has been reported to work) or
 | 
				
			||||||
 | 
					   ActivePerl)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 * Run the CygWin bash shell
 | 
					 * Run the Cygwin bash shell
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 * $ tar zxvf openssl-x.x.x.tar.gz
 | 
					 * $ tar zxvf openssl-x.x.x.tar.gz
 | 
				
			||||||
   $ cd openssl-x.x.x
 | 
					   $ cd openssl-x.x.x
 | 
				
			||||||
   $ ./Configure no-threads CygWin32
 | 
					   $ ./config
 | 
				
			||||||
   [...]
 | 
					   [...]
 | 
				
			||||||
   $ make
 | 
					   $ make
 | 
				
			||||||
   [...]
 | 
					   [...]
 | 
				
			||||||
@@ -164,27 +184,24 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 This will create a default install in /usr/local/ssl.
 | 
					 This will create a default install in /usr/local/ssl.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 CygWin32 Notes:
 | 
					 Cygwin Notes:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 "make test" and normal file operations may fail in directories
 | 
					 "make test" and normal file operations may fail in directories
 | 
				
			||||||
 mounted as text (i.e. mount -t c:\somewhere /home) due to CygWin
 | 
					 mounted as text (i.e. mount -t c:\somewhere /home) due to Cygwin
 | 
				
			||||||
 stripping of carriage returns. To avoid this ensure that a binary
 | 
					 stripping of carriage returns. To avoid this ensure that a binary
 | 
				
			||||||
 mount is used, e.g. mount -b c:\somewhere /home.
 | 
					 mount is used, e.g. mount -b c:\somewhere /home.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 As of version 1.1.1 CygWin32 is relatively unstable in its handling
 | 
					 "bc" is not provided in older Cygwin distribution.  This causes a
 | 
				
			||||||
 of cr/lf issues. These make procedures succeeded with versions 1.1 and
 | 
					 | 
				
			||||||
 the snapshot 20000524 (Slow!).
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 "bc" is not provided in the CygWin32 distribution.  This causes a
 | 
					 | 
				
			||||||
 non-fatal error in "make test" but is otherwise harmless.  If
 | 
					 non-fatal error in "make test" but is otherwise harmless.  If
 | 
				
			||||||
 desired, GNU bc can be built with CygWin32 without change.
 | 
					 desired and needed, GNU bc can be built with Cygwin without change.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 Installation
 | 
					 Installation
 | 
				
			||||||
 ------------
 | 
					 ------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 There's currently no real installation procedure for Win32.  There are,
 | 
					 If you used the Cygwin procedure above, you have already installed and
 | 
				
			||||||
 however, some suggestions:
 | 
					 can skip this section.  For all other procedures, there's currently no real
 | 
				
			||||||
 | 
					 installation procedure for Win32.  There are, however, some suggestions:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    - do nothing.  The include files are found in the inc32/ subdirectory,
 | 
					    - do nothing.  The include files are found in the inc32/ subdirectory,
 | 
				
			||||||
      all binaries are found in out32dll/ or out32/ depending if you built
 | 
					      all binaries are found in out32dll/ or out32/ depending if you built
 | 
				
			||||||
@@ -256,5 +273,5 @@
 | 
				
			|||||||
 malloc(), free() and realloc() as the application.  However there are many
 | 
					 malloc(), free() and realloc() as the application.  However there are many
 | 
				
			||||||
 standard library functions used by OpenSSL that call malloc() internally
 | 
					 standard library functions used by OpenSSL that call malloc() internally
 | 
				
			||||||
 (e.g. fopen()), and OpenSSL cannot change these; so in general you cannot
 | 
					 (e.g. fopen()), and OpenSSL cannot change these; so in general you cannot
 | 
				
			||||||
 rely on CYRPTO_malloc_init() solving your problem, and you should
 | 
					 rely on CRYPTO_malloc_init() solving your problem, and you should
 | 
				
			||||||
 consistently use the multithreaded library.
 | 
					 consistently use the multithreaded library.
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										68
									
								
								INSTALL.WCE
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										68
									
								
								INSTALL.WCE
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,68 @@
 | 
				
			|||||||
 | 
					 
 | 
				
			||||||
 | 
					 INSTALLATION FOR THE WINDOWS CE PLATFORM
 | 
				
			||||||
 | 
					 ----------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 Building OpenSSL for Windows CE requires the following external tools:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  * Microsoft eMbedded Visual C++ 3.0
 | 
				
			||||||
 | 
					  * wcecompat compatibility library (www.essemer.com.au)
 | 
				
			||||||
 | 
					  * Optionally ceutils for running automated tests (www.essemer.com.au)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 You also need Perl for Win32.  You will need ActiveState Perl, available
 | 
				
			||||||
 | 
					 from http://www.activestate.com/ActivePerl.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 The C Runtime Library implementation for Windows CE that is included with
 | 
				
			||||||
 | 
					 Microsoft eMbedded Visual C++ 3.0 is incomplete and in some places
 | 
				
			||||||
 | 
					 incorrect.  wcecompat plugs the holes and tries to bring the Windows CE
 | 
				
			||||||
 | 
					 CRT to a level that is more compatible with ANSI C.  wcecompat goes further
 | 
				
			||||||
 | 
					 and provides low-level IO and stream IO support for stdin/stdout/stderr
 | 
				
			||||||
 | 
					 (which Windows CE does not provide).  This IO functionality is not needed
 | 
				
			||||||
 | 
					 by the OpenSSL library itself but is used for the tests and openssl.exe.
 | 
				
			||||||
 | 
					 More information is available at www.essemer.com.au.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 Building
 | 
				
			||||||
 | 
					 --------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 Setup the eMbedded Visual C++ environment.  There are batch files for doing
 | 
				
			||||||
 | 
					 this installed with eVC++.  For an ARM processor, for example, execute:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 > "C:\Program Files\Microsoft eMbedded Tools\EVC\WCE300\BIN\WCEARM.BAT"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 Next indicate where wcecompat is located:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 > set WCECOMPAT=C:\wcecompat
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 Next you should run Configure:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 > perl Configure VC-CE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 Next you need to build the Makefiles:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 > ms\do_ms
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 If you get errors about things not having numbers assigned then check the
 | 
				
			||||||
 | 
					 troubleshooting section in INSTALL.W32: you probably won't be able to compile
 | 
				
			||||||
 | 
					 it as it stands.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 Then from the VC++ environment at a prompt do:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 - to build static libraries:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   > nmake -f ms\ce.mak
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 - or to build DLLs:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   > nmake -f ms\cedll.mak
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 If all is well it should compile and you will have some static libraries and
 | 
				
			||||||
 | 
					 executables in out32, or some DLLs and executables in out32dll.  If you want
 | 
				
			||||||
 | 
					 to try the tests then make sure the ceutils are in the path and do:
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					 > cd out32
 | 
				
			||||||
 | 
					 > ..\ms\testce
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 This will copy each of the test programs to the Windows CE device and execute
 | 
				
			||||||
 | 
					 them, displaying the output of the tests on this computer.  The output should
 | 
				
			||||||
 | 
					 look similar to the output produced by running the tests for a regular Windows
 | 
				
			||||||
 | 
					 build.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										2
									
								
								LICENSE
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								LICENSE
									
									
									
									
									
								
							@@ -12,7 +12,7 @@
 | 
				
			|||||||
  ---------------
 | 
					  ---------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* ====================================================================
 | 
					/* ====================================================================
 | 
				
			||||||
 * Copyright (c) 1998-2001 The OpenSSL Project.  All rights reserved.
 | 
					 * Copyright (c) 1998-2002 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
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1287,7 +1287,7 @@ EXITPOINT:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
//	Send some bytes
 | 
					//	Send some bytes
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int MacSocket_send(const int inSocketNum,void *inBuff,int inBuffLength)
 | 
					int MacSocket_send(const int inSocketNum,const void *inBuff,int inBuffLength)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
OSErr			errCode = noErr;
 | 
					OSErr			errCode = noErr;
 | 
				
			||||||
int				bytesSent = 0;
 | 
					int				bytesSent = 0;
 | 
				
			||||||
@@ -1604,4 +1604,4 @@ EPInfo* epi = (EPInfo*) context;
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -62,7 +62,7 @@ int MacSocket_recv(const int inSocketNum,void *outBuff,int outBuffLength,const B
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
//	Call this to send data on a socket
 | 
					//	Call this to send data on a socket
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int MacSocket_send(const int inSocketNum,void *inBuff,int inBuffLength);
 | 
					int MacSocket_send(const int inSocketNum,const void *inBuff,int inBuffLength);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//	If zero bytes were read in a call to MacSocket_recv(), it may be that the remote end has done a half-close
 | 
					//	If zero bytes were read in a call to MacSocket_recv(), it may be that the remote end has done a half-close
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										396
									
								
								Makefile.org
									
									
									
									
									
								
							
							
						
						
									
										396
									
								
								Makefile.org
									
									
									
									
									
								
							@@ -56,9 +56,11 @@ CC= gcc
 | 
				
			|||||||
#CFLAG= -DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m486 -Wall -Wuninitialized -DSHA1_ASM -DMD5_ASM -DRMD160_ASM
 | 
					#CFLAG= -DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m486 -Wall -Wuninitialized -DSHA1_ASM -DMD5_ASM -DRMD160_ASM
 | 
				
			||||||
CFLAG= -DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall -DSHA1_ASM -DMD5_ASM -DRMD160_ASM
 | 
					CFLAG= -DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall -DSHA1_ASM -DMD5_ASM -DRMD160_ASM
 | 
				
			||||||
DEPFLAG= 
 | 
					DEPFLAG= 
 | 
				
			||||||
PEX_LIBS= -L. -L.. -L../.. -L../../..
 | 
					PEX_LIBS= 
 | 
				
			||||||
EX_LIBS= 
 | 
					EX_LIBS= 
 | 
				
			||||||
AR=ar r
 | 
					EXE_EXT= 
 | 
				
			||||||
 | 
					ARFLAGS=
 | 
				
			||||||
 | 
					AR=ar $(ARFLAGS) r
 | 
				
			||||||
RANLIB= ranlib
 | 
					RANLIB= ranlib
 | 
				
			||||||
PERL= perl
 | 
					PERL= perl
 | 
				
			||||||
TAR= tar
 | 
					TAR= tar
 | 
				
			||||||
@@ -165,9 +167,9 @@ SHLIBDIRS= crypto ssl
 | 
				
			|||||||
SDIRS=  \
 | 
					SDIRS=  \
 | 
				
			||||||
	md2 md4 md5 sha mdc2 hmac ripemd \
 | 
						md2 md4 md5 sha mdc2 hmac ripemd \
 | 
				
			||||||
	des rc2 rc4 rc5 idea bf cast \
 | 
						des rc2 rc4 rc5 idea bf cast \
 | 
				
			||||||
	bn ec rsa dsa dh dso engine rijndael \
 | 
						bn ec rsa dsa dh dso engine aes \
 | 
				
			||||||
	buffer bio stack lhash rand err objects \
 | 
						buffer bio stack lhash rand err objects \
 | 
				
			||||||
	evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp
 | 
						evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp ui krb5
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# tests to perform.  "alltests" is a special word indicating that all tests
 | 
					# tests to perform.  "alltests" is a special word indicating that all tests
 | 
				
			||||||
# should be performed.
 | 
					# should be performed.
 | 
				
			||||||
@@ -190,6 +192,7 @@ SHARED_CRYPTO=libcrypto$(SHLIB_EXT)
 | 
				
			|||||||
SHARED_SSL=libssl$(SHLIB_EXT)
 | 
					SHARED_SSL=libssl$(SHLIB_EXT)
 | 
				
			||||||
SHARED_LIBS=
 | 
					SHARED_LIBS=
 | 
				
			||||||
SHARED_LIBS_LINK_EXTS=
 | 
					SHARED_LIBS_LINK_EXTS=
 | 
				
			||||||
 | 
					SHARED_LDFLAGS=
 | 
				
			||||||
 | 
					
 | 
				
			||||||
GENERAL=        Makefile
 | 
					GENERAL=        Makefile
 | 
				
			||||||
BASENAME=       openssl
 | 
					BASENAME=       openssl
 | 
				
			||||||
@@ -202,23 +205,18 @@ HEADER=         e_os.h
 | 
				
			|||||||
# When we're prepared to use shared libraries in the programs we link here
 | 
					# When we're prepared to use shared libraries in the programs we link here
 | 
				
			||||||
# we might remove 'clean-shared' from the targets to perform at this stage
 | 
					# we might remove 'clean-shared' from the targets to perform at this stage
 | 
				
			||||||
 | 
					
 | 
				
			||||||
all: clean-shared Makefile.ssl sub_all
 | 
					all: Makefile.ssl sub_all openssl.pc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
sub_all:
 | 
					sub_all:
 | 
				
			||||||
	@for i in $(DIRS); \
 | 
						@for i in $(DIRS); \
 | 
				
			||||||
	do \
 | 
						do \
 | 
				
			||||||
	if [ -d "$$i" ]; then \
 | 
						if [ -d "$$i" ]; then \
 | 
				
			||||||
		(cd $$i && echo "making all in $$i..." && \
 | 
							(cd $$i && echo "making all in $$i..." && \
 | 
				
			||||||
		$(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' SDIRS='$(SDIRS)' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' KRB5_INCLUDES='${KRB5_INCLUDES}' LIBKRB5='${LIBKRB5}' all ) || exit 1; \
 | 
							$(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' SDIRS='$(SDIRS)' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' KRB5_INCLUDES='${KRB5_INCLUDES}' LIBKRB5='${LIBKRB5}' EXE_EXT='${EXE_EXT}' SHARED_LIBS='${SHARED_LIBS}' SHLIB_EXT='${SHLIB_EXT}' SHLIB_TARGET='${SHLIB_TARGET}' all ) || exit 1; \
 | 
				
			||||||
	else \
 | 
						else \
 | 
				
			||||||
		$(MAKE) $$i; \
 | 
							$(MAKE) $$i; \
 | 
				
			||||||
	fi; \
 | 
						fi; \
 | 
				
			||||||
	done; \
 | 
						done;
 | 
				
			||||||
	if echo "$(DIRS)" | \
 | 
					 | 
				
			||||||
	    egrep '(^| )(crypto|ssl)( |$$)' > /dev/null 2>&1 && \
 | 
					 | 
				
			||||||
	   [ -n "$(SHARED_LIBS)" ]; then \
 | 
					 | 
				
			||||||
		$(MAKE) $(SHARED_LIBS); \
 | 
					 | 
				
			||||||
	fi
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
libcrypto$(SHLIB_EXT): libcrypto.a
 | 
					libcrypto$(SHLIB_EXT): libcrypto.a
 | 
				
			||||||
	@if [ "$(SHLIB_TARGET)" != "" ]; then \
 | 
						@if [ "$(SHLIB_TARGET)" != "" ]; then \
 | 
				
			||||||
@@ -226,9 +224,10 @@ libcrypto$(SHLIB_EXT): libcrypto.a
 | 
				
			|||||||
	else \
 | 
						else \
 | 
				
			||||||
		echo "There's no support for shared libraries on this platform" >&2; \
 | 
							echo "There's no support for shared libraries on this platform" >&2; \
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
libssl$(SHLIB_EXT): libcrypto$(SHLIB_EXT) libssl.a
 | 
					libssl$(SHLIB_EXT): libcrypto$(SHLIB_EXT) libssl.a
 | 
				
			||||||
	@if [ "$(SHLIB_TARGET)" != "" ]; then \
 | 
						@if [ "$(SHLIB_TARGET)" != "" ]; then \
 | 
				
			||||||
		$(MAKE) SHLIBDIRS=ssl SHLIBDEPS='-L. -lcrypto' build-shared; \
 | 
							$(MAKE) SHLIBDIRS=ssl SHLIBDEPS='-lcrypto' build-shared; \
 | 
				
			||||||
	else \
 | 
						else \
 | 
				
			||||||
		echo "There's no support for shared libraries on this platform" >&2; \
 | 
							echo "There's no support for shared libraries on this platform" >&2; \
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
@@ -242,58 +241,180 @@ clean-shared:
 | 
				
			|||||||
			done; \
 | 
								done; \
 | 
				
			||||||
		fi; \
 | 
							fi; \
 | 
				
			||||||
		( set -x; rm -f lib$$i$(SHLIB_EXT) ); \
 | 
							( set -x; rm -f lib$$i$(SHLIB_EXT) ); \
 | 
				
			||||||
	done
 | 
							if [ "$(PLATFORM)" = "Cygwin" ]; then \
 | 
				
			||||||
 | 
								( set -x; rm -f cyg$$i-$(SHLIB_VERSION_NUMBER)$(SHLIB_EXT) lib$$i$(SHLIB_EXT).a ); \
 | 
				
			||||||
link-shared:
 | 
					 | 
				
			||||||
	@for i in $(SHLIBDIRS); do \
 | 
					 | 
				
			||||||
		prev=lib$$i$(SHLIB_EXT); \
 | 
					 | 
				
			||||||
		if [ -n "$(SHARED_LIBS_LINK_EXTS)" ]; then \
 | 
					 | 
				
			||||||
			tmp="$(SHARED_LIBS_LINK_EXTS)"; \
 | 
					 | 
				
			||||||
			for j in $${tmp:-x}; do \
 | 
					 | 
				
			||||||
				( set -x; ln -s -f $$prev lib$$i$$j ); \
 | 
					 | 
				
			||||||
				prev=lib$$i$$j; \
 | 
					 | 
				
			||||||
			done; \
 | 
					 | 
				
			||||||
		fi; \
 | 
							fi; \
 | 
				
			||||||
	done
 | 
						done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					link-shared:
 | 
				
			||||||
 | 
						@if [ -n "$(SHARED_LIBS_LINK_EXTS)" ]; then \
 | 
				
			||||||
 | 
							tmp="$(SHARED_LIBS_LINK_EXTS)"; \
 | 
				
			||||||
 | 
							for i in $(SHLIBDIRS); do \
 | 
				
			||||||
 | 
								prev=lib$$i$(SHLIB_EXT); \
 | 
				
			||||||
 | 
								for j in $${tmp:-x}; do \
 | 
				
			||||||
 | 
									( set -x; \
 | 
				
			||||||
 | 
									rm -f lib$$i$$j; ln -s $$prev lib$$i$$j ); \
 | 
				
			||||||
 | 
									prev=lib$$i$$j; \
 | 
				
			||||||
 | 
								done; \
 | 
				
			||||||
 | 
							done; \
 | 
				
			||||||
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
build-shared: clean-shared do_$(SHLIB_TARGET) link-shared
 | 
					build-shared: clean-shared do_$(SHLIB_TARGET) link-shared
 | 
				
			||||||
 | 
					
 | 
				
			||||||
do_bsd-gcc-shared: linux-shared
 | 
					do_bsd-gcc-shared: do_gnu-shared
 | 
				
			||||||
do_linux-shared:
 | 
					do_linux-shared: do_gnu-shared
 | 
				
			||||||
	libs='${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
 | 
					do_gnu-shared:
 | 
				
			||||||
	( set -x; ${CC}  -shared -o lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
 | 
						libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
 | 
				
			||||||
		-Wl,-S,-soname=lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
 | 
						( set -x; ${CC} ${SHARED_LDFLAGS} \
 | 
				
			||||||
 | 
							-shared -o lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
 | 
				
			||||||
 | 
							-Wl,-soname=lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
 | 
				
			||||||
 | 
							-Wl,-Bsymbolic \
 | 
				
			||||||
		-Wl,--whole-archive lib$$i.a \
 | 
							-Wl,--whole-archive lib$$i.a \
 | 
				
			||||||
		-Wl,--no-whole-archive $$libs ${EX_LIBS} -lc ) || exit 1; \
 | 
							-Wl,--no-whole-archive $$libs ${EX_LIBS} -lc ) || exit 1; \
 | 
				
			||||||
	libs="$$libs -L. -l$$i"; \
 | 
						libs="$$libs -l$$i"; \
 | 
				
			||||||
 | 
						done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					DETECT_GNU_LD=${CC} -v 2>&1 | grep '^gcc' >/dev/null 2>&1 && \
 | 
				
			||||||
 | 
						my_ld=`${CC} -print-prog-name=ld 2>&1` && \
 | 
				
			||||||
 | 
						[ -n "$$my_ld" ] && \
 | 
				
			||||||
 | 
						$$my_ld -v 2>&1 | grep 'GNU ld' >/dev/null 2>&1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# For Darwin AKA Mac OS/X (dyld)
 | 
				
			||||||
 | 
					do_darwin-shared: 
 | 
				
			||||||
 | 
						libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
 | 
				
			||||||
 | 
						( set -x ; ${CC} --verbose -dynamiclib -o lib$$i${SHLIB_EXT} \
 | 
				
			||||||
 | 
							lib$$i.a $$libs -all_load -current_version ${SHLIB_MAJOR}.${SHLIB_MINOR} \
 | 
				
			||||||
 | 
							-compatibility_version ${SHLIB_MAJOR}.`echo ${SHLIB_MINOR} | cut -d. -f1` \
 | 
				
			||||||
 | 
							-install_name ${INSTALLTOP}/lib/lib$$i${SHLIB_EXT} ) || exit 1; \
 | 
				
			||||||
 | 
						libs="$$libs -l`basename $$i${SHLIB_EXT} .dylib`"; \
 | 
				
			||||||
 | 
						echo "" ; \
 | 
				
			||||||
 | 
						done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					do_cygwin-shared:
 | 
				
			||||||
 | 
						libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
 | 
				
			||||||
 | 
						( set -x; ${CC}  -shared -o cyg$$i-$(SHLIB_VERSION_NUMBER).dll \
 | 
				
			||||||
 | 
							-Wl,-Bsymbolic \
 | 
				
			||||||
 | 
							-Wl,--whole-archive lib$$i.a \
 | 
				
			||||||
 | 
							-Wl,--out-implib,lib$$i.dll.a \
 | 
				
			||||||
 | 
							-Wl,--no-whole-archive $$libs ) || exit 1; \
 | 
				
			||||||
 | 
						libs="$$libs -l$$i"; \
 | 
				
			||||||
	done
 | 
						done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# This assumes that GNU utilities are *not* used
 | 
					# This assumes that GNU utilities are *not* used
 | 
				
			||||||
 | 
					do_alpha-osf1-shared:
 | 
				
			||||||
 | 
						if ${DETECT_GNU_LD}; then \
 | 
				
			||||||
 | 
							$(MAKE) do_gnu-shared; \
 | 
				
			||||||
 | 
						else \
 | 
				
			||||||
 | 
							libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
 | 
				
			||||||
 | 
							( set -x; ${CC} ${SHARED_LDFLAGS} \
 | 
				
			||||||
 | 
								-shared -o lib$$i.so \
 | 
				
			||||||
 | 
								-set_version "${SHLIB_VERSION_HISTORY}${SHLIB_VERSION_NUMBER}" \
 | 
				
			||||||
 | 
								-all lib$$i.a -none $$libs ${EX_LIBS} -lc ) || exit 1; \
 | 
				
			||||||
 | 
							libs="$$libs -l$$i"; \
 | 
				
			||||||
 | 
							done; \
 | 
				
			||||||
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# This assumes that GNU utilities are *not* used
 | 
				
			||||||
 | 
					# The difference between alpha-osf1-shared and tru64-shared is the `-msym'
 | 
				
			||||||
 | 
					# option passed to the linker.
 | 
				
			||||||
do_tru64-shared:
 | 
					do_tru64-shared:
 | 
				
			||||||
	libs='${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
 | 
						if ${DETECT_GNU_LD}; then \
 | 
				
			||||||
	( set -x; ${CC}  -shared -no_archive -o lib$$i.so \
 | 
							$(MAKE) do_gnu-shared; \
 | 
				
			||||||
		-set_version "${SHLIB_VERSION_HISTORY}${SHLIB_VERSION_NUMBER}" \
 | 
						else \
 | 
				
			||||||
		-all lib$$i.a -none $$libs ${EX_LIBS} -lc ) || exit 1; \
 | 
							libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
 | 
				
			||||||
	libs="$$libs -L. -l$$i"; \
 | 
							( set -x; ${CC} ${SHARED_LDFLAGS} \
 | 
				
			||||||
	done
 | 
								-shared -msym -o lib$$i.so \
 | 
				
			||||||
 | 
								-set_version "${SHLIB_VERSION_HISTORY}${SHLIB_VERSION_NUMBER}" \
 | 
				
			||||||
 | 
								-all lib$$i.a -none $$libs ${EX_LIBS} -lc ) || exit 1; \
 | 
				
			||||||
 | 
							libs="$$libs -l$$i"; \
 | 
				
			||||||
 | 
							done; \
 | 
				
			||||||
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# This assumes that GNU utilities are *not* used
 | 
				
			||||||
 | 
					# The difference between tru64-shared and tru64-shared-rpath is the
 | 
				
			||||||
 | 
					# -rpath ${INSTALLTOP}/lib passed to the linker.
 | 
				
			||||||
 | 
					do_tru64-shared-rpath:
 | 
				
			||||||
 | 
						if ${DETECT_GNU_LD}; then \
 | 
				
			||||||
 | 
							$(MAKE) do_gnu-shared; \
 | 
				
			||||||
 | 
						else \
 | 
				
			||||||
 | 
							libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
 | 
				
			||||||
 | 
							( set -x; ${CC} ${SHARED_LDFLAGS} \
 | 
				
			||||||
 | 
								-shared -msym -o lib$$i.so \
 | 
				
			||||||
 | 
								-rpath  ${INSTALLTOP}/lib \
 | 
				
			||||||
 | 
								-set_version "${SHLIB_VERSION_HISTORY}${SHLIB_VERSION_NUMBER}" \
 | 
				
			||||||
 | 
								-all lib$$i.a -none $$libs ${EX_LIBS} -lc ) || exit 1; \
 | 
				
			||||||
 | 
							libs="$$libs -l$$i"; \
 | 
				
			||||||
 | 
							done; \
 | 
				
			||||||
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# This assumes that GNU utilities are *not* used
 | 
					# This assumes that GNU utilities are *not* used
 | 
				
			||||||
do_solaris-shared:
 | 
					do_solaris-shared:
 | 
				
			||||||
	libs='${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
 | 
						if ${DETECT_GNU_LD}; then \
 | 
				
			||||||
	( set -x; ${CC}  -G -o lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
 | 
							$(MAKE) do_gnu-shared; \
 | 
				
			||||||
		-h lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
 | 
						else \
 | 
				
			||||||
		-z allextract lib$$i.a $$libs ${EX_LIBS} -lc ) || exit 1; \
 | 
							libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
 | 
				
			||||||
	libs="$$libs -L. -l$$i"; \
 | 
							( PATH=/usr/ccs/bin:$$PATH ; export PATH; \
 | 
				
			||||||
	done
 | 
							  set -x; ${CC} ${SHARED_LDFLAGS} \
 | 
				
			||||||
 | 
								-G -o lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
 | 
				
			||||||
 | 
								-h lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
 | 
				
			||||||
 | 
								-z allextract lib$$i.a $$libs ${EX_LIBS} -lc ) || exit 1; \
 | 
				
			||||||
 | 
							libs="$$libs -l$$i"; \
 | 
				
			||||||
 | 
							done; \
 | 
				
			||||||
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# OpenServer 5 native compilers used
 | 
				
			||||||
 | 
					do_svr3-shared:
 | 
				
			||||||
 | 
						if ${DETECT_GNU_LD}; then \
 | 
				
			||||||
 | 
							$(MAKE) do_gnu-shared; \
 | 
				
			||||||
 | 
						else \
 | 
				
			||||||
 | 
							libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
 | 
				
			||||||
 | 
							( PATH=/usr/ccs/bin:$$PATH ; export PATH; \
 | 
				
			||||||
 | 
							  find . -name "*.o" -print > allobjs ; \
 | 
				
			||||||
 | 
							  OBJS= ; export OBJS ; \
 | 
				
			||||||
 | 
							  for obj in `ar t lib$$i.a` ; do \
 | 
				
			||||||
 | 
							    OBJS="$${OBJS} `grep $$obj allobjs`" ; \
 | 
				
			||||||
 | 
							  done ; \
 | 
				
			||||||
 | 
							  set -x; ${CC}  -G -o lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
 | 
				
			||||||
 | 
								-h lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
 | 
				
			||||||
 | 
								$${OBJS} $$libs ${EX_LIBS} ) || exit 1; \
 | 
				
			||||||
 | 
							libs="$$libs -l$$i"; \
 | 
				
			||||||
 | 
							done; \
 | 
				
			||||||
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# UnixWare 7 and OpenUNIX 8 native compilers used
 | 
				
			||||||
 | 
					do_svr5-shared:
 | 
				
			||||||
 | 
						if ${DETECT_GNU_LD}; then \
 | 
				
			||||||
 | 
							$(MAKE) do_gnu-shared; \
 | 
				
			||||||
 | 
						else \
 | 
				
			||||||
 | 
							libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
 | 
				
			||||||
 | 
							( PATH=/usr/ccs/bin:$$PATH ; export PATH; \
 | 
				
			||||||
 | 
							  find . -name "*.o" -print > allobjs ; \
 | 
				
			||||||
 | 
							  OBJS= ; export OBJS ; \
 | 
				
			||||||
 | 
							  for obj in `ar t lib$$i.a` ; do \
 | 
				
			||||||
 | 
							    OBJS="$${OBJS} `grep $$obj allobjs`" ; \
 | 
				
			||||||
 | 
							  done ; \
 | 
				
			||||||
 | 
							  set -x; ${CC} ${SHARED_LDFLAGS} \
 | 
				
			||||||
 | 
								-G -o lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
 | 
				
			||||||
 | 
								-h lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
 | 
				
			||||||
 | 
								$${OBJS} $$libs ${EX_LIBS} ) || exit 1; \
 | 
				
			||||||
 | 
							libs="$$libs -l$$i"; \
 | 
				
			||||||
 | 
							done; \
 | 
				
			||||||
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# This assumes that GNU utilities are *not* used
 | 
					# This assumes that GNU utilities are *not* used
 | 
				
			||||||
do_irix-shared:
 | 
					do_irix-shared:
 | 
				
			||||||
	libs='${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
 | 
						if ${DETECT_GNU_LD}; then \
 | 
				
			||||||
	( set -x; ${CC} -shared -o lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
 | 
							$(MAKE) do_gnu-shared; \
 | 
				
			||||||
		-Wl,-soname,lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
 | 
						else \
 | 
				
			||||||
		-all lib$$i.a $$libs ${EX_LIBS} -lc) || exit 1; \
 | 
							libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
 | 
				
			||||||
	libs="$$libs -L. -l$$i"; \
 | 
							( set -x; ${CC} ${SHARED_LDFLAGS} \
 | 
				
			||||||
	done
 | 
								-shared -o lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
 | 
				
			||||||
 | 
								-Wl,-soname,lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
 | 
				
			||||||
 | 
								-all lib$$i.a $$libs ${EX_LIBS} -lc) || exit 1; \
 | 
				
			||||||
 | 
							libs="$$libs -l$$i"; \
 | 
				
			||||||
 | 
							done; \
 | 
				
			||||||
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# This assumes that GNU utilities are *not* used
 | 
					# This assumes that GNU utilities are *not* used
 | 
				
			||||||
# HP-UX includes the full pathname of libs we depend on, so we would get
 | 
					# HP-UX includes the full pathname of libs we depend on, so we would get
 | 
				
			||||||
@@ -308,11 +429,13 @@ do_irix-shared:
 | 
				
			|||||||
#
 | 
					#
 | 
				
			||||||
do_hpux-shared:
 | 
					do_hpux-shared:
 | 
				
			||||||
	for i in ${SHLIBDIRS}; do \
 | 
						for i in ${SHLIBDIRS}; do \
 | 
				
			||||||
	( set -x; /usr/ccs/bin/ld +vnocompatwarnings \
 | 
						( set -x; /usr/ccs/bin/ld ${SHARED_LDFLAGS} \
 | 
				
			||||||
 | 
					 		+vnocompatwarnings \
 | 
				
			||||||
		-b -z +s \
 | 
							-b -z +s \
 | 
				
			||||||
		-o lib$$i.sl.${SHLIB_MAJOR}.${SHLIB_MINOR} \
 | 
							-o lib$$i.sl.${SHLIB_MAJOR}.${SHLIB_MINOR} \
 | 
				
			||||||
		+h lib$$i.sl.${SHLIB_MAJOR}.${SHLIB_MINOR} \
 | 
							+h lib$$i.sl.${SHLIB_MAJOR}.${SHLIB_MINOR} \
 | 
				
			||||||
		-Fl lib$$i.a -ldld -lc ) || exit 1; \
 | 
							-Fl lib$$i.a -ldld -lc ) || exit 1; \
 | 
				
			||||||
 | 
						chmod a=rx lib$$i.sl.${SHLIB_MAJOR}.${SHLIB_MINOR}; \
 | 
				
			||||||
	done
 | 
						done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# This assumes that GNU utilities are *not* used
 | 
					# This assumes that GNU utilities are *not* used
 | 
				
			||||||
@@ -326,12 +449,84 @@ do_hpux-shared:
 | 
				
			|||||||
#
 | 
					#
 | 
				
			||||||
do_hpux64-shared:
 | 
					do_hpux64-shared:
 | 
				
			||||||
	for i in ${SHLIBDIRS}; do \
 | 
						for i in ${SHLIBDIRS}; do \
 | 
				
			||||||
	( set -x; /usr/ccs/bin/ld -b -z \
 | 
						( set -x; /usr/ccs/bin/ld ${SHARED_LDFLAGS} \
 | 
				
			||||||
 | 
					 		-b -z \
 | 
				
			||||||
		-o lib$$i.sl.${SHLIB_MAJOR}.${SHLIB_MINOR} \
 | 
							-o lib$$i.sl.${SHLIB_MAJOR}.${SHLIB_MINOR} \
 | 
				
			||||||
		+h lib$$i.sl.${SHLIB_MAJOR}.${SHLIB_MINOR} \
 | 
							+h lib$$i.sl.${SHLIB_MAJOR}.${SHLIB_MINOR} \
 | 
				
			||||||
		+forceload lib$$i.a -ldl -lc ) || exit 1; \
 | 
							+forceload lib$$i.a -ldl -lc ) || exit 1; \
 | 
				
			||||||
 | 
						chmod a=rx lib$$i.sl.${SHLIB_MAJOR}.${SHLIB_MINOR}; \
 | 
				
			||||||
	done
 | 
						done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# The following method is said to work on all platforms.  Tests will
 | 
				
			||||||
 | 
					# determine if that's how it's gong to be used.
 | 
				
			||||||
 | 
					# This assumes that for all but GNU systems, GNU utilities are *not* used.
 | 
				
			||||||
 | 
					# ALLSYMSFLAGS would be:
 | 
				
			||||||
 | 
					#  GNU systems: --whole-archive
 | 
				
			||||||
 | 
					#  Tru64 Unix:  -all
 | 
				
			||||||
 | 
					#  Solaris:     -z allextract
 | 
				
			||||||
 | 
					#  Irix:        -all
 | 
				
			||||||
 | 
					#  HP/UX-32bit: -Fl
 | 
				
			||||||
 | 
					#  HP/UX-64bit: +forceload
 | 
				
			||||||
 | 
					#  AIX:		-bnogc
 | 
				
			||||||
 | 
					# SHAREDFLAGS would be:
 | 
				
			||||||
 | 
					#  GNU systems: -shared -Wl,-soname=lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
 | 
				
			||||||
 | 
					#  Tru64 Unix:  -shared \
 | 
				
			||||||
 | 
					#		-set_version "${SHLIB_VERSION_HISTORY}${SHLIB_VERSION_NUMBER}"
 | 
				
			||||||
 | 
					#  Solaris:     -G -h lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
 | 
				
			||||||
 | 
					#  Irix:        -shared -Wl,-soname,lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
 | 
				
			||||||
 | 
					#  HP/UX-32bit: +vnocompatwarnings -b -z +s \
 | 
				
			||||||
 | 
					#		+h lib$$i.sl.${SHLIB_MAJOR}.${SHLIB_MINOR}
 | 
				
			||||||
 | 
					#  HP/UX-64bit: -b -z +h lib$$i.sl.${SHLIB_MAJOR}.${SHLIB_MINOR}
 | 
				
			||||||
 | 
					#  AIX:		-G -bE:lib$$i.exp -bM:SRE
 | 
				
			||||||
 | 
					# SHAREDCMD would be:
 | 
				
			||||||
 | 
					#  GNU systems: $(CC)
 | 
				
			||||||
 | 
					#  Tru64 Unix:  $(CC)
 | 
				
			||||||
 | 
					#  Solaris:     $(CC)
 | 
				
			||||||
 | 
					#  Irix:        $(CC)
 | 
				
			||||||
 | 
					#  HP/UX-32bit: /usr/ccs/bin/ld
 | 
				
			||||||
 | 
					#  HP/UX-64bit: /usr/ccs/bin/ld
 | 
				
			||||||
 | 
					#  AIX:		$(CC)
 | 
				
			||||||
 | 
					ALLSYMSFLAG=-bnogc
 | 
				
			||||||
 | 
					SHAREDFLAGS=${SHARED_LDFLAGS} -G -bE:lib$$i.exp -bM:SRE
 | 
				
			||||||
 | 
					SHAREDCMD=$(CC)
 | 
				
			||||||
 | 
					do_aix-shared:
 | 
				
			||||||
 | 
						libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
 | 
				
			||||||
 | 
						( set -x; \
 | 
				
			||||||
 | 
						  ld -r -o $$i.o $(ALLSYMSFLAG) lib$$i.a && \
 | 
				
			||||||
 | 
						  ( nm -Pg lib$$i.o | grep ' [BD] ' | cut -f1 -d' ' > lib$$i.exp; \
 | 
				
			||||||
 | 
						    $(SHAREDCMD) $(SHAREDFLAG) -o lib$$i.so lib$$i.o \
 | 
				
			||||||
 | 
							$$libs ${EX_LIBS} ) ) \
 | 
				
			||||||
 | 
						|| exit 1; \
 | 
				
			||||||
 | 
						libs="$$libs -l$$i"; \
 | 
				
			||||||
 | 
						done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					do_reliantunix-shared:
 | 
				
			||||||
 | 
						libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
 | 
				
			||||||
 | 
						tmpdir=/tmp/openssl.$$$$ ; rm -rf $$tmpdir ; \
 | 
				
			||||||
 | 
						( set -x; \
 | 
				
			||||||
 | 
						  ( Opwd=`pwd` ; mkdir $$tmpdir || exit 1; \
 | 
				
			||||||
 | 
						    cd $$tmpdir || exit 1 ; ar x $$Opwd/lib$$i.a ; \
 | 
				
			||||||
 | 
						    ${CC} -G -o lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} *.o \
 | 
				
			||||||
 | 
						  ) || exit 1; \
 | 
				
			||||||
 | 
						  cp $$tmpdir/lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} . ; \
 | 
				
			||||||
 | 
						) || exit 1; \
 | 
				
			||||||
 | 
						rm -rf $$tmpdir ; \
 | 
				
			||||||
 | 
						libs="$$libs -l$$i"; \
 | 
				
			||||||
 | 
						done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					openssl.pc:
 | 
				
			||||||
 | 
						@ ( echo 'prefix=$(INSTALLTOP)'; \
 | 
				
			||||||
 | 
						    echo 'exec_prefix=$${prefix}'; \
 | 
				
			||||||
 | 
						    echo 'libdir=$${exec_prefix}/lib'; \
 | 
				
			||||||
 | 
						    echo 'includedir=$${prefix}/include'; \
 | 
				
			||||||
 | 
						    echo ''; \
 | 
				
			||||||
 | 
						    echo 'Name: OpenSSL'; \
 | 
				
			||||||
 | 
						    echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
 | 
				
			||||||
 | 
						    echo 'Version: '$(VERSION); \
 | 
				
			||||||
 | 
						    echo 'Requires: '; \
 | 
				
			||||||
 | 
						    echo 'Libs: -L$${libdir} -lssl -lcrypto $(EX_LIBS)'; \
 | 
				
			||||||
 | 
						    echo 'Cflags: -I$${includedir}' ) > openssl.pc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Makefile.ssl: Makefile.org
 | 
					Makefile.ssl: Makefile.org
 | 
				
			||||||
	@echo "Makefile.ssl is older than Makefile.org."
 | 
						@echo "Makefile.ssl is older than Makefile.org."
 | 
				
			||||||
	@echo "Reconfigure the source tree (via './config' or 'perl Configure'), please."
 | 
						@echo "Reconfigure the source tree (via './config' or 'perl Configure'), please."
 | 
				
			||||||
@@ -350,6 +545,7 @@ clean:
 | 
				
			|||||||
		rm -f $(LIBS); \
 | 
							rm -f $(LIBS); \
 | 
				
			||||||
	fi; \
 | 
						fi; \
 | 
				
			||||||
	done;
 | 
						done;
 | 
				
			||||||
 | 
						rm -f openssl.pc
 | 
				
			||||||
	rm -f *.a *.o speed.* *.map *.so .pure core
 | 
						rm -f *.a *.o speed.* *.map *.so .pure core
 | 
				
			||||||
	rm -f $(TARFILE)
 | 
						rm -f $(TARFILE)
 | 
				
			||||||
	@for i in $(ONEDIRS) ;\
 | 
						@for i in $(ONEDIRS) ;\
 | 
				
			||||||
@@ -382,6 +578,10 @@ links:
 | 
				
			|||||||
	fi; \
 | 
						fi; \
 | 
				
			||||||
	done;
 | 
						done;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					gentests:
 | 
				
			||||||
 | 
						@(cd test && echo "generating dummy tests (if needed)..." && \
 | 
				
			||||||
 | 
						$(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' SDIRS='$(SDIRS)' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' TESTS='${TESTS}' KRB5_INCLUDES='${KRB5_INCLUDES}' LIBKRB5='${LIBKRB5}' EXE_EXT='${EXE_EXT}' SHARED_LIBS='${SHARED_LIBS}' SHLIB_EXT='${SHLIB_EXT}' SHLIB_TARGET='${SHLIB_TARGET}' TESTS='${TESTS}' OPENSSL_DEBUG_MEMORY=on generate );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
dclean:
 | 
					dclean:
 | 
				
			||||||
	rm -f *.bak
 | 
						rm -f *.bak
 | 
				
			||||||
	@for i in $(DIRS) ;\
 | 
						@for i in $(DIRS) ;\
 | 
				
			||||||
@@ -394,15 +594,23 @@ dclean:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
rehash: rehash.time
 | 
					rehash: rehash.time
 | 
				
			||||||
rehash.time: certs
 | 
					rehash.time: certs
 | 
				
			||||||
	@(OPENSSL="`pwd`/apps/openssl"; OPENSSL_DEBUG_MEMORY=on; export OPENSSL OPENSSL_DEBUG_MEMORY; $(PERL) tools/c_rehash certs)
 | 
						@(OPENSSL="`pwd`/apps/openssl"; OPENSSL_DEBUG_MEMORY=on; \
 | 
				
			||||||
 | 
							export OPENSSL OPENSSL_DEBUG_MEMORY; \
 | 
				
			||||||
 | 
							LD_LIBRARY_PATH="`pwd`"; DYLD_LIBRARY_PATH="`pwd`"; SHLIB_PATH="`pwd`"; LIBPATH="`pwd`"; \
 | 
				
			||||||
 | 
							if [ "$(PLATFORM)" != "Cygwin" ]; then PATH="`pwd`:$$PATH"; fi; \
 | 
				
			||||||
 | 
							export LD_LIBRARY_PATH DYLD_LIBRARY_PATH SHLIB_PATH LIBPATH PATH; \
 | 
				
			||||||
 | 
							$(PERL) tools/c_rehash certs)
 | 
				
			||||||
	touch rehash.time
 | 
						touch rehash.time
 | 
				
			||||||
 | 
					
 | 
				
			||||||
test:   tests
 | 
					test:   tests
 | 
				
			||||||
 | 
					
 | 
				
			||||||
tests: rehash
 | 
					tests: rehash
 | 
				
			||||||
	@(cd test && echo "testing..." && \
 | 
						@(cd test && echo "testing..." && \
 | 
				
			||||||
	$(MAKE) CC='${CC}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SDIRS='${SDIRS}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' PERL='${PERL}' TESTS='${TESTS}' KRB5_INCLUDES='${KRB5_INCLUDES}' LIBKRB5='${LIBKRB5}' OPENSSL_DEBUG_MEMORY=on tests );
 | 
						$(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' SDIRS='$(SDIRS)' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' TESTS='${TESTS}' KRB5_INCLUDES='${KRB5_INCLUDES}' LIBKRB5='${LIBKRB5}' EXE_EXT='${EXE_EXT}' SHARED_LIBS='${SHARED_LIBS}' SHLIB_EXT='${SHLIB_EXT}' SHLIB_TARGET='${SHLIB_TARGET}' TESTS='${TESTS}' OPENSSL_DEBUG_MEMORY=on tests );
 | 
				
			||||||
	@apps/openssl version -a
 | 
						@LD_LIBRARY_PATH="`pwd`"; DYLD_LIBRARY_PATH="`pwd`"; SHLIB_PATH="`pwd`"; LIBPATH="`pwd`"; \
 | 
				
			||||||
 | 
							if [ "$(PLATFORM)" != "Cygwin" ]; then PATH="`pwd`:$$PATH"; fi; \
 | 
				
			||||||
 | 
							export LD_LIBRARY_PATH DYLD_LIBRARY_PATH SHLIB_PATH LIBPATH PATH; \
 | 
				
			||||||
 | 
							apps/openssl version -a
 | 
				
			||||||
 | 
					
 | 
				
			||||||
report:
 | 
					report:
 | 
				
			||||||
	@$(PERL) util/selftest.pl
 | 
						@$(PERL) util/selftest.pl
 | 
				
			||||||
@@ -412,7 +620,7 @@ depend:
 | 
				
			|||||||
	do \
 | 
						do \
 | 
				
			||||||
	if [ -d "$$i" ]; then \
 | 
						if [ -d "$$i" ]; then \
 | 
				
			||||||
		(cd $$i && echo "making dependencies $$i..." && \
 | 
							(cd $$i && echo "making dependencies $$i..." && \
 | 
				
			||||||
		$(MAKE) SDIRS='${SDIRS}' DEPFLAG='${DEPFLAG}' MAKEDEPPROG='${MAKEDEPPROG}' depend ) || exit 1; \
 | 
							$(MAKE) SDIRS='${SDIRS}' CFLAG='${CFLAG}' DEPFLAG='${DEPFLAG}' MAKEDEPPROG='${MAKEDEPPROG}' KRB5_INCLUDES='${KRB5_INCLUDES}' PERL='${PERL}' depend ) || exit 1; \
 | 
				
			||||||
	fi; \
 | 
						fi; \
 | 
				
			||||||
	done;
 | 
						done;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -436,6 +644,7 @@ tags:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
errors:
 | 
					errors:
 | 
				
			||||||
	$(PERL) util/mkerr.pl -recurse -write
 | 
						$(PERL) util/mkerr.pl -recurse -write
 | 
				
			||||||
 | 
						(cd crypto/engine; $(MAKE) PERL=$(PERL) errors)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
stacks:
 | 
					stacks:
 | 
				
			||||||
	$(PERL) util/mkstack.pl -write
 | 
						$(PERL) util/mkstack.pl -write
 | 
				
			||||||
@@ -457,18 +666,27 @@ TABLE: Configure
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
update: depend errors stacks util/libeay.num util/ssleay.num crypto/objects/obj_dat.h TABLE
 | 
					update: depend errors stacks util/libeay.num util/ssleay.num crypto/objects/obj_dat.h TABLE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Build distribution tar-file. As the list of files returned by "find" is
 | 
				
			||||||
 | 
					# pretty long, on several platforms a "too many arguments" error or similar
 | 
				
			||||||
 | 
					# would occur. Therefore the list of files is temporarily stored into a file
 | 
				
			||||||
 | 
					# and read directly, requiring GNU-Tar. Call "make TAR=gtar dist" if the normal
 | 
				
			||||||
 | 
					# tar does not support the --files-from option.
 | 
				
			||||||
tar:
 | 
					tar:
 | 
				
			||||||
	@$(TAR) $(TARFLAGS) -cvf - \
 | 
						find . -type d -print | xargs chmod 755
 | 
				
			||||||
		`find * \! -path CVS/\* \! -path \*/CVS/\* \! -name CVS \! -name .cvsignore \! -name STATUS \! -name TABLE | sort` |\
 | 
						find . -type f -print | xargs chmod a+r
 | 
				
			||||||
 | 
						find . -type f -perm -0100 -print | xargs chmod a+x
 | 
				
			||||||
 | 
						find * \! -path CVS/\* \! -path \*/CVS/\* \! -name CVS \! -name .cvsignore \! -name STATUS \! -name TABLE | sort > ../$(TARFILE).list; \
 | 
				
			||||||
 | 
						$(TAR) $(TARFLAGS) --files-from ../$(TARFILE).list -cvf - | \
 | 
				
			||||||
	tardy --user_number=0  --user_name=openssl \
 | 
						tardy --user_number=0  --user_name=openssl \
 | 
				
			||||||
	      --group_number=0 --group_name=openssl \
 | 
						      --group_number=0 --group_name=openssl \
 | 
				
			||||||
	      --prefix=openssl-$(VERSION) - |\
 | 
						      --prefix=openssl-$(VERSION) - |\
 | 
				
			||||||
	gzip --best >../$(TARFILE).gz; \
 | 
						gzip --best >../$(TARFILE).gz; \
 | 
				
			||||||
 | 
						rm -f ../$(TARFILE).list; \
 | 
				
			||||||
	ls -l ../$(TARFILE).gz
 | 
						ls -l ../$(TARFILE).gz
 | 
				
			||||||
 | 
					
 | 
				
			||||||
tar-snap:
 | 
					tar-snap:
 | 
				
			||||||
	@$(TAR) $(TARFLAGS) -cvf - \
 | 
						@$(TAR) $(TARFLAGS) -cvf - \
 | 
				
			||||||
		`find * \! -path CVS/\* \! -path \*/CVS/\* \! -name CVS \! -name .cvsignore \! -name STATUS \! -name TABLE \! -name '*.o' \! -name '*.a' \! -name '*.so' \! -name '*.so.*'  \! -name 'openssl' \! -name '*test' \! -name '.#*' | sort` |\
 | 
							`find * \! -path CVS/\* \! -path \*/CVS/\* \! -name CVS \! -name .cvsignore \! -name STATUS \! -name TABLE \! -name '*.o' \! -name '*.a' \! -name '*.so' \! -name '*.so.*'  \! -name 'openssl' \! -name '*test' \! -name '.#*' \! -name '*~' | sort` |\
 | 
				
			||||||
	tardy --user_number=0  --user_name=openssl \
 | 
						tardy --user_number=0  --user_name=openssl \
 | 
				
			||||||
	      --group_number=0 --group_name=openssl \
 | 
						      --group_number=0 --group_name=openssl \
 | 
				
			||||||
	      --prefix=openssl-$(VERSION) - > ../$(TARFILE);\
 | 
						      --prefix=openssl-$(VERSION) - > ../$(TARFILE);\
 | 
				
			||||||
@@ -478,7 +696,7 @@ dist:
 | 
				
			|||||||
	$(PERL) Configure dist
 | 
						$(PERL) Configure dist
 | 
				
			||||||
	@$(MAKE) dist_pem_h
 | 
						@$(MAKE) dist_pem_h
 | 
				
			||||||
	@$(MAKE) SDIRS='${SDIRS}' clean
 | 
						@$(MAKE) SDIRS='${SDIRS}' clean
 | 
				
			||||||
	@$(MAKE) tar
 | 
						@$(MAKE) TAR='${TAR}' TARFLAGS='${TARFLAGS}' tar
 | 
				
			||||||
 | 
					
 | 
				
			||||||
dist_pem_h:
 | 
					dist_pem_h:
 | 
				
			||||||
	(cd crypto/pem; $(MAKE) CC='${CC}' SDIRS='${SDIRS}' CFLAG='${CFLAG}' pem.h; $(MAKE) clean)
 | 
						(cd crypto/pem; $(MAKE) CC='${CC}' SDIRS='${SDIRS}' CFLAG='${CFLAG}' pem.h; $(MAKE) clean)
 | 
				
			||||||
@@ -486,6 +704,7 @@ dist_pem_h:
 | 
				
			|||||||
install: all install_docs
 | 
					install: all install_docs
 | 
				
			||||||
	@$(PERL) $(TOP)/util/mkdir-p.pl $(INSTALL_PREFIX)$(INSTALLTOP)/bin \
 | 
						@$(PERL) $(TOP)/util/mkdir-p.pl $(INSTALL_PREFIX)$(INSTALLTOP)/bin \
 | 
				
			||||||
		$(INSTALL_PREFIX)$(INSTALLTOP)/lib \
 | 
							$(INSTALL_PREFIX)$(INSTALLTOP)/lib \
 | 
				
			||||||
 | 
							$(INSTALL_PREFIX)$(INSTALLTOP)/lib/pkginfo \
 | 
				
			||||||
		$(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl \
 | 
							$(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl \
 | 
				
			||||||
		$(INSTALL_PREFIX)$(OPENSSLDIR)/misc \
 | 
							$(INSTALL_PREFIX)$(OPENSSLDIR)/misc \
 | 
				
			||||||
		$(INSTALL_PREFIX)$(OPENSSLDIR)/certs \
 | 
							$(INSTALL_PREFIX)$(OPENSSLDIR)/certs \
 | 
				
			||||||
@@ -500,32 +719,46 @@ install: all install_docs
 | 
				
			|||||||
	do \
 | 
						do \
 | 
				
			||||||
	if [ -d "$$i" ]; then \
 | 
						if [ -d "$$i" ]; then \
 | 
				
			||||||
		(cd $$i; echo "installing $$i..."; \
 | 
							(cd $$i; echo "installing $$i..."; \
 | 
				
			||||||
		$(MAKE) CC='${CC}' CFLAG='${CFLAG}' INSTALL_PREFIX='${INSTALL_PREFIX}' INSTALLTOP='${INSTALLTOP}' OPENSSLDIR='${OPENSSLDIR}' EX_LIBS='${EX_LIBS}' SDIRS='${SDIRS}' RANLIB='${RANLIB}' install ); \
 | 
							$(MAKE) CC='${CC}' CFLAG='${CFLAG}' INSTALL_PREFIX='${INSTALL_PREFIX}' INSTALLTOP='${INSTALLTOP}' OPENSSLDIR='${OPENSSLDIR}' EX_LIBS='${EX_LIBS}' SDIRS='${SDIRS}' RANLIB='${RANLIB}' EXE_EXT='${EXE_EXT}' install ); \
 | 
				
			||||||
	fi; \
 | 
						fi; \
 | 
				
			||||||
	done
 | 
						done
 | 
				
			||||||
	@for i in $(LIBS) ;\
 | 
						@for i in $(LIBS) ;\
 | 
				
			||||||
	do \
 | 
						do \
 | 
				
			||||||
		if [ -f "$$i" ]; then \
 | 
							if [ -f "$$i" ]; then \
 | 
				
			||||||
		(       echo installing $$i; \
 | 
							(       echo installing $$i; \
 | 
				
			||||||
			cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/lib; \
 | 
								cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
 | 
				
			||||||
			$(RANLIB) $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i; \
 | 
								$(RANLIB) $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
 | 
				
			||||||
			chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i ); \
 | 
								chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
 | 
				
			||||||
		fi \
 | 
								mv $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i ); \
 | 
				
			||||||
	done
 | 
							fi; \
 | 
				
			||||||
 | 
						done;
 | 
				
			||||||
	@if [ -n "$(SHARED_LIBS)" ]; then \
 | 
						@if [ -n "$(SHARED_LIBS)" ]; then \
 | 
				
			||||||
		tmp="$(SHARED_LIBS)"; \
 | 
							tmp="$(SHARED_LIBS)"; \
 | 
				
			||||||
		for i in $${tmp:-x}; \
 | 
							for i in $${tmp:-x}; \
 | 
				
			||||||
		do \
 | 
							do \
 | 
				
			||||||
			if [ -f "$$i" ]; then \
 | 
								if [ -f "$$i" -o -f "$$i.a" ]; then \
 | 
				
			||||||
			(       echo installing $$i; \
 | 
								(       echo installing $$i; \
 | 
				
			||||||
				cp -f $$i $(INSTALL_PREFIX)$(INSTALLTOP)/lib; \
 | 
									if [ "$(PLATFORM)" != "Cygwin" ]; then \
 | 
				
			||||||
				chmod 555 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i ); \
 | 
										cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
 | 
				
			||||||
			fi \
 | 
										chmod 555 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
 | 
				
			||||||
 | 
										mv $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i; \
 | 
				
			||||||
 | 
									else \
 | 
				
			||||||
 | 
										c=`echo $$i | sed 's/^lib\(.*\)/cyg\1-$(SHLIB_VERSION_NUMBER)/'`; \
 | 
				
			||||||
 | 
										cp $$c $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
 | 
				
			||||||
 | 
										chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
 | 
				
			||||||
 | 
										mv $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c; \
 | 
				
			||||||
 | 
										cp $$i.a $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.a.new; \
 | 
				
			||||||
 | 
										chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.a.new; \
 | 
				
			||||||
 | 
										mv $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.a.new $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.a; \
 | 
				
			||||||
 | 
									fi ); \
 | 
				
			||||||
 | 
								fi; \
 | 
				
			||||||
		done; \
 | 
							done; \
 | 
				
			||||||
		(	here="`pwd`"; \
 | 
							(	here="`pwd`"; \
 | 
				
			||||||
			cd $(INSTALL_PREFIX)$(INSTALLTOP)/lib; \
 | 
								cd $(INSTALL_PREFIX)$(INSTALLTOP)/lib; \
 | 
				
			||||||
			make -f $$here/Makefile link-shared ); \
 | 
								set $(MAKE); \
 | 
				
			||||||
 | 
								$$1 -f $$here/Makefile link-shared ); \
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
						cp openssl.pc $(INSTALL_PREFIX)$(INSTALLTOP)/lib/pkginfo
 | 
				
			||||||
 | 
					
 | 
				
			||||||
install_docs:
 | 
					install_docs:
 | 
				
			||||||
	@$(PERL) $(TOP)/util/mkdir-p.pl \
 | 
						@$(PERL) $(TOP)/util/mkdir-p.pl \
 | 
				
			||||||
@@ -533,22 +766,25 @@ install_docs:
 | 
				
			|||||||
		$(INSTALL_PREFIX)$(MANDIR)/man3 \
 | 
							$(INSTALL_PREFIX)$(MANDIR)/man3 \
 | 
				
			||||||
		$(INSTALL_PREFIX)$(MANDIR)/man5 \
 | 
							$(INSTALL_PREFIX)$(MANDIR)/man5 \
 | 
				
			||||||
		$(INSTALL_PREFIX)$(MANDIR)/man7
 | 
							$(INSTALL_PREFIX)$(MANDIR)/man7
 | 
				
			||||||
	@for i in doc/apps/*.pod; do \
 | 
						@pod2man="`cd util; ./pod2mantest $(PERL)`"; \
 | 
				
			||||||
 | 
						for i in doc/apps/*.pod; do \
 | 
				
			||||||
		fn=`basename $$i .pod`; \
 | 
							fn=`basename $$i .pod`; \
 | 
				
			||||||
		sec=`[ "$$fn" = "config" ] && echo 5 || echo 1`; \
 | 
							if [ "$$fn" = "config" ]; then sec=5; else sec=1; fi; \
 | 
				
			||||||
		echo "installing man$$sec/`basename $$i .pod`.$$sec"; \
 | 
							echo "installing man$$sec/`basename $$i .pod`.$$sec"; \
 | 
				
			||||||
		(cd `dirname $$i`; \
 | 
							(cd `$(PERL) util/dirname.pl $$i`; \
 | 
				
			||||||
		$(PERL) ../../util/pod2man.pl --section=$$sec --center=OpenSSL \
 | 
							sh -c "$$pod2man \
 | 
				
			||||||
			 --release=$(VERSION) `basename $$i`) \
 | 
								--section=$$sec --center=OpenSSL \
 | 
				
			||||||
 | 
								--release=$(VERSION) `basename $$i`") \
 | 
				
			||||||
			>  $(INSTALL_PREFIX)$(MANDIR)/man$$sec/`basename $$i .pod`.$$sec; \
 | 
								>  $(INSTALL_PREFIX)$(MANDIR)/man$$sec/`basename $$i .pod`.$$sec; \
 | 
				
			||||||
	done
 | 
						done; \
 | 
				
			||||||
	@for i in doc/crypto/*.pod doc/ssl/*.pod; do \
 | 
						for i in doc/crypto/*.pod doc/ssl/*.pod; do \
 | 
				
			||||||
		fn=`basename $$i .pod`; \
 | 
							fn=`basename $$i .pod`; \
 | 
				
			||||||
		sec=`[ "$$fn" = "des_modes" ] && echo 7 || echo 3`; \
 | 
							if [ "$$fn" = "des_modes" ]; then sec=7; else sec=3; fi; \
 | 
				
			||||||
		echo "installing man$$sec/`basename $$i .pod`.$$sec"; \
 | 
							echo "installing man$$sec/`basename $$i .pod`.$$sec"; \
 | 
				
			||||||
		(cd `dirname $$i`; \
 | 
							(cd `$(PERL) util/dirname.pl $$i`; \
 | 
				
			||||||
		$(PERL) ../../util/pod2man.pl --section=$$sec --center=OpenSSL \
 | 
							sh -c "$$pod2man \
 | 
				
			||||||
			--release=$(VERSION) `basename $$i`) \
 | 
								--section=$$sec --center=OpenSSL \
 | 
				
			||||||
 | 
								--release=$(VERSION) `basename $$i`") \
 | 
				
			||||||
			>  $(INSTALL_PREFIX)$(MANDIR)/man$$sec/`basename $$i .pod`.$$sec; \
 | 
								>  $(INSTALL_PREFIX)$(MANDIR)/man$$sec/`basename $$i .pod`.$$sec; \
 | 
				
			||||||
	done
 | 
						done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										130
									
								
								NEWS
									
									
									
									
									
								
							
							
						
						
									
										130
									
								
								NEWS
									
									
									
									
									
								
							@@ -8,7 +8,130 @@
 | 
				
			|||||||
  Major changes between OpenSSL 0.9.6 and OpenSSL 0.9.7:
 | 
					  Major changes between OpenSSL 0.9.6 and OpenSSL 0.9.7:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      o New library section OCSP.
 | 
					      o New library section OCSP.
 | 
				
			||||||
      o Complete haul-over of the ASN.1 library section.
 | 
					      o Complete rewrite of ASN1 code.
 | 
				
			||||||
 | 
					      o CRL checking in verify code and openssl utility.
 | 
				
			||||||
 | 
					      o Extension copying in 'ca' utility.
 | 
				
			||||||
 | 
					      o Flexible display options in 'ca' utility.
 | 
				
			||||||
 | 
					      o Provisional support for international characters with UTF8.
 | 
				
			||||||
 | 
					      o Support for external crypto devices ('engine') is no longer
 | 
				
			||||||
 | 
					        a separate distribution.
 | 
				
			||||||
 | 
					      o New elliptic curve library section.
 | 
				
			||||||
 | 
					      o New AES (Rijndael) library section.
 | 
				
			||||||
 | 
					      o Support for new platforms: Windows CE, Tandem OSS, A/UX, AIX 64-bit
 | 
				
			||||||
 | 
					      o Extended support for some platforms: VxWorks
 | 
				
			||||||
 | 
					      o Enhanced support for shared libraries.
 | 
				
			||||||
 | 
					      o Support for pkg-config.
 | 
				
			||||||
 | 
					      o Lots of new manuals.
 | 
				
			||||||
 | 
					      o Change DES API to clean up the namespace (some applications link also
 | 
				
			||||||
 | 
					        against libdes providing similar functions having the same name).
 | 
				
			||||||
 | 
					        Provide macros for backward compatibility (will be removed in the
 | 
				
			||||||
 | 
					        future).
 | 
				
			||||||
 | 
					      o Unify handling of cryptographic algorithms (software and engine)
 | 
				
			||||||
 | 
					        to be available via EVP routines for asymmetric and symmetric ciphers.
 | 
				
			||||||
 | 
					      o NCONF: new configuration handling routines.
 | 
				
			||||||
 | 
					      o Change API to use more 'const' modifiers to improve error checking
 | 
				
			||||||
 | 
					        and help optimizers.
 | 
				
			||||||
 | 
					      o Finally remove references to RSAref.
 | 
				
			||||||
 | 
					      o Reworked parts of the BIGNUM code.
 | 
				
			||||||
 | 
					      o Support for new engines: Broadcom ubsec, Accelerated Encryption
 | 
				
			||||||
 | 
					        Processing, IBM 4758.
 | 
				
			||||||
 | 
					      o A few new engines added in the demos area.
 | 
				
			||||||
 | 
					      o Extended and corrected OID (object identifier) table.
 | 
				
			||||||
 | 
					      o PRNG: query at more locations for a random device, automatic query for
 | 
				
			||||||
 | 
					        EGD style random sources at several locations.
 | 
				
			||||||
 | 
					      o SSL/TLS: allow optional cipher choice according to server's preference.
 | 
				
			||||||
 | 
					      o SSL/TLS: allow server to explicitly set new session ids.
 | 
				
			||||||
 | 
					      o SSL/TLS: support Kerberos cipher suites (RFC2712).
 | 
				
			||||||
 | 
					      o SSL/TLS: allow more precise control of renegotiations and sessions.
 | 
				
			||||||
 | 
					      o SSL/TLS: add callback to retrieve SSL/TLS messages.
 | 
				
			||||||
 | 
					      o SSL/TLS: support AES cipher suites (RFC3268).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Major changes between OpenSSL 0.9.6g and OpenSSL 0.9.6h:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      o New configuration targets for Tandem OSS and A/UX.
 | 
				
			||||||
 | 
					      o New OIDs for Microsoft attributes.
 | 
				
			||||||
 | 
					      o Better handling of SSL session caching.
 | 
				
			||||||
 | 
					      o Better comparison of distinguished names.
 | 
				
			||||||
 | 
					      o Better handling of shared libraries in a mixed GNU/non-GNU environment.
 | 
				
			||||||
 | 
					      o Support assembler code with Borland C.
 | 
				
			||||||
 | 
					      o Fixes for length problems.
 | 
				
			||||||
 | 
					      o Fixes for uninitialised variables.
 | 
				
			||||||
 | 
					      o Fixes for memory leaks, some unusual crashes and some race conditions.
 | 
				
			||||||
 | 
					      o Fixes for smaller building problems.
 | 
				
			||||||
 | 
					      o Updates of manuals, FAQ and other instructive documents.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Major changes between OpenSSL 0.9.6f and OpenSSL 0.9.6g:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      o Important building fixes on Unix.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Major changes between OpenSSL 0.9.6e and OpenSSL 0.9.6f:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      o Various important bugfixes.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Major changes between OpenSSL 0.9.6d and OpenSSL 0.9.6e:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      o Important security related bugfixes.
 | 
				
			||||||
 | 
					      o Various SSL/TLS library bugfixes.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Major changes between OpenSSL 0.9.6c and OpenSSL 0.9.6d:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      o Various SSL/TLS library bugfixes.
 | 
				
			||||||
 | 
					      o Fix DH parameter generation for 'non-standard' generators.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Major changes between OpenSSL 0.9.6b and OpenSSL 0.9.6c:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      o Various SSL/TLS library bugfixes.
 | 
				
			||||||
 | 
					      o BIGNUM library fixes.
 | 
				
			||||||
 | 
					      o RSA OAEP and random number generation fixes.
 | 
				
			||||||
 | 
					      o Object identifiers corrected and added.
 | 
				
			||||||
 | 
					      o Add assembler BN routines for IA64.
 | 
				
			||||||
 | 
					      o Add support for OS/390 Unix, UnixWare with gcc, OpenUNIX 8,
 | 
				
			||||||
 | 
					        MIPS Linux; shared library support for Irix, HP-UX.
 | 
				
			||||||
 | 
					      o Add crypto accelerator support for AEP, Baltimore SureWare,
 | 
				
			||||||
 | 
					        Broadcom and Cryptographic Appliance's keyserver
 | 
				
			||||||
 | 
					        [in 0.9.6c-engine release].
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Major changes between OpenSSL 0.9.6a and OpenSSL 0.9.6b:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      o Security fix: PRNG improvements.
 | 
				
			||||||
 | 
					      o Security fix: RSA OAEP check.
 | 
				
			||||||
 | 
					      o Security fix: Reinsert and fix countermeasure to Bleichbacher's
 | 
				
			||||||
 | 
					        attack.
 | 
				
			||||||
 | 
					      o MIPS bug fix in BIGNUM.
 | 
				
			||||||
 | 
					      o Bug fix in "openssl enc".
 | 
				
			||||||
 | 
					      o Bug fix in X.509 printing routine.
 | 
				
			||||||
 | 
					      o Bug fix in DSA verification routine and DSA S/MIME verification.
 | 
				
			||||||
 | 
					      o Bug fix to make PRNG thread-safe.
 | 
				
			||||||
 | 
					      o Bug fix in RAND_file_name().
 | 
				
			||||||
 | 
					      o Bug fix in compatibility mode trust settings.
 | 
				
			||||||
 | 
					      o Bug fix in blowfish EVP.
 | 
				
			||||||
 | 
					      o Increase default size for BIO buffering filter.
 | 
				
			||||||
 | 
					      o Compatibility fixes in some scripts.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Major changes between OpenSSL 0.9.6 and OpenSSL 0.9.6a:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      o Security fix: change behavior of OpenSSL to avoid using
 | 
				
			||||||
 | 
					        environment variables when running as root.
 | 
				
			||||||
 | 
					      o Security fix: check the result of RSA-CRT to reduce the
 | 
				
			||||||
 | 
					        possibility of deducing the private key from an incorrectly
 | 
				
			||||||
 | 
					        calculated signature.
 | 
				
			||||||
 | 
					      o Security fix: prevent Bleichenbacher's DSA attack.
 | 
				
			||||||
 | 
					      o Security fix: Zero the premaster secret after deriving the
 | 
				
			||||||
 | 
					        master secret in DH ciphersuites.
 | 
				
			||||||
 | 
					      o Reimplement SSL_peek(), which had various problems.
 | 
				
			||||||
 | 
					      o Compatibility fix: the function des_encrypt() renamed to
 | 
				
			||||||
 | 
					        des_encrypt1() to avoid clashes with some Unixen libc.
 | 
				
			||||||
 | 
					      o Bug fixes for Win32, HP/UX and Irix.
 | 
				
			||||||
 | 
					      o Bug fixes in BIGNUM, SSL, PKCS#7, PKCS#12, X.509, CONF and
 | 
				
			||||||
 | 
					        memory checking routines.
 | 
				
			||||||
 | 
					      o Bug fixes for RSA operations in threaded environments.
 | 
				
			||||||
 | 
					      o Bug fixes in misc. openssl applications.
 | 
				
			||||||
 | 
					      o Remove a few potential memory leaks.
 | 
				
			||||||
 | 
					      o Add tighter checks of BIGNUM routines.
 | 
				
			||||||
 | 
					      o Shared library support has been reworked for generality.
 | 
				
			||||||
 | 
					      o More documentation.
 | 
				
			||||||
 | 
					      o New function BN_rand_range().
 | 
				
			||||||
 | 
					      o Add "-rand" option to openssl s_client and s_server.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Major changes between OpenSSL 0.9.5a and OpenSSL 0.9.6:
 | 
					  Major changes between OpenSSL 0.9.5a and OpenSSL 0.9.6:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -19,9 +142,12 @@
 | 
				
			|||||||
      o New 'rsautl' application, low level RSA utility.
 | 
					      o New 'rsautl' application, low level RSA utility.
 | 
				
			||||||
      o MD4 now included.
 | 
					      o MD4 now included.
 | 
				
			||||||
      o Bugfix for SSL rollback padding check.
 | 
					      o Bugfix for SSL rollback padding check.
 | 
				
			||||||
      o Support for external crypto devices.
 | 
					      o Support for external crypto devices [1].
 | 
				
			||||||
      o Enhanced EVP interface.
 | 
					      o Enhanced EVP interface.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    [1] The support for external crypto devices is currently a separate
 | 
				
			||||||
 | 
					        distribution.  See the file README.ENGINE.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Major changes between OpenSSL 0.9.5 and OpenSSL 0.9.5a:
 | 
					  Major changes between OpenSSL 0.9.5 and OpenSSL 0.9.5a:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      o Bug fixes for Win32, SuSE Linux, NeXTSTEP and FreeBSD 2.2.8 
 | 
					      o Bug fixes for Win32, SuSE Linux, NeXTSTEP and FreeBSD 2.2.8 
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										48
									
								
								PROBLEMS
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								PROBLEMS
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,48 @@
 | 
				
			|||||||
 | 
					* System libcrypto.dylib and libssl.dylib are used by system ld on MacOS X.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    NOTE: The problem described here only applies when OpenSSL isn't built
 | 
				
			||||||
 | 
					    with shared library support (i.e. without the "shared" configuration
 | 
				
			||||||
 | 
					    option).  If you build with shared library support, you will have no
 | 
				
			||||||
 | 
					    problems as long as you set up DYLD_LIBRARY_PATH properly at all times.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					This is really a misfeature in ld, which seems to look for .dylib libraries
 | 
				
			||||||
 | 
					along the whole library path before it bothers looking for .a libraries.  This
 | 
				
			||||||
 | 
					means that -L switches won't matter unless OpenSSL is built with shared
 | 
				
			||||||
 | 
					library support.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The workaround may be to change the following lines in apps/Makefile.ssl and
 | 
				
			||||||
 | 
					test/Makefile.ssl:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  LIBCRYPTO=-L.. -lcrypto
 | 
				
			||||||
 | 
					  LIBSSL=-L.. -lssl
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					to:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  LIBCRYPTO=../libcrypto.a
 | 
				
			||||||
 | 
					  LIBSSL=../libssl.a
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					It's possible that something similar is needed for shared library support
 | 
				
			||||||
 | 
					as well.  That hasn't been well tested yet.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Another solution that many seem to recommend is to move the libraries
 | 
				
			||||||
 | 
					/usr/lib/libcrypto.0.9.dylib, /usr/lib/libssl.0.9.dylib to a different
 | 
				
			||||||
 | 
					directory, build and install OpenSSL and anything that depends on your
 | 
				
			||||||
 | 
					build, then move libcrypto.0.9.dylib and libssl.0.9.dylib back to their
 | 
				
			||||||
 | 
					original places.  Note that the version numbers on those two libraries
 | 
				
			||||||
 | 
					may differ on your machine.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					As long as Apple doesn't fix the problem with ld, this problem building
 | 
				
			||||||
 | 
					OpenSSL will remain as is.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* Parallell make leads to errors
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					While running tests, running a parallell make is a bad idea.  Many test
 | 
				
			||||||
 | 
					scripts use the same name for output and input files, which means different
 | 
				
			||||||
 | 
					will interfere with each other and lead to test failure.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The solution is simple for now: don't run parallell make when testing.
 | 
				
			||||||
							
								
								
									
										25
									
								
								README
									
									
									
									
									
								
							
							
						
						
									
										25
									
								
								README
									
									
									
									
									
								
							@@ -1,7 +1,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 OpenSSL 0.9.7-dev 24 Sep 2000
 | 
					 OpenSSL 0.9.7-beta4 19 Nov 2002
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 Copyright (c) 1998-2000 The OpenSSL Project
 | 
					 Copyright (c) 1998-2002 The OpenSSL Project
 | 
				
			||||||
 Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson
 | 
					 Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson
 | 
				
			||||||
 All rights reserved.
 | 
					 All rights reserved.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -62,7 +62,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
     X.509v3 certificates
 | 
					     X.509v3 certificates
 | 
				
			||||||
        X509 encoding/decoding into/from binary ASN1 and a PEM
 | 
					        X509 encoding/decoding into/from binary ASN1 and a PEM
 | 
				
			||||||
             based ascii-binary encoding which supports encryption with a
 | 
					             based ASCII-binary encoding which supports encryption with a
 | 
				
			||||||
             private key.  Program to generate RSA and DSA certificate
 | 
					             private key.  Program to generate RSA and DSA certificate
 | 
				
			||||||
             requests and to generate RSA and DSA certificates.
 | 
					             requests and to generate RSA and DSA certificates.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -97,7 +97,7 @@
 | 
				
			|||||||
 locations around the world. _YOU_ are responsible for ensuring that your use
 | 
					 locations around the world. _YOU_ are responsible for ensuring that your use
 | 
				
			||||||
 of any algorithms is legal by checking if there are any patents in your
 | 
					 of any algorithms is legal by checking if there are any patents in your
 | 
				
			||||||
 country.  The file contains some of the patents that we know about or are
 | 
					 country.  The file contains some of the patents that we know about or are
 | 
				
			||||||
 rumoured to exist. This is not a definitive list.
 | 
					 rumored to exist. This is not a definitive list.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 RSA Security holds software patents on the RC5 algorithm.  If you
 | 
					 RSA Security holds software patents on the RC5 algorithm.  If you
 | 
				
			||||||
 intend to use this cipher, you must contact RSA Security for
 | 
					 intend to use this cipher, you must contact RSA Security for
 | 
				
			||||||
@@ -122,6 +122,13 @@
 | 
				
			|||||||
 lists the functions; you will probably have to look at the code to work out
 | 
					 lists the functions; you will probably have to look at the code to work out
 | 
				
			||||||
 how to use them. Look at the example programs.
 | 
					 how to use them. Look at the example programs.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 PROBLEMS
 | 
				
			||||||
 | 
					 --------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 For some platforms, there are some known problems that may affect the user
 | 
				
			||||||
 | 
					 or application author.  We try to collect those in doc/PROBLEMS, with current
 | 
				
			||||||
 | 
					 thoughts on how they should be solved in a future of OpenSSL.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 SUPPORT 
 | 
					 SUPPORT 
 | 
				
			||||||
 -------
 | 
					 -------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -146,11 +153,13 @@
 | 
				
			|||||||
    - Problem Description (steps that will reproduce the problem, if known)
 | 
					    - Problem Description (steps that will reproduce the problem, if known)
 | 
				
			||||||
    - Stack Traceback (if the application dumps core)
 | 
					    - Stack Traceback (if the application dumps core)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 Report the bug to the OpenSSL project at:
 | 
					 Report the bug to the OpenSSL project via the Request Tracker
 | 
				
			||||||
 | 
					 (http://www.openssl.org/support/rt2.html) by mail to:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    openssl-bugs@openssl.org
 | 
					    openssl-bugs@openssl.org
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 Note that mail to openssl-bugs@openssl.org is forwarded to a public
 | 
					 Note that mail to openssl-bugs@openssl.org is recorded in the publicly
 | 
				
			||||||
 | 
					 readable request tracker database and is forwarded to a public
 | 
				
			||||||
 mailing list. Confidential mail may be sent to openssl-security@openssl.org
 | 
					 mailing list. Confidential mail may be sent to openssl-security@openssl.org
 | 
				
			||||||
 (PGP key available from the key servers).
 | 
					 (PGP key available from the key servers).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -164,7 +173,9 @@
 | 
				
			|||||||
 textual explanation of what your patch does.
 | 
					 textual explanation of what your patch does.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 Note: For legal reasons, contributions from the US can be accepted only
 | 
					 Note: For legal reasons, contributions from the US can be accepted only
 | 
				
			||||||
 if a copy of the patch is sent to crypt@bxa.doc.gov
 | 
					 if a TSA notification and a copy of the patch is sent to crypt@bis.doc.gov;
 | 
				
			||||||
 | 
					 see http://www.bis.doc.gov/Encryption/PubAvailEncSourceCodeNofify.html [sic]
 | 
				
			||||||
 | 
					 and http://w3.access.gpo.gov/bis/ear/pdf/740.pdf (EAR Section 740.13(e)).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 The preferred format for changes is "diff -u" output. You might
 | 
					 The preferred format for changes is "diff -u" output. You might
 | 
				
			||||||
 generate it like this:
 | 
					 generate it like this:
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										290
									
								
								README.ENGINE
									
									
									
									
									
								
							
							
						
						
									
										290
									
								
								README.ENGINE
									
									
									
									
									
								
							@@ -1,43 +1,289 @@
 | 
				
			|||||||
 | 
					 | 
				
			||||||
  ENGINE
 | 
					  ENGINE
 | 
				
			||||||
  ======
 | 
					  ======
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  With OpenSSL 0.9.6, a new component has been added to support external 
 | 
					  With OpenSSL 0.9.6, a new component was added to support alternative
 | 
				
			||||||
  crypto devices, for example accelerator cards.  The component is called
 | 
					  cryptography implementations, most commonly for interfacing with external
 | 
				
			||||||
  ENGINE, and has still a pretty experimental status and almost no
 | 
					  crypto devices (eg. accelerator cards). This component is called ENGINE,
 | 
				
			||||||
  documentation.  It's designed to be faily easily extensible by the
 | 
					  and its presence in OpenSSL 0.9.6 (and subsequent bug-fix releases)
 | 
				
			||||||
  calling programs.
 | 
					  caused a little confusion as 0.9.6** releases were rolled in two
 | 
				
			||||||
 | 
					  versions, a "standard" and an "engine" version. In development for 0.9.7,
 | 
				
			||||||
 | 
					  the ENGINE code has been merged into the main branch and will be present
 | 
				
			||||||
 | 
					  in the standard releases from 0.9.7 forwards.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  There's currently built-in support for the following crypto devices:
 | 
					  There are currently built-in ENGINE implementations for the following
 | 
				
			||||||
 | 
					  crypto devices:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      o CryptoSwift
 | 
					      o CryptoSwift
 | 
				
			||||||
      o Compaq Atalla
 | 
					      o Compaq Atalla
 | 
				
			||||||
      o nCipher CHIL
 | 
					      o nCipher CHIL
 | 
				
			||||||
      o Nuron
 | 
					      o Nuron
 | 
				
			||||||
 | 
					      o Broadcom uBSec
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  A number of things are still needed and are being worked on:
 | 
					  In addition, dynamic binding to external ENGINE implementations is now
 | 
				
			||||||
 | 
					  provided by a special ENGINE called "dynamic". See the "DYNAMIC ENGINE"
 | 
				
			||||||
 | 
					  section below for details.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      o A better way of handling the methods that are handled by the
 | 
					  At this stage, a number of things are still needed and are being worked on:
 | 
				
			||||||
        engines.
 | 
					
 | 
				
			||||||
      o Documentation!
 | 
					      1 Integration of EVP support.
 | 
				
			||||||
 | 
					      2 Configuration support.
 | 
				
			||||||
 | 
					      3 Documentation!
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					1 With respect to EVP, this relates to support for ciphers and digests in
 | 
				
			||||||
 | 
					  the ENGINE model so that alternative implementations of existing
 | 
				
			||||||
 | 
					  algorithms/modes (or previously unimplemented ones) can be provided by
 | 
				
			||||||
 | 
					  ENGINE implementations.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					2 Configuration support currently exists in the ENGINE API itself, in the
 | 
				
			||||||
 | 
					  form of "control commands". These allow an application to expose to the
 | 
				
			||||||
 | 
					  user/admin the set of commands and parameter types a given ENGINE
 | 
				
			||||||
 | 
					  implementation supports, and for an application to directly feed string
 | 
				
			||||||
 | 
					  based input to those ENGINEs, in the form of name-value pairs. This is an
 | 
				
			||||||
 | 
					  extensible way for ENGINEs to define their own "configuration" mechanisms
 | 
				
			||||||
 | 
					  that are specific to a given ENGINE (eg. for a particular hardware
 | 
				
			||||||
 | 
					  device) but that should be consistent across *all* OpenSSL-based
 | 
				
			||||||
 | 
					  applications when they use that ENGINE. Work is in progress (or at least
 | 
				
			||||||
 | 
					  in planning) for supporting these control commands from the CONF (or
 | 
				
			||||||
 | 
					  NCONF) code so that applications using OpenSSL's existing configuration
 | 
				
			||||||
 | 
					  file format can have ENGINE settings specified in much the same way.
 | 
				
			||||||
 | 
					  Presently however, applications must use the ENGINE API itself to provide
 | 
				
			||||||
 | 
					  such functionality. To see first hand the types of commands available
 | 
				
			||||||
 | 
					  with the various compiled-in ENGINEs (see further down for dynamic
 | 
				
			||||||
 | 
					  ENGINEs), use the "engine" openssl utility with full verbosity, ie;
 | 
				
			||||||
 | 
					       openssl engine -vvvv
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					3 Documentation? Volunteers welcome! The source code is reasonably well
 | 
				
			||||||
 | 
					  self-documenting, but some summaries and usage instructions are needed -
 | 
				
			||||||
 | 
					  moreover, they are needed in the same POD format the existing OpenSSL
 | 
				
			||||||
 | 
					  documentation is provided in. Any complete or incomplete contributions
 | 
				
			||||||
 | 
					  would help make this happen.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  STABILITY & BUG-REPORTS
 | 
				
			||||||
 | 
					  =======================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  What already exists is fairly stable as far as it has been tested, but
 | 
					  What already exists is fairly stable as far as it has been tested, but
 | 
				
			||||||
  the test base has been a bit small most of the time.
 | 
					  the test base has been a bit small most of the time. For the most part,
 | 
				
			||||||
 | 
					  the vendors of the devices these ENGINEs support have contributed to the
 | 
				
			||||||
 | 
					  development and/or testing of the implementations, and *usually* (with no
 | 
				
			||||||
 | 
					  guarantees) have experience in using the ENGINE support to drive their
 | 
				
			||||||
 | 
					  devices from common OpenSSL-based applications. Bugs and/or inexplicable
 | 
				
			||||||
 | 
					  behaviour in using a specific ENGINE implementation should be sent to the
 | 
				
			||||||
 | 
					  author of that implementation (if it is mentioned in the corresponding C
 | 
				
			||||||
 | 
					  file), and in the case of implementations for commercial hardware
 | 
				
			||||||
 | 
					  devices, also through whatever vendor support channels are available.  If
 | 
				
			||||||
 | 
					  none of this is possible, or the problem seems to be something about the
 | 
				
			||||||
 | 
					  ENGINE API itself (ie. not necessarily specific to a particular ENGINE
 | 
				
			||||||
 | 
					  implementation) then you should mail complete details to the relevant
 | 
				
			||||||
 | 
					  OpenSSL mailing list. For a definition of "complete details", refer to
 | 
				
			||||||
 | 
					  the OpenSSL "README" file. As for which list to send it to;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					     openssl-users: if you are *using* the ENGINE abstraction, either in an
 | 
				
			||||||
 | 
					          pre-compiled application or in your own application code.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  No external crypto device is chosen unless you say so.  You have actively
 | 
					     openssl-dev: if you are discussing problems with OpenSSL source code.
 | 
				
			||||||
  tell the openssl utility commands to use it through a new command line
 | 
					 | 
				
			||||||
  switch called "-engine".  And if you want to use the ENGINE library to
 | 
					 | 
				
			||||||
  do something similar, you must also explicitely choose an external crypto
 | 
					 | 
				
			||||||
  device, or the built-in crypto routines will be used, just as in the
 | 
					 | 
				
			||||||
  default OpenSSL distribution.
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  USAGE
 | 
				
			||||||
 | 
					  =====
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  The default "openssl" ENGINE is always chosen when performing crypto
 | 
				
			||||||
 | 
					  operations unless you specify otherwise. You must actively tell the
 | 
				
			||||||
 | 
					  openssl utility commands to use anything else through a new command line
 | 
				
			||||||
 | 
					  switch called "-engine". Also, if you want to use the ENGINE support in
 | 
				
			||||||
 | 
					  your own code to do something similar, you must likewise explicitly
 | 
				
			||||||
 | 
					  select the ENGINE implementation you want.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Depending on the type of hardware, system, and configuration, "settings"
 | 
				
			||||||
 | 
					  may need to be applied to an ENGINE for it to function as expected/hoped.
 | 
				
			||||||
 | 
					  The recommended way of doing this is for the application to support
 | 
				
			||||||
 | 
					  ENGINE "control commands" so that each ENGINE implementation can provide
 | 
				
			||||||
 | 
					  whatever configuration primitives it might require and the application
 | 
				
			||||||
 | 
					  can allow the user/admin (and thus the hardware vendor's support desk
 | 
				
			||||||
 | 
					  also) to provide any such input directly to the ENGINE implementation.
 | 
				
			||||||
 | 
					  This way, applications do not need to know anything specific to any
 | 
				
			||||||
 | 
					  device, they only need to provide the means to carry such user/admin
 | 
				
			||||||
 | 
					  input through to the ENGINE in question. Ie. this connects *you* (and
 | 
				
			||||||
 | 
					  your helpdesk) to the specific ENGINE implementation (and device), and
 | 
				
			||||||
 | 
					  allows application authors to not get buried in hassle supporting
 | 
				
			||||||
 | 
					  arbitrary devices they know (and care) nothing about.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  A new "openssl" utility, "openssl engine", has been added in that allows
 | 
				
			||||||
 | 
					  for testing and examination of ENGINE implementations. Basic usage
 | 
				
			||||||
 | 
					  instructions are available by specifying the "-?" command line switch.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  DYNAMIC ENGINES
 | 
				
			||||||
 | 
					  ===============
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  The new "dynamic" ENGINE provides a low-overhead way to support ENGINE
 | 
				
			||||||
 | 
					  implementations that aren't pre-compiled and linked into OpenSSL-based
 | 
				
			||||||
 | 
					  applications. This could be because existing compiled-in implementations
 | 
				
			||||||
 | 
					  have known problems and you wish to use a newer version with an existing
 | 
				
			||||||
 | 
					  application. It could equally be because the application (or OpenSSL
 | 
				
			||||||
 | 
					  library) you are using simply doesn't have support for the ENGINE you
 | 
				
			||||||
 | 
					  wish to use, and the ENGINE provider (eg. hardware vendor) is providing
 | 
				
			||||||
 | 
					  you with a self-contained implementation in the form of a shared-library.
 | 
				
			||||||
 | 
					  The other use-case for "dynamic" is with applications that wish to
 | 
				
			||||||
 | 
					  maintain the smallest foot-print possible and so do not link in various
 | 
				
			||||||
 | 
					  ENGINE implementations from OpenSSL, but instead leaves you to provide
 | 
				
			||||||
 | 
					  them, if you want them, in the form of "dynamic"-loadable
 | 
				
			||||||
 | 
					  shared-libraries. It should be possible for hardware vendors to provide
 | 
				
			||||||
 | 
					  their own shared-libraries to support arbitrary hardware to work with
 | 
				
			||||||
 | 
					  applications based on OpenSSL 0.9.7 or later. If you're using an
 | 
				
			||||||
 | 
					  application based on 0.9.7 (or later) and the support you desire is only
 | 
				
			||||||
 | 
					  announced for versions later than the one you need, ask the vendor to
 | 
				
			||||||
 | 
					  backport their ENGINE to the version you need.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  How does "dynamic" work?
 | 
				
			||||||
 | 
					  ------------------------
 | 
				
			||||||
 | 
					    The dynamic ENGINE has a special flag in its implementation such that
 | 
				
			||||||
 | 
					    every time application code asks for the 'dynamic' ENGINE, it in fact
 | 
				
			||||||
 | 
					    gets its own copy of it. As such, multi-threaded code (or code that
 | 
				
			||||||
 | 
					    multiplexes multiple uses of 'dynamic' in a single application in any
 | 
				
			||||||
 | 
					    way at all) does not get confused by 'dynamic' being used to do many
 | 
				
			||||||
 | 
					    independent things. Other ENGINEs typically don't do this so there is
 | 
				
			||||||
 | 
					    only ever 1 ENGINE structure of its type (and reference counts are used
 | 
				
			||||||
 | 
					    to keep order). The dynamic ENGINE itself provides absolutely no
 | 
				
			||||||
 | 
					    cryptographic functionality, and any attempt to "initialise" the ENGINE
 | 
				
			||||||
 | 
					    automatically fails. All it does provide are a few "control commands"
 | 
				
			||||||
 | 
					    that can be used to control how it will load an external ENGINE
 | 
				
			||||||
 | 
					    implementation from a shared-library. To see these control commands,
 | 
				
			||||||
 | 
					    use the command-line;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					       openssl engine -vvvv dynamic
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    The "SO_PATH" control command should be used to identify the
 | 
				
			||||||
 | 
					    shared-library that contains the ENGINE implementation, and "NO_VCHECK"
 | 
				
			||||||
 | 
					    might possibly be useful if there is a minor version conflict and you
 | 
				
			||||||
 | 
					    (or a vendor helpdesk) is convinced you can safely ignore it.
 | 
				
			||||||
 | 
					    "ID" is probably only needed if a shared-library implements
 | 
				
			||||||
 | 
					    multiple ENGINEs, but if you know the engine id you expect to be using,
 | 
				
			||||||
 | 
					    it doesn't hurt to specify it (and this provides a sanity check if
 | 
				
			||||||
 | 
					    nothing else). "LIST_ADD" is only required if you actually wish the
 | 
				
			||||||
 | 
					    loaded ENGINE to be discoverable by application code later on using the
 | 
				
			||||||
 | 
					    ENGINE's "id". For most applications, this isn't necessary - but some
 | 
				
			||||||
 | 
					    application authors may have nifty reasons for using it. The "LOAD"
 | 
				
			||||||
 | 
					    command is the only one that takes no parameters and is the command
 | 
				
			||||||
 | 
					    that uses the settings from any previous commands to actually *load*
 | 
				
			||||||
 | 
					    the shared-library ENGINE implementation. If this command succeeds, the
 | 
				
			||||||
 | 
					    (copy of the) 'dynamic' ENGINE will magically morph into the ENGINE
 | 
				
			||||||
 | 
					    that has been loaded from the shared-library. As such, any control
 | 
				
			||||||
 | 
					    commands supported by the loaded ENGINE could then be executed as per
 | 
				
			||||||
 | 
					    normal. Eg. if ENGINE "foo" is implemented in the shared-library
 | 
				
			||||||
 | 
					    "libfoo.so" and it supports some special control command "CMD_FOO", the
 | 
				
			||||||
 | 
					    following code would load and use it (NB: obviously this code has no
 | 
				
			||||||
 | 
					    error checking);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					       ENGINE *e = ENGINE_by_id("dynamic");
 | 
				
			||||||
 | 
					       ENGINE_ctrl_cmd_string(e, "SO_PATH", "/lib/libfoo.so", 0);
 | 
				
			||||||
 | 
					       ENGINE_ctrl_cmd_string(e, "ID", "foo", 0);
 | 
				
			||||||
 | 
					       ENGINE_ctrl_cmd_string(e, "LOAD", NULL, 0);
 | 
				
			||||||
 | 
					       ENGINE_ctrl_cmd_string(e, "CMD_FOO", "some input data", 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    For testing, the "openssl engine" utility can be useful for this sort
 | 
				
			||||||
 | 
					    of thing. For example the above code excerpt would achieve much the
 | 
				
			||||||
 | 
					    same result as;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					       openssl engine dynamic \
 | 
				
			||||||
 | 
					                 -pre SO_PATH:/lib/libfoo.so \
 | 
				
			||||||
 | 
					                 -pre ID:foo \
 | 
				
			||||||
 | 
					                 -pre LOAD \
 | 
				
			||||||
 | 
					                 -pre "CMD_FOO:some input data"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Or to simply see the list of commands supported by the "foo" ENGINE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					       openssl engine -vvvv dynamic \
 | 
				
			||||||
 | 
					                 -pre SO_PATH:/lib/libfoo.so \
 | 
				
			||||||
 | 
					                 -pre ID:foo \
 | 
				
			||||||
 | 
					                 -pre LOAD
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Applications that support the ENGINE API and more specifically, the
 | 
				
			||||||
 | 
					    "control commands" mechanism, will provide some way for you to pass
 | 
				
			||||||
 | 
					    such commands through to ENGINEs. As such, you would select "dynamic"
 | 
				
			||||||
 | 
					    as the ENGINE to use, and the parameters/commands you pass would
 | 
				
			||||||
 | 
					    control the *actual* ENGINE used. Each command is actually a name-value
 | 
				
			||||||
 | 
					    pair and the value can sometimes be omitted (eg. the "LOAD" command).
 | 
				
			||||||
 | 
					    Whilst the syntax demonstrated in "openssl engine" uses a colon to
 | 
				
			||||||
 | 
					    separate the command name from the value, applications may provide
 | 
				
			||||||
 | 
					    their own syntax for making that separation (eg. a win32 registry
 | 
				
			||||||
 | 
					    key-value pair may be used by some applications). The reason for the
 | 
				
			||||||
 | 
					    "-pre" syntax in the "openssl engine" utility is that some commands
 | 
				
			||||||
 | 
					    might be issued to an ENGINE *after* it has been initialised for use.
 | 
				
			||||||
 | 
					    Eg. if an ENGINE implementation requires a smart-card to be inserted
 | 
				
			||||||
 | 
					    during initialisation (or a PIN to be typed, or whatever), there may be
 | 
				
			||||||
 | 
					    a control command you can issue afterwards to "forget" the smart-card
 | 
				
			||||||
 | 
					    so that additional initialisation is no longer possible. In
 | 
				
			||||||
 | 
					    applications such as web-servers, where potentially volatile code may
 | 
				
			||||||
 | 
					    run on the same host system, this may provide some arguable security
 | 
				
			||||||
 | 
					    value. In such a case, the command would be passed to the ENGINE after
 | 
				
			||||||
 | 
					    it has been initialised for use, and so the "-post" switch would be
 | 
				
			||||||
 | 
					    used instead. Applications may provide a different syntax for
 | 
				
			||||||
 | 
					    supporting this distinction, and some may simply not provide it at all
 | 
				
			||||||
 | 
					    ("-pre" is almost always what you're after, in reality).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  How do I build a "dynamic" ENGINE?
 | 
				
			||||||
 | 
					  ----------------------------------
 | 
				
			||||||
 | 
					    This question is trickier - currently OpenSSL bundles various ENGINE
 | 
				
			||||||
 | 
					    implementations that are statically built in, and any application that
 | 
				
			||||||
 | 
					    calls the "ENGINE_load_builtin_engines()" function will automatically
 | 
				
			||||||
 | 
					    have all such ENGINEs available (and occupying memory). Applications
 | 
				
			||||||
 | 
					    that don't call that function have no ENGINEs available like that and
 | 
				
			||||||
 | 
					    would have to use "dynamic" to load any such ENGINE - but on the other
 | 
				
			||||||
 | 
					    hand such applications would only have the memory footprint of any
 | 
				
			||||||
 | 
					    ENGINEs explicitly loaded using user/admin provided control commands.
 | 
				
			||||||
 | 
					    The main advantage of not statically linking ENGINEs and only using
 | 
				
			||||||
 | 
					    "dynamic" for hardware support is that any installation using no
 | 
				
			||||||
 | 
					    "external" ENGINE suffers no unnecessary memory footprint from unused
 | 
				
			||||||
 | 
					    ENGINEs. Likewise, installations that do require an ENGINE incur the
 | 
				
			||||||
 | 
					    overheads from only *that* ENGINE once it has been loaded.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Sounds good? Maybe, but currently building an ENGINE implementation as
 | 
				
			||||||
 | 
					    a shared-library that can be loaded by "dynamic" isn't automated in
 | 
				
			||||||
 | 
					    OpenSSL's build process. It can be done manually quite easily however.
 | 
				
			||||||
 | 
					    Such a shared-library can either be built with any OpenSSL code it
 | 
				
			||||||
 | 
					    needs statically linked in, or it can link dynamically against OpenSSL
 | 
				
			||||||
 | 
					    if OpenSSL itself is built as a shared library. The instructions are
 | 
				
			||||||
 | 
					    the same in each case, but in the former (statically linked any
 | 
				
			||||||
 | 
					    dependencies on OpenSSL) you must ensure OpenSSL is built with
 | 
				
			||||||
 | 
					    position-independent code ("PIC"). The default OpenSSL compilation may
 | 
				
			||||||
 | 
					    already specify the relevant flags to do this, but you should consult
 | 
				
			||||||
 | 
					    with your compiler documentation if you are in any doubt.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    This example will show building the "atalla" ENGINE in the
 | 
				
			||||||
 | 
					    crypto/engine/ directory as a shared-library for use via the "dynamic"
 | 
				
			||||||
 | 
					    ENGINE.
 | 
				
			||||||
 | 
					    1) "cd" to the crypto/engine/ directory of a pre-compiled OpenSSL
 | 
				
			||||||
 | 
					       source tree.
 | 
				
			||||||
 | 
					    2) Recompile at least one source file so you can see all the compiler
 | 
				
			||||||
 | 
					       flags (and syntax) being used to build normally. Eg;
 | 
				
			||||||
 | 
					           touch hw_atalla.c ; make
 | 
				
			||||||
 | 
					       will rebuild "hw_atalla.o" using all such flags.
 | 
				
			||||||
 | 
					    3) Manually enter the same compilation line to compile the
 | 
				
			||||||
 | 
					       "hw_atalla.c" file but with the following two changes;
 | 
				
			||||||
 | 
					         (a) add "-DENGINE_DYNAMIC_SUPPORT" to the command line switches,
 | 
				
			||||||
 | 
						 (b) change the output file from "hw_atalla.o" to something new,
 | 
				
			||||||
 | 
					             eg. "tmp_atalla.o"
 | 
				
			||||||
 | 
					    4) Link "tmp_atalla.o" into a shared-library using the top-level
 | 
				
			||||||
 | 
					       OpenSSL libraries to resolve any dependencies. The syntax for doing
 | 
				
			||||||
 | 
					       this depends heavily on your system/compiler and is a nightmare
 | 
				
			||||||
 | 
					       known well to anyone who has worked with shared-library portability
 | 
				
			||||||
 | 
					       before. 'gcc' on Linux, for example, would use the following syntax;
 | 
				
			||||||
 | 
					          gcc -shared -o dyn_atalla.so tmp_atalla.o -L../.. -lcrypto
 | 
				
			||||||
 | 
					    5) Test your shared library using "openssl engine" as explained in the
 | 
				
			||||||
 | 
					       previous section. Eg. from the top-level directory, you might try;
 | 
				
			||||||
 | 
					          apps/openssl engine -vvvv dynamic \
 | 
				
			||||||
 | 
					              -pre SO_PATH:./crypto/engine/dyn_atalla.so -pre LOAD
 | 
				
			||||||
 | 
					       If the shared-library loads successfully, you will see both "-pre"
 | 
				
			||||||
 | 
					       commands marked as "SUCCESS" and the list of control commands
 | 
				
			||||||
 | 
					       displayed (because of "-vvvv") will be the control commands for the
 | 
				
			||||||
 | 
					       *atalla* ENGINE (ie. *not* the 'dynamic' ENGINE). You can also add
 | 
				
			||||||
 | 
					       the "-t" switch to the utility if you want it to try and initialise
 | 
				
			||||||
 | 
					       the atalla ENGINE for use to test any possible hardware/driver
 | 
				
			||||||
 | 
					       issues.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  PROBLEMS
 | 
					  PROBLEMS
 | 
				
			||||||
  ========
 | 
					  ========
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  It seems like the ENGINE part doesn't work too well with Cryptoswift on
 | 
					  It seems like the ENGINE part doesn't work too well with CryptoSwift on Win32.
 | 
				
			||||||
  Win32.  A quick test done right before the release showed that trying
 | 
					  A quick test done right before the release showed that trying "openssl speed
 | 
				
			||||||
  "openssl speed -engine cswift" generated errors.  If the DSO gets enabled,
 | 
					  -engine cswift" generated errors. If the DSO gets enabled, an attempt is made
 | 
				
			||||||
  an attempt is made to write at memory address 0x00000002.
 | 
					  to write at memory address 0x00000002.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										71
									
								
								STATUS
									
									
									
									
									
								
							
							
						
						
									
										71
									
								
								STATUS
									
									
									
									
									
								
							@@ -1,11 +1,21 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  OpenSSL STATUS                           Last modified at
 | 
					  OpenSSL STATUS                           Last modified at
 | 
				
			||||||
  ______________                           $Date: 2001/02/22 15:10:11 $
 | 
					  ______________                           $Date: 2002/11/19 09:34:38 $
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  DEVELOPMENT STATE
 | 
					  DEVELOPMENT STATE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    o  OpenSSL 0.9.7:  Under development...
 | 
					    o  OpenSSL 0.9.8:  Under development...
 | 
				
			||||||
    o  OpenSSL 0.9.6a: Bugfix release -- under development...
 | 
					    o  OpenSSL 0.9.7-beta4: Released on November 19th, 2002
 | 
				
			||||||
 | 
					    o  OpenSSL 0.9.7-beta3: Released on July 30th, 2002
 | 
				
			||||||
 | 
					    o  OpenSSL 0.9.7-beta2: Released on June 16th, 2002
 | 
				
			||||||
 | 
					    o  OpenSSL 0.9.7-beta1: Released on June  1st, 2002
 | 
				
			||||||
 | 
					    o  OpenSSL 0.9.6g: Released on August     9th, 2002
 | 
				
			||||||
 | 
					    o  OpenSSL 0.9.6f: Released on August     8th, 2002
 | 
				
			||||||
 | 
					    o  OpenSSL 0.9.6e: Released on July      30th, 2002
 | 
				
			||||||
 | 
					    o  OpenSSL 0.9.6d: Released on May        9th, 2002
 | 
				
			||||||
 | 
					    o  OpenSSL 0.9.6c: Released on December  21st, 2001
 | 
				
			||||||
 | 
					    o  OpenSSL 0.9.6b: Released on July       9th, 2001
 | 
				
			||||||
 | 
					    o  OpenSSL 0.9.6a: Released on April      5th, 2001
 | 
				
			||||||
    o  OpenSSL 0.9.6:  Released on September 24th, 2000
 | 
					    o  OpenSSL 0.9.6:  Released on September 24th, 2000
 | 
				
			||||||
    o  OpenSSL 0.9.5a: Released on April      1st, 2000
 | 
					    o  OpenSSL 0.9.5a: Released on April      1st, 2000
 | 
				
			||||||
    o  OpenSSL 0.9.5:  Released on February  28th, 2000
 | 
					    o  OpenSSL 0.9.5:  Released on February  28th, 2000
 | 
				
			||||||
@@ -15,13 +25,16 @@
 | 
				
			|||||||
    o  OpenSSL 0.9.2b: Released on March     22th, 1999
 | 
					    o  OpenSSL 0.9.2b: Released on March     22th, 1999
 | 
				
			||||||
    o  OpenSSL 0.9.1c: Released on December  23th, 1998
 | 
					    o  OpenSSL 0.9.1c: Released on December  23th, 1998
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  [See also http://www.openssl.org/support/rt2.html]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  RELEASE SHOWSTOPPERS
 | 
					  RELEASE SHOWSTOPPERS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    o
 | 
					    o BN_mod_mul verification fails for mips3-sgi-irix
 | 
				
			||||||
 | 
					      unless configured with no-asm
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  AVAILABLE PATCHES
 | 
					  AVAILABLE PATCHES
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    o
 | 
					    o 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  IN PROGRESS
 | 
					  IN PROGRESS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -36,32 +49,22 @@
 | 
				
			|||||||
    o Geoff and Richard are currently working on:
 | 
					    o Geoff and Richard are currently working on:
 | 
				
			||||||
	ENGINE (the new code that gives hardware support among others).
 | 
						ENGINE (the new code that gives hardware support among others).
 | 
				
			||||||
    o Richard is currently working on:
 | 
					    o Richard is currently working on:
 | 
				
			||||||
 | 
						UI (User Interface)
 | 
				
			||||||
	UTIL (a new set of library functions to support some higher level
 | 
						UTIL (a new set of library functions to support some higher level
 | 
				
			||||||
	      functionality that is currently missing).
 | 
						      functionality that is currently missing).
 | 
				
			||||||
	Shared library support for VMS.
 | 
						Shared library support for VMS.
 | 
				
			||||||
	OCSP
 | 
					 | 
				
			||||||
	Kerberos 5 authentication
 | 
						Kerberos 5 authentication
 | 
				
			||||||
	Constification
 | 
						Constification
 | 
				
			||||||
 | 
						OCSP
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  NEEDS PATCH
 | 
					  NEEDS PATCH
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    o  apps/ca.c: "Sign the certificate?" - "n" creates empty certificate file
 | 
					    o  apps/ca.c: "Sign the certificate?" - "n" creates empty certificate file
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    o  OpenSSL_0_9_6-stable:
 | 
					    o  "OpenSSL STATUS" is never up-to-date.
 | 
				
			||||||
       #include <openssl/e_os.h> in exported header files is illegal since
 | 
					 | 
				
			||||||
       e_os.h is suitable only for library-internal use.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    o  Whenever strncpy is used, make sure the resulting string is NULL-terminated
 | 
					 | 
				
			||||||
       or an error is reported
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  OPEN ISSUES
 | 
					  OPEN ISSUES
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    o  crypto/ex_data.c is not really thread-safe and so must be used
 | 
					 | 
				
			||||||
       with care (e.g., extra locking where necessary, or don't call
 | 
					 | 
				
			||||||
       CRYPTO_get_ex_new_index once multiple threads exist).
 | 
					 | 
				
			||||||
       The current API is not suitable for everything that it pretends
 | 
					 | 
				
			||||||
       to offer.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    o  The Makefile hierarchy and build mechanism is still not a round thing:
 | 
					    o  The Makefile hierarchy and build mechanism is still not a round thing:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       1. The config vs. Configure scripts
 | 
					       1. The config vs. Configure scripts
 | 
				
			||||||
@@ -86,22 +89,20 @@
 | 
				
			|||||||
                    which apparently is not flexible enough to generate
 | 
					                    which apparently is not flexible enough to generate
 | 
				
			||||||
                    libcrypto)
 | 
					                    libcrypto)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
    o  The perl/ stuff needs a major overhaul. Currently it's
 | 
					 | 
				
			||||||
       totally obsolete. Either we clean it up and enhance it to be up-to-date
 | 
					 | 
				
			||||||
       with the C code or we also could replace it with the really nice
 | 
					 | 
				
			||||||
       Net::SSLeay package we can find under
 | 
					 | 
				
			||||||
       http://www.neuronio.pt/SSLeay.pm.html.  Ralf uses this package for a
 | 
					 | 
				
			||||||
       longer time and it works fine and is a nice Perl module. Best would be
 | 
					 | 
				
			||||||
       to convince the author to work for the OpenSSL project and create a
 | 
					 | 
				
			||||||
       Net::OpenSSL or Crypt::OpenSSL package out of it and maintains it for
 | 
					 | 
				
			||||||
       us.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
       Status: Ralf thinks we should both contact the author of Net::SSLeay
 | 
					 | 
				
			||||||
               and look how much effort it is to bring Eric's perl/ stuff up
 | 
					 | 
				
			||||||
               to date.
 | 
					 | 
				
			||||||
               Paul +1
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  WISHES
 | 
					  WISHES
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    o 
 | 
					    o  Add variants of DH_generate_parameters() and BN_generate_prime() [etc?]
 | 
				
			||||||
 | 
					       where the callback function can request that the function be aborted.
 | 
				
			||||||
 | 
					       [Gregory Stark <ghstark@pobox.com>, <rayyang2000@yahoo.com>]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    o  SRP in TLS.
 | 
				
			||||||
 | 
					       [wished by:
 | 
				
			||||||
 | 
					        Dj <derek@yo.net>, Tom Wu <tom@arcot.com>,
 | 
				
			||||||
 | 
					        Tom Holroyd <tomh@po.crl.go.jp>]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					       See http://search.ietf.org/internet-drafts/draft-ietf-tls-srp-00.txt
 | 
				
			||||||
 | 
					       as well as http://www-cs-students.stanford.edu/~tjw/srp/.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					       Tom Holroyd tells us there is a SRP patch for OpenSSH at
 | 
				
			||||||
 | 
					       http://members.tripod.com/professor_tom/archives/, that could
 | 
				
			||||||
 | 
					       be useful.
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										353
									
								
								VMS/mkshared.com
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										353
									
								
								VMS/mkshared.com
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,353 @@
 | 
				
			|||||||
 | 
					$! MKSHARED.COM -- script to created shareable images on VMS
 | 
				
			||||||
 | 
					$!
 | 
				
			||||||
 | 
					$! No command line parameters.  This should be run at the start of the source
 | 
				
			||||||
 | 
					$! tree (the same directory where one finds INSTALL.VMS).
 | 
				
			||||||
 | 
					$!
 | 
				
			||||||
 | 
					$! Input:	[.UTIL]LIBEAY.NUM,[.AXP.EXE.CRYPTO]LIBCRYPTO.OLB
 | 
				
			||||||
 | 
					$!		[.UTIL]SSLEAY.NUM,[.AXP.EXE.SSL]LIBSSL.OLB
 | 
				
			||||||
 | 
					$! Output:	[.AXP.EXE.CRYPTO]LIBCRYPTO.OPT,.MAP,.EXE
 | 
				
			||||||
 | 
					$!		[.AXP.EXE.SSL]LIBSSL.OPT,.MAP,.EXE
 | 
				
			||||||
 | 
					$!
 | 
				
			||||||
 | 
					$! So far, tests have only been made on VMS for Alpha.  VAX will come in time.
 | 
				
			||||||
 | 
					$! ===========================================================================
 | 
				
			||||||
 | 
					$
 | 
				
			||||||
 | 
					$! ----- Prepare info for processing: version number and file info
 | 
				
			||||||
 | 
					$ gosub read_version_info
 | 
				
			||||||
 | 
					$ if libver .eqs. ""
 | 
				
			||||||
 | 
					$ then
 | 
				
			||||||
 | 
					$   write sys$error "ERROR: Couldn't find any library version info..."
 | 
				
			||||||
 | 
					$   exit
 | 
				
			||||||
 | 
					$ endif
 | 
				
			||||||
 | 
					$
 | 
				
			||||||
 | 
					$ if f$getsyi("CPU") .ge. 128
 | 
				
			||||||
 | 
					$ then
 | 
				
			||||||
 | 
					$   libid  = "Crypto"
 | 
				
			||||||
 | 
					$   libnum = "[.UTIL]LIBEAY.NUM"
 | 
				
			||||||
 | 
					$   libdir = "[.AXP.EXE.CRYPTO]"
 | 
				
			||||||
 | 
					$   libolb = "''libdir'LIBCRYPTO.OLB"
 | 
				
			||||||
 | 
					$   libopt = "''libdir'LIBCRYPTO.OPT"
 | 
				
			||||||
 | 
					$   libmap = "''libdir'LIBCRYPTO.MAP"
 | 
				
			||||||
 | 
					$   libgoal= "''libdir'LIBCRYPTO.EXE"
 | 
				
			||||||
 | 
					$   libref = ""
 | 
				
			||||||
 | 
					$   gosub create_axp_shr
 | 
				
			||||||
 | 
					$   libid  = "SSL"
 | 
				
			||||||
 | 
					$   libnum = "[.UTIL]SSLEAY.NUM"
 | 
				
			||||||
 | 
					$   libdir = "[.AXP.EXE.SSL]"
 | 
				
			||||||
 | 
					$   libolb = "''libdir'LIBSSL.OLB"
 | 
				
			||||||
 | 
					$   libopt = "''libdir'LIBSSL.OPT"
 | 
				
			||||||
 | 
					$   libmap = "''libdir'LIBSSL.MAP"
 | 
				
			||||||
 | 
					$   libgoal= "''libdir'LIBSSL.EXE"
 | 
				
			||||||
 | 
					$   libref = "[.AXP.EXE.CRYPTO]LIBCRYPTO.EXE"
 | 
				
			||||||
 | 
					$   gosub create_axp_shr
 | 
				
			||||||
 | 
					$ else
 | 
				
			||||||
 | 
					$   libtit = "CRYPTO_TRANSFER_VECTOR"
 | 
				
			||||||
 | 
					$   libid  = "Crypto"
 | 
				
			||||||
 | 
					$   libnum = "[.UTIL]LIBEAY.NUM"
 | 
				
			||||||
 | 
					$   libdir = "[.VAX.EXE.CRYPTO]"
 | 
				
			||||||
 | 
					$   libmar = "''libdir'LIBCRYPTO.MAR"
 | 
				
			||||||
 | 
					$   libolb = "''libdir'LIBCRYPTO.OLB"
 | 
				
			||||||
 | 
					$   libopt = "''libdir'LIBCRYPTO.OPT"
 | 
				
			||||||
 | 
					$   libobj = "''libdir'LIBCRYPTO.OBJ"
 | 
				
			||||||
 | 
					$   libmap = "''libdir'LIBCRYPTO.MAP"
 | 
				
			||||||
 | 
					$   libgoal= "''libdir'LIBCRYPTO.EXE"
 | 
				
			||||||
 | 
					$   libref = ""
 | 
				
			||||||
 | 
					$   libvec = "LIBCRYPTO"
 | 
				
			||||||
 | 
					$   gosub create_vax_shr
 | 
				
			||||||
 | 
					$   libtit = "SSL_TRANSFER_VECTOR"
 | 
				
			||||||
 | 
					$   libid  = "SSL"
 | 
				
			||||||
 | 
					$   libnum = "[.UTIL]SSLEAY.NUM"
 | 
				
			||||||
 | 
					$   libdir = "[.VAX.EXE.SSL]"
 | 
				
			||||||
 | 
					$   libmar = "''libdir'LIBSSL.MAR"
 | 
				
			||||||
 | 
					$   libolb = "''libdir'LIBSSL.OLB"
 | 
				
			||||||
 | 
					$   libopt = "''libdir'LIBSSL.OPT"
 | 
				
			||||||
 | 
					$   libobj = "''libdir'LIBSSL.OBJ"
 | 
				
			||||||
 | 
					$   libmap = "''libdir'LIBSSL.MAP"
 | 
				
			||||||
 | 
					$   libgoal= "''libdir'LIBSSL.EXE"
 | 
				
			||||||
 | 
					$   libref = "[.VAX.EXE.CRYPTO]LIBCRYPTO.EXE"
 | 
				
			||||||
 | 
					$   libvec = "LIBSSL"
 | 
				
			||||||
 | 
					$   gosub create_vax_shr
 | 
				
			||||||
 | 
					$ endif
 | 
				
			||||||
 | 
					$ exit
 | 
				
			||||||
 | 
					$
 | 
				
			||||||
 | 
					$! ----- Soubroutines to actually build the shareable libraries
 | 
				
			||||||
 | 
					$! The way things work, there's a main shareable library creator for each
 | 
				
			||||||
 | 
					$! supported architecture, which is called from the main code above.
 | 
				
			||||||
 | 
					$! The creator will define a number of variables to tell the next levels of
 | 
				
			||||||
 | 
					$! subroutines what routines to use to write to the option files, call the
 | 
				
			||||||
 | 
					$! main processor, read_func_num, and when that is done, it will write version
 | 
				
			||||||
 | 
					$! data at the end of the .opt file, close it, and link the library.
 | 
				
			||||||
 | 
					$!
 | 
				
			||||||
 | 
					$! read_func_num reads through a .num file and calls the writer routine for
 | 
				
			||||||
 | 
					$! each line.  It's also responsible for checking that order is properly kept
 | 
				
			||||||
 | 
					$! in the .num file, check that each line applies to VMS and the architecture,
 | 
				
			||||||
 | 
					$! and to fill in "holes" with dummy entries.
 | 
				
			||||||
 | 
					$!
 | 
				
			||||||
 | 
					$! The creator routines depend on the following variables:
 | 
				
			||||||
 | 
					$! libnum	The name of the .num file to use as input
 | 
				
			||||||
 | 
					$! libolb	The name of the object library to build from
 | 
				
			||||||
 | 
					$! libid	The identification string of the shareable library
 | 
				
			||||||
 | 
					$! libopt	The name of the .opt file to write
 | 
				
			||||||
 | 
					$! libtit	The title of the assembler transfer vector file (VAX only)
 | 
				
			||||||
 | 
					$! libmar	The name of the assembler transfer vector file (VAX only)
 | 
				
			||||||
 | 
					$! libmap	The name of the map file to write
 | 
				
			||||||
 | 
					$! libgoal	The name of the shareable library to write
 | 
				
			||||||
 | 
					$! libref	The name of a shareable library to link in
 | 
				
			||||||
 | 
					$!
 | 
				
			||||||
 | 
					$! read_func_num depends on the following variables from the creator:
 | 
				
			||||||
 | 
					$! libwriter	The name of the writer routine to call for each .num file line
 | 
				
			||||||
 | 
					$! -----
 | 
				
			||||||
 | 
					$
 | 
				
			||||||
 | 
					$! ----- Subroutines for AXP
 | 
				
			||||||
 | 
					$! -----
 | 
				
			||||||
 | 
					$! The creator routine
 | 
				
			||||||
 | 
					$ create_axp_shr:
 | 
				
			||||||
 | 
					$   open/write opt 'libopt'
 | 
				
			||||||
 | 
					$   write opt "identification=""",libid," ",libverstr,""""
 | 
				
			||||||
 | 
					$   write opt libolb,"/lib"
 | 
				
			||||||
 | 
					$   if libref .nes. "" then write opt libref,"/SHARE"
 | 
				
			||||||
 | 
					$   write opt "SYMBOL_VECTOR=(-"
 | 
				
			||||||
 | 
					$   libfirstentry := true
 | 
				
			||||||
 | 
					$   libwrch   := opt
 | 
				
			||||||
 | 
					$   libwriter := write_axp_transfer_entry
 | 
				
			||||||
 | 
					$   textcount = 0
 | 
				
			||||||
 | 
					$   gosub read_func_num
 | 
				
			||||||
 | 
					$   write opt ")"
 | 
				
			||||||
 | 
					$   write opt "GSMATCH=",libvmatch,",",libver
 | 
				
			||||||
 | 
					$   close opt
 | 
				
			||||||
 | 
					$   link/map='libmap'/full/share='libgoal' 'libopt'/option
 | 
				
			||||||
 | 
					$   return
 | 
				
			||||||
 | 
					$
 | 
				
			||||||
 | 
					$! The record writer routine
 | 
				
			||||||
 | 
					$ write_axp_transfer_entry:
 | 
				
			||||||
 | 
					$   if libentry .eqs. ".dummy" then return
 | 
				
			||||||
 | 
					$   if info_kind .eqs. "VARIABLE"
 | 
				
			||||||
 | 
					$   then
 | 
				
			||||||
 | 
					$     pr:=DATA
 | 
				
			||||||
 | 
					$   else
 | 
				
			||||||
 | 
					$     pr:=PROCEDURE
 | 
				
			||||||
 | 
					$   endif
 | 
				
			||||||
 | 
					$   textcount_this = f$length(pr) + f$length(libentry) + 5
 | 
				
			||||||
 | 
					$   if textcount + textcount_this .gt. 1024
 | 
				
			||||||
 | 
					$   then
 | 
				
			||||||
 | 
					$     write opt ")"
 | 
				
			||||||
 | 
					$     write opt "SYMBOL_VECTOR=(-"
 | 
				
			||||||
 | 
					$     textcount = 16
 | 
				
			||||||
 | 
					$     libfirstentry := true
 | 
				
			||||||
 | 
					$   endif
 | 
				
			||||||
 | 
					$   if libfirstentry
 | 
				
			||||||
 | 
					$   then
 | 
				
			||||||
 | 
					$     write 'libwrch' "    ",libentry,"=",pr," -"
 | 
				
			||||||
 | 
					$   else
 | 
				
			||||||
 | 
					$     write 'libwrch' "    ,",libentry,"=",pr," -"
 | 
				
			||||||
 | 
					$   endif
 | 
				
			||||||
 | 
					$   libfirstentry := false
 | 
				
			||||||
 | 
					$   textcount = textcount + textcount_this
 | 
				
			||||||
 | 
					$   return
 | 
				
			||||||
 | 
					$
 | 
				
			||||||
 | 
					$! ----- Subroutines for AXP
 | 
				
			||||||
 | 
					$! -----
 | 
				
			||||||
 | 
					$! The creator routine
 | 
				
			||||||
 | 
					$ create_vax_shr:
 | 
				
			||||||
 | 
					$   open/write mar 'libmar'
 | 
				
			||||||
 | 
					$   type sys$input:/out=mar:
 | 
				
			||||||
 | 
					;
 | 
				
			||||||
 | 
					; Transfer vector for VAX shareable image
 | 
				
			||||||
 | 
					;
 | 
				
			||||||
 | 
					$   write mar "	.TITLE ",libtit
 | 
				
			||||||
 | 
					$   write mar "	.IDENT /",libid,"/"
 | 
				
			||||||
 | 
					$   type sys$input:/out=mar:
 | 
				
			||||||
 | 
					;
 | 
				
			||||||
 | 
					; Define macro to assist in building transfer vector entries.  Each entry
 | 
				
			||||||
 | 
					; should take no more than 8 bytes.
 | 
				
			||||||
 | 
					;
 | 
				
			||||||
 | 
						.MACRO FTRANSFER_ENTRY routine
 | 
				
			||||||
 | 
						.ALIGN QUAD
 | 
				
			||||||
 | 
						.TRANSFER routine
 | 
				
			||||||
 | 
						.MASK	routine
 | 
				
			||||||
 | 
						JMP	routine+2
 | 
				
			||||||
 | 
						.ENDM FTRANSFER_ENTRY
 | 
				
			||||||
 | 
					;
 | 
				
			||||||
 | 
					; Place entries in own program section.
 | 
				
			||||||
 | 
					;
 | 
				
			||||||
 | 
					$   write mar "	.PSECT $$",libvec,",QUAD,PIC,USR,CON,REL,LCL,SHR,EXE,RD,NOWRT"
 | 
				
			||||||
 | 
					$   write mar libvec,"_xfer:"
 | 
				
			||||||
 | 
					$   libwrch   := mar
 | 
				
			||||||
 | 
					$   libwriter := write_vax_ftransfer_entry
 | 
				
			||||||
 | 
					$   gosub read_func_num
 | 
				
			||||||
 | 
					$   type sys$input:/out=mar:
 | 
				
			||||||
 | 
					;
 | 
				
			||||||
 | 
					; Allocate extra storage at end of vector to allow for expansion.
 | 
				
			||||||
 | 
					;
 | 
				
			||||||
 | 
					$   write mar "	.BLKB 32768-<.-",libvec,"_xfer>	; 64 pages total."
 | 
				
			||||||
 | 
					$!   libwriter := write_vax_vtransfer_entry
 | 
				
			||||||
 | 
					$!   gosub read_func_num
 | 
				
			||||||
 | 
					$   write mar "	.END"
 | 
				
			||||||
 | 
					$   close mar
 | 
				
			||||||
 | 
					$   open/write opt 'libopt'
 | 
				
			||||||
 | 
					$   write opt "identification=""",libid," ",libverstr,""""
 | 
				
			||||||
 | 
					$   write opt libobj
 | 
				
			||||||
 | 
					$   write opt libolb,"/lib"
 | 
				
			||||||
 | 
					$   if libref .nes. "" then write opt libref,"/SHARE"
 | 
				
			||||||
 | 
					$   type sys$input:/out=opt:
 | 
				
			||||||
 | 
					!
 | 
				
			||||||
 | 
					! Ensure transfer vector is at beginning of image
 | 
				
			||||||
 | 
					!
 | 
				
			||||||
 | 
					CLUSTER=FIRST
 | 
				
			||||||
 | 
					$   write opt "COLLECT=FIRST,$$",libvec
 | 
				
			||||||
 | 
					$   write opt "GSMATCH=",libvmatch,",",libver
 | 
				
			||||||
 | 
					$   type sys$input:/out=opt:
 | 
				
			||||||
 | 
					!
 | 
				
			||||||
 | 
					! make psects nonshareable so image can be installed.
 | 
				
			||||||
 | 
					!
 | 
				
			||||||
 | 
					PSECT_ATTR=$CHAR_STRING_CONSTANTS,NOWRT
 | 
				
			||||||
 | 
					$   libwrch   := opt
 | 
				
			||||||
 | 
					$   libwriter := write_vax_psect_attr
 | 
				
			||||||
 | 
					$   gosub read_func_num
 | 
				
			||||||
 | 
					$   close opt
 | 
				
			||||||
 | 
					$   macro/obj='libobj' 'libmar'
 | 
				
			||||||
 | 
					$   link/map='libmap'/full/share='libgoal' 'libopt'/option
 | 
				
			||||||
 | 
					$   return
 | 
				
			||||||
 | 
					$
 | 
				
			||||||
 | 
					$! The record writer routine for VAX functions
 | 
				
			||||||
 | 
					$ write_vax_ftransfer_entry:
 | 
				
			||||||
 | 
					$   if info_kind .nes. "FUNCTION" then return
 | 
				
			||||||
 | 
					$   if libentry .eqs ".dummy"
 | 
				
			||||||
 | 
					$   then
 | 
				
			||||||
 | 
					$     write 'libwrch' "	.BLKB 8" ! Dummy is zeroes...
 | 
				
			||||||
 | 
					$   else
 | 
				
			||||||
 | 
					$     write 'libwrch' "	FTRANSFER_ENTRY ",libentry
 | 
				
			||||||
 | 
					$   endif
 | 
				
			||||||
 | 
					$   return
 | 
				
			||||||
 | 
					$! The record writer routine for VAX variables (should never happen!)
 | 
				
			||||||
 | 
					$ write_vax_psect_attr:
 | 
				
			||||||
 | 
					$   if info_kind .nes. "VARIABLE" then return
 | 
				
			||||||
 | 
					$   if libentry .eqs ".dummy" then return
 | 
				
			||||||
 | 
					$   write 'libwrch' "PSECT_ATTR=",libentry,",NOSHR"
 | 
				
			||||||
 | 
					$   return
 | 
				
			||||||
 | 
					$
 | 
				
			||||||
 | 
					$! ----- Common subroutines
 | 
				
			||||||
 | 
					$! -----
 | 
				
			||||||
 | 
					$! The .num file reader.  This one has great responsability.
 | 
				
			||||||
 | 
					$ read_func_num:
 | 
				
			||||||
 | 
					$   open libnum 'libnum'
 | 
				
			||||||
 | 
					$   goto read_nums
 | 
				
			||||||
 | 
					$
 | 
				
			||||||
 | 
					$ read_nums:
 | 
				
			||||||
 | 
					$   libentrynum=0
 | 
				
			||||||
 | 
					$   liblastentry:=false
 | 
				
			||||||
 | 
					$   entrycount=0
 | 
				
			||||||
 | 
					$   loop:
 | 
				
			||||||
 | 
					$     read/end=loop_end/err=loop_end libnum line
 | 
				
			||||||
 | 
					$     entrynum=f$int(f$element(1," ",f$edit(line,"COMPRESS,TRIM")))
 | 
				
			||||||
 | 
					$     entryinfo=f$element(2," ",f$edit(line,"COMPRESS,TRIM"))
 | 
				
			||||||
 | 
					$     curentry=f$element(0," ",f$edit(line,"COMPRESS,TRIM"))
 | 
				
			||||||
 | 
					$     info_exist=f$element(0,":",entryinfo)
 | 
				
			||||||
 | 
					$     info_platforms=","+f$element(1,":",entryinfo)+","
 | 
				
			||||||
 | 
					$     info_kind=f$element(2,":",entryinfo)
 | 
				
			||||||
 | 
					$     info_algorithms=","+f$element(3,":",entryinfo)+","
 | 
				
			||||||
 | 
					$     if info_exist .eqs. "NOEXIST" then goto loop
 | 
				
			||||||
 | 
					$     truesum = 0
 | 
				
			||||||
 | 
					$     falsesum = 0
 | 
				
			||||||
 | 
					$     negatives = 1
 | 
				
			||||||
 | 
					$     plat_i = 0
 | 
				
			||||||
 | 
					$     loop1:
 | 
				
			||||||
 | 
					$       plat_entry = f$element(plat_i,",",info_platforms)
 | 
				
			||||||
 | 
					$       plat_i = plat_i + 1
 | 
				
			||||||
 | 
					$       if plat_entry .eqs. "" then goto loop1
 | 
				
			||||||
 | 
					$       if plat_entry .nes. ","
 | 
				
			||||||
 | 
					$       then
 | 
				
			||||||
 | 
					$         if f$extract(0,1,plat_entry) .nes. "!" then negatives = 0
 | 
				
			||||||
 | 
					$         if f$getsyi("CPU") .lt. 128
 | 
				
			||||||
 | 
					$         then
 | 
				
			||||||
 | 
					$           if plat_entry .eqs. "EXPORT_VAR_AS_FUNCTION" then -
 | 
				
			||||||
 | 
					$             truesum = truesum + 1
 | 
				
			||||||
 | 
					$           if plat_entry .eqs. "!EXPORT_VAR_AS_FUNCTION" then -
 | 
				
			||||||
 | 
					$             falsesum = falsesum + 1
 | 
				
			||||||
 | 
					$         endif
 | 
				
			||||||
 | 
					$         if plat_entry .eqs. "VMS" then truesum = truesum + 1
 | 
				
			||||||
 | 
					$         if plat_entry .eqs. "!VMS" then falsesum = falsesum + 1
 | 
				
			||||||
 | 
					$	  goto loop1
 | 
				
			||||||
 | 
					$       endif
 | 
				
			||||||
 | 
					$     endloop1:
 | 
				
			||||||
 | 
					$!DEBUG!$     if info_platforms - "EXPORT_VAR_AS_FUNCTION" .nes. info_platforms
 | 
				
			||||||
 | 
					$!DEBUG!$     then
 | 
				
			||||||
 | 
					$!DEBUG!$       write sys$output line
 | 
				
			||||||
 | 
					$!DEBUG!$       write sys$output "        truesum = ",truesum,-
 | 
				
			||||||
 | 
					$!DEBUG!		", negatives = ",negatives,", falsesum = ",falsesum
 | 
				
			||||||
 | 
					$!DEBUG!$     endif
 | 
				
			||||||
 | 
					$     if falsesum .ne. 0 then goto loop
 | 
				
			||||||
 | 
					$     if truesum+negatives .eq. 0 then goto loop
 | 
				
			||||||
 | 
					$     alg_i = 0
 | 
				
			||||||
 | 
					$     loop2:
 | 
				
			||||||
 | 
					$       alg_entry = f$element(alg_i,",",info_algorithms)
 | 
				
			||||||
 | 
					$	alg_i = alg_i + 1
 | 
				
			||||||
 | 
					$       if alg_entry .eqs. "" then goto loop2
 | 
				
			||||||
 | 
					$       if alg_entry .nes. ","
 | 
				
			||||||
 | 
					$       then
 | 
				
			||||||
 | 
					$         if alg_entry .eqs. "KRB5" then goto loop ! Special for now
 | 
				
			||||||
 | 
					$         if f$trnlnm("OPENSSL_NO_"+alg_entry) .nes. "" then goto loop
 | 
				
			||||||
 | 
					$	  goto loop2
 | 
				
			||||||
 | 
					$       endif
 | 
				
			||||||
 | 
					$     endloop2:
 | 
				
			||||||
 | 
					$     if info_platforms - "EXPORT_VAR_AS_FUNCTION" .nes. info_platforms
 | 
				
			||||||
 | 
					$     then
 | 
				
			||||||
 | 
					$!DEBUG!$     write sys$output curentry," ; ",entrynum," ; ",entryinfo
 | 
				
			||||||
 | 
					$     endif
 | 
				
			||||||
 | 
					$   redo:
 | 
				
			||||||
 | 
					$     next:=loop
 | 
				
			||||||
 | 
					$     tolibentry=curentry
 | 
				
			||||||
 | 
					$     if libentrynum .ne. entrynum
 | 
				
			||||||
 | 
					$     then
 | 
				
			||||||
 | 
					$       entrycount=entrycount+1
 | 
				
			||||||
 | 
					$       if entrycount .lt. entrynum
 | 
				
			||||||
 | 
					$       then
 | 
				
			||||||
 | 
					$!DEBUG!$         write sys$output "Info: entrycount: ''entrycount', entrynum: ''entrynum' => 0"
 | 
				
			||||||
 | 
					$         tolibentry=".dummy"
 | 
				
			||||||
 | 
					$         next:=redo
 | 
				
			||||||
 | 
					$       endif
 | 
				
			||||||
 | 
					$       if entrycount .gt. entrynum
 | 
				
			||||||
 | 
					$       then
 | 
				
			||||||
 | 
					$         write sys$error "Decreasing library entry numbers!  Can't continue"
 | 
				
			||||||
 | 
					$         write sys$error """",line,""""
 | 
				
			||||||
 | 
					$         close libnum
 | 
				
			||||||
 | 
					$         return
 | 
				
			||||||
 | 
					$       endif
 | 
				
			||||||
 | 
					$       libentry=tolibentry
 | 
				
			||||||
 | 
					$!DEBUG!$       write sys$output entrycount," ",libentry," ",entryinfo
 | 
				
			||||||
 | 
					$       if libentry .nes. "" .and. libwriter .nes. "" then gosub 'libwriter'
 | 
				
			||||||
 | 
					$     else
 | 
				
			||||||
 | 
					$       write sys$error "Info: ""''curentry'"" is an alias for ""''libentry'"".  Overriding..."
 | 
				
			||||||
 | 
					$     endif
 | 
				
			||||||
 | 
					$     libentrynum=entrycount
 | 
				
			||||||
 | 
					$     goto 'next'
 | 
				
			||||||
 | 
					$   loop_end:
 | 
				
			||||||
 | 
					$   close libnum
 | 
				
			||||||
 | 
					$   return
 | 
				
			||||||
 | 
					$
 | 
				
			||||||
 | 
					$! The version number reader
 | 
				
			||||||
 | 
					$ read_version_info:
 | 
				
			||||||
 | 
					$   libver = ""
 | 
				
			||||||
 | 
					$   open/read vf [.CRYPTO]OPENSSLV.H
 | 
				
			||||||
 | 
					$   loop_rvi:
 | 
				
			||||||
 | 
					$     read/err=endloop_rvi/end=endloop_rvi vf rvi_line
 | 
				
			||||||
 | 
					$     if rvi_line - "SHLIB_VERSION_NUMBER """ .eqs. rvi_line then -
 | 
				
			||||||
 | 
						goto loop_rvi
 | 
				
			||||||
 | 
					$     libverstr = f$element(1,"""",rvi_line)
 | 
				
			||||||
 | 
					$     libvmajor = f$element(0,".",libverstr)
 | 
				
			||||||
 | 
					$     libvminor = f$element(1,".",libverstr)
 | 
				
			||||||
 | 
					$     libvedit = f$element(2,".",libverstr)
 | 
				
			||||||
 | 
					$     libvpatch = f$cvui(0,8,f$extract(1,1,libvedit)+"@")-f$cvui(0,8,"@")
 | 
				
			||||||
 | 
					$     libvedit = f$extract(0,1,libvedit)
 | 
				
			||||||
 | 
					$     libver = f$string(f$int(libvmajor)*100)+","+-
 | 
				
			||||||
 | 
						f$string(f$int(libvminor)*100+f$int(libvedit)*10+f$int(libvpatch))
 | 
				
			||||||
 | 
					$     if libvmajor .eqs. "0"
 | 
				
			||||||
 | 
					$     then
 | 
				
			||||||
 | 
					$       libvmatch = "EQUAL"
 | 
				
			||||||
 | 
					$     else
 | 
				
			||||||
 | 
					$       ! Starting with the 1.0 release, backward compatibility should be
 | 
				
			||||||
 | 
					$       ! kept, so switch over to the following
 | 
				
			||||||
 | 
					$       libvmatch = "LEQUAL"
 | 
				
			||||||
 | 
					$     endif
 | 
				
			||||||
 | 
					$   endloop_rvi:
 | 
				
			||||||
 | 
					$   close vf
 | 
				
			||||||
 | 
					$   return
 | 
				
			||||||
							
								
								
									
										1
									
								
								VMS/tcpip_shr_decc.opt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								VMS/tcpip_shr_decc.opt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
				
			|||||||
 | 
					sys$share:tcpip$ipc_shr.exe/share
 | 
				
			||||||
							
								
								
									
										1199
									
								
								apps/Makefile.ssl
									
									
									
									
									
								
							
							
						
						
									
										1199
									
								
								apps/Makefile.ssl
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										660
									
								
								apps/apps.c
									
									
									
									
									
								
							
							
						
						
									
										660
									
								
								apps/apps.c
									
									
									
									
									
								
							@@ -55,27 +55,89 @@
 | 
				
			|||||||
 * copied and put under another distribution licence
 | 
					 * copied and put under another distribution licence
 | 
				
			||||||
 * [including the GNU Public Licence.]
 | 
					 * [including the GNU Public Licence.]
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					/* ====================================================================
 | 
				
			||||||
 | 
					 * Copyright (c) 1998-2001 The OpenSSL Project.  All rights reserved.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Redistribution and use in source and binary forms, with or without
 | 
				
			||||||
 | 
					 * modification, are permitted provided that the following conditions
 | 
				
			||||||
 | 
					 * are met:
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 1. Redistributions of source code must retain the above copyright
 | 
				
			||||||
 | 
					 *    notice, this list of conditions and the following disclaimer. 
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 2. Redistributions in binary form must reproduce the above copyright
 | 
				
			||||||
 | 
					 *    notice, this list of conditions and the following disclaimer in
 | 
				
			||||||
 | 
					 *    the documentation and/or other materials provided with the
 | 
				
			||||||
 | 
					 *    distribution.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 3. All advertising materials mentioning features or use of this
 | 
				
			||||||
 | 
					 *    software must display the following acknowledgment:
 | 
				
			||||||
 | 
					 *    "This product includes software developed by the OpenSSL Project
 | 
				
			||||||
 | 
					 *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
 | 
				
			||||||
 | 
					 *    endorse or promote products derived from this software without
 | 
				
			||||||
 | 
					 *    prior written permission. For written permission, please contact
 | 
				
			||||||
 | 
					 *    openssl-core@openssl.org.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 5. Products derived from this software may not be called "OpenSSL"
 | 
				
			||||||
 | 
					 *    nor may "OpenSSL" appear in their names without prior written
 | 
				
			||||||
 | 
					 *    permission of the OpenSSL Project.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 6. Redistributions of any form whatsoever must retain the following
 | 
				
			||||||
 | 
					 *    acknowledgment:
 | 
				
			||||||
 | 
					 *    "This product includes software developed by the OpenSSL Project
 | 
				
			||||||
 | 
					 *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
 | 
				
			||||||
 | 
					 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 | 
				
			||||||
 | 
					 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 | 
				
			||||||
 | 
					 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
 | 
				
			||||||
 | 
					 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 | 
				
			||||||
 | 
					 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 | 
				
			||||||
 | 
					 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 | 
				
			||||||
 | 
					 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 | 
				
			||||||
 | 
					 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 | 
				
			||||||
 | 
					 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 | 
				
			||||||
 | 
					 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 | 
				
			||||||
 | 
					 * OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
				
			||||||
 | 
					 * ====================================================================
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This product includes cryptographic software written by Eric Young
 | 
				
			||||||
 | 
					 * (eay@cryptsoft.com).  This product includes software written by Tim
 | 
				
			||||||
 | 
					 * Hudson (tjh@cryptsoft.com).
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdio.h>
 | 
					#include <stdio.h>
 | 
				
			||||||
#include <stdlib.h>
 | 
					#include <stdlib.h>
 | 
				
			||||||
#include <string.h>
 | 
					#include <string.h>
 | 
				
			||||||
#include <sys/types.h>
 | 
					#include <sys/types.h>
 | 
				
			||||||
#include <sys/stat.h>
 | 
					#include <sys/stat.h>
 | 
				
			||||||
#define NON_MAIN
 | 
					#include <ctype.h>
 | 
				
			||||||
#include "apps.h"
 | 
					 | 
				
			||||||
#undef NON_MAIN
 | 
					 | 
				
			||||||
#include <openssl/err.h>
 | 
					#include <openssl/err.h>
 | 
				
			||||||
#include <openssl/x509.h>
 | 
					#include <openssl/x509.h>
 | 
				
			||||||
 | 
					#include <openssl/x509v3.h>
 | 
				
			||||||
#include <openssl/pem.h>
 | 
					#include <openssl/pem.h>
 | 
				
			||||||
#include <openssl/pkcs12.h>
 | 
					#include <openssl/pkcs12.h>
 | 
				
			||||||
 | 
					#include <openssl/ui.h>
 | 
				
			||||||
#include <openssl/safestack.h>
 | 
					#include <openssl/safestack.h>
 | 
				
			||||||
 | 
					#include <openssl/engine.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef OPENSSL_SYS_WINDOWS
 | 
					#ifdef OPENSSL_SYS_WINDOWS
 | 
				
			||||||
#define strcasecmp _stricmp
 | 
					#define strcasecmp _stricmp
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
#include <strings.h>
 | 
					#  ifdef NO_STRINGS_H
 | 
				
			||||||
 | 
					    int	strcasecmp();
 | 
				
			||||||
 | 
					#  else
 | 
				
			||||||
 | 
					#    include <strings.h>
 | 
				
			||||||
 | 
					#  endif /* NO_STRINGS_H */
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define NON_MAIN
 | 
				
			||||||
 | 
					#include "apps.h"
 | 
				
			||||||
 | 
					#undef NON_MAIN
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef OPENSSL_SYS_WINDOWS
 | 
					#ifdef OPENSSL_SYS_WINDOWS
 | 
				
			||||||
#  include "bss_file.c"
 | 
					#  include "bss_file.c"
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
@@ -86,7 +148,17 @@ typedef struct {
 | 
				
			|||||||
	unsigned long mask;
 | 
						unsigned long mask;
 | 
				
			||||||
} NAME_EX_TBL;
 | 
					} NAME_EX_TBL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static UI_METHOD *ui_method = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int set_table_opts(unsigned long *flags, const char *arg, const NAME_EX_TBL *in_tbl);
 | 
					static int set_table_opts(unsigned long *flags, const char *arg, const NAME_EX_TBL *in_tbl);
 | 
				
			||||||
 | 
					static int set_multi_opts(unsigned long *flags, const char *arg, const NAME_EX_TBL *in_tbl);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if !defined(OPENSSL_NO_RC4) && !defined(OPENSSL_NO_RSA)
 | 
				
			||||||
 | 
					/* Looks like this stuff is worth moving into separate function */
 | 
				
			||||||
 | 
					static EVP_PKEY *
 | 
				
			||||||
 | 
					load_netscape_key(BIO *err, BIO *key, const char *file,
 | 
				
			||||||
 | 
							const char *key_descrip, int format);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int app_init(long mesgwin);
 | 
					int app_init(long mesgwin);
 | 
				
			||||||
#ifdef undef /* never finished - probably never will be :-) */
 | 
					#ifdef undef /* never finished - probably never will be :-) */
 | 
				
			||||||
@@ -244,9 +316,16 @@ void program_name(char *in, char *out, int size)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	q=strrchr(p,'.');
 | 
						q=strrchr(p,'.');
 | 
				
			||||||
	if (q == NULL)
 | 
						if (q == NULL)
 | 
				
			||||||
		q = in+size;
 | 
							q = p + strlen(p);
 | 
				
			||||||
	strncpy(out,p,q-p);
 | 
						strncpy(out,p,size-1);
 | 
				
			||||||
	out[q-p]='\0';
 | 
						if (q-p >= size)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							out[size-1]='\0';
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							out[q-p]='\0';
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
void program_name(char *in, char *out, int size)
 | 
					void program_name(char *in, char *out, int size)
 | 
				
			||||||
@@ -258,8 +337,7 @@ void program_name(char *in, char *out, int size)
 | 
				
			|||||||
		p++;
 | 
							p++;
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		p=in;
 | 
							p=in;
 | 
				
			||||||
	strncpy(out,p,size-1);
 | 
						BUF_strlcpy(out,p,size);
 | 
				
			||||||
	out[size-1]='\0';
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
@@ -267,19 +345,57 @@ void program_name(char *in, char *out, int size)
 | 
				
			|||||||
#ifdef OPENSSL_SYS_WIN32
 | 
					#ifdef OPENSSL_SYS_WIN32
 | 
				
			||||||
int WIN32_rename(char *from, char *to)
 | 
					int WIN32_rename(char *from, char *to)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
#ifdef OPENSSL_SYS_WINNT
 | 
					#ifndef OPENSSL_SYS_WINCE
 | 
				
			||||||
	int ret;
 | 
						/* Windows rename gives an error if 'to' exists, so delete it
 | 
				
			||||||
/* Note: MoveFileEx() doesn't work under Win95, Win98 */
 | 
						 * first and ignore file not found errror
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
	ret=MoveFileEx(from,to,MOVEFILE_REPLACE_EXISTING|MOVEFILE_COPY_ALLOWED);
 | 
						if((remove(to) != 0) && (errno != ENOENT))
 | 
				
			||||||
	return(ret?0:-1);
 | 
							return -1;
 | 
				
			||||||
 | 
					#undef rename
 | 
				
			||||||
 | 
						return rename(from, to);
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
	unlink(to);
 | 
						/* convert strings to UNICODE */
 | 
				
			||||||
	return MoveFile(from, to);
 | 
						{
 | 
				
			||||||
 | 
						BOOL result = FALSE;
 | 
				
			||||||
 | 
						WCHAR* wfrom;
 | 
				
			||||||
 | 
						WCHAR* wto;
 | 
				
			||||||
 | 
						int i;
 | 
				
			||||||
 | 
						wfrom = malloc((strlen(from)+1)*2);
 | 
				
			||||||
 | 
						wto = malloc((strlen(to)+1)*2);
 | 
				
			||||||
 | 
						if (wfrom != NULL && wto != NULL)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							for (i=0; i<(int)strlen(from)+1; i++)
 | 
				
			||||||
 | 
								wfrom[i] = (short)from[i];
 | 
				
			||||||
 | 
							for (i=0; i<(int)strlen(to)+1; i++)
 | 
				
			||||||
 | 
								wto[i] = (short)to[i];
 | 
				
			||||||
 | 
							result = MoveFile(wfrom, wto);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						if (wfrom != NULL)
 | 
				
			||||||
 | 
							free(wfrom);
 | 
				
			||||||
 | 
						if (wto != NULL)
 | 
				
			||||||
 | 
							free(wto);
 | 
				
			||||||
 | 
						return result;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef OPENSSL_SYS_VMS
 | 
				
			||||||
 | 
					int VMS_strcasecmp(const char *str1, const char *str2)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						while (*str1 && *str2)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							int res = toupper(*str1) - toupper(*str2);
 | 
				
			||||||
 | 
							if (res) return res < 0 ? -1 : 1;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						if (*str1)
 | 
				
			||||||
 | 
							return 1;
 | 
				
			||||||
 | 
						if (*str2)
 | 
				
			||||||
 | 
							return -1;
 | 
				
			||||||
 | 
						return 0;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int chopup_args(ARGS *arg, char *buf, int *argc, char **argv[])
 | 
					int chopup_args(ARGS *arg, char *buf, int *argc, char **argv[])
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	int num,len,i;
 | 
						int num,len,i;
 | 
				
			||||||
@@ -355,18 +471,175 @@ int app_init(long mesgwin)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
int dump_cert_text (BIO *out, X509 *x)
 | 
					int dump_cert_text (BIO *out, X509 *x)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	char buf[256];
 | 
						char *p;
 | 
				
			||||||
	X509_NAME_oneline(X509_get_subject_name(x),buf,256);
 | 
					 | 
				
			||||||
	BIO_puts(out,"subject=");
 | 
					 | 
				
			||||||
	BIO_puts(out,buf);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	X509_NAME_oneline(X509_get_issuer_name(x),buf,256);
 | 
						p=X509_NAME_oneline(X509_get_subject_name(x),NULL,0);
 | 
				
			||||||
	BIO_puts(out,"\nissuer= ");
 | 
						BIO_puts(out,"subject=");
 | 
				
			||||||
	BIO_puts(out,buf);
 | 
						BIO_puts(out,p);
 | 
				
			||||||
 | 
						OPENSSL_free(p);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						p=X509_NAME_oneline(X509_get_issuer_name(x),NULL,0);
 | 
				
			||||||
 | 
						BIO_puts(out,"\nissuer=");
 | 
				
			||||||
 | 
						BIO_puts(out,p);
 | 
				
			||||||
	BIO_puts(out,"\n");
 | 
						BIO_puts(out,"\n");
 | 
				
			||||||
        return 0;
 | 
						OPENSSL_free(p);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static int ui_open(UI *ui)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						return UI_method_get_opener(UI_OpenSSL())(ui);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					static int ui_read(UI *ui, UI_STRING *uis)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						if (UI_get_input_flags(uis) & UI_INPUT_FLAG_DEFAULT_PWD
 | 
				
			||||||
 | 
							&& UI_get0_user_data(ui))
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							switch(UI_get_string_type(uis))
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
							case UIT_PROMPT:
 | 
				
			||||||
 | 
							case UIT_VERIFY:
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								const char *password =
 | 
				
			||||||
 | 
									((PW_CB_DATA *)UI_get0_user_data(ui))->password;
 | 
				
			||||||
 | 
								if (password[0] != '\0')
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
									UI_set_result(ui, uis, password);
 | 
				
			||||||
 | 
									return 1;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							default:
 | 
				
			||||||
 | 
								break;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						return UI_method_get_reader(UI_OpenSSL())(ui, uis);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					static int ui_write(UI *ui, UI_STRING *uis)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						if (UI_get_input_flags(uis) & UI_INPUT_FLAG_DEFAULT_PWD
 | 
				
			||||||
 | 
							&& UI_get0_user_data(ui))
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							switch(UI_get_string_type(uis))
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
							case UIT_PROMPT:
 | 
				
			||||||
 | 
							case UIT_VERIFY:
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								const char *password =
 | 
				
			||||||
 | 
									((PW_CB_DATA *)UI_get0_user_data(ui))->password;
 | 
				
			||||||
 | 
								if (password[0] != '\0')
 | 
				
			||||||
 | 
									return 1;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							default:
 | 
				
			||||||
 | 
								break;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						return UI_method_get_writer(UI_OpenSSL())(ui, uis);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					static int ui_close(UI *ui)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						return UI_method_get_closer(UI_OpenSSL())(ui);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					int setup_ui_method(void)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						ui_method = UI_create_method("OpenSSL application user interface");
 | 
				
			||||||
 | 
						UI_method_set_opener(ui_method, ui_open);
 | 
				
			||||||
 | 
						UI_method_set_reader(ui_method, ui_read);
 | 
				
			||||||
 | 
						UI_method_set_writer(ui_method, ui_write);
 | 
				
			||||||
 | 
						UI_method_set_closer(ui_method, ui_close);
 | 
				
			||||||
 | 
						return 0;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					void destroy_ui_method(void)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						if(ui_method)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							UI_destroy_method(ui_method);
 | 
				
			||||||
 | 
							ui_method = NULL;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					int password_callback(char *buf, int bufsiz, int verify,
 | 
				
			||||||
 | 
						PW_CB_DATA *cb_tmp)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						UI *ui = NULL;
 | 
				
			||||||
 | 
						int res = 0;
 | 
				
			||||||
 | 
						const char *prompt_info = NULL;
 | 
				
			||||||
 | 
						const char *password = NULL;
 | 
				
			||||||
 | 
						PW_CB_DATA *cb_data = (PW_CB_DATA *)cb_tmp;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (cb_data)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							if (cb_data->password)
 | 
				
			||||||
 | 
								password = cb_data->password;
 | 
				
			||||||
 | 
							if (cb_data->prompt_info)
 | 
				
			||||||
 | 
								prompt_info = cb_data->prompt_info;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (password)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							res = strlen(password);
 | 
				
			||||||
 | 
							if (res > bufsiz)
 | 
				
			||||||
 | 
								res = bufsiz;
 | 
				
			||||||
 | 
							memcpy(buf, password, res);
 | 
				
			||||||
 | 
							return res;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						ui = UI_new_method(ui_method);
 | 
				
			||||||
 | 
						if (ui)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							int ok = 0;
 | 
				
			||||||
 | 
							char *buff = NULL;
 | 
				
			||||||
 | 
							int ui_flags = 0;
 | 
				
			||||||
 | 
							char *prompt = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							prompt = UI_construct_prompt(ui, "pass phrase",
 | 
				
			||||||
 | 
								cb_data->prompt_info);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							ui_flags |= UI_INPUT_FLAG_DEFAULT_PWD;
 | 
				
			||||||
 | 
							UI_ctrl(ui, UI_CTRL_PRINT_ERRORS, 1, 0, 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (ok >= 0)
 | 
				
			||||||
 | 
								ok = UI_add_input_string(ui,prompt,ui_flags,buf,
 | 
				
			||||||
 | 
									PW_MIN_LENGTH,BUFSIZ-1);
 | 
				
			||||||
 | 
							if (ok >= 0 && verify)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								buff = (char *)OPENSSL_malloc(bufsiz);
 | 
				
			||||||
 | 
								ok = UI_add_verify_string(ui,prompt,ui_flags,buff,
 | 
				
			||||||
 | 
									PW_MIN_LENGTH,BUFSIZ-1, buf);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							if (ok >= 0)
 | 
				
			||||||
 | 
								do
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
									ok = UI_process(ui);
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								while (ok < 0 && UI_ctrl(ui, UI_CTRL_IS_REDOABLE, 0, 0, 0));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (buff)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								memset(buff,0,(unsigned int)bufsiz);
 | 
				
			||||||
 | 
								OPENSSL_free(buff);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (ok >= 0)
 | 
				
			||||||
 | 
								res = strlen(buf);
 | 
				
			||||||
 | 
							if (ok == -1)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								BIO_printf(bio_err, "User interface error\n");
 | 
				
			||||||
 | 
								ERR_print_errors(bio_err);
 | 
				
			||||||
 | 
								memset(buf,0,(unsigned int)bufsiz);
 | 
				
			||||||
 | 
								res = 0;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							if (ok == -2)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								BIO_printf(bio_err,"aborted!\n");
 | 
				
			||||||
 | 
								memset(buf,0,(unsigned int)bufsiz);
 | 
				
			||||||
 | 
								res = 0;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							UI_free(ui);
 | 
				
			||||||
 | 
							OPENSSL_free(prompt);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						return res;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static char *app_get_pass(BIO *err, char *arg, int keepbio);
 | 
					static char *app_get_pass(BIO *err, char *arg, int keepbio);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int app_passwd(BIO *err, char *arg1, char *arg2, char **pass1, char **pass2)
 | 
					int app_passwd(BIO *err, char *arg1, char *arg2, char **pass1, char **pass2)
 | 
				
			||||||
@@ -442,18 +715,18 @@ static char *app_get_pass(BIO *err, char *arg, int keepbio)
 | 
				
			|||||||
	return BUF_strdup(tpass);
 | 
						return BUF_strdup(tpass);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int add_oid_section(BIO *err, LHASH *conf)
 | 
					int add_oid_section(BIO *err, CONF *conf)
 | 
				
			||||||
{	
 | 
					{	
 | 
				
			||||||
	char *p;
 | 
						char *p;
 | 
				
			||||||
	STACK_OF(CONF_VALUE) *sktmp;
 | 
						STACK_OF(CONF_VALUE) *sktmp;
 | 
				
			||||||
	CONF_VALUE *cnf;
 | 
						CONF_VALUE *cnf;
 | 
				
			||||||
	int i;
 | 
						int i;
 | 
				
			||||||
	if(!(p=CONF_get_string(conf,NULL,"oid_section")))
 | 
						if(!(p=NCONF_get_string(conf,NULL,"oid_section")))
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		ERR_clear_error();
 | 
							ERR_clear_error();
 | 
				
			||||||
		return 1;
 | 
							return 1;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	if(!(sktmp = CONF_get_section(conf, p))) {
 | 
						if(!(sktmp = NCONF_get_section(conf, p))) {
 | 
				
			||||||
		BIO_printf(err, "problem loading oid section %s\n", p);
 | 
							BIO_printf(err, "problem loading oid section %s\n", p);
 | 
				
			||||||
		return 0;
 | 
							return 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -468,7 +741,8 @@ int add_oid_section(BIO *err, LHASH *conf)
 | 
				
			|||||||
	return 1;
 | 
						return 1;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
X509 *load_cert(BIO *err, char *file, int format)
 | 
					X509 *load_cert(BIO *err, const char *file, int format,
 | 
				
			||||||
 | 
						const char *pass, ENGINE *e, const char *cert_descrip)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	ASN1_HEADER *ah=NULL;
 | 
						ASN1_HEADER *ah=NULL;
 | 
				
			||||||
	BUF_MEM *buf=NULL;
 | 
						BUF_MEM *buf=NULL;
 | 
				
			||||||
@@ -490,7 +764,9 @@ X509 *load_cert(BIO *err, char *file, int format)
 | 
				
			|||||||
		{
 | 
							{
 | 
				
			||||||
		if (BIO_read_filename(cert,file) <= 0)
 | 
							if (BIO_read_filename(cert,file) <= 0)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
			perror(file);
 | 
								BIO_printf(err, "Error opening %s %s\n",
 | 
				
			||||||
 | 
									cert_descrip, file);
 | 
				
			||||||
 | 
								ERR_print_errors(err);
 | 
				
			||||||
			goto end;
 | 
								goto end;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -541,7 +817,8 @@ X509 *load_cert(BIO *err, char *file, int format)
 | 
				
			|||||||
		ah->data=NULL;
 | 
							ah->data=NULL;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	else if (format == FORMAT_PEM)
 | 
						else if (format == FORMAT_PEM)
 | 
				
			||||||
		x=PEM_read_bio_X509_AUX(cert,NULL,NULL,NULL);
 | 
							x=PEM_read_bio_X509_AUX(cert,NULL,
 | 
				
			||||||
 | 
								(pem_password_cb *)password_callback, NULL);
 | 
				
			||||||
	else if (format == FORMAT_PKCS12)
 | 
						else if (format == FORMAT_PKCS12)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		PKCS12 *p12 = d2i_PKCS12_bio(cert, NULL);
 | 
							PKCS12 *p12 = d2i_PKCS12_bio(cert, NULL);
 | 
				
			||||||
@@ -551,7 +828,8 @@ X509 *load_cert(BIO *err, char *file, int format)
 | 
				
			|||||||
		p12 = NULL;
 | 
							p12 = NULL;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	else	{
 | 
						else	{
 | 
				
			||||||
		BIO_printf(err,"bad input format specified for input cert\n");
 | 
							BIO_printf(err,"bad input format specified for %s\n",
 | 
				
			||||||
 | 
								cert_descrip);
 | 
				
			||||||
		goto end;
 | 
							goto end;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
end:
 | 
					end:
 | 
				
			||||||
@@ -566,12 +844,17 @@ end:
 | 
				
			|||||||
	return(x);
 | 
						return(x);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
EVP_PKEY *load_key(BIO *err, char *file, int format, char *pass, ENGINE *e)
 | 
					EVP_PKEY *load_key(BIO *err, const char *file, int format, int maybe_stdin,
 | 
				
			||||||
 | 
						const char *pass, ENGINE *e, const char *key_descrip)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	BIO *key=NULL;
 | 
						BIO *key=NULL;
 | 
				
			||||||
	EVP_PKEY *pkey=NULL;
 | 
						EVP_PKEY *pkey=NULL;
 | 
				
			||||||
 | 
						PW_CB_DATA cb_data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (file == NULL)
 | 
						cb_data.password = pass;
 | 
				
			||||||
 | 
						cb_data.prompt_info = file;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (file == NULL && (!maybe_stdin || format == FORMAT_ENGINE))
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		BIO_printf(err,"no keyfile specified\n");
 | 
							BIO_printf(err,"no keyfile specified\n");
 | 
				
			||||||
		goto end;
 | 
							goto end;
 | 
				
			||||||
@@ -581,7 +864,8 @@ EVP_PKEY *load_key(BIO *err, char *file, int format, char *pass, ENGINE *e)
 | 
				
			|||||||
		if (!e)
 | 
							if (!e)
 | 
				
			||||||
			BIO_printf(bio_err,"no engine specified\n");
 | 
								BIO_printf(bio_err,"no engine specified\n");
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			pkey = ENGINE_load_private_key(e, file, pass);
 | 
								pkey = ENGINE_load_private_key(e, file,
 | 
				
			||||||
 | 
									ui_method, &cb_data);
 | 
				
			||||||
		goto end;
 | 
							goto end;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	key=BIO_new(BIO_s_file());
 | 
						key=BIO_new(BIO_s_file());
 | 
				
			||||||
@@ -590,19 +874,32 @@ EVP_PKEY *load_key(BIO *err, char *file, int format, char *pass, ENGINE *e)
 | 
				
			|||||||
		ERR_print_errors(err);
 | 
							ERR_print_errors(err);
 | 
				
			||||||
		goto end;
 | 
							goto end;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	if (BIO_read_filename(key,file) <= 0)
 | 
						if (file == NULL && maybe_stdin)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		perror(file);
 | 
							setvbuf(stdin, NULL, _IONBF, 0);
 | 
				
			||||||
		goto end;
 | 
							BIO_set_fp(key,stdin,BIO_NOCLOSE);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
							if (BIO_read_filename(key,file) <= 0)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								BIO_printf(err, "Error opening %s %s\n",
 | 
				
			||||||
 | 
									key_descrip, file);
 | 
				
			||||||
 | 
								ERR_print_errors(err);
 | 
				
			||||||
 | 
								goto end;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
	if (format == FORMAT_ASN1)
 | 
						if (format == FORMAT_ASN1)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		pkey=d2i_PrivateKey_bio(key, NULL);
 | 
							pkey=d2i_PrivateKey_bio(key, NULL);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	else if (format == FORMAT_PEM)
 | 
						else if (format == FORMAT_PEM)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		pkey=PEM_read_bio_PrivateKey(key,NULL,NULL,pass);
 | 
							pkey=PEM_read_bio_PrivateKey(key,NULL,
 | 
				
			||||||
 | 
								(pem_password_cb *)password_callback, &cb_data);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					#if !defined(OPENSSL_NO_RC4) && !defined(OPENSSL_NO_RSA)
 | 
				
			||||||
 | 
						else if (format == FORMAT_NETSCAPE || format == FORMAT_IISSGC)
 | 
				
			||||||
 | 
							pkey = load_netscape_key(err, key, file, key_descrip, format);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
	else if (format == FORMAT_PKCS12)
 | 
						else if (format == FORMAT_PKCS12)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		PKCS12 *p12 = d2i_PKCS12_bio(key, NULL);
 | 
							PKCS12 *p12 = d2i_PKCS12_bio(key, NULL);
 | 
				
			||||||
@@ -613,22 +910,27 @@ EVP_PKEY *load_key(BIO *err, char *file, int format, char *pass, ENGINE *e)
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		BIO_printf(err,"bad input format specified for key\n");
 | 
							BIO_printf(err,"bad input format specified for key file\n");
 | 
				
			||||||
		goto end;
 | 
							goto end;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 end:
 | 
					 end:
 | 
				
			||||||
	if (key != NULL) BIO_free(key);
 | 
						if (key != NULL) BIO_free(key);
 | 
				
			||||||
	if (pkey == NULL)
 | 
						if (pkey == NULL)
 | 
				
			||||||
		BIO_printf(err,"unable to load Private Key\n");
 | 
							BIO_printf(err,"unable to load %s\n", key_descrip);
 | 
				
			||||||
	return(pkey);
 | 
						return(pkey);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
EVP_PKEY *load_pubkey(BIO *err, char *file, int format, ENGINE *e)
 | 
					EVP_PKEY *load_pubkey(BIO *err, const char *file, int format, int maybe_stdin,
 | 
				
			||||||
 | 
						const char *pass, ENGINE *e, const char *key_descrip)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	BIO *key=NULL;
 | 
						BIO *key=NULL;
 | 
				
			||||||
	EVP_PKEY *pkey=NULL;
 | 
						EVP_PKEY *pkey=NULL;
 | 
				
			||||||
 | 
						PW_CB_DATA cb_data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (file == NULL)
 | 
						cb_data.password = pass;
 | 
				
			||||||
 | 
						cb_data.prompt_info = file;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (file == NULL && (!maybe_stdin || format == FORMAT_ENGINE))
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		BIO_printf(err,"no keyfile specified\n");
 | 
							BIO_printf(err,"no keyfile specified\n");
 | 
				
			||||||
		goto end;
 | 
							goto end;
 | 
				
			||||||
@@ -638,7 +940,8 @@ EVP_PKEY *load_pubkey(BIO *err, char *file, int format, ENGINE *e)
 | 
				
			|||||||
		if (!e)
 | 
							if (!e)
 | 
				
			||||||
			BIO_printf(bio_err,"no engine specified\n");
 | 
								BIO_printf(bio_err,"no engine specified\n");
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			pkey = ENGINE_load_public_key(e, file, NULL);
 | 
								pkey = ENGINE_load_public_key(e, file,
 | 
				
			||||||
 | 
									ui_method, &cb_data);
 | 
				
			||||||
		goto end;
 | 
							goto end;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	key=BIO_new(BIO_s_file());
 | 
						key=BIO_new(BIO_s_file());
 | 
				
			||||||
@@ -647,10 +950,18 @@ EVP_PKEY *load_pubkey(BIO *err, char *file, int format, ENGINE *e)
 | 
				
			|||||||
		ERR_print_errors(err);
 | 
							ERR_print_errors(err);
 | 
				
			||||||
		goto end;
 | 
							goto end;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	if (BIO_read_filename(key,file) <= 0)
 | 
						if (file == NULL && maybe_stdin)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		perror(file);
 | 
							setvbuf(stdin, NULL, _IONBF, 0);
 | 
				
			||||||
		goto end;
 | 
							BIO_set_fp(key,stdin,BIO_NOCLOSE);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
							if (BIO_read_filename(key,file) <= 0)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								BIO_printf(err, "Error opening %s %s\n",
 | 
				
			||||||
 | 
									key_descrip, file);
 | 
				
			||||||
 | 
								ERR_print_errors(err);
 | 
				
			||||||
 | 
								goto end;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	if (format == FORMAT_ASN1)
 | 
						if (format == FORMAT_ASN1)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
@@ -658,27 +969,83 @@ EVP_PKEY *load_pubkey(BIO *err, char *file, int format, ENGINE *e)
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	else if (format == FORMAT_PEM)
 | 
						else if (format == FORMAT_PEM)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		pkey=PEM_read_bio_PUBKEY(key,NULL,NULL,NULL);
 | 
							pkey=PEM_read_bio_PUBKEY(key,NULL,
 | 
				
			||||||
 | 
								(pem_password_cb *)password_callback, &cb_data);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					#if !defined(OPENSSL_NO_RC4) && !defined(OPENSSL_NO_RSA)
 | 
				
			||||||
 | 
						else if (format == FORMAT_NETSCAPE || format == FORMAT_IISSGC)
 | 
				
			||||||
 | 
							pkey = load_netscape_key(err, key, file, key_descrip, format);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		BIO_printf(err,"bad input format specified for key\n");
 | 
							BIO_printf(err,"bad input format specified for key file\n");
 | 
				
			||||||
		goto end;
 | 
							goto end;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 end:
 | 
					 end:
 | 
				
			||||||
	if (key != NULL) BIO_free(key);
 | 
						if (key != NULL) BIO_free(key);
 | 
				
			||||||
	if (pkey == NULL)
 | 
						if (pkey == NULL)
 | 
				
			||||||
		BIO_printf(err,"unable to load Public Key\n");
 | 
							BIO_printf(err,"unable to load %s\n", key_descrip);
 | 
				
			||||||
	return(pkey);
 | 
						return(pkey);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
STACK_OF(X509) *load_certs(BIO *err, char *file, int format)
 | 
					#if !defined(OPENSSL_NO_RC4) && !defined(OPENSSL_NO_RSA)
 | 
				
			||||||
 | 
					static EVP_PKEY *
 | 
				
			||||||
 | 
					load_netscape_key(BIO *err, BIO *key, const char *file,
 | 
				
			||||||
 | 
							const char *key_descrip, int format)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						EVP_PKEY *pkey;
 | 
				
			||||||
 | 
						BUF_MEM *buf;
 | 
				
			||||||
 | 
						RSA	*rsa;
 | 
				
			||||||
 | 
						const unsigned char *p;
 | 
				
			||||||
 | 
						int size, i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						buf=BUF_MEM_new();
 | 
				
			||||||
 | 
						pkey = EVP_PKEY_new();
 | 
				
			||||||
 | 
						size = 0;
 | 
				
			||||||
 | 
						if (buf == NULL || pkey == NULL)
 | 
				
			||||||
 | 
							goto error;
 | 
				
			||||||
 | 
						for (;;)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							if (!BUF_MEM_grow_clean(buf,size+1024*10))
 | 
				
			||||||
 | 
								goto error;
 | 
				
			||||||
 | 
							i = BIO_read(key, &(buf->data[size]), 1024*10);
 | 
				
			||||||
 | 
							size += i;
 | 
				
			||||||
 | 
							if (i == 0)
 | 
				
			||||||
 | 
								break;
 | 
				
			||||||
 | 
							if (i < 0)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									BIO_printf(err, "Error reading %s %s",
 | 
				
			||||||
 | 
										key_descrip, file);
 | 
				
			||||||
 | 
									goto error;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						p=(unsigned char *)buf->data;
 | 
				
			||||||
 | 
						rsa = d2i_RSA_NET(NULL,&p,(long)size,NULL,
 | 
				
			||||||
 | 
							(format == FORMAT_IISSGC ? 1 : 0));
 | 
				
			||||||
 | 
						if (rsa == NULL)
 | 
				
			||||||
 | 
							goto error;
 | 
				
			||||||
 | 
						BUF_MEM_free(buf);
 | 
				
			||||||
 | 
						EVP_PKEY_set1_RSA(pkey, rsa);
 | 
				
			||||||
 | 
						return pkey;
 | 
				
			||||||
 | 
					error:
 | 
				
			||||||
 | 
						BUF_MEM_free(buf);
 | 
				
			||||||
 | 
						EVP_PKEY_free(pkey);
 | 
				
			||||||
 | 
						return NULL;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					#endif /* ndef OPENSSL_NO_RC4 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					STACK_OF(X509) *load_certs(BIO *err, const char *file, int format,
 | 
				
			||||||
 | 
						const char *pass, ENGINE *e, const char *cert_descrip)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	BIO *certs;
 | 
						BIO *certs;
 | 
				
			||||||
	int i;
 | 
						int i;
 | 
				
			||||||
	STACK_OF(X509) *othercerts = NULL;
 | 
						STACK_OF(X509) *othercerts = NULL;
 | 
				
			||||||
	STACK_OF(X509_INFO) *allcerts = NULL;
 | 
						STACK_OF(X509_INFO) *allcerts = NULL;
 | 
				
			||||||
	X509_INFO *xi;
 | 
						X509_INFO *xi;
 | 
				
			||||||
 | 
						PW_CB_DATA cb_data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						cb_data.password = pass;
 | 
				
			||||||
 | 
						cb_data.prompt_info = file;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if((certs = BIO_new(BIO_s_file())) == NULL)
 | 
						if((certs = BIO_new(BIO_s_file())) == NULL)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
@@ -692,7 +1059,9 @@ STACK_OF(X509) *load_certs(BIO *err, char *file, int format)
 | 
				
			|||||||
		{
 | 
							{
 | 
				
			||||||
		if (BIO_read_filename(certs,file) <= 0)
 | 
							if (BIO_read_filename(certs,file) <= 0)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
			perror(file);
 | 
								BIO_printf(err, "Error opening %s %s\n",
 | 
				
			||||||
 | 
									cert_descrip, file);
 | 
				
			||||||
 | 
								ERR_print_errors(err);
 | 
				
			||||||
			goto end;
 | 
								goto end;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -706,7 +1075,8 @@ STACK_OF(X509) *load_certs(BIO *err, char *file, int format)
 | 
				
			|||||||
			othercerts = NULL;
 | 
								othercerts = NULL;
 | 
				
			||||||
			goto end;
 | 
								goto end;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		allcerts = PEM_X509_INFO_read_bio(certs, NULL, NULL, NULL);
 | 
							allcerts = PEM_X509_INFO_read_bio(certs, NULL,
 | 
				
			||||||
 | 
									(pem_password_cb *)password_callback, &cb_data);
 | 
				
			||||||
		for(i = 0; i < sk_X509_INFO_num(allcerts); i++)
 | 
							for(i = 0; i < sk_X509_INFO_num(allcerts); i++)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
			xi = sk_X509_INFO_value (allcerts, i);
 | 
								xi = sk_X509_INFO_value (allcerts, i);
 | 
				
			||||||
@@ -719,7 +1089,8 @@ STACK_OF(X509) *load_certs(BIO *err, char *file, int format)
 | 
				
			|||||||
		goto end;
 | 
							goto end;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	else	{
 | 
						else	{
 | 
				
			||||||
		BIO_printf(err,"bad input format specified for input cert\n");
 | 
							BIO_printf(err,"bad input format specified for %s\n",
 | 
				
			||||||
 | 
								cert_descrip);
 | 
				
			||||||
		goto end;
 | 
							goto end;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
end:
 | 
					end:
 | 
				
			||||||
@@ -744,10 +1115,14 @@ end:
 | 
				
			|||||||
/* BIO_dump unknown extensions */
 | 
					/* BIO_dump unknown extensions */
 | 
				
			||||||
#define X509V3_EXT_DUMP_UNKNOWN		(3L << 16)
 | 
					#define X509V3_EXT_DUMP_UNKNOWN		(3L << 16)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define X509_FLAG_CA (X509_FLAG_NO_ISSUER | X509_FLAG_NO_PUBKEY | \
 | 
				
			||||||
 | 
								 X509_FLAG_NO_HEADER | X509_FLAG_NO_VERSION)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int set_cert_ex(unsigned long *flags, const char *arg)
 | 
					int set_cert_ex(unsigned long *flags, const char *arg)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	static const NAME_EX_TBL cert_tbl[] = {
 | 
						static const NAME_EX_TBL cert_tbl[] = {
 | 
				
			||||||
		{ "compatible", X509_FLAG_COMPAT, 0xffffffffl},
 | 
							{ "compatible", X509_FLAG_COMPAT, 0xffffffffl},
 | 
				
			||||||
 | 
							{ "ca_default", X509_FLAG_CA, 0xffffffffl},
 | 
				
			||||||
		{ "no_header", X509_FLAG_NO_HEADER, 0},
 | 
							{ "no_header", X509_FLAG_NO_HEADER, 0},
 | 
				
			||||||
		{ "no_version", X509_FLAG_NO_VERSION, 0},
 | 
							{ "no_version", X509_FLAG_NO_VERSION, 0},
 | 
				
			||||||
		{ "no_serial", X509_FLAG_NO_SERIAL, 0},
 | 
							{ "no_serial", X509_FLAG_NO_SERIAL, 0},
 | 
				
			||||||
@@ -759,13 +1134,14 @@ int set_cert_ex(unsigned long *flags, const char *arg)
 | 
				
			|||||||
		{ "no_extensions", X509_FLAG_NO_EXTENSIONS, 0},
 | 
							{ "no_extensions", X509_FLAG_NO_EXTENSIONS, 0},
 | 
				
			||||||
		{ "no_sigdump", X509_FLAG_NO_SIGDUMP, 0},
 | 
							{ "no_sigdump", X509_FLAG_NO_SIGDUMP, 0},
 | 
				
			||||||
		{ "no_aux", X509_FLAG_NO_AUX, 0},
 | 
							{ "no_aux", X509_FLAG_NO_AUX, 0},
 | 
				
			||||||
 | 
							{ "no_attributes", X509_FLAG_NO_ATTRIBUTES, 0},
 | 
				
			||||||
		{ "ext_default", X509V3_EXT_DEFAULT, X509V3_EXT_UNKNOWN_MASK},
 | 
							{ "ext_default", X509V3_EXT_DEFAULT, X509V3_EXT_UNKNOWN_MASK},
 | 
				
			||||||
		{ "ext_error", X509V3_EXT_ERROR_UNKNOWN, X509V3_EXT_UNKNOWN_MASK},
 | 
							{ "ext_error", X509V3_EXT_ERROR_UNKNOWN, X509V3_EXT_UNKNOWN_MASK},
 | 
				
			||||||
		{ "ext_parse", X509V3_EXT_PARSE_UNKNOWN, X509V3_EXT_UNKNOWN_MASK},
 | 
							{ "ext_parse", X509V3_EXT_PARSE_UNKNOWN, X509V3_EXT_UNKNOWN_MASK},
 | 
				
			||||||
		{ "ext_dump", X509V3_EXT_DUMP_UNKNOWN, X509V3_EXT_UNKNOWN_MASK},
 | 
							{ "ext_dump", X509V3_EXT_DUMP_UNKNOWN, X509V3_EXT_UNKNOWN_MASK},
 | 
				
			||||||
		{ NULL, 0, 0}
 | 
							{ NULL, 0, 0}
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
	return set_table_opts(flags, arg, cert_tbl);
 | 
						return set_multi_opts(flags, arg, cert_tbl);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int set_name_ex(unsigned long *flags, const char *arg)
 | 
					int set_name_ex(unsigned long *flags, const char *arg)
 | 
				
			||||||
@@ -790,15 +1166,89 @@ int set_name_ex(unsigned long *flags, const char *arg)
 | 
				
			|||||||
		{ "nofname", XN_FLAG_FN_NONE, XN_FLAG_FN_MASK},
 | 
							{ "nofname", XN_FLAG_FN_NONE, XN_FLAG_FN_MASK},
 | 
				
			||||||
		{ "sname", XN_FLAG_FN_SN, XN_FLAG_FN_MASK},
 | 
							{ "sname", XN_FLAG_FN_SN, XN_FLAG_FN_MASK},
 | 
				
			||||||
		{ "lname", XN_FLAG_FN_LN, XN_FLAG_FN_MASK},
 | 
							{ "lname", XN_FLAG_FN_LN, XN_FLAG_FN_MASK},
 | 
				
			||||||
 | 
							{ "align", XN_FLAG_FN_ALIGN, 0},
 | 
				
			||||||
		{ "oid", XN_FLAG_FN_OID, XN_FLAG_FN_MASK},
 | 
							{ "oid", XN_FLAG_FN_OID, XN_FLAG_FN_MASK},
 | 
				
			||||||
		{ "space_eq", XN_FLAG_SPC_EQ, 0},
 | 
							{ "space_eq", XN_FLAG_SPC_EQ, 0},
 | 
				
			||||||
		{ "dump_unknown", XN_FLAG_DUMP_UNKNOWN_FIELDS, 0},
 | 
							{ "dump_unknown", XN_FLAG_DUMP_UNKNOWN_FIELDS, 0},
 | 
				
			||||||
		{ "RFC2253", XN_FLAG_RFC2253, 0xffffffffL},
 | 
							{ "RFC2253", XN_FLAG_RFC2253, 0xffffffffL},
 | 
				
			||||||
		{ "oneline", XN_FLAG_ONELINE, 0xffffffffL},
 | 
							{ "oneline", XN_FLAG_ONELINE, 0xffffffffL},
 | 
				
			||||||
		{ "multiline", XN_FLAG_MULTILINE, 0xffffffffL},
 | 
							{ "multiline", XN_FLAG_MULTILINE, 0xffffffffL},
 | 
				
			||||||
 | 
							{ "ca_default", XN_FLAG_MULTILINE, 0xffffffffL},
 | 
				
			||||||
		{ NULL, 0, 0}
 | 
							{ NULL, 0, 0}
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
	return set_table_opts(flags, arg, ex_tbl);
 | 
						return set_multi_opts(flags, arg, ex_tbl);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int set_ext_copy(int *copy_type, const char *arg)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (!strcasecmp(arg, "none"))
 | 
				
			||||||
 | 
							*copy_type = EXT_COPY_NONE;
 | 
				
			||||||
 | 
						else if (!strcasecmp(arg, "copy"))
 | 
				
			||||||
 | 
							*copy_type = EXT_COPY_ADD;
 | 
				
			||||||
 | 
						else if (!strcasecmp(arg, "copyall"))
 | 
				
			||||||
 | 
							*copy_type = EXT_COPY_ALL;
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
							return 0;
 | 
				
			||||||
 | 
						return 1;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int copy_extensions(X509 *x, X509_REQ *req, int copy_type)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						STACK_OF(X509_EXTENSION) *exts = NULL;
 | 
				
			||||||
 | 
						X509_EXTENSION *ext, *tmpext;
 | 
				
			||||||
 | 
						ASN1_OBJECT *obj;
 | 
				
			||||||
 | 
						int i, idx, ret = 0;
 | 
				
			||||||
 | 
						if (!x || !req || (copy_type == EXT_COPY_NONE))
 | 
				
			||||||
 | 
							return 1;
 | 
				
			||||||
 | 
						exts = X509_REQ_get_extensions(req);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						for(i = 0; i < sk_X509_EXTENSION_num(exts); i++) {
 | 
				
			||||||
 | 
							ext = sk_X509_EXTENSION_value(exts, i);
 | 
				
			||||||
 | 
							obj = X509_EXTENSION_get_object(ext);
 | 
				
			||||||
 | 
							idx = X509_get_ext_by_OBJ(x, obj, -1);
 | 
				
			||||||
 | 
							/* Does extension exist? */
 | 
				
			||||||
 | 
							if (idx != -1) {
 | 
				
			||||||
 | 
								/* If normal copy don't override existing extension */
 | 
				
			||||||
 | 
								if (copy_type == EXT_COPY_ADD)
 | 
				
			||||||
 | 
									continue;
 | 
				
			||||||
 | 
								/* Delete all extensions of same type */
 | 
				
			||||||
 | 
								do {
 | 
				
			||||||
 | 
									tmpext = X509_get_ext(x, idx);
 | 
				
			||||||
 | 
									X509_delete_ext(x, idx);
 | 
				
			||||||
 | 
									X509_EXTENSION_free(tmpext);
 | 
				
			||||||
 | 
									idx = X509_get_ext_by_OBJ(x, obj, -1);
 | 
				
			||||||
 | 
								} while (idx != -1);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							if (!X509_add_ext(x, ext, -1))
 | 
				
			||||||
 | 
								goto end;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						ret = 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						end:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						sk_X509_EXTENSION_pop_free(exts, X509_EXTENSION_free);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return ret;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
								
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static int set_multi_opts(unsigned long *flags, const char *arg, const NAME_EX_TBL *in_tbl)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						STACK_OF(CONF_VALUE) *vals;
 | 
				
			||||||
 | 
						CONF_VALUE *val;
 | 
				
			||||||
 | 
						int i, ret = 1;
 | 
				
			||||||
 | 
						if(!arg) return 0;
 | 
				
			||||||
 | 
						vals = X509V3_parse_list(arg);
 | 
				
			||||||
 | 
						for (i = 0; i < sk_CONF_VALUE_num(vals); i++) {
 | 
				
			||||||
 | 
							val = sk_CONF_VALUE_value(vals, i);
 | 
				
			||||||
 | 
							if (!set_table_opts(flags, val->name, in_tbl))
 | 
				
			||||||
 | 
								ret = 0;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						sk_CONF_VALUE_pop_free(vals, X509V3_conf_free);
 | 
				
			||||||
 | 
						return ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int set_table_opts(unsigned long *flags, const char *arg, const NAME_EX_TBL *in_tbl)
 | 
					static int set_table_opts(unsigned long *flags, const char *arg, const NAME_EX_TBL *in_tbl)
 | 
				
			||||||
@@ -828,18 +1278,20 @@ static int set_table_opts(unsigned long *flags, const char *arg, const NAME_EX_T
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void print_name(BIO *out, char *title, X509_NAME *nm, unsigned long lflags)
 | 
					void print_name(BIO *out, char *title, X509_NAME *nm, unsigned long lflags)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	char buf[256];
 | 
						char *buf;
 | 
				
			||||||
	char mline = 0;
 | 
						char mline = 0;
 | 
				
			||||||
	int indent = 0;
 | 
						int indent = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(title) BIO_puts(out, title);
 | 
						if(title) BIO_puts(out, title);
 | 
				
			||||||
	if((lflags & XN_FLAG_SEP_MASK) == XN_FLAG_SEP_MULTILINE) {
 | 
						if((lflags & XN_FLAG_SEP_MASK) == XN_FLAG_SEP_MULTILINE) {
 | 
				
			||||||
		mline = 1;
 | 
							mline = 1;
 | 
				
			||||||
		indent = 4;
 | 
							indent = 4;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if(lflags == XN_FLAG_COMPAT) {
 | 
						if(lflags == XN_FLAG_COMPAT) {
 | 
				
			||||||
		X509_NAME_oneline(nm,buf,256);
 | 
							buf = X509_NAME_oneline(nm, 0, 0);
 | 
				
			||||||
		BIO_puts(out,buf);
 | 
							BIO_puts(out, buf);
 | 
				
			||||||
		BIO_puts(out, "\n");
 | 
							BIO_puts(out, "\n");
 | 
				
			||||||
 | 
							OPENSSL_free(buf);
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		if(mline) BIO_puts(out, "\n");
 | 
							if(mline) BIO_puts(out, "\n");
 | 
				
			||||||
		X509_NAME_print_ex(out, nm, indent, lflags);
 | 
							X509_NAME_print_ex(out, nm, indent, lflags);
 | 
				
			||||||
@@ -876,3 +1328,93 @@ X509_STORE *setup_verify(BIO *bp, char *CAfile, char *CApath)
 | 
				
			|||||||
	X509_STORE_free(store);
 | 
						X509_STORE_free(store);
 | 
				
			||||||
	return NULL;
 | 
						return NULL;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Try to load an engine in a shareable library */
 | 
				
			||||||
 | 
					static ENGINE *try_load_engine(BIO *err, const char *engine, int debug)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						ENGINE *e = ENGINE_by_id("dynamic");
 | 
				
			||||||
 | 
						if (e)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							if (!ENGINE_ctrl_cmd_string(e, "SO_PATH", engine, 0)
 | 
				
			||||||
 | 
								|| !ENGINE_ctrl_cmd_string(e, "LOAD", NULL, 0))
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								ENGINE_free(e);
 | 
				
			||||||
 | 
								e = NULL;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						return e;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ENGINE *setup_engine(BIO *err, const char *engine, int debug)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					        ENGINE *e = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (engine)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
							if(strcmp(engine, "auto") == 0)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								BIO_printf(err,"enabling auto ENGINE support\n");
 | 
				
			||||||
 | 
								ENGINE_register_all_complete();
 | 
				
			||||||
 | 
								return NULL;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							if((e = ENGINE_by_id(engine)) == NULL
 | 
				
			||||||
 | 
								&& (e = try_load_engine(err, engine, debug)) == NULL)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								BIO_printf(err,"invalid engine \"%s\"\n", engine);
 | 
				
			||||||
 | 
								ERR_print_errors(err);
 | 
				
			||||||
 | 
								return NULL;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							if (debug)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								ENGINE_ctrl(e, ENGINE_CTRL_SET_LOGSTREAM,
 | 
				
			||||||
 | 
									0, err, 0);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					                ENGINE_ctrl_cmd(e, "SET_USER_INTERFACE", 0, ui_method, 0, 1);
 | 
				
			||||||
 | 
							if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								BIO_printf(err,"can't use that engine\n");
 | 
				
			||||||
 | 
								ERR_print_errors(err);
 | 
				
			||||||
 | 
								ENGINE_free(e);
 | 
				
			||||||
 | 
								return NULL;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							BIO_printf(err,"engine \"%s\" set.\n", ENGINE_get_id(e));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							/* Free our "structural" reference. */
 | 
				
			||||||
 | 
							ENGINE_free(e);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					        return e;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int load_config(BIO *err, CONF *cnf)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						if (!cnf)
 | 
				
			||||||
 | 
							cnf = config;
 | 
				
			||||||
 | 
						if (!cnf)
 | 
				
			||||||
 | 
							return 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						OPENSSL_load_builtin_modules();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (CONF_modules_load(cnf, NULL, 0) <= 0)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							BIO_printf(err, "Error configuring OpenSSL\n");
 | 
				
			||||||
 | 
							ERR_print_errors(err);
 | 
				
			||||||
 | 
							return 0;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						return 1;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					char *make_config_name()
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						const char *t=X509_get_default_cert_area();
 | 
				
			||||||
 | 
						char *p;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						p=OPENSSL_malloc(strlen(t)+strlen(OPENSSL_CONF)+2);
 | 
				
			||||||
 | 
						strcpy(p,t);
 | 
				
			||||||
 | 
					#ifndef OPENSSL_SYS_VMS
 | 
				
			||||||
 | 
						strcat(p,"/");
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
						strcat(p,OPENSSL_CONF);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return p;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										139
									
								
								apps/apps.h
									
									
									
									
									
								
							
							
						
						
									
										139
									
								
								apps/apps.h
									
									
									
									
									
								
							@@ -55,6 +55,59 @@
 | 
				
			|||||||
 * copied and put under another distribution licence
 | 
					 * copied and put under another distribution licence
 | 
				
			||||||
 * [including the GNU Public Licence.]
 | 
					 * [including the GNU Public Licence.]
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					/* ====================================================================
 | 
				
			||||||
 | 
					 * Copyright (c) 1998-2001 The OpenSSL Project.  All rights reserved.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Redistribution and use in source and binary forms, with or without
 | 
				
			||||||
 | 
					 * modification, are permitted provided that the following conditions
 | 
				
			||||||
 | 
					 * are met:
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 1. Redistributions of source code must retain the above copyright
 | 
				
			||||||
 | 
					 *    notice, this list of conditions and the following disclaimer. 
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 2. Redistributions in binary form must reproduce the above copyright
 | 
				
			||||||
 | 
					 *    notice, this list of conditions and the following disclaimer in
 | 
				
			||||||
 | 
					 *    the documentation and/or other materials provided with the
 | 
				
			||||||
 | 
					 *    distribution.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 3. All advertising materials mentioning features or use of this
 | 
				
			||||||
 | 
					 *    software must display the following acknowledgment:
 | 
				
			||||||
 | 
					 *    "This product includes software developed by the OpenSSL Project
 | 
				
			||||||
 | 
					 *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
 | 
				
			||||||
 | 
					 *    endorse or promote products derived from this software without
 | 
				
			||||||
 | 
					 *    prior written permission. For written permission, please contact
 | 
				
			||||||
 | 
					 *    openssl-core@openssl.org.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 5. Products derived from this software may not be called "OpenSSL"
 | 
				
			||||||
 | 
					 *    nor may "OpenSSL" appear in their names without prior written
 | 
				
			||||||
 | 
					 *    permission of the OpenSSL Project.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 6. Redistributions of any form whatsoever must retain the following
 | 
				
			||||||
 | 
					 *    acknowledgment:
 | 
				
			||||||
 | 
					 *    "This product includes software developed by the OpenSSL Project
 | 
				
			||||||
 | 
					 *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
 | 
				
			||||||
 | 
					 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 | 
				
			||||||
 | 
					 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 | 
				
			||||||
 | 
					 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
 | 
				
			||||||
 | 
					 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 | 
				
			||||||
 | 
					 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 | 
				
			||||||
 | 
					 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 | 
				
			||||||
 | 
					 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 | 
				
			||||||
 | 
					 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 | 
				
			||||||
 | 
					 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 | 
				
			||||||
 | 
					 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 | 
				
			||||||
 | 
					 * OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
				
			||||||
 | 
					 * ====================================================================
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This product includes cryptographic software written by Eric Young
 | 
				
			||||||
 | 
					 * (eay@cryptsoft.com).  This product includes software written by Tim
 | 
				
			||||||
 | 
					 * Hudson (tjh@cryptsoft.com).
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef HEADER_APPS_H
 | 
					#ifndef HEADER_APPS_H
 | 
				
			||||||
#define HEADER_APPS_H
 | 
					#define HEADER_APPS_H
 | 
				
			||||||
@@ -67,7 +120,9 @@
 | 
				
			|||||||
#include <openssl/x509.h>
 | 
					#include <openssl/x509.h>
 | 
				
			||||||
#include <openssl/lhash.h>
 | 
					#include <openssl/lhash.h>
 | 
				
			||||||
#include <openssl/conf.h>
 | 
					#include <openssl/conf.h>
 | 
				
			||||||
 | 
					#include <openssl/txt_db.h>
 | 
				
			||||||
#include <openssl/engine.h>
 | 
					#include <openssl/engine.h>
 | 
				
			||||||
 | 
					#include <openssl/ossl_typ.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int app_RAND_load_file(const char *file, BIO *bio_e, int dont_warn);
 | 
					int app_RAND_load_file(const char *file, BIO *bio_e, int dont_warn);
 | 
				
			||||||
int app_RAND_write_file(const char *file, BIO *bio_e);
 | 
					int app_RAND_write_file(const char *file, BIO *bio_e);
 | 
				
			||||||
@@ -79,29 +134,33 @@ long app_RAND_load_files(char *file); /* `file' is a list of files to read,
 | 
				
			|||||||
                                       * (see e_os.h).  The string is
 | 
					                                       * (see e_os.h).  The string is
 | 
				
			||||||
                                       * destroyed! */
 | 
					                                       * destroyed! */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef OPENSSL_NO_STDIO
 | 
					 | 
				
			||||||
BIO_METHOD *BIO_s_file();
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#ifdef OPENSSL_SYS_WIN32
 | 
					#ifdef OPENSSL_SYS_WIN32
 | 
				
			||||||
#define rename(from,to) WIN32_rename((from),(to))
 | 
					#define rename(from,to) WIN32_rename((from),(to))
 | 
				
			||||||
int WIN32_rename(char *oldname,char *newname);
 | 
					int WIN32_rename(char *oldname,char *newname);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* VMS below version 7.0 doesn't have strcasecmp() */
 | 
				
			||||||
 | 
					#ifdef OPENSSL_SYS_VMS
 | 
				
			||||||
 | 
					#define strcasecmp(str1,str2) VMS_strcasecmp((str1),(str2))
 | 
				
			||||||
 | 
					int VMS_strcasecmp(const char *str1, const char *str2);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef MONOLITH
 | 
					#ifndef MONOLITH
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define MAIN(a,v)	main(a,v)
 | 
					#define MAIN(a,v)	main(a,v)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef NON_MAIN
 | 
					#ifndef NON_MAIN
 | 
				
			||||||
 | 
					CONF *config=NULL;
 | 
				
			||||||
BIO *bio_err=NULL;
 | 
					BIO *bio_err=NULL;
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
 | 
					extern CONF *config;
 | 
				
			||||||
extern BIO *bio_err;
 | 
					extern BIO *bio_err;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define MAIN(a,v)	PROG(a,v)
 | 
					#define MAIN(a,v)	PROG(a,v)
 | 
				
			||||||
extern LHASH *config;
 | 
					extern CONF *config;
 | 
				
			||||||
extern char *default_config_file;
 | 
					extern char *default_config_file;
 | 
				
			||||||
extern BIO *bio_err;
 | 
					extern BIO *bio_err;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -116,24 +175,34 @@ extern BIO *bio_err;
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(MONOLITH) && !defined(OPENSSL_C)
 | 
					#if defined(MONOLITH) && !defined(OPENSSL_C)
 | 
				
			||||||
#  define apps_startup()	do_pipe_sig()
 | 
					#  define apps_startup() \
 | 
				
			||||||
 | 
							do_pipe_sig()
 | 
				
			||||||
 | 
					#  define apps_shutdown()
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
#  if defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_WIN16) || \
 | 
					#  if defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_WIN16) || \
 | 
				
			||||||
   defined(OPENSSL_SYS_WIN32)
 | 
					   defined(OPENSSL_SYS_WIN32)
 | 
				
			||||||
#    ifdef _O_BINARY
 | 
					#    ifdef _O_BINARY
 | 
				
			||||||
#      define apps_startup() \
 | 
					#      define apps_startup() \
 | 
				
			||||||
		_fmode=_O_BINARY; do_pipe_sig(); CRYPTO_malloc_init(); \
 | 
							do { _fmode=_O_BINARY; do_pipe_sig(); CRYPTO_malloc_init(); \
 | 
				
			||||||
		OpenSSL_add_all_algorithms(); ENGINE_load_builtin_engines()
 | 
							ERR_load_crypto_strings(); OpenSSL_add_all_algorithms(); \
 | 
				
			||||||
 | 
							ENGINE_load_builtin_engines(); setup_ui_method(); } while(0)
 | 
				
			||||||
#    else
 | 
					#    else
 | 
				
			||||||
#      define apps_startup() \
 | 
					#      define apps_startup() \
 | 
				
			||||||
		_fmode=O_BINARY; do_pipe_sig(); CRYPTO_malloc_init(); \
 | 
							do { _fmode=O_BINARY; do_pipe_sig(); CRYPTO_malloc_init(); \
 | 
				
			||||||
		OpenSSL_add_all_algorithms(); ENGINE_load_builtin_engines()
 | 
							ERR_load_crypto_strings(); OpenSSL_add_all_algorithms(); \
 | 
				
			||||||
 | 
							ENGINE_load_builtin_engines(); setup_ui_method(); } while(0)
 | 
				
			||||||
#    endif
 | 
					#    endif
 | 
				
			||||||
#  else
 | 
					#  else
 | 
				
			||||||
#    define apps_startup() \
 | 
					#    define apps_startup() \
 | 
				
			||||||
		do_pipe_sig(); OpenSSL_add_all_algorithms(); \
 | 
							do { do_pipe_sig(); OpenSSL_add_all_algorithms(); \
 | 
				
			||||||
		ENGINE_load_builtin_engines()
 | 
							ERR_load_crypto_strings(); ENGINE_load_builtin_engines(); \
 | 
				
			||||||
 | 
							setup_ui_method(); } while(0)
 | 
				
			||||||
#  endif
 | 
					#  endif
 | 
				
			||||||
 | 
					#  define apps_shutdown() \
 | 
				
			||||||
 | 
							do { CONF_modules_unload(1); destroy_ui_method(); \
 | 
				
			||||||
 | 
							EVP_cleanup(); ENGINE_cleanup(); \
 | 
				
			||||||
 | 
							CRYPTO_cleanup_all_ex_data(); ERR_remove_state(0); \
 | 
				
			||||||
 | 
							ERR_free_strings(); } while(0)
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct args_st
 | 
					typedef struct args_st
 | 
				
			||||||
@@ -142,6 +211,19 @@ typedef struct args_st
 | 
				
			|||||||
	int count;
 | 
						int count;
 | 
				
			||||||
	} ARGS;
 | 
						} ARGS;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define PW_MIN_LENGTH 4
 | 
				
			||||||
 | 
					typedef struct pw_cb_data
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						const void *password;
 | 
				
			||||||
 | 
						const char *prompt_info;
 | 
				
			||||||
 | 
						} PW_CB_DATA;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int password_callback(char *buf, int bufsiz, int verify,
 | 
				
			||||||
 | 
						PW_CB_DATA *cb_data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int setup_ui_method(void);
 | 
				
			||||||
 | 
					void destroy_ui_method(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int should_retry(int i);
 | 
					int should_retry(int i);
 | 
				
			||||||
int args_from_file(char *file, int *argc, char **argv[]);
 | 
					int args_from_file(char *file, int *argc, char **argv[]);
 | 
				
			||||||
int str2fmt(char *s);
 | 
					int str2fmt(char *s);
 | 
				
			||||||
@@ -153,13 +235,30 @@ void print_name(BIO *out, char *title, X509_NAME *nm, unsigned long lflags);
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
int set_cert_ex(unsigned long *flags, const char *arg);
 | 
					int set_cert_ex(unsigned long *flags, const char *arg);
 | 
				
			||||||
int set_name_ex(unsigned long *flags, const char *arg);
 | 
					int set_name_ex(unsigned long *flags, const char *arg);
 | 
				
			||||||
 | 
					int set_ext_copy(int *copy_type, const char *arg);
 | 
				
			||||||
 | 
					int copy_extensions(X509 *x, X509_REQ *req, int copy_type);
 | 
				
			||||||
int app_passwd(BIO *err, char *arg1, char *arg2, char **pass1, char **pass2);
 | 
					int app_passwd(BIO *err, char *arg1, char *arg2, char **pass1, char **pass2);
 | 
				
			||||||
int add_oid_section(BIO *err, LHASH *conf);
 | 
					int add_oid_section(BIO *err, CONF *conf);
 | 
				
			||||||
X509 *load_cert(BIO *err, char *file, int format);
 | 
					X509 *load_cert(BIO *err, const char *file, int format,
 | 
				
			||||||
EVP_PKEY *load_key(BIO *err, char *file, int format, char *pass, ENGINE *e);
 | 
						const char *pass, ENGINE *e, const char *cert_descrip);
 | 
				
			||||||
EVP_PKEY *load_pubkey(BIO *err, char *file, int format, ENGINE *e);
 | 
					EVP_PKEY *load_key(BIO *err, const char *file, int format, int maybe_stdin,
 | 
				
			||||||
STACK_OF(X509) *load_certs(BIO *err, char *file, int format);
 | 
						const char *pass, ENGINE *e, const char *key_descrip);
 | 
				
			||||||
 | 
					EVP_PKEY *load_pubkey(BIO *err, const char *file, int format, int maybe_stdin,
 | 
				
			||||||
 | 
						const char *pass, ENGINE *e, const char *key_descrip);
 | 
				
			||||||
 | 
					STACK_OF(X509) *load_certs(BIO *err, const char *file, int format,
 | 
				
			||||||
 | 
						const char *pass, ENGINE *e, const char *cert_descrip);
 | 
				
			||||||
X509_STORE *setup_verify(BIO *bp, char *CAfile, char *CApath);
 | 
					X509_STORE *setup_verify(BIO *bp, char *CAfile, char *CApath);
 | 
				
			||||||
 | 
					ENGINE *setup_engine(BIO *err, const char *engine, int debug);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int load_config(BIO *err, CONF *cnf);
 | 
				
			||||||
 | 
					char *make_config_name(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Functions defined in ca.c and also used in ocsp.c */
 | 
				
			||||||
 | 
					int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold,
 | 
				
			||||||
 | 
								ASN1_GENERALIZEDTIME **pinvtm, char *str);
 | 
				
			||||||
 | 
					int make_serial_index(TXT_DB *db);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					X509_NAME *do_subject(char *str, long chtype);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define FORMAT_UNDEF    0
 | 
					#define FORMAT_UNDEF    0
 | 
				
			||||||
#define FORMAT_ASN1     1
 | 
					#define FORMAT_ASN1     1
 | 
				
			||||||
@@ -169,6 +268,12 @@ X509_STORE *setup_verify(BIO *bp, char *CAfile, char *CApath);
 | 
				
			|||||||
#define FORMAT_PKCS12   5
 | 
					#define FORMAT_PKCS12   5
 | 
				
			||||||
#define FORMAT_SMIME    6
 | 
					#define FORMAT_SMIME    6
 | 
				
			||||||
#define FORMAT_ENGINE   7
 | 
					#define FORMAT_ENGINE   7
 | 
				
			||||||
 | 
					#define FORMAT_IISSGC	8	/* XXX this stupid macro helps us to avoid
 | 
				
			||||||
 | 
									 * adding yet another param to load_*key() */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define EXT_COPY_NONE	0
 | 
				
			||||||
 | 
					#define EXT_COPY_ADD	1
 | 
				
			||||||
 | 
					#define EXT_COPY_ALL	2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define NETSCAPE_CERT_HDR	"certificate"
 | 
					#define NETSCAPE_CERT_HDR	"certificate"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -103,6 +103,9 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
		if ((bio_err=BIO_new(BIO_s_file())) != NULL)
 | 
							if ((bio_err=BIO_new(BIO_s_file())) != NULL)
 | 
				
			||||||
			BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
 | 
								BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!load_config(bio_err, NULL))
 | 
				
			||||||
 | 
							goto end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	prog=argv[0];
 | 
						prog=argv[0];
 | 
				
			||||||
	argc--;
 | 
						argc--;
 | 
				
			||||||
	argv++;
 | 
						argv++;
 | 
				
			||||||
@@ -181,7 +184,7 @@ bad:
 | 
				
			|||||||
		BIO_printf(bio_err,"where options are\n");
 | 
							BIO_printf(bio_err,"where options are\n");
 | 
				
			||||||
		BIO_printf(bio_err," -inform arg   input format - one of DER TXT PEM\n");
 | 
							BIO_printf(bio_err," -inform arg   input format - one of DER TXT PEM\n");
 | 
				
			||||||
		BIO_printf(bio_err," -in arg       input file\n");
 | 
							BIO_printf(bio_err," -in arg       input file\n");
 | 
				
			||||||
		BIO_printf(bio_err," -out arg      output file\n");
 | 
							BIO_printf(bio_err," -out arg      output file (output format is always DER\n");
 | 
				
			||||||
		BIO_printf(bio_err," -noout arg    don't produce any output\n");
 | 
							BIO_printf(bio_err," -noout arg    don't produce any output\n");
 | 
				
			||||||
		BIO_printf(bio_err," -offset arg   offset into file\n");
 | 
							BIO_printf(bio_err," -offset arg   offset into file\n");
 | 
				
			||||||
		BIO_printf(bio_err," -length arg   length of section in file\n");
 | 
							BIO_printf(bio_err," -length arg   length of section in file\n");
 | 
				
			||||||
@@ -192,7 +195,6 @@ bad:
 | 
				
			|||||||
		BIO_printf(bio_err," -strparse offset\n");
 | 
							BIO_printf(bio_err," -strparse offset\n");
 | 
				
			||||||
		BIO_printf(bio_err,"               a series of these can be used to 'dig' into multiple\n");
 | 
							BIO_printf(bio_err,"               a series of these can be used to 'dig' into multiple\n");
 | 
				
			||||||
		BIO_printf(bio_err,"               ASN1 blob wrappings\n");
 | 
							BIO_printf(bio_err,"               ASN1 blob wrappings\n");
 | 
				
			||||||
		BIO_printf(bio_err," -out filename output DER encoding to file\n");
 | 
					 | 
				
			||||||
		goto end;
 | 
							goto end;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -329,6 +331,7 @@ end:
 | 
				
			|||||||
	if (at != NULL) ASN1_TYPE_free(at);
 | 
						if (at != NULL) ASN1_TYPE_free(at);
 | 
				
			||||||
	if (osk != NULL) sk_free(osk);
 | 
						if (osk != NULL) sk_free(osk);
 | 
				
			||||||
	OBJ_cleanup();
 | 
						OBJ_cleanup();
 | 
				
			||||||
 | 
						apps_shutdown();
 | 
				
			||||||
	EXIT(ret);
 | 
						EXIT(ret);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -187,7 +187,7 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
			{
 | 
								{
 | 
				
			||||||
			BIO_puts(STDout,SSL_CIPHER_description(
 | 
								BIO_puts(STDout,SSL_CIPHER_description(
 | 
				
			||||||
				sk_SSL_CIPHER_value(sk,i),
 | 
									sk_SSL_CIPHER_value(sk,i),
 | 
				
			||||||
				buf,512));
 | 
									buf,sizeof buf));
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -202,6 +202,7 @@ end:
 | 
				
			|||||||
	if (ctx != NULL) SSL_CTX_free(ctx);
 | 
						if (ctx != NULL) SSL_CTX_free(ctx);
 | 
				
			||||||
	if (ssl != NULL) SSL_free(ssl);
 | 
						if (ssl != NULL) SSL_free(ssl);
 | 
				
			||||||
	if (STDout != NULL) BIO_free_all(STDout);
 | 
						if (STDout != NULL) BIO_free_all(STDout);
 | 
				
			||||||
 | 
						apps_shutdown();
 | 
				
			||||||
	EXIT(ret);
 | 
						EXIT(ret);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										23
									
								
								apps/crl.c
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								apps/crl.c
									
									
									
									
									
								
							@@ -87,6 +87,7 @@ static char *crl_usage[]={
 | 
				
			|||||||
" -noout          - no CRL output\n",
 | 
					" -noout          - no CRL output\n",
 | 
				
			||||||
" -CAfile  name   - verify CRL using certificates in file \"name\"\n",
 | 
					" -CAfile  name   - verify CRL using certificates in file \"name\"\n",
 | 
				
			||||||
" -CApath  dir    - verify CRL using certificates in \"dir\"\n",
 | 
					" -CApath  dir    - verify CRL using certificates in \"dir\"\n",
 | 
				
			||||||
 | 
					" -nameopt arg    - various certificate name options\n",
 | 
				
			||||||
NULL
 | 
					NULL
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -97,6 +98,7 @@ int MAIN(int, char **);
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
int MAIN(int argc, char **argv)
 | 
					int MAIN(int argc, char **argv)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
 | 
						unsigned long nmflag = 0;
 | 
				
			||||||
	X509_CRL *x=NULL;
 | 
						X509_CRL *x=NULL;
 | 
				
			||||||
	char *CAfile = NULL, *CApath = NULL;
 | 
						char *CAfile = NULL, *CApath = NULL;
 | 
				
			||||||
	int ret=1,i,num,badops=0;
 | 
						int ret=1,i,num,badops=0;
 | 
				
			||||||
@@ -105,7 +107,7 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
	char *infile=NULL,*outfile=NULL;
 | 
						char *infile=NULL,*outfile=NULL;
 | 
				
			||||||
	int hash=0,issuer=0,lastupdate=0,nextupdate=0,noout=0,text=0;
 | 
						int hash=0,issuer=0,lastupdate=0,nextupdate=0,noout=0,text=0;
 | 
				
			||||||
	int fingerprint = 0;
 | 
						int fingerprint = 0;
 | 
				
			||||||
	char **pp,buf[256];
 | 
						char **pp;
 | 
				
			||||||
	X509_STORE *store = NULL;
 | 
						X509_STORE *store = NULL;
 | 
				
			||||||
	X509_STORE_CTX ctx;
 | 
						X509_STORE_CTX ctx;
 | 
				
			||||||
	X509_LOOKUP *lookup = NULL;
 | 
						X509_LOOKUP *lookup = NULL;
 | 
				
			||||||
@@ -120,6 +122,9 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
		if ((bio_err=BIO_new(BIO_s_file())) != NULL)
 | 
							if ((bio_err=BIO_new(BIO_s_file())) != NULL)
 | 
				
			||||||
			BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
 | 
								BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!load_config(bio_err, NULL))
 | 
				
			||||||
 | 
							goto end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (bio_out == NULL)
 | 
						if (bio_out == NULL)
 | 
				
			||||||
		if ((bio_out=BIO_new(BIO_s_file())) != NULL)
 | 
							if ((bio_out=BIO_new(BIO_s_file())) != NULL)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
@@ -185,6 +190,11 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
			text = 1;
 | 
								text = 1;
 | 
				
			||||||
		else if (strcmp(*argv,"-hash") == 0)
 | 
							else if (strcmp(*argv,"-hash") == 0)
 | 
				
			||||||
			hash= ++num;
 | 
								hash= ++num;
 | 
				
			||||||
 | 
							else if (strcmp(*argv,"-nameopt") == 0)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								if (--argc < 1) goto bad;
 | 
				
			||||||
 | 
								if (!set_name_ex(&nmflag, *(++argv))) goto bad;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
		else if (strcmp(*argv,"-issuer") == 0)
 | 
							else if (strcmp(*argv,"-issuer") == 0)
 | 
				
			||||||
			issuer= ++num;
 | 
								issuer= ++num;
 | 
				
			||||||
		else if (strcmp(*argv,"-lastupdate") == 0)
 | 
							else if (strcmp(*argv,"-lastupdate") == 0)
 | 
				
			||||||
@@ -235,7 +245,11 @@ bad:
 | 
				
			|||||||
			X509_LOOKUP_add_dir(lookup,NULL,X509_FILETYPE_DEFAULT);
 | 
								X509_LOOKUP_add_dir(lookup,NULL,X509_FILETYPE_DEFAULT);
 | 
				
			||||||
		ERR_clear_error();
 | 
							ERR_clear_error();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		X509_STORE_CTX_init(&ctx, store, NULL, NULL);
 | 
							if(!X509_STORE_CTX_init(&ctx, store, NULL, NULL)) {
 | 
				
			||||||
 | 
								BIO_printf(bio_err,
 | 
				
			||||||
 | 
									"Error initialising X509 store\n");
 | 
				
			||||||
 | 
								goto end;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		i = X509_STORE_get_by_subject(&ctx, X509_LU_X509, 
 | 
							i = X509_STORE_get_by_subject(&ctx, X509_LU_X509, 
 | 
				
			||||||
					X509_CRL_get_issuer(x), &xobj);
 | 
										X509_CRL_get_issuer(x), &xobj);
 | 
				
			||||||
@@ -264,9 +278,7 @@ bad:
 | 
				
			|||||||
			{
 | 
								{
 | 
				
			||||||
			if (issuer == i)
 | 
								if (issuer == i)
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
				X509_NAME_oneline(X509_CRL_get_issuer(x),
 | 
									print_name(bio_out, "issuer=", X509_CRL_get_issuer(x), nmflag);
 | 
				
			||||||
								buf,256);
 | 
					 | 
				
			||||||
				BIO_printf(bio_out,"issuer= %s\n",buf);
 | 
					 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (hash == i)
 | 
								if (hash == i)
 | 
				
			||||||
@@ -364,6 +376,7 @@ end:
 | 
				
			|||||||
		X509_STORE_CTX_cleanup(&ctx);
 | 
							X509_STORE_CTX_cleanup(&ctx);
 | 
				
			||||||
		X509_STORE_free(store);
 | 
							X509_STORE_free(store);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						apps_shutdown();
 | 
				
			||||||
	EXIT(ret);
 | 
						EXIT(ret);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -166,7 +166,8 @@ bad:
 | 
				
			|||||||
		BIO_printf(bio_err," -certfile arg  certificates file of chain to a trusted CA\n");
 | 
							BIO_printf(bio_err," -certfile arg  certificates file of chain to a trusted CA\n");
 | 
				
			||||||
		BIO_printf(bio_err,"                (can be used more than once)\n");
 | 
							BIO_printf(bio_err,"                (can be used more than once)\n");
 | 
				
			||||||
		BIO_printf(bio_err," -nocrl         no crl to load, just certs from '-certfile'\n");
 | 
							BIO_printf(bio_err," -nocrl         no crl to load, just certs from '-certfile'\n");
 | 
				
			||||||
		EXIT(1);
 | 
							ret = 1;
 | 
				
			||||||
 | 
							goto end;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ERR_load_crypto_strings();
 | 
						ERR_load_crypto_strings();
 | 
				
			||||||
@@ -278,6 +279,7 @@ end:
 | 
				
			|||||||
	if (p7 != NULL) PKCS7_free(p7);
 | 
						if (p7 != NULL) PKCS7_free(p7);
 | 
				
			||||||
	if (crl != NULL) X509_CRL_free(crl);
 | 
						if (crl != NULL) X509_CRL_free(crl);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						apps_shutdown();
 | 
				
			||||||
	EXIT(ret);
 | 
						EXIT(ret);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										134
									
								
								apps/dgst.c
									
									
									
									
									
								
							
							
						
						
									
										134
									
								
								apps/dgst.c
									
									
									
									
									
								
							@@ -66,7 +66,6 @@
 | 
				
			|||||||
#include <openssl/objects.h>
 | 
					#include <openssl/objects.h>
 | 
				
			||||||
#include <openssl/x509.h>
 | 
					#include <openssl/x509.h>
 | 
				
			||||||
#include <openssl/pem.h>
 | 
					#include <openssl/pem.h>
 | 
				
			||||||
#include <openssl/engine.h>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#undef BUFSIZE
 | 
					#undef BUFSIZE
 | 
				
			||||||
#define BUFSIZE	1024*8
 | 
					#define BUFSIZE	1024*8
 | 
				
			||||||
@@ -74,8 +73,9 @@
 | 
				
			|||||||
#undef PROG
 | 
					#undef PROG
 | 
				
			||||||
#define PROG	dgst_main
 | 
					#define PROG	dgst_main
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout,
 | 
					int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout,
 | 
				
			||||||
		EVP_PKEY *key, unsigned char *sigin, int siglen);
 | 
						  EVP_PKEY *key, unsigned char *sigin, int siglen, const char *title,
 | 
				
			||||||
 | 
						  const char *file);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int MAIN(int, char **);
 | 
					int MAIN(int, char **);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -89,8 +89,8 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
	BIO *bmd=NULL;
 | 
						BIO *bmd=NULL;
 | 
				
			||||||
	BIO *out = NULL;
 | 
						BIO *out = NULL;
 | 
				
			||||||
	const char *name;
 | 
						const char *name;
 | 
				
			||||||
#define PROG_NAME_SIZE  16
 | 
					#define PROG_NAME_SIZE  39
 | 
				
			||||||
	char pname[PROG_NAME_SIZE];
 | 
						char pname[PROG_NAME_SIZE+1];
 | 
				
			||||||
	int separator=0;
 | 
						int separator=0;
 | 
				
			||||||
	int debug=0;
 | 
						int debug=0;
 | 
				
			||||||
	int keyform=FORMAT_PEM;
 | 
						int keyform=FORMAT_PEM;
 | 
				
			||||||
@@ -113,8 +113,11 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
		if ((bio_err=BIO_new(BIO_s_file())) != NULL)
 | 
							if ((bio_err=BIO_new(BIO_s_file())) != NULL)
 | 
				
			||||||
			BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
 | 
								BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!load_config(bio_err, NULL))
 | 
				
			||||||
 | 
							goto end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* first check the program name */
 | 
						/* first check the program name */
 | 
				
			||||||
	program_name(argv[0],pname,PROG_NAME_SIZE);
 | 
						program_name(argv[0],pname,sizeof pname);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	md=EVP_get_digestbyname(pname);
 | 
						md=EVP_get_digestbyname(pname);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -225,23 +228,7 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
		goto end;
 | 
							goto end;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (engine != NULL)
 | 
					        e = setup_engine(bio_err, engine, 0);
 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
		if((e = ENGINE_by_id(engine)) == NULL)
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			BIO_printf(bio_err,"invalid engine \"%s\"\n",
 | 
					 | 
				
			||||||
				engine);
 | 
					 | 
				
			||||||
			goto end;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			BIO_printf(bio_err,"can't use that engine\n");
 | 
					 | 
				
			||||||
			goto end;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
 | 
					 | 
				
			||||||
		/* Free our "structural" reference. */
 | 
					 | 
				
			||||||
		ENGINE_free(e);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	in=BIO_new(BIO_s_file());
 | 
						in=BIO_new(BIO_s_file());
 | 
				
			||||||
	bmd=BIO_new(BIO_f_md());
 | 
						bmd=BIO_new(BIO_f_md());
 | 
				
			||||||
@@ -289,52 +276,19 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if(keyfile)
 | 
						if(keyfile)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		if (keyform == FORMAT_PEM)
 | 
							if (want_pub)
 | 
				
			||||||
			{
 | 
								sigkey = load_pubkey(bio_err, keyfile, keyform, 0, NULL,
 | 
				
			||||||
			BIO *keybio;
 | 
									e, "key file");
 | 
				
			||||||
			keybio = BIO_new_file(keyfile, "r");
 | 
					 | 
				
			||||||
			if(!keybio)
 | 
					 | 
				
			||||||
				{
 | 
					 | 
				
			||||||
				BIO_printf(bio_err,
 | 
					 | 
				
			||||||
					"Error opening key file %s\n",
 | 
					 | 
				
			||||||
					keyfile);
 | 
					 | 
				
			||||||
				ERR_print_errors(bio_err);
 | 
					 | 
				
			||||||
				goto end;
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			if(want_pub) 
 | 
					 | 
				
			||||||
				sigkey = PEM_read_bio_PUBKEY(keybio,
 | 
					 | 
				
			||||||
					NULL, NULL, NULL);
 | 
					 | 
				
			||||||
			else
 | 
					 | 
				
			||||||
				sigkey = PEM_read_bio_PrivateKey(keybio,
 | 
					 | 
				
			||||||
					NULL, NULL, NULL);
 | 
					 | 
				
			||||||
			BIO_free(keybio);
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		else if (keyform == FORMAT_ENGINE)
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			if (!e)
 | 
					 | 
				
			||||||
				{
 | 
					 | 
				
			||||||
				BIO_printf(bio_err,"no engine specified\n");
 | 
					 | 
				
			||||||
				goto end;
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			if (want_pub)
 | 
					 | 
				
			||||||
				sigkey = ENGINE_load_public_key(e, keyfile, NULL);
 | 
					 | 
				
			||||||
			else
 | 
					 | 
				
			||||||
				sigkey = ENGINE_load_private_key(e, keyfile, NULL);
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
 | 
								sigkey = load_key(bio_err, keyfile, keyform, 0, NULL,
 | 
				
			||||||
 | 
									e, "key file");
 | 
				
			||||||
 | 
							if (!sigkey)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
			BIO_printf(bio_err,
 | 
								/* load_[pub]key() has already printed an appropriate
 | 
				
			||||||
				"bad input format specified for key file\n");
 | 
								   message */
 | 
				
			||||||
			goto end;
 | 
								goto end;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		if(!sigkey) {
 | 
					 | 
				
			||||||
			BIO_printf(bio_err, "Error reading key file %s\n",
 | 
					 | 
				
			||||||
								keyfile);
 | 
					 | 
				
			||||||
			ERR_print_errors(bio_err);
 | 
					 | 
				
			||||||
			goto end;
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(sigfile && sigkey) {
 | 
						if(sigfile && sigkey) {
 | 
				
			||||||
		BIO *sigbio;
 | 
							BIO *sigbio;
 | 
				
			||||||
@@ -366,22 +320,36 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
	if (argc == 0)
 | 
						if (argc == 0)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		BIO_set_fp(in,stdin,BIO_NOCLOSE);
 | 
							BIO_set_fp(in,stdin,BIO_NOCLOSE);
 | 
				
			||||||
		do_fp(out, buf,inp,separator, out_bin, sigkey, sigbuf, siglen);
 | 
							err=do_fp(out, buf,inp,separator, out_bin, sigkey, sigbuf,
 | 
				
			||||||
 | 
								  siglen,"","(stdin)");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		name=OBJ_nid2sn(md->type);
 | 
							name=OBJ_nid2sn(md->type);
 | 
				
			||||||
		for (i=0; i<argc; i++)
 | 
							for (i=0; i<argc; i++)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
 | 
								char *tmp,*tofree=NULL;
 | 
				
			||||||
 | 
								int r;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (BIO_read_filename(in,argv[i]) <= 0)
 | 
								if (BIO_read_filename(in,argv[i]) <= 0)
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
				perror(argv[i]);
 | 
									perror(argv[i]);
 | 
				
			||||||
				err++;
 | 
									err++;
 | 
				
			||||||
				continue;
 | 
									continue;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			if(!out_bin) BIO_printf(out, "%s(%s)= ",name,argv[i]);
 | 
								if(!out_bin)
 | 
				
			||||||
			do_fp(out, buf,inp,separator, out_bin, sigkey, 
 | 
									{
 | 
				
			||||||
								sigbuf, siglen);
 | 
									tmp=tofree=OPENSSL_malloc(strlen(name)+strlen(argv[i])+5);
 | 
				
			||||||
 | 
									sprintf(tmp,"%s(%s)= ",name,argv[i]);
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								else
 | 
				
			||||||
 | 
									tmp="";
 | 
				
			||||||
 | 
								r=do_fp(out,buf,inp,separator,out_bin,sigkey,sigbuf,
 | 
				
			||||||
 | 
									siglen,tmp,argv[i]);
 | 
				
			||||||
 | 
								if(r)
 | 
				
			||||||
 | 
								    err=r;
 | 
				
			||||||
 | 
								if(tofree)
 | 
				
			||||||
 | 
									OPENSSL_free(tofree);
 | 
				
			||||||
			(void)BIO_reset(bmd);
 | 
								(void)BIO_reset(bmd);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -396,11 +364,13 @@ end:
 | 
				
			|||||||
	EVP_PKEY_free(sigkey);
 | 
						EVP_PKEY_free(sigkey);
 | 
				
			||||||
	if(sigbuf) OPENSSL_free(sigbuf);
 | 
						if(sigbuf) OPENSSL_free(sigbuf);
 | 
				
			||||||
	if (bmd != NULL) BIO_free(bmd);
 | 
						if (bmd != NULL) BIO_free(bmd);
 | 
				
			||||||
 | 
						apps_shutdown();
 | 
				
			||||||
	EXIT(err);
 | 
						EXIT(err);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout,
 | 
					int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout,
 | 
				
			||||||
			EVP_PKEY *key, unsigned char *sigin, int siglen)
 | 
						  EVP_PKEY *key, unsigned char *sigin, int siglen, const char *title,
 | 
				
			||||||
 | 
						  const char *file)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	int len;
 | 
						int len;
 | 
				
			||||||
	int i;
 | 
						int i;
 | 
				
			||||||
@@ -408,21 +378,33 @@ void do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout,
 | 
				
			|||||||
	for (;;)
 | 
						for (;;)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		i=BIO_read(bp,(char *)buf,BUFSIZE);
 | 
							i=BIO_read(bp,(char *)buf,BUFSIZE);
 | 
				
			||||||
		if (i <= 0) break;
 | 
							if(i < 0)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								BIO_printf(bio_err, "Read Error in %s\n",file);
 | 
				
			||||||
 | 
								ERR_print_errors(bio_err);
 | 
				
			||||||
 | 
								return 1;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							if (i == 0) break;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	if(sigin)
 | 
						if(sigin)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		EVP_MD_CTX *ctx;
 | 
							EVP_MD_CTX *ctx;
 | 
				
			||||||
		BIO_get_md_ctx(bp, &ctx);
 | 
							BIO_get_md_ctx(bp, &ctx);
 | 
				
			||||||
		i = EVP_VerifyFinal(ctx, sigin, (unsigned int)siglen, key); 
 | 
							i = EVP_VerifyFinal(ctx, sigin, (unsigned int)siglen, key); 
 | 
				
			||||||
		if(i > 0) BIO_printf(out, "Verified OK\n");
 | 
							if(i > 0)
 | 
				
			||||||
		else if(i == 0) BIO_printf(out, "Verification Failure\n");
 | 
								BIO_printf(out, "Verified OK\n");
 | 
				
			||||||
 | 
							else if(i == 0)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								BIO_printf(out, "Verification Failure\n");
 | 
				
			||||||
 | 
								return 1;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
			BIO_printf(bio_err, "Error Verifying Data\n");
 | 
								BIO_printf(bio_err, "Error Verifying Data\n");
 | 
				
			||||||
			ERR_print_errors(bio_err);
 | 
								ERR_print_errors(bio_err);
 | 
				
			||||||
 | 
								return 1;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		return;
 | 
							return 0;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	if(key)
 | 
						if(key)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
@@ -432,7 +414,7 @@ void do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout,
 | 
				
			|||||||
			{
 | 
								{
 | 
				
			||||||
			BIO_printf(bio_err, "Error Signing Data\n");
 | 
								BIO_printf(bio_err, "Error Signing Data\n");
 | 
				
			||||||
			ERR_print_errors(bio_err);
 | 
								ERR_print_errors(bio_err);
 | 
				
			||||||
			return;
 | 
								return 1;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
@@ -441,6 +423,7 @@ void do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout,
 | 
				
			|||||||
	if(binout) BIO_write(out, buf, len);
 | 
						if(binout) BIO_write(out, buf, len);
 | 
				
			||||||
	else 
 | 
						else 
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
 | 
							BIO_write(out,title,strlen(title));
 | 
				
			||||||
		for (i=0; i<len; i++)
 | 
							for (i=0; i<len; i++)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
			if (sep && (i != 0))
 | 
								if (sep && (i != 0))
 | 
				
			||||||
@@ -449,5 +432,6 @@ void do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout,
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
		BIO_printf(out, "\n");
 | 
							BIO_printf(out, "\n");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
						return 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										23
									
								
								apps/dh.c
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								apps/dh.c
									
									
									
									
									
								
							@@ -69,7 +69,6 @@
 | 
				
			|||||||
#include <openssl/dh.h>
 | 
					#include <openssl/dh.h>
 | 
				
			||||||
#include <openssl/x509.h>
 | 
					#include <openssl/x509.h>
 | 
				
			||||||
#include <openssl/pem.h>
 | 
					#include <openssl/pem.h>
 | 
				
			||||||
#include <openssl/engine.h>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#undef PROG
 | 
					#undef PROG
 | 
				
			||||||
#define PROG	dh_main
 | 
					#define PROG	dh_main
 | 
				
			||||||
@@ -101,6 +100,9 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
		if ((bio_err=BIO_new(BIO_s_file())) != NULL)
 | 
							if ((bio_err=BIO_new(BIO_s_file())) != NULL)
 | 
				
			||||||
			BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
 | 
								BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!load_config(bio_err, NULL))
 | 
				
			||||||
 | 
							goto end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	engine=NULL;
 | 
						engine=NULL;
 | 
				
			||||||
	infile=NULL;
 | 
						infile=NULL;
 | 
				
			||||||
	outfile=NULL;
 | 
						outfile=NULL;
 | 
				
			||||||
@@ -174,23 +176,7 @@ bad:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	ERR_load_crypto_strings();
 | 
						ERR_load_crypto_strings();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (engine != NULL)
 | 
					        e = setup_engine(bio_err, engine, 0);
 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
		if((e = ENGINE_by_id(engine)) == NULL)
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			BIO_printf(bio_err,"invalid engine \"%s\"\n",
 | 
					 | 
				
			||||||
				engine);
 | 
					 | 
				
			||||||
			goto end;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			BIO_printf(bio_err,"can't use that engine\n");
 | 
					 | 
				
			||||||
			goto end;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
 | 
					 | 
				
			||||||
		/* Free our "structural" reference. */
 | 
					 | 
				
			||||||
		ENGINE_free(e);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	in=BIO_new(BIO_s_file());
 | 
						in=BIO_new(BIO_s_file());
 | 
				
			||||||
	out=BIO_new(BIO_s_file());
 | 
						out=BIO_new(BIO_s_file());
 | 
				
			||||||
@@ -346,6 +332,7 @@ end:
 | 
				
			|||||||
	if (in != NULL) BIO_free(in);
 | 
						if (in != NULL) BIO_free(in);
 | 
				
			||||||
	if (out != NULL) BIO_free_all(out);
 | 
						if (out != NULL) BIO_free_all(out);
 | 
				
			||||||
	if (dh != NULL) DH_free(dh);
 | 
						if (dh != NULL) DH_free(dh);
 | 
				
			||||||
 | 
						apps_shutdown();
 | 
				
			||||||
	EXIT(ret);
 | 
						EXIT(ret);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -121,7 +121,6 @@
 | 
				
			|||||||
#include <openssl/dh.h>
 | 
					#include <openssl/dh.h>
 | 
				
			||||||
#include <openssl/x509.h>
 | 
					#include <openssl/x509.h>
 | 
				
			||||||
#include <openssl/pem.h>
 | 
					#include <openssl/pem.h>
 | 
				
			||||||
#include <openssl/engine.h>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef OPENSSL_NO_DSA
 | 
					#ifndef OPENSSL_NO_DSA
 | 
				
			||||||
#include <openssl/dsa.h>
 | 
					#include <openssl/dsa.h>
 | 
				
			||||||
@@ -167,6 +166,9 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
		if ((bio_err=BIO_new(BIO_s_file())) != NULL)
 | 
							if ((bio_err=BIO_new(BIO_s_file())) != NULL)
 | 
				
			||||||
			BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
 | 
								BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!load_config(bio_err, NULL))
 | 
				
			||||||
 | 
							goto end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	infile=NULL;
 | 
						infile=NULL;
 | 
				
			||||||
	outfile=NULL;
 | 
						outfile=NULL;
 | 
				
			||||||
	informat=FORMAT_PEM;
 | 
						informat=FORMAT_PEM;
 | 
				
			||||||
@@ -257,23 +259,7 @@ bad:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	ERR_load_crypto_strings();
 | 
						ERR_load_crypto_strings();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (engine != NULL)
 | 
					        e = setup_engine(bio_err, engine, 0);
 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
		if((e = ENGINE_by_id(engine)) == NULL)
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			BIO_printf(bio_err,"invalid engine \"%s\"\n",
 | 
					 | 
				
			||||||
				engine);
 | 
					 | 
				
			||||||
			goto end;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			BIO_printf(bio_err,"can't use that engine\n");
 | 
					 | 
				
			||||||
			goto end;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
 | 
					 | 
				
			||||||
		/* Free our "structural" reference. */
 | 
					 | 
				
			||||||
		ENGINE_free(e);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (g && !num)
 | 
						if (g && !num)
 | 
				
			||||||
		num = DEFBITS;
 | 
							num = DEFBITS;
 | 
				
			||||||
@@ -504,7 +490,7 @@ bad:
 | 
				
			|||||||
		printf("\tif ((dh->p == NULL) || (dh->g == NULL))\n");
 | 
							printf("\tif ((dh->p == NULL) || (dh->g == NULL))\n");
 | 
				
			||||||
		printf("\t\t{ DH_free(dh); return(NULL); }\n");
 | 
							printf("\t\t{ DH_free(dh); return(NULL); }\n");
 | 
				
			||||||
		if (dh->length)
 | 
							if (dh->length)
 | 
				
			||||||
			printf("\tdh->length = %d;\n", dh->length);
 | 
								printf("\tdh->length = %ld;\n", dh->length);
 | 
				
			||||||
		printf("\treturn(dh);\n\t}\n");
 | 
							printf("\treturn(dh);\n\t}\n");
 | 
				
			||||||
		OPENSSL_free(data);
 | 
							OPENSSL_free(data);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -532,6 +518,7 @@ end:
 | 
				
			|||||||
	if (in != NULL) BIO_free(in);
 | 
						if (in != NULL) BIO_free(in);
 | 
				
			||||||
	if (out != NULL) BIO_free_all(out);
 | 
						if (out != NULL) BIO_free_all(out);
 | 
				
			||||||
	if (dh != NULL) DH_free(dh);
 | 
						if (dh != NULL) DH_free(dh);
 | 
				
			||||||
 | 
						apps_shutdown();
 | 
				
			||||||
	EXIT(ret);
 | 
						EXIT(ret);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										30
									
								
								apps/dsa.c
									
									
									
									
									
								
							
							
						
						
									
										30
									
								
								apps/dsa.c
									
									
									
									
									
								
							@@ -68,7 +68,6 @@
 | 
				
			|||||||
#include <openssl/evp.h>
 | 
					#include <openssl/evp.h>
 | 
				
			||||||
#include <openssl/x509.h>
 | 
					#include <openssl/x509.h>
 | 
				
			||||||
#include <openssl/pem.h>
 | 
					#include <openssl/pem.h>
 | 
				
			||||||
#include <openssl/engine.h>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#undef PROG
 | 
					#undef PROG
 | 
				
			||||||
#define PROG	dsa_main
 | 
					#define PROG	dsa_main
 | 
				
			||||||
@@ -80,6 +79,9 @@
 | 
				
			|||||||
 * -des		- encrypt output if PEM format with DES in cbc mode
 | 
					 * -des		- encrypt output if PEM format with DES in cbc mode
 | 
				
			||||||
 * -des3	- encrypt output if PEM format
 | 
					 * -des3	- encrypt output if PEM format
 | 
				
			||||||
 * -idea	- encrypt output if PEM format
 | 
					 * -idea	- encrypt output if PEM format
 | 
				
			||||||
 | 
					 * -aes128	- encrypt output if PEM format
 | 
				
			||||||
 | 
					 * -aes192	- encrypt output if PEM format
 | 
				
			||||||
 | 
					 * -aes256	- encrypt output if PEM format
 | 
				
			||||||
 * -text	- print a text version
 | 
					 * -text	- print a text version
 | 
				
			||||||
 * -modulus	- print the DSA public key
 | 
					 * -modulus	- print the DSA public key
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
@@ -107,6 +109,9 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
		if ((bio_err=BIO_new(BIO_s_file())) != NULL)
 | 
							if ((bio_err=BIO_new(BIO_s_file())) != NULL)
 | 
				
			||||||
			BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
 | 
								BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!load_config(bio_err, NULL))
 | 
				
			||||||
 | 
							goto end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	engine=NULL;
 | 
						engine=NULL;
 | 
				
			||||||
	infile=NULL;
 | 
						infile=NULL;
 | 
				
			||||||
	outfile=NULL;
 | 
						outfile=NULL;
 | 
				
			||||||
@@ -189,6 +194,10 @@ bad:
 | 
				
			|||||||
		BIO_printf(bio_err," -des3           encrypt PEM output with ede cbc des using 168 bit key\n");
 | 
							BIO_printf(bio_err," -des3           encrypt PEM output with ede cbc des using 168 bit key\n");
 | 
				
			||||||
#ifndef OPENSSL_NO_IDEA
 | 
					#ifndef OPENSSL_NO_IDEA
 | 
				
			||||||
		BIO_printf(bio_err," -idea           encrypt PEM output with cbc idea\n");
 | 
							BIO_printf(bio_err," -idea           encrypt PEM output with cbc idea\n");
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_AES
 | 
				
			||||||
 | 
							BIO_printf(bio_err," -aes128, -aes192, -aes256\n");
 | 
				
			||||||
 | 
							BIO_printf(bio_err,"                 encrypt PEM output with cbc aes\n");
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
		BIO_printf(bio_err," -text           print the key in text\n");
 | 
							BIO_printf(bio_err," -text           print the key in text\n");
 | 
				
			||||||
		BIO_printf(bio_err," -noout          don't print key out\n");
 | 
							BIO_printf(bio_err," -noout          don't print key out\n");
 | 
				
			||||||
@@ -198,23 +207,7 @@ bad:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	ERR_load_crypto_strings();
 | 
						ERR_load_crypto_strings();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (engine != NULL)
 | 
					        e = setup_engine(bio_err, engine, 0);
 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
		if((e = ENGINE_by_id(engine)) == NULL)
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			BIO_printf(bio_err,"invalid engine \"%s\"\n",
 | 
					 | 
				
			||||||
				engine);
 | 
					 | 
				
			||||||
			goto end;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			BIO_printf(bio_err,"can't use that engine\n");
 | 
					 | 
				
			||||||
			goto end;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
 | 
					 | 
				
			||||||
		/* Free our "structural" reference. */
 | 
					 | 
				
			||||||
		ENGINE_free(e);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(!app_passwd(bio_err, passargin, passargout, &passin, &passout)) {
 | 
						if(!app_passwd(bio_err, passargin, passargout, &passin, &passout)) {
 | 
				
			||||||
		BIO_printf(bio_err, "Error getting passwords\n");
 | 
							BIO_printf(bio_err, "Error getting passwords\n");
 | 
				
			||||||
@@ -320,6 +313,7 @@ end:
 | 
				
			|||||||
	if(dsa != NULL) DSA_free(dsa);
 | 
						if(dsa != NULL) DSA_free(dsa);
 | 
				
			||||||
	if(passin) OPENSSL_free(passin);
 | 
						if(passin) OPENSSL_free(passin);
 | 
				
			||||||
	if(passout) OPENSSL_free(passout);
 | 
						if(passout) OPENSSL_free(passout);
 | 
				
			||||||
 | 
						apps_shutdown();
 | 
				
			||||||
	EXIT(ret);
 | 
						EXIT(ret);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -69,7 +69,6 @@
 | 
				
			|||||||
#include <openssl/dsa.h>
 | 
					#include <openssl/dsa.h>
 | 
				
			||||||
#include <openssl/x509.h>
 | 
					#include <openssl/x509.h>
 | 
				
			||||||
#include <openssl/pem.h>
 | 
					#include <openssl/pem.h>
 | 
				
			||||||
#include <openssl/engine.h>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#undef PROG
 | 
					#undef PROG
 | 
				
			||||||
#define PROG	dsaparam_main
 | 
					#define PROG	dsaparam_main
 | 
				
			||||||
@@ -107,6 +106,9 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
		if ((bio_err=BIO_new(BIO_s_file())) != NULL)
 | 
							if ((bio_err=BIO_new(BIO_s_file())) != NULL)
 | 
				
			||||||
			BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
 | 
								BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!load_config(bio_err, NULL))
 | 
				
			||||||
 | 
							goto end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	infile=NULL;
 | 
						infile=NULL;
 | 
				
			||||||
	outfile=NULL;
 | 
						outfile=NULL;
 | 
				
			||||||
	informat=FORMAT_PEM;
 | 
						informat=FORMAT_PEM;
 | 
				
			||||||
@@ -184,9 +186,10 @@ bad:
 | 
				
			|||||||
		BIO_printf(bio_err," -outform arg  output format - DER or PEM\n");
 | 
							BIO_printf(bio_err," -outform arg  output format - DER or PEM\n");
 | 
				
			||||||
		BIO_printf(bio_err," -in arg       input file\n");
 | 
							BIO_printf(bio_err," -in arg       input file\n");
 | 
				
			||||||
		BIO_printf(bio_err," -out arg      output file\n");
 | 
							BIO_printf(bio_err," -out arg      output file\n");
 | 
				
			||||||
		BIO_printf(bio_err," -text         print the key in text\n");
 | 
							BIO_printf(bio_err," -text         print as text\n");
 | 
				
			||||||
		BIO_printf(bio_err," -C            Output C code\n");
 | 
							BIO_printf(bio_err," -C            Output C code\n");
 | 
				
			||||||
		BIO_printf(bio_err," -noout        no output\n");
 | 
							BIO_printf(bio_err," -noout        no output\n");
 | 
				
			||||||
 | 
							BIO_printf(bio_err," -genkey       generate a DSA key\n");
 | 
				
			||||||
		BIO_printf(bio_err," -rand         files to use for random number input\n");
 | 
							BIO_printf(bio_err," -rand         files to use for random number input\n");
 | 
				
			||||||
		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");
 | 
				
			||||||
		BIO_printf(bio_err," number        number of bits to use for generating private key\n");
 | 
							BIO_printf(bio_err," number        number of bits to use for generating private key\n");
 | 
				
			||||||
@@ -232,23 +235,7 @@ bad:
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (engine != NULL)
 | 
					        e = setup_engine(bio_err, engine, 0);
 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
		if((e = ENGINE_by_id(engine)) == NULL)
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			BIO_printf(bio_err,"invalid engine \"%s\"\n",
 | 
					 | 
				
			||||||
				engine);
 | 
					 | 
				
			||||||
			goto end;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			BIO_printf(bio_err,"can't use that engine\n");
 | 
					 | 
				
			||||||
			goto end;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
 | 
					 | 
				
			||||||
		/* Free our "structural" reference. */
 | 
					 | 
				
			||||||
		ENGINE_free(e);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (need_rand)
 | 
						if (need_rand)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
@@ -384,6 +371,7 @@ end:
 | 
				
			|||||||
	if (in != NULL) BIO_free(in);
 | 
						if (in != NULL) BIO_free(in);
 | 
				
			||||||
	if (out != NULL) BIO_free_all(out);
 | 
						if (out != NULL) BIO_free_all(out);
 | 
				
			||||||
	if (dsa != NULL) DSA_free(dsa);
 | 
						if (dsa != NULL) DSA_free(dsa);
 | 
				
			||||||
 | 
						apps_shutdown();
 | 
				
			||||||
	EXIT(ret);
 | 
						EXIT(ret);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										56
									
								
								apps/enc.c
									
									
									
									
									
								
							
							
						
						
									
										56
									
								
								apps/enc.c
									
									
									
									
									
								
							@@ -66,11 +66,7 @@
 | 
				
			|||||||
#include <openssl/objects.h>
 | 
					#include <openssl/objects.h>
 | 
				
			||||||
#include <openssl/x509.h>
 | 
					#include <openssl/x509.h>
 | 
				
			||||||
#include <openssl/rand.h>
 | 
					#include <openssl/rand.h>
 | 
				
			||||||
#ifndef OPENSSL_NO_MD5
 | 
					 | 
				
			||||||
#include <openssl/md5.h>
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
#include <openssl/pem.h>
 | 
					#include <openssl/pem.h>
 | 
				
			||||||
#include <openssl/engine.h>
 | 
					 | 
				
			||||||
#include <ctype.h>
 | 
					#include <ctype.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int set_hex(char *in,unsigned char *out,int size);
 | 
					int set_hex(char *in,unsigned char *out,int size);
 | 
				
			||||||
@@ -82,7 +78,7 @@ int set_hex(char *in,unsigned char *out,int size);
 | 
				
			|||||||
#define BSIZE	(8*1024)
 | 
					#define BSIZE	(8*1024)
 | 
				
			||||||
#define	PROG	enc_main
 | 
					#define	PROG	enc_main
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void show_ciphers(const OBJ_NAME *name,void *bio_)
 | 
					static void show_ciphers(const OBJ_NAME *name,void *bio_)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	BIO *bio=bio_;
 | 
						BIO *bio=bio_;
 | 
				
			||||||
	static int n;
 | 
						static int n;
 | 
				
			||||||
@@ -106,7 +102,7 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
	{
 | 
						{
 | 
				
			||||||
	ENGINE *e = NULL;
 | 
						ENGINE *e = NULL;
 | 
				
			||||||
	static const char magic[]="Salted__";
 | 
						static const char magic[]="Salted__";
 | 
				
			||||||
	char mbuf[8];	/* should be 1 smaller than magic */
 | 
						char mbuf[sizeof magic-1];
 | 
				
			||||||
	char *strbuf=NULL;
 | 
						char *strbuf=NULL;
 | 
				
			||||||
	unsigned char *buff=NULL,*bufsize=NULL;
 | 
						unsigned char *buff=NULL,*bufsize=NULL;
 | 
				
			||||||
	int bsize=BSIZE,verbose=0;
 | 
						int bsize=BSIZE,verbose=0;
 | 
				
			||||||
@@ -121,8 +117,8 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
	const EVP_CIPHER *cipher=NULL,*c;
 | 
						const EVP_CIPHER *cipher=NULL,*c;
 | 
				
			||||||
	char *inf=NULL,*outf=NULL;
 | 
						char *inf=NULL,*outf=NULL;
 | 
				
			||||||
	BIO *in=NULL,*out=NULL,*b64=NULL,*benc=NULL,*rbio=NULL,*wbio=NULL;
 | 
						BIO *in=NULL,*out=NULL,*b64=NULL,*benc=NULL,*rbio=NULL,*wbio=NULL;
 | 
				
			||||||
#define PROG_NAME_SIZE  16
 | 
					#define PROG_NAME_SIZE  39
 | 
				
			||||||
	char pname[PROG_NAME_SIZE];
 | 
						char pname[PROG_NAME_SIZE+1];
 | 
				
			||||||
	char *engine = NULL;
 | 
						char *engine = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	apps_startup();
 | 
						apps_startup();
 | 
				
			||||||
@@ -131,8 +127,11 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
		if ((bio_err=BIO_new(BIO_s_file())) != NULL)
 | 
							if ((bio_err=BIO_new(BIO_s_file())) != NULL)
 | 
				
			||||||
			BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
 | 
								BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!load_config(bio_err, NULL))
 | 
				
			||||||
 | 
							goto end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* first check the program name */
 | 
						/* first check the program name */
 | 
				
			||||||
	program_name(argv[0],pname,PROG_NAME_SIZE);
 | 
						program_name(argv[0],pname,sizeof pname);
 | 
				
			||||||
	if (strcmp(pname,"base64") == 0)
 | 
						if (strcmp(pname,"base64") == 0)
 | 
				
			||||||
		base64=1;
 | 
							base64=1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -217,7 +216,7 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
				goto bad;
 | 
									goto bad;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			buf[0]='\0';
 | 
								buf[0]='\0';
 | 
				
			||||||
			fgets(buf,128,infile);
 | 
								fgets(buf,sizeof buf,infile);
 | 
				
			||||||
			fclose(infile);
 | 
								fclose(infile);
 | 
				
			||||||
			i=strlen(buf);
 | 
								i=strlen(buf);
 | 
				
			||||||
			if ((i > 0) &&
 | 
								if ((i > 0) &&
 | 
				
			||||||
@@ -285,23 +284,7 @@ bad:
 | 
				
			|||||||
		argv++;
 | 
							argv++;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (engine != NULL)
 | 
					        e = setup_engine(bio_err, engine, 0);
 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
		if((e = ENGINE_by_id(engine)) == NULL)
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			BIO_printf(bio_err,"invalid engine \"%s\"\n",
 | 
					 | 
				
			||||||
				engine);
 | 
					 | 
				
			||||||
			goto end;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			BIO_printf(bio_err,"can't use that engine\n");
 | 
					 | 
				
			||||||
			goto end;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
 | 
					 | 
				
			||||||
		/* Free our "structural" reference. */
 | 
					 | 
				
			||||||
		ENGINE_free(e);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (bufsize != NULL)
 | 
						if (bufsize != NULL)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
@@ -459,12 +442,12 @@ bad:
 | 
				
			|||||||
			else {
 | 
								else {
 | 
				
			||||||
				if(enc) {
 | 
									if(enc) {
 | 
				
			||||||
					if(hsalt) {
 | 
										if(hsalt) {
 | 
				
			||||||
						if(!set_hex(hsalt,salt,PKCS5_SALT_LEN)) {
 | 
											if(!set_hex(hsalt,salt,sizeof salt)) {
 | 
				
			||||||
							BIO_printf(bio_err,
 | 
												BIO_printf(bio_err,
 | 
				
			||||||
								"invalid hex salt value\n");
 | 
													"invalid hex salt value\n");
 | 
				
			||||||
							goto end;
 | 
												goto end;
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
					} else if (RAND_pseudo_bytes(salt, PKCS5_SALT_LEN) < 0)
 | 
										} else if (RAND_pseudo_bytes(salt, sizeof salt) < 0)
 | 
				
			||||||
						goto end;
 | 
											goto end;
 | 
				
			||||||
					/* If -P option then don't bother writing */
 | 
										/* If -P option then don't bother writing */
 | 
				
			||||||
					if((printkey != 2)
 | 
										if((printkey != 2)
 | 
				
			||||||
@@ -472,14 +455,14 @@ bad:
 | 
				
			|||||||
							 sizeof magic-1) != sizeof magic-1
 | 
												 sizeof magic-1) != sizeof magic-1
 | 
				
			||||||
					       || BIO_write(wbio,
 | 
										       || BIO_write(wbio,
 | 
				
			||||||
							    (char *)salt,
 | 
												    (char *)salt,
 | 
				
			||||||
							    PKCS5_SALT_LEN) != PKCS5_SALT_LEN)) {
 | 
												    sizeof salt) != sizeof salt)) {
 | 
				
			||||||
						BIO_printf(bio_err,"error writing output file\n");
 | 
											BIO_printf(bio_err,"error writing output file\n");
 | 
				
			||||||
						goto end;
 | 
											goto end;
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
				} else if(BIO_read(rbio,mbuf,sizeof mbuf) != sizeof mbuf
 | 
									} else if(BIO_read(rbio,mbuf,sizeof mbuf) != sizeof mbuf
 | 
				
			||||||
					  || BIO_read(rbio,
 | 
										  || BIO_read(rbio,
 | 
				
			||||||
						      (unsigned char *)salt,
 | 
											      (unsigned char *)salt,
 | 
				
			||||||
				    PKCS5_SALT_LEN) != PKCS5_SALT_LEN) {
 | 
									    sizeof salt) != sizeof salt) {
 | 
				
			||||||
					BIO_printf(bio_err,"error reading input file\n");
 | 
										BIO_printf(bio_err,"error reading input file\n");
 | 
				
			||||||
					goto end;
 | 
										goto end;
 | 
				
			||||||
				} else if(memcmp(mbuf,magic,sizeof magic-1)) {
 | 
									} else if(memcmp(mbuf,magic,sizeof magic-1)) {
 | 
				
			||||||
@@ -507,6 +490,14 @@ bad:
 | 
				
			|||||||
			BIO_printf(bio_err,"invalid hex iv value\n");
 | 
								BIO_printf(bio_err,"invalid hex iv value\n");
 | 
				
			||||||
			goto end;
 | 
								goto end;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
							if ((hiv == NULL) && (str == NULL))
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								/* No IV was explicitly set and no IV was generated
 | 
				
			||||||
 | 
								 * during EVP_BytesToKey. Hence the IV is undefined,
 | 
				
			||||||
 | 
								 * making correct decryption impossible. */
 | 
				
			||||||
 | 
								BIO_printf(bio_err, "iv undefined\n");
 | 
				
			||||||
 | 
								goto end;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
		if ((hkey != NULL) && !set_hex(hkey,key,sizeof key))
 | 
							if ((hkey != NULL) && !set_hex(hkey,key,sizeof key))
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
			BIO_printf(bio_err,"invalid hex key value\n");
 | 
								BIO_printf(bio_err,"invalid hex key value\n");
 | 
				
			||||||
@@ -533,7 +524,7 @@ bad:
 | 
				
			|||||||
			if (!nosalt)
 | 
								if (!nosalt)
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
				printf("salt=");
 | 
									printf("salt=");
 | 
				
			||||||
				for (i=0; i<PKCS5_SALT_LEN; i++)
 | 
									for (i=0; i<sizeof salt; i++)
 | 
				
			||||||
					printf("%02X",salt[i]);
 | 
										printf("%02X",salt[i]);
 | 
				
			||||||
				printf("\n");
 | 
									printf("\n");
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
@@ -594,6 +585,7 @@ end:
 | 
				
			|||||||
	if (benc != NULL) BIO_free(benc);
 | 
						if (benc != NULL) BIO_free(benc);
 | 
				
			||||||
	if (b64 != NULL) BIO_free(b64);
 | 
						if (b64 != NULL) BIO_free(b64);
 | 
				
			||||||
	if(pass) OPENSSL_free(pass);
 | 
						if(pass) OPENSSL_free(pass);
 | 
				
			||||||
 | 
						apps_shutdown();
 | 
				
			||||||
	EXIT(ret);
 | 
						EXIT(ret);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										335
									
								
								apps/engine.c
									
									
									
									
									
								
							
							
						
						
									
										335
									
								
								apps/engine.c
									
									
									
									
									
								
							@@ -72,9 +72,20 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
static char *engine_usage[]={
 | 
					static char *engine_usage[]={
 | 
				
			||||||
"usage: engine opts [engine ...]\n",
 | 
					"usage: engine opts [engine ...]\n",
 | 
				
			||||||
" -v          - verbose mode, a textual listing of the engines in OpenSSL\n",
 | 
					" -v[v[v[v]]] - verbose mode, for each engine, list its 'control commands'\n",
 | 
				
			||||||
 | 
					"               -vv will additionally display each command's description\n",
 | 
				
			||||||
 | 
					"               -vvv will also add the input flags for each command\n",
 | 
				
			||||||
 | 
					"               -vvvv will also show internal input flags\n",
 | 
				
			||||||
" -c          - for each engine, also list the capabilities\n",
 | 
					" -c          - for each engine, also list the capabilities\n",
 | 
				
			||||||
" -t          - for each engine, check that they are really available\n",
 | 
					" -t          - for each engine, check that they are really available\n",
 | 
				
			||||||
 | 
					" -pre <cmd>  - runs command 'cmd' against the ENGINE before any attempts\n",
 | 
				
			||||||
 | 
					"               to load it (if -t is used)\n",
 | 
				
			||||||
 | 
					" -post <cmd> - runs command 'cmd' against the ENGINE after loading it\n",
 | 
				
			||||||
 | 
					"               (only used if -t is also provided)\n",
 | 
				
			||||||
 | 
					" NB: -pre and -post will be applied to all ENGINEs supplied on the command\n",
 | 
				
			||||||
 | 
					" line, or all supported ENGINEs if none are specified.\n",
 | 
				
			||||||
 | 
					" Eg. '-pre \"SO_PATH:/lib/libdriver.so\"' calls command \"SO_PATH\" with\n",
 | 
				
			||||||
 | 
					" argument \"/lib/libdriver.so\".\n",
 | 
				
			||||||
NULL
 | 
					NULL
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -83,7 +94,7 @@ static void identity(void *ptr)
 | 
				
			|||||||
	return;
 | 
						return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int append_buf(char **buf, char *s, int *size, int step)
 | 
					static int append_buf(char **buf, const char *s, int *size, int step)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	int l = strlen(s);
 | 
						int l = strlen(s);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -115,6 +126,216 @@ static int append_buf(char **buf, char *s, int *size, int step)
 | 
				
			|||||||
	return 1;
 | 
						return 1;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static int util_flags(BIO *bio_out, unsigned int flags, const char *indent)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						int started = 0, err = 0;
 | 
				
			||||||
 | 
						/* Indent before displaying input flags */
 | 
				
			||||||
 | 
						BIO_printf(bio_out, "%s%s(input flags): ", indent, indent);
 | 
				
			||||||
 | 
						if(flags == 0)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							BIO_printf(bio_out, "<no flags>\n");
 | 
				
			||||||
 | 
							return 1;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					        /* If the object is internal, mark it in a way that shows instead of
 | 
				
			||||||
 | 
					         * having it part of all the other flags, even if it really is. */
 | 
				
			||||||
 | 
						if(flags & ENGINE_CMD_FLAG_INTERNAL)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							BIO_printf(bio_out, "[Internal] ");
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if(flags & ENGINE_CMD_FLAG_NUMERIC)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							if(started)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								BIO_printf(bio_out, "|");
 | 
				
			||||||
 | 
								err = 1;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							BIO_printf(bio_out, "NUMERIC");
 | 
				
			||||||
 | 
							started = 1;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						/* Now we check that no combinations of the mutually exclusive NUMERIC,
 | 
				
			||||||
 | 
						 * STRING, and NO_INPUT flags have been used. Future flags that can be
 | 
				
			||||||
 | 
						 * OR'd together with these would need to added after these to preserve
 | 
				
			||||||
 | 
						 * the testing logic. */
 | 
				
			||||||
 | 
						if(flags & ENGINE_CMD_FLAG_STRING)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							if(started)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								BIO_printf(bio_out, "|");
 | 
				
			||||||
 | 
								err = 1;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							BIO_printf(bio_out, "STRING");
 | 
				
			||||||
 | 
							started = 1;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						if(flags & ENGINE_CMD_FLAG_NO_INPUT)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							if(started)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								BIO_printf(bio_out, "|");
 | 
				
			||||||
 | 
								err = 1;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							BIO_printf(bio_out, "NO_INPUT");
 | 
				
			||||||
 | 
							started = 1;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						/* Check for unknown flags */
 | 
				
			||||||
 | 
						flags = flags & ~ENGINE_CMD_FLAG_NUMERIC &
 | 
				
			||||||
 | 
								~ENGINE_CMD_FLAG_STRING &
 | 
				
			||||||
 | 
								~ENGINE_CMD_FLAG_NO_INPUT &
 | 
				
			||||||
 | 
								~ENGINE_CMD_FLAG_INTERNAL;
 | 
				
			||||||
 | 
						if(flags)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							if(started) BIO_printf(bio_out, "|");
 | 
				
			||||||
 | 
							BIO_printf(bio_out, "<0x%04X>", flags);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						if(err)
 | 
				
			||||||
 | 
							BIO_printf(bio_out, "  <illegal flags!>");
 | 
				
			||||||
 | 
						BIO_printf(bio_out, "\n");
 | 
				
			||||||
 | 
						return 1;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static int util_verbose(ENGINE *e, int verbose, BIO *bio_out, const char *indent)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						static const int line_wrap = 78;
 | 
				
			||||||
 | 
						int num;
 | 
				
			||||||
 | 
						int ret = 0;
 | 
				
			||||||
 | 
						char *name = NULL;
 | 
				
			||||||
 | 
						char *desc = NULL;
 | 
				
			||||||
 | 
						int flags;
 | 
				
			||||||
 | 
						int xpos = 0;
 | 
				
			||||||
 | 
						STACK *cmds = NULL;
 | 
				
			||||||
 | 
						if(!ENGINE_ctrl(e, ENGINE_CTRL_HAS_CTRL_FUNCTION, 0, NULL, NULL) ||
 | 
				
			||||||
 | 
								((num = ENGINE_ctrl(e, ENGINE_CTRL_GET_FIRST_CMD_TYPE,
 | 
				
			||||||
 | 
										0, NULL, NULL)) <= 0))
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
					#if 0
 | 
				
			||||||
 | 
							BIO_printf(bio_out, "%s<no control commands>\n", indent);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
							return 1;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						cmds = sk_new_null();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if(!cmds)
 | 
				
			||||||
 | 
							goto err;
 | 
				
			||||||
 | 
						do {
 | 
				
			||||||
 | 
							int len;
 | 
				
			||||||
 | 
							/* Get the command input flags */
 | 
				
			||||||
 | 
							if((flags = ENGINE_ctrl(e, ENGINE_CTRL_GET_CMD_FLAGS, num,
 | 
				
			||||||
 | 
										NULL, NULL)) < 0)
 | 
				
			||||||
 | 
								goto err;
 | 
				
			||||||
 | 
					                if (!(flags & ENGINE_CMD_FLAG_INTERNAL) || verbose >= 4)
 | 
				
			||||||
 | 
					                        {
 | 
				
			||||||
 | 
					                        /* Get the command name */
 | 
				
			||||||
 | 
					                        if((len = ENGINE_ctrl(e, ENGINE_CTRL_GET_NAME_LEN_FROM_CMD, num,
 | 
				
			||||||
 | 
					                                NULL, NULL)) <= 0)
 | 
				
			||||||
 | 
					                                goto err;
 | 
				
			||||||
 | 
					                        if((name = OPENSSL_malloc(len + 1)) == NULL)
 | 
				
			||||||
 | 
					                                goto err;
 | 
				
			||||||
 | 
					                        if(ENGINE_ctrl(e, ENGINE_CTRL_GET_NAME_FROM_CMD, num, name,
 | 
				
			||||||
 | 
					                                NULL) <= 0)
 | 
				
			||||||
 | 
					                                goto err;
 | 
				
			||||||
 | 
					                        /* Get the command description */
 | 
				
			||||||
 | 
					                        if((len = ENGINE_ctrl(e, ENGINE_CTRL_GET_DESC_LEN_FROM_CMD, num,
 | 
				
			||||||
 | 
					                                NULL, NULL)) < 0)
 | 
				
			||||||
 | 
					                                goto err;
 | 
				
			||||||
 | 
					                        if(len > 0)
 | 
				
			||||||
 | 
					                                {
 | 
				
			||||||
 | 
					                                if((desc = OPENSSL_malloc(len + 1)) == NULL)
 | 
				
			||||||
 | 
					                                        goto err;
 | 
				
			||||||
 | 
					                                if(ENGINE_ctrl(e, ENGINE_CTRL_GET_DESC_FROM_CMD, num, desc,
 | 
				
			||||||
 | 
					                                        NULL) <= 0)
 | 
				
			||||||
 | 
					                                        goto err;
 | 
				
			||||||
 | 
					                                }
 | 
				
			||||||
 | 
					                        /* Now decide on the output */
 | 
				
			||||||
 | 
					                        if(xpos == 0)
 | 
				
			||||||
 | 
					                                /* Do an indent */
 | 
				
			||||||
 | 
					                                xpos = BIO_printf(bio_out, indent);
 | 
				
			||||||
 | 
					                        else
 | 
				
			||||||
 | 
					                                /* Otherwise prepend a ", " */
 | 
				
			||||||
 | 
					                                xpos += BIO_printf(bio_out, ", ");
 | 
				
			||||||
 | 
					                        if(verbose == 1)
 | 
				
			||||||
 | 
					                                {
 | 
				
			||||||
 | 
					                                /* We're just listing names, comma-delimited */
 | 
				
			||||||
 | 
					                                if((xpos > (int)strlen(indent)) &&
 | 
				
			||||||
 | 
										(xpos + (int)strlen(name) > line_wrap))
 | 
				
			||||||
 | 
					                                        {
 | 
				
			||||||
 | 
					                                        BIO_printf(bio_out, "\n");
 | 
				
			||||||
 | 
					                                        xpos = BIO_printf(bio_out, indent);
 | 
				
			||||||
 | 
					                                        }
 | 
				
			||||||
 | 
					                                xpos += BIO_printf(bio_out, "%s", name);
 | 
				
			||||||
 | 
					                                }
 | 
				
			||||||
 | 
					                        else
 | 
				
			||||||
 | 
					                                {
 | 
				
			||||||
 | 
					                                /* We're listing names plus descriptions */
 | 
				
			||||||
 | 
					                                BIO_printf(bio_out, "%s: %s\n", name,
 | 
				
			||||||
 | 
					                                        (desc == NULL) ? "<no description>" : desc);
 | 
				
			||||||
 | 
					                                /* ... and sometimes input flags */
 | 
				
			||||||
 | 
					                                if((verbose >= 3) && !util_flags(bio_out, flags,
 | 
				
			||||||
 | 
					                                        indent))
 | 
				
			||||||
 | 
					                                        goto err;
 | 
				
			||||||
 | 
					                                xpos = 0;
 | 
				
			||||||
 | 
					                                }
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
							OPENSSL_free(name); name = NULL;
 | 
				
			||||||
 | 
							if(desc) { OPENSSL_free(desc); desc = NULL; }
 | 
				
			||||||
 | 
							/* Move to the next command */
 | 
				
			||||||
 | 
							num = ENGINE_ctrl(e, ENGINE_CTRL_GET_NEXT_CMD_TYPE,
 | 
				
			||||||
 | 
										num, NULL, NULL);
 | 
				
			||||||
 | 
							} while(num > 0);
 | 
				
			||||||
 | 
						if(xpos > 0)
 | 
				
			||||||
 | 
							BIO_printf(bio_out, "\n");
 | 
				
			||||||
 | 
						ret = 1;
 | 
				
			||||||
 | 
					err:
 | 
				
			||||||
 | 
						if(cmds) sk_pop_free(cmds, identity);
 | 
				
			||||||
 | 
						if(name) OPENSSL_free(name);
 | 
				
			||||||
 | 
						if(desc) OPENSSL_free(desc);
 | 
				
			||||||
 | 
						return ret;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void util_do_cmds(ENGINE *e, STACK *cmds, BIO *bio_out, const char *indent)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						int loop, res, num = sk_num(cmds);
 | 
				
			||||||
 | 
						if(num < 0)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							BIO_printf(bio_out, "[Error]: internal stack error\n");
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						for(loop = 0; loop < num; loop++)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							char buf[256];
 | 
				
			||||||
 | 
							const char *cmd, *arg;
 | 
				
			||||||
 | 
							cmd = sk_value(cmds, loop);
 | 
				
			||||||
 | 
							res = 1; /* assume success */
 | 
				
			||||||
 | 
							/* Check if this command has no ":arg" */
 | 
				
			||||||
 | 
							if((arg = strstr(cmd, ":")) == NULL)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								if(!ENGINE_ctrl_cmd_string(e, cmd, NULL, 0))
 | 
				
			||||||
 | 
									res = 0;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							else
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								if((int)(arg - cmd) > 254)
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
									BIO_printf(bio_out,"[Error]: command name too long\n");
 | 
				
			||||||
 | 
									return;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								memcpy(buf, cmd, (int)(arg - cmd));
 | 
				
			||||||
 | 
								buf[arg-cmd] = '\0';
 | 
				
			||||||
 | 
								arg++; /* Move past the ":" */
 | 
				
			||||||
 | 
								/* Call the command with the argument */
 | 
				
			||||||
 | 
								if(!ENGINE_ctrl_cmd_string(e, buf, arg, 0))
 | 
				
			||||||
 | 
									res = 0;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							if(res)
 | 
				
			||||||
 | 
								BIO_printf(bio_out, "[Success]: %s\n", cmd);
 | 
				
			||||||
 | 
							else
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								BIO_printf(bio_out, "[Failure]: %s\n", cmd);
 | 
				
			||||||
 | 
								ERR_print_errors(bio_out);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int MAIN(int, char **);
 | 
					int MAIN(int, char **);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int MAIN(int argc, char **argv)
 | 
					int MAIN(int argc, char **argv)
 | 
				
			||||||
@@ -124,14 +345,20 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
	int verbose=0, list_cap=0, test_avail=0;
 | 
						int verbose=0, list_cap=0, test_avail=0;
 | 
				
			||||||
	ENGINE *e;
 | 
						ENGINE *e;
 | 
				
			||||||
	STACK *engines = sk_new_null();
 | 
						STACK *engines = sk_new_null();
 | 
				
			||||||
	int badops=0;
 | 
						STACK *pre_cmds = sk_new_null();
 | 
				
			||||||
 | 
						STACK *post_cmds = sk_new_null();
 | 
				
			||||||
 | 
						int badops=1;
 | 
				
			||||||
	BIO *bio_out=NULL;
 | 
						BIO *bio_out=NULL;
 | 
				
			||||||
 | 
						const char *indent = "     ";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	apps_startup();
 | 
						apps_startup();
 | 
				
			||||||
	SSL_load_error_strings();
 | 
						SSL_load_error_strings();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (bio_err == NULL)
 | 
						if (bio_err == NULL)
 | 
				
			||||||
		bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
 | 
							bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!load_config(bio_err, NULL))
 | 
				
			||||||
 | 
							goto end;
 | 
				
			||||||
	bio_out=BIO_new_fp(stdout,BIO_NOCLOSE);
 | 
						bio_out=BIO_new_fp(stdout,BIO_NOCLOSE);
 | 
				
			||||||
#ifdef OPENSSL_SYS_VMS
 | 
					#ifdef OPENSSL_SYS_VMS
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
@@ -144,25 +371,38 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
	argv++;
 | 
						argv++;
 | 
				
			||||||
	while (argc >= 1)
 | 
						while (argc >= 1)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		if (strcmp(*argv,"-v") == 0)
 | 
							if (strncmp(*argv,"-v",2) == 0)
 | 
				
			||||||
			verbose=1;
 | 
								{
 | 
				
			||||||
 | 
								if(strspn(*argv + 1, "v") < strlen(*argv + 1))
 | 
				
			||||||
 | 
									goto skip_arg_loop;
 | 
				
			||||||
 | 
								if((verbose=strlen(*argv + 1)) > 4)
 | 
				
			||||||
 | 
									goto skip_arg_loop;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
		else if (strcmp(*argv,"-c") == 0)
 | 
							else if (strcmp(*argv,"-c") == 0)
 | 
				
			||||||
			list_cap=1;
 | 
								list_cap=1;
 | 
				
			||||||
		else if (strcmp(*argv,"-t") == 0)
 | 
							else if (strcmp(*argv,"-t") == 0)
 | 
				
			||||||
			test_avail=1;
 | 
								test_avail=1;
 | 
				
			||||||
 | 
							else if (strcmp(*argv,"-pre") == 0)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								argc--; argv++;
 | 
				
			||||||
 | 
								sk_push(pre_cmds,*argv);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							else if (strcmp(*argv,"-post") == 0)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								argc--; argv++;
 | 
				
			||||||
 | 
								sk_push(post_cmds,*argv);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
		else if ((strncmp(*argv,"-h",2) == 0) ||
 | 
							else if ((strncmp(*argv,"-h",2) == 0) ||
 | 
				
			||||||
			 (strcmp(*argv,"-?") == 0))
 | 
									(strcmp(*argv,"-?") == 0))
 | 
				
			||||||
			{
 | 
								goto skip_arg_loop;
 | 
				
			||||||
			badops=1;
 | 
					 | 
				
			||||||
			break;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			sk_push(engines,*argv);
 | 
								sk_push(engines,*argv);
 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		argc--;
 | 
							argc--;
 | 
				
			||||||
		argv++;
 | 
							argv++;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
						/* Looks like everything went OK */
 | 
				
			||||||
 | 
						badops = 0;
 | 
				
			||||||
 | 
					skip_arg_loop:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (badops)
 | 
						if (badops)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
@@ -185,26 +425,22 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
		if ((e = ENGINE_by_id(id)) != NULL)
 | 
							if ((e = ENGINE_by_id(id)) != NULL)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
			const char *name = ENGINE_get_name(e);
 | 
								const char *name = ENGINE_get_name(e);
 | 
				
			||||||
			BIO_printf(bio_out, "%s (%s)", name, id);
 | 
								/* Do "id" first, then "name". Easier to auto-parse. */
 | 
				
			||||||
			if (list_cap || test_avail)
 | 
								BIO_printf(bio_out, "(%s) %s\n", id, name);
 | 
				
			||||||
				BIO_printf(bio_out, ":");
 | 
								util_do_cmds(e, pre_cmds, bio_out, indent);
 | 
				
			||||||
			if (test_avail)
 | 
								if (strcmp(ENGINE_get_id(e), id) != 0)
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
				if (ENGINE_init(e))
 | 
									BIO_printf(bio_out, "Loaded: (%s) %s\n",
 | 
				
			||||||
					{
 | 
										ENGINE_get_id(e), ENGINE_get_name(e));
 | 
				
			||||||
					BIO_printf(bio_out, " available");
 | 
					 | 
				
			||||||
					ENGINE_finish(e);
 | 
					 | 
				
			||||||
					}
 | 
					 | 
				
			||||||
				else
 | 
					 | 
				
			||||||
					{
 | 
					 | 
				
			||||||
					BIO_printf(bio_out, " unavailable");
 | 
					 | 
				
			||||||
					ERR_clear_error();
 | 
					 | 
				
			||||||
					}
 | 
					 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			if (list_cap)
 | 
								if (list_cap)
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
				int cap_size = 256;
 | 
									int cap_size = 256;
 | 
				
			||||||
				char *cap_buf = NULL;
 | 
									char *cap_buf = NULL;
 | 
				
			||||||
 | 
									int k,n;
 | 
				
			||||||
 | 
									const int *nids;
 | 
				
			||||||
 | 
									ENGINE_CIPHERS_PTR fn_c;
 | 
				
			||||||
 | 
									ENGINE_DIGESTS_PTR fn_d;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				if (ENGINE_get_RSA(e) != NULL
 | 
									if (ENGINE_get_RSA(e) != NULL
 | 
				
			||||||
					&& !append_buf(&cap_buf, "RSA",
 | 
										&& !append_buf(&cap_buf, "RSA",
 | 
				
			||||||
@@ -223,12 +459,50 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
						&cap_size, 256))
 | 
											&cap_size, 256))
 | 
				
			||||||
					goto end;
 | 
										goto end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				if (*cap_buf != '\0')
 | 
									fn_c = ENGINE_get_ciphers(e);
 | 
				
			||||||
					BIO_printf(bio_out, " [%s]", cap_buf);
 | 
									if(!fn_c) goto skip_ciphers;
 | 
				
			||||||
 | 
									n = fn_c(e, NULL, &nids, 0);
 | 
				
			||||||
 | 
									for(k=0 ; k < n ; ++k)
 | 
				
			||||||
 | 
										if(!append_buf(&cap_buf,
 | 
				
			||||||
 | 
											       OBJ_nid2sn(nids[k]),
 | 
				
			||||||
 | 
											       &cap_size, 256))
 | 
				
			||||||
 | 
											goto end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					skip_ciphers:
 | 
				
			||||||
 | 
									fn_d = ENGINE_get_digests(e);
 | 
				
			||||||
 | 
									if(!fn_d) goto skip_digests;
 | 
				
			||||||
 | 
									n = fn_d(e, NULL, &nids, 0);
 | 
				
			||||||
 | 
									for(k=0 ; k < n ; ++k)
 | 
				
			||||||
 | 
										if(!append_buf(&cap_buf,
 | 
				
			||||||
 | 
											       OBJ_nid2sn(nids[k]),
 | 
				
			||||||
 | 
											       &cap_size, 256))
 | 
				
			||||||
 | 
											goto end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					skip_digests:
 | 
				
			||||||
 | 
									if (cap_buf && (*cap_buf != '\0'))
 | 
				
			||||||
 | 
										BIO_printf(bio_out, " [%s]\n", cap_buf);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				OPENSSL_free(cap_buf);
 | 
									OPENSSL_free(cap_buf);
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			BIO_printf(bio_out, "\n");
 | 
								if(test_avail)
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
									BIO_printf(bio_out, "%s", indent);
 | 
				
			||||||
 | 
									if (ENGINE_init(e))
 | 
				
			||||||
 | 
										{
 | 
				
			||||||
 | 
										BIO_printf(bio_out, "[ available ]\n");
 | 
				
			||||||
 | 
										util_do_cmds(e, post_cmds, bio_out, indent);
 | 
				
			||||||
 | 
										ENGINE_finish(e);
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
									else
 | 
				
			||||||
 | 
										{
 | 
				
			||||||
 | 
										BIO_printf(bio_out, "[ unavailable ]\n");
 | 
				
			||||||
 | 
										ERR_print_errors_fp(stdout);
 | 
				
			||||||
 | 
										ERR_clear_error();
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								if((verbose > 0) && !util_verbose(e, verbose, bio_out, indent))
 | 
				
			||||||
 | 
									goto end;
 | 
				
			||||||
 | 
								ENGINE_free(e);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			ERR_print_errors(bio_err);
 | 
								ERR_print_errors(bio_err);
 | 
				
			||||||
@@ -238,6 +512,9 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
end:
 | 
					end:
 | 
				
			||||||
	ERR_print_errors(bio_err);
 | 
						ERR_print_errors(bio_err);
 | 
				
			||||||
	sk_pop_free(engines, identity);
 | 
						sk_pop_free(engines, identity);
 | 
				
			||||||
 | 
						sk_pop_free(pre_cmds, identity);
 | 
				
			||||||
 | 
						sk_pop_free(post_cmds, identity);
 | 
				
			||||||
	if (bio_out != NULL) BIO_free_all(bio_out);
 | 
						if (bio_out != NULL) BIO_free_all(bio_out);
 | 
				
			||||||
 | 
						apps_shutdown();
 | 
				
			||||||
	EXIT(ret);
 | 
						EXIT(ret);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -121,5 +121,6 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
			ret++;
 | 
								ret++;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
						apps_shutdown();
 | 
				
			||||||
	EXIT(ret);
 | 
						EXIT(ret);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										23
									
								
								apps/gendh.c
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								apps/gendh.c
									
									
									
									
									
								
							@@ -70,7 +70,6 @@
 | 
				
			|||||||
#include <openssl/dh.h>
 | 
					#include <openssl/dh.h>
 | 
				
			||||||
#include <openssl/x509.h>
 | 
					#include <openssl/x509.h>
 | 
				
			||||||
#include <openssl/pem.h>
 | 
					#include <openssl/pem.h>
 | 
				
			||||||
#include <openssl/engine.h>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define DEFBITS	512
 | 
					#define DEFBITS	512
 | 
				
			||||||
#undef PROG
 | 
					#undef PROG
 | 
				
			||||||
@@ -97,6 +96,9 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
		if ((bio_err=BIO_new(BIO_s_file())) != NULL)
 | 
							if ((bio_err=BIO_new(BIO_s_file())) != NULL)
 | 
				
			||||||
			BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
 | 
								BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!load_config(bio_err, NULL))
 | 
				
			||||||
 | 
							goto end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	argv++;
 | 
						argv++;
 | 
				
			||||||
	argc--;
 | 
						argc--;
 | 
				
			||||||
	for (;;)
 | 
						for (;;)
 | 
				
			||||||
@@ -143,23 +145,7 @@ bad:
 | 
				
			|||||||
		goto end;
 | 
							goto end;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
	if (engine != NULL)
 | 
					        e = setup_engine(bio_err, engine, 0);
 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
		if((e = ENGINE_by_id(engine)) == NULL)
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			BIO_printf(bio_err,"invalid engine \"%s\"\n",
 | 
					 | 
				
			||||||
				engine);
 | 
					 | 
				
			||||||
			goto end;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			BIO_printf(bio_err,"can't use that engine\n");
 | 
					 | 
				
			||||||
			goto end;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
 | 
					 | 
				
			||||||
		/* Free our "structural" reference. */
 | 
					 | 
				
			||||||
		ENGINE_free(e);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	out=BIO_new(BIO_s_file());
 | 
						out=BIO_new(BIO_s_file());
 | 
				
			||||||
	if (out == NULL)
 | 
						if (out == NULL)
 | 
				
			||||||
@@ -211,6 +197,7 @@ end:
 | 
				
			|||||||
		ERR_print_errors(bio_err);
 | 
							ERR_print_errors(bio_err);
 | 
				
			||||||
	if (out != NULL) BIO_free_all(out);
 | 
						if (out != NULL) BIO_free_all(out);
 | 
				
			||||||
	if (dh != NULL) DH_free(dh);
 | 
						if (dh != NULL) DH_free(dh);
 | 
				
			||||||
 | 
						apps_shutdown();
 | 
				
			||||||
	EXIT(ret);
 | 
						EXIT(ret);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -68,7 +68,6 @@
 | 
				
			|||||||
#include <openssl/dsa.h>
 | 
					#include <openssl/dsa.h>
 | 
				
			||||||
#include <openssl/x509.h>
 | 
					#include <openssl/x509.h>
 | 
				
			||||||
#include <openssl/pem.h>
 | 
					#include <openssl/pem.h>
 | 
				
			||||||
#include <openssl/engine.h>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define DEFBITS	512
 | 
					#define DEFBITS	512
 | 
				
			||||||
#undef PROG
 | 
					#undef PROG
 | 
				
			||||||
@@ -94,6 +93,9 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
		if ((bio_err=BIO_new(BIO_s_file())) != NULL)
 | 
							if ((bio_err=BIO_new(BIO_s_file())) != NULL)
 | 
				
			||||||
			BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
 | 
								BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!load_config(bio_err, NULL))
 | 
				
			||||||
 | 
							goto end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	argv++;
 | 
						argv++;
 | 
				
			||||||
	argc--;
 | 
						argc--;
 | 
				
			||||||
	for (;;)
 | 
						for (;;)
 | 
				
			||||||
@@ -130,6 +132,14 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
#ifndef OPENSSL_NO_IDEA
 | 
					#ifndef OPENSSL_NO_IDEA
 | 
				
			||||||
		else if (strcmp(*argv,"-idea") == 0)
 | 
							else if (strcmp(*argv,"-idea") == 0)
 | 
				
			||||||
			enc=EVP_idea_cbc();
 | 
								enc=EVP_idea_cbc();
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_AES
 | 
				
			||||||
 | 
							else if (strcmp(*argv,"-aes128") == 0)
 | 
				
			||||||
 | 
								enc=EVP_aes_128_cbc();
 | 
				
			||||||
 | 
							else if (strcmp(*argv,"-aes192") == 0)
 | 
				
			||||||
 | 
								enc=EVP_aes_192_cbc();
 | 
				
			||||||
 | 
							else if (strcmp(*argv,"-aes256") == 0)
 | 
				
			||||||
 | 
								enc=EVP_aes_256_cbc();
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
		else if (**argv != '-' && dsaparams == NULL)
 | 
							else if (**argv != '-' && dsaparams == NULL)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
@@ -152,6 +162,10 @@ bad:
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
#ifndef OPENSSL_NO_IDEA
 | 
					#ifndef OPENSSL_NO_IDEA
 | 
				
			||||||
		BIO_printf(bio_err," -idea     - encrypt the generated key with IDEA in cbc mode\n");
 | 
							BIO_printf(bio_err," -idea     - encrypt the generated key with IDEA in cbc mode\n");
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_AES
 | 
				
			||||||
 | 
							BIO_printf(bio_err," -aes128, -aes192, -aes256\n");
 | 
				
			||||||
 | 
							BIO_printf(bio_err,"                 encrypt PEM output with cbc aes\n");
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
		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");
 | 
				
			||||||
		BIO_printf(bio_err," -rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR);
 | 
							BIO_printf(bio_err," -rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR);
 | 
				
			||||||
@@ -162,23 +176,7 @@ bad:
 | 
				
			|||||||
		goto end;
 | 
							goto end;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (engine != NULL)
 | 
					        e = setup_engine(bio_err, engine, 0);
 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
		if((e = ENGINE_by_id(engine)) == NULL)
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			BIO_printf(bio_err,"invalid engine \"%s\"\n",
 | 
					 | 
				
			||||||
				engine);
 | 
					 | 
				
			||||||
			goto end;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			BIO_printf(bio_err,"can't use that engine\n");
 | 
					 | 
				
			||||||
			goto end;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
 | 
					 | 
				
			||||||
		/* Free our "structural" reference. */
 | 
					 | 
				
			||||||
		ENGINE_free(e);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(!app_passwd(bio_err, NULL, passargout, NULL, &passout)) {
 | 
						if(!app_passwd(bio_err, NULL, passargout, NULL, &passout)) {
 | 
				
			||||||
		BIO_printf(bio_err, "Error getting password\n");
 | 
							BIO_printf(bio_err, "Error getting password\n");
 | 
				
			||||||
@@ -247,6 +245,7 @@ end:
 | 
				
			|||||||
	if (out != NULL) BIO_free_all(out);
 | 
						if (out != NULL) BIO_free_all(out);
 | 
				
			||||||
	if (dsa != NULL) DSA_free(dsa);
 | 
						if (dsa != NULL) DSA_free(dsa);
 | 
				
			||||||
	if(passout) OPENSSL_free(passout);
 | 
						if(passout) OPENSSL_free(passout);
 | 
				
			||||||
 | 
						apps_shutdown();
 | 
				
			||||||
	EXIT(ret);
 | 
						EXIT(ret);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -69,7 +69,7 @@
 | 
				
			|||||||
#include <openssl/evp.h>
 | 
					#include <openssl/evp.h>
 | 
				
			||||||
#include <openssl/x509.h>
 | 
					#include <openssl/x509.h>
 | 
				
			||||||
#include <openssl/pem.h>
 | 
					#include <openssl/pem.h>
 | 
				
			||||||
#include <openssl/engine.h>
 | 
					#include <openssl/rand.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define DEFBITS	512
 | 
					#define DEFBITS	512
 | 
				
			||||||
#undef PROG
 | 
					#undef PROG
 | 
				
			||||||
@@ -99,6 +99,9 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
	if (bio_err == NULL)
 | 
						if (bio_err == NULL)
 | 
				
			||||||
		if ((bio_err=BIO_new(BIO_s_file())) != NULL)
 | 
							if ((bio_err=BIO_new(BIO_s_file())) != NULL)
 | 
				
			||||||
			BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
 | 
								BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!load_config(bio_err, NULL))
 | 
				
			||||||
 | 
							goto err;
 | 
				
			||||||
	if ((out=BIO_new(BIO_s_file())) == NULL)
 | 
						if ((out=BIO_new(BIO_s_file())) == NULL)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		BIO_printf(bio_err,"unable to create BIO for output\n");
 | 
							BIO_printf(bio_err,"unable to create BIO for output\n");
 | 
				
			||||||
@@ -138,6 +141,14 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
#ifndef OPENSSL_NO_IDEA
 | 
					#ifndef OPENSSL_NO_IDEA
 | 
				
			||||||
		else if (strcmp(*argv,"-idea") == 0)
 | 
							else if (strcmp(*argv,"-idea") == 0)
 | 
				
			||||||
			enc=EVP_idea_cbc();
 | 
								enc=EVP_idea_cbc();
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_AES
 | 
				
			||||||
 | 
							else if (strcmp(*argv,"-aes128") == 0)
 | 
				
			||||||
 | 
								enc=EVP_aes_128_cbc();
 | 
				
			||||||
 | 
							else if (strcmp(*argv,"-aes192") == 0)
 | 
				
			||||||
 | 
								enc=EVP_aes_192_cbc();
 | 
				
			||||||
 | 
							else if (strcmp(*argv,"-aes256") == 0)
 | 
				
			||||||
 | 
								enc=EVP_aes_256_cbc();
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
		else if (strcmp(*argv,"-passout") == 0)
 | 
							else if (strcmp(*argv,"-passout") == 0)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
@@ -157,6 +168,10 @@ bad:
 | 
				
			|||||||
		BIO_printf(bio_err," -des3           encrypt the generated key with DES in ede cbc mode (168 bit key)\n");
 | 
							BIO_printf(bio_err," -des3           encrypt the generated key with DES in ede cbc mode (168 bit key)\n");
 | 
				
			||||||
#ifndef OPENSSL_NO_IDEA
 | 
					#ifndef OPENSSL_NO_IDEA
 | 
				
			||||||
		BIO_printf(bio_err," -idea           encrypt the generated key with IDEA in cbc mode\n");
 | 
							BIO_printf(bio_err," -idea           encrypt the generated key with IDEA in cbc mode\n");
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_AES
 | 
				
			||||||
 | 
							BIO_printf(bio_err," -aes128, -aes192, -aes256\n");
 | 
				
			||||||
 | 
							BIO_printf(bio_err,"                 encrypt PEM output with cbc aes\n");
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
		BIO_printf(bio_err," -out file       output the key to 'file\n");
 | 
							BIO_printf(bio_err," -out file       output the key to 'file\n");
 | 
				
			||||||
		BIO_printf(bio_err," -passout arg    output file pass phrase source\n");
 | 
							BIO_printf(bio_err," -passout arg    output file pass phrase source\n");
 | 
				
			||||||
@@ -176,23 +191,7 @@ bad:
 | 
				
			|||||||
		goto err;
 | 
							goto err;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (engine != NULL)
 | 
					        e = setup_engine(bio_err, engine, 0);
 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
		if((e = ENGINE_by_id(engine)) == NULL)
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			BIO_printf(bio_err,"invalid engine \"%s\"\n",
 | 
					 | 
				
			||||||
				engine);
 | 
					 | 
				
			||||||
			goto err;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			BIO_printf(bio_err,"can't use that engine\n");
 | 
					 | 
				
			||||||
			goto err;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
 | 
					 | 
				
			||||||
		/* Free our "structural" reference. */
 | 
					 | 
				
			||||||
		ENGINE_free(e);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (outfile == NULL)
 | 
						if (outfile == NULL)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
@@ -242,8 +241,14 @@ bad:
 | 
				
			|||||||
		l+=rsa->e->d[i];
 | 
							l+=rsa->e->d[i];
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	BIO_printf(bio_err,"e is %ld (0x%lX)\n",l,l);
 | 
						BIO_printf(bio_err,"e is %ld (0x%lX)\n",l,l);
 | 
				
			||||||
	if (!PEM_write_bio_RSAPrivateKey(out,rsa,enc,NULL,0,NULL, passout))
 | 
						{
 | 
				
			||||||
 | 
						PW_CB_DATA cb_data;
 | 
				
			||||||
 | 
						cb_data.password = passout;
 | 
				
			||||||
 | 
						cb_data.prompt_info = outfile;
 | 
				
			||||||
 | 
						if (!PEM_write_bio_RSAPrivateKey(out,rsa,enc,NULL,0,
 | 
				
			||||||
 | 
							(pem_password_cb *)password_callback,&cb_data))
 | 
				
			||||||
		goto err;
 | 
							goto err;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ret=0;
 | 
						ret=0;
 | 
				
			||||||
err:
 | 
					err:
 | 
				
			||||||
@@ -252,6 +257,7 @@ err:
 | 
				
			|||||||
	if(passout) OPENSSL_free(passout);
 | 
						if(passout) OPENSSL_free(passout);
 | 
				
			||||||
	if (ret != 0)
 | 
						if (ret != 0)
 | 
				
			||||||
		ERR_print_errors(bio_err);
 | 
							ERR_print_errors(bio_err);
 | 
				
			||||||
 | 
						apps_shutdown();
 | 
				
			||||||
	EXIT(ret);
 | 
						EXIT(ret);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -15,22 +15,10 @@ $!
 | 
				
			|||||||
$!  It was written so it would try to determine what "C" compiler to
 | 
					$!  It was written so it would try to determine what "C" compiler to
 | 
				
			||||||
$!  use or you can specify which "C" compiler to use.
 | 
					$!  use or you can specify which "C" compiler to use.
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$!  Specify RSAREF as P1 to compile with the RSAREF library instead of
 | 
					$!  Specify DEBUG or NODEBUG as P1 to compile with or without debugger
 | 
				
			||||||
$!  the regular one.  If you specify NORSAREF it will compile with the
 | 
					 | 
				
			||||||
$!  regular RSAREF routines.  (Note: If you are in the United States
 | 
					 | 
				
			||||||
$!  you MUST compile with RSAREF unless you have a license from RSA).
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$!  Note: The RSAREF libraries are NOT INCLUDED and you have to
 | 
					 | 
				
			||||||
$!        download it from "ftp://ftp.rsa.com/rsaref".  You have to
 | 
					 | 
				
			||||||
$!        get the ".tar-Z" file as the ".zip" file dosen't have the
 | 
					 | 
				
			||||||
$!        directory structure stored.  You have to extract the file
 | 
					 | 
				
			||||||
$!        into the [.RSAREF] directory under the root directory as that
 | 
					 | 
				
			||||||
$!        is where the scripts will look for the files.
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$!  Specify DEBUG or NODEBUG as P2 to compile with or without debugger
 | 
					 | 
				
			||||||
$!  information.
 | 
					$!  information.
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$!  Specify which compiler at P3 to try to compile under.
 | 
					$!  Specify which compiler at P2 to try to compile under.
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$!	   VAXC	 For VAX C.
 | 
					$!	   VAXC	 For VAX C.
 | 
				
			||||||
$!	   DECC	 For DEC C.
 | 
					$!	   DECC	 For DEC C.
 | 
				
			||||||
@@ -39,15 +27,16 @@ $!
 | 
				
			|||||||
$!  If you don't speficy a compiler, it will try to determine which
 | 
					$!  If you don't speficy a compiler, it will try to determine which
 | 
				
			||||||
$!  "C" compiler to use.
 | 
					$!  "C" compiler to use.
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$!  P4, if defined, sets a TCP/IP library to use, through one of the following
 | 
					$!  P3, if defined, sets a TCP/IP library to use, through one of the following
 | 
				
			||||||
$!  keywords:
 | 
					$!  keywords:
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$!	UCX		for UCX
 | 
					$!	UCX		for UCX
 | 
				
			||||||
$!	SOCKETSHR	for SOCKETSHR+NETLIB
 | 
					$!	SOCKETSHR	for SOCKETSHR+NETLIB
 | 
				
			||||||
 | 
					$!	TCPIP		for TCPIP (post UCX)
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$!  P5, if defined, sets a compiler thread NOT needed on OpenVMS 7.1 (and up)
 | 
					$!  P4, if defined, sets a compiler thread NOT needed on OpenVMS 7.1 (and up)
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$!  P6, if defined, sets a choice of programs to compile.
 | 
					$!  P5, if defined, sets a choice of programs to compile.
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$! Define A TCP/IP Library That We Will Need To Link To.
 | 
					$! Define A TCP/IP Library That We Will Need To Link To.
 | 
				
			||||||
@@ -100,10 +89,6 @@ $! Define The CRYPTO Library.
 | 
				
			|||||||
$!
 | 
					$!
 | 
				
			||||||
$ CRYPTO_LIB := SYS$DISK:[-.'ARCH'.EXE.CRYPTO]LIBCRYPTO.OLB
 | 
					$ CRYPTO_LIB := SYS$DISK:[-.'ARCH'.EXE.CRYPTO]LIBCRYPTO.OLB
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$! Define The RSAREF Library.
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$ RSAREF_LIB := SYS$DISK:[-.'ARCH'.EXE.RSAREF]LIBRSAGLUE.OLB
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$! Define The SSL Library.
 | 
					$! Define The SSL Library.
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$ SSL_LIB := SYS$DISK:[-.'ARCH'.EXE.SSL]LIBSSL.OLB
 | 
					$ SSL_LIB := SYS$DISK:[-.'ARCH'.EXE.SSL]LIBSSL.OLB
 | 
				
			||||||
@@ -292,73 +277,31 @@ $   WRITE SYS$OUTPUT FILE_NAME," needs a TCP/IP library.  Can't link.  Skipping.
 | 
				
			|||||||
$   GOTO NEXT_FILE
 | 
					$   GOTO NEXT_FILE
 | 
				
			||||||
$ ENDIF
 | 
					$ ENDIF
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$! Link The Program, Check To See If We Need To Link With RSAREF Or Not.
 | 
					$! Link The Program.
 | 
				
			||||||
 | 
					$! Check To See If We Are To Link With A Specific TCP/IP Library.
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$ IF (RSAREF.EQS."TRUE")
 | 
					$ IF (TCPIP_LIB.NES."")
 | 
				
			||||||
$ THEN
 | 
					$ THEN
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$!  Check To See If We Are To Link With A Specific TCP/IP Library.
 | 
					$! Don't Link With The RSAREF Routines And TCP/IP Library.
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$   IF (TCPIP_LIB.NES."")
 | 
					$   LINK/'DEBUGGER'/'TRACEBACK' /EXE='EXE_FILE' -
 | 
				
			||||||
$   THEN
 | 
						'OBJECT_FILE''EXTRA_OBJ', -
 | 
				
			||||||
$!
 | 
					        'SSL_LIB'/LIBRARY,'CRYPTO_LIB'/LIBRARY, -
 | 
				
			||||||
$!    Link With The RSAREF Library And A Specific TCP/IP Library.
 | 
					        'TCPIP_LIB','OPT_FILE'/OPTION
 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$     LINK/'DEBUGGER'/'TRACEBACK' /EXE='EXE_FILE' -
 | 
					 | 
				
			||||||
	  'OBJECT_FILE''EXTRA_OBJ', -
 | 
					 | 
				
			||||||
          'SSL_LIB'/LIBRARY,'CRYPTO_LIB'/LIBRARY,'RSAREF_LIB'/LIBRARY, -
 | 
					 | 
				
			||||||
          'TCPIP_LIB','OPT_FILE'/OPTION
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$!  Else...
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$   ELSE
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$!    Link With The RSAREF Library And NO TCP/IP Library.
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$     LINK/'DEBUGGER'/'TRACEBACK' /EXE='EXE_FILE' -
 | 
					 | 
				
			||||||
	  'OBJECT_FILE''EXTRA_OBJ', -
 | 
					 | 
				
			||||||
          'SSL_LIB'/LIBRARY,'CRYPTO_LIB'/LIBRARY,'RSAREF_LIB'/LIBRARY, -
 | 
					 | 
				
			||||||
          'OPT_FILE'/OPTION
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$!  End The TCP/IP Library Check.
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$   ENDIF
 | 
					 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$! Else...
 | 
					$! Else...
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$ ELSE
 | 
					$ ELSE
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$!  Don't Link With The RSAREF Routines.
 | 
					$! Don't Link With The RSAREF Routines And Link With A TCP/IP Library.
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
 | 
					$   LINK/'DEBUGGER'/'TRACEBACK' /EXE='EXE_FILE' -
 | 
				
			||||||
 | 
						'OBJECT_FILE''EXTRA_OBJ', -
 | 
				
			||||||
 | 
					        'SSL_LIB'/LIBRARY,'CRYPTO_LIB'/LIBRARY, -
 | 
				
			||||||
 | 
					        'OPT_FILE'/OPTION
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$!  Check To See If We Are To Link With A Specific TCP/IP Library.
 | 
					$! End The TCP/IP Library Check.
 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$   IF (TCPIP_LIB.NES."")
 | 
					 | 
				
			||||||
$   THEN
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$!    Don't Link With The RSAREF Routines And TCP/IP Library.
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$       LINK/'DEBUGGER'/'TRACEBACK' /EXE='EXE_FILE' -
 | 
					 | 
				
			||||||
	    'OBJECT_FILE''EXTRA_OBJ', -
 | 
					 | 
				
			||||||
            'SSL_LIB'/LIBRARY,'CRYPTO_LIB'/LIBRARY, -
 | 
					 | 
				
			||||||
            'TCPIP_LIB','OPT_FILE'/OPTION
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$!  Else...
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$   ELSE
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$!    Don't Link With The RSAREF Routines And Link With A TCP/IP Library.
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$       LINK/'DEBUGGER'/'TRACEBACK' /EXE='EXE_FILE' -
 | 
					 | 
				
			||||||
	    'OBJECT_FILE''EXTRA_OBJ', -
 | 
					 | 
				
			||||||
            'SSL_LIB'/LIBRARY,'CRYPTO_LIB'/LIBRARY, -
 | 
					 | 
				
			||||||
            'OPT_FILE'/OPTION
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$!  End The TCP/IP Library Check.
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$   ENDIF
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$! End The RSAREF Link Check.
 | 
					 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$ ENDIF
 | 
					$ ENDIF
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
@@ -525,32 +468,6 @@ $! End The Crypto Library Check.
 | 
				
			|||||||
$!
 | 
					$!
 | 
				
			||||||
$ ENDIF
 | 
					$ ENDIF
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$! See If We Need The RSAREF Library.
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$ IF (RSAREF.EQS."TRUE")
 | 
					 | 
				
			||||||
$ THEN
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$!  Look For The Library LIBRSAGLUE.OLB.
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$   IF (F$SEARCH(RSAREF_LIB).EQS."")
 | 
					 | 
				
			||||||
$   THEN
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$!    Tell The User We Can't Find The LIBRSAGLUE.OLB Library.
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$     WRITE SYS$OUTPUT ""
 | 
					 | 
				
			||||||
$     WRITE SYS$OUTPUT "Can't Find The Library ",RSAREF_LIB,"."
 | 
					 | 
				
			||||||
$     WRITE SYS$OUTPUT "We Can't Link Without It."
 | 
					 | 
				
			||||||
$     WRITE SYS$OUTPUT ""
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$!    Since We Can't Link Without It, Exit.
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$     EXIT
 | 
					 | 
				
			||||||
$   ENDIF
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$! End The RSAREF Library Check.
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$ ENDIF
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$! Look For The Library LIBSSL.OLB.
 | 
					$! Look For The Library LIBSSL.OLB.
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$ IF (F$SEARCH(SSL_LIB).EQS."")
 | 
					$ IF (F$SEARCH(SSL_LIB).EQS."")
 | 
				
			||||||
@@ -581,87 +498,10 @@ $ CHECK_OPTIONS:
 | 
				
			|||||||
$!
 | 
					$!
 | 
				
			||||||
$! Check To See If P1 Is Blank.
 | 
					$! Check To See If P1 Is Blank.
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$ P1 = "NORSAREF"
 | 
					$ IF (P1.EQS."NODEBUG")
 | 
				
			||||||
$ IF (P1.EQS."NORSAREF")
 | 
					 | 
				
			||||||
$ THEN
 | 
					$ THEN
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$!   P1 Is NORSAREF, So Compile With The Regular RSA Libraries.
 | 
					$!   P1 Is NODEBUG, So Compile Without Debugger Information.
 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$    RSAREF = "FALSE"
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$! Else...
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$ ELSE
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$!  Check To See If We Are To Use The RSAREF Library.
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$   IF (P1.EQS."RSAREF")
 | 
					 | 
				
			||||||
$   THEN
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$!    Check To Make Sure We Have The RSAREF Source Code Directory.
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$     IF (F$SEARCH("SYS$DISK:[-.RSAREF]SOURCE.DIR").EQS."")
 | 
					 | 
				
			||||||
$     THEN
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$!      We Don't Have The RSAREF Souce Code Directory, So Tell The
 | 
					 | 
				
			||||||
$!      User This.
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$       WRITE SYS$OUTPUT ""
 | 
					 | 
				
			||||||
$       WRITE SYS$OUTPUT "It appears that you don't have the RSAREF Souce Code."
 | 
					 | 
				
			||||||
$       WRITE SYS$OUTPUT "You need to go to 'ftp://ftp.rsa.com/rsaref'.  You have to"
 | 
					 | 
				
			||||||
$       WRITE SYS$OUTPUT "get the '.tar-Z' file as the '.zip' file dosen't have the"
 | 
					 | 
				
			||||||
$       WRITE SYS$OUTPUT "directory structure stored.  You have to extract the file"
 | 
					 | 
				
			||||||
$       WRITE SYS$OUTPUT "into the [.RSAREF] directory under the root directory"
 | 
					 | 
				
			||||||
$       WRITE SYS$OUTPUT "as that is where the scripts will look for the files."
 | 
					 | 
				
			||||||
$       WRITE SYS$OUTPUT ""
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$!      Time To Exit.
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$       EXIT
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$!    Else...
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$     ELSE
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$!      Compile Using The RSAREF Library.
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$       RSAREF = "TRUE"
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$!    End The RSAREF Soure Directory Check.
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$     ENDIF
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$!  Else...
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$   ELSE 
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$!    They Entered An Invalid Option..
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$     WRITE SYS$OUTPUT ""
 | 
					 | 
				
			||||||
$     WRITE SYS$OUTPUT "The Option ",P1," Is Invalid.  The Valid Options Are:"
 | 
					 | 
				
			||||||
$     WRITE SYS$OUTPUT ""
 | 
					 | 
				
			||||||
$     WRITE SYS$OUTPUT "     RSAREF   :  Compile With The RSAREF Library."
 | 
					 | 
				
			||||||
$     WRITE SYS$OUTPUT "     NORSAREF :  Compile With The Regular RSA Library."
 | 
					 | 
				
			||||||
$     WRITE SYS$OUTPUT ""
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$!    Time To EXIT.
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$     EXIT
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$!  End The Valid Arguement Check.
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$   ENDIF
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$! End P1 Check.
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$ ENDIF
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$! Check To See If P2 Is Blank.
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$ IF (P2.EQS."NODEBUG")
 | 
					 | 
				
			||||||
$ THEN
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$!   P2 Is NODEBUG, So Compile Without Debugger Information.
 | 
					 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$    DEBUGGER  = "NODEBUG"
 | 
					$    DEBUGGER  = "NODEBUG"
 | 
				
			||||||
$    TRACEBACK = "NOTRACEBACK" 
 | 
					$    TRACEBACK = "NOTRACEBACK" 
 | 
				
			||||||
@@ -676,7 +516,7 @@ $ ELSE
 | 
				
			|||||||
$!
 | 
					$!
 | 
				
			||||||
$!  Check To See If We Are To Compile With Debugger Information.
 | 
					$!  Check To See If We Are To Compile With Debugger Information.
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$   IF (P2.EQS."DEBUG")
 | 
					$   IF (P1.EQS."DEBUG")
 | 
				
			||||||
$   THEN
 | 
					$   THEN
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$!    Compile With Debugger Information.
 | 
					$!    Compile With Debugger Information.
 | 
				
			||||||
@@ -692,7 +532,7 @@ $!
 | 
				
			|||||||
$!    Tell The User Entered An Invalid Option..
 | 
					$!    Tell The User Entered An Invalid Option..
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$     WRITE SYS$OUTPUT ""
 | 
					$     WRITE SYS$OUTPUT ""
 | 
				
			||||||
$     WRITE SYS$OUTPUT "The Option ",P2," Is Invalid.  The Valid Options Are:"
 | 
					$     WRITE SYS$OUTPUT "The Option ",P1," Is Invalid.  The Valid Options Are:"
 | 
				
			||||||
$     WRITE SYS$OUTPUT ""
 | 
					$     WRITE SYS$OUTPUT ""
 | 
				
			||||||
$     WRITE SYS$OUTPUT "    DEBUG    :  Compile With The Debugger Information."
 | 
					$     WRITE SYS$OUTPUT "    DEBUG    :  Compile With The Debugger Information."
 | 
				
			||||||
$     WRITE SYS$OUTPUT "    NODEBUG  :  Compile Without The Debugger Information."
 | 
					$     WRITE SYS$OUTPUT "    NODEBUG  :  Compile Without The Debugger Information."
 | 
				
			||||||
@@ -706,13 +546,13 @@ $!  End The Valid Arguement Check.
 | 
				
			|||||||
$!
 | 
					$!
 | 
				
			||||||
$   ENDIF
 | 
					$   ENDIF
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$! End The P2 Check.
 | 
					$! End The P1 Check.
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$ ENDIF
 | 
					$ ENDIF
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$! Check To See If P3 Is Blank.
 | 
					$! Check To See If P2 Is Blank.
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$ IF (P3.EQS."")
 | 
					$ IF (P2.EQS."")
 | 
				
			||||||
$ THEN
 | 
					$ THEN
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$!  O.K., The User Didn't Specify A Compiler, Let's Try To
 | 
					$!  O.K., The User Didn't Specify A Compiler, Let's Try To
 | 
				
			||||||
@@ -725,7 +565,7 @@ $   THEN
 | 
				
			|||||||
$!
 | 
					$!
 | 
				
			||||||
$!    Looks Like GNUC, Set To Use GNUC.
 | 
					$!    Looks Like GNUC, Set To Use GNUC.
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$     P3 = "GNUC"
 | 
					$     P2 = "GNUC"
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$!  Else...
 | 
					$!  Else...
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
@@ -738,7 +578,7 @@ $     THEN
 | 
				
			|||||||
$!
 | 
					$!
 | 
				
			||||||
$!      Looks Like DECC, Set To Use DECC.
 | 
					$!      Looks Like DECC, Set To Use DECC.
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$       P3 = "DECC"
 | 
					$       P2 = "DECC"
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$!    Else...
 | 
					$!    Else...
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
@@ -746,7 +586,7 @@ $     ELSE
 | 
				
			|||||||
$!
 | 
					$!
 | 
				
			||||||
$!      Looks Like VAXC, Set To Use VAXC.
 | 
					$!      Looks Like VAXC, Set To Use VAXC.
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$       P3 = "VAXC"
 | 
					$       P2 = "VAXC"
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$!    End The VAXC Compiler Check.
 | 
					$!    End The VAXC Compiler Check.
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
@@ -760,9 +600,9 @@ $!  End The Compiler Check.
 | 
				
			|||||||
$!
 | 
					$!
 | 
				
			||||||
$ ENDIF
 | 
					$ ENDIF
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$! Check To See If We Have A Option For P4.
 | 
					$! Check To See If We Have A Option For P3.
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$ IF (P4.EQS."")
 | 
					$ IF (P3.EQS."")
 | 
				
			||||||
$ THEN
 | 
					$ THEN
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$!  Find out what socket library we have available
 | 
					$!  Find out what socket library we have available
 | 
				
			||||||
@@ -772,7 +612,7 @@ $   THEN
 | 
				
			|||||||
$!
 | 
					$!
 | 
				
			||||||
$!    We have SOCKETSHR, and it is my opinion that it's the best to use.
 | 
					$!    We have SOCKETSHR, and it is my opinion that it's the best to use.
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$     P4 = "SOCKETSHR"
 | 
					$     P3 = "SOCKETSHR"
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$!    Tell the user
 | 
					$!    Tell the user
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
@@ -792,7 +632,7 @@ $     THEN
 | 
				
			|||||||
$!
 | 
					$!
 | 
				
			||||||
$!	Last resort: a UCX or UCX-compatible library
 | 
					$!	Last resort: a UCX or UCX-compatible library
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$	P4 = "UCX"
 | 
					$	P3 = "UCX"
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$!      Tell the user
 | 
					$!      Tell the user
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
@@ -816,12 +656,12 @@ $ IF F$TYPE(USER_CCDISABLEWARNINGS) .NES. "" THEN -
 | 
				
			|||||||
$!
 | 
					$!
 | 
				
			||||||
$!  Check To See If The User Entered A Valid Paramter.
 | 
					$!  Check To See If The User Entered A Valid Paramter.
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$ IF (P3.EQS."VAXC").OR.(P3.EQS."DECC").OR.(P3.EQS."GNUC")
 | 
					$ IF (P2.EQS."VAXC").OR.(P2.EQS."DECC").OR.(P2.EQS."GNUC")
 | 
				
			||||||
$ THEN
 | 
					$ THEN
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$!  Check To See If The User Wanted DECC.
 | 
					$!  Check To See If The User Wanted DECC.
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$   IF (P3.EQS."DECC")
 | 
					$   IF (P2.EQS."DECC")
 | 
				
			||||||
$   THEN
 | 
					$   THEN
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$!    Looks Like DECC, Set To Use DECC.
 | 
					$!    Looks Like DECC, Set To Use DECC.
 | 
				
			||||||
@@ -851,7 +691,7 @@ $   ENDIF
 | 
				
			|||||||
$!
 | 
					$!
 | 
				
			||||||
$!  Check To See If We Are To Use VAXC.
 | 
					$!  Check To See If We Are To Use VAXC.
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$   IF (P3.EQS."VAXC")
 | 
					$   IF (P2.EQS."VAXC")
 | 
				
			||||||
$   THEN
 | 
					$   THEN
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$!    Looks Like VAXC, Set To Use VAXC.
 | 
					$!    Looks Like VAXC, Set To Use VAXC.
 | 
				
			||||||
@@ -888,7 +728,7 @@ $   ENDIF
 | 
				
			|||||||
$!
 | 
					$!
 | 
				
			||||||
$!  Check To See If We Are To Use GNU C.
 | 
					$!  Check To See If We Are To Use GNU C.
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$   IF (P3.EQS."GNUC")
 | 
					$   IF (P2.EQS."GNUC")
 | 
				
			||||||
$   THEN
 | 
					$   THEN
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$!    Looks Like GNUC, Set To Use GNUC.
 | 
					$!    Looks Like GNUC, Set To Use GNUC.
 | 
				
			||||||
@@ -917,31 +757,6 @@ $!  Set up default defines
 | 
				
			|||||||
$!
 | 
					$!
 | 
				
			||||||
$   CCDEFS = """FLAT_INC=1""," + CCDEFS
 | 
					$   CCDEFS = """FLAT_INC=1""," + CCDEFS
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$!  Check To See If We Are To Compile With RSAREF Routines.
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$   IF (RSAREF.EQS."TRUE")
 | 
					 | 
				
			||||||
$   THEN
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$!    Compile With RSAREF.
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$     CCDEFS = CCDEFS + ",""RSAref=1"""
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$!    Tell The User This.
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$     WRITE SYS$OUTPUT "Compiling With RSAREF Routines."
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$!    Else, We Don't Care.  Compile Without The RSAREF Library.
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$   ELSE
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$!    Tell The User We Are Compile Without The RSAREF Routines.
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$     WRITE SYS$OUTPUT "Compiling Without The RSAREF Routines.
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$!  End The RSAREF Check.
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$   ENDIF
 | 
					 | 
				
			||||||
$!
 | 
					 | 
				
			||||||
$!  Else The User Entered An Invalid Arguement.
 | 
					$!  Else The User Entered An Invalid Arguement.
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$ ELSE
 | 
					$ ELSE
 | 
				
			||||||
@@ -949,7 +764,7 @@ $!
 | 
				
			|||||||
$!  Tell The User We Don't Know What They Want.
 | 
					$!  Tell The User We Don't Know What They Want.
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$   WRITE SYS$OUTPUT ""
 | 
					$   WRITE SYS$OUTPUT ""
 | 
				
			||||||
$   WRITE SYS$OUTPUT "The Option ",P3," Is Invalid.  The Valid Options Are:"
 | 
					$   WRITE SYS$OUTPUT "The Option ",P2," Is Invalid.  The Valid Options Are:"
 | 
				
			||||||
$   WRITE SYS$OUTPUT ""
 | 
					$   WRITE SYS$OUTPUT ""
 | 
				
			||||||
$   WRITE SYS$OUTPUT "    VAXC  :  To Compile With VAX C."
 | 
					$   WRITE SYS$OUTPUT "    VAXC  :  To Compile With VAX C."
 | 
				
			||||||
$   WRITE SYS$OUTPUT "    DECC  :  To Compile With DEC C."
 | 
					$   WRITE SYS$OUTPUT "    DECC  :  To Compile With DEC C."
 | 
				
			||||||
@@ -963,17 +778,18 @@ $ ENDIF
 | 
				
			|||||||
$!
 | 
					$!
 | 
				
			||||||
$! Time to check the contents, and to make sure we get the correct library.
 | 
					$! Time to check the contents, and to make sure we get the correct library.
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$ IF P4.EQS."SOCKETSHR" .OR. P4.EQS."MULTINET" .OR. P4.EQS."UCX"
 | 
					$ IF P3.EQS."SOCKETSHR" .OR. P3.EQS."MULTINET" .OR. P3.EQS."UCX" -
 | 
				
			||||||
 | 
					     .OR. P3.EQS."TCPIP" .OR. P3.EQS."NONE"
 | 
				
			||||||
$ THEN
 | 
					$ THEN
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$!  Check to see if SOCKETSHR was chosen
 | 
					$!  Check to see if SOCKETSHR was chosen
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$   IF P4.EQS."SOCKETSHR"
 | 
					$   IF P3.EQS."SOCKETSHR"
 | 
				
			||||||
$   THEN
 | 
					$   THEN
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$!    Set the library to use SOCKETSHR
 | 
					$!    Set the library to use SOCKETSHR
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$     TCPIP_LIB = "[-.VMS]SOCKETSHR_SHR.OPT/OPT"
 | 
					$     TCPIP_LIB = "SYS$DISK:[-.VMS]SOCKETSHR_SHR.OPT/OPT"
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$!    Done with SOCKETSHR
 | 
					$!    Done with SOCKETSHR
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
@@ -981,12 +797,12 @@ $   ENDIF
 | 
				
			|||||||
$!
 | 
					$!
 | 
				
			||||||
$!  Check to see if MULTINET was chosen
 | 
					$!  Check to see if MULTINET was chosen
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$   IF P4.EQS."MULTINET"
 | 
					$   IF P3.EQS."MULTINET"
 | 
				
			||||||
$   THEN
 | 
					$   THEN
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$!    Set the library to use UCX emulation.
 | 
					$!    Set the library to use UCX emulation.
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$     P4 = "UCX"
 | 
					$     P3 = "UCX"
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$!    Done with MULTINET
 | 
					$!    Done with MULTINET
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
@@ -994,27 +810,53 @@ $   ENDIF
 | 
				
			|||||||
$!
 | 
					$!
 | 
				
			||||||
$!  Check to see if UCX was chosen
 | 
					$!  Check to see if UCX was chosen
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$   IF P4.EQS."UCX"
 | 
					$   IF P3.EQS."UCX"
 | 
				
			||||||
$   THEN
 | 
					$   THEN
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$!    Set the library to use UCX.
 | 
					$!    Set the library to use UCX.
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$     TCPIP_LIB = "[-.VMS]UCX_SHR_DECC.OPT/OPT"
 | 
					$     TCPIP_LIB = "SYS$DISK:[-.VMS]UCX_SHR_DECC.OPT/OPT"
 | 
				
			||||||
$     IF F$TRNLNM("UCX$IPC_SHR") .NES. ""
 | 
					$     IF F$TRNLNM("UCX$IPC_SHR") .NES. ""
 | 
				
			||||||
$     THEN
 | 
					$     THEN
 | 
				
			||||||
$       TCPIP_LIB = "[-.VMS]UCX_SHR_DECC_LOG.OPT/OPT"
 | 
					$       TCPIP_LIB = "SYS$DISK:[-.VMS]UCX_SHR_DECC_LOG.OPT/OPT"
 | 
				
			||||||
$     ELSE
 | 
					$     ELSE
 | 
				
			||||||
$       IF COMPILER .NES. "DECC" .AND. ARCH .EQS. "VAX" THEN -
 | 
					$       IF COMPILER .NES. "DECC" .AND. ARCH .EQS. "VAX" THEN -
 | 
				
			||||||
	  TCPIP_LIB = "[-.VMS]UCX_SHR_VAXC.OPT/OPT"
 | 
						  TCPIP_LIB = "SYS$DISK:[-.VMS]UCX_SHR_VAXC.OPT/OPT"
 | 
				
			||||||
$     ENDIF
 | 
					$     ENDIF
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$!    Done with UCX
 | 
					$!    Done with UCX
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$   ENDIF
 | 
					$   ENDIF
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
 | 
					$!  Check to see if TCPIP (post UCX) was chosen
 | 
				
			||||||
 | 
					$!
 | 
				
			||||||
 | 
					$   IF P3.EQS."TCPIP"
 | 
				
			||||||
 | 
					$   THEN
 | 
				
			||||||
 | 
					$!
 | 
				
			||||||
 | 
					$!    Set the library to use TCPIP.
 | 
				
			||||||
 | 
					$!
 | 
				
			||||||
 | 
					$     TCPIP_LIB = "SYS$DISK:[-.VMS]TCPIP_SHR_DECC.OPT/OPT"
 | 
				
			||||||
 | 
					$!
 | 
				
			||||||
 | 
					$!    Done with TCPIP
 | 
				
			||||||
 | 
					$!
 | 
				
			||||||
 | 
					$   ENDIF
 | 
				
			||||||
 | 
					$!
 | 
				
			||||||
 | 
					$!  Check to see if NONE was chosen
 | 
				
			||||||
 | 
					$!
 | 
				
			||||||
 | 
					$   IF P3.EQS."NONE"
 | 
				
			||||||
 | 
					$   THEN
 | 
				
			||||||
 | 
					$!
 | 
				
			||||||
 | 
					$!    Do not use TCPIP.
 | 
				
			||||||
 | 
					$!
 | 
				
			||||||
 | 
					$     TCPIP_LIB = ""
 | 
				
			||||||
 | 
					$!
 | 
				
			||||||
 | 
					$!    Done with TCPIP
 | 
				
			||||||
 | 
					$!
 | 
				
			||||||
 | 
					$   ENDIF
 | 
				
			||||||
 | 
					$!
 | 
				
			||||||
$!  Add TCP/IP type to CC definitions.
 | 
					$!  Add TCP/IP type to CC definitions.
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$   CCDEFS = CCDEFS + ",TCPIP_TYPE_''P4'"
 | 
					$   CCDEFS = CCDEFS + ",TCPIP_TYPE_''P3'"
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$!  Print info
 | 
					$!  Print info
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
@@ -1027,10 +869,11 @@ $!
 | 
				
			|||||||
$!  Tell The User We Don't Know What They Want.
 | 
					$!  Tell The User We Don't Know What They Want.
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$   WRITE SYS$OUTPUT ""
 | 
					$   WRITE SYS$OUTPUT ""
 | 
				
			||||||
$   WRITE SYS$OUTPUT "The Option ",P4," Is Invalid.  The Valid Options Are:"
 | 
					$   WRITE SYS$OUTPUT "The Option ",P3," Is Invalid.  The Valid Options Are:"
 | 
				
			||||||
$   WRITE SYS$OUTPUT ""
 | 
					$   WRITE SYS$OUTPUT ""
 | 
				
			||||||
$   WRITE SYS$OUTPUT "    SOCKETSHR  :  To link with SOCKETSHR TCP/IP library."
 | 
					$   WRITE SYS$OUTPUT "    SOCKETSHR  :  To link with SOCKETSHR TCP/IP library."
 | 
				
			||||||
$   WRITE SYS$OUTPUT "    UCX        :  To link with UCX TCP/IP library."
 | 
					$   WRITE SYS$OUTPUT "    UCX        :  To link with UCX TCP/IP library."
 | 
				
			||||||
 | 
					$   WRITE SYS$OUTPUT "    TCPIP      :  To link with TCPIP (post UCX) TCP/IP library."
 | 
				
			||||||
$   WRITE SYS$OUTPUT ""
 | 
					$   WRITE SYS$OUTPUT ""
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$!  Time To EXIT.
 | 
					$!  Time To EXIT.
 | 
				
			||||||
@@ -1057,7 +900,7 @@ $ CC = CC + "/DEFINE=(" + CCDEFS + ")" + CCDISABLEWARNINGS
 | 
				
			|||||||
$!
 | 
					$!
 | 
				
			||||||
$! Show user the result
 | 
					$! Show user the result
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$ WRITE SYS$OUTPUT "Main Compiling Command: ",CC
 | 
					$ WRITE/SYMBOL SYS$OUTPUT "Main Compiling Command: ",CC
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$! Special Threads For OpenVMS v7.1 Or Later
 | 
					$! Special Threads For OpenVMS v7.1 Or Later
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
@@ -1065,9 +908,9 @@ $! Written By:  Richard Levitte
 | 
				
			|||||||
$!              richard@levitte.org
 | 
					$!              richard@levitte.org
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$! Check To See If We Have A Option For P5.
 | 
					$! Check To See If We Have A Option For P4.
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$ IF (P5.EQS."")
 | 
					$ IF (P4.EQS."")
 | 
				
			||||||
$ THEN
 | 
					$ THEN
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$!  Get The Version Of VMS We Are Using.
 | 
					$!  Get The Version Of VMS We Are Using.
 | 
				
			||||||
@@ -1089,15 +932,15 @@ $!  End The VMS Version Check.
 | 
				
			|||||||
$!
 | 
					$!
 | 
				
			||||||
$   ENDIF
 | 
					$   ENDIF
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$! End The P5 Check.
 | 
					$! End The P4 Check.
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$ ENDIF
 | 
					$ ENDIF
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$! Check if the user wanted to compile just a subset of all the programs.
 | 
					$! Check if the user wanted to compile just a subset of all the programs.
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$ IF P6 .NES. ""
 | 
					$ IF P5 .NES. ""
 | 
				
			||||||
$ THEN
 | 
					$ THEN
 | 
				
			||||||
$   PROGRAMS = P6
 | 
					$   PROGRAMS = P5
 | 
				
			||||||
$ ENDIF
 | 
					$ ENDIF
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$!  Time To RETURN...
 | 
					$!  Time To RETURN...
 | 
				
			||||||
@@ -1113,6 +956,7 @@ $!
 | 
				
			|||||||
$! Save directory information
 | 
					$! Save directory information
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
$ __HERE = F$PARSE(F$PARSE("A.;",F$ENVIRONMENT("PROCEDURE"))-"A.;","[]A.;") - "A.;"
 | 
					$ __HERE = F$PARSE(F$PARSE("A.;",F$ENVIRONMENT("PROCEDURE"))-"A.;","[]A.;") - "A.;"
 | 
				
			||||||
 | 
					$ __HERE = F$EDIT(__HERE,"UPCASE")
 | 
				
			||||||
$ __TOP = __HERE - "APPS]"
 | 
					$ __TOP = __HERE - "APPS]"
 | 
				
			||||||
$ __INCLUDE = __TOP + "INCLUDE.OPENSSL]"
 | 
					$ __INCLUDE = __TOP + "INCLUDE.OPENSSL]"
 | 
				
			||||||
$!
 | 
					$!
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -58,9 +58,9 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include <stdio.h>
 | 
					#include <stdio.h>
 | 
				
			||||||
#include <string.h>
 | 
					#include <string.h>
 | 
				
			||||||
 | 
					#include "apps.h"
 | 
				
			||||||
#include <openssl/pem.h>
 | 
					#include <openssl/pem.h>
 | 
				
			||||||
#include <openssl/err.h>
 | 
					#include <openssl/err.h>
 | 
				
			||||||
#include "apps.h"
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#undef PROG
 | 
					#undef PROG
 | 
				
			||||||
#define PROG nseq_main
 | 
					#define PROG nseq_main
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										518
									
								
								apps/ocsp.c
									
									
									
									
									
								
							
							
						
						
									
										518
									
								
								apps/ocsp.c
									
									
									
									
									
								
							@@ -58,15 +58,28 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include <stdio.h>
 | 
					#include <stdio.h>
 | 
				
			||||||
#include <string.h>
 | 
					#include <string.h>
 | 
				
			||||||
 | 
					#include "apps.h"
 | 
				
			||||||
#include <openssl/pem.h>
 | 
					#include <openssl/pem.h>
 | 
				
			||||||
#include <openssl/ocsp.h>
 | 
					#include <openssl/ocsp.h>
 | 
				
			||||||
#include <openssl/err.h>
 | 
					#include <openssl/err.h>
 | 
				
			||||||
#include <openssl/ssl.h>
 | 
					#include <openssl/ssl.h>
 | 
				
			||||||
#include "apps.h"
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Maximum leeway in validity period: default 5 minutes */
 | 
					/* Maximum leeway in validity period: default 5 minutes */
 | 
				
			||||||
#define MAX_VALIDITY_PERIOD	(5 * 60)
 | 
					#define MAX_VALIDITY_PERIOD	(5 * 60)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* CA index.txt definitions */
 | 
				
			||||||
 | 
					#define DB_type         0
 | 
				
			||||||
 | 
					#define DB_exp_date     1
 | 
				
			||||||
 | 
					#define DB_rev_date     2
 | 
				
			||||||
 | 
					#define DB_serial       3       /* index - unique */
 | 
				
			||||||
 | 
					#define DB_file         4       
 | 
				
			||||||
 | 
					#define DB_name         5       /* index - unique for active */
 | 
				
			||||||
 | 
					#define DB_NUMBER       6
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define DB_TYPE_REV	'R'
 | 
				
			||||||
 | 
					#define DB_TYPE_EXP	'E'
 | 
				
			||||||
 | 
					#define DB_TYPE_VAL	'V'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int add_ocsp_cert(OCSP_REQUEST **req, X509 *cert, X509 *issuer,
 | 
					static int add_ocsp_cert(OCSP_REQUEST **req, X509 *cert, X509 *issuer,
 | 
				
			||||||
				STACK_OF(OCSP_CERTID) *ids);
 | 
									STACK_OF(OCSP_CERTID) *ids);
 | 
				
			||||||
static int add_ocsp_serial(OCSP_REQUEST **req, char *serial, X509 *issuer,
 | 
					static int add_ocsp_serial(OCSP_REQUEST **req, char *serial, X509 *issuer,
 | 
				
			||||||
@@ -75,6 +88,16 @@ static int print_ocsp_summary(BIO *out, OCSP_BASICRESP *bs, OCSP_REQUEST *req,
 | 
				
			|||||||
				STACK *names, STACK_OF(OCSP_CERTID) *ids,
 | 
									STACK *names, STACK_OF(OCSP_CERTID) *ids,
 | 
				
			||||||
				long nsec, long maxage);
 | 
									long nsec, long maxage);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static int make_ocsp_response(OCSP_RESPONSE **resp, OCSP_REQUEST *req, TXT_DB *db,
 | 
				
			||||||
 | 
								X509 *ca, X509 *rcert, EVP_PKEY *rkey,
 | 
				
			||||||
 | 
								STACK_OF(X509) *rother, unsigned long flags,
 | 
				
			||||||
 | 
								int nmin, int ndays);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static char **lookup_serial(TXT_DB *db, ASN1_INTEGER *ser);
 | 
				
			||||||
 | 
					static BIO *init_responder(char *port);
 | 
				
			||||||
 | 
					static int do_responder(OCSP_REQUEST **preq, BIO **pcbio, BIO *acbio, char *port);
 | 
				
			||||||
 | 
					static int send_ocsp_response(BIO *cbio, OCSP_RESPONSE *resp);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#undef PROG
 | 
					#undef PROG
 | 
				
			||||||
#define PROG ocsp_main
 | 
					#define PROG ocsp_main
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -82,35 +105,49 @@ int MAIN(int, char **);
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
int MAIN(int argc, char **argv)
 | 
					int MAIN(int argc, char **argv)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
 | 
						ENGINE *e = NULL;
 | 
				
			||||||
	char **args;
 | 
						char **args;
 | 
				
			||||||
	char *host = NULL, *port = NULL, *path = "/";
 | 
						char *host = NULL, *port = NULL, *path = "/";
 | 
				
			||||||
	char *reqin = NULL, *respin = NULL;
 | 
						char *reqin = NULL, *respin = NULL;
 | 
				
			||||||
	char *reqout = NULL, *respout = NULL;
 | 
						char *reqout = NULL, *respout = NULL;
 | 
				
			||||||
	char *signfile = NULL, *keyfile = NULL;
 | 
						char *signfile = NULL, *keyfile = NULL;
 | 
				
			||||||
 | 
						char *rsignfile = NULL, *rkeyfile = NULL;
 | 
				
			||||||
	char *outfile = NULL;
 | 
						char *outfile = NULL;
 | 
				
			||||||
	int add_nonce = 1, noverify = 0, use_ssl = -1;
 | 
						int add_nonce = 1, noverify = 0, use_ssl = -1;
 | 
				
			||||||
	OCSP_REQUEST *req = NULL;
 | 
						OCSP_REQUEST *req = NULL;
 | 
				
			||||||
	OCSP_RESPONSE *resp = NULL;
 | 
						OCSP_RESPONSE *resp = NULL;
 | 
				
			||||||
	OCSP_BASICRESP *bs = NULL;
 | 
						OCSP_BASICRESP *bs = NULL;
 | 
				
			||||||
	X509 *issuer = NULL, *cert = NULL;
 | 
						X509 *issuer = NULL, *cert = NULL;
 | 
				
			||||||
	X509 *signer = NULL;
 | 
						X509 *signer = NULL, *rsigner = NULL;
 | 
				
			||||||
	EVP_PKEY *key = NULL;
 | 
						EVP_PKEY *key = NULL, *rkey = NULL;
 | 
				
			||||||
	BIO *cbio = NULL, *derbio = NULL;
 | 
						BIO *acbio = NULL, *cbio = NULL;
 | 
				
			||||||
 | 
						BIO *derbio = NULL;
 | 
				
			||||||
	BIO *out = NULL;
 | 
						BIO *out = NULL;
 | 
				
			||||||
	int req_text = 0, resp_text = 0;
 | 
						int req_text = 0, resp_text = 0;
 | 
				
			||||||
	long nsec = MAX_VALIDITY_PERIOD, maxage = -1;
 | 
						long nsec = MAX_VALIDITY_PERIOD, maxage = -1;
 | 
				
			||||||
	char *CAfile = NULL, *CApath = NULL;
 | 
						char *CAfile = NULL, *CApath = NULL;
 | 
				
			||||||
	X509_STORE *store = NULL;
 | 
						X509_STORE *store = NULL;
 | 
				
			||||||
	SSL_CTX *ctx = NULL;
 | 
						SSL_CTX *ctx = NULL;
 | 
				
			||||||
	STACK_OF(X509) *sign_other = NULL, *verify_other = NULL;
 | 
						STACK_OF(X509) *sign_other = NULL, *verify_other = NULL, *rother = NULL;
 | 
				
			||||||
	char *sign_certfile = NULL, *verify_certfile = NULL;
 | 
						char *sign_certfile = NULL, *verify_certfile = NULL, *rcertfile = NULL;
 | 
				
			||||||
	unsigned long sign_flags = 0, verify_flags = 0;
 | 
						unsigned long sign_flags = 0, verify_flags = 0, rflags = 0;
 | 
				
			||||||
	int ret = 1;
 | 
						int ret = 1;
 | 
				
			||||||
 | 
						int accept_count = -1;
 | 
				
			||||||
	int badarg = 0;
 | 
						int badarg = 0;
 | 
				
			||||||
	int i;
 | 
						int i;
 | 
				
			||||||
	STACK *reqnames = NULL;
 | 
						STACK *reqnames = NULL;
 | 
				
			||||||
	STACK_OF(OCSP_CERTID) *ids = NULL;
 | 
						STACK_OF(OCSP_CERTID) *ids = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						X509 *rca_cert = NULL;
 | 
				
			||||||
 | 
						char *ridx_filename = NULL;
 | 
				
			||||||
 | 
						char *rca_filename = NULL;
 | 
				
			||||||
 | 
						TXT_DB *rdb = NULL;
 | 
				
			||||||
 | 
						int nmin = 0, ndays = -1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (bio_err == NULL) bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
 | 
						if (bio_err == NULL) bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!load_config(bio_err, NULL))
 | 
				
			||||||
 | 
							goto end;
 | 
				
			||||||
	SSL_load_error_strings();
 | 
						SSL_load_error_strings();
 | 
				
			||||||
	args = argv + 1;
 | 
						args = argv + 1;
 | 
				
			||||||
	reqnames = sk_new_null();
 | 
						reqnames = sk_new_null();
 | 
				
			||||||
@@ -148,12 +185,25 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
				}
 | 
									}
 | 
				
			||||||
			else badarg = 1;
 | 
								else badarg = 1;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
							else if (!strcmp(*args, "-port"))
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								if (args[1])
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
									args++;
 | 
				
			||||||
 | 
									port = *args;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								else badarg = 1;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
		else if (!strcmp(*args, "-noverify"))
 | 
							else if (!strcmp(*args, "-noverify"))
 | 
				
			||||||
			noverify = 1;
 | 
								noverify = 1;
 | 
				
			||||||
		else if (!strcmp(*args, "-nonce"))
 | 
							else if (!strcmp(*args, "-nonce"))
 | 
				
			||||||
			add_nonce = 2;
 | 
								add_nonce = 2;
 | 
				
			||||||
		else if (!strcmp(*args, "-no_nonce"))
 | 
							else if (!strcmp(*args, "-no_nonce"))
 | 
				
			||||||
			add_nonce = 0;
 | 
								add_nonce = 0;
 | 
				
			||||||
 | 
							else if (!strcmp(*args, "-resp_no_certs"))
 | 
				
			||||||
 | 
								rflags |= OCSP_NOCERTS;
 | 
				
			||||||
 | 
							else if (!strcmp(*args, "-resp_key_id"))
 | 
				
			||||||
 | 
								rflags |= OCSP_RESPID_KEY;
 | 
				
			||||||
		else if (!strcmp(*args, "-no_certs"))
 | 
							else if (!strcmp(*args, "-no_certs"))
 | 
				
			||||||
			sign_flags |= OCSP_NOCERTS;
 | 
								sign_flags |= OCSP_NOCERTS;
 | 
				
			||||||
		else if (!strcmp(*args, "-no_signature_verify"))
 | 
							else if (!strcmp(*args, "-no_signature_verify"))
 | 
				
			||||||
@@ -326,7 +376,8 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
				{
 | 
									{
 | 
				
			||||||
				args++;
 | 
									args++;
 | 
				
			||||||
				X509_free(issuer);
 | 
									X509_free(issuer);
 | 
				
			||||||
				issuer = load_cert(bio_err, *args, FORMAT_PEM);
 | 
									issuer = load_cert(bio_err, *args, FORMAT_PEM,
 | 
				
			||||||
 | 
										NULL, e, "issuer certificate");
 | 
				
			||||||
				if(!issuer) goto end;
 | 
									if(!issuer) goto end;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			else badarg = 1;
 | 
								else badarg = 1;
 | 
				
			||||||
@@ -337,7 +388,8 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
				{
 | 
									{
 | 
				
			||||||
				args++;
 | 
									args++;
 | 
				
			||||||
				X509_free(cert);
 | 
									X509_free(cert);
 | 
				
			||||||
				cert = load_cert(bio_err, *args, FORMAT_PEM);
 | 
									cert = load_cert(bio_err, *args, FORMAT_PEM,
 | 
				
			||||||
 | 
										NULL, e, "certificate");
 | 
				
			||||||
				if(!cert) goto end;
 | 
									if(!cert) goto end;
 | 
				
			||||||
				if(!add_ocsp_cert(&req, cert, issuer, ids))
 | 
									if(!add_ocsp_cert(&req, cert, issuer, ids))
 | 
				
			||||||
					goto end;
 | 
										goto end;
 | 
				
			||||||
@@ -358,12 +410,107 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
				}
 | 
									}
 | 
				
			||||||
			else badarg = 1;
 | 
								else badarg = 1;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
							else if (!strcmp(*args, "-index"))
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								if (args[1])
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
									args++;
 | 
				
			||||||
 | 
									ridx_filename = *args;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								else badarg = 1;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							else if (!strcmp(*args, "-CA"))
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								if (args[1])
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
									args++;
 | 
				
			||||||
 | 
									rca_filename = *args;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								else badarg = 1;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							else if (!strcmp (*args, "-nmin"))
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								if (args[1])
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
									args++;
 | 
				
			||||||
 | 
									nmin = atol(*args);
 | 
				
			||||||
 | 
									if (nmin < 0)
 | 
				
			||||||
 | 
										{
 | 
				
			||||||
 | 
										BIO_printf(bio_err,
 | 
				
			||||||
 | 
											"Illegal update period %s\n",
 | 
				
			||||||
 | 
											*args);
 | 
				
			||||||
 | 
										badarg = 1;
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									if (ndays == -1)
 | 
				
			||||||
 | 
										ndays = 0;
 | 
				
			||||||
 | 
								else badarg = 1;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							else if (!strcmp (*args, "-nrequest"))
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								if (args[1])
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
									args++;
 | 
				
			||||||
 | 
									accept_count = atol(*args);
 | 
				
			||||||
 | 
									if (accept_count < 0)
 | 
				
			||||||
 | 
										{
 | 
				
			||||||
 | 
										BIO_printf(bio_err,
 | 
				
			||||||
 | 
											"Illegal accept count %s\n",
 | 
				
			||||||
 | 
											*args);
 | 
				
			||||||
 | 
										badarg = 1;
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								else badarg = 1;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							else if (!strcmp (*args, "-ndays"))
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								if (args[1])
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
									args++;
 | 
				
			||||||
 | 
									ndays = atol(*args);
 | 
				
			||||||
 | 
									if (ndays < 0)
 | 
				
			||||||
 | 
										{
 | 
				
			||||||
 | 
										BIO_printf(bio_err,
 | 
				
			||||||
 | 
											"Illegal update period %s\n",
 | 
				
			||||||
 | 
											*args);
 | 
				
			||||||
 | 
										badarg = 1;
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								else badarg = 1;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							else if (!strcmp(*args, "-rsigner"))
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								if (args[1])
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
									args++;
 | 
				
			||||||
 | 
									rsignfile = *args;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								else badarg = 1;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							else if (!strcmp(*args, "-rkey"))
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								if (args[1])
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
									args++;
 | 
				
			||||||
 | 
									rkeyfile = *args;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								else badarg = 1;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							else if (!strcmp(*args, "-rother"))
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								if (args[1])
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
									args++;
 | 
				
			||||||
 | 
									rcertfile = *args;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								else badarg = 1;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
		else badarg = 1;
 | 
							else badarg = 1;
 | 
				
			||||||
		args++;
 | 
							args++;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Have we anything to do? */
 | 
						/* Have we anything to do? */
 | 
				
			||||||
	if (!req && !reqin && !respin) badarg = 1;
 | 
						if (!req && !reqin && !respin && !(port && ridx_filename)) badarg = 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (badarg)
 | 
						if (badarg)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
@@ -403,6 +550,17 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
		BIO_printf (bio_err, "-no_cert_verify    don't check signing certificate\n");
 | 
							BIO_printf (bio_err, "-no_cert_verify    don't check signing certificate\n");
 | 
				
			||||||
		BIO_printf (bio_err, "-no_chain          don't chain verify response\n");
 | 
							BIO_printf (bio_err, "-no_chain          don't chain verify response\n");
 | 
				
			||||||
		BIO_printf (bio_err, "-no_cert_checks    don't do additional checks on signing certificate\n");
 | 
							BIO_printf (bio_err, "-no_cert_checks    don't do additional checks on signing certificate\n");
 | 
				
			||||||
 | 
							BIO_printf (bio_err, "-port num		 port to run responder on\n");
 | 
				
			||||||
 | 
							BIO_printf (bio_err, "-index file	 certificate status index file\n");
 | 
				
			||||||
 | 
							BIO_printf (bio_err, "-CA file		 CA certificate\n");
 | 
				
			||||||
 | 
							BIO_printf (bio_err, "-rsigner file	 responder certificate to sign responses with\n");
 | 
				
			||||||
 | 
							BIO_printf (bio_err, "-rkey file	 responder key to sign responses with\n");
 | 
				
			||||||
 | 
							BIO_printf (bio_err, "-rother file	 other certificates to include in response\n");
 | 
				
			||||||
 | 
							BIO_printf (bio_err, "-resp_no_certs     don't include any certificates in response\n");
 | 
				
			||||||
 | 
							BIO_printf (bio_err, "-nmin n	 	 number of minutes before next update\n");
 | 
				
			||||||
 | 
							BIO_printf (bio_err, "-ndays n	 	 number of days before next update\n");
 | 
				
			||||||
 | 
							BIO_printf (bio_err, "-resp_key_id       identify reponse by signing certificate key ID\n");
 | 
				
			||||||
 | 
							BIO_printf (bio_err, "-nrequest n        number of requests to accept (default unlimited)\n");
 | 
				
			||||||
		goto end;
 | 
							goto end;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -434,7 +592,54 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!req && (signfile || reqout || host || add_nonce))
 | 
						if (!req && port)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							acbio = init_responder(port);
 | 
				
			||||||
 | 
							if (!acbio)
 | 
				
			||||||
 | 
								goto end;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (rsignfile && !rdb)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							if (!rkeyfile) rkeyfile = rsignfile;
 | 
				
			||||||
 | 
							rsigner = load_cert(bio_err, rsignfile, FORMAT_PEM,
 | 
				
			||||||
 | 
								NULL, e, "responder certificate");
 | 
				
			||||||
 | 
							if (!rsigner)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								BIO_printf(bio_err, "Error loading responder certificate\n");
 | 
				
			||||||
 | 
								goto end;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							rca_cert = load_cert(bio_err, rca_filename, FORMAT_PEM,
 | 
				
			||||||
 | 
								NULL, e, "CA certificate");
 | 
				
			||||||
 | 
							if (rcertfile)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								rother = load_certs(bio_err, rcertfile, FORMAT_PEM,
 | 
				
			||||||
 | 
									NULL, e, "responder other certificates");
 | 
				
			||||||
 | 
								if (!rother) goto end;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							rkey = load_key(bio_err, rkeyfile, FORMAT_PEM, 0, NULL, NULL,
 | 
				
			||||||
 | 
								"responder private key");
 | 
				
			||||||
 | 
							if (!rkey)
 | 
				
			||||||
 | 
								goto end;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						if(acbio)
 | 
				
			||||||
 | 
							BIO_printf(bio_err, "Waiting for OCSP client connections...\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						redo_accept:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (acbio)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							if (!do_responder(&req, &cbio, acbio, port))
 | 
				
			||||||
 | 
								goto end;
 | 
				
			||||||
 | 
							if (!req)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								resp = OCSP_response_create(OCSP_RESPONSE_STATUS_MALFORMEDREQUEST, NULL);
 | 
				
			||||||
 | 
								send_ocsp_response(cbio, resp);
 | 
				
			||||||
 | 
								goto done_resp;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!req && (signfile || reqout || host || add_nonce || ridx_filename))
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		BIO_printf(bio_err, "Need an OCSP request for this operation!\n");
 | 
							BIO_printf(bio_err, "Need an OCSP request for this operation!\n");
 | 
				
			||||||
		goto end;
 | 
							goto end;
 | 
				
			||||||
@@ -445,7 +650,8 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
	if (signfile)
 | 
						if (signfile)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		if (!keyfile) keyfile = signfile;
 | 
							if (!keyfile) keyfile = signfile;
 | 
				
			||||||
		signer = load_cert(bio_err, signfile, FORMAT_PEM);
 | 
							signer = load_cert(bio_err, signfile, FORMAT_PEM,
 | 
				
			||||||
 | 
								NULL, e, "signer certificate");
 | 
				
			||||||
		if (!signer)
 | 
							if (!signer)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
			BIO_printf(bio_err, "Error loading signer certificate\n");
 | 
								BIO_printf(bio_err, "Error loading signer certificate\n");
 | 
				
			||||||
@@ -453,15 +659,14 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
		if (sign_certfile)
 | 
							if (sign_certfile)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
			sign_other = load_certs(bio_err, sign_certfile, FORMAT_PEM);
 | 
								sign_other = load_certs(bio_err, sign_certfile, FORMAT_PEM,
 | 
				
			||||||
 | 
									NULL, e, "signer certificates");
 | 
				
			||||||
			if (!sign_other) goto end;
 | 
								if (!sign_other) goto end;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		key = load_key(bio_err, keyfile, FORMAT_PEM, NULL, NULL);
 | 
							key = load_key(bio_err, keyfile, FORMAT_PEM, 0, NULL, NULL,
 | 
				
			||||||
 | 
								"signer private key");
 | 
				
			||||||
		if (!key)
 | 
							if (!key)
 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			BIO_printf(bio_err, "Error loading signer private key\n");
 | 
					 | 
				
			||||||
			goto end;
 | 
								goto end;
 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		if (!OCSP_request_sign(req, signer, key, EVP_sha1(), sign_other, sign_flags))
 | 
							if (!OCSP_request_sign(req, signer, key, EVP_sha1(), sign_other, sign_flags))
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
			BIO_printf(bio_err, "Error signing OCSP request\n");
 | 
								BIO_printf(bio_err, "Error signing OCSP request\n");
 | 
				
			||||||
@@ -469,10 +674,12 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (req_text && req) OCSP_REQUEST_print(out, req, 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (reqout)
 | 
						if (reqout)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		derbio = BIO_new_file(reqout, "wb");
 | 
							derbio = BIO_new_file(reqout, "wb");
 | 
				
			||||||
		if (!derbio)
 | 
							if(!derbio)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
			BIO_printf(bio_err, "Error opening file %s\n", reqout);
 | 
								BIO_printf(bio_err, "Error opening file %s\n", reqout);
 | 
				
			||||||
			goto end;
 | 
								goto end;
 | 
				
			||||||
@@ -481,9 +688,39 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
		BIO_free(derbio);
 | 
							BIO_free(derbio);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (req_text && req) OCSP_REQUEST_print(out, req, 0);
 | 
						if (ridx_filename && (!rkey || !rsigner || !rca_cert))
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							BIO_printf(bio_err, "Need a responder certificate, key and CA for this operation!\n");
 | 
				
			||||||
 | 
							goto end;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (host)
 | 
						if (ridx_filename && !rdb)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							BIO *db_bio = NULL;
 | 
				
			||||||
 | 
							db_bio = BIO_new_file(ridx_filename, "r");
 | 
				
			||||||
 | 
							if (!db_bio)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								BIO_printf(bio_err, "Error opening index file %s\n", ridx_filename);
 | 
				
			||||||
 | 
								goto end;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							rdb = TXT_DB_read(db_bio, DB_NUMBER);
 | 
				
			||||||
 | 
							BIO_free(db_bio);
 | 
				
			||||||
 | 
							if (!rdb)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								BIO_printf(bio_err, "Error reading index file %s\n", ridx_filename);
 | 
				
			||||||
 | 
								goto end;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							if (!make_serial_index(rdb))
 | 
				
			||||||
 | 
								goto end;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (rdb)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							i = make_ocsp_response(&resp, req, rdb, rca_cert, rsigner, rkey, rother, rflags, nmin, ndays);
 | 
				
			||||||
 | 
							if (cbio)
 | 
				
			||||||
 | 
								send_ocsp_response(cbio, resp);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						else if (host)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		cbio = BIO_new_connect(host);
 | 
							cbio = BIO_new_connect(host);
 | 
				
			||||||
		if (!cbio)
 | 
							if (!cbio)
 | 
				
			||||||
@@ -537,6 +774,8 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
		goto end;
 | 
							goto end;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						done_resp:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (respout)
 | 
						if (respout)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		derbio = BIO_new_file(respout, "wb");
 | 
							derbio = BIO_new_file(respout, "wb");
 | 
				
			||||||
@@ -561,11 +800,33 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if (resp_text) OCSP_RESPONSE_print(out, resp, 0);
 | 
						if (resp_text) OCSP_RESPONSE_print(out, resp, 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	store = setup_verify(bio_err, CAfile, CApath);
 | 
						/* If running as responder don't verify our own response */
 | 
				
			||||||
	if(!store) goto end;
 | 
						if (cbio)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							if (accept_count > 0)
 | 
				
			||||||
 | 
								accept_count--;
 | 
				
			||||||
 | 
							/* Redo if more connections needed */
 | 
				
			||||||
 | 
							if (accept_count)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								BIO_free_all(cbio);
 | 
				
			||||||
 | 
								cbio = NULL;
 | 
				
			||||||
 | 
								OCSP_REQUEST_free(req);
 | 
				
			||||||
 | 
								req = NULL;
 | 
				
			||||||
 | 
								OCSP_RESPONSE_free(resp);
 | 
				
			||||||
 | 
								resp = NULL;
 | 
				
			||||||
 | 
								goto redo_accept;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							goto end;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!store)
 | 
				
			||||||
 | 
							store = setup_verify(bio_err, CAfile, CApath);
 | 
				
			||||||
 | 
						if (!store)
 | 
				
			||||||
 | 
							goto end;
 | 
				
			||||||
	if (verify_certfile)
 | 
						if (verify_certfile)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		verify_other = load_certs(bio_err, verify_certfile, FORMAT_PEM);
 | 
							verify_other = load_certs(bio_err, verify_certfile, FORMAT_PEM,
 | 
				
			||||||
 | 
								NULL, e, "validator certificate");
 | 
				
			||||||
		if (!verify_other) goto end;
 | 
							if (!verify_other) goto end;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -613,9 +874,14 @@ end:
 | 
				
			|||||||
	X509_free(signer);
 | 
						X509_free(signer);
 | 
				
			||||||
	X509_STORE_free(store);
 | 
						X509_STORE_free(store);
 | 
				
			||||||
	EVP_PKEY_free(key);
 | 
						EVP_PKEY_free(key);
 | 
				
			||||||
 | 
						EVP_PKEY_free(rkey);
 | 
				
			||||||
	X509_free(issuer);
 | 
						X509_free(issuer);
 | 
				
			||||||
	X509_free(cert);
 | 
						X509_free(cert);
 | 
				
			||||||
 | 
						X509_free(rsigner);
 | 
				
			||||||
 | 
						X509_free(rca_cert);
 | 
				
			||||||
 | 
						TXT_DB_free(rdb);
 | 
				
			||||||
	BIO_free_all(cbio);
 | 
						BIO_free_all(cbio);
 | 
				
			||||||
 | 
						BIO_free_all(acbio);
 | 
				
			||||||
	BIO_free(out);
 | 
						BIO_free(out);
 | 
				
			||||||
	OCSP_REQUEST_free(req);
 | 
						OCSP_REQUEST_free(req);
 | 
				
			||||||
	OCSP_RESPONSE_free(resp);
 | 
						OCSP_RESPONSE_free(resp);
 | 
				
			||||||
@@ -754,3 +1020,209 @@ static int print_ocsp_summary(BIO *out, OCSP_BASICRESP *bs, OCSP_REQUEST *req,
 | 
				
			|||||||
	return 1;
 | 
						return 1;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static int make_ocsp_response(OCSP_RESPONSE **resp, OCSP_REQUEST *req, TXT_DB *db,
 | 
				
			||||||
 | 
								X509 *ca, X509 *rcert, EVP_PKEY *rkey,
 | 
				
			||||||
 | 
								STACK_OF(X509) *rother, unsigned long flags,
 | 
				
			||||||
 | 
								int nmin, int ndays)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						ASN1_TIME *thisupd = NULL, *nextupd = NULL;
 | 
				
			||||||
 | 
						OCSP_CERTID *cid, *ca_id = NULL;
 | 
				
			||||||
 | 
						OCSP_BASICRESP *bs = NULL;
 | 
				
			||||||
 | 
						int i, id_count, ret = 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						id_count = OCSP_request_onereq_count(req);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (id_count <= 0)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							*resp = OCSP_response_create(OCSP_RESPONSE_STATUS_MALFORMEDREQUEST, NULL);
 | 
				
			||||||
 | 
							goto end;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						ca_id = OCSP_cert_to_id(EVP_sha1(), NULL, ca);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						bs = OCSP_BASICRESP_new();
 | 
				
			||||||
 | 
						thisupd = X509_gmtime_adj(NULL, 0);
 | 
				
			||||||
 | 
						if (ndays != -1)
 | 
				
			||||||
 | 
							nextupd = X509_gmtime_adj(NULL, nmin * 60 + ndays * 3600 * 24 );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* Examine each certificate id in the request */
 | 
				
			||||||
 | 
						for (i = 0; i < id_count; i++)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							OCSP_ONEREQ *one;
 | 
				
			||||||
 | 
							ASN1_INTEGER *serial;
 | 
				
			||||||
 | 
							char **inf;
 | 
				
			||||||
 | 
							one = OCSP_request_onereq_get0(req, i);
 | 
				
			||||||
 | 
							cid = OCSP_onereq_get0_id(one);
 | 
				
			||||||
 | 
							/* Is this request about our CA? */
 | 
				
			||||||
 | 
							if (OCSP_id_issuer_cmp(ca_id, cid))
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								OCSP_basic_add1_status(bs, cid,
 | 
				
			||||||
 | 
											V_OCSP_CERTSTATUS_UNKNOWN,
 | 
				
			||||||
 | 
											0, NULL,
 | 
				
			||||||
 | 
											thisupd, nextupd);
 | 
				
			||||||
 | 
								continue;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							OCSP_id_get0_info(NULL, NULL, NULL, &serial, cid);
 | 
				
			||||||
 | 
							inf = lookup_serial(db, serial);
 | 
				
			||||||
 | 
							if (!inf)
 | 
				
			||||||
 | 
								OCSP_basic_add1_status(bs, cid,
 | 
				
			||||||
 | 
											V_OCSP_CERTSTATUS_UNKNOWN,
 | 
				
			||||||
 | 
											0, NULL,
 | 
				
			||||||
 | 
											thisupd, nextupd);
 | 
				
			||||||
 | 
							else if (inf[DB_type][0] == DB_TYPE_VAL)
 | 
				
			||||||
 | 
								OCSP_basic_add1_status(bs, cid,
 | 
				
			||||||
 | 
											V_OCSP_CERTSTATUS_GOOD,
 | 
				
			||||||
 | 
											0, NULL,
 | 
				
			||||||
 | 
											thisupd, nextupd);
 | 
				
			||||||
 | 
							else if (inf[DB_type][0] == DB_TYPE_REV)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								ASN1_OBJECT *inst = NULL;
 | 
				
			||||||
 | 
								ASN1_TIME *revtm = NULL;
 | 
				
			||||||
 | 
								ASN1_GENERALIZEDTIME *invtm = NULL;
 | 
				
			||||||
 | 
								OCSP_SINGLERESP *single;
 | 
				
			||||||
 | 
								int reason = -1;
 | 
				
			||||||
 | 
								unpack_revinfo(&revtm, &reason, &inst, &invtm, inf[DB_rev_date]);
 | 
				
			||||||
 | 
								single = OCSP_basic_add1_status(bs, cid,
 | 
				
			||||||
 | 
											V_OCSP_CERTSTATUS_REVOKED,
 | 
				
			||||||
 | 
											reason, revtm,
 | 
				
			||||||
 | 
											thisupd, nextupd);
 | 
				
			||||||
 | 
								if (invtm)
 | 
				
			||||||
 | 
									OCSP_SINGLERESP_add1_ext_i2d(single, NID_invalidity_date, invtm, 0, 0);
 | 
				
			||||||
 | 
								else if (inst)
 | 
				
			||||||
 | 
									OCSP_SINGLERESP_add1_ext_i2d(single, NID_hold_instruction_code, inst, 0, 0);
 | 
				
			||||||
 | 
								ASN1_OBJECT_free(inst);
 | 
				
			||||||
 | 
								ASN1_TIME_free(revtm);
 | 
				
			||||||
 | 
								ASN1_GENERALIZEDTIME_free(invtm);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						OCSP_copy_nonce(bs, req);
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
						OCSP_basic_sign(bs, rcert, rkey, EVP_sha1(), rother, flags);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						*resp = OCSP_response_create(OCSP_RESPONSE_STATUS_SUCCESSFUL, bs);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						end:
 | 
				
			||||||
 | 
						ASN1_TIME_free(thisupd);
 | 
				
			||||||
 | 
						ASN1_TIME_free(nextupd);
 | 
				
			||||||
 | 
						OCSP_CERTID_free(ca_id);
 | 
				
			||||||
 | 
						OCSP_BASICRESP_free(bs);
 | 
				
			||||||
 | 
						return ret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static char **lookup_serial(TXT_DB *db, ASN1_INTEGER *ser)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						int i;
 | 
				
			||||||
 | 
						BIGNUM *bn = NULL;
 | 
				
			||||||
 | 
						char *itmp, *row[DB_NUMBER],**rrow;
 | 
				
			||||||
 | 
						for (i = 0; i < DB_NUMBER; i++) row[i] = NULL;
 | 
				
			||||||
 | 
						bn = ASN1_INTEGER_to_BN(ser,NULL);
 | 
				
			||||||
 | 
						if (BN_is_zero(bn))
 | 
				
			||||||
 | 
							itmp = BUF_strdup("00");
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
							itmp = BN_bn2hex(bn);
 | 
				
			||||||
 | 
						row[DB_serial] = itmp;
 | 
				
			||||||
 | 
						BN_free(bn);
 | 
				
			||||||
 | 
						rrow=TXT_DB_get_by_index(db,DB_serial,row);
 | 
				
			||||||
 | 
						OPENSSL_free(itmp);
 | 
				
			||||||
 | 
						return rrow;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Quick and dirty OCSP server: read in and parse input request */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static BIO *init_responder(char *port)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						BIO *acbio = NULL, *bufbio = NULL;
 | 
				
			||||||
 | 
						bufbio = BIO_new(BIO_f_buffer());
 | 
				
			||||||
 | 
						if (!bufbio) 
 | 
				
			||||||
 | 
							goto err;
 | 
				
			||||||
 | 
						acbio = BIO_new_accept(port);
 | 
				
			||||||
 | 
						if (!acbio)
 | 
				
			||||||
 | 
							goto err;
 | 
				
			||||||
 | 
						BIO_set_accept_bios(acbio, bufbio);
 | 
				
			||||||
 | 
						bufbio = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (BIO_do_accept(acbio) <= 0)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								BIO_printf(bio_err, "Error setting up accept BIO\n");
 | 
				
			||||||
 | 
								ERR_print_errors(bio_err);
 | 
				
			||||||
 | 
								goto err;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return acbio;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						err:
 | 
				
			||||||
 | 
						BIO_free_all(acbio);
 | 
				
			||||||
 | 
						BIO_free(bufbio);
 | 
				
			||||||
 | 
						return NULL;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static int do_responder(OCSP_REQUEST **preq, BIO **pcbio, BIO *acbio, char *port)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						int have_post = 0, len;
 | 
				
			||||||
 | 
						OCSP_REQUEST *req = NULL;
 | 
				
			||||||
 | 
						char inbuf[1024];
 | 
				
			||||||
 | 
						BIO *cbio = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (BIO_do_accept(acbio) <= 0)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								BIO_printf(bio_err, "Error accepting connection\n");
 | 
				
			||||||
 | 
								ERR_print_errors(bio_err);
 | 
				
			||||||
 | 
								return 0;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						cbio = BIO_pop(acbio);
 | 
				
			||||||
 | 
						*pcbio = cbio;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						for(;;)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							len = BIO_gets(cbio, inbuf, sizeof inbuf);
 | 
				
			||||||
 | 
							if (len <= 0)
 | 
				
			||||||
 | 
								return 1;
 | 
				
			||||||
 | 
							/* Look for "POST" signalling start of query */
 | 
				
			||||||
 | 
							if (!have_post)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								if(strncmp(inbuf, "POST", 4))
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
									BIO_printf(bio_err, "Invalid request\n");
 | 
				
			||||||
 | 
									return 1;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								have_post = 1;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							/* Look for end of headers */
 | 
				
			||||||
 | 
							if ((inbuf[0] == '\r') || (inbuf[0] == '\n'))
 | 
				
			||||||
 | 
								break;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* Try to read OCSP request */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						req = d2i_OCSP_REQUEST_bio(cbio, NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!req)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							BIO_printf(bio_err, "Error parsing OCSP request\n");
 | 
				
			||||||
 | 
							ERR_print_errors(bio_err);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						*preq = req;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static int send_ocsp_response(BIO *cbio, OCSP_RESPONSE *resp)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						char http_resp[] = 
 | 
				
			||||||
 | 
							"HTTP/1.0 200 OK\r\nContent-type: application/ocsp-response\r\n"
 | 
				
			||||||
 | 
							"Content-Length: %d\r\n\r\n";
 | 
				
			||||||
 | 
						if (!cbio)
 | 
				
			||||||
 | 
							return 0;
 | 
				
			||||||
 | 
						BIO_printf(cbio, http_resp, i2d_OCSP_RESPONSE(resp, NULL));
 | 
				
			||||||
 | 
						i2d_OCSP_RESPONSE_bio(cbio, resp);
 | 
				
			||||||
 | 
						BIO_flush(cbio);
 | 
				
			||||||
 | 
						return 1;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -56,7 +56,7 @@
 | 
				
			|||||||
 * [including the GNU Public Licence.]
 | 
					 * [including the GNU Public Licence.]
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
/* ====================================================================
 | 
					/* ====================================================================
 | 
				
			||||||
 * Copyright (c) 1998-2000 The OpenSSL Project.  All rights reserved.
 | 
					 * Copyright (c) 1998-2001 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
 | 
				
			||||||
@@ -114,6 +114,7 @@
 | 
				
			|||||||
#include <string.h>
 | 
					#include <string.h>
 | 
				
			||||||
#include <stdlib.h>
 | 
					#include <stdlib.h>
 | 
				
			||||||
#define OPENSSL_C /* tells apps.h to use complete apps_startup() */
 | 
					#define OPENSSL_C /* tells apps.h to use complete apps_startup() */
 | 
				
			||||||
 | 
					#include "apps.h"
 | 
				
			||||||
#include <openssl/bio.h>
 | 
					#include <openssl/bio.h>
 | 
				
			||||||
#include <openssl/crypto.h>
 | 
					#include <openssl/crypto.h>
 | 
				
			||||||
#include <openssl/lhash.h>
 | 
					#include <openssl/lhash.h>
 | 
				
			||||||
@@ -121,8 +122,8 @@
 | 
				
			|||||||
#include <openssl/x509.h>
 | 
					#include <openssl/x509.h>
 | 
				
			||||||
#include <openssl/pem.h>
 | 
					#include <openssl/pem.h>
 | 
				
			||||||
#include <openssl/ssl.h>
 | 
					#include <openssl/ssl.h>
 | 
				
			||||||
 | 
					#include <openssl/engine.h>
 | 
				
			||||||
#define USE_SOCKETS /* needed for the _O_BINARY defs in the MS world */
 | 
					#define USE_SOCKETS /* needed for the _O_BINARY defs in the MS world */
 | 
				
			||||||
#include "apps.h"
 | 
					 | 
				
			||||||
#include "progs.h"
 | 
					#include "progs.h"
 | 
				
			||||||
#include "s_apps.h"
 | 
					#include "s_apps.h"
 | 
				
			||||||
#include <openssl/err.h>
 | 
					#include <openssl/err.h>
 | 
				
			||||||
@@ -138,11 +139,11 @@ static unsigned long MS_CALLBACK hash(const void *a_void);
 | 
				
			|||||||
static int MS_CALLBACK cmp(const void *a_void,const void *b_void);
 | 
					static int MS_CALLBACK cmp(const void *a_void,const void *b_void);
 | 
				
			||||||
static LHASH *prog_init(void );
 | 
					static LHASH *prog_init(void );
 | 
				
			||||||
static int do_cmd(LHASH *prog,int argc,char *argv[]);
 | 
					static int do_cmd(LHASH *prog,int argc,char *argv[]);
 | 
				
			||||||
LHASH *config=NULL;
 | 
					 | 
				
			||||||
char *default_config_file=NULL;
 | 
					char *default_config_file=NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Make sure there is only one when MONOLITH is defined */
 | 
					/* Make sure there is only one when MONOLITH is defined */
 | 
				
			||||||
#ifdef MONOLITH
 | 
					#ifdef MONOLITH
 | 
				
			||||||
 | 
					CONF *config=NULL;
 | 
				
			||||||
BIO *bio_err=NULL;
 | 
					BIO *bio_err=NULL;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -214,10 +215,11 @@ static void lock_dbg_cb(int mode, int type, const char *file, int line)
 | 
				
			|||||||
int main(int Argc, char *Argv[])
 | 
					int main(int Argc, char *Argv[])
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	ARGS arg;
 | 
						ARGS arg;
 | 
				
			||||||
#define PROG_NAME_SIZE	16
 | 
					#define PROG_NAME_SIZE	39
 | 
				
			||||||
	char pname[PROG_NAME_SIZE];
 | 
						char pname[PROG_NAME_SIZE+1];
 | 
				
			||||||
	FUNCTION f,*fp;
 | 
						FUNCTION f,*fp;
 | 
				
			||||||
	MS_STATIC char *prompt,buf[1024],config_name[256];
 | 
						MS_STATIC char *prompt,buf[1024];
 | 
				
			||||||
 | 
						char *to_free=NULL;
 | 
				
			||||||
	int n,i,ret=0;
 | 
						int n,i,ret=0;
 | 
				
			||||||
	int argc;
 | 
						int argc;
 | 
				
			||||||
	char **argv,*p;
 | 
						char **argv,*p;
 | 
				
			||||||
@@ -227,12 +229,21 @@ int main(int Argc, char *Argv[])
 | 
				
			|||||||
	arg.data=NULL;
 | 
						arg.data=NULL;
 | 
				
			||||||
	arg.count=0;
 | 
						arg.count=0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (getenv("OPENSSL_DEBUG_MEMORY") != NULL)
 | 
						if (bio_err == NULL)
 | 
				
			||||||
 | 
							if ((bio_err=BIO_new(BIO_s_file())) != NULL)
 | 
				
			||||||
 | 
								BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (getenv("OPENSSL_DEBUG_MEMORY") != NULL) /* if not defined, use compiled-in library defaults */
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		if (!(0 == strcmp(getenv("OPENSSL_DEBUG_MEMORY"), "off")))
 | 
							if (!(0 == strcmp(getenv("OPENSSL_DEBUG_MEMORY"), "off")))
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
			CRYPTO_malloc_debug_init();
 | 
								CRYPTO_malloc_debug_init();
 | 
				
			||||||
			CRYPTO_dbg_set_options(V_CRYPTO_MDEBUG_ALL);
 | 
								CRYPTO_set_mem_debug_options(V_CRYPTO_MDEBUG_ALL);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							else
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								/* OPENSSL_DEBUG_MEMORY=off */
 | 
				
			||||||
 | 
								CRYPTO_set_mem_debug_functions(0, 0, 0, 0, 0);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
 | 
						CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
 | 
				
			||||||
@@ -246,36 +257,28 @@ int main(int Argc, char *Argv[])
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	apps_startup();
 | 
						apps_startup();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (bio_err == NULL)
 | 
					 | 
				
			||||||
		if ((bio_err=BIO_new(BIO_s_file())) != NULL)
 | 
					 | 
				
			||||||
			BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	ERR_load_crypto_strings();
 | 
					 | 
				
			||||||
	ENGINE_load_builtin_engines();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* Lets load up our environment a little */
 | 
						/* Lets load up our environment a little */
 | 
				
			||||||
	p=getenv("OPENSSL_CONF");
 | 
						p=getenv("OPENSSL_CONF");
 | 
				
			||||||
	if (p == NULL)
 | 
						if (p == NULL)
 | 
				
			||||||
		p=getenv("SSLEAY_CONF");
 | 
							p=getenv("SSLEAY_CONF");
 | 
				
			||||||
	if (p == NULL)
 | 
						if (p == NULL)
 | 
				
			||||||
		{
 | 
							p=to_free=make_config_name();
 | 
				
			||||||
		strcpy(config_name,X509_get_default_cert_area());
 | 
					 | 
				
			||||||
#ifndef OPENSSL_SYS_VMS
 | 
					 | 
				
			||||||
		strcat(config_name,"/");
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
		strcat(config_name,OPENSSL_CONF);
 | 
					 | 
				
			||||||
		p=config_name;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	default_config_file=p;
 | 
						default_config_file=p;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	config=CONF_load(config,p,&errline);
 | 
						config=NCONF_new(NULL);
 | 
				
			||||||
	if (config == NULL) ERR_clear_error();
 | 
						i=NCONF_load(config,p,&errline);
 | 
				
			||||||
 | 
						if (i == 0)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							NCONF_free(config);
 | 
				
			||||||
 | 
							config = NULL;
 | 
				
			||||||
 | 
							ERR_clear_error();
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	prog=prog_init();
 | 
						prog=prog_init();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* first check the program name */
 | 
						/* first check the program name */
 | 
				
			||||||
	program_name(Argv[0],pname,PROG_NAME_SIZE);
 | 
						program_name(Argv[0],pname,sizeof pname);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	f.name=pname;
 | 
						f.name=pname;
 | 
				
			||||||
	fp=(FUNCTION *)lh_retrieve(prog,&f);
 | 
						fp=(FUNCTION *)lh_retrieve(prog,&f);
 | 
				
			||||||
@@ -303,7 +306,7 @@ int main(int Argc, char *Argv[])
 | 
				
			|||||||
		{
 | 
							{
 | 
				
			||||||
		ret=0;
 | 
							ret=0;
 | 
				
			||||||
		p=buf;
 | 
							p=buf;
 | 
				
			||||||
		n=1024;
 | 
							n=sizeof buf;
 | 
				
			||||||
		i=0;
 | 
							i=0;
 | 
				
			||||||
		for (;;)
 | 
							for (;;)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
@@ -337,18 +340,18 @@ int main(int Argc, char *Argv[])
 | 
				
			|||||||
	BIO_printf(bio_err,"bad exit\n");
 | 
						BIO_printf(bio_err,"bad exit\n");
 | 
				
			||||||
	ret=1;
 | 
						ret=1;
 | 
				
			||||||
end:
 | 
					end:
 | 
				
			||||||
 | 
						if (to_free)
 | 
				
			||||||
 | 
							OPENSSL_free(to_free);
 | 
				
			||||||
	if (config != NULL)
 | 
						if (config != NULL)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		CONF_free(config);
 | 
							NCONF_free(config);
 | 
				
			||||||
		config=NULL;
 | 
							config=NULL;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	if (prog != NULL) lh_free(prog);
 | 
						if (prog != NULL) lh_free(prog);
 | 
				
			||||||
	if (arg.data != NULL) OPENSSL_free(arg.data);
 | 
						if (arg.data != NULL) OPENSSL_free(arg.data);
 | 
				
			||||||
	ERR_remove_state(0);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	EVP_cleanup();
 | 
						apps_shutdown();
 | 
				
			||||||
	ERR_free_strings();
 | 
					
 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	CRYPTO_mem_leaks(bio_err);
 | 
						CRYPTO_mem_leaks(bio_err);
 | 
				
			||||||
	if (bio_err != NULL)
 | 
						if (bio_err != NULL)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -48,6 +48,14 @@ RANDFILE	= $dir/private/.rand	# private random number file
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
x509_extensions	= usr_cert		# The extentions to add to the cert
 | 
					x509_extensions	= usr_cert		# The extentions to add to the cert
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Comment out the following two lines for the "traditional"
 | 
				
			||||||
 | 
					# (and highly broken) format.
 | 
				
			||||||
 | 
					name_opt 	= ca_default		# Subject Name options
 | 
				
			||||||
 | 
					cert_opt 	= ca_default		# Certificate field options
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Extension copying option: use with caution.
 | 
				
			||||||
 | 
					# copy_extensions = copy
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Extensions to add to a CRL. Note: Netscape communicator chokes on V2 CRLs
 | 
					# Extensions to add to a CRL. Note: Netscape communicator chokes on V2 CRLs
 | 
				
			||||||
# so this is commented out by default to leave a V1 CRL.
 | 
					# so this is commented out by default to leave a V1 CRL.
 | 
				
			||||||
# crl_extensions	= crl_ext
 | 
					# crl_extensions	= crl_ext
 | 
				
			||||||
@@ -180,6 +188,9 @@ authorityKeyIdentifier=keyid,issuer:always
 | 
				
			|||||||
# This stuff is for subjectAltName and issuerAltname.
 | 
					# This stuff is for subjectAltName and issuerAltname.
 | 
				
			||||||
# Import the email address.
 | 
					# Import the email address.
 | 
				
			||||||
# subjectAltName=email:copy
 | 
					# subjectAltName=email:copy
 | 
				
			||||||
 | 
					# An alternative to produce certificates that aren't
 | 
				
			||||||
 | 
					# deprecated according to PKIX.
 | 
				
			||||||
 | 
					# subjectAltName=email:move
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Copy subject details
 | 
					# Copy subject details
 | 
				
			||||||
# issuerAltName=issuer:copy
 | 
					# issuerAltName=issuer:copy
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -15,7 +15,6 @@
 | 
				
			|||||||
#include <openssl/err.h>
 | 
					#include <openssl/err.h>
 | 
				
			||||||
#include <openssl/evp.h>
 | 
					#include <openssl/evp.h>
 | 
				
			||||||
#include <openssl/rand.h>
 | 
					#include <openssl/rand.h>
 | 
				
			||||||
 | 
					 | 
				
			||||||
#ifndef OPENSSL_NO_DES
 | 
					#ifndef OPENSSL_NO_DES
 | 
				
			||||||
# include <openssl/des.h>
 | 
					# include <openssl/des.h>
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
@@ -79,6 +78,9 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
	if (bio_err == NULL)
 | 
						if (bio_err == NULL)
 | 
				
			||||||
		if ((bio_err=BIO_new(BIO_s_file())) != NULL)
 | 
							if ((bio_err=BIO_new(BIO_s_file())) != NULL)
 | 
				
			||||||
			BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
 | 
								BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!load_config(bio_err, NULL))
 | 
				
			||||||
 | 
							goto err;
 | 
				
			||||||
	out = BIO_new(BIO_s_file());
 | 
						out = BIO_new(BIO_s_file());
 | 
				
			||||||
	if (out == NULL)
 | 
						if (out == NULL)
 | 
				
			||||||
		goto err;
 | 
							goto err;
 | 
				
			||||||
@@ -289,6 +291,7 @@ err:
 | 
				
			|||||||
		BIO_free(in);
 | 
							BIO_free(in);
 | 
				
			||||||
	if (out)
 | 
						if (out)
 | 
				
			||||||
		BIO_free_all(out);
 | 
							BIO_free_all(out);
 | 
				
			||||||
 | 
						apps_shutdown();
 | 
				
			||||||
	EXIT(ret);
 | 
						EXIT(ret);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -310,7 +313,7 @@ static char *md5crypt(const char *passwd, const char *magic, const char *salt)
 | 
				
			|||||||
	unsigned char buf[MD5_DIGEST_LENGTH];
 | 
						unsigned char buf[MD5_DIGEST_LENGTH];
 | 
				
			||||||
	char *salt_out;
 | 
						char *salt_out;
 | 
				
			||||||
	int n, i;
 | 
						int n, i;
 | 
				
			||||||
	MD5_CTX md;
 | 
						EVP_MD_CTX md,md2;
 | 
				
			||||||
	size_t passwd_len, salt_len;
 | 
						size_t passwd_len, salt_len;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	passwd_len = strlen(passwd);
 | 
						passwd_len = strlen(passwd);
 | 
				
			||||||
@@ -325,49 +328,47 @@ static char *md5crypt(const char *passwd, const char *magic, const char *salt)
 | 
				
			|||||||
	salt_len = strlen(salt_out);
 | 
						salt_len = strlen(salt_out);
 | 
				
			||||||
	assert(salt_len <= 8);
 | 
						assert(salt_len <= 8);
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	MD5_Init(&md);
 | 
						EVP_MD_CTX_init(&md);
 | 
				
			||||||
	MD5_Update(&md, passwd, passwd_len);
 | 
						EVP_DigestInit_ex(&md,EVP_md5(), NULL);
 | 
				
			||||||
	MD5_Update(&md, "$", 1);
 | 
						EVP_DigestUpdate(&md, passwd, passwd_len);
 | 
				
			||||||
	MD5_Update(&md, magic, strlen(magic));
 | 
						EVP_DigestUpdate(&md, "$", 1);
 | 
				
			||||||
	MD5_Update(&md, "$", 1);
 | 
						EVP_DigestUpdate(&md, magic, strlen(magic));
 | 
				
			||||||
	MD5_Update(&md, salt_out, salt_len);
 | 
						EVP_DigestUpdate(&md, "$", 1);
 | 
				
			||||||
 | 
						EVP_DigestUpdate(&md, salt_out, salt_len);
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	 {
 | 
						EVP_MD_CTX_init(&md2);
 | 
				
			||||||
		MD5_CTX md2;
 | 
						EVP_DigestInit_ex(&md2,EVP_md5(), NULL);
 | 
				
			||||||
 | 
						EVP_DigestUpdate(&md2, passwd, passwd_len);
 | 
				
			||||||
 | 
						EVP_DigestUpdate(&md2, salt_out, salt_len);
 | 
				
			||||||
 | 
						EVP_DigestUpdate(&md2, passwd, passwd_len);
 | 
				
			||||||
 | 
						EVP_DigestFinal_ex(&md2, buf, NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		MD5_Init(&md2);
 | 
					 | 
				
			||||||
		MD5_Update(&md2, passwd, passwd_len);
 | 
					 | 
				
			||||||
		MD5_Update(&md2, salt_out, salt_len);
 | 
					 | 
				
			||||||
		MD5_Update(&md2, passwd, passwd_len);
 | 
					 | 
				
			||||||
		MD5_Final(buf, &md2);
 | 
					 | 
				
			||||||
	 }
 | 
					 | 
				
			||||||
	for (i = passwd_len; i > sizeof buf; i -= sizeof buf)
 | 
						for (i = passwd_len; i > sizeof buf; i -= sizeof buf)
 | 
				
			||||||
		MD5_Update(&md, buf, sizeof buf);
 | 
							EVP_DigestUpdate(&md, buf, sizeof buf);
 | 
				
			||||||
	MD5_Update(&md, buf, i);
 | 
						EVP_DigestUpdate(&md, buf, i);
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	n = passwd_len;
 | 
						n = passwd_len;
 | 
				
			||||||
	while (n)
 | 
						while (n)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		MD5_Update(&md, (n & 1) ? "\0" : passwd, 1);
 | 
							EVP_DigestUpdate(&md, (n & 1) ? "\0" : passwd, 1);
 | 
				
			||||||
		n >>= 1;
 | 
							n >>= 1;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	MD5_Final(buf, &md);
 | 
						EVP_DigestFinal_ex(&md, buf, NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (i = 0; i < 1000; i++)
 | 
						for (i = 0; i < 1000; i++)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		MD5_CTX md2;
 | 
							EVP_DigestInit_ex(&md2,EVP_md5(), NULL);
 | 
				
			||||||
 | 
							EVP_DigestUpdate(&md2, (i & 1) ? (unsigned char *) passwd : buf,
 | 
				
			||||||
		MD5_Init(&md2);
 | 
							                       (i & 1) ? passwd_len : sizeof buf);
 | 
				
			||||||
		MD5_Update(&md2, (i & 1) ? (unsigned char *) passwd : buf,
 | 
					 | 
				
			||||||
		                 (i & 1) ? passwd_len : sizeof buf);
 | 
					 | 
				
			||||||
		if (i % 3)
 | 
							if (i % 3)
 | 
				
			||||||
			MD5_Update(&md2, salt_out, salt_len);
 | 
								EVP_DigestUpdate(&md2, salt_out, salt_len);
 | 
				
			||||||
		if (i % 7)
 | 
							if (i % 7)
 | 
				
			||||||
			MD5_Update(&md2, passwd, passwd_len);
 | 
								EVP_DigestUpdate(&md2, passwd, passwd_len);
 | 
				
			||||||
		MD5_Update(&md2, (i & 1) ? buf : (unsigned char *) passwd,
 | 
							EVP_DigestUpdate(&md2, (i & 1) ? buf : (unsigned char *) passwd,
 | 
				
			||||||
		                 (i & 1) ? sizeof buf : passwd_len);
 | 
							                       (i & 1) ? sizeof buf : passwd_len);
 | 
				
			||||||
		MD5_Final(buf, &md2);
 | 
							EVP_DigestFinal_ex(&md2, buf, NULL);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
						EVP_MD_CTX_cleanup(&md2);
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	 {
 | 
						 {
 | 
				
			||||||
		/* transform buf into output string */
 | 
							/* transform buf into output string */
 | 
				
			||||||
@@ -405,6 +406,7 @@ static char *md5crypt(const char *passwd, const char *magic, const char *salt)
 | 
				
			|||||||
		*output = 0;
 | 
							*output = 0;
 | 
				
			||||||
		assert(strlen(out_buf) < sizeof(out_buf));
 | 
							assert(strlen(out_buf) < sizeof(out_buf));
 | 
				
			||||||
	 }
 | 
						 }
 | 
				
			||||||
 | 
						EVP_MD_CTX_cleanup(&md);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return out_buf;
 | 
						return out_buf;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -479,7 +481,7 @@ static int do_passwd(int passed_salt, char **salt_p, char **salt_malloc_p,
 | 
				
			|||||||
	/* now compute password hash */
 | 
						/* now compute password hash */
 | 
				
			||||||
#ifndef OPENSSL_NO_DES
 | 
					#ifndef OPENSSL_NO_DES
 | 
				
			||||||
	if (usecrypt)
 | 
						if (usecrypt)
 | 
				
			||||||
		hash = des_crypt(passwd, *salt_p);
 | 
							hash = DES_crypt(passwd, *salt_p);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#ifndef NO_MD5CRYPT_1
 | 
					#ifndef NO_MD5CRYPT_1
 | 
				
			||||||
	if (use1 || useapr1)
 | 
						if (use1 || useapr1)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -66,7 +66,6 @@
 | 
				
			|||||||
#include <openssl/err.h>
 | 
					#include <openssl/err.h>
 | 
				
			||||||
#include <openssl/pem.h>
 | 
					#include <openssl/pem.h>
 | 
				
			||||||
#include <openssl/pkcs12.h>
 | 
					#include <openssl/pkcs12.h>
 | 
				
			||||||
#include <openssl/engine.h>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define PROG pkcs12_main
 | 
					#define PROG pkcs12_main
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -96,9 +95,10 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
    ENGINE *e = NULL;
 | 
					    ENGINE *e = NULL;
 | 
				
			||||||
    char *infile=NULL, *outfile=NULL, *keyname = NULL;	
 | 
					    char *infile=NULL, *outfile=NULL, *keyname = NULL;	
 | 
				
			||||||
    char *certfile=NULL;
 | 
					    char *certfile=NULL;
 | 
				
			||||||
    BIO *in=NULL, *out = NULL, *inkey = NULL, *certsin = NULL;
 | 
					    BIO *in=NULL, *out = NULL;
 | 
				
			||||||
    char **args;
 | 
					    char **args;
 | 
				
			||||||
    char *name = NULL;
 | 
					    char *name = NULL;
 | 
				
			||||||
 | 
					    char *csp_name = NULL;
 | 
				
			||||||
    PKCS12 *p12 = NULL;
 | 
					    PKCS12 *p12 = NULL;
 | 
				
			||||||
    char pass[50], macpass[50];
 | 
					    char pass[50], macpass[50];
 | 
				
			||||||
    int export_cert = 0;
 | 
					    int export_cert = 0;
 | 
				
			||||||
@@ -127,6 +127,9 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
    enc = EVP_des_ede3_cbc();
 | 
					    enc = EVP_des_ede3_cbc();
 | 
				
			||||||
    if (bio_err == NULL ) bio_err = BIO_new_fp (stderr, BIO_NOCLOSE);
 | 
					    if (bio_err == NULL ) bio_err = BIO_new_fp (stderr, BIO_NOCLOSE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!load_config(bio_err, NULL))
 | 
				
			||||||
 | 
							goto end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    args = argv + 1;
 | 
					    args = argv + 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -151,6 +154,11 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
		else if (!strcmp (*args, "-idea")) enc=EVP_idea_cbc();
 | 
							else if (!strcmp (*args, "-idea")) enc=EVP_idea_cbc();
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
		else if (!strcmp (*args, "-des3")) enc = EVP_des_ede3_cbc();
 | 
							else if (!strcmp (*args, "-des3")) enc = EVP_des_ede3_cbc();
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_AES
 | 
				
			||||||
 | 
							else if (!strcmp(*args,"-aes128")) enc=EVP_aes_128_cbc();
 | 
				
			||||||
 | 
							else if (!strcmp(*args,"-aes192")) enc=EVP_aes_192_cbc();
 | 
				
			||||||
 | 
							else if (!strcmp(*args,"-aes256")) enc=EVP_aes_256_cbc();
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
		else if (!strcmp (*args, "-noiter")) iter = 1;
 | 
							else if (!strcmp (*args, "-noiter")) iter = 1;
 | 
				
			||||||
		else if (!strcmp (*args, "-maciter"))
 | 
							else if (!strcmp (*args, "-maciter"))
 | 
				
			||||||
					 maciter = PKCS12_DEFAULT_ITER;
 | 
										 maciter = PKCS12_DEFAULT_ITER;
 | 
				
			||||||
@@ -197,6 +205,11 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
			args++;	
 | 
								args++;	
 | 
				
			||||||
			name = *args;
 | 
								name = *args;
 | 
				
			||||||
		    } else badarg = 1;
 | 
							    } else badarg = 1;
 | 
				
			||||||
 | 
							} else if (!strcmp (*args, "-CSP")) {
 | 
				
			||||||
 | 
							    if (args[1]) {
 | 
				
			||||||
 | 
								args++;	
 | 
				
			||||||
 | 
								csp_name = *args;
 | 
				
			||||||
 | 
							    } else badarg = 1;
 | 
				
			||||||
		} else if (!strcmp (*args, "-caname")) {
 | 
							} else if (!strcmp (*args, "-caname")) {
 | 
				
			||||||
		    if (args[1]) {
 | 
							    if (args[1]) {
 | 
				
			||||||
			args++;	
 | 
								args++;	
 | 
				
			||||||
@@ -274,6 +287,10 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
	BIO_printf (bio_err, "-des3         encrypt private keys with triple DES (default)\n");
 | 
						BIO_printf (bio_err, "-des3         encrypt private keys with triple DES (default)\n");
 | 
				
			||||||
#ifndef OPENSSL_NO_IDEA
 | 
					#ifndef OPENSSL_NO_IDEA
 | 
				
			||||||
	BIO_printf (bio_err, "-idea         encrypt private keys with idea\n");
 | 
						BIO_printf (bio_err, "-idea         encrypt private keys with idea\n");
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_AES
 | 
				
			||||||
 | 
						BIO_printf (bio_err, "-aes128, -aes192, -aes256\n");
 | 
				
			||||||
 | 
						BIO_printf (bio_err, "              encrypt PEM output with cbc aes\n");
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
	BIO_printf (bio_err, "-nodes        don't encrypt private keys\n");
 | 
						BIO_printf (bio_err, "-nodes        don't encrypt private keys\n");
 | 
				
			||||||
	BIO_printf (bio_err, "-noiter       don't use encryption iteration\n");
 | 
						BIO_printf (bio_err, "-noiter       don't use encryption iteration\n");
 | 
				
			||||||
@@ -294,19 +311,7 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
    	goto end;
 | 
					    	goto end;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (engine != NULL) {
 | 
					    e = setup_engine(bio_err, engine, 0);
 | 
				
			||||||
	if((e = ENGINE_by_id(engine)) == NULL) {
 | 
					 | 
				
			||||||
	    BIO_printf(bio_err,"invalid engine \"%s\"\n", engine);
 | 
					 | 
				
			||||||
	    goto end;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	if(!ENGINE_set_default(e, ENGINE_METHOD_ALL)) {
 | 
					 | 
				
			||||||
	    BIO_printf(bio_err,"can't use that engine\n");
 | 
					 | 
				
			||||||
	    goto end;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
 | 
					 | 
				
			||||||
	/* Free our "structural" reference. */
 | 
					 | 
				
			||||||
	ENGINE_free(e);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if(passarg) {
 | 
					    if(passarg) {
 | 
				
			||||||
	if(export_cert) passargout = passarg;
 | 
						if(export_cert) passargout = passarg;
 | 
				
			||||||
@@ -352,6 +357,7 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
	    goto end;
 | 
						    goto end;
 | 
				
			||||||
   }
 | 
					   }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if 0
 | 
				
			||||||
   if (certfile) {
 | 
					   if (certfile) {
 | 
				
			||||||
    	if(!(certsin = BIO_new_file(certfile, "r"))) {
 | 
					    	if(!(certsin = BIO_new_file(certfile, "r"))) {
 | 
				
			||||||
	    BIO_printf(bio_err, "Can't open certificate file %s\n", certfile);
 | 
						    BIO_printf(bio_err, "Can't open certificate file %s\n", certfile);
 | 
				
			||||||
@@ -367,6 +373,7 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
	    goto end;
 | 
						    goto end;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
     }
 | 
					     }
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef CRYPTO_MDEBUG
 | 
					#ifdef CRYPTO_MDEBUG
 | 
				
			||||||
    CRYPTO_pop_info();
 | 
					    CRYPTO_pop_info();
 | 
				
			||||||
@@ -392,7 +399,7 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
#ifdef CRYPTO_MDEBUG
 | 
					#ifdef CRYPTO_MDEBUG
 | 
				
			||||||
    CRYPTO_push_info("read MAC password");
 | 
					    CRYPTO_push_info("read MAC password");
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
	if(EVP_read_pw_string (macpass, 50, "Enter MAC Password:", export_cert))
 | 
						if(EVP_read_pw_string (macpass, sizeof macpass, "Enter MAC Password:", export_cert))
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
    	    BIO_printf (bio_err, "Can't read Password\n");
 | 
					    	    BIO_printf (bio_err, "Can't read Password\n");
 | 
				
			||||||
    	    goto end;
 | 
					    	    goto end;
 | 
				
			||||||
@@ -420,12 +427,9 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
	CRYPTO_push_info("process -export_cert");
 | 
						CRYPTO_push_info("process -export_cert");
 | 
				
			||||||
	CRYPTO_push_info("reading private key");
 | 
						CRYPTO_push_info("reading private key");
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
	key = PEM_read_bio_PrivateKey(inkey ? inkey : in, NULL, NULL, passin);
 | 
						key = load_key(bio_err, keyname ? keyname : infile, FORMAT_PEM, 1,
 | 
				
			||||||
	if (!inkey) (void) BIO_reset(in);
 | 
							passin, e, "private key");
 | 
				
			||||||
	else BIO_free(inkey);
 | 
					 | 
				
			||||||
	if (!key) {
 | 
						if (!key) {
 | 
				
			||||||
		BIO_printf (bio_err, "Error loading private key\n");
 | 
					 | 
				
			||||||
		ERR_print_errors(bio_err);
 | 
					 | 
				
			||||||
		goto export_end;
 | 
							goto export_end;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -434,12 +438,9 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
	CRYPTO_push_info("reading certs from input");
 | 
						CRYPTO_push_info("reading certs from input");
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	certs = sk_X509_new_null();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* Load in all certs in input file */
 | 
						/* Load in all certs in input file */
 | 
				
			||||||
	if(!cert_load(in, certs)) {
 | 
						if(!(certs = load_certs(bio_err, infile, FORMAT_PEM, NULL, e,
 | 
				
			||||||
		BIO_printf(bio_err, "Error loading certificates from input\n");
 | 
							"certificates"))) {
 | 
				
			||||||
		ERR_print_errors(bio_err);
 | 
					 | 
				
			||||||
		goto export_end;
 | 
							goto export_end;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -469,13 +470,17 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
	bags = sk_PKCS12_SAFEBAG_new_null ();
 | 
						bags = sk_PKCS12_SAFEBAG_new_null ();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Add any more certificates asked for */
 | 
						/* Add any more certificates asked for */
 | 
				
			||||||
	if (certsin) {
 | 
						if (certfile) {
 | 
				
			||||||
		if(!cert_load(certsin, certs)) {
 | 
							STACK_OF(X509) *morecerts=NULL;
 | 
				
			||||||
			BIO_printf(bio_err, "Error loading certificates from certfile\n");
 | 
							if(!(morecerts = load_certs(bio_err, certfile, FORMAT_PEM,
 | 
				
			||||||
			ERR_print_errors(bio_err);
 | 
										    NULL, e,
 | 
				
			||||||
 | 
										    "certificates from certfile"))) {
 | 
				
			||||||
			goto export_end;
 | 
								goto export_end;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	    	BIO_free(certsin);
 | 
							while(sk_X509_num(morecerts) > 0) {
 | 
				
			||||||
 | 
								sk_X509_push(certs, sk_X509_shift(morecerts));
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							sk_X509_free(morecerts);
 | 
				
			||||||
 	}
 | 
					 	}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef CRYPTO_MDEBUG
 | 
					#ifdef CRYPTO_MDEBUG
 | 
				
			||||||
@@ -503,9 +508,10 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
		    /* Exclude verified certificate */
 | 
							    /* Exclude verified certificate */
 | 
				
			||||||
		    for (i = 1; i < sk_X509_num (chain2) ; i++) 
 | 
							    for (i = 1; i < sk_X509_num (chain2) ; i++) 
 | 
				
			||||||
			sk_X509_push(certs, sk_X509_value (chain2, i));
 | 
								sk_X509_push(certs, sk_X509_value (chain2, i));
 | 
				
			||||||
		}
 | 
							    /* Free first certificate */
 | 
				
			||||||
		sk_X509_free(chain2);
 | 
							    X509_free(sk_X509_value(chain2, 0));
 | 
				
			||||||
		if (vret) {
 | 
							    sk_X509_free(chain2);
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
			BIO_printf (bio_err, "Error %s getting chain.\n",
 | 
								BIO_printf (bio_err, "Error %s getting chain.\n",
 | 
				
			||||||
					X509_verify_cert_error_string(vret));
 | 
										X509_verify_cert_error_string(vret));
 | 
				
			||||||
			goto export_end;
 | 
								goto export_end;
 | 
				
			||||||
@@ -532,8 +538,6 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	sk_X509_pop_free(certs, X509_free);
 | 
						sk_X509_pop_free(certs, X509_free);
 | 
				
			||||||
	certs = NULL;
 | 
						certs = NULL;
 | 
				
			||||||
	/* ucert is part of certs so it is already freed */
 | 
					 | 
				
			||||||
	ucert = NULL;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef CRYPTO_MDEBUG
 | 
					#ifdef CRYPTO_MDEBUG
 | 
				
			||||||
	CRYPTO_pop_info();
 | 
						CRYPTO_pop_info();
 | 
				
			||||||
@@ -541,7 +545,7 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(!noprompt &&
 | 
						if(!noprompt &&
 | 
				
			||||||
		EVP_read_pw_string(pass, 50, "Enter Export Password:", 1)) {
 | 
							EVP_read_pw_string(pass, sizeof pass, "Enter Export Password:", 1)) {
 | 
				
			||||||
	    BIO_printf (bio_err, "Can't read Password\n");
 | 
						    BIO_printf (bio_err, "Can't read Password\n");
 | 
				
			||||||
	    goto export_end;
 | 
						    goto export_end;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -572,6 +576,7 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
	PKCS8_PRIV_KEY_INFO_free(p8);
 | 
						PKCS8_PRIV_KEY_INFO_free(p8);
 | 
				
			||||||
	p8 = NULL;
 | 
						p8 = NULL;
 | 
				
			||||||
        if (name) PKCS12_add_friendlyname (bag, name, -1);
 | 
					        if (name) PKCS12_add_friendlyname (bag, name, -1);
 | 
				
			||||||
 | 
						if(csp_name) PKCS12_add_CSPName_asc(bag, csp_name, -1);
 | 
				
			||||||
	PKCS12_add_localkeyid (bag, keyid, keyidlen);
 | 
						PKCS12_add_localkeyid (bag, keyid, keyidlen);
 | 
				
			||||||
	bags = sk_PKCS12_SAFEBAG_new_null();
 | 
						bags = sk_PKCS12_SAFEBAG_new_null();
 | 
				
			||||||
	sk_PKCS12_SAFEBAG_push (bags, bag);
 | 
						sk_PKCS12_SAFEBAG_push (bags, bag);
 | 
				
			||||||
@@ -621,7 +626,6 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
	if (certs) sk_X509_pop_free(certs, X509_free);
 | 
						if (certs) sk_X509_pop_free(certs, X509_free);
 | 
				
			||||||
	if (safes) sk_PKCS7_pop_free(safes, PKCS7_free);
 | 
						if (safes) sk_PKCS7_pop_free(safes, PKCS7_free);
 | 
				
			||||||
	if (bags) sk_PKCS12_SAFEBAG_pop_free(bags, PKCS12_SAFEBAG_free);
 | 
						if (bags) sk_PKCS12_SAFEBAG_pop_free(bags, PKCS12_SAFEBAG_free);
 | 
				
			||||||
	if (ucert) X509_free(ucert);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef CRYPTO_MDEBUG
 | 
					#ifdef CRYPTO_MDEBUG
 | 
				
			||||||
	CRYPTO_pop_info();
 | 
						CRYPTO_pop_info();
 | 
				
			||||||
@@ -638,7 +642,7 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
#ifdef CRYPTO_MDEBUG
 | 
					#ifdef CRYPTO_MDEBUG
 | 
				
			||||||
    CRYPTO_push_info("read import password");
 | 
					    CRYPTO_push_info("read import password");
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
    if(!noprompt && EVP_read_pw_string(pass, 50, "Enter Import Password:", 0)) {
 | 
					    if(!noprompt && EVP_read_pw_string(pass, sizeof pass, "Enter Import Password:", 0)) {
 | 
				
			||||||
	BIO_printf (bio_err, "Can't read Password\n");
 | 
						BIO_printf (bio_err, "Can't read Password\n");
 | 
				
			||||||
	goto end;
 | 
						goto end;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -691,6 +695,7 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
    if (canames) sk_free(canames);
 | 
					    if (canames) sk_free(canames);
 | 
				
			||||||
    if(passin) OPENSSL_free(passin);
 | 
					    if(passin) OPENSSL_free(passin);
 | 
				
			||||||
    if(passout) OPENSSL_free(passout);
 | 
					    if(passout) OPENSSL_free(passout);
 | 
				
			||||||
 | 
					    apps_shutdown();
 | 
				
			||||||
    EXIT(ret);
 | 
					    EXIT(ret);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -772,7 +777,10 @@ int dump_certs_pkeys_bag (BIO *out, PKCS12_SAFEBAG *bag, char *pass,
 | 
				
			|||||||
		print_attribs (out, bag->attrib, "Bag Attributes");
 | 
							print_attribs (out, bag->attrib, "Bag Attributes");
 | 
				
			||||||
		if (!(p8 = PKCS12_decrypt_skey(bag, pass, passlen)))
 | 
							if (!(p8 = PKCS12_decrypt_skey(bag, pass, passlen)))
 | 
				
			||||||
				return 0;
 | 
									return 0;
 | 
				
			||||||
		if (!(pkey = EVP_PKCS82PKEY (p8))) return 0;
 | 
							if (!(pkey = EVP_PKCS82PKEY (p8))) {
 | 
				
			||||||
 | 
								PKCS8_PRIV_KEY_INFO_free(p8);
 | 
				
			||||||
 | 
								return 0;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		print_attribs (out, p8->attributes, "Key Attributes");
 | 
							print_attribs (out, p8->attributes, "Key Attributes");
 | 
				
			||||||
		PKCS8_PRIV_KEY_INFO_free(p8);
 | 
							PKCS8_PRIV_KEY_INFO_free(p8);
 | 
				
			||||||
		PEM_write_bio_PrivateKey (out, pkey, enc, NULL, 0, NULL, pempass);
 | 
							PEM_write_bio_PrivateKey (out, pkey, enc, NULL, 0, NULL, pempass);
 | 
				
			||||||
@@ -820,6 +828,9 @@ int get_cert_chain (X509 *cert, X509_STORE *store, STACK_OF(X509) **chain)
 | 
				
			|||||||
	STACK_OF(X509) *chn;
 | 
						STACK_OF(X509) *chn;
 | 
				
			||||||
	int i;
 | 
						int i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* FIXME: Should really check the return status of X509_STORE_CTX_init
 | 
				
			||||||
 | 
						 * for an error, but how that fits into the return value of this
 | 
				
			||||||
 | 
						 * function is less obvious. */
 | 
				
			||||||
	X509_STORE_CTX_init(&store_ctx, store, cert, NULL);
 | 
						X509_STORE_CTX_init(&store_ctx, store, cert, NULL);
 | 
				
			||||||
	if (X509_verify_cert(&store_ctx) <= 0) {
 | 
						if (X509_verify_cert(&store_ctx) <= 0) {
 | 
				
			||||||
		i = X509_STORE_CTX_get_error (&store_ctx);
 | 
							i = X509_STORE_CTX_get_error (&store_ctx);
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										25
									
								
								apps/pkcs7.c
									
									
									
									
									
								
							
							
						
						
									
										25
									
								
								apps/pkcs7.c
									
									
									
									
									
								
							@@ -67,7 +67,6 @@
 | 
				
			|||||||
#include <openssl/x509.h>
 | 
					#include <openssl/x509.h>
 | 
				
			||||||
#include <openssl/pkcs7.h>
 | 
					#include <openssl/pkcs7.h>
 | 
				
			||||||
#include <openssl/pem.h>
 | 
					#include <openssl/pem.h>
 | 
				
			||||||
#include <openssl/engine.h>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#undef PROG
 | 
					#undef PROG
 | 
				
			||||||
#define PROG	pkcs7_main
 | 
					#define PROG	pkcs7_main
 | 
				
			||||||
@@ -90,7 +89,7 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
	int informat,outformat;
 | 
						int informat,outformat;
 | 
				
			||||||
	char *infile,*outfile,*prog;
 | 
						char *infile,*outfile,*prog;
 | 
				
			||||||
	int print_certs=0,text=0,noout=0;
 | 
						int print_certs=0,text=0,noout=0;
 | 
				
			||||||
	int ret=0;
 | 
						int ret=1;
 | 
				
			||||||
	char *engine=NULL;
 | 
						char *engine=NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	apps_startup();
 | 
						apps_startup();
 | 
				
			||||||
@@ -163,28 +162,13 @@ bad:
 | 
				
			|||||||
		BIO_printf(bio_err," -text         print full details of certificates\n");
 | 
							BIO_printf(bio_err," -text         print full details of certificates\n");
 | 
				
			||||||
		BIO_printf(bio_err," -noout        don't output encoded data\n");
 | 
							BIO_printf(bio_err," -noout        don't output encoded data\n");
 | 
				
			||||||
		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");
 | 
				
			||||||
		EXIT(1);
 | 
							ret = 1;
 | 
				
			||||||
 | 
							goto end;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ERR_load_crypto_strings();
 | 
						ERR_load_crypto_strings();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (engine != NULL)
 | 
					        e = setup_engine(bio_err, engine, 0);
 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
		if((e = ENGINE_by_id(engine)) == NULL)
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			BIO_printf(bio_err,"invalid engine \"%s\"\n",
 | 
					 | 
				
			||||||
				engine);
 | 
					 | 
				
			||||||
			goto end;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			BIO_printf(bio_err,"can't use that engine\n");
 | 
					 | 
				
			||||||
			goto end;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
 | 
					 | 
				
			||||||
		/* Free our "structural" reference. */
 | 
					 | 
				
			||||||
		ENGINE_free(e);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	in=BIO_new(BIO_s_file());
 | 
						in=BIO_new(BIO_s_file());
 | 
				
			||||||
	out=BIO_new(BIO_s_file());
 | 
						out=BIO_new(BIO_s_file());
 | 
				
			||||||
@@ -316,5 +300,6 @@ end:
 | 
				
			|||||||
	if (p7 != NULL) PKCS7_free(p7);
 | 
						if (p7 != NULL) PKCS7_free(p7);
 | 
				
			||||||
	if (in != NULL) BIO_free(in);
 | 
						if (in != NULL) BIO_free(in);
 | 
				
			||||||
	if (out != NULL) BIO_free_all(out);
 | 
						if (out != NULL) BIO_free_all(out);
 | 
				
			||||||
 | 
						apps_shutdown();
 | 
				
			||||||
	EXIT(ret);
 | 
						EXIT(ret);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										48
									
								
								apps/pkcs8.c
									
									
									
									
									
								
							
							
						
						
									
										48
									
								
								apps/pkcs8.c
									
									
									
									
									
								
							@@ -62,9 +62,7 @@
 | 
				
			|||||||
#include <openssl/err.h>
 | 
					#include <openssl/err.h>
 | 
				
			||||||
#include <openssl/evp.h>
 | 
					#include <openssl/evp.h>
 | 
				
			||||||
#include <openssl/pkcs12.h>
 | 
					#include <openssl/pkcs12.h>
 | 
				
			||||||
#include <openssl/engine.h>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "apps.h"
 | 
					 | 
				
			||||||
#define PROG pkcs8_main
 | 
					#define PROG pkcs8_main
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int MAIN(int, char **);
 | 
					int MAIN(int, char **);
 | 
				
			||||||
@@ -84,13 +82,16 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
	int nocrypt = 0;
 | 
						int nocrypt = 0;
 | 
				
			||||||
	X509_SIG *p8;
 | 
						X509_SIG *p8;
 | 
				
			||||||
	PKCS8_PRIV_KEY_INFO *p8inf;
 | 
						PKCS8_PRIV_KEY_INFO *p8inf;
 | 
				
			||||||
	EVP_PKEY *pkey;
 | 
						EVP_PKEY *pkey=NULL;
 | 
				
			||||||
	char pass[50], *passin = NULL, *passout = NULL, *p8pass = NULL;
 | 
						char pass[50], *passin = NULL, *passout = NULL, *p8pass = NULL;
 | 
				
			||||||
	int badarg = 0;
 | 
						int badarg = 0;
 | 
				
			||||||
	char *engine=NULL;
 | 
						char *engine=NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (bio_err == NULL) bio_err = BIO_new_fp (stderr, BIO_NOCLOSE);
 | 
						if (bio_err == NULL) bio_err = BIO_new_fp (stderr, BIO_NOCLOSE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!load_config(bio_err, NULL))
 | 
				
			||||||
 | 
							goto end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	informat=FORMAT_PEM;
 | 
						informat=FORMAT_PEM;
 | 
				
			||||||
	outformat=FORMAT_PEM;
 | 
						outformat=FORMAT_PEM;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -185,23 +186,7 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
		return (1);
 | 
							return (1);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (engine != NULL)
 | 
					        e = setup_engine(bio_err, engine, 0);
 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
		if((e = ENGINE_by_id(engine)) == NULL)
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			BIO_printf(bio_err,"invalid engine \"%s\"\n",
 | 
					 | 
				
			||||||
				engine);
 | 
					 | 
				
			||||||
			return (1);
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			BIO_printf(bio_err,"can't use that engine\n");
 | 
					 | 
				
			||||||
			return (1);
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
 | 
					 | 
				
			||||||
		/* Free our "structural" reference. */
 | 
					 | 
				
			||||||
		ENGINE_free(e);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(!app_passwd(bio_err, passargin, passargout, &passin, &passout)) {
 | 
						if(!app_passwd(bio_err, passargin, passargout, &passin, &passout)) {
 | 
				
			||||||
		BIO_printf(bio_err, "Error getting passwords\n");
 | 
							BIO_printf(bio_err, "Error getting passwords\n");
 | 
				
			||||||
@@ -233,21 +218,14 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (topk8) {
 | 
						if (topk8)
 | 
				
			||||||
		if(informat == FORMAT_PEM)
 | 
							{
 | 
				
			||||||
			pkey = PEM_read_bio_PrivateKey(in, NULL, NULL, passin);
 | 
							BIO_free(in); /* Not needed in this section */
 | 
				
			||||||
		else if(informat == FORMAT_ASN1)
 | 
							pkey = load_key(bio_err, infile, informat, 1,
 | 
				
			||||||
			pkey = d2i_PrivateKey_bio(in, NULL);
 | 
								passin, e, "key");
 | 
				
			||||||
		else {
 | 
					 | 
				
			||||||
			BIO_printf(bio_err, "Bad format specified for key\n");
 | 
					 | 
				
			||||||
			return (1);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		if (!pkey) {
 | 
							if (!pkey) {
 | 
				
			||||||
			BIO_printf(bio_err, "Error reading key\n", outfile);
 | 
					 | 
				
			||||||
			ERR_print_errors(bio_err);
 | 
					 | 
				
			||||||
			return (1);
 | 
								return (1);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		BIO_free(in);
 | 
					 | 
				
			||||||
		if (!(p8inf = EVP_PKEY2PKCS8_broken(pkey, p8_broken))) {
 | 
							if (!(p8inf = EVP_PKEY2PKCS8_broken(pkey, p8_broken))) {
 | 
				
			||||||
			BIO_printf(bio_err, "Error converting key\n", outfile);
 | 
								BIO_printf(bio_err, "Error converting key\n", outfile);
 | 
				
			||||||
			ERR_print_errors(bio_err);
 | 
								ERR_print_errors(bio_err);
 | 
				
			||||||
@@ -266,7 +244,8 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
			if(passout) p8pass = passout;
 | 
								if(passout) p8pass = passout;
 | 
				
			||||||
			else {
 | 
								else {
 | 
				
			||||||
				p8pass = pass;
 | 
									p8pass = pass;
 | 
				
			||||||
				EVP_read_pw_string(pass, 50, "Enter Encryption Password:", 1);
 | 
									if (EVP_read_pw_string(pass, sizeof pass, "Enter Encryption Password:", 1))
 | 
				
			||||||
 | 
										return (1);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			app_RAND_load_file(NULL, bio_err, 0);
 | 
								app_RAND_load_file(NULL, bio_err, 0);
 | 
				
			||||||
			if (!(p8 = PKCS8_encrypt(pbe_nid, cipher,
 | 
								if (!(p8 = PKCS8_encrypt(pbe_nid, cipher,
 | 
				
			||||||
@@ -323,7 +302,7 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
		if(passin) p8pass = passin;
 | 
							if(passin) p8pass = passin;
 | 
				
			||||||
		else {
 | 
							else {
 | 
				
			||||||
			p8pass = pass;
 | 
								p8pass = pass;
 | 
				
			||||||
			EVP_read_pw_string(pass, 50, "Enter Password:", 0);
 | 
								EVP_read_pw_string(pass, sizeof pass, "Enter Password:", 0);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		p8inf = PKCS8_decrypt(p8, p8pass, strlen(p8pass));
 | 
							p8inf = PKCS8_decrypt(p8, p8pass, strlen(p8pass));
 | 
				
			||||||
		X509_SIG_free(p8);
 | 
							X509_SIG_free(p8);
 | 
				
			||||||
@@ -372,6 +351,7 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
			return (1);
 | 
								return (1);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						end:
 | 
				
			||||||
	EVP_PKEY_free(pkey);
 | 
						EVP_PKEY_free(pkey);
 | 
				
			||||||
	BIO_free_all(out);
 | 
						BIO_free_all(out);
 | 
				
			||||||
	BIO_free(in);
 | 
						BIO_free(in);
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										32
									
								
								apps/progs.h
									
									
									
									
									
								
							
							
						
						
									
										32
									
								
								apps/progs.h
									
									
									
									
									
								
							@@ -113,13 +113,45 @@ FUNCTION functions[] = {
 | 
				
			|||||||
	{FUNC_TYPE_GENERAL,"rand",rand_main},
 | 
						{FUNC_TYPE_GENERAL,"rand",rand_main},
 | 
				
			||||||
	{FUNC_TYPE_GENERAL,"engine",engine_main},
 | 
						{FUNC_TYPE_GENERAL,"engine",engine_main},
 | 
				
			||||||
	{FUNC_TYPE_GENERAL,"ocsp",ocsp_main},
 | 
						{FUNC_TYPE_GENERAL,"ocsp",ocsp_main},
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_MD2
 | 
				
			||||||
	{FUNC_TYPE_MD,"md2",dgst_main},
 | 
						{FUNC_TYPE_MD,"md2",dgst_main},
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_MD4
 | 
				
			||||||
	{FUNC_TYPE_MD,"md4",dgst_main},
 | 
						{FUNC_TYPE_MD,"md4",dgst_main},
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_MD5
 | 
				
			||||||
	{FUNC_TYPE_MD,"md5",dgst_main},
 | 
						{FUNC_TYPE_MD,"md5",dgst_main},
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_SHA
 | 
				
			||||||
	{FUNC_TYPE_MD,"sha",dgst_main},
 | 
						{FUNC_TYPE_MD,"sha",dgst_main},
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_SHA1
 | 
				
			||||||
	{FUNC_TYPE_MD,"sha1",dgst_main},
 | 
						{FUNC_TYPE_MD,"sha1",dgst_main},
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_MDC2
 | 
				
			||||||
	{FUNC_TYPE_MD,"mdc2",dgst_main},
 | 
						{FUNC_TYPE_MD,"mdc2",dgst_main},
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_RMD160
 | 
				
			||||||
	{FUNC_TYPE_MD,"rmd160",dgst_main},
 | 
						{FUNC_TYPE_MD,"rmd160",dgst_main},
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_AES
 | 
				
			||||||
 | 
						{FUNC_TYPE_CIPHER,"aes-128-cbc",enc_main},
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_AES
 | 
				
			||||||
 | 
						{FUNC_TYPE_CIPHER,"aes-128-ecb",enc_main},
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_AES
 | 
				
			||||||
 | 
						{FUNC_TYPE_CIPHER,"aes-192-cbc",enc_main},
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_AES
 | 
				
			||||||
 | 
						{FUNC_TYPE_CIPHER,"aes-192-ecb",enc_main},
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_AES
 | 
				
			||||||
 | 
						{FUNC_TYPE_CIPHER,"aes-256-cbc",enc_main},
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_AES
 | 
				
			||||||
 | 
						{FUNC_TYPE_CIPHER,"aes-256-ecb",enc_main},
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
	{FUNC_TYPE_CIPHER,"base64",enc_main},
 | 
						{FUNC_TYPE_CIPHER,"base64",enc_main},
 | 
				
			||||||
#ifndef OPENSSL_NO_DES
 | 
					#ifndef OPENSSL_NO_DES
 | 
				
			||||||
	{FUNC_TYPE_CIPHER,"des",enc_main},
 | 
						{FUNC_TYPE_CIPHER,"des",enc_main},
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -28,15 +28,15 @@ foreach (@ARGV)
 | 
				
			|||||||
	push(@files,$_);
 | 
						push(@files,$_);
 | 
				
			||||||
	$str="\t{FUNC_TYPE_GENERAL,\"$_\",${_}_main},\n";
 | 
						$str="\t{FUNC_TYPE_GENERAL,\"$_\",${_}_main},\n";
 | 
				
			||||||
	if (($_ =~ /^s_/) || ($_ =~ /^ciphers$/))
 | 
						if (($_ =~ /^s_/) || ($_ =~ /^ciphers$/))
 | 
				
			||||||
		{ print "#if !defined(NO_SOCK) && !(defined(NO_SSL2) && defined(NO_SSL3))\n${str}#endif\n"; } 
 | 
							{ print "#if !defined(OPENSSL_NO_SOCK) && !(defined(OPENSSL_NO_SSL2) && defined(OPENSSL_NO_SSL3))\n${str}#endif\n"; } 
 | 
				
			||||||
	elsif ( ($_ =~ /^rsa$/) || ($_ =~ /^genrsa$/) || ($_ =~ /^rsautl$/)) 
 | 
						elsif ( ($_ =~ /^rsa$/) || ($_ =~ /^genrsa$/) || ($_ =~ /^rsautl$/)) 
 | 
				
			||||||
		{ print "#ifndef NO_RSA\n${str}#endif\n";  }
 | 
							{ print "#ifndef OPENSSL_NO_RSA\n${str}#endif\n";  }
 | 
				
			||||||
	elsif ( ($_ =~ /^dsa$/) || ($_ =~ /^gendsa$/) || ($_ =~ /^dsaparam$/))
 | 
						elsif ( ($_ =~ /^dsa$/) || ($_ =~ /^gendsa$/) || ($_ =~ /^dsaparam$/))
 | 
				
			||||||
		{ print "#ifndef NO_DSA\n${str}#endif\n"; }
 | 
							{ print "#ifndef OPENSSL_NO_DSA\n${str}#endif\n"; }
 | 
				
			||||||
	elsif ( ($_ =~ /^dh$/) || ($_ =~ /^gendh$/) || ($_ =~ /^dhparam$/))
 | 
						elsif ( ($_ =~ /^dh$/) || ($_ =~ /^gendh$/) || ($_ =~ /^dhparam$/))
 | 
				
			||||||
		{ print "#ifndef NO_DH\n${str}#endif\n"; }
 | 
							{ print "#ifndef OPENSSL_NO_DH\n${str}#endif\n"; }
 | 
				
			||||||
	elsif ( ($_ =~ /^pkcs12$/))
 | 
						elsif ( ($_ =~ /^pkcs12$/))
 | 
				
			||||||
		{ print "#if !defined(NO_DES) && !defined(NO_SHA1)\n${str}#endif\n"; }
 | 
							{ print "#if !defined(OPENSSL_NO_DES) && !defined(OPENSSL_NO_SHA1)\n${str}#endif\n"; }
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		{ print $str; }
 | 
							{ print $str; }
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -44,10 +44,13 @@ foreach (@ARGV)
 | 
				
			|||||||
foreach ("md2","md4","md5","sha","sha1","mdc2","rmd160")
 | 
					foreach ("md2","md4","md5","sha","sha1","mdc2","rmd160")
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	push(@files,$_);
 | 
						push(@files,$_);
 | 
				
			||||||
	printf "\t{FUNC_TYPE_MD,\"%s\",dgst_main},\n",$_;
 | 
						printf "#ifndef OPENSSL_NO_".uc($_)."\n\t{FUNC_TYPE_MD,\"".$_."\",dgst_main},\n#endif\n";
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
foreach (
 | 
					foreach (
 | 
				
			||||||
 | 
						"aes-128-cbc", "aes-128-ecb",
 | 
				
			||||||
 | 
						"aes-192-cbc", "aes-192-ecb",
 | 
				
			||||||
 | 
						"aes-256-cbc", "aes-256-ecb",
 | 
				
			||||||
	"base64",
 | 
						"base64",
 | 
				
			||||||
	"des", "des3", "desx", "idea", "rc4", "rc4-40",
 | 
						"des", "des3", "desx", "idea", "rc4", "rc4-40",
 | 
				
			||||||
	"rc2", "bf", "cast", "rc5",
 | 
						"rc2", "bf", "cast", "rc5",
 | 
				
			||||||
@@ -64,13 +67,14 @@ foreach (
 | 
				
			|||||||
	push(@files,$_);
 | 
						push(@files,$_);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	$t=sprintf("\t{FUNC_TYPE_CIPHER,\"%s\",enc_main},\n",$_);
 | 
						$t=sprintf("\t{FUNC_TYPE_CIPHER,\"%s\",enc_main},\n",$_);
 | 
				
			||||||
	if    ($_ =~ /des/)  { $t="#ifndef NO_DES\n${t}#endif\n"; }
 | 
						if    ($_ =~ /des/)  { $t="#ifndef OPENSSL_NO_DES\n${t}#endif\n"; }
 | 
				
			||||||
	elsif ($_ =~ /idea/) { $t="#ifndef NO_IDEA\n${t}#endif\n"; }
 | 
						elsif ($_ =~ /aes/)  { $t="#ifndef OPENSSL_NO_AES\n${t}#endif\n"; }
 | 
				
			||||||
	elsif ($_ =~ /rc4/)  { $t="#ifndef NO_RC4\n${t}#endif\n"; }
 | 
						elsif ($_ =~ /idea/) { $t="#ifndef OPENSSL_NO_IDEA\n${t}#endif\n"; }
 | 
				
			||||||
	elsif ($_ =~ /rc2/)  { $t="#ifndef NO_RC2\n${t}#endif\n"; }
 | 
						elsif ($_ =~ /rc4/)  { $t="#ifndef OPENSSL_NO_RC4\n${t}#endif\n"; }
 | 
				
			||||||
	elsif ($_ =~ /bf/)   { $t="#ifndef NO_BF\n${t}#endif\n"; }
 | 
						elsif ($_ =~ /rc2/)  { $t="#ifndef OPENSSL_NO_RC2\n${t}#endif\n"; }
 | 
				
			||||||
	elsif ($_ =~ /cast/) { $t="#ifndef NO_CAST\n${t}#endif\n"; }
 | 
						elsif ($_ =~ /bf/)   { $t="#ifndef OPENSSL_NO_BF\n${t}#endif\n"; }
 | 
				
			||||||
	elsif ($_ =~ /rc5/)  { $t="#ifndef NO_RC5\n${t}#endif\n"; }
 | 
						elsif ($_ =~ /cast/) { $t="#ifndef OPENSSL_NO_CAST\n${t}#endif\n"; }
 | 
				
			||||||
 | 
						elsif ($_ =~ /rc5/)  { $t="#ifndef OPENSSL_NO_RC5\n${t}#endif\n"; }
 | 
				
			||||||
	print $t;
 | 
						print $t;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										76
									
								
								apps/rand.c
									
									
									
									
									
								
							
							
						
						
									
										76
									
								
								apps/rand.c
									
									
									
									
									
								
							@@ -1,4 +1,57 @@
 | 
				
			|||||||
/* apps/rand.c */
 | 
					/* apps/rand.c */
 | 
				
			||||||
 | 
					/* ====================================================================
 | 
				
			||||||
 | 
					 * Copyright (c) 1998-2001 The OpenSSL Project.  All rights reserved.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Redistribution and use in source and binary forms, with or without
 | 
				
			||||||
 | 
					 * modification, are permitted provided that the following conditions
 | 
				
			||||||
 | 
					 * are met:
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 1. Redistributions of source code must retain the above copyright
 | 
				
			||||||
 | 
					 *    notice, this list of conditions and the following disclaimer. 
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 2. Redistributions in binary form must reproduce the above copyright
 | 
				
			||||||
 | 
					 *    notice, this list of conditions and the following disclaimer in
 | 
				
			||||||
 | 
					 *    the documentation and/or other materials provided with the
 | 
				
			||||||
 | 
					 *    distribution.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 3. All advertising materials mentioning features or use of this
 | 
				
			||||||
 | 
					 *    software must display the following acknowledgment:
 | 
				
			||||||
 | 
					 *    "This product includes software developed by the OpenSSL Project
 | 
				
			||||||
 | 
					 *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
 | 
				
			||||||
 | 
					 *    endorse or promote products derived from this software without
 | 
				
			||||||
 | 
					 *    prior written permission. For written permission, please contact
 | 
				
			||||||
 | 
					 *    openssl-core@openssl.org.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 5. Products derived from this software may not be called "OpenSSL"
 | 
				
			||||||
 | 
					 *    nor may "OpenSSL" appear in their names without prior written
 | 
				
			||||||
 | 
					 *    permission of the OpenSSL Project.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 6. Redistributions of any form whatsoever must retain the following
 | 
				
			||||||
 | 
					 *    acknowledgment:
 | 
				
			||||||
 | 
					 *    "This product includes software developed by the OpenSSL Project
 | 
				
			||||||
 | 
					 *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
 | 
				
			||||||
 | 
					 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 | 
				
			||||||
 | 
					 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 | 
				
			||||||
 | 
					 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
 | 
				
			||||||
 | 
					 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 | 
				
			||||||
 | 
					 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 | 
				
			||||||
 | 
					 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 | 
				
			||||||
 | 
					 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 | 
				
			||||||
 | 
					 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 | 
				
			||||||
 | 
					 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 | 
				
			||||||
 | 
					 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 | 
				
			||||||
 | 
					 * OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
				
			||||||
 | 
					 * ====================================================================
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This product includes cryptographic software written by Eric Young
 | 
				
			||||||
 | 
					 * (eay@cryptsoft.com).  This product includes software written by Tim
 | 
				
			||||||
 | 
					 * Hudson (tjh@cryptsoft.com).
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "apps.h"
 | 
					#include "apps.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -9,7 +62,6 @@
 | 
				
			|||||||
#include <openssl/bio.h>
 | 
					#include <openssl/bio.h>
 | 
				
			||||||
#include <openssl/err.h>
 | 
					#include <openssl/err.h>
 | 
				
			||||||
#include <openssl/rand.h>
 | 
					#include <openssl/rand.h>
 | 
				
			||||||
#include <openssl/engine.h>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#undef PROG
 | 
					#undef PROG
 | 
				
			||||||
#define PROG rand_main
 | 
					#define PROG rand_main
 | 
				
			||||||
@@ -40,6 +92,9 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
		if ((bio_err = BIO_new(BIO_s_file())) != NULL)
 | 
							if ((bio_err = BIO_new(BIO_s_file())) != NULL)
 | 
				
			||||||
			BIO_set_fp(bio_err, stderr, BIO_NOCLOSE|BIO_FP_TEXT);
 | 
								BIO_set_fp(bio_err, stderr, BIO_NOCLOSE|BIO_FP_TEXT);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!load_config(bio_err, NULL))
 | 
				
			||||||
 | 
							goto err;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	badopt = 0;
 | 
						badopt = 0;
 | 
				
			||||||
	i = 0;
 | 
						i = 0;
 | 
				
			||||||
	while (!badopt && argv[++i] != NULL)
 | 
						while (!badopt && argv[++i] != NULL)
 | 
				
			||||||
@@ -101,23 +156,7 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
		goto err;
 | 
							goto err;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (engine != NULL)
 | 
					        e = setup_engine(bio_err, engine, 0);
 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
		if((e = ENGINE_by_id(engine)) == NULL)
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			BIO_printf(bio_err,"invalid engine \"%s\"\n",
 | 
					 | 
				
			||||||
				engine);
 | 
					 | 
				
			||||||
			goto err;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			BIO_printf(bio_err,"can't use that engine\n");
 | 
					 | 
				
			||||||
			goto err;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
 | 
					 | 
				
			||||||
		/* Free our "structural" reference. */
 | 
					 | 
				
			||||||
		ENGINE_free(e);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	app_RAND_load_file(NULL, bio_err, (inrand != NULL));
 | 
						app_RAND_load_file(NULL, bio_err, (inrand != NULL));
 | 
				
			||||||
	if (inrand != NULL)
 | 
						if (inrand != NULL)
 | 
				
			||||||
@@ -173,5 +212,6 @@ err:
 | 
				
			|||||||
	ERR_print_errors(bio_err);
 | 
						ERR_print_errors(bio_err);
 | 
				
			||||||
	if (out)
 | 
						if (out)
 | 
				
			||||||
		BIO_free_all(out);
 | 
							BIO_free_all(out);
 | 
				
			||||||
 | 
						apps_shutdown();
 | 
				
			||||||
	EXIT(ret);
 | 
						EXIT(ret);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										424
									
								
								apps/req.c
									
									
									
									
									
								
							
							
						
						
									
										424
									
								
								apps/req.c
									
									
									
									
									
								
							@@ -73,7 +73,7 @@
 | 
				
			|||||||
#include <openssl/x509v3.h>
 | 
					#include <openssl/x509v3.h>
 | 
				
			||||||
#include <openssl/objects.h>
 | 
					#include <openssl/objects.h>
 | 
				
			||||||
#include <openssl/pem.h>
 | 
					#include <openssl/pem.h>
 | 
				
			||||||
#include <openssl/engine.h>
 | 
					#include "../crypto/cryptlib.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define SECTION		"req"
 | 
					#define SECTION		"req"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -85,6 +85,7 @@
 | 
				
			|||||||
#define V3_EXTENSIONS	"x509_extensions"
 | 
					#define V3_EXTENSIONS	"x509_extensions"
 | 
				
			||||||
#define REQ_EXTENSIONS	"req_extensions"
 | 
					#define REQ_EXTENSIONS	"req_extensions"
 | 
				
			||||||
#define STRING_MASK	"string_mask"
 | 
					#define STRING_MASK	"string_mask"
 | 
				
			||||||
 | 
					#define UTF8_IN		"utf8"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define DEFAULT_KEY_LENGTH	512
 | 
					#define DEFAULT_KEY_LENGTH	512
 | 
				
			||||||
#define MIN_KEY_LENGTH		384
 | 
					#define MIN_KEY_LENGTH		384
 | 
				
			||||||
@@ -106,33 +107,37 @@
 | 
				
			|||||||
 * -rand file(s) - load the file(s) into the PRNG.
 | 
					 * -rand file(s) - load the file(s) into the PRNG.
 | 
				
			||||||
 * -newkey	- make a key and a request.
 | 
					 * -newkey	- make a key and a request.
 | 
				
			||||||
 * -modulus	- print RSA modulus.
 | 
					 * -modulus	- print RSA modulus.
 | 
				
			||||||
 | 
					 * -pubkey	- output Public Key.
 | 
				
			||||||
 * -x509	- output a self signed X509 structure instead.
 | 
					 * -x509	- output a self signed X509 structure instead.
 | 
				
			||||||
 * -asn1-kludge	- output new certificate request in a format that some CA's
 | 
					 * -asn1-kludge	- output new certificate request in a format that some CA's
 | 
				
			||||||
 *		  require.  This format is wrong
 | 
					 *		  require.  This format is wrong
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int make_REQ(X509_REQ *req,EVP_PKEY *pkey,char *dn,int attribs);
 | 
					static int make_REQ(X509_REQ *req,EVP_PKEY *pkey,char *dn,int attribs,
 | 
				
			||||||
static int build_subject(X509_REQ *req, char *subj);
 | 
							unsigned long chtype);
 | 
				
			||||||
 | 
					static int build_subject(X509_REQ *req, char *subj, unsigned long chtype);
 | 
				
			||||||
static int prompt_info(X509_REQ *req,
 | 
					static int prompt_info(X509_REQ *req,
 | 
				
			||||||
		STACK_OF(CONF_VALUE) *dn_sk, char *dn_sect,
 | 
							STACK_OF(CONF_VALUE) *dn_sk, char *dn_sect,
 | 
				
			||||||
		STACK_OF(CONF_VALUE) *attr_sk, char *attr_sect, int attribs);
 | 
							STACK_OF(CONF_VALUE) *attr_sk, char *attr_sect, int attribs,
 | 
				
			||||||
 | 
							unsigned long chtype);
 | 
				
			||||||
static int auto_info(X509_REQ *req, STACK_OF(CONF_VALUE) *sk,
 | 
					static int auto_info(X509_REQ *req, STACK_OF(CONF_VALUE) *sk,
 | 
				
			||||||
				STACK_OF(CONF_VALUE) *attr, int attribs);
 | 
									STACK_OF(CONF_VALUE) *attr, int attribs,
 | 
				
			||||||
 | 
									unsigned long chtype);
 | 
				
			||||||
static int add_attribute_object(X509_REQ *req, char *text,
 | 
					static int add_attribute_object(X509_REQ *req, char *text,
 | 
				
			||||||
				char *def, char *value, int nid, int min,
 | 
									char *def, char *value, int nid, int n_min,
 | 
				
			||||||
				int max);
 | 
									int n_max, unsigned long chtype);
 | 
				
			||||||
static int add_DN_object(X509_NAME *n, char *text, char *def, char *value,
 | 
					static int add_DN_object(X509_NAME *n, char *text, char *def, char *value,
 | 
				
			||||||
	int nid,int min,int max);
 | 
						int nid,int n_min,int n_max, unsigned long chtype);
 | 
				
			||||||
#ifndef OPENSSL_NO_RSA
 | 
					#ifndef OPENSSL_NO_RSA
 | 
				
			||||||
static void MS_CALLBACK req_cb(int p,int n,void *arg);
 | 
					static void MS_CALLBACK req_cb(int p,int n,void *arg);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
static int req_check_len(int len,int min,int max);
 | 
					static int req_check_len(int len,int n_min,int n_max);
 | 
				
			||||||
static int check_end(char *str, char *end);
 | 
					static int check_end(char *str, char *end);
 | 
				
			||||||
#ifndef MONOLITH
 | 
					#ifndef MONOLITH
 | 
				
			||||||
static char *default_config_file=NULL;
 | 
					static char *default_config_file=NULL;
 | 
				
			||||||
static LHASH *config=NULL;
 | 
					static CONF *config=NULL;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
static LHASH *req_conf=NULL;
 | 
					static CONF *req_conf=NULL;
 | 
				
			||||||
static int batch=0;
 | 
					static int batch=0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define TYPE_RSA	1
 | 
					#define TYPE_RSA	1
 | 
				
			||||||
@@ -147,15 +152,16 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
#ifndef OPENSSL_NO_DSA
 | 
					#ifndef OPENSSL_NO_DSA
 | 
				
			||||||
	DSA *dsa_params=NULL;
 | 
						DSA *dsa_params=NULL;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
	unsigned long nmflag = 0;
 | 
						unsigned long nmflag = 0, reqflag = 0;
 | 
				
			||||||
	int ex=1,x509=0,days=30;
 | 
						int ex=1,x509=0,days=30;
 | 
				
			||||||
	X509 *x509ss=NULL;
 | 
						X509 *x509ss=NULL;
 | 
				
			||||||
	X509_REQ *req=NULL;
 | 
						X509_REQ *req=NULL;
 | 
				
			||||||
	EVP_PKEY *pkey=NULL;
 | 
						EVP_PKEY *pkey=NULL;
 | 
				
			||||||
	int i,badops=0,newreq=0,newkey= -1,verbose=0,pkey_type=TYPE_RSA;
 | 
						int i=0,badops=0,newreq=0,verbose=0,pkey_type=TYPE_RSA;
 | 
				
			||||||
 | 
						long newkey = -1;
 | 
				
			||||||
	BIO *in=NULL,*out=NULL;
 | 
						BIO *in=NULL,*out=NULL;
 | 
				
			||||||
	int informat,outformat,verify=0,noout=0,text=0,keyform=FORMAT_PEM;
 | 
						int informat,outformat,verify=0,noout=0,text=0,keyform=FORMAT_PEM;
 | 
				
			||||||
	int nodes=0,kludge=0,newhdr=0,subject=0;
 | 
						int nodes=0,kludge=0,newhdr=0,subject=0,pubkey=0;
 | 
				
			||||||
	char *infile,*outfile,*prog,*keyfile=NULL,*template=NULL,*keyout=NULL;
 | 
						char *infile,*outfile,*prog,*keyfile=NULL,*template=NULL,*keyout=NULL;
 | 
				
			||||||
	char *engine=NULL;
 | 
						char *engine=NULL;
 | 
				
			||||||
	char *extensions = NULL;
 | 
						char *extensions = NULL;
 | 
				
			||||||
@@ -169,8 +175,10 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
	char *p;
 | 
						char *p;
 | 
				
			||||||
	char *subj = NULL;
 | 
						char *subj = NULL;
 | 
				
			||||||
	const EVP_MD *md_alg=NULL,*digest=EVP_md5();
 | 
						const EVP_MD *md_alg=NULL,*digest=EVP_md5();
 | 
				
			||||||
 | 
						unsigned long chtype = MBSTRING_ASC;
 | 
				
			||||||
#ifndef MONOLITH
 | 
					#ifndef MONOLITH
 | 
				
			||||||
	MS_STATIC char config_name[256];
 | 
						char *to_free;
 | 
				
			||||||
 | 
						long errline;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	req_conf = NULL;
 | 
						req_conf = NULL;
 | 
				
			||||||
@@ -213,6 +221,10 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
			if (--argc < 1) goto bad;
 | 
								if (--argc < 1) goto bad;
 | 
				
			||||||
			keyfile= *(++argv);
 | 
								keyfile= *(++argv);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
							else if (strcmp(*argv,"-pubkey") == 0)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								pubkey=1;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
		else if (strcmp(*argv,"-new") == 0)
 | 
							else if (strcmp(*argv,"-new") == 0)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
			newreq=1;
 | 
								newreq=1;
 | 
				
			||||||
@@ -295,7 +307,7 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
						goto end;
 | 
											goto end;
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					dtmp=X509_get_pubkey(xtmp);
 | 
										if ((dtmp=X509_get_pubkey(xtmp)) == NULL) goto end;
 | 
				
			||||||
					if (dtmp->type == EVP_PKEY_DSA)
 | 
										if (dtmp->type == EVP_PKEY_DSA)
 | 
				
			||||||
						dsa_params=DSAparams_dup(dtmp->pkey.dsa);
 | 
											dsa_params=DSAparams_dup(dtmp->pkey.dsa);
 | 
				
			||||||
					EVP_PKEY_free(dtmp);
 | 
										EVP_PKEY_free(dtmp);
 | 
				
			||||||
@@ -338,11 +350,18 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
			noout=1;
 | 
								noout=1;
 | 
				
			||||||
		else if (strcmp(*argv,"-verbose") == 0)
 | 
							else if (strcmp(*argv,"-verbose") == 0)
 | 
				
			||||||
			verbose=1;
 | 
								verbose=1;
 | 
				
			||||||
 | 
							else if (strcmp(*argv,"-utf8") == 0)
 | 
				
			||||||
 | 
								chtype = MBSTRING_UTF8;
 | 
				
			||||||
		else if (strcmp(*argv,"-nameopt") == 0)
 | 
							else if (strcmp(*argv,"-nameopt") == 0)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
			if (--argc < 1) goto bad;
 | 
								if (--argc < 1) goto bad;
 | 
				
			||||||
			if (!set_name_ex(&nmflag, *(++argv))) goto bad;
 | 
								if (!set_name_ex(&nmflag, *(++argv))) goto bad;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
							else if (strcmp(*argv,"-reqopt") == 0)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								if (--argc < 1) goto bad;
 | 
				
			||||||
 | 
								if (!set_cert_ex(&reqflag, *(++argv))) goto bad;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
		else if (strcmp(*argv,"-subject") == 0)
 | 
							else if (strcmp(*argv,"-subject") == 0)
 | 
				
			||||||
			subject=1;
 | 
								subject=1;
 | 
				
			||||||
		else if (strcmp(*argv,"-text") == 0)
 | 
							else if (strcmp(*argv,"-text") == 0)
 | 
				
			||||||
@@ -405,6 +424,7 @@ bad:
 | 
				
			|||||||
		BIO_printf(bio_err," -in arg        input file\n");
 | 
							BIO_printf(bio_err," -in arg        input file\n");
 | 
				
			||||||
		BIO_printf(bio_err," -out arg       output file\n");
 | 
							BIO_printf(bio_err," -out arg       output file\n");
 | 
				
			||||||
		BIO_printf(bio_err," -text          text form of request\n");
 | 
							BIO_printf(bio_err," -text          text form of request\n");
 | 
				
			||||||
 | 
							BIO_printf(bio_err," -pubkey        output public key\n");
 | 
				
			||||||
		BIO_printf(bio_err," -noout         do not output REQ\n");
 | 
							BIO_printf(bio_err," -noout         do not output REQ\n");
 | 
				
			||||||
		BIO_printf(bio_err," -verify        verify signature on REQ\n");
 | 
							BIO_printf(bio_err," -verify        verify signature on REQ\n");
 | 
				
			||||||
		BIO_printf(bio_err," -modulus       RSA modulus\n");
 | 
							BIO_printf(bio_err," -modulus       RSA modulus\n");
 | 
				
			||||||
@@ -420,7 +440,7 @@ bad:
 | 
				
			|||||||
		BIO_printf(bio_err,"                the random number generator\n");
 | 
							BIO_printf(bio_err,"                the random number generator\n");
 | 
				
			||||||
		BIO_printf(bio_err," -newkey rsa:bits generate a new RSA key of 'bits' in size\n");
 | 
							BIO_printf(bio_err," -newkey rsa:bits generate a new RSA key of 'bits' in size\n");
 | 
				
			||||||
		BIO_printf(bio_err," -newkey dsa:file generate a new DSA key, parameters taken from CA in 'file'\n");
 | 
							BIO_printf(bio_err," -newkey dsa:file generate a new DSA key, parameters taken from CA in 'file'\n");
 | 
				
			||||||
		BIO_printf(bio_err," -[digest]      Digest to sign with (md5, sha1, md2, mdc2)\n");
 | 
							BIO_printf(bio_err," -[digest]      Digest to sign with (md5, sha1, md2, mdc2, md4)\n");
 | 
				
			||||||
		BIO_printf(bio_err," -config file   request template file.\n");
 | 
							BIO_printf(bio_err," -config file   request template file.\n");
 | 
				
			||||||
		BIO_printf(bio_err," -subj arg      set or modify request subject\n");
 | 
							BIO_printf(bio_err," -subj arg      set or modify request subject\n");
 | 
				
			||||||
		BIO_printf(bio_err," -new           new request.\n");
 | 
							BIO_printf(bio_err," -new           new request.\n");
 | 
				
			||||||
@@ -433,6 +453,9 @@ bad:
 | 
				
			|||||||
		BIO_printf(bio_err,"                have been reported as requiring\n");
 | 
							BIO_printf(bio_err,"                have been reported as requiring\n");
 | 
				
			||||||
		BIO_printf(bio_err," -extensions .. specify certificate extension section (override value in config file)\n");
 | 
							BIO_printf(bio_err," -extensions .. specify certificate extension section (override value in config file)\n");
 | 
				
			||||||
		BIO_printf(bio_err," -reqexts ..    specify request extension section (override value in config file)\n");
 | 
							BIO_printf(bio_err," -reqexts ..    specify request extension section (override value in config file)\n");
 | 
				
			||||||
 | 
							BIO_printf(bio_err," -utf8          input characters are UTF8 (default ASCII)\n");
 | 
				
			||||||
 | 
							BIO_printf(bio_err," -nameopt arg   - various certificate name options\n");
 | 
				
			||||||
 | 
							BIO_printf(bio_err," -reqopt arg    - various request text options\n\n");
 | 
				
			||||||
		goto end;
 | 
							goto end;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -448,25 +471,21 @@ bad:
 | 
				
			|||||||
	if (p == NULL)
 | 
						if (p == NULL)
 | 
				
			||||||
		p=getenv("SSLEAY_CONF");
 | 
							p=getenv("SSLEAY_CONF");
 | 
				
			||||||
	if (p == NULL)
 | 
						if (p == NULL)
 | 
				
			||||||
		{
 | 
							p=to_free=make_config_name();
 | 
				
			||||||
		strcpy(config_name,X509_get_default_cert_area());
 | 
					 | 
				
			||||||
#ifndef OPENSSL_SYS_VMS
 | 
					 | 
				
			||||||
		strcat(config_name,"/");
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
		strcat(config_name,OPENSSL_CONF);
 | 
					 | 
				
			||||||
		p=config_name;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	default_config_file=p;
 | 
						default_config_file=p;
 | 
				
			||||||
	config=CONF_load(config,p,NULL);
 | 
						config=NCONF_new(NULL);
 | 
				
			||||||
 | 
						i=NCONF_load(config, p, &errline);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (template != NULL)
 | 
						if (template != NULL)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		long errline;
 | 
							long errline = -1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		BIO_printf(bio_err,"Using configuration from %s\n",template);
 | 
							if( verbose )
 | 
				
			||||||
		req_conf=CONF_load(NULL,template,&errline);
 | 
								BIO_printf(bio_err,"Using configuration from %s\n",template);
 | 
				
			||||||
		if (req_conf == NULL)
 | 
							req_conf=NCONF_new(NULL);
 | 
				
			||||||
 | 
							i=NCONF_load(req_conf,template,&errline);
 | 
				
			||||||
 | 
							if (i == 0)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
			BIO_printf(bio_err,"error on line %ld of %s\n",errline,template);
 | 
								BIO_printf(bio_err,"error on line %ld of %s\n",errline,template);
 | 
				
			||||||
			goto end;
 | 
								goto end;
 | 
				
			||||||
@@ -475,7 +494,8 @@ bad:
 | 
				
			|||||||
	else
 | 
						else
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		req_conf=config;
 | 
							req_conf=config;
 | 
				
			||||||
		BIO_printf(bio_err,"Using configuration from %s\n",
 | 
							if( verbose )
 | 
				
			||||||
 | 
								BIO_printf(bio_err,"Using configuration from %s\n",
 | 
				
			||||||
			default_config_file);
 | 
								default_config_file);
 | 
				
			||||||
		if (req_conf == NULL)
 | 
							if (req_conf == NULL)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
@@ -485,7 +505,9 @@ bad:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if (req_conf != NULL)
 | 
						if (req_conf != NULL)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		p=CONF_get_string(req_conf,NULL,"oid_file");
 | 
							if (!load_config(bio_err, req_conf))
 | 
				
			||||||
 | 
								goto end;
 | 
				
			||||||
 | 
							p=NCONF_get_string(req_conf,NULL,"oid_file");
 | 
				
			||||||
		if (p == NULL)
 | 
							if (p == NULL)
 | 
				
			||||||
			ERR_clear_error();
 | 
								ERR_clear_error();
 | 
				
			||||||
		if (p != NULL)
 | 
							if (p != NULL)
 | 
				
			||||||
@@ -511,7 +533,7 @@ bad:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if (md_alg == NULL)
 | 
						if (md_alg == NULL)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		p=CONF_get_string(req_conf,SECTION,"default_md");
 | 
							p=NCONF_get_string(req_conf,SECTION,"default_md");
 | 
				
			||||||
		if (p == NULL)
 | 
							if (p == NULL)
 | 
				
			||||||
			ERR_clear_error();
 | 
								ERR_clear_error();
 | 
				
			||||||
		if (p != NULL)
 | 
							if (p != NULL)
 | 
				
			||||||
@@ -523,7 +545,7 @@ bad:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if (!extensions)
 | 
						if (!extensions)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		extensions = CONF_get_string(req_conf, SECTION, V3_EXTENSIONS);
 | 
							extensions = NCONF_get_string(req_conf, SECTION, V3_EXTENSIONS);
 | 
				
			||||||
		if (!extensions)
 | 
							if (!extensions)
 | 
				
			||||||
			ERR_clear_error();
 | 
								ERR_clear_error();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -531,8 +553,8 @@ bad:
 | 
				
			|||||||
		/* Check syntax of file */
 | 
							/* Check syntax of file */
 | 
				
			||||||
		X509V3_CTX ctx;
 | 
							X509V3_CTX ctx;
 | 
				
			||||||
		X509V3_set_ctx_test(&ctx);
 | 
							X509V3_set_ctx_test(&ctx);
 | 
				
			||||||
		X509V3_set_conf_lhash(&ctx, req_conf);
 | 
							X509V3_set_nconf(&ctx, req_conf);
 | 
				
			||||||
		if(!X509V3_EXT_add_conf(req_conf, &ctx, extensions, NULL)) {
 | 
							if(!X509V3_EXT_add_nconf(req_conf, &ctx, extensions, NULL)) {
 | 
				
			||||||
			BIO_printf(bio_err,
 | 
								BIO_printf(bio_err,
 | 
				
			||||||
			 "Error Loading extension section %s\n", extensions);
 | 
								 "Error Loading extension section %s\n", extensions);
 | 
				
			||||||
			goto end;
 | 
								goto end;
 | 
				
			||||||
@@ -541,19 +563,19 @@ bad:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if(!passin)
 | 
						if(!passin)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		passin = CONF_get_string(req_conf, SECTION, "input_password");
 | 
							passin = NCONF_get_string(req_conf, SECTION, "input_password");
 | 
				
			||||||
		if (!passin)
 | 
							if (!passin)
 | 
				
			||||||
			ERR_clear_error();
 | 
								ERR_clear_error();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	if(!passout)
 | 
						if(!passout)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		passout = CONF_get_string(req_conf, SECTION, "output_password");
 | 
							passout = NCONF_get_string(req_conf, SECTION, "output_password");
 | 
				
			||||||
		if (!passout)
 | 
							if (!passout)
 | 
				
			||||||
			ERR_clear_error();
 | 
								ERR_clear_error();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	p = CONF_get_string(req_conf, SECTION, STRING_MASK);
 | 
						p = NCONF_get_string(req_conf, SECTION, STRING_MASK);
 | 
				
			||||||
	if (!p)
 | 
						if (!p)
 | 
				
			||||||
		ERR_clear_error();
 | 
							ERR_clear_error();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -562,9 +584,19 @@ bad:
 | 
				
			|||||||
		goto end;
 | 
							goto end;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (chtype != MBSTRING_UTF8)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							p = NCONF_get_string(req_conf, SECTION, UTF8_IN);
 | 
				
			||||||
 | 
							if (!p)
 | 
				
			||||||
 | 
								ERR_clear_error();
 | 
				
			||||||
 | 
							else if (!strcmp(p, "yes"))
 | 
				
			||||||
 | 
								chtype = MBSTRING_UTF8;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(!req_exts)
 | 
						if(!req_exts)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		req_exts = CONF_get_string(req_conf, SECTION, REQ_EXTENSIONS);
 | 
							req_exts = NCONF_get_string(req_conf, SECTION, REQ_EXTENSIONS);
 | 
				
			||||||
		if (!req_exts)
 | 
							if (!req_exts)
 | 
				
			||||||
			ERR_clear_error();
 | 
								ERR_clear_error();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -572,8 +604,8 @@ bad:
 | 
				
			|||||||
		/* Check syntax of file */
 | 
							/* Check syntax of file */
 | 
				
			||||||
		X509V3_CTX ctx;
 | 
							X509V3_CTX ctx;
 | 
				
			||||||
		X509V3_set_ctx_test(&ctx);
 | 
							X509V3_set_ctx_test(&ctx);
 | 
				
			||||||
		X509V3_set_conf_lhash(&ctx, req_conf);
 | 
							X509V3_set_nconf(&ctx, req_conf);
 | 
				
			||||||
		if(!X509V3_EXT_add_conf(req_conf, &ctx, req_exts, NULL)) {
 | 
							if(!X509V3_EXT_add_nconf(req_conf, &ctx, req_exts, NULL)) {
 | 
				
			||||||
			BIO_printf(bio_err,
 | 
								BIO_printf(bio_err,
 | 
				
			||||||
			 "Error Loading request extension section %s\n",
 | 
								 "Error Loading request extension section %s\n",
 | 
				
			||||||
								req_exts);
 | 
													req_exts);
 | 
				
			||||||
@@ -586,65 +618,21 @@ bad:
 | 
				
			|||||||
	if ((in == NULL) || (out == NULL))
 | 
						if ((in == NULL) || (out == NULL))
 | 
				
			||||||
		goto end;
 | 
							goto end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (engine != NULL)
 | 
					        e = setup_engine(bio_err, engine, 0);
 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
		if((e = ENGINE_by_id(engine)) == NULL)
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			BIO_printf(bio_err,"invalid engine \"%s\"\n",
 | 
					 | 
				
			||||||
				engine);
 | 
					 | 
				
			||||||
			goto end;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			BIO_printf(bio_err,"can't use that engine\n");
 | 
					 | 
				
			||||||
			goto end;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
 | 
					 | 
				
			||||||
		/* Free our "structural" reference. */
 | 
					 | 
				
			||||||
		ENGINE_free(e);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (keyfile != NULL)
 | 
						if (keyfile != NULL)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		if (keyform == FORMAT_ENGINE)
 | 
							pkey = load_key(bio_err, keyfile, keyform, 0, passin, e,
 | 
				
			||||||
 | 
								"Private Key");
 | 
				
			||||||
 | 
							if (!pkey)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
			if (!e)
 | 
								/* load_key() has already printed an appropriate
 | 
				
			||||||
				{
 | 
								   message */
 | 
				
			||||||
				BIO_printf(bio_err,"no engine specified\n");
 | 
					 | 
				
			||||||
				goto end;
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			pkey = ENGINE_load_private_key(e, keyfile, NULL);
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		else
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			if (BIO_read_filename(in,keyfile) <= 0)
 | 
					 | 
				
			||||||
				{
 | 
					 | 
				
			||||||
				perror(keyfile);
 | 
					 | 
				
			||||||
				goto end;
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			if (keyform == FORMAT_ASN1)
 | 
					 | 
				
			||||||
				pkey=d2i_PrivateKey_bio(in,NULL);
 | 
					 | 
				
			||||||
			else if (keyform == FORMAT_PEM)
 | 
					 | 
				
			||||||
				{
 | 
					 | 
				
			||||||
				pkey=PEM_read_bio_PrivateKey(in,NULL,NULL,
 | 
					 | 
				
			||||||
					passin);
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			else
 | 
					 | 
				
			||||||
				{
 | 
					 | 
				
			||||||
				BIO_printf(bio_err,"bad input format specified for X509 request\n");
 | 
					 | 
				
			||||||
				goto end;
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		if (pkey == NULL)
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			BIO_printf(bio_err,"unable to load Private key\n");
 | 
					 | 
				
			||||||
			goto end;
 | 
								goto end;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		if (EVP_PKEY_type(pkey->type) == EVP_PKEY_DSA)
 | 
							if (EVP_PKEY_type(pkey->type) == EVP_PKEY_DSA)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
			char *randfile = CONF_get_string(req_conf,SECTION,"RANDFILE");
 | 
								char *randfile = NCONF_get_string(req_conf,SECTION,"RANDFILE");
 | 
				
			||||||
			if (randfile == NULL)
 | 
								if (randfile == NULL)
 | 
				
			||||||
				ERR_clear_error();
 | 
									ERR_clear_error();
 | 
				
			||||||
			app_RAND_load_file(randfile, bio_err, 0);
 | 
								app_RAND_load_file(randfile, bio_err, 0);
 | 
				
			||||||
@@ -653,7 +641,7 @@ bad:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if (newreq && (pkey == NULL))
 | 
						if (newreq && (pkey == NULL))
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		char *randfile = CONF_get_string(req_conf,SECTION,"RANDFILE");
 | 
							char *randfile = NCONF_get_string(req_conf,SECTION,"RANDFILE");
 | 
				
			||||||
		if (randfile == NULL)
 | 
							if (randfile == NULL)
 | 
				
			||||||
			ERR_clear_error();
 | 
								ERR_clear_error();
 | 
				
			||||||
		app_RAND_load_file(randfile, bio_err, 0);
 | 
							app_RAND_load_file(randfile, bio_err, 0);
 | 
				
			||||||
@@ -662,8 +650,7 @@ bad:
 | 
				
			|||||||
	
 | 
						
 | 
				
			||||||
		if (newkey <= 0)
 | 
							if (newkey <= 0)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
			newkey=(int)CONF_get_number(req_conf,SECTION,BITS);
 | 
								if (!NCONF_get_number(req_conf,SECTION,BITS, &newkey))
 | 
				
			||||||
			if (newkey <= 0)
 | 
					 | 
				
			||||||
				newkey=DEFAULT_KEY_LENGTH;
 | 
									newkey=DEFAULT_KEY_LENGTH;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -703,7 +690,7 @@ bad:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		if (keyout == NULL)
 | 
							if (keyout == NULL)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
			keyout=CONF_get_string(req_conf,SECTION,KEYFILE);
 | 
								keyout=NCONF_get_string(req_conf,SECTION,KEYFILE);
 | 
				
			||||||
			if (keyout == NULL)
 | 
								if (keyout == NULL)
 | 
				
			||||||
				ERR_clear_error();
 | 
									ERR_clear_error();
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
@@ -729,11 +716,11 @@ bad:
 | 
				
			|||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		p=CONF_get_string(req_conf,SECTION,"encrypt_rsa_key");
 | 
							p=NCONF_get_string(req_conf,SECTION,"encrypt_rsa_key");
 | 
				
			||||||
		if (p == NULL)
 | 
							if (p == NULL)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
			ERR_clear_error();
 | 
								ERR_clear_error();
 | 
				
			||||||
			p=CONF_get_string(req_conf,SECTION,"encrypt_key");
 | 
								p=NCONF_get_string(req_conf,SECTION,"encrypt_key");
 | 
				
			||||||
			if (p == NULL)
 | 
								if (p == NULL)
 | 
				
			||||||
				ERR_clear_error();
 | 
									ERR_clear_error();
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
@@ -810,7 +797,7 @@ loop:
 | 
				
			|||||||
				goto end;
 | 
									goto end;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			i=make_REQ(req,pkey,subj,!x509);
 | 
								i=make_REQ(req,pkey,subj,!x509, chtype);
 | 
				
			||||||
			subj=NULL; /* done processing '-subj' option */
 | 
								subj=NULL; /* done processing '-subj' option */
 | 
				
			||||||
			if ((kludge > 0) && !sk_X509_ATTRIBUTE_num(req->req_info->attributes))
 | 
								if ((kludge > 0) && !sk_X509_ATTRIBUTE_num(req->req_info->attributes))
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
@@ -832,28 +819,29 @@ loop:
 | 
				
			|||||||
			/* Set version to V3 */
 | 
								/* Set version to V3 */
 | 
				
			||||||
			if(!X509_set_version(x509ss, 2)) goto end;
 | 
								if(!X509_set_version(x509ss, 2)) goto end;
 | 
				
			||||||
			if (serial)
 | 
								if (serial)
 | 
				
			||||||
				X509_set_serialNumber(x509ss, serial);
 | 
									{
 | 
				
			||||||
 | 
									if (!X509_set_serialNumber(x509ss, serial)) goto end;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
			else
 | 
								else
 | 
				
			||||||
				ASN1_INTEGER_set(X509_get_serialNumber(x509ss),0L);
 | 
									{
 | 
				
			||||||
 | 
									if (!ASN1_INTEGER_set(X509_get_serialNumber(x509ss),0L)) goto end;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			X509_set_issuer_name(x509ss,
 | 
								if (!X509_set_issuer_name(x509ss, X509_REQ_get_subject_name(req))) goto end;
 | 
				
			||||||
				X509_REQ_get_subject_name(req));
 | 
								if (!X509_gmtime_adj(X509_get_notBefore(x509ss),0)) goto end;
 | 
				
			||||||
			X509_gmtime_adj(X509_get_notBefore(x509ss),0);
 | 
								if (!X509_gmtime_adj(X509_get_notAfter(x509ss), (long)60*60*24*days)) goto end;
 | 
				
			||||||
			X509_gmtime_adj(X509_get_notAfter(x509ss),
 | 
								if (!X509_set_subject_name(x509ss, X509_REQ_get_subject_name(req))) goto end;
 | 
				
			||||||
				(long)60*60*24*days);
 | 
					 | 
				
			||||||
			X509_set_subject_name(x509ss,
 | 
					 | 
				
			||||||
				X509_REQ_get_subject_name(req));
 | 
					 | 
				
			||||||
			tmppkey = X509_REQ_get_pubkey(req);
 | 
								tmppkey = X509_REQ_get_pubkey(req);
 | 
				
			||||||
			X509_set_pubkey(x509ss,tmppkey);
 | 
								if (!tmppkey || !X509_set_pubkey(x509ss,tmppkey)) goto end;
 | 
				
			||||||
			EVP_PKEY_free(tmppkey);
 | 
								EVP_PKEY_free(tmppkey);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			/* Set up V3 context struct */
 | 
								/* Set up V3 context struct */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			X509V3_set_ctx(&ext_ctx, x509ss, x509ss, NULL, NULL, 0);
 | 
								X509V3_set_ctx(&ext_ctx, x509ss, x509ss, NULL, NULL, 0);
 | 
				
			||||||
			X509V3_set_conf_lhash(&ext_ctx, req_conf);
 | 
								X509V3_set_nconf(&ext_ctx, req_conf);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			/* Add extensions */
 | 
								/* Add extensions */
 | 
				
			||||||
			if(extensions && !X509V3_EXT_add_conf(req_conf, 
 | 
								if(extensions && !X509V3_EXT_add_nconf(req_conf, 
 | 
				
			||||||
				 	&ext_ctx, extensions, x509ss))
 | 
									 	&ext_ctx, extensions, x509ss))
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
				BIO_printf(bio_err,
 | 
									BIO_printf(bio_err,
 | 
				
			||||||
@@ -872,10 +860,10 @@ loop:
 | 
				
			|||||||
			/* Set up V3 context struct */
 | 
								/* Set up V3 context struct */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			X509V3_set_ctx(&ext_ctx, NULL, NULL, req, NULL, 0);
 | 
								X509V3_set_ctx(&ext_ctx, NULL, NULL, req, NULL, 0);
 | 
				
			||||||
			X509V3_set_conf_lhash(&ext_ctx, req_conf);
 | 
								X509V3_set_nconf(&ext_ctx, req_conf);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			/* Add extensions */
 | 
								/* Add extensions */
 | 
				
			||||||
			if(req_exts && !X509V3_EXT_REQ_add_conf(req_conf, 
 | 
								if(req_exts && !X509V3_EXT_REQ_add_nconf(req_conf, 
 | 
				
			||||||
				 	&ext_ctx, req_exts, req))
 | 
									 	&ext_ctx, req_exts, req))
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
				BIO_printf(bio_err,
 | 
									BIO_printf(bio_err,
 | 
				
			||||||
@@ -902,7 +890,7 @@ loop:
 | 
				
			|||||||
			print_name(bio_err, "old subject=", X509_REQ_get_subject_name(req), nmflag);
 | 
								print_name(bio_err, "old subject=", X509_REQ_get_subject_name(req), nmflag);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (build_subject(req, subj) == 0)
 | 
							if (build_subject(req, subj, chtype) == 0)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
			BIO_printf(bio_err, "ERROR: cannot modify subject\n");
 | 
								BIO_printf(bio_err, "ERROR: cannot modify subject\n");
 | 
				
			||||||
			ex=1;
 | 
								ex=1;
 | 
				
			||||||
@@ -941,12 +929,13 @@ loop:
 | 
				
			|||||||
		else if (i == 0)
 | 
							else if (i == 0)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
			BIO_printf(bio_err,"verify failure\n");
 | 
								BIO_printf(bio_err,"verify failure\n");
 | 
				
			||||||
 | 
								ERR_print_errors(bio_err);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		else /* if (i > 0) */
 | 
							else /* if (i > 0) */
 | 
				
			||||||
			BIO_printf(bio_err,"verify OK\n");
 | 
								BIO_printf(bio_err,"verify OK\n");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (noout && !text && !modulus && !subject)
 | 
						if (noout && !text && !modulus && !subject && !pubkey)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		ex=0;
 | 
							ex=0;
 | 
				
			||||||
		goto end;
 | 
							goto end;
 | 
				
			||||||
@@ -975,12 +964,26 @@ loop:
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (pubkey)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							EVP_PKEY *tpubkey; 
 | 
				
			||||||
 | 
							tpubkey=X509_REQ_get_pubkey(req);
 | 
				
			||||||
 | 
							if (tpubkey == NULL)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								BIO_printf(bio_err,"Error getting public key\n");
 | 
				
			||||||
 | 
								ERR_print_errors(bio_err);
 | 
				
			||||||
 | 
								goto end;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							PEM_write_bio_PUBKEY(out, tpubkey);
 | 
				
			||||||
 | 
							EVP_PKEY_free(tpubkey);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (text)
 | 
						if (text)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		if (x509)
 | 
							if (x509)
 | 
				
			||||||
			X509_print(out,x509ss);
 | 
								X509_print_ex(out, x509ss, nmflag, reqflag);
 | 
				
			||||||
		else	
 | 
							else	
 | 
				
			||||||
			X509_REQ_print(out,req);
 | 
								X509_REQ_print_ex(out, req, nmflag, reqflag);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(subject) 
 | 
						if(subject) 
 | 
				
			||||||
@@ -993,24 +996,25 @@ loop:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if (modulus)
 | 
						if (modulus)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		EVP_PKEY *pubkey;
 | 
							EVP_PKEY *tpubkey;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (x509)
 | 
							if (x509)
 | 
				
			||||||
			pubkey=X509_get_pubkey(x509ss);
 | 
								tpubkey=X509_get_pubkey(x509ss);
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			pubkey=X509_REQ_get_pubkey(req);
 | 
								tpubkey=X509_REQ_get_pubkey(req);
 | 
				
			||||||
		if (pubkey == NULL)
 | 
							if (tpubkey == NULL)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
			fprintf(stdout,"Modulus=unavailable\n");
 | 
								fprintf(stdout,"Modulus=unavailable\n");
 | 
				
			||||||
			goto end; 
 | 
								goto end; 
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		fprintf(stdout,"Modulus=");
 | 
							fprintf(stdout,"Modulus=");
 | 
				
			||||||
#ifndef OPENSSL_NO_RSA
 | 
					#ifndef OPENSSL_NO_RSA
 | 
				
			||||||
		if (pubkey->type == EVP_PKEY_RSA)
 | 
							if (tpubkey->type == EVP_PKEY_RSA)
 | 
				
			||||||
			BN_print(out,pubkey->pkey.rsa->n);
 | 
								BN_print(out,tpubkey->pkey.rsa->n);
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
			fprintf(stdout,"Wrong Algorithm type");
 | 
								fprintf(stdout,"Wrong Algorithm type");
 | 
				
			||||||
 | 
							EVP_PKEY_free(tpubkey);
 | 
				
			||||||
		fprintf(stdout,"\n");
 | 
							fprintf(stdout,"\n");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1049,11 +1053,15 @@ loop:
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	ex=0;
 | 
						ex=0;
 | 
				
			||||||
end:
 | 
					end:
 | 
				
			||||||
 | 
					#ifndef MONOLITH
 | 
				
			||||||
 | 
						if(to_free)
 | 
				
			||||||
 | 
							OPENSSL_free(to_free);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
	if (ex)
 | 
						if (ex)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		ERR_print_errors(bio_err);
 | 
							ERR_print_errors(bio_err);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	if ((req_conf != NULL) && (req_conf != config)) CONF_free(req_conf);
 | 
						if ((req_conf != NULL) && (req_conf != config)) NCONF_free(req_conf);
 | 
				
			||||||
	BIO_free(in);
 | 
						BIO_free(in);
 | 
				
			||||||
	BIO_free_all(out);
 | 
						BIO_free_all(out);
 | 
				
			||||||
	EVP_PKEY_free(pkey);
 | 
						EVP_PKEY_free(pkey);
 | 
				
			||||||
@@ -1066,36 +1074,38 @@ end:
 | 
				
			|||||||
#ifndef OPENSSL_NO_DSA
 | 
					#ifndef OPENSSL_NO_DSA
 | 
				
			||||||
	if (dsa_params != NULL) DSA_free(dsa_params);
 | 
						if (dsa_params != NULL) DSA_free(dsa_params);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
						apps_shutdown();
 | 
				
			||||||
	EXIT(ex);
 | 
						EXIT(ex);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int make_REQ(X509_REQ *req, EVP_PKEY *pkey, char *subj, int attribs)
 | 
					static int make_REQ(X509_REQ *req, EVP_PKEY *pkey, char *subj, int attribs,
 | 
				
			||||||
 | 
								unsigned long chtype)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	int ret=0,i;
 | 
						int ret=0,i;
 | 
				
			||||||
	char no_prompt = 0;
 | 
						char no_prompt = 0;
 | 
				
			||||||
	STACK_OF(CONF_VALUE) *dn_sk, *attr_sk = NULL;
 | 
						STACK_OF(CONF_VALUE) *dn_sk, *attr_sk = NULL;
 | 
				
			||||||
	char *tmp, *dn_sect,*attr_sect;
 | 
						char *tmp, *dn_sect,*attr_sect;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	tmp=CONF_get_string(req_conf,SECTION,PROMPT);
 | 
						tmp=NCONF_get_string(req_conf,SECTION,PROMPT);
 | 
				
			||||||
	if (tmp == NULL)
 | 
						if (tmp == NULL)
 | 
				
			||||||
		ERR_clear_error();
 | 
							ERR_clear_error();
 | 
				
			||||||
	if((tmp != NULL) && !strcmp(tmp, "no")) no_prompt = 1;
 | 
						if((tmp != NULL) && !strcmp(tmp, "no")) no_prompt = 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	dn_sect=CONF_get_string(req_conf,SECTION,DISTINGUISHED_NAME);
 | 
						dn_sect=NCONF_get_string(req_conf,SECTION,DISTINGUISHED_NAME);
 | 
				
			||||||
	if (dn_sect == NULL)
 | 
						if (dn_sect == NULL)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		BIO_printf(bio_err,"unable to find '%s' in config\n",
 | 
							BIO_printf(bio_err,"unable to find '%s' in config\n",
 | 
				
			||||||
			DISTINGUISHED_NAME);
 | 
								DISTINGUISHED_NAME);
 | 
				
			||||||
		goto err;
 | 
							goto err;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	dn_sk=CONF_get_section(req_conf,dn_sect);
 | 
						dn_sk=NCONF_get_section(req_conf,dn_sect);
 | 
				
			||||||
	if (dn_sk == NULL)
 | 
						if (dn_sk == NULL)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		BIO_printf(bio_err,"unable to get '%s' section\n",dn_sect);
 | 
							BIO_printf(bio_err,"unable to get '%s' section\n",dn_sect);
 | 
				
			||||||
		goto err;
 | 
							goto err;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	attr_sect=CONF_get_string(req_conf,SECTION,ATTRIBUTES);
 | 
						attr_sect=NCONF_get_string(req_conf,SECTION,ATTRIBUTES);
 | 
				
			||||||
	if (attr_sect == NULL)
 | 
						if (attr_sect == NULL)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		ERR_clear_error();		
 | 
							ERR_clear_error();		
 | 
				
			||||||
@@ -1103,7 +1113,7 @@ static int make_REQ(X509_REQ *req, EVP_PKEY *pkey, char *subj, int attribs)
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		attr_sk=CONF_get_section(req_conf,attr_sect);
 | 
							attr_sk=NCONF_get_section(req_conf,attr_sect);
 | 
				
			||||||
		if (attr_sk == NULL)
 | 
							if (attr_sk == NULL)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
			BIO_printf(bio_err,"unable to get '%s' section\n",attr_sect);
 | 
								BIO_printf(bio_err,"unable to get '%s' section\n",attr_sect);
 | 
				
			||||||
@@ -1115,81 +1125,39 @@ static int make_REQ(X509_REQ *req, EVP_PKEY *pkey, char *subj, int attribs)
 | 
				
			|||||||
	if (!X509_REQ_set_version(req,0L)) goto err; /* version 1 */
 | 
						if (!X509_REQ_set_version(req,0L)) goto err; /* version 1 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (no_prompt) 
 | 
						if (no_prompt) 
 | 
				
			||||||
		i = auto_info(req, dn_sk, attr_sk, attribs);
 | 
							i = auto_info(req, dn_sk, attr_sk, attribs, chtype);
 | 
				
			||||||
	else 
 | 
						else 
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		if (subj)
 | 
							if (subj)
 | 
				
			||||||
			i = build_subject(req, subj);
 | 
								i = build_subject(req, subj, chtype);
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			i = prompt_info(req, dn_sk, dn_sect, attr_sk, attr_sect, attribs);
 | 
								i = prompt_info(req, dn_sk, dn_sect, attr_sk, attr_sect, attribs, chtype);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	if(!i) goto err;
 | 
						if(!i) goto err;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	X509_REQ_set_pubkey(req,pkey);
 | 
						if (!X509_REQ_set_pubkey(req,pkey)) goto err;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ret=1;
 | 
						ret=1;
 | 
				
			||||||
err:
 | 
					err:
 | 
				
			||||||
	return(ret);
 | 
						return(ret);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int build_subject(X509_REQ *req, char *subject)
 | 
					/*
 | 
				
			||||||
 | 
					 * subject is expected to be in the format /type0=value0/type1=value1/type2=...
 | 
				
			||||||
 | 
					 * where characters may be escaped by \
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					static int build_subject(X509_REQ *req, char *subject, unsigned long chtype)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	X509_NAME *n = NULL;
 | 
						X509_NAME *n;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	int i, nid, ne_num=0;
 | 
						if (!(n = do_subject(subject, chtype)))
 | 
				
			||||||
 | 
							return 0;
 | 
				
			||||||
	char *ne_name = NULL;
 | 
					 | 
				
			||||||
	char *ne_value = NULL;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	char *tmp = NULL;
 | 
					 | 
				
			||||||
	char *p[2];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	char *str_list[256];
 | 
					 | 
				
			||||||
       
 | 
					 | 
				
			||||||
	p[0] = ",/";
 | 
					 | 
				
			||||||
        p[1] = "=";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	n = X509_NAME_new();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	tmp = strtok(subject, p[0]);
 | 
					 | 
				
			||||||
	while((tmp != NULL) && (ne_num < (sizeof str_list/sizeof *str_list)))
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
		char *token = tmp;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		while (token[0] == ' ')
 | 
					 | 
				
			||||||
			token++;
 | 
					 | 
				
			||||||
		str_list[ne_num] = token;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		tmp = strtok(NULL, p[0]);
 | 
					 | 
				
			||||||
		ne_num++;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	for(i = 0; i < ne_num; i++)
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
		ne_name  = strtok(str_list[i], p[1]);
 | 
					 | 
				
			||||||
		ne_value = strtok(NULL, p[1]);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		if ((nid=OBJ_txt2nid(ne_name)) == NID_undef)
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			BIO_printf(bio_err, "Subject Attribute %s has no known NID, skipped\n", ne_name);
 | 
					 | 
				
			||||||
			continue;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		if (ne_value == NULL)
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			BIO_printf(bio_err, "No value provided for Subject Attribute %s, skipped\n", ne_name);
 | 
					 | 
				
			||||||
			continue;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		if (!X509_NAME_add_entry_by_NID(n, nid, MBSTRING_ASC, (unsigned char*)ne_value, -1,-1,0))
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			X509_NAME_free(n);
 | 
					 | 
				
			||||||
			return 0;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!X509_REQ_set_subject_name(req, n))
 | 
						if (!X509_REQ_set_subject_name(req, n))
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							X509_NAME_free(n);
 | 
				
			||||||
		return 0;
 | 
							return 0;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	X509_NAME_free(n);
 | 
						X509_NAME_free(n);
 | 
				
			||||||
	return 1;
 | 
						return 1;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -1197,12 +1165,14 @@ static int build_subject(X509_REQ *req, char *subject)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
static int prompt_info(X509_REQ *req,
 | 
					static int prompt_info(X509_REQ *req,
 | 
				
			||||||
		STACK_OF(CONF_VALUE) *dn_sk, char *dn_sect,
 | 
							STACK_OF(CONF_VALUE) *dn_sk, char *dn_sect,
 | 
				
			||||||
		STACK_OF(CONF_VALUE) *attr_sk, char *attr_sect, int attribs)
 | 
							STACK_OF(CONF_VALUE) *attr_sk, char *attr_sect, int attribs,
 | 
				
			||||||
 | 
							unsigned long chtype)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	int i;
 | 
						int i;
 | 
				
			||||||
	char *p,*q;
 | 
						char *p,*q;
 | 
				
			||||||
	char buf[100];
 | 
						char buf[100];
 | 
				
			||||||
	int nid,min,max;
 | 
						int nid;
 | 
				
			||||||
 | 
						long n_min,n_max;
 | 
				
			||||||
	char *type,*def,*value;
 | 
						char *type,*def,*value;
 | 
				
			||||||
	CONF_VALUE *v;
 | 
						CONF_VALUE *v;
 | 
				
			||||||
	X509_NAME *subj;
 | 
						X509_NAME *subj;
 | 
				
			||||||
@@ -1246,28 +1216,36 @@ start:		for (;;)
 | 
				
			|||||||
				}
 | 
									}
 | 
				
			||||||
			/* If OBJ not recognised ignore it */
 | 
								/* If OBJ not recognised ignore it */
 | 
				
			||||||
			if ((nid=OBJ_txt2nid(type)) == NID_undef) goto start;
 | 
								if ((nid=OBJ_txt2nid(type)) == NID_undef) goto start;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								if(strlen(v->name) > sizeof buf-9)
 | 
				
			||||||
 | 
								   {
 | 
				
			||||||
 | 
								   BIO_printf(bio_err,"Name '%s' too long\n",v->name);
 | 
				
			||||||
 | 
								   return 0;
 | 
				
			||||||
 | 
								   }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			sprintf(buf,"%s_default",v->name);
 | 
								sprintf(buf,"%s_default",v->name);
 | 
				
			||||||
			if ((def=CONF_get_string(req_conf,dn_sect,buf)) == NULL)
 | 
								if ((def=NCONF_get_string(req_conf,dn_sect,buf)) == NULL)
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
				ERR_clear_error();
 | 
									ERR_clear_error();
 | 
				
			||||||
				def="";
 | 
									def="";
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				
 | 
					 | 
				
			||||||
			sprintf(buf,"%s_value",v->name);
 | 
								sprintf(buf,"%s_value",v->name);
 | 
				
			||||||
			if ((value=CONF_get_string(req_conf,dn_sect,buf)) == NULL)
 | 
								if ((value=NCONF_get_string(req_conf,dn_sect,buf)) == NULL)
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
				ERR_clear_error();
 | 
									ERR_clear_error();
 | 
				
			||||||
				value=NULL;
 | 
									value=NULL;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			sprintf(buf,"%s_min",v->name);
 | 
								sprintf(buf,"%s_min",v->name);
 | 
				
			||||||
			min=(int)CONF_get_number(req_conf,dn_sect,buf);
 | 
								if (!NCONF_get_number(req_conf,dn_sect,buf, &n_min))
 | 
				
			||||||
 | 
									n_min = -1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			sprintf(buf,"%s_max",v->name);
 | 
								sprintf(buf,"%s_max",v->name);
 | 
				
			||||||
			max=(int)CONF_get_number(req_conf,dn_sect,buf);
 | 
								if (!NCONF_get_number(req_conf,dn_sect,buf, &n_max))
 | 
				
			||||||
 | 
									n_max = -1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (!add_DN_object(subj,v->value,def,value,nid,
 | 
								if (!add_DN_object(subj,v->value,def,value,nid,
 | 
				
			||||||
				min,max))
 | 
									n_min,n_max, chtype))
 | 
				
			||||||
				return 0;
 | 
									return 0;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		if (X509_NAME_entry_count(subj) == 0)
 | 
							if (X509_NAME_entry_count(subj) == 0)
 | 
				
			||||||
@@ -1297,8 +1275,14 @@ start2:			for (;;)
 | 
				
			|||||||
				if ((nid=OBJ_txt2nid(type)) == NID_undef)
 | 
									if ((nid=OBJ_txt2nid(type)) == NID_undef)
 | 
				
			||||||
					goto start2;
 | 
										goto start2;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									if(strlen(v->name) > sizeof buf-9)
 | 
				
			||||||
 | 
									   {
 | 
				
			||||||
 | 
									   BIO_printf(bio_err,"Name '%s' too long\n",v->name);
 | 
				
			||||||
 | 
									   return 0;
 | 
				
			||||||
 | 
									   }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				sprintf(buf,"%s_default",type);
 | 
									sprintf(buf,"%s_default",type);
 | 
				
			||||||
				if ((def=CONF_get_string(req_conf,attr_sect,buf))
 | 
									if ((def=NCONF_get_string(req_conf,attr_sect,buf))
 | 
				
			||||||
					== NULL)
 | 
										== NULL)
 | 
				
			||||||
					{
 | 
										{
 | 
				
			||||||
					ERR_clear_error();
 | 
										ERR_clear_error();
 | 
				
			||||||
@@ -1307,7 +1291,7 @@ start2:			for (;;)
 | 
				
			|||||||
				
 | 
									
 | 
				
			||||||
				
 | 
									
 | 
				
			||||||
				sprintf(buf,"%s_value",type);
 | 
									sprintf(buf,"%s_value",type);
 | 
				
			||||||
				if ((value=CONF_get_string(req_conf,attr_sect,buf))
 | 
									if ((value=NCONF_get_string(req_conf,attr_sect,buf))
 | 
				
			||||||
					== NULL)
 | 
										== NULL)
 | 
				
			||||||
					{
 | 
										{
 | 
				
			||||||
					ERR_clear_error();
 | 
										ERR_clear_error();
 | 
				
			||||||
@@ -1315,13 +1299,15 @@ start2:			for (;;)
 | 
				
			|||||||
					}
 | 
										}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				sprintf(buf,"%s_min",type);
 | 
									sprintf(buf,"%s_min",type);
 | 
				
			||||||
				min=(int)CONF_get_number(req_conf,attr_sect,buf);
 | 
									if (!NCONF_get_number(req_conf,attr_sect,buf, &n_min))
 | 
				
			||||||
 | 
										n_min = -1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				sprintf(buf,"%s_max",type);
 | 
									sprintf(buf,"%s_max",type);
 | 
				
			||||||
				max=(int)CONF_get_number(req_conf,attr_sect,buf);
 | 
									if (!NCONF_get_number(req_conf,attr_sect,buf, &n_max))
 | 
				
			||||||
 | 
										n_max = -1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				if (!add_attribute_object(req,
 | 
									if (!add_attribute_object(req,
 | 
				
			||||||
					v->value,def,value,nid,min,max))
 | 
										v->value,def,value,nid,n_min,n_max, chtype))
 | 
				
			||||||
					return 0;
 | 
										return 0;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
@@ -1337,7 +1323,7 @@ start2:			for (;;)
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int auto_info(X509_REQ *req, STACK_OF(CONF_VALUE) *dn_sk,
 | 
					static int auto_info(X509_REQ *req, STACK_OF(CONF_VALUE) *dn_sk,
 | 
				
			||||||
			STACK_OF(CONF_VALUE) *attr_sk, int attribs)
 | 
								STACK_OF(CONF_VALUE) *attr_sk, int attribs, unsigned long chtype)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	int i;
 | 
						int i;
 | 
				
			||||||
	char *p,*q;
 | 
						char *p,*q;
 | 
				
			||||||
@@ -1365,7 +1351,7 @@ static int auto_info(X509_REQ *req, STACK_OF(CONF_VALUE) *dn_sk,
 | 
				
			|||||||
				if(*p) type = p;
 | 
									if(*p) type = p;
 | 
				
			||||||
				break;
 | 
									break;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		if (!X509_NAME_add_entry_by_txt(subj,type, MBSTRING_ASC,
 | 
							if (!X509_NAME_add_entry_by_txt(subj,type, chtype,
 | 
				
			||||||
				(unsigned char *) v->value,-1,-1,0)) return 0;
 | 
									(unsigned char *) v->value,-1,-1,0)) return 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -1380,7 +1366,7 @@ static int auto_info(X509_REQ *req, STACK_OF(CONF_VALUE) *dn_sk,
 | 
				
			|||||||
			for (i = 0; i < sk_CONF_VALUE_num(attr_sk); i++)
 | 
								for (i = 0; i < sk_CONF_VALUE_num(attr_sk); i++)
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
				v=sk_CONF_VALUE_value(attr_sk,i);
 | 
									v=sk_CONF_VALUE_value(attr_sk,i);
 | 
				
			||||||
				if(!X509_REQ_add1_attr_by_txt(req, v->name, MBSTRING_ASC,
 | 
									if(!X509_REQ_add1_attr_by_txt(req, v->name, chtype,
 | 
				
			||||||
					(unsigned char *)v->value, -1)) return 0;
 | 
										(unsigned char *)v->value, -1)) return 0;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
@@ -1389,7 +1375,7 @@ static int auto_info(X509_REQ *req, STACK_OF(CONF_VALUE) *dn_sk,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int add_DN_object(X509_NAME *n, char *text, char *def, char *value,
 | 
					static int add_DN_object(X509_NAME *n, char *text, char *def, char *value,
 | 
				
			||||||
	     int nid, int min, int max)
 | 
						     int nid, int n_min, int n_max, unsigned long chtype)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	int i,ret=0;
 | 
						int i,ret=0;
 | 
				
			||||||
	MS_STATIC char buf[1024];
 | 
						MS_STATIC char buf[1024];
 | 
				
			||||||
@@ -1398,6 +1384,7 @@ start:
 | 
				
			|||||||
	(void)BIO_flush(bio_err);
 | 
						(void)BIO_flush(bio_err);
 | 
				
			||||||
	if(value != NULL)
 | 
						if(value != NULL)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
 | 
							OPENSSL_assert(strlen(value) < sizeof buf-2);
 | 
				
			||||||
		strcpy(buf,value);
 | 
							strcpy(buf,value);
 | 
				
			||||||
		strcat(buf,"\n");
 | 
							strcat(buf,"\n");
 | 
				
			||||||
		BIO_printf(bio_err,"%s\n",value);
 | 
							BIO_printf(bio_err,"%s\n",value);
 | 
				
			||||||
@@ -1407,7 +1394,7 @@ start:
 | 
				
			|||||||
		buf[0]='\0';
 | 
							buf[0]='\0';
 | 
				
			||||||
		if (!batch)
 | 
							if (!batch)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
			fgets(buf,1024,stdin);
 | 
								fgets(buf,sizeof buf,stdin);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
@@ -1436,8 +1423,8 @@ start:
 | 
				
			|||||||
#ifdef CHARSET_EBCDIC
 | 
					#ifdef CHARSET_EBCDIC
 | 
				
			||||||
	ebcdic2ascii(buf, buf, i);
 | 
						ebcdic2ascii(buf, buf, i);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
	if(!req_check_len(i, min, max)) goto start;
 | 
						if(!req_check_len(i, n_min, n_max)) goto start;
 | 
				
			||||||
	if (!X509_NAME_add_entry_by_NID(n,nid, MBSTRING_ASC,
 | 
						if (!X509_NAME_add_entry_by_NID(n,nid, chtype,
 | 
				
			||||||
				(unsigned char *) buf, -1,-1,0)) goto err;
 | 
									(unsigned char *) buf, -1,-1,0)) goto err;
 | 
				
			||||||
	ret=1;
 | 
						ret=1;
 | 
				
			||||||
err:
 | 
					err:
 | 
				
			||||||
@@ -1445,8 +1432,8 @@ err:
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int add_attribute_object(X509_REQ *req, char *text,
 | 
					static int add_attribute_object(X509_REQ *req, char *text,
 | 
				
			||||||
				char *def, char *value, int nid, int min,
 | 
									char *def, char *value, int nid, int n_min,
 | 
				
			||||||
				int max)
 | 
									int n_max, unsigned long chtype)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	int i;
 | 
						int i;
 | 
				
			||||||
	static char buf[1024];
 | 
						static char buf[1024];
 | 
				
			||||||
@@ -1456,6 +1443,7 @@ start:
 | 
				
			|||||||
	(void)BIO_flush(bio_err);
 | 
						(void)BIO_flush(bio_err);
 | 
				
			||||||
	if (value != NULL)
 | 
						if (value != NULL)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
 | 
							OPENSSL_assert(strlen(value) < sizeof buf-2);
 | 
				
			||||||
		strcpy(buf,value);
 | 
							strcpy(buf,value);
 | 
				
			||||||
		strcat(buf,"\n");
 | 
							strcat(buf,"\n");
 | 
				
			||||||
		BIO_printf(bio_err,"%s\n",value);
 | 
							BIO_printf(bio_err,"%s\n",value);
 | 
				
			||||||
@@ -1465,7 +1453,7 @@ start:
 | 
				
			|||||||
		buf[0]='\0';
 | 
							buf[0]='\0';
 | 
				
			||||||
		if (!batch)
 | 
							if (!batch)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
			fgets(buf,1024,stdin);
 | 
								fgets(buf,sizeof buf,stdin);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
@@ -1494,9 +1482,9 @@ start:
 | 
				
			|||||||
#ifdef CHARSET_EBCDIC
 | 
					#ifdef CHARSET_EBCDIC
 | 
				
			||||||
	ebcdic2ascii(buf, buf, i);
 | 
						ebcdic2ascii(buf, buf, i);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
	if(!req_check_len(i, min, max)) goto start;
 | 
						if(!req_check_len(i, n_min, n_max)) goto start;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(!X509_REQ_add1_attr_by_NID(req, nid, MBSTRING_ASC,
 | 
						if(!X509_REQ_add1_attr_by_NID(req, nid, chtype,
 | 
				
			||||||
					(unsigned char *)buf, -1)) {
 | 
										(unsigned char *)buf, -1)) {
 | 
				
			||||||
		BIO_printf(bio_err, "Error adding attribute\n");
 | 
							BIO_printf(bio_err, "Error adding attribute\n");
 | 
				
			||||||
		ERR_print_errors(bio_err);
 | 
							ERR_print_errors(bio_err);
 | 
				
			||||||
@@ -1525,16 +1513,16 @@ static void MS_CALLBACK req_cb(int p, int n, void *arg)
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int req_check_len(int len, int min, int max)
 | 
					static int req_check_len(int len, int n_min, int n_max)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	if (len < min)
 | 
						if ((n_min > 0) && (len < n_min))
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		BIO_printf(bio_err,"string is too short, it needs to be at least %d bytes long\n",min);
 | 
							BIO_printf(bio_err,"string is too short, it needs to be at least %d bytes long\n",n_min);
 | 
				
			||||||
		return(0);
 | 
							return(0);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	if ((max != 0) && (len > max))
 | 
						if ((n_max >= 0) && (len > n_max))
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		BIO_printf(bio_err,"string is too long, it needs to be less than  %d bytes long\n",max);
 | 
							BIO_printf(bio_err,"string is too long, it needs to be less than  %d bytes long\n",n_max);
 | 
				
			||||||
		return(0);
 | 
							return(0);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	return(1);
 | 
						return(1);
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										105
									
								
								apps/rsa.c
									
									
									
									
									
								
							
							
						
						
									
										105
									
								
								apps/rsa.c
									
									
									
									
									
								
							@@ -68,7 +68,6 @@
 | 
				
			|||||||
#include <openssl/evp.h>
 | 
					#include <openssl/evp.h>
 | 
				
			||||||
#include <openssl/x509.h>
 | 
					#include <openssl/x509.h>
 | 
				
			||||||
#include <openssl/pem.h>
 | 
					#include <openssl/pem.h>
 | 
				
			||||||
#include <openssl/engine.h>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#undef PROG
 | 
					#undef PROG
 | 
				
			||||||
#define PROG	rsa_main
 | 
					#define PROG	rsa_main
 | 
				
			||||||
@@ -80,6 +79,9 @@
 | 
				
			|||||||
 * -des		- encrypt output if PEM format with DES in cbc mode
 | 
					 * -des		- encrypt output if PEM format with DES in cbc mode
 | 
				
			||||||
 * -des3	- encrypt output if PEM format
 | 
					 * -des3	- encrypt output if PEM format
 | 
				
			||||||
 * -idea	- encrypt output if PEM format
 | 
					 * -idea	- encrypt output if PEM format
 | 
				
			||||||
 | 
					 * -aes128	- encrypt output if PEM format
 | 
				
			||||||
 | 
					 * -aes192	- encrypt output if PEM format
 | 
				
			||||||
 | 
					 * -aes256	- encrypt output if PEM format
 | 
				
			||||||
 * -text	- print a text version
 | 
					 * -text	- print a text version
 | 
				
			||||||
 * -modulus	- print the RSA key modulus
 | 
					 * -modulus	- print the RSA key modulus
 | 
				
			||||||
 * -check	- verify key consistency
 | 
					 * -check	- verify key consistency
 | 
				
			||||||
@@ -96,7 +98,7 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
	RSA *rsa=NULL;
 | 
						RSA *rsa=NULL;
 | 
				
			||||||
	int i,badops=0, sgckey=0;
 | 
						int i,badops=0, sgckey=0;
 | 
				
			||||||
	const EVP_CIPHER *enc=NULL;
 | 
						const EVP_CIPHER *enc=NULL;
 | 
				
			||||||
	BIO *in=NULL,*out=NULL;
 | 
						BIO *out=NULL;
 | 
				
			||||||
	int informat,outformat,text=0,check=0,noout=0;
 | 
						int informat,outformat,text=0,check=0,noout=0;
 | 
				
			||||||
	int pubin = 0, pubout = 0;
 | 
						int pubin = 0, pubout = 0;
 | 
				
			||||||
	char *infile,*outfile,*prog;
 | 
						char *infile,*outfile,*prog;
 | 
				
			||||||
@@ -111,6 +113,9 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
		if ((bio_err=BIO_new(BIO_s_file())) != NULL)
 | 
							if ((bio_err=BIO_new(BIO_s_file())) != NULL)
 | 
				
			||||||
			BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
 | 
								BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!load_config(bio_err, NULL))
 | 
				
			||||||
 | 
							goto end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	infile=NULL;
 | 
						infile=NULL;
 | 
				
			||||||
	outfile=NULL;
 | 
						outfile=NULL;
 | 
				
			||||||
	informat=FORMAT_PEM;
 | 
						informat=FORMAT_PEM;
 | 
				
			||||||
@@ -196,6 +201,10 @@ bad:
 | 
				
			|||||||
		BIO_printf(bio_err," -des3           encrypt PEM output with ede cbc des using 168 bit key\n");
 | 
							BIO_printf(bio_err," -des3           encrypt PEM output with ede cbc des using 168 bit key\n");
 | 
				
			||||||
#ifndef OPENSSL_NO_IDEA
 | 
					#ifndef OPENSSL_NO_IDEA
 | 
				
			||||||
		BIO_printf(bio_err," -idea           encrypt PEM output with cbc idea\n");
 | 
							BIO_printf(bio_err," -idea           encrypt PEM output with cbc idea\n");
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_AES
 | 
				
			||||||
 | 
							BIO_printf(bio_err," -aes128, -aes192, -aes256\n");
 | 
				
			||||||
 | 
							BIO_printf(bio_err,"                 encrypt PEM output with cbc aes\n");
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
		BIO_printf(bio_err," -text           print the key in text\n");
 | 
							BIO_printf(bio_err," -text           print the key in text\n");
 | 
				
			||||||
		BIO_printf(bio_err," -noout          don't print key out\n");
 | 
							BIO_printf(bio_err," -noout          don't print key out\n");
 | 
				
			||||||
@@ -209,23 +218,7 @@ bad:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	ERR_load_crypto_strings();
 | 
						ERR_load_crypto_strings();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (engine != NULL)
 | 
					        e = setup_engine(bio_err, engine, 0);
 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
		if((e = ENGINE_by_id(engine)) == NULL)
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			BIO_printf(bio_err,"invalid engine \"%s\"\n",
 | 
					 | 
				
			||||||
				engine);
 | 
					 | 
				
			||||||
			goto end;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			BIO_printf(bio_err,"can't use that engine\n");
 | 
					 | 
				
			||||||
			goto end;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
 | 
					 | 
				
			||||||
		/* Free our "structural" reference. */
 | 
					 | 
				
			||||||
		ENGINE_free(e);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(!app_passwd(bio_err, passargin, passargout, &passin, &passout)) {
 | 
						if(!app_passwd(bio_err, passargin, passargout, &passin, &passout)) {
 | 
				
			||||||
		BIO_printf(bio_err, "Error getting passwords\n");
 | 
							BIO_printf(bio_err, "Error getting passwords\n");
 | 
				
			||||||
@@ -237,69 +230,29 @@ bad:
 | 
				
			|||||||
		goto end;
 | 
							goto end;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	in=BIO_new(BIO_s_file());
 | 
					 | 
				
			||||||
	out=BIO_new(BIO_s_file());
 | 
						out=BIO_new(BIO_s_file());
 | 
				
			||||||
	if ((in == NULL) || (out == NULL))
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
		ERR_print_errors(bio_err);
 | 
					 | 
				
			||||||
		goto end;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (infile == NULL)
 | 
						{
 | 
				
			||||||
		BIO_set_fp(in,stdin,BIO_NOCLOSE);
 | 
							EVP_PKEY	*pkey;
 | 
				
			||||||
	else
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
		if (BIO_read_filename(in,infile) <= 0)
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			perror(infile);
 | 
					 | 
				
			||||||
			goto end;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	BIO_printf(bio_err,"read RSA key\n");
 | 
							if (pubin)
 | 
				
			||||||
	if	(informat == FORMAT_ASN1) {
 | 
								pkey = load_pubkey(bio_err, infile,
 | 
				
			||||||
		if (pubin) rsa=d2i_RSA_PUBKEY_bio(in,NULL);
 | 
									(informat == FORMAT_NETSCAPE && sgckey ?
 | 
				
			||||||
		else rsa=d2i_RSAPrivateKey_bio(in,NULL);
 | 
										FORMAT_IISSGC : informat), 1,
 | 
				
			||||||
 | 
									passin, e, "Public Key");
 | 
				
			||||||
 | 
							else
 | 
				
			||||||
 | 
								pkey = load_key(bio_err, infile,
 | 
				
			||||||
 | 
									(informat == FORMAT_NETSCAPE && sgckey ?
 | 
				
			||||||
 | 
										FORMAT_IISSGC : informat), 1,
 | 
				
			||||||
 | 
									passin, e, "Private Key");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (pkey != NULL)
 | 
				
			||||||
 | 
							rsa = pkey == NULL ? NULL : EVP_PKEY_get1_RSA(pkey);
 | 
				
			||||||
 | 
							EVP_PKEY_free(pkey);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
#ifndef OPENSSL_NO_RC4
 | 
					 | 
				
			||||||
	else if (informat == FORMAT_NETSCAPE)
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
		BUF_MEM *buf=NULL;
 | 
					 | 
				
			||||||
		const unsigned char *p;
 | 
					 | 
				
			||||||
		int size=0;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		buf=BUF_MEM_new();
 | 
					 | 
				
			||||||
		for (;;)
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			if ((buf == NULL) || (!BUF_MEM_grow(buf,size+1024*10)))
 | 
					 | 
				
			||||||
				goto end;
 | 
					 | 
				
			||||||
			i=BIO_read(in,&(buf->data[size]),1024*10);
 | 
					 | 
				
			||||||
			size+=i;
 | 
					 | 
				
			||||||
			if (i == 0) break;
 | 
					 | 
				
			||||||
			if (i < 0)
 | 
					 | 
				
			||||||
				{
 | 
					 | 
				
			||||||
				perror("reading private key");
 | 
					 | 
				
			||||||
				BUF_MEM_free(buf);
 | 
					 | 
				
			||||||
				goto end;
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		p=(unsigned char *)buf->data;
 | 
					 | 
				
			||||||
		rsa=d2i_RSA_NET(NULL,&p,(long)size,NULL, sgckey);
 | 
					 | 
				
			||||||
		BUF_MEM_free(buf);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
	else if (informat == FORMAT_PEM) {
 | 
					 | 
				
			||||||
		if(pubin) rsa=PEM_read_bio_RSA_PUBKEY(in,NULL,NULL,NULL);
 | 
					 | 
				
			||||||
		else rsa=PEM_read_bio_RSAPrivateKey(in,NULL, NULL,passin);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	else
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
		BIO_printf(bio_err,"bad input format specified for key\n");
 | 
					 | 
				
			||||||
		goto end;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	if (rsa == NULL)
 | 
						if (rsa == NULL)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		BIO_printf(bio_err,"unable to load key\n");
 | 
					 | 
				
			||||||
		ERR_print_errors(bio_err);
 | 
							ERR_print_errors(bio_err);
 | 
				
			||||||
		goto end;
 | 
							goto end;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -411,11 +364,11 @@ bad:
 | 
				
			|||||||
	else
 | 
						else
 | 
				
			||||||
		ret=0;
 | 
							ret=0;
 | 
				
			||||||
end:
 | 
					end:
 | 
				
			||||||
	if(in != NULL) BIO_free(in);
 | 
					 | 
				
			||||||
	if(out != NULL) BIO_free_all(out);
 | 
						if(out != NULL) BIO_free_all(out);
 | 
				
			||||||
	if(rsa != NULL) RSA_free(rsa);
 | 
						if(rsa != NULL) RSA_free(rsa);
 | 
				
			||||||
	if(passin) OPENSSL_free(passin);
 | 
						if(passin) OPENSSL_free(passin);
 | 
				
			||||||
	if(passout) OPENSSL_free(passout);
 | 
						if(passout) OPENSSL_free(passout);
 | 
				
			||||||
 | 
						apps_shutdown();
 | 
				
			||||||
	EXIT(ret);
 | 
						EXIT(ret);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
#else /* !OPENSSL_NO_RSA */
 | 
					#else /* !OPENSSL_NO_RSA */
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -62,7 +62,6 @@
 | 
				
			|||||||
#include <string.h>
 | 
					#include <string.h>
 | 
				
			||||||
#include <openssl/err.h>
 | 
					#include <openssl/err.h>
 | 
				
			||||||
#include <openssl/pem.h>
 | 
					#include <openssl/pem.h>
 | 
				
			||||||
#include <openssl/engine.h>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define RSA_SIGN 	1
 | 
					#define RSA_SIGN 	1
 | 
				
			||||||
#define RSA_VERIFY 	2
 | 
					#define RSA_VERIFY 	2
 | 
				
			||||||
@@ -105,6 +104,9 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
	argv++;
 | 
						argv++;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(!bio_err) bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
 | 
						if(!bio_err) bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!load_config(bio_err, NULL))
 | 
				
			||||||
 | 
							goto end;
 | 
				
			||||||
	ERR_load_crypto_strings();
 | 
						ERR_load_crypto_strings();
 | 
				
			||||||
	OpenSSL_add_all_algorithms();
 | 
						OpenSSL_add_all_algorithms();
 | 
				
			||||||
	pad = RSA_PKCS1_PADDING;
 | 
						pad = RSA_PKCS1_PADDING;
 | 
				
			||||||
@@ -120,6 +122,9 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
		} else if(!strcmp(*argv, "-inkey")) {
 | 
							} else if(!strcmp(*argv, "-inkey")) {
 | 
				
			||||||
			if (--argc < 1) badarg = 1;
 | 
								if (--argc < 1) badarg = 1;
 | 
				
			||||||
			keyfile = *(++argv);
 | 
								keyfile = *(++argv);
 | 
				
			||||||
 | 
							} else if (strcmp(*argv,"-keyform") == 0) {
 | 
				
			||||||
 | 
								if (--argc < 1) badarg = 1;
 | 
				
			||||||
 | 
								keyform=str2fmt(*(++argv));
 | 
				
			||||||
		} else if(!strcmp(*argv, "-engine")) {
 | 
							} else if(!strcmp(*argv, "-engine")) {
 | 
				
			||||||
			if (--argc < 1) badarg = 1;
 | 
								if (--argc < 1) badarg = 1;
 | 
				
			||||||
			engine = *(++argv);
 | 
								engine = *(++argv);
 | 
				
			||||||
@@ -157,38 +162,25 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
		goto end;
 | 
							goto end;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (engine != NULL)
 | 
					        e = setup_engine(bio_err, engine, 0);
 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
		if((e = ENGINE_by_id(engine)) == NULL)
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			BIO_printf(bio_err,"invalid engine \"%s\"\n",
 | 
					 | 
				
			||||||
				engine);
 | 
					 | 
				
			||||||
			goto end;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			BIO_printf(bio_err,"can't use that engine\n");
 | 
					 | 
				
			||||||
			goto end;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
 | 
					 | 
				
			||||||
		/* Free our "structural" reference. */
 | 
					 | 
				
			||||||
		ENGINE_free(e);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* FIXME: seed PRNG only if needed */
 | 
					/* FIXME: seed PRNG only if needed */
 | 
				
			||||||
	app_RAND_load_file(NULL, bio_err, 0);
 | 
						app_RAND_load_file(NULL, bio_err, 0);
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	switch(key_type) {
 | 
						switch(key_type) {
 | 
				
			||||||
		case KEY_PRIVKEY:
 | 
							case KEY_PRIVKEY:
 | 
				
			||||||
		pkey = load_key(bio_err, keyfile, keyform, NULL, e);
 | 
							pkey = load_key(bio_err, keyfile, keyform, 0,
 | 
				
			||||||
 | 
								NULL, e, "Private Key");
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		case KEY_PUBKEY:
 | 
							case KEY_PUBKEY:
 | 
				
			||||||
		pkey = load_pubkey(bio_err, keyfile, keyform, e);
 | 
							pkey = load_pubkey(bio_err, keyfile, keyform, 0,
 | 
				
			||||||
 | 
								NULL, e, "Public Key");
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		case KEY_CERT:
 | 
							case KEY_CERT:
 | 
				
			||||||
		x = load_cert(bio_err, keyfile, keyform);
 | 
							x = load_cert(bio_err, keyfile, keyform,
 | 
				
			||||||
 | 
								NULL, e, "Certificate");
 | 
				
			||||||
		if(x) {
 | 
							if(x) {
 | 
				
			||||||
			pkey = X509_get_pubkey(x);
 | 
								pkey = X509_get_pubkey(x);
 | 
				
			||||||
			X509_free(x);
 | 
								X509_free(x);
 | 
				
			||||||
@@ -197,7 +189,6 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(!pkey) {
 | 
						if(!pkey) {
 | 
				
			||||||
		BIO_printf(bio_err, "Error loading key\n");
 | 
					 | 
				
			||||||
		return 1;
 | 
							return 1;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -302,6 +293,7 @@ static void usage()
 | 
				
			|||||||
	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, "-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, "-pubin          input is an RSA public\n");
 | 
						BIO_printf(bio_err, "-pubin          input is an RSA public\n");
 | 
				
			||||||
	BIO_printf(bio_err, "-certin         input is a certificate carrying an RSA public key\n");
 | 
						BIO_printf(bio_err, "-certin         input is a certificate carrying an RSA public key\n");
 | 
				
			||||||
	BIO_printf(bio_err, "-ssl            use SSL v2 padding\n");
 | 
						BIO_printf(bio_err, "-ssl            use SSL v2 padding\n");
 | 
				
			||||||
@@ -313,6 +305,8 @@ static void usage()
 | 
				
			|||||||
	BIO_printf(bio_err, "-encrypt        encrypt with public key\n");
 | 
						BIO_printf(bio_err, "-encrypt        encrypt with public key\n");
 | 
				
			||||||
	BIO_printf(bio_err, "-decrypt        decrypt with private key\n");
 | 
						BIO_printf(bio_err, "-decrypt        decrypt with private key\n");
 | 
				
			||||||
	BIO_printf(bio_err, "-hexdump        hex dump output\n");
 | 
						BIO_printf(bio_err, "-hexdump        hex dump output\n");
 | 
				
			||||||
 | 
						BIO_printf(bio_err, "-engine e       use engine e, possibly a hardware device.\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -55,6 +55,59 @@
 | 
				
			|||||||
 * copied and put under another distribution licence
 | 
					 * copied and put under another distribution licence
 | 
				
			||||||
 * [including the GNU Public Licence.]
 | 
					 * [including the GNU Public Licence.]
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					/* ====================================================================
 | 
				
			||||||
 | 
					 * Copyright (c) 1998-2001 The OpenSSL Project.  All rights reserved.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Redistribution and use in source and binary forms, with or without
 | 
				
			||||||
 | 
					 * modification, are permitted provided that the following conditions
 | 
				
			||||||
 | 
					 * are met:
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 1. Redistributions of source code must retain the above copyright
 | 
				
			||||||
 | 
					 *    notice, this list of conditions and the following disclaimer. 
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 2. Redistributions in binary form must reproduce the above copyright
 | 
				
			||||||
 | 
					 *    notice, this list of conditions and the following disclaimer in
 | 
				
			||||||
 | 
					 *    the documentation and/or other materials provided with the
 | 
				
			||||||
 | 
					 *    distribution.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 3. All advertising materials mentioning features or use of this
 | 
				
			||||||
 | 
					 *    software must display the following acknowledgment:
 | 
				
			||||||
 | 
					 *    "This product includes software developed by the OpenSSL Project
 | 
				
			||||||
 | 
					 *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
 | 
				
			||||||
 | 
					 *    endorse or promote products derived from this software without
 | 
				
			||||||
 | 
					 *    prior written permission. For written permission, please contact
 | 
				
			||||||
 | 
					 *    openssl-core@openssl.org.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 5. Products derived from this software may not be called "OpenSSL"
 | 
				
			||||||
 | 
					 *    nor may "OpenSSL" appear in their names without prior written
 | 
				
			||||||
 | 
					 *    permission of the OpenSSL Project.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 6. Redistributions of any form whatsoever must retain the following
 | 
				
			||||||
 | 
					 *    acknowledgment:
 | 
				
			||||||
 | 
					 *    "This product includes software developed by the OpenSSL Project
 | 
				
			||||||
 | 
					 *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
 | 
				
			||||||
 | 
					 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 | 
				
			||||||
 | 
					 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 | 
				
			||||||
 | 
					 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
 | 
				
			||||||
 | 
					 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 | 
				
			||||||
 | 
					 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 | 
				
			||||||
 | 
					 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 | 
				
			||||||
 | 
					 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 | 
				
			||||||
 | 
					 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 | 
				
			||||||
 | 
					 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 | 
				
			||||||
 | 
					 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 | 
				
			||||||
 | 
					 * OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
				
			||||||
 | 
					 * ====================================================================
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This product includes cryptographic software written by Eric Young
 | 
				
			||||||
 | 
					 * (eay@cryptsoft.com).  This product includes software written by Tim
 | 
				
			||||||
 | 
					 * Hudson (tjh@cryptsoft.com).
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <sys/types.h>
 | 
					#include <sys/types.h>
 | 
				
			||||||
#include <openssl/opensslconf.h>
 | 
					#include <openssl/opensslconf.h>
 | 
				
			||||||
@@ -89,13 +142,9 @@ typedef fd_mask fd_set;
 | 
				
			|||||||
int do_server(int port, int *ret, int (*cb) (), char *context);
 | 
					int do_server(int port, int *ret, int (*cb) (), char *context);
 | 
				
			||||||
#ifdef HEADER_X509_H
 | 
					#ifdef HEADER_X509_H
 | 
				
			||||||
int MS_CALLBACK verify_callback(int ok, X509_STORE_CTX *ctx);
 | 
					int MS_CALLBACK verify_callback(int ok, X509_STORE_CTX *ctx);
 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
int MS_CALLBACK verify_callback(int ok, char *ctx);
 | 
					 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#ifdef HEADER_SSL_H
 | 
					#ifdef HEADER_SSL_H
 | 
				
			||||||
int set_cert_stuff(SSL_CTX *ctx, char *cert_file, char *key_file);
 | 
					int set_cert_stuff(SSL_CTX *ctx, char *cert_file, char *key_file);
 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
int set_cert_stuff(char *ctx, char *cert_file, char *key_file);
 | 
					 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
int init_client(int *sock, char *server, int port);
 | 
					int init_client(int *sock, char *server, int port);
 | 
				
			||||||
int should_retry(int i);
 | 
					int should_retry(int i);
 | 
				
			||||||
@@ -106,8 +155,6 @@ long MS_CALLBACK bio_dump_cb(BIO *bio, int cmd, const char *argp,
 | 
				
			|||||||
	int argi, long argl, long ret);
 | 
						int argi, long argl, long ret);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef HEADER_SSL_H
 | 
					#ifdef HEADER_SSL_H
 | 
				
			||||||
void MS_CALLBACK apps_ssl_info_callback(SSL *s, int where, int ret);
 | 
					void MS_CALLBACK apps_ssl_info_callback(const SSL *s, int where, int ret);
 | 
				
			||||||
#else
 | 
					void MS_CALLBACK msg_cb(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg);
 | 
				
			||||||
void MS_CALLBACK apps_ssl_info_callback(char *s, int where, int ret);
 | 
					 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										317
									
								
								apps/s_cb.c
									
									
									
									
									
								
							
							
						
						
									
										317
									
								
								apps/s_cb.c
									
									
									
									
									
								
							@@ -55,6 +55,59 @@
 | 
				
			|||||||
 * copied and put under another distribution licence
 | 
					 * copied and put under another distribution licence
 | 
				
			||||||
 * [including the GNU Public Licence.]
 | 
					 * [including the GNU Public Licence.]
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					/* ====================================================================
 | 
				
			||||||
 | 
					 * Copyright (c) 1998-2001 The OpenSSL Project.  All rights reserved.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Redistribution and use in source and binary forms, with or without
 | 
				
			||||||
 | 
					 * modification, are permitted provided that the following conditions
 | 
				
			||||||
 | 
					 * are met:
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 1. Redistributions of source code must retain the above copyright
 | 
				
			||||||
 | 
					 *    notice, this list of conditions and the following disclaimer. 
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 2. Redistributions in binary form must reproduce the above copyright
 | 
				
			||||||
 | 
					 *    notice, this list of conditions and the following disclaimer in
 | 
				
			||||||
 | 
					 *    the documentation and/or other materials provided with the
 | 
				
			||||||
 | 
					 *    distribution.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 3. All advertising materials mentioning features or use of this
 | 
				
			||||||
 | 
					 *    software must display the following acknowledgment:
 | 
				
			||||||
 | 
					 *    "This product includes software developed by the OpenSSL Project
 | 
				
			||||||
 | 
					 *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
 | 
				
			||||||
 | 
					 *    endorse or promote products derived from this software without
 | 
				
			||||||
 | 
					 *    prior written permission. For written permission, please contact
 | 
				
			||||||
 | 
					 *    openssl-core@openssl.org.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 5. Products derived from this software may not be called "OpenSSL"
 | 
				
			||||||
 | 
					 *    nor may "OpenSSL" appear in their names without prior written
 | 
				
			||||||
 | 
					 *    permission of the OpenSSL Project.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 6. Redistributions of any form whatsoever must retain the following
 | 
				
			||||||
 | 
					 *    acknowledgment:
 | 
				
			||||||
 | 
					 *    "This product includes software developed by the OpenSSL Project
 | 
				
			||||||
 | 
					 *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
 | 
				
			||||||
 | 
					 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 | 
				
			||||||
 | 
					 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 | 
				
			||||||
 | 
					 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
 | 
				
			||||||
 | 
					 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 | 
				
			||||||
 | 
					 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 | 
				
			||||||
 | 
					 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 | 
				
			||||||
 | 
					 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 | 
				
			||||||
 | 
					 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 | 
				
			||||||
 | 
					 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 | 
				
			||||||
 | 
					 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 | 
				
			||||||
 | 
					 * OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
				
			||||||
 | 
					 * ====================================================================
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This product includes cryptographic software written by Eric Young
 | 
				
			||||||
 | 
					 * (eay@cryptsoft.com).  This product includes software written by Tim
 | 
				
			||||||
 | 
					 * Hudson (tjh@cryptsoft.com).
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdio.h>
 | 
					#include <stdio.h>
 | 
				
			||||||
#include <stdlib.h>
 | 
					#include <stdlib.h>
 | 
				
			||||||
@@ -81,7 +134,7 @@ int MS_CALLBACK verify_callback(int ok, X509_STORE_CTX *ctx)
 | 
				
			|||||||
	err=	X509_STORE_CTX_get_error(ctx);
 | 
						err=	X509_STORE_CTX_get_error(ctx);
 | 
				
			||||||
	depth=	X509_STORE_CTX_get_error_depth(ctx);
 | 
						depth=	X509_STORE_CTX_get_error_depth(ctx);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	X509_NAME_oneline(X509_get_subject_name(err_cert),buf,256);
 | 
						X509_NAME_oneline(X509_get_subject_name(err_cert),buf,sizeof buf);
 | 
				
			||||||
	BIO_printf(bio_err,"depth=%d %s\n",depth,buf);
 | 
						BIO_printf(bio_err,"depth=%d %s\n",depth,buf);
 | 
				
			||||||
	if (!ok)
 | 
						if (!ok)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
@@ -101,7 +154,7 @@ int MS_CALLBACK verify_callback(int ok, X509_STORE_CTX *ctx)
 | 
				
			|||||||
	switch (ctx->error)
 | 
						switch (ctx->error)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
	case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT:
 | 
						case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT:
 | 
				
			||||||
		X509_NAME_oneline(X509_get_issuer_name(ctx->current_cert),buf,256);
 | 
							X509_NAME_oneline(X509_get_issuer_name(ctx->current_cert),buf,sizeof buf);
 | 
				
			||||||
		BIO_printf(bio_err,"issuer= %s\n",buf);
 | 
							BIO_printf(bio_err,"issuer= %s\n",buf);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case X509_V_ERR_CERT_NOT_YET_VALID:
 | 
						case X509_V_ERR_CERT_NOT_YET_VALID:
 | 
				
			||||||
@@ -200,7 +253,7 @@ long MS_CALLBACK bio_dump_cb(BIO *bio, int cmd, const char *argp, int argi,
 | 
				
			|||||||
	return(ret);
 | 
						return(ret);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void MS_CALLBACK apps_ssl_info_callback(SSL *s, int where, int ret)
 | 
					void MS_CALLBACK apps_ssl_info_callback(const SSL *s, int where, int ret)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	char *str;
 | 
						char *str;
 | 
				
			||||||
	int w;
 | 
						int w;
 | 
				
			||||||
@@ -236,3 +289,261 @@ void MS_CALLBACK apps_ssl_info_callback(SSL *s, int where, int ret)
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void MS_CALLBACK msg_cb(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						BIO *bio = arg;
 | 
				
			||||||
 | 
						const char *str_write_p, *str_version, *str_content_type = "", *str_details1 = "", *str_details2= "";
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						str_write_p = write_p ? ">>>" : "<<<";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						switch (version)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
						case SSL2_VERSION:
 | 
				
			||||||
 | 
							str_version = "SSL 2.0";
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
						case SSL3_VERSION:
 | 
				
			||||||
 | 
							str_version = "SSL 3.0 ";
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
						case TLS1_VERSION:
 | 
				
			||||||
 | 
							str_version = "TLS 1.0 ";
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
						default:
 | 
				
			||||||
 | 
							str_version = "???";
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (version == SSL2_VERSION)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							str_details1 = "???";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (len > 0)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								switch (((unsigned char*)buf)[0])
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
									case 0:
 | 
				
			||||||
 | 
										str_details1 = ", ERROR:";
 | 
				
			||||||
 | 
										str_details2 = " ???";
 | 
				
			||||||
 | 
										if (len >= 3)
 | 
				
			||||||
 | 
											{
 | 
				
			||||||
 | 
											unsigned err = (((unsigned char*)buf)[1]<<8) + ((unsigned char*)buf)[2];
 | 
				
			||||||
 | 
											
 | 
				
			||||||
 | 
											switch (err)
 | 
				
			||||||
 | 
												{
 | 
				
			||||||
 | 
											case 0x0001:
 | 
				
			||||||
 | 
												str_details2 = " NO-CIPHER-ERROR";
 | 
				
			||||||
 | 
												break;
 | 
				
			||||||
 | 
											case 0x0002:
 | 
				
			||||||
 | 
												str_details2 = " NO-CERTIFICATE-ERROR";
 | 
				
			||||||
 | 
												break;
 | 
				
			||||||
 | 
											case 0x0004:
 | 
				
			||||||
 | 
												str_details2 = " BAD-CERTIFICATE-ERROR";
 | 
				
			||||||
 | 
												break;
 | 
				
			||||||
 | 
											case 0x0006:
 | 
				
			||||||
 | 
												str_details2 = " UNSUPPORTED-CERTIFICATE-TYPE-ERROR";
 | 
				
			||||||
 | 
												break;
 | 
				
			||||||
 | 
												}
 | 
				
			||||||
 | 
											}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
									case 1:
 | 
				
			||||||
 | 
										str_details1 = ", CLIENT-HELLO";
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
									case 2:
 | 
				
			||||||
 | 
										str_details1 = ", CLIENT-MASTER-KEY";
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
									case 3:
 | 
				
			||||||
 | 
										str_details1 = ", CLIENT-FINISHED";
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
									case 4:
 | 
				
			||||||
 | 
										str_details1 = ", SERVER-HELLO";
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
									case 5:
 | 
				
			||||||
 | 
										str_details1 = ", SERVER-VERIFY";
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
									case 6:
 | 
				
			||||||
 | 
										str_details1 = ", SERVER-FINISHED";
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
									case 7:
 | 
				
			||||||
 | 
										str_details1 = ", REQUEST-CERTIFICATE";
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
									case 8:
 | 
				
			||||||
 | 
										str_details1 = ", CLIENT-CERTIFICATE";
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (version == SSL3_VERSION || version == TLS1_VERSION)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							switch (content_type)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
							case 20:
 | 
				
			||||||
 | 
								str_content_type = "ChangeCipherSpec";
 | 
				
			||||||
 | 
								break;
 | 
				
			||||||
 | 
							case 21:
 | 
				
			||||||
 | 
								str_content_type = "Alert";
 | 
				
			||||||
 | 
								break;
 | 
				
			||||||
 | 
							case 22:
 | 
				
			||||||
 | 
								str_content_type = "Handshake";
 | 
				
			||||||
 | 
								break;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (content_type == 21) /* Alert */
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								str_details1 = ", ???";
 | 
				
			||||||
 | 
								
 | 
				
			||||||
 | 
								if (len == 2)
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
									switch (((unsigned char*)buf)[0])
 | 
				
			||||||
 | 
										{
 | 
				
			||||||
 | 
									case 1:
 | 
				
			||||||
 | 
										str_details1 = ", warning";
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
									case 2:
 | 
				
			||||||
 | 
										str_details1 = ", fatal";
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									str_details2 = " ???";
 | 
				
			||||||
 | 
									switch (((unsigned char*)buf)[1])
 | 
				
			||||||
 | 
										{
 | 
				
			||||||
 | 
									case 0:
 | 
				
			||||||
 | 
										str_details2 = " close_notify";
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
									case 10:
 | 
				
			||||||
 | 
										str_details2 = " unexpected_message";
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
									case 20:
 | 
				
			||||||
 | 
										str_details2 = " bad_record_mac";
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
									case 21:
 | 
				
			||||||
 | 
										str_details2 = " decryption_failed";
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
									case 22:
 | 
				
			||||||
 | 
										str_details2 = " record_overflow";
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
									case 30:
 | 
				
			||||||
 | 
										str_details2 = " decompression_failure";
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
									case 40:
 | 
				
			||||||
 | 
										str_details2 = " handshake_failure";
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
									case 42:
 | 
				
			||||||
 | 
										str_details2 = " bad_certificate";
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
									case 43:
 | 
				
			||||||
 | 
										str_details2 = " unsupported_certificate";
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
									case 44:
 | 
				
			||||||
 | 
										str_details2 = " certificate_revoked";
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
									case 45:
 | 
				
			||||||
 | 
										str_details2 = " certificate_expired";
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
									case 46:
 | 
				
			||||||
 | 
										str_details2 = " certificate_unknown";
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
									case 47:
 | 
				
			||||||
 | 
										str_details2 = " illegal_parameter";
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
									case 48:
 | 
				
			||||||
 | 
										str_details2 = " unknown_ca";
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
									case 49:
 | 
				
			||||||
 | 
										str_details2 = " access_denied";
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
									case 50:
 | 
				
			||||||
 | 
										str_details2 = " decode_error";
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
									case 51:
 | 
				
			||||||
 | 
										str_details2 = " decrypt_error";
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
									case 60:
 | 
				
			||||||
 | 
										str_details2 = " export_restriction";
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
									case 70:
 | 
				
			||||||
 | 
										str_details2 = " protocol_version";
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
									case 71:
 | 
				
			||||||
 | 
										str_details2 = " insufficient_security";
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
									case 80:
 | 
				
			||||||
 | 
										str_details2 = " internal_error";
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
									case 90:
 | 
				
			||||||
 | 
										str_details2 = " user_canceled";
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
									case 100:
 | 
				
			||||||
 | 
										str_details2 = " no_renegotiation";
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							if (content_type == 22) /* Handshake */
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								str_details1 = "???";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								if (len > 0)
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
									switch (((unsigned char*)buf)[0])
 | 
				
			||||||
 | 
										{
 | 
				
			||||||
 | 
									case 0:
 | 
				
			||||||
 | 
										str_details1 = ", HelloRequest";
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
									case 1:
 | 
				
			||||||
 | 
										str_details1 = ", ClientHello";
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
									case 2:
 | 
				
			||||||
 | 
										str_details1 = ", ServerHello";
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
									case 11:
 | 
				
			||||||
 | 
										str_details1 = ", Certificate";
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
									case 12:
 | 
				
			||||||
 | 
										str_details1 = ", ServerKeyExchange";
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
									case 13:
 | 
				
			||||||
 | 
										str_details1 = ", CertificateRequest";
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
									case 14:
 | 
				
			||||||
 | 
										str_details1 = ", ServerHelloDone";
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
									case 15:
 | 
				
			||||||
 | 
										str_details1 = ", CertificateVerify";
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
									case 16:
 | 
				
			||||||
 | 
										str_details1 = ", ClientKeyExchange";
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
									case 20:
 | 
				
			||||||
 | 
										str_details1 = ", Finished";
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						BIO_printf(bio, "%s %s%s [length %04lx]%s%s\n", str_write_p, str_version, str_content_type, (unsigned long)len, str_details1, str_details2);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (len > 0)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							size_t num, i;
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							BIO_printf(bio, "   ");
 | 
				
			||||||
 | 
							num = len;
 | 
				
			||||||
 | 
					#if 0
 | 
				
			||||||
 | 
							if (num > 16)
 | 
				
			||||||
 | 
								num = 16;
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
							for (i = 0; i < num; i++)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								if (i % 16 == 0 && i > 0)
 | 
				
			||||||
 | 
									BIO_printf(bio, "\n   ");
 | 
				
			||||||
 | 
								BIO_printf(bio, " %02x", ((unsigned char*)buf)[i]);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							if (i < len)
 | 
				
			||||||
 | 
								BIO_printf(bio, " ...");
 | 
				
			||||||
 | 
							BIO_printf(bio, "\n");
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						BIO_flush(bio);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										178
									
								
								apps/s_client.c
									
									
									
									
									
								
							
							
						
						
									
										178
									
								
								apps/s_client.c
									
									
									
									
									
								
							@@ -55,6 +55,59 @@
 | 
				
			|||||||
 * copied and put under another distribution licence
 | 
					 * copied and put under another distribution licence
 | 
				
			||||||
 * [including the GNU Public Licence.]
 | 
					 * [including the GNU Public Licence.]
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					/* ====================================================================
 | 
				
			||||||
 | 
					 * Copyright (c) 1998-2001 The OpenSSL Project.  All rights reserved.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Redistribution and use in source and binary forms, with or without
 | 
				
			||||||
 | 
					 * modification, are permitted provided that the following conditions
 | 
				
			||||||
 | 
					 * are met:
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 1. Redistributions of source code must retain the above copyright
 | 
				
			||||||
 | 
					 *    notice, this list of conditions and the following disclaimer. 
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 2. Redistributions in binary form must reproduce the above copyright
 | 
				
			||||||
 | 
					 *    notice, this list of conditions and the following disclaimer in
 | 
				
			||||||
 | 
					 *    the documentation and/or other materials provided with the
 | 
				
			||||||
 | 
					 *    distribution.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 3. All advertising materials mentioning features or use of this
 | 
				
			||||||
 | 
					 *    software must display the following acknowledgment:
 | 
				
			||||||
 | 
					 *    "This product includes software developed by the OpenSSL Project
 | 
				
			||||||
 | 
					 *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
 | 
				
			||||||
 | 
					 *    endorse or promote products derived from this software without
 | 
				
			||||||
 | 
					 *    prior written permission. For written permission, please contact
 | 
				
			||||||
 | 
					 *    openssl-core@openssl.org.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 5. Products derived from this software may not be called "OpenSSL"
 | 
				
			||||||
 | 
					 *    nor may "OpenSSL" appear in their names without prior written
 | 
				
			||||||
 | 
					 *    permission of the OpenSSL Project.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 6. Redistributions of any form whatsoever must retain the following
 | 
				
			||||||
 | 
					 *    acknowledgment:
 | 
				
			||||||
 | 
					 *    "This product includes software developed by the OpenSSL Project
 | 
				
			||||||
 | 
					 *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
 | 
				
			||||||
 | 
					 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 | 
				
			||||||
 | 
					 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 | 
				
			||||||
 | 
					 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
 | 
				
			||||||
 | 
					 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 | 
				
			||||||
 | 
					 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 | 
				
			||||||
 | 
					 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 | 
				
			||||||
 | 
					 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 | 
				
			||||||
 | 
					 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 | 
				
			||||||
 | 
					 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 | 
				
			||||||
 | 
					 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 | 
				
			||||||
 | 
					 * OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
				
			||||||
 | 
					 * ====================================================================
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This product includes cryptographic software written by Eric Young
 | 
				
			||||||
 | 
					 * (eay@cryptsoft.com).  This product includes software written by Tim
 | 
				
			||||||
 | 
					 * Hudson (tjh@cryptsoft.com).
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <assert.h>
 | 
					#include <assert.h>
 | 
				
			||||||
#include <stdio.h>
 | 
					#include <stdio.h>
 | 
				
			||||||
@@ -80,13 +133,21 @@ typedef unsigned int u_int;
 | 
				
			|||||||
#include <openssl/ssl.h>
 | 
					#include <openssl/ssl.h>
 | 
				
			||||||
#include <openssl/err.h>
 | 
					#include <openssl/err.h>
 | 
				
			||||||
#include <openssl/pem.h>
 | 
					#include <openssl/pem.h>
 | 
				
			||||||
#include <openssl/engine.h>
 | 
					#include <openssl/rand.h>
 | 
				
			||||||
#include "s_apps.h"
 | 
					#include "s_apps.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef OPENSSL_SYS_WINDOWS
 | 
					#ifdef OPENSSL_SYS_WINDOWS
 | 
				
			||||||
#include <conio.h>
 | 
					#include <conio.h>
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef OPENSSL_SYS_WINCE
 | 
				
			||||||
 | 
					/* Windows CE incorrectly defines fileno as returning void*, so to avoid problems below... */
 | 
				
			||||||
 | 
					#ifdef fileno
 | 
				
			||||||
 | 
					#undef fileno
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#define fileno(a) (int)_fileno(a)
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if (defined(OPENSSL_SYS_VMS) && __VMS_VER < 70000000)
 | 
					#if (defined(OPENSSL_SYS_VMS) && __VMS_VER < 70000000)
 | 
				
			||||||
/* FIONBIO used as a switch to enable ioctl, and that isn't in VMS < 7.0 */
 | 
					/* FIONBIO used as a switch to enable ioctl, and that isn't in VMS < 7.0 */
 | 
				
			||||||
@@ -113,6 +174,7 @@ static int c_nbio=0;
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
static int c_Pause=0;
 | 
					static int c_Pause=0;
 | 
				
			||||||
static int c_debug=0;
 | 
					static int c_debug=0;
 | 
				
			||||||
 | 
					static int c_msg=0;
 | 
				
			||||||
static int c_showcerts=0;
 | 
					static int c_showcerts=0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void sc_usage(void);
 | 
					static void sc_usage(void);
 | 
				
			||||||
@@ -139,6 +201,7 @@ static void sc_usage(void)
 | 
				
			|||||||
	BIO_printf(bio_err," -pause        - sleep(1) after each read(2) and write(2) system call\n");
 | 
						BIO_printf(bio_err," -pause        - sleep(1) after each read(2) and write(2) system call\n");
 | 
				
			||||||
	BIO_printf(bio_err," -showcerts    - show all certificates in the chain\n");
 | 
						BIO_printf(bio_err," -showcerts    - show all certificates in the chain\n");
 | 
				
			||||||
	BIO_printf(bio_err," -debug        - extra output\n");
 | 
						BIO_printf(bio_err," -debug        - extra output\n");
 | 
				
			||||||
 | 
						BIO_printf(bio_err," -msg          - Show protocol messages\n");
 | 
				
			||||||
	BIO_printf(bio_err," -nbio_test    - more ssl protocol testing\n");
 | 
						BIO_printf(bio_err," -nbio_test    - more ssl protocol testing\n");
 | 
				
			||||||
	BIO_printf(bio_err," -state        - print the 'ssl' states\n");
 | 
						BIO_printf(bio_err," -state        - print the 'ssl' states\n");
 | 
				
			||||||
#ifdef FIONBIO
 | 
					#ifdef FIONBIO
 | 
				
			||||||
@@ -155,6 +218,10 @@ static void sc_usage(void)
 | 
				
			|||||||
	BIO_printf(bio_err," -serverpref   - Use server's cipher preferences (only SSLv2)\n");
 | 
						BIO_printf(bio_err," -serverpref   - Use server's cipher preferences (only SSLv2)\n");
 | 
				
			||||||
	BIO_printf(bio_err," -cipher       - preferred cipher to use, use the 'openssl ciphers'\n");
 | 
						BIO_printf(bio_err," -cipher       - preferred cipher to use, use the 'openssl ciphers'\n");
 | 
				
			||||||
	BIO_printf(bio_err,"                 command to see what is available\n");
 | 
						BIO_printf(bio_err,"                 command to see what is available\n");
 | 
				
			||||||
 | 
						BIO_printf(bio_err," -starttls prot - use the STARTTLS command before starting TLS\n");
 | 
				
			||||||
 | 
						BIO_printf(bio_err,"                 for those protocols that support it, where\n");
 | 
				
			||||||
 | 
						BIO_printf(bio_err,"                 'prot' defines which one to assume.  Currently,\n");
 | 
				
			||||||
 | 
						BIO_printf(bio_err,"                 only \"smtp\" is supported.\n");
 | 
				
			||||||
	BIO_printf(bio_err," -engine id    - Initialise and use the specified engine\n");
 | 
						BIO_printf(bio_err," -engine id    - Initialise and use the specified engine\n");
 | 
				
			||||||
	BIO_printf(bio_err," -rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR);
 | 
						BIO_printf(bio_err," -rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -166,8 +233,9 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
	{
 | 
						{
 | 
				
			||||||
	int off=0;
 | 
						int off=0;
 | 
				
			||||||
	SSL *con=NULL,*con2=NULL;
 | 
						SSL *con=NULL,*con2=NULL;
 | 
				
			||||||
 | 
						X509_STORE *store = NULL;
 | 
				
			||||||
	int s,k,width,state=0;
 | 
						int s,k,width,state=0;
 | 
				
			||||||
	char *cbuf=NULL,*sbuf=NULL;
 | 
						char *cbuf=NULL,*sbuf=NULL,*mbuf=NULL;
 | 
				
			||||||
	int cbuf_len,cbuf_off;
 | 
						int cbuf_len,cbuf_off;
 | 
				
			||||||
	int sbuf_len,sbuf_off;
 | 
						int sbuf_len,sbuf_off;
 | 
				
			||||||
	fd_set readfds,writefds;
 | 
						fd_set readfds,writefds;
 | 
				
			||||||
@@ -181,7 +249,8 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
	int write_tty,read_tty,write_ssl,read_ssl,tty_on,ssl_pending;
 | 
						int write_tty,read_tty,write_ssl,read_ssl,tty_on,ssl_pending;
 | 
				
			||||||
	SSL_CTX *ctx=NULL;
 | 
						SSL_CTX *ctx=NULL;
 | 
				
			||||||
	int ret=1,in_init=1,i,nbio_test=0;
 | 
						int ret=1,in_init=1,i,nbio_test=0;
 | 
				
			||||||
	int prexit = 0;
 | 
						int smtp_starttls = 0;
 | 
				
			||||||
 | 
						int prexit = 0, vflags = 0;
 | 
				
			||||||
	SSL_METHOD *meth=NULL;
 | 
						SSL_METHOD *meth=NULL;
 | 
				
			||||||
	BIO *sbio;
 | 
						BIO *sbio;
 | 
				
			||||||
	char *inrand=NULL;
 | 
						char *inrand=NULL;
 | 
				
			||||||
@@ -204,13 +273,18 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
	c_quiet=0;
 | 
						c_quiet=0;
 | 
				
			||||||
	c_ign_eof=0;
 | 
						c_ign_eof=0;
 | 
				
			||||||
	c_debug=0;
 | 
						c_debug=0;
 | 
				
			||||||
 | 
						c_msg=0;
 | 
				
			||||||
	c_showcerts=0;
 | 
						c_showcerts=0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (bio_err == NULL)
 | 
						if (bio_err == NULL)
 | 
				
			||||||
		bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
 | 
							bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!load_config(bio_err, NULL))
 | 
				
			||||||
 | 
							goto end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (	((cbuf=OPENSSL_malloc(BUFSIZZ)) == NULL) ||
 | 
						if (	((cbuf=OPENSSL_malloc(BUFSIZZ)) == NULL) ||
 | 
				
			||||||
		((sbuf=OPENSSL_malloc(BUFSIZZ)) == NULL))
 | 
							((sbuf=OPENSSL_malloc(BUFSIZZ)) == NULL) ||
 | 
				
			||||||
 | 
							((mbuf=OPENSSL_malloc(BUFSIZZ)) == NULL))
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		BIO_printf(bio_err,"out of memory\n");
 | 
							BIO_printf(bio_err,"out of memory\n");
 | 
				
			||||||
		goto end;
 | 
							goto end;
 | 
				
			||||||
@@ -255,6 +329,10 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
			if (--argc < 1) goto bad;
 | 
								if (--argc < 1) goto bad;
 | 
				
			||||||
			cert_file= *(++argv);
 | 
								cert_file= *(++argv);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
							else if	(strcmp(*argv,"-crl_check") == 0)
 | 
				
			||||||
 | 
								vflags |= X509_V_FLAG_CRL_CHECK;
 | 
				
			||||||
 | 
							else if	(strcmp(*argv,"-crl_check_all") == 0)
 | 
				
			||||||
 | 
								vflags |= X509_V_FLAG_CRL_CHECK|X509_V_FLAG_CRL_CHECK_ALL;
 | 
				
			||||||
		else if	(strcmp(*argv,"-prexit") == 0)
 | 
							else if	(strcmp(*argv,"-prexit") == 0)
 | 
				
			||||||
			prexit=1;
 | 
								prexit=1;
 | 
				
			||||||
		else if	(strcmp(*argv,"-crlf") == 0)
 | 
							else if	(strcmp(*argv,"-crlf") == 0)
 | 
				
			||||||
@@ -270,6 +348,8 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
			c_Pause=1;
 | 
								c_Pause=1;
 | 
				
			||||||
		else if	(strcmp(*argv,"-debug") == 0)
 | 
							else if	(strcmp(*argv,"-debug") == 0)
 | 
				
			||||||
			c_debug=1;
 | 
								c_debug=1;
 | 
				
			||||||
 | 
							else if	(strcmp(*argv,"-msg") == 0)
 | 
				
			||||||
 | 
								c_msg=1;
 | 
				
			||||||
		else if	(strcmp(*argv,"-showcerts") == 0)
 | 
							else if	(strcmp(*argv,"-showcerts") == 0)
 | 
				
			||||||
			c_showcerts=1;
 | 
								c_showcerts=1;
 | 
				
			||||||
		else if	(strcmp(*argv,"-nbio_test") == 0)
 | 
							else if	(strcmp(*argv,"-nbio_test") == 0)
 | 
				
			||||||
@@ -326,6 +406,15 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
		else if (strcmp(*argv,"-nbio") == 0)
 | 
							else if (strcmp(*argv,"-nbio") == 0)
 | 
				
			||||||
			{ c_nbio=1; }
 | 
								{ c_nbio=1; }
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
							else if	(strcmp(*argv,"-starttls") == 0)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								if (--argc < 1) goto bad;
 | 
				
			||||||
 | 
								++argv;
 | 
				
			||||||
 | 
								if (strcmp(*argv,"smtp") == 0)
 | 
				
			||||||
 | 
									smtp_starttls = 1;
 | 
				
			||||||
 | 
								else
 | 
				
			||||||
 | 
									goto bad;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
		else if	(strcmp(*argv,"-engine") == 0)
 | 
							else if	(strcmp(*argv,"-engine") == 0)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
			if (--argc < 1) goto bad;
 | 
								if (--argc < 1) goto bad;
 | 
				
			||||||
@@ -352,6 +441,11 @@ bad:
 | 
				
			|||||||
		goto end;
 | 
							goto end;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						OpenSSL_add_ssl_algorithms();
 | 
				
			||||||
 | 
						SSL_load_error_strings();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        e = setup_engine(bio_err, engine_id, 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!app_RAND_load_file(NULL, bio_err, 1) && inrand == NULL
 | 
						if (!app_RAND_load_file(NULL, bio_err, 1) && inrand == NULL
 | 
				
			||||||
		&& !RAND_status())
 | 
							&& !RAND_status())
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
@@ -363,7 +457,7 @@ bad:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if (bio_c_out == NULL)
 | 
						if (bio_c_out == NULL)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		if (c_quiet)
 | 
							if (c_quiet && !c_debug && !c_msg)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
			bio_c_out=BIO_new(BIO_s_null());
 | 
								bio_c_out=BIO_new(BIO_s_null());
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
@@ -374,32 +468,6 @@ bad:
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	OpenSSL_add_ssl_algorithms();
 | 
					 | 
				
			||||||
	SSL_load_error_strings();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (engine_id != NULL)
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
		if((e = ENGINE_by_id(engine_id)) == NULL)
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			BIO_printf(bio_err,"invalid engine\n");
 | 
					 | 
				
			||||||
			ERR_print_errors(bio_err);
 | 
					 | 
				
			||||||
			goto end;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		if (c_debug)
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			ENGINE_ctrl(e, ENGINE_CTRL_SET_LOGSTREAM,
 | 
					 | 
				
			||||||
				0, bio_err, 0);
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			BIO_printf(bio_err,"can't use that engine\n");
 | 
					 | 
				
			||||||
			ERR_print_errors(bio_err);
 | 
					 | 
				
			||||||
			goto end;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		BIO_printf(bio_err,"engine \"%s\" set.\n", engine_id);
 | 
					 | 
				
			||||||
		ENGINE_free(e);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	ctx=SSL_CTX_new(meth);
 | 
						ctx=SSL_CTX_new(meth);
 | 
				
			||||||
	if (ctx == NULL)
 | 
						if (ctx == NULL)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
@@ -436,6 +504,8 @@ bad:
 | 
				
			|||||||
		/* goto end; */
 | 
							/* goto end; */
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						store = SSL_CTX_get_cert_store(ctx);
 | 
				
			||||||
 | 
						X509_STORE_set_flags(store, vflags);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	con=SSL_new(ctx);
 | 
						con=SSL_new(ctx);
 | 
				
			||||||
#ifndef OPENSSL_NO_KRB5
 | 
					#ifndef OPENSSL_NO_KRB5
 | 
				
			||||||
@@ -485,6 +555,11 @@ re_start:
 | 
				
			|||||||
		BIO_set_callback(sbio,bio_dump_cb);
 | 
							BIO_set_callback(sbio,bio_dump_cb);
 | 
				
			||||||
		BIO_set_callback_arg(sbio,bio_c_out);
 | 
							BIO_set_callback_arg(sbio,bio_c_out);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
						if (c_msg)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							SSL_set_msg_callback(con, msg_cb);
 | 
				
			||||||
 | 
							SSL_set_msg_callback_arg(con, bio_c_out);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	SSL_set_bio(con,sbio,sbio);
 | 
						SSL_set_bio(con,sbio,sbio);
 | 
				
			||||||
	SSL_set_connect_state(con);
 | 
						SSL_set_connect_state(con);
 | 
				
			||||||
@@ -503,6 +578,14 @@ re_start:
 | 
				
			|||||||
	sbuf_len=0;
 | 
						sbuf_len=0;
 | 
				
			||||||
	sbuf_off=0;
 | 
						sbuf_off=0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* This is an ugly hack that does a lot of assumptions */
 | 
				
			||||||
 | 
						if (smtp_starttls)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							BIO_read(sbio,mbuf,BUFSIZZ);
 | 
				
			||||||
 | 
							BIO_printf(sbio,"STARTTLS\r\n");
 | 
				
			||||||
 | 
							BIO_read(sbio,sbuf,BUFSIZZ);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (;;)
 | 
						for (;;)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		FD_ZERO(&readfds);
 | 
							FD_ZERO(&readfds);
 | 
				
			||||||
@@ -522,6 +605,13 @@ re_start:
 | 
				
			|||||||
				print_stuff(bio_c_out,con,full_log);
 | 
									print_stuff(bio_c_out,con,full_log);
 | 
				
			||||||
				if (full_log > 0) full_log--;
 | 
									if (full_log > 0) full_log--;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									if (smtp_starttls)
 | 
				
			||||||
 | 
										{
 | 
				
			||||||
 | 
										BIO_printf(bio_err,"%s",mbuf);
 | 
				
			||||||
 | 
										/* We don't need to know any more */
 | 
				
			||||||
 | 
										smtp_starttls = 0;
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				if (reconnect)
 | 
									if (reconnect)
 | 
				
			||||||
					{
 | 
										{
 | 
				
			||||||
					reconnect--;
 | 
										reconnect--;
 | 
				
			||||||
@@ -580,7 +670,11 @@ re_start:
 | 
				
			|||||||
					tv.tv_usec = 0;
 | 
										tv.tv_usec = 0;
 | 
				
			||||||
					i=select(width,(void *)&readfds,(void *)&writefds,
 | 
										i=select(width,(void *)&readfds,(void *)&writefds,
 | 
				
			||||||
						 NULL,&tv);
 | 
											 NULL,&tv);
 | 
				
			||||||
 | 
					#ifdef OPENSSL_SYS_WINCE
 | 
				
			||||||
 | 
										if(!i && (!_kbhit() || !read_tty) ) continue;
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
					if(!i && (!((_kbhit()) || (WAIT_OBJECT_0 == WaitForSingleObject(GetStdHandle(STD_INPUT_HANDLE), 0))) || !read_tty) ) continue;
 | 
										if(!i && (!((_kbhit()) || (WAIT_OBJECT_0 == WaitForSingleObject(GetStdHandle(STD_INPUT_HANDLE), 0))) || !read_tty) ) continue;
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
				} else 	i=select(width,(void *)&readfds,(void *)&writefds,
 | 
									} else 	i=select(width,(void *)&readfds,(void *)&writefds,
 | 
				
			||||||
					 NULL,NULL);
 | 
										 NULL,NULL);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
@@ -664,8 +758,8 @@ re_start:
 | 
				
			|||||||
				goto shut;
 | 
									goto shut;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
#ifdef OPENSSL_SYS_WINDOWS
 | 
					#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS)
 | 
				
			||||||
		/* Assume Windows can always write */
 | 
							/* Assume Windows/DOS can always write */
 | 
				
			||||||
		else if (!ssl_pending && write_tty)
 | 
							else if (!ssl_pending && write_tty)
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
		else if (!ssl_pending && FD_ISSET(fileno(stdout),&writefds))
 | 
							else if (!ssl_pending && FD_ISSET(fileno(stdout),&writefds))
 | 
				
			||||||
@@ -746,7 +840,11 @@ printf("read=%d pending=%d peek=%d\n",k,SSL_pending(con),SSL_peek(con,zbuf,10240
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef OPENSSL_SYS_WINDOWS
 | 
					#ifdef OPENSSL_SYS_WINDOWS
 | 
				
			||||||
 | 
					#ifdef OPENSSL_SYS_WINCE
 | 
				
			||||||
 | 
							else if (_kbhit())
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
		else if ((_kbhit()) || (WAIT_OBJECT_0 == WaitForSingleObject(GetStdHandle(STD_INPUT_HANDLE), 0)))
 | 
							else if ((_kbhit()) || (WAIT_OBJECT_0 == WaitForSingleObject(GetStdHandle(STD_INPUT_HANDLE), 0)))
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
		else if (FD_ISSET(fileno(stdin),&readfds))
 | 
							else if (FD_ISSET(fileno(stdin),&readfds))
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
@@ -812,11 +910,13 @@ end:
 | 
				
			|||||||
	if (ctx != NULL) SSL_CTX_free(ctx);
 | 
						if (ctx != NULL) SSL_CTX_free(ctx);
 | 
				
			||||||
	if (cbuf != NULL) { memset(cbuf,0,BUFSIZZ); OPENSSL_free(cbuf); }
 | 
						if (cbuf != NULL) { memset(cbuf,0,BUFSIZZ); OPENSSL_free(cbuf); }
 | 
				
			||||||
	if (sbuf != NULL) { memset(sbuf,0,BUFSIZZ); OPENSSL_free(sbuf); }
 | 
						if (sbuf != NULL) { memset(sbuf,0,BUFSIZZ); OPENSSL_free(sbuf); }
 | 
				
			||||||
 | 
						if (mbuf != NULL) { memset(mbuf,0,BUFSIZZ); OPENSSL_free(mbuf); }
 | 
				
			||||||
	if (bio_c_out != NULL)
 | 
						if (bio_c_out != NULL)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		BIO_free(bio_c_out);
 | 
							BIO_free(bio_c_out);
 | 
				
			||||||
		bio_c_out=NULL;
 | 
							bio_c_out=NULL;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
						apps_shutdown();
 | 
				
			||||||
	EXIT(ret);
 | 
						EXIT(ret);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -846,10 +946,10 @@ static void print_stuff(BIO *bio, SSL *s, int full)
 | 
				
			|||||||
			for (i=0; i<sk_X509_num(sk); i++)
 | 
								for (i=0; i<sk_X509_num(sk); i++)
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
				X509_NAME_oneline(X509_get_subject_name(
 | 
									X509_NAME_oneline(X509_get_subject_name(
 | 
				
			||||||
					sk_X509_value(sk,i)),buf,BUFSIZ);
 | 
										sk_X509_value(sk,i)),buf,sizeof buf);
 | 
				
			||||||
				BIO_printf(bio,"%2d s:%s\n",i,buf);
 | 
									BIO_printf(bio,"%2d s:%s\n",i,buf);
 | 
				
			||||||
				X509_NAME_oneline(X509_get_issuer_name(
 | 
									X509_NAME_oneline(X509_get_issuer_name(
 | 
				
			||||||
					sk_X509_value(sk,i)),buf,BUFSIZ);
 | 
										sk_X509_value(sk,i)),buf,sizeof buf);
 | 
				
			||||||
				BIO_printf(bio,"   i:%s\n",buf);
 | 
									BIO_printf(bio,"   i:%s\n",buf);
 | 
				
			||||||
				if (c_showcerts)
 | 
									if (c_showcerts)
 | 
				
			||||||
					PEM_write_bio_X509(bio,sk_X509_value(sk,i));
 | 
										PEM_write_bio_X509(bio,sk_X509_value(sk,i));
 | 
				
			||||||
@@ -864,10 +964,10 @@ static void print_stuff(BIO *bio, SSL *s, int full)
 | 
				
			|||||||
			if (!(c_showcerts && got_a_chain)) /* Redundant if we showed the whole chain */
 | 
								if (!(c_showcerts && got_a_chain)) /* Redundant if we showed the whole chain */
 | 
				
			||||||
				PEM_write_bio_X509(bio,peer);
 | 
									PEM_write_bio_X509(bio,peer);
 | 
				
			||||||
			X509_NAME_oneline(X509_get_subject_name(peer),
 | 
								X509_NAME_oneline(X509_get_subject_name(peer),
 | 
				
			||||||
				buf,BUFSIZ);
 | 
									buf,sizeof buf);
 | 
				
			||||||
			BIO_printf(bio,"subject=%s\n",buf);
 | 
								BIO_printf(bio,"subject=%s\n",buf);
 | 
				
			||||||
			X509_NAME_oneline(X509_get_issuer_name(peer),
 | 
								X509_NAME_oneline(X509_get_issuer_name(peer),
 | 
				
			||||||
				buf,BUFSIZ);
 | 
									buf,sizeof buf);
 | 
				
			||||||
			BIO_printf(bio,"issuer=%s\n",buf);
 | 
								BIO_printf(bio,"issuer=%s\n",buf);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
@@ -889,7 +989,7 @@ static void print_stuff(BIO *bio, SSL *s, int full)
 | 
				
			|||||||
			{
 | 
								{
 | 
				
			||||||
			BIO_printf(bio,"---\nNo client certificate CA names sent\n");
 | 
								BIO_printf(bio,"---\nNo client certificate CA names sent\n");
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		p=SSL_get_shared_ciphers(s,buf,BUFSIZ);
 | 
							p=SSL_get_shared_ciphers(s,buf,sizeof buf);
 | 
				
			||||||
		if (p != NULL)
 | 
							if (p != NULL)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
			/* This works only for SSL 2.  In later protocol
 | 
								/* This works only for SSL 2.  In later protocol
 | 
				
			||||||
@@ -938,5 +1038,7 @@ static void print_stuff(BIO *bio, SSL *s, int full)
 | 
				
			|||||||
	BIO_printf(bio,"---\n");
 | 
						BIO_printf(bio,"---\n");
 | 
				
			||||||
	if (peer != NULL)
 | 
						if (peer != NULL)
 | 
				
			||||||
		X509_free(peer);
 | 
							X509_free(peer);
 | 
				
			||||||
 | 
						/* flush, or debugging output gets mixed with http response */
 | 
				
			||||||
 | 
						BIO_flush(bio);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										200
									
								
								apps/s_server.c
									
									
									
									
									
								
							
							
						
						
									
										200
									
								
								apps/s_server.c
									
									
									
									
									
								
							@@ -55,6 +55,59 @@
 | 
				
			|||||||
 * copied and put under another distribution licence
 | 
					 * copied and put under another distribution licence
 | 
				
			||||||
 * [including the GNU Public Licence.]
 | 
					 * [including the GNU Public Licence.]
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					/* ====================================================================
 | 
				
			||||||
 | 
					 * Copyright (c) 1998-2001 The OpenSSL Project.  All rights reserved.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Redistribution and use in source and binary forms, with or without
 | 
				
			||||||
 | 
					 * modification, are permitted provided that the following conditions
 | 
				
			||||||
 | 
					 * are met:
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 1. Redistributions of source code must retain the above copyright
 | 
				
			||||||
 | 
					 *    notice, this list of conditions and the following disclaimer. 
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 2. Redistributions in binary form must reproduce the above copyright
 | 
				
			||||||
 | 
					 *    notice, this list of conditions and the following disclaimer in
 | 
				
			||||||
 | 
					 *    the documentation and/or other materials provided with the
 | 
				
			||||||
 | 
					 *    distribution.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 3. All advertising materials mentioning features or use of this
 | 
				
			||||||
 | 
					 *    software must display the following acknowledgment:
 | 
				
			||||||
 | 
					 *    "This product includes software developed by the OpenSSL Project
 | 
				
			||||||
 | 
					 *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
 | 
				
			||||||
 | 
					 *    endorse or promote products derived from this software without
 | 
				
			||||||
 | 
					 *    prior written permission. For written permission, please contact
 | 
				
			||||||
 | 
					 *    openssl-core@openssl.org.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 5. Products derived from this software may not be called "OpenSSL"
 | 
				
			||||||
 | 
					 *    nor may "OpenSSL" appear in their names without prior written
 | 
				
			||||||
 | 
					 *    permission of the OpenSSL Project.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 6. Redistributions of any form whatsoever must retain the following
 | 
				
			||||||
 | 
					 *    acknowledgment:
 | 
				
			||||||
 | 
					 *    "This product includes software developed by the OpenSSL Project
 | 
				
			||||||
 | 
					 *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
 | 
				
			||||||
 | 
					 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 | 
				
			||||||
 | 
					 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 | 
				
			||||||
 | 
					 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
 | 
				
			||||||
 | 
					 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 | 
				
			||||||
 | 
					 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 | 
				
			||||||
 | 
					 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 | 
				
			||||||
 | 
					 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 | 
				
			||||||
 | 
					 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 | 
				
			||||||
 | 
					 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 | 
				
			||||||
 | 
					 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 | 
				
			||||||
 | 
					 * OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
				
			||||||
 | 
					 * ====================================================================
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This product includes cryptographic software written by Eric Young
 | 
				
			||||||
 | 
					 * (eay@cryptsoft.com).  This product includes software written by Tim
 | 
				
			||||||
 | 
					 * Hudson (tjh@cryptsoft.com).
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <assert.h>
 | 
					#include <assert.h>
 | 
				
			||||||
#include <stdio.h>
 | 
					#include <stdio.h>
 | 
				
			||||||
@@ -84,13 +137,21 @@ typedef unsigned int u_int;
 | 
				
			|||||||
#include <openssl/pem.h>
 | 
					#include <openssl/pem.h>
 | 
				
			||||||
#include <openssl/x509.h>
 | 
					#include <openssl/x509.h>
 | 
				
			||||||
#include <openssl/ssl.h>
 | 
					#include <openssl/ssl.h>
 | 
				
			||||||
#include <openssl/engine.h>
 | 
					#include <openssl/rand.h>
 | 
				
			||||||
#include "s_apps.h"
 | 
					#include "s_apps.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef OPENSSL_SYS_WINDOWS
 | 
					#ifdef OPENSSL_SYS_WINDOWS
 | 
				
			||||||
#include <conio.h>
 | 
					#include <conio.h>
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef OPENSSL_SYS_WINCE
 | 
				
			||||||
 | 
					/* Windows CE incorrectly defines fileno as returning void*, so to avoid problems below... */
 | 
				
			||||||
 | 
					#ifdef fileno
 | 
				
			||||||
 | 
					#undef fileno
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#define fileno(a) (int)_fileno(a)
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if (defined(OPENSSL_SYS_VMS) && __VMS_VER < 70000000)
 | 
					#if (defined(OPENSSL_SYS_VMS) && __VMS_VER < 70000000)
 | 
				
			||||||
/* FIONBIO used as a switch to enable ioctl, and that isn't in VMS < 7.0 */
 | 
					/* FIONBIO used as a switch to enable ioctl, and that isn't in VMS < 7.0 */
 | 
				
			||||||
#undef FIONBIO
 | 
					#undef FIONBIO
 | 
				
			||||||
@@ -177,6 +238,7 @@ static int www=0;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
static BIO *bio_s_out=NULL;
 | 
					static BIO *bio_s_out=NULL;
 | 
				
			||||||
static int s_debug=0;
 | 
					static int s_debug=0;
 | 
				
			||||||
 | 
					static int s_msg=0;
 | 
				
			||||||
static int s_quiet=0;
 | 
					static int s_quiet=0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int hack=0;
 | 
					static int hack=0;
 | 
				
			||||||
@@ -202,6 +264,7 @@ static void s_server_init(void)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	bio_s_out=NULL;
 | 
						bio_s_out=NULL;
 | 
				
			||||||
	s_debug=0;
 | 
						s_debug=0;
 | 
				
			||||||
 | 
						s_msg=0;
 | 
				
			||||||
	s_quiet=0;
 | 
						s_quiet=0;
 | 
				
			||||||
	hack=0;
 | 
						hack=0;
 | 
				
			||||||
	engine_id=NULL;
 | 
						engine_id=NULL;
 | 
				
			||||||
@@ -230,6 +293,7 @@ static void sv_usage(void)
 | 
				
			|||||||
	BIO_printf(bio_err," -nbio_test    - test with the non-blocking test bio\n");
 | 
						BIO_printf(bio_err," -nbio_test    - test with the non-blocking test bio\n");
 | 
				
			||||||
	BIO_printf(bio_err," -crlf         - convert LF from terminal into CRLF\n");
 | 
						BIO_printf(bio_err," -crlf         - convert LF from terminal into CRLF\n");
 | 
				
			||||||
	BIO_printf(bio_err," -debug        - Print more output\n");
 | 
						BIO_printf(bio_err," -debug        - Print more output\n");
 | 
				
			||||||
 | 
						BIO_printf(bio_err," -msg          - Show protocol messages\n");
 | 
				
			||||||
	BIO_printf(bio_err," -state        - Print the SSL states\n");
 | 
						BIO_printf(bio_err," -state        - Print the SSL states\n");
 | 
				
			||||||
	BIO_printf(bio_err," -CApath arg   - PEM format directory of CA's\n");
 | 
						BIO_printf(bio_err," -CApath arg   - PEM format directory of CA's\n");
 | 
				
			||||||
	BIO_printf(bio_err," -CAfile arg   - PEM format file of CA's\n");
 | 
						BIO_printf(bio_err," -CAfile arg   - PEM format file of CA's\n");
 | 
				
			||||||
@@ -264,10 +328,10 @@ static char **local_argv;
 | 
				
			|||||||
static int ebcdic_new(BIO *bi);
 | 
					static int ebcdic_new(BIO *bi);
 | 
				
			||||||
static int ebcdic_free(BIO *a);
 | 
					static int ebcdic_free(BIO *a);
 | 
				
			||||||
static int ebcdic_read(BIO *b, char *out, int outl);
 | 
					static int ebcdic_read(BIO *b, char *out, int outl);
 | 
				
			||||||
static int ebcdic_write(BIO *b, char *in, int inl);
 | 
					static int ebcdic_write(BIO *b, const char *in, int inl);
 | 
				
			||||||
static long ebcdic_ctrl(BIO *b, int cmd, long num, char *ptr);
 | 
					static long ebcdic_ctrl(BIO *b, int cmd, long num, void *ptr);
 | 
				
			||||||
static int ebcdic_gets(BIO *bp, char *buf, int size);
 | 
					static int ebcdic_gets(BIO *bp, char *buf, int size);
 | 
				
			||||||
static int ebcdic_puts(BIO *bp, char *str);
 | 
					static int ebcdic_puts(BIO *bp, const char *str);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define BIO_TYPE_EBCDIC_FILTER	(18|0x0200)
 | 
					#define BIO_TYPE_EBCDIC_FILTER	(18|0x0200)
 | 
				
			||||||
static BIO_METHOD methods_ebcdic=
 | 
					static BIO_METHOD methods_ebcdic=
 | 
				
			||||||
@@ -332,7 +396,7 @@ static int ebcdic_read(BIO *b, char *out, int outl)
 | 
				
			|||||||
	return(ret);
 | 
						return(ret);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int ebcdic_write(BIO *b, char *in, int inl)
 | 
					static int ebcdic_write(BIO *b, const char *in, int inl)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	EBCDIC_OUTBUFF *wbuf;
 | 
						EBCDIC_OUTBUFF *wbuf;
 | 
				
			||||||
	int ret=0;
 | 
						int ret=0;
 | 
				
			||||||
@@ -365,7 +429,7 @@ static int ebcdic_write(BIO *b, char *in, int inl)
 | 
				
			|||||||
	return(ret);
 | 
						return(ret);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static long ebcdic_ctrl(BIO *b, int cmd, long num, char *ptr)
 | 
					static long ebcdic_ctrl(BIO *b, int cmd, long num, void *ptr)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	long ret;
 | 
						long ret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -384,7 +448,7 @@ static long ebcdic_ctrl(BIO *b, int cmd, long num, char *ptr)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
static int ebcdic_gets(BIO *bp, char *buf, int size)
 | 
					static int ebcdic_gets(BIO *bp, char *buf, int size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int i, ret;
 | 
						int i, ret=0;
 | 
				
			||||||
	if (bp->next_bio == NULL) return(0);
 | 
						if (bp->next_bio == NULL) return(0);
 | 
				
			||||||
/*	return(BIO_gets(bp->next_bio,buf,size));*/
 | 
					/*	return(BIO_gets(bp->next_bio,buf,size));*/
 | 
				
			||||||
	for (i=0; i<size-1; ++i)
 | 
						for (i=0; i<size-1; ++i)
 | 
				
			||||||
@@ -403,7 +467,7 @@ static int ebcdic_gets(BIO *bp, char *buf, int size)
 | 
				
			|||||||
	return (ret < 0 && i == 0) ? ret : i;
 | 
						return (ret < 0 && i == 0) ? ret : i;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int ebcdic_puts(BIO *bp, char *str)
 | 
					static int ebcdic_puts(BIO *bp, const char *str)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if (bp->next_bio == NULL) return(0);
 | 
						if (bp->next_bio == NULL) return(0);
 | 
				
			||||||
	return ebcdic_write(bp, str, strlen(str));
 | 
						return ebcdic_write(bp, str, strlen(str));
 | 
				
			||||||
@@ -414,6 +478,8 @@ int MAIN(int, char **);
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
int MAIN(int argc, char *argv[])
 | 
					int MAIN(int argc, char *argv[])
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
 | 
						X509_STORE *store = NULL;
 | 
				
			||||||
 | 
						int vflags = 0;
 | 
				
			||||||
	short port=PORT;
 | 
						short port=PORT;
 | 
				
			||||||
	char *CApath=NULL,*CAfile=NULL;
 | 
						char *CApath=NULL,*CAfile=NULL;
 | 
				
			||||||
	char *context = NULL;
 | 
						char *context = NULL;
 | 
				
			||||||
@@ -446,6 +512,9 @@ int MAIN(int argc, char *argv[])
 | 
				
			|||||||
	if (bio_err == NULL)
 | 
						if (bio_err == NULL)
 | 
				
			||||||
		bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
 | 
							bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!load_config(bio_err, NULL))
 | 
				
			||||||
 | 
							goto end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	verify_depth=0;
 | 
						verify_depth=0;
 | 
				
			||||||
#ifdef FIONBIO
 | 
					#ifdef FIONBIO
 | 
				
			||||||
	s_nbio=0;
 | 
						s_nbio=0;
 | 
				
			||||||
@@ -518,6 +587,14 @@ int MAIN(int argc, char *argv[])
 | 
				
			|||||||
			if (--argc < 1) goto bad;
 | 
								if (--argc < 1) goto bad;
 | 
				
			||||||
			CApath= *(++argv);
 | 
								CApath= *(++argv);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
							else if (strcmp(*argv,"-crl_check") == 0)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								vflags |= X509_V_FLAG_CRL_CHECK;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							else if (strcmp(*argv,"-crl_check") == 0)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								vflags |= X509_V_FLAG_CRL_CHECK|X509_V_FLAG_CRL_CHECK_ALL;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
		else if	(strcmp(*argv,"-serverpref") == 0)
 | 
							else if	(strcmp(*argv,"-serverpref") == 0)
 | 
				
			||||||
			{ off|=SSL_OP_CIPHER_SERVER_PREFERENCE; }
 | 
								{ off|=SSL_OP_CIPHER_SERVER_PREFERENCE; }
 | 
				
			||||||
		else if	(strcmp(*argv,"-cipher") == 0)
 | 
							else if	(strcmp(*argv,"-cipher") == 0)
 | 
				
			||||||
@@ -543,6 +620,8 @@ int MAIN(int argc, char *argv[])
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
		else if	(strcmp(*argv,"-debug") == 0)
 | 
							else if	(strcmp(*argv,"-debug") == 0)
 | 
				
			||||||
			{ s_debug=1; }
 | 
								{ s_debug=1; }
 | 
				
			||||||
 | 
							else if	(strcmp(*argv,"-msg") == 0)
 | 
				
			||||||
 | 
								{ s_msg=1; }
 | 
				
			||||||
		else if	(strcmp(*argv,"-hack") == 0)
 | 
							else if	(strcmp(*argv,"-hack") == 0)
 | 
				
			||||||
			{ hack=1; }
 | 
								{ hack=1; }
 | 
				
			||||||
		else if	(strcmp(*argv,"-state") == 0)
 | 
							else if	(strcmp(*argv,"-state") == 0)
 | 
				
			||||||
@@ -612,6 +691,11 @@ bad:
 | 
				
			|||||||
		goto end;
 | 
							goto end;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						SSL_load_error_strings();
 | 
				
			||||||
 | 
						OpenSSL_add_ssl_algorithms();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        e = setup_engine(bio_err, engine_id, 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!app_RAND_load_file(NULL, bio_err, 1) && inrand == NULL
 | 
						if (!app_RAND_load_file(NULL, bio_err, 1) && inrand == NULL
 | 
				
			||||||
		&& !RAND_status())
 | 
							&& !RAND_status())
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
@@ -623,7 +707,7 @@ bad:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if (bio_s_out == NULL)
 | 
						if (bio_s_out == NULL)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		if (s_quiet && !s_debug)
 | 
							if (s_quiet && !s_debug && !s_msg)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
			bio_s_out=BIO_new(BIO_s_null());
 | 
								bio_s_out=BIO_new(BIO_s_null());
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
@@ -644,32 +728,6 @@ bad:
 | 
				
			|||||||
		s_dkey_file=NULL;
 | 
							s_dkey_file=NULL;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	SSL_load_error_strings();
 | 
					 | 
				
			||||||
	OpenSSL_add_ssl_algorithms();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (engine_id != NULL)
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
		if((e = ENGINE_by_id(engine_id)) == NULL)
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			BIO_printf(bio_err,"invalid engine\n");
 | 
					 | 
				
			||||||
			ERR_print_errors(bio_err);
 | 
					 | 
				
			||||||
			goto end;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		if (s_debug)
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			ENGINE_ctrl(e, ENGINE_CTRL_SET_LOGSTREAM,
 | 
					 | 
				
			||||||
				0, bio_err, 0);
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			BIO_printf(bio_err,"can't use that engine\n");
 | 
					 | 
				
			||||||
			ERR_print_errors(bio_err);
 | 
					 | 
				
			||||||
			goto end;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		BIO_printf(bio_err,"engine \"%s\" set.\n", engine_id);
 | 
					 | 
				
			||||||
		ENGINE_free(e);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	ctx=SSL_CTX_new(meth);
 | 
						ctx=SSL_CTX_new(meth);
 | 
				
			||||||
	if (ctx == NULL)
 | 
						if (ctx == NULL)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
@@ -696,7 +754,6 @@ bad:
 | 
				
			|||||||
	if (bugs) SSL_CTX_set_options(ctx,SSL_OP_ALL);
 | 
						if (bugs) SSL_CTX_set_options(ctx,SSL_OP_ALL);
 | 
				
			||||||
	if (hack) SSL_CTX_set_options(ctx,SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG);
 | 
						if (hack) SSL_CTX_set_options(ctx,SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG);
 | 
				
			||||||
	SSL_CTX_set_options(ctx,off);
 | 
						SSL_CTX_set_options(ctx,off);
 | 
				
			||||||
	if (hack) SSL_CTX_set_options(ctx,SSL_OP_NON_EXPORT_FIRST);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (state) SSL_CTX_set_info_callback(ctx,apps_ssl_info_callback);
 | 
						if (state) SSL_CTX_set_info_callback(ctx,apps_ssl_info_callback);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -721,6 +778,8 @@ bad:
 | 
				
			|||||||
		ERR_print_errors(bio_err);
 | 
							ERR_print_errors(bio_err);
 | 
				
			||||||
		/* goto end; */
 | 
							/* goto end; */
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
						store = SSL_CTX_get_cert_store(ctx);
 | 
				
			||||||
 | 
						X509_STORE_set_flags(store, vflags);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef OPENSSL_NO_DH
 | 
					#ifndef OPENSSL_NO_DH
 | 
				
			||||||
	if (!no_dhe)
 | 
						if (!no_dhe)
 | 
				
			||||||
@@ -808,6 +867,7 @@ end:
 | 
				
			|||||||
		BIO_free(bio_s_out);
 | 
							BIO_free(bio_s_out);
 | 
				
			||||||
		bio_s_out=NULL;
 | 
							bio_s_out=NULL;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
						apps_shutdown();
 | 
				
			||||||
	EXIT(ret);
 | 
						EXIT(ret);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -871,8 +931,10 @@ static int sv_body(char *hostname, int s, unsigned char *context)
 | 
				
			|||||||
#ifndef OPENSSL_NO_KRB5
 | 
					#ifndef OPENSSL_NO_KRB5
 | 
				
			||||||
		if ((con->kssl_ctx = kssl_ctx_new()) != NULL)
 | 
							if ((con->kssl_ctx = kssl_ctx_new()) != NULL)
 | 
				
			||||||
                        {
 | 
					                        {
 | 
				
			||||||
                        kssl_ctx_setstring(con->kssl_ctx, KSSL_SERVICE, KRB5SVC);
 | 
					                        kssl_ctx_setstring(con->kssl_ctx, KSSL_SERVICE,
 | 
				
			||||||
                        kssl_ctx_setstring(con->kssl_ctx, KSSL_KEYTAB, KRB5KEYTAB);
 | 
													KRB5SVC);
 | 
				
			||||||
 | 
					                        kssl_ctx_setstring(con->kssl_ctx, KSSL_KEYTAB,
 | 
				
			||||||
 | 
													KRB5KEYTAB);
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
#endif	/* OPENSSL_NO_KRB5 */
 | 
					#endif	/* OPENSSL_NO_KRB5 */
 | 
				
			||||||
		if(context)
 | 
							if(context)
 | 
				
			||||||
@@ -899,6 +961,11 @@ static int sv_body(char *hostname, int s, unsigned char *context)
 | 
				
			|||||||
		BIO_set_callback(SSL_get_rbio(con),bio_dump_cb);
 | 
							BIO_set_callback(SSL_get_rbio(con),bio_dump_cb);
 | 
				
			||||||
		BIO_set_callback_arg(SSL_get_rbio(con),bio_s_out);
 | 
							BIO_set_callback_arg(SSL_get_rbio(con),bio_s_out);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
						if (s_msg)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							SSL_set_msg_callback(con, msg_cb);
 | 
				
			||||||
 | 
							SSL_set_msg_callback_arg(con, bio_s_out);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	width=s+1;
 | 
						width=s+1;
 | 
				
			||||||
	for (;;)
 | 
						for (;;)
 | 
				
			||||||
@@ -1169,14 +1236,14 @@ static int init_ssl_connection(SSL *con)
 | 
				
			|||||||
		{
 | 
							{
 | 
				
			||||||
		BIO_printf(bio_s_out,"Client certificate\n");
 | 
							BIO_printf(bio_s_out,"Client certificate\n");
 | 
				
			||||||
		PEM_write_bio_X509(bio_s_out,peer);
 | 
							PEM_write_bio_X509(bio_s_out,peer);
 | 
				
			||||||
		X509_NAME_oneline(X509_get_subject_name(peer),buf,BUFSIZ);
 | 
							X509_NAME_oneline(X509_get_subject_name(peer),buf,sizeof buf);
 | 
				
			||||||
		BIO_printf(bio_s_out,"subject=%s\n",buf);
 | 
							BIO_printf(bio_s_out,"subject=%s\n",buf);
 | 
				
			||||||
		X509_NAME_oneline(X509_get_issuer_name(peer),buf,BUFSIZ);
 | 
							X509_NAME_oneline(X509_get_issuer_name(peer),buf,sizeof buf);
 | 
				
			||||||
		BIO_printf(bio_s_out,"issuer=%s\n",buf);
 | 
							BIO_printf(bio_s_out,"issuer=%s\n",buf);
 | 
				
			||||||
		X509_free(peer);
 | 
							X509_free(peer);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (SSL_get_shared_ciphers(con,buf,BUFSIZ) != NULL)
 | 
						if (SSL_get_shared_ciphers(con,buf,sizeof buf) != NULL)
 | 
				
			||||||
		BIO_printf(bio_s_out,"Shared ciphers:%s\n",buf);
 | 
							BIO_printf(bio_s_out,"Shared ciphers:%s\n",buf);
 | 
				
			||||||
	str=SSL_CIPHER_get_name(SSL_get_current_cipher(con));
 | 
						str=SSL_CIPHER_get_name(SSL_get_current_cipher(con));
 | 
				
			||||||
	BIO_printf(bio_s_out,"CIPHER is %s\n",(str != NULL)?str:"(NONE)");
 | 
						BIO_printf(bio_s_out,"CIPHER is %s\n",(str != NULL)?str:"(NONE)");
 | 
				
			||||||
@@ -1257,6 +1324,13 @@ static int www_body(char *hostname, int s, unsigned char *context)
 | 
				
			|||||||
	if (!BIO_set_write_buffer_size(io,bufsize)) goto err;
 | 
						if (!BIO_set_write_buffer_size(io,bufsize)) goto err;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((con=SSL_new(ctx)) == NULL) goto err;
 | 
						if ((con=SSL_new(ctx)) == NULL) goto err;
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_KRB5
 | 
				
			||||||
 | 
						if ((con->kssl_ctx = kssl_ctx_new()) != NULL)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							kssl_ctx_setstring(con->kssl_ctx, KSSL_SERVICE, KRB5SVC);
 | 
				
			||||||
 | 
							kssl_ctx_setstring(con->kssl_ctx, KSSL_KEYTAB, KRB5KEYTAB);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					#endif	/* OPENSSL_NO_KRB5 */
 | 
				
			||||||
	if(context) SSL_set_session_id_context(con, context,
 | 
						if(context) SSL_set_session_id_context(con, context,
 | 
				
			||||||
					       strlen((char *)context));
 | 
										       strlen((char *)context));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1284,6 +1358,11 @@ static int www_body(char *hostname, int s, unsigned char *context)
 | 
				
			|||||||
		BIO_set_callback(SSL_get_rbio(con),bio_dump_cb);
 | 
							BIO_set_callback(SSL_get_rbio(con),bio_dump_cb);
 | 
				
			||||||
		BIO_set_callback_arg(SSL_get_rbio(con),bio_s_out);
 | 
							BIO_set_callback_arg(SSL_get_rbio(con),bio_s_out);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
						if (s_msg)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							SSL_set_msg_callback(con, msg_cb);
 | 
				
			||||||
 | 
							SSL_set_msg_callback_arg(con, bio_s_out);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	blank=0;
 | 
						blank=0;
 | 
				
			||||||
	for (;;)
 | 
						for (;;)
 | 
				
			||||||
@@ -1324,7 +1403,7 @@ static int www_body(char *hostname, int s, unsigned char *context)
 | 
				
			|||||||
			else
 | 
								else
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
				BIO_printf(bio_s_out,"read R BLOCK\n");
 | 
									BIO_printf(bio_s_out,"read R BLOCK\n");
 | 
				
			||||||
#ifndef OPENSSL_SYS_MSDOS
 | 
					#if !defined(OPENSSL_SYS_MSDOS) && !defined(__DJGPP__)
 | 
				
			||||||
				sleep(1);
 | 
									sleep(1);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
				continue;
 | 
									continue;
 | 
				
			||||||
@@ -1423,20 +1502,33 @@ static int www_body(char *hostname, int s, unsigned char *context)
 | 
				
			|||||||
			{
 | 
								{
 | 
				
			||||||
			BIO *file;
 | 
								BIO *file;
 | 
				
			||||||
			char *p,*e;
 | 
								char *p,*e;
 | 
				
			||||||
			static char *text="HTTP/1.0 200 ok\r\n"
 | 
								static char *text="HTTP/1.0 200 ok\r\nContent-type: text/plain\r\n\r\n";
 | 
				
			||||||
                                "Content-type: text/plain\r\n\r\n";
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
			/* skip the '/' */
 | 
								/* skip the '/' */
 | 
				
			||||||
			p= &(buf[5]);
 | 
								p= &(buf[5]);
 | 
				
			||||||
			dot=0;
 | 
					
 | 
				
			||||||
 | 
								dot = 1;
 | 
				
			||||||
			for (e=p; *e != '\0'; e++)
 | 
								for (e=p; *e != '\0'; e++)
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
				if (e[0] == ' ') break;
 | 
									if (e[0] == ' ')
 | 
				
			||||||
				if (	(e[0] == '.') &&
 | 
										break;
 | 
				
			||||||
					(strncmp(&(e[-1]),"/../",4) == 0))
 | 
					
 | 
				
			||||||
					dot=1;
 | 
									switch (dot)
 | 
				
			||||||
 | 
										{
 | 
				
			||||||
 | 
									case 1:
 | 
				
			||||||
 | 
										dot = (e[0] == '.') ? 2 : 0;
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
									case 2:
 | 
				
			||||||
 | 
										dot = (e[0] == '.') ? 3 : 0;
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
									case 3:
 | 
				
			||||||
 | 
										dot = (e[0] == '/') ? -1 : 0;
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
									if (dot == 0)
 | 
				
			||||||
 | 
										dot = (e[0] == '/') ? 1 : 0;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			
 | 
								dot = (dot == 3) || (dot == -1); /* filename contains ".." component */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (*e == '\0')
 | 
								if (*e == '\0')
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
@@ -1460,9 +1552,11 @@ static int www_body(char *hostname, int s, unsigned char *context)
 | 
				
			|||||||
				break;
 | 
									break;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if 0
 | 
				
			||||||
			/* append if a directory lookup */
 | 
								/* append if a directory lookup */
 | 
				
			||||||
			if (e[-1] == '/')
 | 
								if (e[-1] == '/')
 | 
				
			||||||
				strcat(p,"index.html");
 | 
									strcat(p,"index.html");
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			/* if a directory, do the index thang */
 | 
								/* if a directory, do the index thang */
 | 
				
			||||||
			if (stat(p,&st_buf) < 0)
 | 
								if (stat(p,&st_buf) < 0)
 | 
				
			||||||
@@ -1474,7 +1568,13 @@ static int www_body(char *hostname, int s, unsigned char *context)
 | 
				
			|||||||
				}
 | 
									}
 | 
				
			||||||
			if (S_ISDIR(st_buf.st_mode))
 | 
								if (S_ISDIR(st_buf.st_mode))
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
 | 
					#if 0 /* must check buffer size */
 | 
				
			||||||
				strcat(p,"/index.html");
 | 
									strcat(p,"/index.html");
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
									BIO_puts(io,text);
 | 
				
			||||||
 | 
									BIO_printf(io,"'%s' is a directory\r\n",p);
 | 
				
			||||||
 | 
									break;
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if ((file=BIO_new_file(p,"r")) == NULL)
 | 
								if ((file=BIO_new_file(p,"r")) == NULL)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -83,9 +83,9 @@ typedef unsigned int u_int;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
static struct hostent *GetHostByName(char *name);
 | 
					static struct hostent *GetHostByName(char *name);
 | 
				
			||||||
#ifdef OPENSSL_SYS_WINDOWS
 | 
					#ifdef OPENSSL_SYS_WINDOWS
 | 
				
			||||||
static void sock_cleanup(void);
 | 
					static void ssl_sock_cleanup(void);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
static int sock_init(void);
 | 
					static int ssl_sock_init(void);
 | 
				
			||||||
static int init_client_ip(int *sock,unsigned char ip[4], int port);
 | 
					static int init_client_ip(int *sock,unsigned char ip[4], int port);
 | 
				
			||||||
static int init_server(int *sock, int port);
 | 
					static int init_server(int *sock, int port);
 | 
				
			||||||
static int init_server_long(int *sock, int port,char *ip);
 | 
					static int init_server_long(int *sock, int port,char *ip);
 | 
				
			||||||
@@ -118,7 +118,7 @@ static LONG FAR PASCAL topHookProc(HWND hwnd, UINT message, WPARAM wParam,
 | 
				
			|||||||
		case WM_DESTROY:
 | 
							case WM_DESTROY:
 | 
				
			||||||
		case WM_CLOSE:
 | 
							case WM_CLOSE:
 | 
				
			||||||
			SetWindowLong(topWnd,GWL_WNDPROC,(LONG)lpTopWndProc);
 | 
								SetWindowLong(topWnd,GWL_WNDPROC,(LONG)lpTopWndProc);
 | 
				
			||||||
			sock_cleanup();
 | 
								ssl_sock_cleanup();
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -135,26 +135,34 @@ static BOOL CALLBACK enumproc(HWND hwnd,LPARAM lParam)
 | 
				
			|||||||
#endif /* OPENSSL_SYS_WINDOWS */
 | 
					#endif /* OPENSSL_SYS_WINDOWS */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef OPENSSL_SYS_WINDOWS
 | 
					#ifdef OPENSSL_SYS_WINDOWS
 | 
				
			||||||
static void sock_cleanup(void)
 | 
					static void ssl_sock_cleanup(void)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	if (wsa_init_done)
 | 
						if (wsa_init_done)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		wsa_init_done=0;
 | 
							wsa_init_done=0;
 | 
				
			||||||
 | 
					#ifndef OPENSSL_SYS_WINCE
 | 
				
			||||||
		WSACancelBlockingCall();
 | 
							WSACancelBlockingCall();
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
		WSACleanup();
 | 
							WSACleanup();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int sock_init(void)
 | 
					static int ssl_sock_init(void)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
#ifdef OPENSSL_SYS_WINDOWS
 | 
					#ifdef WATT32
 | 
				
			||||||
 | 
						extern int _watt_do_exit;
 | 
				
			||||||
 | 
						_watt_do_exit = 0;
 | 
				
			||||||
 | 
						dbug_init();
 | 
				
			||||||
 | 
						if (sock_init())
 | 
				
			||||||
 | 
							return (0);
 | 
				
			||||||
 | 
					#elif defined(OPENSSL_SYS_WINDOWS)
 | 
				
			||||||
	if (!wsa_init_done)
 | 
						if (!wsa_init_done)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		int err;
 | 
							int err;
 | 
				
			||||||
	  
 | 
						  
 | 
				
			||||||
#ifdef SIGINT
 | 
					#ifdef SIGINT
 | 
				
			||||||
		signal(SIGINT,(void (*)(int))sock_cleanup);
 | 
							signal(SIGINT,(void (*)(int))ssl_sock_cleanup);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
		wsa_init_done=1;
 | 
							wsa_init_done=1;
 | 
				
			||||||
		memset(&wsa_state,0,sizeof(wsa_state));
 | 
							memset(&wsa_state,0,sizeof(wsa_state));
 | 
				
			||||||
@@ -196,7 +204,7 @@ static int init_client_ip(int *sock, unsigned char ip[4], int port)
 | 
				
			|||||||
	struct sockaddr_in them;
 | 
						struct sockaddr_in them;
 | 
				
			||||||
	int s,i;
 | 
						int s,i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!sock_init()) return(0);
 | 
						if (!ssl_sock_init()) return(0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	memset((char *)&them,0,sizeof(them));
 | 
						memset((char *)&them,0,sizeof(them));
 | 
				
			||||||
	them.sin_family=AF_INET;
 | 
						them.sin_family=AF_INET;
 | 
				
			||||||
@@ -261,7 +269,7 @@ static int init_server_long(int *sock, int port, char *ip)
 | 
				
			|||||||
	struct sockaddr_in server;
 | 
						struct sockaddr_in server;
 | 
				
			||||||
	int s= -1,i;
 | 
						int s= -1,i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!sock_init()) return(0);
 | 
						if (!ssl_sock_init()) return(0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	memset((char *)&server,0,sizeof(server));
 | 
						memset((char *)&server,0,sizeof(server));
 | 
				
			||||||
	server.sin_family=AF_INET;
 | 
						server.sin_family=AF_INET;
 | 
				
			||||||
@@ -318,7 +326,7 @@ static int do_accept(int acc_sock, int *sock, char **host)
 | 
				
			|||||||
	int len;
 | 
						int len;
 | 
				
			||||||
/*	struct linger ling; */
 | 
					/*	struct linger ling; */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!sock_init()) return(0);
 | 
						if (!ssl_sock_init()) return(0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef OPENSSL_SYS_WINDOWS
 | 
					#ifndef OPENSSL_SYS_WINDOWS
 | 
				
			||||||
redoit:
 | 
					redoit:
 | 
				
			||||||
@@ -448,7 +456,7 @@ static int host_ip(char *str, unsigned char ip[4])
 | 
				
			|||||||
		{ /* do a gethostbyname */
 | 
							{ /* do a gethostbyname */
 | 
				
			||||||
		struct hostent *he;
 | 
							struct hostent *he;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (!sock_init()) return(0);
 | 
							if (!ssl_sock_init()) return(0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		he=GetHostByName(str);
 | 
							he=GetHostByName(str);
 | 
				
			||||||
		if (he == NULL)
 | 
							if (he == NULL)
 | 
				
			||||||
@@ -529,9 +537,12 @@ static struct hostent *GetHostByName(char *name)
 | 
				
			|||||||
		ret=gethostbyname(name);
 | 
							ret=gethostbyname(name);
 | 
				
			||||||
		if (ret == NULL) return(NULL);
 | 
							if (ret == NULL) return(NULL);
 | 
				
			||||||
		/* else add to cache */
 | 
							/* else add to cache */
 | 
				
			||||||
		strncpy(ghbn_cache[lowi].name,name,128);
 | 
							if(strlen(name) < sizeof ghbn_cache[0].name)
 | 
				
			||||||
		memcpy((char *)&(ghbn_cache[lowi].ent),ret,sizeof(struct hostent));
 | 
								{
 | 
				
			||||||
		ghbn_cache[lowi].order=ghbn_miss+ghbn_hits;
 | 
								strcpy(ghbn_cache[lowi].name,name);
 | 
				
			||||||
 | 
								memcpy((char *)&(ghbn_cache[lowi].ent),ret,sizeof(struct hostent));
 | 
				
			||||||
 | 
								ghbn_cache[lowi].order=ghbn_miss+ghbn_hits;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
		return(ret);
 | 
							return(ret);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -67,22 +67,25 @@
 | 
				
			|||||||
#include <stdlib.h>
 | 
					#include <stdlib.h>
 | 
				
			||||||
#include <string.h>
 | 
					#include <string.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define USE_SOCKETS
 | 
				
			||||||
 | 
					#include "apps.h"
 | 
				
			||||||
#ifdef OPENSSL_NO_STDIO
 | 
					#ifdef OPENSSL_NO_STDIO
 | 
				
			||||||
#define APPS_WIN16
 | 
					#define APPS_WIN16
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#define USE_SOCKETS
 | 
					 | 
				
			||||||
#include <openssl/x509.h>
 | 
					#include <openssl/x509.h>
 | 
				
			||||||
#include <openssl/ssl.h>
 | 
					#include <openssl/ssl.h>
 | 
				
			||||||
#include <openssl/pem.h>
 | 
					#include <openssl/pem.h>
 | 
				
			||||||
#include "apps.h"
 | 
					 | 
				
			||||||
#include "s_apps.h"
 | 
					#include "s_apps.h"
 | 
				
			||||||
#include <openssl/err.h>
 | 
					#include <openssl/err.h>
 | 
				
			||||||
#ifdef WIN32_STUFF
 | 
					#ifdef WIN32_STUFF
 | 
				
			||||||
#include "winmain.h"
 | 
					#include "winmain.h"
 | 
				
			||||||
#include "wintext.h"
 | 
					#include "wintext.h"
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					#if !defined(OPENSSL_SYS_MSDOS)
 | 
				
			||||||
 | 
					#include OPENSSL_UNISTD
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if !defined(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX)
 | 
					#if !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_VXWORKS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC))
 | 
				
			||||||
#define TIMES
 | 
					#define TIMES
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -102,14 +105,10 @@
 | 
				
			|||||||
#undef TIMES
 | 
					#undef TIMES
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef TIMES
 | 
					#if !defined(TIMES) && !defined(OPENSSL_SYS_VXWORKS)
 | 
				
			||||||
#include <sys/timeb.h>
 | 
					#include <sys/timeb.h>
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef _AIX
 | 
					 | 
				
			||||||
#include <sys/select.h>
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#if defined(sun) || defined(__ultrix)
 | 
					#if defined(sun) || defined(__ultrix)
 | 
				
			||||||
#define _POSIX_SOURCE
 | 
					#define _POSIX_SOURCE
 | 
				
			||||||
#include <limits.h>
 | 
					#include <limits.h>
 | 
				
			||||||
@@ -119,11 +118,19 @@
 | 
				
			|||||||
/* The following if from times(3) man page.  It may need to be changed
 | 
					/* The following if from times(3) man page.  It may need to be changed
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
#ifndef HZ
 | 
					#ifndef HZ
 | 
				
			||||||
#ifndef CLK_TCK
 | 
					# ifdef _SC_CLK_TCK
 | 
				
			||||||
#define HZ      100.0
 | 
					#  define HZ ((double)sysconf(_SC_CLK_TCK))
 | 
				
			||||||
#else /* CLK_TCK */
 | 
					# else
 | 
				
			||||||
#define HZ ((double)CLK_TCK)
 | 
					#  ifndef CLK_TCK
 | 
				
			||||||
#endif
 | 
					#   ifndef _BSD_CLK_TCK_ /* FreeBSD hack */
 | 
				
			||||||
 | 
					#    define HZ	100.0
 | 
				
			||||||
 | 
					#   else /* _BSD_CLK_TCK_ */
 | 
				
			||||||
 | 
					#    define HZ ((double)_BSD_CLK_TCK_)
 | 
				
			||||||
 | 
					#   endif
 | 
				
			||||||
 | 
					#  else /* CLK_TCK */
 | 
				
			||||||
 | 
					#   define HZ ((double)CLK_TCK)
 | 
				
			||||||
 | 
					#  endif
 | 
				
			||||||
 | 
					# endif
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#undef PROG
 | 
					#undef PROG
 | 
				
			||||||
@@ -139,6 +146,10 @@
 | 
				
			|||||||
#undef BUFSIZZ
 | 
					#undef BUFSIZZ
 | 
				
			||||||
#define BUFSIZZ 1024*10
 | 
					#define BUFSIZZ 1024*10
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define MYBUFSIZ 1024*8
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#undef min
 | 
				
			||||||
 | 
					#undef max
 | 
				
			||||||
#define min(a,b) (((a) < (b)) ? (a) : (b))
 | 
					#define min(a,b) (((a) < (b)) ? (a) : (b))
 | 
				
			||||||
#define max(a,b) (((a) > (b)) ? (a) : (b))
 | 
					#define max(a,b) (((a) > (b)) ? (a) : (b))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -311,6 +322,11 @@ static int parseArgs(int argc, char **argv)
 | 
				
			|||||||
		{
 | 
							{
 | 
				
			||||||
		if (--argc < 1) goto bad;
 | 
							if (--argc < 1) goto bad;
 | 
				
			||||||
		s_www_path= *(++argv);
 | 
							s_www_path= *(++argv);
 | 
				
			||||||
 | 
							if(strlen(s_www_path) > MYBUFSIZ-100)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								BIO_printf(bio_err,"-www option too long\n");
 | 
				
			||||||
 | 
								badop=1;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	else if(strcmp(*argv,"-bugs") == 0)
 | 
						else if(strcmp(*argv,"-bugs") == 0)
 | 
				
			||||||
	    st_bugs=1;
 | 
						    st_bugs=1;
 | 
				
			||||||
@@ -368,6 +384,22 @@ static double tm_Time_F(int s)
 | 
				
			|||||||
		ret=((double)(tend.tms_utime-tstart.tms_utime))/HZ;
 | 
							ret=((double)(tend.tms_utime-tstart.tms_utime))/HZ;
 | 
				
			||||||
		return((ret == 0.0)?1e-6:ret);
 | 
							return((ret == 0.0)?1e-6:ret);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					#elif defined(OPENSSL_SYS_VXWORKS)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
						static unsigned long tick_start, tick_end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if( s == START )
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							tick_start = tickGet();
 | 
				
			||||||
 | 
							return 0;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							tick_end = tickGet();
 | 
				
			||||||
 | 
							ret = (double)(tick_end - tick_start) / (double)sysClkRateGet();
 | 
				
			||||||
 | 
							return((ret == 0.0)?1e-6:ret);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
#else /* !times() */
 | 
					#else /* !times() */
 | 
				
			||||||
	static struct timeb tstart,tend;
 | 
						static struct timeb tstart,tend;
 | 
				
			||||||
	long i;
 | 
						long i;
 | 
				
			||||||
@@ -443,7 +475,6 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if (tm_cipher == NULL ) {
 | 
						if (tm_cipher == NULL ) {
 | 
				
			||||||
		fprintf( stderr, "No CIPHER specified\n" );
 | 
							fprintf( stderr, "No CIPHER specified\n" );
 | 
				
			||||||
/*		EXIT(1); */
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!(perform & 1)) goto next;
 | 
						if (!(perform & 1)) goto next;
 | 
				
			||||||
@@ -456,7 +487,7 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
	tm_Time_F(START);
 | 
						tm_Time_F(START);
 | 
				
			||||||
	for (;;)
 | 
						for (;;)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		if (finishtime < time(NULL)) break;
 | 
							if (finishtime < (long)time(NULL)) break;
 | 
				
			||||||
#ifdef WIN32_STUFF
 | 
					#ifdef WIN32_STUFF
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if( flushWinMsgs(0) == -1 )
 | 
							if( flushWinMsgs(0) == -1 )
 | 
				
			||||||
@@ -507,9 +538,9 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	totalTime += tm_Time_F(STOP); /* Add the time for this iteration */
 | 
						totalTime += tm_Time_F(STOP); /* Add the time for this iteration */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	i=(int)(time(NULL)-finishtime+maxTime);
 | 
						i=(int)((long)time(NULL)-finishtime+maxTime);
 | 
				
			||||||
	printf( "\n\n%d connections in %.2fs; %.2f connections/user sec, bytes read %ld\n", nConn, totalTime, ((double)nConn/totalTime),bytes_read);
 | 
						printf( "\n\n%d connections in %.2fs; %.2f connections/user sec, bytes read %ld\n", nConn, totalTime, ((double)nConn/totalTime),bytes_read);
 | 
				
			||||||
	printf( "%d connections in %ld real seconds, %ld bytes read per connection\n",nConn,time(NULL)-finishtime+maxTime,bytes_read/nConn);
 | 
						printf( "%d connections in %ld real seconds, %ld bytes read per connection\n",nConn,(long)time(NULL)-finishtime+maxTime,bytes_read/nConn);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Now loop and time connections using the same session id over and over */
 | 
						/* Now loop and time connections using the same session id over and over */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -541,7 +572,7 @@ next:
 | 
				
			|||||||
	nConn = 0;
 | 
						nConn = 0;
 | 
				
			||||||
	totalTime = 0.0;
 | 
						totalTime = 0.0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	finishtime=time(NULL)+maxTime;
 | 
						finishtime=(long)time(NULL)+maxTime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	printf( "starting\n" );
 | 
						printf( "starting\n" );
 | 
				
			||||||
	bytes_read=0;
 | 
						bytes_read=0;
 | 
				
			||||||
@@ -549,7 +580,7 @@ next:
 | 
				
			|||||||
		
 | 
							
 | 
				
			||||||
	for (;;)
 | 
						for (;;)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		if (finishtime < time(NULL)) break;
 | 
							if (finishtime < (long)time(NULL)) break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef WIN32_STUFF
 | 
					#ifdef WIN32_STUFF
 | 
				
			||||||
		if( flushWinMsgs(0) == -1 )
 | 
							if( flushWinMsgs(0) == -1 )
 | 
				
			||||||
@@ -599,7 +630,7 @@ next:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	printf( "\n\n%d connections in %.2fs; %.2f connections/user sec, bytes read %ld\n", nConn, totalTime, ((double)nConn/totalTime),bytes_read);
 | 
						printf( "\n\n%d connections in %.2fs; %.2f connections/user sec, bytes read %ld\n", nConn, totalTime, ((double)nConn/totalTime),bytes_read);
 | 
				
			||||||
	printf( "%d connections in %ld real seconds, %ld bytes read per connection\n",nConn,time(NULL)-finishtime+maxTime,bytes_read/nConn);
 | 
						printf( "%d connections in %ld real seconds, %ld bytes read per connection\n",nConn,(long)time(NULL)-finishtime+maxTime,bytes_read/nConn);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ret=0;
 | 
						ret=0;
 | 
				
			||||||
end:
 | 
					end:
 | 
				
			||||||
@@ -610,6 +641,7 @@ end:
 | 
				
			|||||||
		SSL_CTX_free(tm_ctx);
 | 
							SSL_CTX_free(tm_ctx);
 | 
				
			||||||
		tm_ctx=NULL;
 | 
							tm_ctx=NULL;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
						apps_shutdown();
 | 
				
			||||||
	EXIT(ret);
 | 
						EXIT(ret);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -272,6 +272,7 @@ bad:
 | 
				
			|||||||
end:
 | 
					end:
 | 
				
			||||||
	if (out != NULL) BIO_free_all(out);
 | 
						if (out != NULL) BIO_free_all(out);
 | 
				
			||||||
	if (x != NULL) SSL_SESSION_free(x);
 | 
						if (x != NULL) SSL_SESSION_free(x);
 | 
				
			||||||
 | 
						apps_shutdown();
 | 
				
			||||||
	EXIT(ret);
 | 
						EXIT(ret);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										95
									
								
								apps/smime.c
									
									
									
									
									
								
							
							
						
						
									
										95
									
								
								apps/smime.c
									
									
									
									
									
								
							@@ -64,7 +64,6 @@
 | 
				
			|||||||
#include <openssl/crypto.h>
 | 
					#include <openssl/crypto.h>
 | 
				
			||||||
#include <openssl/pem.h>
 | 
					#include <openssl/pem.h>
 | 
				
			||||||
#include <openssl/err.h>
 | 
					#include <openssl/err.h>
 | 
				
			||||||
#include <openssl/engine.h>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#undef PROG
 | 
					#undef PROG
 | 
				
			||||||
#define PROG smime_main
 | 
					#define PROG smime_main
 | 
				
			||||||
@@ -97,18 +96,28 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
	STACK_OF(X509) *encerts = NULL, *other = NULL;
 | 
						STACK_OF(X509) *encerts = NULL, *other = NULL;
 | 
				
			||||||
	BIO *in = NULL, *out = NULL, *indata = NULL;
 | 
						BIO *in = NULL, *out = NULL, *indata = NULL;
 | 
				
			||||||
	int badarg = 0;
 | 
						int badarg = 0;
 | 
				
			||||||
	int flags = PKCS7_DETACHED;
 | 
						int flags = PKCS7_DETACHED, store_flags = 0;
 | 
				
			||||||
	char *to = NULL, *from = NULL, *subject = NULL;
 | 
						char *to = NULL, *from = NULL, *subject = NULL;
 | 
				
			||||||
	char *CAfile = NULL, *CApath = NULL;
 | 
						char *CAfile = NULL, *CApath = NULL;
 | 
				
			||||||
	char *passargin = NULL, *passin = NULL;
 | 
						char *passargin = NULL, *passin = NULL;
 | 
				
			||||||
	char *inrand = NULL;
 | 
						char *inrand = NULL;
 | 
				
			||||||
	int need_rand = 0;
 | 
						int need_rand = 0;
 | 
				
			||||||
	int informat = FORMAT_SMIME, outformat = FORMAT_SMIME;
 | 
						int informat = FORMAT_SMIME, outformat = FORMAT_SMIME;
 | 
				
			||||||
 | 
					        int keyform = FORMAT_PEM;
 | 
				
			||||||
	char *engine=NULL;
 | 
						char *engine=NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	args = argv + 1;
 | 
						args = argv + 1;
 | 
				
			||||||
	ret = 1;
 | 
						ret = 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						apps_startup();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (bio_err == NULL)
 | 
				
			||||||
 | 
							if ((bio_err = BIO_new(BIO_s_file())) != NULL)
 | 
				
			||||||
 | 
								BIO_set_fp(bio_err, stderr, BIO_NOCLOSE|BIO_FP_TEXT);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!load_config(bio_err, NULL))
 | 
				
			||||||
 | 
							goto end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	while (!badarg && *args && *args[0] == '-') {
 | 
						while (!badarg && *args && *args[0] == '-') {
 | 
				
			||||||
		if (!strcmp (*args, "-encrypt")) operation = SMIME_ENCRYPT;
 | 
							if (!strcmp (*args, "-encrypt")) operation = SMIME_ENCRYPT;
 | 
				
			||||||
		else if (!strcmp (*args, "-decrypt")) operation = SMIME_DECRYPT;
 | 
							else if (!strcmp (*args, "-decrypt")) operation = SMIME_DECRYPT;
 | 
				
			||||||
@@ -128,6 +137,14 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
				cipher = EVP_rc2_cbc();
 | 
									cipher = EVP_rc2_cbc();
 | 
				
			||||||
		else if (!strcmp (*args, "-rc2-64")) 
 | 
							else if (!strcmp (*args, "-rc2-64")) 
 | 
				
			||||||
				cipher = EVP_rc2_64_cbc();
 | 
									cipher = EVP_rc2_64_cbc();
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_AES
 | 
				
			||||||
 | 
							else if (!strcmp(*args,"-aes128"))
 | 
				
			||||||
 | 
									cipher = EVP_aes_128_cbc();
 | 
				
			||||||
 | 
							else if (!strcmp(*args,"-aes192"))
 | 
				
			||||||
 | 
									cipher = EVP_aes_192_cbc();
 | 
				
			||||||
 | 
							else if (!strcmp(*args,"-aes256"))
 | 
				
			||||||
 | 
									cipher = EVP_aes_256_cbc();
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
		else if (!strcmp (*args, "-text")) 
 | 
							else if (!strcmp (*args, "-text")) 
 | 
				
			||||||
				flags |= PKCS7_TEXT;
 | 
									flags |= PKCS7_TEXT;
 | 
				
			||||||
@@ -149,6 +166,10 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
				flags |= PKCS7_BINARY;
 | 
									flags |= PKCS7_BINARY;
 | 
				
			||||||
		else if (!strcmp (*args, "-nosigs"))
 | 
							else if (!strcmp (*args, "-nosigs"))
 | 
				
			||||||
				flags |= PKCS7_NOSIGS;
 | 
									flags |= PKCS7_NOSIGS;
 | 
				
			||||||
 | 
							else if (!strcmp (*args, "-crl_check"))
 | 
				
			||||||
 | 
									store_flags |= X509_V_FLAG_CRL_CHECK;
 | 
				
			||||||
 | 
							else if (!strcmp (*args, "-crl_check_all"))
 | 
				
			||||||
 | 
									store_flags |= X509_V_FLAG_CRL_CHECK|X509_V_FLAG_CRL_CHECK_ALL;
 | 
				
			||||||
		else if (!strcmp(*args,"-rand")) {
 | 
							else if (!strcmp(*args,"-rand")) {
 | 
				
			||||||
			if (args[1]) {
 | 
								if (args[1]) {
 | 
				
			||||||
				args++;
 | 
									args++;
 | 
				
			||||||
@@ -195,6 +216,11 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
				args++;
 | 
									args++;
 | 
				
			||||||
				keyfile = *args;
 | 
									keyfile = *args;
 | 
				
			||||||
			} else badarg = 1;
 | 
								} else badarg = 1;
 | 
				
			||||||
 | 
							} else if (!strcmp (*args, "-keyform")) {
 | 
				
			||||||
 | 
								if (args[1]) {
 | 
				
			||||||
 | 
									args++;
 | 
				
			||||||
 | 
									keyform = str2fmt(*args);
 | 
				
			||||||
 | 
								} else badarg = 1;
 | 
				
			||||||
		} else if (!strcmp (*args, "-certfile")) {
 | 
							} else if (!strcmp (*args, "-certfile")) {
 | 
				
			||||||
			if (args[1]) {
 | 
								if (args[1]) {
 | 
				
			||||||
				args++;
 | 
									args++;
 | 
				
			||||||
@@ -274,6 +300,10 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
		BIO_printf (bio_err, "-rc2-40        encrypt with RC2-40 (default)\n");
 | 
							BIO_printf (bio_err, "-rc2-40        encrypt with RC2-40 (default)\n");
 | 
				
			||||||
		BIO_printf (bio_err, "-rc2-64        encrypt with RC2-64\n");
 | 
							BIO_printf (bio_err, "-rc2-64        encrypt with RC2-64\n");
 | 
				
			||||||
		BIO_printf (bio_err, "-rc2-128       encrypt with RC2-128\n");
 | 
							BIO_printf (bio_err, "-rc2-128       encrypt with RC2-128\n");
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_AES
 | 
				
			||||||
 | 
							BIO_printf (bio_err, "-aes128, -aes192, -aes256\n");
 | 
				
			||||||
 | 
							BIO_printf (bio_err, "               encrypt PEM output with cbc aes\n");
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
		BIO_printf (bio_err, "-nointern      don't search certificates in message for signer\n");
 | 
							BIO_printf (bio_err, "-nointern      don't search certificates in message for signer\n");
 | 
				
			||||||
		BIO_printf (bio_err, "-nosigs        don't verify message signature\n");
 | 
							BIO_printf (bio_err, "-nosigs        don't verify message signature\n");
 | 
				
			||||||
@@ -288,6 +318,7 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
		BIO_printf (bio_err, "-in file       input file\n");
 | 
							BIO_printf (bio_err, "-in file       input file\n");
 | 
				
			||||||
		BIO_printf (bio_err, "-inform arg    input format SMIME (default), PEM or DER\n");
 | 
							BIO_printf (bio_err, "-inform arg    input format SMIME (default), PEM or DER\n");
 | 
				
			||||||
		BIO_printf (bio_err, "-inkey file    input private key (if not signer or recipient)\n");
 | 
							BIO_printf (bio_err, "-inkey file    input private key (if not signer or recipient)\n");
 | 
				
			||||||
 | 
							BIO_printf (bio_err, "-keyform arg   input private key format (PEM or ENGINE)\n");
 | 
				
			||||||
		BIO_printf (bio_err, "-out file      output file\n");
 | 
							BIO_printf (bio_err, "-out file      output file\n");
 | 
				
			||||||
		BIO_printf (bio_err, "-outform arg   output format SMIME (default), PEM or DER\n");
 | 
							BIO_printf (bio_err, "-outform arg   output format SMIME (default), PEM or DER\n");
 | 
				
			||||||
		BIO_printf (bio_err, "-content file  supply or override content for detached signature\n");
 | 
							BIO_printf (bio_err, "-content file  supply or override content for detached signature\n");
 | 
				
			||||||
@@ -297,7 +328,10 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
		BIO_printf (bio_err, "-text          include or delete text MIME headers\n");
 | 
							BIO_printf (bio_err, "-text          include or delete text MIME headers\n");
 | 
				
			||||||
		BIO_printf (bio_err, "-CApath dir    trusted certificates directory\n");
 | 
							BIO_printf (bio_err, "-CApath dir    trusted certificates directory\n");
 | 
				
			||||||
		BIO_printf (bio_err, "-CAfile file   trusted certificates file\n");
 | 
							BIO_printf (bio_err, "-CAfile file   trusted certificates file\n");
 | 
				
			||||||
 | 
							BIO_printf (bio_err, "-crl_check     check revocation status of signer's certificate using CRLs\n");
 | 
				
			||||||
 | 
							BIO_printf (bio_err, "-crl_check_all check revocation status of signer's certificate chain using CRLs\n");
 | 
				
			||||||
		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");
 | 
				
			||||||
 | 
							BIO_printf (bio_err, "-passin arg    input file pass phrase source\n");
 | 
				
			||||||
		BIO_printf(bio_err,  "-rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR);
 | 
							BIO_printf(bio_err,  "-rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR);
 | 
				
			||||||
		BIO_printf(bio_err,  "               load the file (or the files in the directory) into\n");
 | 
							BIO_printf(bio_err,  "               load the file (or the files in the directory) into\n");
 | 
				
			||||||
		BIO_printf(bio_err,  "               the random number generator\n");
 | 
							BIO_printf(bio_err,  "               the random number generator\n");
 | 
				
			||||||
@@ -305,23 +339,7 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
		goto end;
 | 
							goto end;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (engine != NULL)
 | 
					        e = setup_engine(bio_err, engine, 0);
 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
		if((e = ENGINE_by_id(engine)) == NULL)
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			BIO_printf(bio_err,"invalid engine \"%s\"\n",
 | 
					 | 
				
			||||||
				engine);
 | 
					 | 
				
			||||||
			goto end;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			BIO_printf(bio_err,"can't use that engine\n");
 | 
					 | 
				
			||||||
			goto end;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
 | 
					 | 
				
			||||||
		/* Free our "structural" reference. */
 | 
					 | 
				
			||||||
		ENGINE_free(e);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(!app_passwd(bio_err, passargin, NULL, &passin, NULL)) {
 | 
						if(!app_passwd(bio_err, passargin, NULL, &passin, NULL)) {
 | 
				
			||||||
		BIO_printf(bio_err, "Error getting password\n");
 | 
							BIO_printf(bio_err, "Error getting password\n");
 | 
				
			||||||
@@ -358,8 +376,11 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
		encerts = sk_X509_new_null();
 | 
							encerts = sk_X509_new_null();
 | 
				
			||||||
		while (*args) {
 | 
							while (*args) {
 | 
				
			||||||
			if(!(cert = load_cert(bio_err,*args,FORMAT_PEM))) {
 | 
								if(!(cert = load_cert(bio_err,*args,FORMAT_PEM,
 | 
				
			||||||
 | 
									NULL, e, "recipient certificate file"))) {
 | 
				
			||||||
 | 
					#if 0				/* An appropriate message is already printed */
 | 
				
			||||||
				BIO_printf(bio_err, "Can't read recipient certificate file %s\n", *args);
 | 
									BIO_printf(bio_err, "Can't read recipient certificate file %s\n", *args);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
				goto end;
 | 
									goto end;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			sk_X509_push(encerts, cert);
 | 
								sk_X509_push(encerts, cert);
 | 
				
			||||||
@@ -369,23 +390,32 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(signerfile && (operation == SMIME_SIGN)) {
 | 
						if(signerfile && (operation == SMIME_SIGN)) {
 | 
				
			||||||
		if(!(signer = load_cert(bio_err,signerfile,FORMAT_PEM))) {
 | 
							if(!(signer = load_cert(bio_err,signerfile,FORMAT_PEM, NULL,
 | 
				
			||||||
 | 
								e, "signer certificate"))) {
 | 
				
			||||||
 | 
					#if 0			/* An appropri message has already been printed */
 | 
				
			||||||
			BIO_printf(bio_err, "Can't read signer certificate file %s\n", signerfile);
 | 
								BIO_printf(bio_err, "Can't read signer certificate file %s\n", signerfile);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
			goto end;
 | 
								goto end;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(certfile) {
 | 
						if(certfile) {
 | 
				
			||||||
		if(!(other = load_certs(bio_err,certfile,FORMAT_PEM))) {
 | 
							if(!(other = load_certs(bio_err,certfile,FORMAT_PEM, NULL,
 | 
				
			||||||
 | 
								e, "certificate file"))) {
 | 
				
			||||||
 | 
					#if 0			/* An appropriate message has already been printed */
 | 
				
			||||||
			BIO_printf(bio_err, "Can't read certificate file %s\n", certfile);
 | 
								BIO_printf(bio_err, "Can't read certificate file %s\n", certfile);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
			ERR_print_errors(bio_err);
 | 
								ERR_print_errors(bio_err);
 | 
				
			||||||
			goto end;
 | 
								goto end;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(recipfile && (operation == SMIME_DECRYPT)) {
 | 
						if(recipfile && (operation == SMIME_DECRYPT)) {
 | 
				
			||||||
		if(!(recip = load_cert(bio_err,recipfile,FORMAT_PEM))) {
 | 
							if(!(recip = load_cert(bio_err,recipfile,FORMAT_PEM,NULL,
 | 
				
			||||||
 | 
								e, "recipient certificate file"))) {
 | 
				
			||||||
 | 
					#if 0			/* An appropriate message has alrady been printed */
 | 
				
			||||||
			BIO_printf(bio_err, "Can't read recipient certificate file %s\n", recipfile);
 | 
								BIO_printf(bio_err, "Can't read recipient certificate file %s\n", recipfile);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
			ERR_print_errors(bio_err);
 | 
								ERR_print_errors(bio_err);
 | 
				
			||||||
			goto end;
 | 
								goto end;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -398,11 +428,11 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
	} else keyfile = NULL;
 | 
						} else keyfile = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(keyfile) {
 | 
						if(keyfile) {
 | 
				
			||||||
		if(!(key = load_key(bio_err,keyfile, FORMAT_PEM, passin, NULL))) {
 | 
							key = load_key(bio_err, keyfile, keyform, 0, passin, e,
 | 
				
			||||||
			BIO_printf(bio_err, "Can't read recipient certificate file %s\n", keyfile);
 | 
								       "signing key file");
 | 
				
			||||||
			ERR_print_errors(bio_err);
 | 
							if (!key) {
 | 
				
			||||||
			goto end;
 | 
								goto end;
 | 
				
			||||||
		}
 | 
					                }
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (infile) {
 | 
						if (infile) {
 | 
				
			||||||
@@ -431,15 +461,20 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if(operation == SMIME_VERIFY) {
 | 
						if(operation == SMIME_VERIFY) {
 | 
				
			||||||
		if(!(store = setup_verify(bio_err, CAfile, CApath))) goto end;
 | 
							if(!(store = setup_verify(bio_err, CAfile, CApath))) goto end;
 | 
				
			||||||
 | 
							X509_STORE_set_flags(store, store_flags);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ret = 3;
 | 
						ret = 3;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(operation == SMIME_ENCRYPT) {
 | 
						if(operation == SMIME_ENCRYPT) {
 | 
				
			||||||
		p7 = PKCS7_encrypt(encerts, in, cipher, flags);
 | 
							p7 = PKCS7_encrypt(encerts, in, cipher, flags);
 | 
				
			||||||
	} else if(operation == SMIME_SIGN) {
 | 
						} else if(operation == SMIME_SIGN) {
 | 
				
			||||||
		p7 = PKCS7_sign(signer, key, other, in, flags);
 | 
							p7 = PKCS7_sign(signer, key, other, in, flags);
 | 
				
			||||||
		BIO_reset(in);
 | 
							if (BIO_reset(in) != 0 && (flags & PKCS7_DETACHED)) {
 | 
				
			||||||
 | 
							  BIO_printf(bio_err, "Can't rewind input file\n");
 | 
				
			||||||
 | 
							  goto end;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		if(informat == FORMAT_SMIME) 
 | 
							if(informat == FORMAT_SMIME) 
 | 
				
			||||||
			p7 = SMIME_read_PKCS7(in, &indata);
 | 
								p7 = SMIME_read_PKCS7(in, &indata);
 | 
				
			||||||
@@ -479,9 +514,9 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
	} else if(operation == SMIME_VERIFY) {
 | 
						} else if(operation == SMIME_VERIFY) {
 | 
				
			||||||
		STACK_OF(X509) *signers;
 | 
							STACK_OF(X509) *signers;
 | 
				
			||||||
		if(PKCS7_verify(p7, other, store, indata, out, flags)) {
 | 
							if(PKCS7_verify(p7, other, store, indata, out, flags)) {
 | 
				
			||||||
			BIO_printf(bio_err, "Verification Successful\n");
 | 
								BIO_printf(bio_err, "Verification successful\n");
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			BIO_printf(bio_err, "Verification Failure\n");
 | 
								BIO_printf(bio_err, "Verification failure\n");
 | 
				
			||||||
			goto end;
 | 
								goto end;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		signers = PKCS7_get0_signers(p7, other, flags);
 | 
							signers = PKCS7_get0_signers(p7, other, flags);
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										885
									
								
								apps/speed.c
									
									
									
									
									
								
							
							
						
						
									
										885
									
								
								apps/speed.c
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										50
									
								
								apps/spkac.c
									
									
									
									
									
								
							
							
						
						
									
										50
									
								
								apps/spkac.c
									
									
									
									
									
								
							@@ -69,7 +69,6 @@
 | 
				
			|||||||
#include <openssl/lhash.h>
 | 
					#include <openssl/lhash.h>
 | 
				
			||||||
#include <openssl/x509.h>
 | 
					#include <openssl/x509.h>
 | 
				
			||||||
#include <openssl/pem.h>
 | 
					#include <openssl/pem.h>
 | 
				
			||||||
#include <openssl/engine.h>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#undef PROG
 | 
					#undef PROG
 | 
				
			||||||
#define PROG	spkac_main
 | 
					#define PROG	spkac_main
 | 
				
			||||||
@@ -84,13 +83,13 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
	{
 | 
						{
 | 
				
			||||||
	ENGINE *e = NULL;
 | 
						ENGINE *e = NULL;
 | 
				
			||||||
	int i,badops=0, ret = 1;
 | 
						int i,badops=0, ret = 1;
 | 
				
			||||||
	BIO *in = NULL,*out = NULL, *key = NULL;
 | 
						BIO *in = NULL,*out = NULL;
 | 
				
			||||||
	int verify=0,noout=0,pubkey=0;
 | 
						int verify=0,noout=0,pubkey=0;
 | 
				
			||||||
	char *infile = NULL,*outfile = NULL,*prog;
 | 
						char *infile = NULL,*outfile = NULL,*prog;
 | 
				
			||||||
	char *passargin = NULL, *passin = NULL;
 | 
						char *passargin = NULL, *passin = NULL;
 | 
				
			||||||
	char *spkac = "SPKAC", *spksect = "default", *spkstr = NULL;
 | 
						char *spkac = "SPKAC", *spksect = "default", *spkstr = NULL;
 | 
				
			||||||
	char *challenge = NULL, *keyfile = NULL;
 | 
						char *challenge = NULL, *keyfile = NULL;
 | 
				
			||||||
	LHASH *conf = NULL;
 | 
						CONF *conf = NULL;
 | 
				
			||||||
	NETSCAPE_SPKI *spki = NULL;
 | 
						NETSCAPE_SPKI *spki = NULL;
 | 
				
			||||||
	EVP_PKEY *pkey = NULL;
 | 
						EVP_PKEY *pkey = NULL;
 | 
				
			||||||
	char *engine=NULL;
 | 
						char *engine=NULL;
 | 
				
			||||||
@@ -99,6 +98,9 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if (!bio_err) bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
 | 
						if (!bio_err) bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!load_config(bio_err, NULL))
 | 
				
			||||||
 | 
							goto end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	prog=argv[0];
 | 
						prog=argv[0];
 | 
				
			||||||
	argc--;
 | 
						argc--;
 | 
				
			||||||
	argv++;
 | 
						argv++;
 | 
				
			||||||
@@ -179,36 +181,13 @@ bad:
 | 
				
			|||||||
		goto end;
 | 
							goto end;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (engine != NULL)
 | 
					        e = setup_engine(bio_err, engine, 0);
 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
		if((e = ENGINE_by_id(engine)) == NULL)
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			BIO_printf(bio_err,"invalid engine \"%s\"\n",
 | 
					 | 
				
			||||||
				engine);
 | 
					 | 
				
			||||||
			goto end;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			BIO_printf(bio_err,"can't use that engine\n");
 | 
					 | 
				
			||||||
			goto end;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
 | 
					 | 
				
			||||||
		/* Free our "structural" reference. */
 | 
					 | 
				
			||||||
		ENGINE_free(e);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(keyfile) {
 | 
						if(keyfile) {
 | 
				
			||||||
		if(strcmp(keyfile, "-")) key = BIO_new_file(keyfile, "r");
 | 
							pkey = load_key(bio_err,
 | 
				
			||||||
		else key = BIO_new_fp(stdin, BIO_NOCLOSE);
 | 
									strcmp(keyfile, "-") ? keyfile : NULL,
 | 
				
			||||||
		if(!key) {
 | 
									FORMAT_PEM, 1, passin, e, "private key");
 | 
				
			||||||
			BIO_printf(bio_err, "Error opening key file\n");
 | 
					 | 
				
			||||||
			ERR_print_errors(bio_err);
 | 
					 | 
				
			||||||
			goto end;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		pkey = PEM_read_bio_PrivateKey(key, NULL, NULL, passin);
 | 
					 | 
				
			||||||
		if(!pkey) {
 | 
							if(!pkey) {
 | 
				
			||||||
			BIO_printf(bio_err, "Error reading private key\n");
 | 
					 | 
				
			||||||
			ERR_print_errors(bio_err);
 | 
					 | 
				
			||||||
			goto end;
 | 
								goto end;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		spki = NETSCAPE_SPKI_new();
 | 
							spki = NETSCAPE_SPKI_new();
 | 
				
			||||||
@@ -251,15 +230,16 @@ bad:
 | 
				
			|||||||
		goto end;
 | 
							goto end;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	conf = CONF_load_bio(NULL, in, NULL);
 | 
						conf = NCONF_new(NULL);
 | 
				
			||||||
 | 
						i = NCONF_load_bio(conf, in, NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(!conf) {
 | 
						if(!i) {
 | 
				
			||||||
		BIO_printf(bio_err, "Error parsing config file\n");
 | 
							BIO_printf(bio_err, "Error parsing config file\n");
 | 
				
			||||||
		ERR_print_errors(bio_err);
 | 
							ERR_print_errors(bio_err);
 | 
				
			||||||
		goto end;
 | 
							goto end;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spkstr = CONF_get_string(conf, spksect, spkac);
 | 
						spkstr = NCONF_get_string(conf, spksect, spkac);
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
	if(!spkstr) {
 | 
						if(!spkstr) {
 | 
				
			||||||
		BIO_printf(bio_err, "Can't find SPKAC called \"%s\"\n", spkac);
 | 
							BIO_printf(bio_err, "Can't find SPKAC called \"%s\"\n", spkac);
 | 
				
			||||||
@@ -308,12 +288,12 @@ bad:
 | 
				
			|||||||
	ret = 0;
 | 
						ret = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
end:
 | 
					end:
 | 
				
			||||||
	CONF_free(conf);
 | 
						NCONF_free(conf);
 | 
				
			||||||
	NETSCAPE_SPKI_free(spki);
 | 
						NETSCAPE_SPKI_free(spki);
 | 
				
			||||||
	BIO_free(in);
 | 
						BIO_free(in);
 | 
				
			||||||
	BIO_free_all(out);
 | 
						BIO_free_all(out);
 | 
				
			||||||
	BIO_free(key);
 | 
					 | 
				
			||||||
	EVP_PKEY_free(pkey);
 | 
						EVP_PKEY_free(pkey);
 | 
				
			||||||
	if(passin) OPENSSL_free(passin);
 | 
						if(passin) OPENSSL_free(passin);
 | 
				
			||||||
 | 
						apps_shutdown();
 | 
				
			||||||
	EXIT(ret);
 | 
						EXIT(ret);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,6 +3,18 @@
 | 
				
			|||||||
DSA *get_dsa512(void );
 | 
					DSA *get_dsa512(void );
 | 
				
			||||||
DSA *get_dsa1024(void );
 | 
					DSA *get_dsa1024(void );
 | 
				
			||||||
DSA *get_dsa2048(void );
 | 
					DSA *get_dsa2048(void );
 | 
				
			||||||
 | 
					static unsigned char dsa512_priv[] = {
 | 
				
			||||||
 | 
						0x65,0xe5,0xc7,0x38,0x60,0x24,0xb5,0x89,0xd4,0x9c,0xeb,0x4c,
 | 
				
			||||||
 | 
						0x9c,0x1d,0x7a,0x22,0xbd,0xd1,0xc2,0xd2,
 | 
				
			||||||
 | 
						};
 | 
				
			||||||
 | 
					static unsigned char dsa512_pub[] = {
 | 
				
			||||||
 | 
						0x00,0x95,0xa7,0x0d,0xec,0x93,0x68,0xba,0x5f,0xf7,0x5f,0x07,
 | 
				
			||||||
 | 
						0xf2,0x3b,0xad,0x6b,0x01,0xdc,0xbe,0xec,0xde,0x04,0x7a,0x3a,
 | 
				
			||||||
 | 
						0x27,0xb3,0xec,0x49,0xfd,0x08,0x43,0x3d,0x7e,0xa8,0x2c,0x5e,
 | 
				
			||||||
 | 
						0x7b,0xbb,0xfc,0xf4,0x6e,0xeb,0x6c,0xb0,0x6e,0xf8,0x02,0x12,
 | 
				
			||||||
 | 
						0x8c,0x38,0x5d,0x83,0x56,0x7d,0xee,0x53,0x05,0x3e,0x24,0x84,
 | 
				
			||||||
 | 
						0xbe,0xba,0x0a,0x6b,0xc8,
 | 
				
			||||||
 | 
						};
 | 
				
			||||||
static unsigned char dsa512_p[]={
 | 
					static unsigned char dsa512_p[]={
 | 
				
			||||||
	0x9D,0x1B,0x69,0x8E,0x26,0xDB,0xF2,0x2B,0x11,0x70,0x19,0x86,
 | 
						0x9D,0x1B,0x69,0x8E,0x26,0xDB,0xF2,0x2B,0x11,0x70,0x19,0x86,
 | 
				
			||||||
	0xF6,0x19,0xC8,0xF8,0x19,0xF2,0x18,0x53,0x94,0x46,0x06,0xD0,
 | 
						0xF6,0x19,0xC8,0xF8,0x19,0xF2,0x18,0x53,0x94,0x46,0x06,0xD0,
 | 
				
			||||||
@@ -29,14 +41,34 @@ DSA *get_dsa512()
 | 
				
			|||||||
	DSA *dsa;
 | 
						DSA *dsa;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((dsa=DSA_new()) == NULL) return(NULL);
 | 
						if ((dsa=DSA_new()) == NULL) return(NULL);
 | 
				
			||||||
 | 
						dsa->priv_key=BN_bin2bn(dsa512_priv,sizeof(dsa512_priv),NULL);
 | 
				
			||||||
 | 
						dsa->pub_key=BN_bin2bn(dsa512_pub,sizeof(dsa512_pub),NULL);
 | 
				
			||||||
	dsa->p=BN_bin2bn(dsa512_p,sizeof(dsa512_p),NULL);
 | 
						dsa->p=BN_bin2bn(dsa512_p,sizeof(dsa512_p),NULL);
 | 
				
			||||||
	dsa->q=BN_bin2bn(dsa512_q,sizeof(dsa512_q),NULL);
 | 
						dsa->q=BN_bin2bn(dsa512_q,sizeof(dsa512_q),NULL);
 | 
				
			||||||
	dsa->g=BN_bin2bn(dsa512_g,sizeof(dsa512_g),NULL);
 | 
						dsa->g=BN_bin2bn(dsa512_g,sizeof(dsa512_g),NULL);
 | 
				
			||||||
	if ((dsa->p == NULL) || (dsa->q == NULL) || (dsa->g == NULL))
 | 
						if ((dsa->priv_key == NULL) || (dsa->pub_key == NULL) || (dsa->p == NULL) ||
 | 
				
			||||||
 | 
									(dsa->q == NULL) || (dsa->g == NULL))
 | 
				
			||||||
		return(NULL);
 | 
							return(NULL);
 | 
				
			||||||
	return(dsa);
 | 
						return(dsa);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static unsigned char dsa1024_priv[]={
 | 
				
			||||||
 | 
						0x7d,0x21,0xda,0xbb,0x62,0x15,0x47,0x36,0x07,0x67,0x12,0xe8,
 | 
				
			||||||
 | 
						0x8c,0xaa,0x1c,0xcd,0x38,0x12,0x61,0x18,
 | 
				
			||||||
 | 
						};
 | 
				
			||||||
 | 
					static unsigned char dsa1024_pub[]={
 | 
				
			||||||
 | 
						0x3c,0x4e,0x9c,0x2a,0x7f,0x16,0xc1,0x25,0xeb,0xac,0x78,0x63,
 | 
				
			||||||
 | 
						0x90,0x14,0x8c,0x8b,0xf4,0x68,0x43,0x3c,0x2d,0xee,0x65,0x50,
 | 
				
			||||||
 | 
						0x7d,0x9c,0x8f,0x8c,0x8a,0x51,0xd6,0x11,0x2b,0x99,0xaf,0x1e,
 | 
				
			||||||
 | 
						0x90,0x97,0xb5,0xd3,0xa6,0x20,0x25,0xd6,0xfe,0x43,0x02,0xd5,
 | 
				
			||||||
 | 
						0x91,0x7d,0xa7,0x8c,0xdb,0xc9,0x85,0xa3,0x36,0x48,0xf7,0x68,
 | 
				
			||||||
 | 
						0xaa,0x60,0xb1,0xf7,0x05,0x68,0x3a,0xa3,0x3f,0xd3,0x19,0x82,
 | 
				
			||||||
 | 
						0xd8,0x82,0x7a,0x77,0xfb,0xef,0xf4,0x15,0x0a,0xeb,0x06,0x04,
 | 
				
			||||||
 | 
						0x7f,0x53,0x07,0x0c,0xbc,0xcb,0x2d,0x83,0xdb,0x3e,0xd1,0x28,
 | 
				
			||||||
 | 
						0xa5,0xa1,0x31,0xe0,0x67,0xfa,0x50,0xde,0x9b,0x07,0x83,0x7e,
 | 
				
			||||||
 | 
						0x2c,0x0b,0xc3,0x13,0x50,0x61,0xe5,0xad,0xbd,0x36,0xb8,0x97,
 | 
				
			||||||
 | 
						0x4e,0x40,0x7d,0xe8,0x83,0x0d,0xbc,0x4b
 | 
				
			||||||
 | 
						};
 | 
				
			||||||
static unsigned char dsa1024_p[]={
 | 
					static unsigned char dsa1024_p[]={
 | 
				
			||||||
	0xA7,0x3F,0x6E,0x85,0xBF,0x41,0x6A,0x29,0x7D,0xF0,0x9F,0x47,
 | 
						0xA7,0x3F,0x6E,0x85,0xBF,0x41,0x6A,0x29,0x7D,0xF0,0x9F,0x47,
 | 
				
			||||||
	0x19,0x30,0x90,0x9A,0x09,0x1D,0xDA,0x6A,0x33,0x1E,0xC5,0x3D,
 | 
						0x19,0x30,0x90,0x9A,0x09,0x1D,0xDA,0x6A,0x33,0x1E,0xC5,0x3D,
 | 
				
			||||||
@@ -73,14 +105,45 @@ DSA *get_dsa1024()
 | 
				
			|||||||
	DSA *dsa;
 | 
						DSA *dsa;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((dsa=DSA_new()) == NULL) return(NULL);
 | 
						if ((dsa=DSA_new()) == NULL) return(NULL);
 | 
				
			||||||
 | 
						dsa->priv_key=BN_bin2bn(dsa1024_priv,sizeof(dsa1024_priv),NULL);
 | 
				
			||||||
 | 
						dsa->pub_key=BN_bin2bn(dsa1024_pub,sizeof(dsa1024_pub),NULL);
 | 
				
			||||||
	dsa->p=BN_bin2bn(dsa1024_p,sizeof(dsa1024_p),NULL);
 | 
						dsa->p=BN_bin2bn(dsa1024_p,sizeof(dsa1024_p),NULL);
 | 
				
			||||||
	dsa->q=BN_bin2bn(dsa1024_q,sizeof(dsa1024_q),NULL);
 | 
						dsa->q=BN_bin2bn(dsa1024_q,sizeof(dsa1024_q),NULL);
 | 
				
			||||||
	dsa->g=BN_bin2bn(dsa1024_g,sizeof(dsa1024_g),NULL);
 | 
						dsa->g=BN_bin2bn(dsa1024_g,sizeof(dsa1024_g),NULL);
 | 
				
			||||||
	if ((dsa->p == NULL) || (dsa->q == NULL) || (dsa->g == NULL))
 | 
						if ((dsa->priv_key == NULL) || (dsa->pub_key == NULL) || (dsa->p == NULL) ||
 | 
				
			||||||
 | 
									(dsa->q == NULL) || (dsa->g == NULL))
 | 
				
			||||||
		return(NULL);
 | 
							return(NULL);
 | 
				
			||||||
	return(dsa);
 | 
						return(dsa);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static unsigned char dsa2048_priv[]={
 | 
				
			||||||
 | 
						0x32,0x67,0x92,0xf6,0xc4,0xe2,0xe2,0xe8,0xa0,0x8b,0x6b,0x45,
 | 
				
			||||||
 | 
						0x0c,0x8a,0x76,0xb0,0xee,0xcf,0x91,0xa7,
 | 
				
			||||||
 | 
						};
 | 
				
			||||||
 | 
					static unsigned char dsa2048_pub[]={
 | 
				
			||||||
 | 
						0x17,0x8f,0xa8,0x11,0x84,0x92,0xec,0x83,0x47,0xc7,0x6a,0xb0,
 | 
				
			||||||
 | 
						0x92,0xaf,0x5a,0x20,0x37,0xa3,0x64,0x79,0xd2,0xd0,0x3d,0xcd,
 | 
				
			||||||
 | 
						0xe0,0x61,0x88,0x88,0x21,0xcc,0x74,0x5d,0xce,0x4c,0x51,0x47,
 | 
				
			||||||
 | 
						0xf0,0xc5,0x5c,0x4c,0x82,0x7a,0xaf,0x72,0xad,0xb9,0xe0,0x53,
 | 
				
			||||||
 | 
						0xf2,0x78,0xb7,0xf0,0xb5,0x48,0x7f,0x8a,0x3a,0x18,0xd1,0x9f,
 | 
				
			||||||
 | 
						0x8b,0x7d,0xa5,0x47,0xb7,0x95,0xab,0x98,0xf8,0x7b,0x74,0x50,
 | 
				
			||||||
 | 
						0x56,0x8e,0x57,0xf0,0xee,0xf5,0xb7,0xba,0xab,0x85,0x86,0xf9,
 | 
				
			||||||
 | 
						0x2b,0xef,0x41,0x56,0xa0,0xa4,0x9f,0xb7,0x38,0x00,0x46,0x0a,
 | 
				
			||||||
 | 
						0xa6,0xf1,0xfc,0x1f,0xd8,0x4e,0x85,0x44,0x92,0x43,0x21,0x5d,
 | 
				
			||||||
 | 
						0x6e,0xcc,0xc2,0xcb,0x26,0x31,0x0d,0x21,0xc4,0xbd,0x8d,0x24,
 | 
				
			||||||
 | 
						0xbc,0xd9,0x18,0x19,0xd7,0xdc,0xf1,0xe7,0x93,0x50,0x48,0x03,
 | 
				
			||||||
 | 
						0x2c,0xae,0x2e,0xe7,0x49,0x88,0x5f,0x93,0x57,0x27,0x99,0x36,
 | 
				
			||||||
 | 
						0xb4,0x20,0xab,0xfc,0xa7,0x2b,0xf2,0xd9,0x98,0xd7,0xd4,0x34,
 | 
				
			||||||
 | 
						0x9d,0x96,0x50,0x58,0x9a,0xea,0x54,0xf3,0xee,0xf5,0x63,0x14,
 | 
				
			||||||
 | 
						0xee,0x85,0x83,0x74,0x76,0xe1,0x52,0x95,0xc3,0xf7,0xeb,0x04,
 | 
				
			||||||
 | 
						0x04,0x7b,0xa7,0x28,0x1b,0xcc,0xea,0x4a,0x4e,0x84,0xda,0xd8,
 | 
				
			||||||
 | 
						0x9c,0x79,0xd8,0x9b,0x66,0x89,0x2f,0xcf,0xac,0xd7,0x79,0xf9,
 | 
				
			||||||
 | 
						0xa9,0xd8,0x45,0x13,0x78,0xb9,0x00,0x14,0xc9,0x7e,0x22,0x51,
 | 
				
			||||||
 | 
						0x86,0x67,0xb0,0x9f,0x26,0x11,0x23,0xc8,0x38,0xd7,0x70,0x1d,
 | 
				
			||||||
 | 
						0x15,0x8e,0x4d,0x4f,0x95,0x97,0x40,0xa1,0xc2,0x7e,0x01,0x18,
 | 
				
			||||||
 | 
						0x72,0xf4,0x10,0xe6,0x8d,0x52,0x16,0x7f,0xf2,0xc9,0xf8,0x33,
 | 
				
			||||||
 | 
						0x8b,0x33,0xb7,0xce,
 | 
				
			||||||
 | 
						};
 | 
				
			||||||
static unsigned char dsa2048_p[]={
 | 
					static unsigned char dsa2048_p[]={
 | 
				
			||||||
	0xA0,0x25,0xFA,0xAD,0xF4,0x8E,0xB9,0xE5,0x99,0xF3,0x5D,0x6F,
 | 
						0xA0,0x25,0xFA,0xAD,0xF4,0x8E,0xB9,0xE5,0x99,0xF3,0x5D,0x6F,
 | 
				
			||||||
	0x4F,0x83,0x34,0xE2,0x7E,0xCF,0x6F,0xBF,0x30,0xAF,0x6F,0x81,
 | 
						0x4F,0x83,0x34,0xE2,0x7E,0xCF,0x6F,0xBF,0x30,0xAF,0x6F,0x81,
 | 
				
			||||||
@@ -139,10 +202,13 @@ DSA *get_dsa2048()
 | 
				
			|||||||
	DSA *dsa;
 | 
						DSA *dsa;
 | 
				
			||||||
 
 | 
					 
 | 
				
			||||||
	if ((dsa=DSA_new()) == NULL) return(NULL);
 | 
						if ((dsa=DSA_new()) == NULL) return(NULL);
 | 
				
			||||||
 | 
						dsa->priv_key=BN_bin2bn(dsa2048_priv,sizeof(dsa2048_priv),NULL);
 | 
				
			||||||
 | 
						dsa->pub_key=BN_bin2bn(dsa2048_pub,sizeof(dsa2048_pub),NULL);
 | 
				
			||||||
	dsa->p=BN_bin2bn(dsa2048_p,sizeof(dsa2048_p),NULL);
 | 
						dsa->p=BN_bin2bn(dsa2048_p,sizeof(dsa2048_p),NULL);
 | 
				
			||||||
	dsa->q=BN_bin2bn(dsa2048_q,sizeof(dsa2048_q),NULL);
 | 
						dsa->q=BN_bin2bn(dsa2048_q,sizeof(dsa2048_q),NULL);
 | 
				
			||||||
	dsa->g=BN_bin2bn(dsa2048_g,sizeof(dsa2048_g),NULL);
 | 
						dsa->g=BN_bin2bn(dsa2048_g,sizeof(dsa2048_g),NULL);
 | 
				
			||||||
	if ((dsa->p == NULL) || (dsa->q == NULL) || (dsa->g == NULL))
 | 
						if ((dsa->priv_key == NULL) || (dsa->pub_key == NULL) || (dsa->p == NULL) ||
 | 
				
			||||||
 | 
									(dsa->q == NULL) || (dsa->g == NULL))
 | 
				
			||||||
		return(NULL);
 | 
							return(NULL);
 | 
				
			||||||
	return(dsa);
 | 
						return(dsa);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -65,15 +65,14 @@
 | 
				
			|||||||
#include <openssl/x509.h>
 | 
					#include <openssl/x509.h>
 | 
				
			||||||
#include <openssl/x509v3.h>
 | 
					#include <openssl/x509v3.h>
 | 
				
			||||||
#include <openssl/pem.h>
 | 
					#include <openssl/pem.h>
 | 
				
			||||||
#include <openssl/engine.h>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#undef PROG
 | 
					#undef PROG
 | 
				
			||||||
#define PROG	verify_main
 | 
					#define PROG	verify_main
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int MS_CALLBACK cb(int ok, X509_STORE_CTX *ctx);
 | 
					static int MS_CALLBACK cb(int ok, X509_STORE_CTX *ctx);
 | 
				
			||||||
static int check(X509_STORE *ctx, char *file, STACK_OF(X509) *uchain, STACK_OF(X509) *tchain, int purpose);
 | 
					static int check(X509_STORE *ctx, char *file, STACK_OF(X509) *uchain, STACK_OF(X509) *tchain, int purpose, ENGINE *e);
 | 
				
			||||||
static STACK_OF(X509) *load_untrusted(char *file);
 | 
					static STACK_OF(X509) *load_untrusted(char *file);
 | 
				
			||||||
static int v_verbose=0, issuer_checks = 0;
 | 
					static int v_verbose=0, vflags = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int MAIN(int, char **);
 | 
					int MAIN(int, char **);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -101,6 +100,9 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
		if ((bio_err=BIO_new(BIO_s_file())) != NULL)
 | 
							if ((bio_err=BIO_new(BIO_s_file())) != NULL)
 | 
				
			||||||
			BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
 | 
								BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!load_config(bio_err, NULL))
 | 
				
			||||||
 | 
							goto end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	argc--;
 | 
						argc--;
 | 
				
			||||||
	argv++;
 | 
						argv++;
 | 
				
			||||||
	for (;;)
 | 
						for (;;)
 | 
				
			||||||
@@ -147,8 +149,14 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
				}
 | 
									}
 | 
				
			||||||
			else if (strcmp(*argv,"-help") == 0)
 | 
								else if (strcmp(*argv,"-help") == 0)
 | 
				
			||||||
				goto end;
 | 
									goto end;
 | 
				
			||||||
 | 
								else if (strcmp(*argv,"-ignore_critical") == 0)
 | 
				
			||||||
 | 
									vflags |= X509_V_FLAG_IGNORE_CRITICAL;
 | 
				
			||||||
			else if (strcmp(*argv,"-issuer_checks") == 0)
 | 
								else if (strcmp(*argv,"-issuer_checks") == 0)
 | 
				
			||||||
				issuer_checks=1;
 | 
									vflags |= X509_V_FLAG_CB_ISSUER_CHECK;
 | 
				
			||||||
 | 
								else if (strcmp(*argv,"-crl_check") == 0)
 | 
				
			||||||
 | 
									vflags |= X509_V_FLAG_CRL_CHECK;
 | 
				
			||||||
 | 
								else if (strcmp(*argv,"-crl_check_all") == 0)
 | 
				
			||||||
 | 
									vflags |= X509_V_FLAG_CRL_CHECK|X509_V_FLAG_CRL_CHECK_ALL;
 | 
				
			||||||
			else if (strcmp(*argv,"-verbose") == 0)
 | 
								else if (strcmp(*argv,"-verbose") == 0)
 | 
				
			||||||
				v_verbose=1;
 | 
									v_verbose=1;
 | 
				
			||||||
			else if (argv[0][0] == '-')
 | 
								else if (argv[0][0] == '-')
 | 
				
			||||||
@@ -162,23 +170,7 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
			break;
 | 
								break;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (engine != NULL)
 | 
					        e = setup_engine(bio_err, engine, 0);
 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
		if((e = ENGINE_by_id(engine)) == NULL)
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			BIO_printf(bio_err,"invalid engine \"%s\"\n",
 | 
					 | 
				
			||||||
				engine);
 | 
					 | 
				
			||||||
			goto end;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			BIO_printf(bio_err,"can't use that engine\n");
 | 
					 | 
				
			||||||
			goto end;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
 | 
					 | 
				
			||||||
		/* Free our "structural" reference. */
 | 
					 | 
				
			||||||
		ENGINE_free(e);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	lookup=X509_STORE_add_lookup(cert_ctx,X509_LOOKUP_file());
 | 
						lookup=X509_STORE_add_lookup(cert_ctx,X509_LOOKUP_file());
 | 
				
			||||||
	if (lookup == NULL) abort();
 | 
						if (lookup == NULL) abort();
 | 
				
			||||||
@@ -220,14 +212,14 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (argc < 1) check(cert_ctx, NULL, untrusted, trusted, purpose);
 | 
						if (argc < 1) check(cert_ctx, NULL, untrusted, trusted, purpose, e);
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		for (i=0; i<argc; i++)
 | 
							for (i=0; i<argc; i++)
 | 
				
			||||||
			check(cert_ctx,argv[i], untrusted, trusted, purpose);
 | 
								check(cert_ctx,argv[i], untrusted, trusted, purpose, e);
 | 
				
			||||||
	ret=0;
 | 
						ret=0;
 | 
				
			||||||
end:
 | 
					end:
 | 
				
			||||||
	if (ret == 1) {
 | 
						if (ret == 1) {
 | 
				
			||||||
		BIO_printf(bio_err,"usage: verify [-verbose] [-CApath path] [-CAfile file] [-purpose purpose] [-engine e] cert1 cert2 ...\n");
 | 
							BIO_printf(bio_err,"usage: verify [-verbose] [-CApath path] [-CAfile file] [-purpose purpose] [-crl_check] [-engine e] cert1 cert2 ...\n");
 | 
				
			||||||
		BIO_printf(bio_err,"recognized usages:\n");
 | 
							BIO_printf(bio_err,"recognized usages:\n");
 | 
				
			||||||
		for(i = 0; i < X509_PURPOSE_get_count(); i++) {
 | 
							for(i = 0; i < X509_PURPOSE_get_count(); i++) {
 | 
				
			||||||
			X509_PURPOSE *ptmp;
 | 
								X509_PURPOSE *ptmp;
 | 
				
			||||||
@@ -239,42 +231,19 @@ end:
 | 
				
			|||||||
	if (cert_ctx != NULL) X509_STORE_free(cert_ctx);
 | 
						if (cert_ctx != NULL) X509_STORE_free(cert_ctx);
 | 
				
			||||||
	sk_X509_pop_free(untrusted, X509_free);
 | 
						sk_X509_pop_free(untrusted, X509_free);
 | 
				
			||||||
	sk_X509_pop_free(trusted, X509_free);
 | 
						sk_X509_pop_free(trusted, X509_free);
 | 
				
			||||||
 | 
						apps_shutdown();
 | 
				
			||||||
	EXIT(ret);
 | 
						EXIT(ret);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int check(X509_STORE *ctx, char *file, STACK_OF(X509) *uchain, STACK_OF(X509) *tchain, int purpose)
 | 
					static int check(X509_STORE *ctx, char *file, STACK_OF(X509) *uchain, STACK_OF(X509) *tchain, int purpose, ENGINE *e)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	X509 *x=NULL;
 | 
						X509 *x=NULL;
 | 
				
			||||||
	BIO *in=NULL;
 | 
					 | 
				
			||||||
	int i=0,ret=0;
 | 
						int i=0,ret=0;
 | 
				
			||||||
	X509_STORE_CTX *csc;
 | 
						X509_STORE_CTX *csc;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	in=BIO_new(BIO_s_file());
 | 
						x = load_cert(bio_err, file, FORMAT_PEM, NULL, e, "certificate file");
 | 
				
			||||||
	if (in == NULL)
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
		ERR_print_errors(bio_err);
 | 
					 | 
				
			||||||
		goto end;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (file == NULL)
 | 
					 | 
				
			||||||
		BIO_set_fp(in,stdin,BIO_NOCLOSE);
 | 
					 | 
				
			||||||
	else
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
		if (BIO_read_filename(in,file) <= 0)
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			perror(file);
 | 
					 | 
				
			||||||
			goto end;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	x=PEM_read_bio_X509(in,NULL,NULL,NULL);
 | 
					 | 
				
			||||||
	if (x == NULL)
 | 
						if (x == NULL)
 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
		fprintf(stdout,"%s: unable to load certificate file\n",
 | 
					 | 
				
			||||||
			(file == NULL)?"stdin":file);
 | 
					 | 
				
			||||||
		ERR_print_errors(bio_err);
 | 
					 | 
				
			||||||
		goto end;
 | 
							goto end;
 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	fprintf(stdout,"%s: ",(file == NULL)?"stdin":file);
 | 
						fprintf(stdout,"%s: ",(file == NULL)?"stdin":file);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	csc = X509_STORE_CTX_new();
 | 
						csc = X509_STORE_CTX_new();
 | 
				
			||||||
@@ -283,11 +252,14 @@ static int check(X509_STORE *ctx, char *file, STACK_OF(X509) *uchain, STACK_OF(X
 | 
				
			|||||||
		ERR_print_errors(bio_err);
 | 
							ERR_print_errors(bio_err);
 | 
				
			||||||
		goto end;
 | 
							goto end;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	X509_STORE_CTX_init(csc,ctx,x,uchain);
 | 
						X509_STORE_set_flags(ctx, vflags);
 | 
				
			||||||
 | 
						if(!X509_STORE_CTX_init(csc,ctx,x,uchain))
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							ERR_print_errors(bio_err);
 | 
				
			||||||
 | 
							goto end;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	if(tchain) X509_STORE_CTX_trusted_stack(csc, tchain);
 | 
						if(tchain) X509_STORE_CTX_trusted_stack(csc, tchain);
 | 
				
			||||||
	if(purpose >= 0) X509_STORE_CTX_set_purpose(csc, purpose);
 | 
						if(purpose >= 0) X509_STORE_CTX_set_purpose(csc, purpose);
 | 
				
			||||||
	if(issuer_checks)
 | 
					 | 
				
			||||||
		X509_STORE_CTX_set_flags(csc, X509_V_FLAG_CB_ISSUER_CHECK);
 | 
					 | 
				
			||||||
	i=X509_verify_cert(csc);
 | 
						i=X509_verify_cert(csc);
 | 
				
			||||||
	X509_STORE_CTX_free(csc);
 | 
						X509_STORE_CTX_free(csc);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -301,7 +273,6 @@ end:
 | 
				
			|||||||
	else
 | 
						else
 | 
				
			||||||
		ERR_print_errors(bio_err);
 | 
							ERR_print_errors(bio_err);
 | 
				
			||||||
	if (x != NULL) X509_free(x);
 | 
						if (x != NULL) X509_free(x);
 | 
				
			||||||
	if (in != NULL) BIO_free(in);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return(ret);
 | 
						return(ret);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -359,7 +330,8 @@ static int MS_CALLBACK cb(int ok, X509_STORE_CTX *ctx)
 | 
				
			|||||||
	if (!ok)
 | 
						if (!ok)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		X509_NAME_oneline(
 | 
							X509_NAME_oneline(
 | 
				
			||||||
				X509_get_subject_name(ctx->current_cert),buf,256);
 | 
									X509_get_subject_name(ctx->current_cert),buf,
 | 
				
			||||||
 | 
									sizeof buf);
 | 
				
			||||||
		printf("%s\n",buf);
 | 
							printf("%s\n",buf);
 | 
				
			||||||
		printf("error %d at %d depth lookup:%s\n",ctx->error,
 | 
							printf("error %d at %d depth lookup:%s\n",ctx->error,
 | 
				
			||||||
			ctx->error_depth,
 | 
								ctx->error_depth,
 | 
				
			||||||
@@ -375,6 +347,9 @@ static int MS_CALLBACK cb(int ok, X509_STORE_CTX *ctx)
 | 
				
			|||||||
		if (ctx->error == X509_V_ERR_PATH_LENGTH_EXCEEDED) ok=1;
 | 
							if (ctx->error == X509_V_ERR_PATH_LENGTH_EXCEEDED) ok=1;
 | 
				
			||||||
		if (ctx->error == X509_V_ERR_INVALID_PURPOSE) ok=1;
 | 
							if (ctx->error == X509_V_ERR_INVALID_PURPOSE) ok=1;
 | 
				
			||||||
		if (ctx->error == X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT) ok=1;
 | 
							if (ctx->error == X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT) ok=1;
 | 
				
			||||||
 | 
							if (ctx->error == X509_V_ERR_CRL_HAS_EXPIRED) ok=1;
 | 
				
			||||||
 | 
							if (ctx->error == X509_V_ERR_CRL_NOT_YET_VALID) ok=1;
 | 
				
			||||||
 | 
							if (ctx->error == X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION) ok=1;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	if (!v_verbose)
 | 
						if (!v_verbose)
 | 
				
			||||||
		ERR_clear_error();
 | 
							ERR_clear_error();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -55,6 +55,59 @@
 | 
				
			|||||||
 * copied and put under another distribution licence
 | 
					 * copied and put under another distribution licence
 | 
				
			||||||
 * [including the GNU Public Licence.]
 | 
					 * [including the GNU Public Licence.]
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					/* ====================================================================
 | 
				
			||||||
 | 
					 * Copyright (c) 1998-2001 The OpenSSL Project.  All rights reserved.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Redistribution and use in source and binary forms, with or without
 | 
				
			||||||
 | 
					 * modification, are permitted provided that the following conditions
 | 
				
			||||||
 | 
					 * are met:
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 1. Redistributions of source code must retain the above copyright
 | 
				
			||||||
 | 
					 *    notice, this list of conditions and the following disclaimer. 
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 2. Redistributions in binary form must reproduce the above copyright
 | 
				
			||||||
 | 
					 *    notice, this list of conditions and the following disclaimer in
 | 
				
			||||||
 | 
					 *    the documentation and/or other materials provided with the
 | 
				
			||||||
 | 
					 *    distribution.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 3. All advertising materials mentioning features or use of this
 | 
				
			||||||
 | 
					 *    software must display the following acknowledgment:
 | 
				
			||||||
 | 
					 *    "This product includes software developed by the OpenSSL Project
 | 
				
			||||||
 | 
					 *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
 | 
				
			||||||
 | 
					 *    endorse or promote products derived from this software without
 | 
				
			||||||
 | 
					 *    prior written permission. For written permission, please contact
 | 
				
			||||||
 | 
					 *    openssl-core@openssl.org.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 5. Products derived from this software may not be called "OpenSSL"
 | 
				
			||||||
 | 
					 *    nor may "OpenSSL" appear in their names without prior written
 | 
				
			||||||
 | 
					 *    permission of the OpenSSL Project.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 6. Redistributions of any form whatsoever must retain the following
 | 
				
			||||||
 | 
					 *    acknowledgment:
 | 
				
			||||||
 | 
					 *    "This product includes software developed by the OpenSSL Project
 | 
				
			||||||
 | 
					 *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
 | 
				
			||||||
 | 
					 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 | 
				
			||||||
 | 
					 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 | 
				
			||||||
 | 
					 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
 | 
				
			||||||
 | 
					 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 | 
				
			||||||
 | 
					 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 | 
				
			||||||
 | 
					 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 | 
				
			||||||
 | 
					 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 | 
				
			||||||
 | 
					 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 | 
				
			||||||
 | 
					 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 | 
				
			||||||
 | 
					 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 | 
				
			||||||
 | 
					 * OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
				
			||||||
 | 
					 * ====================================================================
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This product includes cryptographic software written by Eric Young
 | 
				
			||||||
 | 
					 * (eay@cryptsoft.com).  This product includes software written by Tim
 | 
				
			||||||
 | 
					 * Hudson (tjh@cryptsoft.com).
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdio.h>
 | 
					#include <stdio.h>
 | 
				
			||||||
#include <stdlib.h>
 | 
					#include <stdlib.h>
 | 
				
			||||||
@@ -62,6 +115,21 @@
 | 
				
			|||||||
#include "apps.h"
 | 
					#include "apps.h"
 | 
				
			||||||
#include <openssl/evp.h>
 | 
					#include <openssl/evp.h>
 | 
				
			||||||
#include <openssl/crypto.h>
 | 
					#include <openssl/crypto.h>
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_MD2
 | 
				
			||||||
 | 
					# include <openssl/md2.h>
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_RC4
 | 
				
			||||||
 | 
					# include <openssl/rc4.h>
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_DES
 | 
				
			||||||
 | 
					# include <openssl/des.h>
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_IDEA
 | 
				
			||||||
 | 
					# include <openssl/idea.h>
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_BF
 | 
				
			||||||
 | 
					# include <openssl/blowfish.h>
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#undef PROG
 | 
					#undef PROG
 | 
				
			||||||
#define PROG	version_main
 | 
					#define PROG	version_main
 | 
				
			||||||
@@ -118,7 +186,7 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
		printf("%s ",RC4_options());
 | 
							printf("%s ",RC4_options());
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#ifndef OPENSSL_NO_DES
 | 
					#ifndef OPENSSL_NO_DES
 | 
				
			||||||
		printf("%s ",des_options());
 | 
							printf("%s ",DES_options());
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#ifndef OPENSSL_NO_IDEA
 | 
					#ifndef OPENSSL_NO_IDEA
 | 
				
			||||||
		printf("%s ",idea_options());
 | 
							printf("%s ",idea_options());
 | 
				
			||||||
@@ -131,5 +199,6 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
	if (cflags)  printf("%s\n",SSLeay_version(SSLEAY_CFLAGS));
 | 
						if (cflags)  printf("%s\n",SSLeay_version(SSLEAY_CFLAGS));
 | 
				
			||||||
	if (dir)  printf("%s\n",SSLeay_version(SSLEAY_DIR));
 | 
						if (dir)  printf("%s\n",SSLeay_version(SSLEAY_DIR));
 | 
				
			||||||
end:
 | 
					end:
 | 
				
			||||||
 | 
						apps_shutdown();
 | 
				
			||||||
	EXIT(ret);
 | 
						EXIT(ret);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -118,7 +118,6 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
 | 
				
			|||||||
        HDC hdc;
 | 
					        HDC hdc;
 | 
				
			||||||
	PAINTSTRUCT ps;
 | 
						PAINTSTRUCT ps;
 | 
				
			||||||
        RECT rect;
 | 
					        RECT rect;
 | 
				
			||||||
        char buffer[200];
 | 
					 | 
				
			||||||
        static int seeded = 0;
 | 
					        static int seeded = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	switch (iMsg)
 | 
						switch (iMsg)
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										88
									
								
								apps/x509.c
									
									
									
									
									
								
							
							
						
						
									
										88
									
								
								apps/x509.c
									
									
									
									
									
								
							@@ -73,7 +73,6 @@
 | 
				
			|||||||
#include <openssl/x509v3.h>
 | 
					#include <openssl/x509v3.h>
 | 
				
			||||||
#include <openssl/objects.h>
 | 
					#include <openssl/objects.h>
 | 
				
			||||||
#include <openssl/pem.h>
 | 
					#include <openssl/pem.h>
 | 
				
			||||||
#include <openssl/engine.h>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#undef PROG
 | 
					#undef PROG
 | 
				
			||||||
#define PROG x509_main
 | 
					#define PROG x509_main
 | 
				
			||||||
@@ -123,7 +122,7 @@ static char *x509_usage[]={
 | 
				
			|||||||
" -CAkey arg      - set the CA key, must be PEM format\n",
 | 
					" -CAkey arg      - set the CA key, must be PEM format\n",
 | 
				
			||||||
"                   missing, it is assumed to be in the CA file.\n",
 | 
					"                   missing, it is assumed to be in the CA file.\n",
 | 
				
			||||||
" -CAcreateserial - create serial number file if it does not exist\n",
 | 
					" -CAcreateserial - create serial number file if it does not exist\n",
 | 
				
			||||||
" -CAserial       - serial file\n",
 | 
					" -CAserial arg   - serial file\n",
 | 
				
			||||||
" -set_serial     - serial number to use\n",
 | 
					" -set_serial     - serial number to use\n",
 | 
				
			||||||
" -text           - print the certificate in text form\n",
 | 
					" -text           - print the certificate in text form\n",
 | 
				
			||||||
" -C              - print out C code forms\n",
 | 
					" -C              - print out C code forms\n",
 | 
				
			||||||
@@ -139,10 +138,10 @@ NULL
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
static int MS_CALLBACK callb(int ok, X509_STORE_CTX *ctx);
 | 
					static int MS_CALLBACK callb(int ok, X509_STORE_CTX *ctx);
 | 
				
			||||||
static int sign (X509 *x, EVP_PKEY *pkey,int days,int clrext, const EVP_MD *digest,
 | 
					static int sign (X509 *x, EVP_PKEY *pkey,int days,int clrext, const EVP_MD *digest,
 | 
				
			||||||
						LHASH *conf, char *section);
 | 
											CONF *conf, char *section);
 | 
				
			||||||
static int x509_certify (X509_STORE *ctx,char *CAfile,const EVP_MD *digest,
 | 
					static int x509_certify (X509_STORE *ctx,char *CAfile,const EVP_MD *digest,
 | 
				
			||||||
			 X509 *x,X509 *xca,EVP_PKEY *pkey,char *serial,
 | 
								 X509 *x,X509 *xca,EVP_PKEY *pkey,char *serial,
 | 
				
			||||||
			 int create,int days, int clrext, LHASH *conf, char *section,
 | 
								 int create,int days, int clrext, CONF *conf, char *section,
 | 
				
			||||||
						ASN1_INTEGER *sno);
 | 
											ASN1_INTEGER *sno);
 | 
				
			||||||
static int purpose_print(BIO *bio, X509 *cert, X509_PURPOSE *pt);
 | 
					static int purpose_print(BIO *bio, X509 *cert, X509_PURPOSE *pt);
 | 
				
			||||||
static int reqfile=0;
 | 
					static int reqfile=0;
 | 
				
			||||||
@@ -179,7 +178,7 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
	int fingerprint=0;
 | 
						int fingerprint=0;
 | 
				
			||||||
	char buf[256];
 | 
						char buf[256];
 | 
				
			||||||
	const EVP_MD *md_alg,*digest=EVP_md5();
 | 
						const EVP_MD *md_alg,*digest=EVP_md5();
 | 
				
			||||||
	LHASH *extconf = NULL;
 | 
						CONF *extconf = NULL;
 | 
				
			||||||
	char *extsect = NULL, *extfile = NULL, *passin = NULL, *passargin = NULL;
 | 
						char *extsect = NULL, *extfile = NULL, *passin = NULL, *passargin = NULL;
 | 
				
			||||||
	int need_rand = 0;
 | 
						int need_rand = 0;
 | 
				
			||||||
	int checkend=0,checkoffset=0;
 | 
						int checkend=0,checkoffset=0;
 | 
				
			||||||
@@ -192,6 +191,9 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if (bio_err == NULL)
 | 
						if (bio_err == NULL)
 | 
				
			||||||
		bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
 | 
							bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!load_config(bio_err, NULL))
 | 
				
			||||||
 | 
							goto end;
 | 
				
			||||||
	STDout=BIO_new_fp(stdout,BIO_NOCLOSE);
 | 
						STDout=BIO_new_fp(stdout,BIO_NOCLOSE);
 | 
				
			||||||
#ifdef OPENSSL_SYS_VMS
 | 
					#ifdef OPENSSL_SYS_VMS
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
@@ -243,7 +245,7 @@ int MAIN(int argc, char **argv)
 | 
				
			|||||||
		else if (strcmp(*argv,"-CAkeyform") == 0)
 | 
							else if (strcmp(*argv,"-CAkeyform") == 0)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
			if (--argc < 1) goto bad;
 | 
								if (--argc < 1) goto bad;
 | 
				
			||||||
			CAformat=str2fmt(*(++argv));
 | 
								CAkeyformat=str2fmt(*(++argv));
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		else if (strcmp(*argv,"-days") == 0)
 | 
							else if (strcmp(*argv,"-days") == 0)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
@@ -448,23 +450,7 @@ bad:
 | 
				
			|||||||
		goto end;
 | 
							goto end;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (engine != NULL)
 | 
					        e = setup_engine(bio_err, engine, 0);
 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
		if((e = ENGINE_by_id(engine)) == NULL)
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			BIO_printf(bio_err,"invalid engine \"%s\"\n",
 | 
					 | 
				
			||||||
				engine);
 | 
					 | 
				
			||||||
			goto end;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
			BIO_printf(bio_err,"can't use that engine\n");
 | 
					 | 
				
			||||||
			goto end;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
 | 
					 | 
				
			||||||
		/* Free our "structural" reference. */
 | 
					 | 
				
			||||||
		ENGINE_free(e);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (need_rand)
 | 
						if (need_rand)
 | 
				
			||||||
		app_RAND_load_file(NULL, bio_err, 0);
 | 
							app_RAND_load_file(NULL, bio_err, 0);
 | 
				
			||||||
@@ -493,9 +479,10 @@ bad:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if (extfile)
 | 
						if (extfile)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		long errorline;
 | 
							long errorline = -1;
 | 
				
			||||||
		X509V3_CTX ctx2;
 | 
							X509V3_CTX ctx2;
 | 
				
			||||||
		if (!(extconf=CONF_load(NULL,extfile,&errorline)))
 | 
							extconf = NCONF_new(NULL);
 | 
				
			||||||
 | 
							if (!NCONF_load(extconf, extfile,&errorline))
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
			if (errorline <= 0)
 | 
								if (errorline <= 0)
 | 
				
			||||||
				BIO_printf(bio_err,
 | 
									BIO_printf(bio_err,
 | 
				
			||||||
@@ -509,7 +496,7 @@ bad:
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
		if (!extsect)
 | 
							if (!extsect)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
			extsect = CONF_get_string(extconf, "default", "extensions");
 | 
								extsect = NCONF_get_string(extconf, "default", "extensions");
 | 
				
			||||||
			if (!extsect)
 | 
								if (!extsect)
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
				ERR_clear_error();
 | 
									ERR_clear_error();
 | 
				
			||||||
@@ -517,8 +504,8 @@ bad:
 | 
				
			|||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		X509V3_set_ctx_test(&ctx2);
 | 
							X509V3_set_ctx_test(&ctx2);
 | 
				
			||||||
		X509V3_set_conf_lhash(&ctx2, extconf);
 | 
							X509V3_set_nconf(&ctx2, extconf);
 | 
				
			||||||
		if (!X509V3_EXT_add_conf(extconf, &ctx2, extsect, NULL))
 | 
							if (!X509V3_EXT_add_nconf(extconf, &ctx2, extsect, NULL))
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
			BIO_printf(bio_err,
 | 
								BIO_printf(bio_err,
 | 
				
			||||||
				"Error Loading extension section %s\n",
 | 
									"Error Loading extension section %s\n",
 | 
				
			||||||
@@ -619,12 +606,12 @@ bad:
 | 
				
			|||||||
		EVP_PKEY_free(pkey);
 | 
							EVP_PKEY_free(pkey);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		x=load_cert(bio_err,infile,informat);
 | 
							x=load_cert(bio_err,infile,informat,NULL,e,"Certificate");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (x == NULL) goto end;
 | 
						if (x == NULL) goto end;
 | 
				
			||||||
	if (CA_flag)
 | 
						if (CA_flag)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		xca=load_cert(bio_err,CAfile,CAformat);
 | 
							xca=load_cert(bio_err,CAfile,CAformat,NULL,e,"CA Certificate");
 | 
				
			||||||
		if (xca == NULL) goto end;
 | 
							if (xca == NULL) goto end;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -783,10 +770,11 @@ bad:
 | 
				
			|||||||
				int y,z;
 | 
									int y,z;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				X509_NAME_oneline(X509_get_subject_name(x),
 | 
									X509_NAME_oneline(X509_get_subject_name(x),
 | 
				
			||||||
					buf,256);
 | 
										buf,sizeof buf);
 | 
				
			||||||
				BIO_printf(STDout,"/* subject:%s */\n",buf);
 | 
									BIO_printf(STDout,"/* subject:%s */\n",buf);
 | 
				
			||||||
				m=X509_NAME_oneline(
 | 
									m=X509_NAME_oneline(
 | 
				
			||||||
					X509_get_issuer_name(x),buf,256);
 | 
										X509_get_issuer_name(x),buf,
 | 
				
			||||||
 | 
										sizeof buf);
 | 
				
			||||||
				BIO_printf(STDout,"/* issuer :%s */\n",buf);
 | 
									BIO_printf(STDout,"/* issuer :%s */\n",buf);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				z=i2d_X509(x,NULL);
 | 
									z=i2d_X509(x,NULL);
 | 
				
			||||||
@@ -874,7 +862,8 @@ bad:
 | 
				
			|||||||
				if (Upkey == NULL)
 | 
									if (Upkey == NULL)
 | 
				
			||||||
					{
 | 
										{
 | 
				
			||||||
					Upkey=load_key(bio_err,
 | 
										Upkey=load_key(bio_err,
 | 
				
			||||||
						keyfile,keyformat, passin, e);
 | 
											keyfile, keyformat, 0,
 | 
				
			||||||
 | 
											passin, e, "Private key");
 | 
				
			||||||
					if (Upkey == NULL) goto end;
 | 
										if (Upkey == NULL) goto end;
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
#ifndef OPENSSL_NO_DSA
 | 
					#ifndef OPENSSL_NO_DSA
 | 
				
			||||||
@@ -892,8 +881,9 @@ bad:
 | 
				
			|||||||
				if (CAkeyfile != NULL)
 | 
									if (CAkeyfile != NULL)
 | 
				
			||||||
					{
 | 
										{
 | 
				
			||||||
					CApkey=load_key(bio_err,
 | 
										CApkey=load_key(bio_err,
 | 
				
			||||||
						CAkeyfile,CAkeyformat, passin,
 | 
											CAkeyfile, CAkeyformat,
 | 
				
			||||||
						e);
 | 
											0, passin, e,
 | 
				
			||||||
 | 
											"CA Private Key");
 | 
				
			||||||
					if (CApkey == NULL) goto end;
 | 
										if (CApkey == NULL) goto end;
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
#ifndef OPENSSL_NO_DSA
 | 
					#ifndef OPENSSL_NO_DSA
 | 
				
			||||||
@@ -920,14 +910,17 @@ bad:
 | 
				
			|||||||
				else
 | 
									else
 | 
				
			||||||
					{
 | 
										{
 | 
				
			||||||
					pk=load_key(bio_err,
 | 
										pk=load_key(bio_err,
 | 
				
			||||||
						keyfile,FORMAT_PEM, passin, e);
 | 
											keyfile, FORMAT_PEM, 0,
 | 
				
			||||||
 | 
											passin, e, "request key");
 | 
				
			||||||
					if (pk == NULL) goto end;
 | 
										if (pk == NULL) goto end;
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				BIO_printf(bio_err,"Generating certificate request\n");
 | 
									BIO_printf(bio_err,"Generating certificate request\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef OPENSSL_NO_DSA
 | 
				
			||||||
		                if (pk->type == EVP_PKEY_DSA)
 | 
							                if (pk->type == EVP_PKEY_DSA)
 | 
				
			||||||
		                        digest=EVP_dss1();
 | 
							                        digest=EVP_dss1();
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				rq=X509_to_X509_REQ(x,pk,digest);
 | 
									rq=X509_to_X509_REQ(x,pk,digest);
 | 
				
			||||||
				EVP_PKEY_free(pk);
 | 
									EVP_PKEY_free(pk);
 | 
				
			||||||
@@ -1009,7 +1002,7 @@ end:
 | 
				
			|||||||
	if (need_rand)
 | 
						if (need_rand)
 | 
				
			||||||
		app_RAND_write_file(NULL, bio_err);
 | 
							app_RAND_write_file(NULL, bio_err);
 | 
				
			||||||
	OBJ_cleanup();
 | 
						OBJ_cleanup();
 | 
				
			||||||
	CONF_free(extconf);
 | 
						NCONF_free(extconf);
 | 
				
			||||||
	BIO_free_all(out);
 | 
						BIO_free_all(out);
 | 
				
			||||||
	BIO_free_all(STDout);
 | 
						BIO_free_all(STDout);
 | 
				
			||||||
	X509_STORE_free(ctx);
 | 
						X509_STORE_free(ctx);
 | 
				
			||||||
@@ -1023,6 +1016,7 @@ end:
 | 
				
			|||||||
	sk_ASN1_OBJECT_pop_free(trust, ASN1_OBJECT_free);
 | 
						sk_ASN1_OBJECT_pop_free(trust, ASN1_OBJECT_free);
 | 
				
			||||||
	sk_ASN1_OBJECT_pop_free(reject, ASN1_OBJECT_free);
 | 
						sk_ASN1_OBJECT_pop_free(reject, ASN1_OBJECT_free);
 | 
				
			||||||
	if (passin) OPENSSL_free(passin);
 | 
						if (passin) OPENSSL_free(passin);
 | 
				
			||||||
 | 
						apps_shutdown();
 | 
				
			||||||
	EXIT(ret);
 | 
						EXIT(ret);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1081,7 +1075,7 @@ static ASN1_INTEGER *load_serial(char *CAfile, char *serialfile, int create)
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	else 
 | 
						else 
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		if (!a2i_ASN1_INTEGER(io,bs,buf2,1024))
 | 
							if (!a2i_ASN1_INTEGER(io,bs,buf2,sizeof buf2))
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
			BIO_printf(bio_err,"unable to load serial number from %s\n",buf);
 | 
								BIO_printf(bio_err,"unable to load serial number from %s\n",buf);
 | 
				
			||||||
			ERR_print_errors(bio_err);
 | 
								ERR_print_errors(bio_err);
 | 
				
			||||||
@@ -1129,7 +1123,7 @@ static ASN1_INTEGER *load_serial(char *CAfile, char *serialfile, int create)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
static int x509_certify(X509_STORE *ctx, char *CAfile, const EVP_MD *digest,
 | 
					static int x509_certify(X509_STORE *ctx, char *CAfile, const EVP_MD *digest,
 | 
				
			||||||
	     X509 *x, X509 *xca, EVP_PKEY *pkey, char *serialfile, int create,
 | 
						     X509 *x, X509 *xca, EVP_PKEY *pkey, char *serialfile, int create,
 | 
				
			||||||
	     int days, int clrext, LHASH *conf, char *section, ASN1_INTEGER *sno)
 | 
						     int days, int clrext, CONF *conf, char *section, ASN1_INTEGER *sno)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	int ret=0;
 | 
						int ret=0;
 | 
				
			||||||
	ASN1_INTEGER *bs=NULL;
 | 
						ASN1_INTEGER *bs=NULL;
 | 
				
			||||||
@@ -1140,7 +1134,11 @@ static int x509_certify(X509_STORE *ctx, char *CAfile, const EVP_MD *digest,
 | 
				
			|||||||
	EVP_PKEY_copy_parameters(upkey,pkey);
 | 
						EVP_PKEY_copy_parameters(upkey,pkey);
 | 
				
			||||||
	EVP_PKEY_free(upkey);
 | 
						EVP_PKEY_free(upkey);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	X509_STORE_CTX_init(&xsc,ctx,x,NULL);
 | 
						if(!X509_STORE_CTX_init(&xsc,ctx,x,NULL))
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							BIO_printf(bio_err,"Error initialising X509 store\n");
 | 
				
			||||||
 | 
							goto end;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	if (sno) bs = sno;
 | 
						if (sno) bs = sno;
 | 
				
			||||||
	else if (!(bs = load_serial(CAfile, serialfile, create)))
 | 
						else if (!(bs = load_serial(CAfile, serialfile, create)))
 | 
				
			||||||
		goto end;
 | 
							goto end;
 | 
				
			||||||
@@ -1179,8 +1177,8 @@ static int x509_certify(X509_STORE *ctx, char *CAfile, const EVP_MD *digest,
 | 
				
			|||||||
		X509V3_CTX ctx2;
 | 
							X509V3_CTX ctx2;
 | 
				
			||||||
		X509_set_version(x,2); /* version 3 certificate */
 | 
							X509_set_version(x,2); /* version 3 certificate */
 | 
				
			||||||
                X509V3_set_ctx(&ctx2, xca, x, NULL, NULL, 0);
 | 
					                X509V3_set_ctx(&ctx2, xca, x, NULL, NULL, 0);
 | 
				
			||||||
                X509V3_set_conf_lhash(&ctx2, conf);
 | 
					                X509V3_set_nconf(&ctx2, conf);
 | 
				
			||||||
                if (!X509V3_EXT_add_conf(conf, &ctx2, section, x)) goto end;
 | 
					                if (!X509V3_EXT_add_nconf(conf, &ctx2, section, x)) goto end;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!X509_sign(x,pkey,digest)) goto end;
 | 
						if (!X509_sign(x,pkey,digest)) goto end;
 | 
				
			||||||
@@ -1226,7 +1224,7 @@ static int MS_CALLBACK callb(int ok, X509_STORE_CTX *ctx)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/* self sign */
 | 
					/* self sign */
 | 
				
			||||||
static int sign(X509 *x, EVP_PKEY *pkey, int days, int clrext, const EVP_MD *digest, 
 | 
					static int sign(X509 *x, EVP_PKEY *pkey, int days, int clrext, const EVP_MD *digest, 
 | 
				
			||||||
						LHASH *conf, char *section)
 | 
											CONF *conf, char *section)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	EVP_PKEY *pktmp;
 | 
						EVP_PKEY *pktmp;
 | 
				
			||||||
@@ -1256,8 +1254,8 @@ static int sign(X509 *x, EVP_PKEY *pkey, int days, int clrext, const EVP_MD *dig
 | 
				
			|||||||
		X509V3_CTX ctx;
 | 
							X509V3_CTX ctx;
 | 
				
			||||||
		X509_set_version(x,2); /* version 3 certificate */
 | 
							X509_set_version(x,2); /* version 3 certificate */
 | 
				
			||||||
                X509V3_set_ctx(&ctx, x, x, NULL, NULL, 0);
 | 
					                X509V3_set_ctx(&ctx, x, x, NULL, NULL, 0);
 | 
				
			||||||
                X509V3_set_conf_lhash(&ctx, conf);
 | 
					                X509V3_set_nconf(&ctx, conf);
 | 
				
			||||||
                if (!X509V3_EXT_add_conf(conf, &ctx, section, x)) goto err;
 | 
					                if (!X509V3_EXT_add_nconf(conf, &ctx, section, x)) goto err;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	if (!X509_sign(x,pkey,digest)) goto err;
 | 
						if (!X509_sign(x,pkey,digest)) goto err;
 | 
				
			||||||
	return 1;
 | 
						return 1;
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										261
									
								
								config
									
									
									
									
									
								
							
							
						
						
									
										261
									
								
								config
									
									
									
									
									
								
							@@ -74,10 +74,18 @@ if [ "x$XREL" != "x" ]; then
 | 
				
			|||||||
		echo "whatever-whatever-sco5"; exit 0
 | 
							echo "whatever-whatever-sco5"; exit 0
 | 
				
			||||||
		;;
 | 
							;;
 | 
				
			||||||
	    4.2MP)
 | 
						    4.2MP)
 | 
				
			||||||
		if [ "x$VERSION" = "x2.1.1" ]; then
 | 
							if [ "x$VERSION" = "x2.01" ]; then
 | 
				
			||||||
 | 
							    echo "${MACHINE}-whatever-unixware201"; exit 0
 | 
				
			||||||
 | 
							elif [ "x$VERSION" = "x2.02" ]; then
 | 
				
			||||||
 | 
							    echo "${MACHINE}-whatever-unixware202"; exit 0
 | 
				
			||||||
 | 
							elif [ "x$VERSION" = "x2.03" ]; then
 | 
				
			||||||
 | 
							    echo "${MACHINE}-whatever-unixware203"; exit 0
 | 
				
			||||||
 | 
							elif [ "x$VERSION" = "x2.1.1" ]; then
 | 
				
			||||||
		    echo "${MACHINE}-whatever-unixware211"; exit 0
 | 
							    echo "${MACHINE}-whatever-unixware211"; exit 0
 | 
				
			||||||
		elif [ "x$VERSION" = "x2.1.2" ]; then
 | 
							elif [ "x$VERSION" = "x2.1.2" ]; then
 | 
				
			||||||
		    echo "${MACHINE}-whatever-unixware212"; exit 0
 | 
							    echo "${MACHINE}-whatever-unixware212"; exit 0
 | 
				
			||||||
 | 
							elif [ "x$VERSION" = "x2.1.3" ]; then
 | 
				
			||||||
 | 
							    echo "${MACHINE}-whatever-unixware213"; exit 0
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
		    echo "${MACHINE}-whatever-unixware2"; exit 0
 | 
							    echo "${MACHINE}-whatever-unixware2"; exit 0
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
@@ -85,6 +93,11 @@ if [ "x$XREL" != "x" ]; then
 | 
				
			|||||||
	    4.2)
 | 
						    4.2)
 | 
				
			||||||
		echo "whatever-whatever-unixware1"; exit 0
 | 
							echo "whatever-whatever-unixware1"; exit 0
 | 
				
			||||||
		;;
 | 
							;;
 | 
				
			||||||
 | 
						    OpenUNIX)
 | 
				
			||||||
 | 
							if [ "`echo x$VERSION | sed -e 's/\..*//'`" = "x8" ]; then
 | 
				
			||||||
 | 
							    echo "${MACHINE}-unknown-OpenUNIX${VERSION}"; exit 0
 | 
				
			||||||
 | 
							fi
 | 
				
			||||||
 | 
							;;
 | 
				
			||||||
	    5)
 | 
						    5)
 | 
				
			||||||
		if [ "`echo x$VERSION | sed -e 's/\..*//'`" = "x7" ]; then
 | 
							if [ "`echo x$VERSION | sed -e 's/\..*//'`" = "x7" ]; then
 | 
				
			||||||
		    echo "${MACHINE}-sco-unixware7"; exit 0
 | 
							    echo "${MACHINE}-sco-unixware7"; exit 0
 | 
				
			||||||
@@ -104,6 +117,14 @@ case "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in
 | 
				
			|||||||
	echo "m68k-apple-aux3"; exit 0
 | 
						echo "m68k-apple-aux3"; exit 0
 | 
				
			||||||
	;;
 | 
						;;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    AIX:[3456789]:4:*)
 | 
				
			||||||
 | 
						echo "${MACHINE}-ibm-aix43"; exit 0
 | 
				
			||||||
 | 
						;;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    AIX:*:[56789]:*)
 | 
				
			||||||
 | 
						echo "${MACHINE}-ibm-aix43"; exit 0
 | 
				
			||||||
 | 
						;;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    AIX:*)
 | 
					    AIX:*)
 | 
				
			||||||
	echo "${MACHINE}-ibm-aix"; exit 0
 | 
						echo "${MACHINE}-ibm-aix"; exit 0
 | 
				
			||||||
	;;
 | 
						;;
 | 
				
			||||||
@@ -119,10 +140,7 @@ case "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in
 | 
				
			|||||||
    HP-UX:*)
 | 
					    HP-UX:*)
 | 
				
			||||||
	HPUXVER=`echo ${RELEASE}|sed -e 's/[^.]*.[0B]*//'`
 | 
						HPUXVER=`echo ${RELEASE}|sed -e 's/[^.]*.[0B]*//'`
 | 
				
			||||||
	case "$HPUXVER" in
 | 
						case "$HPUXVER" in
 | 
				
			||||||
	    11.*)
 | 
						    1[0-9].*)	# HPUX 10 and 11 targets are unified
 | 
				
			||||||
		echo "${MACHINE}-hp-hpux11"; exit 0
 | 
					 | 
				
			||||||
		;;
 | 
					 | 
				
			||||||
	    10.*)
 | 
					 | 
				
			||||||
		echo "${MACHINE}-hp-hpux10"; exit 0
 | 
							echo "${MACHINE}-hp-hpux10"; exit 0
 | 
				
			||||||
		;;
 | 
							;;
 | 
				
			||||||
	    *)
 | 
						    *)
 | 
				
			||||||
@@ -208,15 +226,33 @@ case "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in
 | 
				
			|||||||
	echo "${MACHINE}-whatever-openbsd"; exit 0
 | 
						echo "${MACHINE}-whatever-openbsd"; exit 0
 | 
				
			||||||
	;;
 | 
						;;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    OpenUNIX:*)
 | 
				
			||||||
 | 
						echo "${MACHINE}-unknown-OpenUNIX${VERSION}"; exit 0
 | 
				
			||||||
 | 
						;;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    OSF1:*:*:*alpha*)
 | 
					    OSF1:*:*:*alpha*)
 | 
				
			||||||
	echo "${MACHINE}-dec-osf"; exit 0
 | 
						OSFMAJOR=`echo ${RELEASE}| sed -e 's/^V\([0-9]*\)\..*$/\1/'`
 | 
				
			||||||
 | 
						case "$OSFMAJOR" in
 | 
				
			||||||
 | 
						    4|5)
 | 
				
			||||||
 | 
							echo "${MACHINE}-dec-tru64"; exit 0
 | 
				
			||||||
 | 
							;;
 | 
				
			||||||
 | 
						    1|2|3)
 | 
				
			||||||
 | 
							echo "${MACHINE}-dec-osf"; exit 0
 | 
				
			||||||
 | 
							;;
 | 
				
			||||||
 | 
						    *)
 | 
				
			||||||
 | 
							echo "${MACHINE}-dec-osf"; exit 0
 | 
				
			||||||
 | 
							;;
 | 
				
			||||||
 | 
						esac
 | 
				
			||||||
	;;
 | 
						;;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    QNX:*)
 | 
					    QNX:*)
 | 
				
			||||||
	case "$VERSION" in
 | 
						case "$RELEASE" in
 | 
				
			||||||
	    4*)
 | 
						    4*)
 | 
				
			||||||
		echo "${MACHINE}-whatever-qnx4"
 | 
							echo "${MACHINE}-whatever-qnx4"
 | 
				
			||||||
		;;
 | 
							;;
 | 
				
			||||||
 | 
						    6*)
 | 
				
			||||||
 | 
							echo "${MACHINE}-whatever-qnx6"
 | 
				
			||||||
 | 
							;;
 | 
				
			||||||
	    *)
 | 
						    *)
 | 
				
			||||||
		echo "${MACHINE}-whatever-qnx"
 | 
							echo "${MACHINE}-whatever-qnx"
 | 
				
			||||||
		;;
 | 
							;;
 | 
				
			||||||
@@ -296,6 +332,29 @@ case "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in
 | 
				
			|||||||
	echo "mips-sony-newsos4"; exit 0;
 | 
						echo "mips-sony-newsos4"; exit 0;
 | 
				
			||||||
	;;
 | 
						;;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    CYGWIN*)
 | 
				
			||||||
 | 
						case "$RELEASE" in
 | 
				
			||||||
 | 
						    [bB]*|1.0|1.[12].*)
 | 
				
			||||||
 | 
							echo "${MACHINE}-whatever-cygwin_pre1.3"
 | 
				
			||||||
 | 
							;;
 | 
				
			||||||
 | 
						    *)
 | 
				
			||||||
 | 
							echo "${MACHINE}-whatever-cygwin"
 | 
				
			||||||
 | 
							;;
 | 
				
			||||||
 | 
						esac
 | 
				
			||||||
 | 
						exit 0
 | 
				
			||||||
 | 
						;;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    *"CRAY T3E")
 | 
				
			||||||
 | 
					       echo "t3e-cray-unicosmk"; exit 0;
 | 
				
			||||||
 | 
					       ;;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    *CRAY*)
 | 
				
			||||||
 | 
					       echo "j90-cray-unicos"; exit 0;
 | 
				
			||||||
 | 
					       ;;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    NONSTOP_KERNEL*)
 | 
				
			||||||
 | 
					       echo "nsr-tandem-nsk"; exit 0;
 | 
				
			||||||
 | 
					       ;;
 | 
				
			||||||
esac
 | 
					esac
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
@@ -335,18 +394,43 @@ exit 0
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# figure out if gcc is available and if so we use it otherwise
 | 
					# figure out if gcc is available and if so we use it otherwise
 | 
				
			||||||
# we fallback to whatever cc does on the system
 | 
					# we fallback to whatever cc does on the system
 | 
				
			||||||
GCCVER=`(gcc --version) 2>/dev/null`
 | 
					GCCVER=`(gcc -dumpversion) 2>/dev/null`
 | 
				
			||||||
if [ "$GCCVER" != "" ]; then
 | 
					if [ "$GCCVER" != "" ]; then
 | 
				
			||||||
  CC=gcc
 | 
					  CC=gcc
 | 
				
			||||||
  # then strip off whatever prefix Cygnus prepends the number with...
 | 
					  # then strip off whatever prefix egcs prepends the number with...
 | 
				
			||||||
  GCCVER=`echo $GCCVER | sed 's/^[a-z]*\-//'`
 | 
					  # Hopefully, this will work for any future prefixes as well.
 | 
				
			||||||
 | 
					  GCCVER=`echo $GCCVER | sed 's/^[a-zA-Z]*\-//'`
 | 
				
			||||||
 | 
					  # Since gcc 3.1 gcc --version behaviour has changed.  gcc -dumpversion
 | 
				
			||||||
 | 
					  # does give us what we want though, so we use that.  We just just the
 | 
				
			||||||
 | 
					  # major and minor version numbers.
 | 
				
			||||||
  # peak single digit before and after first dot, e.g. 2.95.1 gives 29
 | 
					  # peak single digit before and after first dot, e.g. 2.95.1 gives 29
 | 
				
			||||||
  GCCVER=`echo $GCCVER | sed 's/\([0-9]\)\.\([0-9]\).*/\1\2/'`
 | 
					  GCCVER=`echo $GCCVER | sed 's/\([0-9]\)\.\([0-9]\).*/\1\2/'`
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
  CC=cc
 | 
					  CC=cc
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					GCCVER=${GCCVER:-0}
 | 
				
			||||||
 | 
					if [ "$SYSTEM" = "HP-UX" ];then
 | 
				
			||||||
 | 
					  # By default gcc is a ILP32 compiler (with long long == 64).
 | 
				
			||||||
 | 
					  GCC_BITS="32"
 | 
				
			||||||
 | 
					  if [ $GCCVER -ge 30 ]; then
 | 
				
			||||||
 | 
					    # PA64 support only came in with gcc 3.0.x.
 | 
				
			||||||
 | 
					    # We look for the preprocessor symbol __LP64__ indicating
 | 
				
			||||||
 | 
					    # 64bit bit long and pointer.  sizeof(int) == 32 on HPUX64.
 | 
				
			||||||
 | 
					    if gcc -v -E -x c /dev/null 2>&1 | grep __LP64__ > /dev/null; then
 | 
				
			||||||
 | 
					      GCC_BITS="64"
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					  fi
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
if [ "$SYSTEM" = "SunOS" ]; then
 | 
					if [ "$SYSTEM" = "SunOS" ]; then
 | 
				
			||||||
 | 
					  if [ $GCCVER -ge 30 ]; then
 | 
				
			||||||
 | 
					    # 64-bit ABI isn't officially supported in gcc 3.0, but it appears
 | 
				
			||||||
 | 
					    # to be working, at the very least 'make test' passes...
 | 
				
			||||||
 | 
					    if gcc -v -E -x c /dev/null 2>&1 | grep __arch64__ > /dev/null; then
 | 
				
			||||||
 | 
					      GCC_ARCH="-m64"
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					      GCC_ARCH="-m32"
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					  fi
 | 
				
			||||||
  # check for WorkShop C, expected output is "cc: blah-blah C x.x"
 | 
					  # check for WorkShop C, expected output is "cc: blah-blah C x.x"
 | 
				
			||||||
  CCVER=`(cc -V 2>&1) 2>/dev/null | \
 | 
					  CCVER=`(cc -V 2>&1) 2>/dev/null | \
 | 
				
			||||||
  	egrep -e '^cc: .* C [0-9]\.[0-9]' | \
 | 
					  	egrep -e '^cc: .* C [0-9]\.[0-9]' | \
 | 
				
			||||||
@@ -377,7 +461,6 @@ if [ "${SYSTEM}-${MACHINE}" = "Linux-alpha" ]; then
 | 
				
			|||||||
  fi
 | 
					  fi
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
GCCVER=${GCCVER:-0}
 | 
					 | 
				
			||||||
CCVER=${CCVER:-0}
 | 
					CCVER=${CCVER:-0}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# read the output of the embedded GuessOS 
 | 
					# read the output of the embedded GuessOS 
 | 
				
			||||||
@@ -410,9 +493,9 @@ case "$GUESSOS" in
 | 
				
			|||||||
  mips4-sgi-irix64)
 | 
					  mips4-sgi-irix64)
 | 
				
			||||||
	echo "WARNING! If you wish to build 64-bit library, then you have to"
 | 
						echo "WARNING! If you wish to build 64-bit library, then you have to"
 | 
				
			||||||
	echo "         invoke './Configure irix64-mips4-$CC' *manually*."
 | 
						echo "         invoke './Configure irix64-mips4-$CC' *manually*."
 | 
				
			||||||
	echo "         Type return if you want to continue, Ctrl-C to abort."
 | 
					 | 
				
			||||||
	if [ "$TEST" = "false" ]; then
 | 
						if [ "$TEST" = "false" ]; then
 | 
				
			||||||
	  read waste < /dev/tty
 | 
						  echo "         You have about 5 seconds to press Ctrl-C to abort."
 | 
				
			||||||
 | 
						  (stty -icanon min 0 time 50; read waste) < /dev/tty
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
        CPU=`(hinv -t cpu) 2>/dev/null | sed 's/^CPU:[^R]*R\([0-9]*\).*/\1/'`
 | 
					        CPU=`(hinv -t cpu) 2>/dev/null | sed 's/^CPU:[^R]*R\([0-9]*\).*/\1/'`
 | 
				
			||||||
        CPU=${CPU:-0}
 | 
					        CPU=${CPU:-0}
 | 
				
			||||||
@@ -453,6 +536,10 @@ EOF
 | 
				
			|||||||
	${CC} -o dummy dummy.c && OUT=`./dummy ${MACHINE}`
 | 
						${CC} -o dummy dummy.c && OUT=`./dummy ${MACHINE}`
 | 
				
			||||||
	rm dummy dummy.c
 | 
						rm dummy dummy.c
 | 
				
			||||||
	;;
 | 
						;;
 | 
				
			||||||
 | 
					  ppc64-*-linux2)
 | 
				
			||||||
 | 
						#Use the standard target for PPC architecture until we create a
 | 
				
			||||||
 | 
						#special one for the 64bit architecture.
 | 
				
			||||||
 | 
						OUT="linux-ppc" ;;
 | 
				
			||||||
  ppc-*-linux2) OUT="linux-ppc" ;;
 | 
					  ppc-*-linux2) OUT="linux-ppc" ;;
 | 
				
			||||||
  m68k-*-linux*) OUT="linux-m68k" ;;
 | 
					  m68k-*-linux*) OUT="linux-m68k" ;;
 | 
				
			||||||
  ia64-*-linux?) OUT="linux-ia64" ;;
 | 
					  ia64-*-linux?) OUT="linux-ia64" ;;
 | 
				
			||||||
@@ -475,21 +562,76 @@ EOF
 | 
				
			|||||||
	sun4d)	OUT="linux-sparcv8" ;;
 | 
						sun4d)	OUT="linux-sparcv8" ;;
 | 
				
			||||||
	*)	OUT="linux-sparcv7" ;;
 | 
						*)	OUT="linux-sparcv7" ;;
 | 
				
			||||||
	esac ;;
 | 
						esac ;;
 | 
				
			||||||
 | 
					  parisc-*-linux2)
 | 
				
			||||||
 | 
					        CPUARCH=`awk '/cpu family/{print substr($5,1,3)}' /proc/cpuinfo`
 | 
				
			||||||
 | 
						CPUSCHEDULE=`awk '/^cpu.[ 	]: PA/{print substr($3,3)}' /proc/cpuinfo`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						# ??TODO ??  Model transformations
 | 
				
			||||||
 | 
						# 0. CPU Architecture for the 1.1 processor has letter suffixes. We strip that off
 | 
				
			||||||
 | 
						#    assuming no further arch. identification will ever be used by GCC.
 | 
				
			||||||
 | 
						# 1. I'm most concerned about whether is a 7300LC is closer to a 7100 versus a 7100LC.
 | 
				
			||||||
 | 
						# 2. The variant 64-bit processors cause concern should GCC support explicit schedulers
 | 
				
			||||||
 | 
						#    for these chips in the future.
 | 
				
			||||||
 | 
						#         PA7300LC -> 7100LC (1.1)
 | 
				
			||||||
 | 
						#         PA8200   -> 8000   (2.0)
 | 
				
			||||||
 | 
						#         PA8500   -> 8000   (2.0)
 | 
				
			||||||
 | 
						#         PA8600   -> 8000   (2.0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						CPUSCHEDULE=`echo $CPUSCHEDULE|sed -e 's/7300LC/7100LC/' -e 's/8?00/8000/'`
 | 
				
			||||||
 | 
						# Finish Model transformations
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						options="$options -mschedule=$CPUSCHEDULE -march=$CPUARCH"
 | 
				
			||||||
 | 
						OUT="linux-parisc" ;;
 | 
				
			||||||
  arm*-*-linux2) OUT="linux-elf-arm" ;;
 | 
					  arm*-*-linux2) OUT="linux-elf-arm" ;;
 | 
				
			||||||
  s390-*-linux2) OUT="linux-s390" ;;
 | 
					  s390-*-linux2) OUT="linux-s390" ;;
 | 
				
			||||||
  *-*-linux2) OUT="linux-elf" ;;
 | 
					  s390x-*-linux?) OUT="linux-s390x" ;;
 | 
				
			||||||
 | 
					  *-*-linux2) OUT="linux-elf"
 | 
				
			||||||
 | 
						if [ "$GCCVER" -gt 28 ]; then
 | 
				
			||||||
 | 
					          if grep '^model.*Pentium' /proc/cpuinfo >/dev/null ; then
 | 
				
			||||||
 | 
					            OUT="linux-pentium"
 | 
				
			||||||
 | 
					          fi
 | 
				
			||||||
 | 
					          if grep '^model.*Pentium Pro' /proc/cpuinfo >/dev/null ; then
 | 
				
			||||||
 | 
					            OUT="linux-ppro"
 | 
				
			||||||
 | 
					          fi
 | 
				
			||||||
 | 
					          if grep '^model.*K6' /proc/cpuinfo >/dev/null ; then
 | 
				
			||||||
 | 
					            OUT="linux-k6"
 | 
				
			||||||
 | 
					          fi
 | 
				
			||||||
 | 
					        fi ;;
 | 
				
			||||||
  *-*-linux1) OUT="linux-aout" ;;
 | 
					  *-*-linux1) OUT="linux-aout" ;;
 | 
				
			||||||
  sun4u*-*-solaris2)
 | 
					  sun4u*-*-solaris2)
 | 
				
			||||||
 | 
						OUT="solaris-sparcv9-$CC"
 | 
				
			||||||
	ISA64=`(isalist) 2>/dev/null | grep sparcv9`
 | 
						ISA64=`(isalist) 2>/dev/null | grep sparcv9`
 | 
				
			||||||
	if [ "$ISA64" != "" -a "$CC" = "cc" -a $CCVER -ge 50 ]; then
 | 
						if [ "$ISA64" != "" ]; then
 | 
				
			||||||
 | 
						    if [ "$CC" = "cc" -a $CCVER -ge 50 ]; then
 | 
				
			||||||
		echo "WARNING! If you wish to build 64-bit library, then you have to"
 | 
							echo "WARNING! If you wish to build 64-bit library, then you have to"
 | 
				
			||||||
		echo "         invoke './Configure solaris64-sparcv9-cc' *manually*."
 | 
							echo "         invoke './Configure solaris64-sparcv9-cc' *manually*."
 | 
				
			||||||
		echo "         Type return if you want to continue, Ctrl-C to abort."
 | 
					 | 
				
			||||||
		if [ "$TEST" = "false" ]; then
 | 
							if [ "$TEST" = "false" ]; then
 | 
				
			||||||
		  read waste < /dev/tty
 | 
							  echo "         You have about 5 seconds to press Ctrl-C to abort."
 | 
				
			||||||
 | 
							  (stty -icanon min 0 time 50; read waste) < /dev/tty
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
 | 
						    elif [ "$CC" = "gcc" -a "$GCC_ARCH" = "-m64" ]; then
 | 
				
			||||||
 | 
							# $GCC_ARCH denotes default ABI chosen by compiler driver
 | 
				
			||||||
 | 
							# (first one found on the $PATH). I assume that user
 | 
				
			||||||
 | 
							# expects certain consistency with the rest of his builds
 | 
				
			||||||
 | 
							# and therefore switch over to 64-bit. <appro>
 | 
				
			||||||
 | 
							OUT="solaris64-sparcv9-gcc"
 | 
				
			||||||
 | 
							echo "WARNING! If you wish to build 32-bit library, then you have to"
 | 
				
			||||||
 | 
							echo "         invoke './Configure solaris-sparcv9-gcc' *manually*."
 | 
				
			||||||
 | 
							if [ "$TEST" = "false" ]; then
 | 
				
			||||||
 | 
							  echo "         You have about 5 seconds to press Ctrl-C to abort."
 | 
				
			||||||
 | 
							  (stty -icanon min 0 time 50; read waste) < /dev/tty
 | 
				
			||||||
 | 
							fi
 | 
				
			||||||
 | 
						    elif [ "$GCC_ARCH" = "-m32" ]; then
 | 
				
			||||||
 | 
							echo "NOTICE! If you *know* that your GNU C supports 64-bit/V9 ABI"
 | 
				
			||||||
 | 
							echo "        and wish to build 64-bit library, then you have to"
 | 
				
			||||||
 | 
							echo "        invoke './Configure solaris64-sparcv9-gcc' *manually*."
 | 
				
			||||||
 | 
							if [ "$TEST" = "false" ]; then
 | 
				
			||||||
 | 
							  echo "         You have about 5 seconds to press Ctrl-C to abort."
 | 
				
			||||||
 | 
							  (stty -icanon min 0 time 50; read waste) < /dev/tty
 | 
				
			||||||
 | 
							fi
 | 
				
			||||||
 | 
						    fi
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
	OUT="solaris-sparcv9-$CC" ;;
 | 
						;;
 | 
				
			||||||
  sun4m-*-solaris2)	OUT="solaris-sparcv8-$CC" ;;
 | 
					  sun4m-*-solaris2)	OUT="solaris-sparcv8-$CC" ;;
 | 
				
			||||||
  sun4d-*-solaris2)	OUT="solaris-sparcv8-$CC" ;;
 | 
					  sun4d-*-solaris2)	OUT="solaris-sparcv8-$CC" ;;
 | 
				
			||||||
  sun4*-*-solaris2)	OUT="solaris-sparcv7-$CC" ;;
 | 
					  sun4*-*-solaris2)	OUT="solaris-sparcv7-$CC" ;;
 | 
				
			||||||
@@ -501,28 +643,93 @@ EOF
 | 
				
			|||||||
  *86*-*-netbsd) OUT="NetBSD-x86" ;;
 | 
					  *86*-*-netbsd) OUT="NetBSD-x86" ;;
 | 
				
			||||||
  sun3*-*-netbsd) OUT="NetBSD-m68" ;;
 | 
					  sun3*-*-netbsd) OUT="NetBSD-m68" ;;
 | 
				
			||||||
  *-*-netbsd) OUT="NetBSD-sparc" ;;
 | 
					  *-*-netbsd) OUT="NetBSD-sparc" ;;
 | 
				
			||||||
  *86*-*-openbsd) OUT="OpenBSD-x86" ;;
 | 
					 | 
				
			||||||
  alpha*-*-openbsd) OUT="OpenBSD-alpha" ;;
 | 
					  alpha*-*-openbsd) OUT="OpenBSD-alpha" ;;
 | 
				
			||||||
 | 
					  *86*-*-openbsd) OUT="OpenBSD-i386" ;;
 | 
				
			||||||
 | 
					  m68k*-*-openbsd) OUT="OpenBSD-m68k" ;;
 | 
				
			||||||
 | 
					  m88k*-*-openbsd) OUT="OpenBSD-m88k" ;;
 | 
				
			||||||
 | 
					  mips*-*-openbsd) OUT="OpenBSD-mips" ;;
 | 
				
			||||||
  pmax*-*-openbsd) OUT="OpenBSD-mips" ;;
 | 
					  pmax*-*-openbsd) OUT="OpenBSD-mips" ;;
 | 
				
			||||||
 | 
					  powerpc*-*-openbsd) OUT="OpenBSD-powerpc" ;;
 | 
				
			||||||
 | 
					  sparc64*-*-openbsd) OUT="OpenBSD-sparc64" ;;
 | 
				
			||||||
 | 
					  sparc*-*-openbsd) OUT="OpenBSD-sparc" ;;
 | 
				
			||||||
 | 
					  vax*-*-openbsd) OUT="OpenBSD-vax" ;;
 | 
				
			||||||
 | 
					  hppa*-*-openbsd) OUT="OpenBSD-hppa" ;;
 | 
				
			||||||
  *-*-openbsd) OUT="OpenBSD" ;;
 | 
					  *-*-openbsd) OUT="OpenBSD" ;;
 | 
				
			||||||
  *86*-*-bsdi4) OUT="bsdi-elf-gcc" ;;
 | 
					  *86*-*-bsdi4) OUT="bsdi-elf-gcc" ;;
 | 
				
			||||||
  *-*-osf) OUT="alpha-cc" ;;
 | 
					  *-*-osf) OUT="alphaold-cc" ;;
 | 
				
			||||||
 | 
					  *-*-tru64) OUT="alpha-cc" ;;
 | 
				
			||||||
 | 
					  *-*-OpenUNIX*)
 | 
				
			||||||
 | 
						if [ "$CC" = "gcc" ]; then
 | 
				
			||||||
 | 
						  OUT="OpenUNIX-8-gcc" 
 | 
				
			||||||
 | 
						else    
 | 
				
			||||||
 | 
						  OUT="OpenUNIX-8" 
 | 
				
			||||||
 | 
						fi
 | 
				
			||||||
 | 
						;;
 | 
				
			||||||
  *-*-unixware7) OUT="unixware-7" ;;
 | 
					  *-*-unixware7) OUT="unixware-7" ;;
 | 
				
			||||||
  *-*-UnixWare7) OUT="unixware-7" ;;
 | 
					  *-*-UnixWare7) OUT="unixware-7" ;;
 | 
				
			||||||
  *-*-Unixware7) OUT="unixware-7" ;;
 | 
					  *-*-Unixware7) OUT="unixware-7" ;;
 | 
				
			||||||
  *-*-unixware[1-2]*) OUT="unixware-2.0" ;;
 | 
					  *-*-unixware20*) OUT="unixware-2.0" ;;
 | 
				
			||||||
  *-*-UnixWare[1-2]*) OUT="unixware-2.0" ;;
 | 
					  *-*-unixware21*) OUT="unixware-2.1" ;;
 | 
				
			||||||
  *-*-Unixware[1-2]*) OUT="unixware-2.0" ;;
 | 
					  *-*-UnixWare20*) OUT="unixware-2.0" ;;
 | 
				
			||||||
 | 
					  *-*-UnixWare21*) OUT="unixware-2.1" ;;
 | 
				
			||||||
 | 
					  *-*-Unixware20*) OUT="unixware-2.0" ;;
 | 
				
			||||||
 | 
					  *-*-Unixware21*) OUT="unixware-2.1" ;;
 | 
				
			||||||
  BS2000-siemens-sysv4) OUT="BS2000-OSD" ;;
 | 
					  BS2000-siemens-sysv4) OUT="BS2000-OSD" ;;
 | 
				
			||||||
  RM*-siemens-sysv4) OUT="ReliantUNIX" ;;
 | 
					  RM*-siemens-sysv4) OUT="ReliantUNIX" ;;
 | 
				
			||||||
  *-siemens-sysv4) OUT="SINIX" ;;
 | 
					  *-siemens-sysv4) OUT="SINIX" ;;
 | 
				
			||||||
  *-hpux1*)	OUT="hpux-parisc-$CC"
 | 
					  *-hpux1*)
 | 
				
			||||||
		options="$options -D_REENTRANT" ;;
 | 
						if [ $CC = "gcc" ];
 | 
				
			||||||
 | 
						then
 | 
				
			||||||
 | 
						  if [ $GCC_BITS = "64" ]; then
 | 
				
			||||||
 | 
						    OUT="hpux64-parisc-gcc"
 | 
				
			||||||
 | 
						  else
 | 
				
			||||||
 | 
						    OUT="hpux-parisc-gcc"
 | 
				
			||||||
 | 
						  fi
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
						  OUT="hpux-parisc-$CC"
 | 
				
			||||||
 | 
						fi
 | 
				
			||||||
 | 
						KERNEL_BITS=`(getconf KERNEL_BITS) 2>/dev/null`
 | 
				
			||||||
 | 
						KERNEL_BITS=${KERNEL_BITS:-32}
 | 
				
			||||||
 | 
						CPU_VERSION=`(getconf CPU_VERSION) 2>/dev/null`
 | 
				
			||||||
 | 
						CPU_VERSION=${CPU_VERSION:-0}
 | 
				
			||||||
 | 
						# See <sys/unistd.h> for further info on CPU_VERSION.
 | 
				
			||||||
 | 
						if   [ $CPU_VERSION -ge 768 ]; then	# IA-64 CPU
 | 
				
			||||||
 | 
						     echo "NOTICE! 64-bit is the only ABI currently operational on HP-UXi."
 | 
				
			||||||
 | 
						     echo "        Post request to openssl-dev@openssl.org for 32-bit support."
 | 
				
			||||||
 | 
						     if [ "$TEST" = "false" ]; then
 | 
				
			||||||
 | 
							(stty -icanon min 0 time 50; read waste) < /dev/tty
 | 
				
			||||||
 | 
						     fi
 | 
				
			||||||
 | 
						     OUT="hpux64-ia64-cc"
 | 
				
			||||||
 | 
						elif [ $CPU_VERSION -ge 532 ]; then	# PA-RISC 2.x CPU
 | 
				
			||||||
 | 
						     if [ "$CC" = "cc" ]; then
 | 
				
			||||||
 | 
							OUT="hpux-parisc2-cc" # can't we have hpux-parisc2-gcc?
 | 
				
			||||||
 | 
						     fi
 | 
				
			||||||
 | 
						     if [ $KERNEL_BITS -eq 64 -a "$CC" = "cc" ]; then
 | 
				
			||||||
 | 
							echo "WARNING! If you wish to build 64-bit library then you have to"
 | 
				
			||||||
 | 
							echo "         invoke './Configure hpux64-parisc2-cc' *manually*."
 | 
				
			||||||
 | 
							if [ "$TEST" = "false" ]; then
 | 
				
			||||||
 | 
							  echo "         You have about 5 seconds to press Ctrl-C to abort."
 | 
				
			||||||
 | 
							  (stty -icanon min 0 time 50; read waste) < /dev/tty
 | 
				
			||||||
 | 
							fi
 | 
				
			||||||
 | 
						     fi
 | 
				
			||||||
 | 
						elif [ $CPU_VERSION -ge 528 ]; then	# PA-RISC 1.1+ CPU
 | 
				
			||||||
 | 
						     :
 | 
				
			||||||
 | 
						elif [ $CPU_VERSION -ge 523 ]; then	# PA-RISC 1.0 CPU
 | 
				
			||||||
 | 
						     :
 | 
				
			||||||
 | 
						else					# Motorola(?) CPU
 | 
				
			||||||
 | 
						     OUT="hpux-$CC"
 | 
				
			||||||
 | 
						fi
 | 
				
			||||||
 | 
						options="$options -D_REENTRANT" ;;
 | 
				
			||||||
  *-hpux)	OUT="hpux-parisc-$CC" ;;
 | 
					  *-hpux)	OUT="hpux-parisc-$CC" ;;
 | 
				
			||||||
  # these are all covered by the catchall below
 | 
					  # these are all covered by the catchall below
 | 
				
			||||||
  # *-aix) OUT="aix-$CC" ;;
 | 
					  # *-aix) OUT="aix-$CC" ;;
 | 
				
			||||||
  # *-dgux) OUT="dgux" ;;
 | 
					  # *-dgux) OUT="dgux" ;;
 | 
				
			||||||
  mips-sony-newsos4) OUT="newsos4-gcc" ;;
 | 
					  mips-sony-newsos4) OUT="newsos4-gcc" ;;
 | 
				
			||||||
 | 
					  *-*-cygwin_pre1.3) OUT="Cygwin-pre1.3" ;;
 | 
				
			||||||
 | 
					  *-*-cygwin) OUT="Cygwin" ;;
 | 
				
			||||||
 | 
					  t3e-cray-unicosmk) OUT="cray-t3e" ;;
 | 
				
			||||||
 | 
					  j90-cray-unicos) OUT="cray-j90" ;;
 | 
				
			||||||
 | 
					  nsr-tandem-nsk) OUT="tandem-c89" ;;
 | 
				
			||||||
  *) OUT=`echo $GUESSOS | awk -F- '{print $3}'`;;
 | 
					  *) OUT=`echo $GUESSOS | awk -F- '{print $3}'`;;
 | 
				
			||||||
esac
 | 
					esac
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -557,7 +764,7 @@ case "$GUESSOS" in
 | 
				
			|||||||
  i386-*) options="$options 386" ;;
 | 
					  i386-*) options="$options 386" ;;
 | 
				
			||||||
esac
 | 
					esac
 | 
				
			||||||
 | 
					
 | 
				
			||||||
for i in bf cast des dh dsa ec hmac md2 md5 mdc2 rc2 rc4 rc5 ripemd rsa sha
 | 
					for i in bf cast des dh dsa ec hmac idea md2 md5 mdc2 rc2 rc4 rc5 aes ripemd rsa sha
 | 
				
			||||||
do
 | 
					do
 | 
				
			||||||
  if [ ! -d crypto/$i ]
 | 
					  if [ ! -d crypto/$i ]
 | 
				
			||||||
  then
 | 
					  then
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -28,35 +28,37 @@ LIBS=
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
SDIRS=	md2 md5 sha mdc2 hmac ripemd \
 | 
					SDIRS=	md2 md5 sha mdc2 hmac ripemd \
 | 
				
			||||||
	des rc2 rc4 rc5 idea bf cast \
 | 
						des rc2 rc4 rc5 idea bf cast \
 | 
				
			||||||
	bn ec rsa dsa dh dso engine rijndael \
 | 
						bn ec rsa dsa dh dso engine aes \
 | 
				
			||||||
	buffer bio stack lhash rand err objects \
 | 
						buffer bio stack lhash rand err objects \
 | 
				
			||||||
	evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp
 | 
						evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp ui krb5
 | 
				
			||||||
 | 
					
 | 
				
			||||||
GENERAL=Makefile README crypto-lib.com install.com
 | 
					GENERAL=Makefile README crypto-lib.com install.com
 | 
				
			||||||
 | 
					
 | 
				
			||||||
LIB= $(TOP)/libcrypto.a
 | 
					LIB= $(TOP)/libcrypto.a
 | 
				
			||||||
LIBSRC=	cryptlib.c mem.c mem_dbg.c cversion.c ex_data.c tmdiff.c cpt_err.c ebcdic.c uid.c
 | 
					SHARED_LIB= libcrypto$(SHLIB_EXT)
 | 
				
			||||||
LIBOBJ= cryptlib.o mem.o mem_dbg.o cversion.o ex_data.o tmdiff.o cpt_err.o ebcdic.o uid.o
 | 
					LIBSRC=	cryptlib.c mem.c mem_dbg.c cversion.c ex_data.c tmdiff.c cpt_err.c ebcdic.c uid.c o_time.c
 | 
				
			||||||
 | 
					LIBOBJ= cryptlib.o mem.o mem_dbg.o cversion.o ex_data.o tmdiff.o cpt_err.o ebcdic.o uid.o o_time.o
 | 
				
			||||||
 | 
					
 | 
				
			||||||
SRC= $(LIBSRC)
 | 
					SRC= $(LIBSRC)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
EXHEADER= crypto.h tmdiff.h opensslv.h opensslconf.h ebcdic.h symhacks.h
 | 
					EXHEADER= crypto.h tmdiff.h opensslv.h opensslconf.h ebcdic.h symhacks.h \
 | 
				
			||||||
HEADER=	cryptlib.h buildinf.h md32_common.h $(EXHEADER)
 | 
						ossl_typ.h
 | 
				
			||||||
 | 
					HEADER=	cryptlib.h buildinf.h md32_common.h o_time.h $(EXHEADER)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ALL=    $(GENERAL) $(SRC) $(HEADER)
 | 
					ALL=    $(GENERAL) $(SRC) $(HEADER)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
top:
 | 
					top:
 | 
				
			||||||
	@(cd ..; $(MAKE) DIRS=$(DIR) all)
 | 
						@(cd ..; $(MAKE) DIRS=$(DIR) all)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
all: buildinf.h lib subdirs
 | 
					all: buildinf.h lib subdirs shared
 | 
				
			||||||
 | 
					
 | 
				
			||||||
buildinf.h: ../Makefile.ssl
 | 
					buildinf.h: ../Makefile.ssl
 | 
				
			||||||
	( echo "#ifndef MK1MF_BUILD"; \
 | 
						( echo "#ifndef MK1MF_BUILD"; \
 | 
				
			||||||
	echo "  /* auto-generated by crypto/Makefile.ssl for crypto/cversion.c */"; \
 | 
						echo '  /* auto-generated by crypto/Makefile.ssl for crypto/cversion.c */'; \
 | 
				
			||||||
	echo "  #define CFLAGS \"$(CC) $(CFLAG)\""; \
 | 
						echo '  #define CFLAGS "$(CC) $(CFLAG)"'; \
 | 
				
			||||||
	echo "  #define PLATFORM \"$(PLATFORM)\""; \
 | 
						echo '  #define PLATFORM "$(PLATFORM)"'; \
 | 
				
			||||||
	echo "  #define DATE \"`date`\""; \
 | 
						echo "  #define DATE \"`LC_ALL=C LC_TIME=C date`\""; \
 | 
				
			||||||
	echo "#endif" ) >buildinf.h
 | 
						echo '#endif' ) >buildinf.h
 | 
				
			||||||
 | 
					
 | 
				
			||||||
testapps:
 | 
					testapps:
 | 
				
			||||||
	if echo ${SDIRS} | fgrep ' des '; \
 | 
						if echo ${SDIRS} | fgrep ' des '; \
 | 
				
			||||||
@@ -94,6 +96,11 @@ lib:	$(LIBOBJ)
 | 
				
			|||||||
	$(RANLIB) $(LIB) || echo Never mind.
 | 
						$(RANLIB) $(LIB) || echo Never mind.
 | 
				
			||||||
	@touch lib
 | 
						@touch lib
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					shared:
 | 
				
			||||||
 | 
						if [ -n "$(SHARED_LIBS)" ]; then \
 | 
				
			||||||
 | 
							(cd ..; $(MAKE) $(SHARED_LIB)); \
 | 
				
			||||||
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
libs:
 | 
					libs:
 | 
				
			||||||
	@for i in $(SDIRS) ;\
 | 
						@for i in $(SDIRS) ;\
 | 
				
			||||||
	do \
 | 
						do \
 | 
				
			||||||
@@ -129,12 +136,12 @@ lint:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
depend:
 | 
					depend:
 | 
				
			||||||
	if [ ! -f buildinf.h ]; then touch buildinf.h; fi # fake buildinf.h if it does not exist
 | 
						if [ ! -f buildinf.h ]; then touch buildinf.h; fi # fake buildinf.h if it does not exist
 | 
				
			||||||
	$(MAKEDEPEND) $(INCLUDE) $(DEPFLAG) $(PROGS) $(LIBSRC)
 | 
						$(MAKEDEPEND) -- $(CFLAG) $(INCLUDE) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
 | 
				
			||||||
	if [ ! -s buildinf.h ]; then rm buildinf.h; fi
 | 
						if [ ! -s buildinf.h ]; then rm buildinf.h; fi
 | 
				
			||||||
	@for i in $(SDIRS) ;\
 | 
						@for i in $(SDIRS) ;\
 | 
				
			||||||
	do \
 | 
						do \
 | 
				
			||||||
	(cd $$i && echo "making depend in crypto/$$i..." && \
 | 
						(cd $$i && echo "making depend in crypto/$$i..." && \
 | 
				
			||||||
	$(MAKE) MAKEFILE='${MAKEFILE}' INCLUDES='${INCLUDES}' DEPFLAG='${DEPFLAG}' depend ); \
 | 
						$(MAKE) MAKEFILE='${MAKEFILE}' INCLUDES='${INCLUDES}' CFLAG='${CFLAG}' DEPFLAG='${DEPFLAG}' PERL='${PERL}' depend ); \
 | 
				
			||||||
	done;
 | 
						done;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
clean:
 | 
					clean:
 | 
				
			||||||
@@ -173,7 +180,7 @@ cversion.o: ../include/openssl/err.h ../include/openssl/lhash.h
 | 
				
			|||||||
cversion.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
 | 
					cversion.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
 | 
				
			||||||
cversion.o: ../include/openssl/safestack.h ../include/openssl/stack.h
 | 
					cversion.o: ../include/openssl/safestack.h ../include/openssl/stack.h
 | 
				
			||||||
cversion.o: ../include/openssl/symhacks.h buildinf.h cryptlib.h cversion.c
 | 
					cversion.o: ../include/openssl/symhacks.h buildinf.h cryptlib.h cversion.c
 | 
				
			||||||
ebcdic.o: ../include/openssl/opensslconf.h ebcdic.c
 | 
					ebcdic.o: ../include/openssl/e_os2.h ../include/openssl/opensslconf.h ebcdic.c
 | 
				
			||||||
ex_data.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
 | 
					ex_data.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
 | 
				
			||||||
ex_data.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
 | 
					ex_data.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
 | 
				
			||||||
ex_data.o: ../include/openssl/err.h ../include/openssl/lhash.h
 | 
					ex_data.o: ../include/openssl/err.h ../include/openssl/lhash.h
 | 
				
			||||||
@@ -192,6 +199,8 @@ mem_dbg.o: ../include/openssl/err.h ../include/openssl/lhash.h
 | 
				
			|||||||
mem_dbg.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
 | 
					mem_dbg.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
 | 
				
			||||||
mem_dbg.o: ../include/openssl/safestack.h ../include/openssl/stack.h
 | 
					mem_dbg.o: ../include/openssl/safestack.h ../include/openssl/stack.h
 | 
				
			||||||
mem_dbg.o: ../include/openssl/symhacks.h cryptlib.h mem_dbg.c
 | 
					mem_dbg.o: ../include/openssl/symhacks.h cryptlib.h mem_dbg.c
 | 
				
			||||||
 | 
					o_time.o: ../include/openssl/e_os2.h ../include/openssl/opensslconf.h o_time.c
 | 
				
			||||||
 | 
					o_time.o: o_time.h
 | 
				
			||||||
tmdiff.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
 | 
					tmdiff.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
 | 
				
			||||||
tmdiff.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
 | 
					tmdiff.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
 | 
				
			||||||
tmdiff.o: ../include/openssl/err.h ../include/openssl/lhash.h
 | 
					tmdiff.o: ../include/openssl/err.h ../include/openssl/lhash.h
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										103
									
								
								crypto/aes/Makefile.ssl
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										103
									
								
								crypto/aes/Makefile.ssl
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,103 @@
 | 
				
			|||||||
 | 
					#
 | 
				
			||||||
 | 
					# crypto/aes/Makefile
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					DIR=	aes
 | 
				
			||||||
 | 
					TOP=	../..
 | 
				
			||||||
 | 
					CC=	cc
 | 
				
			||||||
 | 
					CPP=	$(CC) -E
 | 
				
			||||||
 | 
					INCLUDES=
 | 
				
			||||||
 | 
					CFLAG=-g
 | 
				
			||||||
 | 
					INSTALL_PREFIX=
 | 
				
			||||||
 | 
					OPENSSLDIR=     /usr/local/ssl
 | 
				
			||||||
 | 
					INSTALLTOP=	/usr/local/ssl
 | 
				
			||||||
 | 
					MAKE=		make -f Makefile.ssl
 | 
				
			||||||
 | 
					MAKEDEPPROG=	makedepend
 | 
				
			||||||
 | 
					MAKEDEPEND=	$(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
 | 
				
			||||||
 | 
					MAKEFILE=	Makefile.ssl
 | 
				
			||||||
 | 
					AR=		ar r
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# CFLAGS= -mpentiumpro $(INCLUDES) $(CFLAG) -O3 -fexpensive-optimizations -funroll-loops -fforce-addr
 | 
				
			||||||
 | 
					CFLAGS= $(INCLUDES) $(CFLAG)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					GENERAL=Makefile
 | 
				
			||||||
 | 
					#TEST=aestest.c
 | 
				
			||||||
 | 
					TEST=
 | 
				
			||||||
 | 
					APPS=
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					LIB=$(TOP)/libcrypto.a
 | 
				
			||||||
 | 
					LIBSRC=aes_core.c aes_misc.c aes_ecb.c aes_cbc.c aes_cfb.c aes_ofb.c aes_ctr.c
 | 
				
			||||||
 | 
					LIBOBJ=aes_core.o aes_misc.o aes_ecb.o aes_cbc.o aes_cfb.o aes_ofb.o aes_ctr.o
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					SRC= $(LIBSRC)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					EXHEADER= aes.h
 | 
				
			||||||
 | 
					HEADER= aes_locl.h $(EXHEADER)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ALL=    $(GENERAL) $(SRC) $(HEADER)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					top:
 | 
				
			||||||
 | 
						(cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					all:	lib
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					lib:	$(LIBOBJ)
 | 
				
			||||||
 | 
						$(AR) $(LIB) $(LIBOBJ)
 | 
				
			||||||
 | 
						$(RANLIB) $(LIB) || echo Never mind.
 | 
				
			||||||
 | 
						@touch lib
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					$(LIBOBJ): $(LIBSRC)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					files:
 | 
				
			||||||
 | 
						$(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					links:
 | 
				
			||||||
 | 
						@$(TOP)/util/point.sh Makefile.ssl Makefile
 | 
				
			||||||
 | 
						@$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
 | 
				
			||||||
 | 
						@$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
 | 
				
			||||||
 | 
						@$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					install: installs
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					installs:
 | 
				
			||||||
 | 
						@for i in $(EXHEADER) ; \
 | 
				
			||||||
 | 
						do  \
 | 
				
			||||||
 | 
						(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
 | 
				
			||||||
 | 
						chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
 | 
				
			||||||
 | 
						done;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					tags:
 | 
				
			||||||
 | 
						ctags $(SRC)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					tests:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					lint:
 | 
				
			||||||
 | 
						lint -DLINT $(INCLUDES) $(SRC)>fluff
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					depend:
 | 
				
			||||||
 | 
						$(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					dclean:
 | 
				
			||||||
 | 
						$(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
 | 
				
			||||||
 | 
						mv -f Makefile.new $(MAKEFILE)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					clean:
 | 
				
			||||||
 | 
						rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# DO NOT DELETE THIS LINE -- make depend depends on it.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					aes_cbc.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h
 | 
				
			||||||
 | 
					aes_cbc.o: ../../include/openssl/opensslconf.h aes_cbc.c aes_locl.h
 | 
				
			||||||
 | 
					aes_cfb.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h
 | 
				
			||||||
 | 
					aes_cfb.o: ../../include/openssl/opensslconf.h aes_cfb.c aes_locl.h
 | 
				
			||||||
 | 
					aes_core.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h
 | 
				
			||||||
 | 
					aes_core.o: ../../include/openssl/opensslconf.h aes_core.c aes_locl.h
 | 
				
			||||||
 | 
					aes_ctr.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h
 | 
				
			||||||
 | 
					aes_ctr.o: ../../include/openssl/opensslconf.h aes_ctr.c aes_locl.h
 | 
				
			||||||
 | 
					aes_ecb.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h
 | 
				
			||||||
 | 
					aes_ecb.o: ../../include/openssl/opensslconf.h aes_ecb.c aes_locl.h
 | 
				
			||||||
 | 
					aes_misc.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h
 | 
				
			||||||
 | 
					aes_misc.o: ../../include/openssl/opensslconf.h
 | 
				
			||||||
 | 
					aes_misc.o: ../../include/openssl/opensslv.h aes_locl.h aes_misc.c
 | 
				
			||||||
 | 
					aes_ofb.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h
 | 
				
			||||||
 | 
					aes_ofb.o: ../../include/openssl/opensslconf.h aes_locl.h aes_ofb.c
 | 
				
			||||||
							
								
								
									
										3
									
								
								crypto/aes/README
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								crypto/aes/README
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,3 @@
 | 
				
			|||||||
 | 
					This is an OpenSSL-compatible version of AES (also called Rijndael).
 | 
				
			||||||
 | 
					aes_core.c is basically the same as rijndael-alg-fst.c but with an
 | 
				
			||||||
 | 
					API that looks like the rest of the OpenSSL symmetric cipher suite.
 | 
				
			||||||
							
								
								
									
										111
									
								
								crypto/aes/aes.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										111
									
								
								crypto/aes/aes.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,111 @@
 | 
				
			|||||||
 | 
					/* crypto/aes/aes.h -*- mode:C; c-file-style: "eay" -*- */
 | 
				
			||||||
 | 
					/* ====================================================================
 | 
				
			||||||
 | 
					 * Copyright (c) 1998-2002 The OpenSSL Project.  All rights reserved.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Redistribution and use in source and binary forms, with or without
 | 
				
			||||||
 | 
					 * modification, are permitted provided that the following conditions
 | 
				
			||||||
 | 
					 * are met:
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 1. Redistributions of source code must retain the above copyright
 | 
				
			||||||
 | 
					 *    notice, this list of conditions and the following disclaimer. 
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 2. Redistributions in binary form must reproduce the above copyright
 | 
				
			||||||
 | 
					 *    notice, this list of conditions and the following disclaimer in
 | 
				
			||||||
 | 
					 *    the documentation and/or other materials provided with the
 | 
				
			||||||
 | 
					 *    distribution.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 3. All advertising materials mentioning features or use of this
 | 
				
			||||||
 | 
					 *    software must display the following acknowledgment:
 | 
				
			||||||
 | 
					 *    "This product includes software developed by the OpenSSL Project
 | 
				
			||||||
 | 
					 *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
 | 
				
			||||||
 | 
					 *    endorse or promote products derived from this software without
 | 
				
			||||||
 | 
					 *    prior written permission. For written permission, please contact
 | 
				
			||||||
 | 
					 *    openssl-core@openssl.org.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 5. Products derived from this software may not be called "OpenSSL"
 | 
				
			||||||
 | 
					 *    nor may "OpenSSL" appear in their names without prior written
 | 
				
			||||||
 | 
					 *    permission of the OpenSSL Project.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 6. Redistributions of any form whatsoever must retain the following
 | 
				
			||||||
 | 
					 *    acknowledgment:
 | 
				
			||||||
 | 
					 *    "This product includes software developed by the OpenSSL Project
 | 
				
			||||||
 | 
					 *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
 | 
				
			||||||
 | 
					 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 | 
				
			||||||
 | 
					 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 | 
				
			||||||
 | 
					 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
 | 
				
			||||||
 | 
					 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 | 
				
			||||||
 | 
					 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 | 
				
			||||||
 | 
					 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 | 
				
			||||||
 | 
					 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 | 
				
			||||||
 | 
					 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 | 
				
			||||||
 | 
					 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 | 
				
			||||||
 | 
					 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 | 
				
			||||||
 | 
					 * OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
				
			||||||
 | 
					 * ====================================================================
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef HEADER_AES_H
 | 
				
			||||||
 | 
					#define HEADER_AES_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef OPENSSL_NO_AES
 | 
				
			||||||
 | 
					#error AES is disabled.
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static const int AES_DECRYPT = 0;
 | 
				
			||||||
 | 
					static const int AES_ENCRYPT = 1;
 | 
				
			||||||
 | 
					/* Because array size can't be a const in C, the following two are macros.
 | 
				
			||||||
 | 
					   Both sizes are in bytes. */
 | 
				
			||||||
 | 
					#define AES_MAXNR 14
 | 
				
			||||||
 | 
					#define AES_BLOCK_SIZE 16
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef  __cplusplus
 | 
				
			||||||
 | 
					extern "C" {
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* This should be a hidden type, but EVP requires that the size be known */
 | 
				
			||||||
 | 
					struct aes_key_st {
 | 
				
			||||||
 | 
					    unsigned long rd_key[4 *(AES_MAXNR + 1)];
 | 
				
			||||||
 | 
					    int rounds;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					typedef struct aes_key_st AES_KEY;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const char *AES_options(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
 | 
				
			||||||
 | 
						AES_KEY *key);
 | 
				
			||||||
 | 
					int AES_set_decrypt_key(const unsigned char *userKey, const int bits,
 | 
				
			||||||
 | 
						AES_KEY *key);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void AES_encrypt(const unsigned char *in, unsigned char *out,
 | 
				
			||||||
 | 
						const AES_KEY *key);
 | 
				
			||||||
 | 
					void AES_decrypt(const unsigned char *in, unsigned char *out,
 | 
				
			||||||
 | 
						const AES_KEY *key);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void AES_ecb_encrypt(const unsigned char *in, unsigned char *out,
 | 
				
			||||||
 | 
						const AES_KEY *key, const int enc);
 | 
				
			||||||
 | 
					void AES_cbc_encrypt(const unsigned char *in, unsigned char *out,
 | 
				
			||||||
 | 
						const unsigned long length, const AES_KEY *key,
 | 
				
			||||||
 | 
						unsigned char *ivec, const int enc);
 | 
				
			||||||
 | 
					void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out,
 | 
				
			||||||
 | 
						const unsigned long length, const AES_KEY *key,
 | 
				
			||||||
 | 
						unsigned char *ivec, int *num, const int enc);
 | 
				
			||||||
 | 
					void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out,
 | 
				
			||||||
 | 
						const unsigned long length, const AES_KEY *key,
 | 
				
			||||||
 | 
						unsigned char *ivec, int *num);
 | 
				
			||||||
 | 
					void AES_ctr128_encrypt(const unsigned char *in, unsigned char *out,
 | 
				
			||||||
 | 
						const unsigned long length, const AES_KEY *key,
 | 
				
			||||||
 | 
						unsigned char counter[AES_BLOCK_SIZE],
 | 
				
			||||||
 | 
						unsigned char ecount_buf[AES_BLOCK_SIZE],
 | 
				
			||||||
 | 
						unsigned int *num);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef  __cplusplus
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif /* !HEADER_AES_H */
 | 
				
			||||||
							
								
								
									
										111
									
								
								crypto/aes/aes_cbc.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										111
									
								
								crypto/aes/aes_cbc.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,111 @@
 | 
				
			|||||||
 | 
					/* crypto/aes/aes_cbc.c -*- mode:C; c-file-style: "eay" -*- */
 | 
				
			||||||
 | 
					/* ====================================================================
 | 
				
			||||||
 | 
					 * Copyright (c) 1998-2002 The OpenSSL Project.  All rights reserved.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Redistribution and use in source and binary forms, with or without
 | 
				
			||||||
 | 
					 * modification, are permitted provided that the following conditions
 | 
				
			||||||
 | 
					 * are met:
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 1. Redistributions of source code must retain the above copyright
 | 
				
			||||||
 | 
					 *    notice, this list of conditions and the following disclaimer. 
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 2. Redistributions in binary form must reproduce the above copyright
 | 
				
			||||||
 | 
					 *    notice, this list of conditions and the following disclaimer in
 | 
				
			||||||
 | 
					 *    the documentation and/or other materials provided with the
 | 
				
			||||||
 | 
					 *    distribution.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 3. All advertising materials mentioning features or use of this
 | 
				
			||||||
 | 
					 *    software must display the following acknowledgment:
 | 
				
			||||||
 | 
					 *    "This product includes software developed by the OpenSSL Project
 | 
				
			||||||
 | 
					 *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
 | 
				
			||||||
 | 
					 *    endorse or promote products derived from this software without
 | 
				
			||||||
 | 
					 *    prior written permission. For written permission, please contact
 | 
				
			||||||
 | 
					 *    openssl-core@openssl.org.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 5. Products derived from this software may not be called "OpenSSL"
 | 
				
			||||||
 | 
					 *    nor may "OpenSSL" appear in their names without prior written
 | 
				
			||||||
 | 
					 *    permission of the OpenSSL Project.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 6. Redistributions of any form whatsoever must retain the following
 | 
				
			||||||
 | 
					 *    acknowledgment:
 | 
				
			||||||
 | 
					 *    "This product includes software developed by the OpenSSL Project
 | 
				
			||||||
 | 
					 *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
 | 
				
			||||||
 | 
					 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 | 
				
			||||||
 | 
					 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 | 
				
			||||||
 | 
					 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
 | 
				
			||||||
 | 
					 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 | 
				
			||||||
 | 
					 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 | 
				
			||||||
 | 
					 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 | 
				
			||||||
 | 
					 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 | 
				
			||||||
 | 
					 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 | 
				
			||||||
 | 
					 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 | 
				
			||||||
 | 
					 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 | 
				
			||||||
 | 
					 * OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
				
			||||||
 | 
					 * ====================================================================
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef AES_DEBUG
 | 
				
			||||||
 | 
					# ifndef NDEBUG
 | 
				
			||||||
 | 
					#  define NDEBUG
 | 
				
			||||||
 | 
					# endif
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#include <assert.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <openssl/aes.h>
 | 
				
			||||||
 | 
					#include "aes_locl.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void AES_cbc_encrypt(const unsigned char *in, unsigned char *out,
 | 
				
			||||||
 | 
							     const unsigned long length, const AES_KEY *key,
 | 
				
			||||||
 | 
							     unsigned char *ivec, const int enc) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						unsigned long n;
 | 
				
			||||||
 | 
						unsigned long len = length;
 | 
				
			||||||
 | 
						unsigned char tmp[AES_BLOCK_SIZE];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						assert(in && out && key && ivec);
 | 
				
			||||||
 | 
						assert((AES_ENCRYPT == enc)||(AES_DECRYPT == enc));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (AES_ENCRYPT == enc) {
 | 
				
			||||||
 | 
							while (len >= AES_BLOCK_SIZE) {
 | 
				
			||||||
 | 
								for(n=0; n < sizeof tmp; ++n)
 | 
				
			||||||
 | 
									tmp[n] = in[n] ^ ivec[n];
 | 
				
			||||||
 | 
								AES_encrypt(tmp, out, key);
 | 
				
			||||||
 | 
								memcpy(ivec, out, AES_BLOCK_SIZE);
 | 
				
			||||||
 | 
								len -= AES_BLOCK_SIZE;
 | 
				
			||||||
 | 
								in += AES_BLOCK_SIZE;
 | 
				
			||||||
 | 
								out += AES_BLOCK_SIZE;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							if (len) {
 | 
				
			||||||
 | 
								for(n=0; n < len; ++n)
 | 
				
			||||||
 | 
									tmp[n] = in[n] ^ ivec[n];
 | 
				
			||||||
 | 
								for(n=len; n < AES_BLOCK_SIZE; ++n)
 | 
				
			||||||
 | 
									tmp[n] = ivec[n];
 | 
				
			||||||
 | 
								AES_encrypt(tmp, tmp, key);
 | 
				
			||||||
 | 
								memcpy(out, tmp, len);
 | 
				
			||||||
 | 
								memcpy(ivec, tmp, sizeof tmp);
 | 
				
			||||||
 | 
							}			
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
 | 
							while (len >= AES_BLOCK_SIZE) {
 | 
				
			||||||
 | 
								memcpy(tmp, in, sizeof tmp);
 | 
				
			||||||
 | 
								AES_decrypt(in, out, key);
 | 
				
			||||||
 | 
								for(n=0; n < AES_BLOCK_SIZE; ++n)
 | 
				
			||||||
 | 
									out[n] ^= ivec[n];
 | 
				
			||||||
 | 
								memcpy(ivec, tmp, AES_BLOCK_SIZE);
 | 
				
			||||||
 | 
								len -= AES_BLOCK_SIZE;
 | 
				
			||||||
 | 
								in += AES_BLOCK_SIZE;
 | 
				
			||||||
 | 
								out += AES_BLOCK_SIZE;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							if (len) {
 | 
				
			||||||
 | 
								memcpy(tmp, in, sizeof tmp);
 | 
				
			||||||
 | 
								AES_decrypt(tmp, tmp, key);
 | 
				
			||||||
 | 
								for(n=0; n < len; ++n)
 | 
				
			||||||
 | 
									out[n] ^= ivec[n];
 | 
				
			||||||
 | 
								memcpy(ivec, tmp, sizeof tmp);
 | 
				
			||||||
 | 
							}			
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										157
									
								
								crypto/aes/aes_cfb.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										157
									
								
								crypto/aes/aes_cfb.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,157 @@
 | 
				
			|||||||
 | 
					/* crypto/aes/aes_cfb.c -*- mode:C; c-file-style: "eay" -*- */
 | 
				
			||||||
 | 
					/* ====================================================================
 | 
				
			||||||
 | 
					 * Copyright (c) 1998-2002 The OpenSSL Project.  All rights reserved.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Redistribution and use in source and binary forms, with or without
 | 
				
			||||||
 | 
					 * modification, are permitted provided that the following conditions
 | 
				
			||||||
 | 
					 * are met:
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 1. Redistributions of source code must retain the above copyright
 | 
				
			||||||
 | 
					 *    notice, this list of conditions and the following disclaimer. 
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 2. Redistributions in binary form must reproduce the above copyright
 | 
				
			||||||
 | 
					 *    notice, this list of conditions and the following disclaimer in
 | 
				
			||||||
 | 
					 *    the documentation and/or other materials provided with the
 | 
				
			||||||
 | 
					 *    distribution.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 3. All advertising materials mentioning features or use of this
 | 
				
			||||||
 | 
					 *    software must display the following acknowledgment:
 | 
				
			||||||
 | 
					 *    "This product includes software developed by the OpenSSL Project
 | 
				
			||||||
 | 
					 *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
 | 
				
			||||||
 | 
					 *    endorse or promote products derived from this software without
 | 
				
			||||||
 | 
					 *    prior written permission. For written permission, please contact
 | 
				
			||||||
 | 
					 *    openssl-core@openssl.org.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 5. Products derived from this software may not be called "OpenSSL"
 | 
				
			||||||
 | 
					 *    nor may "OpenSSL" appear in their names without prior written
 | 
				
			||||||
 | 
					 *    permission of the OpenSSL Project.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 6. Redistributions of any form whatsoever must retain the following
 | 
				
			||||||
 | 
					 *    acknowledgment:
 | 
				
			||||||
 | 
					 *    "This product includes software developed by the OpenSSL Project
 | 
				
			||||||
 | 
					 *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
 | 
				
			||||||
 | 
					 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 | 
				
			||||||
 | 
					 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 | 
				
			||||||
 | 
					 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
 | 
				
			||||||
 | 
					 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 | 
				
			||||||
 | 
					 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 | 
				
			||||||
 | 
					 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 | 
				
			||||||
 | 
					 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 | 
				
			||||||
 | 
					 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 | 
				
			||||||
 | 
					 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 | 
				
			||||||
 | 
					 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 | 
				
			||||||
 | 
					 * OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
				
			||||||
 | 
					 * ====================================================================
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 | 
				
			||||||
 | 
					 * All rights reserved.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This package is an SSL implementation written
 | 
				
			||||||
 | 
					 * by Eric Young (eay@cryptsoft.com).
 | 
				
			||||||
 | 
					 * The implementation was written so as to conform with Netscapes SSL.
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * This library is free for commercial and non-commercial use as long as
 | 
				
			||||||
 | 
					 * the following conditions are aheared to.  The following conditions
 | 
				
			||||||
 | 
					 * apply to all code found in this distribution, be it the RC4, RSA,
 | 
				
			||||||
 | 
					 * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
 | 
				
			||||||
 | 
					 * included with this distribution is covered by the same copyright terms
 | 
				
			||||||
 | 
					 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * Copyright remains Eric Young's, and as such any Copyright notices in
 | 
				
			||||||
 | 
					 * the code are not to be removed.
 | 
				
			||||||
 | 
					 * If this package is used in a product, Eric Young should be given attribution
 | 
				
			||||||
 | 
					 * as the author of the parts of the library used.
 | 
				
			||||||
 | 
					 * This can be in the form of a textual message at program startup or
 | 
				
			||||||
 | 
					 * in documentation (online or textual) provided with the package.
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * Redistribution and use in source and binary forms, with or without
 | 
				
			||||||
 | 
					 * modification, are permitted provided that the following conditions
 | 
				
			||||||
 | 
					 * are met:
 | 
				
			||||||
 | 
					 * 1. Redistributions of source code must retain the copyright
 | 
				
			||||||
 | 
					 *    notice, this list of conditions and the following disclaimer.
 | 
				
			||||||
 | 
					 * 2. Redistributions in binary form must reproduce the above copyright
 | 
				
			||||||
 | 
					 *    notice, this list of conditions and the following disclaimer in the
 | 
				
			||||||
 | 
					 *    documentation and/or other materials provided with the distribution.
 | 
				
			||||||
 | 
					 * 3. All advertising materials mentioning features or use of this software
 | 
				
			||||||
 | 
					 *    must display the following acknowledgement:
 | 
				
			||||||
 | 
					 *    "This product includes cryptographic software written by
 | 
				
			||||||
 | 
					 *     Eric Young (eay@cryptsoft.com)"
 | 
				
			||||||
 | 
					 *    The word 'cryptographic' can be left out if the rouines from the library
 | 
				
			||||||
 | 
					 *    being used are not cryptographic related :-).
 | 
				
			||||||
 | 
					 * 4. If you include any Windows specific code (or a derivative thereof) from 
 | 
				
			||||||
 | 
					 *    the apps directory (application code) you must include an acknowledgement:
 | 
				
			||||||
 | 
					 *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
 | 
				
			||||||
 | 
					 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 | 
				
			||||||
 | 
					 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 | 
				
			||||||
 | 
					 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 | 
				
			||||||
 | 
					 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 | 
				
			||||||
 | 
					 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 | 
				
			||||||
 | 
					 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 | 
				
			||||||
 | 
					 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 | 
				
			||||||
 | 
					 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 | 
				
			||||||
 | 
					 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 | 
				
			||||||
 | 
					 * SUCH DAMAGE.
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * The licence and distribution terms for any publically available version or
 | 
				
			||||||
 | 
					 * derivative of this code cannot be changed.  i.e. this code cannot simply be
 | 
				
			||||||
 | 
					 * copied and put under another distribution licence
 | 
				
			||||||
 | 
					 * [including the GNU Public Licence.]
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef AES_DEBUG
 | 
				
			||||||
 | 
					# ifndef NDEBUG
 | 
				
			||||||
 | 
					#  define NDEBUG
 | 
				
			||||||
 | 
					# endif
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#include <assert.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <openssl/aes.h>
 | 
				
			||||||
 | 
					#include "aes_locl.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* The input and output encrypted as though 128bit cfb mode is being
 | 
				
			||||||
 | 
					 * used.  The extra state information to record how much of the
 | 
				
			||||||
 | 
					 * 128bit block we have used is contained in *num;
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out,
 | 
				
			||||||
 | 
						const unsigned long length, const AES_KEY *key,
 | 
				
			||||||
 | 
						unsigned char *ivec, int *num, const int enc) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						unsigned int n;
 | 
				
			||||||
 | 
						unsigned long l = length;
 | 
				
			||||||
 | 
						unsigned char c;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						assert(in && out && key && ivec && num);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						n = *num;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (enc) {
 | 
				
			||||||
 | 
							while (l--) {
 | 
				
			||||||
 | 
								if (n == 0) {
 | 
				
			||||||
 | 
									AES_encrypt(ivec, ivec, key);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								ivec[n] = *(out++) = *(in++) ^ ivec[n];
 | 
				
			||||||
 | 
								n = (n+1) % AES_BLOCK_SIZE;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
 | 
							while (l--) {
 | 
				
			||||||
 | 
								if (n == 0) {
 | 
				
			||||||
 | 
									AES_encrypt(ivec, ivec, key);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								c = *(in);
 | 
				
			||||||
 | 
								*(out++) = *(in++) ^ ivec[n];
 | 
				
			||||||
 | 
								ivec[n] = c;
 | 
				
			||||||
 | 
								n = (n+1) % AES_BLOCK_SIZE;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						*num=n;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										421
									
								
								crypto/rijndael/rd_fst.c → crypto/aes/aes_core.c
									
									
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										421
									
								
								crypto/rijndael/rd_fst.c → crypto/aes/aes_core.c
									
									
									
									
									
										
										
										Executable file → Normal file
									
								
							@@ -1,3 +1,4 @@
 | 
				
			|||||||
 | 
					/* crypto/aes/aes_core.c -*- mode:C; c-file-style: "eay" -*- */
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * rijndael-alg-fst.c
 | 
					 * rijndael-alg-fst.c
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
@@ -23,10 +24,20 @@
 | 
				
			|||||||
 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 | 
					 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 | 
				
			||||||
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
					 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
#include <assert.h>
 | 
					 | 
				
			||||||
#include <stdlib.h>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "rd_fst.h"
 | 
					/* Note: rewritten a little bit to provide error control and an OpenSSL-
 | 
				
			||||||
 | 
					   compatible API */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef AES_DEBUG
 | 
				
			||||||
 | 
					# ifndef NDEBUG
 | 
				
			||||||
 | 
					#  define NDEBUG
 | 
				
			||||||
 | 
					# endif
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#include <assert.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <stdlib.h>
 | 
				
			||||||
 | 
					#include <openssl/aes.h>
 | 
				
			||||||
 | 
					#include "aes_locl.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
Te0[x] = S [x].[02, 01, 01, 03];
 | 
					Te0[x] = S [x].[02, 01, 01, 03];
 | 
				
			||||||
@@ -710,30 +721,35 @@ static const u32 rcon[] = {
 | 
				
			|||||||
	0x1B000000, 0x36000000, /* for 128-bit blocks, Rijndael never uses more than 10 rcon values */
 | 
						0x1B000000, 0x36000000, /* for 128-bit blocks, Rijndael never uses more than 10 rcon values */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define SWAP(x) (_lrotl(x, 8) & 0x00ff00ff | _lrotr(x, 8) & 0xff00ff00)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#ifdef _MSC_VER
 | 
					 | 
				
			||||||
#define GETU32(p) SWAP(*((u32 *)(p)))
 | 
					 | 
				
			||||||
#define PUTU32(ct, st) { *((u32 *)(ct)) = SWAP((st)); }
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
#define GETU32(pt) (((u32)(pt)[0] << 24) ^ ((u32)(pt)[1] << 16) ^ ((u32)(pt)[2] <<  8) ^ ((u32)(pt)[3]))
 | 
					 | 
				
			||||||
#define PUTU32(ct, st) { (ct)[0] = (u8)((st) >> 24); (ct)[1] = (u8)((st) >> 16); (ct)[2] = (u8)((st) >>  8); (ct)[3] = (u8)(st); }
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Expand the cipher key into the encryption key schedule.
 | 
					 * Expand the cipher key into the encryption key schedule.
 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @return	the number of rounds for the given cipher key size.
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
int rijndaelKeySetupEnc(u32 rk[/*4*(Nr + 1)*/], const u8 cipherKey[], int keyBits) {
 | 
					int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
 | 
				
			||||||
 | 
								AES_KEY *key) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						u32 *rk;
 | 
				
			||||||
   	int i = 0;
 | 
					   	int i = 0;
 | 
				
			||||||
	u32 temp;
 | 
						u32 temp;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	rk[0] = GETU32(cipherKey     );
 | 
						if (!userKey || !key)
 | 
				
			||||||
	rk[1] = GETU32(cipherKey +  4);
 | 
							return -1;
 | 
				
			||||||
	rk[2] = GETU32(cipherKey +  8);
 | 
						if (bits != 128 && bits != 192 && bits != 256)
 | 
				
			||||||
	rk[3] = GETU32(cipherKey + 12);
 | 
							return -2;
 | 
				
			||||||
	if (keyBits == 128) {
 | 
					
 | 
				
			||||||
 | 
						rk = key->rd_key;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (bits==128)
 | 
				
			||||||
 | 
							key->rounds = 10;
 | 
				
			||||||
 | 
						else if (bits==192)
 | 
				
			||||||
 | 
							key->rounds = 12;
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
							key->rounds = 14;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						rk[0] = GETU32(userKey     );
 | 
				
			||||||
 | 
						rk[1] = GETU32(userKey +  4);
 | 
				
			||||||
 | 
						rk[2] = GETU32(userKey +  8);
 | 
				
			||||||
 | 
						rk[3] = GETU32(userKey + 12);
 | 
				
			||||||
 | 
						if (bits == 128) {
 | 
				
			||||||
		for (;;) {
 | 
							for (;;) {
 | 
				
			||||||
			temp  = rk[3];
 | 
								temp  = rk[3];
 | 
				
			||||||
			rk[4] = rk[0] ^
 | 
								rk[4] = rk[0] ^
 | 
				
			||||||
@@ -746,14 +762,14 @@ int rijndaelKeySetupEnc(u32 rk[/*4*(Nr + 1)*/], const u8 cipherKey[], int keyBit
 | 
				
			|||||||
			rk[6] = rk[2] ^ rk[5];
 | 
								rk[6] = rk[2] ^ rk[5];
 | 
				
			||||||
			rk[7] = rk[3] ^ rk[6];
 | 
								rk[7] = rk[3] ^ rk[6];
 | 
				
			||||||
			if (++i == 10) {
 | 
								if (++i == 10) {
 | 
				
			||||||
				return 10;
 | 
									return 0;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			rk += 4;
 | 
								rk += 4;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	rk[4] = GETU32(cipherKey + 16);
 | 
						rk[4] = GETU32(userKey + 16);
 | 
				
			||||||
	rk[5] = GETU32(cipherKey + 20);
 | 
						rk[5] = GETU32(userKey + 20);
 | 
				
			||||||
	if (keyBits == 192) {
 | 
						if (bits == 192) {
 | 
				
			||||||
		for (;;) {
 | 
							for (;;) {
 | 
				
			||||||
			temp = rk[ 5];
 | 
								temp = rk[ 5];
 | 
				
			||||||
			rk[ 6] = rk[ 0] ^
 | 
								rk[ 6] = rk[ 0] ^
 | 
				
			||||||
@@ -766,66 +782,72 @@ int rijndaelKeySetupEnc(u32 rk[/*4*(Nr + 1)*/], const u8 cipherKey[], int keyBit
 | 
				
			|||||||
			rk[ 8] = rk[ 2] ^ rk[ 7];
 | 
								rk[ 8] = rk[ 2] ^ rk[ 7];
 | 
				
			||||||
			rk[ 9] = rk[ 3] ^ rk[ 8];
 | 
								rk[ 9] = rk[ 3] ^ rk[ 8];
 | 
				
			||||||
			if (++i == 8) {
 | 
								if (++i == 8) {
 | 
				
			||||||
				return 12;
 | 
									return 0;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			rk[10] = rk[ 4] ^ rk[ 9];
 | 
								rk[10] = rk[ 4] ^ rk[ 9];
 | 
				
			||||||
			rk[11] = rk[ 5] ^ rk[10];
 | 
								rk[11] = rk[ 5] ^ rk[10];
 | 
				
			||||||
			rk += 6;
 | 
								rk += 6;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	rk[6] = GETU32(cipherKey + 24);
 | 
						rk[6] = GETU32(userKey + 24);
 | 
				
			||||||
	rk[7] = GETU32(cipherKey + 28);
 | 
						rk[7] = GETU32(userKey + 28);
 | 
				
			||||||
	if (keyBits == 256) {
 | 
						if (bits == 256) {
 | 
				
			||||||
        for (;;) {
 | 
							for (;;) {
 | 
				
			||||||
        	temp = rk[ 7];
 | 
								temp = rk[ 7];
 | 
				
			||||||
        	rk[ 8] = rk[ 0] ^
 | 
								rk[ 8] = rk[ 0] ^
 | 
				
			||||||
        		(Te4[(temp >> 16) & 0xff] & 0xff000000) ^
 | 
									(Te4[(temp >> 16) & 0xff] & 0xff000000) ^
 | 
				
			||||||
        		(Te4[(temp >>  8) & 0xff] & 0x00ff0000) ^
 | 
									(Te4[(temp >>  8) & 0xff] & 0x00ff0000) ^
 | 
				
			||||||
        		(Te4[(temp      ) & 0xff] & 0x0000ff00) ^
 | 
									(Te4[(temp      ) & 0xff] & 0x0000ff00) ^
 | 
				
			||||||
        		(Te4[(temp >> 24)       ] & 0x000000ff) ^
 | 
									(Te4[(temp >> 24)       ] & 0x000000ff) ^
 | 
				
			||||||
        		rcon[i];
 | 
									rcon[i];
 | 
				
			||||||
        	rk[ 9] = rk[ 1] ^ rk[ 8];
 | 
								rk[ 9] = rk[ 1] ^ rk[ 8];
 | 
				
			||||||
        	rk[10] = rk[ 2] ^ rk[ 9];
 | 
								rk[10] = rk[ 2] ^ rk[ 9];
 | 
				
			||||||
        	rk[11] = rk[ 3] ^ rk[10];
 | 
								rk[11] = rk[ 3] ^ rk[10];
 | 
				
			||||||
			if (++i == 7) {
 | 
								if (++i == 7) {
 | 
				
			||||||
				return 14;
 | 
									return 0;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
        	temp = rk[11];
 | 
								temp = rk[11];
 | 
				
			||||||
        	rk[12] = rk[ 4] ^
 | 
								rk[12] = rk[ 4] ^
 | 
				
			||||||
        		(Te4[(temp >> 24)       ] & 0xff000000) ^
 | 
									(Te4[(temp >> 24)       ] & 0xff000000) ^
 | 
				
			||||||
        		(Te4[(temp >> 16) & 0xff] & 0x00ff0000) ^
 | 
									(Te4[(temp >> 16) & 0xff] & 0x00ff0000) ^
 | 
				
			||||||
        		(Te4[(temp >>  8) & 0xff] & 0x0000ff00) ^
 | 
									(Te4[(temp >>  8) & 0xff] & 0x0000ff00) ^
 | 
				
			||||||
        		(Te4[(temp      ) & 0xff] & 0x000000ff);
 | 
									(Te4[(temp      ) & 0xff] & 0x000000ff);
 | 
				
			||||||
        	rk[13] = rk[ 5] ^ rk[12];
 | 
								rk[13] = rk[ 5] ^ rk[12];
 | 
				
			||||||
        	rk[14] = rk[ 6] ^ rk[13];
 | 
								rk[14] = rk[ 6] ^ rk[13];
 | 
				
			||||||
        	rk[15] = rk[ 7] ^ rk[14];
 | 
								rk[15] = rk[ 7] ^ rk[14];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			rk += 8;
 | 
								rk += 8;
 | 
				
			||||||
        }
 | 
					        	}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Expand the cipher key into the decryption key schedule.
 | 
					 * Expand the cipher key into the decryption key schedule.
 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @return	the number of rounds for the given cipher key size.
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
int rijndaelKeySetupDec(u32 rk[/*4*(Nr + 1)*/], const u8 cipherKey[], int keyBits) {
 | 
					int AES_set_decrypt_key(const unsigned char *userKey, const int bits,
 | 
				
			||||||
	int Nr, i, j;
 | 
								 AES_KEY *key) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        u32 *rk;
 | 
				
			||||||
 | 
						int i, j, status;
 | 
				
			||||||
	u32 temp;
 | 
						u32 temp;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* expand the cipher key: */
 | 
						/* first, start with an encryption schedule */
 | 
				
			||||||
	Nr = rijndaelKeySetupEnc(rk, cipherKey, keyBits);
 | 
						status = AES_set_encrypt_key(userKey, bits, key);
 | 
				
			||||||
 | 
						if (status < 0)
 | 
				
			||||||
 | 
							return status;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						rk = key->rd_key;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* invert the order of the round keys: */
 | 
						/* invert the order of the round keys: */
 | 
				
			||||||
	for (i = 0, j = 4*Nr; i < j; i += 4, j -= 4) {
 | 
						for (i = 0, j = 4*(key->rounds); i < j; i += 4, j -= 4) {
 | 
				
			||||||
		temp = rk[i    ]; rk[i    ] = rk[j    ]; rk[j    ] = temp;
 | 
							temp = rk[i    ]; rk[i    ] = rk[j    ]; rk[j    ] = temp;
 | 
				
			||||||
		temp = rk[i + 1]; rk[i + 1] = rk[j + 1]; rk[j + 1] = temp;
 | 
							temp = rk[i + 1]; rk[i + 1] = rk[j + 1]; rk[j + 1] = temp;
 | 
				
			||||||
		temp = rk[i + 2]; rk[i + 2] = rk[j + 2]; rk[j + 2] = temp;
 | 
							temp = rk[i + 2]; rk[i + 2] = rk[j + 2]; rk[j + 2] = temp;
 | 
				
			||||||
		temp = rk[i + 3]; rk[i + 3] = rk[j + 3]; rk[j + 3] = temp;
 | 
							temp = rk[i + 3]; rk[i + 3] = rk[j + 3]; rk[j + 3] = temp;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	/* apply the inverse MixColumn transform to all round keys but the first and the last: */
 | 
						/* apply the inverse MixColumn transform to all round keys but the first and the last: */
 | 
				
			||||||
	for (i = 1; i < Nr; i++) {
 | 
						for (i = 1; i < (key->rounds); i++) {
 | 
				
			||||||
		rk += 4;
 | 
							rk += 4;
 | 
				
			||||||
		rk[0] =
 | 
							rk[0] =
 | 
				
			||||||
			Td0[Te4[(rk[0] >> 24)       ] & 0xff] ^
 | 
								Td0[Te4[(rk[0] >> 24)       ] & 0xff] ^
 | 
				
			||||||
@@ -848,25 +870,35 @@ int rijndaelKeySetupDec(u32 rk[/*4*(Nr + 1)*/], const u8 cipherKey[], int keyBit
 | 
				
			|||||||
			Td2[Te4[(rk[3] >>  8) & 0xff] & 0xff] ^
 | 
								Td2[Te4[(rk[3] >>  8) & 0xff] & 0xff] ^
 | 
				
			||||||
			Td3[Te4[(rk[3]      ) & 0xff] & 0xff];
 | 
								Td3[Te4[(rk[3]      ) & 0xff] & 0xff];
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return Nr;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void rijndaelEncrypt(const u32 rk[/*4*(Nr + 1)*/], int Nr, const u8 pt[16], u8 ct[16]) {
 | 
					/*
 | 
				
			||||||
 | 
					 * Encrypt a single block
 | 
				
			||||||
 | 
					 * in and out can overlap
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					void AES_encrypt(const unsigned char *in, unsigned char *out,
 | 
				
			||||||
 | 
							 const AES_KEY *key) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						const u32 *rk;
 | 
				
			||||||
	u32 s0, s1, s2, s3, t0, t1, t2, t3;
 | 
						u32 s0, s1, s2, s3, t0, t1, t2, t3;
 | 
				
			||||||
#ifndef FULL_UNROLL
 | 
					#ifndef FULL_UNROLL
 | 
				
			||||||
    int r;
 | 
						int r;
 | 
				
			||||||
#endif /* ?FULL_UNROLL */
 | 
					#endif /* ?FULL_UNROLL */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /*
 | 
						assert(in && out && key);
 | 
				
			||||||
 | 
						rk = key->rd_key;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/*
 | 
				
			||||||
	 * map byte array block to cipher state
 | 
						 * map byte array block to cipher state
 | 
				
			||||||
	 * and add initial round key:
 | 
						 * and add initial round key:
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	s0 = GETU32(pt     ) ^ rk[0];
 | 
						s0 = GETU32(in     ) ^ rk[0];
 | 
				
			||||||
	s1 = GETU32(pt +  4) ^ rk[1];
 | 
						s1 = GETU32(in +  4) ^ rk[1];
 | 
				
			||||||
	s2 = GETU32(pt +  8) ^ rk[2];
 | 
						s2 = GETU32(in +  8) ^ rk[2];
 | 
				
			||||||
	s3 = GETU32(pt + 12) ^ rk[3];
 | 
						s3 = GETU32(in + 12) ^ rk[3];
 | 
				
			||||||
#ifdef FULL_UNROLL
 | 
					#ifdef FULL_UNROLL
 | 
				
			||||||
    /* round 1: */
 | 
						/* round 1: */
 | 
				
			||||||
   	t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[ 4];
 | 
					   	t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[ 4];
 | 
				
			||||||
   	t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[ 5];
 | 
					   	t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[ 5];
 | 
				
			||||||
   	t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[ 6];
 | 
					   	t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[ 6];
 | 
				
			||||||
@@ -876,7 +908,7 @@ void rijndaelEncrypt(const u32 rk[/*4*(Nr + 1)*/], int Nr, const u8 pt[16], u8 c
 | 
				
			|||||||
   	s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[ 9];
 | 
					   	s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[ 9];
 | 
				
			||||||
   	s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >>  8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[10];
 | 
					   	s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >>  8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[10];
 | 
				
			||||||
   	s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >>  8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[11];
 | 
					   	s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >>  8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[11];
 | 
				
			||||||
    /* round 3: */
 | 
						/* round 3: */
 | 
				
			||||||
   	t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[12];
 | 
					   	t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[12];
 | 
				
			||||||
   	t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[13];
 | 
					   	t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[13];
 | 
				
			||||||
   	t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[14];
 | 
					   	t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[14];
 | 
				
			||||||
@@ -886,7 +918,7 @@ void rijndaelEncrypt(const u32 rk[/*4*(Nr + 1)*/], int Nr, const u8 pt[16], u8 c
 | 
				
			|||||||
   	s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[17];
 | 
					   	s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[17];
 | 
				
			||||||
   	s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >>  8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[18];
 | 
					   	s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >>  8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[18];
 | 
				
			||||||
   	s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >>  8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[19];
 | 
					   	s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >>  8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[19];
 | 
				
			||||||
    /* round 5: */
 | 
						/* round 5: */
 | 
				
			||||||
   	t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[20];
 | 
					   	t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[20];
 | 
				
			||||||
   	t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[21];
 | 
					   	t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[21];
 | 
				
			||||||
   	t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[22];
 | 
					   	t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[22];
 | 
				
			||||||
@@ -896,7 +928,7 @@ void rijndaelEncrypt(const u32 rk[/*4*(Nr + 1)*/], int Nr, const u8 pt[16], u8 c
 | 
				
			|||||||
   	s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[25];
 | 
					   	s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[25];
 | 
				
			||||||
   	s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >>  8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[26];
 | 
					   	s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >>  8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[26];
 | 
				
			||||||
   	s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >>  8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[27];
 | 
					   	s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >>  8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[27];
 | 
				
			||||||
    /* round 7: */
 | 
						/* round 7: */
 | 
				
			||||||
   	t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[28];
 | 
					   	t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[28];
 | 
				
			||||||
   	t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[29];
 | 
					   	t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[29];
 | 
				
			||||||
   	t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[30];
 | 
					   	t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[30];
 | 
				
			||||||
@@ -906,12 +938,12 @@ void rijndaelEncrypt(const u32 rk[/*4*(Nr + 1)*/], int Nr, const u8 pt[16], u8 c
 | 
				
			|||||||
   	s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[33];
 | 
					   	s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[33];
 | 
				
			||||||
   	s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >>  8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[34];
 | 
					   	s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >>  8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[34];
 | 
				
			||||||
   	s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >>  8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[35];
 | 
					   	s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >>  8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[35];
 | 
				
			||||||
    /* round 9: */
 | 
						/* round 9: */
 | 
				
			||||||
   	t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[36];
 | 
					   	t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[36];
 | 
				
			||||||
   	t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[37];
 | 
					   	t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[37];
 | 
				
			||||||
   	t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[38];
 | 
					   	t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[38];
 | 
				
			||||||
   	t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[39];
 | 
					   	t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[39];
 | 
				
			||||||
    if (Nr > 10) {
 | 
					    if (key->rounds > 10) {
 | 
				
			||||||
        /* round 10: */
 | 
					        /* round 10: */
 | 
				
			||||||
        s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >>  8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[40];
 | 
					        s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >>  8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[40];
 | 
				
			||||||
        s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[41];
 | 
					        s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[41];
 | 
				
			||||||
@@ -922,7 +954,7 @@ void rijndaelEncrypt(const u32 rk[/*4*(Nr + 1)*/], int Nr, const u8 pt[16], u8 c
 | 
				
			|||||||
        t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[45];
 | 
					        t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[45];
 | 
				
			||||||
        t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[46];
 | 
					        t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[46];
 | 
				
			||||||
        t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[47];
 | 
					        t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[47];
 | 
				
			||||||
        if (Nr > 12) {
 | 
					        if (key->rounds > 12) {
 | 
				
			||||||
            /* round 12: */
 | 
					            /* round 12: */
 | 
				
			||||||
            s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >>  8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[48];
 | 
					            s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >>  8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[48];
 | 
				
			||||||
            s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[49];
 | 
					            s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[49];
 | 
				
			||||||
@@ -935,12 +967,12 @@ void rijndaelEncrypt(const u32 rk[/*4*(Nr + 1)*/], int Nr, const u8 pt[16], u8 c
 | 
				
			|||||||
            t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[55];
 | 
					            t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[55];
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    rk += Nr << 2;
 | 
					    rk += key->rounds << 2;
 | 
				
			||||||
#else  /* !FULL_UNROLL */
 | 
					#else  /* !FULL_UNROLL */
 | 
				
			||||||
    /*
 | 
					    /*
 | 
				
			||||||
	 * Nr - 1 full rounds:
 | 
					     * Nr - 1 full rounds:
 | 
				
			||||||
	 */
 | 
					     */
 | 
				
			||||||
    r = Nr >> 1;
 | 
					    r = key->rounds >> 1;
 | 
				
			||||||
    for (;;) {
 | 
					    for (;;) {
 | 
				
			||||||
        t0 =
 | 
					        t0 =
 | 
				
			||||||
            Te0[(s0 >> 24)       ] ^
 | 
					            Te0[(s0 >> 24)       ] ^
 | 
				
			||||||
@@ -1008,44 +1040,54 @@ void rijndaelEncrypt(const u32 rk[/*4*(Nr + 1)*/], int Nr, const u8 pt[16], u8 c
 | 
				
			|||||||
		(Te4[(t2 >>  8) & 0xff] & 0x0000ff00) ^
 | 
							(Te4[(t2 >>  8) & 0xff] & 0x0000ff00) ^
 | 
				
			||||||
		(Te4[(t3      ) & 0xff] & 0x000000ff) ^
 | 
							(Te4[(t3      ) & 0xff] & 0x000000ff) ^
 | 
				
			||||||
		rk[0];
 | 
							rk[0];
 | 
				
			||||||
	PUTU32(ct     , s0);
 | 
						PUTU32(out     , s0);
 | 
				
			||||||
	s1 =
 | 
						s1 =
 | 
				
			||||||
		(Te4[(t1 >> 24)       ] & 0xff000000) ^
 | 
							(Te4[(t1 >> 24)       ] & 0xff000000) ^
 | 
				
			||||||
		(Te4[(t2 >> 16) & 0xff] & 0x00ff0000) ^
 | 
							(Te4[(t2 >> 16) & 0xff] & 0x00ff0000) ^
 | 
				
			||||||
		(Te4[(t3 >>  8) & 0xff] & 0x0000ff00) ^
 | 
							(Te4[(t3 >>  8) & 0xff] & 0x0000ff00) ^
 | 
				
			||||||
		(Te4[(t0      ) & 0xff] & 0x000000ff) ^
 | 
							(Te4[(t0      ) & 0xff] & 0x000000ff) ^
 | 
				
			||||||
		rk[1];
 | 
							rk[1];
 | 
				
			||||||
	PUTU32(ct +  4, s1);
 | 
						PUTU32(out +  4, s1);
 | 
				
			||||||
	s2 =
 | 
						s2 =
 | 
				
			||||||
		(Te4[(t2 >> 24)       ] & 0xff000000) ^
 | 
							(Te4[(t2 >> 24)       ] & 0xff000000) ^
 | 
				
			||||||
		(Te4[(t3 >> 16) & 0xff] & 0x00ff0000) ^
 | 
							(Te4[(t3 >> 16) & 0xff] & 0x00ff0000) ^
 | 
				
			||||||
		(Te4[(t0 >>  8) & 0xff] & 0x0000ff00) ^
 | 
							(Te4[(t0 >>  8) & 0xff] & 0x0000ff00) ^
 | 
				
			||||||
		(Te4[(t1      ) & 0xff] & 0x000000ff) ^
 | 
							(Te4[(t1      ) & 0xff] & 0x000000ff) ^
 | 
				
			||||||
		rk[2];
 | 
							rk[2];
 | 
				
			||||||
	PUTU32(ct +  8, s2);
 | 
						PUTU32(out +  8, s2);
 | 
				
			||||||
	s3 =
 | 
						s3 =
 | 
				
			||||||
		(Te4[(t3 >> 24)       ] & 0xff000000) ^
 | 
							(Te4[(t3 >> 24)       ] & 0xff000000) ^
 | 
				
			||||||
		(Te4[(t0 >> 16) & 0xff] & 0x00ff0000) ^
 | 
							(Te4[(t0 >> 16) & 0xff] & 0x00ff0000) ^
 | 
				
			||||||
		(Te4[(t1 >>  8) & 0xff] & 0x0000ff00) ^
 | 
							(Te4[(t1 >>  8) & 0xff] & 0x0000ff00) ^
 | 
				
			||||||
		(Te4[(t2      ) & 0xff] & 0x000000ff) ^
 | 
							(Te4[(t2      ) & 0xff] & 0x000000ff) ^
 | 
				
			||||||
		rk[3];
 | 
							rk[3];
 | 
				
			||||||
	PUTU32(ct + 12, s3);
 | 
						PUTU32(out + 12, s3);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void rijndaelDecrypt(const u32 rk[/*4*(Nr + 1)*/], int Nr, const u8 ct[16], u8 pt[16]) {
 | 
					/*
 | 
				
			||||||
 | 
					 * Decrypt a single block
 | 
				
			||||||
 | 
					 * in and out can overlap
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					void AES_decrypt(const unsigned char *in, unsigned char *out,
 | 
				
			||||||
 | 
							 const AES_KEY *key) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						const u32 *rk;
 | 
				
			||||||
	u32 s0, s1, s2, s3, t0, t1, t2, t3;
 | 
						u32 s0, s1, s2, s3, t0, t1, t2, t3;
 | 
				
			||||||
#ifndef FULL_UNROLL
 | 
					#ifndef FULL_UNROLL
 | 
				
			||||||
    int r;
 | 
						int r;
 | 
				
			||||||
#endif /* ?FULL_UNROLL */
 | 
					#endif /* ?FULL_UNROLL */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /*
 | 
						assert(in && out && key);
 | 
				
			||||||
 | 
						rk = key->rd_key;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/*
 | 
				
			||||||
	 * map byte array block to cipher state
 | 
						 * map byte array block to cipher state
 | 
				
			||||||
	 * and add initial round key:
 | 
						 * and add initial round key:
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
    s0 = GETU32(ct     ) ^ rk[0];
 | 
					    s0 = GETU32(in     ) ^ rk[0];
 | 
				
			||||||
    s1 = GETU32(ct +  4) ^ rk[1];
 | 
					    s1 = GETU32(in +  4) ^ rk[1];
 | 
				
			||||||
    s2 = GETU32(ct +  8) ^ rk[2];
 | 
					    s2 = GETU32(in +  8) ^ rk[2];
 | 
				
			||||||
    s3 = GETU32(ct + 12) ^ rk[3];
 | 
					    s3 = GETU32(in + 12) ^ rk[3];
 | 
				
			||||||
#ifdef FULL_UNROLL
 | 
					#ifdef FULL_UNROLL
 | 
				
			||||||
    /* round 1: */
 | 
					    /* round 1: */
 | 
				
			||||||
    t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >>  8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[ 4];
 | 
					    t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >>  8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[ 4];
 | 
				
			||||||
@@ -1092,7 +1134,7 @@ void rijndaelDecrypt(const u32 rk[/*4*(Nr + 1)*/], int Nr, const u8 ct[16], u8 p
 | 
				
			|||||||
    t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[37];
 | 
					    t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[37];
 | 
				
			||||||
    t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[38];
 | 
					    t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[38];
 | 
				
			||||||
    t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[39];
 | 
					    t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[39];
 | 
				
			||||||
    if (Nr > 10) {
 | 
					    if (key->rounds > 10) {
 | 
				
			||||||
        /* round 10: */
 | 
					        /* round 10: */
 | 
				
			||||||
        s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >>  8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[40];
 | 
					        s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >>  8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[40];
 | 
				
			||||||
        s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >>  8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[41];
 | 
					        s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >>  8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[41];
 | 
				
			||||||
@@ -1103,7 +1145,7 @@ void rijndaelDecrypt(const u32 rk[/*4*(Nr + 1)*/], int Nr, const u8 ct[16], u8 p
 | 
				
			|||||||
        t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[45];
 | 
					        t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[45];
 | 
				
			||||||
        t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[46];
 | 
					        t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[46];
 | 
				
			||||||
        t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[47];
 | 
					        t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[47];
 | 
				
			||||||
        if (Nr > 12) {
 | 
					        if (key->rounds > 12) {
 | 
				
			||||||
            /* round 12: */
 | 
					            /* round 12: */
 | 
				
			||||||
            s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >>  8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[48];
 | 
					            s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >>  8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[48];
 | 
				
			||||||
            s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >>  8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[49];
 | 
					            s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >>  8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[49];
 | 
				
			||||||
@@ -1116,12 +1158,12 @@ void rijndaelDecrypt(const u32 rk[/*4*(Nr + 1)*/], int Nr, const u8 ct[16], u8 p
 | 
				
			|||||||
            t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[55];
 | 
					            t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[55];
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
	rk += Nr << 2;
 | 
						rk += key->rounds << 2;
 | 
				
			||||||
#else  /* !FULL_UNROLL */
 | 
					#else  /* !FULL_UNROLL */
 | 
				
			||||||
    /*
 | 
					    /*
 | 
				
			||||||
     * Nr - 1 full rounds:
 | 
					     * Nr - 1 full rounds:
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    r = Nr >> 1;
 | 
					    r = key->rounds >> 1;
 | 
				
			||||||
    for (;;) {
 | 
					    for (;;) {
 | 
				
			||||||
        t0 =
 | 
					        t0 =
 | 
				
			||||||
            Td0[(s0 >> 24)       ] ^
 | 
					            Td0[(s0 >> 24)       ] ^
 | 
				
			||||||
@@ -1189,212 +1231,27 @@ void rijndaelDecrypt(const u32 rk[/*4*(Nr + 1)*/], int Nr, const u8 ct[16], u8 p
 | 
				
			|||||||
   		(Td4[(t2 >>  8) & 0xff] & 0x0000ff00) ^
 | 
					   		(Td4[(t2 >>  8) & 0xff] & 0x0000ff00) ^
 | 
				
			||||||
   		(Td4[(t1      ) & 0xff] & 0x000000ff) ^
 | 
					   		(Td4[(t1      ) & 0xff] & 0x000000ff) ^
 | 
				
			||||||
   		rk[0];
 | 
					   		rk[0];
 | 
				
			||||||
	PUTU32(pt     , s0);
 | 
						PUTU32(out     , s0);
 | 
				
			||||||
   	s1 =
 | 
					   	s1 =
 | 
				
			||||||
   		(Td4[(t1 >> 24)       ] & 0xff000000) ^
 | 
					   		(Td4[(t1 >> 24)       ] & 0xff000000) ^
 | 
				
			||||||
   		(Td4[(t0 >> 16) & 0xff] & 0x00ff0000) ^
 | 
					   		(Td4[(t0 >> 16) & 0xff] & 0x00ff0000) ^
 | 
				
			||||||
   		(Td4[(t3 >>  8) & 0xff] & 0x0000ff00) ^
 | 
					   		(Td4[(t3 >>  8) & 0xff] & 0x0000ff00) ^
 | 
				
			||||||
   		(Td4[(t2      ) & 0xff] & 0x000000ff) ^
 | 
					   		(Td4[(t2      ) & 0xff] & 0x000000ff) ^
 | 
				
			||||||
   		rk[1];
 | 
					   		rk[1];
 | 
				
			||||||
	PUTU32(pt +  4, s1);
 | 
						PUTU32(out +  4, s1);
 | 
				
			||||||
   	s2 =
 | 
					   	s2 =
 | 
				
			||||||
   		(Td4[(t2 >> 24)       ] & 0xff000000) ^
 | 
					   		(Td4[(t2 >> 24)       ] & 0xff000000) ^
 | 
				
			||||||
   		(Td4[(t1 >> 16) & 0xff] & 0x00ff0000) ^
 | 
					   		(Td4[(t1 >> 16) & 0xff] & 0x00ff0000) ^
 | 
				
			||||||
   		(Td4[(t0 >>  8) & 0xff] & 0x0000ff00) ^
 | 
					   		(Td4[(t0 >>  8) & 0xff] & 0x0000ff00) ^
 | 
				
			||||||
   		(Td4[(t3      ) & 0xff] & 0x000000ff) ^
 | 
					   		(Td4[(t3      ) & 0xff] & 0x000000ff) ^
 | 
				
			||||||
   		rk[2];
 | 
					   		rk[2];
 | 
				
			||||||
	PUTU32(pt +  8, s2);
 | 
						PUTU32(out +  8, s2);
 | 
				
			||||||
   	s3 =
 | 
					   	s3 =
 | 
				
			||||||
   		(Td4[(t3 >> 24)       ] & 0xff000000) ^
 | 
					   		(Td4[(t3 >> 24)       ] & 0xff000000) ^
 | 
				
			||||||
   		(Td4[(t2 >> 16) & 0xff] & 0x00ff0000) ^
 | 
					   		(Td4[(t2 >> 16) & 0xff] & 0x00ff0000) ^
 | 
				
			||||||
   		(Td4[(t1 >>  8) & 0xff] & 0x0000ff00) ^
 | 
					   		(Td4[(t1 >>  8) & 0xff] & 0x0000ff00) ^
 | 
				
			||||||
   		(Td4[(t0      ) & 0xff] & 0x000000ff) ^
 | 
					   		(Td4[(t0      ) & 0xff] & 0x000000ff) ^
 | 
				
			||||||
   		rk[3];
 | 
					   		rk[3];
 | 
				
			||||||
	PUTU32(pt + 12, s3);
 | 
						PUTU32(out + 12, s3);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef INTERMEDIATE_VALUE_KAT
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void rijndaelEncryptRound(const u32 rk[/*4*(Nr + 1)*/], int Nr, u8 block[16], int rounds) {
 | 
					 | 
				
			||||||
	int r;
 | 
					 | 
				
			||||||
	u32 s0, s1, s2, s3, t0, t1, t2, t3;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /*
 | 
					 | 
				
			||||||
	 * map byte array block to cipher state
 | 
					 | 
				
			||||||
	 * and add initial round key:
 | 
					 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
	s0 = GETU32(block     ) ^ rk[0];
 | 
					 | 
				
			||||||
	s1 = GETU32(block +  4) ^ rk[1];
 | 
					 | 
				
			||||||
	s2 = GETU32(block +  8) ^ rk[2];
 | 
					 | 
				
			||||||
	s3 = GETU32(block + 12) ^ rk[3];
 | 
					 | 
				
			||||||
    rk += 4;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /*
 | 
					 | 
				
			||||||
	 * Nr - 1 full rounds:
 | 
					 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
	for (r = (rounds < Nr ? rounds : Nr - 1); r > 0; r--) {
 | 
					 | 
				
			||||||
		t0 =
 | 
					 | 
				
			||||||
			Te0[(s0 >> 24)       ] ^
 | 
					 | 
				
			||||||
			Te1[(s1 >> 16) & 0xff] ^
 | 
					 | 
				
			||||||
			Te2[(s2 >>  8) & 0xff] ^
 | 
					 | 
				
			||||||
			Te3[(s3      ) & 0xff] ^
 | 
					 | 
				
			||||||
			rk[0];
 | 
					 | 
				
			||||||
		t1 =
 | 
					 | 
				
			||||||
			Te0[(s1 >> 24)       ] ^
 | 
					 | 
				
			||||||
			Te1[(s2 >> 16) & 0xff] ^
 | 
					 | 
				
			||||||
			Te2[(s3 >>  8) & 0xff] ^
 | 
					 | 
				
			||||||
			Te3[(s0      ) & 0xff] ^
 | 
					 | 
				
			||||||
			rk[1];
 | 
					 | 
				
			||||||
		t2 =
 | 
					 | 
				
			||||||
			Te0[(s2 >> 24)       ] ^
 | 
					 | 
				
			||||||
			Te1[(s3 >> 16) & 0xff] ^
 | 
					 | 
				
			||||||
			Te2[(s0 >>  8) & 0xff] ^
 | 
					 | 
				
			||||||
			Te3[(s1      ) & 0xff] ^
 | 
					 | 
				
			||||||
			rk[2];
 | 
					 | 
				
			||||||
		t3 =
 | 
					 | 
				
			||||||
			Te0[(s3 >> 24)       ] ^
 | 
					 | 
				
			||||||
			Te1[(s0 >> 16) & 0xff] ^
 | 
					 | 
				
			||||||
			Te2[(s1 >>  8) & 0xff] ^
 | 
					 | 
				
			||||||
			Te3[(s2      ) & 0xff] ^
 | 
					 | 
				
			||||||
			rk[3];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		s0 = t0;
 | 
					 | 
				
			||||||
		s1 = t1;
 | 
					 | 
				
			||||||
		s2 = t2;
 | 
					 | 
				
			||||||
		s3 = t3;
 | 
					 | 
				
			||||||
		rk += 4;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /*
 | 
					 | 
				
			||||||
	 * apply last round and
 | 
					 | 
				
			||||||
	 * map cipher state to byte array block:
 | 
					 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
	if (rounds == Nr) {
 | 
					 | 
				
			||||||
    	t0 =
 | 
					 | 
				
			||||||
    		(Te4[(s0 >> 24)       ] & 0xff000000) ^
 | 
					 | 
				
			||||||
    		(Te4[(s1 >> 16) & 0xff] & 0x00ff0000) ^
 | 
					 | 
				
			||||||
    		(Te4[(s2 >>  8) & 0xff] & 0x0000ff00) ^
 | 
					 | 
				
			||||||
    		(Te4[(s3      ) & 0xff] & 0x000000ff) ^
 | 
					 | 
				
			||||||
    		rk[0];
 | 
					 | 
				
			||||||
    	t1 =
 | 
					 | 
				
			||||||
    		(Te4[(s1 >> 24)       ] & 0xff000000) ^
 | 
					 | 
				
			||||||
    		(Te4[(s2 >> 16) & 0xff] & 0x00ff0000) ^
 | 
					 | 
				
			||||||
    		(Te4[(s3 >>  8) & 0xff] & 0x0000ff00) ^
 | 
					 | 
				
			||||||
    		(Te4[(s0      ) & 0xff] & 0x000000ff) ^
 | 
					 | 
				
			||||||
    		rk[1];
 | 
					 | 
				
			||||||
    	t2 =
 | 
					 | 
				
			||||||
    		(Te4[(s2 >> 24)       ] & 0xff000000) ^
 | 
					 | 
				
			||||||
    		(Te4[(s3 >> 16) & 0xff] & 0x00ff0000) ^
 | 
					 | 
				
			||||||
    		(Te4[(s0 >>  8) & 0xff] & 0x0000ff00) ^
 | 
					 | 
				
			||||||
    		(Te4[(s1      ) & 0xff] & 0x000000ff) ^
 | 
					 | 
				
			||||||
    		rk[2];
 | 
					 | 
				
			||||||
    	t3 =
 | 
					 | 
				
			||||||
    		(Te4[(s3 >> 24)       ] & 0xff000000) ^
 | 
					 | 
				
			||||||
    		(Te4[(s0 >> 16) & 0xff] & 0x00ff0000) ^
 | 
					 | 
				
			||||||
    		(Te4[(s1 >>  8) & 0xff] & 0x0000ff00) ^
 | 
					 | 
				
			||||||
    		(Te4[(s2      ) & 0xff] & 0x000000ff) ^
 | 
					 | 
				
			||||||
    		rk[3];
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		s0 = t0;
 | 
					 | 
				
			||||||
		s1 = t1;
 | 
					 | 
				
			||||||
		s2 = t2;
 | 
					 | 
				
			||||||
		s3 = t3;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	PUTU32(block     , s0);
 | 
					 | 
				
			||||||
	PUTU32(block +  4, s1);
 | 
					 | 
				
			||||||
	PUTU32(block +  8, s2);
 | 
					 | 
				
			||||||
	PUTU32(block + 12, s3);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void rijndaelDecryptRound(const u32 rk[/*4*(Nr + 1)*/], int Nr, u8 block[16], int rounds) {
 | 
					 | 
				
			||||||
	int r;
 | 
					 | 
				
			||||||
	u32 s0, s1, s2, s3, t0, t1, t2, t3;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /*
 | 
					 | 
				
			||||||
	 * map byte array block to cipher state
 | 
					 | 
				
			||||||
	 * and add initial round key:
 | 
					 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
	s0 = GETU32(block     ) ^ rk[0];
 | 
					 | 
				
			||||||
	s1 = GETU32(block +  4) ^ rk[1];
 | 
					 | 
				
			||||||
	s2 = GETU32(block +  8) ^ rk[2];
 | 
					 | 
				
			||||||
	s3 = GETU32(block + 12) ^ rk[3];
 | 
					 | 
				
			||||||
    rk += 4;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /*
 | 
					 | 
				
			||||||
	 * Nr - 1 full rounds:
 | 
					 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
	for (r = (rounds < Nr ? rounds : Nr) - 1; r > 0; r--) {
 | 
					 | 
				
			||||||
		t0 =
 | 
					 | 
				
			||||||
			Td0[(s0 >> 24)       ] ^
 | 
					 | 
				
			||||||
			Td1[(s3 >> 16) & 0xff] ^
 | 
					 | 
				
			||||||
			Td2[(s2 >>  8) & 0xff] ^
 | 
					 | 
				
			||||||
			Td3[(s1      ) & 0xff] ^
 | 
					 | 
				
			||||||
			rk[0];
 | 
					 | 
				
			||||||
		t1 =
 | 
					 | 
				
			||||||
			Td0[(s1 >> 24)       ] ^
 | 
					 | 
				
			||||||
			Td1[(s0 >> 16) & 0xff] ^
 | 
					 | 
				
			||||||
			Td2[(s3 >>  8) & 0xff] ^
 | 
					 | 
				
			||||||
			Td3[(s2      ) & 0xff] ^
 | 
					 | 
				
			||||||
			rk[1];
 | 
					 | 
				
			||||||
		t2 =
 | 
					 | 
				
			||||||
			Td0[(s2 >> 24)       ] ^
 | 
					 | 
				
			||||||
			Td1[(s1 >> 16) & 0xff] ^
 | 
					 | 
				
			||||||
			Td2[(s0 >>  8) & 0xff] ^
 | 
					 | 
				
			||||||
			Td3[(s3      ) & 0xff] ^
 | 
					 | 
				
			||||||
			rk[2];
 | 
					 | 
				
			||||||
		t3 =
 | 
					 | 
				
			||||||
			Td0[(s3 >> 24)       ] ^
 | 
					 | 
				
			||||||
			Td1[(s2 >> 16) & 0xff] ^
 | 
					 | 
				
			||||||
			Td2[(s1 >>  8) & 0xff] ^
 | 
					 | 
				
			||||||
			Td3[(s0      ) & 0xff] ^
 | 
					 | 
				
			||||||
			rk[3];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		s0 = t0;
 | 
					 | 
				
			||||||
		s1 = t1;
 | 
					 | 
				
			||||||
		s2 = t2;
 | 
					 | 
				
			||||||
		s3 = t3;
 | 
					 | 
				
			||||||
		rk += 4;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /*
 | 
					 | 
				
			||||||
	 * complete the last round and
 | 
					 | 
				
			||||||
	 * map cipher state to byte array block:
 | 
					 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
	t0 =
 | 
					 | 
				
			||||||
		(Td4[(s0 >> 24)       ] & 0xff000000) ^
 | 
					 | 
				
			||||||
		(Td4[(s3 >> 16) & 0xff] & 0x00ff0000) ^
 | 
					 | 
				
			||||||
		(Td4[(s2 >>  8) & 0xff] & 0x0000ff00) ^
 | 
					 | 
				
			||||||
		(Td4[(s1      ) & 0xff] & 0x000000ff);
 | 
					 | 
				
			||||||
	t1 =
 | 
					 | 
				
			||||||
		(Td4[(s1 >> 24)       ] & 0xff000000) ^
 | 
					 | 
				
			||||||
		(Td4[(s0 >> 16) & 0xff] & 0x00ff0000) ^
 | 
					 | 
				
			||||||
		(Td4[(s3 >>  8) & 0xff] & 0x0000ff00) ^
 | 
					 | 
				
			||||||
		(Td4[(s2      ) & 0xff] & 0x000000ff);
 | 
					 | 
				
			||||||
	t2 =
 | 
					 | 
				
			||||||
		(Td4[(s2 >> 24)       ] & 0xff000000) ^
 | 
					 | 
				
			||||||
		(Td4[(s1 >> 16) & 0xff] & 0x00ff0000) ^
 | 
					 | 
				
			||||||
		(Td4[(s0 >>  8) & 0xff] & 0x0000ff00) ^
 | 
					 | 
				
			||||||
		(Td4[(s3      ) & 0xff] & 0x000000ff);
 | 
					 | 
				
			||||||
	t3 =
 | 
					 | 
				
			||||||
		(Td4[(s3 >> 24)       ] & 0xff000000) ^
 | 
					 | 
				
			||||||
		(Td4[(s2 >> 16) & 0xff] & 0x00ff0000) ^
 | 
					 | 
				
			||||||
		(Td4[(s1 >>  8) & 0xff] & 0x0000ff00) ^
 | 
					 | 
				
			||||||
		(Td4[(s0      ) & 0xff] & 0x000000ff);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (rounds == Nr) {
 | 
					 | 
				
			||||||
	    t0 ^= rk[0];
 | 
					 | 
				
			||||||
	    t1 ^= rk[1];
 | 
					 | 
				
			||||||
	    t2 ^= rk[2];
 | 
					 | 
				
			||||||
	    t3 ^= rk[3];
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	PUTU32(block     , t0);
 | 
					 | 
				
			||||||
	PUTU32(block +  4, t1);
 | 
					 | 
				
			||||||
	PUTU32(block +  8, t2);
 | 
					 | 
				
			||||||
	PUTU32(block + 12, t3);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#endif /* INTERMEDIATE_VALUE_KAT */
 | 
					 | 
				
			||||||
							
								
								
									
										128
									
								
								crypto/aes/aes_ctr.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										128
									
								
								crypto/aes/aes_ctr.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,128 @@
 | 
				
			|||||||
 | 
					/* crypto/aes/aes_ctr.c -*- mode:C; c-file-style: "eay" -*- */
 | 
				
			||||||
 | 
					/* ====================================================================
 | 
				
			||||||
 | 
					 * Copyright (c) 1998-2002 The OpenSSL Project.  All rights reserved.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Redistribution and use in source and binary forms, with or without
 | 
				
			||||||
 | 
					 * modification, are permitted provided that the following conditions
 | 
				
			||||||
 | 
					 * are met:
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 1. Redistributions of source code must retain the above copyright
 | 
				
			||||||
 | 
					 *    notice, this list of conditions and the following disclaimer. 
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 2. Redistributions in binary form must reproduce the above copyright
 | 
				
			||||||
 | 
					 *    notice, this list of conditions and the following disclaimer in
 | 
				
			||||||
 | 
					 *    the documentation and/or other materials provided with the
 | 
				
			||||||
 | 
					 *    distribution.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 3. All advertising materials mentioning features or use of this
 | 
				
			||||||
 | 
					 *    software must display the following acknowledgment:
 | 
				
			||||||
 | 
					 *    "This product includes software developed by the OpenSSL Project
 | 
				
			||||||
 | 
					 *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
 | 
				
			||||||
 | 
					 *    endorse or promote products derived from this software without
 | 
				
			||||||
 | 
					 *    prior written permission. For written permission, please contact
 | 
				
			||||||
 | 
					 *    openssl-core@openssl.org.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 5. Products derived from this software may not be called "OpenSSL"
 | 
				
			||||||
 | 
					 *    nor may "OpenSSL" appear in their names without prior written
 | 
				
			||||||
 | 
					 *    permission of the OpenSSL Project.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 6. Redistributions of any form whatsoever must retain the following
 | 
				
			||||||
 | 
					 *    acknowledgment:
 | 
				
			||||||
 | 
					 *    "This product includes software developed by the OpenSSL Project
 | 
				
			||||||
 | 
					 *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
 | 
				
			||||||
 | 
					 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 | 
				
			||||||
 | 
					 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 | 
				
			||||||
 | 
					 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
 | 
				
			||||||
 | 
					 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 | 
				
			||||||
 | 
					 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 | 
				
			||||||
 | 
					 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 | 
				
			||||||
 | 
					 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 | 
				
			||||||
 | 
					 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 | 
				
			||||||
 | 
					 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 | 
				
			||||||
 | 
					 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 | 
				
			||||||
 | 
					 * OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
				
			||||||
 | 
					 * ====================================================================
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef AES_DEBUG
 | 
				
			||||||
 | 
					# ifndef NDEBUG
 | 
				
			||||||
 | 
					#  define NDEBUG
 | 
				
			||||||
 | 
					# endif
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#include <assert.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <openssl/aes.h>
 | 
				
			||||||
 | 
					#include "aes_locl.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* NOTE: CTR mode is big-endian.  The rest of the AES code
 | 
				
			||||||
 | 
					 * is endian-neutral. */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* increment counter (128-bit int) by 2^64 */
 | 
				
			||||||
 | 
					static void AES_ctr128_inc(unsigned char *counter) {
 | 
				
			||||||
 | 
						unsigned long c;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* Grab 3rd dword of counter and increment */
 | 
				
			||||||
 | 
					#ifdef L_ENDIAN
 | 
				
			||||||
 | 
						c = GETU32(counter + 8);
 | 
				
			||||||
 | 
						c++;
 | 
				
			||||||
 | 
						PUTU32(counter + 8, c);
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
						c = GETU32(counter + 4);
 | 
				
			||||||
 | 
						c++;
 | 
				
			||||||
 | 
						PUTU32(counter + 4, c);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* if no overflow, we're done */
 | 
				
			||||||
 | 
						if (c)
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* Grab top dword of counter and increment */
 | 
				
			||||||
 | 
					#ifdef L_ENDIAN
 | 
				
			||||||
 | 
						c = GETU32(counter + 12);
 | 
				
			||||||
 | 
						c++;
 | 
				
			||||||
 | 
						PUTU32(counter + 12, c);
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
						c = GETU32(counter +  0);
 | 
				
			||||||
 | 
						c++;
 | 
				
			||||||
 | 
						PUTU32(counter +  0, c);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* The input encrypted as though 128bit counter mode is being
 | 
				
			||||||
 | 
					 * used.  The extra state information to record how much of the
 | 
				
			||||||
 | 
					 * 128bit block we have used is contained in *num, and the
 | 
				
			||||||
 | 
					 * encrypted counter is kept in ecount_buf.  Both *num and
 | 
				
			||||||
 | 
					 * ecount_buf must be initialised with zeros before the first
 | 
				
			||||||
 | 
					 * call to AES_ctr128_encrypt().
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					void AES_ctr128_encrypt(const unsigned char *in, unsigned char *out,
 | 
				
			||||||
 | 
						const unsigned long length, const AES_KEY *key,
 | 
				
			||||||
 | 
						unsigned char counter[AES_BLOCK_SIZE],
 | 
				
			||||||
 | 
						unsigned char ecount_buf[AES_BLOCK_SIZE],
 | 
				
			||||||
 | 
						unsigned int *num) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						unsigned int n;
 | 
				
			||||||
 | 
						unsigned long l=length;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						assert(in && out && key && counter && num);
 | 
				
			||||||
 | 
						assert(*num < AES_BLOCK_SIZE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						n = *num;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						while (l--) {
 | 
				
			||||||
 | 
							if (n == 0) {
 | 
				
			||||||
 | 
								AES_encrypt(counter, ecount_buf, key);
 | 
				
			||||||
 | 
								AES_ctr128_inc(counter);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							*(out++) = *(in++) ^ ecount_buf[n];
 | 
				
			||||||
 | 
							n = (n+1) % AES_BLOCK_SIZE;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						*num=n;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										73
									
								
								crypto/aes/aes_ecb.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										73
									
								
								crypto/aes/aes_ecb.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,73 @@
 | 
				
			|||||||
 | 
					/* crypto/aes/aes_ecb.c -*- mode:C; c-file-style: "eay" -*- */
 | 
				
			||||||
 | 
					/* ====================================================================
 | 
				
			||||||
 | 
					 * Copyright (c) 1998-2002 The OpenSSL Project.  All rights reserved.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Redistribution and use in source and binary forms, with or without
 | 
				
			||||||
 | 
					 * modification, are permitted provided that the following conditions
 | 
				
			||||||
 | 
					 * are met:
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 1. Redistributions of source code must retain the above copyright
 | 
				
			||||||
 | 
					 *    notice, this list of conditions and the following disclaimer. 
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 2. Redistributions in binary form must reproduce the above copyright
 | 
				
			||||||
 | 
					 *    notice, this list of conditions and the following disclaimer in
 | 
				
			||||||
 | 
					 *    the documentation and/or other materials provided with the
 | 
				
			||||||
 | 
					 *    distribution.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 3. All advertising materials mentioning features or use of this
 | 
				
			||||||
 | 
					 *    software must display the following acknowledgment:
 | 
				
			||||||
 | 
					 *    "This product includes software developed by the OpenSSL Project
 | 
				
			||||||
 | 
					 *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
 | 
				
			||||||
 | 
					 *    endorse or promote products derived from this software without
 | 
				
			||||||
 | 
					 *    prior written permission. For written permission, please contact
 | 
				
			||||||
 | 
					 *    openssl-core@openssl.org.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 5. Products derived from this software may not be called "OpenSSL"
 | 
				
			||||||
 | 
					 *    nor may "OpenSSL" appear in their names without prior written
 | 
				
			||||||
 | 
					 *    permission of the OpenSSL Project.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 6. Redistributions of any form whatsoever must retain the following
 | 
				
			||||||
 | 
					 *    acknowledgment:
 | 
				
			||||||
 | 
					 *    "This product includes software developed by the OpenSSL Project
 | 
				
			||||||
 | 
					 *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
 | 
				
			||||||
 | 
					 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 | 
				
			||||||
 | 
					 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 | 
				
			||||||
 | 
					 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
 | 
				
			||||||
 | 
					 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 | 
				
			||||||
 | 
					 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 | 
				
			||||||
 | 
					 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 | 
				
			||||||
 | 
					 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 | 
				
			||||||
 | 
					 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 | 
				
			||||||
 | 
					 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 | 
				
			||||||
 | 
					 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 | 
				
			||||||
 | 
					 * OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
				
			||||||
 | 
					 * ====================================================================
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef AES_DEBUG
 | 
				
			||||||
 | 
					# ifndef NDEBUG
 | 
				
			||||||
 | 
					#  define NDEBUG
 | 
				
			||||||
 | 
					# endif
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#include <assert.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <openssl/aes.h>
 | 
				
			||||||
 | 
					#include "aes_locl.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void AES_ecb_encrypt(const unsigned char *in, unsigned char *out,
 | 
				
			||||||
 | 
							     const AES_KEY *key, const int enc) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        assert(in && out && key);
 | 
				
			||||||
 | 
						assert((AES_ENCRYPT == enc)||(AES_DECRYPT == enc));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (AES_ENCRYPT == enc)
 | 
				
			||||||
 | 
							AES_encrypt(in, out, key);
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
							AES_decrypt(in, out, key);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										85
									
								
								crypto/aes/aes_locl.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										85
									
								
								crypto/aes/aes_locl.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,85 @@
 | 
				
			|||||||
 | 
					/* crypto/aes/aes.h -*- mode:C; c-file-style: "eay" -*- */
 | 
				
			||||||
 | 
					/* ====================================================================
 | 
				
			||||||
 | 
					 * Copyright (c) 1998-2002 The OpenSSL Project.  All rights reserved.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Redistribution and use in source and binary forms, with or without
 | 
				
			||||||
 | 
					 * modification, are permitted provided that the following conditions
 | 
				
			||||||
 | 
					 * are met:
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 1. Redistributions of source code must retain the above copyright
 | 
				
			||||||
 | 
					 *    notice, this list of conditions and the following disclaimer. 
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 2. Redistributions in binary form must reproduce the above copyright
 | 
				
			||||||
 | 
					 *    notice, this list of conditions and the following disclaimer in
 | 
				
			||||||
 | 
					 *    the documentation and/or other materials provided with the
 | 
				
			||||||
 | 
					 *    distribution.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 3. All advertising materials mentioning features or use of this
 | 
				
			||||||
 | 
					 *    software must display the following acknowledgment:
 | 
				
			||||||
 | 
					 *    "This product includes software developed by the OpenSSL Project
 | 
				
			||||||
 | 
					 *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
 | 
				
			||||||
 | 
					 *    endorse or promote products derived from this software without
 | 
				
			||||||
 | 
					 *    prior written permission. For written permission, please contact
 | 
				
			||||||
 | 
					 *    openssl-core@openssl.org.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 5. Products derived from this software may not be called "OpenSSL"
 | 
				
			||||||
 | 
					 *    nor may "OpenSSL" appear in their names without prior written
 | 
				
			||||||
 | 
					 *    permission of the OpenSSL Project.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 6. Redistributions of any form whatsoever must retain the following
 | 
				
			||||||
 | 
					 *    acknowledgment:
 | 
				
			||||||
 | 
					 *    "This product includes software developed by the OpenSSL Project
 | 
				
			||||||
 | 
					 *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
 | 
				
			||||||
 | 
					 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 | 
				
			||||||
 | 
					 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 | 
				
			||||||
 | 
					 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
 | 
				
			||||||
 | 
					 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 | 
				
			||||||
 | 
					 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 | 
				
			||||||
 | 
					 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 | 
				
			||||||
 | 
					 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 | 
				
			||||||
 | 
					 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 | 
				
			||||||
 | 
					 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 | 
				
			||||||
 | 
					 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 | 
				
			||||||
 | 
					 * OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
				
			||||||
 | 
					 * ====================================================================
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef HEADER_AES_LOCL_H
 | 
				
			||||||
 | 
					#define HEADER_AES_LOCL_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <openssl/e_os2.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef OPENSSL_NO_AES
 | 
				
			||||||
 | 
					#error AES is disabled.
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <stdio.h>
 | 
				
			||||||
 | 
					#include <stdlib.h>
 | 
				
			||||||
 | 
					#include <string.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if defined(_MSC_VER) && !defined(OPENSSL_SYS_WINCE)
 | 
				
			||||||
 | 
					# define SWAP(x) (_lrotl(x, 8) & 0x00ff00ff | _lrotr(x, 8) & 0xff00ff00)
 | 
				
			||||||
 | 
					# define GETU32(p) SWAP(*((u32 *)(p)))
 | 
				
			||||||
 | 
					# define PUTU32(ct, st) { *((u32 *)(ct)) = SWAP((st)); }
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					# define GETU32(pt) (((u32)(pt)[0] << 24) ^ ((u32)(pt)[1] << 16) ^ ((u32)(pt)[2] <<  8) ^ ((u32)(pt)[3]))
 | 
				
			||||||
 | 
					# define PUTU32(ct, st) { (ct)[0] = (u8)((st) >> 24); (ct)[1] = (u8)((st) >> 16); (ct)[2] = (u8)((st) >>  8); (ct)[3] = (u8)(st); }
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					typedef unsigned long u32;
 | 
				
			||||||
 | 
					typedef unsigned short u16;
 | 
				
			||||||
 | 
					typedef unsigned char u8;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define MAXKC   (256/32)
 | 
				
			||||||
 | 
					#define MAXKB   (256/8)
 | 
				
			||||||
 | 
					#define MAXNR   14
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* This controls loop-unrolling in aes_core.c */
 | 
				
			||||||
 | 
					#undef FULL_UNROLL
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif /* !HEADER_AES_LOCL_H */
 | 
				
			||||||
							
								
								
									
										64
									
								
								crypto/aes/aes_misc.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										64
									
								
								crypto/aes/aes_misc.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,64 @@
 | 
				
			|||||||
 | 
					/* crypto/aes/aes_misc.c -*- mode:C; c-file-style: "eay" -*- */
 | 
				
			||||||
 | 
					/* ====================================================================
 | 
				
			||||||
 | 
					 * Copyright (c) 1998-2002 The OpenSSL Project.  All rights reserved.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Redistribution and use in source and binary forms, with or without
 | 
				
			||||||
 | 
					 * modification, are permitted provided that the following conditions
 | 
				
			||||||
 | 
					 * are met:
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 1. Redistributions of source code must retain the above copyright
 | 
				
			||||||
 | 
					 *    notice, this list of conditions and the following disclaimer. 
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 2. Redistributions in binary form must reproduce the above copyright
 | 
				
			||||||
 | 
					 *    notice, this list of conditions and the following disclaimer in
 | 
				
			||||||
 | 
					 *    the documentation and/or other materials provided with the
 | 
				
			||||||
 | 
					 *    distribution.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 3. All advertising materials mentioning features or use of this
 | 
				
			||||||
 | 
					 *    software must display the following acknowledgment:
 | 
				
			||||||
 | 
					 *    "This product includes software developed by the OpenSSL Project
 | 
				
			||||||
 | 
					 *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
 | 
				
			||||||
 | 
					 *    endorse or promote products derived from this software without
 | 
				
			||||||
 | 
					 *    prior written permission. For written permission, please contact
 | 
				
			||||||
 | 
					 *    openssl-core@openssl.org.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 5. Products derived from this software may not be called "OpenSSL"
 | 
				
			||||||
 | 
					 *    nor may "OpenSSL" appear in their names without prior written
 | 
				
			||||||
 | 
					 *    permission of the OpenSSL Project.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 6. Redistributions of any form whatsoever must retain the following
 | 
				
			||||||
 | 
					 *    acknowledgment:
 | 
				
			||||||
 | 
					 *    "This product includes software developed by the OpenSSL Project
 | 
				
			||||||
 | 
					 *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
 | 
				
			||||||
 | 
					 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 | 
				
			||||||
 | 
					 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 | 
				
			||||||
 | 
					 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
 | 
				
			||||||
 | 
					 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 | 
				
			||||||
 | 
					 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 | 
				
			||||||
 | 
					 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 | 
				
			||||||
 | 
					 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 | 
				
			||||||
 | 
					 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 | 
				
			||||||
 | 
					 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 | 
				
			||||||
 | 
					 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 | 
				
			||||||
 | 
					 * OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
				
			||||||
 | 
					 * ====================================================================
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <openssl/opensslv.h>
 | 
				
			||||||
 | 
					#include <openssl/aes.h>
 | 
				
			||||||
 | 
					#include "aes_locl.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const char *AES_version="AES" OPENSSL_VERSION_PTEXT;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const char *AES_options(void) {
 | 
				
			||||||
 | 
					#ifdef FULL_UNROLL
 | 
				
			||||||
 | 
					        return "aes(full)";
 | 
				
			||||||
 | 
					#else   
 | 
				
			||||||
 | 
					        return "aes(partial)";
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										142
									
								
								crypto/aes/aes_ofb.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										142
									
								
								crypto/aes/aes_ofb.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,142 @@
 | 
				
			|||||||
 | 
					/* crypto/aes/aes_ofb.c -*- mode:C; c-file-style: "eay" -*- */
 | 
				
			||||||
 | 
					/* ====================================================================
 | 
				
			||||||
 | 
					 * Copyright (c) 1998-2002 The OpenSSL Project.  All rights reserved.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Redistribution and use in source and binary forms, with or without
 | 
				
			||||||
 | 
					 * modification, are permitted provided that the following conditions
 | 
				
			||||||
 | 
					 * are met:
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 1. Redistributions of source code must retain the above copyright
 | 
				
			||||||
 | 
					 *    notice, this list of conditions and the following disclaimer. 
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 2. Redistributions in binary form must reproduce the above copyright
 | 
				
			||||||
 | 
					 *    notice, this list of conditions and the following disclaimer in
 | 
				
			||||||
 | 
					 *    the documentation and/or other materials provided with the
 | 
				
			||||||
 | 
					 *    distribution.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 3. All advertising materials mentioning features or use of this
 | 
				
			||||||
 | 
					 *    software must display the following acknowledgment:
 | 
				
			||||||
 | 
					 *    "This product includes software developed by the OpenSSL Project
 | 
				
			||||||
 | 
					 *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
 | 
				
			||||||
 | 
					 *    endorse or promote products derived from this software without
 | 
				
			||||||
 | 
					 *    prior written permission. For written permission, please contact
 | 
				
			||||||
 | 
					 *    openssl-core@openssl.org.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 5. Products derived from this software may not be called "OpenSSL"
 | 
				
			||||||
 | 
					 *    nor may "OpenSSL" appear in their names without prior written
 | 
				
			||||||
 | 
					 *    permission of the OpenSSL Project.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 6. Redistributions of any form whatsoever must retain the following
 | 
				
			||||||
 | 
					 *    acknowledgment:
 | 
				
			||||||
 | 
					 *    "This product includes software developed by the OpenSSL Project
 | 
				
			||||||
 | 
					 *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
 | 
				
			||||||
 | 
					 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 | 
				
			||||||
 | 
					 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 | 
				
			||||||
 | 
					 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
 | 
				
			||||||
 | 
					 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 | 
				
			||||||
 | 
					 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 | 
				
			||||||
 | 
					 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 | 
				
			||||||
 | 
					 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 | 
				
			||||||
 | 
					 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 | 
				
			||||||
 | 
					 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 | 
				
			||||||
 | 
					 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 | 
				
			||||||
 | 
					 * OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
				
			||||||
 | 
					 * ====================================================================
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 | 
				
			||||||
 | 
					 * All rights reserved.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This package is an SSL implementation written
 | 
				
			||||||
 | 
					 * by Eric Young (eay@cryptsoft.com).
 | 
				
			||||||
 | 
					 * The implementation was written so as to conform with Netscapes SSL.
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * This library is free for commercial and non-commercial use as long as
 | 
				
			||||||
 | 
					 * the following conditions are aheared to.  The following conditions
 | 
				
			||||||
 | 
					 * apply to all code found in this distribution, be it the RC4, RSA,
 | 
				
			||||||
 | 
					 * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
 | 
				
			||||||
 | 
					 * included with this distribution is covered by the same copyright terms
 | 
				
			||||||
 | 
					 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * Copyright remains Eric Young's, and as such any Copyright notices in
 | 
				
			||||||
 | 
					 * the code are not to be removed.
 | 
				
			||||||
 | 
					 * If this package is used in a product, Eric Young should be given attribution
 | 
				
			||||||
 | 
					 * as the author of the parts of the library used.
 | 
				
			||||||
 | 
					 * This can be in the form of a textual message at program startup or
 | 
				
			||||||
 | 
					 * in documentation (online or textual) provided with the package.
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * Redistribution and use in source and binary forms, with or without
 | 
				
			||||||
 | 
					 * modification, are permitted provided that the following conditions
 | 
				
			||||||
 | 
					 * are met:
 | 
				
			||||||
 | 
					 * 1. Redistributions of source code must retain the copyright
 | 
				
			||||||
 | 
					 *    notice, this list of conditions and the following disclaimer.
 | 
				
			||||||
 | 
					 * 2. Redistributions in binary form must reproduce the above copyright
 | 
				
			||||||
 | 
					 *    notice, this list of conditions and the following disclaimer in the
 | 
				
			||||||
 | 
					 *    documentation and/or other materials provided with the distribution.
 | 
				
			||||||
 | 
					 * 3. All advertising materials mentioning features or use of this software
 | 
				
			||||||
 | 
					 *    must display the following acknowledgement:
 | 
				
			||||||
 | 
					 *    "This product includes cryptographic software written by
 | 
				
			||||||
 | 
					 *     Eric Young (eay@cryptsoft.com)"
 | 
				
			||||||
 | 
					 *    The word 'cryptographic' can be left out if the rouines from the library
 | 
				
			||||||
 | 
					 *    being used are not cryptographic related :-).
 | 
				
			||||||
 | 
					 * 4. If you include any Windows specific code (or a derivative thereof) from 
 | 
				
			||||||
 | 
					 *    the apps directory (application code) you must include an acknowledgement:
 | 
				
			||||||
 | 
					 *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
 | 
				
			||||||
 | 
					 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 | 
				
			||||||
 | 
					 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 | 
				
			||||||
 | 
					 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 | 
				
			||||||
 | 
					 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 | 
				
			||||||
 | 
					 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 | 
				
			||||||
 | 
					 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 | 
				
			||||||
 | 
					 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 | 
				
			||||||
 | 
					 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 | 
				
			||||||
 | 
					 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 | 
				
			||||||
 | 
					 * SUCH DAMAGE.
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * The licence and distribution terms for any publically available version or
 | 
				
			||||||
 | 
					 * derivative of this code cannot be changed.  i.e. this code cannot simply be
 | 
				
			||||||
 | 
					 * copied and put under another distribution licence
 | 
				
			||||||
 | 
					 * [including the GNU Public Licence.]
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef AES_DEBUG
 | 
				
			||||||
 | 
					# ifndef NDEBUG
 | 
				
			||||||
 | 
					#  define NDEBUG
 | 
				
			||||||
 | 
					# endif
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#include <assert.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <openssl/aes.h>
 | 
				
			||||||
 | 
					#include "aes_locl.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* The input and output encrypted as though 128bit ofb mode is being
 | 
				
			||||||
 | 
					 * used.  The extra state information to record how much of the
 | 
				
			||||||
 | 
					 * 128bit block we have used is contained in *num;
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out,
 | 
				
			||||||
 | 
						const unsigned long length, const AES_KEY *key,
 | 
				
			||||||
 | 
						unsigned char *ivec, int *num) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						unsigned int n;
 | 
				
			||||||
 | 
						unsigned long l=length;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						assert(in && out && key && ivec && num);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						n = *num;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						while (l--) {
 | 
				
			||||||
 | 
							if (n == 0) {
 | 
				
			||||||
 | 
								AES_encrypt(ivec, ivec, key);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							*(out++) = *(in++) ^ ivec[n];
 | 
				
			||||||
 | 
							n = (n+1) % AES_BLOCK_SIZE;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						*num=n;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -71,8 +71,6 @@ int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp)
 | 
				
			|||||||
	if (a == NULL) return(0);
 | 
						if (a == NULL) return(0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	len=a->length;
 | 
						len=a->length;
 | 
				
			||||||
	ret=1+len;
 | 
					 | 
				
			||||||
	if (pp == NULL) return(ret);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (len > 0)
 | 
						if (len > 0)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
@@ -100,6 +98,10 @@ int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp)
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		bits=0;
 | 
							bits=0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						ret=1+len;
 | 
				
			||||||
 | 
						if (pp == NULL) return(ret);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	p= *pp;
 | 
						p= *pp;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	*(p++)=(unsigned char)bits;
 | 
						*(p++)=(unsigned char)bits;
 | 
				
			||||||
@@ -118,6 +120,12 @@ ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, unsigned char **pp,
 | 
				
			|||||||
	unsigned char *p,*s;
 | 
						unsigned char *p,*s;
 | 
				
			||||||
	int i;
 | 
						int i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (len < 1)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							i=ASN1_R_STRING_TOO_SHORT;
 | 
				
			||||||
 | 
							goto err;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((a == NULL) || ((*a) == NULL))
 | 
						if ((a == NULL) || ((*a) == NULL))
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		if ((ret=M_ASN1_BIT_STRING_new()) == NULL) return(NULL);
 | 
							if ((ret=M_ASN1_BIT_STRING_new()) == NULL) return(NULL);
 | 
				
			||||||
@@ -172,6 +180,7 @@ int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value)
 | 
				
			|||||||
	w=n/8;
 | 
						w=n/8;
 | 
				
			||||||
	v=1<<(7-(n&0x07));
 | 
						v=1<<(7-(n&0x07));
 | 
				
			||||||
	iv= ~v;
 | 
						iv= ~v;
 | 
				
			||||||
 | 
						if (!value) v=0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	a->flags&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07); /* clear, set on write */
 | 
						a->flags&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07); /* clear, set on write */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -182,7 +191,9 @@ int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value)
 | 
				
			|||||||
		if (a->data == NULL)
 | 
							if (a->data == NULL)
 | 
				
			||||||
			c=(unsigned char *)OPENSSL_malloc(w+1);
 | 
								c=(unsigned char *)OPENSSL_malloc(w+1);
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			c=(unsigned char *)OPENSSL_realloc(a->data,w+1);
 | 
								c=(unsigned char *)OPENSSL_realloc_clean(a->data,
 | 
				
			||||||
 | 
													 a->length,
 | 
				
			||||||
 | 
													 w+1);
 | 
				
			||||||
		if (c == NULL) return(0);
 | 
							if (c == NULL) return(0);
 | 
				
			||||||
		if (w+1-a->length > 0) memset(c+a->length, 0, w+1-a->length);
 | 
							if (w+1-a->length > 0) memset(c+a->length, 0, w+1-a->length);
 | 
				
			||||||
		a->data=c;
 | 
							a->data=c;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -60,24 +60,6 @@
 | 
				
			|||||||
#include "cryptlib.h"
 | 
					#include "cryptlib.h"
 | 
				
			||||||
#include <openssl/asn1.h>
 | 
					#include <openssl/asn1.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static unsigned long tag2bit[32]={
 | 
					 | 
				
			||||||
0,	0,	0,	B_ASN1_BIT_STRING,	/* tags  0 -  3 */
 | 
					 | 
				
			||||||
B_ASN1_OCTET_STRING,	0,	0,		B_ASN1_UNKNOWN,/* tags  4- 7 */
 | 
					 | 
				
			||||||
B_ASN1_UNKNOWN,	B_ASN1_UNKNOWN,	B_ASN1_UNKNOWN,	B_ASN1_UNKNOWN,/* tags  8-11 */
 | 
					 | 
				
			||||||
B_ASN1_UTF8STRING,B_ASN1_UNKNOWN,B_ASN1_UNKNOWN,B_ASN1_UNKNOWN,/* tags 12-15 */
 | 
					 | 
				
			||||||
0,	0,	B_ASN1_NUMERICSTRING,B_ASN1_PRINTABLESTRING,   /* tags 16-19 */
 | 
					 | 
				
			||||||
B_ASN1_T61STRING,B_ASN1_VIDEOTEXSTRING,B_ASN1_IA5STRING,       /* tags 20-22 */
 | 
					 | 
				
			||||||
B_ASN1_UTCTIME, B_ASN1_GENERALIZEDTIME,			       /* tags 23-24 */	
 | 
					 | 
				
			||||||
B_ASN1_GRAPHICSTRING,B_ASN1_ISO64STRING,B_ASN1_GENERALSTRING,  /* tags 25-27 */
 | 
					 | 
				
			||||||
B_ASN1_UNIVERSALSTRING,B_ASN1_UNKNOWN,B_ASN1_BMPSTRING,B_ASN1_UNKNOWN, /* tags 28-31 */
 | 
					 | 
				
			||||||
	};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
unsigned long ASN1_tag2bit(int tag)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	if((tag < 0) || (tag > 30)) return 0;
 | 
					 | 
				
			||||||
	return tag2bit[tag];
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static int asn1_collate_primitive(ASN1_STRING *a, ASN1_CTX *c);
 | 
					static int asn1_collate_primitive(ASN1_STRING *a, ASN1_CTX *c);
 | 
				
			||||||
/* type is a 'bitmap' of acceptable string types.
 | 
					/* type is a 'bitmap' of acceptable string types.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
@@ -99,7 +81,7 @@ ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a, unsigned char **pp,
 | 
				
			|||||||
		i=ASN1_R_TAG_VALUE_TOO_HIGH;;
 | 
							i=ASN1_R_TAG_VALUE_TOO_HIGH;;
 | 
				
			||||||
		goto err;
 | 
							goto err;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	if (!(tag2bit[tag] & type))
 | 
						if (!(ASN1_tag2bit(tag) & type))
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		i=ASN1_R_WRONG_TYPE;
 | 
							i=ASN1_R_WRONG_TYPE;
 | 
				
			||||||
		goto err;
 | 
							goto err;
 | 
				
			||||||
@@ -303,7 +285,7 @@ static int asn1_collate_primitive(ASN1_STRING *a, ASN1_CTX *c)
 | 
				
			|||||||
			goto err;
 | 
								goto err;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (!BUF_MEM_grow(&b,num+os->length))
 | 
							if (!BUF_MEM_grow_clean(&b,num+os->length))
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
			c->error=ERR_R_BUF_LIB;
 | 
								c->error=ERR_R_BUF_LIB;
 | 
				
			||||||
			goto err;
 | 
								goto err;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -166,7 +166,7 @@ static int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb)
 | 
				
			|||||||
			{
 | 
								{
 | 
				
			||||||
			want-=(len-off);
 | 
								want-=(len-off);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (!BUF_MEM_grow(b,len+want))
 | 
								if (!BUF_MEM_grow_clean(b,len+want))
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
				ASN1err(ASN1_F_ASN1_D2I_BIO,ERR_R_MALLOC_FAILURE);
 | 
									ASN1err(ASN1_F_ASN1_D2I_BIO,ERR_R_MALLOC_FAILURE);
 | 
				
			||||||
				goto err;
 | 
									goto err;
 | 
				
			||||||
@@ -221,7 +221,7 @@ static int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb)
 | 
				
			|||||||
			if (want > (len-off))
 | 
								if (want > (len-off))
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
				want-=(len-off);
 | 
									want-=(len-off);
 | 
				
			||||||
				if (!BUF_MEM_grow(b,len+want))
 | 
									if (!BUF_MEM_grow_clean(b,len+want))
 | 
				
			||||||
					{
 | 
										{
 | 
				
			||||||
					ASN1err(ASN1_F_ASN1_D2I_BIO,ERR_R_MALLOC_FAILURE);
 | 
										ASN1err(ASN1_F_ASN1_D2I_BIO,ERR_R_MALLOC_FAILURE);
 | 
				
			||||||
					goto err;
 | 
										goto err;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -82,7 +82,7 @@ int ASN1_digest(int (*i2d)(), const EVP_MD *type, char *data,
 | 
				
			|||||||
	p=str;
 | 
						p=str;
 | 
				
			||||||
	i2d(data,&p);
 | 
						i2d(data,&p);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	EVP_Digest(str, i, md, len, type);
 | 
						EVP_Digest(str, i, md, len, type, NULL);
 | 
				
			||||||
	OPENSSL_free(str);
 | 
						OPENSSL_free(str);
 | 
				
			||||||
	return(1);
 | 
						return(1);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -99,7 +99,7 @@ int ASN1_item_digest(const ASN1_ITEM *it, const EVP_MD *type, void *asn,
 | 
				
			|||||||
	i=ASN1_item_i2d(asn,&str, it);
 | 
						i=ASN1_item_i2d(asn,&str, it);
 | 
				
			||||||
	if (!str) return(0);
 | 
						if (!str) return(0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	EVP_Digest(str, i, md, len, type);
 | 
						EVP_Digest(str, i, md, len, type, NULL);
 | 
				
			||||||
	OPENSSL_free(str);
 | 
						OPENSSL_free(str);
 | 
				
			||||||
	return(1);
 | 
						return(1);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -151,7 +151,17 @@ ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(BIGNUM *bn, ASN1_ENUMERATED *ai)
 | 
				
			|||||||
	else ret->type=V_ASN1_ENUMERATED;
 | 
						else ret->type=V_ASN1_ENUMERATED;
 | 
				
			||||||
	j=BN_num_bits(bn);
 | 
						j=BN_num_bits(bn);
 | 
				
			||||||
	len=((j == 0)?0:((j/8)+1));
 | 
						len=((j == 0)?0:((j/8)+1));
 | 
				
			||||||
	ret->data=(unsigned char *)OPENSSL_malloc(len+4);
 | 
						if (ret->length < len+4)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							unsigned char *new_data=OPENSSL_realloc(ret->data, len+4);
 | 
				
			||||||
 | 
							if (!new_data)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								ASN1err(ASN1_F_BN_TO_ASN1_INTEGER,ERR_R_MALLOC_FAILURE);
 | 
				
			||||||
 | 
								goto err;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							ret->data=new_data;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ret->length=BN_bn2bin(bn,ret->data);
 | 
						ret->length=BN_bn2bin(bn,ret->data);
 | 
				
			||||||
	return(ret);
 | 
						return(ret);
 | 
				
			||||||
err:
 | 
					err:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -61,6 +61,7 @@
 | 
				
			|||||||
#include <stdio.h>
 | 
					#include <stdio.h>
 | 
				
			||||||
#include <time.h>
 | 
					#include <time.h>
 | 
				
			||||||
#include "cryptlib.h"
 | 
					#include "cryptlib.h"
 | 
				
			||||||
 | 
					#include "o_time.h"
 | 
				
			||||||
#include <openssl/asn1.h>
 | 
					#include <openssl/asn1.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if 0
 | 
					#if 0
 | 
				
			||||||
@@ -145,6 +146,19 @@ int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *d)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		if ((n < min[i]) || (n > max[i])) goto err;
 | 
							if ((n < min[i]) || (n > max[i])) goto err;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
						/* Optional fractional seconds: decimal point followed by one
 | 
				
			||||||
 | 
						 * or more digits.
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						if (a[o] == '.')
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							if (++o > l) goto err;
 | 
				
			||||||
 | 
							i = o;
 | 
				
			||||||
 | 
							while ((a[o] >= '0') && (a[o] <= '9') && (o <= l))
 | 
				
			||||||
 | 
								o++;
 | 
				
			||||||
 | 
							/* Must have at least one digit after decimal point */
 | 
				
			||||||
 | 
							if (i == o) goto err;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (a[o] == 'Z')
 | 
						if (a[o] == 'Z')
 | 
				
			||||||
		o++;
 | 
							o++;
 | 
				
			||||||
	else if ((a[o] == '+') || (a[o] == '-'))
 | 
						else if ((a[o] == '+') || (a[o] == '-'))
 | 
				
			||||||
@@ -193,21 +207,17 @@ ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,
 | 
				
			|||||||
	{
 | 
						{
 | 
				
			||||||
	char *p;
 | 
						char *p;
 | 
				
			||||||
	struct tm *ts;
 | 
						struct tm *ts;
 | 
				
			||||||
#if defined(OPENSSL_THREADS) && !defined(OPENSSL_SYS_WIN32)
 | 
					 | 
				
			||||||
	struct tm data;
 | 
						struct tm data;
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (s == NULL)
 | 
						if (s == NULL)
 | 
				
			||||||
		s=M_ASN1_GENERALIZEDTIME_new();
 | 
							s=M_ASN1_GENERALIZEDTIME_new();
 | 
				
			||||||
	if (s == NULL)
 | 
						if (s == NULL)
 | 
				
			||||||
		return(NULL);
 | 
							return(NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(OPENSSL_THREADS) && !defined(OPENSSL_SYS_WIN32)
 | 
						ts=OPENSSL_gmtime(&t, &data);
 | 
				
			||||||
	gmtime_r(&t,&data); /* should return &data, but doesn't on some systems, so we don't even look at the return value */
 | 
						if (ts == NULL)
 | 
				
			||||||
	ts=&data;
 | 
							return(NULL);
 | 
				
			||||||
#else
 | 
					
 | 
				
			||||||
	ts=gmtime(&t);
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
	p=(char *)s->data;
 | 
						p=(char *)s->data;
 | 
				
			||||||
	if ((p == NULL) || (s->length < 16))
 | 
						if ((p == NULL) || (s->length < 16))
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -397,7 +397,16 @@ ASN1_INTEGER *BN_to_ASN1_INTEGER(BIGNUM *bn, ASN1_INTEGER *ai)
 | 
				
			|||||||
	else ret->type=V_ASN1_INTEGER;
 | 
						else ret->type=V_ASN1_INTEGER;
 | 
				
			||||||
	j=BN_num_bits(bn);
 | 
						j=BN_num_bits(bn);
 | 
				
			||||||
	len=((j == 0)?0:((j/8)+1));
 | 
						len=((j == 0)?0:((j/8)+1));
 | 
				
			||||||
	ret->data=(unsigned char *)OPENSSL_malloc(len+4);
 | 
						if (ret->length < len+4)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							unsigned char *new_data=OPENSSL_realloc(ret->data, len+4);
 | 
				
			||||||
 | 
							if (!new_data)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								ASN1err(ASN1_F_BN_TO_ASN1_INTEGER,ERR_R_MALLOC_FAILURE);
 | 
				
			||||||
 | 
								goto err;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							ret->data=new_data;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	ret->length=BN_bn2bin(bn,ret->data);
 | 
						ret->length=BN_bn2bin(bn,ret->data);
 | 
				
			||||||
	/* Correct zero case */
 | 
						/* Correct zero case */
 | 
				
			||||||
	if(!ret->length)
 | 
						if(!ret->length)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -183,8 +183,8 @@ int i2a_ASN1_OBJECT(BIO *bp, ASN1_OBJECT *a)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if ((a == NULL) || (a->data == NULL))
 | 
						if ((a == NULL) || (a->data == NULL))
 | 
				
			||||||
		return(BIO_write(bp,"NULL",4));
 | 
							return(BIO_write(bp,"NULL",4));
 | 
				
			||||||
	i=i2t_ASN1_OBJECT(buf,80,a);
 | 
						i=i2t_ASN1_OBJECT(buf,sizeof buf,a);
 | 
				
			||||||
	if (i > 80) i=80;
 | 
						if (i > sizeof buf) i=sizeof buf;
 | 
				
			||||||
	BIO_write(bp,buf,i);
 | 
						BIO_write(bp,buf,i);
 | 
				
			||||||
	return(i);
 | 
						return(i);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -118,7 +118,7 @@ int i2d_ASN1_SET(STACK *a, unsigned char **pp, int (*func)(), int ex_tag,
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        pStart  = p; /* Catch the beg of Setblobs*/
 | 
					        pStart  = p; /* Catch the beg of Setblobs*/
 | 
				
			||||||
        rgSetBlob = (MYBLOB *)OPENSSL_malloc( sk_num(a) * sizeof(MYBLOB)); /* In this array
 | 
					        if (!(rgSetBlob = (MYBLOB *)OPENSSL_malloc( sk_num(a) * sizeof(MYBLOB)))) return 0; /* In this array
 | 
				
			||||||
we will store the SET blobs */
 | 
					we will store the SET blobs */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for (i=0; i<sk_num(a); i++)
 | 
					        for (i=0; i<sk_num(a); i++)
 | 
				
			||||||
@@ -135,7 +135,7 @@ SetBlob
 | 
				
			|||||||
 /* Now we have to sort the blobs. I am using a simple algo.
 | 
					 /* Now we have to sort the blobs. I am using a simple algo.
 | 
				
			||||||
    *Sort ptrs *Copy to temp-mem *Copy from temp-mem to user-mem*/
 | 
					    *Sort ptrs *Copy to temp-mem *Copy from temp-mem to user-mem*/
 | 
				
			||||||
        qsort( rgSetBlob, sk_num(a), sizeof(MYBLOB), SetBlobCmp);
 | 
					        qsort( rgSetBlob, sk_num(a), sizeof(MYBLOB), SetBlobCmp);
 | 
				
			||||||
        pTempMem = OPENSSL_malloc(totSize);
 | 
					        if (!(pTempMem = OPENSSL_malloc(totSize))) return 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Copy to temp mem */
 | 
					/* Copy to temp mem */
 | 
				
			||||||
        p = pTempMem;
 | 
					        p = pTempMem;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -55,6 +55,59 @@
 | 
				
			|||||||
 * copied and put under another distribution licence
 | 
					 * copied and put under another distribution licence
 | 
				
			||||||
 * [including the GNU Public Licence.]
 | 
					 * [including the GNU Public Licence.]
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					/* ====================================================================
 | 
				
			||||||
 | 
					 * Copyright (c) 1998-2002 The OpenSSL Project.  All rights reserved.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Redistribution and use in source and binary forms, with or without
 | 
				
			||||||
 | 
					 * modification, are permitted provided that the following conditions
 | 
				
			||||||
 | 
					 * are met:
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 1. Redistributions of source code must retain the above copyright
 | 
				
			||||||
 | 
					 *    notice, this list of conditions and the following disclaimer. 
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 2. Redistributions in binary form must reproduce the above copyright
 | 
				
			||||||
 | 
					 *    notice, this list of conditions and the following disclaimer in
 | 
				
			||||||
 | 
					 *    the documentation and/or other materials provided with the
 | 
				
			||||||
 | 
					 *    distribution.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 3. All advertising materials mentioning features or use of this
 | 
				
			||||||
 | 
					 *    software must display the following acknowledgment:
 | 
				
			||||||
 | 
					 *    "This product includes software developed by the OpenSSL Project
 | 
				
			||||||
 | 
					 *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
 | 
				
			||||||
 | 
					 *    endorse or promote products derived from this software without
 | 
				
			||||||
 | 
					 *    prior written permission. For written permission, please contact
 | 
				
			||||||
 | 
					 *    openssl-core@openssl.org.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 5. Products derived from this software may not be called "OpenSSL"
 | 
				
			||||||
 | 
					 *    nor may "OpenSSL" appear in their names without prior written
 | 
				
			||||||
 | 
					 *    permission of the OpenSSL Project.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * 6. Redistributions of any form whatsoever must retain the following
 | 
				
			||||||
 | 
					 *    acknowledgment:
 | 
				
			||||||
 | 
					 *    "This product includes software developed by the OpenSSL Project
 | 
				
			||||||
 | 
					 *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
 | 
				
			||||||
 | 
					 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 | 
				
			||||||
 | 
					 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 | 
				
			||||||
 | 
					 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
 | 
				
			||||||
 | 
					 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 | 
				
			||||||
 | 
					 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 | 
				
			||||||
 | 
					 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 | 
				
			||||||
 | 
					 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 | 
				
			||||||
 | 
					 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 | 
				
			||||||
 | 
					 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 | 
				
			||||||
 | 
					 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 | 
				
			||||||
 | 
					 * OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
				
			||||||
 | 
					 * ====================================================================
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This product includes cryptographic software written by Eric Young
 | 
				
			||||||
 | 
					 * (eay@cryptsoft.com).  This product includes software written by Tim
 | 
				
			||||||
 | 
					 * Hudson (tjh@cryptsoft.com).
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdio.h>
 | 
					#include <stdio.h>
 | 
				
			||||||
#include <time.h>
 | 
					#include <time.h>
 | 
				
			||||||
@@ -82,6 +135,7 @@ int ASN1_sign(int (*i2d)(), X509_ALGOR *algor1, X509_ALGOR *algor2,
 | 
				
			|||||||
	int i,inl=0,outl=0,outll=0;
 | 
						int i,inl=0,outl=0,outll=0;
 | 
				
			||||||
	X509_ALGOR *a;
 | 
						X509_ALGOR *a;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						EVP_MD_CTX_init(&ctx);
 | 
				
			||||||
	for (i=0; i<2; i++)
 | 
						for (i=0; i<2; i++)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		if (i == 0)
 | 
							if (i == 0)
 | 
				
			||||||
@@ -89,7 +143,14 @@ int ASN1_sign(int (*i2d)(), X509_ALGOR *algor1, X509_ALGOR *algor2,
 | 
				
			|||||||
		else
 | 
							else
 | 
				
			||||||
			a=algor2;
 | 
								a=algor2;
 | 
				
			||||||
		if (a == NULL) continue;
 | 
							if (a == NULL) continue;
 | 
				
			||||||
		if (	(a->parameter == NULL) || 
 | 
					                if (type->pkey_type == NID_dsaWithSHA1)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								/* special case: RFC 2459 tells us to omit 'parameters'
 | 
				
			||||||
 | 
								 * with id-dsa-with-sha1 */
 | 
				
			||||||
 | 
								ASN1_TYPE_free(a->parameter);
 | 
				
			||||||
 | 
								a->parameter = NULL;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							else if ((a->parameter == NULL) || 
 | 
				
			||||||
			(a->parameter->type != V_ASN1_NULL))
 | 
								(a->parameter->type != V_ASN1_NULL))
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
			ASN1_TYPE_free(a->parameter);
 | 
								ASN1_TYPE_free(a->parameter);
 | 
				
			||||||
@@ -122,7 +183,7 @@ int ASN1_sign(int (*i2d)(), X509_ALGOR *algor1, X509_ALGOR *algor2,
 | 
				
			|||||||
	p=buf_in;
 | 
						p=buf_in;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	i2d(data,&p);
 | 
						i2d(data,&p);
 | 
				
			||||||
	EVP_SignInit(&ctx,type);
 | 
						EVP_SignInit_ex(&ctx,type, NULL);
 | 
				
			||||||
	EVP_SignUpdate(&ctx,(unsigned char *)buf_in,inl);
 | 
						EVP_SignUpdate(&ctx,(unsigned char *)buf_in,inl);
 | 
				
			||||||
	if (!EVP_SignFinal(&ctx,(unsigned char *)buf_out,
 | 
						if (!EVP_SignFinal(&ctx,(unsigned char *)buf_out,
 | 
				
			||||||
			(unsigned int *)&outl,pkey))
 | 
								(unsigned int *)&outl,pkey))
 | 
				
			||||||
@@ -141,7 +202,7 @@ int ASN1_sign(int (*i2d)(), X509_ALGOR *algor1, X509_ALGOR *algor2,
 | 
				
			|||||||
	signature->flags&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07);
 | 
						signature->flags&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07);
 | 
				
			||||||
	signature->flags|=ASN1_STRING_FLAG_BITS_LEFT;
 | 
						signature->flags|=ASN1_STRING_FLAG_BITS_LEFT;
 | 
				
			||||||
err:
 | 
					err:
 | 
				
			||||||
	memset(&ctx,0,sizeof(ctx));
 | 
						EVP_MD_CTX_cleanup(&ctx);
 | 
				
			||||||
	if (buf_in != NULL)
 | 
						if (buf_in != NULL)
 | 
				
			||||||
		{ memset((char *)buf_in,0,(unsigned int)inl); OPENSSL_free(buf_in); }
 | 
							{ memset((char *)buf_in,0,(unsigned int)inl); OPENSSL_free(buf_in); }
 | 
				
			||||||
	if (buf_out != NULL)
 | 
						if (buf_out != NULL)
 | 
				
			||||||
@@ -160,6 +221,7 @@ int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,
 | 
				
			|||||||
	int i,inl=0,outl=0,outll=0;
 | 
						int i,inl=0,outl=0,outll=0;
 | 
				
			||||||
	X509_ALGOR *a;
 | 
						X509_ALGOR *a;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						EVP_MD_CTX_init(&ctx);
 | 
				
			||||||
	for (i=0; i<2; i++)
 | 
						for (i=0; i<2; i++)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
		if (i == 0)
 | 
							if (i == 0)
 | 
				
			||||||
@@ -167,7 +229,14 @@ int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,
 | 
				
			|||||||
		else
 | 
							else
 | 
				
			||||||
			a=algor2;
 | 
								a=algor2;
 | 
				
			||||||
		if (a == NULL) continue;
 | 
							if (a == NULL) continue;
 | 
				
			||||||
		if (	(a->parameter == NULL) || 
 | 
					                if (type->pkey_type == NID_dsaWithSHA1)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
								/* special case: RFC 2459 tells us to omit 'parameters'
 | 
				
			||||||
 | 
								 * with id-dsa-with-sha1 */
 | 
				
			||||||
 | 
								ASN1_TYPE_free(a->parameter);
 | 
				
			||||||
 | 
								a->parameter = NULL;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							else if ((a->parameter == NULL) || 
 | 
				
			||||||
			(a->parameter->type != V_ASN1_NULL))
 | 
								(a->parameter->type != V_ASN1_NULL))
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
			ASN1_TYPE_free(a->parameter);
 | 
								ASN1_TYPE_free(a->parameter);
 | 
				
			||||||
@@ -197,7 +266,7 @@ int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,
 | 
				
			|||||||
		goto err;
 | 
							goto err;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	EVP_SignInit(&ctx,type);
 | 
						EVP_SignInit_ex(&ctx,type, NULL);
 | 
				
			||||||
	EVP_SignUpdate(&ctx,(unsigned char *)buf_in,inl);
 | 
						EVP_SignUpdate(&ctx,(unsigned char *)buf_in,inl);
 | 
				
			||||||
	if (!EVP_SignFinal(&ctx,(unsigned char *)buf_out,
 | 
						if (!EVP_SignFinal(&ctx,(unsigned char *)buf_out,
 | 
				
			||||||
			(unsigned int *)&outl,pkey))
 | 
								(unsigned int *)&outl,pkey))
 | 
				
			||||||
@@ -216,7 +285,7 @@ int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,
 | 
				
			|||||||
	signature->flags&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07);
 | 
						signature->flags&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07);
 | 
				
			||||||
	signature->flags|=ASN1_STRING_FLAG_BITS_LEFT;
 | 
						signature->flags|=ASN1_STRING_FLAG_BITS_LEFT;
 | 
				
			||||||
err:
 | 
					err:
 | 
				
			||||||
	memset(&ctx,0,sizeof(ctx));
 | 
						EVP_MD_CTX_cleanup(&ctx);
 | 
				
			||||||
	if (buf_in != NULL)
 | 
						if (buf_in != NULL)
 | 
				
			||||||
		{ memset((char *)buf_in,0,(unsigned int)inl); OPENSSL_free(buf_in); }
 | 
							{ memset((char *)buf_in,0,(unsigned int)inl); OPENSSL_free(buf_in); }
 | 
				
			||||||
	if (buf_out != NULL)
 | 
						if (buf_out != NULL)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -63,6 +63,7 @@
 | 
				
			|||||||
#include <openssl/asn1.h>
 | 
					#include <openssl/asn1.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "charmap.h"
 | 
					#include "charmap.h"
 | 
				
			||||||
 | 
					#include "cryptlib.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* ASN1_STRING_print_ex() and X509_NAME_print_ex().
 | 
					/* ASN1_STRING_print_ex() and X509_NAME_print_ex().
 | 
				
			||||||
 * Enhanced string and name printing routines handling
 | 
					 * Enhanced string and name printing routines handling
 | 
				
			||||||
@@ -77,8 +78,8 @@
 | 
				
			|||||||
/* Three IO functions for sending data to memory, a BIO and
 | 
					/* Three IO functions for sending data to memory, a BIO and
 | 
				
			||||||
 * and a FILE pointer.
 | 
					 * and a FILE pointer.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					#if 0				/* never used */
 | 
				
			||||||
int send_mem_chars(void *arg, const void *buf, int len)
 | 
					static int send_mem_chars(void *arg, const void *buf, int len)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	unsigned char **out = arg;
 | 
						unsigned char **out = arg;
 | 
				
			||||||
	if(!out) return 1;
 | 
						if(!out) return 1;
 | 
				
			||||||
@@ -86,15 +87,16 @@ int send_mem_chars(void *arg, const void *buf, int len)
 | 
				
			|||||||
	*out += len;
 | 
						*out += len;
 | 
				
			||||||
	return 1;
 | 
						return 1;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int send_bio_chars(void *arg, const void *buf, int len)
 | 
					static int send_bio_chars(void *arg, const void *buf, int len)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if(!arg) return 1;
 | 
						if(!arg) return 1;
 | 
				
			||||||
	if(BIO_write(arg, buf, len) != len) return 0;
 | 
						if(BIO_write(arg, buf, len) != len) return 0;
 | 
				
			||||||
	return 1;
 | 
						return 1;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int send_fp_chars(void *arg, const void *buf, int len)
 | 
					static int send_fp_chars(void *arg, const void *buf, int len)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if(!arg) return 1;
 | 
						if(!arg) return 1;
 | 
				
			||||||
	if(fwrite(buf, 1, len, arg) != (unsigned int)len) return 0;
 | 
						if(fwrite(buf, 1, len, arg) != (unsigned int)len) return 0;
 | 
				
			||||||
@@ -113,14 +115,17 @@ typedef int char_io(void *arg, const void *buf, int len);
 | 
				
			|||||||
static int do_esc_char(unsigned long c, unsigned char flags, char *do_quotes, char_io *io_ch, void *arg)
 | 
					static int do_esc_char(unsigned long c, unsigned char flags, char *do_quotes, char_io *io_ch, void *arg)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	unsigned char chflgs, chtmp;
 | 
						unsigned char chflgs, chtmp;
 | 
				
			||||||
	char tmphex[11];
 | 
						char tmphex[HEX_SIZE(long)+3];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if(c > 0xffffffffL)
 | 
				
			||||||
 | 
							return -1;
 | 
				
			||||||
	if(c > 0xffff) {
 | 
						if(c > 0xffff) {
 | 
				
			||||||
		BIO_snprintf(tmphex, 11, "\\W%08lX", c);
 | 
							BIO_snprintf(tmphex, sizeof tmphex, "\\W%08lX", c);
 | 
				
			||||||
		if(!io_ch(arg, tmphex, 10)) return -1;
 | 
							if(!io_ch(arg, tmphex, 10)) return -1;
 | 
				
			||||||
		return 10;
 | 
							return 10;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if(c > 0xff) {
 | 
						if(c > 0xff) {
 | 
				
			||||||
		BIO_snprintf(tmphex, 11, "\\U%04lX", c);
 | 
							BIO_snprintf(tmphex, sizeof tmphex, "\\U%04lX", c);
 | 
				
			||||||
		if(!io_ch(arg, tmphex, 6)) return -1;
 | 
							if(!io_ch(arg, tmphex, 6)) return -1;
 | 
				
			||||||
		return 6;
 | 
							return 6;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -194,7 +199,7 @@ static int do_buf(unsigned char *buf, int buflen,
 | 
				
			|||||||
		if(type & BUF_TYPE_CONVUTF8) {
 | 
							if(type & BUF_TYPE_CONVUTF8) {
 | 
				
			||||||
			unsigned char utfbuf[6];
 | 
								unsigned char utfbuf[6];
 | 
				
			||||||
			int utflen;
 | 
								int utflen;
 | 
				
			||||||
			utflen = UTF8_putc(utfbuf, 6, c);
 | 
								utflen = UTF8_putc(utfbuf, sizeof utfbuf, c);
 | 
				
			||||||
			for(i = 0; i < utflen; i++) {
 | 
								for(i = 0; i < utflen; i++) {
 | 
				
			||||||
				/* We don't need to worry about setting orflags correctly
 | 
									/* We don't need to worry about setting orflags correctly
 | 
				
			||||||
				 * because if utflen==1 its value will be correct anyway 
 | 
									 * because if utflen==1 its value will be correct anyway 
 | 
				
			||||||
@@ -240,7 +245,7 @@ static int do_hex_dump(char_io *io_ch, void *arg, unsigned char *buf, int buflen
 | 
				
			|||||||
 * #01234 format.
 | 
					 * #01234 format.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int do_dump(unsigned long lflags, char_io *io_ch, void *arg, ASN1_STRING *str)
 | 
					static int do_dump(unsigned long lflags, char_io *io_ch, void *arg, ASN1_STRING *str)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	/* Placing the ASN1_STRING in a temp ASN1_TYPE allows
 | 
						/* Placing the ASN1_STRING in a temp ASN1_TYPE allows
 | 
				
			||||||
	 * the DER encoding to readily obtained
 | 
						 * the DER encoding to readily obtained
 | 
				
			||||||
@@ -371,6 +376,8 @@ static int do_indent(char_io *io_ch, void *arg, int indent)
 | 
				
			|||||||
	return 1;
 | 
						return 1;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define FN_WIDTH_LN	25
 | 
				
			||||||
 | 
					#define FN_WIDTH_SN	10
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int do_name_ex(char_io *io_ch, void *arg, X509_NAME *n,
 | 
					static int do_name_ex(char_io *io_ch, void *arg, X509_NAME *n,
 | 
				
			||||||
				int indent, unsigned long flags)
 | 
									int indent, unsigned long flags)
 | 
				
			||||||
@@ -456,19 +463,29 @@ static int do_name_ex(char_io *io_ch, void *arg, X509_NAME *n,
 | 
				
			|||||||
		val = X509_NAME_ENTRY_get_data(ent);
 | 
							val = X509_NAME_ENTRY_get_data(ent);
 | 
				
			||||||
		fn_nid = OBJ_obj2nid(fn);
 | 
							fn_nid = OBJ_obj2nid(fn);
 | 
				
			||||||
		if(fn_opt != XN_FLAG_FN_NONE) {
 | 
							if(fn_opt != XN_FLAG_FN_NONE) {
 | 
				
			||||||
			int objlen;
 | 
								int objlen, fld_len;
 | 
				
			||||||
			if((fn_opt == XN_FLAG_FN_OID) || (fn_nid==NID_undef) ) {
 | 
								if((fn_opt == XN_FLAG_FN_OID) || (fn_nid==NID_undef) ) {
 | 
				
			||||||
				OBJ_obj2txt(objtmp, 80, fn, 1);
 | 
									OBJ_obj2txt(objtmp, sizeof objtmp, fn, 1);
 | 
				
			||||||
 | 
									fld_len = 0; /* XXX: what should this be? */
 | 
				
			||||||
				objbuf = objtmp;
 | 
									objbuf = objtmp;
 | 
				
			||||||
			} else {
 | 
								} else {
 | 
				
			||||||
				if(fn_opt == XN_FLAG_FN_SN) 
 | 
									if(fn_opt == XN_FLAG_FN_SN) {
 | 
				
			||||||
 | 
										fld_len = FN_WIDTH_SN;
 | 
				
			||||||
					objbuf = OBJ_nid2sn(fn_nid);
 | 
										objbuf = OBJ_nid2sn(fn_nid);
 | 
				
			||||||
				else if(fn_opt == XN_FLAG_FN_LN)
 | 
									} else if(fn_opt == XN_FLAG_FN_LN) {
 | 
				
			||||||
 | 
										fld_len = FN_WIDTH_LN;
 | 
				
			||||||
					objbuf = OBJ_nid2ln(fn_nid);
 | 
										objbuf = OBJ_nid2ln(fn_nid);
 | 
				
			||||||
				else objbuf = "";
 | 
									} else {
 | 
				
			||||||
 | 
										fld_len = 0; /* XXX: what should this be? */
 | 
				
			||||||
 | 
										objbuf = "";
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			objlen = strlen(objbuf);
 | 
								objlen = strlen(objbuf);
 | 
				
			||||||
			if(!io_ch(arg, objbuf, objlen)) return -1;
 | 
								if(!io_ch(arg, objbuf, objlen)) return -1;
 | 
				
			||||||
 | 
								if ((objlen < fld_len) && (flags & XN_FLAG_FN_ALIGN)) {
 | 
				
			||||||
 | 
									if (!do_indent(io_ch, arg, fld_len - objlen)) return -1;
 | 
				
			||||||
 | 
									outlen += fld_len - objlen;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
			if(!io_ch(arg, sep_eq, sep_eq_len)) return -1;
 | 
								if(!io_ch(arg, sep_eq, sep_eq_len)) return -1;
 | 
				
			||||||
			outlen += objlen + sep_eq_len;
 | 
								outlen += objlen + sep_eq_len;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -531,7 +548,7 @@ int ASN1_STRING_to_UTF8(unsigned char **out, ASN1_STRING *in)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	ASN1_STRING stmp, *str = &stmp;
 | 
						ASN1_STRING stmp, *str = &stmp;
 | 
				
			||||||
	int mbflag, type, ret;
 | 
						int mbflag, type, ret;
 | 
				
			||||||
	if(!*out || !in) return -1;
 | 
						if(!in) return -1;
 | 
				
			||||||
	type = in->type;
 | 
						type = in->type;
 | 
				
			||||||
	if((type < 0) || (type > 30)) return -1;
 | 
						if((type < 0) || (type > 30)) return -1;
 | 
				
			||||||
	mbflag = tag2nbyte[type];
 | 
						mbflag = tag2nbyte[type];
 | 
				
			||||||
@@ -540,6 +557,6 @@ int ASN1_STRING_to_UTF8(unsigned char **out, ASN1_STRING *in)
 | 
				
			|||||||
	stmp.data = NULL;
 | 
						stmp.data = NULL;
 | 
				
			||||||
	ret = ASN1_mbstring_copy(&str, in->data, in->length, mbflag, B_ASN1_UTF8STRING);
 | 
						ret = ASN1_mbstring_copy(&str, in->data, in->length, mbflag, B_ASN1_UTF8STRING);
 | 
				
			||||||
	if(ret < 0) return ret;
 | 
						if(ret < 0) return ret;
 | 
				
			||||||
	if(out) *out = stmp.data;
 | 
						*out = stmp.data;
 | 
				
			||||||
	return stmp.length;
 | 
						return stmp.length;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -105,9 +105,9 @@ int ASN1_STRING_set_default_mask_asc(char *p)
 | 
				
			|||||||
		mask = strtoul(p + 5, &end, 0);
 | 
							mask = strtoul(p + 5, &end, 0);
 | 
				
			||||||
		if(*end) return 0;
 | 
							if(*end) return 0;
 | 
				
			||||||
	} else if(!strcmp(p, "nombstr"))
 | 
						} else if(!strcmp(p, "nombstr"))
 | 
				
			||||||
			 mask = ~(B_ASN1_BMPSTRING|B_ASN1_UTF8STRING);
 | 
								 mask = ~((unsigned long)(B_ASN1_BMPSTRING|B_ASN1_UTF8STRING));
 | 
				
			||||||
	else if(!strcmp(p, "pkix"))
 | 
						else if(!strcmp(p, "pkix"))
 | 
				
			||||||
			mask = ~B_ASN1_T61STRING;
 | 
								mask = ~((unsigned long)B_ASN1_T61STRING);
 | 
				
			||||||
	else if(!strcmp(p, "utf8only")) mask = B_ASN1_UTF8STRING;
 | 
						else if(!strcmp(p, "utf8only")) mask = B_ASN1_UTF8STRING;
 | 
				
			||||||
	else if(!strcmp(p, "default"))
 | 
						else if(!strcmp(p, "default"))
 | 
				
			||||||
	    mask = 0xFFFFFFFFL;
 | 
						    mask = 0xFFFFFFFFL;
 | 
				
			||||||
@@ -170,8 +170,10 @@ static ASN1_STRING_TABLE tbl_standard[] = {
 | 
				
			|||||||
{NID_givenName,			1, ub_name, DIRSTRING_TYPE, 0},
 | 
					{NID_givenName,			1, ub_name, DIRSTRING_TYPE, 0},
 | 
				
			||||||
{NID_surname,			1, ub_name, DIRSTRING_TYPE, 0},
 | 
					{NID_surname,			1, ub_name, DIRSTRING_TYPE, 0},
 | 
				
			||||||
{NID_initials,			1, ub_name, DIRSTRING_TYPE, 0},
 | 
					{NID_initials,			1, ub_name, DIRSTRING_TYPE, 0},
 | 
				
			||||||
 | 
					{NID_friendlyName,		-1, -1, B_ASN1_BMPSTRING, STABLE_NO_MASK},
 | 
				
			||||||
{NID_name,			1, ub_name, DIRSTRING_TYPE, 0},
 | 
					{NID_name,			1, ub_name, DIRSTRING_TYPE, 0},
 | 
				
			||||||
{NID_dnQualifier,		-1, -1, B_ASN1_PRINTABLESTRING, STABLE_NO_MASK}
 | 
					{NID_dnQualifier,		-1, -1, B_ASN1_PRINTABLESTRING, STABLE_NO_MASK},
 | 
				
			||||||
 | 
					{NID_ms_csp_name,		-1, -1, B_ASN1_BMPSTRING, STABLE_NO_MASK}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int sk_table_cmp(const ASN1_STRING_TABLE * const *a,
 | 
					static int sk_table_cmp(const ASN1_STRING_TABLE * const *a,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -64,6 +64,7 @@
 | 
				
			|||||||
#include <stdio.h>
 | 
					#include <stdio.h>
 | 
				
			||||||
#include <time.h>
 | 
					#include <time.h>
 | 
				
			||||||
#include "cryptlib.h"
 | 
					#include "cryptlib.h"
 | 
				
			||||||
 | 
					#include "o_time.h"
 | 
				
			||||||
#include <openssl/asn1t.h>
 | 
					#include <openssl/asn1t.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
IMPLEMENT_ASN1_MSTRING(ASN1_TIME, B_ASN1_TIME)
 | 
					IMPLEMENT_ASN1_MSTRING(ASN1_TIME, B_ASN1_TIME)
 | 
				
			||||||
@@ -100,14 +101,11 @@ int i2d_ASN1_TIME(ASN1_TIME *a, unsigned char **pp)
 | 
				
			|||||||
ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t t)
 | 
					ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t t)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	struct tm *ts;
 | 
						struct tm *ts;
 | 
				
			||||||
#if defined(OPENSSL_THREADS) && !defined(OPENSSL_SYS_WIN32) && !defined(__CYGWIN32__)
 | 
					 | 
				
			||||||
	struct tm data;
 | 
						struct tm data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	gmtime_r(&t,&data);
 | 
						ts=OPENSSL_gmtime(&t,&data);
 | 
				
			||||||
	ts=&data; /* should return &data, but doesn't on some systems, so we don't even look at the return value */
 | 
						if (ts == NULL)
 | 
				
			||||||
#else
 | 
							return NULL;
 | 
				
			||||||
	ts=gmtime(&t);
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
	if((ts->tm_year >= 50) && (ts->tm_year < 150))
 | 
						if((ts->tm_year >= 50) && (ts->tm_year < 150))
 | 
				
			||||||
					return ASN1_UTCTIME_set(s, t);
 | 
										return ASN1_UTCTIME_set(s, t);
 | 
				
			||||||
	return ASN1_GENERALIZEDTIME_set(s,t);
 | 
						return ASN1_GENERALIZEDTIME_set(s,t);
 | 
				
			||||||
@@ -154,7 +152,7 @@ ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZE
 | 
				
			|||||||
	if (t->data[0] >= '5') strcpy(str, "19");
 | 
						if (t->data[0] >= '5') strcpy(str, "19");
 | 
				
			||||||
	else strcpy(str, "20");
 | 
						else strcpy(str, "20");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	strcat(str, (char *)t->data);
 | 
						BUF_strlcat(str, (char *)t->data, t->length+2);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return ret;
 | 
						return ret;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user