Compare commits
	
		
			1165 Commits
		
	
	
		
			OpenSSL_1_
			...
			OpenSSL_0_
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					67956bda58 | ||
| 
						 | 
					15d3cd4680 | ||
| 
						 | 
					da4fb3cb39 | ||
| 
						 | 
					e10051ef3f | ||
| 
						 | 
					c60dca1f95 | ||
| 
						 | 
					188abf7e2a | ||
| 
						 | 
					f021b7cca6 | ||
| 
						 | 
					c126b73a4a | ||
| 
						 | 
					3f03b3569d | ||
| 
						 | 
					07dd3bfcd4 | ||
| 
						 | 
					37afdc953e | ||
| 
						 | 
					044855e146 | ||
| 
						 | 
					12379c82ba | ||
| 
						 | 
					be98d6b9ad | ||
| 
						 | 
					910b484975 | ||
| 
						 | 
					1fde5b65c6 | ||
| 
						 | 
					c40bc0b11f | ||
| 
						 | 
					7a0c01b41a | ||
| 
						 | 
					6fe9c925d2 | ||
| 
						 | 
					1ebdc48d5a | ||
| 
						 | 
					395a6c69bd | ||
| 
						 | 
					0d658ddf25 | ||
| 
						 | 
					cefa7ce284 | ||
| 
						 | 
					ee4041b8bd | ||
| 
						 | 
					a17f351b56 | ||
| 
						 | 
					4fcf8d8b07 | ||
| 
						 | 
					b7650eb21e | ||
| 
						 | 
					69120ad199 | ||
| 
						 | 
					1eee8a4226 | ||
| 
						 | 
					98448a53c8 | ||
| 
						 | 
					241d088156 | ||
| 
						 | 
					a22a8dd7dd | ||
| 
						 | 
					e26ad0c4fd | ||
| 
						 | 
					6e7559ac7f | ||
| 
						 | 
					9feda63955 | ||
| 
						 | 
					1ed81ff731 | ||
| 
						 | 
					b2dc2e6dac | ||
| 
						 | 
					1b787fc04c | ||
| 
						 | 
					9a6401acdf | ||
| 
						 | 
					c40fcc1e40 | ||
| 
						 | 
					f908ca4db4 | ||
| 
						 | 
					72f6453c48 | ||
| 
						 | 
					eca7b90771 | ||
| 
						 | 
					7eb90ccefb | ||
| 
						 | 
					6ed534782f | ||
| 
						 | 
					1ee27238f7 | ||
| 
						 | 
					59689735a6 | ||
| 
						 | 
					1be16287ee | ||
| 
						 | 
					9fe4b73d97 | ||
| 
						 | 
					73cb37295d | ||
| 
						 | 
					1f35508ae6 | ||
| 
						 | 
					3e2a74c294 | ||
| 
						 | 
					a34922c476 | ||
| 
						 | 
					84be7091fd | ||
| 
						 | 
					f82c1f0dd8 | ||
| 
						 | 
					dc0cb7e74f | ||
| 
						 | 
					ab31dbc482 | ||
| 
						 | 
					36e9d3ee91 | ||
| 
						 | 
					cc8c0f6b46 | ||
| 
						 | 
					3eac70a356 | ||
| 
						 | 
					5f3ad8f82c | ||
| 
						 | 
					367316c723 | ||
| 
						 | 
					d34353cc91 | ||
| 
						 | 
					6287fa5396 | ||
| 
						 | 
					a00c3c4019 | ||
| 
						 | 
					f4677b7960 | ||
| 
						 | 
					92308905dd | ||
| 
						 | 
					6f32fc5c4e | ||
| 
						 | 
					e607e731eb | ||
| 
						 | 
					f17c45611e | ||
| 
						 | 
					1ff7b6492b | ||
| 
						 | 
					20900d6801 | ||
| 
						 | 
					4b253d904d | ||
| 
						 | 
					a51c8c64e0 | ||
| 
						 | 
					c153422388 | ||
| 
						 | 
					7f065cfdbd | ||
| 
						 | 
					667fbc0847 | ||
| 
						 | 
					6ba7bd5697 | ||
| 
						 | 
					2cad035c01 | ||
| 
						 | 
					2a76c68842 | ||
| 
						 | 
					1b00f4bc37 | ||
| 
						 | 
					be62eb6d93 | ||
| 
						 | 
					5f3878f1e3 | ||
| 
						 | 
					a523e997d3 | ||
| 
						 | 
					fe43caa4a4 | ||
| 
						 | 
					792e614144 | ||
| 
						 | 
					ce2b87d88a | ||
| 
						 | 
					f092a073a7 | ||
| 
						 | 
					6fa4cd7136 | ||
| 
						 | 
					505ed2b076 | ||
| 
						 | 
					cef3e62d2b | ||
| 
						 | 
					40ea9ff9e8 | ||
| 
						 | 
					a97a6b03bc | ||
| 
						 | 
					516f76fd2c | ||
| 
						 | 
					5a02ac6e5b | ||
| 
						 | 
					14d4074ee1 | ||
| 
						 | 
					d9f16c405c | ||
| 
						 | 
					bfc6482a7a | ||
| 
						 | 
					5aa032033e | ||
| 
						 | 
					2d59f9938f | ||
| 
						 | 
					c0ce8fe755 | ||
| 
						 | 
					55eff40084 | ||
| 
						 | 
					e5a251843d | ||
| 
						 | 
					fe46b0de29 | ||
| 
						 | 
					a581439bb1 | ||
| 
						 | 
					a43337e8c4 | ||
| 
						 | 
					33c51ec143 | ||
| 
						 | 
					448da15fbf | ||
| 
						 | 
					a1bb2d6c2f | ||
| 
						 | 
					81dde5e8fe | ||
| 
						 | 
					b84e441861 | ||
| 
						 | 
					08e012bbec | ||
| 
						 | 
					b46acc392b | ||
| 
						 | 
					28af6367b8 | ||
| 
						 | 
					2c17b493b1 | ||
| 
						 | 
					ea725a66c9 | ||
| 
						 | 
					1532493dab | ||
| 
						 | 
					3795297af8 | ||
| 
						 | 
					33fd33d423 | ||
| 
						 | 
					4e98f8863f | ||
| 
						 | 
					582ef3dbdb | ||
| 
						 | 
					6a933782fa | ||
| 
						 | 
					d1c2778e93 | ||
| 
						 | 
					8d64abacc6 | ||
| 
						 | 
					9af6802943 | ||
| 
						 | 
					c10f53a897 | ||
| 
						 | 
					2124e869a8 | ||
| 
						 | 
					3b668eedda | ||
| 
						 | 
					7471431322 | ||
| 
						 | 
					1542de4eed | ||
| 
						 | 
					b6c2bffbdf | ||
| 
						 | 
					ff09931e22 | ||
| 
						 | 
					155c70b882 | ||
| 
						 | 
					7c49452973 | ||
| 
						 | 
					312539ae9f | ||
| 
						 | 
					cc40dcce58 | ||
| 
						 | 
					5790921aea | ||
| 
						 | 
					df84c11407 | ||
| 
						 | 
					b76306c983 | ||
| 
						 | 
					cdffc716c9 | ||
| 
						 | 
					5dffc13f55 | ||
| 
						 | 
					a5873a8d3d | ||
| 
						 | 
					4db3e88459 | ||
| 
						 | 
					ab073bad4f | ||
| 
						 | 
					cfe04f607d | ||
| 
						 | 
					c0e9f540e0 | ||
| 
						 | 
					7c97aacbe8 | ||
| 
						 | 
					36b8f87566 | ||
| 
						 | 
					d875413a0b | ||
| 
						 | 
					155ad6d219 | ||
| 
						 | 
					138f20433e | ||
| 
						 | 
					7747c67861 | ||
| 
						 | 
					237a6f06b6 | ||
| 
						 | 
					fe99beb82a | ||
| 
						 | 
					736a77f275 | ||
| 
						 | 
					94539213a1 | ||
| 
						 | 
					c5c4246319 | ||
| 
						 | 
					2e6d8a8991 | ||
| 
						 | 
					e852835da6 | ||
| 
						 | 
					d245c32529 | ||
| 
						 | 
					964d58bcb0 | ||
| 
						 | 
					52702f6f92 | ||
| 
						 | 
					05794d983f | ||
| 
						 | 
					364f36f851 | ||
| 
						 | 
					9b809d6278 | ||
| 
						 | 
					bbefea3387 | ||
| 
						 | 
					d83dde6180 | ||
| 
						 | 
					63e1319d0f | ||
| 
						 | 
					8067d34b3a | ||
| 
						 | 
					e3f2860e73 | ||
| 
						 | 
					92eb44d238 | ||
| 
						 | 
					f4179bead4 | ||
| 
						 | 
					fced277486 | ||
| 
						 | 
					3d1be455ce | ||
| 
						 | 
					dee4d129cb | ||
| 
						 | 
					0067bd77a8 | ||
| 
						 | 
					d98904e5a7 | ||
| 
						 | 
					96a259e81e | ||
| 
						 | 
					59f3477b82 | ||
| 
						 | 
					f947b818bf | ||
| 
						 | 
					3fa1a444ce | ||
| 
						 | 
					a2dc9b6be2 | ||
| 
						 | 
					16349eeceb | ||
| 
						 | 
					aecf1c1f96 | ||
| 
						 | 
					4ea574fdf3 | ||
| 
						 | 
					cf8115deb0 | ||
| 
						 | 
					d25cbda074 | ||
| 
						 | 
					5d582fd516 | ||
| 
						 | 
					8ec86dcf04 | ||
| 
						 | 
					6d3b70c8da | ||
| 
						 | 
					0a4fda742b | ||
| 
						 | 
					3745e57bf9 | ||
| 
						 | 
					b7e7aa00de | ||
| 
						 | 
					1098fd48ce | ||
| 
						 | 
					393906d9be | ||
| 
						 | 
					446881468c | ||
| 
						 | 
					cfb95ba9f6 | ||
| 
						 | 
					c198c26226 | ||
| 
						 | 
					54d6ddba69 | ||
| 
						 | 
					1af12ff1d1 | ||
| 
						 | 
					bd72b8eca6 | ||
| 
						 | 
					200d00c854 | ||
| 
						 | 
					669b912dea | ||
| 
						 | 
					36a4a67b2b | ||
| 
						 | 
					3413424f01 | ||
| 
						 | 
					80fc840d89 | ||
| 
						 | 
					6455100f7a | ||
| 
						 | 
					b7c8b4fc95 | ||
| 
						 | 
					f58d0f70b6 | ||
| 
						 | 
					8f59c61d1d | ||
| 
						 | 
					fd43ae3fe4 | ||
| 
						 | 
					cdd0f3b328 | ||
| 
						 | 
					f9f6f0e9f0 | ||
| 
						 | 
					405f382144 | ||
| 
						 | 
					a750273546 | ||
| 
						 | 
					ddc5f6f328 | ||
| 
						 | 
					4231b356aa | ||
| 
						 | 
					df1f7b4b02 | ||
| 
						 | 
					0b7545b239 | ||
| 
						 | 
					3a72137211 | ||
| 
						 | 
					e5d289cc03 | ||
| 
						 | 
					0ff3766b0e | ||
| 
						 | 
					3562202306 | ||
| 
						 | 
					2bf4b96aef | ||
| 
						 | 
					811e08a2c5 | ||
| 
						 | 
					dd6e90465d | ||
| 
						 | 
					a86c626802 | ||
| 
						 | 
					705c3dec2c | ||
| 
						 | 
					4afcee8b4b | ||
| 
						 | 
					9627017f9c | ||
| 
						 | 
					e0f6c15418 | ||
| 
						 | 
					ecc20b75f8 | ||
| 
						 | 
					540e455e3a | ||
| 
						 | 
					14748adb09 | ||
| 
						 | 
					ff2ab9e6bb | ||
| 
						 | 
					cc5cc3bb8f | ||
| 
						 | 
					1f3206216b | ||
| 
						 | 
					f113bb9f4e | ||
| 
						 | 
					4681147bb3 | ||
| 
						 | 
					52c3f232e4 | ||
| 
						 | 
					3dc466424e | ||
| 
						 | 
					353415cc81 | ||
| 
						 | 
					1a12ce8ea5 | ||
| 
						 | 
					0278e15fa3 | ||
| 
						 | 
					f01f085cb9 | ||
| 
						 | 
					bca68e90cc | ||
| 
						 | 
					a3f67ec18d | ||
| 
						 | 
					56ef1cbc40 | ||
| 
						 | 
					a1411093f0 | ||
| 
						 | 
					f35f7d9fbb | ||
| 
						 | 
					dfbf646ac4 | ||
| 
						 | 
					591371566e | ||
| 
						 | 
					5799b72178 | ||
| 
						 | 
					1cfe6842d5 | ||
| 
						 | 
					f4c98a6a3d | ||
| 
						 | 
					4aefb1dd98 | ||
| 
						 | 
					aa03989791 | ||
| 
						 | 
					a865b2c320 | ||
| 
						 | 
					694ce314a8 | ||
| 
						 | 
					94299a36a6 | ||
| 
						 | 
					3aaeb5c1e5 | ||
| 
						 | 
					80ec6cc806 | ||
| 
						 | 
					3d83320279 | ||
| 
						 | 
					4ab252d198 | ||
| 
						 | 
					058ffd7623 | ||
| 
						 | 
					0330a13aea | ||
| 
						 | 
					467325b81d | ||
| 
						 | 
					00f716bbe6 | ||
| 
						 | 
					2f2f032497 | ||
| 
						 | 
					feb200bbb3 | ||
| 
						 | 
					3894667036 | ||
| 
						 | 
					203ac694e3 | ||
| 
						 | 
					bb592c75e7 | ||
| 
						 | 
					777d717c40 | ||
| 
						 | 
					143d84590f | ||
| 
						 | 
					a29669d78d | ||
| 
						 | 
					e5be1e1696 | ||
| 
						 | 
					9e47c34729 | ||
| 
						 | 
					cb896f8923 | ||
| 
						 | 
					cec9bce126 | ||
| 
						 | 
					3f79793b7e | ||
| 
						 | 
					0d01d8a735 | ||
| 
						 | 
					2c0fa03dc6 | ||
| 
						 | 
					d3b3a6d389 | ||
| 
						 | 
					fc260b09a1 | ||
| 
						 | 
					b3c79a8a27 | ||
| 
						 | 
					f0ecefc0c0 | ||
| 
						 | 
					b0118409a9 | ||
| 
						 | 
					5f23288692 | ||
| 
						 | 
					45c58c7d10 | ||
| 
						 | 
					112591be76 | ||
| 
						 | 
					1b8daa3693 | ||
| 
						 | 
					1cdbc755ee | ||
| 
						 | 
					aa9c7e4b8c | ||
| 
						 | 
					6be69a168f | ||
| 
						 | 
					eaf76feeb6 | ||
| 
						 | 
					03e79ed05e | ||
| 
						 | 
					56bef2df4f | ||
| 
						 | 
					10d3886c51 | ||
| 
						 | 
					f1c0cf5b70 | ||
| 
						 | 
					2a7ac69ee4 | ||
| 
						 | 
					d13ea8e184 | ||
| 
						 | 
					1820b04bb2 | ||
| 
						 | 
					439b7ef463 | ||
| 
						 | 
					a25fb95bd6 | ||
| 
						 | 
					6168067160 | ||
| 
						 | 
					c3031a4610 | ||
| 
						 | 
					1099a94063 | ||
| 
						 | 
					812d8a176c | ||
| 
						 | 
					db533c96e3 | ||
| 
						 | 
					8831eb7624 | ||
| 
						 | 
					3c8f315021 | ||
| 
						 | 
					0f2e636602 | ||
| 
						 | 
					98bd148b1a | ||
| 
						 | 
					292248b8c2 | ||
| 
						 | 
					d3eef3e5af | ||
| 
						 | 
					c5fbf8c1ba | ||
| 
						 | 
					1ed2d8f512 | ||
| 
						 | 
					d140890259 | ||
| 
						 | 
					eb492df2bb | ||
| 
						 | 
					2c16e78400 | ||
| 
						 | 
					bf2b87aea3 | ||
| 
						 | 
					1dff425999 | ||
| 
						 | 
					501af5ba89 | ||
| 
						 | 
					31d6e7b7ba | ||
| 
						 | 
					b983322bfb | ||
| 
						 | 
					339654e163 | ||
| 
						 | 
					5ca48cc853 | ||
| 
						 | 
					79996e3335 | ||
| 
						 | 
					173acc185c | ||
| 
						 | 
					a985ecdd17 | ||
| 
						 | 
					fb4c24b6e7 | ||
| 
						 | 
					1366f6b9bd | ||
| 
						 | 
					e13546f739 | ||
| 
						 | 
					d6c813daff | ||
| 
						 | 
					e3818a4c4b | ||
| 
						 | 
					415fe2abe9 | ||
| 
						 | 
					5bbdaaf4b7 | ||
| 
						 | 
					bf1f1a5759 | ||
| 
						 | 
					8e42429c9d | ||
| 
						 | 
					c43c2285f6 | ||
| 
						 | 
					94b2c29f9d | ||
| 
						 | 
					090f931a35 | ||
| 
						 | 
					6b8be6da76 | ||
| 
						 | 
					7ec2d392e7 | ||
| 
						 | 
					e88f66bb49 | ||
| 
						 | 
					28a2759ab8 | ||
| 
						 | 
					3edad44d6e | ||
| 
						 | 
					9e7459fc5d | ||
| 
						 | 
					b98f5ef42b | ||
| 
						 | 
					a6d4f79f24 | ||
| 
						 | 
					efcb7a75fc | ||
| 
						 | 
					30aa23fea2 | ||
| 
						 | 
					c9e045041e | ||
| 
						 | 
					fd6fa9c0b2 | ||
| 
						 | 
					9f70d09275 | ||
| 
						 | 
					3fb0f01001 | ||
| 
						 | 
					216ac24bd3 | ||
| 
						 | 
					2035af2091 | ||
| 
						 | 
					19398a175a | ||
| 
						 | 
					fa369ddbe7 | ||
| 
						 | 
					294ba3c282 | ||
| 
						 | 
					2923e91a98 | ||
| 
						 | 
					7c52b7706f | ||
| 
						 | 
					ddec587581 | ||
| 
						 | 
					4f466f8e81 | ||
| 
						 | 
					1502cda142 | ||
| 
						 | 
					ce2b5d7574 | ||
| 
						 | 
					f1c65db80b | ||
| 
						 | 
					496970b233 | ||
| 
						 | 
					3b0e61a812 | ||
| 
						 | 
					e84b0d709b | ||
| 
						 | 
					16241f0ea4 | ||
| 
						 | 
					518af4e3ae | ||
| 
						 | 
					fe01f90a1c | ||
| 
						 | 
					99a376df16 | ||
| 
						 | 
					831ffcb705 | ||
| 
						 | 
					5f297c4504 | ||
| 
						 | 
					d7623ff9f3 | ||
| 
						 | 
					df9b5405e8 | ||
| 
						 | 
					180eb5b3c2 | ||
| 
						 | 
					af7d49aaff | ||
| 
						 | 
					187b655bc2 | ||
| 
						 | 
					8612cb9239 | ||
| 
						 | 
					b2f3fafa6a | ||
| 
						 | 
					483dab147d | ||
| 
						 | 
					f39b8e697c | ||
| 
						 | 
					7d610299c9 | ||
| 
						 | 
					25550b2dd4 | ||
| 
						 | 
					5c676c47cd | ||
| 
						 | 
					e77f9d5e78 | ||
| 
						 | 
					9c04747623 | ||
| 
						 | 
					e66deb6817 | ||
| 
						 | 
					cc9a645a02 | ||
| 
						 | 
					18fb9d807e | ||
| 
						 | 
					a1cc568288 | ||
| 
						 | 
					2ea3cd8abc | ||
| 
						 | 
					095db72024 | ||
| 
						 | 
					11eb172b6e | ||
| 
						 | 
					4b60f4b175 | ||
| 
						 | 
					0794f3a798 | ||
| 
						 | 
					2b8e7b5061 | ||
| 
						 | 
					6f57311da0 | ||
| 
						 | 
					98b09d3949 | ||
| 
						 | 
					231a737a82 | ||
| 
						 | 
					236860735e | ||
| 
						 | 
					ac1ef7ec72 | ||
| 
						 | 
					5f761514e1 | ||
| 
						 | 
					32f1f622f6 | ||
| 
						 | 
					5f95651316 | ||
| 
						 | 
					ccac657556 | ||
| 
						 | 
					a9c23ea079 | ||
| 
						 | 
					33ffe2a7f7 | ||
| 
						 | 
					7c717aafc6 | ||
| 
						 | 
					225aeb171e | ||
| 
						 | 
					ffe181c366 | ||
| 
						 | 
					fd4e79a9ed | ||
| 
						 | 
					299e174d2d | ||
| 
						 | 
					ce62fc6eae | ||
| 
						 | 
					43490dfb89 | ||
| 
						 | 
					a523276786 | ||
| 
						 | 
					074471ab0c | ||
| 
						 | 
					d761421e1d | ||
| 
						 | 
					2339c5d722 | ||
| 
						 | 
					dd00266757 | ||
| 
						 | 
					bb99ce5f80 | ||
| 
						 | 
					49f42ec0f6 | ||
| 
						 | 
					91d509f0d9 | ||
| 
						 | 
					d5e858c55f | ||
| 
						 | 
					fb8fcce2ac | ||
| 
						 | 
					d4736ae701 | ||
| 
						 | 
					3e1158522a | ||
| 
						 | 
					57191f86d9 | ||
| 
						 | 
					0a89c575de | ||
| 
						 | 
					4c860910df | ||
| 
						 | 
					0fc3d51b7d | ||
| 
						 | 
					c4b0d7879e | ||
| 
						 | 
					aab1ec3f36 | ||
| 
						 | 
					fbfa11fb29 | ||
| 
						 | 
					284498fcef | ||
| 
						 | 
					07d9808496 | ||
| 
						 | 
					4ab0088bfe | ||
| 
						 | 
					3bd1690bfb | ||
| 
						 | 
					29f4b05954 | ||
| 
						 | 
					48ca0c99b2 | ||
| 
						 | 
					015052cf7b | ||
| 
						 | 
					9ce3ee47ba | ||
| 
						 | 
					2e3fd54337 | ||
| 
						 | 
					625782f7ee | ||
| 
						 | 
					1c90899eef | ||
| 
						 | 
					4f2b7d48b1 | ||
| 
						 | 
					458c3900e1 | ||
| 
						 | 
					ba75b4e750 | ||
| 
						 | 
					ab011d51be | ||
| 
						 | 
					898d9b1a87 | ||
| 
						 | 
					4f9a9d2b79 | ||
| 
						 | 
					346f2f93e1 | ||
| 
						 | 
					25b0e072dd | ||
| 
						 | 
					dc13c882fb | ||
| 
						 | 
					12a52467c8 | ||
| 
						 | 
					22e6c73dcc | ||
| 
						 | 
					53b9696f3f | ||
| 
						 | 
					7e4fe4662b | ||
| 
						 | 
					18fd413f37 | ||
| 
						 | 
					80ed5f84de | ||
| 
						 | 
					b48111df7c | ||
| 
						 | 
					73e3edd70d | ||
| 
						 | 
					d4cfbdf2c0 | ||
| 
						 | 
					294f03a812 | ||
| 
						 | 
					272f9f3d27 | ||
| 
						 | 
					927a28ba3b | ||
| 
						 | 
					a938c4284e | ||
| 
						 | 
					7a44a0cee7 | ||
| 
						 | 
					82430309ac | ||
| 
						 | 
					c2079de880 | ||
| 
						 | 
					967ead7269 | ||
| 
						 | 
					c9255df519 | ||
| 
						 | 
					27c824a1c9 | ||
| 
						 | 
					5b96d1ccf9 | ||
| 
						 | 
					29c0866b38 | ||
| 
						 | 
					0214ea0dfe | ||
| 
						 | 
					80355002a1 | ||
| 
						 | 
					0e36825228 | ||
| 
						 | 
					95a8f1469f | ||
| 
						 | 
					afdbadc704 | ||
| 
						 | 
					004cc26abf | ||
| 
						 | 
					35a924c576 | ||
| 
						 | 
					99279ac97a | ||
| 
						 | 
					87605ca1e2 | ||
| 
						 | 
					7cc586f117 | ||
| 
						 | 
					c263a6092c | ||
| 
						 | 
					f92fd85400 | ||
| 
						 | 
					e71520ddd6 | ||
| 
						 | 
					275f34b5d2 | ||
| 
						 | 
					50fbb6ed36 | ||
| 
						 | 
					34fdacbd35 | ||
| 
						 | 
					77f2d20dbc | ||
| 
						 | 
					0dbfbf26cb | ||
| 
						 | 
					2863a6878f | ||
| 
						 | 
					ae46e91e4d | ||
| 
						 | 
					865a90eb4f | ||
| 
						 | 
					0269c4507c | ||
| 
						 | 
					a5d3574984 | ||
| 
						 | 
					1040deb0c5 | ||
| 
						 | 
					05ea800faf | ||
| 
						 | 
					341f87862c | ||
| 
						 | 
					f805d30769 | ||
| 
						 | 
					4fb9472cc2 | ||
| 
						 | 
					a8098740c6 | ||
| 
						 | 
					e3af0d041e | ||
| 
						 | 
					28cfda9f30 | ||
| 
						 | 
					a313e23fff | ||
| 
						 | 
					4d2a292e8a | ||
| 
						 | 
					5a84b7fc2d | ||
| 
						 | 
					d8e660a6dc | ||
| 
						 | 
					761f3b403b | ||
| 
						 | 
					4570d29404 | ||
| 
						 | 
					14346b3456 | ||
| 
						 | 
					769f58aaaa | ||
| 
						 | 
					a166e96d16 | ||
| 
						 | 
					8dd8ce1dc3 | ||
| 
						 | 
					4c5979a107 | ||
| 
						 | 
					649ab2dcfa | ||
| 
						 | 
					71fc9b37ae | ||
| 
						 | 
					283aedf498 | ||
| 
						 | 
					1a56614af2 | ||
| 
						 | 
					693c33e407 | ||
| 
						 | 
					d9a9aa027d | ||
| 
						 | 
					b22250bb67 | ||
| 
						 | 
					d446120527 | ||
| 
						 | 
					bb9d68489c | ||
| 
						 | 
					affaea59fe | ||
| 
						 | 
					81fc4c93ef | ||
| 
						 | 
					8957121c14 | ||
| 
						 | 
					50241bc84e | ||
| 
						 | 
					e7f077f1ba | ||
| 
						 | 
					c3b82c7610 | ||
| 
						 | 
					2c12e7f6f5 | ||
| 
						 | 
					8db10d9ac4 | ||
| 
						 | 
					c3cc4662af | ||
| 
						 | 
					22892f9803 | ||
| 
						 | 
					27eb115fb6 | ||
| 
						 | 
					51a596ef4f | ||
| 
						 | 
					97de8bd1e0 | ||
| 
						 | 
					1cb7e5be5b | ||
| 
						 | 
					84dd04e761 | ||
| 
						 | 
					2ac061e487 | ||
| 
						 | 
					7cdb81582c | ||
| 
						 | 
					8f33b40302 | ||
| 
						 | 
					e600614ef5 | ||
| 
						 | 
					02581dea1f | ||
| 
						 | 
					40ad08bcc2 | ||
| 
						 | 
					9c4456a13f | ||
| 
						 | 
					f4d0392faa | ||
| 
						 | 
					45ba6cfe03 | ||
| 
						 | 
					4f23a0c797 | ||
| 
						 | 
					f6c32bbf2b | ||
| 
						 | 
					d040c951f0 | ||
| 
						 | 
					69abfb0e33 | ||
| 
						 | 
					9a1daf8482 | ||
| 
						 | 
					9de6dc3af3 | ||
| 
						 | 
					248834dcaa | ||
| 
						 | 
					11a7da7c9f | ||
| 
						 | 
					9fea0b9937 | ||
| 
						 | 
					6fd3f3260d | ||
| 
						 | 
					d9e262443c | ||
| 
						 | 
					51c3bb3b98 | ||
| 
						 | 
					7d608f9e32 | ||
| 
						 | 
					295de18c8a | ||
| 
						 | 
					3370b694b9 | ||
| 
						 | 
					3380c52f15 | ||
| 
						 | 
					1364e6f1ac | ||
| 
						 | 
					c5ac2aa62c | ||
| 
						 | 
					392a0345de | ||
| 
						 | 
					5c2fc73e7b | ||
| 
						 | 
					402b951804 | ||
| 
						 | 
					5848d13fed | ||
| 
						 | 
					5dd24ead57 | ||
| 
						 | 
					d2cb94952a | ||
| 
						 | 
					0615396d2d | ||
| 
						 | 
					82877ea449 | ||
| 
						 | 
					81fae49db9 | ||
| 
						 | 
					74ff8dc975 | ||
| 
						 | 
					ac319217d0 | ||
| 
						 | 
					cdb13ae8d0 | ||
| 
						 | 
					ab700807d9 | ||
| 
						 | 
					744b91bb9f | ||
| 
						 | 
					d69f85bf15 | ||
| 
						 | 
					52ee969e29 | ||
| 
						 | 
					55f0501201 | ||
| 
						 | 
					b2710ee19a | ||
| 
						 | 
					bbfcc4724d | ||
| 
						 | 
					c31cc72d79 | ||
| 
						 | 
					d1049ad93e | ||
| 
						 | 
					5f4cc234fb | ||
| 
						 | 
					d31a13953c | ||
| 
						 | 
					28f5873179 | ||
| 
						 | 
					8f813338f1 | ||
| 
						 | 
					6555dfa486 | ||
| 
						 | 
					5eee0253e5 | ||
| 
						 | 
					594c723f98 | ||
| 
						 | 
					f418265865 | ||
| 
						 | 
					53707e2eec | ||
| 
						 | 
					fde794e898 | ||
| 
						 | 
					082f19b42d | ||
| 
						 | 
					e31c620686 | ||
| 
						 | 
					570253315f | ||
| 
						 | 
					5dcdac6e4e | ||
| 
						 | 
					eea3fce854 | ||
| 
						 | 
					215c49d032 | ||
| 
						 | 
					923df53e25 | ||
| 
						 | 
					1a684d0020 | ||
| 
						 | 
					dc3b721fa0 | ||
| 
						 | 
					4479ce9c1c | ||
| 
						 | 
					4a0d3530e0 | ||
| 
						 | 
					9907d2992d | ||
| 
						 | 
					9d9224f184 | ||
| 
						 | 
					78d4d87e39 | ||
| 
						 | 
					6211633273 | ||
| 
						 | 
					3a4cf918bf | ||
| 
						 | 
					e25eb309ec | ||
| 
						 | 
					ffa2b2aa7d | ||
| 
						 | 
					a77a95584d | ||
| 
						 | 
					68bb98159f | ||
| 
						 | 
					8e6905d238 | ||
| 
						 | 
					1a8521ff24 | ||
| 
						 | 
					9d5460d72d | ||
| 
						 | 
					35e59297fc | ||
| 
						 | 
					9b945233b1 | ||
| 
						 | 
					b065dc2eee | ||
| 
						 | 
					66c4bb1a70 | ||
| 
						 | 
					36abe6fe61 | ||
| 
						 | 
					3c786aa6c8 | ||
| 
						 | 
					e5cce6d356 | ||
| 
						 | 
					723b7d81e4 | ||
| 
						 | 
					a3ddd7358b | ||
| 
						 | 
					45c027f31f | ||
| 
						 | 
					3b62e9eb0d | ||
| 
						 | 
					34a8c7ec87 | ||
| 
						 | 
					d4a6240005 | ||
| 
						 | 
					5c6f76da0a | ||
| 
						 | 
					4636341b05 | ||
| 
						 | 
					be3b770d8f | ||
| 
						 | 
					af32387b3f | ||
| 
						 | 
					115fc340cb | ||
| 
						 | 
					900f7a8776 | ||
| 
						 | 
					4877e30504 | ||
| 
						 | 
					4656ec3852 | ||
| 
						 | 
					e336441197 | ||
| 
						 | 
					20d6182f33 | ||
| 
						 | 
					aa145866f9 | ||
| 
						 | 
					fdff41e166 | ||
| 
						 | 
					07b4bc3979 | ||
| 
						 | 
					0c66d3ae37 | ||
| 
						 | 
					bd869183d5 | ||
| 
						 | 
					7e2bf83100 | ||
| 
						 | 
					25e52a78fb | ||
| 
						 | 
					47c4bb2ddf | ||
| 
						 | 
					951dfbb13a | ||
| 
						 | 
					81780a3b62 | ||
| 
						 | 
					c574d0cdf2 | ||
| 
						 | 
					c987c3f999 | ||
| 
						 | 
					1a5e414863 | ||
| 
						 | 
					ec3639385e | ||
| 
						 | 
					f01cfca6a4 | ||
| 
						 | 
					7d5af5e0fa | ||
| 
						 | 
					8fdb296cbd | ||
| 
						 | 
					879b30aaa3 | ||
| 
						 | 
					40ddcb717a | ||
| 
						 | 
					da1841a075 | ||
| 
						 | 
					0a0a10d127 | ||
| 
						 | 
					df20b6e79b | ||
| 
						 | 
					f4f1dc39e0 | ||
| 
						 | 
					340b4dd7df | ||
| 
						 | 
					4b9dcd821f | ||
| 
						 | 
					669c5c9380 | ||
| 
						 | 
					7f9aa6c59b | ||
| 
						 | 
					d9c06b56ca | ||
| 
						 | 
					d045e1d77e | ||
| 
						 | 
					6d14cc7ec1 | ||
| 
						 | 
					eb499b2854 | ||
| 
						 | 
					65a82ef6d7 | ||
| 
						 | 
					616f581650 | ||
| 
						 | 
					57e802656f | ||
| 
						 | 
					5d7f15daf8 | ||
| 
						 | 
					ec67e3b7e4 | ||
| 
						 | 
					0d3ff3c073 | ||
| 
						 | 
					325e48867c | ||
| 
						 | 
					8de95bc05b | ||
| 
						 | 
					5e3003bb52 | ||
| 
						 | 
					e6e3f38bfa | ||
| 
						 | 
					aa17ab7e57 | ||
| 
						 | 
					35908bd040 | ||
| 
						 | 
					4a9cfd763e | ||
| 
						 | 
					0e73294e26 | ||
| 
						 | 
					b610f46bae | ||
| 
						 | 
					1921a1adb2 | ||
| 
						 | 
					6d2cd23f40 | ||
| 
						 | 
					14fb67f28a | ||
| 
						 | 
					c552680473 | ||
| 
						 | 
					edbf9f878d | ||
| 
						 | 
					2745ddfc33 | ||
| 
						 | 
					808606034a | ||
| 
						 | 
					e18eef3d7a | ||
| 
						 | 
					e78fc11a95 | ||
| 
						 | 
					83231cb376 | ||
| 
						 | 
					986ad56124 | ||
| 
						 | 
					b723a7b11b | ||
| 
						 | 
					1b6b67b17e | ||
| 
						 | 
					1ee3236f72 | ||
| 
						 | 
					b03a4917be | ||
| 
						 | 
					84971b39f5 | ||
| 
						 | 
					5ab3e743f3 | ||
| 
						 | 
					1c5dc844e7 | ||
| 
						 | 
					f871949efd | ||
| 
						 | 
					eb2ec6bee9 | ||
| 
						 | 
					df22f59f6e | ||
| 
						 | 
					db0edc3273 | ||
| 
						 | 
					6300c14248 | ||
| 
						 | 
					d4426e79a7 | ||
| 
						 | 
					b095418d20 | ||
| 
						 | 
					d6fd880481 | ||
| 
						 | 
					cbb0b734c7 | ||
| 
						 | 
					f4bcd70f27 | ||
| 
						 | 
					6e16b45d9d | ||
| 
						 | 
					e09e7ab362 | ||
| 
						 | 
					d5cc2f19cd | ||
| 
						 | 
					b7a80146f4 | ||
| 
						 | 
					5586a71a6e | ||
| 
						 | 
					81418b7c77 | ||
| 
						 | 
					8bd0c77ae3 | ||
| 
						 | 
					e2217e7ed5 | ||
| 
						 | 
					51b75ea7ef | ||
| 
						 | 
					41d4d6721c | ||
| 
						 | 
					9d01d50459 | ||
| 
						 | 
					e27c67c5c5 | ||
| 
						 | 
					e7decd5f4d | ||
| 
						 | 
					38a3178185 | ||
| 
						 | 
					58828ae573 | ||
| 
						 | 
					6b5f5e3508 | ||
| 
						 | 
					f0ec771933 | ||
| 
						 | 
					22d1087e16 | ||
| 
						 | 
					9f85fcefdc | ||
| 
						 | 
					269d2575cd | ||
| 
						 | 
					0b8ed5de2d | ||
| 
						 | 
					c22684eac9 | ||
| 
						 | 
					c42cd4b831 | ||
| 
						 | 
					4d018f7067 | ||
| 
						 | 
					46eaf3b0cc | ||
| 
						 | 
					9df2a00b94 | ||
| 
						 | 
					fbcf4bc1f2 | ||
| 
						 | 
					ca08c064bb | ||
| 
						 | 
					02df47d349 | ||
| 
						 | 
					41c39e3366 | ||
| 
						 | 
					45803988ce | ||
| 
						 | 
					28251e7ff9 | ||
| 
						 | 
					217382d584 | ||
| 
						 | 
					82a2cb6f51 | ||
| 
						 | 
					611ed5f312 | ||
| 
						 | 
					27fbb5dbf4 | ||
| 
						 | 
					db8d9b7cf1 | ||
| 
						 | 
					60ec950517 | ||
| 
						 | 
					2cd4ebc01f | ||
| 
						 | 
					5f4dcaf781 | ||
| 
						 | 
					c55d882fab | ||
| 
						 | 
					8dc7450068 | ||
| 
						 | 
					2e885232c2 | ||
| 
						 | 
					970d9b3795 | ||
| 
						 | 
					2f58af0d85 | ||
| 
						 | 
					0ae50f19da | ||
| 
						 | 
					c4ac37361e | ||
| 
						 | 
					3152861e81 | ||
| 
						 | 
					a14afd0804 | ||
| 
						 | 
					25d5d1a60d | ||
| 
						 | 
					6ff58b9240 | ||
| 
						 | 
					99237262d4 | ||
| 
						 | 
					29982dfd15 | ||
| 
						 | 
					6c4da94687 | ||
| 
						 | 
					6986d0e6eb | ||
| 
						 | 
					bc9320452c | ||
| 
						 | 
					23d43aae27 | ||
| 
						 | 
					de71735e7c | ||
| 
						 | 
					05decf3638 | ||
| 
						 | 
					95bffa1a1f | ||
| 
						 | 
					974d52fdb8 | ||
| 
						 | 
					7614f0e55e | ||
| 
						 | 
					0632284f79 | ||
| 
						 | 
					ad4a89f070 | ||
| 
						 | 
					6104c49f31 | ||
| 
						 | 
					07fc760999 | ||
| 
						 | 
					cf6bc84148 | ||
| 
						 | 
					36d51bea93 | ||
| 
						 | 
					fc12885b1b | ||
| 
						 | 
					ec7033745e | ||
| 
						 | 
					9e31e63147 | ||
| 
						 | 
					feef17fd88 | ||
| 
						 | 
					817f011191 | ||
| 
						 | 
					98c045cf3a | ||
| 
						 | 
					8860f3a82a | ||
| 
						 | 
					43e9f4ca2f | ||
| 
						 | 
					586f843c76 | ||
| 
						 | 
					7cfc9e6d8c | ||
| 
						 | 
					4952ed0fa4 | ||
| 
						 | 
					a084185d76 | ||
| 
						 | 
					914b80d276 | ||
| 
						 | 
					282557da52 | ||
| 
						 | 
					5f649d583c | ||
| 
						 | 
					b98225ebf5 | ||
| 
						 | 
					abb0c2bba4 | ||
| 
						 | 
					b3bdb474a9 | ||
| 
						 | 
					d796e6acb7 | ||
| 
						 | 
					d3afc92bc9 | ||
| 
						 | 
					35a97b4b7b | ||
| 
						 | 
					f59463aad3 | ||
| 
						 | 
					ed656499c4 | ||
| 
						 | 
					63533e9a22 | ||
| 
						 | 
					20f7053254 | ||
| 
						 | 
					8b8ef74d39 | ||
| 
						 | 
					3bfe024d8d | ||
| 
						 | 
					063333e03d | ||
| 
						 | 
					0a0918ff38 | ||
| 
						 | 
					802c014656 | ||
| 
						 | 
					860841794d | ||
| 
						 | 
					2a87c31237 | ||
| 
						 | 
					da5f7fdcee | ||
| 
						 | 
					d8b408b1de | ||
| 
						 | 
					64932f9e4a | ||
| 
						 | 
					5a20efcf17 | ||
| 
						 | 
					2a2857bbc8 | ||
| 
						 | 
					1bef284ab1 | ||
| 
						 | 
					d8d0b6434f | ||
| 
						 | 
					416b6fd115 | ||
| 
						 | 
					f685cf920b | ||
| 
						 | 
					54f51116b2 | ||
| 
						 | 
					b0d90958fc | ||
| 
						 | 
					049ced2c2f | ||
| 
						 | 
					844b0e603b | ||
| 
						 | 
					75ef751e23 | ||
| 
						 | 
					c4f6e56fca | ||
| 
						 | 
					ff86d3d894 | ||
| 
						 | 
					85b4c03e33 | ||
| 
						 | 
					efaf159af6 | ||
| 
						 | 
					daa657fb78 | ||
| 
						 | 
					4685663d73 | ||
| 
						 | 
					ed1f716022 | ||
| 
						 | 
					d3205a4898 | ||
| 
						 | 
					86731ce2c6 | ||
| 
						 | 
					1399309624 | ||
| 
						 | 
					cb59297438 | ||
| 
						 | 
					5824f6bc06 | ||
| 
						 | 
					5ce7090d54 | ||
| 
						 | 
					7306ab29bc | ||
| 
						 | 
					3a8b42f291 | ||
| 
						 | 
					e4c25383f2 | ||
| 
						 | 
					e734dcc2c7 | ||
| 
						 | 
					0fce007b8e | ||
| 
						 | 
					5a053a3a07 | ||
| 
						 | 
					3b2ba5f7fb | ||
| 
						 | 
					7f622f6c04 | ||
| 
						 | 
					801136bcc2 | ||
| 
						 | 
					3c0e39c539 | ||
| 
						 | 
					19fddebf0e | ||
| 
						 | 
					9eaf7e14c7 | ||
| 
						 | 
					0e441bc103 | ||
| 
						 | 
					cd9911fdf8 | ||
| 
						 | 
					6086422193 | ||
| 
						 | 
					9ddb11f11c | ||
| 
						 | 
					7a20cabd03 | ||
| 
						 | 
					9dc4ca4507 | ||
| 
						 | 
					62fea98b4f | ||
| 
						 | 
					7ae4eac5b6 | ||
| 
						 | 
					fcf8ae5e2b | ||
| 
						 | 
					55b9a7938b | ||
| 
						 | 
					cf1546a60e | ||
| 
						 | 
					e7eec05af0 | ||
| 
						 | 
					98e986141b | ||
| 
						 | 
					d7e35e0371 | ||
| 
						 | 
					222f224664 | ||
| 
						 | 
					62b6cd007f | ||
| 
						 | 
					1682e8fb12 | ||
| 
						 | 
					984aefe0e8 | ||
| 
						 | 
					2d54cc69c9 | ||
| 
						 | 
					2dd8278de8 | ||
| 
						 | 
					e0d8ac972e | ||
| 
						 | 
					ec03812fb0 | ||
| 
						 | 
					93cf2b17bf | ||
| 
						 | 
					77ef1a989d | ||
| 
						 | 
					423c7ac6c6 | ||
| 
						 | 
					2c368ef148 | ||
| 
						 | 
					b3c7162fd0 | ||
| 
						 | 
					67865069eb | ||
| 
						 | 
					1896a9be60 | ||
| 
						 | 
					b5b2c037c1 | ||
| 
						 | 
					1957924d51 | ||
| 
						 | 
					104a66f256 | ||
| 
						 | 
					3de6d65ea3 | ||
| 
						 | 
					fdb0a6e004 | ||
| 
						 | 
					87b857b6bf | ||
| 
						 | 
					b18165301d | ||
| 
						 | 
					097e65944a | ||
| 
						 | 
					0cdd29ea78 | ||
| 
						 | 
					7dec24688f | ||
| 
						 | 
					e62fa54811 | ||
| 
						 | 
					1614174e79 | ||
| 
						 | 
					f95d097359 | ||
| 
						 | 
					3c6ab9aad9 | ||
| 
						 | 
					4913b88f70 | ||
| 
						 | 
					273157153c | ||
| 
						 | 
					fb5156ff38 | ||
| 
						 | 
					2a824402f3 | ||
| 
						 | 
					86a249fe4f | ||
| 
						 | 
					6cae8221c9 | ||
| 
						 | 
					750cb3d248 | ||
| 
						 | 
					f254b540b8 | ||
| 
						 | 
					11024f252e | ||
| 
						 | 
					9d5cba17ba | ||
| 
						 | 
					1d01c9d43d | ||
| 
						 | 
					e32ea81876 | ||
| 
						 | 
					ef8a18f49b | ||
| 
						 | 
					b914049c53 | ||
| 
						 | 
					dabaea8048 | ||
| 
						 | 
					09c1a425a9 | ||
| 
						 | 
					8c6fed007f | ||
| 
						 | 
					2e39604021 | ||
| 
						 | 
					fbfb947b21 | ||
| 
						 | 
					8b963f4ba4 | ||
| 
						 | 
					9152f07eaf | ||
| 
						 | 
					35f70c09f5 | ||
| 
						 | 
					cc4cba7b5d | ||
| 
						 | 
					6b695fefd0 | ||
| 
						 | 
					910d193029 | ||
| 
						 | 
					f18dd687c8 | ||
| 
						 | 
					50d5376698 | ||
| 
						 | 
					5b9b62a7db | ||
| 
						 | 
					c0e29e5b01 | ||
| 
						 | 
					2f03129d46 | ||
| 
						 | 
					b44e2d3416 | ||
| 
						 | 
					564915681c | ||
| 
						 | 
					a24b7eeb87 | ||
| 
						 | 
					0215c01861 | ||
| 
						 | 
					beae6324e5 | ||
| 
						 | 
					71a61c573e | ||
| 
						 | 
					6b3b632767 | ||
| 
						 | 
					2a2fa04b7b | ||
| 
						 | 
					79b81d194b | ||
| 
						 | 
					ef04c9aff8 | ||
| 
						 | 
					7f85197c10 | ||
| 
						 | 
					ff0bfe64af | ||
| 
						 | 
					44b3a3a5e6 | ||
| 
						 | 
					7e3033aa93 | ||
| 
						 | 
					8bdbf50772 | ||
| 
						 | 
					ec33a76641 | ||
| 
						 | 
					00ce9376c7 | ||
| 
						 | 
					46e7a9797e | ||
| 
						 | 
					7006c4ac88 | ||
| 
						 | 
					a50a2126cf | ||
| 
						 | 
					07f7b4b470 | ||
| 
						 | 
					7e726e42f4 | ||
| 
						 | 
					40ba0257de | ||
| 
						 | 
					3fbd5f9fea | ||
| 
						 | 
					57b2246d35 | ||
| 
						 | 
					2a5b22d6f9 | ||
| 
						 | 
					f247dc7522 | ||
| 
						 | 
					e6531253e2 | ||
| 
						 | 
					c938babf00 | ||
| 
						 | 
					bf3900020f | ||
| 
						 | 
					586df3bb7f | ||
| 
						 | 
					c4b13b0268 | ||
| 
						 | 
					daef72316f | ||
| 
						 | 
					1f93c96e63 | ||
| 
						 | 
					8aa9c79276 | ||
| 
						 | 
					09a7f2e734 | ||
| 
						 | 
					b2d27e376d | ||
| 
						 | 
					644c4af11e | ||
| 
						 | 
					ca3dc3a0a0 | ||
| 
						 | 
					2b975dfd5b | ||
| 
						 | 
					0932892278 | ||
| 
						 | 
					fe0b3d98c2 | ||
| 
						 | 
					8d56c8b51c | ||
| 
						 | 
					d8e6409336 | ||
| 
						 | 
					a4ae746656 | ||
| 
						 | 
					331a0a7b9b | ||
| 
						 | 
					c630a3e8d6 | ||
| 
						 | 
					7435d89edf | ||
| 
						 | 
					14557c8be4 | ||
| 
						 | 
					98b4995bad | ||
| 
						 | 
					3000bdcc3a | ||
| 
						 | 
					cbe77a6753 | ||
| 
						 | 
					c58a1f76f8 | ||
| 
						 | 
					ecf2875ebf | ||
| 
						 | 
					ce2c19e357 | ||
| 
						 | 
					1b1081a3ed | ||
| 
						 | 
					37b200389a | ||
| 
						 | 
					6b5a8f3a22 | ||
| 
						 | 
					0b18d8b0c7 | ||
| 
						 | 
					3d187ede47 | ||
| 
						 | 
					f3b9c34515 | ||
| 
						 | 
					c923394924 | ||
| 
						 | 
					d9dbd24db5 | ||
| 
						 | 
					b135819d71 | ||
| 
						 | 
					cbcbd07da2 | ||
| 
						 | 
					24f6ab73a7 | ||
| 
						 | 
					5e88347e1b | ||
| 
						 | 
					cac0d4ee6f | ||
| 
						 | 
					428759b3d4 | ||
| 
						 | 
					898d3ecce0 | ||
| 
						 | 
					004f16f6c4 | ||
| 
						 | 
					4e2a0e58f2 | ||
| 
						 | 
					39d29195a7 | ||
| 
						 | 
					727c9b8027 | ||
| 
						 | 
					bd4e9b0512 | ||
| 
						 | 
					7844ff735f | ||
| 
						 | 
					49e96badcf | ||
| 
						 | 
					eb6a81bacc | ||
| 
						 | 
					6687f12988 | ||
| 
						 | 
					fcd12fc0f1 | ||
| 
						 | 
					0fb4d54068 | ||
| 
						 | 
					830a468a23 | ||
| 
						 | 
					af3ca7b4a9 | ||
| 
						 | 
					7a6bb17255 | ||
| 
						 | 
					bc6d459a6e | ||
| 
						 | 
					ff7f34e353 | ||
| 
						 | 
					2e3d79aaec | ||
| 
						 | 
					8a41bcc934 | ||
| 
						 | 
					e2414b41ad | ||
| 
						 | 
					266958bce7 | ||
| 
						 | 
					bc5354cbf0 | ||
| 
						 | 
					cc4997843e | ||
| 
						 | 
					ab95eac286 | ||
| 
						 | 
					1cd76233d1 | ||
| 
						 | 
					3d5afc8b83 | ||
| 
						 | 
					d28b7799dd | ||
| 
						 | 
					b0fb889c29 | ||
| 
						 | 
					460e80bd1d | ||
| 
						 | 
					bc1e96e942 | ||
| 
						 | 
					7ea61df414 | ||
| 
						 | 
					431712293d | ||
| 
						 | 
					335ed97263 | ||
| 
						 | 
					e00b165e9b | ||
| 
						 | 
					5467ddf0e1 | ||
| 
						 | 
					7a37dd92ed | ||
| 
						 | 
					d0c11e9d72 | ||
| 
						 | 
					5ec52fee2c | ||
| 
						 | 
					5026bc13bb | ||
| 
						 | 
					c7d27e5247 | ||
| 
						 | 
					b7d7af7ea9 | ||
| 
						 | 
					39663d2c40 | ||
| 
						 | 
					000299a0e6 | ||
| 
						 | 
					0a47d82b9b | ||
| 
						 | 
					198bcece58 | ||
| 
						 | 
					053677d124 | ||
| 
						 | 
					804072f014 | ||
| 
						 | 
					e9429b43ce | ||
| 
						 | 
					3d37d5e24a | ||
| 
						 | 
					2728a1b4f3 | ||
| 
						 | 
					adb040d4cb | ||
| 
						 | 
					479d7934c0 | ||
| 
						 | 
					22d1acd5ac | ||
| 
						 | 
					b257c152c6 | ||
| 
						 | 
					77b97ee0d7 | ||
| 
						 | 
					e2ac4732cd | ||
| 
						 | 
					e8f665b495 | ||
| 
						 | 
					55f3ef29ea | ||
| 
						 | 
					c2d78c9623 | ||
| 
						 | 
					a4578a5413 | ||
| 
						 | 
					e884fcf785 | ||
| 
						 | 
					e96025755d | ||
| 
						 | 
					c9028b0ab5 | ||
| 
						 | 
					b4d2858f95 | ||
| 
						 | 
					dea446d995 | ||
| 
						 | 
					5cd94f9e9d | ||
| 
						 | 
					cad811fc41 | ||
| 
						 | 
					69f6a9f007 | ||
| 
						 | 
					4eeee0c59f | ||
| 
						 | 
					a5afa6c95f | ||
| 
						 | 
					625dacb93d | ||
| 
						 | 
					62e9c2e091 | ||
| 
						 | 
					e4106a4e24 | ||
| 
						 | 
					a506b8c7dd | ||
| 
						 | 
					e5cd536894 | ||
| 
						 | 
					629ea39a88 | ||
| 
						 | 
					7d9e1321c7 | ||
| 
						 | 
					83af7422a0 | ||
| 
						 | 
					ce8945f35c | ||
| 
						 | 
					dd890f0776 | ||
| 
						 | 
					af4ac437ab | ||
| 
						 | 
					607585fdaf | ||
| 
						 | 
					2f596aeef5 | ||
| 
						 | 
					69762c75fa | ||
| 
						 | 
					36b29660ce | ||
| 
						 | 
					4976983f30 | ||
| 
						 | 
					31e4ad25ba | ||
| 
						 | 
					225f4daf15 | ||
| 
						 | 
					b9927cfa2d | ||
| 
						 | 
					af6cafc603 | ||
| 
						 | 
					15da07d436 | ||
| 
						 | 
					886ed3544b | ||
| 
						 | 
					aff2922f9a | ||
| 
						 | 
					f32e0035a3 | ||
| 
						 | 
					7b1e7706d8 | ||
| 
						 | 
					cd74dda72a | ||
| 
						 | 
					032bb2a2c5 | ||
| 
						 | 
					fa96ed06d2 | ||
| 
						 | 
					43133041c9 | ||
| 
						 | 
					e0ee5ea962 | ||
| 
						 | 
					f5634286a3 | ||
| 
						 | 
					97d37c1c1e | ||
| 
						 | 
					739b139cb2 | ||
| 
						 | 
					0bc9920ad4 | ||
| 
						 | 
					3f516ce837 | ||
| 
						 | 
					9f197f9da5 | ||
| 
						 | 
					3dc2cc36e9 | ||
| 
						 | 
					ca3e683747 | ||
| 
						 | 
					38a1757168 | ||
| 
						 | 
					4104a57107 | ||
| 
						 | 
					b0c0f20071 | ||
| 
						 | 
					7870774162 | ||
| 
						 | 
					4213cdaf5d | ||
| 
						 | 
					39b4c974ee | ||
| 
						 | 
					508f56f17c | ||
| 
						 | 
					48665b7c99 | ||
| 
						 | 
					51971f7293 | ||
| 
						 | 
					3d3addb252 | ||
| 
						 | 
					3f8bdd1fdb | ||
| 
						 | 
					6181fd949f | ||
| 
						 | 
					afd61c63c2 | ||
| 
						 | 
					9a2073b4cd | ||
| 
						 | 
					f28468188b | ||
| 
						 | 
					8871d87512 | ||
| 
						 | 
					a2b81188be | ||
| 
						 | 
					f91f6cd5e4 | ||
| 
						 | 
					bd923a7bac | ||
| 
						 | 
					373c88faef | ||
| 
						 | 
					14813d8123 | ||
| 
						 | 
					92f2437f48 | ||
| 
						 | 
					da959761ff | ||
| 
						 | 
					d8cd25aa0d | ||
| 
						 | 
					d63d4f46fc | ||
| 
						 | 
					52161e090d | ||
| 
						 | 
					9e55e06501 | ||
| 
						 | 
					0b6df67fb1 | ||
| 
						 | 
					bf087e1ea1 | ||
| 
						 | 
					885818fb7c | ||
| 
						 | 
					2f370048cb | ||
| 
						 | 
					28dc02a9d8 | ||
| 
						 | 
					54ebaca535 | ||
| 
						 | 
					4fedc91a4a | ||
| 
						 | 
					f734aaa413 | ||
| 
						 | 
					a575d4b9ee | ||
| 
						 | 
					77a87ded3a | ||
| 
						 | 
					b958d2c298 | ||
| 
						 | 
					dc72a195c2 | ||
| 
						 | 
					e2812ff61f | ||
| 
						 | 
					8c2e34e27f | ||
| 
						 | 
					31f3950fbf | ||
| 
						 | 
					75b3654d18 | ||
| 
						 | 
					418f9ac5e3 | ||
| 
						 | 
					ad4afe4edf | ||
| 
						 | 
					c844b971cb | ||
| 
						 | 
					ca9b1c47af | ||
| 
						 | 
					86039d2751 | ||
| 
						 | 
					420a692f04 | ||
| 
						 | 
					1d2a464fe0 | ||
| 
						 | 
					7735dd0750 | ||
| 
						 | 
					bf7b075f0c | 
@@ -1,6 +1,4 @@
 | 
			
		||||
openssl.pc
 | 
			
		||||
libcrypto.pc
 | 
			
		||||
libssl.pc
 | 
			
		||||
MINFO
 | 
			
		||||
makefile.one
 | 
			
		||||
tmp
 | 
			
		||||
@@ -16,7 +14,7 @@ cctest.a
 | 
			
		||||
*.flc
 | 
			
		||||
semantic.cache
 | 
			
		||||
Makefile
 | 
			
		||||
*.dll*
 | 
			
		||||
*.so*
 | 
			
		||||
*.dll*
 | 
			
		||||
*.sl*
 | 
			
		||||
*.dylib*
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										760
									
								
								CHANGES
									
									
									
									
									
								
							
							
						
						
									
										760
									
								
								CHANGES
									
									
									
									
									
								
							@@ -2,755 +2,23 @@
 | 
			
		||||
 OpenSSL CHANGES
 | 
			
		||||
 _______________
 | 
			
		||||
 | 
			
		||||
 Changes between 0.9.8j and 0.9.9  [xx XXX xxxx]
 | 
			
		||||
 Changes between 0.9.8j and 0.9.8k  [25 Mar 2009]
 | 
			
		||||
 | 
			
		||||
  *) Update Gost ENGINE to support parameter files.
 | 
			
		||||
     [Victor B. Wagner <vitus@cryptocom.ru>]
 | 
			
		||||
  *) Don't set val to NULL when freeing up structures, it is freed up by
 | 
			
		||||
     underlying code. If sizeof(void *) > sizeof(long) this can result in
 | 
			
		||||
     zeroing past the valid field. (CVE-2009-0789)
 | 
			
		||||
     [Paolo Ganci <Paolo.Ganci@AdNovum.CH>]
 | 
			
		||||
 | 
			
		||||
  *) Support GeneralizedTime in ca utility. 
 | 
			
		||||
     [Oliver Martin <oliver@volatilevoid.net>, Steve Henson]
 | 
			
		||||
  *) Fix bug where return value of CMS_SignerInfo_verify_content() was not
 | 
			
		||||
     checked correctly. This would allow some invalid signed attributes to
 | 
			
		||||
     appear to verify correctly. (CVE-2009-0591)
 | 
			
		||||
     [Ivan Nestlerode <inestlerode@us.ibm.com>]
 | 
			
		||||
 | 
			
		||||
  *) Enhance the hash format used for certificate directory links. The new
 | 
			
		||||
     form uses the canonical encoding (meaning equivalent names will work
 | 
			
		||||
     even if they aren't identical) and uses SHA1 instead of MD5. This form
 | 
			
		||||
     is incompatible with the older format and as a result c_rehash should
 | 
			
		||||
     be used to rebuild symbolic links.
 | 
			
		||||
  *) Reject UniversalString and BMPString types with invalid lengths. This
 | 
			
		||||
     prevents a crash in ASN1_STRING_print_ex() which assumes the strings have
 | 
			
		||||
     a legal length. (CVE-2009-0590)
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Make PKCS#8 the default write format for private keys, replacing the
 | 
			
		||||
     traditional format. This form is standardised, more secure and doesn't
 | 
			
		||||
     include an implicit MD5 dependency.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Add a $gcc_devteam_warn option to Configure. The idea is that any code
 | 
			
		||||
     committed to OpenSSL should pass this lot as a minimum.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Add session ticket override functionality for use by EAP-FAST.
 | 
			
		||||
     [Jouni Malinen <j@w1.fi>]
 | 
			
		||||
 | 
			
		||||
  *) Modify HMAC functions to return a value. Since these can be implemented
 | 
			
		||||
     in an ENGINE errors can occur.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Type-checked OBJ_bsearch_ex.
 | 
			
		||||
     [Ben Laurie]
 | 
			
		||||
 | 
			
		||||
  *) Type-checked OBJ_bsearch. Also some constification necessitated
 | 
			
		||||
     by type-checking.  Still to come: TXT_DB, bsearch(?),
 | 
			
		||||
     OBJ_bsearch_ex, qsort, CRYPTO_EX_DATA, ASN1_VALUE, ASN1_STRING,
 | 
			
		||||
     CONF_VALUE.
 | 
			
		||||
     [Ben Laurie]
 | 
			
		||||
 | 
			
		||||
  *) New function OPENSSL_gmtime_adj() to add a specific number of days and
 | 
			
		||||
     seconds to a tm structure directly, instead of going through OS
 | 
			
		||||
     specific date routines. This avoids any issues with OS routines such
 | 
			
		||||
     as the year 2038 bug. New *_adj() functions for ASN1 time structures
 | 
			
		||||
     and X509_time_adj_ex() to cover the extended range. The existing
 | 
			
		||||
     X509_time_adj() is still usable and will no longer have any date issues.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Delta CRL support. New use deltas option which will attempt to locate
 | 
			
		||||
     and search any appropriate delta CRLs available.
 | 
			
		||||
 | 
			
		||||
     This work was sponsored by Google.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Support for CRLs partitioned by reason code. Reorganise CRL processing
 | 
			
		||||
     code and add additional score elements. Validate alternate CRL paths
 | 
			
		||||
     as part of the CRL checking and indicate a new error "CRL path validation
 | 
			
		||||
     error" in this case. Applications wanting additional details can use
 | 
			
		||||
     the verify callback and check the new "parent" field. If this is not
 | 
			
		||||
     NULL CRL path validation is taking place. Existing applications wont
 | 
			
		||||
     see this because it requires extended CRL support which is off by
 | 
			
		||||
     default.
 | 
			
		||||
 | 
			
		||||
     This work was sponsored by Google.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Support for freshest CRL extension.
 | 
			
		||||
 | 
			
		||||
     This work was sponsored by Google.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Initial indirect CRL support. Currently only supported in the CRLs
 | 
			
		||||
     passed directly and not via lookup. Process certificate issuer
 | 
			
		||||
     CRL entry extension and lookup CRL entries by bother issuer name
 | 
			
		||||
     and serial number. Check and process CRL issuer entry in IDP extension.
 | 
			
		||||
 | 
			
		||||
     This work was sponsored by Google.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Add support for distinct certificate and CRL paths. The CRL issuer
 | 
			
		||||
     certificate is validated separately in this case. Only enabled if
 | 
			
		||||
     an extended CRL support flag is set: this flag will enable additional
 | 
			
		||||
     CRL functionality in future.
 | 
			
		||||
 | 
			
		||||
     This work was sponsored by Google.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Add support for policy mappings extension.
 | 
			
		||||
 | 
			
		||||
     This work was sponsored by Google.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Fixes to pathlength constraint, self issued certificate handling,
 | 
			
		||||
     policy processing to align with RFC3280 and PKITS tests.
 | 
			
		||||
 | 
			
		||||
     This work was sponsored by Google.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Support for name constraints certificate extension. DN, email, DNS
 | 
			
		||||
     and URI types are currently supported.
 | 
			
		||||
 | 
			
		||||
     This work was sponsored by Google.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) To cater for systems that provide a pointer-based thread ID rather
 | 
			
		||||
     than numeric, deprecate the current numeric thread ID mechanism and
 | 
			
		||||
     replace it with a structure and associated callback type. This
 | 
			
		||||
     mechanism allows a numeric "hash" to be extracted from a thread ID in
 | 
			
		||||
     either case, and on platforms where pointers are larger than 'long',
 | 
			
		||||
     mixing is done to help ensure the numeric 'hash' is usable even if it
 | 
			
		||||
     can't be guaranteed unique. The default mechanism is to use "&errno"
 | 
			
		||||
     as a pointer-based thread ID to distinguish between threads.
 | 
			
		||||
 | 
			
		||||
     Applications that want to provide their own thread IDs should now use
 | 
			
		||||
     CRYPTO_THREADID_set_callback() to register a callback that will call
 | 
			
		||||
     either CRYPTO_THREADID_set_numeric() or CRYPTO_THREADID_set_pointer().
 | 
			
		||||
 | 
			
		||||
     Note that ERR_remove_state() is now deprecated, because it is tied
 | 
			
		||||
     to the assumption that thread IDs are numeric.  ERR_remove_state(0)
 | 
			
		||||
     to free the current thread's error state should be replaced by
 | 
			
		||||
     ERR_remove_thread_state(NULL).
 | 
			
		||||
 | 
			
		||||
     (This new approach replaces the functions CRYPTO_set_idptr_callback(),
 | 
			
		||||
     CRYPTO_get_idptr_callback(), and CRYPTO_thread_idptr() that existed in
 | 
			
		||||
     OpenSSL 0.9.9-dev between June 2006 and August 2008. Also, if an
 | 
			
		||||
     application was previously providing a numeric thread callback that
 | 
			
		||||
     was inappropriate for distinguishing threads, then uniqueness might
 | 
			
		||||
     have been obtained with &errno that happened immediately in the
 | 
			
		||||
     intermediate development versions of OpenSSL; this is no longer the
 | 
			
		||||
     case, the numeric thread callback will now override the automatic use
 | 
			
		||||
     of &errno.)
 | 
			
		||||
     [Geoff Thorpe, with help from Bodo Moeller]
 | 
			
		||||
 | 
			
		||||
  *) Initial support for different CRL issuing certificates. This covers a
 | 
			
		||||
     simple case where the self issued certificates in the chain exist and
 | 
			
		||||
     the real CRL issuer is higher in the existing chain.
 | 
			
		||||
 | 
			
		||||
     This work was sponsored by Google.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Removed effectively defunct crypto/store from the build.
 | 
			
		||||
     [Ben Laurie]
 | 
			
		||||
 | 
			
		||||
  *) Revamp of STACK to provide stronger type-checking. Still to come:
 | 
			
		||||
     TXT_DB, bsearch(?), OBJ_bsearch, qsort, CRYPTO_EX_DATA, ASN1_VALUE,
 | 
			
		||||
     ASN1_STRING, CONF_VALUE.
 | 
			
		||||
     [Ben Laurie]
 | 
			
		||||
 | 
			
		||||
  *) Add a new SSL_MODE_RELEASE_BUFFERS mode flag to release unused buffer
 | 
			
		||||
     RAM on SSL connections.  This option can save about 34k per idle SSL.
 | 
			
		||||
     [Nick Mathewson]
 | 
			
		||||
 | 
			
		||||
  *) Revamp of LHASH to provide stronger type-checking. Still to come:
 | 
			
		||||
     STACK, TXT_DB, bsearch, qsort.
 | 
			
		||||
     [Ben Laurie]
 | 
			
		||||
 | 
			
		||||
  *) Initial support for Cryptographic Message Syntax (aka CMS) based
 | 
			
		||||
     on RFC3850, RFC3851 and RFC3852. New cms directory and cms utility,
 | 
			
		||||
     support for data, signedData, compressedData, digestedData and
 | 
			
		||||
     encryptedData, envelopedData types included. Scripts to check against
 | 
			
		||||
     RFC4134 examples draft and interop and consistency checks of many
 | 
			
		||||
     content types and variants.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Add options to enc utility to support use of zlib compression BIO.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Extend mk1mf to support importing of options and assembly language
 | 
			
		||||
     files from Configure script, currently only included in VC-WIN32.
 | 
			
		||||
     The assembly language rules can now optionally generate the source
 | 
			
		||||
     files from the associated perl scripts.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Implement remaining functionality needed to support GOST ciphersuites.
 | 
			
		||||
     Interop testing has been performed using CryptoPro implementations.
 | 
			
		||||
     [Victor B. Wagner <vitus@cryptocom.ru>]
 | 
			
		||||
 | 
			
		||||
  *) s390x assembler pack.
 | 
			
		||||
     [Andy Polyakov]
 | 
			
		||||
 | 
			
		||||
  *) ARMv4 assembler pack. ARMv4 refers to v4 and later ISA, not CPU
 | 
			
		||||
     "family."
 | 
			
		||||
     [Andy Polyakov]
 | 
			
		||||
 | 
			
		||||
  *) Implement Opaque PRF Input TLS extension as specified in
 | 
			
		||||
     draft-rescorla-tls-opaque-prf-input-00.txt.  Since this is not an
 | 
			
		||||
     official specification yet and no extension type assignment by
 | 
			
		||||
     IANA exists, this extension (for now) will have to be explicitly
 | 
			
		||||
     enabled when building OpenSSL by providing the extension number
 | 
			
		||||
     to use.  For example, specify an option
 | 
			
		||||
 | 
			
		||||
         -DTLSEXT_TYPE_opaque_prf_input=0x9527
 | 
			
		||||
 | 
			
		||||
     to the "config" or "Configure" script to enable the extension,
 | 
			
		||||
     assuming extension number 0x9527 (which is a completely arbitrary
 | 
			
		||||
     and unofficial assignment based on the MD5 hash of the Internet
 | 
			
		||||
     Draft).  Note that by doing so, you potentially lose
 | 
			
		||||
     interoperability with other TLS implementations since these might
 | 
			
		||||
     be using the same extension number for other purposes.
 | 
			
		||||
 | 
			
		||||
     SSL_set_tlsext_opaque_prf_input(ssl, src, len) is used to set the
 | 
			
		||||
     opaque PRF input value to use in the handshake.  This will create
 | 
			
		||||
     an interal copy of the length-'len' string at 'src', and will
 | 
			
		||||
     return non-zero for success.
 | 
			
		||||
 | 
			
		||||
     To get more control and flexibility, provide a callback function
 | 
			
		||||
     by using
 | 
			
		||||
 | 
			
		||||
          SSL_CTX_set_tlsext_opaque_prf_input_callback(ctx, cb)
 | 
			
		||||
          SSL_CTX_set_tlsext_opaque_prf_input_callback_arg(ctx, arg)
 | 
			
		||||
 | 
			
		||||
     where
 | 
			
		||||
 | 
			
		||||
          int (*cb)(SSL *, void *peerinput, size_t len, void *arg);
 | 
			
		||||
          void *arg;
 | 
			
		||||
 | 
			
		||||
     Callback function 'cb' will be called in handshakes, and is
 | 
			
		||||
     expected to use SSL_set_tlsext_opaque_prf_input() as appropriate.
 | 
			
		||||
     Argument 'arg' is for application purposes (the value as given to
 | 
			
		||||
     SSL_CTX_set_tlsext_opaque_prf_input_callback_arg() will directly
 | 
			
		||||
     be provided to the callback function).  The callback function
 | 
			
		||||
     has to return non-zero to report success: usually 1 to use opaque
 | 
			
		||||
     PRF input just if possible, or 2 to enforce use of the opaque PRF
 | 
			
		||||
     input.  In the latter case, the library will abort the handshake
 | 
			
		||||
     if opaque PRF input is not successfully negotiated.
 | 
			
		||||
 | 
			
		||||
     Arguments 'peerinput' and 'len' given to the callback function
 | 
			
		||||
     will always be NULL and 0 in the case of a client.  A server will
 | 
			
		||||
     see the client's opaque PRF input through these variables if
 | 
			
		||||
     available (NULL and 0 otherwise).  Note that if the server
 | 
			
		||||
     provides an opaque PRF input, the length must be the same as the
 | 
			
		||||
     length of the client's opaque PRF input.
 | 
			
		||||
 | 
			
		||||
     Note that the callback function will only be called when creating
 | 
			
		||||
     a new session (session resumption can resume whatever was
 | 
			
		||||
     previously negotiated), and will not be called in SSL 2.0
 | 
			
		||||
     handshakes; thus, SSL_CTX_set_options(ctx, SSL_OP_NO_SSLv2) or
 | 
			
		||||
     SSL_set_options(ssl, SSL_OP_NO_SSLv2) is especially recommended
 | 
			
		||||
     for applications that need to enforce opaque PRF input.
 | 
			
		||||
 | 
			
		||||
     [Bodo Moeller]
 | 
			
		||||
 | 
			
		||||
  *) Update ssl code to support digests other than SHA1+MD5 for handshake
 | 
			
		||||
     MAC. 
 | 
			
		||||
 | 
			
		||||
     [Victor B. Wagner <vitus@cryptocom.ru>]
 | 
			
		||||
 | 
			
		||||
  *) Add RFC4507 support to OpenSSL. This includes the corrections in
 | 
			
		||||
     RFC4507bis. The encrypted ticket format is an encrypted encoded
 | 
			
		||||
     SSL_SESSION structure, that way new session features are automatically
 | 
			
		||||
     supported.
 | 
			
		||||
 | 
			
		||||
     If a client application caches session in an SSL_SESSION structure
 | 
			
		||||
     support is transparent because tickets are now stored in the encoded
 | 
			
		||||
     SSL_SESSION.
 | 
			
		||||
     
 | 
			
		||||
     The SSL_CTX structure automatically generates keys for ticket
 | 
			
		||||
     protection in servers so again support should be possible
 | 
			
		||||
     with no application modification.
 | 
			
		||||
 | 
			
		||||
     If a client or server wishes to disable RFC4507 support then the option
 | 
			
		||||
     SSL_OP_NO_TICKET can be set.
 | 
			
		||||
 | 
			
		||||
     Add a TLS extension debugging callback to allow the contents of any client
 | 
			
		||||
     or server extensions to be examined.
 | 
			
		||||
 | 
			
		||||
     This work was sponsored by Google.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Final changes to avoid use of pointer pointer casts in OpenSSL.
 | 
			
		||||
     OpenSSL should now compile cleanly on gcc 4.2
 | 
			
		||||
     [Peter Hartley <pdh@utter.chaos.org.uk>, Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Update SSL library to use new EVP_PKEY MAC API. Include generic MAC
 | 
			
		||||
     support including streaming MAC support: this is required for GOST
 | 
			
		||||
     ciphersuite support.
 | 
			
		||||
     [Victor B. Wagner <vitus@cryptocom.ru>, Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Add option -stream to use PKCS#7 streaming in smime utility. New
 | 
			
		||||
     function i2d_PKCS7_bio_stream() and PEM_write_PKCS7_bio_stream()
 | 
			
		||||
     to output in BER and PEM format.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Experimental support for use of HMAC via EVP_PKEY interface. This
 | 
			
		||||
     allows HMAC to be handled via the EVP_DigestSign*() interface. The
 | 
			
		||||
     EVP_PKEY "key" in this case is the HMAC key, potentially allowing
 | 
			
		||||
     ENGINE support for HMAC keys which are unextractable. New -mac and
 | 
			
		||||
     -macopt options to dgst utility.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) New option -sigopt to dgst utility. Update dgst to use
 | 
			
		||||
     EVP_Digest{Sign,Verify}*. These two changes make it possible to use
 | 
			
		||||
     alternative signing paramaters such as X9.31 or PSS in the dgst 
 | 
			
		||||
     utility.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Change ssl_cipher_apply_rule(), the internal function that does
 | 
			
		||||
     the work each time a ciphersuite string requests enabling
 | 
			
		||||
     ("foo+bar"), moving ("+foo+bar"), disabling ("-foo+bar", or
 | 
			
		||||
     removing ("!foo+bar") a class of ciphersuites: Now it maintains
 | 
			
		||||
     the order of disabled ciphersuites such that those ciphersuites
 | 
			
		||||
     that most recently went from enabled to disabled not only stay
 | 
			
		||||
     in order with respect to each other, but also have higher priority
 | 
			
		||||
     than other disabled ciphersuites the next time ciphersuites are
 | 
			
		||||
     enabled again.
 | 
			
		||||
 | 
			
		||||
     This means that you can now say, e.g., "PSK:-PSK:HIGH" to enable
 | 
			
		||||
     the same ciphersuites as with "HIGH" alone, but in a specific
 | 
			
		||||
     order where the PSK ciphersuites come first (since they are the
 | 
			
		||||
     most recently disabled ciphersuites when "HIGH" is parsed).
 | 
			
		||||
 | 
			
		||||
     Also, change ssl_create_cipher_list() (using this new
 | 
			
		||||
     funcionality) such that between otherwise identical
 | 
			
		||||
     cihpersuites, ephemeral ECDH is preferred over ephemeral DH in
 | 
			
		||||
     the default order.
 | 
			
		||||
     [Bodo Moeller]
 | 
			
		||||
 | 
			
		||||
  *) Change ssl_create_cipher_list() so that it automatically
 | 
			
		||||
     arranges the ciphersuites in reasonable order before starting
 | 
			
		||||
     to process the rule string.  Thus, the definition for "DEFAULT"
 | 
			
		||||
     (SSL_DEFAULT_CIPHER_LIST) now is just "ALL:!aNULL:!eNULL", but
 | 
			
		||||
     remains equivalent to "AES:ALL:!aNULL:!eNULL:+aECDH:+kRSA:+RC4:@STRENGTH".
 | 
			
		||||
     This makes it much easier to arrive at a reasonable default order
 | 
			
		||||
     in applications for which anonymous ciphers are OK (meaning
 | 
			
		||||
     that you can't actually use DEFAULT).
 | 
			
		||||
     [Bodo Moeller; suggested by Victor Duchovni]
 | 
			
		||||
 | 
			
		||||
  *) Split the SSL/TLS algorithm mask (as used for ciphersuite string
 | 
			
		||||
     processing) into multiple integers instead of setting
 | 
			
		||||
     "SSL_MKEY_MASK" bits, "SSL_AUTH_MASK" bits, "SSL_ENC_MASK",
 | 
			
		||||
     "SSL_MAC_MASK", and "SSL_SSL_MASK" bits all in a single integer.
 | 
			
		||||
     (These masks as well as the individual bit definitions are hidden
 | 
			
		||||
     away into the non-exported interface ssl/ssl_locl.h, so this
 | 
			
		||||
     change to the definition of the SSL_CIPHER structure shouldn't
 | 
			
		||||
     affect applications.)  This give us more bits for each of these
 | 
			
		||||
     categories, so there is no longer a need to coagulate AES128 and
 | 
			
		||||
     AES256 into a single algorithm bit, and to coagulate Camellia128
 | 
			
		||||
     and Camellia256 into a single algorithm bit, which has led to all
 | 
			
		||||
     kinds of kludges.
 | 
			
		||||
 | 
			
		||||
     Thus, among other things, the kludge introduced in 0.9.7m and
 | 
			
		||||
     0.9.8e for masking out AES256 independently of AES128 or masking
 | 
			
		||||
     out Camellia256 independently of AES256 is not needed here in 0.9.9.
 | 
			
		||||
 | 
			
		||||
     With the change, we also introduce new ciphersuite aliases that
 | 
			
		||||
     so far were missing: "AES128", "AES256", "CAMELLIA128", and
 | 
			
		||||
     "CAMELLIA256".
 | 
			
		||||
     [Bodo Moeller]
 | 
			
		||||
 | 
			
		||||
  *) Add support for dsa-with-SHA224 and dsa-with-SHA256.
 | 
			
		||||
     Use the leftmost N bytes of the signature input if the input is
 | 
			
		||||
     larger than the prime q (with N being the size in bytes of q).
 | 
			
		||||
     [Nils Larsch]
 | 
			
		||||
 | 
			
		||||
  *) Very *very* experimental PKCS#7 streaming encoder support. Nothing uses
 | 
			
		||||
     it yet and it is largely untested.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Add support for the ecdsa-with-SHA224/256/384/512 signature types.
 | 
			
		||||
     [Nils Larsch]
 | 
			
		||||
 | 
			
		||||
  *) Initial incomplete changes to avoid need for function casts in OpenSSL
 | 
			
		||||
     some compilers (gcc 4.2 and later) reject their use. Safestack is
 | 
			
		||||
     reimplemented.  Update ASN1 to avoid use of legacy functions. 
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Win32/64 targets are linked with Winsock2.
 | 
			
		||||
     [Andy Polyakov]
 | 
			
		||||
 | 
			
		||||
  *) Add an X509_CRL_METHOD structure to allow CRL processing to be redirected
 | 
			
		||||
     to external functions. This can be used to increase CRL handling 
 | 
			
		||||
     efficiency especially when CRLs are very large by (for example) storing
 | 
			
		||||
     the CRL revoked certificates in a database.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Overhaul of by_dir code. Add support for dynamic loading of CRLs so
 | 
			
		||||
     new CRLs added to a directory can be used. New command line option
 | 
			
		||||
     -verify_return_error to s_client and s_server. This causes real errors
 | 
			
		||||
     to be returned by the verify callback instead of carrying on no matter
 | 
			
		||||
     what. This reflects the way a "real world" verify callback would behave.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) GOST engine, supporting several GOST algorithms and public key formats.
 | 
			
		||||
     Kindly donated by Cryptocom.
 | 
			
		||||
     [Cryptocom]
 | 
			
		||||
 | 
			
		||||
  *) Partial support for Issuing Distribution Point CRL extension. CRLs
 | 
			
		||||
     partitioned by DP are handled but no indirect CRL or reason partitioning
 | 
			
		||||
     (yet). Complete overhaul of CRL handling: now the most suitable CRL is
 | 
			
		||||
     selected via a scoring technique which handles IDP and AKID in CRLs.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) New X509_STORE_CTX callbacks lookup_crls() and lookup_certs() which
 | 
			
		||||
     will ultimately be used for all verify operations: this will remove the
 | 
			
		||||
     X509_STORE dependency on certificate verification and allow alternative
 | 
			
		||||
     lookup methods.  X509_STORE based implementations of these two callbacks.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Allow multiple CRLs to exist in an X509_STORE with matching issuer names.
 | 
			
		||||
     Modify get_crl() to find a valid (unexpired) CRL if possible.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) New function X509_CRL_match() to check if two CRLs are identical. Normally
 | 
			
		||||
     this would be called X509_CRL_cmp() but that name is already used by
 | 
			
		||||
     a function that just compares CRL issuer names. Cache several CRL 
 | 
			
		||||
     extensions in X509_CRL structure and cache CRLDP in X509.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Store a "canonical" representation of X509_NAME structure (ASN1 Name)
 | 
			
		||||
     this maps equivalent X509_NAME structures into a consistent structure.
 | 
			
		||||
     Name comparison can then be performed rapidly using memcmp().
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Non-blocking OCSP request processing. Add -timeout option to ocsp 
 | 
			
		||||
     utility.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Allow digests to supply their own micalg string for S/MIME type using
 | 
			
		||||
     the ctrl EVP_MD_CTRL_MICALG.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) During PKCS7 signing pass the PKCS7 SignerInfo structure to the
 | 
			
		||||
     EVP_PKEY_METHOD before and after signing via the EVP_PKEY_CTRL_PKCS7_SIGN
 | 
			
		||||
     ctrl. It can then customise the structure before and/or after signing
 | 
			
		||||
     if necessary.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) New function OBJ_add_sigid() to allow application defined signature OIDs
 | 
			
		||||
     to be added to OpenSSLs internal tables. New function OBJ_sigid_free()
 | 
			
		||||
     to free up any added signature OIDs.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) New functions EVP_CIPHER_do_all(), EVP_CIPHER_do_all_sorted(),
 | 
			
		||||
     EVP_MD_do_all() and EVP_MD_do_all_sorted() to enumerate internal
 | 
			
		||||
     digest and cipher tables. New options added to openssl utility:
 | 
			
		||||
     list-message-digest-algorithms and list-cipher-algorithms.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Change the array representation of binary polynomials: the list
 | 
			
		||||
     of degrees of non-zero coefficients is now terminated with -1.
 | 
			
		||||
     Previously it was terminated with 0, which was also part of the
 | 
			
		||||
     value; thus, the array representation was not applicable to
 | 
			
		||||
     polynomials where t^0 has coefficient zero.  This change makes
 | 
			
		||||
     the array representation useful in a more general context.
 | 
			
		||||
     [Douglas Stebila]
 | 
			
		||||
 | 
			
		||||
  *) Various modifications and fixes to SSL/TLS cipher string
 | 
			
		||||
     handling.  For ECC, the code now distinguishes between fixed ECDH
 | 
			
		||||
     with RSA certificates on the one hand and with ECDSA certificates
 | 
			
		||||
     on the other hand, since these are separate ciphersuites.  The
 | 
			
		||||
     unused code for Fortezza ciphersuites has been removed.
 | 
			
		||||
 | 
			
		||||
     For consistency with EDH, ephemeral ECDH is now called "EECDH"
 | 
			
		||||
     (not "ECDHE").  For consistency with the code for DH
 | 
			
		||||
     certificates, use of ECDH certificates is now considered ECDH
 | 
			
		||||
     authentication, not RSA or ECDSA authentication (the latter is
 | 
			
		||||
     merely the CA's signing algorithm and not actively used in the
 | 
			
		||||
     protocol).
 | 
			
		||||
 | 
			
		||||
     The temporary ciphersuite alias "ECCdraft" is no longer
 | 
			
		||||
     available, and ECC ciphersuites are no longer excluded from "ALL"
 | 
			
		||||
     and "DEFAULT".  The following aliases now exist for RFC 4492
 | 
			
		||||
     ciphersuites, most of these by analogy with the DH case:
 | 
			
		||||
 | 
			
		||||
         kECDHr   - ECDH cert, signed with RSA
 | 
			
		||||
         kECDHe   - ECDH cert, signed with ECDSA
 | 
			
		||||
         kECDH    - ECDH cert (signed with either RSA or ECDSA)
 | 
			
		||||
         kEECDH   - ephemeral ECDH
 | 
			
		||||
         ECDH     - ECDH cert or ephemeral ECDH
 | 
			
		||||
 | 
			
		||||
         aECDH    - ECDH cert
 | 
			
		||||
         aECDSA   - ECDSA cert
 | 
			
		||||
         ECDSA    - ECDSA cert
 | 
			
		||||
 | 
			
		||||
         AECDH    - anonymous ECDH
 | 
			
		||||
         EECDH    - non-anonymous ephemeral ECDH (equivalent to "kEECDH:-AECDH")
 | 
			
		||||
 | 
			
		||||
     [Bodo Moeller]
 | 
			
		||||
 | 
			
		||||
  *) Add additional S/MIME capabilities for AES and GOST ciphers if supported.
 | 
			
		||||
     Use correct micalg parameters depending on digest(s) in signed message.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Add engine support for EVP_PKEY_ASN1_METHOD. Add functions to process
 | 
			
		||||
     an ENGINE asn1 method. Support ENGINE lookups in the ASN1 code.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Initial engine support for EVP_PKEY_METHOD. New functions to permit
 | 
			
		||||
     an engine to register a method. Add ENGINE lookups for methods and
 | 
			
		||||
     functional reference processing.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) New functions EVP_Digest{Sign,Verify)*. These are enchance versions of
 | 
			
		||||
     EVP_{Sign,Verify}* which allow an application to customise the signature
 | 
			
		||||
     process.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) New -resign option to smime utility. This adds one or more signers
 | 
			
		||||
     to an existing PKCS#7 signedData structure. Also -md option to use an
 | 
			
		||||
     alternative message digest algorithm for signing.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Tidy up PKCS#7 routines and add new functions to make it easier to
 | 
			
		||||
     create PKCS7 structures containing multiple signers. Update smime
 | 
			
		||||
     application to support multiple signers.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) New -macalg option to pkcs12 utility to allow setting of an alternative
 | 
			
		||||
     digest MAC.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Initial support for PKCS#5 v2.0 PRFs other than default SHA1 HMAC.
 | 
			
		||||
     Reorganize PBE internals to lookup from a static table using NIDs,
 | 
			
		||||
     add support for HMAC PBE OID translation. Add a EVP_CIPHER ctrl:
 | 
			
		||||
     EVP_CTRL_PBE_PRF_NID this allows a cipher to specify an alternative
 | 
			
		||||
     PRF which will be automatically used with PBES2.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Replace the algorithm specific calls to generate keys in "req" with the
 | 
			
		||||
     new API.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Update PKCS#7 enveloped data routines to use new API. This is now
 | 
			
		||||
     supported by any public key method supporting the encrypt operation. A
 | 
			
		||||
     ctrl is added to allow the public key algorithm to examine or modify
 | 
			
		||||
     the PKCS#7 RecipientInfo structure if it needs to: for RSA this is
 | 
			
		||||
     a no op.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Add a ctrl to asn1 method to allow a public key algorithm to express
 | 
			
		||||
     a default digest type to use. In most cases this will be SHA1 but some
 | 
			
		||||
     algorithms (such as GOST) need to specify an alternative digest. The
 | 
			
		||||
     return value indicates how strong the prefernce is 1 means optional and
 | 
			
		||||
     2 is mandatory (that is it is the only supported type). Modify
 | 
			
		||||
     ASN1_item_sign() to accept a NULL digest argument to indicate it should
 | 
			
		||||
     use the default md. Update openssl utilities to use the default digest
 | 
			
		||||
     type for signing if it is not explicitly indicated.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Use OID cross reference table in ASN1_sign() and ASN1_verify(). New 
 | 
			
		||||
     EVP_MD flag EVP_MD_FLAG_PKEY_METHOD_SIGNATURE. This uses the relevant
 | 
			
		||||
     signing method from the key type. This effectively removes the link
 | 
			
		||||
     between digests and public key types.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Add an OID cross reference table and utility functions. Its purpose is to
 | 
			
		||||
     translate between signature OIDs such as SHA1WithrsaEncryption and SHA1,
 | 
			
		||||
     rsaEncryption. This will allow some of the algorithm specific hackery
 | 
			
		||||
     needed to use the correct OID to be removed. 
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Remove algorithm specific dependencies when setting PKCS7_SIGNER_INFO
 | 
			
		||||
     structures for PKCS7_sign(). They are now set up by the relevant public
 | 
			
		||||
     key ASN1 method.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Add provisional EC pkey method with support for ECDSA and ECDH.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Add support for key derivation (agreement) in the API, DH method and
 | 
			
		||||
     pkeyutl.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Add DSA pkey method and DH pkey methods, extend DH ASN1 method to support
 | 
			
		||||
     public and private key formats. As a side effect these add additional 
 | 
			
		||||
     command line functionality not previously available: DSA signatures can be
 | 
			
		||||
     generated and verified using pkeyutl and DH key support and generation in
 | 
			
		||||
     pkey, genpkey.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) BeOS support.
 | 
			
		||||
     [Oliver Tappe <zooey@hirschkaefer.de>]
 | 
			
		||||
 | 
			
		||||
  *) New make target "install_html_docs" installs HTML renditions of the
 | 
			
		||||
     manual pages.
 | 
			
		||||
     [Oliver Tappe <zooey@hirschkaefer.de>]
 | 
			
		||||
 | 
			
		||||
  *) New utility "genpkey" this is analagous to "genrsa" etc except it can
 | 
			
		||||
     generate keys for any algorithm. Extend and update EVP_PKEY_METHOD to
 | 
			
		||||
     support key and parameter generation and add initial key generation
 | 
			
		||||
     functionality for RSA.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Add functions for main EVP_PKEY_method operations. The undocumented
 | 
			
		||||
     functions EVP_PKEY_{encrypt,decrypt} have been renamed to
 | 
			
		||||
     EVP_PKEY_{encrypt,decrypt}_old. 
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Initial definitions for EVP_PKEY_METHOD. This will be a high level public
 | 
			
		||||
     key API, doesn't do much yet.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) New function EVP_PKEY_asn1_get0_info() to retrieve information about
 | 
			
		||||
     public key algorithms. New option to openssl utility:
 | 
			
		||||
     "list-public-key-algorithms" to print out info.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Implement the Supported Elliptic Curves Extension for
 | 
			
		||||
     ECC ciphersuites from draft-ietf-tls-ecc-12.txt.
 | 
			
		||||
     [Douglas Stebila]
 | 
			
		||||
 | 
			
		||||
  *) Don't free up OIDs in OBJ_cleanup() if they are in use by EVP_MD or
 | 
			
		||||
     EVP_CIPHER structures to avoid later problems in EVP_cleanup().
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) New utilities pkey and pkeyparam. These are similar to algorithm specific
 | 
			
		||||
     utilities such as rsa, dsa, dsaparam etc except they process any key
 | 
			
		||||
     type.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Transfer public key printing routines to EVP_PKEY_ASN1_METHOD. New 
 | 
			
		||||
     functions EVP_PKEY_print_public(), EVP_PKEY_print_private(),
 | 
			
		||||
     EVP_PKEY_print_param() to print public key data from an EVP_PKEY
 | 
			
		||||
     structure.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Initial support for pluggable public key ASN1.
 | 
			
		||||
     De-spaghettify the public key ASN1 handling. Move public and private
 | 
			
		||||
     key ASN1 handling to a new EVP_PKEY_ASN1_METHOD structure. Relocate
 | 
			
		||||
     algorithm specific handling to a single module within the relevant
 | 
			
		||||
     algorithm directory. Add functions to allow (near) opaque processing
 | 
			
		||||
     of public and private key structures.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Implement the Supported Point Formats Extension for
 | 
			
		||||
     ECC ciphersuites from draft-ietf-tls-ecc-12.txt.
 | 
			
		||||
     [Douglas Stebila]
 | 
			
		||||
 | 
			
		||||
  *) Add initial support for RFC 4279 PSK TLS ciphersuites. Add members
 | 
			
		||||
     for the psk identity [hint] and the psk callback functions to the
 | 
			
		||||
     SSL_SESSION, SSL and SSL_CTX structure.
 | 
			
		||||
     
 | 
			
		||||
     New ciphersuites:
 | 
			
		||||
         PSK-RC4-SHA, PSK-3DES-EDE-CBC-SHA, PSK-AES128-CBC-SHA,
 | 
			
		||||
         PSK-AES256-CBC-SHA
 | 
			
		||||
 
 | 
			
		||||
     New functions:
 | 
			
		||||
         SSL_CTX_use_psk_identity_hint
 | 
			
		||||
         SSL_get_psk_identity_hint
 | 
			
		||||
         SSL_get_psk_identity
 | 
			
		||||
         SSL_use_psk_identity_hint
 | 
			
		||||
 | 
			
		||||
     [Mika Kousa and Pasi Eronen of Nokia Corporation]
 | 
			
		||||
 | 
			
		||||
  *) Add RFC 3161 compliant time stamp request creation, response generation
 | 
			
		||||
     and response verification functionality.
 | 
			
		||||
     [Zolt<6C>n Gl<47>zik <zglozik@opentsa.org>, The OpenTSA Project]
 | 
			
		||||
 | 
			
		||||
  *) Add initial support for TLS extensions, specifically for the server_name
 | 
			
		||||
     extension so far.  The SSL_SESSION, SSL_CTX, and SSL data structures now
 | 
			
		||||
     have new members for a host name.  The SSL data structure has an
 | 
			
		||||
     additional member SSL_CTX *initial_ctx so that new sessions can be
 | 
			
		||||
     stored in that context to allow for session resumption, even after the
 | 
			
		||||
     SSL has been switched to a new SSL_CTX in reaction to a client's
 | 
			
		||||
     server_name extension.
 | 
			
		||||
 | 
			
		||||
     New functions (subject to change):
 | 
			
		||||
 | 
			
		||||
         SSL_get_servername()
 | 
			
		||||
         SSL_get_servername_type()
 | 
			
		||||
         SSL_set_SSL_CTX()
 | 
			
		||||
 | 
			
		||||
     New CTRL codes and macros (subject to change):
 | 
			
		||||
 | 
			
		||||
         SSL_CTRL_SET_TLSEXT_SERVERNAME_CB
 | 
			
		||||
                                 - SSL_CTX_set_tlsext_servername_callback()
 | 
			
		||||
         SSL_CTRL_SET_TLSEXT_SERVERNAME_ARG
 | 
			
		||||
                                      - SSL_CTX_set_tlsext_servername_arg()
 | 
			
		||||
         SSL_CTRL_SET_TLSEXT_HOSTNAME           - SSL_set_tlsext_host_name()
 | 
			
		||||
 | 
			
		||||
     openssl s_client has a new '-servername ...' option.
 | 
			
		||||
 | 
			
		||||
     openssl s_server has new options '-servername_host ...', '-cert2 ...',
 | 
			
		||||
     '-key2 ...', '-servername_fatal' (subject to change).  This allows
 | 
			
		||||
     testing the HostName extension for a specific single host name ('-cert'
 | 
			
		||||
     and '-key' remain fallbacks for handshakes without HostName
 | 
			
		||||
     negotiation).  If the unrecogninzed_name alert has to be sent, this by
 | 
			
		||||
     default is a warning; it becomes fatal with the '-servername_fatal'
 | 
			
		||||
     option.
 | 
			
		||||
 | 
			
		||||
     [Peter Sylvester,  Remy Allais, Christophe Renou]
 | 
			
		||||
 | 
			
		||||
  *) Whirlpool hash implementation is added.
 | 
			
		||||
     [Andy Polyakov]
 | 
			
		||||
 | 
			
		||||
  *) BIGNUM code on 64-bit SPARCv9 targets is switched from bn(64,64) to
 | 
			
		||||
     bn(64,32). Because of instruction set limitations it doesn't have
 | 
			
		||||
     any negative impact on performance. This was done mostly in order
 | 
			
		||||
     to make it possible to share assembler modules, such as bn_mul_mont
 | 
			
		||||
     implementations, between 32- and 64-bit builds without hassle.
 | 
			
		||||
     [Andy Polyakov]
 | 
			
		||||
 | 
			
		||||
  *) Move code previously exiled into file crypto/ec/ec2_smpt.c
 | 
			
		||||
     to ec2_smpl.c, and no longer require the OPENSSL_EC_BIN_PT_COMP
 | 
			
		||||
     macro.
 | 
			
		||||
     [Bodo Moeller]
 | 
			
		||||
 | 
			
		||||
  *) New candidate for BIGNUM assembler implementation, bn_mul_mont,
 | 
			
		||||
     dedicated Montgomery multiplication procedure, is introduced.
 | 
			
		||||
     BN_MONT_CTX is modified to allow bn_mul_mont to reach for higher
 | 
			
		||||
     "64-bit" performance on certain 32-bit targets.
 | 
			
		||||
     [Andy Polyakov]
 | 
			
		||||
 | 
			
		||||
  *) New option SSL_OP_NO_COMP to disable use of compression selectively
 | 
			
		||||
     in SSL structures. New SSL ctrl to set maximum send fragment size. 
 | 
			
		||||
     Save memory by seeting the I/O buffer sizes dynamically instead of
 | 
			
		||||
     using the maximum available value.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) New option -V for 'openssl ciphers'. This prints the ciphersuite code
 | 
			
		||||
     in addition to the text details.
 | 
			
		||||
     [Bodo Moeller]
 | 
			
		||||
 | 
			
		||||
  *) Very, very preliminary EXPERIMENTAL support for printing of general
 | 
			
		||||
     ASN1 structures. This currently produces rather ugly output and doesn't
 | 
			
		||||
     handle several customised structures at all.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Integrated support for PVK file format and some related formats such
 | 
			
		||||
     as MS PUBLICKEYBLOB and PRIVATEKEYBLOB. Command line switches to support
 | 
			
		||||
     these in the 'rsa' and 'dsa' utilities.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Support for PKCS#1 RSAPublicKey format on rsa utility command line.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Remove the ancient ASN1_METHOD code. This was only ever used in one
 | 
			
		||||
     place for the (very old) "NETSCAPE" format certificates which are now
 | 
			
		||||
     handled using new ASN1 code equivalents.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Let the TLSv1_method() etc. functions return a 'const' SSL_METHOD
 | 
			
		||||
     pointer and make the SSL_METHOD parameter in SSL_CTX_new,
 | 
			
		||||
     SSL_CTX_set_ssl_version and SSL_set_ssl_method 'const'.
 | 
			
		||||
     [Nils Larsch]
 | 
			
		||||
 | 
			
		||||
  *) Modify CRL distribution points extension code to print out previously
 | 
			
		||||
     unsupported fields. Enhance extension setting code to allow setting of
 | 
			
		||||
     all fields.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Add print and set support for Issuing Distribution Point CRL extension.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Change 'Configure' script to enable Camellia by default.
 | 
			
		||||
     [NTT]
 | 
			
		||||
 | 
			
		||||
 Changes between 0.9.8j and 0.9.8k  [xx XXX xxxx]
 | 
			
		||||
 | 
			
		||||
  *) Set S/MIME signing as the default purpose rather than setting it 
 | 
			
		||||
     unconditionally. This allows applications to override it at the store
 | 
			
		||||
     level.
 | 
			
		||||
@@ -772,12 +40,12 @@
 | 
			
		||||
 | 
			
		||||
  *) Support NumericString type for name components.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
  *) Allow CC in the environment to override the automatically chosen
 | 
			
		||||
     compiler. Note that nothing is done to ensure flags work with the
 | 
			
		||||
     chosen compiler.
 | 
			
		||||
     [Ben Laurie]
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
 Changes between 0.9.8i and 0.9.8j  [07 Jan 2009]
 | 
			
		||||
 | 
			
		||||
  *) Properly check EVP_VerifyFinal() and similar return values
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										534
									
								
								Configure
									
									
									
									
									
								
							
							
						
						
									
										534
									
								
								Configure
									
									
									
									
									
								
							@@ -6,11 +6,13 @@ eval 'exec perl -S $0 ${1+"$@"}'
 | 
			
		||||
##
 | 
			
		||||
 | 
			
		||||
require 5.000;
 | 
			
		||||
use strict;
 | 
			
		||||
eval 'use strict;';
 | 
			
		||||
 | 
			
		||||
print STDERR "Warning: perl module strict not found.\n" if ($@);
 | 
			
		||||
 | 
			
		||||
# see INSTALL for instructions.
 | 
			
		||||
 | 
			
		||||
my $usage="Usage: Configure [no-<cipher> ...] [enable-<cipher> ...] [experimental-<cipher> ...] [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [no-hw-xxx|no-hw] [[no-]threads] [[no-]shared] [[no-]zlib|zlib-dynamic] [no-asm] [no-dso] [no-krb5] [386] [--prefix=DIR] [--openssldir=OPENSSLDIR] [--with-xxx[=vvv]] [--test-sanity] os/compiler[:flags]\n";
 | 
			
		||||
my $usage="Usage: Configure [no-<cipher> ...] [enable-<cipher> ...] [experimental-<cipher> ...] [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [no-hw-xxx|no-hw] [[no-]threads] [[no-]shared] [[no-]zlib|zlib-dynamic] [enable-montasm] [no-asm] [no-dso] [no-krb5] [386] [--prefix=DIR] [--openssldir=OPENSSLDIR] [--with-xxx[=vvv]] [--test-sanity] os/compiler[:flags]\n";
 | 
			
		||||
 | 
			
		||||
# Options:
 | 
			
		||||
#
 | 
			
		||||
@@ -38,8 +40,6 @@ my $usage="Usage: Configure [no-<cipher> ...] [enable-<cipher> ...] [experimenta
 | 
			
		||||
# --test-sanity Make a number of sanity checks on the data in this file.
 | 
			
		||||
#               This is a debugging tool for OpenSSL developers.
 | 
			
		||||
#
 | 
			
		||||
# --cross-compile-prefix Add specified prefix to binutils components.
 | 
			
		||||
#
 | 
			
		||||
# no-hw-xxx     do not compile support for specific crypto hardware.
 | 
			
		||||
#               Generic OpenSSL-style methods relating to this support
 | 
			
		||||
#               are always compiled but return NULL if the hardware
 | 
			
		||||
@@ -56,6 +56,8 @@ my $usage="Usage: Configure [no-<cipher> ...] [enable-<cipher> ...] [experimenta
 | 
			
		||||
# [no-]zlib     [don't] compile support for zlib compression.
 | 
			
		||||
# zlib-dynamic	Like "zlib", but the zlib library is expected to be a shared
 | 
			
		||||
#		library and will be loaded in run-time by the OpenSSL library.
 | 
			
		||||
# enable-montasm 0.9.8 branch only: enable Montgomery x86 assembler backport
 | 
			
		||||
#               from 0.9.9
 | 
			
		||||
# 386           generate 80386 code
 | 
			
		||||
# no-sse2	disables IA-32 SSE2 code, above option implies no-sse2
 | 
			
		||||
# no-<cipher>   build without specified algorithm (rsa, idea, rc5, ...)
 | 
			
		||||
@@ -121,21 +123,14 @@ my $tlib="-lnsl -lsocket";
 | 
			
		||||
my $bits1="THIRTY_TWO_BIT ";
 | 
			
		||||
my $bits2="SIXTY_FOUR_BIT ";
 | 
			
		||||
 | 
			
		||||
my $x86_asm="x86cpuid.o:bn-586.o co-586.o x86-mont.o:des-586.o crypt586.o:aes-586.o:bf-586.o:md5-586.o:sha1-586.o sha256-586.o sha512-586.o:cast-586.o:rc4-586.o:rmd-586.o:rc5-586.o:wp_block.o wp-mmx.o:cmll-x86.o";
 | 
			
		||||
my $x86_elf_asm="x86cpuid-elf.o:bn86-elf.o co86-elf.o MAYBE-MO86-elf.o:dx86-elf.o yx86-elf.o:ax86-elf.o:bx86-elf.o:mx86-elf.o:sx86-elf.o s512sse2-elf.o:cx86-elf.o:rx86-elf.o rc4_skey.o:rm86-elf.o:r586-elf.o";
 | 
			
		||||
my $x86_coff_asm="x86cpuid-cof.o:bn86-cof.o co86-cof.o MAYBE-MO86-cof.o:dx86-cof.o yx86-cof.o:ax86-cof.o:bx86-cof.o:mx86-cof.o:sx86-cof.o s512sse2-cof.o:cx86-cof.o:rx86-cof.o rc4_skey.o:rm86-cof.o:r586-cof.o";
 | 
			
		||||
my $x86_out_asm="x86cpuid-out.o:bn86-out.o co86-out.o MAYBE-MO86-out.o:dx86-out.o yx86-out.o:ax86-out.o:bx86-out.o:mx86-out.o:sx86-out.o s512sse2-out.o:cx86-out.o:rx86-out.o rc4_skey.o:rm86-out.o:r586-out.o";
 | 
			
		||||
 | 
			
		||||
my $x86_elf_asm="$x86_asm:elf";
 | 
			
		||||
my $x86_64_asm="x86_64cpuid.o:x86_64-gcc.o x86_64-mont.o::aes-x86_64.o::md5-x86_64.o:sha1-x86_64.o sha256-x86_64.o sha512-x86_64.o::rc4-x86_64.o::";
 | 
			
		||||
my $ia64_asm=":bn-ia64.o::aes_core.o aes_cbc.o aes-ia64.o:::sha1-ia64.o sha256-ia64.o sha512-ia64.o::rc4-ia64.o rc4_skey.o::";
 | 
			
		||||
 | 
			
		||||
my $x86_64_asm="x86_64cpuid.o:x86_64-gcc.o x86_64-mont.o::aes-x86_64.o::md5-x86_64.o:sha1-x86_64.o sha256-x86_64.o sha512-x86_64.o::rc4-x86_64.o:::wp-x86_64.o:cmll-x86_64.o cmll_misc.o";
 | 
			
		||||
my $ia64_asm="ia64cpuid.o:bn-ia64.o::aes_core.o aes_cbc.o aes-ia64.o::md5-ia64.o:sha1-ia64.o sha256-ia64.o sha512-ia64.o::rc4-ia64.o rc4_skey.o:::::void";
 | 
			
		||||
my $sparcv9_asm="sparcv9cap.o sparccpuid.o:bn-sparcv9.o sparcv9-mont.o sparcv9a-mont.o:des_enc-sparc.o fcrypt_b.o:aes_core.o aes_cbc.o aes-sparcv9.o:::sha1-sparcv9.o sha256-sparcv9.o sha512-sparcv9.o:::::::void";
 | 
			
		||||
my $sparcv8_asm=":sparcv8.o:des_enc-sparc.o fcrypt_b.o:::::::::::void";
 | 
			
		||||
my $alpha_asm="alphacpuid.o:bn_asm.o alpha-mont.o::::::::::::void";
 | 
			
		||||
my $mips3_asm=":bn-mips3.o::::::::::::void";
 | 
			
		||||
my $s390x_asm="s390xcpuid.o:bn-s390x.o s390x-mont.o::aes-s390x.o:::sha1-s390x.o sha256-s390x.o sha512-s390x.o::rc4-s390x.o:::::void";
 | 
			
		||||
my $armv4_asm=":bn_asm.o armv4-mont.o::aes_cbc.o aes-armv4.o:::sha1-armv4-large.o sha256-armv4.o sha512-armv4.o:::::::void";
 | 
			
		||||
my $ppc32_asm="ppccpuid.o:bn-ppc.o::aes_core.o aes_cbc.o aes-ppc.o:::sha1-ppc.o sha256-ppc.o::::::";
 | 
			
		||||
my $ppc64_asm="ppccpuid.o:bn-ppc.o ppc-mont.o::aes_core.o aes_cbc.o aes-ppc.o:::sha1-ppc.o sha256-ppc.o sha512-ppc.o::::::";
 | 
			
		||||
my $no_asm=":::::::::::::void";
 | 
			
		||||
my $no_asm="::::::::::";
 | 
			
		||||
 | 
			
		||||
# As for $BSDthreads. Idea is to maintain "collective" set of flags,
 | 
			
		||||
# which would cover all BSD flavors. -pthread applies to them all, 
 | 
			
		||||
@@ -146,7 +141,7 @@ my $no_asm=":::::::::::::void";
 | 
			
		||||
# seems to be sufficient?
 | 
			
		||||
my $BSDthreads="-pthread -D_THREAD_SAFE -D_REENTRANT";
 | 
			
		||||
 | 
			
		||||
#config-string	$cc : $cflags : $unistd : $thread_cflag : $sys_id : $lflags : $bn_ops : $cpuid_obj : $bn_obj : $des_obj : $aes_obj : $bf_obj : $md5_obj : $sha1_obj : $cast_obj : $rc4_obj : $rmd160_obj : $rc5_obj : $wp_obj : $cmll_obj : $dso_scheme : $shared_target : $shared_cflag : $shared_ldflag : $shared_extension : $ranlib : $arflags : $multilib
 | 
			
		||||
#config-string	$cc : $cflags : $unistd : $thread_cflag : $sys_id : $lflags : $bn_ops : $cpuid_obj : $bn_obj : $des_obj : $aes_obj : $bf_obj : $md5_obj : $sha1_obj : $cast_obj : $rc4_obj : $rmd160_obj : $rc5_obj : $dso_scheme : $shared_target : $shared_cflag : $shared_ldflag : $shared_extension : $ranlib : $arflags
 | 
			
		||||
 | 
			
		||||
my %table=(
 | 
			
		||||
# File 'TABLE' (created by 'make TABLE') contains the data from this list,
 | 
			
		||||
@@ -164,26 +159,25 @@ my %table=(
 | 
			
		||||
"debug-ben",	"gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown):::::bn86-elf.o co86-elf.o",
 | 
			
		||||
"debug-ben-openbsd","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DOPENSSL_OPENBSD_DEV_CRYPTO -DOPENSSL_NO_ASM -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::",
 | 
			
		||||
"debug-ben-openbsd-debug","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DOPENSSL_OPENBSD_DEV_CRYPTO -DOPENSSL_NO_ASM -g3 -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::",
 | 
			
		||||
"debug-ben-debug",	"gcc:$gcc_devteam_warn -DBN_DEBUG -DCONF_DEBUG -DBN_CTX_DEBUG -DDEBUG_SAFESTACK -g3 -O2 -pipe::(unknown)::::::",
 | 
			
		||||
"debug-ben-no-opt",	"gcc: -Wall -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG -Werror -DL_ENDIAN -DTERMIOS -Wall -g3::(unknown)::::::",
 | 
			
		||||
"debug-ben-debug",	"gcc:$gcc_devteam_warn -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG  -DDEBUG_SAFESTACK -g3 -O2 -pipe::(unknown)::::::",
 | 
			
		||||
"debug-ben-strict",	"gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DCONST_STRICT -O2 -Wall -Wshadow -Werror -Wpointer-arith -Wcast-qual -Wwrite-strings -pipe::(unknown)::::::",
 | 
			
		||||
"debug-rse","cc:-DTERMIOS -DL_ENDIAN -pipe -O -g -ggdb3 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
 | 
			
		||||
"debug-bodo",	"gcc:-DL_ENDIAN -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBIO_PAIR_DEBUG -DPEDANTIC -g -march=i486 -pedantic -Wshadow -Wall -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion::-D_REENTRANT:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
 | 
			
		||||
"debug-bodo",	"gcc:-DL_ENDIAN -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBIO_PAIR_DEBUG -DPEDANTIC -g -march=i486 -pedantic -Wshadow -Wall -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
 | 
			
		||||
"debug-ulf", "gcc:-DTERMIOS -DL_ENDIAN -march=i486 -Wall -DBN_DEBUG -DBN_DEBUG_RAND -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -g -Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations:::CYGWIN32:::${no_asm}:win32:cygwin-shared:::.dll",
 | 
			
		||||
"debug-steve64", "gcc:$gcc_devteam_warn -m64 -DL_ENDIAN -DTERMIO -DCONF_DEBUG -DDEBUG_SAFESTACK -g -DMD32_REG_T=int::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK BF_PTR2 DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"debug-steve32", "gcc:$gcc_devteam_warn -m32 -DL_ENDIAN -DCONF_DEBUG -DDEBUG_SAFESTACK -g -pipe::-D_REENTRANT::-rdynamic -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC:-m32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"debug-steve-opt", "gcc:$gcc_devteam_warn -m64 -O3 -DL_ENDIAN -DTERMIO -DCONF_DEBUG -DDEBUG_SAFESTACK -g -DMD32_REG_T=int::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK BF_PTR2 DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"debug-steve",	"gcc:-DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG_ALL -DPEDANTIC -m32 -g -pedantic -Wno-long-long -Wall -Werror -Wshadow -pipe::-D_REENTRANT::-rdynamic -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared",
 | 
			
		||||
"debug-steve-linux-pseudo64",	"gcc:-DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG_ALL -DOPENSSL_NO_ASM -g -mcpu=i486 -Wall -Werror -Wshadow -pipe::-D_REENTRANT::-rdynamic -ldl:SIXTY_FOUR_BIT:${no_asm}:dlfcn:linux-shared",
 | 
			
		||||
"debug-levitte-linux-elf","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"debug-levitte-linux-noasm","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"debug-levitte-linux-elf-extreme","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -W -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"debug-levitte-linux-noasm-extreme","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_DEBUG_RAND -DCRYPTO_MDEBUG -DENGINE_CONF_DEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -W -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wundef -Wconversion -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"debug-geoff32","gcc:-DBN_DEBUG -DBN_DEBUG_RAND -DBN_STRICT -DPURIFY -DOPENSSL_NO_DEPRECATED -DOPENSSL_NO_ASM -DOPENSSL_NO_INLINE_ASM -DL_ENDIAN -DTERMIO -DPEDANTIC -DMD32_REG_T=int -O1 -ggdb2 -Wall -Werror -Wundef -pedantic -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wsign-compare -Wmissing-prototypes -Wmissing-declarations -Wno-long-long::-D_REENTRANT::-ldl:BN_LLONG:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"debug-geoff64","gcc:-DBN_DEBUG -DBN_DEBUG_RAND -DBN_STRICT -DPURIFY -DOPENSSL_NO_DEPRECATED -DOPENSSL_NO_ASM -DOPENSSL_NO_INLINE_ASM -DL_ENDIAN -DTERMIO -DPEDANTIC -DMD32_REG_T=int -O1 -ggdb2 -Wall -Werror -Wundef -pedantic -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wsign-compare -Wmissing-prototypes -Wmissing-declarations -Wno-long-long::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"debug-linux-pentium","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -mcpu=pentium -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn",
 | 
			
		||||
"debug-linux-ppro","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -mcpu=pentiumpro -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn",
 | 
			
		||||
"debug-linux-elf","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -march=i486 -Wall::-D_REENTRANT::-lefence -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"debug-linux-elf-noefence","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -march=i486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"debug-linux-ia32-aes", "gcc:-DAES_EXPERIMENTAL -DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:x86cpuid.o:bn-586.o co-586.o x86-mont.o:des-586.o crypt586.o:aes_x86core.o aes_cbc.o:bf-586.o:md5-586.o:sha1-586.o sha256-586.o sha512-586.o:cast-586.o:rc4-586.o:rmd-586.o:rc5-586.o:wp_block.o wp-mmx.o::elf:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"debug-geoff","gcc:-DBN_DEBUG -DBN_DEBUG_RAND -DBN_STRICT -DPURIFY -DOPENSSL_NO_DEPRECATED -DOPENSSL_NO_ASM -DOPENSSL_NO_INLINE_ASM -DL_ENDIAN -DTERMIO -DPEDANTIC -O1 -ggdb2 -Wall -Werror -Wundef -pedantic -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wsign-compare -Wmissing-prototypes -Wmissing-declarations -Wno-long-long::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"debug-linux-pentium","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -mcpu=pentium -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn",
 | 
			
		||||
"debug-linux-ppro","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -mcpu=pentiumpro -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn",
 | 
			
		||||
"debug-linux-elf","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -march=i486 -Wall::-D_REENTRANT::-lefence -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"debug-linux-elf-noefence","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -march=i486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"dist",		"cc:-O::(unknown)::::::",
 | 
			
		||||
 | 
			
		||||
# Basic configs that should work on any (32 and less bit) box
 | 
			
		||||
@@ -209,33 +203,33 @@ my %table=(
 | 
			
		||||
# actually recommend to consider using gcc shared build even with vendor
 | 
			
		||||
# compiler:-)
 | 
			
		||||
#						<appro@fy.chalmers.se>
 | 
			
		||||
"solaris64-x86_64-gcc","gcc:-m64 -O3 -Wall -DL_ENDIAN -DMD32_REG_T=int::-D_REENTRANT::-lsocket -lnsl -ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK BF_PTR2 DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:solaris-shared:-fPIC:-m64 -shared -static-libgcc:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/64",
 | 
			
		||||
"solaris64-x86_64-gcc","gcc:-m64 -O3 -Wall -DL_ENDIAN -DMD32_REG_T=int::-D_REENTRANT::-lsocket -lnsl -ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK BF_PTR2 DES_INT DES_UNROLL:${x86_64_asm}:dlfcn:solaris-shared:-fPIC:-m64 -shared -static-libgcc:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
 
 | 
			
		||||
#### Solaris x86 with Sun C setups
 | 
			
		||||
"solaris-x86-cc","cc:-fast -O -Xa::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_UNROLL BF_PTR:${no_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"solaris64-x86_64-cc","cc:-fast -xarch=amd64 -xstrconst -Xa -DL_ENDIAN::-D_REENTRANT::-lsocket -lnsl -ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK BF_PTR2 DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:solaris-shared:-KPIC:-xarch=amd64 -G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/64",
 | 
			
		||||
"solaris64-x86_64-cc","cc:-fast -xarch=amd64 -xstrconst -Xa -DL_ENDIAN::-D_REENTRANT::-lsocket -lnsl -ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK BF_PTR2 DES_INT DES_UNROLL:${x86_64_asm}:dlfcn:solaris-shared:-KPIC:-xarch=amd64 -G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
 | 
			
		||||
#### SPARC Solaris with GNU C setups
 | 
			
		||||
"solaris-sparcv7-gcc","gcc:-O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"solaris-sparcv8-gcc","gcc:-mv8 -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv8_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"solaris-sparcv8-gcc","gcc:-mv8 -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::sparcv8.o:des_enc-sparc.o fcrypt_b.o:::::::::dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
# -m32 should be safe to add as long as driver recognizes -mcpu=ultrasparc
 | 
			
		||||
"solaris-sparcv9-gcc","gcc:-m32 -mcpu=ultrasparc -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"solaris64-sparcv9-gcc","gcc:-m64 -mcpu=ultrasparc -O3 -Wall -DB_ENDIAN::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:solaris-shared:-fPIC:-m64 -shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/64",
 | 
			
		||||
"solaris-sparcv9-gcc","gcc:-m32 -mcpu=ultrasparc -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::sparcv8plus.o:des_enc-sparc.o fcrypt_b.o:::::::::dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"solaris64-sparcv9-gcc","gcc:-m64 -mcpu=ultrasparc -O3 -Wall -DB_ENDIAN::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL BF_PTR:::des_enc-sparc.o fcrypt_b.o:::::::::dlfcn:solaris-shared:-fPIC:-m64 -shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
####
 | 
			
		||||
"debug-solaris-sparcv8-gcc","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -O -g -mv8 -Wall -DB_ENDIAN::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv8_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"debug-solaris-sparcv9-gcc","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -DPEDANTIC -O -g -mcpu=ultrasparc -pedantic -ansi -Wall -Wshadow -Wno-long-long -D__EXTENSIONS__ -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"debug-solaris-sparcv8-gcc","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG_ALL -O -g -mv8 -Wall -DB_ENDIAN::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::sparcv8.o::::::::::dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"debug-solaris-sparcv9-gcc","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG_ALL -DPEDANTIC -O -g -mcpu=ultrasparc -pedantic -ansi -Wall -Wshadow -Wno-long-long -D__EXTENSIONS__ -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::sparcv8plus.o:des_enc-sparc.o fcrypt_b.o:::::::::dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
 | 
			
		||||
#### SPARC Solaris with Sun C setups
 | 
			
		||||
# SC4.0 doesn't pass 'make test', upgrade to SC5.0 or SC4.2.
 | 
			
		||||
# SC4.2 is ok, better than gcc even on bn as long as you tell it -xarch=v8
 | 
			
		||||
# SC5.0 note: Compiler common patch 107357-01 or later is required!
 | 
			
		||||
"solaris-sparcv7-cc","cc:-xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${no_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"solaris-sparcv8-cc","cc:-xarch=v8 -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv8_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"solaris-sparcv9-cc","cc:-xtarget=ultra -xarch=v8plus -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK_LL DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"solaris64-sparcv9-cc","cc:-xtarget=ultra -xarch=v9 -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:solaris-shared:-KPIC:-xarch=v9 -G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):/usr/ccs/bin/ar rs::/64",
 | 
			
		||||
"solaris-sparcv8-cc","cc:-xarch=v8 -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR::sparcv8.o:des_enc-sparc.o fcrypt_b.o:::::::::dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"solaris-sparcv9-cc","cc:-xtarget=ultra -xarch=v8plus -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK_LL DES_PTR DES_RISC1 DES_UNROLL BF_PTR::sparcv8plus.o:des_enc-sparc.o fcrypt_b.o:::::::::dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"solaris64-sparcv9-cc","cc:-xtarget=ultra -xarch=v9 -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL BF_PTR:::des_enc-sparc.o fcrypt_b.o:::::::::dlfcn:solaris-shared:-KPIC:-xarch=v9 -G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):/usr/ccs/bin/ar rs",
 | 
			
		||||
####
 | 
			
		||||
"debug-solaris-sparcv8-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -xarch=v8 -g -O -xstrconst -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv8_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"debug-solaris-sparcv9-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -xtarget=ultra -xarch=v8plus -g -O -xstrconst -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK_LL DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", 
 | 
			
		||||
"debug-solaris-sparcv8-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG_ALL -xarch=v8 -g -O -xstrconst -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR::sparcv8.o::::::::::dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"debug-solaris-sparcv9-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG_ALL -xtarget=ultra -xarch=v8plus -g -O -xstrconst -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK_LL DES_PTR DES_RISC1 DES_UNROLL BF_PTR::sparcv8plus.o::::::::::dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", 
 | 
			
		||||
 | 
			
		||||
#### SunOS configs, assuming sparc for the gcc one.
 | 
			
		||||
#"sunos-cc", "cc:-O4 -DNOPROTO -DNOCONST::(unknown):SUNOS::DES_UNROLL:${no_asm}::",
 | 
			
		||||
@@ -248,11 +242,11 @@ my %table=(
 | 
			
		||||
#### IRIX 6.x configs
 | 
			
		||||
# Only N32 and N64 ABIs are supported. If you need O32 ABI build, invoke
 | 
			
		||||
# './Configure irix-cc -o32' manually.
 | 
			
		||||
"irix-mips3-gcc","gcc:-mabi=n32 -O3 -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::MD2_CHAR RC4_INDEX RC4_CHAR RC4_CHUNK_LL DES_UNROLL DES_RISC2 DES_PTR BF_PTR SIXTY_FOUR_BIT:${mips3_asm}:dlfcn:irix-shared::-mabi=n32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::32",
 | 
			
		||||
"irix-mips3-cc", "cc:-n32 -mips3 -O2 -use_readonly_const -G0 -rdata_shared -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::DES_PTR RC4_CHAR RC4_CHUNK_LL DES_RISC2 DES_UNROLL BF_PTR SIXTY_FOUR_BIT:${mips3_asm}:dlfcn:irix-shared::-n32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::32",
 | 
			
		||||
"irix-mips3-gcc","gcc:-mabi=n32 -O3 -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::MD2_CHAR RC4_INDEX RC4_CHAR RC4_CHUNK_LL DES_UNROLL DES_RISC2 DES_PTR BF_PTR SIXTY_FOUR_BIT::bn-mips3.o::::::::::dlfcn:irix-shared::-mabi=n32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"irix-mips3-cc", "cc:-n32 -mips3 -O2 -use_readonly_const -G0 -rdata_shared -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::DES_PTR RC4_CHAR RC4_CHUNK_LL DES_RISC2 DES_UNROLL BF_PTR SIXTY_FOUR_BIT::bn-mips3.o::::::::::dlfcn:irix-shared::-n32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
# N64 ABI builds.
 | 
			
		||||
"irix64-mips4-gcc","gcc:-mabi=64 -mips4 -O3 -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::RC4_CHAR RC4_CHUNK DES_RISC2 DES_UNROLL SIXTY_FOUR_BIT_LONG:${mips3_asm}:dlfcn:irix-shared::-mabi=64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
 | 
			
		||||
"irix64-mips4-cc", "cc:-64 -mips4 -O2 -use_readonly_const -G0 -rdata_shared -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::RC4_CHAR RC4_CHUNK DES_RISC2 DES_UNROLL SIXTY_FOUR_BIT_LONG:${mips3_asm}:dlfcn:irix-shared::-64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
 | 
			
		||||
"irix64-mips4-gcc","gcc:-mabi=64 -mips4 -O3 -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::RC4_CHAR RC4_CHUNK DES_RISC2 DES_UNROLL SIXTY_FOUR_BIT_LONG::bn-mips3.o::::::::::dlfcn:irix-shared::-mabi=64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"irix64-mips4-cc", "cc:-64 -mips4 -O2 -use_readonly_const -G0 -rdata_shared -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::RC4_CHAR RC4_CHUNK DES_RISC2 DES_UNROLL SIXTY_FOUR_BIT_LONG::bn-mips3.o::::::::::dlfcn:irix-shared::-64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
 | 
			
		||||
#### Unified HP-UX ANSI C configs.
 | 
			
		||||
# Special notes:
 | 
			
		||||
@@ -285,8 +279,8 @@ my %table=(
 | 
			
		||||
# Since there is mention of this in shlib/hpux10-cc.sh
 | 
			
		||||
"hpux-parisc-cc-o4","cc:-Ae +O4 +ESlit -z -DB_ENDIAN -DBN_DIV2W -DMD32_XARRAY::-D_REENTRANT::-ldld:BN_LLONG DES_PTR DES_UNROLL DES_RISC1:${no_asm}:dl:hpux-shared:+Z:-b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"hpux-parisc-gcc","gcc:-O3 -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-Wl,+s -ldld:BN_LLONG DES_PTR DES_UNROLL DES_RISC1:${no_asm}:dl:hpux-shared:-fPIC:-shared:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"hpux-parisc2-gcc","gcc:-march=2.0 -O3 -DB_ENDIAN -D_REENTRANT::::-Wl,+s -ldld:SIXTY_FOUR_BIT RC4_CHAR RC4_CHUNK DES_PTR DES_UNROLL DES_RISC1::pa-risc2.o::::::::::::void:dl:hpux-shared:-fPIC:-shared:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"hpux64-parisc2-gcc","gcc:-O3 -DB_ENDIAN -D_REENTRANT::::-ldl:SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT::pa-risc2W.o::::::::::::void:dlfcn:hpux-shared:-fpic:-shared:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/pa20_64",
 | 
			
		||||
"hpux-parisc2-gcc","gcc:-march=2.0 -O3 -DB_ENDIAN -D_REENTRANT::::-Wl,+s -ldld:SIXTY_FOUR_BIT RC4_CHAR RC4_CHUNK DES_PTR DES_UNROLL DES_RISC1::pa-risc2.o::::::::::dl:hpux-shared:-fPIC:-shared:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"hpux64-parisc2-gcc","gcc:-O3 -DB_ENDIAN -D_REENTRANT::::-ldl:SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT::pa-risc2W.o::::::::::dlfcn:hpux-shared:-fpic:-shared:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
 | 
			
		||||
# More attempts at unified 10.X and 11.X targets for HP C compiler.
 | 
			
		||||
#
 | 
			
		||||
@@ -294,17 +288,17 @@ my %table=(
 | 
			
		||||
# Kevin Steves <ks@hp.se>
 | 
			
		||||
"hpux-parisc-cc","cc:+O3 +Optrs_strongly_typed -Ae +ESlit -DB_ENDIAN -DBN_DIV2W -DMD32_XARRAY::-D_REENTRANT::-Wl,+s -ldld:MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT:${no_asm}:dl:hpux-shared:+Z:-b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"hpux-parisc1_0-cc","cc:+DAportable +O3 +Optrs_strongly_typed -Ae +ESlit -DB_ENDIAN -DMD32_XARRAY::-D_REENTRANT::-Wl,+s -ldld:MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT:${no_asm}:dl:hpux-shared:+Z:-b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"hpux-parisc2-cc","cc:+DA2.0 +DS2.0 +O3 +Optrs_strongly_typed -Ae +ESlit -DB_ENDIAN -DMD32_XARRAY -D_REENTRANT::::-Wl,+s -ldld:SIXTY_FOUR_BIT MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT::pa-risc2.o::::::::::::void:dl:hpux-shared:+Z:-b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"hpux64-parisc2-cc","cc:+DD64 +O3 +Optrs_strongly_typed -Ae +ESlit -DB_ENDIAN -DMD32_XARRAY -D_REENTRANT::::-ldl:SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT::pa-risc2W.o::::::::::::void:dlfcn:hpux-shared:+Z:+DD64 -b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/pa20_64",
 | 
			
		||||
"hpux-parisc2-cc","cc:+DA2.0 +DS2.0 +O3 +Optrs_strongly_typed -Ae +ESlit -DB_ENDIAN -DMD32_XARRAY -D_REENTRANT::::-Wl,+s -ldld:SIXTY_FOUR_BIT MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT::pa-risc2.o::::::::::dl:hpux-shared:+Z:-b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"hpux64-parisc2-cc","cc:+DD64 +O3 +Optrs_strongly_typed -Ae +ESlit -DB_ENDIAN -DMD32_XARRAY -D_REENTRANT::::-ldl:SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT::pa-risc2W.o::::::::::dlfcn:hpux-shared:+Z:+DD64 -b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
 | 
			
		||||
# HP/UX IA-64 targets
 | 
			
		||||
"hpux-ia64-cc","cc:-Ae +DD32 +O2 +Olit=all -z -DB_ENDIAN -D_REENTRANT::::-ldl:SIXTY_FOUR_BIT MD2_CHAR RC4_INDEX DES_UNROLL DES_RISC1 DES_INT:${ia64_asm}:dlfcn:hpux-shared:+Z:+DD32 -b:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/hpux32",
 | 
			
		||||
"hpux-ia64-cc","cc:-Ae +DD32 +O2 +Olit=all -z -DB_ENDIAN -D_REENTRANT::::-ldl:SIXTY_FOUR_BIT MD2_CHAR RC4_INDEX DES_UNROLL DES_RISC1 DES_INT:${ia64_asm}:dlfcn:hpux-shared:+Z:+DD32 -b:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
# Frank Geurts <frank.geurts@nl.abnamro.com> has patiently assisted with
 | 
			
		||||
# with debugging of the following config.
 | 
			
		||||
"hpux64-ia64-cc","cc:-Ae +DD64 +O3 +Olit=all -z -DB_ENDIAN -D_REENTRANT::::-ldl:SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX DES_UNROLL DES_RISC1 DES_INT:${ia64_asm}:dlfcn:hpux-shared:+Z:+DD64 -b:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/hpux64",
 | 
			
		||||
"hpux64-ia64-cc","cc:-Ae +DD64 +O3 +Olit=all -z -DB_ENDIAN -D_REENTRANT::::-ldl:SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX DES_UNROLL DES_RISC1 DES_INT:${ia64_asm}:dlfcn:hpux-shared:+Z:+DD64 -b:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
# GCC builds...
 | 
			
		||||
"hpux-ia64-gcc","gcc:-O3 -DB_ENDIAN -D_REENTRANT::::-ldl:SIXTY_FOUR_BIT MD2_CHAR RC4_INDEX DES_UNROLL DES_RISC1 DES_INT:${ia64_asm}:dlfcn:hpux-shared:-fpic:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/hpux32",
 | 
			
		||||
"hpux64-ia64-gcc","gcc:-mlp64 -O3 -DB_ENDIAN -D_REENTRANT::::-ldl:SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX DES_UNROLL DES_RISC1 DES_INT:${ia64_asm}:dlfcn:hpux-shared:-fpic:-mlp64 -shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/hpux64", 
 | 
			
		||||
"hpux-ia64-gcc","gcc:-O3 -DB_ENDIAN -D_REENTRANT::::-ldl:SIXTY_FOUR_BIT MD2_CHAR RC4_INDEX DES_UNROLL DES_RISC1 DES_INT:${ia64_asm}:dlfcn:hpux-shared:-fpic:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"hpux64-ia64-gcc","gcc:-mlp64 -O3 -DB_ENDIAN -D_REENTRANT::::-ldl:SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX DES_UNROLL DES_RISC1 DES_INT:${ia64_asm}:dlfcn:hpux-shared:-fpic:-mlp64 -shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", 
 | 
			
		||||
 | 
			
		||||
# Legacy HPUX 9.X configs...
 | 
			
		||||
"hpux-cc",	"cc:-DB_ENDIAN -DBN_DIV2W -DMD32_XARRAY -Ae +ESlit +O2 -z::(unknown)::-Wl,+s -ldld:DES_PTR DES_UNROLL DES_RISC1:${no_asm}:dl:hpux-shared:+Z:-b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
@@ -322,9 +316,9 @@ my %table=(
 | 
			
		||||
#
 | 
			
		||||
# For gcc, the following gave a %50 speedup on a 164 over the 'DES_INT' version
 | 
			
		||||
#
 | 
			
		||||
"osf1-alpha-gcc", "gcc:-O3::(unknown):::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_UNROLL DES_RISC1:${alpha_asm}:dlfcn:alpha-osf1-shared:::.so",
 | 
			
		||||
"osf1-alpha-cc",  "cc:-std1 -tune host -O4 -readonly_strings::(unknown):::SIXTY_FOUR_BIT_LONG RC4_CHUNK:${alpha_asm}:dlfcn:alpha-osf1-shared:::.so",
 | 
			
		||||
"tru64-alpha-cc", "cc:-std1 -tune host -fast -readonly_strings::-pthread:::SIXTY_FOUR_BIT_LONG RC4_CHUNK:${alpha_asm}:dlfcn:alpha-osf1-shared::-msym:.so",
 | 
			
		||||
"osf1-alpha-gcc", "gcc:-O3::(unknown):::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_UNROLL DES_RISC1:${no_asm}:dlfcn:alpha-osf1-shared:::.so",
 | 
			
		||||
"osf1-alpha-cc",  "cc:-std1 -tune host -O4 -readonly_strings::(unknown):::SIXTY_FOUR_BIT_LONG RC4_CHUNK:${no_asm}:dlfcn:alpha-osf1-shared:::.so",
 | 
			
		||||
"tru64-alpha-cc", "cc:-std1 -tune host -fast -readonly_strings::-pthread:::SIXTY_FOUR_BIT_LONG RC4_CHUNK:${no_asm}:dlfcn:alpha-osf1-shared::-msym:.so",
 | 
			
		||||
 | 
			
		||||
####
 | 
			
		||||
#### Variety of LINUX:-)
 | 
			
		||||
@@ -332,31 +326,27 @@ my %table=(
 | 
			
		||||
# *-generic* is endian-neutral target, but ./config is free to
 | 
			
		||||
# throw in -D[BL]_ENDIAN, whichever appropriate...
 | 
			
		||||
"linux-generic32","gcc:-DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"linux-ppc",	"gcc:-DB_ENDIAN -DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL:${ppc32_asm}:linux32:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
# It's believed that majority of ARM toolchains predefine appropriate -march.
 | 
			
		||||
# If you compiler does not, do complement config command line with one!
 | 
			
		||||
"linux-armv4",	"gcc:-DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${armv4_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"linux-ppc",	"gcc:-DB_ENDIAN -DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL::linux_ppc32.o::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
#### IA-32 targets...
 | 
			
		||||
"linux-ia32-icc",	"icc:-DL_ENDIAN -DTERMIO -O2 -no_cpprt::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-KPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"linux-elf",	"gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"linux-aout",	"gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -march=i486 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_asm}:a.out",
 | 
			
		||||
"linux-aout",	"gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -march=i486 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_out_asm}",
 | 
			
		||||
####
 | 
			
		||||
"linux-generic64","gcc:-DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"linux-ppc64",	"gcc:-m64 -DB_ENDIAN -DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL:${ppc64_asm}:linux64:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
 | 
			
		||||
"linux-ia64",	"gcc:-DL_ENDIAN -DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_UNROLL DES_INT:${ia64_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"linux-ia64-ecc","ecc:-DL_ENDIAN -DTERMIO -O2 -Wall -no_cpprt::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT:${ia64_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"linux-ia64-icc","icc:-DL_ENDIAN -DTERMIO -O2 -Wall -no_cpprt::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_RISC1 DES_INT:${ia64_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"linux-x86_64",	"gcc:-m64 -DL_ENDIAN -DTERMIO -O3 -Wall -DMD32_REG_T=int::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK BF_PTR2 DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
 | 
			
		||||
"linux-s390x",	"gcc:-m64 -DB_ENDIAN -DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL:${s390x_asm}:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
 | 
			
		||||
"linux-ppc64",	"gcc:-m64 -DB_ENDIAN -DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL::linux_ppc64.o::::::::::dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"linux-ia64",	"gcc:-DL_ENDIAN -DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK:${ia64_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"linux-ia64-ecc","ecc:-DL_ENDIAN -DTERMIO -O2 -Wall -no_cpprt::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK:${ia64_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"linux-ia64-icc","icc:-DL_ENDIAN -DTERMIO -O2 -Wall -no_cpprt::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK:${ia64_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"linux-x86_64",	"gcc:-m64 -DL_ENDIAN -DTERMIO -O3 -Wall -DMD32_REG_T=int::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK BF_PTR2 DES_INT DES_UNROLL:${x86_64_asm}:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
#### SPARC Linux setups
 | 
			
		||||
# Ray Miller <ray.miller@computing-services.oxford.ac.uk> has patiently
 | 
			
		||||
# assisted with debugging of following two configs.
 | 
			
		||||
"linux-sparcv8","gcc:-mv8 -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall -DBN_DIV2W::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv8_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"linux-sparcv8","gcc:-mv8 -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall -DBN_DIV2W::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::sparcv8.o:des_enc-sparc.o fcrypt_b.o:::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
# it's a real mess with -mcpu=ultrasparc option under Linux, but
 | 
			
		||||
# -Wa,-Av8plus should do the trick no matter what.
 | 
			
		||||
"linux-sparcv9","gcc:-m32 -mcpu=ultrasparc -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall -Wa,-Av8plus -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:linux-shared:-fPIC:-m32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"linux-sparcv9","gcc:-m32 -mcpu=ultrasparc -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall -Wa,-Av8plus -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::sparcv8plus.o:des_enc-sparc.o fcrypt_b.o:::::::::dlfcn:linux-shared:-fPIC:-m32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
# GCC 3.1 is a requirement
 | 
			
		||||
"linux64-sparcv9","gcc:-m64 -mcpu=ultrasparc -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT:ULTRASPARC:-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL BF_PTR:${sparcv9_asm}:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
 | 
			
		||||
"linux64-sparcv9","gcc:-m64 -mcpu=ultrasparc -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT:ULTRASPARC:-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::::::::::::dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
#### Alpha Linux with GNU C and Compaq C setups
 | 
			
		||||
# Special notes:
 | 
			
		||||
# - linux-alpha+bwx-gcc is ment to be used from ./config only. If you
 | 
			
		||||
@@ -370,25 +360,25 @@ my %table=(
 | 
			
		||||
#
 | 
			
		||||
#					<appro@fy.chalmers.se>
 | 
			
		||||
#
 | 
			
		||||
"linux-alpha-gcc","gcc:-O3 -DL_ENDIAN -DTERMIO::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_RISC1 DES_UNROLL:${alpha_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"linux-alpha+bwx-gcc","gcc:-O3 -DL_ENDIAN -DTERMIO::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL:${alpha_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"linux-alpha-ccc","ccc:-fast -readonly_strings -DL_ENDIAN -DTERMIO::-D_REENTRANT:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL:${alpha_asm}",
 | 
			
		||||
"linux-alpha+bwx-ccc","ccc:-fast -readonly_strings -DL_ENDIAN -DTERMIO::-D_REENTRANT:::SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL:${alpha_asm}",
 | 
			
		||||
"linux-alpha-gcc","gcc:-O3 -DL_ENDIAN -DTERMIO::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_RISC1 DES_UNROLL:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"linux-alpha+bwx-gcc","gcc:-O3 -DL_ENDIAN -DTERMIO::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"linux-alpha-ccc","ccc:-fast -readonly_strings -DL_ENDIAN -DTERMIO::-D_REENTRANT:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL:${no_asm}",
 | 
			
		||||
"linux-alpha+bwx-ccc","ccc:-fast -readonly_strings -DL_ENDIAN -DTERMIO::-D_REENTRANT:::SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL:${no_asm}",
 | 
			
		||||
 | 
			
		||||
#### *BSD [do see comment about ${BSDthreads} above!]
 | 
			
		||||
"BSD-generic32","gcc:-DTERMIOS -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL:${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"BSD-x86",	"gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_asm}:a.out:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"BSD-x86",	"gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_out_asm}:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"BSD-x86-elf",	"gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"debug-BSD-x86-elf",	"gcc:-DL_ENDIAN -DTERMIOS -O3 -Wall -g::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"BSD-sparcv8",	"gcc:-DB_ENDIAN -DTERMIOS -O3 -mv8 -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL:${sparcv8_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"BSD-sparcv8",	"gcc:-DB_ENDIAN -DTERMIOS -O3 -mv8 -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL::sparcv8.o:des_enc-sparc.o fcrypt_b.o:::::::::dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
 | 
			
		||||
"BSD-generic64","gcc:-DTERMIOS -O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
# -DMD32_REG_T=int doesn't actually belong in sparc64 target, it
 | 
			
		||||
# simply *happens* to work around a compiler bug in gcc 3.3.3,
 | 
			
		||||
# triggered by RIPEMD160 code.
 | 
			
		||||
"BSD-sparc64",	"gcc:-DB_ENDIAN -DTERMIOS -O3 -DMD32_REG_T=int -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC2 BF_PTR:${sparcv9_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"BSD-ia64",	"gcc:-DL_ENDIAN -DTERMIOS -O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_UNROLL DES_INT:${ia64_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"BSD-x86_64",	"gcc:-DL_ENDIAN -DTERMIOS -O3 -DMD32_REG_T=int -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"BSD-sparc64",	"gcc:-DB_ENDIAN -DTERMIOS -O3 -DMD32_REG_T=int -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC2_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC2 BF_PTR:::des_enc-sparc.o fcrypt_b.o:::::::::dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"BSD-ia64",	"gcc:-DL_ENDIAN -DTERMIOS -O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK:${ia64_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
"BSD-x86_64",	"gcc:-DL_ENDIAN -DTERMIOS -O3 -DMD32_REG_T=int -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
 | 
			
		||||
"bsdi-elf-gcc",     "gcc:-DPERL5 -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall::(unknown)::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 | 
			
		||||
 | 
			
		||||
@@ -402,10 +392,6 @@ my %table=(
 | 
			
		||||
"qnx4",	"cc:-DL_ENDIAN -DTERMIO::(unknown):::${x86_gcc_des} ${x86_gcc_opts}:",
 | 
			
		||||
"qnx6",	"cc:-DL_ENDIAN -DTERMIOS::(unknown)::-lsocket:${x86_gcc_des} ${x86_gcc_opts}:",
 | 
			
		||||
 | 
			
		||||
# BeOS
 | 
			
		||||
"beos-x86-r5",   "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -mcpu=pentium -Wall::-D_REENTRANT:BEOS:-lbe -lnet:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:beos:beos-shared:-fPIC -DPIC:-shared:.so",
 | 
			
		||||
"beos-x86-bone", "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -mcpu=pentium -Wall::-D_REENTRANT:BEOS:-lbe -lbind -lsocket:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:beos:beos-shared:-fPIC:-shared:.so",
 | 
			
		||||
 | 
			
		||||
#### SCO/Caldera targets.
 | 
			
		||||
#
 | 
			
		||||
# Originally we had like unixware-*, unixware-*-pentium, unixware-*-p6, etc.
 | 
			
		||||
@@ -428,12 +414,12 @@ my %table=(
 | 
			
		||||
 | 
			
		||||
#### IBM's AIX.
 | 
			
		||||
"aix3-cc",  "cc:-O -DB_ENDIAN -qmaxmem=16384::(unknown):AIX::BN_LLONG RC4_CHAR:::",
 | 
			
		||||
"aix-gcc",  "gcc:-O -DB_ENDIAN::-pthread:AIX::BN_LLONG RC4_CHAR:${ppc32_asm}:aix32:dlfcn:aix-shared::-shared -Wl,-G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X32",
 | 
			
		||||
"aix64-gcc","gcc:-maix64 -O -DB_ENDIAN::-pthread:AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR:${ppc64_asm}:aix64:dlfcn:aix-shared::-maix64 -shared -Wl,-G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X64",
 | 
			
		||||
"aix-gcc",  "gcc:-O -DB_ENDIAN::-pthread:AIX::BN_LLONG RC4_CHAR::aix_ppc32.o::::::::::dlfcn:aix-shared::-shared -Wl,-G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 32",
 | 
			
		||||
"aix64-gcc","gcc:-maix64 -O -DB_ENDIAN::-pthread:AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR::aix_ppc64.o::::::::::dlfcn:aix-shared::-maix64 -shared -Wl,-G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X64",
 | 
			
		||||
# Below targets assume AIX 5. Idea is to effectively disregard $OBJECT_MODE
 | 
			
		||||
# at build time. $OBJECT_MODE is respected at ./config stage!
 | 
			
		||||
"aix-cc",   "cc:-q32 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst::-qthreaded:AIX::BN_LLONG RC4_CHAR:${ppc32_asm}:aix32:dlfcn:aix-shared::-q32 -G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 32",
 | 
			
		||||
"aix64-cc", "cc:-q64 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst::-qthreaded:AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR:${ppc64_asm}:aix64:dlfcn:aix-shared::-q64 -G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 64",
 | 
			
		||||
"aix-cc",   "cc:-q32 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst::-qthreaded:AIX::BN_LLONG RC4_CHAR::aix_ppc32.o::::::::::dlfcn:aix-shared::-q32 -G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 32",
 | 
			
		||||
"aix64-cc", "cc:-q64 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst::-qthreaded:AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR::aix_ppc64.o::::::::::dlfcn:aix-shared::-q64 -G:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 64",
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Cray T90 and similar (SDSC)
 | 
			
		||||
@@ -481,38 +467,28 @@ my %table=(
 | 
			
		||||
#
 | 
			
		||||
"OS390-Unix","c89.sh:-O -DB_ENDIAN -DCHARSET_EBCDIC -DNO_SYS_PARAM_H  -D_ALL_SOURCE::(unknown):::THIRTY_TWO_BIT DES_PTR DES_UNROLL MD2_CHAR RC4_INDEX RC4_CHAR BF_PTR:::",
 | 
			
		||||
 | 
			
		||||
# Visual C targets
 | 
			
		||||
#
 | 
			
		||||
# Win64 targets, WIN64I denotes IA-64 and WIN64A - AMD64
 | 
			
		||||
"VC-WIN64I","cl:-W3 -Gs0 -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DUNICODE -D_UNICODE -D_CRT_SECURE_NO_DEPRECATE:::WIN64I::SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:ia64cpuid.o:ia64.o::aes_core.o aes_cbc.o aes-ia64.o::md5-ia64.o:sha1-ia64.o sha256-ia64.o sha512-ia64.o:::::::ias:win32",
 | 
			
		||||
"VC-WIN64A","cl:-W3 -Gs0 -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DUNICODE -D_UNICODE -D_CRT_SECURE_NO_DEPRECATE:::WIN64A::SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:x86_64cpuid.o:bn_asm.o x86_64-mont.o::aes-x86_64.o::md5-x86_64.o:sha1-x86_64.o sha256-x86_64.o sha512-x86_64.o::rc4-x86_64.o:::wp-x86_64.o::ml64:win32",
 | 
			
		||||
# x86 Win32 target defaults to ANSI API, if you want UNICODE, complement
 | 
			
		||||
# 'perl Configure VC-WIN32' with '-DUNICODE -D_UNICODE'
 | 
			
		||||
"VC-WIN32","cl:-W3 -WX -Gs0 -GF -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE:::WIN32::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${x86_asm}:win32n:win32",
 | 
			
		||||
# Unified CE target
 | 
			
		||||
"VC-WIN64I","cl::::WIN64I::SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:${no_asm}:win32",
 | 
			
		||||
"VC-WIN64A","cl::::WIN64A::SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:${no_asm}:win32",
 | 
			
		||||
 | 
			
		||||
# Visual C targets
 | 
			
		||||
"VC-NT","cl::::WINNT::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${no_asm}:win32",
 | 
			
		||||
"VC-CE","cl::::WINCE::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${no_asm}:win32",
 | 
			
		||||
"VC-WIN32","cl::::WIN32::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${no_asm}:win32",
 | 
			
		||||
 | 
			
		||||
# Borland C++ 4.5
 | 
			
		||||
"BC-32","bcc32::::WIN32::BN_LLONG DES_PTR RC4_INDEX EXPORT_VAR_AS_FN:${no_asm}:win32",
 | 
			
		||||
 | 
			
		||||
# MinGW
 | 
			
		||||
"mingw", "gcc:-mno-cygwin -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall:::MINGW32:-lws2_32 -lgdi32:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts} EXPORT_VAR_AS_FN:${x86_asm}:coff:win32:cygwin-shared:-D_WINDLL -DOPENSSL_USE_APPLINK:-mno-cygwin:.dll.a",
 | 
			
		||||
# As for OPENSSL_USE_APPLINK. Applink makes it possible to use .dll
 | 
			
		||||
# compiled with one compiler with application compiled with another
 | 
			
		||||
# compiler. It's possible to engage Applink support in mingw64 build,
 | 
			
		||||
# but it's not done, because till mingw64 supports structured exception
 | 
			
		||||
# handling, one can't seriously consider its binaries for using with
 | 
			
		||||
# non-mingw64 run-time environment. And as mingw64 is always consistent
 | 
			
		||||
# with itself, Applink is never engaged and can as well be omitted.
 | 
			
		||||
"mingw64", "gcc:-mno-cygwin -DL_ENDIAN -O3 -Wall -DWIN32_LEAN_AND_MEAN -DUNICODE -D_UNICODE:::MINGW64:-lws2_32 -lgdi32:SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:${x86_64_asm}:mingw64:win32:cygwin-shared:-D_WINDLL:-mno-cygwin:.dll.a",
 | 
			
		||||
"mingw", "gcc:-mno-cygwin -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall -D_WIN32_WINNT=0x333:::MINGW32:-lwsock32 -lgdi32:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts} EXPORT_VAR_AS_FN:${x86_coff_asm}:win32:cygwin-shared:-D_WINDLL -DOPENSSL_USE_APPLINK:-mno-cygwin -shared:.dll.a",
 | 
			
		||||
 | 
			
		||||
# UWIN 
 | 
			
		||||
"UWIN", "cc:-DTERMIOS -DL_ENDIAN -O -Wall:::UWIN::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:win32",
 | 
			
		||||
 | 
			
		||||
# Cygwin
 | 
			
		||||
"Cygwin-pre1.3", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall::(unknown):CYGWIN32::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:win32",
 | 
			
		||||
"Cygwin", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall:::CYGWIN32::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_asm}:coff:dlfcn:cygwin-shared:-D_WINDLL:-shared:.dll.a",
 | 
			
		||||
"debug-Cygwin", "gcc:-DTERMIOS -DL_ENDIAN -march=i486 -Wall -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -g -Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations -Werror:::CYGWIN32:::${no_asm}:dlfcn:cygwin-shared:-D_WINDLL:-shared:.dll.a",
 | 
			
		||||
"Cygwin", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall:::CYGWIN32::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_coff_asm}:dlfcn:cygwin-shared:-D_WINDLL:-shared:.dll.a",
 | 
			
		||||
"debug-Cygwin", "gcc:-DTERMIOS -DL_ENDIAN -march=i486 -Wall -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -g -Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations -Werror:::CYGWIN32:::${no_asm}:dlfcn:cygwin-shared:-D_WINDLL:-shared:.dll.a",
 | 
			
		||||
 | 
			
		||||
# NetWare from David Ward (dsward@novell.com)
 | 
			
		||||
# requires either MetroWerks NLM development tools, or gcc / nlmconv
 | 
			
		||||
@@ -530,7 +506,7 @@ my %table=(
 | 
			
		||||
"netware-libc-bsdsock-gcc", "i586-netware-gcc:-nostdinc -I/ndk/libc/include -DNETWARE_BSDSOCK -DL_ENDIAN -DNETWARE_LIBC -DOPENSSL_SYSNAME_NETWARE -DTERMIO -O2 -Wall:::::BN_LLONG ${x86_gcc_opts}::",
 | 
			
		||||
 | 
			
		||||
# DJGPP
 | 
			
		||||
"DJGPP", "gcc:-I/dev/env/WATT_ROOT/inc -DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O2 -Wall:::MSDOS:-L/dev/env/WATT_ROOT/lib -lwatt:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_asm}:a.out:",
 | 
			
		||||
"DJGPP", "gcc:-I/dev/env/WATT_ROOT/inc -DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O2 -Wall:::MSDOS:-L/dev/env/WATT_ROOT/lib -lwatt:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_out_asm}:",
 | 
			
		||||
 | 
			
		||||
# Ultrix from Bernhard Simon <simon@zid.tuwien.ac.at>
 | 
			
		||||
"ultrix-cc","cc:-std1 -O -Olimit 2500 -DL_ENDIAN::(unknown):::::::",
 | 
			
		||||
@@ -540,12 +516,12 @@ my %table=(
 | 
			
		||||
 | 
			
		||||
##### MacOS X (a.k.a. Rhapsody or Darwin) setup
 | 
			
		||||
"rhapsody-ppc-cc","cc:-O3 -DB_ENDIAN::(unknown):MACOSX_RHAPSODY::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}::",
 | 
			
		||||
"darwin-ppc-cc","cc:-arch ppc -O3 -DB_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc32_asm}:osx32:dlfcn:darwin-shared:-fPIC -fno-common:-arch ppc -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
 | 
			
		||||
"darwin64-ppc-cc","cc:-arch ppc64 -O3 -DB_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc64_asm}:osx64:dlfcn:darwin-shared:-fPIC -fno-common:-arch ppc64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
 | 
			
		||||
"darwin-i386-cc","cc:-arch i386 -O3 -fomit-frame-pointer -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_INT RC4_CHUNK DES_UNROLL BF_PTR:${x86_asm}:macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
 | 
			
		||||
"debug-darwin-i386-cc","cc:-arch i386 -g3 -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_INT RC4_CHUNK DES_UNROLL BF_PTR:${x86_asm}:macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
 | 
			
		||||
"darwin64-x86_64-cc","cc:-arch x86_64 -O3 -DL_ENDIAN -DMD32_REG_T=int -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK BF_PTR2 DES_INT DES_UNROLL:${x86_64_asm}:macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch x86_64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
 | 
			
		||||
"debug-darwin-ppc-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DB_ENDIAN -g -Wall -O::-D_REENTRANT:MACOSX::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc32_asm}:osx32:dlfcn:darwin-shared:-fPIC:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
 | 
			
		||||
"darwin-ppc-cc","cc:-arch ppc -O3 -DB_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::osx_ppc32.o::::::::::dlfcn:darwin-shared:-fPIC -fno-common:-arch ppc -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
 | 
			
		||||
"darwin64-ppc-cc","cc:-arch ppc64 -O3 -DB_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::osx_ppc64.o::::::::::dlfcn:darwin-shared:-fPIC -fno-common:-arch ppc64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
 | 
			
		||||
"darwin-i386-cc","cc:-arch i386 -O3 -fomit-frame-pointer -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
 | 
			
		||||
"debug-darwin-i386-cc","cc:-arch i386 -g3 -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
 | 
			
		||||
"darwin64-x86_64-cc","cc:-arch x86_64 -O3 -fomit-frame-pointer -DL_ENDIAN -DMD32_REG_T=int -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK BF_PTR2 DES_INT DES_UNROLL:${no_asm}:dlfcn:darwin-shared:-fPIC -fno-common:-arch x86_64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
 | 
			
		||||
"debug-darwin-ppc-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DB_ENDIAN -g -Wall -O::-D_REENTRANT:MACOSX::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::osx_ppc32.o::::::::::dlfcn:darwin-shared:-fPIC -fno-common:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
 | 
			
		||||
 | 
			
		||||
##### A/UX
 | 
			
		||||
"aux3-gcc","gcc:-O2 -DTERMIO::(unknown):AUX:-lbsd:RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:::",
 | 
			
		||||
@@ -562,7 +538,7 @@ my %table=(
 | 
			
		||||
##### VxWorks for various targets
 | 
			
		||||
"vxworks-ppc405","ccppc:-g -msoft-float -mlongcall -DCPU=PPC405 -I\$(WIND_BASE)/target/h:::VXWORKS:-r:::::",
 | 
			
		||||
"vxworks-ppc750","ccppc:-ansi -nostdinc -DPPC750 -D_REENTRANT -fvolatile -fno-builtin -fno-for-scope -fsigned-char -Wall -msoft-float -mlongcall -DCPU=PPC604 -I\$(WIND_BASE)/target/h \$(DEBUG_FLAG):::VXWORKS:-r:::::",
 | 
			
		||||
"vxworks-ppc750-debug","ccppc:-ansi -nostdinc -DPPC750 -D_REENTRANT -fvolatile -fno-builtin -fno-for-scope -fsigned-char -Wall -msoft-float -mlongcall -DCPU=PPC604 -I\$(WIND_BASE)/target/h -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DDEBUG -g:::VXWORKS:-r:::::",
 | 
			
		||||
"vxworks-ppc750-debug","ccppc:-ansi -nostdinc -DPPC750 -D_REENTRANT -fvolatile -fno-builtin -fno-for-scope -fsigned-char -Wall -msoft-float -mlongcall -DCPU=PPC604 -I\$(WIND_BASE)/target/h -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DDEBUG -g:::VXWORKS:-r:::::",
 | 
			
		||||
"vxworks-ppc860","ccppc:-nostdinc -msoft-float -DCPU=PPC860 -DNO_STRINGS_H -I\$(WIND_BASE)/target/h:::VXWORKS:-r:::::",
 | 
			
		||||
"vxworks-mipsle","ccmips:-B\$(WIND_BASE)/host/\$(WIND_HOST_TYPE)/lib/gcc-lib/ -DL_ENDIAN -EL -Wl,-EL -mips2 -mno-branch-likely -G 0 -fno-builtin -msoft-float -DCPU=MIPS32 -DMIPSEL -DNO_STRINGS_H -I\$(WIND_BASE)/target/h:::VXWORKS:-r::${no_asm}::::::ranlibmips:",
 | 
			
		||||
 | 
			
		||||
@@ -596,9 +572,6 @@ my $idx_cast_obj = $idx++;
 | 
			
		||||
my $idx_rc4_obj = $idx++;
 | 
			
		||||
my $idx_rmd160_obj = $idx++;
 | 
			
		||||
my $idx_rc5_obj = $idx++;
 | 
			
		||||
my $idx_wp_obj = $idx++;
 | 
			
		||||
my $idx_cmll_obj = $idx++;
 | 
			
		||||
my $idx_perlasm_scheme = $idx++;
 | 
			
		||||
my $idx_dso_scheme = $idx++;
 | 
			
		||||
my $idx_shared_target = $idx++;
 | 
			
		||||
my $idx_shared_cflag = $idx++;
 | 
			
		||||
@@ -606,19 +579,23 @@ my $idx_shared_ldflag = $idx++;
 | 
			
		||||
my $idx_shared_extension = $idx++;
 | 
			
		||||
my $idx_ranlib = $idx++;
 | 
			
		||||
my $idx_arflags = $idx++;
 | 
			
		||||
my $idx_multilib = $idx++;
 | 
			
		||||
 | 
			
		||||
my $prefix="";
 | 
			
		||||
my $openssldir="";
 | 
			
		||||
my $exe_ext="";
 | 
			
		||||
my $install_prefix="";
 | 
			
		||||
my $cross_compile_prefix="";
 | 
			
		||||
my $fipslibdir="/usr/local/ssl/fips-1.0/lib/";
 | 
			
		||||
my $nofipscanistercheck=0;
 | 
			
		||||
my $fipsdso=0;
 | 
			
		||||
my $fipscanisterinternal="n";
 | 
			
		||||
my $baseaddr="0xFB00000";
 | 
			
		||||
my $no_threads=0;
 | 
			
		||||
my $threads=0;
 | 
			
		||||
my $no_shared=0; # but "no-shared" is default
 | 
			
		||||
my $zlib=1;      # but "no-zlib" is default
 | 
			
		||||
my $no_krb5=0;   # but "no-krb5" is implied unless "--with-krb5-..." is used
 | 
			
		||||
my $no_rfc3779=1; # but "no-rfc3779" is default
 | 
			
		||||
my $montasm=1;   # but "no-montasm" is default
 | 
			
		||||
my $no_asm=0;
 | 
			
		||||
my $no_dso=0;
 | 
			
		||||
my $no_gmp=0;
 | 
			
		||||
@@ -635,6 +612,7 @@ my $rc2	="crypto/rc2/rc2.h";
 | 
			
		||||
my $bf	="crypto/bf/bf_locl.h";
 | 
			
		||||
my $bn_asm	="bn_asm.o";
 | 
			
		||||
my $des_enc="des_enc.o fcrypt_b.o";
 | 
			
		||||
my $fips_des_enc="fips_des_enc.o";
 | 
			
		||||
my $aes_enc="aes_core.o aes_cbc.o";
 | 
			
		||||
my $bf_enc	="bf_enc.o";
 | 
			
		||||
my $cast_enc="c_enc.o";
 | 
			
		||||
@@ -643,22 +621,26 @@ my $rc5_enc="rc5_enc.o";
 | 
			
		||||
my $md5_obj="";
 | 
			
		||||
my $sha1_obj="";
 | 
			
		||||
my $rmd160_obj="";
 | 
			
		||||
my $cmll_enc="camellia.o cmll_misc.o cmll_cbc.o";
 | 
			
		||||
my $processor="";
 | 
			
		||||
my $default_ranlib;
 | 
			
		||||
my $perl;
 | 
			
		||||
my $fips=0;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# All of the following is disabled by default (RC5 was enabled before 0.9.8):
 | 
			
		||||
 | 
			
		||||
my %disabled = ( # "what"         => "comment" [or special keyword "experimental"]
 | 
			
		||||
		 "gmp"		  => "default",
 | 
			
		||||
                 "camellia"       => "default",
 | 
			
		||||
                 "capieng"        => "default",
 | 
			
		||||
                 "cms"            => "default",
 | 
			
		||||
                 "gmp"            => "default",
 | 
			
		||||
                 "jpake"          => "experimental",
 | 
			
		||||
                 "mdc2"           => "default",
 | 
			
		||||
                 "montasm"        => "default", # explicit option in 0.9.8 only (implicitly enabled in 0.9.9)
 | 
			
		||||
                 "rc5"            => "default",
 | 
			
		||||
		 "rfc3779"	  => "default",
 | 
			
		||||
                 "rfc3779"        => "default",
 | 
			
		||||
                 "seed"           => "default",
 | 
			
		||||
                 "shared"         => "default",
 | 
			
		||||
		 "store"	  => "experimental",
 | 
			
		||||
                 "zlib"           => "default",
 | 
			
		||||
                 "zlib-dynamic"   => "default"
 | 
			
		||||
               );
 | 
			
		||||
@@ -666,7 +648,7 @@ my @experimental = ();
 | 
			
		||||
 | 
			
		||||
# This is what $depflags will look like with the above defaults
 | 
			
		||||
# (we need this to see if we should advise the user to run "make depend"):
 | 
			
		||||
my $default_depflags = " -DOPENSSL_NO_GMP -DOPENSSL_NO_JPAKE -DOPENSSL_NO_MDC2 -DOPENSSL_NO_RC5 -DOPENSSL_NO_RFC3779 -DOPENSSL_NO_STORE";
 | 
			
		||||
my $default_depflags = " -DOPENSSL_NO_CAMELLIA -DOPENSSL_NO_CAPIENG -DOPENSSL_NO_CMS -DOPENSSL_NO_GMP -DOPENSSL_NO_JPAKE -DOPENSSL_NO_MDC2 -DOPENSSL_NO_RC5 -DOPENSSL_NO_RFC3779 -DOPENSSL_NO_SEED";
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Explicit "no-..." options will be collected in %disabled along with the defaults.
 | 
			
		||||
@@ -746,8 +728,8 @@ PROCESS_ARGS:
 | 
			
		||||
					{
 | 
			
		||||
					$disabled{$1} = "option";
 | 
			
		||||
					}
 | 
			
		||||
				}			
 | 
			
		||||
			}
 | 
			
		||||
				}
 | 
			
		||||
			}			
 | 
			
		||||
		elsif (/^enable-(.+)$/ || /^experimental-(.+)$/)
 | 
			
		||||
			{
 | 
			
		||||
			my $algo = $1;
 | 
			
		||||
@@ -790,15 +772,39 @@ PROCESS_ARGS:
 | 
			
		||||
			}
 | 
			
		||||
		elsif (/^386$/)
 | 
			
		||||
			{ $processor=386; }
 | 
			
		||||
		elsif (/^fips$/)
 | 
			
		||||
			{
 | 
			
		||||
			$fips=1;
 | 
			
		||||
		        }
 | 
			
		||||
		elsif (/^rsaref$/)
 | 
			
		||||
			{
 | 
			
		||||
			# No RSAref support any more since it's not needed.
 | 
			
		||||
			# The check for the option is there so scripts aren't
 | 
			
		||||
			# broken
 | 
			
		||||
			}
 | 
			
		||||
		elsif (/^nofipscanistercheck$/)
 | 
			
		||||
			{
 | 
			
		||||
			$fips = 1;
 | 
			
		||||
			$nofipscanistercheck = 1;
 | 
			
		||||
			}
 | 
			
		||||
		elsif (/^fipscanisterbuild$/)
 | 
			
		||||
			{
 | 
			
		||||
			$fips = 1;
 | 
			
		||||
			$nofipscanistercheck = 1;
 | 
			
		||||
			$fipslibdir="";
 | 
			
		||||
			$fipscanisterinternal="y";
 | 
			
		||||
			}
 | 
			
		||||
		elsif (/^fipsdso$/)
 | 
			
		||||
			{
 | 
			
		||||
			$fips = 1;
 | 
			
		||||
			$nofipscanistercheck = 1;
 | 
			
		||||
			$fipslibdir="";
 | 
			
		||||
			$fipscanisterinternal="y";
 | 
			
		||||
			$fipsdso = 1;
 | 
			
		||||
			}
 | 
			
		||||
		elsif (/^[-+]/)
 | 
			
		||||
			{
 | 
			
		||||
			if (/^-[lL](.*)$/ or /^-Wl,/)
 | 
			
		||||
			if (/^-[lL](.*)$/)
 | 
			
		||||
				{
 | 
			
		||||
				$libs.=$_." ";
 | 
			
		||||
				}
 | 
			
		||||
@@ -830,9 +836,13 @@ PROCESS_ARGS:
 | 
			
		||||
				{
 | 
			
		||||
				$withargs{"zlib-include"}="-I$1";
 | 
			
		||||
				}
 | 
			
		||||
			elsif (/^--cross-compile-prefix=(.*)$/)
 | 
			
		||||
			elsif (/^--with-fipslibdir=(.*)$/)
 | 
			
		||||
				{
 | 
			
		||||
				$cross_compile_prefix=$1;
 | 
			
		||||
				$fipslibdir="$1/";
 | 
			
		||||
				}
 | 
			
		||||
			elsif (/^--with-baseaddr=(.*)$/)
 | 
			
		||||
				{
 | 
			
		||||
				$baseaddr="$1";
 | 
			
		||||
				}
 | 
			
		||||
			else
 | 
			
		||||
				{
 | 
			
		||||
@@ -941,6 +951,54 @@ print "Configuring for $target\n";
 | 
			
		||||
 | 
			
		||||
&usage if (!defined($table{$target}));
 | 
			
		||||
 | 
			
		||||
my @fields = split(/\s*:\s*/,$table{$target} . ":" x 30 , -1);
 | 
			
		||||
my $cc = $fields[$idx_cc];
 | 
			
		||||
# Allow environment CC to override compiler...
 | 
			
		||||
if($ENV{CC}) {
 | 
			
		||||
    $cc = $ENV{CC};
 | 
			
		||||
}
 | 
			
		||||
my $cflags = $fields[$idx_cflags];
 | 
			
		||||
my $unistd = $fields[$idx_unistd];
 | 
			
		||||
my $thread_cflag = $fields[$idx_thread_cflag];
 | 
			
		||||
my $sys_id = $fields[$idx_sys_id];
 | 
			
		||||
my $lflags = $fields[$idx_lflags];
 | 
			
		||||
my $bn_ops = $fields[$idx_bn_ops];
 | 
			
		||||
my $cpuid_obj = $fields[$idx_cpuid_obj];
 | 
			
		||||
my $bn_obj = $fields[$idx_bn_obj];
 | 
			
		||||
my $des_obj = $fields[$idx_des_obj];
 | 
			
		||||
my $aes_obj = $fields[$idx_aes_obj];
 | 
			
		||||
my $bf_obj = $fields[$idx_bf_obj];
 | 
			
		||||
my $md5_obj = $fields[$idx_md5_obj];
 | 
			
		||||
my $sha1_obj = $fields[$idx_sha1_obj];
 | 
			
		||||
my $cast_obj = $fields[$idx_cast_obj];
 | 
			
		||||
my $rc4_obj = $fields[$idx_rc4_obj];
 | 
			
		||||
my $rmd160_obj = $fields[$idx_rmd160_obj];
 | 
			
		||||
my $rc5_obj = $fields[$idx_rc5_obj];
 | 
			
		||||
my $dso_scheme = $fields[$idx_dso_scheme];
 | 
			
		||||
my $shared_target = $fields[$idx_shared_target];
 | 
			
		||||
my $shared_cflag = $fields[$idx_shared_cflag];
 | 
			
		||||
my $shared_ldflag = $fields[$idx_shared_ldflag];
 | 
			
		||||
my $shared_extension = $fields[$idx_shared_extension];
 | 
			
		||||
my $ranlib = $fields[$idx_ranlib];
 | 
			
		||||
my $arflags = $fields[$idx_arflags];
 | 
			
		||||
 | 
			
		||||
if ($fips)
 | 
			
		||||
	{
 | 
			
		||||
	delete $disabled{"shared"} if ($disabled{"shared"} eq "default");
 | 
			
		||||
	$disabled{"asm"}="forced"
 | 
			
		||||
		if ($target !~ "VC\-.*" &&
 | 
			
		||||
		    "$cpuid_obj:$bn_obj:$aes_obj:$des_obj:$sha1_obj" eq "::::");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
foreach (sort @experimental)
 | 
			
		||||
	{
 | 
			
		||||
	my $ALGO;
 | 
			
		||||
	($ALGO = $_) =~ tr/[a-z]/[A-Z]/;
 | 
			
		||||
 | 
			
		||||
	# opensslconf.h will set OPENSSL_NO_... unless OPENSSL_EXPERIMENTAL_... is defined
 | 
			
		||||
	$openssl_experimental_defines .= "#define OPENSSL_NO_$ALGO\n";
 | 
			
		||||
	$cflags .= " -DOPENSSL_EXPERIMENTAL_$ALGO";
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
foreach (sort (keys %disabled))
 | 
			
		||||
	{
 | 
			
		||||
@@ -956,6 +1014,8 @@ foreach (sort (keys %disabled))
 | 
			
		||||
		{ $no_shared = 1; }
 | 
			
		||||
	elsif (/^zlib$/)
 | 
			
		||||
		{ $zlib = 0; }
 | 
			
		||||
	elsif (/^montasm$/)
 | 
			
		||||
		{ $montasm = 0; }
 | 
			
		||||
	elsif (/^static-engine$/)
 | 
			
		||||
		{ }
 | 
			
		||||
	elsif (/^zlib-dynamic$/)
 | 
			
		||||
@@ -997,23 +1057,26 @@ foreach (sort (keys %disabled))
 | 
			
		||||
	print "\n";
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
my $exp_cflags = "";
 | 
			
		||||
foreach (sort @experimental)
 | 
			
		||||
	{
 | 
			
		||||
	my $ALGO;
 | 
			
		||||
	($ALGO = $_) =~ tr/[a-z]/[A-Z]/;
 | 
			
		||||
 | 
			
		||||
	# opensslconf.h will set OPENSSL_NO_... unless OPENSSL_EXPERIMENTAL_... is defined
 | 
			
		||||
	$openssl_experimental_defines .= "#define OPENSSL_NO_$ALGO\n";
 | 
			
		||||
	$exp_cflags .= " -DOPENSSL_EXPERIMENTAL_$ALGO";
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
my $IsMK1MF=scalar grep /^$target$/,@MK1MF_Builds;
 | 
			
		||||
 | 
			
		||||
$exe_ext=".exe" if ($target eq "Cygwin" || $target eq "DJGPP" || $target =~ /^mingw/);
 | 
			
		||||
$IsMK1MF=1 if ($target eq "mingw" && $^O ne "cygwin" && !is_msys());
 | 
			
		||||
 | 
			
		||||
$no_shared = 0 if ($fipsdso && !$IsMK1MF);
 | 
			
		||||
 | 
			
		||||
$exe_ext=".exe" if ($target eq "Cygwin" || $target eq "DJGPP" || $target eq "mingw");
 | 
			
		||||
$exe_ext=".nlm" if ($target =~ /netware/);
 | 
			
		||||
$exe_ext=".pm"  if ($target =~ /vos/);
 | 
			
		||||
$openssldir="/usr/local/ssl" if ($openssldir eq "" and $prefix eq "");
 | 
			
		||||
if ($openssldir eq "" and $prefix eq "")
 | 
			
		||||
	{
 | 
			
		||||
	if ($fips)
 | 
			
		||||
		{
 | 
			
		||||
		$openssldir="/usr/local/ssl/fips";
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		$openssldir="/usr/local/ssl";
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
$prefix=$openssldir if $prefix eq "";
 | 
			
		||||
 | 
			
		||||
$default_ranlib= &which("ranlib") or $default_ranlib="true";
 | 
			
		||||
@@ -1029,47 +1092,10 @@ $openssldir=$prefix . "/" . $openssldir if $openssldir !~ /(^\/|^[a-zA-Z]:[\\\/]
 | 
			
		||||
 | 
			
		||||
print "IsMK1MF=$IsMK1MF\n";
 | 
			
		||||
 | 
			
		||||
my @fields = split(/\s*:\s*/,$table{$target} . ":" x 30 , -1);
 | 
			
		||||
my $cc = $fields[$idx_cc];
 | 
			
		||||
# Allow environment CC to override compiler...
 | 
			
		||||
if($ENV{CC}) {
 | 
			
		||||
    $cc = $ENV{CC};
 | 
			
		||||
}
 | 
			
		||||
my $cflags = $fields[$idx_cflags];
 | 
			
		||||
my $unistd = $fields[$idx_unistd];
 | 
			
		||||
my $thread_cflag = $fields[$idx_thread_cflag];
 | 
			
		||||
my $sys_id = $fields[$idx_sys_id];
 | 
			
		||||
my $lflags = $fields[$idx_lflags];
 | 
			
		||||
my $bn_ops = $fields[$idx_bn_ops];
 | 
			
		||||
my $cpuid_obj = $fields[$idx_cpuid_obj];
 | 
			
		||||
my $bn_obj = $fields[$idx_bn_obj];
 | 
			
		||||
my $des_obj = $fields[$idx_des_obj];
 | 
			
		||||
my $aes_obj = $fields[$idx_aes_obj];
 | 
			
		||||
my $bf_obj = $fields[$idx_bf_obj];
 | 
			
		||||
my $md5_obj = $fields[$idx_md5_obj];
 | 
			
		||||
my $sha1_obj = $fields[$idx_sha1_obj];
 | 
			
		||||
my $cast_obj = $fields[$idx_cast_obj];
 | 
			
		||||
my $rc4_obj = $fields[$idx_rc4_obj];
 | 
			
		||||
my $rmd160_obj = $fields[$idx_rmd160_obj];
 | 
			
		||||
my $rc5_obj = $fields[$idx_rc5_obj];
 | 
			
		||||
my $wp_obj = $fields[$idx_wp_obj];
 | 
			
		||||
my $cmll_obj = $fields[$idx_cmll_obj];
 | 
			
		||||
my $perlasm_scheme = $fields[$idx_perlasm_scheme];
 | 
			
		||||
my $dso_scheme = $fields[$idx_dso_scheme];
 | 
			
		||||
my $shared_target = $fields[$idx_shared_target];
 | 
			
		||||
my $shared_cflag = $fields[$idx_shared_cflag];
 | 
			
		||||
my $shared_ldflag = $fields[$idx_shared_ldflag];
 | 
			
		||||
my $shared_extension = $fields[$idx_shared_extension];
 | 
			
		||||
my $ranlib = $fields[$idx_ranlib];
 | 
			
		||||
my $arflags = $fields[$idx_arflags];
 | 
			
		||||
my $multilib = $fields[$idx_multilib];
 | 
			
		||||
 | 
			
		||||
$cflags = "$cflags$exp_cflags";
 | 
			
		||||
 | 
			
		||||
# '%' in $lflags is used to split flags to "pre-" and post-flags
 | 
			
		||||
my ($prelflags,$postlflags)=split('%',$lflags);
 | 
			
		||||
if (defined($postlflags))	{ $lflags=$postlflags;	}
 | 
			
		||||
else				{ $lflags=$prelflags; undef $prelflags;	}
 | 
			
		||||
if (defined($postlflags))	{ $lflags=$postlflags;  }
 | 
			
		||||
else				{ $lflags=$prelflags; undef $prelflags; }
 | 
			
		||||
 | 
			
		||||
my $no_shared_warn=0;
 | 
			
		||||
my $no_user_cflags=0;
 | 
			
		||||
@@ -1197,9 +1223,18 @@ $lflags="$libs$lflags" if ($libs ne "");
 | 
			
		||||
 | 
			
		||||
if ($no_asm)
 | 
			
		||||
	{
 | 
			
		||||
	$cpuid_obj=$bn_obj=
 | 
			
		||||
	$des_obj=$aes_obj=$bf_obj=$cast_obj=$rc4_obj=$rc5_obj=$cmll_obj=
 | 
			
		||||
	$sha1_obj=$md5_obj=$rmd160_obj=$wp_obj="";
 | 
			
		||||
	$cpuid_obj=$bn_obj=$des_obj=$aes_obj=$bf_obj=$cast_obj=$rc4_obj=$rc5_obj="";
 | 
			
		||||
	$sha1_obj=$md5_obj=$rmd160_obj="";
 | 
			
		||||
	$cflags=~s/\-D[BL]_ENDIAN//		if ($fips);
 | 
			
		||||
	$thread_cflags=~s/\-D[BL]_ENDIAN//	if ($fips);
 | 
			
		||||
	}
 | 
			
		||||
if ($montasm)
 | 
			
		||||
	{
 | 
			
		||||
	$bn_obj =~ s/MAYBE-MO86-/mo86-/;
 | 
			
		||||
	}
 | 
			
		||||
else
 | 
			
		||||
	{
 | 
			
		||||
	$bn_obj =~ s/MAYBE-MO86-[a-z.]*//;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
if (!$no_shared)
 | 
			
		||||
@@ -1230,7 +1265,7 @@ if ($zlib)
 | 
			
		||||
my $shared_mark = "";
 | 
			
		||||
if ($shared_target eq "")
 | 
			
		||||
	{
 | 
			
		||||
	$no_shared_warn = 1 if !$no_shared;
 | 
			
		||||
	$no_shared_warn = 1 if !$no_shared && !$fips;
 | 
			
		||||
	$no_shared = 1;
 | 
			
		||||
	}
 | 
			
		||||
if (!$no_shared)
 | 
			
		||||
@@ -1243,16 +1278,13 @@ if (!$no_shared)
 | 
			
		||||
 | 
			
		||||
if (!$IsMK1MF)
 | 
			
		||||
	{
 | 
			
		||||
	# add {no-}static-engine to options to allow mkdef.pl to work without extra arguments
 | 
			
		||||
	if ($no_shared)
 | 
			
		||||
		{
 | 
			
		||||
		$openssl_other_defines.="#define OPENSSL_NO_DYNAMIC_ENGINE\n";
 | 
			
		||||
		$options.=" static-engine";
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		$openssl_other_defines.="#define OPENSSL_NO_STATIC_ENGINE\n";
 | 
			
		||||
		$options.=" no-static-engine";
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -1319,13 +1351,17 @@ if ($ranlib eq "")
 | 
			
		||||
$cpuid_obj="" if ($processor eq "386");
 | 
			
		||||
 | 
			
		||||
$bn_obj = $bn_asm unless $bn_obj ne "";
 | 
			
		||||
# bn-586 is the only one implementing bn_*_part_words
 | 
			
		||||
$cflags.=" -DOPENSSL_BN_ASM_PART_WORDS" if ($bn_obj =~ /bn-586/);
 | 
			
		||||
$cflags.=" -DOPENSSL_IA32_SSE2" if (!$no_sse2 && $bn_obj =~ /86/);
 | 
			
		||||
# bn86* is the only one implementing bn_*_part_words
 | 
			
		||||
$cflags.=" -DOPENSSL_BN_ASM_PART_WORDS" if ($bn_obj =~ /bn86/);
 | 
			
		||||
$cflags.=" -DOPENSSL_IA32_SSE2" if (!$no_sse2 && $bn_obj =~ /bn86/);
 | 
			
		||||
 | 
			
		||||
$cflags.=" -DOPENSSL_BN_ASM_MONT" if ($bn_obj =~ /-mont/);
 | 
			
		||||
$cflags.=" -DOPENSSL_BN_ASM_MONT" if ($bn_obj =~ /\-mont|mo86\-/);
 | 
			
		||||
 | 
			
		||||
if ($fips)
 | 
			
		||||
	{
 | 
			
		||||
	$openssl_other_defines.="#define OPENSSL_FIPS\n";
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
$cpuid_obj="mem_clr.o"	unless ($cpuid_obj =~ /\.o$/);
 | 
			
		||||
$des_obj=$des_enc	unless ($des_obj =~ /\.o$/);
 | 
			
		||||
$bf_obj=$bf_enc		unless ($bf_obj =~ /\.o$/);
 | 
			
		||||
$cast_obj=$cast_enc	unless ($cast_obj =~ /\.o$/);
 | 
			
		||||
@@ -1361,15 +1397,6 @@ if ($aes_obj =~ /\.o$/)
 | 
			
		||||
else	{
 | 
			
		||||
	$aes_obj=$aes_enc;
 | 
			
		||||
	}
 | 
			
		||||
$wp_obj="" if ($wp_obj =~ /mmx/ && $processor eq "386");
 | 
			
		||||
if ($wp_obj =~ /\.o$/)
 | 
			
		||||
	{
 | 
			
		||||
	$cflags.=" -DWHIRLPOOL_ASM";
 | 
			
		||||
	}
 | 
			
		||||
else	{
 | 
			
		||||
	$wp_obj="wp_block.o";
 | 
			
		||||
	}
 | 
			
		||||
$cmll_obj=$cmll_enc	unless ($cmll_obj =~ /.o$/);
 | 
			
		||||
 | 
			
		||||
# "Stringify" the C flags string.  This permits it to be made part of a string
 | 
			
		||||
# and works as well on command lines.
 | 
			
		||||
@@ -1419,11 +1446,12 @@ while (<IN>)
 | 
			
		||||
	if ($sdirs) {
 | 
			
		||||
		my $dir;
 | 
			
		||||
		foreach $dir (@skip) {
 | 
			
		||||
			s/(\s)$dir /$1/;
 | 
			
		||||
			s/(\s)$dir\s/$1/;
 | 
			
		||||
			s/\s$dir$//;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	$sdirs = 0 unless /\\$/;
 | 
			
		||||
        s/fips // if (/^DIRS=/ && !$fips);
 | 
			
		||||
        s/engines // if (/^DIRS=/ && $disabled{"engine"});
 | 
			
		||||
	s/^VERSION=.*/VERSION=$version/;
 | 
			
		||||
	s/^MAJOR=.*/MAJOR=$major/;
 | 
			
		||||
@@ -1434,25 +1462,13 @@ while (<IN>)
 | 
			
		||||
	s/^SHLIB_MINOR=.*/SHLIB_MINOR=$shlib_minor/;
 | 
			
		||||
	s/^SHLIB_EXT=.*/SHLIB_EXT=$shared_extension/;
 | 
			
		||||
	s/^INSTALLTOP=.*$/INSTALLTOP=$prefix/;
 | 
			
		||||
	s/^MULTILIB=.*$/MULTILIB=$multilib/;
 | 
			
		||||
	s/^OPENSSLDIR=.*$/OPENSSLDIR=$openssldir/;
 | 
			
		||||
	s/^INSTALL_PREFIX=.*$/INSTALL_PREFIX=$install_prefix/;
 | 
			
		||||
	s/^PLATFORM=.*$/PLATFORM=$target/;
 | 
			
		||||
	s/^OPTIONS=.*$/OPTIONS=$options/;
 | 
			
		||||
	s/^CONFIGURE_ARGS=.*$/CONFIGURE_ARGS=$argvstring/;
 | 
			
		||||
	if ($cross_compile_prefix)
 | 
			
		||||
		{
 | 
			
		||||
		s/^CC=.*$/CROSS_COMPILE_PREFIX= $cross_compile_prefix\nCC= \$\(CROSS_COMPILE_PREFIX\)$cc/;
 | 
			
		||||
		s/^AR=\s*/AR= \$\(CROSS_COMPILE_PREFIX\)/;
 | 
			
		||||
		s/^NM=\s*/NM= \$\(CROSS_COMPILE_PREFIX\)/;
 | 
			
		||||
		s/^RANLIB=\s*/RANLIB= \$\(CROSS_COMPILE_PREFIX\)/;
 | 
			
		||||
		s/^MAKEDEPPROG=.*$/MAKEDEPPROG= \$\(CROSS_COMPILE_PREFIX\)$cc/ if $cc eq "gcc";
 | 
			
		||||
		}
 | 
			
		||||
	else	{
 | 
			
		||||
		s/^CC=.*$/CC= $cc/;
 | 
			
		||||
		s/^RANLIB=.*/RANLIB= $ranlib/;
 | 
			
		||||
		s/^MAKEDEPPROG=.*$/MAKEDEPPROG= $cc/ if $cc eq "gcc";
 | 
			
		||||
		}
 | 
			
		||||
	s/^CC=.*$/CC= $cc/;
 | 
			
		||||
	s/^MAKEDEPPROG=.*$/MAKEDEPPROG= $cc/ if $cc eq "gcc";
 | 
			
		||||
	s/^CFLAG=.*$/CFLAG= $cflags/;
 | 
			
		||||
	s/^DEPFLAG=.*$/DEPFLAG=$depflags/;
 | 
			
		||||
	s/^PEX_LIBS=.*$/PEX_LIBS= $prelflags/;
 | 
			
		||||
@@ -1461,7 +1477,7 @@ while (<IN>)
 | 
			
		||||
	s/^CPUID_OBJ=.*$/CPUID_OBJ= $cpuid_obj/;
 | 
			
		||||
	s/^BN_ASM=.*$/BN_ASM= $bn_obj/;
 | 
			
		||||
	s/^DES_ENC=.*$/DES_ENC= $des_obj/;
 | 
			
		||||
	s/^AES_ENC=.*$/AES_ENC= $aes_obj/;
 | 
			
		||||
	s/^AES_ASM_OBJ=.*$/AES_ASM_OBJ= $aes_obj/;
 | 
			
		||||
	s/^BF_ENC=.*$/BF_ENC= $bf_obj/;
 | 
			
		||||
	s/^CAST_ENC=.*$/CAST_ENC= $cast_obj/;
 | 
			
		||||
	s/^RC4_ENC=.*$/RC4_ENC= $rc4_obj/;
 | 
			
		||||
@@ -1469,19 +1485,32 @@ while (<IN>)
 | 
			
		||||
	s/^MD5_ASM_OBJ=.*$/MD5_ASM_OBJ= $md5_obj/;
 | 
			
		||||
	s/^SHA1_ASM_OBJ=.*$/SHA1_ASM_OBJ= $sha1_obj/;
 | 
			
		||||
	s/^RMD160_ASM_OBJ=.*$/RMD160_ASM_OBJ= $rmd160_obj/;
 | 
			
		||||
	s/^WP_ASM_OBJ=.*$/WP_ASM_OBJ= $wp_obj/;
 | 
			
		||||
	s/^CMLL_ENC=.*$/CMLL_ENC= $cmll_obj/;
 | 
			
		||||
	s/^PERLASM_SCHEME=.*$/PERLASM_SCHEME= $perlasm_scheme/;
 | 
			
		||||
	s/^PROCESSOR=.*/PROCESSOR= $processor/;
 | 
			
		||||
	s/^RANLIB=.*/RANLIB= $ranlib/;
 | 
			
		||||
	s/^ARFLAGS=.*/ARFLAGS= $arflags/;
 | 
			
		||||
	s/^PERL=.*/PERL= $perl/;
 | 
			
		||||
	s/^KRB5_INCLUDES=.*/KRB5_INCLUDES=$withargs{"krb5-include"}/;
 | 
			
		||||
	s/^LIBKRB5=.*/LIBKRB5=$withargs{"krb5-lib"}/;
 | 
			
		||||
	s/^LIBZLIB=.*/LIBZLIB=$withargs{"zlib-lib"}/;
 | 
			
		||||
	s/^ZLIB_INCLUDE=.*/ZLIB_INCLUDE=$withargs{"zlib-include"}/;
 | 
			
		||||
	s/^FIPSLIBDIR=.*/FIPSLIBDIR=$fipslibdir/;
 | 
			
		||||
	if ($fipsdso)
 | 
			
		||||
		{
 | 
			
		||||
		s/^FIPSCANLIB=.*/FIPSCANLIB=libfips/;
 | 
			
		||||
		s/^SHARED_FIPS=.*/SHARED_FIPS=libfips\$(SHLIB_EXT)/;
 | 
			
		||||
		s/^SHLIBDIRS=.*/SHLIBDIRS= crypto ssl fips/;
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		s/^FIPSCANLIB=.*/FIPSCANLIB=libcrypto/ if $fips;
 | 
			
		||||
		s/^SHARED_FIPS=.*/SHARED_FIPS=/;
 | 
			
		||||
		s/^SHLIBDIRS=.*/SHLIBDIRS= crypto ssl/;
 | 
			
		||||
		}
 | 
			
		||||
	s/^FIPSCANISTERINTERNAL=.*/FIPSCANISTERINTERNAL=$fipscanisterinternal/;
 | 
			
		||||
	s/^BASEADDR=.*/BASEADDR=$baseaddr/;
 | 
			
		||||
	s/^SHLIB_TARGET=.*/SHLIB_TARGET=$shared_target/;
 | 
			
		||||
	s/^SHLIB_MARK=.*/SHLIB_MARK=$shared_mark/;
 | 
			
		||||
	s/^SHARED_LIBS=.*/SHARED_LIBS=\$(SHARED_CRYPTO) \$(SHARED_SSL)/ if (!$no_shared);
 | 
			
		||||
	s/^SHARED_LIBS=.*/SHARED_LIBS=\$(SHARED_FIPS) \$(SHARED_CRYPTO) \$(SHARED_SSL)/ if (!$no_shared);
 | 
			
		||||
	if ($shared_extension ne "" && $shared_extension =~ /^\.s([ol])\.[^\.]*$/)
 | 
			
		||||
		{
 | 
			
		||||
		my $sotmp = $1;
 | 
			
		||||
@@ -1514,7 +1543,7 @@ print "EX_LIBS       =$lflags\n";
 | 
			
		||||
print "CPUID_OBJ     =$cpuid_obj\n";
 | 
			
		||||
print "BN_ASM        =$bn_obj\n";
 | 
			
		||||
print "DES_ENC       =$des_obj\n";
 | 
			
		||||
print "AES_ENC       =$aes_obj\n";
 | 
			
		||||
print "AES_ASM_OBJ   =$aes_obj\n";
 | 
			
		||||
print "BF_ENC        =$bf_obj\n";
 | 
			
		||||
print "CAST_ENC      =$cast_obj\n";
 | 
			
		||||
print "RC4_ENC       =$rc4_obj\n";
 | 
			
		||||
@@ -1522,7 +1551,6 @@ print "RC5_ENC       =$rc5_obj\n";
 | 
			
		||||
print "MD5_OBJ_ASM   =$md5_obj\n";
 | 
			
		||||
print "SHA1_OBJ_ASM  =$sha1_obj\n";
 | 
			
		||||
print "RMD160_OBJ_ASM=$rmd160_obj\n";
 | 
			
		||||
print "CMLL_ENC=     =$cmll_obj\n";
 | 
			
		||||
print "PROCESSOR     =$processor\n";
 | 
			
		||||
print "RANLIB        =$ranlib\n";
 | 
			
		||||
print "ARFLAGS       =$arflags\n";
 | 
			
		||||
@@ -1610,25 +1638,14 @@ print OUT "#ifdef OPENSSL_ALGORITHM_DEFINES\n";
 | 
			
		||||
print OUT $openssl_algorithm_defines_trans;
 | 
			
		||||
print OUT "#endif\n\n";
 | 
			
		||||
 | 
			
		||||
print OUT "#define OPENSSL_CPUID_OBJ\n\n" if ($cpuid_obj ne "mem_clr.o");
 | 
			
		||||
print OUT "#define OPENSSL_CPUID_OBJ\n\n" if ($cpuid_obj);
 | 
			
		||||
 | 
			
		||||
while (<IN>)
 | 
			
		||||
	{
 | 
			
		||||
	if	(/^#define\s+OPENSSLDIR/)
 | 
			
		||||
		{
 | 
			
		||||
		my $foo = $openssldir;
 | 
			
		||||
		$foo =~ s/\\/\\\\/g;
 | 
			
		||||
		print OUT "#define OPENSSLDIR \"$foo\"\n";
 | 
			
		||||
		}
 | 
			
		||||
		{ print OUT "#define OPENSSLDIR \"$openssldir\"\n"; }
 | 
			
		||||
	elsif	(/^#define\s+ENGINESDIR/)
 | 
			
		||||
		{
 | 
			
		||||
		# $foo is to become "$prefix/lib$multilib/engines";
 | 
			
		||||
		# as Makefile.org and engines/Makefile are adapted for
 | 
			
		||||
		# $multilib suffix.
 | 
			
		||||
		my $foo = "$prefix/lib/engines";
 | 
			
		||||
		$foo =~ s/\\/\\\\/g;
 | 
			
		||||
		print OUT "#define ENGINESDIR \"$foo\"\n";
 | 
			
		||||
		}
 | 
			
		||||
		{ print OUT "#define ENGINESDIR \"$prefix/lib/engines\"\n"; }
 | 
			
		||||
	elsif	(/^#((define)|(undef))\s+OPENSSL_EXPORT_VAR_AS_FUNCTION/)
 | 
			
		||||
		{ printf OUT "#undef OPENSSL_EXPORT_VAR_AS_FUNCTION\n"
 | 
			
		||||
			if $export_var_as_fn;
 | 
			
		||||
@@ -1791,9 +1808,16 @@ BEGIN
 | 
			
		||||
    BEGIN
 | 
			
		||||
	BLOCK "040904b0"
 | 
			
		||||
	BEGIN
 | 
			
		||||
#if defined(FIPS)
 | 
			
		||||
	    VALUE "Comments", "WARNING: TEST VERSION ONLY ***NOT*** FIPS 140-2 VALIDATED.\\0"
 | 
			
		||||
#endif
 | 
			
		||||
	    // Required:	    
 | 
			
		||||
	    VALUE "CompanyName", "The OpenSSL Project, http://www.openssl.org/\\0"
 | 
			
		||||
#if defined(FIPS)
 | 
			
		||||
	    VALUE "FileDescription", "TEST UNVALIDATED FIPS140-2 DLL\\0"
 | 
			
		||||
#else
 | 
			
		||||
	    VALUE "FileDescription", "OpenSSL Shared Library\\0"
 | 
			
		||||
#endif
 | 
			
		||||
	    VALUE "FileVersion", "$version\\0"
 | 
			
		||||
#if defined(CRYPTO)
 | 
			
		||||
	    VALUE "InternalName", "libeay32\\0"
 | 
			
		||||
@@ -1801,12 +1825,15 @@ BEGIN
 | 
			
		||||
#elif defined(SSL)
 | 
			
		||||
	    VALUE "InternalName", "ssleay32\\0"
 | 
			
		||||
	    VALUE "OriginalFilename", "ssleay32.dll\\0"
 | 
			
		||||
#elif defined(FIPS)
 | 
			
		||||
	    VALUE "InternalName", "libosslfips\\0"
 | 
			
		||||
	    VALUE "OriginalFilename", "libosslfips.dll\\0"
 | 
			
		||||
#endif
 | 
			
		||||
	    VALUE "ProductName", "The OpenSSL Toolkit\\0"
 | 
			
		||||
	    VALUE "ProductVersion", "$version\\0"
 | 
			
		||||
	    // Optional:
 | 
			
		||||
	    //VALUE "Comments", "\\0"
 | 
			
		||||
	    VALUE "LegalCopyright", "Copyright <20> 1998-2005 The OpenSSL Project. Copyright <20> 1995-1998 Eric A. Young, Tim J. Hudson. All rights reserved.\\0"
 | 
			
		||||
	    VALUE "LegalCopyright", "Copyright <20> 1998-2007 The OpenSSL Project. Copyright <20> 1995-1998 Eric A. Young, Tim J. Hudson. All rights reserved.\\0"
 | 
			
		||||
	    //VALUE "LegalTrademarks", "\\0"
 | 
			
		||||
	    //VALUE "PrivateBuild", "\\0"
 | 
			
		||||
	    //VALUE "SpecialBuild", "\\0"
 | 
			
		||||
@@ -1843,6 +1870,21 @@ libraries on this platform, they will at least look at it and try their best
 | 
			
		||||
(but please first make sure you have tried with a current version of OpenSSL).
 | 
			
		||||
EOF
 | 
			
		||||
 | 
			
		||||
print <<\EOF if ($fipscanisterinternal eq "y");
 | 
			
		||||
 | 
			
		||||
WARNING: OpenSSL has been configured using unsupported option(s) to internally
 | 
			
		||||
generate a fipscanister.o object module for TESTING PURPOSES ONLY; that
 | 
			
		||||
compiled module is NOT FIPS 140-2 validated and CANNOT be used to replace the
 | 
			
		||||
OpenSSL FIPS Object Module as identified by the CMVP
 | 
			
		||||
(http://csrc.nist.gov/cryptval/) in any application requiring the use of FIPS
 | 
			
		||||
140-2 validated software. 
 | 
			
		||||
 | 
			
		||||
This is an OpenSSL 0.9.8 test version.
 | 
			
		||||
 | 
			
		||||
See the file README.FIPS for details of how to build a test library.
 | 
			
		||||
 | 
			
		||||
EOF
 | 
			
		||||
 | 
			
		||||
exit(0);
 | 
			
		||||
 | 
			
		||||
sub usage
 | 
			
		||||
@@ -1918,8 +1960,8 @@ sub print_table_entry
 | 
			
		||||
	(my $cc,my $cflags,my $unistd,my $thread_cflag,my $sys_id,my $lflags,
 | 
			
		||||
	my $bn_ops,my $cpuid_obj,my $bn_obj,my $des_obj,my $aes_obj, my $bf_obj,
 | 
			
		||||
	my $md5_obj,my $sha1_obj,my $cast_obj,my $rc4_obj,my $rmd160_obj,
 | 
			
		||||
	my $rc5_obj,my $wp_obj,my $cmll_obj,my $perlasm_scheme,my $dso_scheme,my $shared_target,my $shared_cflag,
 | 
			
		||||
	my $shared_ldflag,my $shared_extension,my $ranlib,my $arflags,my $multilib)=
 | 
			
		||||
	my $rc5_obj,my $dso_scheme,my $shared_target,my $shared_cflag,
 | 
			
		||||
	my $shared_ldflag,my $shared_extension,my $ranlib,my $arflags)=
 | 
			
		||||
	split(/\s*:\s*/,$table{$target} . ":" x 30 , -1);
 | 
			
		||||
			
 | 
			
		||||
	print <<EOF
 | 
			
		||||
@@ -1943,9 +1985,6 @@ sub print_table_entry
 | 
			
		||||
\$rc4_obj      = $rc4_obj
 | 
			
		||||
\$rmd160_obj   = $rmd160_obj
 | 
			
		||||
\$rc5_obj      = $rc5_obj
 | 
			
		||||
\$wp_obj       = $wp_obj
 | 
			
		||||
\$cmll_obj     = $cmll_obj
 | 
			
		||||
\$perlasm_scheme = $perlasm_scheme
 | 
			
		||||
\$dso_scheme   = $dso_scheme
 | 
			
		||||
\$shared_target= $shared_target
 | 
			
		||||
\$shared_cflag = $shared_cflag
 | 
			
		||||
@@ -1953,7 +1992,6 @@ sub print_table_entry
 | 
			
		||||
\$shared_extension = $shared_extension
 | 
			
		||||
\$ranlib       = $ranlib
 | 
			
		||||
\$arflags      = $arflags
 | 
			
		||||
\$multilib     = $multilib
 | 
			
		||||
EOF
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -1992,3 +2030,11 @@ sub test_sanity
 | 
			
		||||
	print STDERR "No sanity errors detected!\n" if $errorcnt == 0;
 | 
			
		||||
	return $errorcnt;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
# Attempt to detect MSYS environment
 | 
			
		||||
 | 
			
		||||
sub is_msys
 | 
			
		||||
	{
 | 
			
		||||
	return 1 if (exists $ENV{"TERM"} && $ENV{"TERM"} eq "msys");
 | 
			
		||||
	return 0;
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										8
									
								
								FAQ
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								FAQ
									
									
									
									
									
								
							@@ -78,7 +78,7 @@ OpenSSL  -  Frequently Asked Questions
 | 
			
		||||
* Which is the current version of OpenSSL?
 | 
			
		||||
 | 
			
		||||
The current version is available from <URL: http://www.openssl.org>.
 | 
			
		||||
OpenSSL 0.9.8j was released on Jan 7th, 2009.
 | 
			
		||||
OpenSSL 0.9.8k was released on Mar 25th, 2009.
 | 
			
		||||
 | 
			
		||||
In addition to the current stable release, you can also access daily
 | 
			
		||||
snapshots of the OpenSSL development version at <URL:
 | 
			
		||||
@@ -717,10 +717,8 @@ file.
 | 
			
		||||
 | 
			
		||||
Multi-threaded applications must provide two callback functions to
 | 
			
		||||
OpenSSL by calling CRYPTO_set_locking_callback() and
 | 
			
		||||
CRYPTO_set_id_callback(), for all versions of OpenSSL up to and
 | 
			
		||||
including 0.9.8[abc...]. As of version 0.9.9, CRYPTO_set_id_callback()
 | 
			
		||||
and associated APIs are deprecated by CRYPTO_THREADID_set_callback()
 | 
			
		||||
and friends. This is described in the threads(3) manpage.
 | 
			
		||||
CRYPTO_set_id_callback().  This is described in the threads(3)
 | 
			
		||||
manpage.
 | 
			
		||||
 | 
			
		||||
* I've compiled a program under Windows and it crashes: why?
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										6
									
								
								INSTALL
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								INSTALL
									
									
									
									
									
								
							@@ -98,7 +98,7 @@
 | 
			
		||||
                The crypto/<cipher> directory can be removed after running
 | 
			
		||||
                "make depend".
 | 
			
		||||
 | 
			
		||||
  -Dxxx, -lxxx, -Lxxx, -fxxx, -mXXX, -Kxxx These system specific options will
 | 
			
		||||
  -Dxxx, -lxxx, -Lxxx, -fxxx, -mxxx, -Kxxx These system specific options will
 | 
			
		||||
                be passed through to the compiler to allow you to
 | 
			
		||||
                define preprocessor symbols, specify additional libraries,
 | 
			
		||||
                library directories or other compiler options.
 | 
			
		||||
@@ -206,10 +206,6 @@
 | 
			
		||||
                       compile programs with libcrypto or libssl.
 | 
			
		||||
       lib             Contains the OpenSSL library files themselves.
 | 
			
		||||
 | 
			
		||||
     Use "make install_sw" to install the software without documentation,
 | 
			
		||||
     and "install_docs_html" to install HTML renditions of the manual
 | 
			
		||||
     pages.
 | 
			
		||||
 | 
			
		||||
     Package builders who want to configure the library for standard
 | 
			
		||||
     locations, but have the package installed somewhere else so that
 | 
			
		||||
     it can easily be packaged, can use
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										155
									
								
								INSTALL.W32
									
									
									
									
									
								
							
							
						
						
									
										155
									
								
								INSTALL.W32
									
									
									
									
									
								
							@@ -5,30 +5,19 @@
 | 
			
		||||
 [Instructions for building for Windows CE can be found in INSTALL.WCE]
 | 
			
		||||
 [Instructions for building for Win64 can be found in INSTALL.W64]
 | 
			
		||||
 | 
			
		||||
 Here are a few comments about building OpenSSL for Win32 environments,
 | 
			
		||||
 such as Windows NT and Windows 9x. It should be noted though that
 | 
			
		||||
 Windows 9x are not ordinarily tested. Its mention merely means that we
 | 
			
		||||
 attempt to maintain certain programming discipline and pay attention
 | 
			
		||||
 to backward compatibility issues, in other words it's kind of expected
 | 
			
		||||
 to work on Windows 9x, but no regression tests are actually performed.
 | 
			
		||||
 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.
 | 
			
		||||
 | 
			
		||||
 On additional note newer OpenSSL versions are compiled and linked with
 | 
			
		||||
 Winsock 2. This means that minimum OS requirement was elevated to NT 4
 | 
			
		||||
 and Windows 98 [there is Winsock 2 update for Windows 95 though].
 | 
			
		||||
 You need Perl for Win32.  Unless you will build on Cygwin, you will need
 | 
			
		||||
 ActiveState Perl, 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.
 | 
			
		||||
 | 
			
		||||
 - one of the following C compilers:
 | 
			
		||||
 and one of the following C compilers:
 | 
			
		||||
 | 
			
		||||
  * Visual C++
 | 
			
		||||
  * Borland C
 | 
			
		||||
  * GNU C (Cygwin or MinGW)
 | 
			
		||||
 | 
			
		||||
- Netwide Assembler, a.k.a. NASM, available from http://nasm.sourceforge.net/
 | 
			
		||||
  is required if you intend to utilize assembler modules. Note that NASM
 | 
			
		||||
  is the only supported assembler.
 | 
			
		||||
 | 
			
		||||
 If you are compiling from a tarball or a CVS snapshot then the Win32 files
 | 
			
		||||
 may well be not up to date. This may mean that some "tweaking" is required to
 | 
			
		||||
 get it all to work. See the trouble shooting section later on for if (when?)
 | 
			
		||||
@@ -37,18 +26,39 @@
 | 
			
		||||
 Visual C++
 | 
			
		||||
 ----------
 | 
			
		||||
 | 
			
		||||
 If you want to compile in the assembly language routines with Visual
 | 
			
		||||
 C++, then you will need already mentioned Netwide Assembler binary,
 | 
			
		||||
 nasmw.exe or nasm.exe, to be available on your %PATH%.
 | 
			
		||||
 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
 | 
			
		||||
 faster code: for example it will typically result in a 2 times speedup in the
 | 
			
		||||
 RSA routines. Currently the following assemblers are supported:
 | 
			
		||||
 | 
			
		||||
  * Microsoft MASM (aka "ml")
 | 
			
		||||
  * Free Netwide Assembler NASM.
 | 
			
		||||
 | 
			
		||||
 MASM is distributed with most versions of VC++. For the versions where it is
 | 
			
		||||
 not included in VC++, it is also distributed with some Microsoft DDKs, for
 | 
			
		||||
 example the Windows NT 4.0 DDK and the Windows 98 DDK. If you do not have
 | 
			
		||||
 either of these DDKs then you can just download the binaries for the Windows
 | 
			
		||||
 98 DDK and extract and rename the two files XXXXXml.exe and XXXXXml.err, to
 | 
			
		||||
 ml.exe and ml.err and install somewhere on your PATH. Both DDKs can be
 | 
			
		||||
 downloaded from the Microsoft developers site www.msdn.com.
 | 
			
		||||
 | 
			
		||||
 NASM is freely available. Version 0.98 was used during testing: other versions
 | 
			
		||||
 may also work. It is available from many places, see for example:
 | 
			
		||||
 http://www.kernel.org/pub/software/devel/nasm/binaries/win32/
 | 
			
		||||
 The NASM binary nasmw.exe needs to be installed anywhere on your PATH.
 | 
			
		||||
 | 
			
		||||
 Firstly you should run Configure:
 | 
			
		||||
 | 
			
		||||
 > perl Configure VC-WIN32 --prefix=c:/some/openssl/dir
 | 
			
		||||
 | 
			
		||||
 Where the prefix argument specifies where OpenSSL will be installed to.
 | 
			
		||||
Where the prefix argument specifies where OpenSSL will be installed to.
 | 
			
		||||
 | 
			
		||||
 Next you need to build the Makefiles and optionally the assembly
 | 
			
		||||
 language files:
 | 
			
		||||
 Next you need to build the Makefiles and optionally the assembly language
 | 
			
		||||
 files:
 | 
			
		||||
 | 
			
		||||
 - If you are using MASM then run:
 | 
			
		||||
 | 
			
		||||
   > ms\do_masm
 | 
			
		||||
 | 
			
		||||
 - If you are using NASM then run:
 | 
			
		||||
 | 
			
		||||
@@ -66,37 +76,36 @@
 | 
			
		||||
 | 
			
		||||
 > nmake -f ms\ntdll.mak
 | 
			
		||||
 | 
			
		||||
 If all is well it should compile and you will have some DLLs and
 | 
			
		||||
 executables in out32dll. If you want to try the tests then do:
 | 
			
		||||
 If all is well it should compile and you will have some DLLs and executables
 | 
			
		||||
 in out32dll. If you want to try the tests then do:
 | 
			
		||||
 
 | 
			
		||||
 > nmake -f ms\ntdll.mak test
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 To install OpenSSL to the specified location do:
 | 
			
		||||
To install OpenSSL to the specified location do:
 | 
			
		||||
 | 
			
		||||
 > nmake -f ms\ntdll.mak install
 | 
			
		||||
> nmake -f ms\ntdll.mak install
 | 
			
		||||
 | 
			
		||||
 Tweaks:
 | 
			
		||||
 | 
			
		||||
 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' to the mk1mf.pl lines in the do_* batch
 | 
			
		||||
 file then debugging symbols will be 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.
 | 
			
		||||
 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'
 | 
			
		||||
 to the mk1mf.pl lines in the do_* batch file then debugging symbols will be
 | 
			
		||||
 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.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 By default in 0.9.8 OpenSSL will compile builtin ENGINES into the
 | 
			
		||||
 libeay32.dll shared library. If you specify the "no-static-engine"
 | 
			
		||||
 option on the command line to Configure the shared library build
 | 
			
		||||
 (ms\ntdll.mak) will compile the engines as separate DLLs.
 | 
			
		||||
 By default in 0.9.8 OpenSSL will compile builtin ENGINES into the libeay32.dll
 | 
			
		||||
 shared library. If you specify the "no-static-engine" option on the command
 | 
			
		||||
 line to Configure the shared library build (ms\ntdll.mak) will compile the
 | 
			
		||||
 engines as separate DLLs.
 | 
			
		||||
 | 
			
		||||
 The default Win32 environment is to leave out any Windows NT specific
 | 
			
		||||
 features.
 | 
			
		||||
 | 
			
		||||
 If you want to enable the NT specific features of OpenSSL (currently
 | 
			
		||||
 only the logging BIO) follow the instructions above but call the batch
 | 
			
		||||
 file do_nt.bat instead of do_ms.bat.
 | 
			
		||||
 If you want to enable the NT specific features of OpenSSL (currently only the
 | 
			
		||||
 logging BIO) follow the instructions above but call the batch file do_nt.bat
 | 
			
		||||
 instead of do_ms.bat.
 | 
			
		||||
 | 
			
		||||
 You can also build a static version of the library using the Makefile
 | 
			
		||||
 ms\nt.mak
 | 
			
		||||
@@ -128,13 +137,17 @@
 | 
			
		||||
 GNU C (Cygwin)
 | 
			
		||||
 --------------
 | 
			
		||||
 | 
			
		||||
 Cygwin implements a Posix/Unix runtime system (cygwin1.dll) on top of
 | 
			
		||||
 Win32 subsystem and provides a bash shell and GNU tools environment.
 | 
			
		||||
 Consequently, a make of OpenSSL with Cygwin is virtually identical to
 | 
			
		||||
 Unix procedure. It is also possible to create Win32 binaries that only
 | 
			
		||||
 use the Microsoft C runtime system (msvcrt.dll or crtdll.dll) using
 | 
			
		||||
 MinGW. MinGW can be used in the Cygwin development environment or in a
 | 
			
		||||
 standalone setup as described in the following section.
 | 
			
		||||
 Cygwin provides a bash shell and GNU tools environment running
 | 
			
		||||
 on NT 4.0, Windows 9x, Windows ME, Windows 2000, and Windows XP.
 | 
			
		||||
 Consequently, a make of OpenSSL with Cygwin is closer to a GNU
 | 
			
		||||
 bash environment such as Linux than to other the other Win32
 | 
			
		||||
 makes.
 | 
			
		||||
 | 
			
		||||
 Cygwin implements a Posix/Unix runtime system (cygwin1.dll).
 | 
			
		||||
 It is also possible to create Win32 binaries that only use the
 | 
			
		||||
 Microsoft C runtime system (msvcrt.dll or crtdll.dll) using
 | 
			
		||||
 MinGW. MinGW can be used in the Cygwin development environment
 | 
			
		||||
 or in a standalone setup as described in the following section.
 | 
			
		||||
 | 
			
		||||
 To build OpenSSL using Cygwin:
 | 
			
		||||
 | 
			
		||||
@@ -179,35 +192,35 @@
 | 
			
		||||
 non-fatal error in "make test" but is otherwise harmless.  If
 | 
			
		||||
 desired and needed, GNU bc can be built with Cygwin without change.
 | 
			
		||||
 | 
			
		||||
 GNU C (MinGW/MSYS)
 | 
			
		||||
 GNU C (MinGW)
 | 
			
		||||
 -------------
 | 
			
		||||
 | 
			
		||||
 * Compiler and shell environment installation:
 | 
			
		||||
 * Compiler installation:
 | 
			
		||||
 | 
			
		||||
   MinGW and MSYS are available from http://www.mingw.org/, both are
 | 
			
		||||
   required. Run the installers and do whatever magic they say it takes
 | 
			
		||||
   to start MSYS bash shell with GNU tools on its PATH.
 | 
			
		||||
   MinGW is available from http://www.mingw.org. Run the installer and
 | 
			
		||||
   set the MinGW bin directory to the PATH in "System Properties" or
 | 
			
		||||
   autoexec.bat.
 | 
			
		||||
 | 
			
		||||
 * Compile OpenSSL:
 | 
			
		||||
 | 
			
		||||
   $ ./config
 | 
			
		||||
   [...]
 | 
			
		||||
   $ make
 | 
			
		||||
   [...]
 | 
			
		||||
   $ make test
 | 
			
		||||
   > ms\mingw32
 | 
			
		||||
 | 
			
		||||
   This will create the library and binaries in root source directory
 | 
			
		||||
   and openssl.exe application in apps directory.
 | 
			
		||||
 | 
			
		||||
   It is also possible to cross-compile it on Linux by configuring
 | 
			
		||||
   with './Configure --cross-compile-prefix=i386-mingw32- mingw ...'.
 | 
			
		||||
   'make test' is naturally not applicable then.
 | 
			
		||||
   This will create the library and binaries in out. In case any problems
 | 
			
		||||
   occur, try
 | 
			
		||||
   > ms\mingw32 no-asm
 | 
			
		||||
   instead.
 | 
			
		||||
 | 
			
		||||
   libcrypto.a and libssl.a are the static libraries. To use the DLLs,
 | 
			
		||||
   link with libeay32.a and libssl32.a instead.
 | 
			
		||||
 | 
			
		||||
   See troubleshooting if you get error messages about functions not
 | 
			
		||||
   having a number assigned.
 | 
			
		||||
   See troubleshooting if you get error messages about functions not having
 | 
			
		||||
   a number assigned.
 | 
			
		||||
 | 
			
		||||
 * You can now try the tests:
 | 
			
		||||
 | 
			
		||||
   > cd out
 | 
			
		||||
   > ..\ms\test
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 Installation
 | 
			
		||||
 ------------
 | 
			
		||||
@@ -294,13 +307,13 @@
 | 
			
		||||
 | 
			
		||||
 If you link with static OpenSSL libraries [those built with ms/nt.mak],
 | 
			
		||||
 then you're expected to additionally link your application with
 | 
			
		||||
 WS2_32.LIB, ADVAPI32.LIB, GDI32.LIB and USER32.LIB. Those developing
 | 
			
		||||
 WSOCK32.LIB, ADVAPI32.LIB, GDI32.LIB and USER32.LIB. Those developing
 | 
			
		||||
 non-interactive service applications might feel concerned about linking
 | 
			
		||||
 with the latter two, as they are justly associated with interactive
 | 
			
		||||
 desktop, which is not available to service processes. The toolkit is
 | 
			
		||||
 designed to detect in which context it's currently executed, GUI,
 | 
			
		||||
 console app or service, and act accordingly, namely whether or not to
 | 
			
		||||
 actually make GUI calls.
 | 
			
		||||
 with latter two, as they are justly associated with interactive desktop,
 | 
			
		||||
 which is not available to service processes. The toolkit is designed
 | 
			
		||||
 to detect in which context it's currently executed, GUI, console app
 | 
			
		||||
 or service, and act accordingly, namely whether or not to actually make
 | 
			
		||||
 GUI calls.
 | 
			
		||||
 | 
			
		||||
 If you link with OpenSSL .DLLs, then you're expected to include into
 | 
			
		||||
 your application code small "shim" snippet, which provides glue between
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										77
									
								
								INSTALL.WCE
									
									
									
									
									
								
							
							
						
						
									
										77
									
								
								INSTALL.WCE
									
									
									
									
									
								
							@@ -4,36 +4,27 @@
 | 
			
		||||
 | 
			
		||||
 Building OpenSSL for Windows CE requires the following external tools:
 | 
			
		||||
 | 
			
		||||
  * Microsoft eMbedded Visual C++ 3.0 or later
 | 
			
		||||
  * Appropriate SDK might be required
 | 
			
		||||
  * Perl for Win32 [commonly recommended ActiveState Perl is available
 | 
			
		||||
    from http://www.activestate.com/Products/ActivePerl/]
 | 
			
		||||
  * Microsoft eMbedded Visual C++ 3.0
 | 
			
		||||
  * wcecompat compatibility library (www.essemer.com.au)
 | 
			
		||||
  * Optionally ceutils for running automated tests (www.essemer.com.au)
 | 
			
		||||
 | 
			
		||||
  * wcecompat compatibility library available at
 | 
			
		||||
    http://www.essemer.com.au/windowsce/
 | 
			
		||||
  * Optionally ceutils for running automated tests (same location)
 | 
			
		||||
 You also need Perl for Win32.  You will need ActiveState Perl, available
 | 
			
		||||
 from http://www.activestate.com/ActivePerl.
 | 
			
		||||
 | 
			
		||||
  _or_
 | 
			
		||||
 Windows CE support in OpenSSL relies on wcecompat and therefore it's
 | 
			
		||||
 appropriate to check http://www.essemer.com.au/windowsce/ for updates in
 | 
			
		||||
 case of compilation problems. As for the moment of this writing version
 | 
			
		||||
 1.1 is available and actually required for WCE 4.2 and newer platforms.
 | 
			
		||||
 All Windows CE specific issues should be directed to www.essemer.com.au.
 | 
			
		||||
 | 
			
		||||
  * PocketConsole driver and PortSDK available at
 | 
			
		||||
    http://www.symbolictools.de/public/pocketconsole/
 | 
			
		||||
  * CMD command interpreter (same location)
 | 
			
		||||
 | 
			
		||||
 As Windows CE support in OpenSSL relies on 3rd party compatibility
 | 
			
		||||
 library, it's appropriate to check corresponding URL for updates. For
 | 
			
		||||
 example if you choose wcecompat, note that as for the moment of this
 | 
			
		||||
 writing version 1.2 is available and actually required for WCE 4.2
 | 
			
		||||
 and newer platforms. All wcecompat issues should be directed to
 | 
			
		||||
 www.essemer.com.au.
 | 
			
		||||
 | 
			
		||||
 Why compatibility library at all? The C Runtime Library implementation
 | 
			
		||||
 for Windows CE that is included with Microsoft eMbedded Visual C++ is
 | 
			
		||||
 incomplete and in some places incorrect.  Compatibility library plugs
 | 
			
		||||
 the holes and tries to bring the Windows CE CRT to [more] usable level.
 | 
			
		||||
 Most gaping hole in CRT is support for stdin/stdout/stderr IO, which
 | 
			
		||||
 proposed compatibility libraries solve in two different ways: wcecompat
 | 
			
		||||
 redirects IO to active sync link, while PortSDK - to NT-like console
 | 
			
		||||
 driver on the handheld itself.
 | 
			
		||||
 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
 | 
			
		||||
 --------
 | 
			
		||||
@@ -43,21 +34,9 @@
 | 
			
		||||
 | 
			
		||||
 > "C:\Program Files\Microsoft eMbedded Tools\EVC\WCE300\BIN\WCEARM.BAT"
 | 
			
		||||
 | 
			
		||||
 Next pick compatibility library according to your preferences.
 | 
			
		||||
 Next indicate where wcecompat is located:
 | 
			
		||||
 | 
			
		||||
 1. To choose wcecompat set up WCECOMPAT environment variable pointing
 | 
			
		||||
    at the location of wcecompat tree "root":
 | 
			
		||||
 | 
			
		||||
    > set WCECOMPAT=C:\wcecompat
 | 
			
		||||
    > set PORTSDK_LIBPATH=
 | 
			
		||||
 | 
			
		||||
 2. To choose PortSDK set up PORTSDK_LIBPATH to point at hardware-
 | 
			
		||||
    specific location where your portlib.lib is installed:
 | 
			
		||||
 | 
			
		||||
    > set PORTSDK_LIBPATH=C:\PortSDK\lib\ARM
 | 
			
		||||
    > set WCECOMPAT=
 | 
			
		||||
 | 
			
		||||
 Note that you may not set both variables.
 | 
			
		||||
 > set WCECOMPAT=C:\wcecompat
 | 
			
		||||
 | 
			
		||||
 Next you should run Configure:
 | 
			
		||||
 | 
			
		||||
@@ -73,16 +52,16 @@
 | 
			
		||||
 | 
			
		||||
 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
 | 
			
		||||
 | 
			
		||||
 [note that static builds are not supported under CE]
 | 
			
		||||
 | 
			
		||||
 If all is well it should compile and you will have some DLLs and executables
 | 
			
		||||
 in out32dll*. 
 | 
			
		||||
 | 
			
		||||
 <<< everyting below needs revision in respect to wcecompat vs. PortSDK >>>
 | 
			
		||||
 | 
			
		||||
 If you want
 | 
			
		||||
 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
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										294
									
								
								Makefile.org
									
									
									
									
									
								
							
							
						
						
									
										294
									
								
								Makefile.org
									
									
									
									
									
								
							@@ -65,8 +65,8 @@ EX_LIBS=
 | 
			
		||||
EXE_EXT= 
 | 
			
		||||
ARFLAGS=
 | 
			
		||||
AR=ar $(ARFLAGS) r
 | 
			
		||||
ARD=ar $(ARFLAGS) d
 | 
			
		||||
RANLIB= ranlib
 | 
			
		||||
NM= nm
 | 
			
		||||
PERL= perl
 | 
			
		||||
TAR= tar
 | 
			
		||||
TARFLAGS= --no-recursion
 | 
			
		||||
@@ -88,7 +88,7 @@ PROCESSOR=
 | 
			
		||||
CPUID_OBJ= 
 | 
			
		||||
BN_ASM= bn_asm.o
 | 
			
		||||
DES_ENC= des_enc.o fcrypt_b.o
 | 
			
		||||
AES_ENC= aes_core.o aes_cbc.o
 | 
			
		||||
AES_ASM_OBJ=aes_core.o aes_cbc.o
 | 
			
		||||
BF_ENC= bf_enc.o
 | 
			
		||||
CAST_ENC= c_enc.o
 | 
			
		||||
RC4_ENC= rc4_enc.o
 | 
			
		||||
@@ -96,9 +96,6 @@ RC5_ENC= rc5_enc.o
 | 
			
		||||
MD5_ASM_OBJ= 
 | 
			
		||||
SHA1_ASM_OBJ= 
 | 
			
		||||
RMD160_ASM_OBJ= 
 | 
			
		||||
WP_ASM_OBJ=
 | 
			
		||||
CMLL_ENC=
 | 
			
		||||
PERLASM_SCHEME=
 | 
			
		||||
 | 
			
		||||
# KRB5 stuff
 | 
			
		||||
KRB5_INCLUDES=
 | 
			
		||||
@@ -108,18 +105,44 @@ LIBKRB5=
 | 
			
		||||
ZLIB_INCLUDE=
 | 
			
		||||
LIBZLIB=
 | 
			
		||||
 | 
			
		||||
DIRS=   crypto ssl engines apps test tools
 | 
			
		||||
SHLIBDIRS= crypto ssl
 | 
			
		||||
# This is the location of fipscanister.o and friends.
 | 
			
		||||
# The FIPS module build will place it $(INSTALLTOP)/lib
 | 
			
		||||
# but since $(INSTALLTOP) can only take the default value
 | 
			
		||||
# when the module is built it will be in /usr/local/ssl/lib
 | 
			
		||||
# $(INSTALLTOP) for this build make be different so hard
 | 
			
		||||
# code the path.
 | 
			
		||||
 | 
			
		||||
FIPSLIBDIR=/usr/local/ssl/lib/
 | 
			
		||||
 | 
			
		||||
# This is set to "y" if fipscanister.o is compiled internally as
 | 
			
		||||
# opposed to coming from an external validated location.
 | 
			
		||||
 | 
			
		||||
FIPSCANISTERINTERNAL=n
 | 
			
		||||
 | 
			
		||||
# The location of the library which contains fipscanister.o
 | 
			
		||||
# normally it will be libcrypto unless fipsdso is set in which
 | 
			
		||||
# case it will be libfips. If not compiling in FIPS mode at all
 | 
			
		||||
# this is empty making it a useful test for a FIPS compile.
 | 
			
		||||
 | 
			
		||||
FIPSCANLIB=
 | 
			
		||||
 | 
			
		||||
# Shared library base address. Currently only used on Windows.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
BASEADDR=
 | 
			
		||||
 | 
			
		||||
DIRS=   crypto fips ssl engines apps test tools
 | 
			
		||||
SHLIBDIRS= crypto ssl fips
 | 
			
		||||
 | 
			
		||||
# dirs in crypto to build
 | 
			
		||||
SDIRS=  \
 | 
			
		||||
	objects \
 | 
			
		||||
	md2 md4 md5 sha mdc2 hmac ripemd whrlpool \
 | 
			
		||||
	des aes rc2 rc4 rc5 idea bf cast camellia seed modes \
 | 
			
		||||
	md2 md4 md5 sha mdc2 hmac ripemd \
 | 
			
		||||
	des aes rc2 rc4 rc5 idea bf cast camellia seed \
 | 
			
		||||
	bn ec rsa dsa ecdsa dh ecdh dso engine \
 | 
			
		||||
	buffer bio stack lhash rand err \
 | 
			
		||||
	evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp ui krb5 \
 | 
			
		||||
	cms pqueue ts jpake store
 | 
			
		||||
	store cms pqueue jpake
 | 
			
		||||
# keep in mind that the above list is adjusted by ./Configure
 | 
			
		||||
# according to no-xxx arguments...
 | 
			
		||||
 | 
			
		||||
@@ -133,8 +156,6 @@ MANDIR=$(OPENSSLDIR)/man
 | 
			
		||||
MAN1=1
 | 
			
		||||
MAN3=3
 | 
			
		||||
MANSUFFIX=
 | 
			
		||||
HTMLSUFFIX=html
 | 
			
		||||
HTMLDIR=$(OPENSSLDIR)/html
 | 
			
		||||
SHELL=/bin/sh
 | 
			
		||||
 | 
			
		||||
TOP=    .
 | 
			
		||||
@@ -144,6 +165,7 @@ WDIRS=  windows
 | 
			
		||||
LIBS=   libcrypto.a libssl.a
 | 
			
		||||
SHARED_CRYPTO=libcrypto$(SHLIB_EXT)
 | 
			
		||||
SHARED_SSL=libssl$(SHLIB_EXT)
 | 
			
		||||
SHARED_FIPS=
 | 
			
		||||
SHARED_LIBS=
 | 
			
		||||
SHARED_LIBS_LINK_EXTS=
 | 
			
		||||
SHARED_LDFLAGS=
 | 
			
		||||
@@ -174,33 +196,33 @@ CLEARENV=	TOP= && unset TOP $${LIB+LIB} $${LIBS+LIBS}	\
 | 
			
		||||
		$${SHAREDCMD+SHAREDCMD} $${SHAREDFLAGS+SHAREDFLAGS}	\
 | 
			
		||||
		$${SHARED_LIB+SHARED_LIB} $${LIBEXTRAS+LIBEXTRAS}
 | 
			
		||||
 | 
			
		||||
BUILDENV=	PLATFORM='$(PLATFORM)' PROCESSOR='$(PROCESSOR)' \
 | 
			
		||||
		CC='$(CC)' CFLAG='$(CFLAG)' 			\
 | 
			
		||||
		AS='$(CC)' ASFLAG='$(CFLAG) -c'			\
 | 
			
		||||
		AR='$(AR)' NM='$(NM)' RANLIB='$(RANLIB)'	\
 | 
			
		||||
		CROSS_COMPILE_PREFIX='$(CROSS_COMPILE_PREFIX)'	\
 | 
			
		||||
		PERL='$(PERL)'					\
 | 
			
		||||
		SDIRS='$(SDIRS)' LIBRPATH='$(INSTALLTOP)/lib'	\
 | 
			
		||||
		INSTALL_PREFIX='$(INSTALL_PREFIX)'		\
 | 
			
		||||
		INSTALLTOP='$(INSTALLTOP)' OPENSSLDIR='$(OPENSSLDIR)'	\
 | 
			
		||||
		MAKEDEPEND='$$$${TOP}/util/domd $$$${TOP} -MD $(MAKEDEPPROG)' \
 | 
			
		||||
		DEPFLAG='-DOPENSSL_NO_DEPRECATED $(DEPFLAG)'	\
 | 
			
		||||
		MAKEDEPPROG='$(MAKEDEPPROG)'			\
 | 
			
		||||
		SHARED_LDFLAGS='$(SHARED_LDFLAGS)'		\
 | 
			
		||||
		KRB5_INCLUDES='$(KRB5_INCLUDES)' LIBKRB5='$(LIBKRB5)'	\
 | 
			
		||||
		EXE_EXT='$(EXE_EXT)' SHARED_LIBS='$(SHARED_LIBS)'	\
 | 
			
		||||
		SHLIB_EXT='$(SHLIB_EXT)' SHLIB_TARGET='$(SHLIB_TARGET)'	\
 | 
			
		||||
		PEX_LIBS='$(PEX_LIBS)' EX_LIBS='$(EX_LIBS)'	\
 | 
			
		||||
		CPUID_OBJ='$(CPUID_OBJ)'			\
 | 
			
		||||
		BN_ASM='$(BN_ASM)' DES_ENC='$(DES_ENC)' 	\
 | 
			
		||||
		AES_ENC='$(AES_ENC)' CMLL_ENC='$(CMLL_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)'		\
 | 
			
		||||
		WP_ASM_OBJ='$(WP_ASM_OBJ)'			\
 | 
			
		||||
		PERLASM_SCHEME='$(PERLASM_SCHEME)'		\
 | 
			
		||||
BUILDENV=	PLATFORM='${PLATFORM}' PROCESSOR='${PROCESSOR}' \
 | 
			
		||||
		CC='${CC}' CFLAG='${CFLAG}' 			\
 | 
			
		||||
		AS='${CC}' ASFLAG='${CFLAG} -c'			\
 | 
			
		||||
		AR='${AR}' PERL='${PERL}' RANLIB='${RANLIB}'	\
 | 
			
		||||
		SDIRS='${SDIRS}' LIBRPATH='${INSTALLTOP}/lib'	\
 | 
			
		||||
		INSTALL_PREFIX='${INSTALL_PREFIX}'		\
 | 
			
		||||
		INSTALLTOP='${INSTALLTOP}' OPENSSLDIR='${OPENSSLDIR}'	\
 | 
			
		||||
		MAKEDEPEND='$$$${TOP}/util/domd $$$${TOP} -MD ${MAKEDEPPROG}' \
 | 
			
		||||
		DEPFLAG='-DOPENSSL_NO_DEPRECATED ${DEPFLAG}'	\
 | 
			
		||||
		MAKEDEPPROG='${MAKEDEPPROG}'			\
 | 
			
		||||
		SHARED_LDFLAGS='${SHARED_LDFLAGS}'		\
 | 
			
		||||
		KRB5_INCLUDES='${KRB5_INCLUDES}' LIBKRB5='${LIBKRB5}'	\
 | 
			
		||||
		EXE_EXT='${EXE_EXT}' SHARED_LIBS='${SHARED_LIBS}'	\
 | 
			
		||||
		SHLIB_EXT='${SHLIB_EXT}' SHLIB_TARGET='${SHLIB_TARGET}'	\
 | 
			
		||||
		PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}'	\
 | 
			
		||||
		CPUID_OBJ='${CPUID_OBJ}'			\
 | 
			
		||||
		BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' 	\
 | 
			
		||||
		AES_ASM_OBJ='${AES_ASM_OBJ}'			\
 | 
			
		||||
		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}'		\
 | 
			
		||||
		FIPSLIBDIR='${FIPSLIBDIR}'			\
 | 
			
		||||
		FIPSCANLIB="$${FIPSCANLIB:-$(FIPSCANLIB)}"	\
 | 
			
		||||
		FIPSCANISTERINTERNAL='${FIPSCANISTERINTERNAL}'	\
 | 
			
		||||
		FIPS_EX_OBJ='${FIPS_EX_OBJ}'	\
 | 
			
		||||
		THIS=$${THIS:-$@} MAKEFILE=Makefile MAKEOVERRIDES=
 | 
			
		||||
# MAKEOVERRIDES= effectively "equalizes" GNU-ish and SysV-ish make flavors,
 | 
			
		||||
# which in turn eliminates ambiguities in variable treatment with -e.
 | 
			
		||||
@@ -219,26 +241,98 @@ BUILDENV=	PLATFORM='$(PLATFORM)' PROCESSOR='$(PROCESSOR)' \
 | 
			
		||||
# subdirectories defined in $(DIRS).  It requires that the target
 | 
			
		||||
# is given through the shell variable `target'.
 | 
			
		||||
BUILD_CMD=  if [ -d "$$dir" ]; then \
 | 
			
		||||
	    (	cd $$dir && echo "making $$target in $$dir..." && \
 | 
			
		||||
	    (	[ $$target != all -a -z "$(FIPSCANLIB)" ] && FIPSCANLIB=/dev/null; \
 | 
			
		||||
		cd $$dir && echo "making $$target in $$dir..." && \
 | 
			
		||||
		$(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=.. DIR=$$dir $$target \
 | 
			
		||||
	    ) || exit 1; \
 | 
			
		||||
	    fi
 | 
			
		||||
RECURSIVE_BUILD_CMD=for dir in $(DIRS); do $(BUILD_CMD); done
 | 
			
		||||
BUILD_ONE_CMD=\
 | 
			
		||||
	if expr " $(DIRS) " : ".* $$dir " >/dev/null 2>&1; then \
 | 
			
		||||
	if echo " $(DIRS) " | grep " $$dir " >/dev/null 2>/dev/null; then \
 | 
			
		||||
		$(BUILD_CMD); \
 | 
			
		||||
	fi
 | 
			
		||||
 | 
			
		||||
reflect:
 | 
			
		||||
	@[ -n "$(THIS)" ] && $(CLEARENV) && $(MAKE) $(THIS) -e $(BUILDENV)
 | 
			
		||||
 | 
			
		||||
FIPS_EX_OBJ= ../crypto/aes/aes_cfb.o \
 | 
			
		||||
	../crypto/aes/aes_ecb.o \
 | 
			
		||||
	../crypto/aes/aes_ofb.o \
 | 
			
		||||
	../crypto/bn/bn_add.o \
 | 
			
		||||
	../crypto/bn/bn_blind.o \
 | 
			
		||||
	../crypto/bn/bn_ctx.o \
 | 
			
		||||
	../crypto/bn/bn_div.o \
 | 
			
		||||
	../crypto/bn/bn_exp2.o \
 | 
			
		||||
	../crypto/bn/bn_exp.o \
 | 
			
		||||
	../crypto/bn/bn_gcd.o \
 | 
			
		||||
	../crypto/bn/bn_lib.o \
 | 
			
		||||
	../crypto/bn/bn_mod.o \
 | 
			
		||||
	../crypto/bn/bn_mont.o \
 | 
			
		||||
	../crypto/bn/bn_mul.o \
 | 
			
		||||
	../crypto/bn/bn_prime.o \
 | 
			
		||||
	../crypto/bn/bn_rand.o \
 | 
			
		||||
	../crypto/bn/bn_recp.o \
 | 
			
		||||
	../crypto/bn/bn_shift.o \
 | 
			
		||||
	../crypto/bn/bn_sqr.o \
 | 
			
		||||
	../crypto/bn/bn_word.o \
 | 
			
		||||
	../crypto/bn/bn_x931p.o \
 | 
			
		||||
	../crypto/buffer/buf_str.o \
 | 
			
		||||
	../crypto/cryptlib.o \
 | 
			
		||||
	../crypto/des/cfb64ede.o \
 | 
			
		||||
	../crypto/des/cfb64enc.o \
 | 
			
		||||
	../crypto/des/cfb_enc.o \
 | 
			
		||||
	../crypto/des/ecb3_enc.o \
 | 
			
		||||
	../crypto/des/ecb_enc.o \
 | 
			
		||||
	../crypto/des/ofb64ede.o \
 | 
			
		||||
	../crypto/des/ofb64enc.o \
 | 
			
		||||
	../crypto/des/fcrypt.o \
 | 
			
		||||
	../crypto/des/set_key.o \
 | 
			
		||||
	../crypto/dsa/dsa_utl.o \
 | 
			
		||||
	../crypto/dsa/dsa_sign.o \
 | 
			
		||||
	../crypto/dsa/dsa_vrf.o \
 | 
			
		||||
	../crypto/err/err.o \
 | 
			
		||||
	../crypto/evp/digest.o \
 | 
			
		||||
	../crypto/evp/enc_min.o \
 | 
			
		||||
	../crypto/evp/e_aes.o \
 | 
			
		||||
	../crypto/evp/e_des3.o \
 | 
			
		||||
	../crypto/evp/p_sign.o \
 | 
			
		||||
	../crypto/evp/p_verify.o \
 | 
			
		||||
	../crypto/mem_clr.o \
 | 
			
		||||
	../crypto/mem.o \
 | 
			
		||||
	../crypto/rand/md_rand.o \
 | 
			
		||||
	../crypto/rand/rand_egd.o \
 | 
			
		||||
	../crypto/rand/randfile.o \
 | 
			
		||||
	../crypto/rand/rand_lib.o \
 | 
			
		||||
	../crypto/rand/rand_os2.o \
 | 
			
		||||
	../crypto/rand/rand_unix.o \
 | 
			
		||||
	../crypto/rand/rand_win.o \
 | 
			
		||||
	../crypto/rsa/rsa_lib.o \
 | 
			
		||||
	../crypto/rsa/rsa_none.o \
 | 
			
		||||
	../crypto/rsa/rsa_oaep.o \
 | 
			
		||||
	../crypto/rsa/rsa_pk1.o \
 | 
			
		||||
	../crypto/rsa/rsa_pss.o \
 | 
			
		||||
	../crypto/rsa/rsa_ssl.o \
 | 
			
		||||
	../crypto/rsa/rsa_x931.o \
 | 
			
		||||
	../crypto/sha/sha1dgst.o \
 | 
			
		||||
	../crypto/sha/sha256.o \
 | 
			
		||||
	../crypto/sha/sha512.o \
 | 
			
		||||
	../crypto/uid.o
 | 
			
		||||
 | 
			
		||||
sub_all: build_all
 | 
			
		||||
build_all: build_libs build_apps build_tests build_tools
 | 
			
		||||
 | 
			
		||||
build_libs: build_crypto build_ssl build_engines
 | 
			
		||||
build_libs: build_crypto build_fips build_ssl build_shared build_engines
 | 
			
		||||
 | 
			
		||||
build_crypto:
 | 
			
		||||
	@dir=crypto; target=all; $(BUILD_ONE_CMD)
 | 
			
		||||
	if [ -n "$(FIPSCANLIB)" ]; then \
 | 
			
		||||
		EXCL_OBJ='$(AES_ASM_OBJ) $(BN_ASM) $(DES_ENC) $(CPUID_OBJ) $(SHA1_ASM_OBJ) $(FIPS_EX_OBJ)' ; export EXCL_OBJ ; \
 | 
			
		||||
		ARX='$(PERL) $${TOP}/util/arx.pl $(AR)' ; \
 | 
			
		||||
	else \
 | 
			
		||||
		ARX='${AR}' ; \
 | 
			
		||||
	fi ; export ARX ; \
 | 
			
		||||
		dir=crypto; target=all; $(BUILD_ONE_CMD)
 | 
			
		||||
build_fips:
 | 
			
		||||
	@dir=fips; target=all; [ -z "$(FIPSCANLIB)" ] || $(BUILD_ONE_CMD)
 | 
			
		||||
build_ssl:
 | 
			
		||||
	@dir=ssl; target=all; $(BUILD_ONE_CMD)
 | 
			
		||||
build_engines:
 | 
			
		||||
@@ -254,9 +348,20 @@ all_testapps: build_libs build_testapps
 | 
			
		||||
build_testapps:
 | 
			
		||||
	@dir=crypto; target=testapps; $(BUILD_ONE_CMD)
 | 
			
		||||
 | 
			
		||||
libcrypto$(SHLIB_EXT): libcrypto.a
 | 
			
		||||
build_shared:	$(SHARED_LIBS)
 | 
			
		||||
libcrypto$(SHLIB_EXT): libcrypto.a $(SHARED_FIPS)
 | 
			
		||||
	@if [ "$(SHLIB_TARGET)" != "" ]; then \
 | 
			
		||||
		$(MAKE) SHLIBDIRS=crypto build-shared; \
 | 
			
		||||
		if [ "$(FIPSCANLIB)" = "libfips" ]; then \
 | 
			
		||||
			$(ARD) libcrypto.a fipscanister.o ; \
 | 
			
		||||
			$(MAKE) SHLIBDIRS='crypto' SHLIBDEPS='-lfips' build-shared; \
 | 
			
		||||
			$(AR) libcrypto.a fips/fipscanister.o ; \
 | 
			
		||||
		else \
 | 
			
		||||
			if [ "$(FIPSCANLIB)" = "libcrypto" ]; then \
 | 
			
		||||
				FIPSLD_CC=$(CC); CC=fips/fipsld; \
 | 
			
		||||
				export CC FIPSLD_CC; \
 | 
			
		||||
			fi; \
 | 
			
		||||
			$(MAKE) -e SHLIBDIRS='crypto' build-shared; \
 | 
			
		||||
		fi \
 | 
			
		||||
	else \
 | 
			
		||||
		echo "There's no support for shared libraries on this platform" >&2; \
 | 
			
		||||
		exit 1; \
 | 
			
		||||
@@ -264,12 +369,32 @@ libcrypto$(SHLIB_EXT): libcrypto.a
 | 
			
		||||
 | 
			
		||||
libssl$(SHLIB_EXT): libcrypto$(SHLIB_EXT) libssl.a
 | 
			
		||||
	@if [ "$(SHLIB_TARGET)" != "" ]; then \
 | 
			
		||||
		$(MAKE) SHLIBDIRS=ssl SHLIBDEPS='-lcrypto' build-shared; \
 | 
			
		||||
		shlibdeps=-lcrypto; \
 | 
			
		||||
		[ "$(FIPSCANLIB)" = "libfips" ] && shlibdeps="$$shlibdeps -lfips"; \
 | 
			
		||||
		$(MAKE) SHLIBDIRS=ssl SHLIBDEPS="$$shlibdeps" build-shared; \
 | 
			
		||||
	else \
 | 
			
		||||
		echo "There's no support for shared libraries on this platform" >&2 ; \
 | 
			
		||||
		exit 1; \
 | 
			
		||||
	fi
 | 
			
		||||
 | 
			
		||||
fips/fipscanister.o:	build_fips
 | 
			
		||||
libfips$(SHLIB_EXT):		fips/fipscanister.o
 | 
			
		||||
	@if [ "$(SHLIB_TARGET)" != "" ]; then \
 | 
			
		||||
		FIPSLD_CC=$(CC); CC=fips/fipsld; export CC FIPSLD_CC; \
 | 
			
		||||
		$(MAKE) -f Makefile.shared -e $(BUILDENV) \
 | 
			
		||||
			CC=$${CC} LIBNAME=fips THIS=$@ \
 | 
			
		||||
			LIBEXTRAS=fips/fipscanister.o \
 | 
			
		||||
			LIBDEPS="$(EX_LIBS)" \
 | 
			
		||||
			LIBVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR} \
 | 
			
		||||
			link_o.$(SHLIB_TARGET) || { rm -f $@; exit 1; } \
 | 
			
		||||
	else \
 | 
			
		||||
		echo "There's no support for shared libraries on this platform" >&2; \
 | 
			
		||||
		exit 1; \
 | 
			
		||||
	fi
 | 
			
		||||
 | 
			
		||||
libfips.a:
 | 
			
		||||
	dir=fips; target=all; $(BUILD_ONE_CMD)
 | 
			
		||||
 | 
			
		||||
clean-shared:
 | 
			
		||||
	@set -e; for i in $(SHLIBDIRS); do \
 | 
			
		||||
		if [ -n "$(SHARED_LIBS_LINK_EXTS)" ]; then \
 | 
			
		||||
@@ -285,10 +410,10 @@ clean-shared:
 | 
			
		||||
	done
 | 
			
		||||
 | 
			
		||||
link-shared:
 | 
			
		||||
	@ set -e; for i in $(SHLIBDIRS); do \
 | 
			
		||||
	@ set -e; for i in ${SHLIBDIRS}; do \
 | 
			
		||||
		$(MAKE) -f $(HERE)/Makefile.shared -e $(BUILDENV) \
 | 
			
		||||
			LIBNAME=$$i LIBVERSION=$(SHLIB_MAJOR).$(SHLIB_MINOR) \
 | 
			
		||||
			LIBCOMPATVERSIONS=";$(SHLIB_VERSION_HISTORY)" \
 | 
			
		||||
			LIBNAME=$$i LIBVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR} \
 | 
			
		||||
			LIBCOMPATVERSIONS=";${SHLIB_VERSION_HISTORY}" \
 | 
			
		||||
			symlink.$(SHLIB_TARGET); \
 | 
			
		||||
		libs="$$libs -l$$i"; \
 | 
			
		||||
	done
 | 
			
		||||
@@ -296,13 +421,13 @@ link-shared:
 | 
			
		||||
build-shared: do_$(SHLIB_TARGET) link-shared
 | 
			
		||||
 | 
			
		||||
do_$(SHLIB_TARGET):
 | 
			
		||||
	@ set -e; libs='-L. $(SHLIBDEPS)'; for i in $(SHLIBDIRS); do \
 | 
			
		||||
		if [ "$(SHLIBDIRS)" = "ssl" -a -n "$(LIBKRB5)" ]; then \
 | 
			
		||||
	@ set -e; libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
 | 
			
		||||
		if [ "${SHLIBDIRS}" = "ssl" -a -n "$(LIBKRB5)" ]; then \
 | 
			
		||||
			libs="$(LIBKRB5) $$libs"; \
 | 
			
		||||
		fi; \
 | 
			
		||||
		$(CLEARENV) && $(MAKE) -f Makefile.shared -e $(BUILDENV) \
 | 
			
		||||
			LIBNAME=$$i LIBVERSION=$(SHLIB_MAJOR).$(SHLIB_MINOR) \
 | 
			
		||||
			LIBCOMPATVERSIONS=";$(SHLIB_VERSION_HISTORY)" \
 | 
			
		||||
			LIBNAME=$$i LIBVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR} \
 | 
			
		||||
			LIBCOMPATVERSIONS=";${SHLIB_VERSION_HISTORY}" \
 | 
			
		||||
			LIBDEPS="$$libs $(EX_LIBS)" \
 | 
			
		||||
			link_a.$(SHLIB_TARGET); \
 | 
			
		||||
		libs="-l$$i $$libs"; \
 | 
			
		||||
@@ -379,31 +504,31 @@ links:
 | 
			
		||||
	@$(PERL) $(TOP)/util/mkdir-p.pl include/openssl
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl include/openssl $(EXHEADER)
 | 
			
		||||
	@set -e; target=links; $(RECURSIVE_BUILD_CMD)
 | 
			
		||||
	@if [ -z "$(FIPSCANLIB)" ]; then \
 | 
			
		||||
		set -e; target=links; dir=fips ; $(BUILD_CMD) ; \
 | 
			
		||||
	fi
 | 
			
		||||
 | 
			
		||||
gentests:
 | 
			
		||||
	@(cd test && echo "generating dummy tests (if needed)..." && \
 | 
			
		||||
	$(CLEARENV) && $(MAKE) -e $(BUILDENV) TESTS='$(TESTS)' OPENSSL_DEBUG_MEMORY=on generate );
 | 
			
		||||
	$(CLEARENV) && $(MAKE) -e $(BUILDENV) TESTS='${TESTS}' OPENSSL_DEBUG_MEMORY=on generate );
 | 
			
		||||
 | 
			
		||||
dclean:
 | 
			
		||||
	rm -rf *.bak include/openssl certs/.0
 | 
			
		||||
	rm -f *.bak
 | 
			
		||||
	@set -e; target=dclean; $(RECURSIVE_BUILD_CMD)
 | 
			
		||||
 | 
			
		||||
rehash: rehash.time
 | 
			
		||||
rehash.time: certs apps
 | 
			
		||||
	@if [ -z "$(CROSS_COMPILE_PREFIX)" ]; then \
 | 
			
		||||
		(OPENSSL="`pwd`/util/opensslwrap.sh"; \
 | 
			
		||||
		[ -x "apps/openssl.exe" ] && OPENSSL="apps/openssl.exe" || :; \
 | 
			
		||||
		OPENSSL_DEBUG_MEMORY=on; \
 | 
			
		||||
		export OPENSSL OPENSSL_DEBUG_MEMORY; \
 | 
			
		||||
		$(PERL) tools/c_rehash certs) && \
 | 
			
		||||
		touch rehash.time; \
 | 
			
		||||
	else :; fi
 | 
			
		||||
rehash.time: certs
 | 
			
		||||
	@(OPENSSL="`pwd`/util/opensslwrap.sh"; \
 | 
			
		||||
	  OPENSSL_DEBUG_MEMORY=on; \
 | 
			
		||||
	  export OPENSSL OPENSSL_DEBUG_MEMORY; \
 | 
			
		||||
	  $(PERL) tools/c_rehash certs)
 | 
			
		||||
	touch rehash.time
 | 
			
		||||
 | 
			
		||||
test:   tests
 | 
			
		||||
 | 
			
		||||
tests: rehash
 | 
			
		||||
	@(cd test && echo "testing..." && \
 | 
			
		||||
	$(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=.. TESTS='$(TESTS)' OPENSSL_DEBUG_MEMORY=on tests );
 | 
			
		||||
	$(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=.. TESTS='${TESTS}' OPENSSL_DEBUG_MEMORY=on tests );
 | 
			
		||||
	util/opensslwrap.sh version -a
 | 
			
		||||
 | 
			
		||||
report:
 | 
			
		||||
@@ -437,8 +562,6 @@ crypto/objects/obj_dat.h: crypto/objects/obj_dat.pl crypto/objects/obj_mac.h
 | 
			
		||||
	$(PERL) crypto/objects/obj_dat.pl crypto/objects/obj_mac.h crypto/objects/obj_dat.h
 | 
			
		||||
crypto/objects/obj_mac.h: crypto/objects/objects.pl crypto/objects/objects.txt crypto/objects/obj_mac.num
 | 
			
		||||
	$(PERL) crypto/objects/objects.pl crypto/objects/objects.txt crypto/objects/obj_mac.num crypto/objects/obj_mac.h
 | 
			
		||||
crypto/objects/obj_xref.h: crypto/objects/objxref.pl crypto/objects/obj_xref.txt crypto/objects/obj_mac.num
 | 
			
		||||
	$(PERL) crypto/objects/objxref.pl crypto/objects/obj_mac.num crypto/objects/obj_xref.txt >crypto/objects/obj_xref.h
 | 
			
		||||
 | 
			
		||||
apps/openssl-vms.cnf: apps/openssl.cnf
 | 
			
		||||
	$(PERL) VMS/VMSify-conf.pl < apps/openssl.cnf > apps/openssl-vms.cnf
 | 
			
		||||
@@ -451,7 +574,7 @@ TABLE: Configure
 | 
			
		||||
	(echo 'Output of `Configure TABLE'"':"; \
 | 
			
		||||
	$(PERL) Configure TABLE) > TABLE
 | 
			
		||||
 | 
			
		||||
update: errors stacks util/libeay.num util/ssleay.num crypto/objects/obj_dat.h crypto/objects/obj_xref.h apps/openssl-vms.cnf crypto/bn/bn_prime.h TABLE depend
 | 
			
		||||
update: errors stacks util/libeay.num util/ssleay.num crypto/objects/obj_dat.h apps/openssl-vms.cnf crypto/bn/bn_prime.h TABLE depend
 | 
			
		||||
 | 
			
		||||
# 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
 | 
			
		||||
@@ -482,8 +605,8 @@ tar-snap:
 | 
			
		||||
dist:   
 | 
			
		||||
	$(PERL) Configure dist
 | 
			
		||||
	@$(MAKE) dist_pem_h
 | 
			
		||||
	@$(MAKE) SDIRS='$(SDIRS)' clean
 | 
			
		||||
	@$(MAKE) TAR='$(TAR)' TARFLAGS='$(TARFLAGS)' tar
 | 
			
		||||
	@$(MAKE) SDIRS='${SDIRS}' clean
 | 
			
		||||
	@$(MAKE) TAR='${TAR}' TARFLAGS='${TARFLAGS}' tar
 | 
			
		||||
 | 
			
		||||
dist_pem_h:
 | 
			
		||||
	(cd crypto/pem; $(MAKE) -e $(BUILDENV) pem.h; $(MAKE) clean)
 | 
			
		||||
@@ -534,16 +657,6 @@ install_sw:
 | 
			
		||||
					chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
 | 
			
		||||
					mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i; \
 | 
			
		||||
				fi ); \
 | 
			
		||||
				if expr $(PLATFORM) : 'mingw' > /dev/null; then \
 | 
			
		||||
				(	case $$i in \
 | 
			
		||||
						*crypto*) i=libeay32.dll;; \
 | 
			
		||||
						*ssl*)    i=ssleay32.dll;; \
 | 
			
		||||
					esac; \
 | 
			
		||||
					echo installing $$i; \
 | 
			
		||||
	 				cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \
 | 
			
		||||
	 				chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \
 | 
			
		||||
	 				mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i ); \
 | 
			
		||||
				fi; \
 | 
			
		||||
			fi; \
 | 
			
		||||
		done; \
 | 
			
		||||
		(	here="`pwd`"; \
 | 
			
		||||
@@ -563,27 +676,6 @@ install_sw:
 | 
			
		||||
	cp openssl.pc $(INSTALL_PREFIX)$(INSTALLTOP)/lib/pkgconfig
 | 
			
		||||
	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/pkgconfig/openssl.pc
 | 
			
		||||
 | 
			
		||||
install_html_docs:
 | 
			
		||||
	here="`pwd`"; \
 | 
			
		||||
	for subdir in apps crypto ssl; do \
 | 
			
		||||
		mkdir -p $(INSTALL_PREFIX)$(HTMLDIR)/$$subdir; \
 | 
			
		||||
		for i in doc/$$subdir/*.pod; do \
 | 
			
		||||
			fn=`basename $$i .pod`; \
 | 
			
		||||
			echo "installing html/$$fn.$(HTMLSUFFIX)"; \
 | 
			
		||||
			cat $$i \
 | 
			
		||||
			| sed -r 's/L<([^)]*)(\([0-9]\))?\|([^)]*)(\([0-9]\))?>/L<\1|\3>/g' \
 | 
			
		||||
			| pod2html --podroot=doc --htmlroot=.. --podpath=apps:crypto:ssl \
 | 
			
		||||
			| sed -r 's/<!DOCTYPE.*//g' \
 | 
			
		||||
			> $(INSTALL_PREFIX)$(HTMLDIR)/$$subdir/$$fn.$(HTMLSUFFIX); \
 | 
			
		||||
			$(PERL) util/extract-names.pl < $$i | \
 | 
			
		||||
				grep -v $$filecase "^$$fn\$$" | \
 | 
			
		||||
				(cd $(INSTALL_PREFIX)$(HTMLDIR)/$$subdir; \
 | 
			
		||||
				 while read n; do \
 | 
			
		||||
					$$here/util/point.sh $$fn.$(HTMLSUFFIX) "$$n".$(HTMLSUFFIX); \
 | 
			
		||||
				 done); \
 | 
			
		||||
		done; \
 | 
			
		||||
	done
 | 
			
		||||
 | 
			
		||||
install_docs:
 | 
			
		||||
	@$(PERL) $(TOP)/util/mkdir-p.pl \
 | 
			
		||||
		$(INSTALL_PREFIX)$(MANDIR)/man1 \
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										118
									
								
								Makefile.shared
									
									
									
									
									
								
							
							
						
						
									
										118
									
								
								Makefile.shared
									
									
									
									
									
								
							@@ -14,8 +14,6 @@ CFLAGS=$(CFLAG)
 | 
			
		||||
LDFLAGS=
 | 
			
		||||
SHARED_LDFLAGS=
 | 
			
		||||
 | 
			
		||||
NM=nm
 | 
			
		||||
 | 
			
		||||
# LIBNAME contains just the name of the library, without prefix ("lib"
 | 
			
		||||
# on Unix, "cyg" for certain forms under Cygwin...) or suffix (.a, .so,
 | 
			
		||||
# .dll, ...).  This one MUST have a value when using this makefile to
 | 
			
		||||
@@ -93,7 +91,7 @@ LINK_APP=	\
 | 
			
		||||
  ( $(SET_X);   \
 | 
			
		||||
    LIBDEPS="$${LIBDEPS:-$(LIBDEPS)}"; \
 | 
			
		||||
    LDCMD="$${LDCMD:-$(CC)}"; LDFLAGS="$${LDFLAGS:-$(CFLAGS)}"; \
 | 
			
		||||
    LIBPATH=`for x in $$LIBDEPS; do echo $$x; done | sed -e 's/^ *-L//;t' -e d | uniq`; \
 | 
			
		||||
    LIBPATH=`for x in $$LIBDEPS; do if echo $$x | grep '^ *-L' > /dev/null 2>&1; then echo $$x | sed -e 's/^ *-L//'; fi; done | uniq`; \
 | 
			
		||||
    LIBPATH=`echo $$LIBPATH | sed -e 's/ /:/g'`; \
 | 
			
		||||
    LD_LIBRARY_PATH=$$LIBPATH:$$LD_LIBRARY_PATH \
 | 
			
		||||
    $${LDCMD} $${LDFLAGS} -o $${APPNAME:=$(APPNAME)} $(OBJECTS) $${LIBDEPS} )
 | 
			
		||||
@@ -103,7 +101,7 @@ LINK_SO=	\
 | 
			
		||||
    LIBDEPS="$${LIBDEPS:-$(LIBDEPS)}"; \
 | 
			
		||||
    SHAREDCMD="$${SHAREDCMD:-$(CC)}"; \
 | 
			
		||||
    SHAREDFLAGS="$${SHAREDFLAGS:-$(CFLAGS) $(SHARED_LDFLAGS)}"; \
 | 
			
		||||
    LIBPATH=`for x in $$LIBDEPS; do echo $$x; done | sed -e 's/^ *-L//;t' -e d | uniq`; \
 | 
			
		||||
    LIBPATH=`for x in $$LIBDEPS; do if echo $$x | grep '^ *-L' > /dev/null 2>&1; then echo $$x | sed -e 's/^ *-L//'; fi; done | uniq`; \
 | 
			
		||||
    LIBPATH=`echo $$LIBPATH | sed -e 's/ /:/g'`; \
 | 
			
		||||
    LD_LIBRARY_PATH=$$LIBPATH:$$LD_LIBRARY_PATH \
 | 
			
		||||
    $${SHAREDCMD} $${SHAREDFLAGS} \
 | 
			
		||||
@@ -144,7 +142,7 @@ LINK_SO_A_UNPACKED=	\
 | 
			
		||||
  SHOBJECTS=$$UNPACKDIR/*.o; \
 | 
			
		||||
  $(LINK_SO) && rm -rf $$UNPACKDIR
 | 
			
		||||
 | 
			
		||||
DETECT_GNU_LD=($(CC) -Wl,-V /dev/null 2>&1 | grep '^GNU ld' )>/dev/null
 | 
			
		||||
DETECT_GNU_LD=(${CC} -Wl,-V /dev/null 2>&1 | grep '^GNU ld' )>/dev/null
 | 
			
		||||
 | 
			
		||||
DO_GNU_SO=$(CALC_VERSIONS); \
 | 
			
		||||
	SHLIB=lib$(LIBNAME).so; \
 | 
			
		||||
@@ -170,19 +168,8 @@ link_a.gnu:
 | 
			
		||||
link_app.gnu:
 | 
			
		||||
	@ $(DO_GNU_APP); $(LINK_APP)
 | 
			
		||||
 | 
			
		||||
DO_BEOS_SO=	SHLIB=lib$(LIBNAME).so; \
 | 
			
		||||
	SHLIB_SUFFIX=; \
 | 
			
		||||
	ALLSYMSFLAGS='-Wl,--whole-archive'; \
 | 
			
		||||
	NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
 | 
			
		||||
	SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-Bsymbolic -Wl,-soname=$$SHLIB$$SHLIB_SUFFIX"
 | 
			
		||||
 | 
			
		||||
link_o.beos:
 | 
			
		||||
	@ $(DO_BEOS_SO); $(LINK_SO_O)
 | 
			
		||||
link_a.beos:
 | 
			
		||||
	@ $(DO_BEOS_SO); $(LINK_SO_A)
 | 
			
		||||
 | 
			
		||||
link_o.bsd:
 | 
			
		||||
	@if $(DETECT_GNU_LD); then $(DO_GNU_SO); else \
 | 
			
		||||
	@if ${DETECT_GNU_LD}; then $(DO_GNU_SO); else \
 | 
			
		||||
	$(CALC_VERSIONS); \
 | 
			
		||||
	SHLIB=lib$(LIBNAME).so; \
 | 
			
		||||
	SHLIB_SUFFIX=; \
 | 
			
		||||
@@ -192,7 +179,7 @@ link_o.bsd:
 | 
			
		||||
	SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -nostdlib"; \
 | 
			
		||||
	fi; $(LINK_SO_O)
 | 
			
		||||
link_a.bsd:
 | 
			
		||||
	@if $(DETECT_GNU_LD); then $(DO_GNU_SO); else \
 | 
			
		||||
	@if ${DETECT_GNU_LD}; then $(DO_GNU_SO); else \
 | 
			
		||||
	$(CALC_VERSIONS); \
 | 
			
		||||
	SHLIB=lib$(LIBNAME).so; \
 | 
			
		||||
	SHLIB_SUFFIX=; \
 | 
			
		||||
@@ -202,7 +189,7 @@ link_a.bsd:
 | 
			
		||||
	SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -nostdlib"; \
 | 
			
		||||
	fi; $(LINK_SO_A)
 | 
			
		||||
link_app.bsd:
 | 
			
		||||
	@if $(DETECT_GNU_LD); then $(DO_GNU_APP); else \
 | 
			
		||||
	@if ${DETECT_GNU_LD}; then $(DO_GNU_APP); else \
 | 
			
		||||
	LDFLAGS="$(CFLAGS) -Wl,-rpath,$(LIBPATH)"; \
 | 
			
		||||
	fi; $(LINK_APP)
 | 
			
		||||
 | 
			
		||||
@@ -213,8 +200,10 @@ link_app.bsd:
 | 
			
		||||
# to use native NSModule(3) API and refers to dlfcn as termporary hack.
 | 
			
		||||
link_o.darwin:
 | 
			
		||||
	@ $(CALC_VERSIONS); \
 | 
			
		||||
	SHLIB=lib$(LIBNAME); \
 | 
			
		||||
	SHLIB_SUFFIX=.so; \
 | 
			
		||||
	SHLIB=`expr "$$THIS" : '.*/\([^/\.]*\)\.'`; \
 | 
			
		||||
	SHLIB=$${SHLIB:-lib$(LIBNAME)}; \
 | 
			
		||||
	SHLIB_SUFFIX=`expr "$$THIS" : '.*\(\.[^\.]*\)$$'`; \
 | 
			
		||||
	SHLIB_SUFFIX=$${SHLIB_SUFFIX:-.so}; \
 | 
			
		||||
	ALLSYMSFLAGS='-all_load'; \
 | 
			
		||||
	NOALLSYMSFLAGS=''; \
 | 
			
		||||
	SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS)"; \
 | 
			
		||||
@@ -238,7 +227,7 @@ link_a.darwin:
 | 
			
		||||
	if [ -n "$$SHLIB_SOVER_NODOT" ]; then \
 | 
			
		||||
		SHAREDFLAGS="$$SHAREDFLAGS -compatibility_version $$SHLIB_SOVER_NODOT"; \
 | 
			
		||||
	fi; \
 | 
			
		||||
	SHAREDFLAGS="$$SHAREDFLAGS -install_name $(INSTALLTOP)/lib/$$SHLIB$(SHLIB_EXT)"; \
 | 
			
		||||
	SHAREDFLAGS="$$SHAREDFLAGS -install_name ${INSTALLTOP}/lib/$$SHLIB${SHLIB_EXT}"; \
 | 
			
		||||
	$(LINK_SO_A)
 | 
			
		||||
link_app.darwin:	# is there run-path on darwin?
 | 
			
		||||
	$(LINK_APP)
 | 
			
		||||
@@ -248,59 +237,40 @@ link_o.cygwin:
 | 
			
		||||
	INHIBIT_SYMLINKS=yes; \
 | 
			
		||||
	SHLIB=cyg$(LIBNAME); \
 | 
			
		||||
	base=-Wl,--enable-auto-image-base; \
 | 
			
		||||
	deffile=; \
 | 
			
		||||
	if expr $(PLATFORM) : 'mingw' > /dev/null; then \
 | 
			
		||||
		SHLIB=$(LIBNAME)eay32; base=; \
 | 
			
		||||
		if test -f $(LIBNAME)eay32.def; then \
 | 
			
		||||
			deffile=$(LIBNAME)eay32.def; \
 | 
			
		||||
		fi; \
 | 
			
		||||
	fi; \
 | 
			
		||||
	SHLIB_SUFFIX=.dll; \
 | 
			
		||||
	LIBVERSION="$(LIBVERSION)"; \
 | 
			
		||||
	SHLIB_SOVER=${LIBVERSION:+"-$(LIBVERSION)"}; \
 | 
			
		||||
	ALLSYMSFLAGS='-Wl,--whole-archive'; \
 | 
			
		||||
	NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
 | 
			
		||||
	SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared $$base $$deffile -Wl,-s,-Bsymbolic"; \
 | 
			
		||||
	SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared $$base -Wl,-Bsymbolic -Wl,--out-implib,lib$(LIBNAME).dll.a"; \
 | 
			
		||||
	$(LINK_SO_O)
 | 
			
		||||
#for mingw target if def-file is in use dll-name should match library-name
 | 
			
		||||
link_a.cygwin:
 | 
			
		||||
	@ $(CALC_VERSIONS); \
 | 
			
		||||
	INHIBIT_SYMLINKS=yes; \
 | 
			
		||||
	SHLIB=cyg$(LIBNAME); SHLIB_SOVER=-$(LIBVERSION); SHLIB_SUFFIX=.dll; \
 | 
			
		||||
	dll_name=$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX; extras=; \
 | 
			
		||||
	SHLIB=cyg$(LIBNAME); \
 | 
			
		||||
	base=-Wl,--enable-auto-image-base; \
 | 
			
		||||
	if expr $(PLATFORM) : 'mingw' > /dev/null; then \
 | 
			
		||||
		case $(LIBNAME) in \
 | 
			
		||||
			crypto) SHLIB=libeay;; \
 | 
			
		||||
			ssl) SHLIB=ssleay;; \
 | 
			
		||||
		esac; \
 | 
			
		||||
		SHLIB_SOVER=32; \
 | 
			
		||||
		extras="$(LIBNAME).def"; \
 | 
			
		||||
		$(PERL) util/mkdef.pl 32 $$SHLIB > $$extras; \
 | 
			
		||||
		base=; [ $(LIBNAME) = "crypto" ] && base=-Wl,--image-base,0x63000000; \
 | 
			
		||||
		SHLIB=$(LIBNAME)eay32; \
 | 
			
		||||
		base=;  [ $(LIBNAME) = "crypto" ] && base=-Wl,--image-base,0x63000000; \
 | 
			
		||||
	fi; \
 | 
			
		||||
	dll_name=$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX; \
 | 
			
		||||
	$(PERL) util/mkrc.pl $$dll_name | \
 | 
			
		||||
		$(CROSS_COMPILE_PREFIX)windres -o rc.o; \
 | 
			
		||||
	extras="$$extras rc.o"; \
 | 
			
		||||
	SHLIB_SUFFIX=.dll; \
 | 
			
		||||
	SHLIB_SOVER=-$(LIBVERSION); \
 | 
			
		||||
	ALLSYMSFLAGS='-Wl,--whole-archive'; \
 | 
			
		||||
	NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
 | 
			
		||||
	SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared $$base -Wl,-s,-Bsymbolic -Wl,--out-implib,lib$(LIBNAME).dll.a $$extras"; \
 | 
			
		||||
	[ -f apps/$$dll_name ] && rm apps/$$dll_name; \
 | 
			
		||||
	[ -f test/$$dll_name ] && rm test/$$dll_name; \
 | 
			
		||||
	SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared $$base -Wl,-Bsymbolic -Wl,--out-implib,lib$(LIBNAME).dll.a"; \
 | 
			
		||||
	[ -f apps/$$SHLIB$$SHLIB_SUFFIX ] && rm apps/$$SHLIB$$SHLIB_SUFFIX; \
 | 
			
		||||
	[ -f test/$$SHLIB$$SHLIB_SUFFIX ] && rm test/$$SHLIB$$SHLIB_SUFFIX; \
 | 
			
		||||
	$(LINK_SO_A) || exit 1; \
 | 
			
		||||
	rm $$extras; \
 | 
			
		||||
	cp -p $$dll_name apps/; \
 | 
			
		||||
	cp -p $$dll_name test/
 | 
			
		||||
	cp -p $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX apps/; \
 | 
			
		||||
	cp -p $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX test/
 | 
			
		||||
link_app.cygwin:
 | 
			
		||||
	@if expr "$(CFLAGS)" : '.*OPENSSL_USE_APPLINK' > /dev/null; then \
 | 
			
		||||
		LIBDEPS="$(TOP)/crypto/applink.o $${LIBDEPS:-$(LIBDEPS)}"; \
 | 
			
		||||
		export LIBDEPS; \
 | 
			
		||||
	fi; \
 | 
			
		||||
	$(LINK_APP)
 | 
			
		||||
 | 
			
		||||
link_o.alpha-osf1:
 | 
			
		||||
	@ if $(DETECT_GNU_LD); then \
 | 
			
		||||
	@ if ${DETECT_GNU_LD}; then \
 | 
			
		||||
		$(DO_GNU_SO); \
 | 
			
		||||
	else \
 | 
			
		||||
		SHLIB=lib$(LIBNAME).so; \
 | 
			
		||||
@@ -321,7 +291,7 @@ link_o.alpha-osf1:
 | 
			
		||||
	fi; \
 | 
			
		||||
	$(LINK_SO_O)
 | 
			
		||||
link_a.alpha-osf1:
 | 
			
		||||
	@ if $(DETECT_GNU_LD); then \
 | 
			
		||||
	@ if ${DETECT_GNU_LD}; then \
 | 
			
		||||
		$(DO_GNU_SO); \
 | 
			
		||||
	else \
 | 
			
		||||
		SHLIB=lib$(LIBNAME).so; \
 | 
			
		||||
@@ -342,7 +312,7 @@ link_a.alpha-osf1:
 | 
			
		||||
	fi; \
 | 
			
		||||
	$(LINK_SO_A)
 | 
			
		||||
link_app.alpha-osf1:
 | 
			
		||||
	@if $(DETECT_GNU_LD); then \
 | 
			
		||||
	@if ${DETECT_GNU_LD}; then \
 | 
			
		||||
		$(DO_GNU_APP); \
 | 
			
		||||
	else \
 | 
			
		||||
		LDFLAGS="$(CFLAGS) -rpath $(LIBRPATH)"; \
 | 
			
		||||
@@ -350,7 +320,7 @@ link_app.alpha-osf1:
 | 
			
		||||
	$(LINK_APP)
 | 
			
		||||
 | 
			
		||||
link_o.solaris:
 | 
			
		||||
	@ if $(DETECT_GNU_LD); then \
 | 
			
		||||
	@ if ${DETECT_GNU_LD}; then \
 | 
			
		||||
		$(DO_GNU_SO); \
 | 
			
		||||
	else \
 | 
			
		||||
		$(CALC_VERSIONS); \
 | 
			
		||||
@@ -364,12 +334,12 @@ link_o.solaris:
 | 
			
		||||
	fi; \
 | 
			
		||||
	$(LINK_SO_O)
 | 
			
		||||
link_a.solaris:
 | 
			
		||||
	@ if $(DETECT_GNU_LD); then \
 | 
			
		||||
	@ if ${DETECT_GNU_LD}; then \
 | 
			
		||||
		$(DO_GNU_SO); \
 | 
			
		||||
	else \
 | 
			
		||||
		$(CALC_VERSIONS); \
 | 
			
		||||
		MINUSZ='-z '; \
 | 
			
		||||
		($(CC) -v 2>&1 | grep gcc) > /dev/null && MINUSZ='-Wl,-z,'; \
 | 
			
		||||
		(${CC} -v 2>&1 | grep gcc) > /dev/null && MINUSZ='-Wl,-z,'; \
 | 
			
		||||
		SHLIB=lib$(LIBNAME).so; \
 | 
			
		||||
		SHLIB_SUFFIX=;\
 | 
			
		||||
		ALLSYMSFLAGS="$${MINUSZ}allextract"; \
 | 
			
		||||
@@ -378,7 +348,7 @@ link_a.solaris:
 | 
			
		||||
	fi; \
 | 
			
		||||
	$(LINK_SO_A)
 | 
			
		||||
link_app.solaris:
 | 
			
		||||
	@ if $(DETECT_GNU_LD); then \
 | 
			
		||||
	@ if ${DETECT_GNU_LD}; then \
 | 
			
		||||
		$(DO_GNU_APP); \
 | 
			
		||||
	else \
 | 
			
		||||
		LDFLAGS="$(CFLAGS) -R $(LIBRPATH)"; \
 | 
			
		||||
@@ -387,7 +357,7 @@ link_app.solaris:
 | 
			
		||||
 | 
			
		||||
# OpenServer 5 native compilers used
 | 
			
		||||
link_o.svr3:
 | 
			
		||||
	@ if $(DETECT_GNU_LD); then \
 | 
			
		||||
	@ if ${DETECT_GNU_LD}; then \
 | 
			
		||||
		$(DO_GNU_SO); \
 | 
			
		||||
	else \
 | 
			
		||||
		$(CALC_VERSIONS); \
 | 
			
		||||
@@ -399,7 +369,7 @@ link_o.svr3:
 | 
			
		||||
	fi; \
 | 
			
		||||
	$(LINK_SO_O)
 | 
			
		||||
link_a.svr3:
 | 
			
		||||
	@ if $(DETECT_GNU_LD); then \
 | 
			
		||||
	@ if ${DETECT_GNU_LD}; then \
 | 
			
		||||
		$(DO_GNU_SO); \
 | 
			
		||||
	else \
 | 
			
		||||
		$(CALC_VERSIONS); \
 | 
			
		||||
@@ -411,12 +381,12 @@ link_a.svr3:
 | 
			
		||||
	fi; \
 | 
			
		||||
	$(LINK_SO_A_UNPACKED)
 | 
			
		||||
link_app.svr3:
 | 
			
		||||
	@$(DETECT_GNU_LD) && $(DO_GNU_APP); \
 | 
			
		||||
	@${DETECT_GNU_LD} && $(DO_GNU_APP); \
 | 
			
		||||
	$(LINK_APP)
 | 
			
		||||
 | 
			
		||||
# UnixWare 7 and OpenUNIX 8 native compilers used
 | 
			
		||||
link_o.svr5:
 | 
			
		||||
	@ if $(DETECT_GNU_LD); then \
 | 
			
		||||
	@ if ${DETECT_GNU_LD}; then \
 | 
			
		||||
		$(DO_GNU_SO); \
 | 
			
		||||
	else \
 | 
			
		||||
		$(CALC_VERSIONS); \
 | 
			
		||||
@@ -430,12 +400,12 @@ link_o.svr5:
 | 
			
		||||
	fi; \
 | 
			
		||||
	$(LINK_SO_O)
 | 
			
		||||
link_a.svr5:
 | 
			
		||||
	@ if $(DETECT_GNU_LD); then \
 | 
			
		||||
	@ if ${DETECT_GNU_LD}; then \
 | 
			
		||||
		$(DO_GNU_SO); \
 | 
			
		||||
	else \
 | 
			
		||||
		$(CALC_VERSIONS); \
 | 
			
		||||
		SHARE_FLAG='-G'; \
 | 
			
		||||
		($(CC) -v 2>&1 | grep gcc) > /dev/null && SHARE_FLAG='-shared'; \
 | 
			
		||||
		(${CC} -v 2>&1 | grep gcc) > /dev/null && SHARE_FLAG='-shared'; \
 | 
			
		||||
		SHLIB=lib$(LIBNAME).so; \
 | 
			
		||||
		SHLIB_SUFFIX=; \
 | 
			
		||||
		ALLSYMSFLAGS=''; \
 | 
			
		||||
@@ -444,11 +414,11 @@ link_a.svr5:
 | 
			
		||||
	fi; \
 | 
			
		||||
	$(LINK_SO_A_UNPACKED)
 | 
			
		||||
link_app.svr5:
 | 
			
		||||
	@$(DETECT_GNU_LD) && $(DO_GNU_APP); \
 | 
			
		||||
	@${DETECT_GNU_LD} && $(DO_GNU_APP); \
 | 
			
		||||
	$(LINK_APP)
 | 
			
		||||
 | 
			
		||||
link_o.irix:
 | 
			
		||||
	@ if $(DETECT_GNU_LD); then \
 | 
			
		||||
	@ if ${DETECT_GNU_LD}; then \
 | 
			
		||||
		$(DO_GNU_SO); \
 | 
			
		||||
	else \
 | 
			
		||||
		$(CALC_VERSIONS); \
 | 
			
		||||
@@ -462,7 +432,7 @@ link_o.irix:
 | 
			
		||||
	fi; \
 | 
			
		||||
	$(LINK_SO_O)
 | 
			
		||||
link_a.irix:
 | 
			
		||||
	@ if $(DETECT_GNU_LD); then \
 | 
			
		||||
	@ if ${DETECT_GNU_LD}; then \
 | 
			
		||||
		$(DO_GNU_SO); \
 | 
			
		||||
	else \
 | 
			
		||||
		$(CALC_VERSIONS); \
 | 
			
		||||
@@ -488,7 +458,7 @@ link_app.irix:
 | 
			
		||||
# ELFs by the way].
 | 
			
		||||
#
 | 
			
		||||
link_o.hpux:
 | 
			
		||||
	@if $(DETECT_GNU_LD); then $(DO_GNU_SO); else \
 | 
			
		||||
	@if ${DETECT_GNU_LD}; then $(DO_GNU_SO); else \
 | 
			
		||||
	$(CALC_VERSIONS); \
 | 
			
		||||
	SHLIB=lib$(LIBNAME).sl; \
 | 
			
		||||
	expr "$(CFLAGS)" : '.*DSO_DLFCN' > /dev/null && SHLIB=lib$(LIBNAME).so; \
 | 
			
		||||
@@ -501,7 +471,7 @@ link_o.hpux:
 | 
			
		||||
	rm -f $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX || :; \
 | 
			
		||||
	$(LINK_SO_O) && chmod a=rx $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX
 | 
			
		||||
link_a.hpux:
 | 
			
		||||
	@if $(DETECT_GNU_LD); then $(DO_GNU_SO); else \
 | 
			
		||||
	@if ${DETECT_GNU_LD}; then $(DO_GNU_SO); else \
 | 
			
		||||
	$(CALC_VERSIONS); \
 | 
			
		||||
	SHLIB=lib$(LIBNAME).sl; \
 | 
			
		||||
	expr $(PLATFORM) : '.*ia64' > /dev/null && SHLIB=lib$(LIBNAME).so; \
 | 
			
		||||
@@ -514,7 +484,7 @@ link_a.hpux:
 | 
			
		||||
	rm -f $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX || :; \
 | 
			
		||||
	$(LINK_SO_A) && chmod a=rx $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX
 | 
			
		||||
link_app.hpux:
 | 
			
		||||
	@if $(DETECT_GNU_LD); then $(DO_GNU_APP); else \
 | 
			
		||||
	@if ${DETECT_GNU_LD}; then $(DO_GNU_APP); else \
 | 
			
		||||
	LDFLAGS="$(CFLAGS) -Wl,+s,+cdp,../:,+cdp,./:,+b,$(LIBRPATH)"; \
 | 
			
		||||
	fi; \
 | 
			
		||||
	$(LINK_APP)
 | 
			
		||||
@@ -579,7 +549,7 @@ symlink.hpux:
 | 
			
		||||
	expr $(PLATFORM) : '.*ia64' > /dev/null && SHLIB=lib$(LIBNAME).so; \
 | 
			
		||||
	$(SYMLINK_SO)
 | 
			
		||||
# The following lines means those specific architectures do no symlinks
 | 
			
		||||
symlink.cygwin symlink.alpha-osf1 symlink.tru64 symlink.tru64-rpath symlink.beos:
 | 
			
		||||
symlink.cygwin symlink.alpha-osf1 symlink.tru64 symlink.tru64-rpath:
 | 
			
		||||
 | 
			
		||||
# Compatibility targets
 | 
			
		||||
link_o.bsd-gcc-shared link_o.linux-shared link_o.gnu-shared: link_o.gnu
 | 
			
		||||
@@ -637,7 +607,3 @@ link_o.reliantunix-shared: link_o.reliantunix
 | 
			
		||||
link_a.reliantunix-shared: link_a.reliantunix
 | 
			
		||||
link_app.reliantunix-shared: link_app.reliantunix
 | 
			
		||||
symlink.reliantunix-shared: symlink.reliantunix
 | 
			
		||||
link_o.beos-shared: link_o.beos
 | 
			
		||||
link_a.beos-shared: link_a.beos
 | 
			
		||||
link_app.beos-shared: link_app.gnu
 | 
			
		||||
symlink.beos-shared: symlink.beos
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										23
									
								
								NEWS
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								NEWS
									
									
									
									
									
								
							@@ -5,8 +5,26 @@
 | 
			
		||||
  This file gives a brief overview of the major changes between each OpenSSL
 | 
			
		||||
  release. For more details please read the CHANGES file.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.8j and OpenSSL 0.9.8k:
 | 
			
		||||
 | 
			
		||||
      o Fix various build issues.
 | 
			
		||||
      o Fix security issues (CVE-2009-0590, CVE-2009-0591, CVE-2009-0789)
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.8i and OpenSSL 0.9.8j:
 | 
			
		||||
 | 
			
		||||
      o Fix security issue (CVE-2008-5077)
 | 
			
		||||
      o Merge FIPS 140-2 branch code.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.8g and OpenSSL 0.9.8h:
 | 
			
		||||
 | 
			
		||||
      o CryptoAPI ENGINE support.
 | 
			
		||||
      o Various precautionary measures.
 | 
			
		||||
      o Fix for bugs affecting certificate request creation.
 | 
			
		||||
      o Support for local machine keyset attribute in PKCS#12 files.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.8f and OpenSSL 0.9.8g:
 | 
			
		||||
 | 
			
		||||
      o Backport of CMS functionality to 0.9.8.
 | 
			
		||||
      o Fixes for bugs introduced with 0.9.8f.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.8e and OpenSSL 0.9.8f:
 | 
			
		||||
@@ -125,11 +143,6 @@
 | 
			
		||||
      o Added initial support for Win64.
 | 
			
		||||
      o Added alternate pkg-config files.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.7l and OpenSSL 0.9.7m:
 | 
			
		||||
 | 
			
		||||
      o FIPS 1.1.1 module linking.
 | 
			
		||||
      o Various ciphersuite selection fixes.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.7k and OpenSSL 0.9.7l:
 | 
			
		||||
 | 
			
		||||
      o Introduce limits to prevent malicious key DoS  (CVE-2006-2940)
 | 
			
		||||
 
 | 
			
		||||
@@ -159,8 +159,6 @@ cd ..\..\..
 | 
			
		||||
echo SHA1
 | 
			
		||||
cd crypto\sha\asm
 | 
			
		||||
perl sha1-586.pl %ASM_MODE% > s1-nw.asm
 | 
			
		||||
perl sha256-586.pl %ASM_MODE% > sha256-nw.asm
 | 
			
		||||
perl sha512-586.pl %ASM_MODE% > sha512-nw.asm
 | 
			
		||||
cd ..\..\..
 | 
			
		||||
 | 
			
		||||
echo RIPEMD160
 | 
			
		||||
@@ -173,11 +171,6 @@ cd crypto\rc5\asm
 | 
			
		||||
perl rc5-586.pl %ASM_MODE% > r5-nw.asm
 | 
			
		||||
cd ..\..\..
 | 
			
		||||
 | 
			
		||||
echo WHIRLPOOL
 | 
			
		||||
cd crypto\whrlpool\asm
 | 
			
		||||
perl wp-mmx.pl %ASM_MODE% > wp-nw.asm
 | 
			
		||||
cd ..\..\..
 | 
			
		||||
 | 
			
		||||
echo CPUID
 | 
			
		||||
cd crypto
 | 
			
		||||
perl x86cpuid.pl %ASM_MODE% > x86cpuid-nw.asm
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								README
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								README
									
									
									
									
									
								
							@@ -1,5 +1,5 @@
 | 
			
		||||
 | 
			
		||||
 OpenSSL 0.9.9-dev XX xxx XXXX
 | 
			
		||||
 OpenSSL 0.9.8k
 | 
			
		||||
 | 
			
		||||
 Copyright (c) 1998-2008 The OpenSSL Project
 | 
			
		||||
 Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										5
									
								
								STATUS
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								STATUS
									
									
									
									
									
								
							@@ -1,10 +1,13 @@
 | 
			
		||||
 | 
			
		||||
  OpenSSL STATUS                           Last modified at
 | 
			
		||||
  ______________                           $Date: 2008/05/28 22:30:28 $
 | 
			
		||||
  ______________                           $Date: 2009/03/25 10:46:55 $
 | 
			
		||||
 | 
			
		||||
  DEVELOPMENT STATE
 | 
			
		||||
 | 
			
		||||
    o  OpenSSL 0.9.9:  Under development...
 | 
			
		||||
    o  OpenSSL 0.9.8k: Released on March     25th, 2009
 | 
			
		||||
    o  OpenSSL 0.9.8j: Released on January    7th, 2009
 | 
			
		||||
    o  OpenSSL 0.9.8i: Released on September 15th, 2008
 | 
			
		||||
    o  OpenSSL 0.9.8h: Released on May       28th, 2008
 | 
			
		||||
    o  OpenSSL 0.9.8g: Released on October   19th, 2007
 | 
			
		||||
    o  OpenSSL 0.9.8f: Released on October   11th, 2007
 | 
			
		||||
 
 | 
			
		||||
@@ -5,4 +5,3 @@ der_chop.bak
 | 
			
		||||
CA.pl
 | 
			
		||||
*.flc
 | 
			
		||||
semantic.cache
 | 
			
		||||
*.dll
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										1055
									
								
								apps/Makefile
									
									
									
									
									
								
							
							
						
						
									
										1055
									
								
								apps/Makefile
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										705
									
								
								apps/apps.c
									
									
									
									
									
								
							
							
						
						
									
										705
									
								
								apps/apps.c
									
									
									
									
									
								
							@@ -109,19 +109,12 @@
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#define _POSIX_C_SOURCE 2	/* On VMS, you need to define this to get
 | 
			
		||||
				   the declaration of fileno().  The value
 | 
			
		||||
				   2 is to make sure no function defined
 | 
			
		||||
				   in POSIX-2 is left undefined. */
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#ifndef OPENSSL_SYSNAME_WIN32
 | 
			
		||||
#include <strings.h>
 | 
			
		||||
#endif
 | 
			
		||||
#include <sys/types.h>
 | 
			
		||||
#include <sys/stat.h>
 | 
			
		||||
#include <ctype.h>
 | 
			
		||||
#include <errno.h>
 | 
			
		||||
#include <assert.h>
 | 
			
		||||
#include <openssl/err.h>
 | 
			
		||||
#include <openssl/x509.h>
 | 
			
		||||
@@ -145,11 +138,6 @@
 | 
			
		||||
#include "apps.h"
 | 
			
		||||
#undef NON_MAIN
 | 
			
		||||
 | 
			
		||||
#ifdef _WIN32
 | 
			
		||||
static int WIN32_rename(const char *from, const char *to);
 | 
			
		||||
#define rename(from,to) WIN32_rename((from),(to))
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
typedef struct {
 | 
			
		||||
	const char *name;
 | 
			
		||||
	unsigned long flag;
 | 
			
		||||
@@ -178,23 +166,18 @@ int args_from_file(char *file, int *argc, char **argv[])
 | 
			
		||||
	static char *buf=NULL;
 | 
			
		||||
	static char **arg=NULL;
 | 
			
		||||
	char *p;
 | 
			
		||||
	struct stat stbuf;
 | 
			
		||||
 | 
			
		||||
	if (stat(file,&stbuf) < 0) return(0);
 | 
			
		||||
 | 
			
		||||
	fp=fopen(file,"r");
 | 
			
		||||
	if (fp == NULL)
 | 
			
		||||
		return(0);
 | 
			
		||||
 | 
			
		||||
	if (fseek(fp,0,SEEK_END)==0)
 | 
			
		||||
		len=ftell(fp), rewind(fp);
 | 
			
		||||
	else	len=-1;
 | 
			
		||||
	if (len<=0)
 | 
			
		||||
		{
 | 
			
		||||
		fclose(fp);
 | 
			
		||||
		return(0);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	*argc=0;
 | 
			
		||||
	*argv=NULL;
 | 
			
		||||
 | 
			
		||||
	len=(unsigned int)stbuf.st_size;
 | 
			
		||||
	if (buf != NULL) OPENSSL_free(buf);
 | 
			
		||||
	buf=(char *)OPENSSL_malloc(len+1);
 | 
			
		||||
	if (buf == NULL) return(0);
 | 
			
		||||
@@ -260,18 +243,11 @@ int str2fmt(char *s)
 | 
			
		||||
	else if ((*s == 'T') || (*s == 't'))
 | 
			
		||||
		return(FORMAT_TEXT);
 | 
			
		||||
	else if ((*s == 'P') || (*s == 'p'))
 | 
			
		||||
 		{
 | 
			
		||||
 		if (s[1] == 'V' || s[1] == 'v')
 | 
			
		||||
 			return FORMAT_PVK;
 | 
			
		||||
 		else
 | 
			
		||||
  			return(FORMAT_PEM);
 | 
			
		||||
 		}
 | 
			
		||||
  	else if ((*s == 'N') || (*s == 'n'))
 | 
			
		||||
  		return(FORMAT_NETSCAPE);
 | 
			
		||||
  	else if ((*s == 'S') || (*s == 's'))
 | 
			
		||||
  		return(FORMAT_SMIME);
 | 
			
		||||
 	else if ((*s == 'M') || (*s == 'm'))
 | 
			
		||||
 		return(FORMAT_MSBLOB);
 | 
			
		||||
		return(FORMAT_PEM);
 | 
			
		||||
	else if ((*s == 'N') || (*s == 'n'))
 | 
			
		||||
		return(FORMAT_NETSCAPE);
 | 
			
		||||
	else if ((*s == 'S') || (*s == 's'))
 | 
			
		||||
		return(FORMAT_SMIME);
 | 
			
		||||
	else if ((*s == '1')
 | 
			
		||||
		|| (strcmp(s,"PKCS12") == 0) || (strcmp(s,"pkcs12") == 0)
 | 
			
		||||
		|| (strcmp(s,"P12") == 0) || (strcmp(s,"p12") == 0))
 | 
			
		||||
@@ -663,15 +639,6 @@ static char *app_get_pass(BIO *err, char *arg, int keepbio)
 | 
			
		||||
				BIO_printf(err, "Can't open file %s\n", arg + 5);
 | 
			
		||||
				return NULL;
 | 
			
		||||
			}
 | 
			
		||||
#if !defined(_WIN32)
 | 
			
		||||
		/*
 | 
			
		||||
		 * Under _WIN32, which covers even Win64 and CE, file
 | 
			
		||||
		 * descriptors referenced by BIO_s_fd are not inherited
 | 
			
		||||
		 * by child process and therefore below is not an option.
 | 
			
		||||
		 * It could have been an option if bss_fd.c was operating
 | 
			
		||||
		 * on real Windows descriptors, such as those obtained
 | 
			
		||||
		 * with CreateFile.
 | 
			
		||||
		 */
 | 
			
		||||
		} else if(!strncmp(arg, "fd:", 3)) {
 | 
			
		||||
			BIO *btmp;
 | 
			
		||||
			i = atoi(arg + 3);
 | 
			
		||||
@@ -683,7 +650,6 @@ static char *app_get_pass(BIO *err, char *arg, int keepbio)
 | 
			
		||||
			/* Can't do BIO_gets on an fd BIO so add a buffering BIO */
 | 
			
		||||
			btmp = BIO_new(BIO_f_buffer());
 | 
			
		||||
			pwdbio = BIO_push(btmp, pwdbio);
 | 
			
		||||
#endif
 | 
			
		||||
		} else if(!strcmp(arg, "stdin")) {
 | 
			
		||||
			pwdbio = BIO_new_fp(stdin, BIO_NOCLOSE);
 | 
			
		||||
			if(!pwdbio) {
 | 
			
		||||
@@ -783,6 +749,8 @@ static int load_pkcs12(BIO *err, BIO *in, const char *desc,
 | 
			
		||||
X509 *load_cert(BIO *err, const char *file, int format,
 | 
			
		||||
	const char *pass, ENGINE *e, const char *cert_descrip)
 | 
			
		||||
	{
 | 
			
		||||
	ASN1_HEADER *ah=NULL;
 | 
			
		||||
	BUF_MEM *buf=NULL;
 | 
			
		||||
	X509 *x=NULL;
 | 
			
		||||
	BIO *cert;
 | 
			
		||||
 | 
			
		||||
@@ -794,9 +762,7 @@ X509 *load_cert(BIO *err, const char *file, int format,
 | 
			
		||||
 | 
			
		||||
	if (file == NULL)
 | 
			
		||||
		{
 | 
			
		||||
#ifdef _IONBF
 | 
			
		||||
		setvbuf(stdin, NULL, _IONBF, 0);
 | 
			
		||||
#endif
 | 
			
		||||
		BIO_set_fp(cert,stdin,BIO_NOCLOSE);
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
@@ -814,21 +780,46 @@ X509 *load_cert(BIO *err, const char *file, int format,
 | 
			
		||||
		x=d2i_X509_bio(cert,NULL);
 | 
			
		||||
	else if (format == FORMAT_NETSCAPE)
 | 
			
		||||
		{
 | 
			
		||||
		NETSCAPE_X509 *nx;
 | 
			
		||||
		nx=ASN1_item_d2i_bio(ASN1_ITEM_rptr(NETSCAPE_X509),cert,NULL);
 | 
			
		||||
		if (nx == NULL)
 | 
			
		||||
				goto end;
 | 
			
		||||
		const unsigned char *p,*op;
 | 
			
		||||
		int size=0,i;
 | 
			
		||||
 | 
			
		||||
		if ((strncmp(NETSCAPE_CERT_HDR,(char *)nx->header->data,
 | 
			
		||||
			nx->header->length) != 0))
 | 
			
		||||
		/* We sort of have to do it this way because it is sort of nice
 | 
			
		||||
		 * to read the header first and check it, then
 | 
			
		||||
		 * try to read the certificate */
 | 
			
		||||
		buf=BUF_MEM_new();
 | 
			
		||||
		for (;;)
 | 
			
		||||
			{
 | 
			
		||||
			if ((buf == NULL) || (!BUF_MEM_grow(buf,size+1024*10)))
 | 
			
		||||
				goto end;
 | 
			
		||||
			i=BIO_read(cert,&(buf->data[size]),1024*10);
 | 
			
		||||
			size+=i;
 | 
			
		||||
			if (i == 0) break;
 | 
			
		||||
			if (i < 0)
 | 
			
		||||
				{
 | 
			
		||||
				perror("reading certificate");
 | 
			
		||||
				goto end;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		p=(unsigned char *)buf->data;
 | 
			
		||||
		op=p;
 | 
			
		||||
 | 
			
		||||
		/* First load the header */
 | 
			
		||||
		if ((ah=d2i_ASN1_HEADER(NULL,&p,(long)size)) == NULL)
 | 
			
		||||
			goto end;
 | 
			
		||||
		if ((ah->header == NULL) || (ah->header->data == NULL) ||
 | 
			
		||||
			(strncmp(NETSCAPE_CERT_HDR,(char *)ah->header->data,
 | 
			
		||||
			ah->header->length) != 0))
 | 
			
		||||
			{
 | 
			
		||||
			NETSCAPE_X509_free(nx);
 | 
			
		||||
			BIO_printf(err,"Error reading header on certificate\n");
 | 
			
		||||
			goto end;
 | 
			
		||||
			}
 | 
			
		||||
		x=nx->cert;
 | 
			
		||||
		nx->cert = NULL;
 | 
			
		||||
		NETSCAPE_X509_free(nx);
 | 
			
		||||
		/* header is ok, so now read the object */
 | 
			
		||||
		p=op;
 | 
			
		||||
		ah->meth=X509_asn1_meth();
 | 
			
		||||
		if ((ah=d2i_ASN1_HEADER(&ah,&p,(long)size)) == NULL)
 | 
			
		||||
			goto end;
 | 
			
		||||
		x=(X509 *)ah->data;
 | 
			
		||||
		ah->data=NULL;
 | 
			
		||||
		}
 | 
			
		||||
	else if (format == FORMAT_PEM)
 | 
			
		||||
		x=PEM_read_bio_X509_AUX(cert,NULL,
 | 
			
		||||
@@ -850,7 +841,9 @@ end:
 | 
			
		||||
		BIO_printf(err,"unable to load certificate\n");
 | 
			
		||||
		ERR_print_errors(err);
 | 
			
		||||
		}
 | 
			
		||||
	if (ah != NULL) ASN1_HEADER_free(ah);
 | 
			
		||||
	if (cert != NULL) BIO_free(cert);
 | 
			
		||||
	if (buf != NULL) BUF_MEM_free(buf);
 | 
			
		||||
	return(x);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -888,9 +881,7 @@ EVP_PKEY *load_key(BIO *err, const char *file, int format, int maybe_stdin,
 | 
			
		||||
		}
 | 
			
		||||
	if (file == NULL && maybe_stdin)
 | 
			
		||||
		{
 | 
			
		||||
#ifdef _IONBF
 | 
			
		||||
		setvbuf(stdin, NULL, _IONBF, 0);
 | 
			
		||||
#endif
 | 
			
		||||
		BIO_set_fp(key,stdin,BIO_NOCLOSE);
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
@@ -921,11 +912,6 @@ EVP_PKEY *load_key(BIO *err, const char *file, int format, int maybe_stdin,
 | 
			
		||||
				&pkey, NULL, NULL))
 | 
			
		||||
			goto end;
 | 
			
		||||
		}
 | 
			
		||||
	else if (format == FORMAT_MSBLOB)
 | 
			
		||||
		pkey = b2i_PrivateKey_bio(key);
 | 
			
		||||
	else if (format == FORMAT_PVK)
 | 
			
		||||
		pkey = b2i_PVK_bio(key, (pem_password_cb *)password_callback,
 | 
			
		||||
								&cb_data);
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		BIO_printf(err,"bad input format specified for key file\n");
 | 
			
		||||
@@ -972,9 +958,7 @@ EVP_PKEY *load_pubkey(BIO *err, const char *file, int format, int maybe_stdin,
 | 
			
		||||
		}
 | 
			
		||||
	if (file == NULL && maybe_stdin)
 | 
			
		||||
		{
 | 
			
		||||
#ifdef _IONBF
 | 
			
		||||
		setvbuf(stdin, NULL, _IONBF, 0);
 | 
			
		||||
#endif
 | 
			
		||||
		BIO_set_fp(key,stdin,BIO_NOCLOSE);
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
@@ -989,36 +973,6 @@ EVP_PKEY *load_pubkey(BIO *err, const char *file, int format, int maybe_stdin,
 | 
			
		||||
		{
 | 
			
		||||
		pkey=d2i_PUBKEY_bio(key, NULL);
 | 
			
		||||
		}
 | 
			
		||||
	else if (format == FORMAT_ASN1RSA)
 | 
			
		||||
		{
 | 
			
		||||
		RSA *rsa;
 | 
			
		||||
		rsa = d2i_RSAPublicKey_bio(key, NULL);
 | 
			
		||||
		if (rsa)
 | 
			
		||||
			{
 | 
			
		||||
			pkey = EVP_PKEY_new();
 | 
			
		||||
			if (pkey)
 | 
			
		||||
				EVP_PKEY_set1_RSA(pkey, rsa);
 | 
			
		||||
			RSA_free(rsa);
 | 
			
		||||
			}
 | 
			
		||||
		else
 | 
			
		||||
			pkey = NULL;
 | 
			
		||||
		}
 | 
			
		||||
	else if (format == FORMAT_PEMRSA)
 | 
			
		||||
		{
 | 
			
		||||
		RSA *rsa;
 | 
			
		||||
		rsa = PEM_read_bio_RSAPublicKey(key, NULL, 
 | 
			
		||||
			(pem_password_cb *)password_callback, &cb_data);
 | 
			
		||||
		if (rsa)
 | 
			
		||||
			{
 | 
			
		||||
			pkey = EVP_PKEY_new();
 | 
			
		||||
			if (pkey)
 | 
			
		||||
				EVP_PKEY_set1_RSA(pkey, rsa);
 | 
			
		||||
			RSA_free(rsa);
 | 
			
		||||
			}
 | 
			
		||||
		else
 | 
			
		||||
			pkey = NULL;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	else if (format == FORMAT_PEM)
 | 
			
		||||
		{
 | 
			
		||||
		pkey=PEM_read_bio_PUBKEY(key,NULL,
 | 
			
		||||
@@ -1028,8 +982,6 @@ EVP_PKEY *load_pubkey(BIO *err, const char *file, int format, int maybe_stdin,
 | 
			
		||||
	else if (format == FORMAT_NETSCAPE || format == FORMAT_IISSGC)
 | 
			
		||||
		pkey = load_netscape_key(err, key, file, key_descrip, format);
 | 
			
		||||
#endif
 | 
			
		||||
	else if (format == FORMAT_MSBLOB)
 | 
			
		||||
		pkey = b2i_PublicKey_bio(key);
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		BIO_printf(err,"bad input format specified for key file\n");
 | 
			
		||||
@@ -1444,10 +1396,6 @@ ENGINE *setup_engine(BIO *err, const char *engine, int debug)
 | 
			
		||||
 | 
			
		||||
int load_config(BIO *err, CONF *cnf)
 | 
			
		||||
	{
 | 
			
		||||
	static int load_config_called = 0;
 | 
			
		||||
	if (load_config_called)
 | 
			
		||||
		return 1;
 | 
			
		||||
	load_config_called = 1;
 | 
			
		||||
	if (!cnf)
 | 
			
		||||
		cnf = config;
 | 
			
		||||
	if (!cnf)
 | 
			
		||||
@@ -1481,7 +1429,7 @@ char *make_config_name()
 | 
			
		||||
	return p;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static unsigned long index_serial_hash(const CSTRING *a)
 | 
			
		||||
static unsigned long index_serial_hash(const char **a)
 | 
			
		||||
	{
 | 
			
		||||
	const char *n;
 | 
			
		||||
 | 
			
		||||
@@ -1490,7 +1438,7 @@ static unsigned long index_serial_hash(const CSTRING *a)
 | 
			
		||||
	return(lh_strhash(n));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static int index_serial_cmp(const CSTRING *a, const CSTRING *b)
 | 
			
		||||
static int index_serial_cmp(const char **a, const char **b)
 | 
			
		||||
	{
 | 
			
		||||
	const char *aa,*bb;
 | 
			
		||||
 | 
			
		||||
@@ -1502,16 +1450,17 @@ static int index_serial_cmp(const CSTRING *a, const CSTRING *b)
 | 
			
		||||
static int index_name_qual(char **a)
 | 
			
		||||
	{ return(a[0][0] == 'V'); }
 | 
			
		||||
 | 
			
		||||
static unsigned long index_name_hash(const CSTRING *a)
 | 
			
		||||
static unsigned long index_name_hash(const char **a)
 | 
			
		||||
	{ return(lh_strhash(a[DB_name])); }
 | 
			
		||||
 | 
			
		||||
int index_name_cmp(const CSTRING *a, const CSTRING *b)
 | 
			
		||||
	{ return(strcmp(a[DB_name], b[DB_name])); }
 | 
			
		||||
int index_name_cmp(const char **a, const char **b)
 | 
			
		||||
	{ return(strcmp(a[DB_name],
 | 
			
		||||
	     b[DB_name])); }
 | 
			
		||||
 | 
			
		||||
static IMPLEMENT_LHASH_HASH_FN(index_serial, CSTRING)
 | 
			
		||||
static IMPLEMENT_LHASH_COMP_FN(index_serial, CSTRING)
 | 
			
		||||
static IMPLEMENT_LHASH_HASH_FN(index_name, CSTRING)
 | 
			
		||||
static IMPLEMENT_LHASH_COMP_FN(index_name, CSTRING)
 | 
			
		||||
static IMPLEMENT_LHASH_HASH_FN(index_serial_hash,const char **)
 | 
			
		||||
static IMPLEMENT_LHASH_COMP_FN(index_serial_cmp,const char **)
 | 
			
		||||
static IMPLEMENT_LHASH_HASH_FN(index_name_hash,const char **)
 | 
			
		||||
static IMPLEMENT_LHASH_COMP_FN(index_name_cmp,const char **)
 | 
			
		||||
 | 
			
		||||
#undef BSIZE
 | 
			
		||||
#define BSIZE 256
 | 
			
		||||
@@ -1639,6 +1588,7 @@ int rotate_serial(char *serialfile, char *new_suffix, char *old_suffix)
 | 
			
		||||
	{
 | 
			
		||||
	char buf[5][BSIZE];
 | 
			
		||||
	int i,j;
 | 
			
		||||
	struct stat sb;
 | 
			
		||||
 | 
			
		||||
	i = strlen(serialfile) + strlen(old_suffix);
 | 
			
		||||
	j = strlen(serialfile) + strlen(new_suffix);
 | 
			
		||||
@@ -1663,21 +1613,30 @@ int rotate_serial(char *serialfile, char *new_suffix, char *old_suffix)
 | 
			
		||||
	j = BIO_snprintf(buf[1], sizeof buf[1], "%s-%s",
 | 
			
		||||
		serialfile, old_suffix);
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef RL_DEBUG
 | 
			
		||||
	BIO_printf(bio_err, "DEBUG: renaming \"%s\" to \"%s\"\n",
 | 
			
		||||
		serialfile, buf[1]);
 | 
			
		||||
#endif
 | 
			
		||||
	if (rename(serialfile,buf[1]) < 0 && errno != ENOENT
 | 
			
		||||
	if (stat(serialfile,&sb) < 0)
 | 
			
		||||
		{
 | 
			
		||||
		if (errno != ENOENT 
 | 
			
		||||
#ifdef ENOTDIR
 | 
			
		||||
			&& errno != ENOTDIR
 | 
			
		||||
#endif
 | 
			
		||||
	   )		{
 | 
			
		||||
		   )
 | 
			
		||||
			goto err;
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
#ifdef RL_DEBUG
 | 
			
		||||
		BIO_printf(bio_err, "DEBUG: renaming \"%s\" to \"%s\"\n",
 | 
			
		||||
			serialfile, buf[1]);
 | 
			
		||||
#endif
 | 
			
		||||
		if (rename(serialfile,buf[1]) < 0)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bio_err,
 | 
			
		||||
				"unable to rename %s to %s\n",
 | 
			
		||||
				serialfile, buf[1]);
 | 
			
		||||
			perror("reason");
 | 
			
		||||
			goto err;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
#ifdef RL_DEBUG
 | 
			
		||||
	BIO_printf(bio_err, "DEBUG: renaming \"%s\" to \"%s\"\n",
 | 
			
		||||
		buf[0],serialfile);
 | 
			
		||||
@@ -1744,7 +1703,10 @@ CA_DB *load_index(char *dbfile, DB_ATTR *db_attr)
 | 
			
		||||
		goto err;
 | 
			
		||||
		}
 | 
			
		||||
	if ((tmpdb = TXT_DB_read(in,DB_NUMBER)) == NULL)
 | 
			
		||||
		{
 | 
			
		||||
		if (tmpdb != NULL) TXT_DB_free(tmpdb);
 | 
			
		||||
		goto err;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_SYS_VMS
 | 
			
		||||
	BIO_snprintf(buf[0], sizeof buf[0], "%s.attr", dbfile);
 | 
			
		||||
@@ -1805,8 +1767,8 @@ CA_DB *load_index(char *dbfile, DB_ATTR *db_attr)
 | 
			
		||||
int index_index(CA_DB *db)
 | 
			
		||||
	{
 | 
			
		||||
	if (!TXT_DB_create_index(db->db, DB_serial, NULL,
 | 
			
		||||
				LHASH_HASH_FN(index_serial),
 | 
			
		||||
				LHASH_COMP_FN(index_serial)))
 | 
			
		||||
				LHASH_HASH_FN(index_serial_hash),
 | 
			
		||||
				LHASH_COMP_FN(index_serial_cmp)))
 | 
			
		||||
		{
 | 
			
		||||
		BIO_printf(bio_err,
 | 
			
		||||
		  "error creating serial number index:(%ld,%ld,%ld)\n",
 | 
			
		||||
@@ -1816,8 +1778,8 @@ int index_index(CA_DB *db)
 | 
			
		||||
 | 
			
		||||
	if (db->attributes.unique_subject
 | 
			
		||||
		&& !TXT_DB_create_index(db->db, DB_name, index_name_qual,
 | 
			
		||||
			LHASH_HASH_FN(index_name),
 | 
			
		||||
			LHASH_COMP_FN(index_name)))
 | 
			
		||||
			LHASH_HASH_FN(index_name_hash),
 | 
			
		||||
			LHASH_COMP_FN(index_name_cmp)))
 | 
			
		||||
		{
 | 
			
		||||
		BIO_printf(bio_err,"error creating name index:(%ld,%ld,%ld)\n",
 | 
			
		||||
			db->db->error,db->db->arg1,db->db->arg2);
 | 
			
		||||
@@ -1897,6 +1859,7 @@ int rotate_index(const char *dbfile, const char *new_suffix, const char *old_suf
 | 
			
		||||
	{
 | 
			
		||||
	char buf[5][BSIZE];
 | 
			
		||||
	int i,j;
 | 
			
		||||
	struct stat sb;
 | 
			
		||||
 | 
			
		||||
	i = strlen(dbfile) + strlen(old_suffix);
 | 
			
		||||
	j = strlen(dbfile) + strlen(new_suffix);
 | 
			
		||||
@@ -1940,21 +1903,30 @@ int rotate_index(const char *dbfile, const char *new_suffix, const char *old_suf
 | 
			
		||||
	j = BIO_snprintf(buf[3], sizeof buf[3], "%s-attr-%s",
 | 
			
		||||
		dbfile, old_suffix);
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef RL_DEBUG
 | 
			
		||||
	BIO_printf(bio_err, "DEBUG: renaming \"%s\" to \"%s\"\n",
 | 
			
		||||
		dbfile, buf[1]);
 | 
			
		||||
#endif
 | 
			
		||||
	if (rename(dbfile,buf[1]) < 0 && errno != ENOENT
 | 
			
		||||
	if (stat(dbfile,&sb) < 0)
 | 
			
		||||
		{
 | 
			
		||||
		if (errno != ENOENT 
 | 
			
		||||
#ifdef ENOTDIR
 | 
			
		||||
		&& errno != ENOTDIR
 | 
			
		||||
			&& errno != ENOTDIR
 | 
			
		||||
#endif
 | 
			
		||||
	   )		{
 | 
			
		||||
		   )
 | 
			
		||||
			goto err;
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
#ifdef RL_DEBUG
 | 
			
		||||
		BIO_printf(bio_err, "DEBUG: renaming \"%s\" to \"%s\"\n",
 | 
			
		||||
			dbfile, buf[1]);
 | 
			
		||||
#endif
 | 
			
		||||
		if (rename(dbfile,buf[1]) < 0)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bio_err,
 | 
			
		||||
				"unable to rename %s to %s\n",
 | 
			
		||||
				dbfile, buf[1]);
 | 
			
		||||
			perror("reason");
 | 
			
		||||
			goto err;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
#ifdef RL_DEBUG
 | 
			
		||||
	BIO_printf(bio_err, "DEBUG: renaming \"%s\" to \"%s\"\n",
 | 
			
		||||
		buf[0],dbfile);
 | 
			
		||||
@@ -1968,15 +1940,23 @@ int rotate_index(const char *dbfile, const char *new_suffix, const char *old_suf
 | 
			
		||||
		rename(buf[1],dbfile);
 | 
			
		||||
		goto err;
 | 
			
		||||
		}
 | 
			
		||||
#ifdef RL_DEBUG
 | 
			
		||||
	BIO_printf(bio_err, "DEBUG: renaming \"%s\" to \"%s\"\n",
 | 
			
		||||
		buf[4],buf[3]);
 | 
			
		||||
#endif
 | 
			
		||||
	if (rename(buf[4],buf[3]) < 0 && errno != ENOENT
 | 
			
		||||
	if (stat(buf[4],&sb) < 0)
 | 
			
		||||
		{
 | 
			
		||||
		if (errno != ENOENT 
 | 
			
		||||
#ifdef ENOTDIR
 | 
			
		||||
		&& errno != ENOTDIR
 | 
			
		||||
			&& errno != ENOTDIR
 | 
			
		||||
#endif
 | 
			
		||||
	   )		{
 | 
			
		||||
		   )
 | 
			
		||||
			goto err;
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
#ifdef RL_DEBUG
 | 
			
		||||
		BIO_printf(bio_err, "DEBUG: renaming \"%s\" to \"%s\"\n",
 | 
			
		||||
			buf[4],buf[3]);
 | 
			
		||||
#endif
 | 
			
		||||
		if (rename(buf[4],buf[3]) < 0)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bio_err,
 | 
			
		||||
				"unable to rename %s to %s\n",
 | 
			
		||||
				buf[4], buf[3]);
 | 
			
		||||
@@ -1985,6 +1965,7 @@ int rotate_index(const char *dbfile, const char *new_suffix, const char *old_suf
 | 
			
		||||
			rename(buf[1],dbfile);
 | 
			
		||||
			goto err;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
#ifdef RL_DEBUG
 | 
			
		||||
	BIO_printf(bio_err, "DEBUG: renaming \"%s\" to \"%s\"\n",
 | 
			
		||||
		buf[2],buf[4]);
 | 
			
		||||
@@ -2179,6 +2160,45 @@ error:
 | 
			
		||||
	return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* This code MUST COME AFTER anything that uses rename() */
 | 
			
		||||
#ifdef OPENSSL_SYS_WIN32
 | 
			
		||||
int WIN32_rename(const char *from, const char *to)
 | 
			
		||||
	{
 | 
			
		||||
#ifndef OPENSSL_SYS_WINCE
 | 
			
		||||
	/* Windows rename gives an error if 'to' exists, so delete it
 | 
			
		||||
	 * first and ignore file not found errror
 | 
			
		||||
	 */
 | 
			
		||||
	if((remove(to) != 0) && (errno != ENOENT))
 | 
			
		||||
		return -1;
 | 
			
		||||
#undef rename
 | 
			
		||||
	return rename(from, to);
 | 
			
		||||
#else
 | 
			
		||||
	/* convert strings to UNICODE */
 | 
			
		||||
	{
 | 
			
		||||
	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
 | 
			
		||||
 | 
			
		||||
int args_verify(char ***pargs, int *pargc,
 | 
			
		||||
			int *badarg, BIO *err, X509_VERIFY_PARAM **pm)
 | 
			
		||||
	{
 | 
			
		||||
@@ -2237,16 +2257,8 @@ int args_verify(char ***pargs, int *pargc,
 | 
			
		||||
		flags |= X509_V_FLAG_POLICY_CHECK;
 | 
			
		||||
	else if (!strcmp(arg, "-explicit_policy"))
 | 
			
		||||
		flags |= X509_V_FLAG_EXPLICIT_POLICY;
 | 
			
		||||
	else if (!strcmp(arg, "-inhibit_any"))
 | 
			
		||||
		flags |= X509_V_FLAG_INHIBIT_ANY;
 | 
			
		||||
	else if (!strcmp(arg, "-inhibit_map"))
 | 
			
		||||
		flags |= X509_V_FLAG_INHIBIT_MAP;
 | 
			
		||||
	else if (!strcmp(arg, "-x509_strict"))
 | 
			
		||||
		flags |= X509_V_FLAG_X509_STRICT;
 | 
			
		||||
	else if (!strcmp(arg, "-extended_crl"))
 | 
			
		||||
		flags |= X509_V_FLAG_EXTENDED_CRL_SUPPORT;
 | 
			
		||||
	else if (!strcmp(arg, "-use_deltas"))
 | 
			
		||||
		flags |= X509_V_FLAG_USE_DELTAS;
 | 
			
		||||
	else if (!strcmp(arg, "-policy_print"))
 | 
			
		||||
		flags |= X509_V_FLAG_NOTIFY_POLICY;
 | 
			
		||||
	else
 | 
			
		||||
@@ -2285,61 +2297,6 @@ int args_verify(char ***pargs, int *pargc,
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
/* Read whole contents of a BIO into an allocated memory buffer and
 | 
			
		||||
 * return it.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
int bio_to_mem(unsigned char **out, int maxlen, BIO *in)
 | 
			
		||||
	{
 | 
			
		||||
	BIO *mem;
 | 
			
		||||
	int len, ret;
 | 
			
		||||
	unsigned char tbuf[1024];
 | 
			
		||||
	mem = BIO_new(BIO_s_mem());
 | 
			
		||||
	if (!mem)
 | 
			
		||||
		return -1;
 | 
			
		||||
	for(;;)
 | 
			
		||||
		{
 | 
			
		||||
		if ((maxlen != -1) && maxlen < 1024)
 | 
			
		||||
			len = maxlen;
 | 
			
		||||
		else
 | 
			
		||||
			len = 1024;
 | 
			
		||||
		len = BIO_read(in, tbuf, len);
 | 
			
		||||
		if (len <= 0)
 | 
			
		||||
			break;
 | 
			
		||||
		if (BIO_write(mem, tbuf, len) != len)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_free(mem);
 | 
			
		||||
			return -1;
 | 
			
		||||
			}
 | 
			
		||||
		maxlen -= len;
 | 
			
		||||
 | 
			
		||||
		if (maxlen == 0)
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
	ret = BIO_get_mem_data(mem, (char **)out);
 | 
			
		||||
	BIO_set_flags(mem, BIO_FLAGS_MEM_RDONLY);
 | 
			
		||||
	BIO_free(mem);
 | 
			
		||||
	return ret;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
int pkey_ctrl_string(EVP_PKEY_CTX *ctx, char *value)
 | 
			
		||||
	{
 | 
			
		||||
	int rv;
 | 
			
		||||
	char *stmp, *vtmp = NULL;
 | 
			
		||||
	stmp = BUF_strdup(value);
 | 
			
		||||
	if (!stmp)
 | 
			
		||||
		return -1;
 | 
			
		||||
	vtmp = strchr(stmp, ':');
 | 
			
		||||
	if (vtmp)
 | 
			
		||||
		{
 | 
			
		||||
		*vtmp = 0;
 | 
			
		||||
		vtmp++;
 | 
			
		||||
		}
 | 
			
		||||
	rv = EVP_PKEY_CTX_ctrl_str(ctx, stmp, vtmp);
 | 
			
		||||
	OPENSSL_free(stmp);
 | 
			
		||||
	return rv;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static void nodes_print(BIO *out, const char *name,
 | 
			
		||||
	STACK_OF(X509_POLICY_NODE) *nodes)
 | 
			
		||||
	{
 | 
			
		||||
@@ -2381,7 +2338,7 @@ void policies_print(BIO *out, X509_STORE_CTX *ctx)
 | 
			
		||||
		BIO_free(out);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
#if !defined(OPENSSL_NO_JPAKE) && !defined(OPENSSL_NO_PSK)
 | 
			
		||||
#ifndef OPENSSL_NO_JPAKE
 | 
			
		||||
 | 
			
		||||
static JPAKE_CTX *jpake_init(const char *us, const char *them,
 | 
			
		||||
							 const char *secret)
 | 
			
		||||
@@ -2564,14 +2521,17 @@ void jpake_client_auth(BIO *out, BIO *conn, const char *secret)
 | 
			
		||||
	jpake_send_step3a(bconn, ctx);
 | 
			
		||||
	jpake_receive_step3b(ctx, bconn);
 | 
			
		||||
 | 
			
		||||
	BIO_puts(out, "JPAKE authentication succeeded, setting PSK\n");
 | 
			
		||||
 | 
			
		||||
	psk_key = BN_bn2hex(JPAKE_get_shared_key(ctx));
 | 
			
		||||
	/*
 | 
			
		||||
	 * The problem is that you must use the derived key in the
 | 
			
		||||
	 * session key or you are subject to man-in-the-middle
 | 
			
		||||
	 * attacks.
 | 
			
		||||
	 */
 | 
			
		||||
	BIO_puts(out, "JPAKE authentication succeeded (N.B. This version can"
 | 
			
		||||
		 " be MitMed. See the version in HEAD for how to do it"
 | 
			
		||||
		 " properly)\n");
 | 
			
		||||
 | 
			
		||||
	BIO_pop(bconn);
 | 
			
		||||
	BIO_free(bconn);
 | 
			
		||||
 | 
			
		||||
	JPAKE_CTX_free(ctx);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
void jpake_server_auth(BIO *out, BIO *conn, const char *secret)
 | 
			
		||||
@@ -2593,340 +2553,17 @@ void jpake_server_auth(BIO *out, BIO *conn, const char *secret)
 | 
			
		||||
	jpake_receive_step3a(ctx, bconn);
 | 
			
		||||
	jpake_send_step3b(bconn, ctx);
 | 
			
		||||
 | 
			
		||||
	BIO_puts(out, "JPAKE authentication succeeded, setting PSK\n");
 | 
			
		||||
 | 
			
		||||
	psk_key = BN_bn2hex(JPAKE_get_shared_key(ctx));
 | 
			
		||||
	/*
 | 
			
		||||
	 * The problem is that you must use the derived key in the
 | 
			
		||||
	 * session key or you are subject to man-in-the-middle
 | 
			
		||||
	 * attacks.
 | 
			
		||||
	 */
 | 
			
		||||
	BIO_puts(out, "JPAKE authentication succeeded (N.B. This version can"
 | 
			
		||||
		 " be MitMed. See the version in HEAD for how to do it"
 | 
			
		||||
		 " properly)\n");
 | 
			
		||||
 | 
			
		||||
	BIO_pop(bconn);
 | 
			
		||||
	BIO_free(bconn);
 | 
			
		||||
 | 
			
		||||
	JPAKE_CTX_free(ctx);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Platform-specific sections
 | 
			
		||||
 */
 | 
			
		||||
#if defined(_WIN32)
 | 
			
		||||
# ifdef fileno
 | 
			
		||||
#  undef fileno
 | 
			
		||||
#  define fileno(a) (int)_fileno(a)
 | 
			
		||||
# endif
 | 
			
		||||
 | 
			
		||||
# include <windows.h>
 | 
			
		||||
# include <tchar.h>
 | 
			
		||||
 | 
			
		||||
static int WIN32_rename(const char *from, const char *to)
 | 
			
		||||
	{
 | 
			
		||||
	TCHAR  *tfrom=NULL,*tto;
 | 
			
		||||
	DWORD	err;
 | 
			
		||||
	int	ret=0;
 | 
			
		||||
 | 
			
		||||
	if (sizeof(TCHAR) == 1)
 | 
			
		||||
		{
 | 
			
		||||
		tfrom = (TCHAR *)from;
 | 
			
		||||
		tto   = (TCHAR *)to;
 | 
			
		||||
		}
 | 
			
		||||
	else	/* UNICODE path */
 | 
			
		||||
		{
 | 
			
		||||
		size_t i,flen=strlen(from)+1,tlen=strlen(to)+1;
 | 
			
		||||
		tfrom = (TCHAR *)malloc(sizeof(TCHAR)*(flen+tlen));
 | 
			
		||||
		if (tfrom==NULL) goto err;
 | 
			
		||||
		tto=tfrom+flen;
 | 
			
		||||
#if !defined(_WIN32_WCE) || _WIN32_WCE>=101
 | 
			
		||||
		if (!MultiByteToWideChar(CP_ACP,0,from,flen,(WCHAR *)tfrom,flen))
 | 
			
		||||
#endif
 | 
			
		||||
			for (i=0;i<flen;i++)	tfrom[i]=(TCHAR)from[i];
 | 
			
		||||
#if !defined(_WIN32_WCE) || _WIN32_WCE>=101
 | 
			
		||||
		if (!MultiByteToWideChar(CP_ACP,0,to,  tlen,(WCHAR *)tto,  tlen))
 | 
			
		||||
#endif
 | 
			
		||||
			for (i=0;i<tlen;i++)	tto[i]  =(TCHAR)to[i];
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (MoveFile(tfrom,tto))	goto ok;
 | 
			
		||||
	err=GetLastError();
 | 
			
		||||
	if (err==ERROR_ALREADY_EXISTS || err==ERROR_FILE_EXISTS)
 | 
			
		||||
		{
 | 
			
		||||
		if (DeleteFile(tto) && MoveFile(tfrom,tto))
 | 
			
		||||
			goto ok;
 | 
			
		||||
		err=GetLastError();
 | 
			
		||||
		}
 | 
			
		||||
	if (err==ERROR_FILE_NOT_FOUND || err==ERROR_PATH_NOT_FOUND)
 | 
			
		||||
		errno = ENOENT;
 | 
			
		||||
	else if (err==ERROR_ACCESS_DENIED)
 | 
			
		||||
		errno = EACCES;
 | 
			
		||||
	else
 | 
			
		||||
		errno = EINVAL;	/* we could map more codes... */
 | 
			
		||||
err:
 | 
			
		||||
	ret=-1;
 | 
			
		||||
ok:
 | 
			
		||||
	if (tfrom!=NULL && tfrom!=(TCHAR *)from)	free(tfrom);
 | 
			
		||||
	return ret;
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/* app_tminterval section */
 | 
			
		||||
#if defined(_WIN32)
 | 
			
		||||
double app_tminterval(int stop,int usertime)
 | 
			
		||||
	{
 | 
			
		||||
	FILETIME		now;
 | 
			
		||||
	double			ret=0;
 | 
			
		||||
	static ULARGE_INTEGER	tmstart;
 | 
			
		||||
	static int		warning=1;
 | 
			
		||||
#ifdef _WIN32_WINNT
 | 
			
		||||
	static HANDLE		proc=NULL;
 | 
			
		||||
 | 
			
		||||
	if (proc==NULL)
 | 
			
		||||
		{
 | 
			
		||||
		if (GetVersion() < 0x80000000)
 | 
			
		||||
			proc = OpenProcess(PROCESS_QUERY_INFORMATION,FALSE,
 | 
			
		||||
						GetCurrentProcessId());
 | 
			
		||||
		if (proc==NULL) proc = (HANDLE)-1;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (usertime && proc!=(HANDLE)-1)
 | 
			
		||||
		{
 | 
			
		||||
		FILETIME junk;
 | 
			
		||||
		GetProcessTimes(proc,&junk,&junk,&junk,&now);
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
#endif
 | 
			
		||||
		{
 | 
			
		||||
		SYSTEMTIME systime;
 | 
			
		||||
 | 
			
		||||
		if (usertime && warning)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bio_err,"To get meaningful results, run "
 | 
			
		||||
					   "this program on idle system.\n");
 | 
			
		||||
			warning=0;
 | 
			
		||||
			}
 | 
			
		||||
		GetSystemTime(&systime);
 | 
			
		||||
		SystemTimeToFileTime(&systime,&now);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (stop==TM_START)
 | 
			
		||||
		{
 | 
			
		||||
		tmstart.u.LowPart  = now.dwLowDateTime;
 | 
			
		||||
		tmstart.u.HighPart = now.dwHighDateTime;
 | 
			
		||||
		}
 | 
			
		||||
	else	{
 | 
			
		||||
		ULARGE_INTEGER tmstop;
 | 
			
		||||
 | 
			
		||||
		tmstop.u.LowPart   = now.dwLowDateTime;
 | 
			
		||||
		tmstop.u.HighPart  = now.dwHighDateTime;
 | 
			
		||||
 | 
			
		||||
		ret = (__int64)(tmstop.QuadPart - tmstart.QuadPart)*1e-7;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	return (ret);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
#elif defined(OPENSSL_SYS_NETWARE)
 | 
			
		||||
#include <time.h>
 | 
			
		||||
 | 
			
		||||
double app_tminterval(int stop,int usertime)
 | 
			
		||||
	{
 | 
			
		||||
	double		ret=0;
 | 
			
		||||
	static clock_t	tmstart;
 | 
			
		||||
	static int	warning=1;
 | 
			
		||||
 | 
			
		||||
	if (usertime && warning)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_printf(bio_err,"To get meaningful results, run "
 | 
			
		||||
				   "this program on idle system.\n");
 | 
			
		||||
		warning=0;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (stop==TM_START)	tmstart = clock();
 | 
			
		||||
	else			ret     = (clock()-tmstart)/(double)CLOCKS_PER_SEC;
 | 
			
		||||
 | 
			
		||||
	return (ret);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
#elif defined(OPENSSL_SYSTEM_VXWORKS)
 | 
			
		||||
#include <time.h>
 | 
			
		||||
 | 
			
		||||
double app_tminterval(int stop,int usertime)
 | 
			
		||||
	{
 | 
			
		||||
	double ret=0;
 | 
			
		||||
#ifdef CLOCK_REALTIME
 | 
			
		||||
	static struct timespec	tmstart;
 | 
			
		||||
	struct timespec		now;
 | 
			
		||||
#else
 | 
			
		||||
	static unsigned long	tmstart;
 | 
			
		||||
	unsigned long		now;
 | 
			
		||||
#endif
 | 
			
		||||
	static int warning=1;
 | 
			
		||||
 | 
			
		||||
	if (usertime && warning)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_printf(bio_err,"To get meaningful results, run "
 | 
			
		||||
				   "this program on idle system.\n");
 | 
			
		||||
		warning=0;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
#ifdef CLOCK_REALTIME
 | 
			
		||||
	clock_gettime(CLOCK_REALTIME,&now);
 | 
			
		||||
	if (stop==TM_START)	tmstart = now;
 | 
			
		||||
	else	ret = ( (now.tv_sec+now.tv_nsec*1e-9)
 | 
			
		||||
			- (tmstart.tv_sec+tmstart.tv_nsec*1e-9) );
 | 
			
		||||
#else
 | 
			
		||||
	now = tickGet();
 | 
			
		||||
	if (stop==TM_START)	tmstart = now;
 | 
			
		||||
	else			ret = (now - tmstart)/(double)sysClkRateGet();
 | 
			
		||||
#endif
 | 
			
		||||
	return (ret);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
#elif defined(OPENSSL_SYSTEM_VMS)
 | 
			
		||||
#include <time.h>
 | 
			
		||||
#include <times.h>
 | 
			
		||||
 | 
			
		||||
double app_tminterval(int stop,int usertime)
 | 
			
		||||
	{
 | 
			
		||||
	static clock_t	tmstart;
 | 
			
		||||
	double		ret = 0;
 | 
			
		||||
	clock_t		now;
 | 
			
		||||
#ifdef __TMS
 | 
			
		||||
	struct tms	rus;
 | 
			
		||||
 | 
			
		||||
	now = times(&rus);
 | 
			
		||||
	if (usertime)	now = rus.tms_utime;
 | 
			
		||||
#else
 | 
			
		||||
	if (usertime)
 | 
			
		||||
		now = clock(); /* sum of user and kernel times */
 | 
			
		||||
	else	{
 | 
			
		||||
		struct timeval tv;
 | 
			
		||||
		gettimeofday(&tv,NULL);
 | 
			
		||||
		now = (clock_t)(
 | 
			
		||||
			(unsigned long long)tv.tv_sec*CLK_TCK +
 | 
			
		||||
			(unsigned long long)tv.tv_usec*(1000000/CLK_TCK)
 | 
			
		||||
			);
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
	if (stop==TM_START)	tmstart = now;
 | 
			
		||||
	else			ret = (now - tmstart)/(double)(CLK_TCK);
 | 
			
		||||
 | 
			
		||||
	return (ret);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
#elif defined(_SC_CLK_TCK)	/* by means of unistd.h */
 | 
			
		||||
#include <sys/times.h>
 | 
			
		||||
 | 
			
		||||
double app_tminterval(int stop,int usertime)
 | 
			
		||||
	{
 | 
			
		||||
	double		ret = 0;
 | 
			
		||||
	struct tms	rus;
 | 
			
		||||
	clock_t		now = times(&rus);
 | 
			
		||||
	static clock_t	tmstart;
 | 
			
		||||
 | 
			
		||||
	if (usertime)		now = rus.tms_utime;
 | 
			
		||||
 | 
			
		||||
	if (stop==TM_START)	tmstart = now;
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		long int tck = sysconf(_SC_CLK_TCK);
 | 
			
		||||
		ret = (now - tmstart)/(double)tck;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	return (ret);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
#else
 | 
			
		||||
#include <sys/time.h>
 | 
			
		||||
#include <sys/resource.h>
 | 
			
		||||
 | 
			
		||||
double app_tminterval(int stop,int usertime)
 | 
			
		||||
	{
 | 
			
		||||
	double		ret = 0;
 | 
			
		||||
	struct rusage	rus;
 | 
			
		||||
	struct timeval	now;
 | 
			
		||||
	static struct timeval tmstart;
 | 
			
		||||
 | 
			
		||||
	if (usertime)		getrusage(RUSAGE_SELF,&rus), now = rus.ru_utime;
 | 
			
		||||
	else			gettimeofday(&now,NULL);
 | 
			
		||||
 | 
			
		||||
	if (stop==TM_START)	tmstart = now;
 | 
			
		||||
	else			ret = ( (now.tv_sec+now.tv_usec*1e-6)
 | 
			
		||||
					- (tmstart.tv_sec+tmstart.tv_usec*1e-6) );
 | 
			
		||||
 | 
			
		||||
	return ret;
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/* app_isdir section */
 | 
			
		||||
#ifdef _WIN32
 | 
			
		||||
int app_isdir(const char *name)
 | 
			
		||||
	{
 | 
			
		||||
	HANDLE		hList;
 | 
			
		||||
	WIN32_FIND_DATA	FileData;
 | 
			
		||||
#if defined(UNICODE) || defined(_UNICODE)
 | 
			
		||||
	size_t i, len_0 = strlen(name)+1;
 | 
			
		||||
 | 
			
		||||
	if (len_0 > sizeof(FileData.cFileName)/sizeof(FileData.cFileName[0]))
 | 
			
		||||
		return -1;
 | 
			
		||||
 | 
			
		||||
#if !defined(_WIN32_WCE) || _WIN32_WCE>=101
 | 
			
		||||
	if (!MultiByteToWideChar(CP_ACP,0,name,len_0,FileData.cFileName,len_0))
 | 
			
		||||
#endif
 | 
			
		||||
		for (i=0;i<len_0;i++)
 | 
			
		||||
			FileData.cFileName[i] = (WCHAR)name[i];
 | 
			
		||||
 | 
			
		||||
	hList = FindFirstFile(FileData.cFileName,&FileData);
 | 
			
		||||
#else
 | 
			
		||||
	hList = FindFirstFile(name,&FileData);
 | 
			
		||||
#endif
 | 
			
		||||
	if (hList == INVALID_HANDLE_VALUE)	return -1;
 | 
			
		||||
	FindClose(hList);
 | 
			
		||||
	return ((FileData.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)!=0);
 | 
			
		||||
	}
 | 
			
		||||
#else
 | 
			
		||||
#include <sys/stat.h>
 | 
			
		||||
#ifndef S_ISDIR
 | 
			
		||||
# if defined(_S_IFMT) && defined(_S_IFDIR)
 | 
			
		||||
#  define S_ISDIR(a)   (((a) & _S_IFMT) == _S_IFDIR)
 | 
			
		||||
# else 
 | 
			
		||||
#  define S_ISDIR(a)   (((a) & S_IFMT) == S_IFDIR)
 | 
			
		||||
# endif 
 | 
			
		||||
#endif 
 | 
			
		||||
 | 
			
		||||
int app_isdir(const char *name)
 | 
			
		||||
	{
 | 
			
		||||
#if defined(S_ISDIR)
 | 
			
		||||
	struct stat st;
 | 
			
		||||
 | 
			
		||||
	if (stat(name,&st)==0)	return S_ISDIR(st.st_mode);
 | 
			
		||||
	else			return -1;
 | 
			
		||||
#else
 | 
			
		||||
	return -1;
 | 
			
		||||
#endif
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/* raw_read|write section */
 | 
			
		||||
#if defined(_WIN32) && defined(STD_INPUT_HANDLE)
 | 
			
		||||
int raw_read_stdin(void *buf,int siz)
 | 
			
		||||
	{
 | 
			
		||||
	DWORD n;
 | 
			
		||||
	if (ReadFile(GetStdHandle(STD_INPUT_HANDLE),buf,siz,&n,NULL))
 | 
			
		||||
		return (n);
 | 
			
		||||
	else	return (-1);
 | 
			
		||||
	}
 | 
			
		||||
#else
 | 
			
		||||
int raw_read_stdin(void *buf,int siz)
 | 
			
		||||
	{	return read(fileno(stdin),buf,siz);	}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined(_WIN32) && defined(STD_OUTPUT_HANDLE)
 | 
			
		||||
int raw_write_stdout(const void *buf,int siz)
 | 
			
		||||
	{
 | 
			
		||||
	DWORD n;
 | 
			
		||||
	if (WriteFile(GetStdHandle(STD_OUTPUT_HANDLE),buf,siz,&n,NULL))
 | 
			
		||||
		return (n);
 | 
			
		||||
	else	return (-1);
 | 
			
		||||
	}
 | 
			
		||||
#else
 | 
			
		||||
int raw_write_stdout(const void *buf,int siz)
 | 
			
		||||
	{	return write(fileno(stdout),buf,siz);	}
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										80
									
								
								apps/apps.h
									
									
									
									
									
								
							
							
						
						
									
										80
									
								
								apps/apps.h
									
									
									
									
									
								
							@@ -137,6 +137,11 @@ long app_RAND_load_files(char *file); /* `file' is a list of files to read,
 | 
			
		||||
                                       * (see e_os.h).  The string is
 | 
			
		||||
                                       * destroyed! */
 | 
			
		||||
 | 
			
		||||
#ifdef OPENSSL_SYS_WIN32
 | 
			
		||||
#define rename(from,to) WIN32_rename((from),(to))
 | 
			
		||||
int WIN32_rename(const char *oldname,const char *newname);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef MONOLITH
 | 
			
		||||
 | 
			
		||||
#define MAIN(a,v)	main(a,v)
 | 
			
		||||
@@ -144,9 +149,11 @@ long app_RAND_load_files(char *file); /* `file' is a list of files to read,
 | 
			
		||||
#ifndef NON_MAIN
 | 
			
		||||
CONF *config=NULL;
 | 
			
		||||
BIO *bio_err=NULL;
 | 
			
		||||
int in_FIPS_mode=0;
 | 
			
		||||
#else
 | 
			
		||||
extern CONF *config;
 | 
			
		||||
extern BIO *bio_err;
 | 
			
		||||
extern int in_FIPS_mode;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#else
 | 
			
		||||
@@ -155,6 +162,7 @@ extern BIO *bio_err;
 | 
			
		||||
extern CONF *config;
 | 
			
		||||
extern char *default_config_file;
 | 
			
		||||
extern BIO *bio_err;
 | 
			
		||||
extern int in_FIPS_mode;
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
@@ -174,24 +182,54 @@ extern BIO *bio_err;
 | 
			
		||||
#  define apps_shutdown()
 | 
			
		||||
#else
 | 
			
		||||
#  ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
#    define apps_startup() \
 | 
			
		||||
			do { do_pipe_sig(); CRYPTO_malloc_init(); \
 | 
			
		||||
#    if defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_WIN16) || \
 | 
			
		||||
     defined(OPENSSL_SYS_WIN32)
 | 
			
		||||
#      ifdef _O_BINARY
 | 
			
		||||
#        define apps_startup() \
 | 
			
		||||
			do { _fmode=_O_BINARY; do_pipe_sig(); CRYPTO_malloc_init(); \
 | 
			
		||||
			ERR_load_crypto_strings(); OpenSSL_add_all_algorithms(); \
 | 
			
		||||
			ENGINE_load_builtin_engines(); setup_ui_method(); } while(0)
 | 
			
		||||
#      else
 | 
			
		||||
#        define apps_startup() \
 | 
			
		||||
			do { _fmode=O_BINARY; do_pipe_sig(); CRYPTO_malloc_init(); \
 | 
			
		||||
			ERR_load_crypto_strings(); OpenSSL_add_all_algorithms(); \
 | 
			
		||||
			ENGINE_load_builtin_engines(); setup_ui_method(); } while(0)
 | 
			
		||||
#      endif
 | 
			
		||||
#    else
 | 
			
		||||
#      define apps_startup() \
 | 
			
		||||
			do { do_pipe_sig(); OpenSSL_add_all_algorithms(); \
 | 
			
		||||
			ERR_load_crypto_strings(); ENGINE_load_builtin_engines(); \
 | 
			
		||||
			setup_ui_method(); } while(0)
 | 
			
		||||
#    endif
 | 
			
		||||
#    define apps_shutdown() \
 | 
			
		||||
			do { CONF_modules_unload(1); destroy_ui_method(); \
 | 
			
		||||
			OBJ_cleanup(); EVP_cleanup(); ENGINE_cleanup(); \
 | 
			
		||||
			CRYPTO_cleanup_all_ex_data(); ERR_remove_thread_state(NULL); \
 | 
			
		||||
			ERR_free_strings(); COMP_zlib_cleanup();} while(0)
 | 
			
		||||
			EVP_cleanup(); ENGINE_cleanup(); \
 | 
			
		||||
			CRYPTO_cleanup_all_ex_data(); ERR_remove_state(0); \
 | 
			
		||||
			ERR_free_strings(); } while(0)
 | 
			
		||||
#  else
 | 
			
		||||
#    define apps_startup() \
 | 
			
		||||
			do { do_pipe_sig(); CRYPTO_malloc_init(); \
 | 
			
		||||
#    if defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_WIN16) || \
 | 
			
		||||
     defined(OPENSSL_SYS_WIN32)
 | 
			
		||||
#      ifdef _O_BINARY
 | 
			
		||||
#        define apps_startup() \
 | 
			
		||||
			do { _fmode=_O_BINARY; do_pipe_sig(); CRYPTO_malloc_init(); \
 | 
			
		||||
			ERR_load_crypto_strings(); OpenSSL_add_all_algorithms(); \
 | 
			
		||||
			setup_ui_method(); } while(0)
 | 
			
		||||
#      else
 | 
			
		||||
#        define apps_startup() \
 | 
			
		||||
			do { _fmode=O_BINARY; do_pipe_sig(); CRYPTO_malloc_init(); \
 | 
			
		||||
			ERR_load_crypto_strings(); OpenSSL_add_all_algorithms(); \
 | 
			
		||||
			setup_ui_method(); } while(0)
 | 
			
		||||
#      endif
 | 
			
		||||
#    else
 | 
			
		||||
#      define apps_startup() \
 | 
			
		||||
			do { do_pipe_sig(); OpenSSL_add_all_algorithms(); \
 | 
			
		||||
			ERR_load_crypto_strings(); \
 | 
			
		||||
			setup_ui_method(); } while(0)
 | 
			
		||||
#    endif
 | 
			
		||||
#    define apps_shutdown() \
 | 
			
		||||
			do { CONF_modules_unload(1); destroy_ui_method(); \
 | 
			
		||||
			OBJ_cleanup(); EVP_cleanup(); \
 | 
			
		||||
			CRYPTO_cleanup_all_ex_data(); ERR_remove_thread_state(NULL); \
 | 
			
		||||
			EVP_cleanup(); \
 | 
			
		||||
			CRYPTO_cleanup_all_ex_data(); ERR_remove_state(0); \
 | 
			
		||||
			ERR_free_strings(); } while(0)
 | 
			
		||||
#  endif
 | 
			
		||||
#endif
 | 
			
		||||
@@ -202,7 +240,6 @@ extern BIO *bio_err;
 | 
			
		||||
#  define openssl_fdset(a,b) FD_SET(a, b)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
typedef struct args_st
 | 
			
		||||
	{
 | 
			
		||||
	char **data;
 | 
			
		||||
@@ -294,23 +331,13 @@ int index_index(CA_DB *db);
 | 
			
		||||
int save_index(const char *dbfile, const char *suffix, CA_DB *db);
 | 
			
		||||
int rotate_index(const char *dbfile, const char *new_suffix, const char *old_suffix);
 | 
			
		||||
void free_index(CA_DB *db);
 | 
			
		||||
#define index_name_cmp_noconst(a, b) \
 | 
			
		||||
	index_name_cmp((const CSTRING *)CHECKED_PTR_OF(STRING, a), \
 | 
			
		||||
	(const CSTRING *)CHECKED_PTR_OF(STRING, b))
 | 
			
		||||
int index_name_cmp(const CSTRING *a, const CSTRING *b);
 | 
			
		||||
int index_name_cmp(const char **a, const char **b);
 | 
			
		||||
int parse_yesno(const char *str, int def);
 | 
			
		||||
 | 
			
		||||
X509_NAME *parse_name(char *str, long chtype, int multirdn);
 | 
			
		||||
int args_verify(char ***pargs, int *pargc,
 | 
			
		||||
			int *badarg, BIO *err, X509_VERIFY_PARAM **pm);
 | 
			
		||||
void policies_print(BIO *out, X509_STORE_CTX *ctx);
 | 
			
		||||
int bio_to_mem(unsigned char **out, int maxlen, BIO *in);
 | 
			
		||||
int pkey_ctrl_string(EVP_PKEY_CTX *ctx, char *value);
 | 
			
		||||
int init_gen_str(BIO *err, EVP_PKEY_CTX **pctx,
 | 
			
		||||
			const char *algname, ENGINE *e, int do_param);
 | 
			
		||||
#ifndef OPENSSL_NO_PSK
 | 
			
		||||
extern char *psk_key;
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_JPAKE
 | 
			
		||||
void jpake_client_auth(BIO *out, BIO *conn, const char *secret);
 | 
			
		||||
void jpake_server_auth(BIO *out, BIO *conn, const char *secret);
 | 
			
		||||
@@ -326,10 +353,6 @@ void jpake_server_auth(BIO *out, BIO *conn, const char *secret);
 | 
			
		||||
#define FORMAT_ENGINE   7
 | 
			
		||||
#define FORMAT_IISSGC	8	/* XXX this stupid macro helps us to avoid
 | 
			
		||||
				 * adding yet another param to load_*key() */
 | 
			
		||||
#define FORMAT_PEMRSA	9	/* PEM RSAPubicKey format */
 | 
			
		||||
#define FORMAT_ASN1RSA	10	/* DER RSAPubicKey format */
 | 
			
		||||
#define FORMAT_MSBLOB	11	/* MS Key blob format */
 | 
			
		||||
#define FORMAT_PVK	12	/* MS PVK file format */
 | 
			
		||||
 | 
			
		||||
#define EXT_COPY_NONE	0
 | 
			
		||||
#define EXT_COPY_ADD	1
 | 
			
		||||
@@ -341,11 +364,4 @@ void jpake_server_auth(BIO *out, BIO *conn, const char *secret);
 | 
			
		||||
 | 
			
		||||
#define SERIAL_RAND_BITS	64
 | 
			
		||||
 | 
			
		||||
int app_isdir(const char *);
 | 
			
		||||
int raw_read_stdin(void *,int);
 | 
			
		||||
int raw_write_stdout(const void *,int);
 | 
			
		||||
 | 
			
		||||
#define TM_START	0
 | 
			
		||||
#define TM_STOP		1
 | 
			
		||||
double app_tminterval (int stop,int usertime);
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -96,7 +96,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	unsigned char *tmpbuf;
 | 
			
		||||
	const unsigned char *ctmpbuf;
 | 
			
		||||
	BUF_MEM *buf=NULL;
 | 
			
		||||
	STACK_OF(STRING) *osk=NULL;
 | 
			
		||||
	STACK *osk=NULL;
 | 
			
		||||
	ASN1_TYPE *at=NULL;
 | 
			
		||||
 | 
			
		||||
	informat=FORMAT_PEM;
 | 
			
		||||
@@ -113,7 +113,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	prog=argv[0];
 | 
			
		||||
	argc--;
 | 
			
		||||
	argv++;
 | 
			
		||||
	if ((osk=sk_STRING_new_null()) == NULL)
 | 
			
		||||
	if ((osk=sk_new_null()) == NULL)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_printf(bio_err,"Memory allocation failure\n");
 | 
			
		||||
		goto end;
 | 
			
		||||
@@ -169,7 +169,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
		else if (strcmp(*argv,"-strparse") == 0)
 | 
			
		||||
			{
 | 
			
		||||
			if (--argc < 1) goto bad;
 | 
			
		||||
			sk_STRING_push(osk,*(++argv));
 | 
			
		||||
			sk_push(osk,*(++argv));
 | 
			
		||||
			}
 | 
			
		||||
		else if (strcmp(*argv,"-genstr") == 0)
 | 
			
		||||
			{
 | 
			
		||||
@@ -302,18 +302,18 @@ bad:
 | 
			
		||||
 | 
			
		||||
	/* If any structs to parse go through in sequence */
 | 
			
		||||
 | 
			
		||||
	if (sk_STRING_num(osk))
 | 
			
		||||
	if (sk_num(osk))
 | 
			
		||||
		{
 | 
			
		||||
		tmpbuf=(unsigned char *)str;
 | 
			
		||||
		tmplen=num;
 | 
			
		||||
		for (i=0; i<sk_STRING_num(osk); i++)
 | 
			
		||||
		for (i=0; i<sk_num(osk); i++)
 | 
			
		||||
			{
 | 
			
		||||
			ASN1_TYPE *atmp;
 | 
			
		||||
			int typ;
 | 
			
		||||
			j=atoi(sk_STRING_value(osk,i));
 | 
			
		||||
			j=atoi(sk_value(osk,i));
 | 
			
		||||
			if (j == 0)
 | 
			
		||||
				{
 | 
			
		||||
				BIO_printf(bio_err,"'%s' is an invalid number\n",sk_STRING_value(osk,i));
 | 
			
		||||
				BIO_printf(bio_err,"'%s' is an invalid number\n",sk_value(osk,i));
 | 
			
		||||
				continue;
 | 
			
		||||
				}
 | 
			
		||||
			tmpbuf+=j;
 | 
			
		||||
@@ -378,7 +378,7 @@ end:
 | 
			
		||||
		ERR_print_errors(bio_err);
 | 
			
		||||
	if (buf != NULL) BUF_MEM_free(buf);
 | 
			
		||||
	if (at != NULL) ASN1_TYPE_free(at);
 | 
			
		||||
	if (osk != NULL) sk_STRING_free(osk);
 | 
			
		||||
	if (osk != NULL) sk_free(osk);
 | 
			
		||||
	OBJ_cleanup();
 | 
			
		||||
	apps_shutdown();
 | 
			
		||||
	OPENSSL_EXIT(ret);
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										144
									
								
								apps/ca.c
									
									
									
									
									
								
							
							
						
						
									
										144
									
								
								apps/ca.c
									
									
									
									
									
								
							@@ -63,6 +63,7 @@
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <ctype.h>
 | 
			
		||||
#include <sys/types.h>
 | 
			
		||||
#include <sys/stat.h>
 | 
			
		||||
#include <openssl/conf.h>
 | 
			
		||||
#include <openssl/bio.h>
 | 
			
		||||
#include <openssl/err.h>
 | 
			
		||||
@@ -82,7 +83,7 @@
 | 
			
		||||
#    else
 | 
			
		||||
#      include <unixlib.h>
 | 
			
		||||
#    endif
 | 
			
		||||
#  elif !defined(OPENSSL_SYS_VXWORKS) && !defined(OPENSSL_SYS_WINDOWS) && !defined(OPENSSL_SYS_NETWARE)
 | 
			
		||||
#  elif !defined(OPENSSL_SYS_VXWORKS) && !defined(OPENSSL_SYS_WINDOWS) && !defined(OPENSSL_SYS_NETWARE) && !defined(__TANDEM)
 | 
			
		||||
#    include <sys/file.h>
 | 
			
		||||
#  endif
 | 
			
		||||
#endif
 | 
			
		||||
@@ -226,7 +227,7 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509, const EVP_MD *dgst,
 | 
			
		||||
static int do_revoke(X509 *x509, CA_DB *db, int ext, char *extval);
 | 
			
		||||
static int get_certificate_status(const char *ser_status, CA_DB *db);
 | 
			
		||||
static int do_updatedb(CA_DB *db);
 | 
			
		||||
static int check_time_format(const char *str);
 | 
			
		||||
static int check_time_format(char *str);
 | 
			
		||||
char *make_revocation_str(int rev_type, char *rev_arg);
 | 
			
		||||
int make_revoked(X509_REVOKED *rev, const char *str);
 | 
			
		||||
int old_entry_print(BIO *bp, ASN1_OBJECT *obj, ASN1_STRING *str);
 | 
			
		||||
@@ -258,7 +259,6 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	int doupdatedb=0;
 | 
			
		||||
	long crldays=0;
 | 
			
		||||
	long crlhours=0;
 | 
			
		||||
	long crlsec=0;
 | 
			
		||||
	long errorline= -1;
 | 
			
		||||
	char *configfile=NULL;
 | 
			
		||||
	char *md=NULL;
 | 
			
		||||
@@ -306,8 +306,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	ASN1_TIME *tmptm;
 | 
			
		||||
	ASN1_INTEGER *tmpser;
 | 
			
		||||
	char *f;
 | 
			
		||||
	const char *p;
 | 
			
		||||
	char * const *pp;
 | 
			
		||||
	const char *p, **pp;
 | 
			
		||||
	int i,j;
 | 
			
		||||
	const EVP_MD *dgst=NULL;
 | 
			
		||||
	STACK_OF(CONF_VALUE) *attribs=NULL;
 | 
			
		||||
@@ -458,11 +457,6 @@ EF_ALIGNMENT=0;
 | 
			
		||||
			if (--argc < 1) goto bad;
 | 
			
		||||
			crlhours= atol(*(++argv));
 | 
			
		||||
			}
 | 
			
		||||
		else if (strcmp(*argv,"-crlsec") == 0)
 | 
			
		||||
			{
 | 
			
		||||
			if (--argc < 1) goto bad;
 | 
			
		||||
			crlsec = atol(*(++argv));
 | 
			
		||||
			}
 | 
			
		||||
		else if (strcmp(*argv,"-infiles") == 0)
 | 
			
		||||
			{
 | 
			
		||||
			argc--;
 | 
			
		||||
@@ -556,10 +550,8 @@ bad:
 | 
			
		||||
 | 
			
		||||
	if (badops)
 | 
			
		||||
		{
 | 
			
		||||
		const char **pp2;
 | 
			
		||||
 | 
			
		||||
		for (pp2=ca_usage; (*pp2 != NULL); pp2++)
 | 
			
		||||
			BIO_printf(bio_err,"%s",*pp2);
 | 
			
		||||
		for (pp=ca_usage; (*pp != NULL); pp++)
 | 
			
		||||
			BIO_printf(bio_err,"%s",*pp);
 | 
			
		||||
		goto err;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@@ -834,6 +826,7 @@ bad:
 | 
			
		||||
	/* lookup where to write new certificates */
 | 
			
		||||
	if ((outdir == NULL) && (req))
 | 
			
		||||
		{
 | 
			
		||||
		struct stat sb;
 | 
			
		||||
 | 
			
		||||
		if ((outdir=NCONF_get_string(conf,section,ENV_NEW_CERTS_DIR))
 | 
			
		||||
			== NULL)
 | 
			
		||||
@@ -852,23 +845,27 @@ bad:
 | 
			
		||||
	       that to access().  However, time's too short to do that just
 | 
			
		||||
	       now.
 | 
			
		||||
	    */
 | 
			
		||||
#ifndef _WIN32
 | 
			
		||||
		if (access(outdir,R_OK|W_OK|X_OK) != 0)
 | 
			
		||||
#else
 | 
			
		||||
		if (_access(outdir,R_OK|W_OK|X_OK) != 0)
 | 
			
		||||
#endif
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bio_err,"I am unable to access the %s directory\n",outdir);
 | 
			
		||||
			perror(outdir);
 | 
			
		||||
			goto err;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		if (app_isdir(outdir)<=0)
 | 
			
		||||
		if (stat(outdir,&sb) != 0)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bio_err,"unable to stat(%s)\n",outdir);
 | 
			
		||||
			perror(outdir);
 | 
			
		||||
			goto err;
 | 
			
		||||
			}
 | 
			
		||||
#ifdef S_IFDIR
 | 
			
		||||
		if (!(sb.st_mode & S_IFDIR))
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bio_err,"%s need to be a directory\n",outdir);
 | 
			
		||||
			perror(outdir);
 | 
			
		||||
			goto err;
 | 
			
		||||
			}
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@@ -883,9 +880,9 @@ bad:
 | 
			
		||||
	if (db == NULL) goto err;
 | 
			
		||||
 | 
			
		||||
	/* Lets check some fields */
 | 
			
		||||
	for (i=0; i<sk_PSTRING_num(db->db->data); i++)
 | 
			
		||||
	for (i=0; i<sk_num(db->db->data); i++)
 | 
			
		||||
		{
 | 
			
		||||
		pp=sk_PSTRING_value(db->db->data,i);
 | 
			
		||||
		pp=(const char **)sk_value(db->db->data,i);
 | 
			
		||||
		if ((pp[DB_type][0] != DB_TYPE_REV) &&
 | 
			
		||||
			(pp[DB_rev_date][0] != '\0'))
 | 
			
		||||
			{
 | 
			
		||||
@@ -938,7 +935,7 @@ bad:
 | 
			
		||||
#endif
 | 
			
		||||
		TXT_DB_write(out,db->db);
 | 
			
		||||
		BIO_printf(bio_err,"%d entries loaded from the database\n",
 | 
			
		||||
			   sk_PSTRING_num(db->db->data));
 | 
			
		||||
			db->db->data->num);
 | 
			
		||||
		BIO_printf(bio_err,"generating index\n");
 | 
			
		||||
		}
 | 
			
		||||
	
 | 
			
		||||
@@ -1029,17 +1026,6 @@ bad:
 | 
			
		||||
		goto err;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (!strcmp(md, "default"))
 | 
			
		||||
		{
 | 
			
		||||
		int def_nid;
 | 
			
		||||
		if (EVP_PKEY_get_default_digest_nid(pkey, &def_nid) <= 0)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_puts(bio_err,"no default digest\n");
 | 
			
		||||
			goto err;
 | 
			
		||||
			}
 | 
			
		||||
		md = (char *)OBJ_nid2sn(def_nid);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if ((dgst=EVP_get_digestbyname(md)) == NULL)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_printf(bio_err,"%s is an unsupported message digest type\n",md);
 | 
			
		||||
@@ -1109,9 +1095,9 @@ bad:
 | 
			
		||||
			if (startdate == NULL)
 | 
			
		||||
				ERR_clear_error();
 | 
			
		||||
			}
 | 
			
		||||
		if (startdate && !ASN1_TIME_set_string(NULL, startdate))
 | 
			
		||||
		if (startdate && !ASN1_UTCTIME_set_string(NULL,startdate))
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bio_err,"start date is invalid, it should be YYMMDDHHMMSSZ or YYYYMMDDHHMMSSZ\n");
 | 
			
		||||
			BIO_printf(bio_err,"start date is invalid, it should be YYMMDDHHMMSSZ\n");
 | 
			
		||||
			goto err;
 | 
			
		||||
			}
 | 
			
		||||
		if (startdate == NULL) startdate="today";
 | 
			
		||||
@@ -1123,9 +1109,9 @@ bad:
 | 
			
		||||
			if (enddate == NULL)
 | 
			
		||||
				ERR_clear_error();
 | 
			
		||||
			}
 | 
			
		||||
		if (enddate && !ASN1_TIME_set_string(NULL, enddate))
 | 
			
		||||
		if (enddate && !ASN1_UTCTIME_set_string(NULL,enddate))
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bio_err,"end date is invalid, it should be YYMMDDHHMMSSZ or YYYYMMDDHHMMSSZ\n");
 | 
			
		||||
			BIO_printf(bio_err,"end date is invalid, it should be YYMMDDHHMMSSZ\n");
 | 
			
		||||
			goto err;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
@@ -1380,7 +1366,7 @@ bad:
 | 
			
		||||
				goto err;
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
		if (!crldays && !crlhours && !crlsec)
 | 
			
		||||
		if (!crldays && !crlhours)
 | 
			
		||||
			{
 | 
			
		||||
			if (!NCONF_get_number(conf,section,
 | 
			
		||||
				ENV_DEFAULT_CRL_DAYS, &crldays))
 | 
			
		||||
@@ -1389,7 +1375,7 @@ bad:
 | 
			
		||||
				ENV_DEFAULT_CRL_HOURS, &crlhours))
 | 
			
		||||
				crlhours = 0;
 | 
			
		||||
			}
 | 
			
		||||
		if ((crldays == 0) && (crlhours == 0) && (crlsec == 0))
 | 
			
		||||
		if ((crldays == 0) && (crlhours == 0))
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bio_err,"cannot lookup how long until the next CRL is issued\n");
 | 
			
		||||
			goto err;
 | 
			
		||||
@@ -1403,14 +1389,14 @@ bad:
 | 
			
		||||
		if (!tmptm) goto err;
 | 
			
		||||
		X509_gmtime_adj(tmptm,0);
 | 
			
		||||
		X509_CRL_set_lastUpdate(crl, tmptm);	
 | 
			
		||||
		X509_time_adj_ex(tmptm, crldays, crlhours*60*60 + crlsec, NULL);
 | 
			
		||||
		X509_gmtime_adj(tmptm,(crldays*24+crlhours)*60*60);
 | 
			
		||||
		X509_CRL_set_nextUpdate(crl, tmptm);	
 | 
			
		||||
 | 
			
		||||
		ASN1_TIME_free(tmptm);
 | 
			
		||||
 | 
			
		||||
		for (i=0; i<sk_PSTRING_num(db->db->data); i++)
 | 
			
		||||
		for (i=0; i<sk_num(db->db->data); i++)
 | 
			
		||||
			{
 | 
			
		||||
			pp=sk_PSTRING_value(db->db->data,i);
 | 
			
		||||
			pp=(const char **)sk_value(db->db->data,i);
 | 
			
		||||
			if (pp[DB_type][0] == DB_TYPE_REV)
 | 
			
		||||
				{
 | 
			
		||||
				if ((r=X509_REVOKED_new()) == NULL) goto err;
 | 
			
		||||
@@ -1436,6 +1422,15 @@ bad:
 | 
			
		||||
 | 
			
		||||
		/* we now have a CRL */
 | 
			
		||||
		if (verbose) BIO_printf(bio_err,"signing CRL\n");
 | 
			
		||||
#ifndef OPENSSL_NO_DSA
 | 
			
		||||
		if (pkey->type == EVP_PKEY_DSA) 
 | 
			
		||||
			dgst=EVP_dss1();
 | 
			
		||||
		else
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_ECDSA
 | 
			
		||||
		if (pkey->type == EVP_PKEY_EC)
 | 
			
		||||
			dgst=EVP_ecdsa();
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
		/* Add any extensions asked for */
 | 
			
		||||
 | 
			
		||||
@@ -1468,12 +1463,6 @@ bad:
 | 
			
		||||
		if (crlnumberfile != NULL)	/* we have a CRL number that need updating */
 | 
			
		||||
			if (!save_serial(crlnumberfile,"new",crlnumber,NULL)) goto err;
 | 
			
		||||
 | 
			
		||||
		if (crlnumber)
 | 
			
		||||
			{
 | 
			
		||||
			BN_free(crlnumber);
 | 
			
		||||
			crlnumber = NULL;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		if (!X509_CRL_sign(crl,pkey,dgst)) goto err;
 | 
			
		||||
 | 
			
		||||
		PEM_write_bio_X509_CRL(Sout,crl);
 | 
			
		||||
@@ -1526,7 +1515,6 @@ err:
 | 
			
		||||
	if (free_key && key)
 | 
			
		||||
		OPENSSL_free(key);
 | 
			
		||||
	BN_free(serial);
 | 
			
		||||
	BN_free(crlnumber);
 | 
			
		||||
	free_index(db);
 | 
			
		||||
	EVP_PKEY_free(pkey);
 | 
			
		||||
	if (x509) X509_free(x509);
 | 
			
		||||
@@ -1685,9 +1673,7 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509, const EVP_MD *dgst,
 | 
			
		||||
	int ok= -1,i,j,last,nid;
 | 
			
		||||
	const char *p;
 | 
			
		||||
	CONF_VALUE *cv;
 | 
			
		||||
	STRING row[DB_NUMBER];
 | 
			
		||||
	STRING *irow=NULL;
 | 
			
		||||
	STRING *rrow=NULL;
 | 
			
		||||
	char *row[DB_NUMBER],**rrow=NULL,**irow=NULL;
 | 
			
		||||
	char buf[25];
 | 
			
		||||
 | 
			
		||||
	tmptm=ASN1_UTCTIME_new();
 | 
			
		||||
@@ -1929,9 +1915,7 @@ again2:
 | 
			
		||||
 | 
			
		||||
	if (db->attributes.unique_subject)
 | 
			
		||||
		{
 | 
			
		||||
		STRING *crow=row;
 | 
			
		||||
 | 
			
		||||
		rrow=TXT_DB_get_by_index(db->db,DB_name,crow);
 | 
			
		||||
		rrow=TXT_DB_get_by_index(db->db,DB_name,row);
 | 
			
		||||
		if (rrow != NULL)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bio_err,
 | 
			
		||||
@@ -2007,11 +1991,11 @@ again2:
 | 
			
		||||
 | 
			
		||||
	if (strcmp(startdate,"today") == 0)
 | 
			
		||||
		X509_gmtime_adj(X509_get_notBefore(ret),0);
 | 
			
		||||
	else ASN1_TIME_set_string(X509_get_notBefore(ret),startdate);
 | 
			
		||||
	else ASN1_UTCTIME_set_string(X509_get_notBefore(ret),startdate);
 | 
			
		||||
 | 
			
		||||
	if (enddate == NULL)
 | 
			
		||||
		X509_time_adj_ex(X509_get_notAfter(ret),days, 0, NULL);
 | 
			
		||||
	else ASN1_TIME_set_string(X509_get_notAfter(ret),enddate);
 | 
			
		||||
		X509_gmtime_adj(X509_get_notAfter(ret),(long)60*60*24*days);
 | 
			
		||||
	else ASN1_UTCTIME_set_string(X509_get_notAfter(ret),enddate);
 | 
			
		||||
 | 
			
		||||
	if (!X509_set_subject_name(ret,subject)) goto err;
 | 
			
		||||
 | 
			
		||||
@@ -2107,7 +2091,7 @@ again2:
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	BIO_printf(bio_err,"Certificate is to be certified until ");
 | 
			
		||||
	ASN1_TIME_print(bio_err,X509_get_notAfter(ret));
 | 
			
		||||
	ASN1_UTCTIME_print(bio_err,X509_get_notAfter(ret));
 | 
			
		||||
	if (days) BIO_printf(bio_err," (%ld days)",days);
 | 
			
		||||
	BIO_printf(bio_err, "\n");
 | 
			
		||||
 | 
			
		||||
@@ -2126,11 +2110,25 @@ again2:
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_DSA
 | 
			
		||||
	if (pkey->type == EVP_PKEY_DSA) dgst=EVP_dss1();
 | 
			
		||||
	pktmp=X509_get_pubkey(ret);
 | 
			
		||||
	if (EVP_PKEY_missing_parameters(pktmp) &&
 | 
			
		||||
		!EVP_PKEY_missing_parameters(pkey))
 | 
			
		||||
		EVP_PKEY_copy_parameters(pktmp,pkey);
 | 
			
		||||
	EVP_PKEY_free(pktmp);
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_ECDSA
 | 
			
		||||
	if (pkey->type == EVP_PKEY_EC)
 | 
			
		||||
		dgst = EVP_ecdsa();
 | 
			
		||||
	pktmp = X509_get_pubkey(ret);
 | 
			
		||||
	if (EVP_PKEY_missing_parameters(pktmp) &&
 | 
			
		||||
		!EVP_PKEY_missing_parameters(pkey))
 | 
			
		||||
		EVP_PKEY_copy_parameters(pktmp, pkey);
 | 
			
		||||
	EVP_PKEY_free(pktmp);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	if (!X509_sign(ret,pkey,dgst))
 | 
			
		||||
		goto err;
 | 
			
		||||
@@ -2232,7 +2230,7 @@ static int certify_spkac(X509 **xret, char *infile, EVP_PKEY *pkey, X509 *x509,
 | 
			
		||||
	     unsigned long nameopt, int default_op, int ext_copy)
 | 
			
		||||
	{
 | 
			
		||||
	STACK_OF(CONF_VALUE) *sk=NULL;
 | 
			
		||||
	LHASH_OF(CONF_VALUE) *parms=NULL;
 | 
			
		||||
	LHASH *parms=NULL;
 | 
			
		||||
	X509_REQ *req=NULL;
 | 
			
		||||
	CONF_VALUE *cv=NULL;
 | 
			
		||||
	NETSCAPE_SPKI *spki = NULL;
 | 
			
		||||
@@ -2395,9 +2393,14 @@ static int fix_data(int nid, int *type)
 | 
			
		||||
	return(1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static int check_time_format(const char *str)
 | 
			
		||||
static int check_time_format(char *str)
 | 
			
		||||
	{
 | 
			
		||||
	return ASN1_TIME_set_string(NULL, str);
 | 
			
		||||
	ASN1_UTCTIME tm;
 | 
			
		||||
 | 
			
		||||
	tm.data=(unsigned char *)str;
 | 
			
		||||
	tm.length=strlen(str);
 | 
			
		||||
	tm.type=V_ASN1_UTCTIME;
 | 
			
		||||
	return(ASN1_UTCTIME_check(&tm));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static int do_revoke(X509 *x509, CA_DB *db, int type, char *value)
 | 
			
		||||
@@ -2412,8 +2415,6 @@ static int do_revoke(X509 *x509, CA_DB *db, int type, char *value)
 | 
			
		||||
		row[i]=NULL;
 | 
			
		||||
	row[DB_name]=X509_NAME_oneline(X509_get_subject_name(x509),NULL,0);
 | 
			
		||||
	bn = ASN1_INTEGER_to_BN(X509_get_serialNumber(x509),NULL);
 | 
			
		||||
	if (!bn)
 | 
			
		||||
		goto err;
 | 
			
		||||
	if (BN_is_zero(bn))
 | 
			
		||||
		row[DB_serial]=BUF_strdup("00");
 | 
			
		||||
	else
 | 
			
		||||
@@ -2483,7 +2484,7 @@ static int do_revoke(X509 *x509, CA_DB *db, int type, char *value)
 | 
			
		||||
		goto err;
 | 
			
		||||
 | 
			
		||||
		}
 | 
			
		||||
	else if (index_name_cmp_noconst(row, rrow))
 | 
			
		||||
	else if (index_name_cmp((const char **)row,(const char **)rrow))
 | 
			
		||||
		{
 | 
			
		||||
		BIO_printf(bio_err,"ERROR:name does not match %s\n",
 | 
			
		||||
			   row[DB_name]);
 | 
			
		||||
@@ -2632,9 +2633,9 @@ static int do_updatedb (CA_DB *db)
 | 
			
		||||
	else
 | 
			
		||||
		a_y2k = 0;
 | 
			
		||||
 | 
			
		||||
	for (i = 0; i < sk_PSTRING_num(db->db->data); i++)
 | 
			
		||||
	for (i = 0; i < sk_num(db->db->data); i++)
 | 
			
		||||
		{
 | 
			
		||||
		rrow = sk_PSTRING_value(db->db->data, i);
 | 
			
		||||
		rrow = (char **) sk_value(db->db->data, i);
 | 
			
		||||
 | 
			
		||||
		if (rrow[DB_type][0] == 'V')
 | 
			
		||||
		 	{
 | 
			
		||||
@@ -2881,13 +2882,22 @@ int old_entry_print(BIO *bp, ASN1_OBJECT *obj, ASN1_STRING *str)
 | 
			
		||||
	p=(char *)str->data;
 | 
			
		||||
	for (j=str->length; j>0; j--)
 | 
			
		||||
		{
 | 
			
		||||
#ifdef CHARSET_EBCDIC
 | 
			
		||||
		if ((*p >= 0x20) && (*p <= 0x7e))
 | 
			
		||||
			BIO_printf(bp,"%c",os_toebcdic[*p]);
 | 
			
		||||
#else
 | 
			
		||||
		if ((*p >= ' ') && (*p <= '~'))
 | 
			
		||||
			BIO_printf(bp,"%c",*p);
 | 
			
		||||
#endif
 | 
			
		||||
		else if (*p & 0x80)
 | 
			
		||||
			BIO_printf(bp,"\\0x%02X",*p);
 | 
			
		||||
		else if ((unsigned char)*p == 0xf7)
 | 
			
		||||
			BIO_printf(bp,"^?");
 | 
			
		||||
#ifdef CHARSET_EBCDIC
 | 
			
		||||
		else	BIO_printf(bp,"^%c",os_toebcdic[*p+0x40]);
 | 
			
		||||
#else
 | 
			
		||||
		else	BIO_printf(bp,"^%c",*p+'@');
 | 
			
		||||
#endif
 | 
			
		||||
		p++;
 | 
			
		||||
		}
 | 
			
		||||
	BIO_printf(bp,"'\n");
 | 
			
		||||
 
 | 
			
		||||
@@ -71,8 +71,7 @@
 | 
			
		||||
 | 
			
		||||
static const char *ciphers_usage[]={
 | 
			
		||||
"usage: ciphers args\n",
 | 
			
		||||
" -v          - verbose mode, a textual listing of the SSL/TLS ciphers in OpenSSL\n",
 | 
			
		||||
" -V          - even more verbose\n",
 | 
			
		||||
" -v          - verbose mode, a textual listing of the ciphers in SSLeay\n",
 | 
			
		||||
" -ssl2       - SSL2 mode\n",
 | 
			
		||||
" -ssl3       - SSL3 mode\n",
 | 
			
		||||
" -tls1       - TLS1 mode\n",
 | 
			
		||||
@@ -84,14 +83,14 @@ int MAIN(int, char **);
 | 
			
		||||
int MAIN(int argc, char **argv)
 | 
			
		||||
	{
 | 
			
		||||
	int ret=1,i;
 | 
			
		||||
	int verbose=0,Verbose=0;
 | 
			
		||||
	int verbose=0;
 | 
			
		||||
	const char **pp;
 | 
			
		||||
	const char *p;
 | 
			
		||||
	int badops=0;
 | 
			
		||||
	SSL_CTX *ctx=NULL;
 | 
			
		||||
	SSL *ssl=NULL;
 | 
			
		||||
	char *ciphers=NULL;
 | 
			
		||||
	const SSL_METHOD *meth=NULL;
 | 
			
		||||
	SSL_METHOD *meth=NULL;
 | 
			
		||||
	STACK_OF(SSL_CIPHER) *sk;
 | 
			
		||||
	char buf[512];
 | 
			
		||||
	BIO *STDout=NULL;
 | 
			
		||||
@@ -115,8 +114,6 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	STDout = BIO_push(tmpbio, STDout);
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
	if (!load_config(bio_err, NULL))
 | 
			
		||||
		goto end;
 | 
			
		||||
 | 
			
		||||
	argc--;
 | 
			
		||||
	argv++;
 | 
			
		||||
@@ -124,8 +121,6 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
		{
 | 
			
		||||
		if (strcmp(*argv,"-v") == 0)
 | 
			
		||||
			verbose=1;
 | 
			
		||||
		else if (strcmp(*argv,"-V") == 0)
 | 
			
		||||
			verbose=Verbose=1;
 | 
			
		||||
#ifndef OPENSSL_NO_SSL2
 | 
			
		||||
		else if (strcmp(*argv,"-ssl2") == 0)
 | 
			
		||||
			meth=SSLv2_client_method();
 | 
			
		||||
@@ -184,33 +179,15 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
			}
 | 
			
		||||
		BIO_printf(STDout,"\n");
 | 
			
		||||
		}
 | 
			
		||||
	else /* verbose */
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		sk=SSL_get_ciphers(ssl);
 | 
			
		||||
 | 
			
		||||
		for (i=0; i<sk_SSL_CIPHER_num(sk); i++)
 | 
			
		||||
			{
 | 
			
		||||
			SSL_CIPHER *c;
 | 
			
		||||
 | 
			
		||||
			c = sk_SSL_CIPHER_value(sk,i);
 | 
			
		||||
			
 | 
			
		||||
			if (Verbose)
 | 
			
		||||
				{
 | 
			
		||||
				unsigned long id = c->id;
 | 
			
		||||
				int id0 = (int)(id >> 24);
 | 
			
		||||
				int id1 = (int)((id >> 16) & 0xffL);
 | 
			
		||||
				int id2 = (int)((id >> 8) & 0xffL);
 | 
			
		||||
				int id3 = (int)(id & 0xffL);
 | 
			
		||||
				
 | 
			
		||||
				if ((id & 0xff000000L) == 0x02000000L)
 | 
			
		||||
					BIO_printf(STDout, "     0x%02X,0x%02X,0x%02X - ", id1, id2, id3); /* SSL2 cipher */
 | 
			
		||||
				else if ((id & 0xff000000L) == 0x03000000L)
 | 
			
		||||
					BIO_printf(STDout, "          0x%02X,0x%02X - ", id2, id3); /* SSL3 cipher */
 | 
			
		||||
				else
 | 
			
		||||
					BIO_printf(STDout, "0x%02X,0x%02X,0x%02X,0x%02X - ", id0, id1, id2, id3); /* whatever */
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
			BIO_puts(STDout,SSL_CIPHER_description(c,buf,sizeof buf));
 | 
			
		||||
			BIO_puts(STDout,SSL_CIPHER_description(
 | 
			
		||||
				sk_SSL_CIPHER_value(sk,i),
 | 
			
		||||
				buf,sizeof buf));
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										109
									
								
								apps/cms.c
									
									
									
									
									
								
							
							
						
						
									
										109
									
								
								apps/cms.c
									
									
									
									
									
								
							@@ -71,9 +71,8 @@
 | 
			
		||||
static int save_certs(char *signerfile, STACK_OF(X509) *signers);
 | 
			
		||||
static int cms_cb(int ok, X509_STORE_CTX *ctx);
 | 
			
		||||
static void receipt_request_print(BIO *out, CMS_ContentInfo *cms);
 | 
			
		||||
static CMS_ReceiptRequest *make_receipt_request(STACK_OF(STRING) *rr_to,
 | 
			
		||||
						int rr_allorfirst,
 | 
			
		||||
						STACK_OF(STRING) *rr_from);
 | 
			
		||||
static CMS_ReceiptRequest *make_receipt_request(STACK *rr_to, int rr_allorfirst,
 | 
			
		||||
								STACK *rr_from);
 | 
			
		||||
 | 
			
		||||
#define SMIME_OP	0x10
 | 
			
		||||
#define SMIME_IP	0x20
 | 
			
		||||
@@ -95,8 +94,6 @@ static CMS_ReceiptRequest *make_receipt_request(STACK_OF(STRING) *rr_to,
 | 
			
		||||
#define SMIME_SIGN_RECEIPT	(15 | SMIME_IP | SMIME_OP)
 | 
			
		||||
#define SMIME_VERIFY_RECEIPT	(16 | SMIME_IP)
 | 
			
		||||
 | 
			
		||||
int verify_err = 0;
 | 
			
		||||
 | 
			
		||||
int MAIN(int, char **);
 | 
			
		||||
 | 
			
		||||
int MAIN(int argc, char **argv)
 | 
			
		||||
@@ -108,7 +105,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	const char *inmode = "r", *outmode = "w";
 | 
			
		||||
	char *infile = NULL, *outfile = NULL, *rctfile = NULL;
 | 
			
		||||
	char *signerfile = NULL, *recipfile = NULL;
 | 
			
		||||
	STACK_OF(STRING) *sksigners = NULL, *skkeys = NULL;
 | 
			
		||||
	STACK *sksigners = NULL, *skkeys = NULL;
 | 
			
		||||
	char *certfile = NULL, *keyfile = NULL, *contfile=NULL;
 | 
			
		||||
	char *certsoutfile = NULL;
 | 
			
		||||
	const EVP_CIPHER *cipher = NULL;
 | 
			
		||||
@@ -119,10 +116,9 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	STACK_OF(X509) *encerts = NULL, *other = NULL;
 | 
			
		||||
	BIO *in = NULL, *out = NULL, *indata = NULL, *rctin = NULL;
 | 
			
		||||
	int badarg = 0;
 | 
			
		||||
	int flags = CMS_DETACHED, noout = 0, print = 0;
 | 
			
		||||
	int verify_retcode = 0;
 | 
			
		||||
	int flags = CMS_DETACHED;
 | 
			
		||||
	int rr_print = 0, rr_allorfirst = -1;
 | 
			
		||||
	STACK_OF(STRING) *rr_to = NULL, *rr_from = NULL;
 | 
			
		||||
	STACK *rr_to = NULL, *rr_from = NULL;
 | 
			
		||||
	CMS_ReceiptRequest *rr = NULL;
 | 
			
		||||
	char *to = NULL, *from = NULL, *subject = NULL;
 | 
			
		||||
	char *CAfile = NULL, *CApath = NULL;
 | 
			
		||||
@@ -170,8 +166,6 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
			operation = SMIME_RESIGN;
 | 
			
		||||
		else if (!strcmp (*args, "-verify"))
 | 
			
		||||
			operation = SMIME_VERIFY;
 | 
			
		||||
		else if (!strcmp (*args, "-verify_retcode"))
 | 
			
		||||
			verify_retcode = 1;
 | 
			
		||||
		else if (!strcmp(*args,"-verify_receipt"))
 | 
			
		||||
			{
 | 
			
		||||
			operation = SMIME_VERIFY_RECEIPT;
 | 
			
		||||
@@ -258,17 +252,21 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
		else if (!strcmp (*args, "-no_attr_verify"))
 | 
			
		||||
				flags |= CMS_NO_ATTR_VERIFY;
 | 
			
		||||
		else if (!strcmp (*args, "-stream"))
 | 
			
		||||
				flags |= CMS_STREAM;
 | 
			
		||||
				{
 | 
			
		||||
				args++;
 | 
			
		||||
				continue;
 | 
			
		||||
				}
 | 
			
		||||
		else if (!strcmp (*args, "-indef"))
 | 
			
		||||
				flags |= CMS_STREAM;
 | 
			
		||||
				{
 | 
			
		||||
				args++;
 | 
			
		||||
				continue;
 | 
			
		||||
				}
 | 
			
		||||
		else if (!strcmp (*args, "-noindef"))
 | 
			
		||||
				flags &= ~CMS_STREAM;
 | 
			
		||||
		else if (!strcmp (*args, "-nooldmime"))
 | 
			
		||||
				flags |= CMS_NOOLDMIMETYPE;
 | 
			
		||||
		else if (!strcmp (*args, "-crlfeol"))
 | 
			
		||||
				flags |= CMS_CRLFEOL;
 | 
			
		||||
		else if (!strcmp (*args, "-noout"))
 | 
			
		||||
				noout = 1;
 | 
			
		||||
		else if (!strcmp (*args, "-receipt_request_print"))
 | 
			
		||||
				rr_print = 1;
 | 
			
		||||
		else if (!strcmp (*args, "-receipt_request_all"))
 | 
			
		||||
@@ -281,8 +279,8 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
				goto argerr;
 | 
			
		||||
			args++;
 | 
			
		||||
			if (!rr_from)
 | 
			
		||||
				rr_from = sk_STRING_new_null();
 | 
			
		||||
			sk_STRING_push(rr_from, *args);
 | 
			
		||||
				rr_from = sk_new_null();
 | 
			
		||||
			sk_push(rr_from, *args);
 | 
			
		||||
			}
 | 
			
		||||
		else if (!strcmp(*args,"-receipt_request_to"))
 | 
			
		||||
			{
 | 
			
		||||
@@ -290,14 +288,9 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
				goto argerr;
 | 
			
		||||
			args++;
 | 
			
		||||
			if (!rr_to)
 | 
			
		||||
				rr_to = sk_STRING_new_null();
 | 
			
		||||
			sk_STRING_push(rr_to, *args);
 | 
			
		||||
				rr_to = sk_new_null();
 | 
			
		||||
			sk_push(rr_to, *args);
 | 
			
		||||
			}
 | 
			
		||||
		else if (!strcmp (*args, "-print"))
 | 
			
		||||
				{
 | 
			
		||||
				noout = 1;
 | 
			
		||||
				print = 1;
 | 
			
		||||
				}
 | 
			
		||||
		else if (!strcmp(*args,"-secretkey"))
 | 
			
		||||
			{
 | 
			
		||||
			long ltmp;
 | 
			
		||||
@@ -387,13 +380,13 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
			if (signerfile)
 | 
			
		||||
				{
 | 
			
		||||
				if (!sksigners)
 | 
			
		||||
					sksigners = sk_STRING_new_null();
 | 
			
		||||
				sk_STRING_push(sksigners, signerfile);
 | 
			
		||||
					sksigners = sk_new_null();
 | 
			
		||||
				sk_push(sksigners, signerfile);
 | 
			
		||||
				if (!keyfile)
 | 
			
		||||
					keyfile = signerfile;
 | 
			
		||||
				if (!skkeys)
 | 
			
		||||
					skkeys = sk_STRING_new_null();
 | 
			
		||||
				sk_STRING_push(skkeys, keyfile);
 | 
			
		||||
					skkeys = sk_new_null();
 | 
			
		||||
				sk_push(skkeys, keyfile);
 | 
			
		||||
				keyfile = NULL;
 | 
			
		||||
				}
 | 
			
		||||
			signerfile = *++args;
 | 
			
		||||
@@ -435,12 +428,12 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
					goto argerr;
 | 
			
		||||
					}
 | 
			
		||||
				if (!sksigners)
 | 
			
		||||
					sksigners = sk_STRING_new_null();
 | 
			
		||||
				sk_STRING_push(sksigners, signerfile);
 | 
			
		||||
					sksigners = sk_new_null();
 | 
			
		||||
				sk_push(sksigners, signerfile);
 | 
			
		||||
				signerfile = NULL;
 | 
			
		||||
				if (!skkeys)
 | 
			
		||||
					skkeys = sk_STRING_new_null();
 | 
			
		||||
				sk_STRING_push(skkeys, keyfile);
 | 
			
		||||
					skkeys = sk_new_null();
 | 
			
		||||
				sk_push(skkeys, keyfile);
 | 
			
		||||
				}
 | 
			
		||||
			keyfile = *++args;
 | 
			
		||||
			}
 | 
			
		||||
@@ -539,13 +532,13 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
		if (signerfile)
 | 
			
		||||
			{
 | 
			
		||||
			if (!sksigners)
 | 
			
		||||
				sksigners = sk_STRING_new_null();
 | 
			
		||||
			sk_STRING_push(sksigners, signerfile);
 | 
			
		||||
				sksigners = sk_new_null();
 | 
			
		||||
			sk_push(sksigners, signerfile);
 | 
			
		||||
			if (!skkeys)
 | 
			
		||||
				skkeys = sk_STRING_new_null();
 | 
			
		||||
				skkeys = sk_new_null();
 | 
			
		||||
			if (!keyfile)
 | 
			
		||||
				keyfile = signerfile;
 | 
			
		||||
			sk_STRING_push(skkeys, keyfile);
 | 
			
		||||
			sk_push(skkeys, keyfile);
 | 
			
		||||
			}
 | 
			
		||||
		if (!sksigners)
 | 
			
		||||
			{
 | 
			
		||||
@@ -980,11 +973,11 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
			}
 | 
			
		||||
		else
 | 
			
		||||
			flags |= CMS_REUSE_DIGEST;
 | 
			
		||||
		for (i = 0; i < sk_STRING_num(sksigners); i++)
 | 
			
		||||
		for (i = 0; i < sk_num(sksigners); i++)
 | 
			
		||||
			{
 | 
			
		||||
			CMS_SignerInfo *si;
 | 
			
		||||
			signerfile = sk_STRING_value(sksigners, i);
 | 
			
		||||
			keyfile = sk_STRING_value(skkeys, i);
 | 
			
		||||
			signerfile = sk_value(sksigners, i);
 | 
			
		||||
			keyfile = sk_value(skkeys, i);
 | 
			
		||||
			signer = load_cert(bio_err, signerfile,FORMAT_PEM, NULL,
 | 
			
		||||
					e, "signer certificate");
 | 
			
		||||
			if (!signer)
 | 
			
		||||
@@ -1082,8 +1075,6 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
		else
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bio_err, "Verification failure\n");
 | 
			
		||||
			if (verify_retcode)
 | 
			
		||||
				ret = verify_err + 32;
 | 
			
		||||
			goto end;
 | 
			
		||||
			}
 | 
			
		||||
		if (signerfile)
 | 
			
		||||
@@ -1116,12 +1107,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		if (noout)
 | 
			
		||||
			{
 | 
			
		||||
			if (print)
 | 
			
		||||
				CMS_ContentInfo_print_ctx(out, cms, 0, NULL);
 | 
			
		||||
			}
 | 
			
		||||
		else if (outformat == FORMAT_SMIME)
 | 
			
		||||
		if (outformat == FORMAT_SMIME)
 | 
			
		||||
			{
 | 
			
		||||
			if (to)
 | 
			
		||||
				BIO_printf(out, "To: %s\n", to);
 | 
			
		||||
@@ -1135,9 +1121,9 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
				ret = SMIME_write_CMS(out, cms, in, flags);
 | 
			
		||||
			}
 | 
			
		||||
		else if (outformat == FORMAT_PEM) 
 | 
			
		||||
			ret = PEM_write_bio_CMS_stream(out, cms, in, flags);
 | 
			
		||||
			ret = PEM_write_bio_CMS(out, cms);
 | 
			
		||||
		else if (outformat == FORMAT_ASN1) 
 | 
			
		||||
			ret = i2d_CMS_bio_stream(out,cms, in, flags);
 | 
			
		||||
			ret = i2d_CMS_bio(out,cms);
 | 
			
		||||
		else
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bio_err, "Bad output format for CMS file\n");
 | 
			
		||||
@@ -1160,9 +1146,9 @@ end:
 | 
			
		||||
	if (vpm)
 | 
			
		||||
		X509_VERIFY_PARAM_free(vpm);
 | 
			
		||||
	if (sksigners)
 | 
			
		||||
		sk_STRING_free(sksigners);
 | 
			
		||||
		sk_free(sksigners);
 | 
			
		||||
	if (skkeys)
 | 
			
		||||
		sk_STRING_free(skkeys);
 | 
			
		||||
		sk_free(skkeys);
 | 
			
		||||
	if (secret_key)
 | 
			
		||||
		OPENSSL_free(secret_key);
 | 
			
		||||
	if (secret_keyid)
 | 
			
		||||
@@ -1172,9 +1158,9 @@ end:
 | 
			
		||||
	if (rr)
 | 
			
		||||
		CMS_ReceiptRequest_free(rr);
 | 
			
		||||
	if (rr_to)
 | 
			
		||||
		sk_STRING_free(rr_to);
 | 
			
		||||
		sk_free(rr_to);
 | 
			
		||||
	if (rr_from)
 | 
			
		||||
		sk_STRING_free(rr_from);
 | 
			
		||||
		sk_free(rr_from);
 | 
			
		||||
	X509_STORE_free(store);
 | 
			
		||||
	X509_free(cert);
 | 
			
		||||
	X509_free(recip);
 | 
			
		||||
@@ -1213,8 +1199,6 @@ static int cms_cb(int ok, X509_STORE_CTX *ctx)
 | 
			
		||||
 | 
			
		||||
	error = X509_STORE_CTX_get_error(ctx);
 | 
			
		||||
 | 
			
		||||
	verify_err = error;
 | 
			
		||||
 | 
			
		||||
	if ((error != X509_V_ERR_NO_EXPLICIT_POLICY)
 | 
			
		||||
		&& ((error != X509_V_OK) || (ok != 2)))
 | 
			
		||||
		return ok;
 | 
			
		||||
@@ -1296,7 +1280,7 @@ static void receipt_request_print(BIO *out, CMS_ContentInfo *cms)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static STACK_OF(GENERAL_NAMES) *make_names_stack(STACK_OF(STRING) *ns)
 | 
			
		||||
static STACK_OF(GENERAL_NAMES) *make_names_stack(STACK *ns)
 | 
			
		||||
	{
 | 
			
		||||
	int i;
 | 
			
		||||
	STACK_OF(GENERAL_NAMES) *ret;
 | 
			
		||||
@@ -1305,10 +1289,12 @@ static STACK_OF(GENERAL_NAMES) *make_names_stack(STACK_OF(STRING) *ns)
 | 
			
		||||
	ret = sk_GENERAL_NAMES_new_null();
 | 
			
		||||
	if (!ret)
 | 
			
		||||
		goto err;
 | 
			
		||||
	for (i = 0; i < sk_STRING_num(ns); i++)
 | 
			
		||||
	for (i = 0; i < sk_num(ns); i++)
 | 
			
		||||
		{
 | 
			
		||||
		char *str = sk_STRING_value(ns, i);
 | 
			
		||||
		gen = a2i_GENERAL_NAME(NULL, NULL, NULL, GEN_EMAIL, str, 0);
 | 
			
		||||
		CONF_VALUE cnf;
 | 
			
		||||
		cnf.name = "email";
 | 
			
		||||
		cnf.value = sk_value(ns, i);
 | 
			
		||||
		gen = v2i_GENERAL_NAME(NULL, NULL, &cnf);
 | 
			
		||||
		if (!gen)
 | 
			
		||||
			goto err;
 | 
			
		||||
		gens = GENERAL_NAMES_new();
 | 
			
		||||
@@ -1335,9 +1321,8 @@ static STACK_OF(GENERAL_NAMES) *make_names_stack(STACK_OF(STRING) *ns)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static CMS_ReceiptRequest *make_receipt_request(STACK_OF(STRING) *rr_to,
 | 
			
		||||
						int rr_allorfirst,
 | 
			
		||||
						STACK_OF(STRING) *rr_from)
 | 
			
		||||
static CMS_ReceiptRequest *make_receipt_request(STACK *rr_to, int rr_allorfirst,
 | 
			
		||||
								STACK *rr_from)
 | 
			
		||||
	{
 | 
			
		||||
	STACK_OF(GENERAL_NAMES) *rct_to, *rct_from;
 | 
			
		||||
	CMS_ReceiptRequest *rr;
 | 
			
		||||
 
 | 
			
		||||
@@ -63,6 +63,7 @@
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <sys/types.h>
 | 
			
		||||
#include <sys/stat.h>
 | 
			
		||||
#include "apps.h"
 | 
			
		||||
#include <openssl/err.h>
 | 
			
		||||
#include <openssl/evp.h>
 | 
			
		||||
@@ -92,7 +93,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	PKCS7 *p7 = NULL;
 | 
			
		||||
	PKCS7_SIGNED *p7s = NULL;
 | 
			
		||||
	X509_CRL *crl=NULL;
 | 
			
		||||
	STACK_OF(STRING) *certflst=NULL;
 | 
			
		||||
	STACK *certflst=NULL;
 | 
			
		||||
	STACK_OF(X509_CRL) *crl_stack=NULL;
 | 
			
		||||
	STACK_OF(X509) *cert_stack=NULL;
 | 
			
		||||
	int ret=1,nocrl=0;
 | 
			
		||||
@@ -140,8 +141,8 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
		else if (strcmp(*argv,"-certfile") == 0)
 | 
			
		||||
			{
 | 
			
		||||
			if (--argc < 1) goto bad;
 | 
			
		||||
			if(!certflst) certflst = sk_STRING_new_null();
 | 
			
		||||
			sk_STRING_push(certflst,*(++argv));
 | 
			
		||||
			if(!certflst) certflst = sk_new_null();
 | 
			
		||||
			sk_push(certflst,*(++argv));
 | 
			
		||||
			}
 | 
			
		||||
		else
 | 
			
		||||
			{
 | 
			
		||||
@@ -226,8 +227,8 @@ bad:
 | 
			
		||||
	if ((cert_stack=sk_X509_new_null()) == NULL) goto end;
 | 
			
		||||
	p7s->cert=cert_stack;
 | 
			
		||||
 | 
			
		||||
	if(certflst) for(i = 0; i < sk_STRING_num(certflst); i++) {
 | 
			
		||||
		certfile = sk_STRING_value(certflst, i);
 | 
			
		||||
	if(certflst) for(i = 0; i < sk_num(certflst); i++) {
 | 
			
		||||
		certfile = sk_value(certflst, i);
 | 
			
		||||
		if (add_certs_from_file(cert_stack,certfile) < 0)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bio_err, "error loading certificates\n");
 | 
			
		||||
@@ -236,7 +237,7 @@ bad:
 | 
			
		||||
			}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	sk_STRING_free(certflst);
 | 
			
		||||
	sk_free(certflst);
 | 
			
		||||
 | 
			
		||||
	if (outfile == NULL)
 | 
			
		||||
		{
 | 
			
		||||
@@ -294,12 +295,19 @@ end:
 | 
			
		||||
 */
 | 
			
		||||
static int add_certs_from_file(STACK_OF(X509) *stack, char *certfile)
 | 
			
		||||
	{
 | 
			
		||||
	struct stat st;
 | 
			
		||||
	BIO *in=NULL;
 | 
			
		||||
	int count=0;
 | 
			
		||||
	int ret= -1;
 | 
			
		||||
	STACK_OF(X509_INFO) *sk=NULL;
 | 
			
		||||
	X509_INFO *xi;
 | 
			
		||||
 | 
			
		||||
	if ((stat(certfile,&st) != 0))
 | 
			
		||||
		{
 | 
			
		||||
		BIO_printf(bio_err,"unable to load the file, %s\n",certfile);
 | 
			
		||||
		goto end;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	in=BIO_new(BIO_s_file());
 | 
			
		||||
	if ((in == NULL) || (BIO_read_filename(in,certfile) <= 0))
 | 
			
		||||
		{
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										284
									
								
								apps/dgst.c
									
									
									
									
									
								
							
							
						
						
									
										284
									
								
								apps/dgst.c
									
									
									
									
									
								
							@@ -75,9 +75,8 @@
 | 
			
		||||
#define PROG	dgst_main
 | 
			
		||||
 | 
			
		||||
int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout,
 | 
			
		||||
	  EVP_PKEY *key, unsigned char *sigin, int siglen,
 | 
			
		||||
	  const char *sig_name, const char *md_name,
 | 
			
		||||
	  const char *file,BIO *bmd);
 | 
			
		||||
	  EVP_PKEY *key, unsigned char *sigin, int siglen, const char *title,
 | 
			
		||||
	  const char *file,BIO *bmd,const char *hmac_key, int non_fips_allow);
 | 
			
		||||
 | 
			
		||||
int MAIN(int, char **);
 | 
			
		||||
 | 
			
		||||
@@ -90,6 +89,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	BIO *in=NULL,*inp;
 | 
			
		||||
	BIO *bmd=NULL;
 | 
			
		||||
	BIO *out = NULL;
 | 
			
		||||
	const char *name;
 | 
			
		||||
#define PROG_NAME_SIZE  39
 | 
			
		||||
	char pname[PROG_NAME_SIZE+1];
 | 
			
		||||
	int separator=0;
 | 
			
		||||
@@ -101,16 +101,16 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	EVP_PKEY *sigkey = NULL;
 | 
			
		||||
	unsigned char *sigbuf = NULL;
 | 
			
		||||
	int siglen = 0;
 | 
			
		||||
	unsigned int sig_flags = 0;
 | 
			
		||||
	char *passargin = NULL, *passin = NULL;
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
	char *engine=NULL;
 | 
			
		||||
#endif
 | 
			
		||||
	char *hmac_key=NULL;
 | 
			
		||||
	char *mac_name=NULL;
 | 
			
		||||
	STACK_OF(STRING) *sigopts = NULL, *macopts = NULL;
 | 
			
		||||
	int non_fips_allow = 0;
 | 
			
		||||
 | 
			
		||||
	apps_startup();
 | 
			
		||||
 | 
			
		||||
ERR_load_crypto_strings();
 | 
			
		||||
	if ((buf=(unsigned char *)OPENSSL_malloc(BUFSIZE)) == NULL)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_printf(bio_err,"out of memory\n");
 | 
			
		||||
@@ -169,6 +169,27 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
			keyfile=*(++argv);
 | 
			
		||||
			do_verify = 1;
 | 
			
		||||
			}
 | 
			
		||||
		else if (strcmp(*argv,"-x931") == 0)
 | 
			
		||||
			sig_flags = EVP_MD_CTX_FLAG_PAD_X931;
 | 
			
		||||
		else if (strcmp(*argv,"-pss_saltlen") == 0)
 | 
			
		||||
			{
 | 
			
		||||
			int saltlen;
 | 
			
		||||
			if (--argc < 1) break;
 | 
			
		||||
			saltlen=atoi(*(++argv));
 | 
			
		||||
			if (saltlen == -1)
 | 
			
		||||
				sig_flags = EVP_MD_CTX_FLAG_PSS_MREC;
 | 
			
		||||
			else if (saltlen == -2)
 | 
			
		||||
				sig_flags = EVP_MD_CTX_FLAG_PSS_MDLEN;
 | 
			
		||||
			else if (saltlen < -2 || saltlen >= 0xFFFE)
 | 
			
		||||
				{
 | 
			
		||||
				BIO_printf(bio_err, "Invalid PSS salt length %d\n", saltlen);
 | 
			
		||||
				goto end;
 | 
			
		||||
				}
 | 
			
		||||
			else
 | 
			
		||||
				sig_flags = saltlen;
 | 
			
		||||
			sig_flags <<= 16;
 | 
			
		||||
			sig_flags |= EVP_MD_CTX_FLAG_PAD_PSS;
 | 
			
		||||
			}
 | 
			
		||||
		else if (strcmp(*argv,"-signature") == 0)
 | 
			
		||||
			{
 | 
			
		||||
			if (--argc < 1) break;
 | 
			
		||||
@@ -184,7 +205,6 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
			{
 | 
			
		||||
			if (--argc < 1) break;
 | 
			
		||||
			engine= *(++argv);
 | 
			
		||||
        		e = setup_engine(bio_err, engine, 0);
 | 
			
		||||
			}
 | 
			
		||||
#endif
 | 
			
		||||
		else if (strcmp(*argv,"-hex") == 0)
 | 
			
		||||
@@ -193,36 +213,16 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
			out_bin = 1;
 | 
			
		||||
		else if (strcmp(*argv,"-d") == 0)
 | 
			
		||||
			debug=1;
 | 
			
		||||
		else if (strcmp(*argv,"-non-fips-allow") == 0)
 | 
			
		||||
			non_fips_allow=1;
 | 
			
		||||
		else if (!strcmp(*argv,"-fips-fingerprint"))
 | 
			
		||||
			hmac_key = "etaonrishdlcupfm";
 | 
			
		||||
		else if (!strcmp(*argv,"-hmac"))
 | 
			
		||||
			{
 | 
			
		||||
			if (--argc < 1)
 | 
			
		||||
				break;
 | 
			
		||||
			hmac_key=*++argv;
 | 
			
		||||
			}
 | 
			
		||||
		else if (!strcmp(*argv,"-mac"))
 | 
			
		||||
			{
 | 
			
		||||
			if (--argc < 1)
 | 
			
		||||
				break;
 | 
			
		||||
			mac_name=*++argv;
 | 
			
		||||
			}
 | 
			
		||||
		else if (strcmp(*argv,"-sigopt") == 0)
 | 
			
		||||
			{
 | 
			
		||||
			if (--argc < 1)
 | 
			
		||||
				break;
 | 
			
		||||
			if (!sigopts)
 | 
			
		||||
				sigopts = sk_STRING_new_null();
 | 
			
		||||
			if (!sigopts || !sk_STRING_push(sigopts, *(++argv)))
 | 
			
		||||
				break;
 | 
			
		||||
			}
 | 
			
		||||
		else if (strcmp(*argv,"-macopt") == 0)
 | 
			
		||||
			{
 | 
			
		||||
			if (--argc < 1)
 | 
			
		||||
				break;
 | 
			
		||||
			if (!macopts)
 | 
			
		||||
				macopts = sk_STRING_new_null();
 | 
			
		||||
			if (!macopts || !sk_STRING_push(macopts, *(++argv)))
 | 
			
		||||
				break;
 | 
			
		||||
			}
 | 
			
		||||
		else if ((m=EVP_get_digestbyname(&((*argv)[1]))) != NULL)
 | 
			
		||||
			md=m;
 | 
			
		||||
		else
 | 
			
		||||
@@ -231,9 +231,12 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
		argv++;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (md == NULL)
 | 
			
		||||
		md=EVP_md5();
 | 
			
		||||
 | 
			
		||||
	if(do_verify && !sigfile) {
 | 
			
		||||
		BIO_printf(bio_err, "No signature to verify: use the -signature option\n");
 | 
			
		||||
		err = 1; 
 | 
			
		||||
		goto end;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -250,7 +253,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
		BIO_printf(bio_err,"-prverify file  verify a signature using private key in file\n");
 | 
			
		||||
		BIO_printf(bio_err,"-keyform arg    key file format (PEM or ENGINE)\n");
 | 
			
		||||
		BIO_printf(bio_err,"-signature file signature to verify\n");
 | 
			
		||||
		BIO_printf(bio_err,"-sigopt nm:v    signature parameter\n");
 | 
			
		||||
		BIO_printf(bio_err,"-binary         output in binary form\n");
 | 
			
		||||
		BIO_printf(bio_err,"-hmac key       create hashed MAC with key\n");
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
		BIO_printf(bio_err,"-engine e       use engine e, possibly a hardware device.\n");
 | 
			
		||||
@@ -265,6 +268,8 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
#ifndef OPENSSL_NO_SHA
 | 
			
		||||
		BIO_printf(bio_err,"-%-14s to use the %s message digest algorithm\n",
 | 
			
		||||
			LN_sha1,LN_sha1);
 | 
			
		||||
		BIO_printf(bio_err,"-%-14s to use the %s message digest algorithm\n",
 | 
			
		||||
			LN_sha,LN_sha);
 | 
			
		||||
#ifndef OPENSSL_NO_SHA256
 | 
			
		||||
		BIO_printf(bio_err,"-%-14s to use the %s message digest algorithm\n",
 | 
			
		||||
			LN_sha224,LN_sha224);
 | 
			
		||||
@@ -282,13 +287,14 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
			LN_mdc2,LN_mdc2);
 | 
			
		||||
		BIO_printf(bio_err,"-%-14s to use the %s message digest algorithm\n",
 | 
			
		||||
			LN_ripemd160,LN_ripemd160);
 | 
			
		||||
#ifndef OPENSSL_NO_WHIRLPOOL
 | 
			
		||||
		BIO_printf(bio_err,"-%-14s to use the %s message digest algorithm\n",
 | 
			
		||||
			SN_whirlpool,SN_whirlpool);
 | 
			
		||||
#endif
 | 
			
		||||
		err=1;
 | 
			
		||||
		goto end;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
        e = setup_engine(bio_err, engine, 0);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	in=BIO_new(BIO_s_file());
 | 
			
		||||
	bmd=BIO_new(BIO_f_md());
 | 
			
		||||
	if (debug)
 | 
			
		||||
@@ -311,10 +317,8 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if(out_bin == -1) {
 | 
			
		||||
		if(keyfile)
 | 
			
		||||
			out_bin = 1;
 | 
			
		||||
		else
 | 
			
		||||
			out_bin = 0;
 | 
			
		||||
		if(keyfile) out_bin = 1;
 | 
			
		||||
		else out_bin = 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if(randfile)
 | 
			
		||||
@@ -340,11 +344,6 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
		ERR_print_errors(bio_err);
 | 
			
		||||
		goto end;
 | 
			
		||||
	}
 | 
			
		||||
	if ((!!mac_name + !!keyfile + !!hmac_key) > 1)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_printf(bio_err, "MAC and Signing key cannot both be specified\n");
 | 
			
		||||
		goto end;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if(keyfile)
 | 
			
		||||
		{
 | 
			
		||||
@@ -362,101 +361,6 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (mac_name)
 | 
			
		||||
		{
 | 
			
		||||
		EVP_PKEY_CTX *mac_ctx = NULL;
 | 
			
		||||
		int r = 0;
 | 
			
		||||
		if (!init_gen_str(bio_err, &mac_ctx, mac_name,e, 0))
 | 
			
		||||
			goto mac_end;
 | 
			
		||||
		if (macopts)
 | 
			
		||||
			{
 | 
			
		||||
			char *macopt;
 | 
			
		||||
			for (i = 0; i < sk_STRING_num(macopts); i++)
 | 
			
		||||
				{
 | 
			
		||||
				macopt = sk_STRING_value(macopts, i);
 | 
			
		||||
				if (pkey_ctrl_string(mac_ctx, macopt) <= 0)
 | 
			
		||||
					{
 | 
			
		||||
					BIO_printf(bio_err,
 | 
			
		||||
						"MAC parameter error \"%s\"\n",
 | 
			
		||||
						macopt);
 | 
			
		||||
					ERR_print_errors(bio_err);
 | 
			
		||||
					goto mac_end;
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		if (EVP_PKEY_keygen(mac_ctx, &sigkey) <= 0)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_puts(bio_err, "Error generating key\n");
 | 
			
		||||
			ERR_print_errors(bio_err);
 | 
			
		||||
			goto mac_end;
 | 
			
		||||
			}
 | 
			
		||||
		r = 1;
 | 
			
		||||
		mac_end:
 | 
			
		||||
		if (mac_ctx)
 | 
			
		||||
			EVP_PKEY_CTX_free(mac_ctx);
 | 
			
		||||
		if (r == 0)
 | 
			
		||||
			goto end;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (hmac_key)
 | 
			
		||||
		{
 | 
			
		||||
		sigkey = EVP_PKEY_new_mac_key(EVP_PKEY_HMAC, e,
 | 
			
		||||
					(unsigned char *)hmac_key, -1);
 | 
			
		||||
		if (!sigkey)
 | 
			
		||||
			goto end;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (sigkey)
 | 
			
		||||
		{
 | 
			
		||||
		EVP_MD_CTX *mctx = NULL;
 | 
			
		||||
		EVP_PKEY_CTX *pctx = NULL;
 | 
			
		||||
		int r;
 | 
			
		||||
		if (!BIO_get_md_ctx(bmd, &mctx))
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bio_err, "Error getting context\n");
 | 
			
		||||
			ERR_print_errors(bio_err);
 | 
			
		||||
			goto end;
 | 
			
		||||
			}
 | 
			
		||||
		if (do_verify)
 | 
			
		||||
			r = EVP_DigestVerifyInit(mctx, &pctx, md, e, sigkey);
 | 
			
		||||
		else
 | 
			
		||||
			r = EVP_DigestSignInit(mctx, &pctx, md, e, sigkey);
 | 
			
		||||
		if (!r)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bio_err, "Error setting context\n");
 | 
			
		||||
			ERR_print_errors(bio_err);
 | 
			
		||||
			goto end;
 | 
			
		||||
			}
 | 
			
		||||
		if (sigopts)
 | 
			
		||||
			{
 | 
			
		||||
			char *sigopt;
 | 
			
		||||
			for (i = 0; i < sk_STRING_num(sigopts); i++)
 | 
			
		||||
				{
 | 
			
		||||
				sigopt = sk_STRING_value(sigopts, i);
 | 
			
		||||
				if (pkey_ctrl_string(pctx, sigopt) <= 0)
 | 
			
		||||
					{
 | 
			
		||||
					BIO_printf(bio_err,
 | 
			
		||||
						"parameter error \"%s\"\n",
 | 
			
		||||
						sigopt);
 | 
			
		||||
					ERR_print_errors(bio_err);
 | 
			
		||||
					goto end;
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	/* we use md as a filter, reading from 'in' */
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		if (md == NULL)
 | 
			
		||||
			md = EVP_md5(); 
 | 
			
		||||
		if (!BIO_set_md(bmd,md))
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bio_err, "Error setting digest %s\n", pname);
 | 
			
		||||
			ERR_print_errors(bio_err);
 | 
			
		||||
			goto end;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if(sigfile && sigkey) {
 | 
			
		||||
		BIO *sigbio;
 | 
			
		||||
		sigbio = BIO_new_file(sigfile, "rb");
 | 
			
		||||
@@ -477,51 +381,67 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
			goto end;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	inp=BIO_push(bmd,in);
 | 
			
		||||
 | 
			
		||||
	if (md == NULL)
 | 
			
		||||
	if (non_fips_allow)
 | 
			
		||||
		{
 | 
			
		||||
		EVP_MD_CTX *tctx;
 | 
			
		||||
		BIO_get_md_ctx(bmd, &tctx);
 | 
			
		||||
		md = EVP_MD_CTX_md(tctx);
 | 
			
		||||
		EVP_MD_CTX *md_ctx;
 | 
			
		||||
		BIO_get_md_ctx(bmd,&md_ctx);
 | 
			
		||||
		EVP_MD_CTX_set_flags(md_ctx, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (sig_flags)
 | 
			
		||||
		{
 | 
			
		||||
		EVP_MD_CTX *md_ctx;
 | 
			
		||||
		BIO_get_md_ctx(bmd,&md_ctx);
 | 
			
		||||
		EVP_MD_CTX_set_flags(md_ctx, sig_flags);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	/* we use md as a filter, reading from 'in' */
 | 
			
		||||
	if (!BIO_set_md(bmd,md))
 | 
			
		||||
		{
 | 
			
		||||
		BIO_printf(bio_err, "Error setting digest %s\n", pname);
 | 
			
		||||
		ERR_print_errors(bio_err);
 | 
			
		||||
		goto end;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
	inp=BIO_push(bmd,in);
 | 
			
		||||
 | 
			
		||||
	if (argc == 0)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_set_fp(in,stdin,BIO_NOCLOSE);
 | 
			
		||||
		err=do_fp(out, buf,inp,separator, out_bin, sigkey, sigbuf,
 | 
			
		||||
			  siglen,NULL,NULL,"stdin",bmd);
 | 
			
		||||
			  siglen,"","(stdin)",bmd,hmac_key,non_fips_allow);
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		const char *md_name = NULL, *sig_name = NULL;
 | 
			
		||||
		if(!out_bin)
 | 
			
		||||
			{
 | 
			
		||||
			if (sigkey)
 | 
			
		||||
				{
 | 
			
		||||
				const EVP_PKEY_ASN1_METHOD *ameth;
 | 
			
		||||
				ameth = EVP_PKEY_get0_asn1(sigkey);
 | 
			
		||||
				if (ameth)
 | 
			
		||||
					EVP_PKEY_asn1_get0_info(NULL, NULL,
 | 
			
		||||
						NULL, NULL, &sig_name, ameth);
 | 
			
		||||
				}
 | 
			
		||||
			md_name = EVP_MD_name(md);
 | 
			
		||||
			}
 | 
			
		||||
		name=OBJ_nid2sn(md->type);
 | 
			
		||||
		err = 0;
 | 
			
		||||
		for (i=0; i<argc; i++)
 | 
			
		||||
			{
 | 
			
		||||
			char *tmp,*tofree=NULL;
 | 
			
		||||
			int r;
 | 
			
		||||
 | 
			
		||||
			if (BIO_read_filename(in,argv[i]) <= 0)
 | 
			
		||||
				{
 | 
			
		||||
				perror(argv[i]);
 | 
			
		||||
				err++;
 | 
			
		||||
				continue;
 | 
			
		||||
				}
 | 
			
		||||
			if(!out_bin)
 | 
			
		||||
				{
 | 
			
		||||
				size_t len = strlen(name)+strlen(argv[i])+(hmac_key ? 5 : 0)+5;
 | 
			
		||||
				tmp=tofree=OPENSSL_malloc(len);
 | 
			
		||||
				BIO_snprintf(tmp,len,"%s%s(%s)= ",
 | 
			
		||||
							 hmac_key ? "HMAC-" : "",name,argv[i]);
 | 
			
		||||
				}
 | 
			
		||||
			else
 | 
			
		||||
				tmp="";
 | 
			
		||||
			r=do_fp(out,buf,inp,separator,out_bin,sigkey,sigbuf,
 | 
			
		||||
				siglen,sig_name,md_name, argv[i],bmd);
 | 
			
		||||
				siglen,tmp,argv[i],bmd,hmac_key,non_fips_allow);
 | 
			
		||||
			if(r)
 | 
			
		||||
			    err=r;
 | 
			
		||||
			if(tofree)
 | 
			
		||||
				OPENSSL_free(tofree);
 | 
			
		||||
			(void)BIO_reset(bmd);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
@@ -536,10 +456,6 @@ end:
 | 
			
		||||
		OPENSSL_free(passin);
 | 
			
		||||
	BIO_free_all(out);
 | 
			
		||||
	EVP_PKEY_free(sigkey);
 | 
			
		||||
	if (sigopts)
 | 
			
		||||
		sk_STRING_free(sigopts);
 | 
			
		||||
	if (macopts)
 | 
			
		||||
		sk_STRING_free(macopts);
 | 
			
		||||
	if(sigbuf) OPENSSL_free(sigbuf);
 | 
			
		||||
	if (bmd != NULL) BIO_free(bmd);
 | 
			
		||||
	apps_shutdown();
 | 
			
		||||
@@ -547,13 +463,24 @@ end:
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout,
 | 
			
		||||
	  EVP_PKEY *key, unsigned char *sigin, int siglen,
 | 
			
		||||
	  const char *sig_name, const char *md_name,
 | 
			
		||||
	  const char *file,BIO *bmd)
 | 
			
		||||
	  EVP_PKEY *key, unsigned char *sigin, int siglen, const char *title,
 | 
			
		||||
	  const char *file,BIO *bmd,const char *hmac_key,int non_fips_allow)
 | 
			
		||||
	{
 | 
			
		||||
	size_t len;
 | 
			
		||||
	unsigned int len;
 | 
			
		||||
	int i;
 | 
			
		||||
	EVP_MD_CTX *md_ctx;
 | 
			
		||||
	HMAC_CTX hmac_ctx;
 | 
			
		||||
 | 
			
		||||
	if (hmac_key)
 | 
			
		||||
		{
 | 
			
		||||
		EVP_MD *md;
 | 
			
		||||
 | 
			
		||||
		BIO_get_md(bmd,&md);
 | 
			
		||||
		HMAC_CTX_init(&hmac_ctx);
 | 
			
		||||
		HMAC_Init_ex(&hmac_ctx,hmac_key,strlen(hmac_key),md, NULL);
 | 
			
		||||
		BIO_get_md_ctx(bmd,&md_ctx);
 | 
			
		||||
		BIO_set_md_ctx(bmd,&hmac_ctx.md_ctx);
 | 
			
		||||
		}
 | 
			
		||||
	for (;;)
 | 
			
		||||
		{
 | 
			
		||||
		i=BIO_read(bp,(char *)buf,BUFSIZE);
 | 
			
		||||
@@ -569,7 +496,7 @@ int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout,
 | 
			
		||||
		{
 | 
			
		||||
		EVP_MD_CTX *ctx;
 | 
			
		||||
		BIO_get_md_ctx(bp, &ctx);
 | 
			
		||||
		i = EVP_DigestVerifyFinal(ctx, sigin, (unsigned int)siglen); 
 | 
			
		||||
		i = EVP_VerifyFinal(ctx, sigin, (unsigned int)siglen, key); 
 | 
			
		||||
		if(i > 0)
 | 
			
		||||
			BIO_printf(out, "Verified OK\n");
 | 
			
		||||
		else if(i == 0)
 | 
			
		||||
@@ -589,26 +516,25 @@ int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout,
 | 
			
		||||
		{
 | 
			
		||||
		EVP_MD_CTX *ctx;
 | 
			
		||||
		BIO_get_md_ctx(bp, &ctx);
 | 
			
		||||
		len = BUFSIZE;
 | 
			
		||||
		if(!EVP_DigestSignFinal(ctx, buf, &len)) 
 | 
			
		||||
		if(!EVP_SignFinal(ctx, buf, (unsigned int *)&len, key)) 
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bio_err, "Error Signing Data\n");
 | 
			
		||||
			ERR_print_errors(bio_err);
 | 
			
		||||
			return 1;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	else if(hmac_key)
 | 
			
		||||
		{
 | 
			
		||||
		HMAC_Final(&hmac_ctx,buf,&len);
 | 
			
		||||
		HMAC_CTX_cleanup(&hmac_ctx);
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
		len=BIO_gets(bp,(char *)buf,BUFSIZE);
 | 
			
		||||
 | 
			
		||||
	if(binout) BIO_write(out, buf, len);
 | 
			
		||||
	else 
 | 
			
		||||
		{
 | 
			
		||||
		if (sig_name)
 | 
			
		||||
			BIO_printf(out, "%s-%s(%s)= ", sig_name, md_name, file);
 | 
			
		||||
		else if (md_name)
 | 
			
		||||
			BIO_printf(out, "%s(%s)= ", md_name, file);
 | 
			
		||||
		else
 | 
			
		||||
			BIO_printf(out, "(%s)= ", file);
 | 
			
		||||
		BIO_write(out,title,strlen(title));
 | 
			
		||||
		for (i=0; i<(int)len; i++)
 | 
			
		||||
			{
 | 
			
		||||
			if (sep && (i != 0))
 | 
			
		||||
@@ -617,6 +543,10 @@ int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout,
 | 
			
		||||
			}
 | 
			
		||||
		BIO_printf(out, "\n");
 | 
			
		||||
		}
 | 
			
		||||
	if (hmac_key)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_set_md_ctx(bmd,md_ctx);
 | 
			
		||||
		}
 | 
			
		||||
	return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										47
									
								
								apps/dsa.c
									
									
									
									
									
								
							
							
						
						
									
										47
									
								
								apps/dsa.c
									
									
									
									
									
								
							@@ -112,8 +112,6 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	char *passin = NULL, *passout = NULL;
 | 
			
		||||
	int modulus=0;
 | 
			
		||||
 | 
			
		||||
	int pvk_encr = 2;
 | 
			
		||||
 | 
			
		||||
	apps_startup();
 | 
			
		||||
 | 
			
		||||
	if (bio_err == NULL)
 | 
			
		||||
@@ -173,12 +171,6 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
			engine= *(++argv);
 | 
			
		||||
			}
 | 
			
		||||
#endif
 | 
			
		||||
		else if (strcmp(*argv,"-pvk-strong") == 0)
 | 
			
		||||
			pvk_encr=2;
 | 
			
		||||
		else if (strcmp(*argv,"-pvk-weak") == 0)
 | 
			
		||||
			pvk_encr=1;
 | 
			
		||||
		else if (strcmp(*argv,"-pvk-none") == 0)
 | 
			
		||||
			pvk_encr=0;
 | 
			
		||||
		else if (strcmp(*argv,"-noout") == 0)
 | 
			
		||||
			noout=1;
 | 
			
		||||
		else if (strcmp(*argv,"-text") == 0)
 | 
			
		||||
@@ -246,30 +238,16 @@ bad:
 | 
			
		||||
		goto end;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	in=BIO_new(BIO_s_file());
 | 
			
		||||
	out=BIO_new(BIO_s_file());
 | 
			
		||||
	if ((in == NULL) || (out == NULL))
 | 
			
		||||
	if (out == NULL)
 | 
			
		||||
		{
 | 
			
		||||
		ERR_print_errors(bio_err);
 | 
			
		||||
		goto end;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (infile == NULL)
 | 
			
		||||
		BIO_set_fp(in,stdin,BIO_NOCLOSE);
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		if (BIO_read_filename(in,infile) <= 0)
 | 
			
		||||
			{
 | 
			
		||||
			perror(infile);
 | 
			
		||||
			goto end;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	BIO_printf(bio_err,"read DSA key\n");
 | 
			
		||||
 | 
			
		||||
		{
 | 
			
		||||
	{
 | 
			
		||||
		EVP_PKEY	*pkey;
 | 
			
		||||
 | 
			
		||||
		if (pubin)
 | 
			
		||||
			pkey = load_pubkey(bio_err, infile, informat, 1,
 | 
			
		||||
				passin, e, "Public Key");
 | 
			
		||||
@@ -277,12 +255,10 @@ bad:
 | 
			
		||||
			pkey = load_key(bio_err, infile, informat, 1,
 | 
			
		||||
				passin, e, "Private Key");
 | 
			
		||||
 | 
			
		||||
		if (pkey)
 | 
			
		||||
			{
 | 
			
		||||
			dsa = EVP_PKEY_get1_DSA(pkey);
 | 
			
		||||
			EVP_PKEY_free(pkey);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		if (pkey != NULL)
 | 
			
		||||
		dsa = pkey == NULL ? NULL : EVP_PKEY_get1_DSA(pkey);
 | 
			
		||||
		EVP_PKEY_free(pkey);
 | 
			
		||||
	}
 | 
			
		||||
	if (dsa == NULL)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_printf(bio_err,"unable to load Key\n");
 | 
			
		||||
@@ -334,17 +310,6 @@ bad:
 | 
			
		||||
			i=PEM_write_bio_DSA_PUBKEY(out,dsa);
 | 
			
		||||
		else i=PEM_write_bio_DSAPrivateKey(out,dsa,enc,
 | 
			
		||||
							NULL,0,NULL, passout);
 | 
			
		||||
	} else if (outformat == FORMAT_MSBLOB || outformat == FORMAT_PVK) {
 | 
			
		||||
		EVP_PKEY *pk;
 | 
			
		||||
		pk = EVP_PKEY_new();
 | 
			
		||||
		EVP_PKEY_set1_DSA(pk, dsa);
 | 
			
		||||
		if (outformat == FORMAT_PVK)
 | 
			
		||||
			i = i2b_PVK_bio(out, pk, pvk_encr, 0, passout);
 | 
			
		||||
		else if (pubin || pubout)
 | 
			
		||||
			i = i2b_PublicKey_bio(out, pk);
 | 
			
		||||
		else
 | 
			
		||||
			i = i2b_PrivateKey_bio(out, pk);
 | 
			
		||||
		EVP_PKEY_free(pk);
 | 
			
		||||
	} else {
 | 
			
		||||
		BIO_printf(bio_err,"bad output format specified for outfile\n");
 | 
			
		||||
		goto end;
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										49
									
								
								apps/enc.c
									
									
									
									
									
								
							
							
						
						
									
										49
									
								
								apps/enc.c
									
									
									
									
									
								
							@@ -67,7 +67,6 @@
 | 
			
		||||
#include <openssl/x509.h>
 | 
			
		||||
#include <openssl/rand.h>
 | 
			
		||||
#include <openssl/pem.h>
 | 
			
		||||
#include <openssl/comp.h>
 | 
			
		||||
#include <ctype.h>
 | 
			
		||||
 | 
			
		||||
int set_hex(char *in,unsigned char *out,int size);
 | 
			
		||||
@@ -117,10 +116,6 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	char *hkey=NULL,*hiv=NULL,*hsalt = NULL;
 | 
			
		||||
	char *md=NULL;
 | 
			
		||||
	int enc=1,printkey=0,i,base64=0;
 | 
			
		||||
#ifdef ZLIB
 | 
			
		||||
	int do_zlib=0;
 | 
			
		||||
	BIO *bzl = NULL;
 | 
			
		||||
#endif
 | 
			
		||||
	int debug=0,olb64=0,nosalt=0;
 | 
			
		||||
	const EVP_CIPHER *cipher=NULL,*c;
 | 
			
		||||
	EVP_CIPHER_CTX *ctx = NULL;
 | 
			
		||||
@@ -132,6 +127,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	char *engine = NULL;
 | 
			
		||||
#endif
 | 
			
		||||
	const EVP_MD *dgst=NULL;
 | 
			
		||||
	int non_fips_allow = 0;
 | 
			
		||||
 | 
			
		||||
	apps_startup();
 | 
			
		||||
 | 
			
		||||
@@ -146,18 +142,9 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	program_name(argv[0],pname,sizeof pname);
 | 
			
		||||
	if (strcmp(pname,"base64") == 0)
 | 
			
		||||
		base64=1;
 | 
			
		||||
#ifdef ZLIB
 | 
			
		||||
	if (strcmp(pname,"zlib") == 0)
 | 
			
		||||
		do_zlib=1;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	cipher=EVP_get_cipherbyname(pname);
 | 
			
		||||
#ifdef ZLIB
 | 
			
		||||
	if (!do_zlib && !base64 && (cipher == NULL)
 | 
			
		||||
				&& (strcmp(pname,"enc") != 0))
 | 
			
		||||
#else
 | 
			
		||||
	if (!base64 && (cipher == NULL) && (strcmp(pname,"enc") != 0))
 | 
			
		||||
#endif
 | 
			
		||||
		{
 | 
			
		||||
		BIO_printf(bio_err,"%s is an unknown cipher\n",pname);
 | 
			
		||||
		goto bad;
 | 
			
		||||
@@ -213,10 +200,6 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
			base64=1;
 | 
			
		||||
		else if	(strcmp(*argv,"-base64") == 0)
 | 
			
		||||
			base64=1;
 | 
			
		||||
#ifdef ZLIB
 | 
			
		||||
		else if	(strcmp(*argv,"-z") == 0)
 | 
			
		||||
			do_zlib=1;
 | 
			
		||||
#endif
 | 
			
		||||
		else if (strcmp(*argv,"-bufsize") == 0)
 | 
			
		||||
			{
 | 
			
		||||
			if (--argc < 1) goto bad;
 | 
			
		||||
@@ -279,6 +262,8 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
			if (--argc < 1) goto bad;
 | 
			
		||||
			md= *(++argv);
 | 
			
		||||
			}
 | 
			
		||||
		else if (strcmp(*argv,"-non-fips-allow") == 0)
 | 
			
		||||
			non_fips_allow = 1;
 | 
			
		||||
		else if	((argv[0][0] == '-') &&
 | 
			
		||||
			((c=EVP_get_cipherbyname(&(argv[0][1]))) != NULL))
 | 
			
		||||
			{
 | 
			
		||||
@@ -301,11 +286,9 @@ bad:
 | 
			
		||||
			BIO_printf(bio_err,"%-14s passphrase is the first line of the file argument\n","-kfile");
 | 
			
		||||
			BIO_printf(bio_err,"%-14s the next argument is the md to use to create a key\n","-md");
 | 
			
		||||
			BIO_printf(bio_err,"%-14s   from a passphrase.  One of md2, md5, sha or sha1\n","");
 | 
			
		||||
			BIO_printf(bio_err,"%-14s salt in hex is the next argument\n","-S");
 | 
			
		||||
			BIO_printf(bio_err,"%-14s key/iv in hex is the next argument\n","-K/-iv");
 | 
			
		||||
			BIO_printf(bio_err,"%-14s print the iv/key (then exit if -P)\n","-[pP]");
 | 
			
		||||
			BIO_printf(bio_err,"%-14s buffer size\n","-bufsize <n>");
 | 
			
		||||
			BIO_printf(bio_err,"%-14s disable standard block padding\n","-nopad");
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
			BIO_printf(bio_err,"%-14s use engine e, possibly a hardware device.\n","-engine e");
 | 
			
		||||
#endif
 | 
			
		||||
@@ -334,7 +317,10 @@ bad:
 | 
			
		||||
 | 
			
		||||
	if (dgst == NULL)
 | 
			
		||||
		{
 | 
			
		||||
		dgst = EVP_md5();
 | 
			
		||||
		if (in_FIPS_mode)
 | 
			
		||||
			dgst = EVP_sha1();
 | 
			
		||||
		else
 | 
			
		||||
			dgst = EVP_md5();
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (bufsize != NULL)
 | 
			
		||||
@@ -466,19 +452,6 @@ bad:
 | 
			
		||||
	rbio=in;
 | 
			
		||||
	wbio=out;
 | 
			
		||||
 | 
			
		||||
#ifdef ZLIB
 | 
			
		||||
 | 
			
		||||
	if (do_zlib)
 | 
			
		||||
		{
 | 
			
		||||
		if ((bzl=BIO_new(BIO_f_zlib())) == NULL)
 | 
			
		||||
			goto end;
 | 
			
		||||
		if (enc)
 | 
			
		||||
			wbio=BIO_push(bzl,wbio);
 | 
			
		||||
		else
 | 
			
		||||
			rbio=BIO_push(bzl,rbio);
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	if (base64)
 | 
			
		||||
		{
 | 
			
		||||
		if ((b64=BIO_new(BIO_f_base64())) == NULL)
 | 
			
		||||
@@ -583,6 +556,11 @@ bad:
 | 
			
		||||
		 */
 | 
			
		||||
 | 
			
		||||
		BIO_get_cipher_ctx(benc, &ctx);
 | 
			
		||||
 | 
			
		||||
		if (non_fips_allow)
 | 
			
		||||
			EVP_CIPHER_CTX_set_flags(ctx,
 | 
			
		||||
				EVP_CIPH_FLAG_NON_FIPS_ALLOW);
 | 
			
		||||
 | 
			
		||||
		if (!EVP_CipherInit_ex(ctx, cipher, NULL, NULL, NULL, enc))
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bio_err, "Error setting cipher %s\n",
 | 
			
		||||
@@ -673,9 +651,6 @@ end:
 | 
			
		||||
	if (out != NULL) BIO_free_all(out);
 | 
			
		||||
	if (benc != NULL) BIO_free(benc);
 | 
			
		||||
	if (b64 != NULL) BIO_free(b64);
 | 
			
		||||
#ifdef ZLIB
 | 
			
		||||
	if (bzl != NULL) BIO_free(bzl);
 | 
			
		||||
#endif
 | 
			
		||||
	if(pass) OPENSSL_free(pass);
 | 
			
		||||
	apps_shutdown();
 | 
			
		||||
	OPENSSL_EXIT(ret);
 | 
			
		||||
 
 | 
			
		||||
@@ -92,7 +92,7 @@ static const char *engine_usage[]={
 | 
			
		||||
NULL
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static void identity(char *ptr)
 | 
			
		||||
static void identity(void *ptr)
 | 
			
		||||
	{
 | 
			
		||||
	return;
 | 
			
		||||
	}
 | 
			
		||||
@@ -148,6 +148,11 @@ static int util_flags(BIO *bio_out, unsigned int flags, const char *indent)
 | 
			
		||||
 | 
			
		||||
	if(flags & ENGINE_CMD_FLAG_NUMERIC)
 | 
			
		||||
		{
 | 
			
		||||
		if(started)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bio_out, "|");
 | 
			
		||||
			err = 1;
 | 
			
		||||
			}
 | 
			
		||||
		BIO_printf(bio_out, "NUMERIC");
 | 
			
		||||
		started = 1;
 | 
			
		||||
		}
 | 
			
		||||
@@ -200,7 +205,7 @@ static int util_verbose(ENGINE *e, int verbose, BIO *bio_out, const char *indent
 | 
			
		||||
	char *desc = NULL;
 | 
			
		||||
	int flags;
 | 
			
		||||
	int xpos = 0;
 | 
			
		||||
	STACK_OF(STRING) *cmds = NULL;
 | 
			
		||||
	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))
 | 
			
		||||
@@ -211,7 +216,7 @@ static int util_verbose(ENGINE *e, int verbose, BIO *bio_out, const char *indent
 | 
			
		||||
		return 1;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	cmds = sk_STRING_new_null();
 | 
			
		||||
	cmds = sk_new_null();
 | 
			
		||||
 | 
			
		||||
	if(!cmds)
 | 
			
		||||
		goto err;
 | 
			
		||||
@@ -284,17 +289,15 @@ static int util_verbose(ENGINE *e, int verbose, BIO *bio_out, const char *indent
 | 
			
		||||
		BIO_printf(bio_out, "\n");
 | 
			
		||||
	ret = 1;
 | 
			
		||||
err:
 | 
			
		||||
	if(cmds) sk_STRING_pop_free(cmds, identity);
 | 
			
		||||
	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_OF(STRING) *cmds, BIO *bio_out,
 | 
			
		||||
			 const char *indent)
 | 
			
		||||
static void util_do_cmds(ENGINE *e, STACK *cmds, BIO *bio_out, const char *indent)
 | 
			
		||||
	{
 | 
			
		||||
	int loop, res, num = sk_STRING_num(cmds);
 | 
			
		||||
 | 
			
		||||
	int loop, res, num = sk_num(cmds);
 | 
			
		||||
	if(num < 0)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_printf(bio_out, "[Error]: internal stack error\n");
 | 
			
		||||
@@ -304,7 +307,7 @@ static void util_do_cmds(ENGINE *e, STACK_OF(STRING) *cmds, BIO *bio_out,
 | 
			
		||||
		{
 | 
			
		||||
		char buf[256];
 | 
			
		||||
		const char *cmd, *arg;
 | 
			
		||||
		cmd = sk_STRING_value(cmds, loop);
 | 
			
		||||
		cmd = sk_value(cmds, loop);
 | 
			
		||||
		res = 1; /* assume success */
 | 
			
		||||
		/* Check if this command has no ":arg" */
 | 
			
		||||
		if((arg = strstr(cmd, ":")) == NULL)
 | 
			
		||||
@@ -344,9 +347,9 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	const char **pp;
 | 
			
		||||
	int verbose=0, list_cap=0, test_avail=0, test_avail_noise = 0;
 | 
			
		||||
	ENGINE *e;
 | 
			
		||||
	STACK_OF(STRING) *engines = sk_STRING_new_null();
 | 
			
		||||
	STACK_OF(STRING) *pre_cmds = sk_STRING_new_null();
 | 
			
		||||
	STACK_OF(STRING) *post_cmds = sk_STRING_new_null();
 | 
			
		||||
	STACK *engines = sk_new_null();
 | 
			
		||||
	STACK *pre_cmds = sk_new_null();
 | 
			
		||||
	STACK *post_cmds = sk_new_null();
 | 
			
		||||
	int badops=1;
 | 
			
		||||
	BIO *bio_out=NULL;
 | 
			
		||||
	const char *indent = "     ";
 | 
			
		||||
@@ -393,20 +396,20 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
			argc--; argv++;
 | 
			
		||||
			if (argc == 0)
 | 
			
		||||
				goto skip_arg_loop;
 | 
			
		||||
			sk_STRING_push(pre_cmds,*argv);
 | 
			
		||||
			sk_push(pre_cmds,*argv);
 | 
			
		||||
			}
 | 
			
		||||
		else if (strcmp(*argv,"-post") == 0)
 | 
			
		||||
			{
 | 
			
		||||
			argc--; argv++;
 | 
			
		||||
			if (argc == 0)
 | 
			
		||||
				goto skip_arg_loop;
 | 
			
		||||
			sk_STRING_push(post_cmds,*argv);
 | 
			
		||||
			sk_push(post_cmds,*argv);
 | 
			
		||||
			}
 | 
			
		||||
		else if ((strncmp(*argv,"-h",2) == 0) ||
 | 
			
		||||
				(strcmp(*argv,"-?") == 0))
 | 
			
		||||
			goto skip_arg_loop;
 | 
			
		||||
		else
 | 
			
		||||
			sk_STRING_push(engines,*argv);
 | 
			
		||||
			sk_push(engines,*argv);
 | 
			
		||||
		argc--;
 | 
			
		||||
		argv++;
 | 
			
		||||
		}
 | 
			
		||||
@@ -421,17 +424,17 @@ skip_arg_loop:
 | 
			
		||||
		goto end;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (sk_STRING_num(engines) == 0)
 | 
			
		||||
	if (sk_num(engines) == 0)
 | 
			
		||||
		{
 | 
			
		||||
		for(e = ENGINE_get_first(); e != NULL; e = ENGINE_get_next(e))
 | 
			
		||||
			{
 | 
			
		||||
			sk_STRING_push(engines,(char *)ENGINE_get_id(e));
 | 
			
		||||
			sk_push(engines,(char *)ENGINE_get_id(e));
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	for (i=0; i<sk_STRING_num(engines); i++)
 | 
			
		||||
	for (i=0; i<sk_num(engines); i++)
 | 
			
		||||
		{
 | 
			
		||||
		const char *id = sk_STRING_value(engines,i);
 | 
			
		||||
		const char *id = sk_value(engines,i);
 | 
			
		||||
		if ((e = ENGINE_by_id(id)) != NULL)
 | 
			
		||||
			{
 | 
			
		||||
			const char *name = ENGINE_get_name(e);
 | 
			
		||||
@@ -451,7 +454,6 @@ skip_arg_loop:
 | 
			
		||||
				const int *nids;
 | 
			
		||||
				ENGINE_CIPHERS_PTR fn_c;
 | 
			
		||||
				ENGINE_DIGESTS_PTR fn_d;
 | 
			
		||||
				ENGINE_PKEY_METHS_PTR fn_pk;
 | 
			
		||||
 | 
			
		||||
				if (ENGINE_get_RSA(e) != NULL
 | 
			
		||||
					&& !append_buf(&cap_buf, "RSA",
 | 
			
		||||
@@ -490,15 +492,6 @@ skip_ciphers:
 | 
			
		||||
						goto end;
 | 
			
		||||
 | 
			
		||||
skip_digests:
 | 
			
		||||
				fn_pk = ENGINE_get_pkey_meths(e);
 | 
			
		||||
				if(!fn_pk) goto skip_pmeths;
 | 
			
		||||
				n = fn_pk(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_pmeths:
 | 
			
		||||
				if (cap_buf && (*cap_buf != '\0'))
 | 
			
		||||
					BIO_printf(bio_out, " [%s]\n", cap_buf);
 | 
			
		||||
 | 
			
		||||
@@ -533,9 +526,9 @@ skip_pmeths:
 | 
			
		||||
end:
 | 
			
		||||
 | 
			
		||||
	ERR_print_errors(bio_err);
 | 
			
		||||
	sk_STRING_pop_free(engines, identity);
 | 
			
		||||
	sk_STRING_pop_free(pre_cmds, identity);
 | 
			
		||||
	sk_STRING_pop_free(post_cmds, 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);
 | 
			
		||||
	apps_shutdown();
 | 
			
		||||
	OPENSSL_EXIT(ret);
 | 
			
		||||
 
 | 
			
		||||
@@ -97,12 +97,10 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
			out = BIO_push(tmpbio, out);
 | 
			
		||||
			}
 | 
			
		||||
#endif
 | 
			
		||||
			lh_ERR_STRING_DATA_node_stats_bio(
 | 
			
		||||
						  ERR_get_string_table(), out);
 | 
			
		||||
			lh_ERR_STRING_DATA_stats_bio(ERR_get_string_table(),
 | 
			
		||||
						     out);
 | 
			
		||||
			lh_ERR_STRING_DATA_node_usage_stats_bio(
 | 
			
		||||
						    ERR_get_string_table(),out);
 | 
			
		||||
			lh_node_stats_bio((LHASH *)ERR_get_string_table(),out);
 | 
			
		||||
			lh_stats_bio((LHASH *)ERR_get_string_table(),out);
 | 
			
		||||
			lh_node_usage_stats_bio((LHASH *)
 | 
			
		||||
				ERR_get_string_table(),out);
 | 
			
		||||
			}
 | 
			
		||||
		if (out != NULL) BIO_free_all(out);
 | 
			
		||||
		argc--;
 | 
			
		||||
 
 | 
			
		||||
@@ -95,6 +95,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	int ret=1;
 | 
			
		||||
	int i,num=DEFBITS;
 | 
			
		||||
	long l;
 | 
			
		||||
	int use_x931 = 0;
 | 
			
		||||
	const EVP_CIPHER *enc=NULL;
 | 
			
		||||
	unsigned long f4=RSA_F4;
 | 
			
		||||
	char *outfile=NULL;
 | 
			
		||||
@@ -138,6 +139,8 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
			f4=3;
 | 
			
		||||
		else if (strcmp(*argv,"-F4") == 0 || strcmp(*argv,"-f4") == 0)
 | 
			
		||||
			f4=RSA_F4;
 | 
			
		||||
		else if (strcmp(*argv,"-x931") == 0)
 | 
			
		||||
			use_x931 = 1;
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
		else if (strcmp(*argv,"-engine") == 0)
 | 
			
		||||
			{
 | 
			
		||||
@@ -266,7 +269,17 @@ bad:
 | 
			
		||||
	BIO_printf(bio_err,"Generating RSA private key, %d bit long modulus\n",
 | 
			
		||||
		num);
 | 
			
		||||
 | 
			
		||||
	if(!BN_set_word(bn, f4) || !RSA_generate_key_ex(rsa, num, bn, &cb))
 | 
			
		||||
	if (use_x931)
 | 
			
		||||
		{
 | 
			
		||||
		BIGNUM *pubexp;
 | 
			
		||||
		pubexp = BN_new();
 | 
			
		||||
		if (!BN_set_word(pubexp, f4))
 | 
			
		||||
			goto err;
 | 
			
		||||
		if (!RSA_X931_generate_key_ex(rsa, num, pubexp, &cb))
 | 
			
		||||
			goto err;
 | 
			
		||||
		BN_free(pubexp);
 | 
			
		||||
		}
 | 
			
		||||
	else if(!BN_set_word(bn, f4) || !RSA_generate_key_ex(rsa, num, bn, &cb))
 | 
			
		||||
		goto err;
 | 
			
		||||
		
 | 
			
		||||
	app_RAND_write_file(NULL, bio_err);
 | 
			
		||||
 
 | 
			
		||||
@@ -68,6 +68,10 @@ $!
 | 
			
		||||
$! Define what programs should be compiled
 | 
			
		||||
$!
 | 
			
		||||
$ PROGRAMS := OPENSSL
 | 
			
		||||
$!$ PROGRAMS := VERIFY,ASN1PARS,REQ,DGST,DH,ENC,PASSWD,GENDH,ERRSTR,CA,CRL,-
 | 
			
		||||
$!	      RSA,DSA,DSAPARAM,-
 | 
			
		||||
$!	      X509,GENRSA,GENDSA,S_SERVER,S_CLIENT,SPEED,-
 | 
			
		||||
$!	      S_TIME,VERSION,PKCS7,CRL2P7,SESS_ID,CIPHERS,NSEQ,
 | 
			
		||||
$!
 | 
			
		||||
$! Check To Make Sure We Have Valid Command Line Parameters.
 | 
			
		||||
$!
 | 
			
		||||
@@ -133,13 +137,12 @@ $ GOSUB CHECK_OPT_FILE
 | 
			
		||||
$!
 | 
			
		||||
$! Define The Application Files.
 | 
			
		||||
$!
 | 
			
		||||
$ LIB_OPENSSL = "VERIFY,ASN1PARS,REQ,DGST,DH,DHPARAM,ENC,PASSWD,GENDH,ERRSTR,"+-
 | 
			
		||||
	     	"CA,PKCS7,CRL2P7,CRL,"+-
 | 
			
		||||
	      	"RSA,RSAUTL,DSA,DSAPARAM,EC,ECPARAM,"+-
 | 
			
		||||
	      	"X509,GENRSA,GENDSA,GENPKEY,S_SERVER,S_CLIENT,SPEED,"+-
 | 
			
		||||
	      	"S_TIME,APPS,S_CB,S_SOCKET,APP_RAND,VERSION,SESS_ID,"+-
 | 
			
		||||
	      	"CIPHERS,NSEQ,PKCS12,PKCS8,PKEY,PKEYPARAM,PKEYUTL,"+ -
 | 
			
		||||
	      	"SPKAC,SMIME,CMS,RAND,ENGINE,OCSP,PRIME,TS"
 | 
			
		||||
$ LIB_FILES = "VERIFY;ASN1PARS;REQ;DGST;DH;DHPARAM;ENC;PASSWD;GENDH;ERRSTR;"+-
 | 
			
		||||
	      "CA;PKCS7;CRL2P7;CRL;"+-
 | 
			
		||||
	      "RSA;RSAUTL;DSA;DSAPARAM;EC;ECPARAM;"+-
 | 
			
		||||
	      "X509;GENRSA;GENDSA;S_SERVER;S_CLIENT;SPEED;"+-
 | 
			
		||||
	      "S_TIME;APPS;S_CB;S_SOCKET;APP_RAND;VERSION;SESS_ID;"+-
 | 
			
		||||
	      "CIPHERS;NSEQ;PKCS12;PKCS8;SPKAC;SMIME;RAND;ENGINE;OCSP;PRIME"
 | 
			
		||||
$ TCPIP_PROGRAMS = ",,"
 | 
			
		||||
$ IF COMPILER .EQS. "VAXC" THEN -
 | 
			
		||||
     TCPIP_PROGRAMS = ",OPENSSL,"
 | 
			
		||||
@@ -152,149 +155,121 @@ $ PHASE := LIB
 | 
			
		||||
$!
 | 
			
		||||
$ RESTART: 
 | 
			
		||||
$!
 | 
			
		||||
$!  Define An App Counter And Set It To "0".
 | 
			
		||||
$!  Define A File Counter And Set It To "0".
 | 
			
		||||
$!
 | 
			
		||||
$ APP_COUNTER = 0
 | 
			
		||||
$ FILE_COUNTER = 0
 | 
			
		||||
$!
 | 
			
		||||
$!  Top Of The App Loop.
 | 
			
		||||
$! Top Of The File Loop.
 | 
			
		||||
$!
 | 
			
		||||
$ NEXT_APP:
 | 
			
		||||
$ NEXT_FILE:
 | 
			
		||||
$!
 | 
			
		||||
$!  Make The Application File Name
 | 
			
		||||
$! O.K, Extract The File Name From The File List.
 | 
			
		||||
$!
 | 
			
		||||
$ CURRENT_APP = F$EDIT(F$ELEMENT(APP_COUNTER,",",PROGRAMS),"TRIM")
 | 
			
		||||
$ FILE_NAME0 = F$EDIT(F$ELEMENT(FILE_COUNTER,";",'PHASE'_FILES),"TRIM")
 | 
			
		||||
$ FILE_NAME = F$EDIT(F$ELEMENT(0,",",FILE_NAME0),"TRIM")
 | 
			
		||||
$ EXTRA_OBJ = FILE_NAME0 - FILE_NAME
 | 
			
		||||
$!
 | 
			
		||||
$!  Check To See If We Are At The End Of The File List.
 | 
			
		||||
$! Check To See If We Are At The End Of The File List.
 | 
			
		||||
$!
 | 
			
		||||
$ IF (CURRENT_APP.EQS.",")
 | 
			
		||||
$ IF (FILE_NAME0.EQS.";")
 | 
			
		||||
$ THEN
 | 
			
		||||
$   IF (PHASE.EQS."LIB")
 | 
			
		||||
$   THEN
 | 
			
		||||
$     PHASE := APP
 | 
			
		||||
$     GOTO RESTART
 | 
			
		||||
$   ELSE
 | 
			
		||||
$     GOTO APP_DONE
 | 
			
		||||
$     GOTO FILE_DONE
 | 
			
		||||
$   ENDIF
 | 
			
		||||
$ ENDIF
 | 
			
		||||
$!
 | 
			
		||||
$!  Increment The Counter.
 | 
			
		||||
$! Increment The Counter.
 | 
			
		||||
$!
 | 
			
		||||
$ APP_COUNTER = APP_COUNTER + 1
 | 
			
		||||
$ FILE_COUNTER = FILE_COUNTER + 1
 | 
			
		||||
$!
 | 
			
		||||
$!  Decide if we're building the object files or not.
 | 
			
		||||
$! Check to see if this program should actually be compiled
 | 
			
		||||
$!
 | 
			
		||||
$ IF PHASE .EQS. "APP" .AND. -
 | 
			
		||||
     ","+PROGRAMS+"," - (","+F$EDIT(FILE_NAME,"UPCASE")+",") .EQS. ","+PROGRAMS+","
 | 
			
		||||
$ THEN
 | 
			
		||||
$   GOTO NEXT_FILE
 | 
			
		||||
$ ENDIF
 | 
			
		||||
$!
 | 
			
		||||
$! Create The Source File Name.
 | 
			
		||||
$!
 | 
			
		||||
$ SOURCE_FILE = "SYS$DISK:[]" + FILE_NAME + ".C"
 | 
			
		||||
$!
 | 
			
		||||
$! Create The Object File Name.
 | 
			
		||||
$!
 | 
			
		||||
$ OBJECT_FILE = OBJ_DIR + FILE_NAME + ".OBJ"
 | 
			
		||||
$!
 | 
			
		||||
$! Create The Executable File Name.
 | 
			
		||||
$!
 | 
			
		||||
$ EXE_FILE = EXE_DIR + FILE_NAME + ".EXE"
 | 
			
		||||
$ ON WARNING THEN GOTO NEXT_FILE
 | 
			
		||||
$!
 | 
			
		||||
$! Check To See If The File We Want To Compile Actually Exists.
 | 
			
		||||
$!
 | 
			
		||||
$ IF (F$SEARCH(SOURCE_FILE).EQS."")
 | 
			
		||||
$ THEN
 | 
			
		||||
$!
 | 
			
		||||
$!  Tell The User That The File Dosen't Exist.
 | 
			
		||||
$!
 | 
			
		||||
$   WRITE SYS$OUTPUT ""
 | 
			
		||||
$   WRITE SYS$OUTPUT "The File ",SOURCE_FILE," Dosen't Exist."
 | 
			
		||||
$   WRITE SYS$OUTPUT ""
 | 
			
		||||
$!
 | 
			
		||||
$!  Exit The Build.
 | 
			
		||||
$!
 | 
			
		||||
$   GOTO EXIT
 | 
			
		||||
$!
 | 
			
		||||
$! End The File Exist Check.
 | 
			
		||||
$!
 | 
			
		||||
$ ENDIF
 | 
			
		||||
$!
 | 
			
		||||
$! Tell The User What We Are Building.
 | 
			
		||||
$!
 | 
			
		||||
$ IF (PHASE.EQS."LIB")
 | 
			
		||||
$ THEN
 | 
			
		||||
$   WRITE SYS$OUTPUT "Compiling The ",FILE_NAME,".C File."
 | 
			
		||||
$ ELSE
 | 
			
		||||
$   WRITE SYS$OUTPUT "Building The ",FILE_NAME," Application Program."
 | 
			
		||||
$ ENDIF
 | 
			
		||||
$!
 | 
			
		||||
$!  Define A Library File Counter And Set It To "-1".
 | 
			
		||||
$!  -1 Means The Application File Name Is To Be Used.
 | 
			
		||||
$! Compile The File.
 | 
			
		||||
$!
 | 
			
		||||
$   LIB_COUNTER = -1
 | 
			
		||||
$ ON ERROR THEN GOTO NEXT_FILE
 | 
			
		||||
$ IF COMPILEWITH_CC2 - FILE_NAME .NES. COMPILEWITH_CC2
 | 
			
		||||
$ THEN
 | 
			
		||||
$   CC2/OBJECT='OBJECT_FILE' 'SOURCE_FILE'
 | 
			
		||||
$ ELSE
 | 
			
		||||
$   CC/OBJECT='OBJECT_FILE' 'SOURCE_FILE'
 | 
			
		||||
$ ENDIF
 | 
			
		||||
$!
 | 
			
		||||
$!  Create a .OPT file for the object files
 | 
			
		||||
$ ON WARNING THEN GOTO NEXT_FILE
 | 
			
		||||
$!
 | 
			
		||||
$   OPEN/WRITE OBJECTS 'EXE_DIR''CURRENT_APP'.OPT
 | 
			
		||||
$!
 | 
			
		||||
$!  Top Of The File Loop.
 | 
			
		||||
$!
 | 
			
		||||
$  NEXT_LIB:
 | 
			
		||||
$!
 | 
			
		||||
$!  O.K, Extract The File Name From The File List.
 | 
			
		||||
$!
 | 
			
		||||
$   IF LIB_COUNTER .GE. 0
 | 
			
		||||
$   THEN
 | 
			
		||||
$     FILE_NAME = F$EDIT(F$ELEMENT(LIB_COUNTER,",",LIB_'CURRENT_APP'),"TRIM")
 | 
			
		||||
$   ELSE
 | 
			
		||||
$     FILE_NAME = CURRENT_APP
 | 
			
		||||
$   ENDIF
 | 
			
		||||
$!
 | 
			
		||||
$!  Check To See If We Are At The End Of The File List.
 | 
			
		||||
$!
 | 
			
		||||
$   IF (FILE_NAME.EQS.",")
 | 
			
		||||
$   THEN
 | 
			
		||||
$     CLOSE OBJECTS
 | 
			
		||||
$     GOTO NEXT_APP
 | 
			
		||||
$   ENDIF
 | 
			
		||||
$!
 | 
			
		||||
$!  Increment The Counter.
 | 
			
		||||
$!
 | 
			
		||||
$   LIB_COUNTER = LIB_COUNTER + 1
 | 
			
		||||
$!
 | 
			
		||||
$!  Create The Source File Name.
 | 
			
		||||
$!
 | 
			
		||||
$   SOURCE_FILE = "SYS$DISK:[]" + FILE_NAME + ".C"
 | 
			
		||||
$!
 | 
			
		||||
$!  Create The Object File Name.
 | 
			
		||||
$!
 | 
			
		||||
$   OBJECT_FILE = OBJ_DIR + FILE_NAME + ".OBJ"
 | 
			
		||||
$!
 | 
			
		||||
$!  Create The Executable File Name.
 | 
			
		||||
$!
 | 
			
		||||
$   EXE_FILE = EXE_DIR + FILE_NAME + ".EXE"
 | 
			
		||||
$   ON WARNING THEN GOTO NEXT_LIB
 | 
			
		||||
$!
 | 
			
		||||
$!  Check To See If The File We Want To Compile Actually Exists.
 | 
			
		||||
$!
 | 
			
		||||
$   IF (F$SEARCH(SOURCE_FILE).EQS."")
 | 
			
		||||
$   THEN
 | 
			
		||||
$!
 | 
			
		||||
$!    Tell The User That The File Dosen't Exist.
 | 
			
		||||
$!
 | 
			
		||||
$     WRITE SYS$OUTPUT ""
 | 
			
		||||
$     WRITE SYS$OUTPUT "The File ",SOURCE_FILE," Dosen't Exist."
 | 
			
		||||
$     WRITE SYS$OUTPUT ""
 | 
			
		||||
$!
 | 
			
		||||
$!    Exit The Build.
 | 
			
		||||
$!
 | 
			
		||||
$     GOTO EXIT
 | 
			
		||||
$!
 | 
			
		||||
$!  End The File Exist Check.
 | 
			
		||||
$!
 | 
			
		||||
$   ENDIF
 | 
			
		||||
$!
 | 
			
		||||
$!  Tell The User What We Are Building.
 | 
			
		||||
$!
 | 
			
		||||
$   IF (PHASE.EQS."LIB")
 | 
			
		||||
$   THEN
 | 
			
		||||
$     WRITE SYS$OUTPUT "Compiling The ",FILE_NAME,".C File."
 | 
			
		||||
$   ELSE
 | 
			
		||||
$     WRITE SYS$OUTPUT "Building The ",FILE_NAME," Application Program."
 | 
			
		||||
$   ENDIF
 | 
			
		||||
$!
 | 
			
		||||
$!  Compile The File.
 | 
			
		||||
$!
 | 
			
		||||
$   ON ERROR THEN GOTO NEXT_LIB
 | 
			
		||||
$   IF COMPILEWITH_CC2 - FILE_NAME .NES. COMPILEWITH_CC2
 | 
			
		||||
$   THEN
 | 
			
		||||
$     CC2/OBJECT='OBJECT_FILE' 'SOURCE_FILE'
 | 
			
		||||
$   ELSE
 | 
			
		||||
$     CC/OBJECT='OBJECT_FILE' 'SOURCE_FILE'
 | 
			
		||||
$   ENDIF
 | 
			
		||||
$   WRITE OBJECTS OBJECT_FILE
 | 
			
		||||
$!
 | 
			
		||||
$   GOTO NEXT_LIB
 | 
			
		||||
$ IF (PHASE.EQS."LIB") 
 | 
			
		||||
$ THEN 
 | 
			
		||||
$   GOTO NEXT_FILE
 | 
			
		||||
$ ENDIF
 | 
			
		||||
$!
 | 
			
		||||
$!  Check if this program works well without a TCPIP library
 | 
			
		||||
$!
 | 
			
		||||
$ IF TCPIP_LIB .EQS. "" .AND. TCPIP_PROGRAMS - CURRENT_APP .NES. TCPIP_PROGRAMS
 | 
			
		||||
$ IF TCPIP_LIB .EQS. "" .AND. TCPIP_PROGRAMS - FILE_NAME .NES. TCPIP_PROGRAMS
 | 
			
		||||
$ THEN
 | 
			
		||||
$   WRITE SYS$OUTPUT CURRENT_APP," needs a TCP/IP library.  Can't link.  Skipping..."
 | 
			
		||||
$   GOTO NEXT_APP
 | 
			
		||||
$   WRITE SYS$OUTPUT FILE_NAME," needs a TCP/IP library.  Can't link.  Skipping..."
 | 
			
		||||
$   GOTO NEXT_FILE
 | 
			
		||||
$ ENDIF
 | 
			
		||||
$!
 | 
			
		||||
$! Link The Program.
 | 
			
		||||
$! Check To See If We Are To Link With A Specific TCP/IP Library.
 | 
			
		||||
$!
 | 
			
		||||
$ ON WARNING THEN GOTO NEXT_APP
 | 
			
		||||
$!
 | 
			
		||||
$ IF (TCPIP_LIB.NES."")
 | 
			
		||||
$ THEN
 | 
			
		||||
$!
 | 
			
		||||
$! Don't Link With The RSAREF Routines And TCP/IP Library.
 | 
			
		||||
$!
 | 
			
		||||
$   LINK/'DEBUGGER'/'TRACEBACK' /EXE='EXE_FILE' -
 | 
			
		||||
	'EXE_DIR''CURRENT_APP'.OPT/OPTION, -
 | 
			
		||||
	'OBJECT_FILE''EXTRA_OBJ', -
 | 
			
		||||
        'SSL_LIB'/LIBRARY,'CRYPTO_LIB'/LIBRARY, -
 | 
			
		||||
        'TCPIP_LIB','OPT_FILE'/OPTION
 | 
			
		||||
$!
 | 
			
		||||
@@ -305,7 +280,7 @@ $!
 | 
			
		||||
$! Don't Link With The RSAREF Routines And Link With A TCP/IP Library.
 | 
			
		||||
$!
 | 
			
		||||
$   LINK/'DEBUGGER'/'TRACEBACK' /EXE='EXE_FILE' -
 | 
			
		||||
	'EXE_DIR''CURRENT_APP'.OPT/OPTION, -
 | 
			
		||||
	'OBJECT_FILE''EXTRA_OBJ', -
 | 
			
		||||
        'SSL_LIB'/LIBRARY,'CRYPTO_LIB'/LIBRARY, -
 | 
			
		||||
        'OPT_FILE'/OPTION
 | 
			
		||||
$!
 | 
			
		||||
@@ -315,11 +290,11 @@ $ ENDIF
 | 
			
		||||
$!
 | 
			
		||||
$! Go Back And Do It Again.
 | 
			
		||||
$!
 | 
			
		||||
$ GOTO NEXT_APP
 | 
			
		||||
$ GOTO NEXT_FILE
 | 
			
		||||
$!
 | 
			
		||||
$! All Done With This File.
 | 
			
		||||
$!
 | 
			
		||||
$ APP_DONE:
 | 
			
		||||
$ FILE_DONE:
 | 
			
		||||
$ EXIT:
 | 
			
		||||
$!
 | 
			
		||||
$! All Done, Time To Clean Up And Exit.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										101
									
								
								apps/ocsp.c
									
									
									
									
									
								
							
							
						
						
									
										101
									
								
								apps/ocsp.c
									
									
									
									
									
								
							@@ -56,50 +56,25 @@
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
#ifndef OPENSSL_NO_OCSP
 | 
			
		||||
 | 
			
		||||
#ifdef OPENSSL_SYS_VMS
 | 
			
		||||
#define _XOPEN_SOURCE_EXTENDED	/* So fd_set and friends get properly defined
 | 
			
		||||
				   on OpenVMS */
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#define USE_SOCKETS
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <time.h>
 | 
			
		||||
#include "apps.h" /* needs to be included before the openssl headers! */
 | 
			
		||||
#include <openssl/e_os2.h>
 | 
			
		||||
#include <openssl/crypto.h>
 | 
			
		||||
#include <openssl/err.h>
 | 
			
		||||
#include <openssl/ssl.h>
 | 
			
		||||
#include <openssl/evp.h>
 | 
			
		||||
#include <openssl/bn.h>
 | 
			
		||||
#include <openssl/err.h>
 | 
			
		||||
 | 
			
		||||
#if defined(NETWARE_CLIB)
 | 
			
		||||
#  ifdef NETWARE_BSDSOCK
 | 
			
		||||
#    include <sys/socket.h>
 | 
			
		||||
#    include <sys/bsdskt.h>
 | 
			
		||||
#  else
 | 
			
		||||
#    include <novsock2.h>
 | 
			
		||||
#  endif
 | 
			
		||||
#elif defined(NETWARE_LIBC)
 | 
			
		||||
#  ifdef NETWARE_BSDSOCK
 | 
			
		||||
#    include <sys/select.h>
 | 
			
		||||
#  else
 | 
			
		||||
#    include <novsock2.h>
 | 
			
		||||
#  endif
 | 
			
		||||
#endif
 | 
			
		||||
  
 | 
			
		||||
/* Maximum leeway in validity period: default 5 minutes */
 | 
			
		||||
#define MAX_VALIDITY_PERIOD	(5 * 60)
 | 
			
		||||
 | 
			
		||||
static int add_ocsp_cert(OCSP_REQUEST **req, X509 *cert, const EVP_MD *cert_id_md, X509 *issuer,
 | 
			
		||||
static int add_ocsp_cert(OCSP_REQUEST **req, X509 *cert, X509 *issuer,
 | 
			
		||||
				STACK_OF(OCSP_CERTID) *ids);
 | 
			
		||||
static int add_ocsp_serial(OCSP_REQUEST **req, char *serial, const EVP_MD * cert_id_md, X509 *issuer,
 | 
			
		||||
static int add_ocsp_serial(OCSP_REQUEST **req, char *serial, X509 *issuer,
 | 
			
		||||
				STACK_OF(OCSP_CERTID) *ids);
 | 
			
		||||
static int print_ocsp_summary(BIO *out, OCSP_BASICRESP *bs, OCSP_REQUEST *req,
 | 
			
		||||
			      STACK_OF(STRING) *names,
 | 
			
		||||
			      STACK_OF(OCSP_CERTID) *ids, long nsec,
 | 
			
		||||
			      long maxage);
 | 
			
		||||
				STACK *names, STACK_OF(OCSP_CERTID) *ids,
 | 
			
		||||
				long nsec, long maxage);
 | 
			
		||||
 | 
			
		||||
static int make_ocsp_response(OCSP_RESPONSE **resp, OCSP_REQUEST *req, CA_DB *db,
 | 
			
		||||
			X509 *ca, X509 *rcert, EVP_PKEY *rkey,
 | 
			
		||||
@@ -151,7 +126,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	int badarg = 0;
 | 
			
		||||
	int i;
 | 
			
		||||
	int ignore_err = 0;
 | 
			
		||||
	STACK_OF(STRING) *reqnames = NULL;
 | 
			
		||||
	STACK *reqnames = NULL;
 | 
			
		||||
	STACK_OF(OCSP_CERTID) *ids = NULL;
 | 
			
		||||
 | 
			
		||||
	X509 *rca_cert = NULL;
 | 
			
		||||
@@ -159,7 +134,6 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	char *rca_filename = NULL;
 | 
			
		||||
	CA_DB *rdb = NULL;
 | 
			
		||||
	int nmin = 0, ndays = -1;
 | 
			
		||||
	const EVP_MD *cert_id_md = NULL;
 | 
			
		||||
 | 
			
		||||
	if (bio_err == NULL) bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
 | 
			
		||||
 | 
			
		||||
@@ -168,7 +142,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	SSL_load_error_strings();
 | 
			
		||||
	OpenSSL_add_ssl_algorithms();
 | 
			
		||||
	args = argv + 1;
 | 
			
		||||
	reqnames = sk_STRING_new_null();
 | 
			
		||||
	reqnames = sk_new_null();
 | 
			
		||||
	ids = sk_OCSP_CERTID_new_null();
 | 
			
		||||
	while (!badarg && *args && *args[0] == '-')
 | 
			
		||||
		{
 | 
			
		||||
@@ -427,10 +401,9 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
				cert = load_cert(bio_err, *args, FORMAT_PEM,
 | 
			
		||||
					NULL, e, "certificate");
 | 
			
		||||
				if(!cert) goto end;
 | 
			
		||||
				if (!cert_id_md) cert_id_md = EVP_sha1();
 | 
			
		||||
				if(!add_ocsp_cert(&req, cert, cert_id_md, issuer, ids))
 | 
			
		||||
				if(!add_ocsp_cert(&req, cert, issuer, ids))
 | 
			
		||||
					goto end;
 | 
			
		||||
				if(!sk_STRING_push(reqnames, *args))
 | 
			
		||||
				if(!sk_push(reqnames, *args))
 | 
			
		||||
					goto end;
 | 
			
		||||
				}
 | 
			
		||||
			else badarg = 1;
 | 
			
		||||
@@ -440,10 +413,9 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
			if (args[1])
 | 
			
		||||
				{
 | 
			
		||||
				args++;
 | 
			
		||||
				if (!cert_id_md) cert_id_md = EVP_sha1();
 | 
			
		||||
				if(!add_ocsp_serial(&req, *args, cert_id_md, issuer, ids))
 | 
			
		||||
				if(!add_ocsp_serial(&req, *args, issuer, ids))
 | 
			
		||||
					goto end;
 | 
			
		||||
				if(!sk_STRING_push(reqnames, *args))
 | 
			
		||||
				if(!sk_push(reqnames, *args))
 | 
			
		||||
					goto end;
 | 
			
		||||
				}
 | 
			
		||||
			else badarg = 1;
 | 
			
		||||
@@ -543,10 +515,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
				}
 | 
			
		||||
			else badarg = 1;
 | 
			
		||||
			}
 | 
			
		||||
		else if ((cert_id_md = EVP_get_digestbyname((*args)+1))==NULL)
 | 
			
		||||
			{
 | 
			
		||||
			badarg = 1;
 | 
			
		||||
			}
 | 
			
		||||
		else badarg = 1;
 | 
			
		||||
		args++;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@@ -602,7 +571,6 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
		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");
 | 
			
		||||
		BIO_printf (bio_err, "-<dgst alg>     use specified digest in the request");
 | 
			
		||||
		goto end;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@@ -709,8 +677,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
			"signer private key");
 | 
			
		||||
		if (!key)
 | 
			
		||||
			goto end;
 | 
			
		||||
 | 
			
		||||
		if (!OCSP_request_sign(req, signer, key, NULL, 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");
 | 
			
		||||
			goto end;
 | 
			
		||||
@@ -899,7 +866,7 @@ end:
 | 
			
		||||
	OCSP_REQUEST_free(req);
 | 
			
		||||
	OCSP_RESPONSE_free(resp);
 | 
			
		||||
	OCSP_BASICRESP_free(bs);
 | 
			
		||||
	sk_STRING_free(reqnames);
 | 
			
		||||
	sk_free(reqnames);
 | 
			
		||||
	sk_OCSP_CERTID_free(ids);
 | 
			
		||||
	sk_X509_pop_free(sign_other, X509_free);
 | 
			
		||||
	sk_X509_pop_free(verify_other, X509_free);
 | 
			
		||||
@@ -914,7 +881,7 @@ end:
 | 
			
		||||
	OPENSSL_EXIT(ret);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int add_ocsp_cert(OCSP_REQUEST **req, X509 *cert, const EVP_MD *cert_id_md,X509 *issuer,
 | 
			
		||||
static int add_ocsp_cert(OCSP_REQUEST **req, X509 *cert, X509 *issuer,
 | 
			
		||||
				STACK_OF(OCSP_CERTID) *ids)
 | 
			
		||||
	{
 | 
			
		||||
	OCSP_CERTID *id;
 | 
			
		||||
@@ -925,7 +892,7 @@ static int add_ocsp_cert(OCSP_REQUEST **req, X509 *cert, const EVP_MD *cert_id_m
 | 
			
		||||
		}
 | 
			
		||||
	if(!*req) *req = OCSP_REQUEST_new();
 | 
			
		||||
	if(!*req) goto err;
 | 
			
		||||
	id = OCSP_cert_to_id(cert_id_md, cert, issuer);
 | 
			
		||||
	id = OCSP_cert_to_id(NULL, cert, issuer);
 | 
			
		||||
	if(!id || !sk_OCSP_CERTID_push(ids, id)) goto err;
 | 
			
		||||
	if(!OCSP_request_add0_id(*req, id)) goto err;
 | 
			
		||||
	return 1;
 | 
			
		||||
@@ -935,7 +902,7 @@ static int add_ocsp_cert(OCSP_REQUEST **req, X509 *cert, const EVP_MD *cert_id_m
 | 
			
		||||
	return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static int add_ocsp_serial(OCSP_REQUEST **req, char *serial,const EVP_MD *cert_id_md, X509 *issuer,
 | 
			
		||||
static int add_ocsp_serial(OCSP_REQUEST **req, char *serial, X509 *issuer,
 | 
			
		||||
				STACK_OF(OCSP_CERTID) *ids)
 | 
			
		||||
	{
 | 
			
		||||
	OCSP_CERTID *id;
 | 
			
		||||
@@ -957,7 +924,7 @@ static int add_ocsp_serial(OCSP_REQUEST **req, char *serial,const EVP_MD *cert_i
 | 
			
		||||
		BIO_printf(bio_err, "Error converting serial number %s\n", serial);
 | 
			
		||||
		return 0;
 | 
			
		||||
		}
 | 
			
		||||
	id = OCSP_cert_id_new(cert_id_md, iname, ikey, sno);
 | 
			
		||||
	id = OCSP_cert_id_new(EVP_sha1(), iname, ikey, sno);
 | 
			
		||||
	ASN1_INTEGER_free(sno);
 | 
			
		||||
	if(!id || !sk_OCSP_CERTID_push(ids, id)) goto err;
 | 
			
		||||
	if(!OCSP_request_add0_id(*req, id)) goto err;
 | 
			
		||||
@@ -969,9 +936,8 @@ static int add_ocsp_serial(OCSP_REQUEST **req, char *serial,const EVP_MD *cert_i
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static int print_ocsp_summary(BIO *out, OCSP_BASICRESP *bs, OCSP_REQUEST *req,
 | 
			
		||||
			      STACK_OF(STRING) *names,
 | 
			
		||||
			      STACK_OF(OCSP_CERTID) *ids, long nsec,
 | 
			
		||||
			      long maxage)
 | 
			
		||||
					STACK *names, STACK_OF(OCSP_CERTID) *ids,
 | 
			
		||||
					long nsec, long maxage)
 | 
			
		||||
	{
 | 
			
		||||
	OCSP_CERTID *id;
 | 
			
		||||
	char *name;
 | 
			
		||||
@@ -981,13 +947,13 @@ static int print_ocsp_summary(BIO *out, OCSP_BASICRESP *bs, OCSP_REQUEST *req,
 | 
			
		||||
 | 
			
		||||
	ASN1_GENERALIZEDTIME *rev, *thisupd, *nextupd;
 | 
			
		||||
 | 
			
		||||
	if (!bs || !req || !sk_STRING_num(names) || !sk_OCSP_CERTID_num(ids))
 | 
			
		||||
	if (!bs || !req || !sk_num(names) || !sk_OCSP_CERTID_num(ids))
 | 
			
		||||
		return 1;
 | 
			
		||||
 | 
			
		||||
	for (i = 0; i < sk_OCSP_CERTID_num(ids); i++)
 | 
			
		||||
		{
 | 
			
		||||
		id = sk_OCSP_CERTID_value(ids, i);
 | 
			
		||||
		name = sk_STRING_value(names, i);
 | 
			
		||||
		name = sk_value(names, i);
 | 
			
		||||
		BIO_printf(out, "%s: ", name);
 | 
			
		||||
 | 
			
		||||
		if(!OCSP_resp_find_status(bs, id, &status, &reason,
 | 
			
		||||
@@ -1044,6 +1010,7 @@ static int make_ocsp_response(OCSP_RESPONSE **resp, OCSP_REQUEST *req, CA_DB *db
 | 
			
		||||
	OCSP_BASICRESP *bs = NULL;
 | 
			
		||||
	int i, id_count, ret = 1;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	id_count = OCSP_request_onereq_count(req);
 | 
			
		||||
 | 
			
		||||
	if (id_count <= 0)
 | 
			
		||||
@@ -1052,6 +1019,7 @@ static int make_ocsp_response(OCSP_RESPONSE **resp, OCSP_REQUEST *req, CA_DB *db
 | 
			
		||||
		goto end;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	ca_id = OCSP_cert_to_id(EVP_sha1(), NULL, ca);
 | 
			
		||||
 | 
			
		||||
	bs = OCSP_BASICRESP_new();
 | 
			
		||||
	thisupd = X509_gmtime_adj(NULL, 0);
 | 
			
		||||
@@ -1064,23 +1032,8 @@ static int make_ocsp_response(OCSP_RESPONSE **resp, OCSP_REQUEST *req, CA_DB *db
 | 
			
		||||
		OCSP_ONEREQ *one;
 | 
			
		||||
		ASN1_INTEGER *serial;
 | 
			
		||||
		char **inf;
 | 
			
		||||
		ASN1_OBJECT *cert_id_md_oid;
 | 
			
		||||
		const EVP_MD *cert_id_md;
 | 
			
		||||
		one = OCSP_request_onereq_get0(req, i);
 | 
			
		||||
		cid = OCSP_onereq_get0_id(one);
 | 
			
		||||
 | 
			
		||||
		OCSP_id_get0_info(NULL,&cert_id_md_oid, NULL,NULL, cid);
 | 
			
		||||
 | 
			
		||||
		cert_id_md = EVP_get_digestbyobj(cert_id_md_oid);	
 | 
			
		||||
		if (! cert_id_md) 
 | 
			
		||||
			{
 | 
			
		||||
			*resp = OCSP_response_create(OCSP_RESPONSE_STATUS_INTERNALERROR,
 | 
			
		||||
				NULL);
 | 
			
		||||
				goto end;
 | 
			
		||||
			}	
 | 
			
		||||
		if (ca_id) OCSP_CERTID_free(ca_id);
 | 
			
		||||
		ca_id = OCSP_cert_to_id(cert_id_md, NULL, ca);
 | 
			
		||||
 | 
			
		||||
		/* Is this request about our CA? */
 | 
			
		||||
		if (OCSP_id_issuer_cmp(ca_id, cid))
 | 
			
		||||
			{
 | 
			
		||||
@@ -1125,8 +1078,8 @@ static int make_ocsp_response(OCSP_RESPONSE **resp, OCSP_REQUEST *req, CA_DB *db
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	OCSP_copy_nonce(bs, req);
 | 
			
		||||
	
 | 
			
		||||
	OCSP_basic_sign(bs, rcert, rkey, NULL, rother, flags);
 | 
			
		||||
		
 | 
			
		||||
	OCSP_basic_sign(bs, rcert, rkey, EVP_sha1(), rother, flags);
 | 
			
		||||
 | 
			
		||||
	*resp = OCSP_response_create(OCSP_RESPONSE_STATUS_SUCCESSFUL, bs);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -21,17 +21,12 @@ oid_section		= new_oids
 | 
			
		||||
 | 
			
		||||
[ new_oids ]
 | 
			
		||||
 | 
			
		||||
# We can add new OIDs in here for use by 'ca', 'req' and 'ts'.
 | 
			
		||||
# We can add new OIDs in here for use by 'ca' and 'req'.
 | 
			
		||||
# Add a simple OID like this:
 | 
			
		||||
# testoid1=1.2.3.4
 | 
			
		||||
# Or use config file substitution like this:
 | 
			
		||||
# testoid2=${testoid1}.5.6
 | 
			
		||||
 | 
			
		||||
# Policies used by the TSA examples.
 | 
			
		||||
tsa_policy1 = 1.2.3.4.1
 | 
			
		||||
tsa_policy2 = 1.2.3.4.5.6
 | 
			
		||||
tsa_policy3 = 1.2.3.4.5.7
 | 
			
		||||
 | 
			
		||||
####################################################################
 | 
			
		||||
[ ca ]
 | 
			
		||||
default_ca	= CA_default		# The default ca section
 | 
			
		||||
@@ -72,7 +67,7 @@ cert_opt 	= ca_default		# Certificate field options
 | 
			
		||||
 | 
			
		||||
default_days	= 365			# how long to certify for
 | 
			
		||||
default_crl_days= 30			# how long before next CRL
 | 
			
		||||
default_md	= default		# use public key default MD
 | 
			
		||||
default_md	= sha1			# which md to use.
 | 
			
		||||
preserve	= no			# keep passed DN ordering
 | 
			
		||||
 | 
			
		||||
# A few difference way of specifying how similar the request should look
 | 
			
		||||
@@ -115,12 +110,13 @@ x509_extensions	= v3_ca	# The extentions to add to the self signed cert
 | 
			
		||||
 | 
			
		||||
# This sets a mask for permitted string types. There are several options. 
 | 
			
		||||
# default: PrintableString, T61String, BMPString.
 | 
			
		||||
# pkix	 : PrintableString, BMPString (PKIX recommendation before 2004)
 | 
			
		||||
# utf8only: only UTF8Strings (PKIX recommendation after 2004).
 | 
			
		||||
# pkix	 : PrintableString, BMPString.
 | 
			
		||||
# utf8only: only UTF8Strings.
 | 
			
		||||
# nombstr : PrintableString, T61String (no BMPStrings or UTF8Strings).
 | 
			
		||||
# MASK:XXXX a literal mask value.
 | 
			
		||||
# WARNING: ancient versions of Netscape crash on BMPStrings or UTF8Strings.
 | 
			
		||||
string_mask = utf8only
 | 
			
		||||
# WARNING: current versions of Netscape crash on BMPStrings or UTF8Strings
 | 
			
		||||
# so use this option with caution!
 | 
			
		||||
string_mask = nombstr
 | 
			
		||||
 | 
			
		||||
# req_extensions = v3_req # The extensions to add to a certificate request
 | 
			
		||||
 | 
			
		||||
@@ -211,9 +207,6 @@ authorityKeyIdentifier=keyid,issuer
 | 
			
		||||
#nsCaPolicyUrl
 | 
			
		||||
#nsSslServerName
 | 
			
		||||
 | 
			
		||||
# This is required for TSA certificates.
 | 
			
		||||
# extendedKeyUsage = critical,timeStamping
 | 
			
		||||
 | 
			
		||||
[ v3_req ]
 | 
			
		||||
 | 
			
		||||
# Extensions to add to a certificate request
 | 
			
		||||
@@ -318,33 +311,3 @@ authorityKeyIdentifier=keyid,issuer:always
 | 
			
		||||
 | 
			
		||||
# This really needs to be in place for it to be a proxy certificate.
 | 
			
		||||
proxyCertInfo=critical,language:id-ppl-anyLanguage,pathlen:3,policy:foo
 | 
			
		||||
 | 
			
		||||
####################################################################
 | 
			
		||||
[ tsa ]
 | 
			
		||||
 | 
			
		||||
default_tsa = tsa_config1	# the default TSA section
 | 
			
		||||
 | 
			
		||||
[ tsa_config1 ]
 | 
			
		||||
 | 
			
		||||
# These are used by the TSA reply generation only.
 | 
			
		||||
dir		= sys\$disk:[.demoCA		# TSA root directory
 | 
			
		||||
serial		= $dir]tsaserial.	# The current serial number (mandatory)
 | 
			
		||||
crypto_device	= builtin		# OpenSSL engine to use for signing
 | 
			
		||||
signer_cert	= $dir/tsacert.pem 	# The TSA signing certificate
 | 
			
		||||
					# (optional)
 | 
			
		||||
certs		= $dir.cacert.pem]	# Certificate chain to include in reply
 | 
			
		||||
					# (optional)
 | 
			
		||||
signer_key	= $dir/private/tsakey.pem # The TSA private key (optional)
 | 
			
		||||
 | 
			
		||||
default_policy	= tsa_policy1		# Policy if request did not specify it
 | 
			
		||||
					# (optional)
 | 
			
		||||
other_policies	= tsa_policy2, tsa_policy3	# acceptable policies (optional)
 | 
			
		||||
digests		= md5, sha1		# Acceptable message digests (mandatory)
 | 
			
		||||
accuracy	= secs:1, millisecs:500, microsecs:100	# (optional)
 | 
			
		||||
clock_precision_digits  = 0	# number of digits after dot. (optional)
 | 
			
		||||
ordering		= yes	# Is ordering defined for timestamps?
 | 
			
		||||
				# (optional, default: no)
 | 
			
		||||
tsa_name		= yes	# Must the TSA name be included in the reply?
 | 
			
		||||
				# (optional, default: no)
 | 
			
		||||
ess_cert_id_chain	= no	# Must the ESS cert id chain be included?
 | 
			
		||||
				# (optional, default: no)
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										196
									
								
								apps/openssl.c
									
									
									
									
									
								
							
							
						
						
									
										196
									
								
								apps/openssl.c
									
									
									
									
									
								
							@@ -135,17 +135,19 @@
 | 
			
		||||
 * type of "FUNCTION*"). This removes the necessity for macro-generated wrapper
 | 
			
		||||
 * functions. */
 | 
			
		||||
 | 
			
		||||
static LHASH_OF(FUNCTION) *prog_init(void );
 | 
			
		||||
static int do_cmd(LHASH_OF(FUNCTION) *prog,int argc,char *argv[]);
 | 
			
		||||
static void list_pkey(BIO *out);
 | 
			
		||||
static void list_cipher(BIO *out);
 | 
			
		||||
static void list_md(BIO *out);
 | 
			
		||||
/* static unsigned long MS_CALLBACK hash(FUNCTION *a); */
 | 
			
		||||
static unsigned long MS_CALLBACK hash(const void *a_void);
 | 
			
		||||
/* static int MS_CALLBACK cmp(FUNCTION *a,FUNCTION *b); */
 | 
			
		||||
static int MS_CALLBACK cmp(const void *a_void,const void *b_void);
 | 
			
		||||
static LHASH *prog_init(void );
 | 
			
		||||
static int do_cmd(LHASH *prog,int argc,char *argv[]);
 | 
			
		||||
char *default_config_file=NULL;
 | 
			
		||||
 | 
			
		||||
/* Make sure there is only one when MONOLITH is defined */
 | 
			
		||||
#ifdef MONOLITH
 | 
			
		||||
CONF *config=NULL;
 | 
			
		||||
BIO *bio_err=NULL;
 | 
			
		||||
int in_FIPS_mode=0;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -225,12 +227,25 @@ int main(int Argc, char *Argv[])
 | 
			
		||||
	int n,i,ret=0;
 | 
			
		||||
	int argc;
 | 
			
		||||
	char **argv,*p;
 | 
			
		||||
	LHASH_OF(FUNCTION) *prog=NULL;
 | 
			
		||||
	LHASH *prog=NULL;
 | 
			
		||||
	long errline;
 | 
			
		||||
 
 | 
			
		||||
	arg.data=NULL;
 | 
			
		||||
	arg.count=0;
 | 
			
		||||
 | 
			
		||||
	in_FIPS_mode = 0;
 | 
			
		||||
 | 
			
		||||
#ifdef OPENSSL_FIPS
 | 
			
		||||
	if(getenv("OPENSSL_FIPS")) {
 | 
			
		||||
		if (!FIPS_mode_set(1)) {
 | 
			
		||||
			ERR_load_crypto_strings();
 | 
			
		||||
			ERR_print_errors(BIO_new_fp(stderr,BIO_NOCLOSE));
 | 
			
		||||
			EXIT(1);
 | 
			
		||||
		}
 | 
			
		||||
		in_FIPS_mode = 1;
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	if (bio_err == NULL)
 | 
			
		||||
		if ((bio_err=BIO_new(BIO_s_file())) != NULL)
 | 
			
		||||
			BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
 | 
			
		||||
@@ -272,21 +287,9 @@ int main(int Argc, char *Argv[])
 | 
			
		||||
	i=NCONF_load(config,p,&errline);
 | 
			
		||||
	if (i == 0)
 | 
			
		||||
		{
 | 
			
		||||
		if (ERR_GET_REASON(ERR_peek_last_error())
 | 
			
		||||
		    == CONF_R_NO_SUCH_FILE)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bio_err,
 | 
			
		||||
				   "WARNING: can't open config file: %s\n",p);
 | 
			
		||||
			ERR_clear_error();
 | 
			
		||||
			NCONF_free(config);
 | 
			
		||||
			config = NULL;
 | 
			
		||||
			}
 | 
			
		||||
		else
 | 
			
		||||
			{
 | 
			
		||||
			ERR_print_errors(bio_err);
 | 
			
		||||
			NCONF_free(config);
 | 
			
		||||
			exit(1);
 | 
			
		||||
			}
 | 
			
		||||
		NCONF_free(config);
 | 
			
		||||
		config = NULL;
 | 
			
		||||
		ERR_clear_error();
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	prog=prog_init();
 | 
			
		||||
@@ -295,7 +298,7 @@ int main(int Argc, char *Argv[])
 | 
			
		||||
	program_name(Argv[0],pname,sizeof pname);
 | 
			
		||||
 | 
			
		||||
	f.name=pname;
 | 
			
		||||
	fp=lh_FUNCTION_retrieve(prog,&f);
 | 
			
		||||
	fp=(FUNCTION *)lh_retrieve(prog,&f);
 | 
			
		||||
	if (fp != NULL)
 | 
			
		||||
		{
 | 
			
		||||
		Argv[0]=pname;
 | 
			
		||||
@@ -361,7 +364,7 @@ end:
 | 
			
		||||
		NCONF_free(config);
 | 
			
		||||
		config=NULL;
 | 
			
		||||
		}
 | 
			
		||||
	if (prog != NULL) lh_FUNCTION_free(prog);
 | 
			
		||||
	if (prog != NULL) lh_free(prog);
 | 
			
		||||
	if (arg.data != NULL) OPENSSL_free(arg.data);
 | 
			
		||||
 | 
			
		||||
	apps_shutdown();
 | 
			
		||||
@@ -377,13 +380,9 @@ end:
 | 
			
		||||
 | 
			
		||||
#define LIST_STANDARD_COMMANDS "list-standard-commands"
 | 
			
		||||
#define LIST_MESSAGE_DIGEST_COMMANDS "list-message-digest-commands"
 | 
			
		||||
#define LIST_MESSAGE_DIGEST_ALGORITHMS "list-message-digest-algorithms"
 | 
			
		||||
#define LIST_CIPHER_COMMANDS "list-cipher-commands"
 | 
			
		||||
#define LIST_CIPHER_ALGORITHMS "list-cipher-algorithms"
 | 
			
		||||
#define LIST_PUBLIC_KEY_ALGORITHMS "list-public-key-algorithms"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static int do_cmd(LHASH_OF(FUNCTION) *prog, int argc, char *argv[])
 | 
			
		||||
static int do_cmd(LHASH *prog, int argc, char *argv[])
 | 
			
		||||
	{
 | 
			
		||||
	FUNCTION f,*fp;
 | 
			
		||||
	int i,ret=1,tp,nl;
 | 
			
		||||
@@ -391,7 +390,7 @@ static int do_cmd(LHASH_OF(FUNCTION) *prog, int argc, char *argv[])
 | 
			
		||||
	if ((argc <= 0) || (argv[0] == NULL))
 | 
			
		||||
		{ ret=0; goto end; }
 | 
			
		||||
	f.name=argv[0];
 | 
			
		||||
	fp=lh_FUNCTION_retrieve(prog,&f);
 | 
			
		||||
	fp=(FUNCTION *)lh_retrieve(prog,&f);
 | 
			
		||||
	if (fp != NULL)
 | 
			
		||||
		{
 | 
			
		||||
		ret=fp->func(argc,argv);
 | 
			
		||||
@@ -406,7 +405,7 @@ static int do_cmd(LHASH_OF(FUNCTION) *prog, int argc, char *argv[])
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
		f.name=argv[0]+3;
 | 
			
		||||
		ret = (lh_FUNCTION_retrieve(prog,&f) != NULL);
 | 
			
		||||
		ret = (lh_retrieve(prog,&f) != NULL);
 | 
			
		||||
		if (!ret)
 | 
			
		||||
			BIO_printf(bio_stdout, "%s\n", argv[0]);
 | 
			
		||||
		else
 | 
			
		||||
@@ -424,10 +423,7 @@ static int do_cmd(LHASH_OF(FUNCTION) *prog, int argc, char *argv[])
 | 
			
		||||
		}
 | 
			
		||||
	else if ((strcmp(argv[0],LIST_STANDARD_COMMANDS) == 0) ||
 | 
			
		||||
		(strcmp(argv[0],LIST_MESSAGE_DIGEST_COMMANDS) == 0) ||
 | 
			
		||||
		(strcmp(argv[0],LIST_MESSAGE_DIGEST_ALGORITHMS) == 0) ||
 | 
			
		||||
		(strcmp(argv[0],LIST_CIPHER_COMMANDS) == 0) ||
 | 
			
		||||
		(strcmp(argv[0],LIST_CIPHER_ALGORITHMS) == 0) ||
 | 
			
		||||
		(strcmp(argv[0],LIST_PUBLIC_KEY_ALGORITHMS) == 0))
 | 
			
		||||
		(strcmp(argv[0],LIST_CIPHER_COMMANDS) == 0))
 | 
			
		||||
		{
 | 
			
		||||
		int list_type;
 | 
			
		||||
		BIO *bio_stdout;
 | 
			
		||||
@@ -436,12 +432,6 @@ static int do_cmd(LHASH_OF(FUNCTION) *prog, int argc, char *argv[])
 | 
			
		||||
			list_type = FUNC_TYPE_GENERAL;
 | 
			
		||||
		else if (strcmp(argv[0],LIST_MESSAGE_DIGEST_COMMANDS) == 0)
 | 
			
		||||
			list_type = FUNC_TYPE_MD;
 | 
			
		||||
		else if (strcmp(argv[0],LIST_MESSAGE_DIGEST_ALGORITHMS) == 0)
 | 
			
		||||
			list_type = FUNC_TYPE_MD_ALG;
 | 
			
		||||
		else if (strcmp(argv[0],LIST_PUBLIC_KEY_ALGORITHMS) == 0)
 | 
			
		||||
			list_type = FUNC_TYPE_PKEY;
 | 
			
		||||
		else if (strcmp(argv[0],LIST_CIPHER_ALGORITHMS) == 0)
 | 
			
		||||
			list_type = FUNC_TYPE_CIPHER_ALG;
 | 
			
		||||
		else /* strcmp(argv[0],LIST_CIPHER_COMMANDS) == 0 */
 | 
			
		||||
			list_type = FUNC_TYPE_CIPHER;
 | 
			
		||||
		bio_stdout = BIO_new_fp(stdout,BIO_NOCLOSE);
 | 
			
		||||
@@ -451,23 +441,10 @@ static int do_cmd(LHASH_OF(FUNCTION) *prog, int argc, char *argv[])
 | 
			
		||||
		bio_stdout = BIO_push(tmpbio, bio_stdout);
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
		if (!load_config(bio_err, NULL))
 | 
			
		||||
			goto end;
 | 
			
		||||
 | 
			
		||||
		if (list_type == FUNC_TYPE_PKEY)
 | 
			
		||||
			list_pkey(bio_stdout);	
 | 
			
		||||
		if (list_type == FUNC_TYPE_MD_ALG)
 | 
			
		||||
			list_md(bio_stdout);	
 | 
			
		||||
		if (list_type == FUNC_TYPE_CIPHER_ALG)
 | 
			
		||||
			list_cipher(bio_stdout);	
 | 
			
		||||
		else
 | 
			
		||||
			{
 | 
			
		||||
			for (fp=functions; fp->name != NULL; fp++)
 | 
			
		||||
				if (fp->type == list_type)
 | 
			
		||||
					BIO_printf(bio_stdout, "%s\n",
 | 
			
		||||
								fp->name);
 | 
			
		||||
			}
 | 
			
		||||
		
 | 
			
		||||
		for (fp=functions; fp->name != NULL; fp++)
 | 
			
		||||
			if (fp->type == list_type)
 | 
			
		||||
				BIO_printf(bio_stdout, "%s\n", fp->name);
 | 
			
		||||
		BIO_free_all(bio_stdout);
 | 
			
		||||
		ret=0;
 | 
			
		||||
		goto end;
 | 
			
		||||
@@ -530,94 +507,9 @@ static int SortFnByName(const void *_f1,const void *_f2)
 | 
			
		||||
    return strcmp(f1->name,f2->name);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
static void list_pkey(BIO *out)
 | 
			
		||||
static LHASH *prog_init(void)
 | 
			
		||||
	{
 | 
			
		||||
	int i;
 | 
			
		||||
	for (i = 0; i < EVP_PKEY_asn1_get_count(); i++)
 | 
			
		||||
		{
 | 
			
		||||
		const EVP_PKEY_ASN1_METHOD *ameth;
 | 
			
		||||
		int pkey_id, pkey_base_id, pkey_flags;
 | 
			
		||||
		const char *pinfo, *pem_str;
 | 
			
		||||
		ameth = EVP_PKEY_asn1_get0(i);
 | 
			
		||||
		EVP_PKEY_asn1_get0_info(&pkey_id, &pkey_base_id, &pkey_flags,
 | 
			
		||||
						&pinfo, &pem_str, ameth);
 | 
			
		||||
		if (pkey_flags & ASN1_PKEY_ALIAS)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(out, "Name: %s\n", 
 | 
			
		||||
					OBJ_nid2ln(pkey_id));
 | 
			
		||||
			BIO_printf(out, "\tType: Alias to %s\n",
 | 
			
		||||
					OBJ_nid2ln(pkey_base_id));
 | 
			
		||||
			}
 | 
			
		||||
		else
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(out, "Name: %s\n", pinfo);
 | 
			
		||||
			BIO_printf(out, "\tType: %s Algorithm\n", 
 | 
			
		||||
				pkey_flags & ASN1_PKEY_DYNAMIC ?
 | 
			
		||||
					"External" : "Builtin");
 | 
			
		||||
			BIO_printf(out, "\tOID: %s\n", OBJ_nid2ln(pkey_id));
 | 
			
		||||
			if (pem_str == NULL)
 | 
			
		||||
				pem_str = "(none)";
 | 
			
		||||
			BIO_printf(out, "\tPEM string: %s\n", pem_str);
 | 
			
		||||
			}
 | 
			
		||||
					
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static void list_cipher_fn(const EVP_CIPHER *c,
 | 
			
		||||
			const char *from, const char *to, void *arg)
 | 
			
		||||
	{
 | 
			
		||||
	if (c)
 | 
			
		||||
		BIO_printf(arg, "%s\n", EVP_CIPHER_name(c));
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		if (!from)
 | 
			
		||||
			from = "<undefined>";
 | 
			
		||||
		if (!to)
 | 
			
		||||
			to = "<undefined>";
 | 
			
		||||
		BIO_printf(arg, "%s => %s\n", from, to);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static void list_cipher(BIO *out)
 | 
			
		||||
	{
 | 
			
		||||
	EVP_CIPHER_do_all_sorted(list_cipher_fn, out);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static void list_md_fn(const EVP_MD *m,
 | 
			
		||||
			const char *from, const char *to, void *arg)
 | 
			
		||||
	{
 | 
			
		||||
	if (m)
 | 
			
		||||
		BIO_printf(arg, "%s\n", EVP_MD_name(m));
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		if (!from)
 | 
			
		||||
			from = "<undefined>";
 | 
			
		||||
		if (!to)
 | 
			
		||||
			to = "<undefined>";
 | 
			
		||||
		BIO_printf(arg, "%s => %s\n", from, to);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static void list_md(BIO *out)
 | 
			
		||||
	{
 | 
			
		||||
	EVP_MD_do_all_sorted(list_md_fn, out);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static int MS_CALLBACK function_cmp(const FUNCTION *a, const FUNCTION *b)
 | 
			
		||||
	{
 | 
			
		||||
	return strncmp(a->name,b->name,8);
 | 
			
		||||
	}
 | 
			
		||||
static IMPLEMENT_LHASH_COMP_FN(function, FUNCTION)
 | 
			
		||||
 | 
			
		||||
static unsigned long MS_CALLBACK function_hash(const FUNCTION *a)
 | 
			
		||||
	{
 | 
			
		||||
	return lh_strhash(a->name);
 | 
			
		||||
	}	
 | 
			
		||||
static IMPLEMENT_LHASH_HASH_FN(function, FUNCTION)
 | 
			
		||||
 | 
			
		||||
static LHASH_OF(FUNCTION) *prog_init(void)
 | 
			
		||||
	{
 | 
			
		||||
	LHASH_OF(FUNCTION) *ret;
 | 
			
		||||
	LHASH *ret;
 | 
			
		||||
	FUNCTION *f;
 | 
			
		||||
	size_t i;
 | 
			
		||||
 | 
			
		||||
@@ -626,11 +518,23 @@ static LHASH_OF(FUNCTION) *prog_init(void)
 | 
			
		||||
	    ;
 | 
			
		||||
	qsort(functions,i,sizeof *functions,SortFnByName);
 | 
			
		||||
 | 
			
		||||
	if ((ret=lh_FUNCTION_new()) == NULL)
 | 
			
		||||
	if ((ret=lh_new(hash, cmp)) == NULL)
 | 
			
		||||
		return(NULL);
 | 
			
		||||
 | 
			
		||||
	for (f=functions; f->name != NULL; f++)
 | 
			
		||||
		(void)lh_FUNCTION_insert(ret,f);
 | 
			
		||||
		lh_insert(ret,f);
 | 
			
		||||
	return(ret);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
/* static int MS_CALLBACK cmp(FUNCTION *a, FUNCTION *b) */
 | 
			
		||||
static int MS_CALLBACK cmp(const void *a_void, const void *b_void)
 | 
			
		||||
	{
 | 
			
		||||
	return(strncmp(((const FUNCTION *)a_void)->name,
 | 
			
		||||
			((const FUNCTION *)b_void)->name,8));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
/* static unsigned long MS_CALLBACK hash(FUNCTION *a) */
 | 
			
		||||
static unsigned long MS_CALLBACK hash(const void *a_void)
 | 
			
		||||
	{
 | 
			
		||||
	return(lh_strhash(((const FUNCTION *)a_void)->name));
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -21,17 +21,12 @@ oid_section		= new_oids
 | 
			
		||||
 | 
			
		||||
[ new_oids ]
 | 
			
		||||
 | 
			
		||||
# We can add new OIDs in here for use by 'ca', 'req' and 'ts'.
 | 
			
		||||
# We can add new OIDs in here for use by 'ca' and 'req'.
 | 
			
		||||
# Add a simple OID like this:
 | 
			
		||||
# testoid1=1.2.3.4
 | 
			
		||||
# Or use config file substitution like this:
 | 
			
		||||
# testoid2=${testoid1}.5.6
 | 
			
		||||
 | 
			
		||||
# Policies used by the TSA examples.
 | 
			
		||||
tsa_policy1 = 1.2.3.4.1
 | 
			
		||||
tsa_policy2 = 1.2.3.4.5.6
 | 
			
		||||
tsa_policy3 = 1.2.3.4.5.7
 | 
			
		||||
 | 
			
		||||
####################################################################
 | 
			
		||||
[ ca ]
 | 
			
		||||
default_ca	= CA_default		# The default ca section
 | 
			
		||||
@@ -72,7 +67,7 @@ cert_opt 	= ca_default		# Certificate field options
 | 
			
		||||
 | 
			
		||||
default_days	= 365			# how long to certify for
 | 
			
		||||
default_crl_days= 30			# how long before next CRL
 | 
			
		||||
default_md	= default		# use public key default MD
 | 
			
		||||
default_md	= sha1			# which md to use.
 | 
			
		||||
preserve	= no			# keep passed DN ordering
 | 
			
		||||
 | 
			
		||||
# A few difference way of specifying how similar the request should look
 | 
			
		||||
@@ -115,12 +110,13 @@ x509_extensions	= v3_ca	# The extentions to add to the self signed cert
 | 
			
		||||
 | 
			
		||||
# This sets a mask for permitted string types. There are several options. 
 | 
			
		||||
# default: PrintableString, T61String, BMPString.
 | 
			
		||||
# pkix	 : PrintableString, BMPString (PKIX recommendation before 2004)
 | 
			
		||||
# utf8only: only UTF8Strings (PKIX recommendation after 2004).
 | 
			
		||||
# pkix	 : PrintableString, BMPString.
 | 
			
		||||
# utf8only: only UTF8Strings.
 | 
			
		||||
# nombstr : PrintableString, T61String (no BMPStrings or UTF8Strings).
 | 
			
		||||
# MASK:XXXX a literal mask value.
 | 
			
		||||
# WARNING: ancient versions of Netscape crash on BMPStrings or UTF8Strings.
 | 
			
		||||
string_mask = utf8only
 | 
			
		||||
# WARNING: current versions of Netscape crash on BMPStrings or UTF8Strings
 | 
			
		||||
# so use this option with caution!
 | 
			
		||||
string_mask = nombstr
 | 
			
		||||
 | 
			
		||||
# req_extensions = v3_req # The extensions to add to a certificate request
 | 
			
		||||
 | 
			
		||||
@@ -211,9 +207,6 @@ authorityKeyIdentifier=keyid,issuer
 | 
			
		||||
#nsCaPolicyUrl
 | 
			
		||||
#nsSslServerName
 | 
			
		||||
 | 
			
		||||
# This is required for TSA certificates.
 | 
			
		||||
# extendedKeyUsage = critical,timeStamping
 | 
			
		||||
 | 
			
		||||
[ v3_req ]
 | 
			
		||||
 | 
			
		||||
# Extensions to add to a certificate request
 | 
			
		||||
@@ -318,33 +311,3 @@ authorityKeyIdentifier=keyid,issuer:always
 | 
			
		||||
 | 
			
		||||
# This really needs to be in place for it to be a proxy certificate.
 | 
			
		||||
proxyCertInfo=critical,language:id-ppl-anyLanguage,pathlen:3,policy:foo
 | 
			
		||||
 | 
			
		||||
####################################################################
 | 
			
		||||
[ tsa ]
 | 
			
		||||
 | 
			
		||||
default_tsa = tsa_config1	# the default TSA section
 | 
			
		||||
 | 
			
		||||
[ tsa_config1 ]
 | 
			
		||||
 | 
			
		||||
# These are used by the TSA reply generation only.
 | 
			
		||||
dir		= ./demoCA		# TSA root directory
 | 
			
		||||
serial		= $dir/tsaserial	# The current serial number (mandatory)
 | 
			
		||||
crypto_device	= builtin		# OpenSSL engine to use for signing
 | 
			
		||||
signer_cert	= $dir/tsacert.pem 	# The TSA signing certificate
 | 
			
		||||
					# (optional)
 | 
			
		||||
certs		= $dir/cacert.pem	# Certificate chain to include in reply
 | 
			
		||||
					# (optional)
 | 
			
		||||
signer_key	= $dir/private/tsakey.pem # The TSA private key (optional)
 | 
			
		||||
 | 
			
		||||
default_policy	= tsa_policy1		# Policy if request did not specify it
 | 
			
		||||
					# (optional)
 | 
			
		||||
other_policies	= tsa_policy2, tsa_policy3	# acceptable policies (optional)
 | 
			
		||||
digests		= md5, sha1		# Acceptable message digests (mandatory)
 | 
			
		||||
accuracy	= secs:1, millisecs:500, microsecs:100	# (optional)
 | 
			
		||||
clock_precision_digits  = 0	# number of digits after dot. (optional)
 | 
			
		||||
ordering		= yes	# Is ordering defined for timestamps?
 | 
			
		||||
				# (optional, default: no)
 | 
			
		||||
tsa_name		= yes	# Must the TSA name be included in the reply?
 | 
			
		||||
				# (optional, default: no)
 | 
			
		||||
ess_cert_id_chain	= no	# Must the ESS cert id chain be included?
 | 
			
		||||
				# (optional, default: no)
 | 
			
		||||
 
 | 
			
		||||
@@ -88,7 +88,6 @@ int print_attribs(BIO *out, STACK_OF(X509_ATTRIBUTE) *attrlst,const char *name);
 | 
			
		||||
void hex_prin(BIO *out, unsigned char *buf, int len);
 | 
			
		||||
int alg_print(BIO *x, X509_ALGOR *alg);
 | 
			
		||||
int cert_load(BIO *in, STACK_OF(X509) *sk);
 | 
			
		||||
static int set_pbe(BIO *err, int *ppbe, const char *str);
 | 
			
		||||
 | 
			
		||||
int MAIN(int, char **);
 | 
			
		||||
 | 
			
		||||
@@ -112,17 +111,16 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
    int maciter = PKCS12_DEFAULT_ITER;
 | 
			
		||||
    int twopass = 0;
 | 
			
		||||
    int keytype = 0;
 | 
			
		||||
    int cert_pbe = NID_pbe_WithSHA1And40BitRC2_CBC;
 | 
			
		||||
    int cert_pbe;
 | 
			
		||||
    int key_pbe = NID_pbe_WithSHA1And3_Key_TripleDES_CBC;
 | 
			
		||||
    int ret = 1;
 | 
			
		||||
    int macver = 1;
 | 
			
		||||
    int noprompt = 0;
 | 
			
		||||
    STACK_OF(STRING) *canames = NULL;
 | 
			
		||||
    STACK *canames = NULL;
 | 
			
		||||
    char *cpass = NULL, *mpass = NULL;
 | 
			
		||||
    char *passargin = NULL, *passargout = NULL, *passarg = NULL;
 | 
			
		||||
    char *passin = NULL, *passout = NULL;
 | 
			
		||||
    char *inrand = NULL;
 | 
			
		||||
    char *macalg = NULL;
 | 
			
		||||
    char *CApath = NULL, *CAfile = NULL;
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
    char *engine=NULL;
 | 
			
		||||
@@ -130,6 +128,13 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
 | 
			
		||||
    apps_startup();
 | 
			
		||||
 | 
			
		||||
#ifdef OPENSSL_FIPS
 | 
			
		||||
    if (FIPS_mode())
 | 
			
		||||
	cert_pbe = NID_pbe_WithSHA1And3_Key_TripleDES_CBC;
 | 
			
		||||
    else
 | 
			
		||||
#endif
 | 
			
		||||
    cert_pbe = NID_pbe_WithSHA1And40BitRC2_CBC;
 | 
			
		||||
 | 
			
		||||
    enc = EVP_des_ede3_cbc();
 | 
			
		||||
    if (bio_err == NULL ) bio_err = BIO_new_fp (stderr, BIO_NOCLOSE);
 | 
			
		||||
 | 
			
		||||
@@ -180,18 +185,33 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
					 maciter = 1;
 | 
			
		||||
		else if (!strcmp (*args, "-nomac"))
 | 
			
		||||
					 maciter = -1;
 | 
			
		||||
		else if (!strcmp (*args, "-macalg"))
 | 
			
		||||
		    if (args[1]) {
 | 
			
		||||
			args++;	
 | 
			
		||||
			macalg = *args;
 | 
			
		||||
		    } else badarg = 1;
 | 
			
		||||
		else if (!strcmp (*args, "-nodes")) enc=NULL;
 | 
			
		||||
		else if (!strcmp (*args, "-certpbe")) {
 | 
			
		||||
			if (!set_pbe(bio_err, &cert_pbe, *++args))
 | 
			
		||||
				badarg = 1;
 | 
			
		||||
			if (args[1]) {
 | 
			
		||||
				args++;
 | 
			
		||||
				if (!strcmp(*args, "NONE"))
 | 
			
		||||
					cert_pbe = -1;
 | 
			
		||||
				else
 | 
			
		||||
					cert_pbe=OBJ_txt2nid(*args);
 | 
			
		||||
				if(cert_pbe == NID_undef) {
 | 
			
		||||
					BIO_printf(bio_err,
 | 
			
		||||
						 "Unknown PBE algorithm %s\n", *args);
 | 
			
		||||
					badarg = 1;
 | 
			
		||||
				}
 | 
			
		||||
			} else badarg = 1;
 | 
			
		||||
		} else if (!strcmp (*args, "-keypbe")) {
 | 
			
		||||
			if (!set_pbe(bio_err, &key_pbe, *++args))
 | 
			
		||||
				badarg = 1;
 | 
			
		||||
			if (args[1]) {
 | 
			
		||||
				args++;
 | 
			
		||||
				if (!strcmp(*args, "NONE"))
 | 
			
		||||
					key_pbe = -1;
 | 
			
		||||
				else
 | 
			
		||||
					key_pbe=OBJ_txt2nid(*args);
 | 
			
		||||
				if(key_pbe == NID_undef) {
 | 
			
		||||
					BIO_printf(bio_err,
 | 
			
		||||
						 "Unknown PBE algorithm %s\n", *args);
 | 
			
		||||
					badarg = 1;
 | 
			
		||||
				}
 | 
			
		||||
			} else badarg = 1;
 | 
			
		||||
		} else if (!strcmp (*args, "-rand")) {
 | 
			
		||||
		    if (args[1]) {
 | 
			
		||||
			args++;	
 | 
			
		||||
@@ -222,8 +242,8 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
		} else if (!strcmp (*args, "-caname")) {
 | 
			
		||||
		    if (args[1]) {
 | 
			
		||||
			args++;	
 | 
			
		||||
			if (!canames) canames = sk_STRING_new_null();
 | 
			
		||||
			sk_STRING_push(canames, *args);
 | 
			
		||||
			if (!canames) canames = sk_new_null();
 | 
			
		||||
			sk_push(canames, *args);
 | 
			
		||||
		    } else badarg = 1;
 | 
			
		||||
		} else if (!strcmp (*args, "-in")) {
 | 
			
		||||
		    if (args[1]) {
 | 
			
		||||
@@ -312,14 +332,11 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
#endif
 | 
			
		||||
	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, "-nomaciter    don't use MAC iteration\n");
 | 
			
		||||
	BIO_printf (bio_err, "-maciter      use MAC iteration\n");
 | 
			
		||||
	BIO_printf (bio_err, "-nomac        don't generate MAC\n");
 | 
			
		||||
	BIO_printf (bio_err, "-twopass      separate MAC, encryption passwords\n");
 | 
			
		||||
	BIO_printf (bio_err, "-descert      encrypt PKCS#12 certificates with triple DES (default RC2-40)\n");
 | 
			
		||||
	BIO_printf (bio_err, "-certpbe alg  specify certificate PBE algorithm (default RC2-40)\n");
 | 
			
		||||
	BIO_printf (bio_err, "-keypbe alg   specify private key PBE algorithm (default 3DES)\n");
 | 
			
		||||
	BIO_printf (bio_err, "-macalg alg   digest algorithm used in MAC (default SHA1)\n");
 | 
			
		||||
	BIO_printf (bio_err, "-keyex        set MS key exchange type\n");
 | 
			
		||||
	BIO_printf (bio_err, "-keysig       set MS key signature type\n");
 | 
			
		||||
	BIO_printf (bio_err, "-password p   set import/export password source\n");
 | 
			
		||||
@@ -331,8 +348,8 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	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,  "              the random number generator\n");
 | 
			
		||||
	BIO_printf(bio_err,  "-CSP name     Microsoft CSP name\n");
 | 
			
		||||
	BIO_printf(bio_err,  "-LMK          Add local machine keyset attribute to private key\n");
 | 
			
		||||
  	BIO_printf(bio_err,  "-CSP name     Microsoft CSP name\n");
 | 
			
		||||
 	BIO_printf(bio_err,  "-LMK          Add local machine keyset attribute to private key\n");
 | 
			
		||||
    	goto end;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -422,7 +439,6 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	EVP_PKEY *key = NULL;
 | 
			
		||||
	X509 *ucert = NULL, *x = NULL;
 | 
			
		||||
	STACK_OF(X509) *certs=NULL;
 | 
			
		||||
	const EVP_MD *macmd = NULL;
 | 
			
		||||
	unsigned char *catmp = NULL;
 | 
			
		||||
	int i;
 | 
			
		||||
 | 
			
		||||
@@ -549,9 +565,9 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
 | 
			
		||||
	/* Add any CA names */
 | 
			
		||||
 | 
			
		||||
	for (i = 0; i < sk_STRING_num(canames); i++)
 | 
			
		||||
	for (i = 0; i < sk_num(canames); i++)
 | 
			
		||||
		{
 | 
			
		||||
		catmp = (unsigned char *)sk_STRING_value(canames, i);
 | 
			
		||||
		catmp = (unsigned char *)sk_value(canames, i);
 | 
			
		||||
		X509_alias_set1(sk_X509_value(certs, i), catmp, -1);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@@ -589,18 +605,8 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
		goto export_end;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (macalg)
 | 
			
		||||
		{
 | 
			
		||||
		macmd = EVP_get_digestbyname(macalg);
 | 
			
		||||
		if (!macmd)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bio_err, "Unknown digest algorithm %s\n", 
 | 
			
		||||
						macalg);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (maciter != -1)
 | 
			
		||||
		PKCS12_set_mac(p12, mpass, -1, NULL, 0, maciter, macmd);
 | 
			
		||||
		PKCS12_set_mac(p12, mpass, -1, NULL, 0, maciter, NULL);
 | 
			
		||||
 | 
			
		||||
#ifdef CRYPTO_MDEBUG
 | 
			
		||||
	CRYPTO_pop_info();
 | 
			
		||||
@@ -687,7 +693,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
#endif
 | 
			
		||||
    BIO_free(in);
 | 
			
		||||
    BIO_free_all(out);
 | 
			
		||||
    if (canames) sk_STRING_free(canames);
 | 
			
		||||
    if (canames) sk_free(canames);
 | 
			
		||||
    if(passin) OPENSSL_free(passin);
 | 
			
		||||
    if(passout) OPENSSL_free(passout);
 | 
			
		||||
    apps_shutdown();
 | 
			
		||||
@@ -956,22 +962,4 @@ void hex_prin(BIO *out, unsigned char *buf, int len)
 | 
			
		||||
	for (i = 0; i < len; i++) BIO_printf (out, "%02X ", buf[i]);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int set_pbe(BIO *err, int *ppbe, const char *str)
 | 
			
		||||
	{
 | 
			
		||||
	if (!str)
 | 
			
		||||
		return 0;
 | 
			
		||||
	if (!strcmp(str, "NONE"))
 | 
			
		||||
		{
 | 
			
		||||
		*ppbe = -1;
 | 
			
		||||
		return 1;
 | 
			
		||||
		}
 | 
			
		||||
	*ppbe=OBJ_txt2nid(str);
 | 
			
		||||
	if (*ppbe == NID_undef)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_printf(bio_err, "Unknown PBE algorithm %s\n", str);
 | 
			
		||||
		return 0;
 | 
			
		||||
		}
 | 
			
		||||
	return 1;
 | 
			
		||||
	}
 | 
			
		||||
			
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -90,7 +90,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	BIO *in=NULL,*out=NULL;
 | 
			
		||||
	int informat,outformat;
 | 
			
		||||
	char *infile,*outfile,*prog;
 | 
			
		||||
	int print_certs=0,text=0,noout=0,p7_print=0;
 | 
			
		||||
	int print_certs=0,text=0,noout=0;
 | 
			
		||||
	int ret=1;
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
	char *engine=NULL;
 | 
			
		||||
@@ -139,8 +139,6 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
			noout=1;
 | 
			
		||||
		else if (strcmp(*argv,"-text") == 0)
 | 
			
		||||
			text=1;
 | 
			
		||||
		else if (strcmp(*argv,"-print") == 0)
 | 
			
		||||
			p7_print=1;
 | 
			
		||||
		else if (strcmp(*argv,"-print_certs") == 0)
 | 
			
		||||
			print_certs=1;
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
@@ -240,9 +238,6 @@ bad:
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (p7_print)
 | 
			
		||||
		PKCS7_print_ctx(out, p7, 0, NULL);
 | 
			
		||||
 | 
			
		||||
	if (print_certs)
 | 
			
		||||
		{
 | 
			
		||||
		STACK_OF(X509) *certs=NULL;
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										74
									
								
								apps/pkcs8.c
									
									
									
									
									
								
							
							
						
						
									
										74
									
								
								apps/pkcs8.c
									
									
									
									
									
								
							@@ -80,12 +80,11 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	int informat, outformat;
 | 
			
		||||
	int p8_broken = PKCS8_OK;
 | 
			
		||||
	int nocrypt = 0;
 | 
			
		||||
	X509_SIG *p8 = NULL;
 | 
			
		||||
	PKCS8_PRIV_KEY_INFO *p8inf = NULL;
 | 
			
		||||
	X509_SIG *p8;
 | 
			
		||||
	PKCS8_PRIV_KEY_INFO *p8inf;
 | 
			
		||||
	EVP_PKEY *pkey=NULL;
 | 
			
		||||
	char pass[50], *passin = NULL, *passout = NULL, *p8pass = NULL;
 | 
			
		||||
	int badarg = 0;
 | 
			
		||||
	int ret = 1;
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
	char *engine=NULL;
 | 
			
		||||
#endif
 | 
			
		||||
@@ -226,7 +225,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
		BIO_printf(bio_err," -engine e       use engine e, possibly a hardware device.\n");
 | 
			
		||||
#endif
 | 
			
		||||
		goto end;
 | 
			
		||||
		return 1;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
@@ -236,7 +235,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	if (!app_passwd(bio_err, passargin, passargout, &passin, &passout))
 | 
			
		||||
		{
 | 
			
		||||
		BIO_printf(bio_err, "Error getting passwords\n");
 | 
			
		||||
		goto end;
 | 
			
		||||
		return 1;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if ((pbe_nid == -1) && !cipher)
 | 
			
		||||
@@ -248,7 +247,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bio_err,
 | 
			
		||||
				 "Can't open input file %s\n", infile);
 | 
			
		||||
			goto end;
 | 
			
		||||
			return (1);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
@@ -260,7 +259,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bio_err,
 | 
			
		||||
				 "Can't open output file %s\n", outfile);
 | 
			
		||||
			goto end;
 | 
			
		||||
			return (1);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
@@ -279,12 +278,17 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
		pkey = load_key(bio_err, infile, informat, 1,
 | 
			
		||||
			passin, e, "key");
 | 
			
		||||
		if (!pkey)
 | 
			
		||||
			goto end;
 | 
			
		||||
			{
 | 
			
		||||
			BIO_free_all(out);
 | 
			
		||||
			return 1;
 | 
			
		||||
			}
 | 
			
		||||
		if (!(p8inf = EVP_PKEY2PKCS8_broken(pkey, p8_broken)))
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bio_err, "Error converting key\n");
 | 
			
		||||
			ERR_print_errors(bio_err);
 | 
			
		||||
			goto end;
 | 
			
		||||
			EVP_PKEY_free(pkey);
 | 
			
		||||
			BIO_free_all(out);
 | 
			
		||||
			return 1;
 | 
			
		||||
			}
 | 
			
		||||
		if (nocrypt)
 | 
			
		||||
			{
 | 
			
		||||
@@ -295,7 +299,10 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
			else
 | 
			
		||||
				{
 | 
			
		||||
				BIO_printf(bio_err, "Bad format specified for key\n");
 | 
			
		||||
				goto end;
 | 
			
		||||
				PKCS8_PRIV_KEY_INFO_free(p8inf);
 | 
			
		||||
				EVP_PKEY_free(pkey);
 | 
			
		||||
				BIO_free_all(out);
 | 
			
		||||
				return (1);
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		else
 | 
			
		||||
@@ -306,7 +313,12 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
				{
 | 
			
		||||
				p8pass = pass;
 | 
			
		||||
				if (EVP_read_pw_string(pass, sizeof pass, "Enter Encryption Password:", 1))
 | 
			
		||||
					goto end;
 | 
			
		||||
					{
 | 
			
		||||
					PKCS8_PRIV_KEY_INFO_free(p8inf);
 | 
			
		||||
					EVP_PKEY_free(pkey);
 | 
			
		||||
					BIO_free_all(out);
 | 
			
		||||
					return (1);
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			app_RAND_load_file(NULL, bio_err, 0);
 | 
			
		||||
			if (!(p8 = PKCS8_encrypt(pbe_nid, cipher,
 | 
			
		||||
@@ -315,7 +327,10 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
				{
 | 
			
		||||
				BIO_printf(bio_err, "Error encrypting key\n");
 | 
			
		||||
				ERR_print_errors(bio_err);
 | 
			
		||||
				goto end;
 | 
			
		||||
				PKCS8_PRIV_KEY_INFO_free(p8inf);
 | 
			
		||||
				EVP_PKEY_free(pkey);
 | 
			
		||||
				BIO_free_all(out);
 | 
			
		||||
				return (1);
 | 
			
		||||
				}
 | 
			
		||||
			app_RAND_write_file(NULL, bio_err);
 | 
			
		||||
			if (outformat == FORMAT_PEM) 
 | 
			
		||||
@@ -325,12 +340,22 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
			else
 | 
			
		||||
				{
 | 
			
		||||
				BIO_printf(bio_err, "Bad format specified for key\n");
 | 
			
		||||
				goto end;
 | 
			
		||||
				PKCS8_PRIV_KEY_INFO_free(p8inf);
 | 
			
		||||
				EVP_PKEY_free(pkey);
 | 
			
		||||
				BIO_free_all(out);
 | 
			
		||||
				return (1);
 | 
			
		||||
				}
 | 
			
		||||
			X509_SIG_free(p8);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		ret = 0;
 | 
			
		||||
		goto end;
 | 
			
		||||
		PKCS8_PRIV_KEY_INFO_free (p8inf);
 | 
			
		||||
		EVP_PKEY_free(pkey);
 | 
			
		||||
		BIO_free_all(out);
 | 
			
		||||
		if (passin)
 | 
			
		||||
			OPENSSL_free(passin);
 | 
			
		||||
		if (passout)
 | 
			
		||||
			OPENSSL_free(passout);
 | 
			
		||||
		return (0);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (nocrypt)
 | 
			
		||||
@@ -342,7 +367,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
		else
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bio_err, "Bad format specified for key\n");
 | 
			
		||||
			goto end;
 | 
			
		||||
			return (1);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
@@ -354,14 +379,14 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
		else
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bio_err, "Bad format specified for key\n");
 | 
			
		||||
			goto end;
 | 
			
		||||
			return (1);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		if (!p8)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf (bio_err, "Error reading key\n");
 | 
			
		||||
			ERR_print_errors(bio_err);
 | 
			
		||||
			goto end;
 | 
			
		||||
			return (1);
 | 
			
		||||
			}
 | 
			
		||||
		if (passin)
 | 
			
		||||
			p8pass = passin;
 | 
			
		||||
@@ -371,20 +396,21 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
			EVP_read_pw_string(pass, sizeof pass, "Enter Password:", 0);
 | 
			
		||||
			}
 | 
			
		||||
		p8inf = PKCS8_decrypt(p8, p8pass, strlen(p8pass));
 | 
			
		||||
		X509_SIG_free(p8);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (!p8inf)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_printf(bio_err, "Error decrypting key\n");
 | 
			
		||||
		ERR_print_errors(bio_err);
 | 
			
		||||
		goto end;
 | 
			
		||||
		return (1);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (!(pkey = EVP_PKCS82PKEY(p8inf)))
 | 
			
		||||
		{
 | 
			
		||||
		BIO_printf(bio_err, "Error converting key\n");
 | 
			
		||||
		ERR_print_errors(bio_err);
 | 
			
		||||
		goto end;
 | 
			
		||||
		return (1);
 | 
			
		||||
		}
 | 
			
		||||
	
 | 
			
		||||
	if (p8inf->broken)
 | 
			
		||||
@@ -410,6 +436,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	PKCS8_PRIV_KEY_INFO_free(p8inf);
 | 
			
		||||
	if (outformat == FORMAT_PEM) 
 | 
			
		||||
		PEM_write_bio_PrivateKey(out, pkey, NULL, NULL, 0, NULL, passout);
 | 
			
		||||
	else if (outformat == FORMAT_ASN1)
 | 
			
		||||
@@ -417,13 +444,10 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		BIO_printf(bio_err, "Bad format specified for key\n");
 | 
			
		||||
			goto end;
 | 
			
		||||
			return (1);
 | 
			
		||||
		}
 | 
			
		||||
	ret = 0;
 | 
			
		||||
 | 
			
		||||
	end:
 | 
			
		||||
	X509_SIG_free(p8);
 | 
			
		||||
	PKCS8_PRIV_KEY_INFO_free(p8inf);
 | 
			
		||||
	EVP_PKEY_free(pkey);
 | 
			
		||||
	BIO_free_all(out);
 | 
			
		||||
	BIO_free(in);
 | 
			
		||||
@@ -432,5 +456,5 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	if (passout)
 | 
			
		||||
		OPENSSL_free(passout);
 | 
			
		||||
 | 
			
		||||
	return ret;
 | 
			
		||||
	return (0);
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										46
									
								
								apps/prime.c
									
									
									
									
									
								
							
							
						
						
									
										46
									
								
								apps/prime.c
									
									
									
									
									
								
							@@ -62,9 +62,6 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
    {
 | 
			
		||||
    int hex=0;
 | 
			
		||||
    int checks=20;
 | 
			
		||||
    int generate=0;
 | 
			
		||||
    int bits=0;
 | 
			
		||||
    int safe=0;
 | 
			
		||||
    BIGNUM *bn=NULL;
 | 
			
		||||
    BIO *bio_out;
 | 
			
		||||
 | 
			
		||||
@@ -80,15 +77,6 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	{
 | 
			
		||||
	if(!strcmp(*argv,"-hex"))
 | 
			
		||||
	    hex=1;
 | 
			
		||||
	else if(!strcmp(*argv,"-generate"))
 | 
			
		||||
	    generate=1;
 | 
			
		||||
	else if(!strcmp(*argv,"-bits"))
 | 
			
		||||
	    if(--argc < 1)
 | 
			
		||||
		goto bad;
 | 
			
		||||
	    else
 | 
			
		||||
		bits=atoi(*++argv);
 | 
			
		||||
	else if(!strcmp(*argv,"-safe"))
 | 
			
		||||
	    safe=1;
 | 
			
		||||
	else if(!strcmp(*argv,"-checks"))
 | 
			
		||||
	    if(--argc < 1)
 | 
			
		||||
		goto bad;
 | 
			
		||||
@@ -103,13 +91,13 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	++argv;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    if (argv[0] == NULL && !generate)
 | 
			
		||||
    if (argv[0] == NULL)
 | 
			
		||||
	{
 | 
			
		||||
	BIO_printf(bio_err,"No prime specified\n");
 | 
			
		||||
	goto bad;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    if ((bio_out=BIO_new(BIO_s_file())) != NULL)
 | 
			
		||||
   if ((bio_out=BIO_new(BIO_s_file())) != NULL)
 | 
			
		||||
	{
 | 
			
		||||
	BIO_set_fp(bio_out,stdout,BIO_NOCLOSE);
 | 
			
		||||
#ifdef OPENSSL_SYS_VMS
 | 
			
		||||
@@ -120,32 +108,14 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
#endif
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    if(generate)
 | 
			
		||||
	{
 | 
			
		||||
	char *s;
 | 
			
		||||
 | 
			
		||||
	if(!bits)
 | 
			
		||||
	    {
 | 
			
		||||
	    BIO_printf(bio_err,"Specifiy the number of bits.\n");
 | 
			
		||||
	    return 1;
 | 
			
		||||
	    }
 | 
			
		||||
	bn=BN_new();
 | 
			
		||||
	BN_generate_prime_ex(bn,bits,safe,NULL,NULL,NULL);
 | 
			
		||||
	s=hex ? BN_bn2hex(bn) : BN_bn2dec(bn);
 | 
			
		||||
	BIO_printf(bio_out,"%s\n",s);
 | 
			
		||||
	OPENSSL_free(s);
 | 
			
		||||
	}
 | 
			
		||||
    if(hex)
 | 
			
		||||
	BN_hex2bn(&bn,argv[0]);
 | 
			
		||||
    else
 | 
			
		||||
	{
 | 
			
		||||
	if(hex)
 | 
			
		||||
	    BN_hex2bn(&bn,argv[0]);
 | 
			
		||||
	else
 | 
			
		||||
	    BN_dec2bn(&bn,argv[0]);
 | 
			
		||||
	BN_dec2bn(&bn,argv[0]);
 | 
			
		||||
 | 
			
		||||
	BN_print(bio_out,bn);
 | 
			
		||||
	BIO_printf(bio_out," is %sprime\n",
 | 
			
		||||
		   BN_is_prime_ex(bn,checks,NULL,NULL) ? "" : "not ");
 | 
			
		||||
	}
 | 
			
		||||
    BN_print(bio_out,bn);
 | 
			
		||||
    BIO_printf(bio_out," is %sprime\n",
 | 
			
		||||
	       BN_is_prime_ex(bn,checks,NULL,NULL) ? "" : "not ");
 | 
			
		||||
 | 
			
		||||
    BN_free(bn);
 | 
			
		||||
    BIO_free_all(bio_out);
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										17
									
								
								apps/progs.h
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								apps/progs.h
									
									
									
									
									
								
							@@ -22,7 +22,6 @@ extern int ecparam_main(int argc,char *argv[]);
 | 
			
		||||
extern int x509_main(int argc,char *argv[]);
 | 
			
		||||
extern int genrsa_main(int argc,char *argv[]);
 | 
			
		||||
extern int gendsa_main(int argc,char *argv[]);
 | 
			
		||||
extern int genpkey_main(int argc,char *argv[]);
 | 
			
		||||
extern int s_server_main(int argc,char *argv[]);
 | 
			
		||||
extern int s_client_main(int argc,char *argv[]);
 | 
			
		||||
extern int speed_main(int argc,char *argv[]);
 | 
			
		||||
@@ -36,30 +35,22 @@ extern int ciphers_main(int argc,char *argv[]);
 | 
			
		||||
extern int nseq_main(int argc,char *argv[]);
 | 
			
		||||
extern int pkcs12_main(int argc,char *argv[]);
 | 
			
		||||
extern int pkcs8_main(int argc,char *argv[]);
 | 
			
		||||
extern int pkey_main(int argc,char *argv[]);
 | 
			
		||||
extern int pkeyparam_main(int argc,char *argv[]);
 | 
			
		||||
extern int pkeyutl_main(int argc,char *argv[]);
 | 
			
		||||
extern int spkac_main(int argc,char *argv[]);
 | 
			
		||||
extern int smime_main(int argc,char *argv[]);
 | 
			
		||||
extern int rand_main(int argc,char *argv[]);
 | 
			
		||||
extern int engine_main(int argc,char *argv[]);
 | 
			
		||||
extern int ocsp_main(int argc,char *argv[]);
 | 
			
		||||
extern int prime_main(int argc,char *argv[]);
 | 
			
		||||
extern int ts_main(int argc,char *argv[]);
 | 
			
		||||
 | 
			
		||||
#define FUNC_TYPE_GENERAL	1
 | 
			
		||||
#define FUNC_TYPE_MD		2
 | 
			
		||||
#define FUNC_TYPE_CIPHER	3
 | 
			
		||||
#define FUNC_TYPE_PKEY		4
 | 
			
		||||
#define FUNC_TYPE_MD_ALG	5
 | 
			
		||||
#define FUNC_TYPE_CIPHER_ALG	6
 | 
			
		||||
 | 
			
		||||
typedef struct {
 | 
			
		||||
	int type;
 | 
			
		||||
	const char *name;
 | 
			
		||||
	int (*func)(int argc,char *argv[]);
 | 
			
		||||
	} FUNCTION;
 | 
			
		||||
DECLARE_LHASH_OF(FUNCTION);
 | 
			
		||||
 | 
			
		||||
FUNCTION functions[] = {
 | 
			
		||||
	{FUNC_TYPE_GENERAL,"verify",verify_main},
 | 
			
		||||
@@ -105,7 +96,6 @@ FUNCTION functions[] = {
 | 
			
		||||
#ifndef OPENSSL_NO_DSA
 | 
			
		||||
	{FUNC_TYPE_GENERAL,"gendsa",gendsa_main},
 | 
			
		||||
#endif
 | 
			
		||||
	{FUNC_TYPE_GENERAL,"genpkey",genpkey_main},
 | 
			
		||||
#if !defined(OPENSSL_NO_SOCK) && !(defined(OPENSSL_NO_SSL2) && defined(OPENSSL_NO_SSL3))
 | 
			
		||||
	{FUNC_TYPE_GENERAL,"s_server",s_server_main},
 | 
			
		||||
#endif
 | 
			
		||||
@@ -133,9 +123,6 @@ FUNCTION functions[] = {
 | 
			
		||||
	{FUNC_TYPE_GENERAL,"pkcs12",pkcs12_main},
 | 
			
		||||
#endif
 | 
			
		||||
	{FUNC_TYPE_GENERAL,"pkcs8",pkcs8_main},
 | 
			
		||||
	{FUNC_TYPE_GENERAL,"pkey",pkey_main},
 | 
			
		||||
	{FUNC_TYPE_GENERAL,"pkeyparam",pkeyparam_main},
 | 
			
		||||
	{FUNC_TYPE_GENERAL,"pkeyutl",pkeyutl_main},
 | 
			
		||||
	{FUNC_TYPE_GENERAL,"spkac",spkac_main},
 | 
			
		||||
	{FUNC_TYPE_GENERAL,"smime",smime_main},
 | 
			
		||||
	{FUNC_TYPE_GENERAL,"rand",rand_main},
 | 
			
		||||
@@ -144,7 +131,6 @@ FUNCTION functions[] = {
 | 
			
		||||
#endif
 | 
			
		||||
	{FUNC_TYPE_GENERAL,"ocsp",ocsp_main},
 | 
			
		||||
	{FUNC_TYPE_GENERAL,"prime",prime_main},
 | 
			
		||||
	{FUNC_TYPE_GENERAL,"ts",ts_main},
 | 
			
		||||
#ifndef OPENSSL_NO_MD2
 | 
			
		||||
	{FUNC_TYPE_MD,"md2",dgst_main},
 | 
			
		||||
#endif
 | 
			
		||||
@@ -203,9 +189,6 @@ FUNCTION functions[] = {
 | 
			
		||||
	{FUNC_TYPE_CIPHER,"camellia-256-ecb",enc_main},
 | 
			
		||||
#endif
 | 
			
		||||
	{FUNC_TYPE_CIPHER,"base64",enc_main},
 | 
			
		||||
#ifdef ZLIB
 | 
			
		||||
	{FUNC_TYPE_CIPHER,"zlib",enc_main},
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_DES
 | 
			
		||||
	{FUNC_TYPE_CIPHER,"des",enc_main},
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -13,9 +13,6 @@ print <<'EOF';
 | 
			
		||||
#define FUNC_TYPE_GENERAL	1
 | 
			
		||||
#define FUNC_TYPE_MD		2
 | 
			
		||||
#define FUNC_TYPE_CIPHER	3
 | 
			
		||||
#define FUNC_TYPE_PKEY		4
 | 
			
		||||
#define FUNC_TYPE_MD_ALG	5
 | 
			
		||||
#define FUNC_TYPE_CIPHER_ALG	6
 | 
			
		||||
 | 
			
		||||
typedef struct {
 | 
			
		||||
	int type;
 | 
			
		||||
@@ -65,7 +62,7 @@ foreach (
 | 
			
		||||
	"camellia-128-cbc", "camellia-128-ecb",
 | 
			
		||||
	"camellia-192-cbc", "camellia-192-ecb",
 | 
			
		||||
	"camellia-256-cbc", "camellia-256-ecb",
 | 
			
		||||
	"base64", "zlib",
 | 
			
		||||
	"base64",
 | 
			
		||||
	"des", "des3", "desx", "idea", "seed", "rc4", "rc4-40",
 | 
			
		||||
	"rc2", "bf", "cast", "rc5",
 | 
			
		||||
	"des-ecb", "des-ede",    "des-ede3",
 | 
			
		||||
@@ -92,7 +89,6 @@ foreach (
 | 
			
		||||
	elsif ($_ =~ /bf/)   { $t="#ifndef OPENSSL_NO_BF\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"; }
 | 
			
		||||
	elsif ($_ =~ /zlib/)  { $t="#ifdef ZLIB\n${t}#endif\n"; }
 | 
			
		||||
	print $t;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										484
									
								
								apps/req.c
									
									
									
									
									
								
							
							
						
						
									
										484
									
								
								apps/req.c
									
									
									
									
									
								
							@@ -141,33 +141,39 @@ static int add_attribute_object(X509_REQ *req, char *text, const char *def,
 | 
			
		||||
				int n_max, unsigned long chtype);
 | 
			
		||||
static int add_DN_object(X509_NAME *n, char *text, const char *def, char *value,
 | 
			
		||||
	int nid,int n_min,int n_max, unsigned long chtype, int mval);
 | 
			
		||||
static int genpkey_cb(EVP_PKEY_CTX *ctx);
 | 
			
		||||
#ifndef OPENSSL_NO_RSA
 | 
			
		||||
static int MS_CALLBACK req_cb(int p, int n, BN_GENCB *cb);
 | 
			
		||||
#endif
 | 
			
		||||
static int req_check_len(int len,int n_min,int n_max);
 | 
			
		||||
static int check_end(const char *str, const char *end);
 | 
			
		||||
static EVP_PKEY_CTX *set_keygen_ctx(BIO *err, const char *gstr, int *pkey_type,
 | 
			
		||||
					long *pkeylen, char **palgnam,
 | 
			
		||||
					ENGINE *keygen_engine);
 | 
			
		||||
#ifndef MONOLITH
 | 
			
		||||
static char *default_config_file=NULL;
 | 
			
		||||
#endif
 | 
			
		||||
static CONF *req_conf=NULL;
 | 
			
		||||
static int batch=0;
 | 
			
		||||
 | 
			
		||||
#define TYPE_RSA	1
 | 
			
		||||
#define TYPE_DSA	2
 | 
			
		||||
#define TYPE_DH		3
 | 
			
		||||
#define TYPE_EC		4
 | 
			
		||||
 | 
			
		||||
int MAIN(int, char **);
 | 
			
		||||
 | 
			
		||||
int MAIN(int argc, char **argv)
 | 
			
		||||
	{
 | 
			
		||||
	ENGINE *e = NULL, *gen_eng = NULL;
 | 
			
		||||
	ENGINE *e = NULL;
 | 
			
		||||
#ifndef OPENSSL_NO_DSA
 | 
			
		||||
	DSA *dsa_params=NULL;
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_ECDSA
 | 
			
		||||
	EC_KEY *ec_params = NULL;
 | 
			
		||||
#endif
 | 
			
		||||
	unsigned long nmflag = 0, reqflag = 0;
 | 
			
		||||
	int ex=1,x509=0,days=30;
 | 
			
		||||
	X509 *x509ss=NULL;
 | 
			
		||||
	X509_REQ *req=NULL;
 | 
			
		||||
	EVP_PKEY_CTX *genctx = NULL;
 | 
			
		||||
	const char *keyalg = NULL;
 | 
			
		||||
	char *keyalgstr = NULL;
 | 
			
		||||
	STACK_OF(STRING) *pkeyopts = NULL;
 | 
			
		||||
	EVP_PKEY *pkey=NULL;
 | 
			
		||||
	int i=0,badops=0,newreq=0,verbose=0,pkey_type=-1;
 | 
			
		||||
	int i=0,badops=0,newreq=0,verbose=0,pkey_type=TYPE_RSA;
 | 
			
		||||
	long newkey = -1;
 | 
			
		||||
	BIO *in=NULL,*out=NULL;
 | 
			
		||||
	int informat,outformat,verify=0,noout=0,text=0,keyform=FORMAT_PEM;
 | 
			
		||||
@@ -187,7 +193,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	char *p;
 | 
			
		||||
	char *subj = NULL;
 | 
			
		||||
	int multirdn = 0;
 | 
			
		||||
	const EVP_MD *md_alg=NULL,*digest=NULL;
 | 
			
		||||
	const EVP_MD *md_alg=NULL,*digest=EVP_sha1();
 | 
			
		||||
	unsigned long chtype = MBSTRING_ASC;
 | 
			
		||||
#ifndef MONOLITH
 | 
			
		||||
	char *to_free;
 | 
			
		||||
@@ -230,16 +236,6 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
			if (--argc < 1) goto bad;
 | 
			
		||||
			engine= *(++argv);
 | 
			
		||||
			}
 | 
			
		||||
		else if (strcmp(*argv,"-keygen_engine") == 0)
 | 
			
		||||
			{
 | 
			
		||||
			if (--argc < 1) goto bad;
 | 
			
		||||
			gen_eng = ENGINE_by_id(*(++argv));
 | 
			
		||||
			if (gen_eng == NULL)
 | 
			
		||||
				{
 | 
			
		||||
				BIO_printf(bio_err, "Can't find keygen engine %s\n", *argv);
 | 
			
		||||
				goto end;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
#endif
 | 
			
		||||
		else if (strcmp(*argv,"-key") == 0)
 | 
			
		||||
			{
 | 
			
		||||
@@ -296,20 +292,126 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
			}
 | 
			
		||||
		else if (strcmp(*argv,"-newkey") == 0)
 | 
			
		||||
			{
 | 
			
		||||
			if (--argc < 1)
 | 
			
		||||
			int is_numeric;
 | 
			
		||||
 | 
			
		||||
			if (--argc < 1) goto bad;
 | 
			
		||||
			p= *(++argv);
 | 
			
		||||
			is_numeric = p[0] >= '0' && p[0] <= '9';
 | 
			
		||||
			if (strncmp("rsa:",p,4) == 0 || is_numeric)
 | 
			
		||||
				{
 | 
			
		||||
				pkey_type=TYPE_RSA;
 | 
			
		||||
				if(!is_numeric)
 | 
			
		||||
				    p+=4;
 | 
			
		||||
				newkey= atoi(p);
 | 
			
		||||
				}
 | 
			
		||||
			else
 | 
			
		||||
#ifndef OPENSSL_NO_DSA
 | 
			
		||||
				if (strncmp("dsa:",p,4) == 0)
 | 
			
		||||
				{
 | 
			
		||||
				X509 *xtmp=NULL;
 | 
			
		||||
				EVP_PKEY *dtmp;
 | 
			
		||||
 | 
			
		||||
				pkey_type=TYPE_DSA;
 | 
			
		||||
				p+=4;
 | 
			
		||||
				if ((in=BIO_new_file(p,"r")) == NULL)
 | 
			
		||||
					{
 | 
			
		||||
					perror(p);
 | 
			
		||||
					goto end;
 | 
			
		||||
					}
 | 
			
		||||
				if ((dsa_params=PEM_read_bio_DSAparams(in,NULL,NULL,NULL)) == NULL)
 | 
			
		||||
					{
 | 
			
		||||
					ERR_clear_error();
 | 
			
		||||
					(void)BIO_reset(in);
 | 
			
		||||
					if ((xtmp=PEM_read_bio_X509(in,NULL,NULL,NULL)) == NULL)
 | 
			
		||||
						{
 | 
			
		||||
						BIO_printf(bio_err,"unable to load DSA parameters from file\n");
 | 
			
		||||
						goto end;
 | 
			
		||||
						}
 | 
			
		||||
 | 
			
		||||
					if ((dtmp=X509_get_pubkey(xtmp)) == NULL) goto end;
 | 
			
		||||
					if (dtmp->type == EVP_PKEY_DSA)
 | 
			
		||||
						dsa_params=DSAparams_dup(dtmp->pkey.dsa);
 | 
			
		||||
					EVP_PKEY_free(dtmp);
 | 
			
		||||
					X509_free(xtmp);
 | 
			
		||||
					if (dsa_params == NULL)
 | 
			
		||||
						{
 | 
			
		||||
						BIO_printf(bio_err,"Certificate does not contain DSA parameters\n");
 | 
			
		||||
						goto end;
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
				BIO_free(in);
 | 
			
		||||
				in=NULL;
 | 
			
		||||
				newkey=BN_num_bits(dsa_params->p);
 | 
			
		||||
				}
 | 
			
		||||
			else 
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_ECDSA
 | 
			
		||||
				if (strncmp("ec:",p,3) == 0)
 | 
			
		||||
				{
 | 
			
		||||
				X509 *xtmp=NULL;
 | 
			
		||||
				EVP_PKEY *dtmp;
 | 
			
		||||
				EC_GROUP *group;
 | 
			
		||||
 | 
			
		||||
				pkey_type=TYPE_EC;
 | 
			
		||||
				p+=3;
 | 
			
		||||
				if ((in=BIO_new_file(p,"r")) == NULL)
 | 
			
		||||
					{
 | 
			
		||||
					perror(p);
 | 
			
		||||
					goto end;
 | 
			
		||||
					}
 | 
			
		||||
				if ((ec_params = EC_KEY_new()) == NULL)
 | 
			
		||||
					goto end;
 | 
			
		||||
				group = PEM_read_bio_ECPKParameters(in, NULL, NULL, NULL);
 | 
			
		||||
				if (group == NULL)
 | 
			
		||||
					{
 | 
			
		||||
					EC_KEY_free(ec_params);
 | 
			
		||||
					ERR_clear_error();
 | 
			
		||||
					(void)BIO_reset(in);
 | 
			
		||||
					if ((xtmp=PEM_read_bio_X509(in,NULL,NULL,NULL)) == NULL)
 | 
			
		||||
						{	
 | 
			
		||||
						BIO_printf(bio_err,"unable to load EC parameters from file\n");
 | 
			
		||||
						goto end;
 | 
			
		||||
						}
 | 
			
		||||
 | 
			
		||||
					if ((dtmp=X509_get_pubkey(xtmp))==NULL)
 | 
			
		||||
						goto end;
 | 
			
		||||
					if (dtmp->type == EVP_PKEY_EC)
 | 
			
		||||
						ec_params = EC_KEY_dup(dtmp->pkey.ec);
 | 
			
		||||
					EVP_PKEY_free(dtmp);
 | 
			
		||||
					X509_free(xtmp);
 | 
			
		||||
					if (ec_params == NULL)
 | 
			
		||||
						{
 | 
			
		||||
						BIO_printf(bio_err,"Certificate does not contain EC parameters\n");
 | 
			
		||||
						goto end;
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
				else
 | 
			
		||||
					{
 | 
			
		||||
					if (EC_KEY_set_group(ec_params, group) == 0)
 | 
			
		||||
						goto end;
 | 
			
		||||
					EC_GROUP_free(group);
 | 
			
		||||
					}
 | 
			
		||||
 | 
			
		||||
				BIO_free(in);
 | 
			
		||||
				in=NULL;
 | 
			
		||||
				newkey = EC_GROUP_get_degree(EC_KEY_get0_group(ec_params));
 | 
			
		||||
				}
 | 
			
		||||
			else
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_DH
 | 
			
		||||
				if (strncmp("dh:",p,4) == 0)
 | 
			
		||||
				{
 | 
			
		||||
				pkey_type=TYPE_DH;
 | 
			
		||||
				p+=3;
 | 
			
		||||
				}
 | 
			
		||||
			else
 | 
			
		||||
#endif
 | 
			
		||||
				{
 | 
			
		||||
				goto bad;
 | 
			
		||||
			keyalg = *(++argv);
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
			newreq=1;
 | 
			
		||||
			}
 | 
			
		||||
		else if (strcmp(*argv,"-pkeyopt") == 0)
 | 
			
		||||
			{
 | 
			
		||||
			if (--argc < 1)
 | 
			
		||||
				goto bad;
 | 
			
		||||
			if (!pkeyopts)
 | 
			
		||||
				pkeyopts = sk_STRING_new_null();
 | 
			
		||||
			if (!pkeyopts || !sk_STRING_push(pkeyopts, *(++argv)))
 | 
			
		||||
				goto bad;
 | 
			
		||||
			}
 | 
			
		||||
		else if (strcmp(*argv,"-batch") == 0)
 | 
			
		||||
			batch=1;
 | 
			
		||||
		else if (strcmp(*argv,"-newhdr") == 0)
 | 
			
		||||
@@ -628,20 +730,15 @@ bad:
 | 
			
		||||
 | 
			
		||||
	if (newreq && (pkey == NULL))
 | 
			
		||||
		{
 | 
			
		||||
#ifndef OPENSSL_NO_RSA
 | 
			
		||||
		BN_GENCB cb;
 | 
			
		||||
#endif
 | 
			
		||||
		char *randfile = NCONF_get_string(req_conf,SECTION,"RANDFILE");
 | 
			
		||||
		if (randfile == NULL)
 | 
			
		||||
			ERR_clear_error();
 | 
			
		||||
		app_RAND_load_file(randfile, bio_err, 0);
 | 
			
		||||
		if (inrand)
 | 
			
		||||
			app_RAND_load_files(inrand);
 | 
			
		||||
 | 
			
		||||
		if (keyalg)
 | 
			
		||||
			{
 | 
			
		||||
			genctx = set_keygen_ctx(bio_err, keyalg, &pkey_type, &newkey,
 | 
			
		||||
							&keyalgstr, gen_eng);
 | 
			
		||||
			if (!genctx)
 | 
			
		||||
				goto end;
 | 
			
		||||
			}
 | 
			
		||||
	
 | 
			
		||||
		if (newkey <= 0)
 | 
			
		||||
			{
 | 
			
		||||
@@ -649,55 +746,58 @@ bad:
 | 
			
		||||
				newkey=DEFAULT_KEY_LENGTH;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		if (newkey < MIN_KEY_LENGTH && (pkey_type == EVP_PKEY_RSA || pkey_type == EVP_PKEY_DSA))
 | 
			
		||||
		if (newkey < MIN_KEY_LENGTH && (pkey_type == TYPE_RSA || pkey_type == TYPE_DSA))
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bio_err,"private key length is too short,\n");
 | 
			
		||||
			BIO_printf(bio_err,"it needs to be at least %d bits, not %ld\n",MIN_KEY_LENGTH,newkey);
 | 
			
		||||
			goto end;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		if (!genctx)
 | 
			
		||||
			{
 | 
			
		||||
			genctx = set_keygen_ctx(bio_err, NULL, &pkey_type, &newkey,
 | 
			
		||||
							&keyalgstr, gen_eng);
 | 
			
		||||
			if (!genctx)
 | 
			
		||||
				goto end;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		if (pkeyopts)
 | 
			
		||||
			{
 | 
			
		||||
			char *genopt;
 | 
			
		||||
			for (i = 0; i < sk_STRING_num(pkeyopts); i++)
 | 
			
		||||
				{
 | 
			
		||||
				genopt = sk_STRING_value(pkeyopts, i);
 | 
			
		||||
				if (pkey_ctrl_string(genctx, genopt) <= 0)
 | 
			
		||||
					{
 | 
			
		||||
					BIO_printf(bio_err,
 | 
			
		||||
						"parameter error \"%s\"\n",
 | 
			
		||||
						genopt);
 | 
			
		||||
					ERR_print_errors(bio_err);
 | 
			
		||||
					goto end;
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		BIO_printf(bio_err,"Generating a %ld bit %s private key\n",
 | 
			
		||||
				newkey, keyalgstr);
 | 
			
		||||
			newkey,(pkey_type == TYPE_RSA)?"RSA":
 | 
			
		||||
			(pkey_type == TYPE_DSA)?"DSA":"EC");
 | 
			
		||||
 | 
			
		||||
		EVP_PKEY_CTX_set_cb(genctx, genpkey_cb);
 | 
			
		||||
		EVP_PKEY_CTX_set_app_data(genctx, bio_err);
 | 
			
		||||
		if ((pkey=EVP_PKEY_new()) == NULL) goto end;
 | 
			
		||||
 | 
			
		||||
		if (EVP_PKEY_keygen(genctx, &pkey) <= 0)
 | 
			
		||||
#ifndef OPENSSL_NO_RSA
 | 
			
		||||
		BN_GENCB_set(&cb, req_cb, bio_err);
 | 
			
		||||
		if (pkey_type == TYPE_RSA)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_puts(bio_err, "Error Generating Key\n");
 | 
			
		||||
			goto end;
 | 
			
		||||
			RSA *rsa = RSA_new();
 | 
			
		||||
			BIGNUM *bn = BN_new();
 | 
			
		||||
			if(!bn || !rsa || !BN_set_word(bn, 0x10001) ||
 | 
			
		||||
					!RSA_generate_key_ex(rsa, newkey, bn, &cb) ||
 | 
			
		||||
					!EVP_PKEY_assign_RSA(pkey, rsa))
 | 
			
		||||
				{
 | 
			
		||||
				if(bn) BN_free(bn);
 | 
			
		||||
				if(rsa) RSA_free(rsa);
 | 
			
		||||
				goto end;
 | 
			
		||||
				}
 | 
			
		||||
			BN_free(bn);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		EVP_PKEY_CTX_free(genctx);
 | 
			
		||||
		genctx = NULL;
 | 
			
		||||
		else
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_DSA
 | 
			
		||||
			if (pkey_type == TYPE_DSA)
 | 
			
		||||
			{
 | 
			
		||||
			if (!DSA_generate_key(dsa_params)) goto end;
 | 
			
		||||
			if (!EVP_PKEY_assign_DSA(pkey,dsa_params)) goto end;
 | 
			
		||||
			dsa_params=NULL;
 | 
			
		||||
			}
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_ECDSA
 | 
			
		||||
			if (pkey_type == TYPE_EC)
 | 
			
		||||
			{
 | 
			
		||||
			if (!EC_KEY_generate_key(ec_params)) goto end;
 | 
			
		||||
			if (!EVP_PKEY_assign_EC_KEY(pkey, ec_params)) 
 | 
			
		||||
				goto end;
 | 
			
		||||
			ec_params = NULL;
 | 
			
		||||
			}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
		app_RAND_write_file(randfile, bio_err);
 | 
			
		||||
 | 
			
		||||
		if (pkey == NULL) goto end;
 | 
			
		||||
 | 
			
		||||
		if (keyout == NULL)
 | 
			
		||||
			{
 | 
			
		||||
			keyout=NCONF_get_string(req_conf,SECTION,KEYFILE);
 | 
			
		||||
@@ -795,7 +895,14 @@ loop:
 | 
			
		||||
			BIO_printf(bio_err,"you need to specify a private key\n");
 | 
			
		||||
			goto end;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_DSA
 | 
			
		||||
		if (pkey->type == EVP_PKEY_DSA)
 | 
			
		||||
			digest=EVP_dss1();
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_ECDSA
 | 
			
		||||
		if (pkey->type == EVP_PKEY_EC)
 | 
			
		||||
			digest=EVP_ecdsa();
 | 
			
		||||
#endif
 | 
			
		||||
		if (req == NULL)
 | 
			
		||||
			{
 | 
			
		||||
			req=X509_REQ_new();
 | 
			
		||||
@@ -838,7 +945,7 @@ loop:
 | 
			
		||||
 | 
			
		||||
			if (!X509_set_issuer_name(x509ss, X509_REQ_get_subject_name(req))) goto end;
 | 
			
		||||
			if (!X509_gmtime_adj(X509_get_notBefore(x509ss),0)) goto end;
 | 
			
		||||
			if (!X509_time_adj_ex(X509_get_notAfter(x509ss), days, 0, NULL)) goto end;
 | 
			
		||||
			if (!X509_gmtime_adj(X509_get_notAfter(x509ss), (long)60*60*24*days)) goto end;
 | 
			
		||||
			if (!X509_set_subject_name(x509ss, X509_REQ_get_subject_name(req))) goto end;
 | 
			
		||||
			tmppkey = X509_REQ_get_pubkey(req);
 | 
			
		||||
			if (!tmppkey || !X509_set_pubkey(x509ss,tmppkey)) goto end;
 | 
			
		||||
@@ -860,10 +967,7 @@ loop:
 | 
			
		||||
				}
 | 
			
		||||
			
 | 
			
		||||
			if (!(i=X509_sign(x509ss,pkey,digest)))
 | 
			
		||||
				{
 | 
			
		||||
				ERR_print_errors(bio_err);
 | 
			
		||||
				goto end;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		else
 | 
			
		||||
			{
 | 
			
		||||
@@ -884,10 +988,7 @@ loop:
 | 
			
		||||
				goto end;
 | 
			
		||||
				}
 | 
			
		||||
			if (!(i=X509_REQ_sign(req,pkey,digest)))
 | 
			
		||||
				{
 | 
			
		||||
				ERR_print_errors(bio_err);
 | 
			
		||||
				goto end;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@@ -1024,7 +1125,7 @@ loop:
 | 
			
		||||
			}
 | 
			
		||||
		fprintf(stdout,"Modulus=");
 | 
			
		||||
#ifndef OPENSSL_NO_RSA
 | 
			
		||||
		if (EVP_PKEY_base_id(tpubkey) == EVP_PKEY_RSA)
 | 
			
		||||
		if (tpubkey->type == EVP_PKEY_RSA)
 | 
			
		||||
			BN_print(out,tpubkey->pkey.rsa->n);
 | 
			
		||||
		else
 | 
			
		||||
#endif
 | 
			
		||||
@@ -1080,22 +1181,18 @@ end:
 | 
			
		||||
	BIO_free(in);
 | 
			
		||||
	BIO_free_all(out);
 | 
			
		||||
	EVP_PKEY_free(pkey);
 | 
			
		||||
	if (genctx)
 | 
			
		||||
		EVP_PKEY_CTX_free(genctx);
 | 
			
		||||
	if (pkeyopts)
 | 
			
		||||
		sk_STRING_free(pkeyopts);
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
	if (gen_eng)
 | 
			
		||||
		ENGINE_free(gen_eng);
 | 
			
		||||
#endif
 | 
			
		||||
	if (keyalgstr)
 | 
			
		||||
		OPENSSL_free(keyalgstr);
 | 
			
		||||
	X509_REQ_free(req);
 | 
			
		||||
	X509_free(x509ss);
 | 
			
		||||
	ASN1_INTEGER_free(serial);
 | 
			
		||||
	if(passargin && passin) OPENSSL_free(passin);
 | 
			
		||||
	if(passargout && passout) OPENSSL_free(passout);
 | 
			
		||||
	OBJ_cleanup();
 | 
			
		||||
#ifndef OPENSSL_NO_DSA
 | 
			
		||||
	if (dsa_params != NULL) DSA_free(dsa_params);
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_ECDSA
 | 
			
		||||
	if (ec_params != NULL) EC_KEY_free(ec_params);
 | 
			
		||||
#endif
 | 
			
		||||
	apps_shutdown();
 | 
			
		||||
	OPENSSL_EXIT(ex);
 | 
			
		||||
	}
 | 
			
		||||
@@ -1542,6 +1639,24 @@ err:
 | 
			
		||||
	return(0);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_RSA
 | 
			
		||||
static int MS_CALLBACK req_cb(int p, int n, BN_GENCB *cb)
 | 
			
		||||
	{
 | 
			
		||||
	char c='*';
 | 
			
		||||
 | 
			
		||||
	if (p == 0) c='.';
 | 
			
		||||
	if (p == 1) c='+';
 | 
			
		||||
	if (p == 2) c='*';
 | 
			
		||||
	if (p == 3) c='\n';
 | 
			
		||||
	BIO_write(cb->arg,&c,1);
 | 
			
		||||
	(void)BIO_flush(cb->arg);
 | 
			
		||||
#ifdef LINT
 | 
			
		||||
	p=n;
 | 
			
		||||
#endif
 | 
			
		||||
	return 1;
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
static int req_check_len(int len, int n_min, int n_max)
 | 
			
		||||
	{
 | 
			
		||||
	if ((n_min > 0) && (len < n_min))
 | 
			
		||||
@@ -1568,182 +1683,3 @@ static int check_end(const char *str, const char *end)
 | 
			
		||||
	tmp = str + slen - elen;
 | 
			
		||||
	return strcmp(tmp, end);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static EVP_PKEY_CTX *set_keygen_ctx(BIO *err, const char *gstr, int *pkey_type,
 | 
			
		||||
					long *pkeylen, char **palgnam,
 | 
			
		||||
					ENGINE *keygen_engine)
 | 
			
		||||
	{
 | 
			
		||||
	EVP_PKEY_CTX *gctx = NULL;
 | 
			
		||||
	EVP_PKEY *param = NULL;
 | 
			
		||||
	long keylen = -1;
 | 
			
		||||
	BIO *pbio = NULL;
 | 
			
		||||
	const char *paramfile = NULL;
 | 
			
		||||
 | 
			
		||||
	if (gstr == NULL)
 | 
			
		||||
		{
 | 
			
		||||
		*pkey_type = EVP_PKEY_RSA;
 | 
			
		||||
		keylen = *pkeylen;
 | 
			
		||||
		}
 | 
			
		||||
	else if (gstr[0] >= '0' && gstr[0] <= '9')
 | 
			
		||||
		{
 | 
			
		||||
		*pkey_type = EVP_PKEY_RSA;
 | 
			
		||||
		keylen = atol(gstr);
 | 
			
		||||
		*pkeylen = keylen;
 | 
			
		||||
		}
 | 
			
		||||
	else if (!strncmp(gstr, "param:", 6))
 | 
			
		||||
		paramfile = gstr + 6;
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		const char *p = strchr(gstr, ':');
 | 
			
		||||
		int len;
 | 
			
		||||
		ENGINE *tmpeng;
 | 
			
		||||
		const EVP_PKEY_ASN1_METHOD *ameth;
 | 
			
		||||
 | 
			
		||||
		if (p)
 | 
			
		||||
			len = p - gstr;
 | 
			
		||||
		else
 | 
			
		||||
			len = strlen(gstr);
 | 
			
		||||
		/* The lookup of a the string will cover all engines so
 | 
			
		||||
		 * keep a note of the implementation.
 | 
			
		||||
		 */
 | 
			
		||||
 | 
			
		||||
		ameth = EVP_PKEY_asn1_find_str(&tmpeng, gstr, len);
 | 
			
		||||
 | 
			
		||||
		if (!ameth)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(err, "Unknown algorithm %.*s\n", len, gstr);
 | 
			
		||||
			return NULL;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		EVP_PKEY_asn1_get0_info(NULL, pkey_type, NULL, NULL, NULL,
 | 
			
		||||
									ameth);
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
		if (tmpeng)
 | 
			
		||||
			ENGINE_finish(tmpeng);
 | 
			
		||||
#endif
 | 
			
		||||
		if (*pkey_type == EVP_PKEY_RSA)
 | 
			
		||||
			{
 | 
			
		||||
			if (p)
 | 
			
		||||
				{
 | 
			
		||||
				keylen = atol(p + 1);
 | 
			
		||||
				*pkeylen = keylen;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		else if (p)
 | 
			
		||||
			paramfile = p + 1;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (paramfile)
 | 
			
		||||
		{
 | 
			
		||||
		pbio = BIO_new_file(paramfile, "r");
 | 
			
		||||
		if (!pbio)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(err, "Can't open parameter file %s\n",
 | 
			
		||||
					paramfile);
 | 
			
		||||
			return NULL;
 | 
			
		||||
			}
 | 
			
		||||
		param = PEM_read_bio_Parameters(pbio, NULL);
 | 
			
		||||
 | 
			
		||||
		if (!param)
 | 
			
		||||
			{
 | 
			
		||||
			X509 *x;
 | 
			
		||||
			(void)BIO_reset(pbio);
 | 
			
		||||
			x = PEM_read_bio_X509(pbio, NULL, NULL, NULL);
 | 
			
		||||
			if (x)
 | 
			
		||||
				{
 | 
			
		||||
				param = X509_get_pubkey(x);
 | 
			
		||||
				X509_free(x);
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		BIO_free(pbio);
 | 
			
		||||
 | 
			
		||||
		if (!param)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(err, "Error reading parameter file %s\n",
 | 
			
		||||
					paramfile);
 | 
			
		||||
			return NULL;
 | 
			
		||||
			}
 | 
			
		||||
		if (*pkey_type == -1)
 | 
			
		||||
			*pkey_type = EVP_PKEY_id(param);
 | 
			
		||||
		else if (*pkey_type != EVP_PKEY_base_id(param))
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(err, "Key Type does not match parameters\n");
 | 
			
		||||
			EVP_PKEY_free(param);
 | 
			
		||||
			return NULL;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (palgnam)
 | 
			
		||||
		{
 | 
			
		||||
		const EVP_PKEY_ASN1_METHOD *ameth;
 | 
			
		||||
		ENGINE *tmpeng;
 | 
			
		||||
		const char *anam;
 | 
			
		||||
		ameth = EVP_PKEY_asn1_find(&tmpeng, *pkey_type);
 | 
			
		||||
		if (!ameth)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_puts(err, "Internal error: can't find key algorithm\n");
 | 
			
		||||
			return NULL;
 | 
			
		||||
			}
 | 
			
		||||
		EVP_PKEY_asn1_get0_info(NULL, NULL, NULL, NULL, &anam, ameth);
 | 
			
		||||
		*palgnam = BUF_strdup(anam);
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
		if (tmpeng)
 | 
			
		||||
			ENGINE_finish(tmpeng);
 | 
			
		||||
#endif
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (param)
 | 
			
		||||
		{
 | 
			
		||||
		gctx = EVP_PKEY_CTX_new(param, keygen_engine);
 | 
			
		||||
		*pkeylen = EVP_PKEY_bits(param);
 | 
			
		||||
		EVP_PKEY_free(param);
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
		gctx = EVP_PKEY_CTX_new_id(*pkey_type, keygen_engine);
 | 
			
		||||
 | 
			
		||||
	if (!gctx)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_puts(err, "Error allocating keygen context\n");
 | 
			
		||||
		ERR_print_errors(err);
 | 
			
		||||
		return NULL;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (EVP_PKEY_keygen_init(gctx) <= 0)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_puts(err, "Error initializing keygen context\n");
 | 
			
		||||
		ERR_print_errors(err);
 | 
			
		||||
		return NULL;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if ((*pkey_type == EVP_PKEY_RSA) && (keylen != -1))
 | 
			
		||||
		{
 | 
			
		||||
		if (EVP_PKEY_CTX_set_rsa_keygen_bits(gctx, keylen) <= 0)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_puts(err, "Error setting RSA keysize\n");
 | 
			
		||||
			ERR_print_errors(err);
 | 
			
		||||
			EVP_PKEY_CTX_free(gctx);
 | 
			
		||||
			return NULL;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	return gctx;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static int genpkey_cb(EVP_PKEY_CTX *ctx)
 | 
			
		||||
	{
 | 
			
		||||
	char c='*';
 | 
			
		||||
	BIO *b = EVP_PKEY_CTX_get_app_data(ctx);
 | 
			
		||||
	int p;
 | 
			
		||||
	p = EVP_PKEY_CTX_get_keygen_info(ctx, 0);
 | 
			
		||||
	if (p == 0) c='.';
 | 
			
		||||
	if (p == 1) c='+';
 | 
			
		||||
	if (p == 2) c='*';
 | 
			
		||||
	if (p == 3) c='\n';
 | 
			
		||||
	BIO_write(b,&c,1);
 | 
			
		||||
	(void)BIO_flush(b);
 | 
			
		||||
#ifdef LINT
 | 
			
		||||
	p=n;
 | 
			
		||||
#endif
 | 
			
		||||
	return 1;
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										59
									
								
								apps/rsa.c
									
									
									
									
									
								
							
							
						
						
									
										59
									
								
								apps/rsa.c
									
									
									
									
									
								
							@@ -115,8 +115,6 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
#endif
 | 
			
		||||
	int modulus=0;
 | 
			
		||||
 | 
			
		||||
	int pvk_encr = 2;
 | 
			
		||||
 | 
			
		||||
	apps_startup();
 | 
			
		||||
 | 
			
		||||
	if (bio_err == NULL)
 | 
			
		||||
@@ -179,16 +177,6 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
			pubin=1;
 | 
			
		||||
		else if (strcmp(*argv,"-pubout") == 0)
 | 
			
		||||
			pubout=1;
 | 
			
		||||
		else if (strcmp(*argv,"-RSAPublicKey_in") == 0)
 | 
			
		||||
			pubin = 2;
 | 
			
		||||
		else if (strcmp(*argv,"-RSAPublicKey_out") == 0)
 | 
			
		||||
			pubout = 2;
 | 
			
		||||
		else if (strcmp(*argv,"-pvk-strong") == 0)
 | 
			
		||||
			pvk_encr=2;
 | 
			
		||||
		else if (strcmp(*argv,"-pvk-weak") == 0)
 | 
			
		||||
			pvk_encr=1;
 | 
			
		||||
		else if (strcmp(*argv,"-pvk-none") == 0)
 | 
			
		||||
			pvk_encr=0;
 | 
			
		||||
		else if (strcmp(*argv,"-noout") == 0)
 | 
			
		||||
			noout=1;
 | 
			
		||||
		else if (strcmp(*argv,"-text") == 0)
 | 
			
		||||
@@ -269,23 +257,10 @@ bad:
 | 
			
		||||
		EVP_PKEY	*pkey;
 | 
			
		||||
 | 
			
		||||
		if (pubin)
 | 
			
		||||
			{
 | 
			
		||||
			int tmpformat=-1;
 | 
			
		||||
			if (pubin == 2)
 | 
			
		||||
				{
 | 
			
		||||
				if (informat == FORMAT_PEM)
 | 
			
		||||
					tmpformat = FORMAT_PEMRSA;
 | 
			
		||||
				else if (informat == FORMAT_ASN1)
 | 
			
		||||
					tmpformat = FORMAT_ASN1RSA;
 | 
			
		||||
				}
 | 
			
		||||
			else if (informat == FORMAT_NETSCAPE && sgckey)
 | 
			
		||||
				tmpformat = FORMAT_IISSGC;
 | 
			
		||||
			else
 | 
			
		||||
				tmpformat = informat;
 | 
			
		||||
					
 | 
			
		||||
			pkey = load_pubkey(bio_err, infile, tmpformat, 1,
 | 
			
		||||
			pkey = load_pubkey(bio_err, infile,
 | 
			
		||||
				(informat == FORMAT_NETSCAPE && sgckey ?
 | 
			
		||||
					FORMAT_IISSGC : informat), 1,
 | 
			
		||||
				passin, e, "Public Key");
 | 
			
		||||
			}
 | 
			
		||||
		else
 | 
			
		||||
			pkey = load_key(bio_err, infile,
 | 
			
		||||
				(informat == FORMAT_NETSCAPE && sgckey ?
 | 
			
		||||
@@ -293,7 +268,7 @@ bad:
 | 
			
		||||
				passin, e, "Private Key");
 | 
			
		||||
 | 
			
		||||
		if (pkey != NULL)
 | 
			
		||||
			rsa = EVP_PKEY_get1_RSA(pkey);
 | 
			
		||||
		rsa = pkey == NULL ? NULL : EVP_PKEY_get1_RSA(pkey);
 | 
			
		||||
		EVP_PKEY_free(pkey);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -371,13 +346,7 @@ bad:
 | 
			
		||||
		}
 | 
			
		||||
	BIO_printf(bio_err,"writing RSA key\n");
 | 
			
		||||
	if 	(outformat == FORMAT_ASN1) {
 | 
			
		||||
		if(pubout || pubin) 
 | 
			
		||||
			{
 | 
			
		||||
			if (pubout == 2)
 | 
			
		||||
				i=i2d_RSAPublicKey_bio(out,rsa);
 | 
			
		||||
			else
 | 
			
		||||
				i=i2d_RSA_PUBKEY_bio(out,rsa);
 | 
			
		||||
			}
 | 
			
		||||
		if(pubout || pubin) i=i2d_RSA_PUBKEY_bio(out,rsa);
 | 
			
		||||
		else i=i2d_RSAPrivateKey_bio(out,rsa);
 | 
			
		||||
	}
 | 
			
		||||
#ifndef OPENSSL_NO_RC4
 | 
			
		||||
@@ -401,25 +370,9 @@ bad:
 | 
			
		||||
#endif
 | 
			
		||||
	else if (outformat == FORMAT_PEM) {
 | 
			
		||||
		if(pubout || pubin)
 | 
			
		||||
			{
 | 
			
		||||
			if (pubout == 2)
 | 
			
		||||
		    		i=PEM_write_bio_RSAPublicKey(out,rsa);
 | 
			
		||||
			else
 | 
			
		||||
		    		i=PEM_write_bio_RSA_PUBKEY(out,rsa);
 | 
			
		||||
			}
 | 
			
		||||
		    i=PEM_write_bio_RSA_PUBKEY(out,rsa);
 | 
			
		||||
		else i=PEM_write_bio_RSAPrivateKey(out,rsa,
 | 
			
		||||
						enc,NULL,0,NULL,passout);
 | 
			
		||||
	} else if (outformat == FORMAT_MSBLOB || outformat == FORMAT_PVK) {
 | 
			
		||||
		EVP_PKEY *pk;
 | 
			
		||||
		pk = EVP_PKEY_new();
 | 
			
		||||
		EVP_PKEY_set1_RSA(pk, rsa);
 | 
			
		||||
		if (outformat == FORMAT_PVK)
 | 
			
		||||
			i = i2b_PVK_bio(out, pk, pvk_encr, 0, passout);
 | 
			
		||||
		else if (pubin || pubout)
 | 
			
		||||
			i = i2b_PublicKey_bio(out, pk);
 | 
			
		||||
		else
 | 
			
		||||
			i = i2b_PrivateKey_bio(out, pk);
 | 
			
		||||
		EVP_PKEY_free(pk);
 | 
			
		||||
	} else	{
 | 
			
		||||
		BIO_printf(bio_err,"bad output format specified for outfile\n");
 | 
			
		||||
		goto end;
 | 
			
		||||
 
 | 
			
		||||
@@ -117,7 +117,7 @@
 | 
			
		||||
#include <conio.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined(OPENSSL_SYS_MSDOS) && !defined(_WIN32)
 | 
			
		||||
#ifdef OPENSSL_SYS_MSDOS
 | 
			
		||||
#define _kbhit kbhit
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
@@ -162,7 +162,7 @@ int extract_port(char *str, short *port_ptr);
 | 
			
		||||
int extract_host_port(char *str,char **host_ptr,unsigned char *ip,short *p);
 | 
			
		||||
 | 
			
		||||
long MS_CALLBACK bio_dump_callback(BIO *bio, int cmd, const char *argp,
 | 
			
		||||
				   int argi, long argl, long ret);
 | 
			
		||||
	int argi, long argl, long ret);
 | 
			
		||||
 | 
			
		||||
#ifdef HEADER_SSL_H
 | 
			
		||||
void MS_CALLBACK apps_ssl_info_callback(const SSL *s, int where, int ret);
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										36
									
								
								apps/s_cb.c
									
									
									
									
									
								
							
							
						
						
									
										36
									
								
								apps/s_cb.c
									
									
									
									
									
								
							@@ -56,7 +56,7 @@
 | 
			
		||||
 * [including the GNU Public Licence.]
 | 
			
		||||
 */
 | 
			
		||||
/* ====================================================================
 | 
			
		||||
 * Copyright (c) 1998-2006 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
 | 
			
		||||
 * modification, are permitted provided that the following conditions
 | 
			
		||||
@@ -123,7 +123,6 @@
 | 
			
		||||
 | 
			
		||||
int verify_depth=0;
 | 
			
		||||
int verify_error=X509_V_OK;
 | 
			
		||||
int verify_return_error=0;
 | 
			
		||||
 | 
			
		||||
int MS_CALLBACK verify_callback(int ok, X509_STORE_CTX *ctx)
 | 
			
		||||
	{
 | 
			
		||||
@@ -143,8 +142,7 @@ int MS_CALLBACK verify_callback(int ok, X509_STORE_CTX *ctx)
 | 
			
		||||
			X509_verify_cert_error_string(err));
 | 
			
		||||
		if (verify_depth >= depth)
 | 
			
		||||
			{
 | 
			
		||||
			if (!verify_return_error)
 | 
			
		||||
				ok=1;
 | 
			
		||||
			ok=1;
 | 
			
		||||
			verify_error=X509_V_OK;
 | 
			
		||||
			}
 | 
			
		||||
		else
 | 
			
		||||
@@ -260,7 +258,7 @@ int set_cert_key_stuff(SSL_CTX *ctx, X509 *cert, EVP_PKEY *key)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
long MS_CALLBACK bio_dump_callback(BIO *bio, int cmd, const char *argp,
 | 
			
		||||
				   int argi, long argl, long ret)
 | 
			
		||||
	int argi, long argl, long ret)
 | 
			
		||||
	{
 | 
			
		||||
	BIO *out;
 | 
			
		||||
 | 
			
		||||
@@ -269,15 +267,15 @@ long MS_CALLBACK bio_dump_callback(BIO *bio, int cmd, const char *argp,
 | 
			
		||||
 | 
			
		||||
	if (cmd == (BIO_CB_READ|BIO_CB_RETURN))
 | 
			
		||||
		{
 | 
			
		||||
		BIO_printf(out,"read from %p [%p] (%lu bytes => %ld (0x%lX))\n",
 | 
			
		||||
 			(void *)bio,argp,(unsigned long)argi,ret,ret);
 | 
			
		||||
		BIO_printf(out,"read from %p [%p] (%d bytes => %ld (0x%lX))\n",
 | 
			
		||||
 			(void *)bio,argp,argi,ret,ret);
 | 
			
		||||
		BIO_dump(out,argp,(int)ret);
 | 
			
		||||
		return(ret);
 | 
			
		||||
		}
 | 
			
		||||
	else if (cmd == (BIO_CB_WRITE|BIO_CB_RETURN))
 | 
			
		||||
		{
 | 
			
		||||
		BIO_printf(out,"write to %p [%p] (%lu bytes => %ld (0x%lX))\n",
 | 
			
		||||
			(void *)bio,argp,(unsigned long)argi,ret,ret);
 | 
			
		||||
		BIO_printf(out,"write to %p [%p] (%d bytes => %ld (0x%lX))\n",
 | 
			
		||||
			(void *)bio,argp,argi,ret,ret);
 | 
			
		||||
		BIO_dump(out,argp,(int)ret);
 | 
			
		||||
		}
 | 
			
		||||
	return(ret);
 | 
			
		||||
@@ -506,21 +504,6 @@ void MS_CALLBACK msg_cb(int write_p, int version, int content_type, const void *
 | 
			
		||||
				case 100:
 | 
			
		||||
					str_details2 = " no_renegotiation";
 | 
			
		||||
					break;
 | 
			
		||||
				case 110:
 | 
			
		||||
					str_details2 = " unsupported_extension";
 | 
			
		||||
					break;
 | 
			
		||||
				case 111:
 | 
			
		||||
					str_details2 = " certificate_unobtainable";
 | 
			
		||||
					break;
 | 
			
		||||
				case 112:
 | 
			
		||||
					str_details2 = " unrecognized_name";
 | 
			
		||||
					break;
 | 
			
		||||
				case 113:
 | 
			
		||||
					str_details2 = " bad_certificate_status_response";
 | 
			
		||||
					break;
 | 
			
		||||
				case 114:
 | 
			
		||||
					str_details2 = " bad_certificate_hash_value";
 | 
			
		||||
					break;
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
@@ -638,11 +621,6 @@ void MS_CALLBACK tlsext_cb(SSL *s, int client_server, int type,
 | 
			
		||||
		extname = "server ticket";
 | 
			
		||||
		break;
 | 
			
		||||
 | 
			
		||||
#ifdef TLSEXT_TYPE_opaque_prf_input
 | 
			
		||||
		case TLSEXT_TYPE_opaque_prf_input:
 | 
			
		||||
		extname = "opaque PRF input";
 | 
			
		||||
		break;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
		default:
 | 
			
		||||
		extname = "unknown";
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										293
									
								
								apps/s_client.c
									
									
									
									
									
								
							
							
						
						
									
										293
									
								
								apps/s_client.c
									
									
									
									
									
								
							@@ -56,7 +56,7 @@
 | 
			
		||||
 * [including the GNU Public Licence.]
 | 
			
		||||
 */
 | 
			
		||||
/* ====================================================================
 | 
			
		||||
 * Copyright (c) 1998-2006 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
 | 
			
		||||
 * modification, are permitted provided that the following conditions
 | 
			
		||||
@@ -108,35 +108,8 @@
 | 
			
		||||
 * Hudson (tjh@cryptsoft.com).
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
/* ====================================================================
 | 
			
		||||
 * Copyright 2005 Nokia. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * The portions of the attached software ("Contribution") is developed by
 | 
			
		||||
 * Nokia Corporation and is licensed pursuant to the OpenSSL open source
 | 
			
		||||
 * license.
 | 
			
		||||
 *
 | 
			
		||||
 * The Contribution, originally written by Mika Kousa and Pasi Eronen of
 | 
			
		||||
 * Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites
 | 
			
		||||
 * support (see RFC 4279) to OpenSSL.
 | 
			
		||||
 *
 | 
			
		||||
 * No patent licenses or other rights except those expressly stated in
 | 
			
		||||
 * the OpenSSL open source license shall be deemed granted or received
 | 
			
		||||
 * expressly, by implication, estoppel, or otherwise.
 | 
			
		||||
 *
 | 
			
		||||
 * No assurances are provided by Nokia that the Contribution does not
 | 
			
		||||
 * infringe the patent or other intellectual property rights of any third
 | 
			
		||||
 * party or that the license provides you with all the necessary rights
 | 
			
		||||
 * to make use of the Contribution.
 | 
			
		||||
 *
 | 
			
		||||
 * THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN
 | 
			
		||||
 * ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA
 | 
			
		||||
 * SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY
 | 
			
		||||
 * OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR
 | 
			
		||||
 * OTHERWISE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <assert.h>
 | 
			
		||||
#include <ctype.h>
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
@@ -162,19 +135,23 @@ typedef unsigned int u_int;
 | 
			
		||||
#include <openssl/pem.h>
 | 
			
		||||
#include <openssl/rand.h>
 | 
			
		||||
#include <openssl/ocsp.h>
 | 
			
		||||
#include <openssl/bn.h>
 | 
			
		||||
#include "s_apps.h"
 | 
			
		||||
#include "timeouts.h"
 | 
			
		||||
 | 
			
		||||
#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)
 | 
			
		||||
/* FIONBIO used as a switch to enable ioctl, and that isn't in VMS < 7.0 */
 | 
			
		||||
#undef FIONBIO
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined(OPENSSL_SYS_BEOS_R5)
 | 
			
		||||
#include <fcntl.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#undef PROG
 | 
			
		||||
#define PROG	s_client_main
 | 
			
		||||
 | 
			
		||||
@@ -189,7 +166,6 @@ typedef unsigned int u_int;
 | 
			
		||||
 | 
			
		||||
extern int verify_depth;
 | 
			
		||||
extern int verify_error;
 | 
			
		||||
extern int verify_return_error;
 | 
			
		||||
 | 
			
		||||
#ifdef FIONBIO
 | 
			
		||||
static int c_nbio=0;
 | 
			
		||||
@@ -212,69 +188,6 @@ static BIO *bio_c_out=NULL;
 | 
			
		||||
static int c_quiet=0;
 | 
			
		||||
static int c_ign_eof=0;
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_PSK
 | 
			
		||||
/* Default PSK identity and key */
 | 
			
		||||
static char *psk_identity="Client_identity";
 | 
			
		||||
/*char *psk_key=NULL;  by default PSK is not used */
 | 
			
		||||
 | 
			
		||||
static unsigned int psk_client_cb(SSL *ssl, const char *hint, char *identity,
 | 
			
		||||
	unsigned int max_identity_len, unsigned char *psk,
 | 
			
		||||
	unsigned int max_psk_len)
 | 
			
		||||
	{
 | 
			
		||||
	unsigned int psk_len = 0;
 | 
			
		||||
	int ret;
 | 
			
		||||
        BIGNUM *bn=NULL;
 | 
			
		||||
 | 
			
		||||
	if (c_debug)
 | 
			
		||||
		BIO_printf(bio_c_out, "psk_client_cb\n");
 | 
			
		||||
	if (!hint)
 | 
			
		||||
                {
 | 
			
		||||
                /* no ServerKeyExchange message*/
 | 
			
		||||
		if (c_debug)
 | 
			
		||||
			BIO_printf(bio_c_out,"NULL received PSK identity hint, continuing anyway\n");
 | 
			
		||||
                }
 | 
			
		||||
        else if (c_debug)
 | 
			
		||||
		BIO_printf(bio_c_out, "Received PSK identity hint '%s'\n", hint);
 | 
			
		||||
 | 
			
		||||
	/* lookup PSK identity and PSK key based on the given identity hint here */
 | 
			
		||||
	ret = BIO_snprintf(identity, max_identity_len, "%s", psk_identity);
 | 
			
		||||
	if (ret < 0 || (unsigned int)ret > max_identity_len)
 | 
			
		||||
		goto out_err;
 | 
			
		||||
	if (c_debug)
 | 
			
		||||
		BIO_printf(bio_c_out, "created identity '%s' len=%d\n", identity, ret);
 | 
			
		||||
        ret=BN_hex2bn(&bn, psk_key);
 | 
			
		||||
        if (!ret)
 | 
			
		||||
                {
 | 
			
		||||
                BIO_printf(bio_err,"Could not convert PSK key '%s' to BIGNUM\n", psk_key);
 | 
			
		||||
                if (bn)
 | 
			
		||||
                        BN_free(bn);
 | 
			
		||||
                return 0;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
        if ((unsigned int)BN_num_bytes(bn) > max_psk_len)
 | 
			
		||||
                {
 | 
			
		||||
                BIO_printf(bio_err,"psk buffer of callback is too small (%d) for key (%d)\n",
 | 
			
		||||
                        max_psk_len, BN_num_bytes(bn));
 | 
			
		||||
                BN_free(bn);
 | 
			
		||||
                return 0;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
        psk_len=BN_bn2bin(bn, psk);
 | 
			
		||||
        BN_free(bn);
 | 
			
		||||
        if (psk_len == 0)
 | 
			
		||||
                goto out_err;
 | 
			
		||||
 | 
			
		||||
	if (c_debug)
 | 
			
		||||
		BIO_printf(bio_c_out, "created PSK len=%d\n", psk_len);
 | 
			
		||||
 | 
			
		||||
        return psk_len;
 | 
			
		||||
 out_err:
 | 
			
		||||
	if (c_debug)
 | 
			
		||||
		BIO_printf(bio_err, "Error in PSK client callback\n");
 | 
			
		||||
        return 0;
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
static void sc_usage(void)
 | 
			
		||||
	{
 | 
			
		||||
	BIO_printf(bio_err,"usage: s_client args\n");
 | 
			
		||||
@@ -283,7 +196,7 @@ static void sc_usage(void)
 | 
			
		||||
	BIO_printf(bio_err," -port port     - use -connect instead\n");
 | 
			
		||||
	BIO_printf(bio_err," -connect host:port - who to connect to (default is %s:%s)\n",SSL_HOST_NAME,PORT_STR);
 | 
			
		||||
 | 
			
		||||
	BIO_printf(bio_err," -verify arg   - turn on peer certificate verification\n");
 | 
			
		||||
	BIO_printf(bio_err," -verify depth - turn on peer certificate verification\n");
 | 
			
		||||
	BIO_printf(bio_err," -cert arg     - certificate file to use, PEM format assumed\n");
 | 
			
		||||
	BIO_printf(bio_err," -certform arg - certificate format (PEM or DER) PEM default\n");
 | 
			
		||||
	BIO_printf(bio_err," -key arg      - Private key file to use, in cert file if\n");
 | 
			
		||||
@@ -309,13 +222,6 @@ static void sc_usage(void)
 | 
			
		||||
	BIO_printf(bio_err," -quiet        - no s_client output\n");
 | 
			
		||||
	BIO_printf(bio_err," -ign_eof      - ignore input eof (default when -quiet)\n");
 | 
			
		||||
	BIO_printf(bio_err," -no_ign_eof   - don't ignore input eof\n");
 | 
			
		||||
#ifndef OPENSSL_NO_PSK
 | 
			
		||||
	BIO_printf(bio_err," -psk_identity arg - PSK identity\n");
 | 
			
		||||
	BIO_printf(bio_err," -psk arg      - PSK in hex (without 0x)\n");
 | 
			
		||||
# ifndef OPENSSL_NO_JPAKE
 | 
			
		||||
	BIO_printf(bio_err," -jpake arg    - JPAKE secret to use\n");
 | 
			
		||||
# endif
 | 
			
		||||
#endif
 | 
			
		||||
	BIO_printf(bio_err," -ssl2         - just use SSLv2\n");
 | 
			
		||||
	BIO_printf(bio_err," -ssl3         - just use SSLv3\n");
 | 
			
		||||
	BIO_printf(bio_err," -tls1         - just use TLSv1\n");
 | 
			
		||||
@@ -366,7 +272,6 @@ static int MS_CALLBACK ssl_servername_cb(SSL *s, int *ad, void *arg)
 | 
			
		||||
	return SSL_TLSEXT_ERR_OK;
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
enum
 | 
			
		||||
{
 | 
			
		||||
	PROTO_OFF	= 0,
 | 
			
		||||
@@ -382,7 +287,7 @@ int MAIN(int, char **);
 | 
			
		||||
int MAIN(int argc, char **argv)
 | 
			
		||||
	{
 | 
			
		||||
	int off=0;
 | 
			
		||||
	SSL *con=NULL;
 | 
			
		||||
	SSL *con=NULL,*con2=NULL;
 | 
			
		||||
	X509_STORE *store = NULL;
 | 
			
		||||
	int s,k,width,state=0;
 | 
			
		||||
	char *cbuf=NULL,*sbuf=NULL,*mbuf=NULL;
 | 
			
		||||
@@ -405,8 +310,11 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	int ret=1,in_init=1,i,nbio_test=0;
 | 
			
		||||
	int starttls_proto = PROTO_OFF;
 | 
			
		||||
	int prexit = 0, vflags = 0;
 | 
			
		||||
	const SSL_METHOD *meth=NULL;
 | 
			
		||||
	int socket_type=SOCK_STREAM;
 | 
			
		||||
	SSL_METHOD *meth=NULL;
 | 
			
		||||
#ifdef sock_type
 | 
			
		||||
#undef sock_type
 | 
			
		||||
#endif
 | 
			
		||||
	int sock_type=SOCK_STREAM;
 | 
			
		||||
	BIO *sbio;
 | 
			
		||||
	char *inrand=NULL;
 | 
			
		||||
	int mbuf_len=0;
 | 
			
		||||
@@ -416,12 +324,10 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	ENGINE *ssl_client_engine=NULL;
 | 
			
		||||
#endif
 | 
			
		||||
	ENGINE *e=NULL;
 | 
			
		||||
#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_NETWARE) || defined(OPENSSL_SYS_BEOS_R5)
 | 
			
		||||
#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_NETWARE)
 | 
			
		||||
	struct timeval tv;
 | 
			
		||||
#if defined(OPENSSL_SYS_BEOS_R5)
 | 
			
		||||
	int stdin_set = 0;
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_TLSEXT
 | 
			
		||||
	char *servername = NULL; 
 | 
			
		||||
        tlsextctx tlsextcbp = 
 | 
			
		||||
@@ -432,7 +338,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	struct sockaddr peer;
 | 
			
		||||
	int peerlen = sizeof(peer);
 | 
			
		||||
	int enable_timeouts = 0 ;
 | 
			
		||||
	long socket_mtu = 0;
 | 
			
		||||
	long mtu = 0;
 | 
			
		||||
#ifndef OPENSSL_NO_JPAKE
 | 
			
		||||
	char *jpake_secret = NULL;
 | 
			
		||||
#endif
 | 
			
		||||
@@ -525,8 +431,6 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
			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,"-verify_return_error") == 0)
 | 
			
		||||
			verify_return_error = 1;
 | 
			
		||||
		else if	(strcmp(*argv,"-prexit") == 0)
 | 
			
		||||
			prexit=1;
 | 
			
		||||
		else if	(strcmp(*argv,"-crlf") == 0)
 | 
			
		||||
@@ -562,27 +466,6 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
			nbio_test=1;
 | 
			
		||||
		else if	(strcmp(*argv,"-state") == 0)
 | 
			
		||||
			state=1;
 | 
			
		||||
#ifndef OPENSSL_NO_PSK
 | 
			
		||||
                else if (strcmp(*argv,"-psk_identity") == 0)
 | 
			
		||||
			{
 | 
			
		||||
			if (--argc < 1) goto bad;
 | 
			
		||||
			psk_identity=*(++argv);
 | 
			
		||||
			}
 | 
			
		||||
                else if (strcmp(*argv,"-psk") == 0)
 | 
			
		||||
			{
 | 
			
		||||
                        size_t j;
 | 
			
		||||
 | 
			
		||||
			if (--argc < 1) goto bad;
 | 
			
		||||
			psk_key=*(++argv);
 | 
			
		||||
			for (j = 0; j < strlen(psk_key); j++)
 | 
			
		||||
                                {
 | 
			
		||||
                                if (isxdigit((int)psk_key[j]))
 | 
			
		||||
                                        continue;
 | 
			
		||||
                                BIO_printf(bio_err,"Not a hex number '%s'\n",*argv);
 | 
			
		||||
                                goto bad;
 | 
			
		||||
                                }
 | 
			
		||||
			}
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_SSL2
 | 
			
		||||
		else if	(strcmp(*argv,"-ssl2") == 0)
 | 
			
		||||
			meth=SSLv2_client_method();
 | 
			
		||||
@@ -599,14 +482,14 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
		else if	(strcmp(*argv,"-dtls1") == 0)
 | 
			
		||||
			{
 | 
			
		||||
			meth=DTLSv1_client_method();
 | 
			
		||||
			socket_type=SOCK_DGRAM;
 | 
			
		||||
			sock_type=SOCK_DGRAM;
 | 
			
		||||
			}
 | 
			
		||||
		else if (strcmp(*argv,"-timeout") == 0)
 | 
			
		||||
			enable_timeouts=1;
 | 
			
		||||
		else if (strcmp(*argv,"-mtu") == 0)
 | 
			
		||||
			{
 | 
			
		||||
			if (--argc < 1) goto bad;
 | 
			
		||||
			socket_mtu = atol(*(++argv));
 | 
			
		||||
			mtu = atol(*(++argv));
 | 
			
		||||
			}
 | 
			
		||||
#endif
 | 
			
		||||
		else if (strcmp(*argv,"-bugs") == 0)
 | 
			
		||||
@@ -646,8 +529,6 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
			off|=SSL_OP_NO_SSLv3;
 | 
			
		||||
		else if (strcmp(*argv,"-no_ssl2") == 0)
 | 
			
		||||
			off|=SSL_OP_NO_SSLv2;
 | 
			
		||||
		else if	(strcmp(*argv,"-no_comp") == 0)
 | 
			
		||||
			{ off|=SSL_OP_NO_COMPRESSION; }
 | 
			
		||||
#ifndef OPENSSL_NO_TLSEXT
 | 
			
		||||
		else if	(strcmp(*argv,"-no_ticket") == 0)
 | 
			
		||||
			{ off|=SSL_OP_NO_TICKET; }
 | 
			
		||||
@@ -728,26 +609,6 @@ bad:
 | 
			
		||||
		goto end;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
#if !defined(OPENSSL_NO_JPAKE) && !defined(OPENSSL_NO_PSK)
 | 
			
		||||
	if (jpake_secret)
 | 
			
		||||
		{
 | 
			
		||||
		if (psk_key)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bio_err,
 | 
			
		||||
				   "Can't use JPAKE and PSK together\n");
 | 
			
		||||
			goto end;
 | 
			
		||||
			}
 | 
			
		||||
		psk_identity = "JPAKE";
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (cipher)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_printf(bio_err, "JPAKE sets cipher to PSK\n");
 | 
			
		||||
		goto end;
 | 
			
		||||
		}
 | 
			
		||||
	cipher = "PSK";
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	OpenSSL_add_ssl_algorithms();
 | 
			
		||||
	SSL_load_error_strings();
 | 
			
		||||
 | 
			
		||||
@@ -763,7 +624,6 @@ bad:
 | 
			
		||||
			goto end;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
	if (!app_passwd(bio_err, passarg, NULL, &pass, NULL))
 | 
			
		||||
		{
 | 
			
		||||
@@ -845,18 +705,6 @@ bad:
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_PSK
 | 
			
		||||
#ifdef OPENSSL_NO_JPAKE
 | 
			
		||||
	if (psk_key != NULL)
 | 
			
		||||
#else
 | 
			
		||||
	if (psk_key != NULL || jpake_secret)
 | 
			
		||||
#endif
 | 
			
		||||
		{
 | 
			
		||||
		if (c_debug)
 | 
			
		||||
			BIO_printf(bio_c_out, "PSK key given or JPAKE in use, setting client callback\n");
 | 
			
		||||
		SSL_CTX_set_psk_client_callback(ctx, psk_client_cb);
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
	if (bugs)
 | 
			
		||||
		SSL_CTX_set_options(ctx,SSL_OP_ALL|off);
 | 
			
		||||
	else
 | 
			
		||||
@@ -864,7 +712,7 @@ bad:
 | 
			
		||||
	/* DTLS: partial reads end up discarding unread UDP bytes :-( 
 | 
			
		||||
	 * Setting read ahead solves this problem.
 | 
			
		||||
	 */
 | 
			
		||||
	if (socket_type == SOCK_DGRAM) SSL_CTX_set_read_ahead(ctx, 1);
 | 
			
		||||
	if (sock_type == SOCK_DGRAM) SSL_CTX_set_read_ahead(ctx, 1);
 | 
			
		||||
 | 
			
		||||
	if (state) SSL_CTX_set_info_callback(ctx,apps_ssl_info_callback);
 | 
			
		||||
	if (cipher != NULL)
 | 
			
		||||
@@ -936,6 +784,7 @@ bad:
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_KRB5
 | 
			
		||||
	if (con  &&  (con->kssl_ctx = kssl_ctx_new()) != NULL)
 | 
			
		||||
                {
 | 
			
		||||
@@ -943,15 +792,10 @@ bad:
 | 
			
		||||
		}
 | 
			
		||||
#endif	/* OPENSSL_NO_KRB5  */
 | 
			
		||||
/*	SSL_set_cipher_list(con,"RC4-MD5"); */
 | 
			
		||||
#if 0
 | 
			
		||||
#ifdef TLSEXT_TYPE_opaque_prf_input
 | 
			
		||||
	SSL_set_tlsext_opaque_prf_input(con, "Test client", 11);
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
re_start:
 | 
			
		||||
 | 
			
		||||
	if (init_client(&s,host,port,socket_type) == 0)
 | 
			
		||||
	if (init_client(&s,host,port,sock_type) == 0)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_printf(bio_err,"connect:errno=%d\n",get_last_socket_error());
 | 
			
		||||
		SHUTDOWN(s);
 | 
			
		||||
@@ -988,7 +832,7 @@ re_start:
 | 
			
		||||
 | 
			
		||||
		(void)BIO_ctrl_set_connected(sbio, 1, &peer);
 | 
			
		||||
 | 
			
		||||
		if (enable_timeouts)
 | 
			
		||||
		if ( enable_timeouts)
 | 
			
		||||
			{
 | 
			
		||||
			timeout.tv_sec = 0;
 | 
			
		||||
			timeout.tv_usec = DGRAM_RCV_TIMEOUT;
 | 
			
		||||
@@ -999,10 +843,10 @@ re_start:
 | 
			
		||||
			BIO_ctrl(sbio, BIO_CTRL_DGRAM_SET_SEND_TIMEOUT, 0, &timeout);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		if (socket_mtu > 0)
 | 
			
		||||
		if ( mtu > 0)
 | 
			
		||||
			{
 | 
			
		||||
			SSL_set_options(con, SSL_OP_NO_QUERY_MTU);
 | 
			
		||||
			SSL_set_mtu(con, socket_mtu);
 | 
			
		||||
			SSL_set_mtu(con, mtu);
 | 
			
		||||
			}
 | 
			
		||||
		else
 | 
			
		||||
			/* want to do MTU discovery */
 | 
			
		||||
@@ -1203,14 +1047,6 @@ SSL_set_tlsext_status_ids(con, ids);
 | 
			
		||||
			if (in_init)
 | 
			
		||||
				{
 | 
			
		||||
				in_init=0;
 | 
			
		||||
#if 0 /* This test doesn't really work as intended (needs to be fixed) */
 | 
			
		||||
#ifndef OPENSSL_NO_TLSEXT
 | 
			
		||||
				if (servername != NULL && !SSL_session_reused(con))
 | 
			
		||||
					{
 | 
			
		||||
					BIO_printf(bio_c_out,"Server did %sacknowledge servername extension.\n",tlsextcbp.ack?"":"not ");
 | 
			
		||||
					}
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
				if (sess_out)
 | 
			
		||||
					{
 | 
			
		||||
					BIO *stmp = BIO_new_file(sess_out, "w");
 | 
			
		||||
@@ -1248,22 +1084,22 @@ SSL_set_tlsext_status_ids(con, ids);
 | 
			
		||||
 | 
			
		||||
		if (!ssl_pending)
 | 
			
		||||
			{
 | 
			
		||||
#if !defined(OPENSSL_SYS_WINDOWS) && !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_NETWARE) && !defined (OPENSSL_SYS_BEOS_R5)
 | 
			
		||||
#if !defined(OPENSSL_SYS_WINDOWS) && !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_NETWARE)
 | 
			
		||||
			if (tty_on)
 | 
			
		||||
				{
 | 
			
		||||
				if (read_tty)  openssl_fdset(fileno(stdin),&readfds);
 | 
			
		||||
				if (write_tty) openssl_fdset(fileno(stdout),&writefds);
 | 
			
		||||
				if (read_tty)  FD_SET(fileno(stdin),&readfds);
 | 
			
		||||
				if (write_tty) FD_SET(fileno(stdout),&writefds);
 | 
			
		||||
				}
 | 
			
		||||
			if (read_ssl)
 | 
			
		||||
				openssl_fdset(SSL_get_fd(con),&readfds);
 | 
			
		||||
				FD_SET(SSL_get_fd(con),&readfds);
 | 
			
		||||
			if (write_ssl)
 | 
			
		||||
				openssl_fdset(SSL_get_fd(con),&writefds);
 | 
			
		||||
				FD_SET(SSL_get_fd(con),&writefds);
 | 
			
		||||
#else
 | 
			
		||||
			if(!tty_on || !write_tty) {
 | 
			
		||||
				if (read_ssl)
 | 
			
		||||
					openssl_fdset(SSL_get_fd(con),&readfds);
 | 
			
		||||
					FD_SET(SSL_get_fd(con),&readfds);
 | 
			
		||||
				if (write_ssl)
 | 
			
		||||
					openssl_fdset(SSL_get_fd(con),&writefds);
 | 
			
		||||
					FD_SET(SSL_get_fd(con),&writefds);
 | 
			
		||||
			}
 | 
			
		||||
#endif
 | 
			
		||||
/*			printf("mode tty(%d %d%d) ssl(%d%d)\n",
 | 
			
		||||
@@ -1308,25 +1144,6 @@ SSL_set_tlsext_status_ids(con, ids);
 | 
			
		||||
				} else 	i=select(width,(void *)&readfds,(void *)&writefds,
 | 
			
		||||
					NULL,NULL);
 | 
			
		||||
			}
 | 
			
		||||
#elif defined(OPENSSL_SYS_BEOS_R5)
 | 
			
		||||
			/* Under BeOS-R5 the situation is similar to DOS */
 | 
			
		||||
			i=0;
 | 
			
		||||
			stdin_set = 0;
 | 
			
		||||
			(void)fcntl(fileno(stdin), F_SETFL, O_NONBLOCK);
 | 
			
		||||
			if(!write_tty) {
 | 
			
		||||
				if(read_tty) {
 | 
			
		||||
					tv.tv_sec = 1;
 | 
			
		||||
					tv.tv_usec = 0;
 | 
			
		||||
					i=select(width,(void *)&readfds,(void *)&writefds,
 | 
			
		||||
						 NULL,&tv);
 | 
			
		||||
					if (read(fileno(stdin), sbuf, 0) >= 0)
 | 
			
		||||
						stdin_set = 1;
 | 
			
		||||
					if (!i && (stdin_set != 1 || !read_tty))
 | 
			
		||||
						continue;
 | 
			
		||||
				} else 	i=select(width,(void *)&readfds,(void *)&writefds,
 | 
			
		||||
					 NULL,NULL);
 | 
			
		||||
			}
 | 
			
		||||
			(void)fcntl(fileno(stdin), F_SETFL, 0);
 | 
			
		||||
#else
 | 
			
		||||
			i=select(width,(void *)&readfds,(void *)&writefds,
 | 
			
		||||
				 NULL,NULL);
 | 
			
		||||
@@ -1380,7 +1197,6 @@ SSL_set_tlsext_status_ids(con, ids);
 | 
			
		||||
				if (cbuf_len != 0)
 | 
			
		||||
					{
 | 
			
		||||
					BIO_printf(bio_c_out,"shutdown\n");
 | 
			
		||||
					ret = 0;
 | 
			
		||||
					goto shut;
 | 
			
		||||
					}
 | 
			
		||||
				else
 | 
			
		||||
@@ -1408,8 +1224,8 @@ SSL_set_tlsext_status_ids(con, ids);
 | 
			
		||||
				goto shut;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_NETWARE) || defined(OPENSSL_SYS_BEOS_R5)
 | 
			
		||||
		/* Assume Windows/DOS/BeOS can always write */
 | 
			
		||||
#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_NETWARE)
 | 
			
		||||
		/* Assume Windows/DOS can always write */
 | 
			
		||||
		else if (!ssl_pending && write_tty)
 | 
			
		||||
#else
 | 
			
		||||
		else if (!ssl_pending && FD_ISSET(fileno(stdout),&writefds))
 | 
			
		||||
@@ -1418,12 +1234,11 @@ SSL_set_tlsext_status_ids(con, ids);
 | 
			
		||||
#ifdef CHARSET_EBCDIC
 | 
			
		||||
			ascii2ebcdic(&(sbuf[sbuf_off]),&(sbuf[sbuf_off]),sbuf_len);
 | 
			
		||||
#endif
 | 
			
		||||
			i=raw_write_stdout(&(sbuf[sbuf_off]),sbuf_len);
 | 
			
		||||
			i=write(fileno(stdout),&(sbuf[sbuf_off]),sbuf_len);
 | 
			
		||||
 | 
			
		||||
			if (i <= 0)
 | 
			
		||||
				{
 | 
			
		||||
				BIO_printf(bio_c_out,"DONE\n");
 | 
			
		||||
				ret = 0;
 | 
			
		||||
				goto shut;
 | 
			
		||||
				/* goto end; */
 | 
			
		||||
				}
 | 
			
		||||
@@ -1478,12 +1293,10 @@ printf("read=%d pending=%d peek=%d\n",k,SSL_pending(con),SSL_peek(con,zbuf,10240
 | 
			
		||||
				BIO_printf(bio_c_out,"read X BLOCK\n");
 | 
			
		||||
				break;
 | 
			
		||||
			case SSL_ERROR_SYSCALL:
 | 
			
		||||
				ret=get_last_socket_error();
 | 
			
		||||
				BIO_printf(bio_err,"read:errno=%d\n",ret);
 | 
			
		||||
				BIO_printf(bio_err,"read:errno=%d\n",get_last_socket_error());
 | 
			
		||||
				goto shut;
 | 
			
		||||
			case SSL_ERROR_ZERO_RETURN:
 | 
			
		||||
				BIO_printf(bio_c_out,"closed\n");
 | 
			
		||||
				ret=0;
 | 
			
		||||
				goto shut;
 | 
			
		||||
			case SSL_ERROR_SSL:
 | 
			
		||||
				ERR_print_errors(bio_err);
 | 
			
		||||
@@ -1499,9 +1312,7 @@ printf("read=%d pending=%d peek=%d\n",k,SSL_pending(con),SSL_peek(con,zbuf,10240
 | 
			
		||||
		else if ((_kbhit()) || (WAIT_OBJECT_0 == WaitForSingleObject(GetStdHandle(STD_INPUT_HANDLE), 0)))
 | 
			
		||||
#endif
 | 
			
		||||
#elif defined (OPENSSL_SYS_NETWARE)
 | 
			
		||||
		else if (_kbhit())
 | 
			
		||||
#elif defined(OPENSSL_SYS_BEOS_R5)
 | 
			
		||||
		else if (stdin_set)
 | 
			
		||||
        else if (_kbhit())
 | 
			
		||||
#else
 | 
			
		||||
		else if (FD_ISSET(fileno(stdin),&readfds))
 | 
			
		||||
#endif
 | 
			
		||||
@@ -1510,7 +1321,7 @@ printf("read=%d pending=%d peek=%d\n",k,SSL_pending(con),SSL_peek(con,zbuf,10240
 | 
			
		||||
				{
 | 
			
		||||
				int j, lf_num;
 | 
			
		||||
 | 
			
		||||
				i=raw_read_stdin(cbuf,BUFSIZZ/2);
 | 
			
		||||
				i=read(fileno(stdin),cbuf,BUFSIZZ/2);
 | 
			
		||||
				lf_num = 0;
 | 
			
		||||
				/* both loops are skipped when i <= 0 */
 | 
			
		||||
				for (j = 0; j < i; j++)
 | 
			
		||||
@@ -1529,12 +1340,11 @@ printf("read=%d pending=%d peek=%d\n",k,SSL_pending(con),SSL_peek(con,zbuf,10240
 | 
			
		||||
				assert(lf_num == 0);
 | 
			
		||||
				}
 | 
			
		||||
			else
 | 
			
		||||
				i=raw_read_stdin(cbuf,BUFSIZZ);
 | 
			
		||||
				i=read(fileno(stdin),cbuf,BUFSIZZ);
 | 
			
		||||
 | 
			
		||||
			if ((!c_ign_eof) && ((i <= 0) || (cbuf[0] == 'Q')))
 | 
			
		||||
				{
 | 
			
		||||
				BIO_printf(bio_err,"DONE\n");
 | 
			
		||||
				ret=0;
 | 
			
		||||
				goto shut;
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
@@ -1557,20 +1367,14 @@ printf("read=%d pending=%d peek=%d\n",k,SSL_pending(con),SSL_peek(con,zbuf,10240
 | 
			
		||||
			read_tty=0;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	ret=0;
 | 
			
		||||
shut:
 | 
			
		||||
	if (in_init)
 | 
			
		||||
		print_stuff(bio_c_out,con,full_log);
 | 
			
		||||
	SSL_shutdown(con);
 | 
			
		||||
	SHUTDOWN(SSL_get_fd(con));
 | 
			
		||||
	ret=0;
 | 
			
		||||
end:
 | 
			
		||||
	if (con != NULL)
 | 
			
		||||
		{
 | 
			
		||||
		if (prexit != 0)
 | 
			
		||||
			print_stuff(bio_c_out,con,1);
 | 
			
		||||
		SSL_free(con);
 | 
			
		||||
		}
 | 
			
		||||
	if(prexit) print_stuff(bio_c_out,con,1);
 | 
			
		||||
	if (con != NULL) SSL_free(con);
 | 
			
		||||
	if (con2 != NULL) SSL_free(con2);
 | 
			
		||||
	if (ctx != NULL) SSL_CTX_free(ctx);
 | 
			
		||||
	if (cert)
 | 
			
		||||
		X509_free(cert);
 | 
			
		||||
@@ -1599,7 +1403,7 @@ static void print_stuff(BIO *bio, SSL *s, int full)
 | 
			
		||||
	char buf[BUFSIZ];
 | 
			
		||||
	STACK_OF(X509) *sk;
 | 
			
		||||
	STACK_OF(X509_NAME) *sk2;
 | 
			
		||||
	const SSL_CIPHER *c;
 | 
			
		||||
	SSL_CIPHER *c;
 | 
			
		||||
	X509_NAME *xn;
 | 
			
		||||
	int j,i;
 | 
			
		||||
#ifndef OPENSSL_NO_COMP
 | 
			
		||||
@@ -1750,5 +1554,4 @@ static int ocsp_resp_cb(SSL *s, void *arg)
 | 
			
		||||
	OCSP_RESPONSE_free(rsp);
 | 
			
		||||
	return 1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
#endif  /* ndef OPENSSL_NO_TLSEXT */
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										304
									
								
								apps/s_server.c
									
									
									
									
									
								
							
							
						
						
									
										304
									
								
								apps/s_server.c
									
									
									
									
									
								
							@@ -56,7 +56,7 @@
 | 
			
		||||
 * [including the GNU Public Licence.]
 | 
			
		||||
 */
 | 
			
		||||
/* ====================================================================
 | 
			
		||||
 * Copyright (c) 1998-2006 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
 | 
			
		||||
 * modification, are permitted provided that the following conditions
 | 
			
		||||
@@ -113,32 +113,6 @@
 | 
			
		||||
 * ECC cipher suite support in OpenSSL originally developed by 
 | 
			
		||||
 * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.
 | 
			
		||||
 */
 | 
			
		||||
/* ====================================================================
 | 
			
		||||
 * Copyright 2005 Nokia. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * The portions of the attached software ("Contribution") is developed by
 | 
			
		||||
 * Nokia Corporation and is licensed pursuant to the OpenSSL open source
 | 
			
		||||
 * license.
 | 
			
		||||
 *
 | 
			
		||||
 * The Contribution, originally written by Mika Kousa and Pasi Eronen of
 | 
			
		||||
 * Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites
 | 
			
		||||
 * support (see RFC 4279) to OpenSSL.
 | 
			
		||||
 *
 | 
			
		||||
 * No patent licenses or other rights except those expressly stated in
 | 
			
		||||
 * the OpenSSL open source license shall be deemed granted or received
 | 
			
		||||
 * expressly, by implication, estoppel, or otherwise.
 | 
			
		||||
 *
 | 
			
		||||
 * No assurances are provided by Nokia that the Contribution does not
 | 
			
		||||
 * infringe the patent or other intellectual property rights of any third
 | 
			
		||||
 * party or that the license provides you with all the necessary rights
 | 
			
		||||
 * to make use of the Contribution.
 | 
			
		||||
 *
 | 
			
		||||
 * THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN
 | 
			
		||||
 * ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA
 | 
			
		||||
 * SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY
 | 
			
		||||
 * OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR
 | 
			
		||||
 * OTHERWISE.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/* Until the key-gen callbacks are modified to use newer prototypes, we allow
 | 
			
		||||
 * deprecated functions for openssl-internal code */
 | 
			
		||||
@@ -147,11 +121,11 @@
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#include <assert.h>
 | 
			
		||||
#include <ctype.h>
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
 | 
			
		||||
#include <sys/stat.h>
 | 
			
		||||
#include <openssl/e_os2.h>
 | 
			
		||||
#ifdef OPENSSL_NO_STDIO
 | 
			
		||||
#define APPS_WIN16
 | 
			
		||||
@@ -189,15 +163,19 @@ typedef unsigned int u_int;
 | 
			
		||||
#include "s_apps.h"
 | 
			
		||||
#include "timeouts.h"
 | 
			
		||||
 | 
			
		||||
#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)
 | 
			
		||||
/* FIONBIO used as a switch to enable ioctl, and that isn't in VMS < 7.0 */
 | 
			
		||||
#undef FIONBIO
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined(OPENSSL_SYS_BEOS_R5)
 | 
			
		||||
#include <fcntl.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_RSA
 | 
			
		||||
static RSA MS_CALLBACK *tmp_rsa_cb(SSL *s, int is_export, int keylength);
 | 
			
		||||
#endif
 | 
			
		||||
@@ -218,6 +196,14 @@ static DH *get_dh512(void);
 | 
			
		||||
static void s_server_init(void);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef S_ISDIR
 | 
			
		||||
# if defined(_S_IFMT) && defined(_S_IFDIR)
 | 
			
		||||
#  define S_ISDIR(a)	(((a) & _S_IFMT) == _S_IFDIR)
 | 
			
		||||
# else
 | 
			
		||||
#  define S_ISDIR(a)	(((a) & S_IFMT) == S_IFDIR)
 | 
			
		||||
# endif
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_DH
 | 
			
		||||
static unsigned char dh512_p[]={
 | 
			
		||||
	0xDA,0x58,0x3C,0x16,0xD9,0x85,0x22,0x89,0xD0,0xE4,0xAF,0x75,
 | 
			
		||||
@@ -259,7 +245,7 @@ static int accept_socket= -1;
 | 
			
		||||
#undef PROG
 | 
			
		||||
#define PROG		s_server_main
 | 
			
		||||
 | 
			
		||||
extern int verify_depth, verify_return_error;
 | 
			
		||||
extern int verify_depth;
 | 
			
		||||
 | 
			
		||||
static char *cipher=NULL;
 | 
			
		||||
static int s_server_verify=SSL_VERIFY_NONE;
 | 
			
		||||
@@ -297,75 +283,12 @@ static char *engine_id=NULL;
 | 
			
		||||
static const char *session_id_prefix=NULL;
 | 
			
		||||
 | 
			
		||||
static int enable_timeouts = 0;
 | 
			
		||||
static long socket_mtu;
 | 
			
		||||
#ifdef mtu
 | 
			
		||||
#undef mtu
 | 
			
		||||
#endif
 | 
			
		||||
static long mtu;
 | 
			
		||||
static int cert_chain = 0;
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_PSK
 | 
			
		||||
static char *psk_identity="Client_identity";
 | 
			
		||||
char *psk_key=NULL; /* by default PSK is not used */
 | 
			
		||||
 | 
			
		||||
static unsigned int psk_server_cb(SSL *ssl, const char *identity,
 | 
			
		||||
	unsigned char *psk, unsigned int max_psk_len)
 | 
			
		||||
	{
 | 
			
		||||
	unsigned int psk_len = 0;
 | 
			
		||||
	int ret;
 | 
			
		||||
	BIGNUM *bn = NULL;
 | 
			
		||||
 | 
			
		||||
	if (s_debug)
 | 
			
		||||
		BIO_printf(bio_s_out,"psk_server_cb\n");
 | 
			
		||||
	if (!identity)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_printf(bio_err,"Error: client did not send PSK identity\n");
 | 
			
		||||
		goto out_err;
 | 
			
		||||
		}
 | 
			
		||||
	if (s_debug)
 | 
			
		||||
		BIO_printf(bio_s_out,"identity_len=%d identity=%s\n",
 | 
			
		||||
			identity ? (int)strlen(identity) : 0, identity);
 | 
			
		||||
 | 
			
		||||
	/* here we could lookup the given identity e.g. from a database */
 | 
			
		||||
  	if (strcmp(identity, psk_identity) != 0)
 | 
			
		||||
		{
 | 
			
		||||
                BIO_printf(bio_s_out, "PSK error: client identity not found"
 | 
			
		||||
			   " (got '%s' expected '%s')\n", identity,
 | 
			
		||||
			   psk_identity);
 | 
			
		||||
		goto out_err;
 | 
			
		||||
                }
 | 
			
		||||
	if (s_debug)
 | 
			
		||||
		BIO_printf(bio_s_out, "PSK client identity found\n");
 | 
			
		||||
 | 
			
		||||
	/* convert the PSK key to binary */
 | 
			
		||||
	ret = BN_hex2bn(&bn, psk_key);
 | 
			
		||||
	if (!ret)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_printf(bio_err,"Could not convert PSK key '%s' to BIGNUM\n", psk_key);
 | 
			
		||||
		if (bn)
 | 
			
		||||
			BN_free(bn);
 | 
			
		||||
		return 0;
 | 
			
		||||
		}
 | 
			
		||||
	if (BN_num_bytes(bn) > (int)max_psk_len)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_printf(bio_err,"psk buffer of callback is too small (%d) for key (%d)\n",
 | 
			
		||||
			max_psk_len, BN_num_bytes(bn));
 | 
			
		||||
		BN_free(bn);
 | 
			
		||||
		return 0;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	ret = BN_bn2bin(bn, psk);
 | 
			
		||||
	BN_free(bn);
 | 
			
		||||
 | 
			
		||||
	if (ret < 0)
 | 
			
		||||
		goto out_err;
 | 
			
		||||
	psk_len = (unsigned int)ret;
 | 
			
		||||
 | 
			
		||||
	if (s_debug)
 | 
			
		||||
		BIO_printf(bio_s_out, "fetched PSK len=%d\n", psk_len);
 | 
			
		||||
        return psk_len;
 | 
			
		||||
 out_err:
 | 
			
		||||
	if (s_debug)
 | 
			
		||||
		BIO_printf(bio_err, "Error in PSK server callback\n");
 | 
			
		||||
	return 0;
 | 
			
		||||
        }
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef MONOLITH
 | 
			
		||||
static void s_server_init(void)
 | 
			
		||||
@@ -430,7 +353,7 @@ static void sv_usage(void)
 | 
			
		||||
#ifndef OPENSSL_NO_ECDH
 | 
			
		||||
	BIO_printf(bio_err," -named_curve arg  - Elliptic curve name to use for ephemeral ECDH keys.\n" \
 | 
			
		||||
	                   "                 Use \"openssl ecparam -list_curves\" for all names\n" \
 | 
			
		||||
	                   "                 (default is nistp256).\n");
 | 
			
		||||
	                   "                 (default is sect163r2).\n");
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef FIONBIO
 | 
			
		||||
	BIO_printf(bio_err," -nbio         - Run with non-blocking IO\n");
 | 
			
		||||
@@ -447,13 +370,6 @@ static void sv_usage(void)
 | 
			
		||||
	BIO_printf(bio_err," -serverpref   - Use server's cipher preferences\n");
 | 
			
		||||
	BIO_printf(bio_err," -quiet        - No server output\n");
 | 
			
		||||
	BIO_printf(bio_err," -no_tmp_rsa   - Do not generate a tmp RSA key\n");
 | 
			
		||||
#ifndef OPENSSL_NO_PSK
 | 
			
		||||
	BIO_printf(bio_err," -psk_hint arg - PSK identity hint to use\n");
 | 
			
		||||
	BIO_printf(bio_err," -psk arg      - PSK in hex (without 0x)\n");
 | 
			
		||||
# ifndef OPENSSL_NO_JPAKE
 | 
			
		||||
	BIO_printf(bio_err," -jpake arg    - JPAKE secret to use\n");
 | 
			
		||||
# endif
 | 
			
		||||
#endif
 | 
			
		||||
	BIO_printf(bio_err," -ssl2         - Just talk SSLv2\n");
 | 
			
		||||
	BIO_printf(bio_err," -ssl3         - Just talk SSLv3\n");
 | 
			
		||||
	BIO_printf(bio_err," -tls1         - Just talk TLSv1\n");
 | 
			
		||||
@@ -710,7 +626,7 @@ static int cert_status_cb(SSL *s, void *arg)
 | 
			
		||||
	int use_ssl;
 | 
			
		||||
	unsigned char *rspder = NULL;
 | 
			
		||||
	int rspderlen;
 | 
			
		||||
	STACK_OF(STRING) *aia = NULL;
 | 
			
		||||
	STACK *aia = NULL;
 | 
			
		||||
	X509 *x = NULL;
 | 
			
		||||
	X509_STORE_CTX inctx;
 | 
			
		||||
	X509_OBJECT obj;
 | 
			
		||||
@@ -732,7 +648,7 @@ BIO_printf(err, "cert_status: received %d ids\n", sk_OCSP_RESPID_num(ids));
 | 
			
		||||
	aia = X509_get1_ocsp(x);
 | 
			
		||||
	if (aia)
 | 
			
		||||
		{
 | 
			
		||||
		if (!OCSP_parse_url(sk_STRING_value(aia, 0),
 | 
			
		||||
		if (!OCSP_parse_url(sk_value(aia, 0),
 | 
			
		||||
			&host, &port, &path, &use_ssl))
 | 
			
		||||
			{
 | 
			
		||||
			BIO_puts(err, "cert_status: can't parse AIA URL\n");
 | 
			
		||||
@@ -740,7 +656,7 @@ BIO_printf(err, "cert_status: received %d ids\n", sk_OCSP_RESPID_num(ids));
 | 
			
		||||
			}
 | 
			
		||||
		if (srctx->verbose)
 | 
			
		||||
			BIO_printf(err, "cert_status: AIA URL: %s\n",
 | 
			
		||||
					sk_STRING_value(aia, 0));
 | 
			
		||||
					sk_value(aia, 0));
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
@@ -824,7 +740,6 @@ BIO_printf(err, "cert_status: received %d ids\n", sk_OCSP_RESPID_num(ids));
 | 
			
		||||
	goto done;
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
int MAIN(int, char **);
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_JPAKE
 | 
			
		||||
@@ -847,8 +762,8 @@ int MAIN(int argc, char *argv[])
 | 
			
		||||
	int off=0;
 | 
			
		||||
	int no_tmp_rsa=0,no_dhe=0,no_ecdhe=0,nocert=0;
 | 
			
		||||
	int state=0;
 | 
			
		||||
	const SSL_METHOD *meth=NULL;
 | 
			
		||||
	int socket_type=SOCK_STREAM;
 | 
			
		||||
	SSL_METHOD *meth=NULL;
 | 
			
		||||
        int socket_type=SOCK_STREAM;
 | 
			
		||||
	ENGINE *e=NULL;
 | 
			
		||||
	char *inrand=NULL;
 | 
			
		||||
	int s_cert_format = FORMAT_PEM, s_key_format = FORMAT_PEM;
 | 
			
		||||
@@ -864,10 +779,7 @@ int MAIN(int argc, char *argv[])
 | 
			
		||||
#ifndef OPENSSL_NO_TLSEXT
 | 
			
		||||
        tlsextctx tlsextcbp = {NULL, NULL, SSL_TLSEXT_ERR_ALERT_WARNING};
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_PSK
 | 
			
		||||
	/* by default do not send a PSK identity hint */
 | 
			
		||||
	static char *psk_identity_hint=NULL;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if !defined(OPENSSL_NO_SSL2) && !defined(OPENSSL_NO_SSL3)
 | 
			
		||||
	meth=SSLv23_server_method();
 | 
			
		||||
#elif !defined(OPENSSL_NO_SSL3)
 | 
			
		||||
@@ -1007,8 +919,6 @@ int MAIN(int argc, char *argv[])
 | 
			
		||||
			{
 | 
			
		||||
			vflags |= X509_V_FLAG_CRL_CHECK|X509_V_FLAG_CRL_CHECK_ALL;
 | 
			
		||||
			}
 | 
			
		||||
		else if (strcmp(*argv,"-verify_return_error") == 0)
 | 
			
		||||
			verify_return_error = 1;
 | 
			
		||||
		else if	(strcmp(*argv,"-serverpref") == 0)
 | 
			
		||||
			{ off|=SSL_OP_CIPHER_SERVER_PREFERENCE; }
 | 
			
		||||
		else if	(strcmp(*argv,"-cipher") == 0)
 | 
			
		||||
@@ -1083,27 +993,6 @@ int MAIN(int argc, char *argv[])
 | 
			
		||||
			{ no_dhe=1; }
 | 
			
		||||
		else if	(strcmp(*argv,"-no_ecdhe") == 0)
 | 
			
		||||
			{ no_ecdhe=1; }
 | 
			
		||||
#ifndef OPENSSL_NO_PSK
 | 
			
		||||
                else if (strcmp(*argv,"-psk_hint") == 0)
 | 
			
		||||
			{
 | 
			
		||||
                        if (--argc < 1) goto bad;
 | 
			
		||||
                        psk_identity_hint= *(++argv);
 | 
			
		||||
                        }
 | 
			
		||||
                else if (strcmp(*argv,"-psk") == 0)
 | 
			
		||||
			{
 | 
			
		||||
			size_t i;
 | 
			
		||||
 | 
			
		||||
			if (--argc < 1) goto bad;
 | 
			
		||||
			psk_key=*(++argv);
 | 
			
		||||
			for (i=0; i<strlen(psk_key); i++)
 | 
			
		||||
				{
 | 
			
		||||
				if (isxdigit((int)psk_key[i]))
 | 
			
		||||
					continue;
 | 
			
		||||
				BIO_printf(bio_err,"Not a hex number '%s'\n",*argv);
 | 
			
		||||
				goto bad;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
#endif
 | 
			
		||||
		else if	(strcmp(*argv,"-www") == 0)
 | 
			
		||||
			{ www=1; }
 | 
			
		||||
		else if	(strcmp(*argv,"-WWW") == 0)
 | 
			
		||||
@@ -1116,8 +1005,6 @@ int MAIN(int argc, char *argv[])
 | 
			
		||||
			{ off|=SSL_OP_NO_SSLv3; }
 | 
			
		||||
		else if	(strcmp(*argv,"-no_tls1") == 0)
 | 
			
		||||
			{ off|=SSL_OP_NO_TLSv1; }
 | 
			
		||||
		else if	(strcmp(*argv,"-no_comp") == 0)
 | 
			
		||||
			{ off|=SSL_OP_NO_COMPRESSION; }
 | 
			
		||||
#ifndef OPENSSL_NO_TLSEXT
 | 
			
		||||
		else if	(strcmp(*argv,"-no_ticket") == 0)
 | 
			
		||||
			{ off|=SSL_OP_NO_TICKET; }
 | 
			
		||||
@@ -1145,7 +1032,7 @@ int MAIN(int argc, char *argv[])
 | 
			
		||||
		else if (strcmp(*argv,"-mtu") == 0)
 | 
			
		||||
			{
 | 
			
		||||
			if (--argc < 1) goto bad;
 | 
			
		||||
			socket_mtu = atol(*(++argv));
 | 
			
		||||
			mtu = atol(*(++argv));
 | 
			
		||||
			}
 | 
			
		||||
		else if (strcmp(*argv, "-chain") == 0)
 | 
			
		||||
			cert_chain = 1;
 | 
			
		||||
@@ -1187,7 +1074,7 @@ int MAIN(int argc, char *argv[])
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
#endif
 | 
			
		||||
#if !defined(OPENSSL_NO_JPAKE) && !defined(OPENSSL_NO_PSK)
 | 
			
		||||
#ifndef OPENSSL_NO_JPAKE
 | 
			
		||||
		else if (strcmp(*argv,"-jpake") == 0)
 | 
			
		||||
			{
 | 
			
		||||
			if (--argc < 1) goto bad;
 | 
			
		||||
@@ -1210,26 +1097,6 @@ bad:
 | 
			
		||||
		goto end;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
#if !defined(OPENSSL_NO_JPAKE) && !defined(OPENSSL_NO_PSK)
 | 
			
		||||
	if (jpake_secret)
 | 
			
		||||
		{
 | 
			
		||||
		if (psk_key)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bio_err,
 | 
			
		||||
				   "Can't use JPAKE and PSK together\n");
 | 
			
		||||
			goto end;
 | 
			
		||||
			}
 | 
			
		||||
		psk_identity = "JPAKE";
 | 
			
		||||
		if (cipher)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bio_err, "JPAKE sets cipher to PSK\n");
 | 
			
		||||
			goto end;
 | 
			
		||||
			}
 | 
			
		||||
		cipher = "PSK";
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	SSL_load_error_strings();
 | 
			
		||||
	OpenSSL_add_ssl_algorithms();
 | 
			
		||||
 | 
			
		||||
@@ -1292,8 +1159,6 @@ bad:
 | 
			
		||||
			}
 | 
			
		||||
#endif
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	if (s_dcert_file)
 | 
			
		||||
		{
 | 
			
		||||
 | 
			
		||||
@@ -1412,7 +1277,6 @@ bad:
 | 
			
		||||
		}
 | 
			
		||||
	store = SSL_CTX_get_cert_store(ctx);
 | 
			
		||||
	X509_STORE_set_flags(store, vflags);
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_TLSEXT
 | 
			
		||||
	if (s_cert2)
 | 
			
		||||
		{
 | 
			
		||||
@@ -1448,11 +1312,13 @@ bad:
 | 
			
		||||
		if (bugs) SSL_CTX_set_options(ctx2,SSL_OP_ALL);
 | 
			
		||||
		if (hack) SSL_CTX_set_options(ctx2,SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG);
 | 
			
		||||
		SSL_CTX_set_options(ctx2,off);
 | 
			
		||||
 | 
			
		||||
		/* DTLS: partial reads end up discarding unread UDP bytes :-( 
 | 
			
		||||
		 * Setting read ahead solves this problem.
 | 
			
		||||
		 */
 | 
			
		||||
		if (socket_type == SOCK_DGRAM) SSL_CTX_set_read_ahead(ctx2, 1);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		if (state) SSL_CTX_set_info_callback(ctx2,apps_ssl_info_callback);
 | 
			
		||||
 | 
			
		||||
		SSL_CTX_sess_set_cache_size(ctx2,128);
 | 
			
		||||
@@ -1467,6 +1333,7 @@ bad:
 | 
			
		||||
		}
 | 
			
		||||
#endif 
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_DH
 | 
			
		||||
	if (!no_dhe)
 | 
			
		||||
		{
 | 
			
		||||
@@ -1542,10 +1409,10 @@ bad:
 | 
			
		||||
		else
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bio_s_out,"Using default temp ECDH parameters\n");
 | 
			
		||||
			ecdh = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
 | 
			
		||||
			ecdh = EC_KEY_new_by_curve_name(NID_sect163r2);
 | 
			
		||||
			if (ecdh == NULL) 
 | 
			
		||||
				{
 | 
			
		||||
				BIO_printf(bio_err, "unable to create curve (nistp256)\n");
 | 
			
		||||
				BIO_printf(bio_err, "unable to create curve (sect163r2)\n");
 | 
			
		||||
				goto end;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
@@ -1580,7 +1447,7 @@ bad:
 | 
			
		||||
#ifndef OPENSSL_NO_TLSEXT
 | 
			
		||||
		if (ctx2) 
 | 
			
		||||
			SSL_CTX_set_tmp_rsa_callback(ctx2,tmp_rsa_cb);
 | 
			
		||||
#endif		
 | 
			
		||||
#endif	
 | 
			
		||||
		}
 | 
			
		||||
#else
 | 
			
		||||
	if (!no_tmp_rsa && SSL_CTX_need_tmp_RSA(ctx))
 | 
			
		||||
@@ -1613,34 +1480,11 @@ bad:
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_PSK
 | 
			
		||||
#ifdef OPENSSL_NO_JPAKE
 | 
			
		||||
	if (psk_key != NULL)
 | 
			
		||||
#else
 | 
			
		||||
	if (psk_key != NULL || jpake_secret)
 | 
			
		||||
#endif
 | 
			
		||||
		{
 | 
			
		||||
		if (s_debug)
 | 
			
		||||
			BIO_printf(bio_s_out, "PSK key given or JPAKE in use, setting server callback\n");
 | 
			
		||||
		SSL_CTX_set_psk_server_callback(ctx, psk_server_cb);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (!SSL_CTX_use_psk_identity_hint(ctx, psk_identity_hint))
 | 
			
		||||
		{
 | 
			
		||||
		BIO_printf(bio_err,"error setting PSK identity hint to context\n");
 | 
			
		||||
	if (cipher != NULL)
 | 
			
		||||
		if(!SSL_CTX_set_cipher_list(ctx,cipher)) {
 | 
			
		||||
		BIO_printf(bio_err,"error setting cipher list\n");
 | 
			
		||||
		ERR_print_errors(bio_err);
 | 
			
		||||
		goto end;
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	if (cipher != NULL)
 | 
			
		||||
		{
 | 
			
		||||
		if(!SSL_CTX_set_cipher_list(ctx,cipher))
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bio_err,"error setting cipher list\n");
 | 
			
		||||
			ERR_print_errors(bio_err);
 | 
			
		||||
			goto end;
 | 
			
		||||
			}
 | 
			
		||||
#ifndef OPENSSL_NO_TLSEXT
 | 
			
		||||
		if (ctx2 && !SSL_CTX_set_cipher_list(ctx2,cipher))
 | 
			
		||||
			{
 | 
			
		||||
@@ -1649,7 +1493,7 @@ bad:
 | 
			
		||||
			goto end;
 | 
			
		||||
			}
 | 
			
		||||
#endif
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	SSL_CTX_set_verify(ctx,s_server_verify,verify_callback);
 | 
			
		||||
	SSL_CTX_set_session_id_context(ctx,(void*)&s_server_session_id_context,
 | 
			
		||||
		sizeof s_server_session_id_context);
 | 
			
		||||
@@ -1668,7 +1512,6 @@ bad:
 | 
			
		||||
		SSL_CTX_set_tlsext_servername_arg(ctx, &tlsextcbp);
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	if (CAfile != NULL)
 | 
			
		||||
		{
 | 
			
		||||
		SSL_CTX_set_client_CA_list(ctx,SSL_load_client_CA_file(CAfile));
 | 
			
		||||
@@ -1677,9 +1520,7 @@ bad:
 | 
			
		||||
			SSL_CTX_set_client_CA_list(ctx2,SSL_load_client_CA_file(CAfile));
 | 
			
		||||
#endif
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	BIO_printf(bio_s_out,"ACCEPT\n");
 | 
			
		||||
	(void)BIO_flush(bio_s_out);
 | 
			
		||||
	if (www)
 | 
			
		||||
		do_server(port,socket_type,&accept_socket,www_body, context);
 | 
			
		||||
	else
 | 
			
		||||
@@ -1750,7 +1591,7 @@ static int sv_body(char *hostname, int s, unsigned char *context)
 | 
			
		||||
	unsigned long l;
 | 
			
		||||
	SSL *con=NULL;
 | 
			
		||||
	BIO *sbio;
 | 
			
		||||
#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_NETWARE) || defined(OPENSSL_SYS_BEOS_R5)
 | 
			
		||||
#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_NETWARE)
 | 
			
		||||
	struct timeval tv;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
@@ -1800,11 +1641,6 @@ static int sv_body(char *hostname, int s, unsigned char *context)
 | 
			
		||||
						 strlen((char *)context));
 | 
			
		||||
	}
 | 
			
		||||
	SSL_clear(con);
 | 
			
		||||
#if 0
 | 
			
		||||
#ifdef TLSEXT_TYPE_opaque_prf_input
 | 
			
		||||
	SSL_set_tlsext_opaque_prf_input(con, "Test server", 11);
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	if (SSL_version(con) == DTLS1_VERSION)
 | 
			
		||||
		{
 | 
			
		||||
@@ -1812,7 +1648,7 @@ static int sv_body(char *hostname, int s, unsigned char *context)
 | 
			
		||||
 | 
			
		||||
		sbio=BIO_new_dgram(s,BIO_NOCLOSE);
 | 
			
		||||
 | 
			
		||||
		if (enable_timeouts)
 | 
			
		||||
		if ( enable_timeouts)
 | 
			
		||||
			{
 | 
			
		||||
			timeout.tv_sec = 0;
 | 
			
		||||
			timeout.tv_usec = DGRAM_RCV_TIMEOUT;
 | 
			
		||||
@@ -1823,10 +1659,11 @@ static int sv_body(char *hostname, int s, unsigned char *context)
 | 
			
		||||
			BIO_ctrl(sbio, BIO_CTRL_DGRAM_SET_SEND_TIMEOUT, 0, &timeout);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		if (socket_mtu > 0)
 | 
			
		||||
		
 | 
			
		||||
		if ( mtu > 0)
 | 
			
		||||
			{
 | 
			
		||||
			SSL_set_options(con, SSL_OP_NO_QUERY_MTU);
 | 
			
		||||
			SSL_set_mtu(con, socket_mtu);
 | 
			
		||||
			SSL_set_mtu(con, mtu);
 | 
			
		||||
			}
 | 
			
		||||
		else
 | 
			
		||||
			/* want to do MTU discovery */
 | 
			
		||||
@@ -1885,10 +1722,10 @@ static int sv_body(char *hostname, int s, unsigned char *context)
 | 
			
		||||
		if (!read_from_sslcon)
 | 
			
		||||
			{
 | 
			
		||||
			FD_ZERO(&readfds);
 | 
			
		||||
#if !defined(OPENSSL_SYS_WINDOWS) && !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_NETWARE) && !defined(OPENSSL_SYS_BEOS_R5)
 | 
			
		||||
			openssl_fdset(fileno(stdin),&readfds);
 | 
			
		||||
#if !defined(OPENSSL_SYS_WINDOWS) && !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_NETWARE)
 | 
			
		||||
			FD_SET(fileno(stdin),&readfds);
 | 
			
		||||
#endif
 | 
			
		||||
			openssl_fdset(s,&readfds);
 | 
			
		||||
			FD_SET(s,&readfds);
 | 
			
		||||
			/* Note: under VMS with SOCKETSHR the second parameter is
 | 
			
		||||
			 * currently of type (int *) whereas under other systems
 | 
			
		||||
			 * it is (void *) if you don't have a cast it will choke
 | 
			
		||||
@@ -1907,17 +1744,6 @@ static int sv_body(char *hostname, int s, unsigned char *context)
 | 
			
		||||
			if((i < 0) || (!i && !_kbhit() ) )continue;
 | 
			
		||||
			if(_kbhit())
 | 
			
		||||
				read_from_terminal = 1;
 | 
			
		||||
#elif defined(OPENSSL_SYS_BEOS_R5)
 | 
			
		||||
			/* Under BeOS-R5 the situation is similar to DOS */
 | 
			
		||||
			tv.tv_sec = 1;
 | 
			
		||||
			tv.tv_usec = 0;
 | 
			
		||||
			(void)fcntl(fileno(stdin), F_SETFL, O_NONBLOCK);
 | 
			
		||||
			i=select(width,(void *)&readfds,NULL,NULL,&tv);
 | 
			
		||||
			if ((i < 0) || (!i && read(fileno(stdin), buf, 0) < 0))
 | 
			
		||||
				continue;
 | 
			
		||||
			if (read(fileno(stdin), buf, 0) >= 0)
 | 
			
		||||
				read_from_terminal = 1;
 | 
			
		||||
			(void)fcntl(fileno(stdin), F_SETFL, 0);
 | 
			
		||||
#else
 | 
			
		||||
			i=select(width,(void *)&readfds,NULL,NULL,NULL);
 | 
			
		||||
			if (i <= 0) continue;
 | 
			
		||||
@@ -1933,7 +1759,7 @@ static int sv_body(char *hostname, int s, unsigned char *context)
 | 
			
		||||
				{
 | 
			
		||||
				int j, lf_num;
 | 
			
		||||
 | 
			
		||||
				i=raw_read_stdin(buf, bufsize/2);
 | 
			
		||||
				i=read(fileno(stdin), buf, bufsize/2);
 | 
			
		||||
				lf_num = 0;
 | 
			
		||||
				/* both loops are skipped when i <= 0 */
 | 
			
		||||
				for (j = 0; j < i; j++)
 | 
			
		||||
@@ -1952,7 +1778,7 @@ static int sv_body(char *hostname, int s, unsigned char *context)
 | 
			
		||||
				assert(lf_num == 0);
 | 
			
		||||
				}
 | 
			
		||||
			else
 | 
			
		||||
				i=raw_read_stdin(buf,bufsize);
 | 
			
		||||
				i=read(fileno(stdin),buf,bufsize);
 | 
			
		||||
			if (!s_quiet)
 | 
			
		||||
				{
 | 
			
		||||
				if ((i <= 0) || (buf[0] == 'Q'))
 | 
			
		||||
@@ -1972,7 +1798,6 @@ static int sv_body(char *hostname, int s, unsigned char *context)
 | 
			
		||||
					ret= -11;*/
 | 
			
		||||
					goto err;
 | 
			
		||||
					}
 | 
			
		||||
 | 
			
		||||
				if ((buf[0] == 'r') && 
 | 
			
		||||
					((buf[1] == '\n') || (buf[1] == '\r')))
 | 
			
		||||
					{
 | 
			
		||||
@@ -2069,7 +1894,7 @@ again:
 | 
			
		||||
#ifdef CHARSET_EBCDIC
 | 
			
		||||
					ascii2ebcdic(buf,buf,i);
 | 
			
		||||
#endif
 | 
			
		||||
					raw_write_stdout(buf,
 | 
			
		||||
					write(fileno(stdout),buf,
 | 
			
		||||
						(unsigned int)i);
 | 
			
		||||
					if (SSL_pending(con)) goto again;
 | 
			
		||||
					break;
 | 
			
		||||
@@ -2093,16 +1918,13 @@ again:
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
err:
 | 
			
		||||
	if (con != NULL)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_printf(bio_s_out,"shutting down SSL\n");
 | 
			
		||||
	BIO_printf(bio_s_out,"shutting down SSL\n");
 | 
			
		||||
#if 1
 | 
			
		||||
		SSL_set_shutdown(con,SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN);
 | 
			
		||||
	SSL_set_shutdown(con,SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN);
 | 
			
		||||
#else
 | 
			
		||||
		SSL_shutdown(con);
 | 
			
		||||
	SSL_shutdown(con);
 | 
			
		||||
#endif
 | 
			
		||||
		SSL_free(con);
 | 
			
		||||
		}
 | 
			
		||||
	if (con != NULL) SSL_free(con);
 | 
			
		||||
	BIO_printf(bio_s_out,"CONNECTION CLOSED\n");
 | 
			
		||||
	if (buf != NULL)
 | 
			
		||||
		{
 | 
			
		||||
@@ -2224,8 +2046,9 @@ static int www_body(char *hostname, int s, unsigned char *context)
 | 
			
		||||
	char *buf=NULL;
 | 
			
		||||
	int ret=1;
 | 
			
		||||
	int i,j,k,blank,dot;
 | 
			
		||||
	struct stat st_buf;
 | 
			
		||||
	SSL *con;
 | 
			
		||||
	const SSL_CIPHER *c;
 | 
			
		||||
	SSL_CIPHER *c;
 | 
			
		||||
	BIO *io,*ssl_bio,*sbio;
 | 
			
		||||
	long total_bytes;
 | 
			
		||||
 | 
			
		||||
@@ -2495,7 +2318,14 @@ static int www_body(char *hostname, int s, unsigned char *context)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
			/* if a directory, do the index thang */
 | 
			
		||||
			if (app_isdir(p)>0)
 | 
			
		||||
			if (stat(p,&st_buf) < 0)
 | 
			
		||||
				{
 | 
			
		||||
				BIO_puts(io,text);
 | 
			
		||||
				BIO_printf(io,"Error accessing '%s'\r\n",p);
 | 
			
		||||
				ERR_print_errors(io);
 | 
			
		||||
				break;
 | 
			
		||||
				}
 | 
			
		||||
			if (S_ISDIR(st_buf.st_mode))
 | 
			
		||||
				{
 | 
			
		||||
#if 0 /* must check buffer size */
 | 
			
		||||
				strcat(p,"/index.html");
 | 
			
		||||
 
 | 
			
		||||
@@ -231,11 +231,13 @@ static int ssl_sock_init(void)
 | 
			
		||||
int init_client(int *sock, char *host, int port, int type)
 | 
			
		||||
	{
 | 
			
		||||
	unsigned char ip[4];
 | 
			
		||||
	short p=0;
 | 
			
		||||
 | 
			
		||||
	if (!host_ip(host,&(ip[0])))
 | 
			
		||||
		{
 | 
			
		||||
		return(0);
 | 
			
		||||
		}
 | 
			
		||||
	if (p != 0) port=p;
 | 
			
		||||
	return(init_client_ip(sock,ip,port,type));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -264,7 +266,7 @@ static int init_client_ip(int *sock, unsigned char ip[4], int port, int type)
 | 
			
		||||
			
 | 
			
		||||
	if (s == INVALID_SOCKET) { perror("socket"); return(0); }
 | 
			
		||||
 | 
			
		||||
#if defined(SO_KEEPALIVE) && !defined(OPENSSL_SYS_MPE)
 | 
			
		||||
#ifndef OPENSSL_SYS_MPE
 | 
			
		||||
	if (type == SOCK_STREAM)
 | 
			
		||||
		{
 | 
			
		||||
		i=0;
 | 
			
		||||
@@ -274,7 +276,7 @@ static int init_client_ip(int *sock, unsigned char ip[4], int port, int type)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	if (connect(s,(struct sockaddr *)&them,sizeof(them)) == -1)
 | 
			
		||||
		{ closesocket(s); perror("connect"); return(0); }
 | 
			
		||||
		{ close(s); perror("connect"); return(0); }
 | 
			
		||||
	*sock=s;
 | 
			
		||||
	return(1);
 | 
			
		||||
	}
 | 
			
		||||
@@ -283,7 +285,7 @@ int do_server(int port, int type, int *ret, int (*cb)(char *hostname, int s, uns
 | 
			
		||||
	{
 | 
			
		||||
	int sock;
 | 
			
		||||
	char *name = NULL;
 | 
			
		||||
	int accept_socket = 0;
 | 
			
		||||
	int accept_socket;
 | 
			
		||||
	int i;
 | 
			
		||||
 | 
			
		||||
	if (!init_server(&accept_socket,port,type)) return(0);
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										109
									
								
								apps/s_time.c
									
									
									
									
									
								
							
							
						
						
									
										109
									
								
								apps/s_time.c
									
									
									
									
									
								
							@@ -85,6 +85,54 @@
 | 
			
		||||
#include OPENSSL_UNISTD
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if !defined(OPENSSL_SYS_NETWARE) && !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_VXWORKS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC))
 | 
			
		||||
#define TIMES
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef _IRIX
 | 
			
		||||
#include <time.h>
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef TIMES
 | 
			
		||||
#include <sys/types.h>
 | 
			
		||||
#include <sys/times.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/* Depending on the VMS version, the tms structure is perhaps defined.
 | 
			
		||||
   The __TMS macro will show if it was.  If it wasn't defined, we should
 | 
			
		||||
   undefine TIMES, since that tells the rest of the program how things
 | 
			
		||||
   should be handled.				-- Richard Levitte */
 | 
			
		||||
#if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS)
 | 
			
		||||
#undef TIMES
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if !defined(TIMES) && !defined(OPENSSL_SYS_VXWORKS) && !defined(OPENSSL_SYS_NETWARE)
 | 
			
		||||
#include <sys/timeb.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined(sun) || defined(__ultrix)
 | 
			
		||||
#define _POSIX_SOURCE
 | 
			
		||||
#include <limits.h>
 | 
			
		||||
#include <sys/param.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/* The following if from times(3) man page.  It may need to be changed
 | 
			
		||||
*/
 | 
			
		||||
#ifndef HZ
 | 
			
		||||
# ifdef _SC_CLK_TCK
 | 
			
		||||
#  define HZ ((double)sysconf(_SC_CLK_TCK))
 | 
			
		||||
# else
 | 
			
		||||
#  ifndef CLK_TCK
 | 
			
		||||
#   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
 | 
			
		||||
 | 
			
		||||
#undef PROG
 | 
			
		||||
#define PROG s_time_main
 | 
			
		||||
 | 
			
		||||
@@ -129,7 +177,7 @@ static char *tm_cipher=NULL;
 | 
			
		||||
static int tm_verify = SSL_VERIFY_NONE;
 | 
			
		||||
static int maxTime = SECONDS;
 | 
			
		||||
static SSL_CTX *tm_ctx=NULL;
 | 
			
		||||
static const SSL_METHOD *s_time_meth=NULL;
 | 
			
		||||
static SSL_METHOD *s_time_meth=NULL;
 | 
			
		||||
static char *s_www_path=NULL;
 | 
			
		||||
static long bytes_read=0; 
 | 
			
		||||
static int st_bugs=0;
 | 
			
		||||
@@ -324,8 +372,63 @@ bad:
 | 
			
		||||
 | 
			
		||||
static double tm_Time_F(int s)
 | 
			
		||||
	{
 | 
			
		||||
	return app_tminterval(s,1);
 | 
			
		||||
	static double ret;
 | 
			
		||||
#ifdef TIMES
 | 
			
		||||
	static struct tms tstart,tend;
 | 
			
		||||
 | 
			
		||||
	if(s == START) {
 | 
			
		||||
		times(&tstart);
 | 
			
		||||
		return(0);
 | 
			
		||||
	} else {
 | 
			
		||||
		times(&tend);
 | 
			
		||||
		ret=((double)(tend.tms_utime-tstart.tms_utime))/HZ;
 | 
			
		||||
		return((ret == 0.0)?1e-6:ret);
 | 
			
		||||
	}
 | 
			
		||||
#elif defined(OPENSSL_SYS_NETWARE)
 | 
			
		||||
    static clock_t tstart,tend;
 | 
			
		||||
 | 
			
		||||
    if (s == START)
 | 
			
		||||
    {
 | 
			
		||||
        tstart=clock();
 | 
			
		||||
        return(0);
 | 
			
		||||
    }
 | 
			
		||||
    else
 | 
			
		||||
    {
 | 
			
		||||
        tend=clock();
 | 
			
		||||
        ret=(double)((double)(tend)-(double)(tstart));
 | 
			
		||||
        return((ret < 0.001)?0.001: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() */
 | 
			
		||||
	static struct timeb tstart,tend;
 | 
			
		||||
	long i;
 | 
			
		||||
 | 
			
		||||
	if(s == START) {
 | 
			
		||||
		ftime(&tstart);
 | 
			
		||||
		return(0);
 | 
			
		||||
	} else {
 | 
			
		||||
		ftime(&tend);
 | 
			
		||||
		i=(long)tend.millitm-(long)tstart.millitm;
 | 
			
		||||
		ret=((double)(tend.time-tstart.time))+((double)i)/1000.0;
 | 
			
		||||
		return((ret == 0.0)?1e-6:ret);
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/***********************************************************************
 | 
			
		||||
 * MAIN - main processing area for client
 | 
			
		||||
@@ -601,7 +704,7 @@ static SSL *doConnection(SSL *scon)
 | 
			
		||||
			i=SSL_get_fd(serverCon);
 | 
			
		||||
			width=i+1;
 | 
			
		||||
			FD_ZERO(&readfds);
 | 
			
		||||
			openssl_fdset(i,&readfds);
 | 
			
		||||
			FD_SET(i,&readfds);
 | 
			
		||||
			/* Note: under VMS with SOCKETSHR the 2nd parameter
 | 
			
		||||
			 * is currently of type (int *) whereas under other
 | 
			
		||||
			 * systems it is (void *) if you don't have a cast it
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										412
									
								
								apps/smime.c
									
									
									
									
									
								
							
							
						
						
									
										412
									
								
								apps/smime.c
									
									
									
									
									
								
							@@ -73,14 +73,11 @@ static int save_certs(char *signerfile, STACK_OF(X509) *signers);
 | 
			
		||||
static int smime_cb(int ok, X509_STORE_CTX *ctx);
 | 
			
		||||
 | 
			
		||||
#define SMIME_OP	0x10
 | 
			
		||||
#define SMIME_IP	0x20
 | 
			
		||||
#define SMIME_SIGNERS	0x40
 | 
			
		||||
#define SMIME_ENCRYPT	(1 | SMIME_OP)
 | 
			
		||||
#define SMIME_DECRYPT	(2 | SMIME_IP)
 | 
			
		||||
#define SMIME_SIGN	(3 | SMIME_OP | SMIME_SIGNERS)
 | 
			
		||||
#define SMIME_VERIFY	(4 | SMIME_IP)
 | 
			
		||||
#define SMIME_PK7OUT	(5 | SMIME_IP | SMIME_OP)
 | 
			
		||||
#define SMIME_RESIGN	(6 | SMIME_IP | SMIME_OP | SMIME_SIGNERS)
 | 
			
		||||
#define SMIME_DECRYPT	2
 | 
			
		||||
#define SMIME_SIGN	(3 | SMIME_OP)
 | 
			
		||||
#define SMIME_VERIFY	4
 | 
			
		||||
#define SMIME_PK7OUT	5
 | 
			
		||||
 | 
			
		||||
int MAIN(int, char **);
 | 
			
		||||
 | 
			
		||||
@@ -93,7 +90,6 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	const char *inmode = "r", *outmode = "w";
 | 
			
		||||
	char *infile = NULL, *outfile = NULL;
 | 
			
		||||
	char *signerfile = NULL, *recipfile = NULL;
 | 
			
		||||
	STACK_OF(STRING) *sksigners = NULL, *skkeys = NULL;
 | 
			
		||||
	char *certfile = NULL, *keyfile = NULL, *contfile=NULL;
 | 
			
		||||
	const EVP_CIPHER *cipher = NULL;
 | 
			
		||||
	PKCS7 *p7 = NULL;
 | 
			
		||||
@@ -109,8 +105,6 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	char *passargin = NULL, *passin = NULL;
 | 
			
		||||
	char *inrand = NULL;
 | 
			
		||||
	int need_rand = 0;
 | 
			
		||||
	int indef = 0;
 | 
			
		||||
	const EVP_MD *sign_md = NULL;
 | 
			
		||||
	int informat = FORMAT_SMIME, outformat = FORMAT_SMIME;
 | 
			
		||||
        int keyform = FORMAT_PEM;
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
@@ -141,8 +135,6 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
			operation = SMIME_DECRYPT;
 | 
			
		||||
		else if (!strcmp (*args, "-sign"))
 | 
			
		||||
			operation = SMIME_SIGN;
 | 
			
		||||
		else if (!strcmp (*args, "-resign"))
 | 
			
		||||
			operation = SMIME_RESIGN;
 | 
			
		||||
		else if (!strcmp (*args, "-verify"))
 | 
			
		||||
			operation = SMIME_VERIFY;
 | 
			
		||||
		else if (!strcmp (*args, "-pk7out"))
 | 
			
		||||
@@ -201,209 +193,205 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
				flags |= PKCS7_BINARY;
 | 
			
		||||
		else if (!strcmp (*args, "-nosigs"))
 | 
			
		||||
				flags |= PKCS7_NOSIGS;
 | 
			
		||||
		else if (!strcmp (*args, "-stream"))
 | 
			
		||||
				indef = 1;
 | 
			
		||||
		else if (!strcmp (*args, "-indef"))
 | 
			
		||||
				indef = 1;
 | 
			
		||||
		else if (!strcmp (*args, "-noindef"))
 | 
			
		||||
				indef = 0;
 | 
			
		||||
		else if (!strcmp (*args, "-nooldmime"))
 | 
			
		||||
				flags |= PKCS7_NOOLDMIMETYPE;
 | 
			
		||||
		else if (!strcmp (*args, "-crlfeol"))
 | 
			
		||||
				flags |= PKCS7_CRLFEOL;
 | 
			
		||||
		else if (!strcmp(*args,"-rand"))
 | 
			
		||||
			{
 | 
			
		||||
			if (!args[1])
 | 
			
		||||
				goto argerr;
 | 
			
		||||
			args++;
 | 
			
		||||
			inrand = *args;
 | 
			
		||||
			if (args[1])
 | 
			
		||||
				{
 | 
			
		||||
				args++;
 | 
			
		||||
				inrand = *args;
 | 
			
		||||
				}
 | 
			
		||||
			else
 | 
			
		||||
				badarg = 1;
 | 
			
		||||
			need_rand = 1;
 | 
			
		||||
			}
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
		else if (!strcmp(*args,"-engine"))
 | 
			
		||||
			{
 | 
			
		||||
			if (!args[1])
 | 
			
		||||
				goto argerr;
 | 
			
		||||
			engine = *++args;
 | 
			
		||||
			if (args[1])
 | 
			
		||||
				{
 | 
			
		||||
				args++;
 | 
			
		||||
				engine = *args;
 | 
			
		||||
				}
 | 
			
		||||
			else badarg = 1;
 | 
			
		||||
			}
 | 
			
		||||
#endif
 | 
			
		||||
		else if (!strcmp(*args,"-passin"))
 | 
			
		||||
			{
 | 
			
		||||
			if (!args[1])
 | 
			
		||||
				goto argerr;
 | 
			
		||||
			passargin = *++args;
 | 
			
		||||
			if (args[1])
 | 
			
		||||
				{
 | 
			
		||||
				args++;
 | 
			
		||||
				passargin = *args;
 | 
			
		||||
				}
 | 
			
		||||
			else
 | 
			
		||||
				badarg = 1;
 | 
			
		||||
			}
 | 
			
		||||
		else if (!strcmp (*args, "-to"))
 | 
			
		||||
			{
 | 
			
		||||
			if (!args[1])
 | 
			
		||||
				goto argerr;
 | 
			
		||||
			to = *++args;
 | 
			
		||||
			if (args[1])
 | 
			
		||||
				{
 | 
			
		||||
				args++;
 | 
			
		||||
				to = *args;
 | 
			
		||||
				}
 | 
			
		||||
			else
 | 
			
		||||
				badarg = 1;
 | 
			
		||||
			}
 | 
			
		||||
		else if (!strcmp (*args, "-from"))
 | 
			
		||||
			{
 | 
			
		||||
			if (!args[1])
 | 
			
		||||
				goto argerr;
 | 
			
		||||
			from = *++args;
 | 
			
		||||
			if (args[1])
 | 
			
		||||
				{
 | 
			
		||||
				args++;
 | 
			
		||||
				from = *args;
 | 
			
		||||
				}
 | 
			
		||||
			else badarg = 1;
 | 
			
		||||
			}
 | 
			
		||||
		else if (!strcmp (*args, "-subject"))
 | 
			
		||||
			{
 | 
			
		||||
			if (!args[1])
 | 
			
		||||
				goto argerr;
 | 
			
		||||
			subject = *++args;
 | 
			
		||||
			if (args[1])
 | 
			
		||||
				{
 | 
			
		||||
				args++;
 | 
			
		||||
				subject = *args;
 | 
			
		||||
				}
 | 
			
		||||
			else
 | 
			
		||||
				badarg = 1;
 | 
			
		||||
			}
 | 
			
		||||
		else if (!strcmp (*args, "-signer"))
 | 
			
		||||
			{
 | 
			
		||||
			if (!args[1])
 | 
			
		||||
				goto argerr;
 | 
			
		||||
			/* If previous -signer argument add signer to list */
 | 
			
		||||
 | 
			
		||||
			if (signerfile)
 | 
			
		||||
			if (args[1])
 | 
			
		||||
				{
 | 
			
		||||
				if (!sksigners)
 | 
			
		||||
					sksigners = sk_STRING_new_null();
 | 
			
		||||
				sk_STRING_push(sksigners, signerfile);
 | 
			
		||||
				if (!keyfile)
 | 
			
		||||
					keyfile = signerfile;
 | 
			
		||||
				if (!skkeys)
 | 
			
		||||
					skkeys = sk_STRING_new_null();
 | 
			
		||||
				sk_STRING_push(skkeys, keyfile);
 | 
			
		||||
				keyfile = NULL;
 | 
			
		||||
				args++;
 | 
			
		||||
				signerfile = *args;
 | 
			
		||||
				}
 | 
			
		||||
			signerfile = *++args;
 | 
			
		||||
			else
 | 
			
		||||
				badarg = 1;
 | 
			
		||||
			}
 | 
			
		||||
		else if (!strcmp (*args, "-recip"))
 | 
			
		||||
			{
 | 
			
		||||
			if (!args[1])
 | 
			
		||||
				goto argerr;
 | 
			
		||||
			recipfile = *++args;
 | 
			
		||||
			}
 | 
			
		||||
		else if (!strcmp (*args, "-md"))
 | 
			
		||||
			{
 | 
			
		||||
			if (!args[1])
 | 
			
		||||
				goto argerr;
 | 
			
		||||
			sign_md = EVP_get_digestbyname(*++args);
 | 
			
		||||
			if (sign_md == NULL)
 | 
			
		||||
			if (args[1])
 | 
			
		||||
				{
 | 
			
		||||
				BIO_printf(bio_err, "Unknown digest %s\n",
 | 
			
		||||
							*args);
 | 
			
		||||
				goto argerr;
 | 
			
		||||
				args++;
 | 
			
		||||
				recipfile = *args;
 | 
			
		||||
				}
 | 
			
		||||
			else badarg = 1;
 | 
			
		||||
			}
 | 
			
		||||
		else if (!strcmp (*args, "-inkey"))
 | 
			
		||||
			{
 | 
			
		||||
			if (!args[1])	
 | 
			
		||||
				goto argerr;
 | 
			
		||||
			/* If previous -inkey arument add signer to list */
 | 
			
		||||
			if (keyfile)
 | 
			
		||||
			if (args[1])
 | 
			
		||||
				{
 | 
			
		||||
				if (!signerfile)
 | 
			
		||||
					{
 | 
			
		||||
					BIO_puts(bio_err, "Illegal -inkey without -signer\n");
 | 
			
		||||
					goto argerr;
 | 
			
		||||
					}
 | 
			
		||||
				if (!sksigners)
 | 
			
		||||
					sksigners = sk_STRING_new_null();
 | 
			
		||||
				sk_STRING_push(sksigners, signerfile);
 | 
			
		||||
				signerfile = NULL;
 | 
			
		||||
				if (!skkeys)
 | 
			
		||||
					skkeys = sk_STRING_new_null();
 | 
			
		||||
				sk_STRING_push(skkeys, keyfile);
 | 
			
		||||
				args++;
 | 
			
		||||
				keyfile = *args;
 | 
			
		||||
				}
 | 
			
		||||
			keyfile = *++args;
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
				badarg = 1;
 | 
			
		||||
		}
 | 
			
		||||
		else if (!strcmp (*args, "-keyform"))
 | 
			
		||||
			{
 | 
			
		||||
			if (!args[1])
 | 
			
		||||
				goto argerr;
 | 
			
		||||
			keyform = str2fmt(*++args);
 | 
			
		||||
			if (args[1])
 | 
			
		||||
				{
 | 
			
		||||
				args++;
 | 
			
		||||
				keyform = str2fmt(*args);
 | 
			
		||||
				}
 | 
			
		||||
			else
 | 
			
		||||
				badarg = 1;
 | 
			
		||||
			}
 | 
			
		||||
		else if (!strcmp (*args, "-certfile"))
 | 
			
		||||
			{
 | 
			
		||||
			if (!args[1])
 | 
			
		||||
				goto argerr;
 | 
			
		||||
			certfile = *++args;
 | 
			
		||||
			if (args[1])
 | 
			
		||||
				{
 | 
			
		||||
				args++;
 | 
			
		||||
				certfile = *args;
 | 
			
		||||
				}
 | 
			
		||||
			else
 | 
			
		||||
				badarg = 1;
 | 
			
		||||
			}
 | 
			
		||||
		else if (!strcmp (*args, "-CAfile"))
 | 
			
		||||
			{
 | 
			
		||||
			if (!args[1])
 | 
			
		||||
				goto argerr;
 | 
			
		||||
			CAfile = *++args;
 | 
			
		||||
			if (args[1])
 | 
			
		||||
				{
 | 
			
		||||
				args++;
 | 
			
		||||
				CAfile = *args;
 | 
			
		||||
				}
 | 
			
		||||
			else
 | 
			
		||||
				badarg = 1;
 | 
			
		||||
			}
 | 
			
		||||
		else if (!strcmp (*args, "-CApath"))
 | 
			
		||||
			{
 | 
			
		||||
			if (!args[1])
 | 
			
		||||
				goto argerr;
 | 
			
		||||
			CApath = *++args;
 | 
			
		||||
			if (args[1])
 | 
			
		||||
				{
 | 
			
		||||
				args++;
 | 
			
		||||
				CApath = *args;
 | 
			
		||||
				}
 | 
			
		||||
			else
 | 
			
		||||
				badarg = 1;
 | 
			
		||||
			}
 | 
			
		||||
		else if (!strcmp (*args, "-in"))
 | 
			
		||||
			{
 | 
			
		||||
			if (!args[1])
 | 
			
		||||
				goto argerr;
 | 
			
		||||
			infile = *++args;
 | 
			
		||||
			if (args[1])
 | 
			
		||||
				{
 | 
			
		||||
				args++;
 | 
			
		||||
				infile = *args;
 | 
			
		||||
				}
 | 
			
		||||
			else
 | 
			
		||||
				badarg = 1;
 | 
			
		||||
			}
 | 
			
		||||
		else if (!strcmp (*args, "-inform"))
 | 
			
		||||
			{
 | 
			
		||||
			if (!args[1])
 | 
			
		||||
				goto argerr;
 | 
			
		||||
			informat = str2fmt(*++args);
 | 
			
		||||
			if (args[1])
 | 
			
		||||
				{
 | 
			
		||||
				args++;
 | 
			
		||||
				informat = str2fmt(*args);
 | 
			
		||||
				}
 | 
			
		||||
			else
 | 
			
		||||
				badarg = 1;
 | 
			
		||||
			}
 | 
			
		||||
		else if (!strcmp (*args, "-outform"))
 | 
			
		||||
			{
 | 
			
		||||
			if (!args[1])
 | 
			
		||||
				goto argerr;
 | 
			
		||||
			outformat = str2fmt(*++args);
 | 
			
		||||
			if (args[1])
 | 
			
		||||
				{
 | 
			
		||||
				args++;
 | 
			
		||||
				outformat = str2fmt(*args);
 | 
			
		||||
				}
 | 
			
		||||
			else
 | 
			
		||||
				badarg = 1;
 | 
			
		||||
			}
 | 
			
		||||
		else if (!strcmp (*args, "-out"))
 | 
			
		||||
			{
 | 
			
		||||
			if (!args[1])
 | 
			
		||||
				goto argerr;
 | 
			
		||||
			outfile = *++args;
 | 
			
		||||
			if (args[1])
 | 
			
		||||
				{
 | 
			
		||||
				args++;
 | 
			
		||||
				outfile = *args;
 | 
			
		||||
				}
 | 
			
		||||
			else
 | 
			
		||||
				badarg = 1;
 | 
			
		||||
			}
 | 
			
		||||
		else if (!strcmp (*args, "-content"))
 | 
			
		||||
			{
 | 
			
		||||
			if (!args[1])
 | 
			
		||||
				goto argerr;
 | 
			
		||||
			contfile = *++args;
 | 
			
		||||
			if (args[1])
 | 
			
		||||
				{
 | 
			
		||||
				args++;
 | 
			
		||||
				contfile = *args;
 | 
			
		||||
				}
 | 
			
		||||
			else
 | 
			
		||||
				badarg = 1;
 | 
			
		||||
			}
 | 
			
		||||
		else if (args_verify(&args, NULL, &badarg, bio_err, &vpm))
 | 
			
		||||
			continue;
 | 
			
		||||
		else if ((cipher = EVP_get_cipherbyname(*args + 1)) == NULL)
 | 
			
		||||
		else
 | 
			
		||||
			badarg = 1;
 | 
			
		||||
		args++;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (!(operation & SMIME_SIGNERS) && (skkeys || sksigners))
 | 
			
		||||
		{
 | 
			
		||||
		BIO_puts(bio_err, "Multiple signers or keys not allowed\n");
 | 
			
		||||
		goto argerr;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (operation & SMIME_SIGNERS)
 | 
			
		||||
	if (operation == SMIME_SIGN)
 | 
			
		||||
		{
 | 
			
		||||
		/* Check to see if any final signer needs to be appended */
 | 
			
		||||
		if (keyfile && !signerfile)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_puts(bio_err, "Illegal -inkey without -signer\n");
 | 
			
		||||
			goto argerr;
 | 
			
		||||
			}
 | 
			
		||||
		if (signerfile)
 | 
			
		||||
			{
 | 
			
		||||
			if (!sksigners)
 | 
			
		||||
				sksigners = sk_STRING_new_null();
 | 
			
		||||
			sk_STRING_push(sksigners, signerfile);
 | 
			
		||||
			if (!skkeys)
 | 
			
		||||
				skkeys = sk_STRING_new_null();
 | 
			
		||||
			if (!keyfile)
 | 
			
		||||
				keyfile = signerfile;
 | 
			
		||||
			sk_STRING_push(skkeys, keyfile);
 | 
			
		||||
			}
 | 
			
		||||
		if (!sksigners)
 | 
			
		||||
		if (!signerfile)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bio_err, "No signer certificate specified\n");
 | 
			
		||||
			badarg = 1;
 | 
			
		||||
			}
 | 
			
		||||
		signerfile = NULL;
 | 
			
		||||
		keyfile = NULL;
 | 
			
		||||
		need_rand = 1;
 | 
			
		||||
		}
 | 
			
		||||
	else if (operation == SMIME_DECRYPT)
 | 
			
		||||
@@ -428,7 +416,6 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
 | 
			
		||||
	if (badarg)
 | 
			
		||||
		{
 | 
			
		||||
		argerr:
 | 
			
		||||
		BIO_printf (bio_err, "Usage smime [options] cert.pem ...\n");
 | 
			
		||||
		BIO_printf (bio_err, "where options are\n");
 | 
			
		||||
		BIO_printf (bio_err, "-encrypt       encrypt message\n");
 | 
			
		||||
@@ -512,11 +499,13 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
 | 
			
		||||
	ret = 2;
 | 
			
		||||
 | 
			
		||||
	if (!(operation & SMIME_SIGNERS))
 | 
			
		||||
	if (operation != SMIME_SIGN)
 | 
			
		||||
		flags &= ~PKCS7_DETACHED;
 | 
			
		||||
 | 
			
		||||
	if (operation & SMIME_OP)
 | 
			
		||||
		{
 | 
			
		||||
		if (flags & PKCS7_BINARY)
 | 
			
		||||
			inmode = "rb";
 | 
			
		||||
		if (outformat == FORMAT_ASN1)
 | 
			
		||||
			outmode = "wb";
 | 
			
		||||
		}
 | 
			
		||||
@@ -524,18 +513,9 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
		{
 | 
			
		||||
		if (flags & PKCS7_BINARY)
 | 
			
		||||
			outmode = "wb";
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (operation & SMIME_IP)
 | 
			
		||||
		{
 | 
			
		||||
		if (informat == FORMAT_ASN1)
 | 
			
		||||
			inmode = "rb";
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		if (flags & PKCS7_BINARY)
 | 
			
		||||
			inmode = "rb";
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (operation == SMIME_ENCRYPT)
 | 
			
		||||
		{
 | 
			
		||||
@@ -565,11 +545,26 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (signerfile && (operation == SMIME_SIGN))
 | 
			
		||||
		{
 | 
			
		||||
		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);
 | 
			
		||||
#endif
 | 
			
		||||
			goto end;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (certfile)
 | 
			
		||||
		{
 | 
			
		||||
		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);
 | 
			
		||||
#endif
 | 
			
		||||
			ERR_print_errors(bio_err);
 | 
			
		||||
			goto end;
 | 
			
		||||
			}
 | 
			
		||||
@@ -580,6 +575,9 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
		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);
 | 
			
		||||
#endif
 | 
			
		||||
			ERR_print_errors(bio_err);
 | 
			
		||||
			goto end;
 | 
			
		||||
			}
 | 
			
		||||
@@ -617,36 +615,6 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	else
 | 
			
		||||
		in = BIO_new_fp(stdin, BIO_NOCLOSE);
 | 
			
		||||
 | 
			
		||||
	if (operation & SMIME_IP)
 | 
			
		||||
		{
 | 
			
		||||
		if (informat == FORMAT_SMIME) 
 | 
			
		||||
			p7 = SMIME_read_PKCS7(in, &indata);
 | 
			
		||||
		else if (informat == FORMAT_PEM) 
 | 
			
		||||
			p7 = PEM_read_bio_PKCS7(in, NULL, NULL, NULL);
 | 
			
		||||
		else if (informat == FORMAT_ASN1) 
 | 
			
		||||
			p7 = d2i_PKCS7_bio(in, NULL);
 | 
			
		||||
		else
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bio_err, "Bad input format for PKCS#7 file\n");
 | 
			
		||||
			goto end;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		if (!p7)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bio_err, "Error reading S/MIME message\n");
 | 
			
		||||
			goto end;
 | 
			
		||||
			}
 | 
			
		||||
		if (contfile)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_free(indata);
 | 
			
		||||
			if (!(indata = BIO_new_file(contfile, "rb")))
 | 
			
		||||
				{
 | 
			
		||||
				BIO_printf(bio_err, "Can't read content file %s\n", contfile);
 | 
			
		||||
				goto end;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (outfile)
 | 
			
		||||
		{
 | 
			
		||||
		if (!(out = BIO_new_file(outfile, outmode)))
 | 
			
		||||
@@ -680,58 +648,43 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	ret = 3;
 | 
			
		||||
 | 
			
		||||
	if (operation == SMIME_ENCRYPT)
 | 
			
		||||
		{
 | 
			
		||||
		if (indef)
 | 
			
		||||
			flags |= PKCS7_STREAM;
 | 
			
		||||
		p7 = PKCS7_encrypt(encerts, in, cipher, flags);
 | 
			
		||||
		}
 | 
			
		||||
	else if (operation & SMIME_SIGNERS)
 | 
			
		||||
	else if (operation == SMIME_SIGN)
 | 
			
		||||
		{
 | 
			
		||||
		int i;
 | 
			
		||||
		/* If detached data content we only enable streaming if
 | 
			
		||||
		 * S/MIME output format.
 | 
			
		||||
		/* If detached data and SMIME output enable partial
 | 
			
		||||
		 * signing.
 | 
			
		||||
		 */
 | 
			
		||||
		if (operation == SMIME_SIGN)
 | 
			
		||||
			{
 | 
			
		||||
			if (flags & PKCS7_DETACHED)
 | 
			
		||||
				{
 | 
			
		||||
				if (outformat == FORMAT_SMIME)
 | 
			
		||||
					flags |= PKCS7_STREAM;
 | 
			
		||||
				}
 | 
			
		||||
			else if (indef)
 | 
			
		||||
				flags |= PKCS7_STREAM;
 | 
			
		||||
			flags |= PKCS7_PARTIAL;
 | 
			
		||||
			p7 = PKCS7_sign(NULL, NULL, other, in, flags);
 | 
			
		||||
			if (!p7)
 | 
			
		||||
				goto end;
 | 
			
		||||
			}
 | 
			
		||||
		if ((flags & PKCS7_DETACHED) && (outformat == FORMAT_SMIME))
 | 
			
		||||
			flags |= PKCS7_STREAM;
 | 
			
		||||
		p7 = PKCS7_sign(signer, key, other, in, flags);
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		if (informat == FORMAT_SMIME) 
 | 
			
		||||
			p7 = SMIME_read_PKCS7(in, &indata);
 | 
			
		||||
		else if (informat == FORMAT_PEM) 
 | 
			
		||||
			p7 = PEM_read_bio_PKCS7(in, NULL, NULL, NULL);
 | 
			
		||||
		else if (informat == FORMAT_ASN1) 
 | 
			
		||||
			p7 = d2i_PKCS7_bio(in, NULL);
 | 
			
		||||
		else
 | 
			
		||||
			flags |= PKCS7_REUSE_DIGEST;
 | 
			
		||||
		for (i = 0; i < sk_STRING_num(sksigners); i++)
 | 
			
		||||
			{
 | 
			
		||||
			signerfile = sk_STRING_value(sksigners, i);
 | 
			
		||||
			keyfile = sk_STRING_value(skkeys, i);
 | 
			
		||||
			signer = load_cert(bio_err, signerfile,FORMAT_PEM, NULL,
 | 
			
		||||
					e, "signer certificate");
 | 
			
		||||
			if (!signer)
 | 
			
		||||
				goto end;
 | 
			
		||||
			key = load_key(bio_err, keyfile, keyform, 0, passin, e,
 | 
			
		||||
			       "signing key file");
 | 
			
		||||
			if (!key)
 | 
			
		||||
				goto end;
 | 
			
		||||
			if (!PKCS7_sign_add_signer(p7, signer, key,
 | 
			
		||||
						sign_md, flags))
 | 
			
		||||
				goto end;
 | 
			
		||||
			X509_free(signer);
 | 
			
		||||
			signer = NULL;
 | 
			
		||||
			EVP_PKEY_free(key);
 | 
			
		||||
			key = NULL;
 | 
			
		||||
			BIO_printf(bio_err, "Bad input format for PKCS#7 file\n");
 | 
			
		||||
			goto end;
 | 
			
		||||
			}
 | 
			
		||||
		/* If not streaming or resigning finalize structure */
 | 
			
		||||
		if ((operation == SMIME_SIGN) && !(flags & PKCS7_STREAM))
 | 
			
		||||
 | 
			
		||||
		if (!p7)
 | 
			
		||||
			{
 | 
			
		||||
			if (!PKCS7_final(p7, in, flags))
 | 
			
		||||
			BIO_printf(bio_err, "Error reading S/MIME message\n");
 | 
			
		||||
			goto end;
 | 
			
		||||
			}
 | 
			
		||||
		if (contfile)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_free(indata);
 | 
			
		||||
			if (!(indata = BIO_new_file(contfile, "rb")))
 | 
			
		||||
				{
 | 
			
		||||
				BIO_printf(bio_err, "Can't read content file %s\n", contfile);
 | 
			
		||||
				goto end;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@@ -781,16 +734,11 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
		if (subject)
 | 
			
		||||
			BIO_printf(out, "Subject: %s\n", subject);
 | 
			
		||||
		if (outformat == FORMAT_SMIME) 
 | 
			
		||||
			{
 | 
			
		||||
			if (operation == SMIME_RESIGN)
 | 
			
		||||
				SMIME_write_PKCS7(out, p7, indata, flags);
 | 
			
		||||
			else
 | 
			
		||||
				SMIME_write_PKCS7(out, p7, in, flags);
 | 
			
		||||
			}
 | 
			
		||||
			SMIME_write_PKCS7(out, p7, in, flags);
 | 
			
		||||
		else if (outformat == FORMAT_PEM) 
 | 
			
		||||
			PEM_write_bio_PKCS7_stream(out, p7, in, flags);
 | 
			
		||||
			PEM_write_bio_PKCS7(out,p7);
 | 
			
		||||
		else if (outformat == FORMAT_ASN1) 
 | 
			
		||||
			i2d_PKCS7_bio_stream(out,p7, in, flags);
 | 
			
		||||
			i2d_PKCS7_bio(out,p7);
 | 
			
		||||
		else
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bio_err, "Bad output format for PKCS#7 file\n");
 | 
			
		||||
@@ -806,10 +754,6 @@ end:
 | 
			
		||||
	sk_X509_pop_free(other, X509_free);
 | 
			
		||||
	if (vpm)
 | 
			
		||||
		X509_VERIFY_PARAM_free(vpm);
 | 
			
		||||
	if (sksigners)
 | 
			
		||||
		sk_STRING_free(sksigners);
 | 
			
		||||
	if (skkeys)
 | 
			
		||||
		sk_STRING_free(skkeys);
 | 
			
		||||
	X509_STORE_free(store);
 | 
			
		||||
	X509_free(cert);
 | 
			
		||||
	X509_free(recip);
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										321
									
								
								apps/speed.c
									
									
									
									
									
								
							
							
						
						
									
										321
									
								
								apps/speed.c
									
									
									
									
									
								
							@@ -108,8 +108,53 @@
 | 
			
		||||
#include <signal.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef _WIN32
 | 
			
		||||
#include <windows.h>
 | 
			
		||||
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(OPENSSL_SYS_MACOSX)
 | 
			
		||||
# define USE_TOD
 | 
			
		||||
#elif !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_VXWORKS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC))
 | 
			
		||||
# define TIMES
 | 
			
		||||
#endif
 | 
			
		||||
#if !defined(_UNICOS) && !defined(__OpenBSD__) && !defined(sgi) && !defined(__FreeBSD__) && !(defined(__bsdi) || defined(__bsdi__)) && !defined(_AIX) && !defined(OPENSSL_SYS_MPE) && !defined(__NetBSD__) && !defined(OPENSSL_SYS_VXWORKS) /* FIXME */
 | 
			
		||||
# define TIMEB
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined(OPENSSL_SYS_NETWARE)
 | 
			
		||||
#undef TIMES
 | 
			
		||||
#undef TIMEB
 | 
			
		||||
#include <time.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef _IRIX
 | 
			
		||||
# include <time.h>
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef TIMES
 | 
			
		||||
# include <sys/types.h>
 | 
			
		||||
# include <sys/times.h>
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef USE_TOD
 | 
			
		||||
# include <sys/time.h>
 | 
			
		||||
# include <sys/resource.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/* Depending on the VMS version, the tms structure is perhaps defined.
 | 
			
		||||
   The __TMS macro will show if it was.  If it wasn't defined, we should
 | 
			
		||||
   undefine TIMES, since that tells the rest of the program how things
 | 
			
		||||
   should be handled.				-- Richard Levitte */
 | 
			
		||||
#if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS)
 | 
			
		||||
#undef TIMES
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef TIMEB
 | 
			
		||||
#include <sys/timeb.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if !defined(TIMES) && !defined(TIMEB) && !defined(USE_TOD) && !defined(OPENSSL_SYS_VXWORKS) && !defined(OPENSSL_SYS_NETWARE)
 | 
			
		||||
#error "It seems neither struct tms nor struct timeb is supported in this platform!"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined(sun) || defined(__ultrix)
 | 
			
		||||
#define _POSIX_SOURCE
 | 
			
		||||
#include <limits.h>
 | 
			
		||||
#include <sys/param.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#include <openssl/bn.h>
 | 
			
		||||
@@ -144,9 +189,6 @@
 | 
			
		||||
#ifndef OPENSSL_NO_RIPEMD
 | 
			
		||||
#include <openssl/ripemd.h>
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_WHIRLPOOL
 | 
			
		||||
#include <openssl/whrlpool.h>
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_RC4
 | 
			
		||||
#include <openssl/rc4.h>
 | 
			
		||||
#endif
 | 
			
		||||
@@ -184,6 +226,34 @@
 | 
			
		||||
#include <openssl/ecdh.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * The following "HZ" timing stuff should be sync'd up with the code in
 | 
			
		||||
 * crypto/tmdiff.[ch]. That appears to try to do the same job, though I think
 | 
			
		||||
 * this code is more up to date than libcrypto's so there may be features to
 | 
			
		||||
 * migrate over first. This is used in two places further down AFAICS. 
 | 
			
		||||
 * The point is that nothing in openssl actually *uses* that tmdiff stuff, so
 | 
			
		||||
 * either speed.c should be using it or it should go because it's obviously not
 | 
			
		||||
 * useful enough. Anyone want to do a janitorial job on this?
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/* The following if from times(3) man page.  It may need to be changed */
 | 
			
		||||
#ifndef HZ
 | 
			
		||||
# if defined(_SC_CLK_TCK) \
 | 
			
		||||
     && (!defined(OPENSSL_SYS_VMS) || __CTRL_VER >= 70000000)
 | 
			
		||||
#  define HZ sysconf(_SC_CLK_TCK)
 | 
			
		||||
# else
 | 
			
		||||
#  ifndef CLK_TCK
 | 
			
		||||
#   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
 | 
			
		||||
 | 
			
		||||
#if !defined(OPENSSL_SYS_VMS) && !defined(OPENSSL_SYS_WINDOWS) && !defined(OPENSSL_SYS_MACINTOSH_CLASSIC) && !defined(OPENSSL_SYS_OS2) && !defined(OPENSSL_SYS_NETWARE)
 | 
			
		||||
# define HAVE_FORK 1
 | 
			
		||||
#endif
 | 
			
		||||
@@ -192,6 +262,7 @@
 | 
			
		||||
#define BUFSIZE	((long)1024*8+1)
 | 
			
		||||
int run=0;
 | 
			
		||||
 | 
			
		||||
static char ftime_used = 0, times_used = 0, gettimeofday_used = 0, getrusage_used = 0;
 | 
			
		||||
static int mr=0;
 | 
			
		||||
static int usertime=1;
 | 
			
		||||
 | 
			
		||||
@@ -204,7 +275,7 @@ static void print_result(int alg,int run_no,int count,double time_used);
 | 
			
		||||
static int do_multi(int multi);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#define ALGOR_NUM	29
 | 
			
		||||
#define ALGOR_NUM	28
 | 
			
		||||
#define SIZE_NUM	5
 | 
			
		||||
#define RSA_NUM		4
 | 
			
		||||
#define DSA_NUM		3
 | 
			
		||||
@@ -218,7 +289,7 @@ static const char *names[ALGOR_NUM]={
 | 
			
		||||
  "rc2 cbc","rc5-32/12 cbc","blowfish cbc","cast cbc",
 | 
			
		||||
  "aes-128 cbc","aes-192 cbc","aes-256 cbc",
 | 
			
		||||
  "camellia-128 cbc","camellia-192 cbc","camellia-256 cbc",
 | 
			
		||||
  "evp","sha256","sha512","whirlpool",
 | 
			
		||||
  "evp","sha256","sha512",
 | 
			
		||||
  "aes-128 ige","aes-192 ige","aes-256 ige"};
 | 
			
		||||
static double results[ALGOR_NUM][SIZE_NUM];
 | 
			
		||||
static int lengths[SIZE_NUM]={16,64,256,1024,8*1024};
 | 
			
		||||
@@ -257,46 +328,141 @@ static SIGRETTYPE sig_done(int sig)
 | 
			
		||||
#define START	0
 | 
			
		||||
#define STOP	1
 | 
			
		||||
 | 
			
		||||
#if defined(_WIN32)
 | 
			
		||||
 | 
			
		||||
#define SIGALRM
 | 
			
		||||
static unsigned int lapse,schlock;
 | 
			
		||||
static void alarm(unsigned int secs) { lapse = secs*1000; }
 | 
			
		||||
 | 
			
		||||
static DWORD WINAPI sleepy(VOID *arg)
 | 
			
		||||
	{
 | 
			
		||||
	schlock = 1;
 | 
			
		||||
	Sleep(lapse);
 | 
			
		||||
	run = 0;
 | 
			
		||||
	return 0;
 | 
			
		||||
	}
 | 
			
		||||
#if defined(OPENSSL_SYS_NETWARE)
 | 
			
		||||
 | 
			
		||||
   /* for NetWare the best we can do is use clock() which returns the
 | 
			
		||||
    * time, in hundredths of a second, since the NLM began executing
 | 
			
		||||
   */
 | 
			
		||||
static double Time_F(int s)
 | 
			
		||||
	{
 | 
			
		||||
	if (s == START)
 | 
			
		||||
		{
 | 
			
		||||
		HANDLE	thr;
 | 
			
		||||
		schlock = 0;
 | 
			
		||||
		thr = CreateThread(NULL,4096,sleepy,NULL,0,NULL);
 | 
			
		||||
		if (thr==NULL)
 | 
			
		||||
			{
 | 
			
		||||
			DWORD ret=GetLastError();
 | 
			
		||||
			BIO_printf(bio_err,"unable to CreateThread (%d)",ret);
 | 
			
		||||
			ExitProcess(ret);
 | 
			
		||||
			}
 | 
			
		||||
		CloseHandle(thr);		/* detach the thread	*/
 | 
			
		||||
		while (!schlock) Sleep(0);	/* scheduler spinlock	*/
 | 
			
		||||
		}
 | 
			
		||||
	double ret;
 | 
			
		||||
 | 
			
		||||
   static clock_t tstart,tend;
 | 
			
		||||
 | 
			
		||||
   if (s == START)
 | 
			
		||||
   {
 | 
			
		||||
      tstart=clock();
 | 
			
		||||
      return(0);
 | 
			
		||||
   }
 | 
			
		||||
   else
 | 
			
		||||
   {
 | 
			
		||||
      tend=clock();
 | 
			
		||||
      ret=(double)((double)(tend)-(double)(tstart));
 | 
			
		||||
      return((ret < 0.001)?0.001:ret);
 | 
			
		||||
   }
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
	return app_tminterval(s,usertime);
 | 
			
		||||
	}
 | 
			
		||||
#else
 | 
			
		||||
 | 
			
		||||
static double Time_F(int s)
 | 
			
		||||
	{
 | 
			
		||||
	return app_tminterval(s,usertime);
 | 
			
		||||
	}
 | 
			
		||||
	double ret;
 | 
			
		||||
 | 
			
		||||
#ifdef USE_TOD
 | 
			
		||||
	if(usertime)
 | 
			
		||||
		{
 | 
			
		||||
		static struct rusage tstart,tend;
 | 
			
		||||
 | 
			
		||||
		getrusage_used = 1;
 | 
			
		||||
		if (s == START)
 | 
			
		||||
			{
 | 
			
		||||
			getrusage(RUSAGE_SELF,&tstart);
 | 
			
		||||
			return(0);
 | 
			
		||||
			}
 | 
			
		||||
		else
 | 
			
		||||
			{
 | 
			
		||||
			long i;
 | 
			
		||||
 | 
			
		||||
			getrusage(RUSAGE_SELF,&tend);
 | 
			
		||||
			i=(long)tend.ru_utime.tv_usec-(long)tstart.ru_utime.tv_usec;
 | 
			
		||||
			ret=((double)(tend.ru_utime.tv_sec-tstart.ru_utime.tv_sec))
 | 
			
		||||
			  +((double)i)/1000000.0;
 | 
			
		||||
			return((ret < 0.001)?0.001:ret);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		static struct timeval tstart,tend;
 | 
			
		||||
		long i;
 | 
			
		||||
 | 
			
		||||
		gettimeofday_used = 1;
 | 
			
		||||
		if (s == START)
 | 
			
		||||
			{
 | 
			
		||||
			gettimeofday(&tstart,NULL);
 | 
			
		||||
			return(0);
 | 
			
		||||
			}
 | 
			
		||||
		else
 | 
			
		||||
			{
 | 
			
		||||
			gettimeofday(&tend,NULL);
 | 
			
		||||
			i=(long)tend.tv_usec-(long)tstart.tv_usec;
 | 
			
		||||
			ret=((double)(tend.tv_sec-tstart.tv_sec))+((double)i)/1000000.0;
 | 
			
		||||
			return((ret < 0.001)?0.001:ret);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
#else  /* ndef USE_TOD */
 | 
			
		||||
		
 | 
			
		||||
# ifdef TIMES
 | 
			
		||||
	if (usertime)
 | 
			
		||||
		{
 | 
			
		||||
		static struct tms tstart,tend;
 | 
			
		||||
 | 
			
		||||
		times_used = 1;
 | 
			
		||||
		if (s == START)
 | 
			
		||||
			{
 | 
			
		||||
			times(&tstart);
 | 
			
		||||
			return(0);
 | 
			
		||||
			}
 | 
			
		||||
		else
 | 
			
		||||
			{
 | 
			
		||||
			times(&tend);
 | 
			
		||||
			ret = HZ;
 | 
			
		||||
			ret=(double)(tend.tms_utime-tstart.tms_utime) / ret;
 | 
			
		||||
			return((ret < 1e-3)?1e-3:ret);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
# endif /* times() */
 | 
			
		||||
# if defined(TIMES) && defined(TIMEB)
 | 
			
		||||
	else
 | 
			
		||||
# endif
 | 
			
		||||
# ifdef 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.001)?0.001:ret);
 | 
			
		||||
			}
 | 
			
		||||
                }
 | 
			
		||||
# elif defined(TIMEB)
 | 
			
		||||
		{
 | 
			
		||||
		static struct timeb tstart,tend;
 | 
			
		||||
		long i;
 | 
			
		||||
 | 
			
		||||
		ftime_used = 1;
 | 
			
		||||
		if (s == START)
 | 
			
		||||
			{
 | 
			
		||||
			ftime(&tstart);
 | 
			
		||||
			return(0);
 | 
			
		||||
			}
 | 
			
		||||
		else
 | 
			
		||||
			{
 | 
			
		||||
			ftime(&tend);
 | 
			
		||||
			i=(long)tend.millitm-(long)tstart.millitm;
 | 
			
		||||
			ret=((double)(tend.time-tstart.time))+((double)i)/1000.0;
 | 
			
		||||
			return((ret < 0.001)?0.001:ret);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
# endif
 | 
			
		||||
#endif
 | 
			
		||||
	}
 | 
			
		||||
#endif /* if defined(OPENSSL_SYS_NETWARE) */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_ECDH
 | 
			
		||||
@@ -356,9 +522,6 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	unsigned char sha512[SHA512_DIGEST_LENGTH];
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_WHIRLPOOL
 | 
			
		||||
	unsigned char whirlpool[WHIRLPOOL_DIGEST_LENGTH];
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_RIPEMD
 | 
			
		||||
	unsigned char rmd160[RIPEMD160_DIGEST_LENGTH];
 | 
			
		||||
#endif
 | 
			
		||||
@@ -455,10 +618,9 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
#define D_EVP		22
 | 
			
		||||
#define D_SHA256	23	
 | 
			
		||||
#define D_SHA512	24
 | 
			
		||||
#define D_WHIRLPOOL	25
 | 
			
		||||
#define D_IGE_128_AES   26
 | 
			
		||||
#define D_IGE_192_AES   27
 | 
			
		||||
#define D_IGE_256_AES   28
 | 
			
		||||
#define D_IGE_128_AES   25
 | 
			
		||||
#define D_IGE_192_AES   26
 | 
			
		||||
#define D_IGE_256_AES   27
 | 
			
		||||
	double d=0.0;
 | 
			
		||||
	long c[ALGOR_NUM][SIZE_NUM];
 | 
			
		||||
#define	R_DSA_512	0
 | 
			
		||||
@@ -778,10 +940,6 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
		else
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_WHIRLPOOL
 | 
			
		||||
			if (strcmp(*argv,"whirlpool") == 0) doit[D_WHIRLPOOL]=1;
 | 
			
		||||
		else
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_RIPEMD
 | 
			
		||||
			if (strcmp(*argv,"ripemd") == 0) doit[D_RMD160]=1;
 | 
			
		||||
		else
 | 
			
		||||
@@ -993,16 +1151,12 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
#ifndef OPENSSL_NO_SHA512
 | 
			
		||||
			BIO_printf(bio_err,"sha512   ");
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_WHIRLPOOL
 | 
			
		||||
			BIO_printf(bio_err,"whirlpool");
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_RIPEMD160
 | 
			
		||||
			BIO_printf(bio_err,"rmd160");
 | 
			
		||||
#endif
 | 
			
		||||
#if !defined(OPENSSL_NO_MD2) || !defined(OPENSSL_NO_MDC2) || \
 | 
			
		||||
    !defined(OPENSSL_NO_MD4) || !defined(OPENSSL_NO_MD5) || \
 | 
			
		||||
    !defined(OPENSSL_NO_SHA1) || !defined(OPENSSL_NO_RIPEMD160) || \
 | 
			
		||||
    !defined(OPENSSL_NO_WHIRLPOOL)
 | 
			
		||||
    !defined(OPENSSL_NO_SHA1) || !defined(OPENSSL_NO_RIPEMD160)
 | 
			
		||||
			BIO_printf(bio_err,"\n");
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
@@ -1135,6 +1289,11 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
 | 
			
		||||
	if (usertime == 0 && !mr)
 | 
			
		||||
		BIO_printf(bio_err,"You have chosen to measure elapsed time instead of user CPU time.\n");
 | 
			
		||||
	if (usertime <= 0 && !mr)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_printf(bio_err,"To get the most accurate results, try to run this\n");
 | 
			
		||||
		BIO_printf(bio_err,"program when this computer is idle.\n");
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_RSA
 | 
			
		||||
	for (i=0; i<RSA_NUM; i++)
 | 
			
		||||
@@ -1244,7 +1403,6 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	c[D_CBC_256_CML][0]=count;
 | 
			
		||||
	c[D_SHA256][0]=count;
 | 
			
		||||
	c[D_SHA512][0]=count;
 | 
			
		||||
	c[D_WHIRLPOOL][0]=count;
 | 
			
		||||
	c[D_IGE_128_AES][0]=count;
 | 
			
		||||
	c[D_IGE_192_AES][0]=count;
 | 
			
		||||
	c[D_IGE_256_AES][0]=count;
 | 
			
		||||
@@ -1260,7 +1418,6 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
		c[D_RMD160][i]=c[D_RMD160][0]*4*lengths[0]/lengths[i];
 | 
			
		||||
		c[D_SHA256][i]=c[D_SHA256][0]*4*lengths[0]/lengths[i];
 | 
			
		||||
		c[D_SHA512][i]=c[D_SHA512][0]*4*lengths[0]/lengths[i];
 | 
			
		||||
		c[D_WHIRLPOOL][i]=c[D_WHIRLPOOL][0]*4*lengths[0]/lengths[i];
 | 
			
		||||
		}
 | 
			
		||||
	for (i=1; i<SIZE_NUM; i++)
 | 
			
		||||
		{
 | 
			
		||||
@@ -1444,9 +1601,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
#else
 | 
			
		||||
#define COND(c)	(run)
 | 
			
		||||
#define COUNT(d) (count)
 | 
			
		||||
#ifndef _WIN32
 | 
			
		||||
	signal(SIGALRM,sig_done);
 | 
			
		||||
#endif
 | 
			
		||||
#endif /* SIGALRM */
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_MD2
 | 
			
		||||
@@ -1576,23 +1731,8 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_WHIRLPOOL
 | 
			
		||||
	if (doit[D_WHIRLPOOL])
 | 
			
		||||
		{
 | 
			
		||||
		for (j=0; j<SIZE_NUM; j++)
 | 
			
		||||
			{
 | 
			
		||||
			print_message(names[D_WHIRLPOOL],c[D_WHIRLPOOL][j],lengths[j]);
 | 
			
		||||
			Time_F(START);
 | 
			
		||||
			for (count=0,run=1; COND(c[D_WHIRLPOOL][j]); count++)
 | 
			
		||||
				WHIRLPOOL(buf,lengths[j],whirlpool);
 | 
			
		||||
			d=Time_F(STOP);
 | 
			
		||||
			print_result(D_WHIRLPOOL,j,count,d);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_RIPEMD
 | 
			
		||||
	if (doit[D_RMD160])
 | 
			
		||||
		{
 | 
			
		||||
@@ -1738,8 +1878,6 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
			print_result(D_IGE_256_AES,j,count,d);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_CAMELLIA
 | 
			
		||||
	if (doit[D_CBC_128_CML])
 | 
			
		||||
@@ -2352,6 +2490,35 @@ show_res:
 | 
			
		||||
		printf("%s ",BF_options());
 | 
			
		||||
#endif
 | 
			
		||||
		fprintf(stdout,"\n%s\n",SSLeay_version(SSLEAY_CFLAGS));
 | 
			
		||||
		printf("available timing options: ");
 | 
			
		||||
#ifdef TIMES
 | 
			
		||||
		printf("TIMES ");
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef TIMEB
 | 
			
		||||
		printf("TIMEB ");
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef USE_TOD
 | 
			
		||||
		printf("USE_TOD ");
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef HZ
 | 
			
		||||
#define as_string(s) (#s)
 | 
			
		||||
		{
 | 
			
		||||
		double dbl = HZ;
 | 
			
		||||
		printf("HZ=%g", dbl);
 | 
			
		||||
		}
 | 
			
		||||
# ifdef _SC_CLK_TCK
 | 
			
		||||
		printf(" [sysconf value]");
 | 
			
		||||
# endif
 | 
			
		||||
#endif
 | 
			
		||||
		printf("\n");
 | 
			
		||||
		printf("timing function used: %s%s%s%s%s%s%s\n",
 | 
			
		||||
		       (ftime_used ? "ftime" : ""),
 | 
			
		||||
		       (ftime_used + times_used > 1 ? "," : ""),
 | 
			
		||||
		       (times_used ? "times" : ""),
 | 
			
		||||
		       (ftime_used + times_used + gettimeofday_used > 1 ? "," : ""),
 | 
			
		||||
		       (gettimeofday_used ? "gettimeofday" : ""),
 | 
			
		||||
		       (ftime_used + times_used + gettimeofday_used + getrusage_used > 1 ? "," : ""),
 | 
			
		||||
		       (getrusage_used ? "getrusage" : ""));
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (pr_header)
 | 
			
		||||
@@ -2608,7 +2775,6 @@ static int do_multi(int multi)
 | 
			
		||||
			close(fd[1]);
 | 
			
		||||
			mr=1;
 | 
			
		||||
			usertime=0;
 | 
			
		||||
			free(fds);
 | 
			
		||||
			return 0;
 | 
			
		||||
			}
 | 
			
		||||
		printf("Forked child %d\n",n);
 | 
			
		||||
@@ -2757,10 +2923,7 @@ static int do_multi(int multi)
 | 
			
		||||
			else
 | 
			
		||||
				fprintf(stderr,"Unknown type '%s' from child %d\n",buf,n);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		fclose(f);
 | 
			
		||||
		}
 | 
			
		||||
	free(fds);
 | 
			
		||||
	return 1;
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										59
									
								
								apps/x509.c
									
									
									
									
									
								
							
							
						
						
									
										59
									
								
								apps/x509.c
									
									
									
									
									
								
							@@ -114,7 +114,7 @@ static const char *x509_usage[]={
 | 
			
		||||
" -alias          - output certificate alias\n",
 | 
			
		||||
" -noout          - no certificate output\n",
 | 
			
		||||
" -ocspid         - print OCSP hash values for the subject name and public key\n",
 | 
			
		||||
" -ocspurl        - print OCSP Responder URL(s)\n",
 | 
			
		||||
" -ocsp_uri       - print OCSP Responder URL(s)\n",
 | 
			
		||||
" -trustout       - output a \"trusted\" certificate\n",
 | 
			
		||||
" -clrtrust       - clear all trusted purposes\n",
 | 
			
		||||
" -clrreject      - clear all rejected purposes\n",
 | 
			
		||||
@@ -190,7 +190,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	X509_REQ *rq=NULL;
 | 
			
		||||
	int fingerprint=0;
 | 
			
		||||
	char buf[256];
 | 
			
		||||
	const EVP_MD *md_alg,*digest=NULL;
 | 
			
		||||
	const EVP_MD *md_alg,*digest=EVP_sha1();
 | 
			
		||||
	CONF *extconf = NULL;
 | 
			
		||||
	char *extsect = NULL, *extfile = NULL, *passin = NULL, *passargin = NULL;
 | 
			
		||||
	int need_rand = 0;
 | 
			
		||||
@@ -738,14 +738,13 @@ bad:
 | 
			
		||||
			else if ((email == i) || (ocsp_uri == i))
 | 
			
		||||
				{
 | 
			
		||||
				int j;
 | 
			
		||||
				STACK_OF(STRING) *emlst;
 | 
			
		||||
				STACK *emlst;
 | 
			
		||||
				if (email == i)
 | 
			
		||||
					emlst = X509_get1_email(x);
 | 
			
		||||
				else
 | 
			
		||||
					emlst = X509_get1_ocsp(x);
 | 
			
		||||
				for (j = 0; j < sk_STRING_num(emlst); j++)
 | 
			
		||||
					BIO_printf(STDout, "%s\n",
 | 
			
		||||
						   sk_STRING_value(emlst, j));
 | 
			
		||||
				for (j = 0; j < sk_num(emlst); j++)
 | 
			
		||||
					BIO_printf(STDout, "%s\n", sk_value(emlst, j));
 | 
			
		||||
				X509_email_free(emlst);
 | 
			
		||||
				}
 | 
			
		||||
			else if (aliasout == i)
 | 
			
		||||
@@ -893,18 +892,14 @@ bad:
 | 
			
		||||
				int j;
 | 
			
		||||
				unsigned int n;
 | 
			
		||||
				unsigned char md[EVP_MAX_MD_SIZE];
 | 
			
		||||
				const EVP_MD *fdig = digest;
 | 
			
		||||
 | 
			
		||||
				if (!fdig)
 | 
			
		||||
					fdig = EVP_sha1();
 | 
			
		||||
 | 
			
		||||
				if (!X509_digest(x,fdig,md,&n))
 | 
			
		||||
				if (!X509_digest(x,digest,md,&n))
 | 
			
		||||
					{
 | 
			
		||||
					BIO_printf(bio_err,"out of memory\n");
 | 
			
		||||
					goto end;
 | 
			
		||||
					}
 | 
			
		||||
				BIO_printf(STDout,"%s Fingerprint=",
 | 
			
		||||
						OBJ_nid2sn(EVP_MD_type(fdig)));
 | 
			
		||||
						OBJ_nid2sn(EVP_MD_type(digest)));
 | 
			
		||||
				for (j=0; j<(int)n; j++)
 | 
			
		||||
					{
 | 
			
		||||
					BIO_printf(STDout,"%02X%c",md[j],
 | 
			
		||||
@@ -924,6 +919,14 @@ bad:
 | 
			
		||||
						passin, e, "Private key");
 | 
			
		||||
					if (Upkey == NULL) goto end;
 | 
			
		||||
					}
 | 
			
		||||
#ifndef OPENSSL_NO_DSA
 | 
			
		||||
		                if (Upkey->type == EVP_PKEY_DSA)
 | 
			
		||||
		                        digest=EVP_dss1();
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_ECDSA
 | 
			
		||||
				if (Upkey->type == EVP_PKEY_EC)
 | 
			
		||||
					digest=EVP_ecdsa();
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
				assert(need_rand);
 | 
			
		||||
				if (!sign(x,Upkey,days,clrext,digest,
 | 
			
		||||
@@ -940,6 +943,14 @@ bad:
 | 
			
		||||
						"CA Private Key");
 | 
			
		||||
					if (CApkey == NULL) goto end;
 | 
			
		||||
					}
 | 
			
		||||
#ifndef OPENSSL_NO_DSA
 | 
			
		||||
		                if (CApkey->type == EVP_PKEY_DSA)
 | 
			
		||||
		                        digest=EVP_dss1();
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_ECDSA
 | 
			
		||||
				if (CApkey->type == EVP_PKEY_EC)
 | 
			
		||||
					digest = EVP_ecdsa();
 | 
			
		||||
#endif
 | 
			
		||||
				
 | 
			
		||||
				assert(need_rand);
 | 
			
		||||
				if (!x509_certify(ctx,CAfile,digest,x,xca,
 | 
			
		||||
@@ -967,6 +978,15 @@ bad:
 | 
			
		||||
 | 
			
		||||
				BIO_printf(bio_err,"Generating certificate request\n");
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_DSA
 | 
			
		||||
		                if (pk->type == EVP_PKEY_DSA)
 | 
			
		||||
		                        digest=EVP_dss1();
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_ECDSA
 | 
			
		||||
				if (pk->type == EVP_PKEY_EC)
 | 
			
		||||
					digest=EVP_ecdsa();
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
				rq=X509_to_X509_REQ(x,pk,digest);
 | 
			
		||||
				EVP_PKEY_free(pk);
 | 
			
		||||
				if (rq == NULL)
 | 
			
		||||
@@ -1020,15 +1040,16 @@ bad:
 | 
			
		||||
		}
 | 
			
		||||
	else if (outformat == FORMAT_NETSCAPE)
 | 
			
		||||
		{
 | 
			
		||||
		NETSCAPE_X509 nx;
 | 
			
		||||
		ASN1_OCTET_STRING hdr;
 | 
			
		||||
		ASN1_HEADER ah;
 | 
			
		||||
		ASN1_OCTET_STRING os;
 | 
			
		||||
 | 
			
		||||
		hdr.data=(unsigned char *)NETSCAPE_CERT_HDR;
 | 
			
		||||
		hdr.length=strlen(NETSCAPE_CERT_HDR);
 | 
			
		||||
		nx.header= &hdr;
 | 
			
		||||
		nx.cert=x;
 | 
			
		||||
		os.data=(unsigned char *)NETSCAPE_CERT_HDR;
 | 
			
		||||
		os.length=strlen(NETSCAPE_CERT_HDR);
 | 
			
		||||
		ah.header= &os;
 | 
			
		||||
		ah.data=(char *)x;
 | 
			
		||||
		ah.meth=X509_asn1_meth();
 | 
			
		||||
 | 
			
		||||
		i=ASN1_item_i2d_bio(ASN1_ITEM_rptr(NETSCAPE_X509),out,&nx);
 | 
			
		||||
		i=ASN1_i2d_bio_of(ASN1_HEADER,i2d_ASN1_HEADER,out,&ah);
 | 
			
		||||
		}
 | 
			
		||||
	else	{
 | 
			
		||||
		BIO_printf(bio_err,"bad output format specified for outfile\n");
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										45
									
								
								config
									
									
									
									
									
								
							
							
						
						
									
										45
									
								
								config
									
									
									
									
									
								
							@@ -29,7 +29,7 @@ EXE=""
 | 
			
		||||
for i
 | 
			
		||||
do
 | 
			
		||||
case "$i" in 
 | 
			
		||||
-d*) PREFIX="debug-";;
 | 
			
		||||
-d) PREFIX="debug-";;
 | 
			
		||||
-t*) TEST="true";;
 | 
			
		||||
-h*) TEST="true"; cat <<EOF
 | 
			
		||||
Usage: config [options]
 | 
			
		||||
@@ -122,14 +122,6 @@ case "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in
 | 
			
		||||
	echo "${MACHINE}-ibm-aix3"; exit 0
 | 
			
		||||
	;;
 | 
			
		||||
 | 
			
		||||
    BeOS:*:BePC)
 | 
			
		||||
    if [ -e /boot/develop/headers/be/bone ]; then
 | 
			
		||||
		echo "beos-x86-bone"; exit 0
 | 
			
		||||
	else
 | 
			
		||||
		echo "beos-x86-r5"; exit 0
 | 
			
		||||
	fi
 | 
			
		||||
	;;
 | 
			
		||||
 | 
			
		||||
    dgux:*)
 | 
			
		||||
	echo "${MACHINE}-dg-dgux"; exit 0
 | 
			
		||||
	;;
 | 
			
		||||
@@ -278,7 +270,7 @@ case "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in
 | 
			
		||||
		echo "ppc-apple-darwin${VERSION}"
 | 
			
		||||
		;;
 | 
			
		||||
	    *)
 | 
			
		||||
		echo "i686-apple-darwin${VERSION}"
 | 
			
		||||
		echo "i386-apple-darwin${VERSION}"
 | 
			
		||||
		;;
 | 
			
		||||
	esac
 | 
			
		||||
	exit 0
 | 
			
		||||
@@ -531,28 +523,8 @@ case "$GUESSOS" in
 | 
			
		||||
	OUT="irix-mips3-$CC"
 | 
			
		||||
	;;
 | 
			
		||||
  ppc-apple-rhapsody) OUT="rhapsody-ppc-cc" ;;
 | 
			
		||||
  ppc-apple-darwin*)
 | 
			
		||||
	ISA64=`(sysctl -n hw.optional.64bitops) 2>/dev/null`
 | 
			
		||||
	if [ "$ISA64" = "1" ]; then
 | 
			
		||||
	    echo "WARNING! If you wish to build 64-bit library, then you have to"
 | 
			
		||||
	    echo "         invoke './Configure darwin64-ppc-cc' *manually*."
 | 
			
		||||
	    if [ "$TEST" = "false" -a -t 1 ]; then
 | 
			
		||||
	      echo "         You have about 5 seconds to press Ctrl-C to abort."
 | 
			
		||||
	      (trap "stty `stty -g`" 2 0; stty -icanon min 0 time 50; read waste) <&1
 | 
			
		||||
	    fi
 | 
			
		||||
	fi
 | 
			
		||||
	OUT="darwin-ppc-cc" ;;
 | 
			
		||||
  i?86-apple-darwin*)
 | 
			
		||||
	ISA64=`(sysctl -n hw.optional.x86_64) 2>/dev/null`
 | 
			
		||||
	if [ "$ISA64" = "1" ]; then
 | 
			
		||||
	    echo "WARNING! If you wish to build 64-bit library, then you have to"
 | 
			
		||||
	    echo "         invoke './Configure darwin64-x86_64-cc' *manually*."
 | 
			
		||||
	    if [ "$TEST" = "false" -a -t 1 ]; then
 | 
			
		||||
	      echo "         You have about 5 seconds to press Ctrl-C to abort."
 | 
			
		||||
	      (trap "stty `stty -g`" 2 0; stty -icanon min 0 time 50; read waste) <&1
 | 
			
		||||
	    fi
 | 
			
		||||
	fi
 | 
			
		||||
	OUT="darwin-i386-cc" ;;
 | 
			
		||||
  ppc-apple-darwin*) OUT="darwin-ppc-cc" ;;
 | 
			
		||||
  i386-apple-darwin*) OUT="darwin-i386-cc" ;;
 | 
			
		||||
  alpha-*-linux2)
 | 
			
		||||
        ISA=`awk '/cpu model/{print$4;exit(0);}' /proc/cpuinfo`
 | 
			
		||||
	case ${ISA:-generic} in
 | 
			
		||||
@@ -617,13 +589,13 @@ case "$GUESSOS" in
 | 
			
		||||
 | 
			
		||||
	options="$options -DB_ENDIAN -mschedule=$CPUSCHEDULE -march=$CPUARCH"
 | 
			
		||||
	OUT="linux-generic32" ;;
 | 
			
		||||
  armv[1-3]*-*-linux2) OUT="linux-generic32" ;;
 | 
			
		||||
  arm*-*-linux2) OUT="linux-armv4" ;;
 | 
			
		||||
  arm*b-*-linux2) OUT="linux-generic32"; options="$options -DB_ENDIAN" ;;
 | 
			
		||||
  arm*l-*-linux2) OUT="linux-generic32"; options="$options -DL_ENDIAN" ;;
 | 
			
		||||
  sh*b-*-linux2) OUT="linux-generic32"; options="$options -DB_ENDIAN" ;;
 | 
			
		||||
  sh*-*-linux2)  OUT="linux-generic32"; options="$options -DL_ENDIAN" ;;
 | 
			
		||||
  m68k*-*-linux2) OUT="linux-generic32"; options="$options -DB_ENDIAN" ;;
 | 
			
		||||
  s390-*-linux2) OUT="linux-generic32"; options="$options -DB_ENDIAN" ;;
 | 
			
		||||
  s390x-*-linux2) OUT="linux-s390x" ;;
 | 
			
		||||
  s390-*-linux2) OUT="linux-generic32"; options="$options -DB_ENDIAN -DNO_ASM" ;;
 | 
			
		||||
  s390x-*-linux2) OUT="linux-generic64"; options="$options -DB_ENDIAN" ;;
 | 
			
		||||
  x86_64-*-linux?) OUT="linux-x86_64" ;;
 | 
			
		||||
  *86-*-linux2) OUT="linux-elf"
 | 
			
		||||
	if [ "$GCCVER" -gt 28 ]; then
 | 
			
		||||
@@ -797,7 +769,6 @@ case "$GUESSOS" in
 | 
			
		||||
  t3e-cray-unicosmk) OUT="cray-t3e" ;;
 | 
			
		||||
  j90-cray-unicos) OUT="cray-j90" ;;
 | 
			
		||||
  nsr-tandem-nsk) OUT="tandem-c89" ;;
 | 
			
		||||
  beos-*) OUT="$GUESSOS" ;;
 | 
			
		||||
  *) OUT=`echo $GUESSOS | awk -F- '{print $3}'`;;
 | 
			
		||||
esac
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -4,5 +4,3 @@ opensslconf.h
 | 
			
		||||
Makefile.save
 | 
			
		||||
*.flc
 | 
			
		||||
semantic.cache
 | 
			
		||||
*cpuid.s
 | 
			
		||||
uplink-cof.s
 | 
			
		||||
 
 | 
			
		||||
@@ -54,6 +54,8 @@ struct LP_dir_context_st
 | 
			
		||||
 | 
			
		||||
const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory)
 | 
			
		||||
{
 | 
			
		||||
  struct dirent *direntry = NULL;
 | 
			
		||||
 | 
			
		||||
  if (ctx == NULL || directory == NULL)
 | 
			
		||||
    {
 | 
			
		||||
      errno = EINVAL;
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@ TOP=		..
 | 
			
		||||
CC=		cc
 | 
			
		||||
INCLUDE=	-I. -I$(TOP) -I../include
 | 
			
		||||
# INCLUDES targets sudbirs!
 | 
			
		||||
INCLUDES=	-I.. -I../.. -I../asn1 -I../evp -I../../include
 | 
			
		||||
INCLUDES=	-I.. -I../.. -I../../include
 | 
			
		||||
CFLAG=		-g
 | 
			
		||||
MAKEDEPPROG=	makedepend
 | 
			
		||||
MAKEDEPEND=	$(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
 | 
			
		||||
@@ -17,7 +17,7 @@ AR=		ar r
 | 
			
		||||
 | 
			
		||||
RECURSIVE_MAKE=	[ -n "$(SDIRS)" ] && for i in $(SDIRS) ; do \
 | 
			
		||||
		    (cd $$i && echo "making $$target in $(DIR)/$$i..." && \
 | 
			
		||||
		    $(MAKE) -e TOP=../.. DIR=$$i INCLUDES='$(INCLUDES)' $$target ) || exit 1; \
 | 
			
		||||
		    $(MAKE) -e TOP=../.. DIR=$$i INCLUDES='${INCLUDES}' $$target ) || exit 1; \
 | 
			
		||||
		done;
 | 
			
		||||
 | 
			
		||||
PEX_LIBS=
 | 
			
		||||
@@ -26,7 +26,6 @@ EX_LIBS=
 | 
			
		||||
CFLAGS= $(INCLUDE) $(CFLAG)
 | 
			
		||||
ASFLAGS= $(INCLUDE) $(ASFLAG)
 | 
			
		||||
AFLAGS=$(ASFLAGS)
 | 
			
		||||
CPUID_OBJ=mem_clr.o
 | 
			
		||||
 | 
			
		||||
LIBS=
 | 
			
		||||
 | 
			
		||||
@@ -34,12 +33,12 @@ GENERAL=Makefile README crypto-lib.com install.com
 | 
			
		||||
 | 
			
		||||
LIB= $(TOP)/libcrypto.a
 | 
			
		||||
SHARED_LIB= libcrypto$(SHLIB_EXT)
 | 
			
		||||
LIBSRC=	cryptlib.c mem.c mem_clr.c mem_dbg.c cversion.c ex_data.c cpt_err.c ebcdic.c uid.c o_time.c o_str.c o_dir.c
 | 
			
		||||
LIBOBJ= cryptlib.o mem.o mem_dbg.o cversion.o ex_data.o cpt_err.o ebcdic.o uid.o o_time.o o_str.o o_dir.o $(CPUID_OBJ)
 | 
			
		||||
LIBSRC=	cryptlib.c dyn_lck.c mem.c mem_clr.c mem_dbg.c cversion.c ex_data.c tmdiff.c cpt_err.c ebcdic.c uid.c o_time.c o_str.c o_dir.c o_init.c fips_err.c
 | 
			
		||||
LIBOBJ= cryptlib.o dyn_lck.o mem.o mem_clr.o mem_dbg.o cversion.o ex_data.o tmdiff.o cpt_err.o ebcdic.o uid.o o_time.o o_str.o o_dir.o o_init.o fips_err.o $(CPUID_OBJ)
 | 
			
		||||
 | 
			
		||||
SRC= $(LIBSRC)
 | 
			
		||||
 | 
			
		||||
EXHEADER= crypto.h opensslv.h opensslconf.h ebcdic.h symhacks.h \
 | 
			
		||||
EXHEADER= crypto.h tmdiff.h opensslv.h opensslconf.h ebcdic.h symhacks.h \
 | 
			
		||||
	ossl_typ.h
 | 
			
		||||
HEADER=	cryptlib.h buildinf.h md32_common.h o_time.h o_str.h o_dir.h $(EXHEADER)
 | 
			
		||||
 | 
			
		||||
@@ -48,7 +47,7 @@ ALL=    $(GENERAL) $(SRC) $(HEADER)
 | 
			
		||||
top:
 | 
			
		||||
	@(cd ..; $(MAKE) DIRS=$(DIR) all)
 | 
			
		||||
 | 
			
		||||
all: shared
 | 
			
		||||
all: lib
 | 
			
		||||
 | 
			
		||||
buildinf.h: ../Makefile
 | 
			
		||||
	( echo "#ifndef MK1MF_BUILD"; \
 | 
			
		||||
@@ -58,26 +57,26 @@ buildinf.h: ../Makefile
 | 
			
		||||
	echo "  #define DATE \"`LC_ALL=C LC_TIME=C date`\""; \
 | 
			
		||||
	echo '#endif' ) >buildinf.h
 | 
			
		||||
 | 
			
		||||
x86cpuid.s:	x86cpuid.pl perlasm/x86asm.pl
 | 
			
		||||
	$(PERL) x86cpuid.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
 | 
			
		||||
x86cpuid-elf.s:	x86cpuid.pl perlasm/x86asm.pl
 | 
			
		||||
	$(PERL) x86cpuid.pl elf $(CFLAGS) $(PROCESSOR) > $@
 | 
			
		||||
x86cpuid-cof.s: x86cpuid.pl perlasm/x86asm.pl
 | 
			
		||||
	$(PERL) x86cpuid.pl coff $(CFLAGS) $(PROCESSOR) > $@
 | 
			
		||||
x86cpuid-out.s: x86cpuid.pl perlasm/x86asm.pl
 | 
			
		||||
	$(PERL) x86cpuid.pl a.out $(CFLAGS) $(PROCESSOR) > $@
 | 
			
		||||
 | 
			
		||||
applink.o:	$(TOP)/ms/applink.c
 | 
			
		||||
	$(CC) $(CFLAGS) -c -o $@ $(TOP)/ms/applink.c
 | 
			
		||||
uplink.o:	../ms/uplink.c
 | 
			
		||||
	$(CC) $(CFLAGS) -c -o $@ ../ms/uplink.c
 | 
			
		||||
 | 
			
		||||
uplink.o:	$(TOP)/ms/uplink.c applink.o
 | 
			
		||||
	$(CC) $(CFLAGS) -c -o $@ $(TOP)/ms/uplink.c
 | 
			
		||||
 | 
			
		||||
uplink-cof.s:	$(TOP)/ms/uplink.pl
 | 
			
		||||
	$(PERL) $(TOP)/ms/uplink.pl coff > $@
 | 
			
		||||
uplink-cof.s:	../ms/uplink.pl
 | 
			
		||||
	$(PERL) ../ms/uplink.pl coff > $@
 | 
			
		||||
 | 
			
		||||
x86_64cpuid.s: x86_64cpuid.pl
 | 
			
		||||
	$(PERL) x86_64cpuid.pl $(PERLASM_SCHEME) > $@
 | 
			
		||||
	$(PERL) x86_64cpuid.pl $@
 | 
			
		||||
ia64cpuid.s: ia64cpuid.S
 | 
			
		||||
	$(CC) $(CFLAGS) -E ia64cpuid.S > $@
 | 
			
		||||
ppccpuid.s:		ppccpuid.pl;	$(PERL) ppccpuid.pl $(PERLASM_SCHEME) $@
 | 
			
		||||
 | 
			
		||||
testapps:
 | 
			
		||||
	[ -z "$(THIS)" ] || (	if echo $(SDIRS) | fgrep ' des '; \
 | 
			
		||||
	[ -z "$(THIS)" ] || (	if echo ${SDIRS} | fgrep ' des '; \
 | 
			
		||||
				then cd des && $(MAKE) -e des; fi )
 | 
			
		||||
	[ -z "$(THIS)" ] || ( cd pkcs7 && $(MAKE) -e testapps );
 | 
			
		||||
	@if [ -z "$(THIS)" ]; then $(MAKE) -f $(TOP)/Makefile reflect THIS=$@; fi
 | 
			
		||||
@@ -95,11 +94,11 @@ links:
 | 
			
		||||
	@$(PERL) $(TOP)/util/mklink.pl ../apps $(APPS)
 | 
			
		||||
	@target=links; $(RECURSIVE_MAKE)
 | 
			
		||||
 | 
			
		||||
# lib: $(LIB): are splitted to avoid end-less loop
 | 
			
		||||
lib:	$(LIB)
 | 
			
		||||
# lib: and $(LIB): are splitted to avoid end-less loop
 | 
			
		||||
lib:	buildinf.h $(LIB) subdirs
 | 
			
		||||
	@touch lib
 | 
			
		||||
$(LIB):	$(LIBOBJ)
 | 
			
		||||
	$(AR) $(LIB) $(LIBOBJ)
 | 
			
		||||
	$(ARX) $(LIB) $(LIBOBJ)
 | 
			
		||||
	$(RANLIB) $(LIB) || echo Never mind.
 | 
			
		||||
 | 
			
		||||
shared: buildinf.h lib subdirs
 | 
			
		||||
@@ -136,7 +135,6 @@ clean:
 | 
			
		||||
dclean:
 | 
			
		||||
	$(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
 | 
			
		||||
	mv -f Makefile.new $(MAKEFILE)
 | 
			
		||||
	rm -f opensslconf.h
 | 
			
		||||
	@target=dclean; $(RECURSIVE_MAKE)
 | 
			
		||||
 | 
			
		||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
 | 
			
		||||
@@ -161,6 +159,13 @@ cversion.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
 | 
			
		||||
cversion.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
 | 
			
		||||
cversion.o: ../include/openssl/stack.h ../include/openssl/symhacks.h buildinf.h
 | 
			
		||||
cversion.o: cryptlib.h cversion.c
 | 
			
		||||
dyn_lck.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
 | 
			
		||||
dyn_lck.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
 | 
			
		||||
dyn_lck.o: ../include/openssl/err.h ../include/openssl/lhash.h
 | 
			
		||||
dyn_lck.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
 | 
			
		||||
dyn_lck.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
 | 
			
		||||
dyn_lck.o: ../include/openssl/stack.h ../include/openssl/symhacks.h cryptlib.h
 | 
			
		||||
dyn_lck.o: dyn_lck.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: ../include/openssl/crypto.h ../include/openssl/e_os2.h
 | 
			
		||||
@@ -169,6 +174,13 @@ ex_data.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
 | 
			
		||||
ex_data.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
 | 
			
		||||
ex_data.o: ../include/openssl/stack.h ../include/openssl/symhacks.h cryptlib.h
 | 
			
		||||
ex_data.o: ex_data.c
 | 
			
		||||
fips_err.o: ../include/openssl/bio.h ../include/openssl/crypto.h
 | 
			
		||||
fips_err.o: ../include/openssl/e_os2.h ../include/openssl/err.h
 | 
			
		||||
fips_err.o: ../include/openssl/fips.h ../include/openssl/lhash.h
 | 
			
		||||
fips_err.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
 | 
			
		||||
fips_err.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
 | 
			
		||||
fips_err.o: ../include/openssl/stack.h ../include/openssl/symhacks.h fips_err.c
 | 
			
		||||
fips_err.o: fips_err.h
 | 
			
		||||
mem.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
 | 
			
		||||
mem.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
 | 
			
		||||
mem.o: ../include/openssl/err.h ../include/openssl/lhash.h
 | 
			
		||||
@@ -189,10 +201,23 @@ mem_dbg.o: ../include/openssl/stack.h ../include/openssl/symhacks.h cryptlib.h
 | 
			
		||||
mem_dbg.o: mem_dbg.c
 | 
			
		||||
o_dir.o: ../e_os.h ../include/openssl/e_os2.h ../include/openssl/opensslconf.h
 | 
			
		||||
o_dir.o: LPdir_unix.c o_dir.c o_dir.h
 | 
			
		||||
o_init.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/crypto.h
 | 
			
		||||
o_init.o: ../include/openssl/e_os2.h ../include/openssl/err.h
 | 
			
		||||
o_init.o: ../include/openssl/lhash.h ../include/openssl/opensslconf.h
 | 
			
		||||
o_init.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
 | 
			
		||||
o_init.o: ../include/openssl/safestack.h ../include/openssl/stack.h
 | 
			
		||||
o_init.o: ../include/openssl/symhacks.h o_init.c
 | 
			
		||||
o_str.o: ../e_os.h ../include/openssl/e_os2.h ../include/openssl/opensslconf.h
 | 
			
		||||
o_str.o: o_str.c o_str.h
 | 
			
		||||
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: ../include/openssl/crypto.h ../include/openssl/e_os2.h
 | 
			
		||||
tmdiff.o: ../include/openssl/err.h ../include/openssl/lhash.h
 | 
			
		||||
tmdiff.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
 | 
			
		||||
tmdiff.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
 | 
			
		||||
tmdiff.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
 | 
			
		||||
tmdiff.o: ../include/openssl/tmdiff.h cryptlib.h tmdiff.c
 | 
			
		||||
uid.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
 | 
			
		||||
uid.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
 | 
			
		||||
uid.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
 | 
			
		||||
 
 | 
			
		||||
@@ -2,4 +2,4 @@ lib
 | 
			
		||||
Makefile.save
 | 
			
		||||
*.flc
 | 
			
		||||
semantic.cache
 | 
			
		||||
aes-*.s
 | 
			
		||||
ax86-elf.s
 | 
			
		||||
 
 | 
			
		||||
@@ -11,7 +11,7 @@ CFLAG=-g
 | 
			
		||||
MAKEFILE=	Makefile
 | 
			
		||||
AR=		ar r
 | 
			
		||||
 | 
			
		||||
AES_ENC=aes_core.o aes_cbc.o
 | 
			
		||||
AES_ASM_OBJ=aes_core.o aes_cbc.o
 | 
			
		||||
 | 
			
		||||
CFLAGS= $(INCLUDES) $(CFLAG)
 | 
			
		||||
ASFLAGS= $(INCLUDES) $(ASFLAG)
 | 
			
		||||
@@ -26,7 +26,7 @@ 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 aes_ige.c aes_wrap.c
 | 
			
		||||
LIBOBJ=aes_misc.o aes_ecb.o aes_cfb.o aes_ofb.o aes_ctr.o aes_ige.o aes_wrap.o \
 | 
			
		||||
       $(AES_ENC)
 | 
			
		||||
       $(AES_ASM_OBJ)
 | 
			
		||||
 | 
			
		||||
SRC= $(LIBSRC)
 | 
			
		||||
 | 
			
		||||
@@ -41,27 +41,24 @@ top:
 | 
			
		||||
all:	lib
 | 
			
		||||
 | 
			
		||||
lib:	$(LIBOBJ)
 | 
			
		||||
	$(AR) $(LIB) $(LIBOBJ)
 | 
			
		||||
	$(ARX) $(LIB) $(LIBOBJ)
 | 
			
		||||
	$(RANLIB) $(LIB) || echo Never mind.
 | 
			
		||||
	@touch lib
 | 
			
		||||
 | 
			
		||||
$(LIBOBJ): $(LIBSRC)
 | 
			
		||||
 | 
			
		||||
aes-ia64.s: asm/aes-ia64.S
 | 
			
		||||
	$(CC) $(CFLAGS) -E asm/aes-ia64.S > $@
 | 
			
		||||
 | 
			
		||||
aes-586.s:	asm/aes-586.pl ../perlasm/x86asm.pl
 | 
			
		||||
	$(PERL) asm/aes-586.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
 | 
			
		||||
ax86-elf.s: asm/aes-586.pl ../perlasm/x86asm.pl
 | 
			
		||||
	(cd asm; $(PERL) aes-586.pl elf $(CFLAGS) $(PROCESSOR) > ../$@)
 | 
			
		||||
ax86-cof.s: asm/aes-586.pl ../perlasm/x86asm.pl
 | 
			
		||||
	(cd asm; $(PERL) aes-586.pl coff $(CFLAGS) $(PROCESSOR) > ../$@)
 | 
			
		||||
ax86-out.s: asm/aes-586.pl ../perlasm/x86asm.pl
 | 
			
		||||
	(cd asm; $(PERL) aes-586.pl a.out $(CFLAGS) $(PROCESSOR) > ../$@)
 | 
			
		||||
 | 
			
		||||
aes-x86_64.s: asm/aes-x86_64.pl
 | 
			
		||||
	$(PERL) asm/aes-x86_64.pl $(PERLASM_SCHEME) > $@
 | 
			
		||||
 | 
			
		||||
aes-sparcv9.s: asm/aes-sparcv9.pl
 | 
			
		||||
	$(PERL) asm/aes-sparcv9.pl $(CFLAGS) > $@
 | 
			
		||||
 | 
			
		||||
aes-ppc.s:	asm/aes-ppc.pl
 | 
			
		||||
	$(PERL) asm/aes-ppc.pl $(PERLASM_SCHEME) $@
 | 
			
		||||
 | 
			
		||||
# GNU make "catch all"
 | 
			
		||||
aes-%.s:	asm/aes-%.pl;	$(PERL) $< $(CFLAGS) > $@
 | 
			
		||||
	$(PERL) asm/aes-x86_64.pl $@
 | 
			
		||||
 | 
			
		||||
files:
 | 
			
		||||
	$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
 | 
			
		||||
@@ -100,14 +97,16 @@ clean:
 | 
			
		||||
 | 
			
		||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
 | 
			
		||||
 | 
			
		||||
aes_cbc.o: ../../include/openssl/aes.h ../../include/openssl/modes.h
 | 
			
		||||
aes_cbc.o: ../../include/openssl/opensslconf.h aes_cbc.c
 | 
			
		||||
aes_cfb.o: ../../include/openssl/aes.h ../../include/openssl/modes.h
 | 
			
		||||
aes_cfb.o: ../../include/openssl/opensslconf.h aes_cfb.c
 | 
			
		||||
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: ../../e_os.h ../../include/openssl/aes.h
 | 
			
		||||
aes_cfb.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
 | 
			
		||||
aes_cfb.o: 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/modes.h
 | 
			
		||||
aes_ctr.o: ../../include/openssl/opensslconf.h aes_ctr.c
 | 
			
		||||
aes_core.o: ../../include/openssl/fips.h ../../include/openssl/opensslconf.h
 | 
			
		||||
aes_core.o: 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_ige.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/bio.h
 | 
			
		||||
@@ -120,8 +119,8 @@ aes_ige.o: ../../include/openssl/symhacks.h ../cryptlib.h aes_ige.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/modes.h
 | 
			
		||||
aes_ofb.o: ../../include/openssl/opensslconf.h aes_ofb.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
 | 
			
		||||
aes_wrap.o: ../../e_os.h ../../include/openssl/aes.h
 | 
			
		||||
aes_wrap.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
 | 
			
		||||
aes_wrap.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
 | 
			
		||||
 
 | 
			
		||||
@@ -58,8 +58,6 @@
 | 
			
		||||
#error AES is disabled.
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#include <stddef.h>
 | 
			
		||||
 | 
			
		||||
#define AES_ENCRYPT	1
 | 
			
		||||
#define AES_DECRYPT	0
 | 
			
		||||
 | 
			
		||||
@@ -68,6 +66,10 @@
 | 
			
		||||
#define AES_MAXNR 14
 | 
			
		||||
#define AES_BLOCK_SIZE 16
 | 
			
		||||
 | 
			
		||||
#ifdef OPENSSL_FIPS
 | 
			
		||||
#define FIPS_AES_SIZE_T	int
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef  __cplusplus
 | 
			
		||||
extern "C" {
 | 
			
		||||
#endif
 | 
			
		||||
@@ -98,32 +100,37 @@ void AES_decrypt(const unsigned char *in, unsigned char *out,
 | 
			
		||||
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,
 | 
			
		||||
	size_t length, const AES_KEY *key,
 | 
			
		||||
	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,
 | 
			
		||||
	size_t length, const AES_KEY *key,
 | 
			
		||||
	const unsigned long length, const AES_KEY *key,
 | 
			
		||||
	unsigned char *ivec, int *num, const int enc);
 | 
			
		||||
void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out,
 | 
			
		||||
	size_t length, const AES_KEY *key,
 | 
			
		||||
	const unsigned long length, const AES_KEY *key,
 | 
			
		||||
	unsigned char *ivec, int *num, const int enc);
 | 
			
		||||
void AES_cfb8_encrypt(const unsigned char *in, unsigned char *out,
 | 
			
		||||
	size_t length, const AES_KEY *key,
 | 
			
		||||
	const unsigned long length, const AES_KEY *key,
 | 
			
		||||
	unsigned char *ivec, int *num, const int enc);
 | 
			
		||||
void AES_cfbr_encrypt_block(const unsigned char *in,unsigned char *out,
 | 
			
		||||
			    const int nbits,const AES_KEY *key,
 | 
			
		||||
			    unsigned char *ivec,const int enc);
 | 
			
		||||
void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out,
 | 
			
		||||
	size_t length, const AES_KEY *key,
 | 
			
		||||
	const unsigned long length, const AES_KEY *key,
 | 
			
		||||
	unsigned char *ivec, int *num);
 | 
			
		||||
void AES_ctr128_encrypt(const unsigned char *in, unsigned char *out,
 | 
			
		||||
	size_t length, const AES_KEY *key,
 | 
			
		||||
	const unsigned long length, const AES_KEY *key,
 | 
			
		||||
	unsigned char ivec[AES_BLOCK_SIZE],
 | 
			
		||||
	unsigned char ecount_buf[AES_BLOCK_SIZE],
 | 
			
		||||
	unsigned int *num);
 | 
			
		||||
 | 
			
		||||
/* For IGE, see also http://www.links.org/files/openssl-ige.pdf */
 | 
			
		||||
/* NB: the IV is _two_ blocks long */
 | 
			
		||||
void AES_ige_encrypt(const unsigned char *in, unsigned char *out,
 | 
			
		||||
		     size_t length, const AES_KEY *key,
 | 
			
		||||
		     const unsigned long length, const AES_KEY *key,
 | 
			
		||||
		     unsigned char *ivec, const int enc);
 | 
			
		||||
/* NB: the IV is _four_ blocks long */
 | 
			
		||||
void AES_bi_ige_encrypt(const unsigned char *in, unsigned char *out,
 | 
			
		||||
			size_t length, const AES_KEY *key,
 | 
			
		||||
			const unsigned long length, const AES_KEY *key,
 | 
			
		||||
			const AES_KEY *key2, const unsigned char *ivec,
 | 
			
		||||
			const int enc);
 | 
			
		||||
 | 
			
		||||
@@ -134,7 +141,6 @@ int AES_unwrap_key(AES_KEY *key, const unsigned char *iv,
 | 
			
		||||
		unsigned char *out,
 | 
			
		||||
		const unsigned char *in, unsigned int inlen);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#ifdef  __cplusplus
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -49,15 +49,85 @@
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <openssl/aes.h>
 | 
			
		||||
#include <openssl/modes.h>
 | 
			
		||||
#ifndef AES_DEBUG
 | 
			
		||||
# ifndef NDEBUG
 | 
			
		||||
#  define NDEBUG
 | 
			
		||||
# endif
 | 
			
		||||
#endif
 | 
			
		||||
#include <assert.h>
 | 
			
		||||
 | 
			
		||||
#include <openssl/aes.h>
 | 
			
		||||
#include "aes_locl.h"
 | 
			
		||||
 | 
			
		||||
#if !defined(OPENSSL_FIPS_AES_ASM)
 | 
			
		||||
void AES_cbc_encrypt(const unsigned char *in, unsigned char *out,
 | 
			
		||||
		     size_t len, const AES_KEY *key,
 | 
			
		||||
		     const unsigned long length, const AES_KEY *key,
 | 
			
		||||
		     unsigned char *ivec, const int enc) {
 | 
			
		||||
 | 
			
		||||
	if (enc)
 | 
			
		||||
		CRYPTO_cbc128_encrypt(in,out,len,key,ivec,(block128_f)AES_encrypt);
 | 
			
		||||
	else
 | 
			
		||||
		CRYPTO_cbc128_decrypt(in,out,len,key,ivec,(block128_f)AES_decrypt);
 | 
			
		||||
	unsigned long n;
 | 
			
		||||
	unsigned long len = length;
 | 
			
		||||
	unsigned char tmp[AES_BLOCK_SIZE];
 | 
			
		||||
	const unsigned char *iv = ivec;
 | 
			
		||||
 | 
			
		||||
	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 < AES_BLOCK_SIZE; ++n)
 | 
			
		||||
				out[n] = in[n] ^ iv[n];
 | 
			
		||||
			AES_encrypt(out, out, key);
 | 
			
		||||
			iv = out;
 | 
			
		||||
			len -= AES_BLOCK_SIZE;
 | 
			
		||||
			in += AES_BLOCK_SIZE;
 | 
			
		||||
			out += AES_BLOCK_SIZE;
 | 
			
		||||
		}
 | 
			
		||||
		if (len) {
 | 
			
		||||
			for(n=0; n < len; ++n)
 | 
			
		||||
				out[n] = in[n] ^ iv[n];
 | 
			
		||||
			for(n=len; n < AES_BLOCK_SIZE; ++n)
 | 
			
		||||
				out[n] = iv[n];
 | 
			
		||||
			AES_encrypt(out, out, key);
 | 
			
		||||
			iv = out;
 | 
			
		||||
		}
 | 
			
		||||
		memcpy(ivec,iv,AES_BLOCK_SIZE);
 | 
			
		||||
	} else if (in != out) {
 | 
			
		||||
		while (len >= AES_BLOCK_SIZE) {
 | 
			
		||||
			AES_decrypt(in, out, key);
 | 
			
		||||
			for(n=0; n < AES_BLOCK_SIZE; ++n)
 | 
			
		||||
				out[n] ^= iv[n];
 | 
			
		||||
			iv = in;
 | 
			
		||||
			len -= AES_BLOCK_SIZE;
 | 
			
		||||
			in  += AES_BLOCK_SIZE;
 | 
			
		||||
			out += AES_BLOCK_SIZE;
 | 
			
		||||
		}
 | 
			
		||||
		if (len) {
 | 
			
		||||
			AES_decrypt(in,tmp,key);
 | 
			
		||||
			for(n=0; n < len; ++n)
 | 
			
		||||
				out[n] = tmp[n] ^ iv[n];
 | 
			
		||||
			iv = in;
 | 
			
		||||
		}
 | 
			
		||||
		memcpy(ivec,iv,AES_BLOCK_SIZE);
 | 
			
		||||
	} else {
 | 
			
		||||
		while (len >= AES_BLOCK_SIZE) {
 | 
			
		||||
			memcpy(tmp, in, AES_BLOCK_SIZE);
 | 
			
		||||
			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, AES_BLOCK_SIZE);
 | 
			
		||||
			AES_decrypt(tmp, out, key);
 | 
			
		||||
			for(n=0; n < len; ++n)
 | 
			
		||||
				out[n] ^= ivec[n];
 | 
			
		||||
			for(n=len; n < AES_BLOCK_SIZE; ++n)
 | 
			
		||||
				out[n] = tmp[n];
 | 
			
		||||
			memcpy(ivec, tmp, AES_BLOCK_SIZE);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
/* crypto/aes/aes_cfb.c -*- mode:C; c-file-style: "eay" -*- */
 | 
			
		||||
/* ====================================================================
 | 
			
		||||
 * Copyright (c) 2002-2006 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
 | 
			
		||||
 * modification, are permitted provided that the following conditions
 | 
			
		||||
@@ -48,9 +48,73 @@
 | 
			
		||||
 * ====================================================================
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
/* 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 <openssl/modes.h>
 | 
			
		||||
#include "aes_locl.h"
 | 
			
		||||
#include "e_os.h"
 | 
			
		||||
 | 
			
		||||
/* The input and output encrypted as though 128bit cfb mode is being
 | 
			
		||||
 * used.  The extra state information to record how much of the
 | 
			
		||||
@@ -58,24 +122,104 @@
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out,
 | 
			
		||||
	size_t length, const AES_KEY *key,
 | 
			
		||||
	const unsigned long length, const AES_KEY *key,
 | 
			
		||||
	unsigned char *ivec, int *num, const int enc) {
 | 
			
		||||
 | 
			
		||||
	CRYPTO_cfb128_encrypt(in,out,length,key,ivec,num,enc,(block128_f)AES_encrypt);
 | 
			
		||||
	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;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* This expects a single block of size nbits for both in and out. Note that
 | 
			
		||||
   it corrupts any extra bits in the last byte of out */
 | 
			
		||||
void AES_cfbr_encrypt_block(const unsigned char *in,unsigned char *out,
 | 
			
		||||
			    const int nbits,const AES_KEY *key,
 | 
			
		||||
			    unsigned char *ivec,const int enc)
 | 
			
		||||
    {
 | 
			
		||||
    int n,rem,num;
 | 
			
		||||
    unsigned char ovec[AES_BLOCK_SIZE*2];
 | 
			
		||||
 | 
			
		||||
    if (nbits<=0 || nbits>128) return;
 | 
			
		||||
 | 
			
		||||
	/* fill in the first half of the new IV with the current IV */
 | 
			
		||||
	memcpy(ovec,ivec,AES_BLOCK_SIZE);
 | 
			
		||||
	/* construct the new IV */
 | 
			
		||||
	AES_encrypt(ivec,ivec,key);
 | 
			
		||||
	num = (nbits+7)/8;
 | 
			
		||||
	if (enc)	/* encrypt the input */
 | 
			
		||||
	    for(n=0 ; n < num ; ++n)
 | 
			
		||||
		out[n] = (ovec[AES_BLOCK_SIZE+n] = in[n] ^ ivec[n]);
 | 
			
		||||
	else		/* decrypt the input */
 | 
			
		||||
	    for(n=0 ; n < num ; ++n)
 | 
			
		||||
		out[n] = (ovec[AES_BLOCK_SIZE+n] = in[n]) ^ ivec[n];
 | 
			
		||||
	/* shift ovec left... */
 | 
			
		||||
	rem = nbits%8;
 | 
			
		||||
	num = nbits/8;
 | 
			
		||||
	if(rem==0)
 | 
			
		||||
	    memcpy(ivec,ovec+num,AES_BLOCK_SIZE);
 | 
			
		||||
	else
 | 
			
		||||
	    for(n=0 ; n < AES_BLOCK_SIZE ; ++n)
 | 
			
		||||
		ivec[n] = ovec[n+num]<<rem | ovec[n+num+1]>>(8-rem);
 | 
			
		||||
 | 
			
		||||
    /* it is not necessary to cleanse ovec, since the IV is not secret */
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
/* N.B. This expects the input to be packed, MS bit first */
 | 
			
		||||
void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out,
 | 
			
		||||
		      size_t length, const AES_KEY *key,
 | 
			
		||||
		      const unsigned long length, const AES_KEY *key,
 | 
			
		||||
		      unsigned char *ivec, int *num, const int enc)
 | 
			
		||||
    {
 | 
			
		||||
    CRYPTO_cfb128_1_encrypt(in,out,length,key,ivec,num,enc,(block128_f)AES_encrypt);
 | 
			
		||||
    unsigned int n;
 | 
			
		||||
    unsigned char c[1],d[1];
 | 
			
		||||
 | 
			
		||||
    assert(in && out && key && ivec && num);
 | 
			
		||||
    assert(*num == 0);
 | 
			
		||||
 | 
			
		||||
    memset(out,0,(length+7)/8);
 | 
			
		||||
    for(n=0 ; n < length ; ++n)
 | 
			
		||||
	{
 | 
			
		||||
	c[0]=(in[n/8]&(1 << (7-n%8))) ? 0x80 : 0;
 | 
			
		||||
	AES_cfbr_encrypt_block(c,d,1,key,ivec,enc);
 | 
			
		||||
	out[n/8]=(out[n/8]&~(1 << (7-n%8)))|((d[0]&0x80) >> (n%8));
 | 
			
		||||
	}
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
void AES_cfb8_encrypt(const unsigned char *in, unsigned char *out,
 | 
			
		||||
		      size_t length, const AES_KEY *key,
 | 
			
		||||
		      const unsigned long length, const AES_KEY *key,
 | 
			
		||||
		      unsigned char *ivec, int *num, const int enc)
 | 
			
		||||
    {
 | 
			
		||||
    CRYPTO_cfb128_8_encrypt(in,out,length,key,ivec,num,enc,(block128_f)AES_encrypt);
 | 
			
		||||
    unsigned int n;
 | 
			
		||||
 | 
			
		||||
    assert(in && out && key && ivec && num);
 | 
			
		||||
    assert(*num == 0);
 | 
			
		||||
 | 
			
		||||
    for(n=0 ; n < length ; ++n)
 | 
			
		||||
	AES_cfbr_encrypt_block(&in[n],&out[n],8,key,ivec,enc);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -37,9 +37,12 @@
 | 
			
		||||
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <openssl/aes.h>
 | 
			
		||||
#ifdef OPENSSL_FIPS
 | 
			
		||||
#include <openssl/fips.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#include "aes_locl.h"
 | 
			
		||||
 | 
			
		||||
#ifndef AES_ASM
 | 
			
		||||
/*
 | 
			
		||||
Te0[x] = S [x].[02, 01, 01, 03];
 | 
			
		||||
Te1[x] = S [x].[03, 02, 01, 01];
 | 
			
		||||
@@ -632,6 +635,10 @@ int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
 | 
			
		||||
   	int i = 0;
 | 
			
		||||
	u32 temp;
 | 
			
		||||
 | 
			
		||||
#ifdef OPENSSL_FIPS
 | 
			
		||||
	FIPS_selftest_check();
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	if (!userKey || !key)
 | 
			
		||||
		return -1;
 | 
			
		||||
	if (bits != 128 && bits != 192 && bits != 256)
 | 
			
		||||
@@ -774,6 +781,7 @@ int AES_set_decrypt_key(const unsigned char *userKey, const int bits,
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#ifndef AES_ASM
 | 
			
		||||
/*
 | 
			
		||||
 * Encrypt a single block
 | 
			
		||||
 * in and out can overlap
 | 
			
		||||
@@ -1156,203 +1164,4 @@ void AES_decrypt(const unsigned char *in, unsigned char *out,
 | 
			
		||||
	PUTU32(out + 12, s3);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#else /* AES_ASM */
 | 
			
		||||
 | 
			
		||||
static const u8 Te4[256] = {
 | 
			
		||||
    0x63U, 0x7cU, 0x77U, 0x7bU, 0xf2U, 0x6bU, 0x6fU, 0xc5U,
 | 
			
		||||
    0x30U, 0x01U, 0x67U, 0x2bU, 0xfeU, 0xd7U, 0xabU, 0x76U,
 | 
			
		||||
    0xcaU, 0x82U, 0xc9U, 0x7dU, 0xfaU, 0x59U, 0x47U, 0xf0U,
 | 
			
		||||
    0xadU, 0xd4U, 0xa2U, 0xafU, 0x9cU, 0xa4U, 0x72U, 0xc0U,
 | 
			
		||||
    0xb7U, 0xfdU, 0x93U, 0x26U, 0x36U, 0x3fU, 0xf7U, 0xccU,
 | 
			
		||||
    0x34U, 0xa5U, 0xe5U, 0xf1U, 0x71U, 0xd8U, 0x31U, 0x15U,
 | 
			
		||||
    0x04U, 0xc7U, 0x23U, 0xc3U, 0x18U, 0x96U, 0x05U, 0x9aU,
 | 
			
		||||
    0x07U, 0x12U, 0x80U, 0xe2U, 0xebU, 0x27U, 0xb2U, 0x75U,
 | 
			
		||||
    0x09U, 0x83U, 0x2cU, 0x1aU, 0x1bU, 0x6eU, 0x5aU, 0xa0U,
 | 
			
		||||
    0x52U, 0x3bU, 0xd6U, 0xb3U, 0x29U, 0xe3U, 0x2fU, 0x84U,
 | 
			
		||||
    0x53U, 0xd1U, 0x00U, 0xedU, 0x20U, 0xfcU, 0xb1U, 0x5bU,
 | 
			
		||||
    0x6aU, 0xcbU, 0xbeU, 0x39U, 0x4aU, 0x4cU, 0x58U, 0xcfU,
 | 
			
		||||
    0xd0U, 0xefU, 0xaaU, 0xfbU, 0x43U, 0x4dU, 0x33U, 0x85U,
 | 
			
		||||
    0x45U, 0xf9U, 0x02U, 0x7fU, 0x50U, 0x3cU, 0x9fU, 0xa8U,
 | 
			
		||||
    0x51U, 0xa3U, 0x40U, 0x8fU, 0x92U, 0x9dU, 0x38U, 0xf5U,
 | 
			
		||||
    0xbcU, 0xb6U, 0xdaU, 0x21U, 0x10U, 0xffU, 0xf3U, 0xd2U,
 | 
			
		||||
    0xcdU, 0x0cU, 0x13U, 0xecU, 0x5fU, 0x97U, 0x44U, 0x17U,
 | 
			
		||||
    0xc4U, 0xa7U, 0x7eU, 0x3dU, 0x64U, 0x5dU, 0x19U, 0x73U,
 | 
			
		||||
    0x60U, 0x81U, 0x4fU, 0xdcU, 0x22U, 0x2aU, 0x90U, 0x88U,
 | 
			
		||||
    0x46U, 0xeeU, 0xb8U, 0x14U, 0xdeU, 0x5eU, 0x0bU, 0xdbU,
 | 
			
		||||
    0xe0U, 0x32U, 0x3aU, 0x0aU, 0x49U, 0x06U, 0x24U, 0x5cU,
 | 
			
		||||
    0xc2U, 0xd3U, 0xacU, 0x62U, 0x91U, 0x95U, 0xe4U, 0x79U,
 | 
			
		||||
    0xe7U, 0xc8U, 0x37U, 0x6dU, 0x8dU, 0xd5U, 0x4eU, 0xa9U,
 | 
			
		||||
    0x6cU, 0x56U, 0xf4U, 0xeaU, 0x65U, 0x7aU, 0xaeU, 0x08U,
 | 
			
		||||
    0xbaU, 0x78U, 0x25U, 0x2eU, 0x1cU, 0xa6U, 0xb4U, 0xc6U,
 | 
			
		||||
    0xe8U, 0xddU, 0x74U, 0x1fU, 0x4bU, 0xbdU, 0x8bU, 0x8aU,
 | 
			
		||||
    0x70U, 0x3eU, 0xb5U, 0x66U, 0x48U, 0x03U, 0xf6U, 0x0eU,
 | 
			
		||||
    0x61U, 0x35U, 0x57U, 0xb9U, 0x86U, 0xc1U, 0x1dU, 0x9eU,
 | 
			
		||||
    0xe1U, 0xf8U, 0x98U, 0x11U, 0x69U, 0xd9U, 0x8eU, 0x94U,
 | 
			
		||||
    0x9bU, 0x1eU, 0x87U, 0xe9U, 0xceU, 0x55U, 0x28U, 0xdfU,
 | 
			
		||||
    0x8cU, 0xa1U, 0x89U, 0x0dU, 0xbfU, 0xe6U, 0x42U, 0x68U,
 | 
			
		||||
    0x41U, 0x99U, 0x2dU, 0x0fU, 0xb0U, 0x54U, 0xbbU, 0x16U
 | 
			
		||||
};
 | 
			
		||||
static const u32 rcon[] = {
 | 
			
		||||
	0x01000000, 0x02000000, 0x04000000, 0x08000000,
 | 
			
		||||
	0x10000000, 0x20000000, 0x40000000, 0x80000000,
 | 
			
		||||
	0x1B000000, 0x36000000, /* for 128-bit blocks, Rijndael never uses more than 10 rcon values */
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Expand the cipher key into the encryption key schedule.
 | 
			
		||||
 */
 | 
			
		||||
int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
 | 
			
		||||
			AES_KEY *key) {
 | 
			
		||||
	u32 *rk;
 | 
			
		||||
   	int i = 0;
 | 
			
		||||
	u32 temp;
 | 
			
		||||
 | 
			
		||||
	if (!userKey || !key)
 | 
			
		||||
		return -1;
 | 
			
		||||
	if (bits != 128 && bits != 192 && bits != 256)
 | 
			
		||||
		return -2;
 | 
			
		||||
 | 
			
		||||
	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) {
 | 
			
		||||
		while (1) {
 | 
			
		||||
			temp  = rk[3];
 | 
			
		||||
			rk[4] = rk[0] ^
 | 
			
		||||
				(Te4[(temp >> 16) & 0xff] << 24) ^
 | 
			
		||||
				(Te4[(temp >>  8) & 0xff] << 16) ^
 | 
			
		||||
				(Te4[(temp      ) & 0xff] << 8) ^
 | 
			
		||||
				(Te4[(temp >> 24)       ]) ^
 | 
			
		||||
				rcon[i];
 | 
			
		||||
			rk[5] = rk[1] ^ rk[4];
 | 
			
		||||
			rk[6] = rk[2] ^ rk[5];
 | 
			
		||||
			rk[7] = rk[3] ^ rk[6];
 | 
			
		||||
			if (++i == 10) {
 | 
			
		||||
				return 0;
 | 
			
		||||
			}
 | 
			
		||||
			rk += 4;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	rk[4] = GETU32(userKey + 16);
 | 
			
		||||
	rk[5] = GETU32(userKey + 20);
 | 
			
		||||
	if (bits == 192) {
 | 
			
		||||
		while (1) {
 | 
			
		||||
			temp = rk[ 5];
 | 
			
		||||
			rk[ 6] = rk[ 0] ^
 | 
			
		||||
				(Te4[(temp >> 16) & 0xff] << 24) ^
 | 
			
		||||
				(Te4[(temp >>  8) & 0xff] << 16) ^
 | 
			
		||||
				(Te4[(temp      ) & 0xff] << 8) ^
 | 
			
		||||
				(Te4[(temp >> 24)       ]) ^
 | 
			
		||||
				rcon[i];
 | 
			
		||||
			rk[ 7] = rk[ 1] ^ rk[ 6];
 | 
			
		||||
			rk[ 8] = rk[ 2] ^ rk[ 7];
 | 
			
		||||
			rk[ 9] = rk[ 3] ^ rk[ 8];
 | 
			
		||||
			if (++i == 8) {
 | 
			
		||||
				return 0;
 | 
			
		||||
			}
 | 
			
		||||
			rk[10] = rk[ 4] ^ rk[ 9];
 | 
			
		||||
			rk[11] = rk[ 5] ^ rk[10];
 | 
			
		||||
			rk += 6;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	rk[6] = GETU32(userKey + 24);
 | 
			
		||||
	rk[7] = GETU32(userKey + 28);
 | 
			
		||||
	if (bits == 256) {
 | 
			
		||||
		while (1) {
 | 
			
		||||
			temp = rk[ 7];
 | 
			
		||||
			rk[ 8] = rk[ 0] ^
 | 
			
		||||
				(Te4[(temp >> 16) & 0xff] << 24) ^
 | 
			
		||||
				(Te4[(temp >>  8) & 0xff] << 16) ^
 | 
			
		||||
				(Te4[(temp      ) & 0xff] << 8) ^
 | 
			
		||||
				(Te4[(temp >> 24)       ]) ^
 | 
			
		||||
				rcon[i];
 | 
			
		||||
			rk[ 9] = rk[ 1] ^ rk[ 8];
 | 
			
		||||
			rk[10] = rk[ 2] ^ rk[ 9];
 | 
			
		||||
			rk[11] = rk[ 3] ^ rk[10];
 | 
			
		||||
			if (++i == 7) {
 | 
			
		||||
				return 0;
 | 
			
		||||
			}
 | 
			
		||||
			temp = rk[11];
 | 
			
		||||
			rk[12] = rk[ 4] ^
 | 
			
		||||
				(Te4[(temp >> 24)       ] << 24) ^
 | 
			
		||||
				(Te4[(temp >> 16) & 0xff] << 16) ^
 | 
			
		||||
				(Te4[(temp >>  8) & 0xff] << 8) ^
 | 
			
		||||
				(Te4[(temp      ) & 0xff]);
 | 
			
		||||
			rk[13] = rk[ 5] ^ rk[12];
 | 
			
		||||
			rk[14] = rk[ 6] ^ rk[13];
 | 
			
		||||
			rk[15] = rk[ 7] ^ rk[14];
 | 
			
		||||
 | 
			
		||||
			rk += 8;
 | 
			
		||||
        	}
 | 
			
		||||
	}
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Expand the cipher key into the decryption key schedule.
 | 
			
		||||
 */
 | 
			
		||||
int AES_set_decrypt_key(const unsigned char *userKey, const int bits,
 | 
			
		||||
			 AES_KEY *key) {
 | 
			
		||||
 | 
			
		||||
        u32 *rk;
 | 
			
		||||
	int i, j, status;
 | 
			
		||||
	u32 temp;
 | 
			
		||||
 | 
			
		||||
	/* first, start with an encryption schedule */
 | 
			
		||||
	status = AES_set_encrypt_key(userKey, bits, key);
 | 
			
		||||
	if (status < 0)
 | 
			
		||||
		return status;
 | 
			
		||||
 | 
			
		||||
	rk = key->rd_key;
 | 
			
		||||
 | 
			
		||||
	/* invert the order of the round keys: */
 | 
			
		||||
	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 + 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 + 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: */
 | 
			
		||||
	for (i = 1; i < (key->rounds); i++) {
 | 
			
		||||
		rk += 4;
 | 
			
		||||
		for (j = 0; j < 4; j++) {
 | 
			
		||||
			u32 tp1, tp2, tp4, tp8, tp9, tpb, tpd, tpe, m;
 | 
			
		||||
 | 
			
		||||
			tp1 = rk[j];
 | 
			
		||||
			m = tp1 & 0x80808080;
 | 
			
		||||
			tp2 = ((tp1 & 0x7f7f7f7f) << 1) ^
 | 
			
		||||
				((m - (m >> 7)) & 0x1b1b1b1b);
 | 
			
		||||
			m = tp2 & 0x80808080;
 | 
			
		||||
			tp4 = ((tp2 & 0x7f7f7f7f) << 1) ^
 | 
			
		||||
				((m - (m >> 7)) & 0x1b1b1b1b);
 | 
			
		||||
			m = tp4 & 0x80808080;
 | 
			
		||||
			tp8 = ((tp4 & 0x7f7f7f7f) << 1) ^
 | 
			
		||||
				((m - (m >> 7)) & 0x1b1b1b1b);
 | 
			
		||||
			tp9 = tp8 ^ tp1;
 | 
			
		||||
			tpb = tp9 ^ tp2;
 | 
			
		||||
			tpd = tp9 ^ tp4;
 | 
			
		||||
			tpe = tp8 ^ tp4 ^ tp2;
 | 
			
		||||
#if defined(ROTATE)
 | 
			
		||||
			rk[j] = tpe ^ ROTATE(tpd,16) ^
 | 
			
		||||
				ROTATE(tp9,24) ^ ROTATE(tpb,8);
 | 
			
		||||
#else
 | 
			
		||||
			rk[j] = tpe ^ (tpd >> 16) ^ (tpd << 16) ^ 
 | 
			
		||||
				(tp9 >> 8) ^ (tp9 << 24) ^
 | 
			
		||||
				(tpb >> 24) ^ (tpb << 8);
 | 
			
		||||
#endif
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif /* AES_ASM */
 | 
			
		||||
 
 | 
			
		||||
@@ -49,13 +49,91 @@
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <openssl/aes.h>
 | 
			
		||||
#include <openssl/modes.h>
 | 
			
		||||
#ifndef AES_DEBUG
 | 
			
		||||
# ifndef NDEBUG
 | 
			
		||||
#  define NDEBUG
 | 
			
		||||
# endif
 | 
			
		||||
#endif
 | 
			
		||||
#include <assert.h>
 | 
			
		||||
 | 
			
		||||
void AES_ctr128_encrypt(const unsigned char *in, unsigned char *out,
 | 
			
		||||
			size_t length, const AES_KEY *key,
 | 
			
		||||
			unsigned char ivec[AES_BLOCK_SIZE],
 | 
			
		||||
			unsigned char ecount_buf[AES_BLOCK_SIZE],
 | 
			
		||||
			unsigned int *num) {
 | 
			
		||||
	CRYPTO_ctr128_encrypt(in,out,length,key,ivec,ecount_buf,num,(block128_f)AES_encrypt);
 | 
			
		||||
#include <openssl/aes.h>
 | 
			
		||||
#include "aes_locl.h"
 | 
			
		||||
 | 
			
		||||
/* NOTE: the IV/counter CTR mode is big-endian.  The rest of the AES code
 | 
			
		||||
 * is endian-neutral. */
 | 
			
		||||
 | 
			
		||||
/* increment counter (128-bit int) by 1 */
 | 
			
		||||
static void AES_ctr128_inc(unsigned char *counter) {
 | 
			
		||||
	unsigned long c;
 | 
			
		||||
 | 
			
		||||
	/* Grab bottom dword of counter and increment */
 | 
			
		||||
	c = GETU32(counter + 12);
 | 
			
		||||
	c++;	c &= 0xFFFFFFFF;
 | 
			
		||||
	PUTU32(counter + 12, c);
 | 
			
		||||
 | 
			
		||||
	/* if no overflow, we're done */
 | 
			
		||||
	if (c)
 | 
			
		||||
		return;
 | 
			
		||||
 | 
			
		||||
	/* Grab 1st dword of counter and increment */
 | 
			
		||||
	c = GETU32(counter +  8);
 | 
			
		||||
	c++;	c &= 0xFFFFFFFF;
 | 
			
		||||
	PUTU32(counter +  8, c);
 | 
			
		||||
 | 
			
		||||
	/* if no overflow, we're done */
 | 
			
		||||
	if (c)
 | 
			
		||||
		return;
 | 
			
		||||
 | 
			
		||||
	/* Grab 2nd dword of counter and increment */
 | 
			
		||||
	c = GETU32(counter +  4);
 | 
			
		||||
	c++;	c &= 0xFFFFFFFF;
 | 
			
		||||
	PUTU32(counter +  4, c);
 | 
			
		||||
 | 
			
		||||
	/* if no overflow, we're done */
 | 
			
		||||
	if (c)
 | 
			
		||||
		return;
 | 
			
		||||
 | 
			
		||||
	/* Grab top dword of counter and increment */
 | 
			
		||||
	c = GETU32(counter +  0);
 | 
			
		||||
	c++;	c &= 0xFFFFFFFF;
 | 
			
		||||
	PUTU32(counter +  0, c);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* 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().
 | 
			
		||||
 *
 | 
			
		||||
 * This algorithm assumes that the counter is in the x lower bits
 | 
			
		||||
 * of the IV (ivec), and that the application has full control over
 | 
			
		||||
 * overflow and the rest of the IV.  This implementation takes NO
 | 
			
		||||
 * responsability for checking that the counter doesn't overflow
 | 
			
		||||
 * into the rest of the IV when incremented.
 | 
			
		||||
 */
 | 
			
		||||
void AES_ctr128_encrypt(const unsigned char *in, unsigned char *out,
 | 
			
		||||
	const unsigned long length, const AES_KEY *key,
 | 
			
		||||
	unsigned char ivec[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(ivec, ecount_buf, key);
 | 
			
		||||
 			AES_ctr128_inc(ivec);
 | 
			
		||||
		}
 | 
			
		||||
		*(out++) = *(in++) ^ ecount_buf[n];
 | 
			
		||||
		n = (n+1) % AES_BLOCK_SIZE;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	*num=n;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -77,11 +77,11 @@ typedef struct {
 | 
			
		||||
/* N.B. The IV for this mode is _twice_ the block size */
 | 
			
		||||
 | 
			
		||||
void AES_ige_encrypt(const unsigned char *in, unsigned char *out,
 | 
			
		||||
					 size_t length, const AES_KEY *key,
 | 
			
		||||
					 const unsigned long length, const AES_KEY *key,
 | 
			
		||||
					 unsigned char *ivec, const int enc)
 | 
			
		||||
	{
 | 
			
		||||
	size_t n;
 | 
			
		||||
	size_t len = length;
 | 
			
		||||
	unsigned long n;
 | 
			
		||||
	unsigned long len;
 | 
			
		||||
 | 
			
		||||
	OPENSSL_assert(in && out && key && ivec);
 | 
			
		||||
	OPENSSL_assert((AES_ENCRYPT == enc)||(AES_DECRYPT == enc));
 | 
			
		||||
@@ -211,12 +211,12 @@ void AES_ige_encrypt(const unsigned char *in, unsigned char *out,
 | 
			
		||||
/* N.B. The IV for this mode is _four times_ the block size */
 | 
			
		||||
 | 
			
		||||
void AES_bi_ige_encrypt(const unsigned char *in, unsigned char *out,
 | 
			
		||||
						size_t length, const AES_KEY *key,
 | 
			
		||||
						const unsigned long length, const AES_KEY *key,
 | 
			
		||||
						const AES_KEY *key2, const unsigned char *ivec,
 | 
			
		||||
						const int enc)
 | 
			
		||||
	{
 | 
			
		||||
	size_t n;
 | 
			
		||||
	size_t len = length;
 | 
			
		||||
	unsigned long n;
 | 
			
		||||
	unsigned long len = length;
 | 
			
		||||
	unsigned char tmp[AES_BLOCK_SIZE];
 | 
			
		||||
	unsigned char tmp2[AES_BLOCK_SIZE];
 | 
			
		||||
	unsigned char tmp3[AES_BLOCK_SIZE];
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
/* crypto/aes/aes_ofb.c -*- mode:C; c-file-style: "eay" -*- */
 | 
			
		||||
/* ====================================================================
 | 
			
		||||
 * Copyright (c) 2002-2006 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
 | 
			
		||||
 * modification, are permitted provided that the following conditions
 | 
			
		||||
@@ -48,13 +48,95 @@
 | 
			
		||||
 * ====================================================================
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
/* 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 <openssl/modes.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,
 | 
			
		||||
	size_t length, const AES_KEY *key,
 | 
			
		||||
	unsigned char *ivec, int *num)
 | 
			
		||||
{
 | 
			
		||||
	CRYPTO_ofb128_encrypt(in,out,length,key,ivec,num,(block128_f)AES_encrypt);
 | 
			
		||||
	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
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -22,32 +22,30 @@ LIBSRC=	a_object.c a_bitstr.c a_utctm.c a_gentm.c a_time.c a_int.c a_octet.c \
 | 
			
		||||
	a_enum.c a_utf8.c a_sign.c a_digest.c a_verify.c a_mbstr.c a_strex.c \
 | 
			
		||||
	x_algor.c x_val.c x_pubkey.c x_sig.c x_req.c x_attrib.c x_bignum.c \
 | 
			
		||||
	x_long.c x_name.c x_x509.c x_x509a.c x_crl.c x_info.c x_spki.c nsseq.c \
 | 
			
		||||
	x_nx509.c d2i_pu.c d2i_pr.c i2d_pu.c i2d_pr.c\
 | 
			
		||||
	d2i_pu.c d2i_pr.c i2d_pu.c i2d_pr.c\
 | 
			
		||||
	t_req.c t_x509.c t_x509a.c t_crl.c t_pkey.c t_spki.c t_bitst.c \
 | 
			
		||||
	tasn_new.c tasn_fre.c tasn_enc.c tasn_dec.c tasn_utl.c tasn_typ.c \
 | 
			
		||||
	tasn_prn.c ameth_lib.c \
 | 
			
		||||
	f_int.c f_string.c n_pkey.c \
 | 
			
		||||
	f_enum.c x_pkey.c a_bool.c x_exten.c bio_asn1.c bio_ndef.c asn_mime.c \
 | 
			
		||||
	asn1_gen.c asn1_par.c asn1_lib.c asn1_err.c a_bytes.c a_strnid.c \
 | 
			
		||||
	f_enum.c a_hdr.c x_pkey.c a_bool.c x_exten.c asn_mime.c \
 | 
			
		||||
	asn1_gen.c asn1_par.c asn1_lib.c asn1_err.c a_meth.c a_bytes.c a_strnid.c \
 | 
			
		||||
	evp_asn1.c asn_pack.c p5_pbe.c p5_pbev2.c p8_pkey.c asn_moid.c
 | 
			
		||||
LIBOBJ= a_object.o a_bitstr.o a_utctm.o a_gentm.o a_time.o a_int.o a_octet.o \
 | 
			
		||||
	a_print.o a_type.o a_set.o a_dup.o a_d2i_fp.o a_i2d_fp.o \
 | 
			
		||||
	a_enum.o a_utf8.o a_sign.o a_digest.o a_verify.o a_mbstr.o a_strex.o \
 | 
			
		||||
	x_algor.o x_val.o x_pubkey.o x_sig.o x_req.o x_attrib.o x_bignum.o \
 | 
			
		||||
	x_long.o x_name.o x_x509.o x_x509a.o x_crl.o x_info.o x_spki.o nsseq.o \
 | 
			
		||||
	x_nx509.o d2i_pu.o d2i_pr.o i2d_pu.o i2d_pr.o \
 | 
			
		||||
	d2i_pu.o d2i_pr.o i2d_pu.o i2d_pr.o \
 | 
			
		||||
	t_req.o t_x509.o t_x509a.o t_crl.o t_pkey.o t_spki.o t_bitst.o \
 | 
			
		||||
	tasn_new.o tasn_fre.o tasn_enc.o tasn_dec.o tasn_utl.o tasn_typ.o \
 | 
			
		||||
	tasn_prn.o ameth_lib.o \
 | 
			
		||||
	f_int.o f_string.o n_pkey.o \
 | 
			
		||||
	f_enum.o x_pkey.o a_bool.o x_exten.o bio_asn1.o bio_ndef.o asn_mime.o \
 | 
			
		||||
	asn1_gen.o asn1_par.o asn1_lib.o asn1_err.o a_bytes.o a_strnid.o \
 | 
			
		||||
	f_enum.o a_hdr.o x_pkey.o a_bool.o x_exten.o asn_mime.o \
 | 
			
		||||
	asn1_gen.o asn1_par.o asn1_lib.o asn1_err.o a_meth.o a_bytes.o a_strnid.o \
 | 
			
		||||
	evp_asn1.o asn_pack.o p5_pbe.o p5_pbev2.o p8_pkey.o asn_moid.o
 | 
			
		||||
 | 
			
		||||
SRC= $(LIBSRC)
 | 
			
		||||
 | 
			
		||||
EXHEADER=  asn1.h asn1_mac.h asn1t.h
 | 
			
		||||
HEADER=	$(EXHEADER) asn1_locl.h
 | 
			
		||||
HEADER=	$(EXHEADER)
 | 
			
		||||
 | 
			
		||||
ALL=    $(GENERAL) $(SRC) $(HEADER)
 | 
			
		||||
 | 
			
		||||
@@ -65,7 +63,7 @@ pk:	pk.c
 | 
			
		||||
all:	lib
 | 
			
		||||
 | 
			
		||||
lib:	$(LIBOBJ)
 | 
			
		||||
	$(AR) $(LIB) $(LIBOBJ)
 | 
			
		||||
	$(ARX) $(LIB) $(LIBOBJ)
 | 
			
		||||
	$(RANLIB) $(LIB) || echo Never mind.
 | 
			
		||||
	@touch lib
 | 
			
		||||
 | 
			
		||||
@@ -144,9 +142,9 @@ a_digest.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
 | 
			
		||||
a_digest.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
 | 
			
		||||
a_digest.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
 | 
			
		||||
a_digest.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
 | 
			
		||||
a_digest.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
 | 
			
		||||
a_digest.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 | 
			
		||||
a_digest.o: ../../include/openssl/opensslconf.h
 | 
			
		||||
a_digest.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
 | 
			
		||||
a_digest.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 | 
			
		||||
a_digest.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 | 
			
		||||
a_digest.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
a_digest.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
 | 
			
		||||
a_digest.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 | 
			
		||||
@@ -175,6 +173,14 @@ a_gentm.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
 | 
			
		||||
a_gentm.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
 | 
			
		||||
a_gentm.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 | 
			
		||||
a_gentm.o: ../cryptlib.h ../o_time.h a_gentm.c
 | 
			
		||||
a_hdr.o: ../../e_os.h ../../include/openssl/asn1.h
 | 
			
		||||
a_hdr.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
 | 
			
		||||
a_hdr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
 | 
			
		||||
a_hdr.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
 | 
			
		||||
a_hdr.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
 | 
			
		||||
a_hdr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
a_hdr.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
 | 
			
		||||
a_hdr.o: ../../include/openssl/symhacks.h ../cryptlib.h a_hdr.c
 | 
			
		||||
a_i2d_fp.o: ../../e_os.h ../../include/openssl/asn1.h
 | 
			
		||||
a_i2d_fp.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
 | 
			
		||||
a_i2d_fp.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
 | 
			
		||||
@@ -199,6 +205,13 @@ a_mbstr.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
 | 
			
		||||
a_mbstr.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
 | 
			
		||||
a_mbstr.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 | 
			
		||||
a_mbstr.o: ../cryptlib.h a_mbstr.c
 | 
			
		||||
a_meth.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
 | 
			
		||||
a_meth.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
 | 
			
		||||
a_meth.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
 | 
			
		||||
a_meth.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
 | 
			
		||||
a_meth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
a_meth.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
 | 
			
		||||
a_meth.o: ../../include/openssl/symhacks.h ../cryptlib.h a_meth.c
 | 
			
		||||
a_object.o: ../../e_os.h ../../include/openssl/asn1.h
 | 
			
		||||
a_object.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
 | 
			
		||||
a_object.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
 | 
			
		||||
@@ -237,27 +250,27 @@ a_sign.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
 | 
			
		||||
a_sign.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
 | 
			
		||||
a_sign.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
 | 
			
		||||
a_sign.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
 | 
			
		||||
a_sign.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
 | 
			
		||||
a_sign.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 | 
			
		||||
a_sign.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
 | 
			
		||||
a_sign.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
 | 
			
		||||
a_sign.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
 | 
			
		||||
a_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 | 
			
		||||
a_sign.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
 | 
			
		||||
a_sign.o: ../cryptlib.h a_sign.c asn1_locl.h
 | 
			
		||||
a_sign.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
 | 
			
		||||
a_sign.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 | 
			
		||||
a_sign.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 | 
			
		||||
a_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
a_sign.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
 | 
			
		||||
a_sign.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 | 
			
		||||
a_sign.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
 | 
			
		||||
a_sign.o: ../../include/openssl/x509_vfy.h ../cryptlib.h a_sign.c
 | 
			
		||||
a_strex.o: ../../e_os.h ../../include/openssl/asn1.h
 | 
			
		||||
a_strex.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
 | 
			
		||||
a_strex.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
 | 
			
		||||
a_strex.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
 | 
			
		||||
a_strex.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
 | 
			
		||||
a_strex.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
 | 
			
		||||
a_strex.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 | 
			
		||||
a_strex.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
 | 
			
		||||
a_strex.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
 | 
			
		||||
a_strex.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
 | 
			
		||||
a_strex.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 | 
			
		||||
a_strex.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
 | 
			
		||||
a_strex.o: ../cryptlib.h a_strex.c charmap.h
 | 
			
		||||
a_strex.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
 | 
			
		||||
a_strex.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 | 
			
		||||
a_strex.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 | 
			
		||||
a_strex.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
a_strex.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
 | 
			
		||||
a_strex.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 | 
			
		||||
a_strex.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
 | 
			
		||||
a_strex.o: ../../include/openssl/x509_vfy.h ../cryptlib.h a_strex.c charmap.h
 | 
			
		||||
a_strnid.o: ../../e_os.h ../../include/openssl/asn1.h
 | 
			
		||||
a_strnid.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
 | 
			
		||||
a_strnid.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
 | 
			
		||||
@@ -305,29 +318,14 @@ a_verify.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
 | 
			
		||||
a_verify.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
 | 
			
		||||
a_verify.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
 | 
			
		||||
a_verify.o: ../../include/openssl/err.h ../../include/openssl/evp.h
 | 
			
		||||
a_verify.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 | 
			
		||||
a_verify.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 | 
			
		||||
a_verify.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
 | 
			
		||||
a_verify.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 | 
			
		||||
a_verify.o: ../../include/openssl/opensslconf.h
 | 
			
		||||
a_verify.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
a_verify.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
 | 
			
		||||
a_verify.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 | 
			
		||||
a_verify.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
 | 
			
		||||
a_verify.o: ../../include/openssl/x509_vfy.h ../cryptlib.h a_verify.c
 | 
			
		||||
a_verify.o: asn1_locl.h
 | 
			
		||||
ameth_lib.o: ../../e_os.h ../../include/openssl/asn1.h
 | 
			
		||||
ameth_lib.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 | 
			
		||||
ameth_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
 | 
			
		||||
ameth_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
 | 
			
		||||
ameth_lib.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
 | 
			
		||||
ameth_lib.o: ../../include/openssl/engine.h ../../include/openssl/err.h
 | 
			
		||||
ameth_lib.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
 | 
			
		||||
ameth_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 | 
			
		||||
ameth_lib.o: ../../include/openssl/opensslconf.h
 | 
			
		||||
ameth_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
ameth_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
 | 
			
		||||
ameth_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 | 
			
		||||
ameth_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
 | 
			
		||||
ameth_lib.o: ../../include/openssl/x509_vfy.h ../cryptlib.h ameth_lib.c
 | 
			
		||||
ameth_lib.o: asn1_locl.h
 | 
			
		||||
asn1_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
 | 
			
		||||
asn1_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
 | 
			
		||||
asn1_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
 | 
			
		||||
@@ -341,8 +339,9 @@ asn1_gen.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
 | 
			
		||||
asn1_gen.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
 | 
			
		||||
asn1_gen.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
 | 
			
		||||
asn1_gen.o: ../../include/openssl/err.h ../../include/openssl/evp.h
 | 
			
		||||
asn1_gen.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 | 
			
		||||
asn1_gen.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 | 
			
		||||
asn1_gen.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
 | 
			
		||||
asn1_gen.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 | 
			
		||||
asn1_gen.o: ../../include/openssl/opensslconf.h
 | 
			
		||||
asn1_gen.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
asn1_gen.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
 | 
			
		||||
asn1_gen.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 | 
			
		||||
@@ -372,23 +371,24 @@ asn_mime.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
 | 
			
		||||
asn_mime.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
 | 
			
		||||
asn_mime.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
 | 
			
		||||
asn_mime.o: ../../include/openssl/err.h ../../include/openssl/evp.h
 | 
			
		||||
asn_mime.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 | 
			
		||||
asn_mime.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 | 
			
		||||
asn_mime.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
 | 
			
		||||
asn_mime.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 | 
			
		||||
asn_mime.o: ../../include/openssl/opensslconf.h
 | 
			
		||||
asn_mime.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
asn_mime.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
 | 
			
		||||
asn_mime.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
 | 
			
		||||
asn_mime.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 | 
			
		||||
asn_mime.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
 | 
			
		||||
asn_mime.o: ../cryptlib.h asn1_locl.h asn_mime.c
 | 
			
		||||
asn_mime.o: ../cryptlib.h asn_mime.c
 | 
			
		||||
asn_moid.o: ../../e_os.h ../../include/openssl/asn1.h
 | 
			
		||||
asn_moid.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
 | 
			
		||||
asn_moid.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
 | 
			
		||||
asn_moid.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
 | 
			
		||||
asn_moid.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
 | 
			
		||||
asn_moid.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
 | 
			
		||||
asn_moid.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
 | 
			
		||||
asn_moid.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 | 
			
		||||
asn_moid.o: ../../include/openssl/opensslconf.h
 | 
			
		||||
asn_moid.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
 | 
			
		||||
asn_moid.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 | 
			
		||||
asn_moid.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 | 
			
		||||
asn_moid.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
asn_moid.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
 | 
			
		||||
asn_moid.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 | 
			
		||||
@@ -402,43 +402,28 @@ asn_pack.o: ../../include/openssl/opensslconf.h
 | 
			
		||||
asn_pack.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
asn_pack.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
 | 
			
		||||
asn_pack.o: ../../include/openssl/symhacks.h ../cryptlib.h asn_pack.c
 | 
			
		||||
bio_asn1.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
 | 
			
		||||
bio_asn1.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
 | 
			
		||||
bio_asn1.o: ../../include/openssl/opensslconf.h
 | 
			
		||||
bio_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
bio_asn1.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
 | 
			
		||||
bio_asn1.o: ../../include/openssl/symhacks.h bio_asn1.c
 | 
			
		||||
bio_ndef.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
 | 
			
		||||
bio_ndef.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
 | 
			
		||||
bio_ndef.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
 | 
			
		||||
bio_ndef.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
 | 
			
		||||
bio_ndef.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
bio_ndef.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
 | 
			
		||||
bio_ndef.o: ../../include/openssl/symhacks.h bio_ndef.c
 | 
			
		||||
d2i_pr.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
 | 
			
		||||
d2i_pr.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
 | 
			
		||||
d2i_pr.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
 | 
			
		||||
d2i_pr.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
 | 
			
		||||
d2i_pr.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
 | 
			
		||||
d2i_pr.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h
 | 
			
		||||
d2i_pr.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
 | 
			
		||||
d2i_pr.o: ../../include/openssl/err.h ../../include/openssl/evp.h
 | 
			
		||||
d2i_pr.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 | 
			
		||||
d2i_pr.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 | 
			
		||||
d2i_pr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
d2i_pr.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
 | 
			
		||||
d2i_pr.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 | 
			
		||||
d2i_pr.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
 | 
			
		||||
d2i_pr.o: ../../include/openssl/x509_vfy.h ../cryptlib.h asn1_locl.h d2i_pr.c
 | 
			
		||||
d2i_pr.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
 | 
			
		||||
d2i_pr.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 | 
			
		||||
d2i_pr.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
 | 
			
		||||
d2i_pr.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rsa.h
 | 
			
		||||
d2i_pr.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
 | 
			
		||||
d2i_pr.o: ../../include/openssl/symhacks.h ../cryptlib.h d2i_pr.c
 | 
			
		||||
d2i_pu.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
 | 
			
		||||
d2i_pu.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
 | 
			
		||||
d2i_pu.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h
 | 
			
		||||
d2i_pu.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
 | 
			
		||||
d2i_pu.o: ../../include/openssl/err.h ../../include/openssl/evp.h
 | 
			
		||||
d2i_pu.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 | 
			
		||||
d2i_pu.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 | 
			
		||||
d2i_pu.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
d2i_pu.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
 | 
			
		||||
d2i_pu.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 | 
			
		||||
d2i_pu.o: ../cryptlib.h d2i_pu.c
 | 
			
		||||
d2i_pu.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
 | 
			
		||||
d2i_pu.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 | 
			
		||||
d2i_pu.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
 | 
			
		||||
d2i_pu.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rsa.h
 | 
			
		||||
d2i_pu.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
 | 
			
		||||
d2i_pu.o: ../../include/openssl/symhacks.h ../cryptlib.h d2i_pu.c
 | 
			
		||||
evp_asn1.o: ../../e_os.h ../../include/openssl/asn1.h
 | 
			
		||||
evp_asn1.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
 | 
			
		||||
evp_asn1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
 | 
			
		||||
@@ -470,76 +455,77 @@ f_string.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
f_string.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
 | 
			
		||||
f_string.o: ../../include/openssl/symhacks.h ../cryptlib.h f_string.c
 | 
			
		||||
i2d_pr.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
 | 
			
		||||
i2d_pr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
 | 
			
		||||
i2d_pr.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
 | 
			
		||||
i2d_pr.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h
 | 
			
		||||
i2d_pr.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
 | 
			
		||||
i2d_pr.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
 | 
			
		||||
i2d_pr.o: ../../include/openssl/err.h ../../include/openssl/evp.h
 | 
			
		||||
i2d_pr.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 | 
			
		||||
i2d_pr.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 | 
			
		||||
i2d_pr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
i2d_pr.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
 | 
			
		||||
i2d_pr.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 | 
			
		||||
i2d_pr.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
 | 
			
		||||
i2d_pr.o: ../../include/openssl/x509_vfy.h ../cryptlib.h asn1_locl.h i2d_pr.c
 | 
			
		||||
i2d_pr.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
 | 
			
		||||
i2d_pr.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 | 
			
		||||
i2d_pr.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
 | 
			
		||||
i2d_pr.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rsa.h
 | 
			
		||||
i2d_pr.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
 | 
			
		||||
i2d_pr.o: ../../include/openssl/symhacks.h ../cryptlib.h i2d_pr.c
 | 
			
		||||
i2d_pu.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
 | 
			
		||||
i2d_pu.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
 | 
			
		||||
i2d_pu.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h
 | 
			
		||||
i2d_pu.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
 | 
			
		||||
i2d_pu.o: ../../include/openssl/err.h ../../include/openssl/evp.h
 | 
			
		||||
i2d_pu.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 | 
			
		||||
i2d_pu.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 | 
			
		||||
i2d_pu.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
i2d_pu.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
 | 
			
		||||
i2d_pu.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 | 
			
		||||
i2d_pu.o: ../cryptlib.h i2d_pu.c
 | 
			
		||||
i2d_pu.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
 | 
			
		||||
i2d_pu.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 | 
			
		||||
i2d_pu.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
 | 
			
		||||
i2d_pu.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rsa.h
 | 
			
		||||
i2d_pu.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
 | 
			
		||||
i2d_pu.o: ../../include/openssl/symhacks.h ../cryptlib.h i2d_pu.c
 | 
			
		||||
n_pkey.o: ../../e_os.h ../../include/openssl/asn1.h
 | 
			
		||||
n_pkey.o: ../../include/openssl/asn1_mac.h ../../include/openssl/asn1t.h
 | 
			
		||||
n_pkey.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
 | 
			
		||||
n_pkey.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
 | 
			
		||||
n_pkey.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
 | 
			
		||||
n_pkey.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
 | 
			
		||||
n_pkey.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
 | 
			
		||||
n_pkey.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 | 
			
		||||
n_pkey.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
 | 
			
		||||
n_pkey.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
 | 
			
		||||
n_pkey.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
 | 
			
		||||
n_pkey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 | 
			
		||||
n_pkey.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
 | 
			
		||||
n_pkey.o: ../../include/openssl/x509_vfy.h ../cryptlib.h n_pkey.c
 | 
			
		||||
n_pkey.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
 | 
			
		||||
n_pkey.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 | 
			
		||||
n_pkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 | 
			
		||||
n_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
n_pkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
 | 
			
		||||
n_pkey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
 | 
			
		||||
n_pkey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 | 
			
		||||
n_pkey.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
 | 
			
		||||
n_pkey.o: ../cryptlib.h n_pkey.c
 | 
			
		||||
nsseq.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
 | 
			
		||||
nsseq.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
 | 
			
		||||
nsseq.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
 | 
			
		||||
nsseq.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
 | 
			
		||||
nsseq.o: ../../include/openssl/ecdsa.h ../../include/openssl/evp.h
 | 
			
		||||
nsseq.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 | 
			
		||||
nsseq.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 | 
			
		||||
nsseq.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
nsseq.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
 | 
			
		||||
nsseq.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 | 
			
		||||
nsseq.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
 | 
			
		||||
nsseq.o: ../../include/openssl/x509_vfy.h nsseq.c
 | 
			
		||||
nsseq.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
 | 
			
		||||
nsseq.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 | 
			
		||||
nsseq.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
 | 
			
		||||
nsseq.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
 | 
			
		||||
nsseq.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
 | 
			
		||||
nsseq.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 | 
			
		||||
nsseq.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h nsseq.c
 | 
			
		||||
p5_pbe.o: ../../e_os.h ../../include/openssl/asn1.h
 | 
			
		||||
p5_pbe.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 | 
			
		||||
p5_pbe.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
 | 
			
		||||
p5_pbe.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
 | 
			
		||||
p5_pbe.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
 | 
			
		||||
p5_pbe.o: ../../include/openssl/err.h ../../include/openssl/evp.h
 | 
			
		||||
p5_pbe.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 | 
			
		||||
p5_pbe.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 | 
			
		||||
p5_pbe.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
p5_pbe.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
 | 
			
		||||
p5_pbe.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
 | 
			
		||||
p5_pbe.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 | 
			
		||||
p5_pbe.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
 | 
			
		||||
p5_pbe.o: ../cryptlib.h p5_pbe.c
 | 
			
		||||
p5_pbe.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
 | 
			
		||||
p5_pbe.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 | 
			
		||||
p5_pbe.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
 | 
			
		||||
p5_pbe.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
 | 
			
		||||
p5_pbe.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
 | 
			
		||||
p5_pbe.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 | 
			
		||||
p5_pbe.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
 | 
			
		||||
p5_pbe.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p5_pbe.c
 | 
			
		||||
p5_pbev2.o: ../../e_os.h ../../include/openssl/asn1.h
 | 
			
		||||
p5_pbev2.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 | 
			
		||||
p5_pbev2.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
 | 
			
		||||
p5_pbev2.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
 | 
			
		||||
p5_pbev2.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
 | 
			
		||||
p5_pbev2.o: ../../include/openssl/err.h ../../include/openssl/evp.h
 | 
			
		||||
p5_pbev2.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 | 
			
		||||
p5_pbev2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 | 
			
		||||
p5_pbev2.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
 | 
			
		||||
p5_pbev2.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 | 
			
		||||
p5_pbev2.o: ../../include/openssl/opensslconf.h
 | 
			
		||||
p5_pbev2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
p5_pbev2.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
 | 
			
		||||
p5_pbev2.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
 | 
			
		||||
@@ -552,48 +538,51 @@ p8_pkey.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
 | 
			
		||||
p8_pkey.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
 | 
			
		||||
p8_pkey.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
 | 
			
		||||
p8_pkey.o: ../../include/openssl/err.h ../../include/openssl/evp.h
 | 
			
		||||
p8_pkey.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 | 
			
		||||
p8_pkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 | 
			
		||||
p8_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
p8_pkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
 | 
			
		||||
p8_pkey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 | 
			
		||||
p8_pkey.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
 | 
			
		||||
p8_pkey.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p8_pkey.c
 | 
			
		||||
p8_pkey.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
 | 
			
		||||
p8_pkey.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 | 
			
		||||
p8_pkey.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
 | 
			
		||||
p8_pkey.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
 | 
			
		||||
p8_pkey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
 | 
			
		||||
p8_pkey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 | 
			
		||||
p8_pkey.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
 | 
			
		||||
p8_pkey.o: ../cryptlib.h p8_pkey.c
 | 
			
		||||
t_bitst.o: ../../e_os.h ../../include/openssl/asn1.h
 | 
			
		||||
t_bitst.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
 | 
			
		||||
t_bitst.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
 | 
			
		||||
t_bitst.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
 | 
			
		||||
t_bitst.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
 | 
			
		||||
t_bitst.o: ../../include/openssl/err.h ../../include/openssl/evp.h
 | 
			
		||||
t_bitst.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 | 
			
		||||
t_bitst.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 | 
			
		||||
t_bitst.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
t_bitst.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
 | 
			
		||||
t_bitst.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 | 
			
		||||
t_bitst.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
 | 
			
		||||
t_bitst.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
 | 
			
		||||
t_bitst.o: ../cryptlib.h t_bitst.c
 | 
			
		||||
t_bitst.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
 | 
			
		||||
t_bitst.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 | 
			
		||||
t_bitst.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
 | 
			
		||||
t_bitst.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
 | 
			
		||||
t_bitst.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
 | 
			
		||||
t_bitst.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 | 
			
		||||
t_bitst.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
 | 
			
		||||
t_bitst.o: ../../include/openssl/x509v3.h ../cryptlib.h t_bitst.c
 | 
			
		||||
t_crl.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
 | 
			
		||||
t_crl.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
 | 
			
		||||
t_crl.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
 | 
			
		||||
t_crl.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
 | 
			
		||||
t_crl.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
 | 
			
		||||
t_crl.o: ../../include/openssl/err.h ../../include/openssl/evp.h
 | 
			
		||||
t_crl.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 | 
			
		||||
t_crl.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 | 
			
		||||
t_crl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
t_crl.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
 | 
			
		||||
t_crl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 | 
			
		||||
t_crl.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
 | 
			
		||||
t_crl.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
 | 
			
		||||
t_crl.o: ../cryptlib.h t_crl.c
 | 
			
		||||
t_crl.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
 | 
			
		||||
t_crl.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 | 
			
		||||
t_crl.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
 | 
			
		||||
t_crl.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
 | 
			
		||||
t_crl.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
 | 
			
		||||
t_crl.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 | 
			
		||||
t_crl.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
 | 
			
		||||
t_crl.o: ../../include/openssl/x509v3.h ../cryptlib.h t_crl.c
 | 
			
		||||
t_pkey.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
 | 
			
		||||
t_pkey.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
 | 
			
		||||
t_pkey.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
 | 
			
		||||
t_pkey.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
 | 
			
		||||
t_pkey.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 | 
			
		||||
t_pkey.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
 | 
			
		||||
t_pkey.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
 | 
			
		||||
t_pkey.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
 | 
			
		||||
t_pkey.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
 | 
			
		||||
t_pkey.o: ../../include/openssl/ec.h ../../include/openssl/err.h
 | 
			
		||||
t_pkey.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 | 
			
		||||
t_pkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 | 
			
		||||
t_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
t_pkey.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
 | 
			
		||||
t_pkey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 | 
			
		||||
t_pkey.o: ../cryptlib.h t_pkey.c
 | 
			
		||||
t_req.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
 | 
			
		||||
@@ -602,57 +591,57 @@ t_req.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
 | 
			
		||||
t_req.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
 | 
			
		||||
t_req.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
 | 
			
		||||
t_req.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
 | 
			
		||||
t_req.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
 | 
			
		||||
t_req.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 | 
			
		||||
t_req.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
 | 
			
		||||
t_req.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
 | 
			
		||||
t_req.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
 | 
			
		||||
t_req.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 | 
			
		||||
t_req.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
 | 
			
		||||
t_req.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
 | 
			
		||||
t_req.o: ../cryptlib.h t_req.c
 | 
			
		||||
t_req.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
 | 
			
		||||
t_req.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 | 
			
		||||
t_req.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 | 
			
		||||
t_req.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
t_req.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
 | 
			
		||||
t_req.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
 | 
			
		||||
t_req.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 | 
			
		||||
t_req.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
 | 
			
		||||
t_req.o: ../../include/openssl/x509v3.h ../cryptlib.h t_req.c
 | 
			
		||||
t_spki.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
 | 
			
		||||
t_spki.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
 | 
			
		||||
t_spki.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h
 | 
			
		||||
t_spki.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
 | 
			
		||||
t_spki.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
 | 
			
		||||
t_spki.o: ../../include/openssl/err.h ../../include/openssl/evp.h
 | 
			
		||||
t_spki.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 | 
			
		||||
t_spki.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 | 
			
		||||
t_spki.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
t_spki.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
 | 
			
		||||
t_spki.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
 | 
			
		||||
t_spki.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 | 
			
		||||
t_spki.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
 | 
			
		||||
t_spki.o: ../cryptlib.h t_spki.c
 | 
			
		||||
t_spki.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
 | 
			
		||||
t_spki.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 | 
			
		||||
t_spki.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
 | 
			
		||||
t_spki.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
 | 
			
		||||
t_spki.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
 | 
			
		||||
t_spki.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 | 
			
		||||
t_spki.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
 | 
			
		||||
t_spki.o: ../../include/openssl/x509_vfy.h ../cryptlib.h t_spki.c
 | 
			
		||||
t_x509.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
 | 
			
		||||
t_x509.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
 | 
			
		||||
t_x509.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
 | 
			
		||||
t_x509.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
 | 
			
		||||
t_x509.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
 | 
			
		||||
t_x509.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
 | 
			
		||||
t_x509.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
 | 
			
		||||
t_x509.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 | 
			
		||||
t_x509.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
 | 
			
		||||
t_x509.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
 | 
			
		||||
t_x509.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
 | 
			
		||||
t_x509.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 | 
			
		||||
t_x509.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
 | 
			
		||||
t_x509.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
 | 
			
		||||
t_x509.o: ../cryptlib.h t_x509.c
 | 
			
		||||
t_x509.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
 | 
			
		||||
t_x509.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 | 
			
		||||
t_x509.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 | 
			
		||||
t_x509.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
t_x509.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
 | 
			
		||||
t_x509.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
 | 
			
		||||
t_x509.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 | 
			
		||||
t_x509.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
 | 
			
		||||
t_x509.o: ../../include/openssl/x509v3.h ../cryptlib.h t_x509.c
 | 
			
		||||
t_x509a.o: ../../e_os.h ../../include/openssl/asn1.h
 | 
			
		||||
t_x509a.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
 | 
			
		||||
t_x509a.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
 | 
			
		||||
t_x509a.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
 | 
			
		||||
t_x509a.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
 | 
			
		||||
t_x509a.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
 | 
			
		||||
t_x509a.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 | 
			
		||||
t_x509a.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
 | 
			
		||||
t_x509a.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
 | 
			
		||||
t_x509a.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
 | 
			
		||||
t_x509a.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 | 
			
		||||
t_x509a.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
 | 
			
		||||
t_x509a.o: ../cryptlib.h t_x509a.c
 | 
			
		||||
t_x509a.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
 | 
			
		||||
t_x509a.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 | 
			
		||||
t_x509a.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 | 
			
		||||
t_x509a.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
t_x509a.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
 | 
			
		||||
t_x509a.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 | 
			
		||||
t_x509a.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
 | 
			
		||||
t_x509a.o: ../../include/openssl/x509_vfy.h ../cryptlib.h t_x509a.c
 | 
			
		||||
tasn_dec.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
 | 
			
		||||
tasn_dec.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
 | 
			
		||||
tasn_dec.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
 | 
			
		||||
@@ -686,21 +675,6 @@ tasn_new.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 | 
			
		||||
tasn_new.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
tasn_new.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
 | 
			
		||||
tasn_new.o: ../../include/openssl/symhacks.h tasn_new.c
 | 
			
		||||
tasn_prn.o: ../../e_os.h ../../include/openssl/asn1.h
 | 
			
		||||
tasn_prn.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 | 
			
		||||
tasn_prn.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
 | 
			
		||||
tasn_prn.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
 | 
			
		||||
tasn_prn.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
 | 
			
		||||
tasn_prn.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
 | 
			
		||||
tasn_prn.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
 | 
			
		||||
tasn_prn.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 | 
			
		||||
tasn_prn.o: ../../include/openssl/opensslconf.h
 | 
			
		||||
tasn_prn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
tasn_prn.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
 | 
			
		||||
tasn_prn.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 | 
			
		||||
tasn_prn.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
 | 
			
		||||
tasn_prn.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
 | 
			
		||||
tasn_prn.o: ../cryptlib.h asn1_locl.h tasn_prn.c
 | 
			
		||||
tasn_typ.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
 | 
			
		||||
tasn_typ.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
 | 
			
		||||
tasn_typ.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
 | 
			
		||||
@@ -720,21 +694,23 @@ x_algor.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
 | 
			
		||||
x_algor.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
 | 
			
		||||
x_algor.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
 | 
			
		||||
x_algor.o: ../../include/openssl/ecdsa.h ../../include/openssl/evp.h
 | 
			
		||||
x_algor.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 | 
			
		||||
x_algor.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 | 
			
		||||
x_algor.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
x_algor.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
 | 
			
		||||
x_algor.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 | 
			
		||||
x_algor.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
 | 
			
		||||
x_algor.o: ../../include/openssl/x509_vfy.h x_algor.c
 | 
			
		||||
x_algor.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
 | 
			
		||||
x_algor.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 | 
			
		||||
x_algor.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
 | 
			
		||||
x_algor.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
 | 
			
		||||
x_algor.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
 | 
			
		||||
x_algor.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 | 
			
		||||
x_algor.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
 | 
			
		||||
x_algor.o: x_algor.c
 | 
			
		||||
x_attrib.o: ../../e_os.h ../../include/openssl/asn1.h
 | 
			
		||||
x_attrib.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 | 
			
		||||
x_attrib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
 | 
			
		||||
x_attrib.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
 | 
			
		||||
x_attrib.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
 | 
			
		||||
x_attrib.o: ../../include/openssl/err.h ../../include/openssl/evp.h
 | 
			
		||||
x_attrib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 | 
			
		||||
x_attrib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 | 
			
		||||
x_attrib.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
 | 
			
		||||
x_attrib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 | 
			
		||||
x_attrib.o: ../../include/openssl/opensslconf.h
 | 
			
		||||
x_attrib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
x_attrib.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
 | 
			
		||||
x_attrib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 | 
			
		||||
@@ -751,42 +727,44 @@ x_bignum.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
 | 
			
		||||
x_bignum.o: ../../include/openssl/symhacks.h ../cryptlib.h x_bignum.c
 | 
			
		||||
x_crl.o: ../../e_os.h ../../include/openssl/asn1.h
 | 
			
		||||
x_crl.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 | 
			
		||||
x_crl.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
 | 
			
		||||
x_crl.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
 | 
			
		||||
x_crl.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
 | 
			
		||||
x_crl.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
 | 
			
		||||
x_crl.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
 | 
			
		||||
x_crl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
 | 
			
		||||
x_crl.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
 | 
			
		||||
x_crl.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
 | 
			
		||||
x_crl.o: ../../include/openssl/err.h ../../include/openssl/evp.h
 | 
			
		||||
x_crl.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
 | 
			
		||||
x_crl.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 | 
			
		||||
x_crl.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
 | 
			
		||||
x_crl.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
 | 
			
		||||
x_crl.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
 | 
			
		||||
x_crl.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 | 
			
		||||
x_crl.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
 | 
			
		||||
x_crl.o: ../../include/openssl/x509v3.h ../cryptlib.h asn1_locl.h x_crl.c
 | 
			
		||||
x_crl.o: ../cryptlib.h x_crl.c
 | 
			
		||||
x_exten.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
 | 
			
		||||
x_exten.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
 | 
			
		||||
x_exten.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
 | 
			
		||||
x_exten.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
 | 
			
		||||
x_exten.o: ../../include/openssl/ecdsa.h ../../include/openssl/evp.h
 | 
			
		||||
x_exten.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 | 
			
		||||
x_exten.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 | 
			
		||||
x_exten.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
x_exten.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
 | 
			
		||||
x_exten.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 | 
			
		||||
x_exten.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
 | 
			
		||||
x_exten.o: ../../include/openssl/x509_vfy.h x_exten.c
 | 
			
		||||
x_exten.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
 | 
			
		||||
x_exten.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 | 
			
		||||
x_exten.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
 | 
			
		||||
x_exten.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
 | 
			
		||||
x_exten.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
 | 
			
		||||
x_exten.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 | 
			
		||||
x_exten.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
 | 
			
		||||
x_exten.o: x_exten.c
 | 
			
		||||
x_info.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
 | 
			
		||||
x_info.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
 | 
			
		||||
x_info.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
 | 
			
		||||
x_info.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
 | 
			
		||||
x_info.o: ../../include/openssl/err.h ../../include/openssl/evp.h
 | 
			
		||||
x_info.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 | 
			
		||||
x_info.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 | 
			
		||||
x_info.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
x_info.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
 | 
			
		||||
x_info.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 | 
			
		||||
x_info.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
 | 
			
		||||
x_info.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_info.c
 | 
			
		||||
x_info.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
 | 
			
		||||
x_info.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 | 
			
		||||
x_info.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
 | 
			
		||||
x_info.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
 | 
			
		||||
x_info.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
 | 
			
		||||
x_info.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 | 
			
		||||
x_info.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
 | 
			
		||||
x_info.o: ../cryptlib.h x_info.c
 | 
			
		||||
x_long.o: ../../e_os.h ../../include/openssl/asn1.h
 | 
			
		||||
x_long.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 | 
			
		||||
x_long.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
 | 
			
		||||
@@ -802,129 +780,125 @@ x_name.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
 | 
			
		||||
x_name.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
 | 
			
		||||
x_name.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
 | 
			
		||||
x_name.o: ../../include/openssl/err.h ../../include/openssl/evp.h
 | 
			
		||||
x_name.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 | 
			
		||||
x_name.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 | 
			
		||||
x_name.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
x_name.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
 | 
			
		||||
x_name.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 | 
			
		||||
x_name.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
 | 
			
		||||
x_name.o: ../../include/openssl/x509_vfy.h ../cryptlib.h asn1_locl.h x_name.c
 | 
			
		||||
x_nx509.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
 | 
			
		||||
x_nx509.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
 | 
			
		||||
x_nx509.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
 | 
			
		||||
x_nx509.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
 | 
			
		||||
x_nx509.o: ../../include/openssl/ecdsa.h ../../include/openssl/evp.h
 | 
			
		||||
x_nx509.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 | 
			
		||||
x_nx509.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 | 
			
		||||
x_nx509.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
x_nx509.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
 | 
			
		||||
x_nx509.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 | 
			
		||||
x_nx509.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
 | 
			
		||||
x_nx509.o: ../../include/openssl/x509_vfy.h x_nx509.c
 | 
			
		||||
x_name.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
 | 
			
		||||
x_name.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 | 
			
		||||
x_name.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
 | 
			
		||||
x_name.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
 | 
			
		||||
x_name.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
 | 
			
		||||
x_name.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 | 
			
		||||
x_name.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
 | 
			
		||||
x_name.o: ../cryptlib.h x_name.c
 | 
			
		||||
x_pkey.o: ../../e_os.h ../../include/openssl/asn1.h
 | 
			
		||||
x_pkey.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
 | 
			
		||||
x_pkey.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
 | 
			
		||||
x_pkey.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
 | 
			
		||||
x_pkey.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
 | 
			
		||||
x_pkey.o: ../../include/openssl/err.h ../../include/openssl/evp.h
 | 
			
		||||
x_pkey.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 | 
			
		||||
x_pkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 | 
			
		||||
x_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
x_pkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
 | 
			
		||||
x_pkey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 | 
			
		||||
x_pkey.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
 | 
			
		||||
x_pkey.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_pkey.c
 | 
			
		||||
x_pkey.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
 | 
			
		||||
x_pkey.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 | 
			
		||||
x_pkey.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
 | 
			
		||||
x_pkey.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
 | 
			
		||||
x_pkey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
 | 
			
		||||
x_pkey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 | 
			
		||||
x_pkey.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
 | 
			
		||||
x_pkey.o: ../cryptlib.h x_pkey.c
 | 
			
		||||
x_pubkey.o: ../../e_os.h ../../include/openssl/asn1.h
 | 
			
		||||
x_pubkey.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 | 
			
		||||
x_pubkey.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
 | 
			
		||||
x_pubkey.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
 | 
			
		||||
x_pubkey.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
 | 
			
		||||
x_pubkey.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
 | 
			
		||||
x_pubkey.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
 | 
			
		||||
x_pubkey.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 | 
			
		||||
x_pubkey.o: ../../include/openssl/opensslconf.h
 | 
			
		||||
x_pubkey.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
 | 
			
		||||
x_pubkey.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 | 
			
		||||
x_pubkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 | 
			
		||||
x_pubkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
x_pubkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
 | 
			
		||||
x_pubkey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
 | 
			
		||||
x_pubkey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 | 
			
		||||
x_pubkey.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
 | 
			
		||||
x_pubkey.o: ../cryptlib.h asn1_locl.h x_pubkey.c
 | 
			
		||||
x_pubkey.o: ../cryptlib.h x_pubkey.c
 | 
			
		||||
x_req.o: ../../e_os.h ../../include/openssl/asn1.h
 | 
			
		||||
x_req.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 | 
			
		||||
x_req.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
 | 
			
		||||
x_req.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
 | 
			
		||||
x_req.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
 | 
			
		||||
x_req.o: ../../include/openssl/err.h ../../include/openssl/evp.h
 | 
			
		||||
x_req.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 | 
			
		||||
x_req.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 | 
			
		||||
x_req.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
x_req.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
 | 
			
		||||
x_req.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 | 
			
		||||
x_req.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
 | 
			
		||||
x_req.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_req.c
 | 
			
		||||
x_req.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
 | 
			
		||||
x_req.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 | 
			
		||||
x_req.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
 | 
			
		||||
x_req.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
 | 
			
		||||
x_req.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
 | 
			
		||||
x_req.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 | 
			
		||||
x_req.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
 | 
			
		||||
x_req.o: ../cryptlib.h x_req.c
 | 
			
		||||
x_sig.o: ../../e_os.h ../../include/openssl/asn1.h
 | 
			
		||||
x_sig.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 | 
			
		||||
x_sig.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
 | 
			
		||||
x_sig.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
 | 
			
		||||
x_sig.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
 | 
			
		||||
x_sig.o: ../../include/openssl/err.h ../../include/openssl/evp.h
 | 
			
		||||
x_sig.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 | 
			
		||||
x_sig.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 | 
			
		||||
x_sig.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
x_sig.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
 | 
			
		||||
x_sig.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 | 
			
		||||
x_sig.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
 | 
			
		||||
x_sig.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_sig.c
 | 
			
		||||
x_sig.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
 | 
			
		||||
x_sig.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 | 
			
		||||
x_sig.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
 | 
			
		||||
x_sig.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
 | 
			
		||||
x_sig.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
 | 
			
		||||
x_sig.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 | 
			
		||||
x_sig.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
 | 
			
		||||
x_sig.o: ../cryptlib.h x_sig.c
 | 
			
		||||
x_spki.o: ../../e_os.h ../../include/openssl/asn1.h
 | 
			
		||||
x_spki.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 | 
			
		||||
x_spki.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
 | 
			
		||||
x_spki.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
 | 
			
		||||
x_spki.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
 | 
			
		||||
x_spki.o: ../../include/openssl/err.h ../../include/openssl/evp.h
 | 
			
		||||
x_spki.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 | 
			
		||||
x_spki.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 | 
			
		||||
x_spki.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
x_spki.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
 | 
			
		||||
x_spki.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 | 
			
		||||
x_spki.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
 | 
			
		||||
x_spki.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_spki.c
 | 
			
		||||
x_spki.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
 | 
			
		||||
x_spki.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 | 
			
		||||
x_spki.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
 | 
			
		||||
x_spki.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
 | 
			
		||||
x_spki.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
 | 
			
		||||
x_spki.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 | 
			
		||||
x_spki.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
 | 
			
		||||
x_spki.o: ../cryptlib.h x_spki.c
 | 
			
		||||
x_val.o: ../../e_os.h ../../include/openssl/asn1.h
 | 
			
		||||
x_val.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 | 
			
		||||
x_val.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
 | 
			
		||||
x_val.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
 | 
			
		||||
x_val.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
 | 
			
		||||
x_val.o: ../../include/openssl/err.h ../../include/openssl/evp.h
 | 
			
		||||
x_val.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 | 
			
		||||
x_val.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 | 
			
		||||
x_val.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
x_val.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
 | 
			
		||||
x_val.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 | 
			
		||||
x_val.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
 | 
			
		||||
x_val.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_val.c
 | 
			
		||||
x_val.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
 | 
			
		||||
x_val.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 | 
			
		||||
x_val.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
 | 
			
		||||
x_val.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
 | 
			
		||||
x_val.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
 | 
			
		||||
x_val.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 | 
			
		||||
x_val.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
 | 
			
		||||
x_val.o: ../cryptlib.h x_val.c
 | 
			
		||||
x_x509.o: ../../e_os.h ../../include/openssl/asn1.h
 | 
			
		||||
x_x509.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 | 
			
		||||
x_x509.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
 | 
			
		||||
x_x509.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
 | 
			
		||||
x_x509.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
 | 
			
		||||
x_x509.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
 | 
			
		||||
x_x509.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
 | 
			
		||||
x_x509.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 | 
			
		||||
x_x509.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
 | 
			
		||||
x_x509.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
 | 
			
		||||
x_x509.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
 | 
			
		||||
x_x509.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 | 
			
		||||
x_x509.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
 | 
			
		||||
x_x509.o: ../../include/openssl/x509v3.h ../cryptlib.h x_x509.c
 | 
			
		||||
x_x509.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
 | 
			
		||||
x_x509.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 | 
			
		||||
x_x509.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 | 
			
		||||
x_x509.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
x_x509.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
 | 
			
		||||
x_x509.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 | 
			
		||||
x_x509.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
 | 
			
		||||
x_x509.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
 | 
			
		||||
x_x509.o: ../cryptlib.h x_x509.c
 | 
			
		||||
x_x509a.o: ../../e_os.h ../../include/openssl/asn1.h
 | 
			
		||||
x_x509a.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
 | 
			
		||||
x_x509a.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
 | 
			
		||||
x_x509a.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
 | 
			
		||||
x_x509a.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
 | 
			
		||||
x_x509a.o: ../../include/openssl/err.h ../../include/openssl/evp.h
 | 
			
		||||
x_x509a.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
 | 
			
		||||
x_x509a.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
 | 
			
		||||
x_x509a.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 | 
			
		||||
x_x509a.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
 | 
			
		||||
x_x509a.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
 | 
			
		||||
x_x509a.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
 | 
			
		||||
x_x509a.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_x509a.c
 | 
			
		||||
x_x509a.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
 | 
			
		||||
x_x509a.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
 | 
			
		||||
x_x509a.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
 | 
			
		||||
x_x509a.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
 | 
			
		||||
x_x509a.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
 | 
			
		||||
x_x509a.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 | 
			
		||||
x_x509a.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
 | 
			
		||||
x_x509a.o: ../cryptlib.h x_x509a.c
 | 
			
		||||
 
 | 
			
		||||
@@ -223,26 +223,3 @@ int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n)
 | 
			
		||||
	return((a->data[w]&v) != 0);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Checks if the given bit string contains only bits specified by 
 | 
			
		||||
 * the flags vector. Returns 0 if there is at least one bit set in 'a'
 | 
			
		||||
 * which is not specified in 'flags', 1 otherwise.
 | 
			
		||||
 * 'len' is the length of 'flags'.
 | 
			
		||||
 */
 | 
			
		||||
int ASN1_BIT_STRING_check(ASN1_BIT_STRING *a,
 | 
			
		||||
			  unsigned char *flags, int flags_len)
 | 
			
		||||
	{
 | 
			
		||||
	int i, ok;
 | 
			
		||||
	/* Check if there is one bit set at all. */
 | 
			
		||||
	if (!a || !a->data) return 1;
 | 
			
		||||
 | 
			
		||||
	/* Check each byte of the internal representation of the bit string. */
 | 
			
		||||
	ok = 1;
 | 
			
		||||
	for (i = 0; i < a->length && ok; ++i)
 | 
			
		||||
		{
 | 
			
		||||
		unsigned char mask = i < flags_len ? ~flags[i] : 0xff;
 | 
			
		||||
		/* We are done if there is an unneeded bit set. */
 | 
			
		||||
		ok = (a->data[i] & mask) == 0;
 | 
			
		||||
		}
 | 
			
		||||
	return ok;
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -117,8 +117,8 @@ err:
 | 
			
		||||
 | 
			
		||||
int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *d)
 | 
			
		||||
	{
 | 
			
		||||
	static const int min[9]={ 0, 0, 1, 1, 0, 0, 0, 0, 0};
 | 
			
		||||
	static const int max[9]={99, 99,12,31,23,59,59,12,59};
 | 
			
		||||
	static int min[9]={ 0, 0, 1, 1, 0, 0, 0, 0, 0};
 | 
			
		||||
	static int max[9]={99, 99,12,31,23,59,59,12,59};
 | 
			
		||||
	char *a;
 | 
			
		||||
	int n,i,l,o;
 | 
			
		||||
 | 
			
		||||
@@ -176,11 +176,6 @@ int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *d)
 | 
			
		||||
			o++;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		/* Missing time zone information. */
 | 
			
		||||
		goto err;
 | 
			
		||||
		}
 | 
			
		||||
	return(o == l);
 | 
			
		||||
err:
 | 
			
		||||
	return(0);
 | 
			
		||||
@@ -210,12 +205,6 @@ int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str)
 | 
			
		||||
 | 
			
		||||
ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,
 | 
			
		||||
	     time_t t)
 | 
			
		||||
	{
 | 
			
		||||
		return ASN1_GENERALIZEDTIME_adj(s, t, 0, 0);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s,
 | 
			
		||||
	     time_t t, int offset_day, long offset_sec)
 | 
			
		||||
	{
 | 
			
		||||
	char *p;
 | 
			
		||||
	struct tm *ts;
 | 
			
		||||
@@ -231,12 +220,6 @@ ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s,
 | 
			
		||||
	if (ts == NULL)
 | 
			
		||||
		return(NULL);
 | 
			
		||||
 | 
			
		||||
	if (offset_day || offset_sec)
 | 
			
		||||
		{ 
 | 
			
		||||
		if (!OPENSSL_gmtime_adj(ts, offset_day, offset_sec))
 | 
			
		||||
			return NULL;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	p=(char *)s->data;
 | 
			
		||||
	if ((p == NULL) || ((size_t)s->length < len))
 | 
			
		||||
		{
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										119
									
								
								crypto/asn1/a_hdr.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										119
									
								
								crypto/asn1/a_hdr.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,119 @@
 | 
			
		||||
/* crypto/asn1/a_hdr.c */
 | 
			
		||||
/* 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.]
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include "cryptlib.h"
 | 
			
		||||
#include <openssl/asn1_mac.h>
 | 
			
		||||
#include <openssl/asn1.h>
 | 
			
		||||
 | 
			
		||||
int i2d_ASN1_HEADER(ASN1_HEADER *a, unsigned char **pp)
 | 
			
		||||
	{
 | 
			
		||||
	M_ASN1_I2D_vars(a);
 | 
			
		||||
 | 
			
		||||
	M_ASN1_I2D_len(a->header,	i2d_ASN1_OCTET_STRING);
 | 
			
		||||
	M_ASN1_I2D_len(a->data,		a->meth->i2d);
 | 
			
		||||
 | 
			
		||||
	M_ASN1_I2D_seq_total();
 | 
			
		||||
 | 
			
		||||
	M_ASN1_I2D_put(a->header,	i2d_ASN1_OCTET_STRING);
 | 
			
		||||
	M_ASN1_I2D_put(a->data,		a->meth->i2d);
 | 
			
		||||
 | 
			
		||||
	M_ASN1_I2D_finish();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
ASN1_HEADER *d2i_ASN1_HEADER(ASN1_HEADER **a, const unsigned char **pp,
 | 
			
		||||
	     long length)
 | 
			
		||||
	{
 | 
			
		||||
	M_ASN1_D2I_vars(a,ASN1_HEADER *,ASN1_HEADER_new);
 | 
			
		||||
 | 
			
		||||
	M_ASN1_D2I_Init();
 | 
			
		||||
        M_ASN1_D2I_start_sequence();
 | 
			
		||||
        M_ASN1_D2I_get_x(ASN1_OCTET_STRING,ret->header,d2i_ASN1_OCTET_STRING);
 | 
			
		||||
	if (ret->meth != NULL)
 | 
			
		||||
		{
 | 
			
		||||
		M_ASN1_D2I_get_x(void,ret->data,ret->meth->d2i);
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		if (a != NULL) (*a)=ret;
 | 
			
		||||
		return(ret);
 | 
			
		||||
		}
 | 
			
		||||
        M_ASN1_D2I_Finish(a,ASN1_HEADER_free,ASN1_F_D2I_ASN1_HEADER);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
ASN1_HEADER *ASN1_HEADER_new(void)
 | 
			
		||||
	{
 | 
			
		||||
	ASN1_HEADER *ret=NULL;
 | 
			
		||||
	ASN1_CTX c;
 | 
			
		||||
 | 
			
		||||
	M_ASN1_New_Malloc(ret,ASN1_HEADER);
 | 
			
		||||
	M_ASN1_New(ret->header,M_ASN1_OCTET_STRING_new);
 | 
			
		||||
	ret->meth=NULL;
 | 
			
		||||
	ret->data=NULL;
 | 
			
		||||
	return(ret);
 | 
			
		||||
        M_ASN1_New_Error(ASN1_F_ASN1_HEADER_NEW);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
void ASN1_HEADER_free(ASN1_HEADER *a)
 | 
			
		||||
	{
 | 
			
		||||
	if (a == NULL) return;
 | 
			
		||||
	M_ASN1_OCTET_STRING_free(a->header);
 | 
			
		||||
	if (a->meth != NULL)
 | 
			
		||||
		a->meth->destroy(a->data);
 | 
			
		||||
	OPENSSL_free(a);
 | 
			
		||||
	}
 | 
			
		||||
@@ -61,10 +61,10 @@
 | 
			
		||||
#include <openssl/asn1.h>
 | 
			
		||||
#include <openssl/bn.h>
 | 
			
		||||
 | 
			
		||||
ASN1_INTEGER *ASN1_INTEGER_dup(const ASN1_INTEGER *x)
 | 
			
		||||
ASN1_INTEGER *ASN1_INTEGER_dup(ASN1_INTEGER *x)
 | 
			
		||||
{ return M_ASN1_INTEGER_dup(x);}
 | 
			
		||||
 | 
			
		||||
int ASN1_INTEGER_cmp(const ASN1_INTEGER *x, const ASN1_INTEGER *y)
 | 
			
		||||
int ASN1_INTEGER_cmp(ASN1_INTEGER *x, ASN1_INTEGER *y)
 | 
			
		||||
	{ 
 | 
			
		||||
	int neg, ret;
 | 
			
		||||
	/* Compare signs */
 | 
			
		||||
@@ -373,7 +373,7 @@ int ASN1_INTEGER_set(ASN1_INTEGER *a, long v)
 | 
			
		||||
	return(1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
long ASN1_INTEGER_get(const ASN1_INTEGER *a)
 | 
			
		||||
long ASN1_INTEGER_get(ASN1_INTEGER *a)
 | 
			
		||||
	{
 | 
			
		||||
	int neg=0,i;
 | 
			
		||||
	long r=0;
 | 
			
		||||
@@ -402,7 +402,7 @@ long ASN1_INTEGER_get(const ASN1_INTEGER *a)
 | 
			
		||||
	return(r);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai)
 | 
			
		||||
ASN1_INTEGER *BN_to_ASN1_INTEGER(BIGNUM *bn, ASN1_INTEGER *ai)
 | 
			
		||||
	{
 | 
			
		||||
	ASN1_INTEGER *ret;
 | 
			
		||||
	int len,j;
 | 
			
		||||
@@ -444,7 +444,7 @@ err:
 | 
			
		||||
	return(NULL);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
BIGNUM *ASN1_INTEGER_to_BN(const ASN1_INTEGER *ai, BIGNUM *bn)
 | 
			
		||||
BIGNUM *ASN1_INTEGER_to_BN(ASN1_INTEGER *ai, BIGNUM *bn)
 | 
			
		||||
	{
 | 
			
		||||
	BIGNUM *ret;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										84
									
								
								crypto/asn1/a_meth.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										84
									
								
								crypto/asn1/a_meth.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,84 @@
 | 
			
		||||
/* crypto/asn1/a_meth.c */
 | 
			
		||||
/* 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.]
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include "cryptlib.h"
 | 
			
		||||
#include <openssl/buffer.h>
 | 
			
		||||
#include <openssl/asn1.h>
 | 
			
		||||
 | 
			
		||||
static  ASN1_METHOD ia5string_meth={
 | 
			
		||||
	(I2D_OF(void))	i2d_ASN1_IA5STRING,
 | 
			
		||||
	(D2I_OF(void))	d2i_ASN1_IA5STRING,
 | 
			
		||||
	(void *(*)(void))ASN1_STRING_new,
 | 
			
		||||
	(void (*)(void *))ASN1_STRING_free};
 | 
			
		||||
 | 
			
		||||
static  ASN1_METHOD bit_string_meth={
 | 
			
		||||
	(I2D_OF(void))	i2d_ASN1_BIT_STRING,
 | 
			
		||||
	(D2I_OF(void))	d2i_ASN1_BIT_STRING,
 | 
			
		||||
	(void *(*)(void))ASN1_STRING_new,
 | 
			
		||||
	(void (*)(void *))ASN1_STRING_free};
 | 
			
		||||
 | 
			
		||||
ASN1_METHOD *ASN1_IA5STRING_asn1_meth(void)
 | 
			
		||||
	{
 | 
			
		||||
	return(&ia5string_meth);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
ASN1_METHOD *ASN1_BIT_STRING_asn1_meth(void)
 | 
			
		||||
	{
 | 
			
		||||
	return(&bit_string_meth);
 | 
			
		||||
	}
 | 
			
		||||
@@ -281,6 +281,8 @@ ASN1_OBJECT *d2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
 | 
			
		||||
	return ret;
 | 
			
		||||
err:
 | 
			
		||||
	ASN1err(ASN1_F_D2I_ASN1_OBJECT,i);
 | 
			
		||||
	if ((ret != NULL) && ((a == NULL) || (*a != ret)))
 | 
			
		||||
		ASN1_OBJECT_free(ret);
 | 
			
		||||
	return(NULL);
 | 
			
		||||
}
 | 
			
		||||
ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
 | 
			
		||||
@@ -288,7 +290,6 @@ ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
 | 
			
		||||
	{
 | 
			
		||||
	ASN1_OBJECT *ret=NULL;
 | 
			
		||||
	const unsigned char *p;
 | 
			
		||||
	unsigned char *data;
 | 
			
		||||
	int i;
 | 
			
		||||
 | 
			
		||||
	/* only the ASN1_OBJECTs from the 'table' will have values
 | 
			
		||||
@@ -301,22 +302,15 @@ ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
 | 
			
		||||
	else	ret=(*a);
 | 
			
		||||
 | 
			
		||||
	p= *pp;
 | 
			
		||||
	/* detach data from object */
 | 
			
		||||
	data = (unsigned char *)ret->data;
 | 
			
		||||
	ret->data = NULL;
 | 
			
		||||
	/* once detached we can change it */
 | 
			
		||||
	if ((data == NULL) || (ret->length < len))
 | 
			
		||||
	if ((ret->data == NULL) || (ret->length < len))
 | 
			
		||||
		{
 | 
			
		||||
		ret->length=0;
 | 
			
		||||
		if (data != NULL) OPENSSL_free(data);
 | 
			
		||||
		data=(unsigned char *)OPENSSL_malloc(len ? (int)len : 1);
 | 
			
		||||
		if (data == NULL)
 | 
			
		||||
			{ i=ERR_R_MALLOC_FAILURE; goto err; }
 | 
			
		||||
		if (ret->data != NULL) OPENSSL_free(ret->data);
 | 
			
		||||
		ret->data=(unsigned char *)OPENSSL_malloc(len ? (int)len : 1);
 | 
			
		||||
		ret->flags|=ASN1_OBJECT_FLAG_DYNAMIC_DATA;
 | 
			
		||||
		if (ret->data == NULL)
 | 
			
		||||
			{ i=ERR_R_MALLOC_FAILURE; goto err; }
 | 
			
		||||
		}
 | 
			
		||||
	memcpy(data,p,(int)len);
 | 
			
		||||
	/* reattach data to object, after which it remains const */
 | 
			
		||||
	ret->data  =data;
 | 
			
		||||
	memcpy(ret->data,p,(int)len);
 | 
			
		||||
	ret->length=(int)len;
 | 
			
		||||
	ret->sn=NULL;
 | 
			
		||||
	ret->ln=NULL;
 | 
			
		||||
@@ -365,7 +359,7 @@ void ASN1_OBJECT_free(ASN1_OBJECT *a)
 | 
			
		||||
		}
 | 
			
		||||
	if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC_DATA)
 | 
			
		||||
		{
 | 
			
		||||
		if (a->data != NULL) OPENSSL_free((void *)a->data);
 | 
			
		||||
		if (a->data != NULL) OPENSSL_free(a->data);
 | 
			
		||||
		a->data=NULL;
 | 
			
		||||
		a->length=0;
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
@@ -60,10 +60,10 @@
 | 
			
		||||
#include "cryptlib.h"
 | 
			
		||||
#include <openssl/asn1.h>
 | 
			
		||||
 | 
			
		||||
ASN1_OCTET_STRING *ASN1_OCTET_STRING_dup(const ASN1_OCTET_STRING *x)
 | 
			
		||||
ASN1_OCTET_STRING *ASN1_OCTET_STRING_dup(ASN1_OCTET_STRING *x)
 | 
			
		||||
{ return M_ASN1_OCTET_STRING_dup(x); }
 | 
			
		||||
 | 
			
		||||
int ASN1_OCTET_STRING_cmp(const ASN1_OCTET_STRING *a, const ASN1_OCTET_STRING *b)
 | 
			
		||||
int ASN1_OCTET_STRING_cmp(ASN1_OCTET_STRING *a, ASN1_OCTET_STRING *b)
 | 
			
		||||
{ return M_ASN1_OCTET_STRING_cmp(a, b); }
 | 
			
		||||
 | 
			
		||||
int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *x, const unsigned char *d, int len)
 | 
			
		||||
 
 | 
			
		||||
@@ -85,9 +85,8 @@ static int SetBlobCmp(const void *elem1, const void *elem2 )
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
/* int is_set:  if TRUE, then sort the contents (i.e. it isn't a SEQUENCE)    */
 | 
			
		||||
int i2d_ASN1_SET(STACK_OF(BLOCK) *a, unsigned char **pp,
 | 
			
		||||
		 i2d_of_void *i2d, int ex_tag, int ex_class,
 | 
			
		||||
		 int is_set)
 | 
			
		||||
int i2d_ASN1_SET(STACK *a, unsigned char **pp, i2d_of_void *i2d, int ex_tag,
 | 
			
		||||
		 int ex_class, int is_set)
 | 
			
		||||
	{
 | 
			
		||||
	int ret=0,r;
 | 
			
		||||
	int i;
 | 
			
		||||
@@ -97,8 +96,8 @@ int i2d_ASN1_SET(STACK_OF(BLOCK) *a, unsigned char **pp,
 | 
			
		||||
        int totSize;
 | 
			
		||||
 | 
			
		||||
	if (a == NULL) return(0);
 | 
			
		||||
	for (i=sk_BLOCK_num(a)-1; i>=0; i--)
 | 
			
		||||
		ret+=i2d(sk_BLOCK_value(a,i),NULL);
 | 
			
		||||
	for (i=sk_num(a)-1; i>=0; i--)
 | 
			
		||||
		ret+=i2d(sk_value(a,i),NULL);
 | 
			
		||||
	r=ASN1_object_size(1,ret,ex_tag);
 | 
			
		||||
	if (pp == NULL) return(r);
 | 
			
		||||
 | 
			
		||||
@@ -109,10 +108,10 @@ int i2d_ASN1_SET(STACK_OF(BLOCK) *a, unsigned char **pp,
 | 
			
		||||
	/* And then again by Ben */
 | 
			
		||||
	/* And again by Steve */
 | 
			
		||||
 | 
			
		||||
	if(!is_set || (sk_BLOCK_num(a) < 2))
 | 
			
		||||
	if(!is_set || (sk_num(a) < 2))
 | 
			
		||||
		{
 | 
			
		||||
		for (i=0; i<sk_BLOCK_num(a); i++)
 | 
			
		||||
                	i2d(sk_BLOCK_value(a,i),&p);
 | 
			
		||||
		for (i=0; i<sk_num(a); i++)
 | 
			
		||||
                	i2d(sk_value(a,i),&p);
 | 
			
		||||
 | 
			
		||||
		*pp=p;
 | 
			
		||||
		return(r);
 | 
			
		||||
@@ -120,17 +119,17 @@ int i2d_ASN1_SET(STACK_OF(BLOCK) *a, unsigned char **pp,
 | 
			
		||||
 | 
			
		||||
        pStart  = p; /* Catch the beg of Setblobs*/
 | 
			
		||||
		/* In this array we will store the SET blobs */
 | 
			
		||||
		rgSetBlob = OPENSSL_malloc(sk_BLOCK_num(a) * sizeof(MYBLOB));
 | 
			
		||||
		rgSetBlob = (MYBLOB *)OPENSSL_malloc(sk_num(a) * sizeof(MYBLOB));
 | 
			
		||||
		if (rgSetBlob == NULL)
 | 
			
		||||
			{
 | 
			
		||||
			ASN1err(ASN1_F_I2D_ASN1_SET,ERR_R_MALLOC_FAILURE);
 | 
			
		||||
			return(0);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
        for (i=0; i<sk_BLOCK_num(a); i++)
 | 
			
		||||
        for (i=0; i<sk_num(a); i++)
 | 
			
		||||
	        {
 | 
			
		||||
                rgSetBlob[i].pbData = p;  /* catch each set encode blob */
 | 
			
		||||
                i2d(sk_BLOCK_value(a,i),&p);
 | 
			
		||||
                i2d(sk_value(a,i),&p);
 | 
			
		||||
                rgSetBlob[i].cbData = p - rgSetBlob[i].pbData; /* Length of this
 | 
			
		||||
SetBlob
 | 
			
		||||
*/
 | 
			
		||||
@@ -140,7 +139,7 @@ SetBlob
 | 
			
		||||
 | 
			
		||||
 /* 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*/
 | 
			
		||||
        qsort( rgSetBlob, sk_BLOCK_num(a), sizeof(MYBLOB), SetBlobCmp);
 | 
			
		||||
        qsort( rgSetBlob, sk_num(a), sizeof(MYBLOB), SetBlobCmp);
 | 
			
		||||
		if (!(pTempMem = OPENSSL_malloc(totSize)))
 | 
			
		||||
			{
 | 
			
		||||
			ASN1err(ASN1_F_I2D_ASN1_SET,ERR_R_MALLOC_FAILURE);
 | 
			
		||||
@@ -149,7 +148,7 @@ SetBlob
 | 
			
		||||
 | 
			
		||||
/* Copy to temp mem */
 | 
			
		||||
        p = pTempMem;
 | 
			
		||||
        for(i=0; i<sk_BLOCK_num(a); ++i)
 | 
			
		||||
        for(i=0; i<sk_num(a); ++i)
 | 
			
		||||
		{
 | 
			
		||||
                memcpy(p, rgSetBlob[i].pbData, rgSetBlob[i].cbData);
 | 
			
		||||
                p += rgSetBlob[i].cbData;
 | 
			
		||||
@@ -163,17 +162,16 @@ SetBlob
 | 
			
		||||
        return(r);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
STACK_OF(BLOCK) *d2i_ASN1_SET(STACK_OF(BLOCK) **a, const unsigned char **pp,
 | 
			
		||||
			      long length, d2i_of_void *d2i,
 | 
			
		||||
			      void (*free_func)(BLOCK), int ex_tag,
 | 
			
		||||
			      int ex_class)
 | 
			
		||||
STACK *d2i_ASN1_SET(STACK **a, const unsigned char **pp, long length,
 | 
			
		||||
		    d2i_of_void *d2i, void (*free_func)(void *), int ex_tag,
 | 
			
		||||
		    int ex_class)
 | 
			
		||||
	{
 | 
			
		||||
	ASN1_const_CTX c;
 | 
			
		||||
	STACK_OF(BLOCK) *ret=NULL;
 | 
			
		||||
	STACK *ret=NULL;
 | 
			
		||||
 | 
			
		||||
	if ((a == NULL) || ((*a) == NULL))
 | 
			
		||||
		{
 | 
			
		||||
		if ((ret=sk_BLOCK_new_null()) == NULL)
 | 
			
		||||
		if ((ret=sk_new_null()) == NULL)
 | 
			
		||||
			{
 | 
			
		||||
			ASN1err(ASN1_F_D2I_ASN1_SET,ERR_R_MALLOC_FAILURE);
 | 
			
		||||
			goto err;
 | 
			
		||||
@@ -218,10 +216,10 @@ STACK_OF(BLOCK) *d2i_ASN1_SET(STACK_OF(BLOCK) **a, const unsigned char **pp,
 | 
			
		||||
		if ((s=d2i(NULL,&c.p,c.slen)) == NULL)
 | 
			
		||||
			{
 | 
			
		||||
			ASN1err(ASN1_F_D2I_ASN1_SET,ASN1_R_ERROR_PARSING_SET_ELEMENT);
 | 
			
		||||
			asn1_add_error(*pp,(int)(c.p- *pp));
 | 
			
		||||
			asn1_add_error(*pp,(int)(c.q- *pp));
 | 
			
		||||
			goto err;
 | 
			
		||||
			}
 | 
			
		||||
		if (!sk_BLOCK_push(ret,s)) goto err;
 | 
			
		||||
		if (!sk_push(ret,s)) goto err;
 | 
			
		||||
		}
 | 
			
		||||
	if (a != NULL) (*a)=ret;
 | 
			
		||||
	*pp=c.p;
 | 
			
		||||
@@ -230,9 +228,9 @@ err:
 | 
			
		||||
	if ((ret != NULL) && ((a == NULL) || (*a != ret)))
 | 
			
		||||
		{
 | 
			
		||||
		if (free_func != NULL)
 | 
			
		||||
			sk_BLOCK_pop_free(ret,free_func);
 | 
			
		||||
			sk_pop_free(ret,free_func);
 | 
			
		||||
		else
 | 
			
		||||
			sk_BLOCK_free(ret);
 | 
			
		||||
			sk_free(ret);
 | 
			
		||||
		}
 | 
			
		||||
	return(NULL);
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -123,7 +123,6 @@
 | 
			
		||||
#include <openssl/x509.h>
 | 
			
		||||
#include <openssl/objects.h>
 | 
			
		||||
#include <openssl/buffer.h>
 | 
			
		||||
#include "asn1_locl.h"
 | 
			
		||||
 | 
			
		||||
#ifndef NO_ASN1_OLD
 | 
			
		||||
 | 
			
		||||
@@ -219,47 +218,45 @@ int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,
 | 
			
		||||
	{
 | 
			
		||||
	EVP_MD_CTX ctx;
 | 
			
		||||
	unsigned char *buf_in=NULL,*buf_out=NULL;
 | 
			
		||||
	int inl=0,outl=0,outll=0;
 | 
			
		||||
	int signid, paramtype;
 | 
			
		||||
 | 
			
		||||
	if (type == NULL)
 | 
			
		||||
		{
 | 
			
		||||
		int def_nid;
 | 
			
		||||
		if (EVP_PKEY_get_default_digest_nid(pkey, &def_nid) > 0)
 | 
			
		||||
			type = EVP_get_digestbynid(def_nid);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (type == NULL)
 | 
			
		||||
		{
 | 
			
		||||
		ASN1err(ASN1_F_ASN1_ITEM_SIGN, ASN1_R_NO_DEFAULT_DIGEST);
 | 
			
		||||
		return 0;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (type->flags & EVP_MD_FLAG_PKEY_METHOD_SIGNATURE)
 | 
			
		||||
		{
 | 
			
		||||
		if (!pkey->ameth ||
 | 
			
		||||
			!OBJ_find_sigid_by_algs(&signid, EVP_MD_nid(type),
 | 
			
		||||
						pkey->ameth->pkey_id))
 | 
			
		||||
			{
 | 
			
		||||
			ASN1err(ASN1_F_ASN1_ITEM_SIGN,
 | 
			
		||||
				ASN1_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED);
 | 
			
		||||
			return 0;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
		signid = type->pkey_type;
 | 
			
		||||
 | 
			
		||||
	if (pkey->ameth->pkey_flags & ASN1_PKEY_SIGPARAM_NULL)
 | 
			
		||||
		paramtype = V_ASN1_NULL;
 | 
			
		||||
	else
 | 
			
		||||
		paramtype = V_ASN1_UNDEF;
 | 
			
		||||
 | 
			
		||||
	if (algor1)
 | 
			
		||||
		X509_ALGOR_set0(algor1, OBJ_nid2obj(signid), paramtype, NULL);
 | 
			
		||||
	if (algor2)
 | 
			
		||||
		X509_ALGOR_set0(algor2, OBJ_nid2obj(signid), paramtype, NULL);
 | 
			
		||||
	int i,inl=0,outl=0,outll=0;
 | 
			
		||||
	X509_ALGOR *a;
 | 
			
		||||
 | 
			
		||||
	EVP_MD_CTX_init(&ctx);
 | 
			
		||||
	for (i=0; i<2; i++)
 | 
			
		||||
		{
 | 
			
		||||
		if (i == 0)
 | 
			
		||||
			a=algor1;
 | 
			
		||||
		else
 | 
			
		||||
			a=algor2;
 | 
			
		||||
		if (a == NULL) continue;
 | 
			
		||||
                if (type->pkey_type == NID_dsaWithSHA1 ||
 | 
			
		||||
			type->pkey_type == NID_ecdsa_with_SHA1)
 | 
			
		||||
			{
 | 
			
		||||
			/* special case: RFC 3279 tells us to omit 'parameters'
 | 
			
		||||
			 * with id-dsa-with-sha1 and ecdsa-with-SHA1 */
 | 
			
		||||
			ASN1_TYPE_free(a->parameter);
 | 
			
		||||
			a->parameter = NULL;
 | 
			
		||||
			}
 | 
			
		||||
		else if ((a->parameter == NULL) || 
 | 
			
		||||
			(a->parameter->type != V_ASN1_NULL))
 | 
			
		||||
			{
 | 
			
		||||
			ASN1_TYPE_free(a->parameter);
 | 
			
		||||
			if ((a->parameter=ASN1_TYPE_new()) == NULL) goto err;
 | 
			
		||||
			a->parameter->type=V_ASN1_NULL;
 | 
			
		||||
			}
 | 
			
		||||
		ASN1_OBJECT_free(a->algorithm);
 | 
			
		||||
		a->algorithm=OBJ_nid2obj(type->pkey_type);
 | 
			
		||||
		if (a->algorithm == NULL)
 | 
			
		||||
			{
 | 
			
		||||
			ASN1err(ASN1_F_ASN1_ITEM_SIGN,ASN1_R_UNKNOWN_OBJECT_TYPE);
 | 
			
		||||
			goto err;
 | 
			
		||||
			}
 | 
			
		||||
		if (a->algorithm->length == 0)
 | 
			
		||||
			{
 | 
			
		||||
			ASN1err(ASN1_F_ASN1_ITEM_SIGN,ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD);
 | 
			
		||||
			goto err;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	inl=ASN1_item_i2d(asn,&buf_in, it);
 | 
			
		||||
	outll=outl=EVP_PKEY_size(pkey);
 | 
			
		||||
	buf_out=(unsigned char *)OPENSSL_malloc((unsigned int)outl);
 | 
			
		||||
@@ -270,7 +267,12 @@ int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,
 | 
			
		||||
		goto err;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	EVP_SignInit_ex(&ctx,type, NULL);
 | 
			
		||||
	if (!EVP_SignInit_ex(&ctx,type, NULL))
 | 
			
		||||
		{
 | 
			
		||||
		outl=0;
 | 
			
		||||
		ASN1err(ASN1_F_ASN1_ITEM_SIGN,ERR_R_EVP_LIB);
 | 
			
		||||
		goto err;
 | 
			
		||||
		}
 | 
			
		||||
	EVP_SignUpdate(&ctx,(unsigned char *)buf_in,inl);
 | 
			
		||||
	if (!EVP_SignFinal(&ctx,(unsigned char *)buf_out,
 | 
			
		||||
			(unsigned int *)&outl,pkey))
 | 
			
		||||
 
 | 
			
		||||
@@ -67,6 +67,7 @@ static STACK_OF(ASN1_STRING_TABLE) *stable = NULL;
 | 
			
		||||
static void st_free(ASN1_STRING_TABLE *tbl);
 | 
			
		||||
static int sk_table_cmp(const ASN1_STRING_TABLE * const *a,
 | 
			
		||||
			const ASN1_STRING_TABLE * const *b);
 | 
			
		||||
static int table_cmp(const void *a, const void *b);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* This is the global mask for the mbstring functions: this is use to
 | 
			
		||||
@@ -157,7 +158,7 @@ ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out, const unsigned char *in,
 | 
			
		||||
 | 
			
		||||
/* This table must be kept in NID order */
 | 
			
		||||
 | 
			
		||||
static const ASN1_STRING_TABLE tbl_standard[] = {
 | 
			
		||||
static ASN1_STRING_TABLE tbl_standard[] = {
 | 
			
		||||
{NID_commonName,		1, ub_common_name, DIRSTRING_TYPE, 0},
 | 
			
		||||
{NID_countryName,		2, 2, B_ASN1_PRINTABLESTRING, STABLE_NO_MASK},
 | 
			
		||||
{NID_localityName,		1, ub_locality_name, DIRSTRING_TYPE, 0},
 | 
			
		||||
@@ -185,23 +186,22 @@ static int sk_table_cmp(const ASN1_STRING_TABLE * const *a,
 | 
			
		||||
	return (*a)->nid - (*b)->nid;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
DECLARE_OBJ_BSEARCH_CMP_FN(ASN1_STRING_TABLE, ASN1_STRING_TABLE, table);
 | 
			
		||||
 | 
			
		||||
static int table_cmp(const ASN1_STRING_TABLE *a, const ASN1_STRING_TABLE *b)
 | 
			
		||||
static int table_cmp(const void *a, const void *b)
 | 
			
		||||
{
 | 
			
		||||
	return a->nid - b->nid;
 | 
			
		||||
	const ASN1_STRING_TABLE *sa = a, *sb = b;
 | 
			
		||||
	return sa->nid - sb->nid;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
IMPLEMENT_OBJ_BSEARCH_CMP_FN(ASN1_STRING_TABLE, ASN1_STRING_TABLE, table);
 | 
			
		||||
 | 
			
		||||
ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid)
 | 
			
		||||
{
 | 
			
		||||
	int idx;
 | 
			
		||||
	ASN1_STRING_TABLE *ttmp;
 | 
			
		||||
	ASN1_STRING_TABLE fnd;
 | 
			
		||||
	fnd.nid = nid;
 | 
			
		||||
	ttmp = OBJ_bsearch_table(&fnd, tbl_standard, 
 | 
			
		||||
			   sizeof(tbl_standard)/sizeof(ASN1_STRING_TABLE));
 | 
			
		||||
	ttmp = (ASN1_STRING_TABLE *) OBJ_bsearch((char *)&fnd,
 | 
			
		||||
					(char *)tbl_standard, 
 | 
			
		||||
			sizeof(tbl_standard)/sizeof(ASN1_STRING_TABLE),
 | 
			
		||||
			sizeof(ASN1_STRING_TABLE), table_cmp);
 | 
			
		||||
	if(ttmp) return ttmp;
 | 
			
		||||
	if(!stable) return NULL;
 | 
			
		||||
	idx = sk_ASN1_STRING_TABLE_find(stable, &fnd);
 | 
			
		||||
 
 | 
			
		||||
@@ -100,12 +100,6 @@ int i2d_ASN1_TIME(ASN1_TIME *a, unsigned char **pp)
 | 
			
		||||
 | 
			
		||||
ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t t)
 | 
			
		||||
	{
 | 
			
		||||
	return ASN1_TIME_adj(s, t, 0, 0);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
ASN1_TIME *ASN1_TIME_adj(ASN1_TIME *s, time_t t,
 | 
			
		||||
				int offset_day, long offset_sec)
 | 
			
		||||
	{
 | 
			
		||||
	struct tm *ts;
 | 
			
		||||
	struct tm data;
 | 
			
		||||
 | 
			
		||||
@@ -115,14 +109,9 @@ ASN1_TIME *ASN1_TIME_adj(ASN1_TIME *s, time_t t,
 | 
			
		||||
		ASN1err(ASN1_F_ASN1_TIME_SET, ASN1_R_ERROR_GETTING_TIME);
 | 
			
		||||
		return NULL;
 | 
			
		||||
		}
 | 
			
		||||
	if (offset_day || offset_sec)
 | 
			
		||||
		{ 
 | 
			
		||||
		if (!OPENSSL_gmtime_adj(ts, offset_day, offset_sec))
 | 
			
		||||
			return NULL;
 | 
			
		||||
		}
 | 
			
		||||
	if((ts->tm_year >= 50) && (ts->tm_year < 150))
 | 
			
		||||
			return ASN1_UTCTIME_adj(s, t, offset_day, offset_sec);
 | 
			
		||||
	return ASN1_GENERALIZEDTIME_adj(s, t, offset_day, offset_sec);
 | 
			
		||||
					return ASN1_UTCTIME_set(s, t);
 | 
			
		||||
	return ASN1_GENERALIZEDTIME_set(s,t);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
int ASN1_TIME_check(ASN1_TIME *t)
 | 
			
		||||
@@ -173,25 +162,3 @@ ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZE
 | 
			
		||||
 | 
			
		||||
	return ret;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
int ASN1_TIME_set_string(ASN1_TIME *s, const char *str)
 | 
			
		||||
	{
 | 
			
		||||
	ASN1_TIME t;
 | 
			
		||||
 | 
			
		||||
	t.length = strlen(str);
 | 
			
		||||
	t.data = (unsigned char *)str;
 | 
			
		||||
	
 | 
			
		||||
	t.type = V_ASN1_UTCTIME;
 | 
			
		||||
 | 
			
		||||
	if (!ASN1_TIME_check(&t))
 | 
			
		||||
		{
 | 
			
		||||
		t.type = V_ASN1_GENERALIZEDTIME;
 | 
			
		||||
		if (!ASN1_TIME_check(&t))
 | 
			
		||||
			return 0;
 | 
			
		||||
		}
 | 
			
		||||
	
 | 
			
		||||
	if (s && !ASN1_STRING_copy((ASN1_STRING *)s, (ASN1_STRING *)&t))
 | 
			
		||||
			return 0;
 | 
			
		||||
 | 
			
		||||
	return 1;
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -77,10 +77,7 @@ void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value)
 | 
			
		||||
		ASN1_primitive_free((ASN1_VALUE **)tmp_a, NULL);
 | 
			
		||||
		}
 | 
			
		||||
	a->type=type;
 | 
			
		||||
	if (type == V_ASN1_BOOLEAN)
 | 
			
		||||
		a->value.boolean = value ? 0xff : 0;
 | 
			
		||||
	else
 | 
			
		||||
		a->value.ptr=value;
 | 
			
		||||
	a->value.ptr=value;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
int ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value)
 | 
			
		||||
@@ -101,7 +98,7 @@ int ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value)
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		ASN1_STRING *sdup;
 | 
			
		||||
		sdup = ASN1_STRING_dup(value);
 | 
			
		||||
		sdup = ASN1_STRING_dup((ASN1_STRING *)value);
 | 
			
		||||
		if (!sdup)
 | 
			
		||||
			return 0;
 | 
			
		||||
		ASN1_TYPE_set(a, type, sdup);
 | 
			
		||||
@@ -111,49 +108,3 @@ int ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value)
 | 
			
		||||
 | 
			
		||||
IMPLEMENT_STACK_OF(ASN1_TYPE)
 | 
			
		||||
IMPLEMENT_ASN1_SET_OF(ASN1_TYPE)
 | 
			
		||||
 | 
			
		||||
/* Returns 0 if they are equal, != 0 otherwise. */
 | 
			
		||||
int ASN1_TYPE_cmp(ASN1_TYPE *a, ASN1_TYPE *b)
 | 
			
		||||
	{
 | 
			
		||||
	int result = -1;
 | 
			
		||||
 | 
			
		||||
	if (!a || !b || a->type != b->type) return -1;
 | 
			
		||||
 | 
			
		||||
	switch (a->type)
 | 
			
		||||
		{
 | 
			
		||||
	case V_ASN1_OBJECT:
 | 
			
		||||
		result = OBJ_cmp(a->value.object, b->value.object);
 | 
			
		||||
		break;
 | 
			
		||||
	case V_ASN1_NULL:
 | 
			
		||||
		result = 0;	/* They do not have content. */
 | 
			
		||||
		break;
 | 
			
		||||
	case V_ASN1_INTEGER:
 | 
			
		||||
	case V_ASN1_NEG_INTEGER:
 | 
			
		||||
	case V_ASN1_ENUMERATED:
 | 
			
		||||
	case V_ASN1_NEG_ENUMERATED:
 | 
			
		||||
	case V_ASN1_BIT_STRING:
 | 
			
		||||
	case V_ASN1_OCTET_STRING:
 | 
			
		||||
	case V_ASN1_SEQUENCE:
 | 
			
		||||
	case V_ASN1_SET:
 | 
			
		||||
	case V_ASN1_NUMERICSTRING:
 | 
			
		||||
	case V_ASN1_PRINTABLESTRING:
 | 
			
		||||
	case V_ASN1_T61STRING:
 | 
			
		||||
	case V_ASN1_VIDEOTEXSTRING:
 | 
			
		||||
	case V_ASN1_IA5STRING:
 | 
			
		||||
	case V_ASN1_UTCTIME:
 | 
			
		||||
	case V_ASN1_GENERALIZEDTIME:
 | 
			
		||||
	case V_ASN1_GRAPHICSTRING:
 | 
			
		||||
	case V_ASN1_VISIBLESTRING:
 | 
			
		||||
	case V_ASN1_GENERALSTRING:
 | 
			
		||||
	case V_ASN1_UNIVERSALSTRING:
 | 
			
		||||
	case V_ASN1_BMPSTRING:
 | 
			
		||||
	case V_ASN1_UTF8STRING:
 | 
			
		||||
	case V_ASN1_OTHER:
 | 
			
		||||
	default:
 | 
			
		||||
		result = ASN1_STRING_cmp((ASN1_STRING *) a->value.ptr,
 | 
			
		||||
					 (ASN1_STRING *) b->value.ptr);
 | 
			
		||||
		break;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	return result;
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -114,8 +114,8 @@ err:
 | 
			
		||||
 | 
			
		||||
int ASN1_UTCTIME_check(ASN1_UTCTIME *d)
 | 
			
		||||
	{
 | 
			
		||||
	static const int min[8]={ 0, 1, 1, 0, 0, 0, 0, 0};
 | 
			
		||||
	static const int max[8]={99,12,31,23,59,59,12,59};
 | 
			
		||||
	static int min[8]={ 0, 1, 1, 0, 0, 0, 0, 0};
 | 
			
		||||
	static int max[8]={99,12,31,23,59,59,12,59};
 | 
			
		||||
	char *a;
 | 
			
		||||
	int n,i,l,o;
 | 
			
		||||
 | 
			
		||||
@@ -186,12 +186,6 @@ int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str)
 | 
			
		||||
 | 
			
		||||
ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t)
 | 
			
		||||
	{
 | 
			
		||||
	return ASN1_UTCTIME_adj(s, t, 0, 0);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t,
 | 
			
		||||
				int offset_day, long offset_sec)
 | 
			
		||||
	{
 | 
			
		||||
	char *p;
 | 
			
		||||
	struct tm *ts;
 | 
			
		||||
	struct tm data;
 | 
			
		||||
@@ -206,15 +200,6 @@ ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t,
 | 
			
		||||
	if (ts == NULL)
 | 
			
		||||
		return(NULL);
 | 
			
		||||
 | 
			
		||||
	if (offset_day || offset_sec)
 | 
			
		||||
		{ 
 | 
			
		||||
		if (!OPENSSL_gmtime_adj(ts, offset_day, offset_sec))
 | 
			
		||||
			return NULL;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if((ts->tm_year < 50) || (ts->tm_year >= 150))
 | 
			
		||||
		return NULL;
 | 
			
		||||
 | 
			
		||||
	p=(char *)s->data;
 | 
			
		||||
	if ((p == NULL) || ((size_t)s->length < len))
 | 
			
		||||
		{
 | 
			
		||||
 
 | 
			
		||||
@@ -60,7 +60,6 @@
 | 
			
		||||
#include <time.h>
 | 
			
		||||
 | 
			
		||||
#include "cryptlib.h"
 | 
			
		||||
#include "asn1_locl.h"
 | 
			
		||||
 | 
			
		||||
#ifndef NO_SYS_TYPES_H
 | 
			
		||||
# include <sys/types.h>
 | 
			
		||||
@@ -101,7 +100,12 @@ int ASN1_verify(i2d_of_void *i2d, X509_ALGOR *a, ASN1_BIT_STRING *signature,
 | 
			
		||||
	p=buf_in;
 | 
			
		||||
 | 
			
		||||
	i2d(data,&p);
 | 
			
		||||
	EVP_VerifyInit_ex(&ctx,type, NULL);
 | 
			
		||||
	if (!EVP_VerifyInit_ex(&ctx,type, NULL))
 | 
			
		||||
		{
 | 
			
		||||
		ASN1err(ASN1_F_ASN1_VERIFY,ERR_R_EVP_LIB);
 | 
			
		||||
		ret=0;
 | 
			
		||||
		goto err;
 | 
			
		||||
		}
 | 
			
		||||
	EVP_VerifyUpdate(&ctx,(unsigned char *)buf_in,inl);
 | 
			
		||||
 | 
			
		||||
	OPENSSL_cleanse(buf_in,(unsigned int)inl);
 | 
			
		||||
@@ -130,34 +134,19 @@ int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *a, ASN1_BIT_STRING *signat
 | 
			
		||||
	     void *asn, EVP_PKEY *pkey)
 | 
			
		||||
	{
 | 
			
		||||
	EVP_MD_CTX ctx;
 | 
			
		||||
	const EVP_MD *type = NULL;
 | 
			
		||||
	const EVP_MD *type;
 | 
			
		||||
	unsigned char *buf_in=NULL;
 | 
			
		||||
	int ret= -1,inl;
 | 
			
		||||
 | 
			
		||||
	int mdnid, pknid;
 | 
			
		||||
	int ret= -1,i,inl;
 | 
			
		||||
 | 
			
		||||
	EVP_MD_CTX_init(&ctx);
 | 
			
		||||
 | 
			
		||||
	/* Convert signature OID into digest and public key OIDs */
 | 
			
		||||
	if (!OBJ_find_sigid_algs(OBJ_obj2nid(a->algorithm), &mdnid, &pknid))
 | 
			
		||||
		{
 | 
			
		||||
		ASN1err(ASN1_F_ASN1_ITEM_VERIFY,ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM);
 | 
			
		||||
		goto err;
 | 
			
		||||
		}
 | 
			
		||||
	type=EVP_get_digestbynid(mdnid);
 | 
			
		||||
	i=OBJ_obj2nid(a->algorithm);
 | 
			
		||||
	type=EVP_get_digestbyname(OBJ_nid2sn(i));
 | 
			
		||||
	if (type == NULL)
 | 
			
		||||
		{
 | 
			
		||||
		ASN1err(ASN1_F_ASN1_ITEM_VERIFY,ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM);
 | 
			
		||||
		goto err;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	/* Check public key OID matches public key type */
 | 
			
		||||
	if (EVP_PKEY_type(pknid) != pkey->ameth->pkey_id)
 | 
			
		||||
		{
 | 
			
		||||
		ASN1err(ASN1_F_ASN1_ITEM_VERIFY,ASN1_R_WRONG_PUBLIC_KEY_TYPE);
 | 
			
		||||
		goto err;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (!EVP_VerifyInit_ex(&ctx,type, NULL))
 | 
			
		||||
		{
 | 
			
		||||
		ASN1err(ASN1_F_ASN1_ITEM_VERIFY,ERR_R_EVP_LIB);
 | 
			
		||||
 
 | 
			
		||||
@@ -213,7 +213,7 @@ typedef struct asn1_object_st
 | 
			
		||||
	const char *sn,*ln;
 | 
			
		||||
	int nid;
 | 
			
		||||
	int length;
 | 
			
		||||
	const unsigned char *data;	/* data remains const after init */
 | 
			
		||||
	unsigned char *data;
 | 
			
		||||
	int flags;	/* Should we free this one */
 | 
			
		||||
	} ASN1_OBJECT;
 | 
			
		||||
 | 
			
		||||
@@ -228,8 +228,8 @@ typedef struct asn1_object_st
 | 
			
		||||
 * complete and is a place holder for content when it had all been 
 | 
			
		||||
 * accessed. The flag will be reset when content has been written to it.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#define ASN1_STRING_FLAG_CONT 0x020 
 | 
			
		||||
 | 
			
		||||
/* This is the base type that holds just about everything :-) */
 | 
			
		||||
typedef struct asn1_string_st
 | 
			
		||||
	{
 | 
			
		||||
@@ -330,13 +330,6 @@ typedef struct ASN1_VALUE_st ASN1_VALUE;
 | 
			
		||||
	type *name##_new(void); \
 | 
			
		||||
	void name##_free(type *a);
 | 
			
		||||
 | 
			
		||||
#define DECLARE_ASN1_PRINT_FUNCTION(stname) \
 | 
			
		||||
	DECLARE_ASN1_PRINT_FUNCTION_fname(stname, stname)
 | 
			
		||||
 | 
			
		||||
#define DECLARE_ASN1_PRINT_FUNCTION_fname(stname, fname) \
 | 
			
		||||
	int fname##_print_ctx(BIO *out, stname *x, int indent, \
 | 
			
		||||
					 const ASN1_PCTX *pctx);
 | 
			
		||||
 | 
			
		||||
#define D2I_OF(type) type *(*)(type **,const unsigned char **,long)
 | 
			
		||||
#define I2D_OF(type) int (*)(type *,unsigned char **)
 | 
			
		||||
#define I2D_OF_const(type) int (*)(const type *,unsigned char **)
 | 
			
		||||
@@ -541,23 +534,28 @@ typedef struct asn1_type_st
 | 
			
		||||
		 * contain the set or sequence bytes */
 | 
			
		||||
		ASN1_STRING *		set;
 | 
			
		||||
		ASN1_STRING *		sequence;
 | 
			
		||||
		ASN1_VALUE *		asn1_value;
 | 
			
		||||
		ASN1_VALUE  *		asn1_value;
 | 
			
		||||
		} value;
 | 
			
		||||
	} ASN1_TYPE;
 | 
			
		||||
 | 
			
		||||
DECLARE_STACK_OF(ASN1_TYPE)
 | 
			
		||||
DECLARE_ASN1_SET_OF(ASN1_TYPE)
 | 
			
		||||
 | 
			
		||||
typedef STACK_OF(ASN1_TYPE) ASN1_SEQUENCE_ANY;
 | 
			
		||||
typedef struct asn1_method_st
 | 
			
		||||
	{
 | 
			
		||||
	i2d_of_void *i2d;
 | 
			
		||||
	d2i_of_void *d2i;
 | 
			
		||||
	void *(*create)(void);
 | 
			
		||||
	void (*destroy)(void *);
 | 
			
		||||
	} ASN1_METHOD;
 | 
			
		||||
 | 
			
		||||
DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SEQUENCE_ANY)
 | 
			
		||||
DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SET_ANY)
 | 
			
		||||
 | 
			
		||||
typedef struct NETSCAPE_X509_st
 | 
			
		||||
/* This is used when parsing some Netscape objects */
 | 
			
		||||
typedef struct asn1_header_st
 | 
			
		||||
	{
 | 
			
		||||
	ASN1_OCTET_STRING *header;
 | 
			
		||||
	X509 *cert;
 | 
			
		||||
	} NETSCAPE_X509;
 | 
			
		||||
	void *data;
 | 
			
		||||
	ASN1_METHOD *meth;
 | 
			
		||||
	} ASN1_HEADER;
 | 
			
		||||
 | 
			
		||||
/* This is used to contain a list of bit names */
 | 
			
		||||
typedef struct BIT_STRING_BITNAME_st {
 | 
			
		||||
@@ -577,34 +575,32 @@ typedef struct BIT_STRING_BITNAME_st {
 | 
			
		||||
		ASN1_STRING_type_new(V_ASN1_BIT_STRING)
 | 
			
		||||
#define M_ASN1_BIT_STRING_free(a)	ASN1_STRING_free((ASN1_STRING *)a)
 | 
			
		||||
#define M_ASN1_BIT_STRING_dup(a) (ASN1_BIT_STRING *)\
 | 
			
		||||
		ASN1_STRING_dup((const ASN1_STRING *)a)
 | 
			
		||||
		ASN1_STRING_dup((ASN1_STRING *)a)
 | 
			
		||||
#define M_ASN1_BIT_STRING_cmp(a,b) ASN1_STRING_cmp(\
 | 
			
		||||
		(const ASN1_STRING *)a,(const ASN1_STRING *)b)
 | 
			
		||||
		(ASN1_STRING *)a,(ASN1_STRING *)b)
 | 
			
		||||
#define M_ASN1_BIT_STRING_set(a,b,c) ASN1_STRING_set((ASN1_STRING *)a,b,c)
 | 
			
		||||
 | 
			
		||||
#define M_ASN1_INTEGER_new()	(ASN1_INTEGER *)\
 | 
			
		||||
		ASN1_STRING_type_new(V_ASN1_INTEGER)
 | 
			
		||||
#define M_ASN1_INTEGER_free(a)		ASN1_STRING_free((ASN1_STRING *)a)
 | 
			
		||||
#define M_ASN1_INTEGER_dup(a) (ASN1_INTEGER *)\
 | 
			
		||||
		ASN1_STRING_dup((const ASN1_STRING *)a)
 | 
			
		||||
#define M_ASN1_INTEGER_dup(a) (ASN1_INTEGER *)ASN1_STRING_dup((ASN1_STRING *)a)
 | 
			
		||||
#define M_ASN1_INTEGER_cmp(a,b)	ASN1_STRING_cmp(\
 | 
			
		||||
		(const ASN1_STRING *)a,(const ASN1_STRING *)b)
 | 
			
		||||
		(ASN1_STRING *)a,(ASN1_STRING *)b)
 | 
			
		||||
 | 
			
		||||
#define M_ASN1_ENUMERATED_new()	(ASN1_ENUMERATED *)\
 | 
			
		||||
		ASN1_STRING_type_new(V_ASN1_ENUMERATED)
 | 
			
		||||
#define M_ASN1_ENUMERATED_free(a)	ASN1_STRING_free((ASN1_STRING *)a)
 | 
			
		||||
#define M_ASN1_ENUMERATED_dup(a) (ASN1_ENUMERATED *)\
 | 
			
		||||
		ASN1_STRING_dup((const ASN1_STRING *)a)
 | 
			
		||||
#define M_ASN1_ENUMERATED_dup(a) (ASN1_ENUMERATED *)ASN1_STRING_dup((ASN1_STRING *)a)
 | 
			
		||||
#define M_ASN1_ENUMERATED_cmp(a,b)	ASN1_STRING_cmp(\
 | 
			
		||||
		(const ASN1_STRING *)a,(const ASN1_STRING *)b)
 | 
			
		||||
		(ASN1_STRING *)a,(ASN1_STRING *)b)
 | 
			
		||||
 | 
			
		||||
#define M_ASN1_OCTET_STRING_new()	(ASN1_OCTET_STRING *)\
 | 
			
		||||
		ASN1_STRING_type_new(V_ASN1_OCTET_STRING)
 | 
			
		||||
#define M_ASN1_OCTET_STRING_free(a)	ASN1_STRING_free((ASN1_STRING *)a)
 | 
			
		||||
#define M_ASN1_OCTET_STRING_dup(a) (ASN1_OCTET_STRING *)\
 | 
			
		||||
		ASN1_STRING_dup((const ASN1_STRING *)a)
 | 
			
		||||
		ASN1_STRING_dup((ASN1_STRING *)a)
 | 
			
		||||
#define M_ASN1_OCTET_STRING_cmp(a,b) ASN1_STRING_cmp(\
 | 
			
		||||
		(const ASN1_STRING *)a,(const ASN1_STRING *)b)
 | 
			
		||||
		(ASN1_STRING *)a,(ASN1_STRING *)b)
 | 
			
		||||
#define M_ASN1_OCTET_STRING_set(a,b,c)	ASN1_STRING_set((ASN1_STRING *)a,b,c)
 | 
			
		||||
#define M_ASN1_OCTET_STRING_print(a,b)	ASN1_STRING_print(a,(ASN1_STRING *)b)
 | 
			
		||||
#define M_i2d_ASN1_OCTET_STRING(a,pp) \
 | 
			
		||||
@@ -688,7 +684,7 @@ typedef struct BIT_STRING_BITNAME_st {
 | 
			
		||||
		ASN1_STRING_type_new(V_ASN1_IA5STRING)
 | 
			
		||||
#define M_ASN1_IA5STRING_free(a)	ASN1_STRING_free((ASN1_STRING *)a)
 | 
			
		||||
#define M_ASN1_IA5STRING_dup(a)	\
 | 
			
		||||
		(ASN1_IA5STRING *)ASN1_STRING_dup((const ASN1_STRING *)a)
 | 
			
		||||
			(ASN1_IA5STRING *)ASN1_STRING_dup((ASN1_STRING *)a)
 | 
			
		||||
#define M_i2d_ASN1_IA5STRING(a,pp) \
 | 
			
		||||
		i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_IA5STRING,\
 | 
			
		||||
			V_ASN1_UNIVERSAL)
 | 
			
		||||
@@ -699,20 +695,18 @@ typedef struct BIT_STRING_BITNAME_st {
 | 
			
		||||
#define M_ASN1_UTCTIME_new()	(ASN1_UTCTIME *)\
 | 
			
		||||
		ASN1_STRING_type_new(V_ASN1_UTCTIME)
 | 
			
		||||
#define M_ASN1_UTCTIME_free(a)	ASN1_STRING_free((ASN1_STRING *)a)
 | 
			
		||||
#define M_ASN1_UTCTIME_dup(a) (ASN1_UTCTIME *)\
 | 
			
		||||
		ASN1_STRING_dup((const ASN1_STRING *)a)
 | 
			
		||||
#define M_ASN1_UTCTIME_dup(a) (ASN1_UTCTIME *)ASN1_STRING_dup((ASN1_STRING *)a)
 | 
			
		||||
 | 
			
		||||
#define M_ASN1_GENERALIZEDTIME_new()	(ASN1_GENERALIZEDTIME *)\
 | 
			
		||||
		ASN1_STRING_type_new(V_ASN1_GENERALIZEDTIME)
 | 
			
		||||
#define M_ASN1_GENERALIZEDTIME_free(a)	ASN1_STRING_free((ASN1_STRING *)a)
 | 
			
		||||
#define M_ASN1_GENERALIZEDTIME_dup(a) (ASN1_GENERALIZEDTIME *)ASN1_STRING_dup(\
 | 
			
		||||
	(const ASN1_STRING *)a)
 | 
			
		||||
	(ASN1_STRING *)a)
 | 
			
		||||
 | 
			
		||||
#define M_ASN1_TIME_new()	(ASN1_TIME *)\
 | 
			
		||||
		ASN1_STRING_type_new(V_ASN1_UTCTIME)
 | 
			
		||||
#define M_ASN1_TIME_free(a)	ASN1_STRING_free((ASN1_STRING *)a)
 | 
			
		||||
#define M_ASN1_TIME_dup(a) (ASN1_TIME *)\
 | 
			
		||||
	ASN1_STRING_dup((const ASN1_STRING *)a)
 | 
			
		||||
#define M_ASN1_TIME_dup(a) (ASN1_TIME *)ASN1_STRING_dup((ASN1_STRING *)a)
 | 
			
		||||
 | 
			
		||||
#define M_ASN1_GENERALSTRING_new()	(ASN1_GENERALSTRING *)\
 | 
			
		||||
		ASN1_STRING_type_new(V_ASN1_GENERALSTRING)
 | 
			
		||||
@@ -773,7 +767,6 @@ DECLARE_ASN1_FUNCTIONS_fname(ASN1_TYPE, ASN1_ANY, ASN1_TYPE)
 | 
			
		||||
int ASN1_TYPE_get(ASN1_TYPE *a);
 | 
			
		||||
void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value);
 | 
			
		||||
int ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value);
 | 
			
		||||
int            ASN1_TYPE_cmp(ASN1_TYPE *a, ASN1_TYPE *b);
 | 
			
		||||
 | 
			
		||||
ASN1_OBJECT *	ASN1_OBJECT_new(void );
 | 
			
		||||
void		ASN1_OBJECT_free(ASN1_OBJECT *a);
 | 
			
		||||
@@ -790,15 +783,14 @@ DECLARE_ASN1_SET_OF(ASN1_OBJECT)
 | 
			
		||||
 | 
			
		||||
ASN1_STRING *	ASN1_STRING_new(void);
 | 
			
		||||
void		ASN1_STRING_free(ASN1_STRING *a);
 | 
			
		||||
int		ASN1_STRING_copy(ASN1_STRING *dst, const ASN1_STRING *str);
 | 
			
		||||
ASN1_STRING *	ASN1_STRING_dup(const ASN1_STRING *a);
 | 
			
		||||
ASN1_STRING *	ASN1_STRING_dup(ASN1_STRING *a);
 | 
			
		||||
ASN1_STRING *	ASN1_STRING_type_new(int type );
 | 
			
		||||
int 		ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b);
 | 
			
		||||
int 		ASN1_STRING_cmp(ASN1_STRING *a, ASN1_STRING *b);
 | 
			
		||||
  /* Since this is used to store all sorts of things, via macros, for now, make
 | 
			
		||||
     its data void * */
 | 
			
		||||
int 		ASN1_STRING_set(ASN1_STRING *str, const void *data, int len);
 | 
			
		||||
void		ASN1_STRING_set0(ASN1_STRING *str, void *data, int len);
 | 
			
		||||
int ASN1_STRING_length(const ASN1_STRING *x);
 | 
			
		||||
int ASN1_STRING_length(ASN1_STRING *x);
 | 
			
		||||
void ASN1_STRING_length_set(ASN1_STRING *x, int n);
 | 
			
		||||
int ASN1_STRING_type(ASN1_STRING *x);
 | 
			
		||||
unsigned char * ASN1_STRING_data(ASN1_STRING *x);
 | 
			
		||||
@@ -811,8 +803,6 @@ int		ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d,
 | 
			
		||||
			int length );
 | 
			
		||||
int		ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value);
 | 
			
		||||
int		ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n);
 | 
			
		||||
int            ASN1_BIT_STRING_check(ASN1_BIT_STRING *a,
 | 
			
		||||
                                     unsigned char *flags, int flags_len);
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_BIO
 | 
			
		||||
int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs,
 | 
			
		||||
@@ -831,15 +821,13 @@ ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a,const unsigned char **pp,
 | 
			
		||||
			long length);
 | 
			
		||||
ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a,const unsigned char **pp,
 | 
			
		||||
			long length);
 | 
			
		||||
ASN1_INTEGER *	ASN1_INTEGER_dup(const ASN1_INTEGER *x);
 | 
			
		||||
int ASN1_INTEGER_cmp(const ASN1_INTEGER *x, const ASN1_INTEGER *y);
 | 
			
		||||
ASN1_INTEGER *	ASN1_INTEGER_dup(ASN1_INTEGER *x);
 | 
			
		||||
int ASN1_INTEGER_cmp(ASN1_INTEGER *x, ASN1_INTEGER *y);
 | 
			
		||||
 | 
			
		||||
DECLARE_ASN1_FUNCTIONS(ASN1_ENUMERATED)
 | 
			
		||||
 | 
			
		||||
int ASN1_UTCTIME_check(ASN1_UTCTIME *a);
 | 
			
		||||
ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s,time_t t);
 | 
			
		||||
ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t,
 | 
			
		||||
				int offset_day, long offset_sec);
 | 
			
		||||
int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str);
 | 
			
		||||
int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t);
 | 
			
		||||
#if 0
 | 
			
		||||
@@ -848,13 +836,11 @@ time_t ASN1_UTCTIME_get(const ASN1_UTCTIME *s);
 | 
			
		||||
 | 
			
		||||
int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *a);
 | 
			
		||||
ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,time_t t);
 | 
			
		||||
ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s,
 | 
			
		||||
	     time_t t, int offset_day, long offset_sec);
 | 
			
		||||
int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str);
 | 
			
		||||
 | 
			
		||||
DECLARE_ASN1_FUNCTIONS(ASN1_OCTET_STRING)
 | 
			
		||||
ASN1_OCTET_STRING *	ASN1_OCTET_STRING_dup(const ASN1_OCTET_STRING *a);
 | 
			
		||||
int 	ASN1_OCTET_STRING_cmp(const ASN1_OCTET_STRING *a, const ASN1_OCTET_STRING *b);
 | 
			
		||||
ASN1_OCTET_STRING *	ASN1_OCTET_STRING_dup(ASN1_OCTET_STRING *a);
 | 
			
		||||
int 	ASN1_OCTET_STRING_cmp(ASN1_OCTET_STRING *a, ASN1_OCTET_STRING *b);
 | 
			
		||||
int 	ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, const unsigned char *data, int len);
 | 
			
		||||
 | 
			
		||||
DECLARE_ASN1_FUNCTIONS(ASN1_VISIBLESTRING)
 | 
			
		||||
@@ -881,19 +867,14 @@ DECLARE_ASN1_FUNCTIONS(ASN1_TIME)
 | 
			
		||||
DECLARE_ASN1_ITEM(ASN1_OCTET_STRING_NDEF)
 | 
			
		||||
 | 
			
		||||
ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s,time_t t);
 | 
			
		||||
ASN1_TIME *ASN1_TIME_adj(ASN1_TIME *s,time_t t,
 | 
			
		||||
				int offset_day, long offset_sec);
 | 
			
		||||
int ASN1_TIME_check(ASN1_TIME *t);
 | 
			
		||||
ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZEDTIME **out);
 | 
			
		||||
int ASN1_TIME_set_string(ASN1_TIME *s, const char *str);
 | 
			
		||||
 | 
			
		||||
int i2d_ASN1_SET(STACK_OF(BLOCK) *a, unsigned char **pp,
 | 
			
		||||
		 i2d_of_void *i2d, int ex_tag, int ex_class,
 | 
			
		||||
		 int is_set);
 | 
			
		||||
STACK_OF(BLOCK) *d2i_ASN1_SET(STACK_OF(BLOCK) **a, const unsigned char **pp,
 | 
			
		||||
			      long length, d2i_of_void *d2i,
 | 
			
		||||
			      void (*free_func)(BLOCK), int ex_tag,
 | 
			
		||||
			      int ex_class);
 | 
			
		||||
int i2d_ASN1_SET(STACK *a, unsigned char **pp,
 | 
			
		||||
		 i2d_of_void *i2d, int ex_tag, int ex_class, int is_set);
 | 
			
		||||
STACK *	d2i_ASN1_SET(STACK **a, const unsigned char **pp, long length,
 | 
			
		||||
		     d2i_of_void *d2i, void (*free_func)(void *),
 | 
			
		||||
		     int ex_tag, int ex_class);
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_BIO
 | 
			
		||||
int i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a);
 | 
			
		||||
@@ -911,9 +892,9 @@ ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data,int len,
 | 
			
		||||
	const char *sn, const char *ln);
 | 
			
		||||
 | 
			
		||||
int ASN1_INTEGER_set(ASN1_INTEGER *a, long v);
 | 
			
		||||
long ASN1_INTEGER_get(const ASN1_INTEGER *a);
 | 
			
		||||
ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai);
 | 
			
		||||
BIGNUM *ASN1_INTEGER_to_BN(const ASN1_INTEGER *ai,BIGNUM *bn);
 | 
			
		||||
long ASN1_INTEGER_get(ASN1_INTEGER *a);
 | 
			
		||||
ASN1_INTEGER *BN_to_ASN1_INTEGER(BIGNUM *bn, ASN1_INTEGER *ai);
 | 
			
		||||
BIGNUM *ASN1_INTEGER_to_BN(ASN1_INTEGER *ai,BIGNUM *bn);
 | 
			
		||||
 | 
			
		||||
int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v);
 | 
			
		||||
long ASN1_ENUMERATED_get(ASN1_ENUMERATED *a);
 | 
			
		||||
@@ -1018,24 +999,30 @@ int ASN1_i2d_bio(i2d_of_void *i2d,BIO *out, unsigned char *x);
 | 
			
		||||
		  CHECKED_PTR_OF(const type, x)))
 | 
			
		||||
 | 
			
		||||
int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, void *x);
 | 
			
		||||
int ASN1_UTCTIME_print(BIO *fp, const ASN1_UTCTIME *a);
 | 
			
		||||
int ASN1_GENERALIZEDTIME_print(BIO *fp, const ASN1_GENERALIZEDTIME *a);
 | 
			
		||||
int ASN1_TIME_print(BIO *fp, const ASN1_TIME *a);
 | 
			
		||||
int ASN1_STRING_print(BIO *bp, const ASN1_STRING *v);
 | 
			
		||||
int ASN1_UTCTIME_print(BIO *fp,ASN1_UTCTIME *a);
 | 
			
		||||
int ASN1_GENERALIZEDTIME_print(BIO *fp,ASN1_GENERALIZEDTIME *a);
 | 
			
		||||
int ASN1_TIME_print(BIO *fp,ASN1_TIME *a);
 | 
			
		||||
int ASN1_STRING_print(BIO *bp,ASN1_STRING *v);
 | 
			
		||||
int ASN1_STRING_print_ex(BIO *out, ASN1_STRING *str, unsigned long flags);
 | 
			
		||||
int ASN1_bn_print(BIO *bp, const char *number, const BIGNUM *num,
 | 
			
		||||
				unsigned char *buf, int off);
 | 
			
		||||
int ASN1_parse(BIO *bp,const unsigned char *pp,long len,int indent);
 | 
			
		||||
int ASN1_parse_dump(BIO *bp,const unsigned char *pp,long len,int indent,int dump);
 | 
			
		||||
#endif
 | 
			
		||||
const char *ASN1_tag2str(int tag);
 | 
			
		||||
 | 
			
		||||
/* Used to load and write netscape format cert */
 | 
			
		||||
 | 
			
		||||
DECLARE_ASN1_FUNCTIONS(NETSCAPE_X509)
 | 
			
		||||
/* Used to load and write netscape format cert/key */
 | 
			
		||||
int i2d_ASN1_HEADER(ASN1_HEADER *a,unsigned char **pp);
 | 
			
		||||
ASN1_HEADER *d2i_ASN1_HEADER(ASN1_HEADER **a,const unsigned char **pp, long length);
 | 
			
		||||
ASN1_HEADER *ASN1_HEADER_new(void );
 | 
			
		||||
void ASN1_HEADER_free(ASN1_HEADER *a);
 | 
			
		||||
 | 
			
		||||
int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s);
 | 
			
		||||
 | 
			
		||||
/* Not used that much at this point, except for the first two */
 | 
			
		||||
ASN1_METHOD *X509_asn1_meth(void);
 | 
			
		||||
ASN1_METHOD *RSAPrivateKey_asn1_meth(void);
 | 
			
		||||
ASN1_METHOD *ASN1_IA5STRING_asn1_meth(void);
 | 
			
		||||
ASN1_METHOD *ASN1_BIT_STRING_asn1_meth(void);
 | 
			
		||||
 | 
			
		||||
int ASN1_TYPE_set_octetstring(ASN1_TYPE *a,
 | 
			
		||||
	unsigned char *data, int len);
 | 
			
		||||
int ASN1_TYPE_get_octetstring(ASN1_TYPE *a,
 | 
			
		||||
@@ -1045,9 +1032,9 @@ int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num,
 | 
			
		||||
int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a,long *num,
 | 
			
		||||
	unsigned char *data, int max_len);
 | 
			
		||||
 | 
			
		||||
STACK_OF(BLOCK) *ASN1_seq_unpack(const unsigned char *buf, int len,
 | 
			
		||||
				 d2i_of_void *d2i, void (*free_func)(BLOCK));
 | 
			
		||||
unsigned char *ASN1_seq_pack(STACK_OF(BLOCK) *safes, i2d_of_void *i2d,
 | 
			
		||||
STACK *ASN1_seq_unpack(const unsigned char *buf, int len,
 | 
			
		||||
		       d2i_of_void *d2i, void (*free_func)(void *));
 | 
			
		||||
unsigned char *ASN1_seq_pack(STACK *safes, i2d_of_void *i2d,
 | 
			
		||||
			     unsigned char **buf, int *len );
 | 
			
		||||
void *ASN1_unpack_string(ASN1_STRING *oct, d2i_of_void *d2i);
 | 
			
		||||
void *ASN1_item_unpack(ASN1_STRING *oct, const ASN1_ITEM *it);
 | 
			
		||||
@@ -1090,58 +1077,15 @@ void ASN1_add_oid_module(void);
 | 
			
		||||
ASN1_TYPE *ASN1_generate_nconf(char *str, CONF *nconf);
 | 
			
		||||
ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf);
 | 
			
		||||
 | 
			
		||||
/* ASN1 Print flags */
 | 
			
		||||
typedef int asn1_output_data_fn(BIO *out, BIO *data, ASN1_VALUE *val, int flags,
 | 
			
		||||
					const ASN1_ITEM *it);
 | 
			
		||||
 | 
			
		||||
/* Indicate missing OPTIONAL fields */
 | 
			
		||||
#define ASN1_PCTX_FLAGS_SHOW_ABSENT		0x001	
 | 
			
		||||
/* Mark start and end of SEQUENCE */
 | 
			
		||||
#define ASN1_PCTX_FLAGS_SHOW_SEQUENCE		0x002
 | 
			
		||||
/* Mark start and end of SEQUENCE/SET OF */
 | 
			
		||||
#define ASN1_PCTX_FLAGS_SHOW_SSOF		0x004
 | 
			
		||||
/* Show the ASN1 type of primitives */
 | 
			
		||||
#define ASN1_PCTX_FLAGS_SHOW_TYPE		0x008
 | 
			
		||||
/* Don't show ASN1 type of ANY */
 | 
			
		||||
#define ASN1_PCTX_FLAGS_NO_ANY_TYPE		0x010
 | 
			
		||||
/* Don't show ASN1 type of MSTRINGs */
 | 
			
		||||
#define ASN1_PCTX_FLAGS_NO_MSTRING_TYPE		0x020
 | 
			
		||||
/* Don't show field names in SEQUENCE */
 | 
			
		||||
#define ASN1_PCTX_FLAGS_NO_FIELD_NAME		0x040
 | 
			
		||||
/* Show structure names of each SEQUENCE field */
 | 
			
		||||
#define ASN1_PCTX_FLAGS_SHOW_FIELD_STRUCT_NAME	0x080
 | 
			
		||||
/* Don't show structure name even at top level */
 | 
			
		||||
#define ASN1_PCTX_FLAGS_NO_STRUCT_NAME		0x100
 | 
			
		||||
 | 
			
		||||
int ASN1_item_print(BIO *out, ASN1_VALUE *ifld, int indent,
 | 
			
		||||
				const ASN1_ITEM *it, const ASN1_PCTX *pctx);
 | 
			
		||||
ASN1_PCTX *ASN1_PCTX_new(void);
 | 
			
		||||
void ASN1_PCTX_free(ASN1_PCTX *p);
 | 
			
		||||
unsigned long ASN1_PCTX_get_flags(ASN1_PCTX *p);
 | 
			
		||||
void ASN1_PCTX_set_flags(ASN1_PCTX *p, unsigned long flags);
 | 
			
		||||
unsigned long ASN1_PCTX_get_nm_flags(ASN1_PCTX *p);
 | 
			
		||||
void ASN1_PCTX_set_nm_flags(ASN1_PCTX *p, unsigned long flags);
 | 
			
		||||
unsigned long ASN1_PCTX_get_cert_flags(ASN1_PCTX *p);
 | 
			
		||||
void ASN1_PCTX_set_cert_flags(ASN1_PCTX *p, unsigned long flags);
 | 
			
		||||
unsigned long ASN1_PCTX_get_oid_flags(ASN1_PCTX *p);
 | 
			
		||||
void ASN1_PCTX_set_oid_flags(ASN1_PCTX *p, unsigned long flags);
 | 
			
		||||
unsigned long ASN1_PCTX_get_str_flags(ASN1_PCTX *p);
 | 
			
		||||
void ASN1_PCTX_set_str_flags(ASN1_PCTX *p, unsigned long flags);
 | 
			
		||||
 | 
			
		||||
BIO_METHOD *BIO_f_asn1(void);
 | 
			
		||||
 | 
			
		||||
BIO *BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it);
 | 
			
		||||
 | 
			
		||||
int i2d_ASN1_bio_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags,
 | 
			
		||||
				const ASN1_ITEM *it);
 | 
			
		||||
int PEM_write_bio_ASN1_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags,
 | 
			
		||||
				const char *hdr,
 | 
			
		||||
				const ASN1_ITEM *it);
 | 
			
		||||
int SMIME_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags,
 | 
			
		||||
int int_smime_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags,
 | 
			
		||||
				int ctype_nid, int econt_nid,
 | 
			
		||||
				STACK_OF(X509_ALGOR) *mdalgs,
 | 
			
		||||
				asn1_output_data_fn *data_fn,
 | 
			
		||||
				const ASN1_ITEM *it);
 | 
			
		||||
ASN1_VALUE *SMIME_read_ASN1(BIO *bio, BIO **bcont, const ASN1_ITEM *it);
 | 
			
		||||
int SMIME_crlf_copy(BIO *in, BIO *out, int flags);
 | 
			
		||||
int SMIME_text(BIO *in, BIO *out);
 | 
			
		||||
 | 
			
		||||
/* BEGIN ERROR CODES */
 | 
			
		||||
/* The following lines are auto generated by the script mkerr.pl. Any changes
 | 
			
		||||
@@ -1192,7 +1136,7 @@ void ERR_load_ASN1_strings(void);
 | 
			
		||||
#define ASN1_F_ASN1_ITEM_VERIFY				 197
 | 
			
		||||
#define ASN1_F_ASN1_MBSTRING_NCOPY			 122
 | 
			
		||||
#define ASN1_F_ASN1_OBJECT_NEW				 123
 | 
			
		||||
#define ASN1_F_ASN1_OUTPUT_DATA				 214
 | 
			
		||||
#define ASN1_F_ASN1_OUTPUT_DATA				 207
 | 
			
		||||
#define ASN1_F_ASN1_PACK_STRING				 124
 | 
			
		||||
#define ASN1_F_ASN1_PCTX_NEW				 205
 | 
			
		||||
#define ASN1_F_ASN1_PKCS5_PBE_SET			 125
 | 
			
		||||
@@ -1212,9 +1156,8 @@ void ERR_load_ASN1_strings(void);
 | 
			
		||||
#define ASN1_F_ASN1_UNPACK_STRING			 136
 | 
			
		||||
#define ASN1_F_ASN1_UTCTIME_SET				 187
 | 
			
		||||
#define ASN1_F_ASN1_VERIFY				 137
 | 
			
		||||
#define ASN1_F_B64_READ_ASN1				 209
 | 
			
		||||
#define ASN1_F_B64_WRITE_ASN1				 210
 | 
			
		||||
#define ASN1_F_BIO_NEW_NDEF				 208
 | 
			
		||||
#define ASN1_F_B64_READ_ASN1				 208
 | 
			
		||||
#define ASN1_F_B64_WRITE_ASN1				 209
 | 
			
		||||
#define ASN1_F_BITSTR_CB				 180
 | 
			
		||||
#define ASN1_F_BN_TO_ASN1_ENUMERATED			 138
 | 
			
		||||
#define ASN1_F_BN_TO_ASN1_INTEGER			 139
 | 
			
		||||
@@ -1233,7 +1176,6 @@ void ERR_load_ASN1_strings(void);
 | 
			
		||||
#define ASN1_F_D2I_ASN1_TYPE_BYTES			 149
 | 
			
		||||
#define ASN1_F_D2I_ASN1_UINTEGER			 150
 | 
			
		||||
#define ASN1_F_D2I_ASN1_UTCTIME				 151
 | 
			
		||||
#define ASN1_F_D2I_AUTOPRIVATEKEY			 207
 | 
			
		||||
#define ASN1_F_D2I_NETSCAPE_RSA				 152
 | 
			
		||||
#define ASN1_F_D2I_NETSCAPE_RSA_2			 153
 | 
			
		||||
#define ASN1_F_D2I_PRIVATEKEY				 154
 | 
			
		||||
@@ -1243,7 +1185,6 @@ void ERR_load_ASN1_strings(void);
 | 
			
		||||
#define ASN1_F_D2I_X509					 156
 | 
			
		||||
#define ASN1_F_D2I_X509_CINF				 157
 | 
			
		||||
#define ASN1_F_D2I_X509_PKEY				 159
 | 
			
		||||
#define ASN1_F_I2D_ASN1_BIO_STREAM			 211
 | 
			
		||||
#define ASN1_F_I2D_ASN1_SET				 188
 | 
			
		||||
#define ASN1_F_I2D_ASN1_TIME				 160
 | 
			
		||||
#define ASN1_F_I2D_DSA_PUBKEY				 161
 | 
			
		||||
@@ -1255,11 +1196,10 @@ void ERR_load_ASN1_strings(void);
 | 
			
		||||
#define ASN1_F_LONG_C2I					 166
 | 
			
		||||
#define ASN1_F_OID_MODULE_INIT				 174
 | 
			
		||||
#define ASN1_F_PARSE_TAGGING				 182
 | 
			
		||||
#define ASN1_F_PKCS5_PBE2_SET_IV			 167
 | 
			
		||||
#define ASN1_F_PKCS5_PBE2_SET				 167
 | 
			
		||||
#define ASN1_F_PKCS5_PBE_SET				 202
 | 
			
		||||
#define ASN1_F_PKCS5_PBE_SET0_ALGOR			 215
 | 
			
		||||
#define ASN1_F_SMIME_READ_ASN1				 212
 | 
			
		||||
#define ASN1_F_SMIME_TEXT				 213
 | 
			
		||||
#define ASN1_F_SMIME_READ_ASN1				 210
 | 
			
		||||
#define ASN1_F_SMIME_TEXT				 211
 | 
			
		||||
#define ASN1_F_X509_CINF_NEW				 168
 | 
			
		||||
#define ASN1_F_X509_CRL_ADD0_REVOKED			 169
 | 
			
		||||
#define ASN1_F_X509_INFO_NEW				 170
 | 
			
		||||
@@ -1271,13 +1211,14 @@ void ERR_load_ASN1_strings(void);
 | 
			
		||||
 | 
			
		||||
/* Reason codes. */
 | 
			
		||||
#define ASN1_R_ADDING_OBJECT				 171
 | 
			
		||||
#define ASN1_R_ASN1_PARSE_ERROR				 203
 | 
			
		||||
#define ASN1_R_ASN1_SIG_PARSE_ERROR			 204
 | 
			
		||||
#define ASN1_R_ASN1_PARSE_ERROR				 198
 | 
			
		||||
#define ASN1_R_ASN1_SIG_PARSE_ERROR			 199
 | 
			
		||||
#define ASN1_R_AUX_ERROR				 100
 | 
			
		||||
#define ASN1_R_BAD_CLASS				 101
 | 
			
		||||
#define ASN1_R_BAD_OBJECT_HEADER			 102
 | 
			
		||||
#define ASN1_R_BAD_PASSWORD_READ			 103
 | 
			
		||||
#define ASN1_R_BAD_TAG					 104
 | 
			
		||||
#define ASN1_R_BMPSTRING_IS_WRONG_LENGTH		 210
 | 
			
		||||
#define ASN1_R_BN_LIB					 105
 | 
			
		||||
#define ASN1_R_BOOLEAN_IS_WRONG_LENGTH			 106
 | 
			
		||||
#define ASN1_R_BUFFER_TOO_SMALL				 107
 | 
			
		||||
@@ -1286,7 +1227,6 @@ void ERR_load_ASN1_strings(void);
 | 
			
		||||
#define ASN1_R_DECODE_ERROR				 110
 | 
			
		||||
#define ASN1_R_DECODING_ERROR				 111
 | 
			
		||||
#define ASN1_R_DEPTH_EXCEEDED				 174
 | 
			
		||||
#define ASN1_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED	 198
 | 
			
		||||
#define ASN1_R_ENCODE_ERROR				 112
 | 
			
		||||
#define ASN1_R_ERROR_GETTING_TIME			 173
 | 
			
		||||
#define ASN1_R_ERROR_LOADING_SECTION			 172
 | 
			
		||||
@@ -1320,7 +1260,7 @@ void ERR_load_ASN1_strings(void);
 | 
			
		||||
#define ASN1_R_INTEGER_TOO_LARGE_FOR_LONG		 128
 | 
			
		||||
#define ASN1_R_INVALID_BMPSTRING_LENGTH			 129
 | 
			
		||||
#define ASN1_R_INVALID_DIGIT				 130
 | 
			
		||||
#define ASN1_R_INVALID_MIME_TYPE			 205
 | 
			
		||||
#define ASN1_R_INVALID_MIME_TYPE			 200
 | 
			
		||||
#define ASN1_R_INVALID_MODIFIER				 186
 | 
			
		||||
#define ASN1_R_INVALID_NUMBER				 187
 | 
			
		||||
#define ASN1_R_INVALID_SEPARATOR			 131
 | 
			
		||||
@@ -1330,9 +1270,9 @@ void ERR_load_ASN1_strings(void);
 | 
			
		||||
#define ASN1_R_IV_TOO_LARGE				 135
 | 
			
		||||
#define ASN1_R_LENGTH_ERROR				 136
 | 
			
		||||
#define ASN1_R_LIST_ERROR				 188
 | 
			
		||||
#define ASN1_R_MIME_NO_CONTENT_TYPE			 206
 | 
			
		||||
#define ASN1_R_MIME_PARSE_ERROR				 207
 | 
			
		||||
#define ASN1_R_MIME_SIG_PARSE_ERROR			 208
 | 
			
		||||
#define ASN1_R_MIME_NO_CONTENT_TYPE			 201
 | 
			
		||||
#define ASN1_R_MIME_PARSE_ERROR				 202
 | 
			
		||||
#define ASN1_R_MIME_SIG_PARSE_ERROR			 203
 | 
			
		||||
#define ASN1_R_MISSING_EOC				 137
 | 
			
		||||
#define ASN1_R_MISSING_SECOND_NUMBER			 138
 | 
			
		||||
#define ASN1_R_MISSING_VALUE				 189
 | 
			
		||||
@@ -1342,12 +1282,11 @@ void ERR_load_ASN1_strings(void);
 | 
			
		||||
#define ASN1_R_NON_HEX_CHARACTERS			 141
 | 
			
		||||
#define ASN1_R_NOT_ASCII_FORMAT				 190
 | 
			
		||||
#define ASN1_R_NOT_ENOUGH_DATA				 142
 | 
			
		||||
#define ASN1_R_NO_CONTENT_TYPE				 209
 | 
			
		||||
#define ASN1_R_NO_DEFAULT_DIGEST			 201
 | 
			
		||||
#define ASN1_R_NO_CONTENT_TYPE				 204
 | 
			
		||||
#define ASN1_R_NO_MATCHING_CHOICE_TYPE			 143
 | 
			
		||||
#define ASN1_R_NO_MULTIPART_BODY_FAILURE		 210
 | 
			
		||||
#define ASN1_R_NO_MULTIPART_BOUNDARY			 211
 | 
			
		||||
#define ASN1_R_NO_SIG_CONTENT_TYPE			 212
 | 
			
		||||
#define ASN1_R_NO_MULTIPART_BODY_FAILURE		 205
 | 
			
		||||
#define ASN1_R_NO_MULTIPART_BOUNDARY			 206
 | 
			
		||||
#define ASN1_R_NO_SIG_CONTENT_TYPE			 207
 | 
			
		||||
#define ASN1_R_NULL_IS_WRONG_LENGTH			 144
 | 
			
		||||
#define ASN1_R_OBJECT_NOT_ASCII_FORMAT			 191
 | 
			
		||||
#define ASN1_R_ODD_NUMBER_OF_CHARS			 145
 | 
			
		||||
@@ -1357,8 +1296,8 @@ void ERR_load_ASN1_strings(void);
 | 
			
		||||
#define ASN1_R_SEQUENCE_NOT_CONSTRUCTED			 149
 | 
			
		||||
#define ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG		 192
 | 
			
		||||
#define ASN1_R_SHORT_LINE				 150
 | 
			
		||||
#define ASN1_R_SIG_INVALID_MIME_TYPE			 213
 | 
			
		||||
#define ASN1_R_STREAMING_NOT_SUPPORTED			 202
 | 
			
		||||
#define ASN1_R_SIG_INVALID_MIME_TYPE			 208
 | 
			
		||||
#define ASN1_R_STREAMING_NOT_SUPPORTED			 209
 | 
			
		||||
#define ASN1_R_STRING_TOO_LONG				 151
 | 
			
		||||
#define ASN1_R_STRING_TOO_SHORT				 152
 | 
			
		||||
#define ASN1_R_TAG_VALUE_TOO_HIGH			 153
 | 
			
		||||
@@ -1369,11 +1308,11 @@ void ERR_load_ASN1_strings(void);
 | 
			
		||||
#define ASN1_R_UNABLE_TO_DECODE_RSA_KEY			 157
 | 
			
		||||
#define ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY		 158
 | 
			
		||||
#define ASN1_R_UNEXPECTED_EOC				 159
 | 
			
		||||
#define ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH		 211
 | 
			
		||||
#define ASN1_R_UNKNOWN_FORMAT				 160
 | 
			
		||||
#define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM		 161
 | 
			
		||||
#define ASN1_R_UNKNOWN_OBJECT_TYPE			 162
 | 
			
		||||
#define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE			 163
 | 
			
		||||
#define ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM		 199
 | 
			
		||||
#define ASN1_R_UNKNOWN_TAG				 194
 | 
			
		||||
#define ASN1_R_UNKOWN_FORMAT				 195
 | 
			
		||||
#define ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE		 164
 | 
			
		||||
@@ -1381,7 +1320,6 @@ void ERR_load_ASN1_strings(void);
 | 
			
		||||
#define ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM		 166
 | 
			
		||||
#define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE		 167
 | 
			
		||||
#define ASN1_R_UNSUPPORTED_TYPE				 196
 | 
			
		||||
#define ASN1_R_WRONG_PUBLIC_KEY_TYPE			 200
 | 
			
		||||
#define ASN1_R_WRONG_TAG				 168
 | 
			
		||||
#define ASN1_R_WRONG_TYPE				 169
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
/* crypto/asn1/asn1_err.c */
 | 
			
		||||
/* ====================================================================
 | 
			
		||||
 * Copyright (c) 1999-2007 The OpenSSL Project.  All rights reserved.
 | 
			
		||||
 * Copyright (c) 1999-2008 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
 | 
			
		||||
@@ -93,7 +93,7 @@ static ERR_STRING_DATA ASN1_str_functs[]=
 | 
			
		||||
{ERR_FUNC(ASN1_F_ASN1_GENERALIZEDTIME_SET),	"ASN1_GENERALIZEDTIME_set"},
 | 
			
		||||
{ERR_FUNC(ASN1_F_ASN1_GENERATE_V3),	"ASN1_generate_v3"},
 | 
			
		||||
{ERR_FUNC(ASN1_F_ASN1_GET_OBJECT),	"ASN1_get_object"},
 | 
			
		||||
{ERR_FUNC(ASN1_F_ASN1_HEADER_NEW),	"ASN1_HEADER_NEW"},
 | 
			
		||||
{ERR_FUNC(ASN1_F_ASN1_HEADER_NEW),	"ASN1_HEADER_new"},
 | 
			
		||||
{ERR_FUNC(ASN1_F_ASN1_I2D_BIO),	"ASN1_i2d_bio"},
 | 
			
		||||
{ERR_FUNC(ASN1_F_ASN1_I2D_FP),	"ASN1_i2d_fp"},
 | 
			
		||||
{ERR_FUNC(ASN1_F_ASN1_INTEGER_SET),	"ASN1_INTEGER_set"},
 | 
			
		||||
@@ -112,7 +112,7 @@ static ERR_STRING_DATA ASN1_str_functs[]=
 | 
			
		||||
{ERR_FUNC(ASN1_F_ASN1_OBJECT_NEW),	"ASN1_OBJECT_new"},
 | 
			
		||||
{ERR_FUNC(ASN1_F_ASN1_OUTPUT_DATA),	"ASN1_OUTPUT_DATA"},
 | 
			
		||||
{ERR_FUNC(ASN1_F_ASN1_PACK_STRING),	"ASN1_pack_string"},
 | 
			
		||||
{ERR_FUNC(ASN1_F_ASN1_PCTX_NEW),	"ASN1_PCTX_new"},
 | 
			
		||||
{ERR_FUNC(ASN1_F_ASN1_PCTX_NEW),	"ASN1_PCTX_NEW"},
 | 
			
		||||
{ERR_FUNC(ASN1_F_ASN1_PKCS5_PBE_SET),	"ASN1_PKCS5_PBE_SET"},
 | 
			
		||||
{ERR_FUNC(ASN1_F_ASN1_SEQ_PACK),	"ASN1_seq_pack"},
 | 
			
		||||
{ERR_FUNC(ASN1_F_ASN1_SEQ_UNPACK),	"ASN1_seq_unpack"},
 | 
			
		||||
@@ -132,7 +132,6 @@ static ERR_STRING_DATA ASN1_str_functs[]=
 | 
			
		||||
{ERR_FUNC(ASN1_F_ASN1_VERIFY),	"ASN1_verify"},
 | 
			
		||||
{ERR_FUNC(ASN1_F_B64_READ_ASN1),	"B64_READ_ASN1"},
 | 
			
		||||
{ERR_FUNC(ASN1_F_B64_WRITE_ASN1),	"B64_WRITE_ASN1"},
 | 
			
		||||
{ERR_FUNC(ASN1_F_BIO_NEW_NDEF),	"BIO_new_NDEF"},
 | 
			
		||||
{ERR_FUNC(ASN1_F_BITSTR_CB),	"BITSTR_CB"},
 | 
			
		||||
{ERR_FUNC(ASN1_F_BN_TO_ASN1_ENUMERATED),	"BN_to_ASN1_ENUMERATED"},
 | 
			
		||||
{ERR_FUNC(ASN1_F_BN_TO_ASN1_INTEGER),	"BN_to_ASN1_INTEGER"},
 | 
			
		||||
@@ -144,14 +143,13 @@ static ERR_STRING_DATA ASN1_str_functs[]=
 | 
			
		||||
{ERR_FUNC(ASN1_F_D2I_ASN1_BOOLEAN),	"d2i_ASN1_BOOLEAN"},
 | 
			
		||||
{ERR_FUNC(ASN1_F_D2I_ASN1_BYTES),	"d2i_ASN1_bytes"},
 | 
			
		||||
{ERR_FUNC(ASN1_F_D2I_ASN1_GENERALIZEDTIME),	"D2I_ASN1_GENERALIZEDTIME"},
 | 
			
		||||
{ERR_FUNC(ASN1_F_D2I_ASN1_HEADER),	"D2I_ASN1_HEADER"},
 | 
			
		||||
{ERR_FUNC(ASN1_F_D2I_ASN1_HEADER),	"d2i_ASN1_HEADER"},
 | 
			
		||||
{ERR_FUNC(ASN1_F_D2I_ASN1_INTEGER),	"D2I_ASN1_INTEGER"},
 | 
			
		||||
{ERR_FUNC(ASN1_F_D2I_ASN1_OBJECT),	"d2i_ASN1_OBJECT"},
 | 
			
		||||
{ERR_FUNC(ASN1_F_D2I_ASN1_SET),	"d2i_ASN1_SET"},
 | 
			
		||||
{ERR_FUNC(ASN1_F_D2I_ASN1_TYPE_BYTES),	"d2i_ASN1_type_bytes"},
 | 
			
		||||
{ERR_FUNC(ASN1_F_D2I_ASN1_UINTEGER),	"d2i_ASN1_UINTEGER"},
 | 
			
		||||
{ERR_FUNC(ASN1_F_D2I_ASN1_UTCTIME),	"D2I_ASN1_UTCTIME"},
 | 
			
		||||
{ERR_FUNC(ASN1_F_D2I_AUTOPRIVATEKEY),	"d2i_AutoPrivateKey"},
 | 
			
		||||
{ERR_FUNC(ASN1_F_D2I_NETSCAPE_RSA),	"d2i_Netscape_RSA"},
 | 
			
		||||
{ERR_FUNC(ASN1_F_D2I_NETSCAPE_RSA_2),	"D2I_NETSCAPE_RSA_2"},
 | 
			
		||||
{ERR_FUNC(ASN1_F_D2I_PRIVATEKEY),	"d2i_PrivateKey"},
 | 
			
		||||
@@ -161,7 +159,6 @@ static ERR_STRING_DATA ASN1_str_functs[]=
 | 
			
		||||
{ERR_FUNC(ASN1_F_D2I_X509),	"D2I_X509"},
 | 
			
		||||
{ERR_FUNC(ASN1_F_D2I_X509_CINF),	"D2I_X509_CINF"},
 | 
			
		||||
{ERR_FUNC(ASN1_F_D2I_X509_PKEY),	"d2i_X509_PKEY"},
 | 
			
		||||
{ERR_FUNC(ASN1_F_I2D_ASN1_BIO_STREAM),	"i2d_ASN1_bio_stream"},
 | 
			
		||||
{ERR_FUNC(ASN1_F_I2D_ASN1_SET),	"i2d_ASN1_SET"},
 | 
			
		||||
{ERR_FUNC(ASN1_F_I2D_ASN1_TIME),	"I2D_ASN1_TIME"},
 | 
			
		||||
{ERR_FUNC(ASN1_F_I2D_DSA_PUBKEY),	"i2d_DSA_PUBKEY"},
 | 
			
		||||
@@ -173,10 +170,9 @@ static ERR_STRING_DATA ASN1_str_functs[]=
 | 
			
		||||
{ERR_FUNC(ASN1_F_LONG_C2I),	"LONG_C2I"},
 | 
			
		||||
{ERR_FUNC(ASN1_F_OID_MODULE_INIT),	"OID_MODULE_INIT"},
 | 
			
		||||
{ERR_FUNC(ASN1_F_PARSE_TAGGING),	"PARSE_TAGGING"},
 | 
			
		||||
{ERR_FUNC(ASN1_F_PKCS5_PBE2_SET_IV),	"PKCS5_pbe2_set_iv"},
 | 
			
		||||
{ERR_FUNC(ASN1_F_PKCS5_PBE2_SET),	"PKCS5_pbe2_set"},
 | 
			
		||||
{ERR_FUNC(ASN1_F_PKCS5_PBE_SET),	"PKCS5_pbe_set"},
 | 
			
		||||
{ERR_FUNC(ASN1_F_PKCS5_PBE_SET0_ALGOR),	"PKCS5_pbe_set0_algor"},
 | 
			
		||||
{ERR_FUNC(ASN1_F_SMIME_READ_ASN1),	"SMIME_read_asn1"},
 | 
			
		||||
{ERR_FUNC(ASN1_F_SMIME_READ_ASN1),	"SMIME_read_ASN1"},
 | 
			
		||||
{ERR_FUNC(ASN1_F_SMIME_TEXT),	"SMIME_text"},
 | 
			
		||||
{ERR_FUNC(ASN1_F_X509_CINF_NEW),	"X509_CINF_NEW"},
 | 
			
		||||
{ERR_FUNC(ASN1_F_X509_CRL_ADD0_REVOKED),	"X509_CRL_add0_revoked"},
 | 
			
		||||
@@ -199,6 +195,7 @@ static ERR_STRING_DATA ASN1_str_reasons[]=
 | 
			
		||||
{ERR_REASON(ASN1_R_BAD_OBJECT_HEADER)    ,"bad object header"},
 | 
			
		||||
{ERR_REASON(ASN1_R_BAD_PASSWORD_READ)    ,"bad password read"},
 | 
			
		||||
{ERR_REASON(ASN1_R_BAD_TAG)              ,"bad tag"},
 | 
			
		||||
{ERR_REASON(ASN1_R_BMPSTRING_IS_WRONG_LENGTH),"bmpstring is wrong length"},
 | 
			
		||||
{ERR_REASON(ASN1_R_BN_LIB)               ,"bn lib"},
 | 
			
		||||
{ERR_REASON(ASN1_R_BOOLEAN_IS_WRONG_LENGTH),"boolean is wrong length"},
 | 
			
		||||
{ERR_REASON(ASN1_R_BUFFER_TOO_SMALL)     ,"buffer too small"},
 | 
			
		||||
@@ -207,7 +204,6 @@ static ERR_STRING_DATA ASN1_str_reasons[]=
 | 
			
		||||
{ERR_REASON(ASN1_R_DECODE_ERROR)         ,"decode error"},
 | 
			
		||||
{ERR_REASON(ASN1_R_DECODING_ERROR)       ,"decoding error"},
 | 
			
		||||
{ERR_REASON(ASN1_R_DEPTH_EXCEEDED)       ,"depth exceeded"},
 | 
			
		||||
{ERR_REASON(ASN1_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED),"digest and key type not supported"},
 | 
			
		||||
{ERR_REASON(ASN1_R_ENCODE_ERROR)         ,"encode error"},
 | 
			
		||||
{ERR_REASON(ASN1_R_ERROR_GETTING_TIME)   ,"error getting time"},
 | 
			
		||||
{ERR_REASON(ASN1_R_ERROR_LOADING_SECTION),"error loading section"},
 | 
			
		||||
@@ -264,7 +260,6 @@ static ERR_STRING_DATA ASN1_str_reasons[]=
 | 
			
		||||
{ERR_REASON(ASN1_R_NOT_ASCII_FORMAT)     ,"not ascii format"},
 | 
			
		||||
{ERR_REASON(ASN1_R_NOT_ENOUGH_DATA)      ,"not enough data"},
 | 
			
		||||
{ERR_REASON(ASN1_R_NO_CONTENT_TYPE)      ,"no content type"},
 | 
			
		||||
{ERR_REASON(ASN1_R_NO_DEFAULT_DIGEST)    ,"no default digest"},
 | 
			
		||||
{ERR_REASON(ASN1_R_NO_MATCHING_CHOICE_TYPE),"no matching choice type"},
 | 
			
		||||
{ERR_REASON(ASN1_R_NO_MULTIPART_BODY_FAILURE),"no multipart body failure"},
 | 
			
		||||
{ERR_REASON(ASN1_R_NO_MULTIPART_BOUNDARY),"no multipart boundary"},
 | 
			
		||||
@@ -290,11 +285,11 @@ static ERR_STRING_DATA ASN1_str_reasons[]=
 | 
			
		||||
{ERR_REASON(ASN1_R_UNABLE_TO_DECODE_RSA_KEY),"unable to decode rsa key"},
 | 
			
		||||
{ERR_REASON(ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY),"unable to decode rsa private key"},
 | 
			
		||||
{ERR_REASON(ASN1_R_UNEXPECTED_EOC)       ,"unexpected eoc"},
 | 
			
		||||
{ERR_REASON(ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH),"universalstring is wrong length"},
 | 
			
		||||
{ERR_REASON(ASN1_R_UNKNOWN_FORMAT)       ,"unknown format"},
 | 
			
		||||
{ERR_REASON(ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM),"unknown message digest algorithm"},
 | 
			
		||||
{ERR_REASON(ASN1_R_UNKNOWN_OBJECT_TYPE)  ,"unknown object type"},
 | 
			
		||||
{ERR_REASON(ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE),"unknown public key type"},
 | 
			
		||||
{ERR_REASON(ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM),"unknown signature algorithm"},
 | 
			
		||||
{ERR_REASON(ASN1_R_UNKNOWN_TAG)          ,"unknown tag"},
 | 
			
		||||
{ERR_REASON(ASN1_R_UNKOWN_FORMAT)        ,"unkown format"},
 | 
			
		||||
{ERR_REASON(ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE),"unsupported any defined by type"},
 | 
			
		||||
@@ -302,7 +297,6 @@ static ERR_STRING_DATA ASN1_str_reasons[]=
 | 
			
		||||
{ERR_REASON(ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM),"unsupported encryption algorithm"},
 | 
			
		||||
{ERR_REASON(ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE),"unsupported public key type"},
 | 
			
		||||
{ERR_REASON(ASN1_R_UNSUPPORTED_TYPE)     ,"unsupported type"},
 | 
			
		||||
{ERR_REASON(ASN1_R_WRONG_PUBLIC_KEY_TYPE),"wrong public key type"},
 | 
			
		||||
{ERR_REASON(ASN1_R_WRONG_TAG)            ,"wrong tag"},
 | 
			
		||||
{ERR_REASON(ASN1_R_WRONG_TYPE)           ,"wrong type"},
 | 
			
		||||
{0,NULL}
 | 
			
		||||
 
 | 
			
		||||
@@ -245,14 +245,8 @@ ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf)
 | 
			
		||||
	/* If IMPLICIT, output tag */
 | 
			
		||||
 | 
			
		||||
	if (asn1_tags.imp_tag != -1)
 | 
			
		||||
		{
 | 
			
		||||
		if (asn1_tags.imp_class == V_ASN1_UNIVERSAL 
 | 
			
		||||
		    && (asn1_tags.imp_tag == V_ASN1_SEQUENCE
 | 
			
		||||
		     || asn1_tags.imp_tag == V_ASN1_SET) )
 | 
			
		||||
			hdr_constructed = V_ASN1_CONSTRUCTED;
 | 
			
		||||
		ASN1_put_object(&p, hdr_constructed, hdr_len,
 | 
			
		||||
					asn1_tags.imp_tag, asn1_tags.imp_class);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	/* Copy across original encoding */
 | 
			
		||||
	memcpy(p, cpy_start, cpy_len);
 | 
			
		||||
@@ -445,12 +439,12 @@ static int parse_tagging(const char *vstart, int vlen, int *ptag, int *pclass)
 | 
			
		||||
 | 
			
		||||
static ASN1_TYPE *asn1_multi(int utype, const char *section, X509V3_CTX *cnf)
 | 
			
		||||
	{
 | 
			
		||||
	ASN1_TYPE *ret = NULL;
 | 
			
		||||
	ASN1_TYPE *ret = NULL, *typ = NULL;
 | 
			
		||||
	STACK_OF(ASN1_TYPE) *sk = NULL;
 | 
			
		||||
	STACK_OF(CONF_VALUE) *sect = NULL;
 | 
			
		||||
	unsigned char *der = NULL;
 | 
			
		||||
	unsigned char *der = NULL, *p;
 | 
			
		||||
	int derlen;
 | 
			
		||||
	int i;
 | 
			
		||||
	int i, is_set;
 | 
			
		||||
	sk = sk_ASN1_TYPE_new_null();
 | 
			
		||||
	if (section)
 | 
			
		||||
		{
 | 
			
		||||
@@ -461,19 +455,28 @@ static ASN1_TYPE *asn1_multi(int utype, const char *section, X509V3_CTX *cnf)
 | 
			
		||||
			goto bad;
 | 
			
		||||
		for (i = 0; i < sk_CONF_VALUE_num(sect); i++)
 | 
			
		||||
			{
 | 
			
		||||
			ASN1_TYPE *typ = ASN1_generate_v3(sk_CONF_VALUE_value(sect, i)->value, cnf);
 | 
			
		||||
			typ = ASN1_generate_v3(sk_CONF_VALUE_value(sect, i)->value, cnf);
 | 
			
		||||
			if (!typ)
 | 
			
		||||
				goto bad;
 | 
			
		||||
			sk_ASN1_TYPE_push(sk, typ);
 | 
			
		||||
			typ = NULL;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	/* Now we has a STACK of the components, convert to the correct form */
 | 
			
		||||
 | 
			
		||||
	if (utype == V_ASN1_SET)
 | 
			
		||||
		derlen = i2d_ASN1_SET_ANY(sk, &der);
 | 
			
		||||
		is_set = 1;
 | 
			
		||||
	else
 | 
			
		||||
		derlen = i2d_ASN1_SEQUENCE_ANY(sk, &der);
 | 
			
		||||
		is_set = 0;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	derlen = i2d_ASN1_SET_OF_ASN1_TYPE(sk, NULL, i2d_ASN1_TYPE, utype,
 | 
			
		||||
					   V_ASN1_UNIVERSAL, is_set);
 | 
			
		||||
	der = OPENSSL_malloc(derlen);
 | 
			
		||||
	p = der;
 | 
			
		||||
	i2d_ASN1_SET_OF_ASN1_TYPE(sk, &p, i2d_ASN1_TYPE, utype,
 | 
			
		||||
				  V_ASN1_UNIVERSAL, is_set);
 | 
			
		||||
 | 
			
		||||
	if (!(ret = ASN1_TYPE_new()))
 | 
			
		||||
		goto bad;
 | 
			
		||||
@@ -495,6 +498,8 @@ static ASN1_TYPE *asn1_multi(int utype, const char *section, X509V3_CTX *cnf)
 | 
			
		||||
 | 
			
		||||
	if (sk)
 | 
			
		||||
		sk_ASN1_TYPE_pop_free(sk, ASN1_TYPE_free);
 | 
			
		||||
	if (typ)
 | 
			
		||||
		ASN1_TYPE_free(typ);
 | 
			
		||||
	if (sect)
 | 
			
		||||
		X509V3_section_free(cnf, sect);
 | 
			
		||||
 | 
			
		||||
@@ -544,7 +549,7 @@ static int append_exp(tag_exp_arg *arg, int exp_tag, int exp_class, int exp_cons
 | 
			
		||||
static int asn1_str2tag(const char *tagstr, int len)
 | 
			
		||||
	{
 | 
			
		||||
	unsigned int i;
 | 
			
		||||
	static const struct tag_name_st *tntmp, tnst [] = {
 | 
			
		||||
	static struct tag_name_st *tntmp, tnst [] = {
 | 
			
		||||
		ASN1_GEN_STR("BOOL", V_ASN1_BOOLEAN),
 | 
			
		||||
		ASN1_GEN_STR("BOOLEAN", V_ASN1_BOOLEAN),
 | 
			
		||||
		ASN1_GEN_STR("NULL", V_ASN1_NULL),
 | 
			
		||||
@@ -579,8 +584,6 @@ static int asn1_str2tag(const char *tagstr, int len)
 | 
			
		||||
		ASN1_GEN_STR("TELETEXSTRING", V_ASN1_T61STRING),
 | 
			
		||||
		ASN1_GEN_STR("GeneralString", V_ASN1_GENERALSTRING),
 | 
			
		||||
		ASN1_GEN_STR("GENSTR", V_ASN1_GENERALSTRING),
 | 
			
		||||
		ASN1_GEN_STR("NUMERIC", V_ASN1_NUMERICSTRING),
 | 
			
		||||
		ASN1_GEN_STR("NUMERICSTRING", V_ASN1_NUMERICSTRING),
 | 
			
		||||
 | 
			
		||||
		/* Special cases */
 | 
			
		||||
		ASN1_GEN_STR("SEQUENCE", V_ASN1_SEQUENCE),
 | 
			
		||||
@@ -726,7 +729,6 @@ static ASN1_TYPE *asn1_str2type(const char *str, int format, int utype)
 | 
			
		||||
		case V_ASN1_VISIBLESTRING:
 | 
			
		||||
		case V_ASN1_UNIVERSALSTRING:
 | 
			
		||||
		case V_ASN1_GENERALSTRING:
 | 
			
		||||
		case V_ASN1_NUMERICSTRING:
 | 
			
		||||
 | 
			
		||||
		if (format == ASN1_GEN_FORMAT_ASCII)
 | 
			
		||||
			format = MBSTRING_ASC;
 | 
			
		||||
 
 | 
			
		||||
@@ -340,31 +340,20 @@ int asn1_GetSequence(ASN1_const_CTX *c, long *length)
 | 
			
		||||
	return(1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
int ASN1_STRING_copy(ASN1_STRING *dst, const ASN1_STRING *str)
 | 
			
		||||
	{
 | 
			
		||||
	if (str == NULL)
 | 
			
		||||
		return 0;
 | 
			
		||||
	dst->type = str->type;
 | 
			
		||||
	if (!ASN1_STRING_set(dst,str->data,str->length))
 | 
			
		||||
		return 0;
 | 
			
		||||
	dst->flags = str->flags;
 | 
			
		||||
	return 1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
ASN1_STRING *ASN1_STRING_dup(const ASN1_STRING *str)
 | 
			
		||||
ASN1_STRING *ASN1_STRING_dup(ASN1_STRING *str)
 | 
			
		||||
	{
 | 
			
		||||
	ASN1_STRING *ret;
 | 
			
		||||
	if (!str)
 | 
			
		||||
		 return NULL;
 | 
			
		||||
	ret=ASN1_STRING_new();
 | 
			
		||||
	if (!ret)
 | 
			
		||||
		return NULL;
 | 
			
		||||
	if (!ASN1_STRING_copy(ret,str))
 | 
			
		||||
 | 
			
		||||
	if (str == NULL) return(NULL);
 | 
			
		||||
	if ((ret=ASN1_STRING_type_new(str->type)) == NULL)
 | 
			
		||||
		return(NULL);
 | 
			
		||||
	if (!ASN1_STRING_set(ret,str->data,str->length))
 | 
			
		||||
		{
 | 
			
		||||
		ASN1_STRING_free(ret);
 | 
			
		||||
		return NULL;
 | 
			
		||||
		return(NULL);
 | 
			
		||||
		}
 | 
			
		||||
	return ret;
 | 
			
		||||
	ret->flags = str->flags;
 | 
			
		||||
	return(ret);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len)
 | 
			
		||||
@@ -438,12 +427,11 @@ ASN1_STRING *ASN1_STRING_type_new(int type)
 | 
			
		||||
void ASN1_STRING_free(ASN1_STRING *a)
 | 
			
		||||
	{
 | 
			
		||||
	if (a == NULL) return;
 | 
			
		||||
	if (a->data && !(a->flags & ASN1_STRING_FLAG_NDEF))
 | 
			
		||||
		OPENSSL_free(a->data);
 | 
			
		||||
	if (a->data != NULL) OPENSSL_free(a->data);
 | 
			
		||||
	OPENSSL_free(a);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
int ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b)
 | 
			
		||||
int ASN1_STRING_cmp(ASN1_STRING *a, ASN1_STRING *b)
 | 
			
		||||
	{
 | 
			
		||||
	int i;
 | 
			
		||||
 | 
			
		||||
@@ -469,7 +457,7 @@ void asn1_add_error(const unsigned char *address, int offset)
 | 
			
		||||
	ERR_add_error_data(4,"address=",buf1," offset=",buf2);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
int ASN1_STRING_length(const ASN1_STRING *x)
 | 
			
		||||
int ASN1_STRING_length(ASN1_STRING *x)
 | 
			
		||||
{ return M_ASN1_STRING_length(x); }
 | 
			
		||||
 | 
			
		||||
void ASN1_STRING_length_set(ASN1_STRING *x, int len)
 | 
			
		||||
 
 | 
			
		||||
@@ -153,13 +153,6 @@ err:\
 | 
			
		||||
		M_ASN1_D2I_get(b,func); \
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
#define M_ASN1_D2I_get_int_opt(b,func,type) \
 | 
			
		||||
	if ((c.slen != 0) && ((M_ASN1_next & (~V_ASN1_CONSTRUCTED)) \
 | 
			
		||||
		== (V_ASN1_UNIVERSAL|(type)))) \
 | 
			
		||||
		{ \
 | 
			
		||||
		M_ASN1_D2I_get_int(b,func); \
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
#define M_ASN1_D2I_get_imp(b,func, type) \
 | 
			
		||||
	M_ASN1_next=(_tmp& V_ASN1_CONSTRUCTED)|type; \
 | 
			
		||||
	c.q=c.p; \
 | 
			
		||||
 
 | 
			
		||||
@@ -70,8 +70,9 @@ static int asn1_print_info(BIO *bp, int tag, int xclass, int constructed,
 | 
			
		||||
	     int indent)
 | 
			
		||||
	{
 | 
			
		||||
	static const char fmt[]="%-18s";
 | 
			
		||||
	static const char fmt2[]="%2d %-15s";
 | 
			
		||||
	char str[128];
 | 
			
		||||
	const char *p;
 | 
			
		||||
	const char *p,*p2=NULL;
 | 
			
		||||
 | 
			
		||||
	if (constructed & V_ASN1_CONSTRUCTED)
 | 
			
		||||
		p="cons: ";
 | 
			
		||||
@@ -92,8 +93,14 @@ static int asn1_print_info(BIO *bp, int tag, int xclass, int constructed,
 | 
			
		||||
	else
 | 
			
		||||
		p = ASN1_tag2str(tag);
 | 
			
		||||
 | 
			
		||||
	if (BIO_printf(bp,fmt,p) <= 0)
 | 
			
		||||
		goto err;
 | 
			
		||||
	if (p2 != NULL)
 | 
			
		||||
		{
 | 
			
		||||
		if (BIO_printf(bp,fmt2,tag,p2) <= 0) goto err;
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		if (BIO_printf(bp,fmt,p) <= 0) goto err;
 | 
			
		||||
		}
 | 
			
		||||
	return(1);
 | 
			
		||||
err:
 | 
			
		||||
	return(0);
 | 
			
		||||
@@ -417,7 +424,7 @@ end:
 | 
			
		||||
 | 
			
		||||
const char *ASN1_tag2str(int tag)
 | 
			
		||||
{
 | 
			
		||||
	static const char * const tag2str[] = {
 | 
			
		||||
	static const char *tag2str[] = {
 | 
			
		||||
	 "EOC", "BOOLEAN", "INTEGER", "BIT STRING", "OCTET STRING", /* 0-4 */
 | 
			
		||||
	 "NULL", "OBJECT", "OBJECT DESCRIPTOR", "EXTERNAL", "REAL", /* 5-9 */
 | 
			
		||||
	 "ENUMERATED", "<ASN1 11>", "UTF8STRING", "<ASN1 13>", 	    /* 10-13 */
 | 
			
		||||
 
 | 
			
		||||
@@ -3,7 +3,7 @@
 | 
			
		||||
 * project 2000.
 | 
			
		||||
 */
 | 
			
		||||
/* ====================================================================
 | 
			
		||||
 * Copyright (c) 2000-2005 The OpenSSL Project.  All rights reserved.
 | 
			
		||||
 * Copyright (c) 2000 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
 | 
			
		||||
@@ -218,18 +218,6 @@ extern "C" {
 | 
			
		||||
		#stname \
 | 
			
		||||
	ASN1_ITEM_end(tname)
 | 
			
		||||
 | 
			
		||||
#define ASN1_NDEF_SEQUENCE_END_cb(stname, tname) \
 | 
			
		||||
	;\
 | 
			
		||||
	ASN1_ITEM_start(tname) \
 | 
			
		||||
		ASN1_ITYPE_NDEF_SEQUENCE,\
 | 
			
		||||
		V_ASN1_SEQUENCE,\
 | 
			
		||||
		tname##_seq_tt,\
 | 
			
		||||
		sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
 | 
			
		||||
		&tname##_aux,\
 | 
			
		||||
		sizeof(stname),\
 | 
			
		||||
		#stname \
 | 
			
		||||
	ASN1_ITEM_end(tname)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* This pair helps declare a CHOICE type. We can do:
 | 
			
		||||
 *
 | 
			
		||||
@@ -663,13 +651,8 @@ typedef int ASN1_ex_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_ITEM
 | 
			
		||||
typedef int ASN1_ex_new_func(ASN1_VALUE **pval, const ASN1_ITEM *it);
 | 
			
		||||
typedef void ASN1_ex_free_func(ASN1_VALUE **pval, const ASN1_ITEM *it);
 | 
			
		||||
 | 
			
		||||
typedef int ASN1_ex_print_func(BIO *out, ASN1_VALUE **pval, 
 | 
			
		||||
						int indent, const char *fname, 
 | 
			
		||||
						const ASN1_PCTX *pctx);
 | 
			
		||||
 | 
			
		||||
typedef int ASN1_primitive_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, const ASN1_ITEM *it);
 | 
			
		||||
typedef int ASN1_primitive_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, int utype, char *free_cont, const ASN1_ITEM *it);
 | 
			
		||||
typedef int ASN1_primitive_print(BIO *out, ASN1_VALUE **pval, const ASN1_ITEM *it, int indent, const ASN1_PCTX *pctx);
 | 
			
		||||
 | 
			
		||||
typedef struct ASN1_COMPAT_FUNCS_st {
 | 
			
		||||
	ASN1_new_func *asn1_new;
 | 
			
		||||
@@ -685,7 +668,6 @@ typedef struct ASN1_EXTERN_FUNCS_st {
 | 
			
		||||
	ASN1_ex_free_func *asn1_ex_clear;
 | 
			
		||||
	ASN1_ex_d2i *asn1_ex_d2i;
 | 
			
		||||
	ASN1_ex_i2d *asn1_ex_i2d;
 | 
			
		||||
	ASN1_ex_print_func *asn1_ex_print;
 | 
			
		||||
} ASN1_EXTERN_FUNCS;
 | 
			
		||||
 | 
			
		||||
typedef struct ASN1_PRIMITIVE_FUNCS_st {
 | 
			
		||||
@@ -696,7 +678,6 @@ typedef struct ASN1_PRIMITIVE_FUNCS_st {
 | 
			
		||||
	ASN1_ex_free_func *prim_clear;
 | 
			
		||||
	ASN1_primitive_c2i *prim_c2i;
 | 
			
		||||
	ASN1_primitive_i2c *prim_i2c;
 | 
			
		||||
	ASN1_primitive_print *prim_print;
 | 
			
		||||
} ASN1_PRIMITIVE_FUNCS;
 | 
			
		||||
 | 
			
		||||
/* This is the ASN1_AUX structure: it handles various
 | 
			
		||||
@@ -716,8 +697,7 @@ typedef struct ASN1_PRIMITIVE_FUNCS_st {
 | 
			
		||||
 * then an external type is more appropriate.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
typedef int ASN1_aux_cb(int operation, ASN1_VALUE **in, const ASN1_ITEM *it,
 | 
			
		||||
				void *exarg);
 | 
			
		||||
typedef int ASN1_aux_cb(int operation, ASN1_VALUE **in, const ASN1_ITEM *it);
 | 
			
		||||
 | 
			
		||||
typedef struct ASN1_AUX_st {
 | 
			
		||||
	void *app_data;
 | 
			
		||||
@@ -728,23 +708,6 @@ typedef struct ASN1_AUX_st {
 | 
			
		||||
	int enc_offset;		/* Offset of ASN1_ENCODING structure */
 | 
			
		||||
} ASN1_AUX;
 | 
			
		||||
 | 
			
		||||
/* For print related callbacks exarg points to this structure */
 | 
			
		||||
typedef struct ASN1_PRINT_ARG_st {
 | 
			
		||||
	BIO *out;
 | 
			
		||||
	int indent;
 | 
			
		||||
	const ASN1_PCTX *pctx;
 | 
			
		||||
} ASN1_PRINT_ARG;
 | 
			
		||||
 | 
			
		||||
/* For streaming related callbacks exarg points to this structure */
 | 
			
		||||
typedef struct ASN1_STREAM_ARG_st {
 | 
			
		||||
	/* BIO to stream through */
 | 
			
		||||
	BIO *out;
 | 
			
		||||
	/* BIO with filters appended */
 | 
			
		||||
	BIO *ndef_bio;
 | 
			
		||||
	/* Streaming I/O boundary */
 | 
			
		||||
	unsigned char **boundary;
 | 
			
		||||
} ASN1_STREAM_ARG;
 | 
			
		||||
 | 
			
		||||
/* Flags in ASN1_AUX */
 | 
			
		||||
 | 
			
		||||
/* Use a reference count */
 | 
			
		||||
@@ -764,12 +727,6 @@ typedef struct ASN1_STREAM_ARG_st {
 | 
			
		||||
#define ASN1_OP_D2I_POST	5
 | 
			
		||||
#define ASN1_OP_I2D_PRE		6
 | 
			
		||||
#define ASN1_OP_I2D_POST	7
 | 
			
		||||
#define ASN1_OP_PRINT_PRE	8
 | 
			
		||||
#define ASN1_OP_PRINT_POST	9
 | 
			
		||||
#define ASN1_OP_STREAM_PRE	10
 | 
			
		||||
#define ASN1_OP_STREAM_POST	11
 | 
			
		||||
#define ASN1_OP_DETACHED_PRE	12
 | 
			
		||||
#define ASN1_OP_DETACHED_POST	13
 | 
			
		||||
 | 
			
		||||
/* Macro to implement a primitive type */
 | 
			
		||||
#define IMPLEMENT_ASN1_TYPE(stname) IMPLEMENT_ASN1_TYPE_ex(stname, stname, 0)
 | 
			
		||||
@@ -825,22 +782,9 @@ typedef struct ASN1_STREAM_ARG_st {
 | 
			
		||||
#define IMPLEMENT_ASN1_FUNCTIONS_ENCODE_name(stname, itname) \
 | 
			
		||||
			IMPLEMENT_ASN1_FUNCTIONS_ENCODE_fname(stname, itname, itname)
 | 
			
		||||
 | 
			
		||||
#define IMPLEMENT_STATIC_ASN1_ALLOC_FUNCTIONS(stname) \
 | 
			
		||||
		IMPLEMENT_ASN1_ALLOC_FUNCTIONS_pfname(static, stname, stname, stname)
 | 
			
		||||
 | 
			
		||||
#define IMPLEMENT_ASN1_ALLOC_FUNCTIONS(stname) \
 | 
			
		||||
		IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, stname, stname)
 | 
			
		||||
 | 
			
		||||
#define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_pfname(pre, stname, itname, fname) \
 | 
			
		||||
	pre stname *fname##_new(void) \
 | 
			
		||||
	{ \
 | 
			
		||||
		return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \
 | 
			
		||||
	} \
 | 
			
		||||
	pre void fname##_free(stname *a) \
 | 
			
		||||
	{ \
 | 
			
		||||
		ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
#define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) \
 | 
			
		||||
	stname *fname##_new(void) \
 | 
			
		||||
	{ \
 | 
			
		||||
@@ -890,17 +834,6 @@ typedef struct ASN1_STREAM_ARG_st {
 | 
			
		||||
        return ASN1_item_dup(ASN1_ITEM_rptr(stname), x); \
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
#define IMPLEMENT_ASN1_PRINT_FUNCTION(stname) \
 | 
			
		||||
	IMPLEMENT_ASN1_PRINT_FUNCTION_fname(stname, stname, stname)
 | 
			
		||||
 | 
			
		||||
#define IMPLEMENT_ASN1_PRINT_FUNCTION_fname(stname, itname, fname) \
 | 
			
		||||
	int fname##_print_ctx(BIO *out, stname *x, int indent, \
 | 
			
		||||
						const ASN1_PCTX *pctx) \
 | 
			
		||||
	{ \
 | 
			
		||||
		return ASN1_item_print(out, (ASN1_VALUE *)x, indent, \
 | 
			
		||||
			ASN1_ITEM_rptr(itname), pctx); \
 | 
			
		||||
	} 
 | 
			
		||||
 | 
			
		||||
#define IMPLEMENT_ASN1_FUNCTIONS_const(name) \
 | 
			
		||||
		IMPLEMENT_ASN1_FUNCTIONS_const_fname(name, name, name)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -59,7 +59,6 @@
 | 
			
		||||
#include <openssl/x509.h>
 | 
			
		||||
#include <openssl/asn1.h>
 | 
			
		||||
#include <openssl/asn1t.h>
 | 
			
		||||
#include "asn1_locl.h"
 | 
			
		||||
 | 
			
		||||
/* Generalised MIME like utilities for streaming ASN1. Although many
 | 
			
		||||
 * have a PKCS7/CMS like flavour others are more general purpose.
 | 
			
		||||
@@ -87,8 +86,6 @@ STACK_OF(MIME_PARAM) *params;		/* Zero or more parameters */
 | 
			
		||||
DECLARE_STACK_OF(MIME_HEADER)
 | 
			
		||||
IMPLEMENT_STACK_OF(MIME_HEADER)
 | 
			
		||||
 | 
			
		||||
static int asn1_output_data(BIO *out, BIO *data, ASN1_VALUE *val, int flags,
 | 
			
		||||
					const ASN1_ITEM *it);
 | 
			
		||||
static char * strip_ends(char *name);
 | 
			
		||||
static char * strip_start(char *name);
 | 
			
		||||
static char * strip_end(char *name);
 | 
			
		||||
@@ -110,39 +107,6 @@ static void mime_hdr_free(MIME_HEADER *hdr);
 | 
			
		||||
#define MAX_SMLEN 1024
 | 
			
		||||
#define mime_debug(x) /* x */
 | 
			
		||||
 | 
			
		||||
/* Output an ASN1 structure in BER format streaming if necessary */
 | 
			
		||||
 | 
			
		||||
int i2d_ASN1_bio_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags,
 | 
			
		||||
				const ASN1_ITEM *it)
 | 
			
		||||
	{
 | 
			
		||||
	/* If streaming create stream BIO and copy all content through it */
 | 
			
		||||
	if (flags & SMIME_STREAM)
 | 
			
		||||
		{
 | 
			
		||||
		BIO *bio, *tbio;
 | 
			
		||||
		bio = BIO_new_NDEF(out, val, it);
 | 
			
		||||
		if (!bio)
 | 
			
		||||
			{
 | 
			
		||||
			ASN1err(ASN1_F_I2D_ASN1_BIO_STREAM,ERR_R_MALLOC_FAILURE);
 | 
			
		||||
			return 0;
 | 
			
		||||
			}
 | 
			
		||||
		SMIME_crlf_copy(in, bio, flags);
 | 
			
		||||
		(void)BIO_flush(bio);
 | 
			
		||||
		/* Free up successive BIOs until we hit the old output BIO */
 | 
			
		||||
		do
 | 
			
		||||
			{
 | 
			
		||||
			tbio = BIO_pop(bio);
 | 
			
		||||
			BIO_free(bio);
 | 
			
		||||
			bio = tbio;
 | 
			
		||||
			} while (bio != out);
 | 
			
		||||
		}
 | 
			
		||||
	/* else just write out ASN1 structure which will have all content
 | 
			
		||||
	 * stored internally
 | 
			
		||||
	 */
 | 
			
		||||
	else
 | 
			
		||||
		ASN1_item_i2d_bio(it, out, val);
 | 
			
		||||
	return 1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
/* Base 64 read and write of ASN1 structure */
 | 
			
		||||
 | 
			
		||||
static int B64_write_ASN1(BIO *out, ASN1_VALUE *val, BIO *in, int flags,
 | 
			
		||||
@@ -159,26 +123,13 @@ static int B64_write_ASN1(BIO *out, ASN1_VALUE *val, BIO *in, int flags,
 | 
			
		||||
	/* prepend the b64 BIO so all data is base64 encoded.
 | 
			
		||||
	 */
 | 
			
		||||
	out = BIO_push(b64, out);
 | 
			
		||||
	r = i2d_ASN1_bio_stream(out, val, in, flags, it);
 | 
			
		||||
	r = ASN1_item_i2d_bio(it, out, val);
 | 
			
		||||
	(void)BIO_flush(out);
 | 
			
		||||
	BIO_pop(out);
 | 
			
		||||
	BIO_free(b64);
 | 
			
		||||
	return r;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
/* Streaming ASN1 PEM write */
 | 
			
		||||
 | 
			
		||||
int PEM_write_bio_ASN1_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags,
 | 
			
		||||
				const char *hdr,
 | 
			
		||||
				const ASN1_ITEM *it)
 | 
			
		||||
	{
 | 
			
		||||
	int r;
 | 
			
		||||
	BIO_printf(out, "-----BEGIN %s-----\n", hdr);
 | 
			
		||||
	r = B64_write_ASN1(out, val, in, flags, it);
 | 
			
		||||
	BIO_printf(out, "-----END %s-----\n", hdr);
 | 
			
		||||
	return r;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static ASN1_VALUE *b64_read_asn1(BIO *bio, const ASN1_ITEM *it)
 | 
			
		||||
{
 | 
			
		||||
	BIO *b64;
 | 
			
		||||
@@ -201,8 +152,7 @@ static ASN1_VALUE *b64_read_asn1(BIO *bio, const ASN1_ITEM *it)
 | 
			
		||||
 | 
			
		||||
static int asn1_write_micalg(BIO *out, STACK_OF(X509_ALGOR) *mdalgs)
 | 
			
		||||
	{
 | 
			
		||||
	const EVP_MD *md;
 | 
			
		||||
	int i, have_unknown = 0, write_comma, ret = 0, md_nid;
 | 
			
		||||
	int i, have_unknown = 0, write_comma, md_nid;
 | 
			
		||||
	have_unknown = 0;
 | 
			
		||||
	write_comma = 0;
 | 
			
		||||
	for (i = 0; i < sk_X509_ALGOR_num(mdalgs); i++)
 | 
			
		||||
@@ -211,21 +161,6 @@ static int asn1_write_micalg(BIO *out, STACK_OF(X509_ALGOR) *mdalgs)
 | 
			
		||||
			BIO_write(out, ",", 1);
 | 
			
		||||
		write_comma = 1;
 | 
			
		||||
		md_nid = OBJ_obj2nid(sk_X509_ALGOR_value(mdalgs, i)->algorithm);
 | 
			
		||||
		md = EVP_get_digestbynid(md_nid);
 | 
			
		||||
		if (md && md->md_ctrl)
 | 
			
		||||
			{
 | 
			
		||||
			int rv;
 | 
			
		||||
			char *micstr;
 | 
			
		||||
			rv = md->md_ctrl(NULL, EVP_MD_CTRL_MICALG, 0, &micstr);
 | 
			
		||||
			if (rv > 0)
 | 
			
		||||
				{
 | 
			
		||||
				BIO_puts(out, micstr);
 | 
			
		||||
				OPENSSL_free(micstr);
 | 
			
		||||
				continue;
 | 
			
		||||
				}
 | 
			
		||||
			if (rv != -2)
 | 
			
		||||
				goto err;
 | 
			
		||||
			}
 | 
			
		||||
		switch(md_nid)
 | 
			
		||||
			{
 | 
			
		||||
			case NID_sha1:
 | 
			
		||||
@@ -248,11 +183,6 @@ static int asn1_write_micalg(BIO *out, STACK_OF(X509_ALGOR) *mdalgs)
 | 
			
		||||
			BIO_puts(out, "sha-512");
 | 
			
		||||
			break;
 | 
			
		||||
 | 
			
		||||
			case NID_id_GostR3411_94:
 | 
			
		||||
			BIO_puts(out, "gostr3411-94");
 | 
			
		||||
				goto err;
 | 
			
		||||
			break;
 | 
			
		||||
 | 
			
		||||
			default:
 | 
			
		||||
			if (have_unknown)
 | 
			
		||||
				write_comma = 0;
 | 
			
		||||
@@ -266,18 +196,16 @@ static int asn1_write_micalg(BIO *out, STACK_OF(X509_ALGOR) *mdalgs)
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	ret = 1;
 | 
			
		||||
	err:
 | 
			
		||||
 | 
			
		||||
	return ret;
 | 
			
		||||
	return 1;
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
/* SMIME sender */
 | 
			
		||||
 | 
			
		||||
int SMIME_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags,
 | 
			
		||||
int int_smime_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags,
 | 
			
		||||
				int ctype_nid, int econt_nid,
 | 
			
		||||
				STACK_OF(X509_ALGOR) *mdalgs,
 | 
			
		||||
				asn1_output_data_fn *data_fn,
 | 
			
		||||
				const ASN1_ITEM *it)
 | 
			
		||||
{
 | 
			
		||||
	char bound[33], c;
 | 
			
		||||
@@ -315,7 +243,7 @@ int SMIME_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags,
 | 
			
		||||
						mime_eol, mime_eol);
 | 
			
		||||
		/* Now write out the first part */
 | 
			
		||||
		BIO_printf(bio, "------%s%s", bound, mime_eol);
 | 
			
		||||
		if (!asn1_output_data(bio, data, val, flags, it))
 | 
			
		||||
		if (!data_fn(bio, data, val, flags, it))
 | 
			
		||||
			return 0;
 | 
			
		||||
		BIO_printf(bio, "%s------%s%s", mime_eol, bound, mime_eol);
 | 
			
		||||
 | 
			
		||||
@@ -368,6 +296,8 @@ int SMIME_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags,
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#if 0
 | 
			
		||||
 | 
			
		||||
/* Handle output of ASN1 data */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -420,6 +350,8 @@ static int asn1_output_data(BIO *out, BIO *data, ASN1_VALUE *val, int flags,
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/* SMIME reader: handle multipart/signed and opaque signing.
 | 
			
		||||
 * in multipart case the content is placed in a memory BIO
 | 
			
		||||
 * pointed to by "bcont". In opaque this is set to NULL
 | 
			
		||||
 
 | 
			
		||||
@@ -66,10 +66,10 @@
 | 
			
		||||
 | 
			
		||||
/* Turn an ASN1 encoded SEQUENCE OF into a STACK of structures */
 | 
			
		||||
 | 
			
		||||
STACK_OF(BLOCK) *ASN1_seq_unpack(const unsigned char *buf, int len,
 | 
			
		||||
				 d2i_of_void *d2i, void (*free_func)(BLOCK))
 | 
			
		||||
STACK *ASN1_seq_unpack(const unsigned char *buf, int len,
 | 
			
		||||
		       d2i_of_void *d2i,void (*free_func)(void *))
 | 
			
		||||
{
 | 
			
		||||
    STACK_OF(BLOCK) *sk;
 | 
			
		||||
    STACK *sk;
 | 
			
		||||
    const unsigned char *pbuf;
 | 
			
		||||
    pbuf =  buf;
 | 
			
		||||
    if (!(sk = d2i_ASN1_SET(NULL, &pbuf, len, d2i, free_func,
 | 
			
		||||
@@ -82,7 +82,7 @@ STACK_OF(BLOCK) *ASN1_seq_unpack(const unsigned char *buf, int len,
 | 
			
		||||
 * OPENSSL_malloc'ed buffer
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
unsigned char *ASN1_seq_pack(STACK_OF(BLOCK) *safes, i2d_of_void *i2d,
 | 
			
		||||
unsigned char *ASN1_seq_pack(STACK *safes, i2d_of_void *i2d,
 | 
			
		||||
			     unsigned char **buf, int *len)
 | 
			
		||||
{
 | 
			
		||||
	int safelen;
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@
 | 
			
		||||
 * Mask of various character properties
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
static const unsigned char char_type[] = {
 | 
			
		||||
static unsigned char char_type[] = {
 | 
			
		||||
 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
 | 
			
		||||
 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
 | 
			
		||||
120, 0, 1,40, 0, 0, 0,16,16,16, 0,25,25,16,16,16,
 | 
			
		||||
 
 | 
			
		||||
@@ -61,12 +61,16 @@
 | 
			
		||||
#include <openssl/bn.h>
 | 
			
		||||
#include <openssl/evp.h>
 | 
			
		||||
#include <openssl/objects.h>
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
#include <openssl/engine.h>
 | 
			
		||||
#endif
 | 
			
		||||
#include <openssl/x509.h>
 | 
			
		||||
#include <openssl/asn1.h>
 | 
			
		||||
#include "asn1_locl.h"
 | 
			
		||||
#ifndef OPENSSL_NO_RSA
 | 
			
		||||
#include <openssl/rsa.h>
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_DSA
 | 
			
		||||
#include <openssl/dsa.h>
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_EC
 | 
			
		||||
#include <openssl/ec.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, const unsigned char **pp,
 | 
			
		||||
	     long length)
 | 
			
		||||
@@ -81,43 +85,47 @@ EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, const unsigned char **pp,
 | 
			
		||||
			return(NULL);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		ret= *a;
 | 
			
		||||
#ifndef OPENSSL_NO_ENGINE
 | 
			
		||||
		if (ret->engine)
 | 
			
		||||
			{
 | 
			
		||||
			ENGINE_finish(ret->engine);
 | 
			
		||||
			ret->engine = NULL;
 | 
			
		||||
			}
 | 
			
		||||
#endif
 | 
			
		||||
		}
 | 
			
		||||
	else	ret= *a;
 | 
			
		||||
 | 
			
		||||
	if (!EVP_PKEY_set_type(ret, type))
 | 
			
		||||
	ret->save_type=type;
 | 
			
		||||
	ret->type=EVP_PKEY_type(type);
 | 
			
		||||
	switch (ret->type)
 | 
			
		||||
		{
 | 
			
		||||
		ASN1err(ASN1_F_D2I_PRIVATEKEY,ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE);
 | 
			
		||||
		goto err;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (!ret->ameth->old_priv_decode ||
 | 
			
		||||
			!ret->ameth->old_priv_decode(ret, pp, length))
 | 
			
		||||
		{
 | 
			
		||||
		if (ret->ameth->priv_decode) 
 | 
			
		||||
			{
 | 
			
		||||
			PKCS8_PRIV_KEY_INFO *p8=NULL;
 | 
			
		||||
			p8=d2i_PKCS8_PRIV_KEY_INFO(NULL,pp,length);
 | 
			
		||||
			if (!p8) goto err;
 | 
			
		||||
			EVP_PKEY_free(ret);
 | 
			
		||||
			ret = EVP_PKCS82PKEY(p8);
 | 
			
		||||
			PKCS8_PRIV_KEY_INFO_free(p8);
 | 
			
		||||
 | 
			
		||||
			} 
 | 
			
		||||
		else 
 | 
			
		||||
#ifndef OPENSSL_NO_RSA
 | 
			
		||||
	case EVP_PKEY_RSA:
 | 
			
		||||
		if ((ret->pkey.rsa=d2i_RSAPrivateKey(NULL,
 | 
			
		||||
			(const unsigned char **)pp,length)) == NULL) /* TMP UGLY CAST */
 | 
			
		||||
			{
 | 
			
		||||
			ASN1err(ASN1_F_D2I_PRIVATEKEY,ERR_R_ASN1_LIB);
 | 
			
		||||
			goto err;
 | 
			
		||||
			}
 | 
			
		||||
		}	
 | 
			
		||||
		break;
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_DSA
 | 
			
		||||
	case EVP_PKEY_DSA:
 | 
			
		||||
		if ((ret->pkey.dsa=d2i_DSAPrivateKey(NULL,
 | 
			
		||||
			(const unsigned char **)pp,length)) == NULL) /* TMP UGLY CAST */
 | 
			
		||||
			{
 | 
			
		||||
			ASN1err(ASN1_F_D2I_PRIVATEKEY,ERR_R_ASN1_LIB);
 | 
			
		||||
			goto err;
 | 
			
		||||
			}
 | 
			
		||||
		break;
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_EC
 | 
			
		||||
	case EVP_PKEY_EC:
 | 
			
		||||
		if ((ret->pkey.ec = d2i_ECPrivateKey(NULL, 
 | 
			
		||||
			(const unsigned char **)pp, length)) == NULL)
 | 
			
		||||
			{
 | 
			
		||||
			ASN1err(ASN1_F_D2I_PRIVATEKEY, ERR_R_ASN1_LIB);
 | 
			
		||||
			goto err;
 | 
			
		||||
			}
 | 
			
		||||
		break;
 | 
			
		||||
#endif
 | 
			
		||||
	default:
 | 
			
		||||
		ASN1err(ASN1_F_D2I_PRIVATEKEY,ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE);
 | 
			
		||||
		goto err;
 | 
			
		||||
		/* break; */
 | 
			
		||||
		}
 | 
			
		||||
	if (a != NULL) (*a)=ret;
 | 
			
		||||
	return(ret);
 | 
			
		||||
err:
 | 
			
		||||
@@ -138,7 +146,8 @@ EVP_PKEY *d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp,
 | 
			
		||||
	 * by analyzing it we can determine the passed structure: this
 | 
			
		||||
	 * assumes the input is surrounded by an ASN1 SEQUENCE.
 | 
			
		||||
	 */
 | 
			
		||||
	inkey = d2i_ASN1_SEQUENCE_ANY(NULL, &p, length);
 | 
			
		||||
	inkey = d2i_ASN1_SET_OF_ASN1_TYPE(NULL, &p, length, d2i_ASN1_TYPE, 
 | 
			
		||||
			ASN1_TYPE_free, V_ASN1_SEQUENCE, V_ASN1_UNIVERSAL);
 | 
			
		||||
	/* Since we only need to discern "traditional format" RSA and DSA
 | 
			
		||||
	 * keys we can just count the elements.
 | 
			
		||||
         */
 | 
			
		||||
@@ -146,24 +155,6 @@ EVP_PKEY *d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp,
 | 
			
		||||
		keytype = EVP_PKEY_DSA;
 | 
			
		||||
	else if (sk_ASN1_TYPE_num(inkey) == 4)
 | 
			
		||||
		keytype = EVP_PKEY_EC;
 | 
			
		||||
	else if (sk_ASN1_TYPE_num(inkey) == 3)  
 | 
			
		||||
		{ /* This seems to be PKCS8, not traditional format */
 | 
			
		||||
			PKCS8_PRIV_KEY_INFO *p8 = d2i_PKCS8_PRIV_KEY_INFO(NULL,pp,length);
 | 
			
		||||
			EVP_PKEY *ret;
 | 
			
		||||
 | 
			
		||||
			sk_ASN1_TYPE_pop_free(inkey, ASN1_TYPE_free);
 | 
			
		||||
			if (!p8) 
 | 
			
		||||
				{
 | 
			
		||||
				ASN1err(ASN1_F_D2I_AUTOPRIVATEKEY,ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE);
 | 
			
		||||
				return NULL;
 | 
			
		||||
				}
 | 
			
		||||
			ret = EVP_PKCS82PKEY(p8);
 | 
			
		||||
			PKCS8_PRIV_KEY_INFO_free(p8);
 | 
			
		||||
			if (a) {
 | 
			
		||||
				*a = ret;
 | 
			
		||||
			}	
 | 
			
		||||
			return ret;
 | 
			
		||||
		}
 | 
			
		||||
	else keytype = EVP_PKEY_RSA;
 | 
			
		||||
	sk_ASN1_TYPE_pop_free(inkey, ASN1_TYPE_free);
 | 
			
		||||
	return d2i_PrivateKey(keytype, a, pp, length);
 | 
			
		||||
 
 | 
			
		||||
@@ -58,22 +58,41 @@
 | 
			
		||||
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include "cryptlib.h"
 | 
			
		||||
#include <openssl/bn.h>
 | 
			
		||||
#include <openssl/evp.h>
 | 
			
		||||
#include <openssl/x509.h>
 | 
			
		||||
#include "asn1_locl.h"
 | 
			
		||||
#include <openssl/objects.h>
 | 
			
		||||
#ifndef OPENSSL_NO_RSA
 | 
			
		||||
#include <openssl/rsa.h>
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_DSA
 | 
			
		||||
#include <openssl/dsa.h>
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_EC
 | 
			
		||||
#include <openssl/ec.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
int i2d_PrivateKey(EVP_PKEY *a, unsigned char **pp)
 | 
			
		||||
	{
 | 
			
		||||
	if (a->ameth && a->ameth->old_priv_encode)
 | 
			
		||||
#ifndef OPENSSL_NO_RSA
 | 
			
		||||
	if (a->type == EVP_PKEY_RSA)
 | 
			
		||||
		{
 | 
			
		||||
		return a->ameth->old_priv_encode(a, pp);
 | 
			
		||||
		return(i2d_RSAPrivateKey(a->pkey.rsa,pp));
 | 
			
		||||
		}
 | 
			
		||||
	if (a->ameth && a->ameth->priv_encode) {
 | 
			
		||||
		PKCS8_PRIV_KEY_INFO *p8 = EVP_PKEY2PKCS8(a);
 | 
			
		||||
		int ret = i2d_PKCS8_PRIV_KEY_INFO(p8,pp);
 | 
			
		||||
		PKCS8_PRIV_KEY_INFO_free(p8);
 | 
			
		||||
		return ret;
 | 
			
		||||
	}	
 | 
			
		||||
	else
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_DSA
 | 
			
		||||
	if (a->type == EVP_PKEY_DSA)
 | 
			
		||||
		{
 | 
			
		||||
		return(i2d_DSAPrivateKey(a->pkey.dsa,pp));
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_EC
 | 
			
		||||
	if (a->type == EVP_PKEY_EC)
 | 
			
		||||
		{
 | 
			
		||||
		return(i2d_ECPrivateKey(a->pkey.ec, pp));
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	ASN1err(ASN1_F_I2D_PRIVATEKEY,ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE);
 | 
			
		||||
	return(-1);
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -3,7 +3,7 @@
 | 
			
		||||
 * project 1999.
 | 
			
		||||
 */
 | 
			
		||||
/* ====================================================================
 | 
			
		||||
 * Copyright (c) 1999-2005 The OpenSSL Project.  All rights reserved.
 | 
			
		||||
 * Copyright (c) 1999 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
 | 
			
		||||
@@ -62,8 +62,7 @@
 | 
			
		||||
#include <openssl/x509.h>
 | 
			
		||||
#include <openssl/objects.h>
 | 
			
		||||
 | 
			
		||||
static int nsseq_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
 | 
			
		||||
							void *exarg)
 | 
			
		||||
static int nsseq_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it)
 | 
			
		||||
{
 | 
			
		||||
	if(operation == ASN1_OP_NEW_POST) {
 | 
			
		||||
		NETSCAPE_CERT_SEQUENCE *nsseq;
 | 
			
		||||
 
 | 
			
		||||
@@ -71,78 +71,61 @@ ASN1_SEQUENCE(PBEPARAM) = {
 | 
			
		||||
 | 
			
		||||
IMPLEMENT_ASN1_FUNCTIONS(PBEPARAM)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* Set an algorithm identifier for a PKCS#5 PBE algorithm */
 | 
			
		||||
 | 
			
		||||
int PKCS5_pbe_set0_algor(X509_ALGOR *algor, int alg, int iter,
 | 
			
		||||
				const unsigned char *salt, int saltlen)
 | 
			
		||||
	{
 | 
			
		||||
	PBEPARAM *pbe=NULL;
 | 
			
		||||
	ASN1_STRING *pbe_str=NULL;
 | 
			
		||||
	unsigned char *sstr;
 | 
			
		||||
 | 
			
		||||
	pbe = PBEPARAM_new();
 | 
			
		||||
	if (!pbe)
 | 
			
		||||
		{
 | 
			
		||||
		ASN1err(ASN1_F_PKCS5_PBE_SET0_ALGOR,ERR_R_MALLOC_FAILURE);
 | 
			
		||||
		goto err;
 | 
			
		||||
		}
 | 
			
		||||
	if(iter <= 0)
 | 
			
		||||
		iter = PKCS5_DEFAULT_ITER;
 | 
			
		||||
	if (!ASN1_INTEGER_set(pbe->iter, iter))
 | 
			
		||||
		{
 | 
			
		||||
		ASN1err(ASN1_F_PKCS5_PBE_SET0_ALGOR,ERR_R_MALLOC_FAILURE);
 | 
			
		||||
		goto err;
 | 
			
		||||
		}
 | 
			
		||||
	if (!saltlen)
 | 
			
		||||
		saltlen = PKCS5_SALT_LEN;
 | 
			
		||||
	if (!ASN1_STRING_set(pbe->salt, NULL, saltlen))
 | 
			
		||||
		{
 | 
			
		||||
		ASN1err(ASN1_F_PKCS5_PBE_SET0_ALGOR,ERR_R_MALLOC_FAILURE);
 | 
			
		||||
		goto err;
 | 
			
		||||
		}
 | 
			
		||||
	sstr = ASN1_STRING_data(pbe->salt);
 | 
			
		||||
	if (salt)
 | 
			
		||||
		memcpy(sstr, salt, saltlen);
 | 
			
		||||
	else if (RAND_pseudo_bytes(sstr, saltlen) < 0)
 | 
			
		||||
		goto err;
 | 
			
		||||
 | 
			
		||||
	if(!ASN1_item_pack(pbe, ASN1_ITEM_rptr(PBEPARAM), &pbe_str))
 | 
			
		||||
		{
 | 
			
		||||
		ASN1err(ASN1_F_PKCS5_PBE_SET0_ALGOR,ERR_R_MALLOC_FAILURE);
 | 
			
		||||
		goto err;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	PBEPARAM_free(pbe);
 | 
			
		||||
	pbe = NULL;
 | 
			
		||||
 | 
			
		||||
	if (X509_ALGOR_set0(algor, OBJ_nid2obj(alg), V_ASN1_SEQUENCE, pbe_str))
 | 
			
		||||
		return 1;
 | 
			
		||||
 | 
			
		||||
err:
 | 
			
		||||
	if (pbe != NULL)
 | 
			
		||||
		PBEPARAM_free(pbe);
 | 
			
		||||
	if (pbe_str != NULL)
 | 
			
		||||
		ASN1_STRING_free(pbe_str);
 | 
			
		||||
	return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
/* Return an algorithm identifier for a PKCS#5 PBE algorithm */
 | 
			
		||||
 | 
			
		||||
X509_ALGOR *PKCS5_pbe_set(int alg, int iter,
 | 
			
		||||
				const unsigned char *salt, int saltlen)
 | 
			
		||||
	{
 | 
			
		||||
	X509_ALGOR *ret;
 | 
			
		||||
	ret = X509_ALGOR_new();
 | 
			
		||||
	if (!ret)
 | 
			
		||||
		{
 | 
			
		||||
X509_ALGOR *PKCS5_pbe_set(int alg, int iter, unsigned char *salt,
 | 
			
		||||
	     int saltlen)
 | 
			
		||||
{
 | 
			
		||||
	PBEPARAM *pbe=NULL;
 | 
			
		||||
	ASN1_OBJECT *al;
 | 
			
		||||
	X509_ALGOR *algor;
 | 
			
		||||
	ASN1_TYPE *astype=NULL;
 | 
			
		||||
 | 
			
		||||
	if (!(pbe = PBEPARAM_new ())) {
 | 
			
		||||
		ASN1err(ASN1_F_PKCS5_PBE_SET,ERR_R_MALLOC_FAILURE);
 | 
			
		||||
		return NULL;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (PKCS5_pbe_set0_algor(ret, alg, iter, salt, saltlen)) 
 | 
			
		||||
		return ret;
 | 
			
		||||
 | 
			
		||||
	X509_ALGOR_free(ret);
 | 
			
		||||
	return NULL;
 | 
			
		||||
		goto err;
 | 
			
		||||
	}
 | 
			
		||||
	if(iter <= 0) iter = PKCS5_DEFAULT_ITER;
 | 
			
		||||
	if (!ASN1_INTEGER_set(pbe->iter, iter)) {
 | 
			
		||||
		ASN1err(ASN1_F_PKCS5_PBE_SET,ERR_R_MALLOC_FAILURE);
 | 
			
		||||
		goto err;
 | 
			
		||||
	}
 | 
			
		||||
	if (!saltlen) saltlen = PKCS5_SALT_LEN;
 | 
			
		||||
	if (!(pbe->salt->data = OPENSSL_malloc (saltlen))) {
 | 
			
		||||
		ASN1err(ASN1_F_PKCS5_PBE_SET,ERR_R_MALLOC_FAILURE);
 | 
			
		||||
		goto err;
 | 
			
		||||
	}
 | 
			
		||||
	pbe->salt->length = saltlen;
 | 
			
		||||
	if (salt) memcpy (pbe->salt->data, salt, saltlen);
 | 
			
		||||
	else if (RAND_pseudo_bytes (pbe->salt->data, saltlen) < 0)
 | 
			
		||||
		goto err;
 | 
			
		||||
 | 
			
		||||
	if (!(astype = ASN1_TYPE_new())) {
 | 
			
		||||
		ASN1err(ASN1_F_PKCS5_PBE_SET,ERR_R_MALLOC_FAILURE);
 | 
			
		||||
		goto err;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	astype->type = V_ASN1_SEQUENCE;
 | 
			
		||||
	if(!ASN1_pack_string_of(PBEPARAM, pbe, i2d_PBEPARAM,
 | 
			
		||||
				&astype->value.sequence)) {
 | 
			
		||||
		ASN1err(ASN1_F_PKCS5_PBE_SET,ERR_R_MALLOC_FAILURE);
 | 
			
		||||
		goto err;
 | 
			
		||||
	}
 | 
			
		||||
	PBEPARAM_free (pbe);
 | 
			
		||||
	pbe = NULL;
 | 
			
		||||
	
 | 
			
		||||
	al = OBJ_nid2obj(alg); /* never need to free al */
 | 
			
		||||
	if (!(algor = X509_ALGOR_new())) {
 | 
			
		||||
		ASN1err(ASN1_F_PKCS5_PBE_SET,ERR_R_MALLOC_FAILURE);
 | 
			
		||||
		goto err;
 | 
			
		||||
	}
 | 
			
		||||
	ASN1_OBJECT_free(algor->algorithm);
 | 
			
		||||
	algor->algorithm = al;
 | 
			
		||||
	algor->parameter = astype;
 | 
			
		||||
 | 
			
		||||
	return (algor);
 | 
			
		||||
err:
 | 
			
		||||
	if (pbe != NULL) PBEPARAM_free(pbe);
 | 
			
		||||
	if (astype != NULL) ASN1_TYPE_free(astype);
 | 
			
		||||
	return NULL;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -82,13 +82,10 @@ IMPLEMENT_ASN1_FUNCTIONS(PBKDF2PARAM)
 | 
			
		||||
 | 
			
		||||
/* Return an algorithm identifier for a PKCS#5 v2.0 PBE algorithm:
 | 
			
		||||
 * yes I know this is horrible!
 | 
			
		||||
 *
 | 
			
		||||
 * Extended version to allow application supplied PRF NID and IV.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
X509_ALGOR *PKCS5_pbe2_set_iv(const EVP_CIPHER *cipher, int iter,
 | 
			
		||||
				 unsigned char *salt, int saltlen,
 | 
			
		||||
				 unsigned char *aiv, int prf_nid)
 | 
			
		||||
X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter,
 | 
			
		||||
				 unsigned char *salt, int saltlen)
 | 
			
		||||
{
 | 
			
		||||
	X509_ALGOR *scheme = NULL, *kalg = NULL, *ret = NULL;
 | 
			
		||||
	int alg_nid;
 | 
			
		||||
@@ -101,7 +98,7 @@ X509_ALGOR *PKCS5_pbe2_set_iv(const EVP_CIPHER *cipher, int iter,
 | 
			
		||||
 | 
			
		||||
	alg_nid = EVP_CIPHER_type(cipher);
 | 
			
		||||
	if(alg_nid == NID_undef) {
 | 
			
		||||
		ASN1err(ASN1_F_PKCS5_PBE2_SET_IV,
 | 
			
		||||
		ASN1err(ASN1_F_PKCS5_PBE2_SET,
 | 
			
		||||
				ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER);
 | 
			
		||||
		goto err;
 | 
			
		||||
	}
 | 
			
		||||
@@ -116,33 +113,20 @@ X509_ALGOR *PKCS5_pbe2_set_iv(const EVP_CIPHER *cipher, int iter,
 | 
			
		||||
	if(!(scheme->parameter = ASN1_TYPE_new())) goto merr;
 | 
			
		||||
 | 
			
		||||
	/* Create random IV */
 | 
			
		||||
	if (EVP_CIPHER_iv_length(cipher))
 | 
			
		||||
		{
 | 
			
		||||
		if (aiv)
 | 
			
		||||
			memcpy(iv, aiv, EVP_CIPHER_iv_length(cipher));
 | 
			
		||||
		else if (RAND_pseudo_bytes(iv, EVP_CIPHER_iv_length(cipher)) < 0)
 | 
			
		||||
  			goto err;
 | 
			
		||||
		}
 | 
			
		||||
	if (EVP_CIPHER_iv_length(cipher) &&
 | 
			
		||||
		RAND_pseudo_bytes(iv, EVP_CIPHER_iv_length(cipher)) < 0)
 | 
			
		||||
  		goto err;
 | 
			
		||||
 | 
			
		||||
	EVP_CIPHER_CTX_init(&ctx);
 | 
			
		||||
 | 
			
		||||
	/* Dummy cipherinit to just setup the IV, and PRF */
 | 
			
		||||
	/* Dummy cipherinit to just setup the IV */
 | 
			
		||||
	EVP_CipherInit_ex(&ctx, cipher, NULL, NULL, iv, 0);
 | 
			
		||||
	if(EVP_CIPHER_param_to_asn1(&ctx, scheme->parameter) < 0) {
 | 
			
		||||
		ASN1err(ASN1_F_PKCS5_PBE2_SET_IV,
 | 
			
		||||
		ASN1err(ASN1_F_PKCS5_PBE2_SET,
 | 
			
		||||
					ASN1_R_ERROR_SETTING_CIPHER_PARAMS);
 | 
			
		||||
		EVP_CIPHER_CTX_cleanup(&ctx);
 | 
			
		||||
		goto err;
 | 
			
		||||
	}
 | 
			
		||||
	/* If prf NID unspecified see if cipher has a preference.
 | 
			
		||||
	 * An error is OK here: just means use default PRF.
 | 
			
		||||
	 */
 | 
			
		||||
	if ((prf_nid == -1) && 
 | 
			
		||||
	EVP_CIPHER_CTX_ctrl(&ctx, EVP_CTRL_PBE_PRF_NID, 0, &prf_nid) <= 0)
 | 
			
		||||
		{
 | 
			
		||||
		ERR_clear_error();
 | 
			
		||||
		prf_nid = NID_hmacWithSHA1;
 | 
			
		||||
		}
 | 
			
		||||
	EVP_CIPHER_CTX_cleanup(&ctx);
 | 
			
		||||
 | 
			
		||||
	if(!(kdf = PBKDF2PARAM_new())) goto merr;
 | 
			
		||||
@@ -170,15 +154,7 @@ X509_ALGOR *PKCS5_pbe2_set_iv(const EVP_CIPHER *cipher, int iter,
 | 
			
		||||
				 EVP_CIPHER_key_length(cipher))) goto merr;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* prf can stay NULL if we are using hmacWithSHA1 */
 | 
			
		||||
	if (prf_nid != NID_hmacWithSHA1)
 | 
			
		||||
		{
 | 
			
		||||
		kdf->prf = X509_ALGOR_new();
 | 
			
		||||
		if (!kdf->prf)
 | 
			
		||||
			goto merr;
 | 
			
		||||
		X509_ALGOR_set0(kdf->prf, OBJ_nid2obj(prf_nid),
 | 
			
		||||
					V_ASN1_NULL, NULL);
 | 
			
		||||
		}
 | 
			
		||||
	/* prf can stay NULL because we are using hmacWithSHA1 */
 | 
			
		||||
 | 
			
		||||
	/* Now setup the PBE2PARAM keyfunc structure */
 | 
			
		||||
 | 
			
		||||
@@ -188,7 +164,7 @@ X509_ALGOR *PKCS5_pbe2_set_iv(const EVP_CIPHER *cipher, int iter,
 | 
			
		||||
 | 
			
		||||
	if(!(pbe2->keyfunc->parameter = ASN1_TYPE_new())) goto merr;
 | 
			
		||||
 | 
			
		||||
	if(!ASN1_item_pack(kdf, ASN1_ITEM_rptr(PBKDF2PARAM),
 | 
			
		||||
	if(!ASN1_pack_string_of(PBKDF2PARAM, kdf, i2d_PBKDF2PARAM,
 | 
			
		||||
			 &pbe2->keyfunc->parameter->value.sequence)) goto merr;
 | 
			
		||||
	pbe2->keyfunc->parameter->type = V_ASN1_SEQUENCE;
 | 
			
		||||
 | 
			
		||||
@@ -204,7 +180,7 @@ X509_ALGOR *PKCS5_pbe2_set_iv(const EVP_CIPHER *cipher, int iter,
 | 
			
		||||
 | 
			
		||||
	/* Encode PBE2PARAM into parameter */
 | 
			
		||||
 | 
			
		||||
	if(!ASN1_item_pack(pbe2, ASN1_ITEM_rptr(PBE2PARAM),
 | 
			
		||||
	if(!ASN1_pack_string_of(PBE2PARAM, pbe2, i2d_PBE2PARAM,
 | 
			
		||||
				 &ret->parameter->value.sequence)) goto merr;
 | 
			
		||||
	ret->parameter->type = V_ASN1_SEQUENCE;
 | 
			
		||||
 | 
			
		||||
@@ -214,7 +190,7 @@ X509_ALGOR *PKCS5_pbe2_set_iv(const EVP_CIPHER *cipher, int iter,
 | 
			
		||||
	return ret;
 | 
			
		||||
 | 
			
		||||
	merr:
 | 
			
		||||
	ASN1err(ASN1_F_PKCS5_PBE2_SET_IV,ERR_R_MALLOC_FAILURE);
 | 
			
		||||
	ASN1err(ASN1_F_PKCS5_PBE2_SET,ERR_R_MALLOC_FAILURE);
 | 
			
		||||
 | 
			
		||||
	err:
 | 
			
		||||
	PBE2PARAM_free(pbe2);
 | 
			
		||||
@@ -227,9 +203,3 @@ X509_ALGOR *PKCS5_pbe2_set_iv(const EVP_CIPHER *cipher, int iter,
 | 
			
		||||
	return NULL;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter,
 | 
			
		||||
				 unsigned char *salt, int saltlen)
 | 
			
		||||
	{
 | 
			
		||||
	return PKCS5_pbe2_set_iv(cipher, iter, salt, saltlen, NULL, -1);
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										131
									
								
								crypto/asn1/p8_key.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										131
									
								
								crypto/asn1/p8_key.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,131 @@
 | 
			
		||||
/* crypto/asn1/p8_key.c */
 | 
			
		||||
/* 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.]
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include "cryptlib.h"
 | 
			
		||||
#include <openssl/asn1_mac.h>
 | 
			
		||||
#include <openssl/objects.h>
 | 
			
		||||
 | 
			
		||||
int i2d_X509_KEY(X509 *a, unsigned char **pp)
 | 
			
		||||
	{
 | 
			
		||||
	M_ASN1_I2D_vars(a);
 | 
			
		||||
 | 
			
		||||
	M_ASN1_I2D_len(a->cert_info,	i2d_X509_CINF);
 | 
			
		||||
	M_ASN1_I2D_len(a->sig_alg,	i2d_X509_ALGOR);
 | 
			
		||||
	M_ASN1_I2D_len(a->signature,	i2d_ASN1_BIT_STRING);
 | 
			
		||||
 | 
			
		||||
	M_ASN1_I2D_seq_total();
 | 
			
		||||
 | 
			
		||||
	M_ASN1_I2D_put(a->cert_info,	i2d_X509_CINF);
 | 
			
		||||
	M_ASN1_I2D_put(a->sig_alg,	i2d_X509_ALGOR);
 | 
			
		||||
	M_ASN1_I2D_put(a->signature,	i2d_ASN1_BIT_STRING);
 | 
			
		||||
 | 
			
		||||
	M_ASN1_I2D_finish();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
X509 *d2i_X509_KEY(X509 **a, unsigned char **pp, long length)
 | 
			
		||||
	{
 | 
			
		||||
	M_ASN1_D2I_vars(a,X509 *,X509_new);
 | 
			
		||||
 | 
			
		||||
	M_ASN1_D2I_Init();
 | 
			
		||||
	M_ASN1_D2I_start_sequence();
 | 
			
		||||
	M_ASN1_D2I_get(ret->cert_info,d2i_X509_CINF);
 | 
			
		||||
	M_ASN1_D2I_get(ret->sig_alg,d2i_X509_ALGOR);
 | 
			
		||||
	M_ASN1_D2I_get(ret->signature,d2i_ASN1_BIT_STRING);
 | 
			
		||||
	M_ASN1_D2I_Finish(a,X509_free,ASN1_F_D2I_X509);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
X509 *X509_KEY_new(void)
 | 
			
		||||
	{
 | 
			
		||||
	X509_KEY *ret=NULL;
 | 
			
		||||
 | 
			
		||||
	M_ASN1_New_OPENSSL_malloc(ret,X509_KEY);
 | 
			
		||||
	ret->references=1;
 | 
			
		||||
	ret->type=NID
 | 
			
		||||
	M_ASN1_New(ret->cert_info,X509_CINF_new);
 | 
			
		||||
	M_ASN1_New(ret->sig_alg,X509_ALGOR_new);
 | 
			
		||||
	M_ASN1_New(ret->signature,ASN1_BIT_STRING_new);
 | 
			
		||||
	return(ret);
 | 
			
		||||
	M_ASN1_New_Error(ASN1_F_X509_NEW);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
void X509_KEY_free(X509 *a)
 | 
			
		||||
	{
 | 
			
		||||
	int i;
 | 
			
		||||
 | 
			
		||||
	if (a == NULL) return;
 | 
			
		||||
 | 
			
		||||
	i=CRYPTO_add_lock(&a->references,-1,CRYPTO_LOCK_X509_KEY);
 | 
			
		||||
#ifdef REF_PRINT
 | 
			
		||||
	REF_PRINT("X509_KEY",a);
 | 
			
		||||
#endif
 | 
			
		||||
	if (i > 0) return;
 | 
			
		||||
#ifdef REF_CHECK
 | 
			
		||||
	if (i < 0)
 | 
			
		||||
		{
 | 
			
		||||
		fprintf(stderr,"X509_KEY_free, bad reference count\n");
 | 
			
		||||
		abort();
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	X509_CINF_free(a->cert_info);
 | 
			
		||||
	X509_ALGOR_free(a->sig_alg);
 | 
			
		||||
	ASN1_BIT_STRING_free(a->signature);
 | 
			
		||||
	OPENSSL_free(a);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -3,7 +3,7 @@
 | 
			
		||||
 * project 1999.
 | 
			
		||||
 */
 | 
			
		||||
/* ====================================================================
 | 
			
		||||
 * Copyright (c) 1999-2005 The OpenSSL Project.  All rights reserved.
 | 
			
		||||
 * Copyright (c) 1999 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
 | 
			
		||||
@@ -62,8 +62,7 @@
 | 
			
		||||
#include <openssl/x509.h>
 | 
			
		||||
 | 
			
		||||
/* Minor tweak to operation: zero private key data */
 | 
			
		||||
static int pkey_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
 | 
			
		||||
							void *exarg)
 | 
			
		||||
static int pkey_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it)
 | 
			
		||||
{
 | 
			
		||||
	/* Since the structure must still be valid use ASN1_OP_FREE_PRE */
 | 
			
		||||
	if(operation == ASN1_OP_FREE_PRE) {
 | 
			
		||||
@@ -83,73 +82,3 @@ ASN1_SEQUENCE_cb(PKCS8_PRIV_KEY_INFO, pkey_cb) = {
 | 
			
		||||
} ASN1_SEQUENCE_END_cb(PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO)
 | 
			
		||||
 | 
			
		||||
IMPLEMENT_ASN1_FUNCTIONS(PKCS8_PRIV_KEY_INFO)
 | 
			
		||||
 | 
			
		||||
int PKCS8_pkey_set0(PKCS8_PRIV_KEY_INFO *priv, ASN1_OBJECT *aobj,
 | 
			
		||||
					int version,
 | 
			
		||||
					int ptype, void *pval,
 | 
			
		||||
					unsigned char *penc, int penclen)
 | 
			
		||||
	{
 | 
			
		||||
	unsigned char **ppenc = NULL;
 | 
			
		||||
	if (version >= 0)
 | 
			
		||||
		{
 | 
			
		||||
		if (!ASN1_INTEGER_set(priv->version, version))
 | 
			
		||||
			return 0;
 | 
			
		||||
		}
 | 
			
		||||
	if (penc)
 | 
			
		||||
		{
 | 
			
		||||
		int pmtype;
 | 
			
		||||
		ASN1_OCTET_STRING *oct;
 | 
			
		||||
		oct = ASN1_OCTET_STRING_new();
 | 
			
		||||
		if (!oct)
 | 
			
		||||
			return 0;
 | 
			
		||||
		oct->data = penc;
 | 
			
		||||
		ppenc = &oct->data;
 | 
			
		||||
		oct->length = penclen;
 | 
			
		||||
		if (priv->broken == PKCS8_NO_OCTET)
 | 
			
		||||
			pmtype = V_ASN1_SEQUENCE;
 | 
			
		||||
		else
 | 
			
		||||
			pmtype = V_ASN1_OCTET_STRING;
 | 
			
		||||
		ASN1_TYPE_set(priv->pkey, pmtype, oct);
 | 
			
		||||
		}
 | 
			
		||||
	if (!X509_ALGOR_set0(priv->pkeyalg, aobj, ptype, pval))
 | 
			
		||||
		{
 | 
			
		||||
		/* If call fails do not swallow 'enc' */
 | 
			
		||||
		if (ppenc)
 | 
			
		||||
			*ppenc = NULL;
 | 
			
		||||
		return 0;
 | 
			
		||||
		}
 | 
			
		||||
	return 1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
int PKCS8_pkey_get0(ASN1_OBJECT **ppkalg,
 | 
			
		||||
		const unsigned char **pk, int *ppklen,
 | 
			
		||||
		X509_ALGOR **pa,
 | 
			
		||||
		PKCS8_PRIV_KEY_INFO *p8)
 | 
			
		||||
	{
 | 
			
		||||
	if (ppkalg)
 | 
			
		||||
		*ppkalg = p8->pkeyalg->algorithm;
 | 
			
		||||
	if(p8->pkey->type == V_ASN1_OCTET_STRING)
 | 
			
		||||
		{
 | 
			
		||||
		p8->broken = PKCS8_OK;
 | 
			
		||||
		if (pk)
 | 
			
		||||
			{
 | 
			
		||||
			*pk = p8->pkey->value.octet_string->data;
 | 
			
		||||
			*ppklen = p8->pkey->value.octet_string->length;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	else if (p8->pkey->type == V_ASN1_SEQUENCE)
 | 
			
		||||
		{
 | 
			
		||||
		p8->broken = PKCS8_NO_OCTET;
 | 
			
		||||
		if (pk)
 | 
			
		||||
			{
 | 
			
		||||
			*pk = p8->pkey->value.sequence->data;
 | 
			
		||||
			*ppklen = p8->pkey->value.sequence->length;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
		return 0;
 | 
			
		||||
	if (pa)
 | 
			
		||||
		*pa = p8->pkeyalg;
 | 
			
		||||
	return 1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -55,15 +55,520 @@
 | 
			
		||||
 * copied and put under another distribution licence
 | 
			
		||||
 * [including the GNU Public Licence.]
 | 
			
		||||
 */
 | 
			
		||||
/* ====================================================================
 | 
			
		||||
 * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
 | 
			
		||||
 * Binary polynomial ECC support in OpenSSL originally developed by 
 | 
			
		||||
 * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include "cryptlib.h"
 | 
			
		||||
#include <openssl/objects.h>
 | 
			
		||||
#include <openssl/buffer.h>
 | 
			
		||||
#include <openssl/bn.h>
 | 
			
		||||
#ifndef OPENSSL_NO_RSA
 | 
			
		||||
#include <openssl/rsa.h>
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_DH
 | 
			
		||||
#include <openssl/dh.h>
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_DSA
 | 
			
		||||
#include <openssl/dsa.h>
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_EC
 | 
			
		||||
#include <openssl/ec.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
int ASN1_bn_print(BIO *bp, const char *number, const BIGNUM *num,
 | 
			
		||||
			unsigned char *buf, int off)
 | 
			
		||||
static int print(BIO *fp,const char *str, const BIGNUM *num,
 | 
			
		||||
		unsigned char *buf,int off);
 | 
			
		||||
#ifndef OPENSSL_NO_EC
 | 
			
		||||
static int print_bin(BIO *fp, const char *str, const unsigned char *num,
 | 
			
		||||
		size_t len, int off);
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_RSA
 | 
			
		||||
#ifndef OPENSSL_NO_FP_API
 | 
			
		||||
int RSA_print_fp(FILE *fp, const RSA *x, int off)
 | 
			
		||||
	{
 | 
			
		||||
	BIO *b;
 | 
			
		||||
	int ret;
 | 
			
		||||
 | 
			
		||||
	if ((b=BIO_new(BIO_s_file())) == NULL)
 | 
			
		||||
		{
 | 
			
		||||
		RSAerr(RSA_F_RSA_PRINT_FP,ERR_R_BUF_LIB);
 | 
			
		||||
		return(0);
 | 
			
		||||
		}
 | 
			
		||||
	BIO_set_fp(b,fp,BIO_NOCLOSE);
 | 
			
		||||
	ret=RSA_print(b,x,off);
 | 
			
		||||
	BIO_free(b);
 | 
			
		||||
	return(ret);
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
int RSA_print(BIO *bp, const RSA *x, int off)
 | 
			
		||||
	{
 | 
			
		||||
	char str[128];
 | 
			
		||||
	const char *s;
 | 
			
		||||
	unsigned char *m=NULL;
 | 
			
		||||
	int ret=0, mod_len = 0;
 | 
			
		||||
	size_t buf_len=0, i;
 | 
			
		||||
 | 
			
		||||
	if (x->n)
 | 
			
		||||
		buf_len = (size_t)BN_num_bytes(x->n);
 | 
			
		||||
	if (x->e)
 | 
			
		||||
		if (buf_len < (i = (size_t)BN_num_bytes(x->e)))
 | 
			
		||||
			buf_len = i;
 | 
			
		||||
	if (x->d)
 | 
			
		||||
		if (buf_len < (i = (size_t)BN_num_bytes(x->d)))
 | 
			
		||||
			buf_len = i;
 | 
			
		||||
	if (x->p)
 | 
			
		||||
		if (buf_len < (i = (size_t)BN_num_bytes(x->p)))
 | 
			
		||||
			buf_len = i;
 | 
			
		||||
	if (x->q)
 | 
			
		||||
		if (buf_len < (i = (size_t)BN_num_bytes(x->q)))
 | 
			
		||||
			buf_len = i;
 | 
			
		||||
	if (x->dmp1)
 | 
			
		||||
		if (buf_len < (i = (size_t)BN_num_bytes(x->dmp1)))
 | 
			
		||||
			buf_len = i;
 | 
			
		||||
	if (x->dmq1)
 | 
			
		||||
		if (buf_len < (i = (size_t)BN_num_bytes(x->dmq1)))
 | 
			
		||||
			buf_len = i;
 | 
			
		||||
	if (x->iqmp)
 | 
			
		||||
		if (buf_len < (i = (size_t)BN_num_bytes(x->iqmp)))
 | 
			
		||||
			buf_len = i;
 | 
			
		||||
 | 
			
		||||
	m=(unsigned char *)OPENSSL_malloc(buf_len+10);
 | 
			
		||||
	if (m == NULL)
 | 
			
		||||
		{
 | 
			
		||||
		RSAerr(RSA_F_RSA_PRINT,ERR_R_MALLOC_FAILURE);
 | 
			
		||||
		goto err;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (x->n != NULL)
 | 
			
		||||
		mod_len = BN_num_bits(x->n);
 | 
			
		||||
 | 
			
		||||
	if (x->d != NULL)
 | 
			
		||||
		{
 | 
			
		||||
		if(!BIO_indent(bp,off,128))
 | 
			
		||||
		   goto err;
 | 
			
		||||
		if (BIO_printf(bp,"Private-Key: (%d bit)\n", mod_len)
 | 
			
		||||
			<= 0) goto err;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (x->d == NULL)
 | 
			
		||||
		BIO_snprintf(str,sizeof str,"Modulus (%d bit):", mod_len);
 | 
			
		||||
	else
 | 
			
		||||
		BUF_strlcpy(str,"modulus:",sizeof str);
 | 
			
		||||
	if (!print(bp,str,x->n,m,off)) goto err;
 | 
			
		||||
	s=(x->d == NULL)?"Exponent:":"publicExponent:";
 | 
			
		||||
	if ((x->e != NULL) && !print(bp,s,x->e,m,off))
 | 
			
		||||
		goto err;
 | 
			
		||||
	if ((x->d != NULL) && !print(bp,"privateExponent:",x->d,m,off))
 | 
			
		||||
		goto err;
 | 
			
		||||
	if ((x->p != NULL) && !print(bp,"prime1:",x->p,m,off))
 | 
			
		||||
		goto err;
 | 
			
		||||
	if ((x->q != NULL) && !print(bp,"prime2:",x->q,m,off))
 | 
			
		||||
		goto err;
 | 
			
		||||
	if ((x->dmp1 != NULL) && !print(bp,"exponent1:",x->dmp1,m,off))
 | 
			
		||||
		goto err;
 | 
			
		||||
	if ((x->dmq1 != NULL) && !print(bp,"exponent2:",x->dmq1,m,off))
 | 
			
		||||
		goto err;
 | 
			
		||||
	if ((x->iqmp != NULL) && !print(bp,"coefficient:",x->iqmp,m,off))
 | 
			
		||||
		goto err;
 | 
			
		||||
	ret=1;
 | 
			
		||||
err:
 | 
			
		||||
	if (m != NULL) OPENSSL_free(m);
 | 
			
		||||
	return(ret);
 | 
			
		||||
	}
 | 
			
		||||
#endif /* OPENSSL_NO_RSA */
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_DSA
 | 
			
		||||
#ifndef OPENSSL_NO_FP_API
 | 
			
		||||
int DSA_print_fp(FILE *fp, const DSA *x, int off)
 | 
			
		||||
	{
 | 
			
		||||
	BIO *b;
 | 
			
		||||
	int ret;
 | 
			
		||||
 | 
			
		||||
	if ((b=BIO_new(BIO_s_file())) == NULL)
 | 
			
		||||
		{
 | 
			
		||||
		DSAerr(DSA_F_DSA_PRINT_FP,ERR_R_BUF_LIB);
 | 
			
		||||
		return(0);
 | 
			
		||||
		}
 | 
			
		||||
	BIO_set_fp(b,fp,BIO_NOCLOSE);
 | 
			
		||||
	ret=DSA_print(b,x,off);
 | 
			
		||||
	BIO_free(b);
 | 
			
		||||
	return(ret);
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
int DSA_print(BIO *bp, const DSA *x, int off)
 | 
			
		||||
	{
 | 
			
		||||
	unsigned char *m=NULL;
 | 
			
		||||
	int ret=0;
 | 
			
		||||
	size_t buf_len=0,i;
 | 
			
		||||
 | 
			
		||||
	if (x->p)
 | 
			
		||||
		buf_len = (size_t)BN_num_bytes(x->p);
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		DSAerr(DSA_F_DSA_PRINT,DSA_R_MISSING_PARAMETERS);
 | 
			
		||||
		goto err;
 | 
			
		||||
		}
 | 
			
		||||
	if (x->q)
 | 
			
		||||
		if (buf_len < (i = (size_t)BN_num_bytes(x->q)))
 | 
			
		||||
			buf_len = i;
 | 
			
		||||
	if (x->g)
 | 
			
		||||
		if (buf_len < (i = (size_t)BN_num_bytes(x->g)))
 | 
			
		||||
			buf_len = i;
 | 
			
		||||
	if (x->priv_key)
 | 
			
		||||
		if (buf_len < (i = (size_t)BN_num_bytes(x->priv_key)))
 | 
			
		||||
			buf_len = i;
 | 
			
		||||
	if (x->pub_key)
 | 
			
		||||
		if (buf_len < (i = (size_t)BN_num_bytes(x->pub_key)))
 | 
			
		||||
			buf_len = i;
 | 
			
		||||
 | 
			
		||||
	m=(unsigned char *)OPENSSL_malloc(buf_len+10);
 | 
			
		||||
	if (m == NULL)
 | 
			
		||||
		{
 | 
			
		||||
		DSAerr(DSA_F_DSA_PRINT,ERR_R_MALLOC_FAILURE);
 | 
			
		||||
		goto err;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (x->priv_key != NULL)
 | 
			
		||||
		{
 | 
			
		||||
		if(!BIO_indent(bp,off,128))
 | 
			
		||||
		   goto err;
 | 
			
		||||
		if (BIO_printf(bp,"Private-Key: (%d bit)\n",BN_num_bits(x->p))
 | 
			
		||||
			<= 0) goto err;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if ((x->priv_key != NULL) && !print(bp,"priv:",x->priv_key,m,off))
 | 
			
		||||
		goto err;
 | 
			
		||||
	if ((x->pub_key  != NULL) && !print(bp,"pub: ",x->pub_key,m,off))
 | 
			
		||||
		goto err;
 | 
			
		||||
	if ((x->p != NULL) && !print(bp,"P:   ",x->p,m,off)) goto err;
 | 
			
		||||
	if ((x->q != NULL) && !print(bp,"Q:   ",x->q,m,off)) goto err;
 | 
			
		||||
	if ((x->g != NULL) && !print(bp,"G:   ",x->g,m,off)) goto err;
 | 
			
		||||
	ret=1;
 | 
			
		||||
err:
 | 
			
		||||
	if (m != NULL) OPENSSL_free(m);
 | 
			
		||||
	return(ret);
 | 
			
		||||
	}
 | 
			
		||||
#endif /* !OPENSSL_NO_DSA */
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_EC
 | 
			
		||||
#ifndef OPENSSL_NO_FP_API
 | 
			
		||||
int ECPKParameters_print_fp(FILE *fp, const EC_GROUP *x, int off)
 | 
			
		||||
	{
 | 
			
		||||
	BIO *b;
 | 
			
		||||
	int ret;
 | 
			
		||||
 | 
			
		||||
	if ((b=BIO_new(BIO_s_file())) == NULL)
 | 
			
		||||
		{
 | 
			
		||||
		ECerr(EC_F_ECPKPARAMETERS_PRINT_FP,ERR_R_BUF_LIB);
 | 
			
		||||
		return(0);
 | 
			
		||||
		}
 | 
			
		||||
	BIO_set_fp(b, fp, BIO_NOCLOSE);
 | 
			
		||||
	ret = ECPKParameters_print(b, x, off);
 | 
			
		||||
	BIO_free(b);
 | 
			
		||||
	return(ret);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
int EC_KEY_print_fp(FILE *fp, const EC_KEY *x, int off)
 | 
			
		||||
	{
 | 
			
		||||
	BIO *b;
 | 
			
		||||
	int ret;
 | 
			
		||||
 
 | 
			
		||||
	if ((b=BIO_new(BIO_s_file())) == NULL)
 | 
			
		||||
		{
 | 
			
		||||
		ECerr(EC_F_EC_KEY_PRINT_FP, ERR_R_BIO_LIB);
 | 
			
		||||
		return(0);
 | 
			
		||||
		}
 | 
			
		||||
	BIO_set_fp(b, fp, BIO_NOCLOSE);
 | 
			
		||||
	ret = EC_KEY_print(b, x, off);
 | 
			
		||||
	BIO_free(b);
 | 
			
		||||
	return(ret);
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
int ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off)
 | 
			
		||||
	{
 | 
			
		||||
	unsigned char *buffer=NULL;
 | 
			
		||||
	size_t	buf_len=0, i;
 | 
			
		||||
	int     ret=0, reason=ERR_R_BIO_LIB;
 | 
			
		||||
	BN_CTX  *ctx=NULL;
 | 
			
		||||
	const EC_POINT *point=NULL;
 | 
			
		||||
	BIGNUM	*p=NULL, *a=NULL, *b=NULL, *gen=NULL,
 | 
			
		||||
		*order=NULL, *cofactor=NULL;
 | 
			
		||||
	const unsigned char *seed;
 | 
			
		||||
	size_t	seed_len=0;
 | 
			
		||||
	
 | 
			
		||||
	static const char *gen_compressed = "Generator (compressed):";
 | 
			
		||||
	static const char *gen_uncompressed = "Generator (uncompressed):";
 | 
			
		||||
	static const char *gen_hybrid = "Generator (hybrid):";
 | 
			
		||||
 
 | 
			
		||||
	if (!x)
 | 
			
		||||
		{
 | 
			
		||||
		reason = ERR_R_PASSED_NULL_PARAMETER;
 | 
			
		||||
		goto err;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (EC_GROUP_get_asn1_flag(x))
 | 
			
		||||
		{
 | 
			
		||||
		/* the curve parameter are given by an asn1 OID */
 | 
			
		||||
		int nid;
 | 
			
		||||
 | 
			
		||||
		if (!BIO_indent(bp, off, 128))
 | 
			
		||||
			goto err;
 | 
			
		||||
 | 
			
		||||
		nid = EC_GROUP_get_curve_name(x);
 | 
			
		||||
		if (nid == 0)
 | 
			
		||||
			goto err;
 | 
			
		||||
 | 
			
		||||
		if (BIO_printf(bp, "ASN1 OID: %s", OBJ_nid2sn(nid)) <= 0)
 | 
			
		||||
			goto err;
 | 
			
		||||
		if (BIO_printf(bp, "\n") <= 0)
 | 
			
		||||
			goto err;
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		/* explicit parameters */
 | 
			
		||||
		int is_char_two = 0;
 | 
			
		||||
		point_conversion_form_t form;
 | 
			
		||||
		int tmp_nid = EC_METHOD_get_field_type(EC_GROUP_method_of(x));
 | 
			
		||||
 | 
			
		||||
		if (tmp_nid == NID_X9_62_characteristic_two_field)
 | 
			
		||||
			is_char_two = 1;
 | 
			
		||||
 | 
			
		||||
		if ((p = BN_new()) == NULL || (a = BN_new()) == NULL ||
 | 
			
		||||
			(b = BN_new()) == NULL || (order = BN_new()) == NULL ||
 | 
			
		||||
			(cofactor = BN_new()) == NULL)
 | 
			
		||||
			{
 | 
			
		||||
			reason = ERR_R_MALLOC_FAILURE;
 | 
			
		||||
			goto err;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		if (is_char_two)
 | 
			
		||||
			{
 | 
			
		||||
			if (!EC_GROUP_get_curve_GF2m(x, p, a, b, ctx))
 | 
			
		||||
				{
 | 
			
		||||
				reason = ERR_R_EC_LIB;
 | 
			
		||||
				goto err;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		else /* prime field */
 | 
			
		||||
			{
 | 
			
		||||
			if (!EC_GROUP_get_curve_GFp(x, p, a, b, ctx))
 | 
			
		||||
				{
 | 
			
		||||
				reason = ERR_R_EC_LIB;
 | 
			
		||||
				goto err;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		if ((point = EC_GROUP_get0_generator(x)) == NULL)
 | 
			
		||||
			{
 | 
			
		||||
			reason = ERR_R_EC_LIB;
 | 
			
		||||
			goto err;
 | 
			
		||||
			}
 | 
			
		||||
		if (!EC_GROUP_get_order(x, order, NULL) || 
 | 
			
		||||
            		!EC_GROUP_get_cofactor(x, cofactor, NULL))
 | 
			
		||||
			{
 | 
			
		||||
			reason = ERR_R_EC_LIB;
 | 
			
		||||
			goto err;
 | 
			
		||||
			}
 | 
			
		||||
		
 | 
			
		||||
		form = EC_GROUP_get_point_conversion_form(x);
 | 
			
		||||
 | 
			
		||||
		if ((gen = EC_POINT_point2bn(x, point, 
 | 
			
		||||
				form, NULL, ctx)) == NULL)
 | 
			
		||||
			{
 | 
			
		||||
			reason = ERR_R_EC_LIB;
 | 
			
		||||
			goto err;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		buf_len = (size_t)BN_num_bytes(p);
 | 
			
		||||
		if (buf_len < (i = (size_t)BN_num_bytes(a)))
 | 
			
		||||
			buf_len = i;
 | 
			
		||||
		if (buf_len < (i = (size_t)BN_num_bytes(b)))
 | 
			
		||||
			buf_len = i;
 | 
			
		||||
		if (buf_len < (i = (size_t)BN_num_bytes(gen)))
 | 
			
		||||
			buf_len = i;
 | 
			
		||||
		if (buf_len < (i = (size_t)BN_num_bytes(order)))
 | 
			
		||||
			buf_len = i;
 | 
			
		||||
		if (buf_len < (i = (size_t)BN_num_bytes(cofactor))) 
 | 
			
		||||
			buf_len = i;
 | 
			
		||||
 | 
			
		||||
		if ((seed = EC_GROUP_get0_seed(x)) != NULL)
 | 
			
		||||
			seed_len = EC_GROUP_get_seed_len(x);
 | 
			
		||||
 | 
			
		||||
		buf_len += 10;
 | 
			
		||||
		if ((buffer = OPENSSL_malloc(buf_len)) == NULL)
 | 
			
		||||
			{
 | 
			
		||||
			reason = ERR_R_MALLOC_FAILURE;
 | 
			
		||||
			goto err;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		if (!BIO_indent(bp, off, 128))
 | 
			
		||||
			goto err;
 | 
			
		||||
 | 
			
		||||
		/* print the 'short name' of the field type */
 | 
			
		||||
		if (BIO_printf(bp, "Field Type: %s\n", OBJ_nid2sn(tmp_nid))
 | 
			
		||||
			<= 0)
 | 
			
		||||
			goto err;  
 | 
			
		||||
 | 
			
		||||
		if (is_char_two)
 | 
			
		||||
			{
 | 
			
		||||
			/* print the 'short name' of the base type OID */
 | 
			
		||||
			int basis_type = EC_GROUP_get_basis_type(x);
 | 
			
		||||
			if (basis_type == 0)
 | 
			
		||||
				goto err;
 | 
			
		||||
 | 
			
		||||
			if (!BIO_indent(bp, off, 128))
 | 
			
		||||
				goto err;
 | 
			
		||||
 | 
			
		||||
			if (BIO_printf(bp, "Basis Type: %s\n", 
 | 
			
		||||
				OBJ_nid2sn(basis_type)) <= 0)
 | 
			
		||||
				goto err;
 | 
			
		||||
 | 
			
		||||
			/* print the polynomial */
 | 
			
		||||
			if ((p != NULL) && !print(bp, "Polynomial:", p, buffer,
 | 
			
		||||
				off))
 | 
			
		||||
				goto err;
 | 
			
		||||
			}
 | 
			
		||||
		else
 | 
			
		||||
			{
 | 
			
		||||
			if ((p != NULL) && !print(bp, "Prime:", p, buffer,off))
 | 
			
		||||
				goto err;
 | 
			
		||||
			}
 | 
			
		||||
		if ((a != NULL) && !print(bp, "A:   ", a, buffer, off)) 
 | 
			
		||||
			goto err;
 | 
			
		||||
		if ((b != NULL) && !print(bp, "B:   ", b, buffer, off))
 | 
			
		||||
			goto err;
 | 
			
		||||
		if (form == POINT_CONVERSION_COMPRESSED)
 | 
			
		||||
			{
 | 
			
		||||
			if ((gen != NULL) && !print(bp, gen_compressed, gen,
 | 
			
		||||
				buffer, off))
 | 
			
		||||
				goto err;
 | 
			
		||||
			}
 | 
			
		||||
		else if (form == POINT_CONVERSION_UNCOMPRESSED)
 | 
			
		||||
			{
 | 
			
		||||
			if ((gen != NULL) && !print(bp, gen_uncompressed, gen,
 | 
			
		||||
				buffer, off))
 | 
			
		||||
				goto err;
 | 
			
		||||
			}
 | 
			
		||||
		else /* form == POINT_CONVERSION_HYBRID */
 | 
			
		||||
			{
 | 
			
		||||
			if ((gen != NULL) && !print(bp, gen_hybrid, gen,
 | 
			
		||||
				buffer, off))
 | 
			
		||||
				goto err;
 | 
			
		||||
			}
 | 
			
		||||
		if ((order != NULL) && !print(bp, "Order: ", order, 
 | 
			
		||||
			buffer, off)) goto err;
 | 
			
		||||
		if ((cofactor != NULL) && !print(bp, "Cofactor: ", cofactor, 
 | 
			
		||||
			buffer, off)) goto err;
 | 
			
		||||
		if (seed && !print_bin(bp, "Seed:", seed, seed_len, off))
 | 
			
		||||
			goto err;
 | 
			
		||||
		}
 | 
			
		||||
	ret=1;
 | 
			
		||||
err:
 | 
			
		||||
	if (!ret)
 | 
			
		||||
 		ECerr(EC_F_ECPKPARAMETERS_PRINT, reason);
 | 
			
		||||
	if (p) 
 | 
			
		||||
		BN_free(p);
 | 
			
		||||
	if (a) 
 | 
			
		||||
		BN_free(a);
 | 
			
		||||
	if (b)
 | 
			
		||||
		BN_free(b);
 | 
			
		||||
	if (gen)
 | 
			
		||||
		BN_free(gen);
 | 
			
		||||
	if (order)
 | 
			
		||||
		BN_free(order);
 | 
			
		||||
	if (cofactor)
 | 
			
		||||
		BN_free(cofactor);
 | 
			
		||||
	if (ctx)
 | 
			
		||||
		BN_CTX_free(ctx);
 | 
			
		||||
	if (buffer != NULL) 
 | 
			
		||||
		OPENSSL_free(buffer);
 | 
			
		||||
	return(ret);	
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
int EC_KEY_print(BIO *bp, const EC_KEY *x, int off)
 | 
			
		||||
	{
 | 
			
		||||
	unsigned char *buffer=NULL;
 | 
			
		||||
	size_t	buf_len=0, i;
 | 
			
		||||
	int     ret=0, reason=ERR_R_BIO_LIB;
 | 
			
		||||
	BIGNUM  *pub_key=NULL, *order=NULL;
 | 
			
		||||
	BN_CTX  *ctx=NULL;
 | 
			
		||||
	const EC_GROUP *group;
 | 
			
		||||
	const EC_POINT *public_key;
 | 
			
		||||
	const BIGNUM *priv_key;
 | 
			
		||||
 
 | 
			
		||||
	if (x == NULL || (group = EC_KEY_get0_group(x)) == NULL)
 | 
			
		||||
		{
 | 
			
		||||
		reason = ERR_R_PASSED_NULL_PARAMETER;
 | 
			
		||||
		goto err;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	public_key = EC_KEY_get0_public_key(x);
 | 
			
		||||
	if ((pub_key = EC_POINT_point2bn(group, public_key,
 | 
			
		||||
		EC_KEY_get_conv_form(x), NULL, ctx)) == NULL)
 | 
			
		||||
		{
 | 
			
		||||
		reason = ERR_R_EC_LIB;
 | 
			
		||||
		goto err;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	buf_len = (size_t)BN_num_bytes(pub_key);
 | 
			
		||||
	priv_key = EC_KEY_get0_private_key(x);
 | 
			
		||||
	if (priv_key != NULL)
 | 
			
		||||
		{
 | 
			
		||||
		if ((i = (size_t)BN_num_bytes(priv_key)) > buf_len)
 | 
			
		||||
			buf_len = i;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	buf_len += 10;
 | 
			
		||||
	if ((buffer = OPENSSL_malloc(buf_len)) == NULL)
 | 
			
		||||
		{
 | 
			
		||||
		reason = ERR_R_MALLOC_FAILURE;
 | 
			
		||||
		goto err;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (priv_key != NULL)
 | 
			
		||||
		{
 | 
			
		||||
		if (!BIO_indent(bp, off, 128))
 | 
			
		||||
			goto err;
 | 
			
		||||
		if ((order = BN_new()) == NULL)
 | 
			
		||||
			goto err;
 | 
			
		||||
		if (!EC_GROUP_get_order(group, order, NULL))
 | 
			
		||||
			goto err;
 | 
			
		||||
		if (BIO_printf(bp, "Private-Key: (%d bit)\n", 
 | 
			
		||||
			BN_num_bits(order)) <= 0) goto err;
 | 
			
		||||
		}
 | 
			
		||||
  
 | 
			
		||||
	if ((priv_key != NULL) && !print(bp, "priv:", priv_key, 
 | 
			
		||||
		buffer, off))
 | 
			
		||||
		goto err;
 | 
			
		||||
	if ((pub_key != NULL) && !print(bp, "pub: ", pub_key,
 | 
			
		||||
		buffer, off))
 | 
			
		||||
		goto err;
 | 
			
		||||
	if (!ECPKParameters_print(bp, group, off))
 | 
			
		||||
		goto err;
 | 
			
		||||
	ret=1;
 | 
			
		||||
err:
 | 
			
		||||
	if (!ret)
 | 
			
		||||
 		ECerr(EC_F_EC_KEY_PRINT, reason);
 | 
			
		||||
	if (pub_key) 
 | 
			
		||||
		BN_free(pub_key);
 | 
			
		||||
	if (order)
 | 
			
		||||
		BN_free(order);
 | 
			
		||||
	if (ctx)
 | 
			
		||||
		BN_CTX_free(ctx);
 | 
			
		||||
	if (buffer != NULL)
 | 
			
		||||
		OPENSSL_free(buffer);
 | 
			
		||||
	return(ret);
 | 
			
		||||
	}
 | 
			
		||||
#endif /* OPENSSL_NO_EC */
 | 
			
		||||
 | 
			
		||||
static int print(BIO *bp, const char *number, const BIGNUM *num, unsigned char *buf,
 | 
			
		||||
	     int off)
 | 
			
		||||
	{
 | 
			
		||||
	int n,i;
 | 
			
		||||
	const char *neg;
 | 
			
		||||
@@ -112,3 +617,223 @@ int ASN1_bn_print(BIO *bp, const char *number, const BIGNUM *num,
 | 
			
		||||
		}
 | 
			
		||||
	return(1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_EC
 | 
			
		||||
static int print_bin(BIO *fp, const char *name, const unsigned char *buf,
 | 
			
		||||
		size_t len, int off)
 | 
			
		||||
	{
 | 
			
		||||
	size_t i;
 | 
			
		||||
	char str[128];
 | 
			
		||||
 | 
			
		||||
	if (buf == NULL)
 | 
			
		||||
		return 1;
 | 
			
		||||
	if (off)
 | 
			
		||||
		{
 | 
			
		||||
		if (off > 128)
 | 
			
		||||
			off=128;
 | 
			
		||||
		memset(str,' ',off);
 | 
			
		||||
		if (BIO_write(fp, str, off) <= 0)
 | 
			
		||||
			return 0;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (BIO_printf(fp,"%s", name) <= 0)
 | 
			
		||||
		return 0;
 | 
			
		||||
 | 
			
		||||
	for (i=0; i<len; i++)
 | 
			
		||||
		{
 | 
			
		||||
		if ((i%15) == 0)
 | 
			
		||||
			{
 | 
			
		||||
			str[0]='\n';
 | 
			
		||||
			memset(&(str[1]),' ',off+4);
 | 
			
		||||
			if (BIO_write(fp, str, off+1+4) <= 0)
 | 
			
		||||
				return 0;
 | 
			
		||||
			}
 | 
			
		||||
		if (BIO_printf(fp,"%02x%s",buf[i],((i+1) == len)?"":":") <= 0)
 | 
			
		||||
			return 0;
 | 
			
		||||
		}
 | 
			
		||||
	if (BIO_write(fp,"\n",1) <= 0)
 | 
			
		||||
		return 0;
 | 
			
		||||
 | 
			
		||||
	return 1;
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_DH
 | 
			
		||||
#ifndef OPENSSL_NO_FP_API
 | 
			
		||||
int DHparams_print_fp(FILE *fp, const DH *x)
 | 
			
		||||
	{
 | 
			
		||||
	BIO *b;
 | 
			
		||||
	int ret;
 | 
			
		||||
 | 
			
		||||
	if ((b=BIO_new(BIO_s_file())) == NULL)
 | 
			
		||||
		{
 | 
			
		||||
		DHerr(DH_F_DHPARAMS_PRINT_FP,ERR_R_BUF_LIB);
 | 
			
		||||
		return(0);
 | 
			
		||||
		}
 | 
			
		||||
	BIO_set_fp(b,fp,BIO_NOCLOSE);
 | 
			
		||||
	ret=DHparams_print(b, x);
 | 
			
		||||
	BIO_free(b);
 | 
			
		||||
	return(ret);
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
int DHparams_print(BIO *bp, const DH *x)
 | 
			
		||||
	{
 | 
			
		||||
	unsigned char *m=NULL;
 | 
			
		||||
	int reason=ERR_R_BUF_LIB,ret=0;
 | 
			
		||||
	size_t buf_len=0, i;
 | 
			
		||||
 | 
			
		||||
	if (x->p)
 | 
			
		||||
		buf_len = (size_t)BN_num_bytes(x->p);
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		reason = ERR_R_PASSED_NULL_PARAMETER;
 | 
			
		||||
		goto err;
 | 
			
		||||
		}
 | 
			
		||||
	if (x->g)
 | 
			
		||||
		if (buf_len < (i = (size_t)BN_num_bytes(x->g)))
 | 
			
		||||
			buf_len = i;
 | 
			
		||||
	m=(unsigned char *)OPENSSL_malloc(buf_len+10);
 | 
			
		||||
	if (m == NULL)
 | 
			
		||||
		{
 | 
			
		||||
		reason=ERR_R_MALLOC_FAILURE;
 | 
			
		||||
		goto err;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (BIO_printf(bp,"Diffie-Hellman-Parameters: (%d bit)\n",
 | 
			
		||||
		BN_num_bits(x->p)) <= 0)
 | 
			
		||||
		goto err;
 | 
			
		||||
	if (!print(bp,"prime:",x->p,m,4)) goto err;
 | 
			
		||||
	if (!print(bp,"generator:",x->g,m,4)) goto err;
 | 
			
		||||
	if (x->length != 0)
 | 
			
		||||
		{
 | 
			
		||||
		if (BIO_printf(bp,"    recommended-private-length: %d bits\n",
 | 
			
		||||
			(int)x->length) <= 0) goto err;
 | 
			
		||||
		}
 | 
			
		||||
	ret=1;
 | 
			
		||||
	if (0)
 | 
			
		||||
		{
 | 
			
		||||
err:
 | 
			
		||||
		DHerr(DH_F_DHPARAMS_PRINT,reason);
 | 
			
		||||
		}
 | 
			
		||||
	if (m != NULL) OPENSSL_free(m);
 | 
			
		||||
	return(ret);
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_DSA
 | 
			
		||||
#ifndef OPENSSL_NO_FP_API
 | 
			
		||||
int DSAparams_print_fp(FILE *fp, const DSA *x)
 | 
			
		||||
	{
 | 
			
		||||
	BIO *b;
 | 
			
		||||
	int ret;
 | 
			
		||||
 | 
			
		||||
	if ((b=BIO_new(BIO_s_file())) == NULL)
 | 
			
		||||
		{
 | 
			
		||||
		DSAerr(DSA_F_DSAPARAMS_PRINT_FP,ERR_R_BUF_LIB);
 | 
			
		||||
		return(0);
 | 
			
		||||
		}
 | 
			
		||||
	BIO_set_fp(b,fp,BIO_NOCLOSE);
 | 
			
		||||
	ret=DSAparams_print(b, x);
 | 
			
		||||
	BIO_free(b);
 | 
			
		||||
	return(ret);
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
int DSAparams_print(BIO *bp, const DSA *x)
 | 
			
		||||
	{
 | 
			
		||||
	unsigned char *m=NULL;
 | 
			
		||||
	int ret=0;
 | 
			
		||||
	size_t buf_len=0,i;
 | 
			
		||||
 | 
			
		||||
	if (x->p)
 | 
			
		||||
		buf_len = (size_t)BN_num_bytes(x->p);
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		DSAerr(DSA_F_DSAPARAMS_PRINT,DSA_R_MISSING_PARAMETERS);
 | 
			
		||||
		goto err;
 | 
			
		||||
		}
 | 
			
		||||
	if (x->q)
 | 
			
		||||
		if (buf_len < (i = (size_t)BN_num_bytes(x->q)))
 | 
			
		||||
			buf_len = i;
 | 
			
		||||
	if (x->g)
 | 
			
		||||
		if (buf_len < (i = (size_t)BN_num_bytes(x->g)))
 | 
			
		||||
			buf_len = i;
 | 
			
		||||
	m=(unsigned char *)OPENSSL_malloc(buf_len+10);
 | 
			
		||||
	if (m == NULL)
 | 
			
		||||
		{
 | 
			
		||||
		DSAerr(DSA_F_DSAPARAMS_PRINT,ERR_R_MALLOC_FAILURE);
 | 
			
		||||
		goto err;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (BIO_printf(bp,"DSA-Parameters: (%d bit)\n",
 | 
			
		||||
		BN_num_bits(x->p)) <= 0)
 | 
			
		||||
		goto err;
 | 
			
		||||
	if (!print(bp,"p:",x->p,m,4)) goto err;
 | 
			
		||||
	if ((x->q != NULL) && !print(bp,"q:",x->q,m,4)) goto err;
 | 
			
		||||
	if ((x->g != NULL) && !print(bp,"g:",x->g,m,4)) goto err;
 | 
			
		||||
	ret=1;
 | 
			
		||||
err:
 | 
			
		||||
	if (m != NULL) OPENSSL_free(m);
 | 
			
		||||
	return(ret);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
#endif /* !OPENSSL_NO_DSA */
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_EC
 | 
			
		||||
#ifndef OPENSSL_NO_FP_API
 | 
			
		||||
int ECParameters_print_fp(FILE *fp, const EC_KEY *x)
 | 
			
		||||
	{
 | 
			
		||||
	BIO *b;
 | 
			
		||||
	int ret;
 | 
			
		||||
 
 | 
			
		||||
	if ((b=BIO_new(BIO_s_file())) == NULL)
 | 
			
		||||
		{
 | 
			
		||||
		ECerr(EC_F_ECPARAMETERS_PRINT_FP, ERR_R_BIO_LIB);
 | 
			
		||||
		return(0);
 | 
			
		||||
		}
 | 
			
		||||
	BIO_set_fp(b, fp, BIO_NOCLOSE);
 | 
			
		||||
	ret = ECParameters_print(b, x);
 | 
			
		||||
	BIO_free(b);
 | 
			
		||||
	return(ret);
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
int ECParameters_print(BIO *bp, const EC_KEY *x)
 | 
			
		||||
	{
 | 
			
		||||
	int     reason=ERR_R_EC_LIB, ret=0;
 | 
			
		||||
	BIGNUM	*order=NULL;
 | 
			
		||||
	const EC_GROUP *group;
 | 
			
		||||
 
 | 
			
		||||
	if (x == NULL || (group = EC_KEY_get0_group(x)) == NULL)
 | 
			
		||||
		{
 | 
			
		||||
		reason = ERR_R_PASSED_NULL_PARAMETER;;
 | 
			
		||||
		goto err;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if ((order = BN_new()) == NULL)
 | 
			
		||||
		{
 | 
			
		||||
		reason = ERR_R_MALLOC_FAILURE;
 | 
			
		||||
		goto err;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (!EC_GROUP_get_order(group, order, NULL))
 | 
			
		||||
		{
 | 
			
		||||
		reason = ERR_R_EC_LIB;
 | 
			
		||||
		goto err;
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
	if (BIO_printf(bp, "ECDSA-Parameters: (%d bit)\n", 
 | 
			
		||||
		BN_num_bits(order)) <= 0)
 | 
			
		||||
		goto err;
 | 
			
		||||
	if (!ECPKParameters_print(bp, group, 4))
 | 
			
		||||
		goto err;
 | 
			
		||||
	ret=1;
 | 
			
		||||
err:
 | 
			
		||||
	if (order)
 | 
			
		||||
		BN_free(order);
 | 
			
		||||
	ECerr(EC_F_ECPARAMETERS_PRINT, reason);
 | 
			
		||||
	return(ret);
 | 
			
		||||
	}
 | 
			
		||||
  
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -149,10 +149,34 @@ int X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflags, unsigned long
 | 
			
		||||
			ERR_print_errors(bp);
 | 
			
		||||
			}
 | 
			
		||||
		else
 | 
			
		||||
#ifndef OPENSSL_NO_RSA
 | 
			
		||||
		if (pkey->type == EVP_PKEY_RSA)
 | 
			
		||||
			{
 | 
			
		||||
			EVP_PKEY_print_public(bp, pkey, 16, NULL);
 | 
			
		||||
			EVP_PKEY_free(pkey);
 | 
			
		||||
			BIO_printf(bp,"%12sRSA Public Key: (%d bit)\n","",
 | 
			
		||||
			BN_num_bits(pkey->pkey.rsa->n));
 | 
			
		||||
			RSA_print(bp,pkey->pkey.rsa,16);
 | 
			
		||||
			}
 | 
			
		||||
		else
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_DSA
 | 
			
		||||
		if (pkey->type == EVP_PKEY_DSA)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bp,"%12sDSA Public Key:\n","");
 | 
			
		||||
			DSA_print(bp,pkey->pkey.dsa,16);
 | 
			
		||||
			}
 | 
			
		||||
		else
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_EC
 | 
			
		||||
		if (pkey->type == EVP_PKEY_EC)
 | 
			
		||||
		{
 | 
			
		||||
			BIO_printf(bp, "%12sEC Public Key: \n","");
 | 
			
		||||
			EC_KEY_print(bp, pkey->pkey.ec, 16);
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
#endif
 | 
			
		||||
			BIO_printf(bp,"%12sUnknown Public Key:\n","");
 | 
			
		||||
 | 
			
		||||
		EVP_PKEY_free(pkey);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if(!(cflag & X509_FLAG_NO_ATTRIBUTES))
 | 
			
		||||
 
 | 
			
		||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user