Compare commits
	
		
			530 Commits
		
	
	
		
			OpenSSL_1_
			...
			OpenSSL_1_
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					3a9a032163 | ||
| 
						 | 
					b83ceba7d5 | ||
| 
						 | 
					d9738d5f07 | ||
| 
						 | 
					583f0bc402 | ||
| 
						 | 
					e8e878bec7 | ||
| 
						 | 
					6099e629f5 | ||
| 
						 | 
					3570086760 | ||
| 
						 | 
					acb341eb6e | ||
| 
						 | 
					8fb2c9922a | ||
| 
						 | 
					a97c208c5a | ||
| 
						 | 
					cc6e9f9abb | ||
| 
						 | 
					56cd740449 | ||
| 
						 | 
					8437225d34 | ||
| 
						 | 
					b4a57c4c41 | ||
| 
						 | 
					faa8038edd | ||
| 
						 | 
					e02863b5ac | ||
| 
						 | 
					04685bc949 | ||
| 
						 | 
					98a0f9660d | ||
| 
						 | 
					45fe66b8ba | ||
| 
						 | 
					8d7aab986b | ||
| 
						 | 
					e078642dde | ||
| 
						 | 
					ffd14272c4 | ||
| 
						 | 
					f16f3ac559 | ||
| 
						 | 
					4fb433d221 | ||
| 
						 | 
					293c1e2235 | ||
| 
						 | 
					d5e16a711e | ||
| 
						 | 
					178c562a46 | ||
| 
						 | 
					61052e891e | ||
| 
						 | 
					cb951e336b | ||
| 
						 | 
					37580f43b5 | ||
| 
						 | 
					ef28c6d676 | ||
| 
						 | 
					2175744952 | ||
| 
						 | 
					2357cd2e20 | ||
| 
						 | 
					5951cc004b | ||
| 
						 | 
					a8565530e2 | ||
| 
						 | 
					9e9ee7e37f | ||
| 
						 | 
					500d67f15a | ||
| 
						 | 
					40fb8587ed | ||
| 
						 | 
					c14a808c51 | ||
| 
						 | 
					cdf42d7b43 | ||
| 
						 | 
					7858d304bc | ||
| 
						 | 
					f14a6bf515 | ||
| 
						 | 
					5dad57536f | ||
| 
						 | 
					a5fad4d6bc | ||
| 
						 | 
					d6c2e3e621 | ||
| 
						 | 
					8c46748bcb | ||
| 
						 | 
					86edf13b1c | ||
| 
						 | 
					fcd9b1073a | ||
| 
						 | 
					036df29387 | ||
| 
						 | 
					60b7d3bbb5 | ||
| 
						 | 
					7e9d42ce97 | ||
| 
						 | 
					b3147fcbe6 | ||
| 
						 | 
					feefb73ad9 | ||
| 
						 | 
					8932b82f7d | ||
| 
						 | 
					a4a759acec | ||
| 
						 | 
					6e5a554533 | ||
| 
						 | 
					2164a17a7d | ||
| 
						 | 
					dc1e493808 | ||
| 
						 | 
					1fe8304db0 | ||
| 
						 | 
					bfd19df6d0 | ||
| 
						 | 
					7f9edfd23a | ||
| 
						 | 
					9673056c25 | ||
| 
						 | 
					f50730d361 | ||
| 
						 | 
					9beb948c0d | ||
| 
						 | 
					ce5ddefc43 | ||
| 
						 | 
					458f23f610 | ||
| 
						 | 
					c983a77887 | ||
| 
						 | 
					7516eaf492 | ||
| 
						 | 
					c6a84ff351 | ||
| 
						 | 
					b8b9bcb458 | ||
| 
						 | 
					be617fbaf8 | ||
| 
						 | 
					321ba85899 | ||
| 
						 | 
					fcabfc66ae | ||
| 
						 | 
					9844573039 | ||
| 
						 | 
					6579603874 | ||
| 
						 | 
					d68aade28a | ||
| 
						 | 
					3242e5938b | ||
| 
						 | 
					35384e8e5b | ||
| 
						 | 
					4c21e004a3 | ||
| 
						 | 
					59ee70e386 | ||
| 
						 | 
					43e569921e | ||
| 
						 | 
					8aaeec9f9a | ||
| 
						 | 
					8454d3f924 | ||
| 
						 | 
					5004c22c25 | ||
| 
						 | 
					e96872f4c0 | ||
| 
						 | 
					14e9a78d47 | ||
| 
						 | 
					2aca9b272e | ||
| 
						 | 
					26d7cb400e | ||
| 
						 | 
					2db95e094d | ||
| 
						 | 
					5fc8bb6ab7 | ||
| 
						 | 
					244d0955ad | ||
| 
						 | 
					061e68c554 | ||
| 
						 | 
					3f1d582f70 | ||
| 
						 | 
					8a2e5bf6b7 | ||
| 
						 | 
					6c3d948723 | ||
| 
						 | 
					51c5ab5d3a | ||
| 
						 | 
					ff60f33811 | ||
| 
						 | 
					2cfa5edb26 | ||
| 
						 | 
					291a3e9629 | ||
| 
						 | 
					2184a14b62 | ||
| 
						 | 
					2e84084fbc | ||
| 
						 | 
					26f9cfbdca | ||
| 
						 | 
					7fc5f4f117 | ||
| 
						 | 
					249a3e362f | ||
| 
						 | 
					15d717f574 | ||
| 
						 | 
					b8712b2b9a | ||
| 
						 | 
					1eaccbef57 | ||
| 
						 | 
					e2f69f5ce7 | ||
| 
						 | 
					821bee4333 | ||
| 
						 | 
					8b6205c484 | ||
| 
						 | 
					e5cf62b04d | ||
| 
						 | 
					b1edca2a4c | ||
| 
						 | 
					e7768ebbd2 | ||
| 
						 | 
					329a76c085 | ||
| 
						 | 
					bbb76be9b5 | ||
| 
						 | 
					b726b8a60c | ||
| 
						 | 
					e298409c34 | ||
| 
						 | 
					25012d5e79 | ||
| 
						 | 
					09b7de77b3 | ||
| 
						 | 
					9bdedec0cf | ||
| 
						 | 
					f63fa8b10a | ||
| 
						 | 
					d47aebbb47 | ||
| 
						 | 
					08931f1cd6 | ||
| 
						 | 
					6ce9687b5a | ||
| 
						 | 
					20e610580e | ||
| 
						 | 
					4fa17211bb | ||
| 
						 | 
					d8d40fc676 | ||
| 
						 | 
					3c7fcdfdd4 | ||
| 
						 | 
					e356ac5c06 | ||
| 
						 | 
					872e681c00 | ||
| 
						 | 
					38b71ba8ff | ||
| 
						 | 
					f8cf36c298 | ||
| 
						 | 
					26a59d9b46 | ||
| 
						 | 
					7fd4ce6a99 | ||
| 
						 | 
					d9d09a8d0f | ||
| 
						 | 
					2b0532f398 | ||
| 
						 | 
					7d07c75c5b | ||
| 
						 | 
					f34297db80 | ||
| 
						 | 
					e2e5326e5b | ||
| 
						 | 
					592c6e1191 | ||
| 
						 | 
					8202802fad | ||
| 
						 | 
					f79bb32926 | ||
| 
						 | 
					7a3809fd97 | ||
| 
						 | 
					f13a149088 | ||
| 
						 | 
					fc586d2955 | ||
| 
						 | 
					17d45dec4d | ||
| 
						 | 
					6bfe55380a | ||
| 
						 | 
					4e05aedbca | ||
| 
						 | 
					bf3e200eb4 | ||
| 
						 | 
					55614f89f0 | ||
| 
						 | 
					b1620443f3 | ||
| 
						 | 
					4ed98b6e25 | ||
| 
						 | 
					3a33923515 | ||
| 
						 | 
					f2df488a1c | ||
| 
						 | 
					8d507aee7c | ||
| 
						 | 
					133145686e | ||
| 
						 | 
					0f04b004ac | ||
| 
						 | 
					81e3a6055c | ||
| 
						 | 
					bea9a17726 | ||
| 
						 | 
					b537ea9ce4 | ||
| 
						 | 
					13ce52be1b | ||
| 
						 | 
					11853c50ec | ||
| 
						 | 
					a60aa7e008 | ||
| 
						 | 
					a49256a349 | ||
| 
						 | 
					e517dfd3d1 | ||
| 
						 | 
					74687f5979 | ||
| 
						 | 
					8dc6617ad5 | ||
| 
						 | 
					c2119214c2 | ||
| 
						 | 
					22387f00b6 | ||
| 
						 | 
					4d16915381 | ||
| 
						 | 
					e7169a5835 | ||
| 
						 | 
					abc2dfbcc3 | ||
| 
						 | 
					23ea9f6f03 | ||
| 
						 | 
					3e5df37861 | ||
| 
						 | 
					4e5f9f8a9a | ||
| 
						 | 
					9446ecfb3a | ||
| 
						 | 
					48ecdec7a0 | ||
| 
						 | 
					8f5f782253 | ||
| 
						 | 
					228a77a4ad | ||
| 
						 | 
					03b17a5789 | ||
| 
						 | 
					391f3b5708 | ||
| 
						 | 
					fe9b9a880f | ||
| 
						 | 
					9f96ea4c2b | ||
| 
						 | 
					41a765182f | ||
| 
						 | 
					bcdd904c6c | ||
| 
						 | 
					a90b1e32d2 | ||
| 
						 | 
					0ed8e95c4b | ||
| 
						 | 
					6b5b85f4f6 | ||
| 
						 | 
					03ebf85f77 | ||
| 
						 | 
					30fbe92c78 | ||
| 
						 | 
					1241e77f15 | ||
| 
						 | 
					1433cac53c | ||
| 
						 | 
					204fb36a0e | ||
| 
						 | 
					2b45603445 | ||
| 
						 | 
					d70c0be4c1 | ||
| 
						 | 
					9b649d9a73 | ||
| 
						 | 
					abbd58559e | ||
| 
						 | 
					d15d17bb64 | ||
| 
						 | 
					966fe81f9b | ||
| 
						 | 
					83764a989d | ||
| 
						 | 
					86788e1ee6 | ||
| 
						 | 
					03b04ddac1 | ||
| 
						 | 
					88ae012c80 | ||
| 
						 | 
					fc4f4cdb8b | ||
| 
						 | 
					4e0fbdc4ec | ||
| 
						 | 
					0c37aed3f3 | ||
| 
						 | 
					099ccdb808 | ||
| 
						 | 
					9871417fb7 | ||
| 
						 | 
					fc7804ec39 | ||
| 
						 | 
					e7b9d9be48 | ||
| 
						 | 
					2172d4f63c | ||
| 
						 | 
					c34091d47e | ||
| 
						 | 
					a9f4ebd753 | ||
| 
						 | 
					604c9948a8 | ||
| 
						 | 
					281720c2a3 | ||
| 
						 | 
					2a9023f7b4 | ||
| 
						 | 
					36e8c39899 | ||
| 
						 | 
					e3f009c595 | ||
| 
						 | 
					fbe3baa773 | ||
| 
						 | 
					690998f904 | ||
| 
						 | 
					3221da845f | ||
| 
						 | 
					9aeb410419 | ||
| 
						 | 
					bf4519cde5 | ||
| 
						 | 
					e967b94356 | ||
| 
						 | 
					2316286c0e | ||
| 
						 | 
					67bde7d465 | ||
| 
						 | 
					cd63f94d4d | ||
| 
						 | 
					2054eb771e | ||
| 
						 | 
					ea0ceb11a0 | ||
| 
						 | 
					00579b98c4 | ||
| 
						 | 
					ee5a8d3e31 | ||
| 
						 | 
					72370164c3 | ||
| 
						 | 
					704422ce1e | ||
| 
						 | 
					8e8d7e1b26 | ||
| 
						 | 
					3ed6327571 | ||
| 
						 | 
					efd4f1dfd3 | ||
| 
						 | 
					00032b0ba1 | ||
| 
						 | 
					a07f514fc0 | ||
| 
						 | 
					b197c770a6 | ||
| 
						 | 
					b7c9762598 | ||
| 
						 | 
					a414bc8c3e | ||
| 
						 | 
					98a3c3c514 | ||
| 
						 | 
					157fd05aad | ||
| 
						 | 
					9f510ceb5d | ||
| 
						 | 
					675b1c2fce | ||
| 
						 | 
					c923132e9d | ||
| 
						 | 
					1864e3bed3 | ||
| 
						 | 
					af7bcd7daa | ||
| 
						 | 
					3fa2fff86f | ||
| 
						 | 
					b372a64e10 | ||
| 
						 | 
					e432336433 | ||
| 
						 | 
					f3b0e0215c | ||
| 
						 | 
					a6cc0e0a0d | ||
| 
						 | 
					b2cb6dc1ef | ||
| 
						 | 
					f87f88a69f | ||
| 
						 | 
					6d87cd2f03 | ||
| 
						 | 
					2db3ea2929 | ||
| 
						 | 
					c28b055a0c | ||
| 
						 | 
					02e8d46119 | ||
| 
						 | 
					105a3db56e | ||
| 
						 | 
					295befec25 | ||
| 
						 | 
					cb34cb1f23 | ||
| 
						 | 
					86f393ceb7 | ||
| 
						 | 
					d6d324374e | ||
| 
						 | 
					14999bcc59 | ||
| 
						 | 
					046e288edf | ||
| 
						 | 
					d8b11e75cb | ||
| 
						 | 
					0df7959d43 | ||
| 
						 | 
					5894eb1f33 | ||
| 
						 | 
					6daba1dc6a | ||
| 
						 | 
					69b8f2895b | ||
| 
						 | 
					0ace876730 | ||
| 
						 | 
					e9daf8a9ce | ||
| 
						 | 
					cf0156622a | ||
| 
						 | 
					86cac6d3b2 | ||
| 
						 | 
					f46ea1d8e2 | ||
| 
						 | 
					0980992d44 | ||
| 
						 | 
					38a503fb8a | ||
| 
						 | 
					fef58ce79e | ||
| 
						 | 
					da0d5e78bc | ||
| 
						 | 
					ad212c1ed1 | ||
| 
						 | 
					e1bce59fd3 | ||
| 
						 | 
					9beb75d3c4 | ||
| 
						 | 
					042ef467ee | ||
| 
						 | 
					01736e6c41 | ||
| 
						 | 
					29411a0c7a | ||
| 
						 | 
					b66f59adfa | ||
| 
						 | 
					9ab788aa23 | ||
| 
						 | 
					87887a7a65 | ||
| 
						 | 
					5a0d057e49 | ||
| 
						 | 
					aa59369b4c | ||
| 
						 | 
					18c7f2fce8 | ||
| 
						 | 
					6a8d6f039a | ||
| 
						 | 
					5ff9c21f72 | ||
| 
						 | 
					5c52c04650 | ||
| 
						 | 
					6c86bf7a1e | ||
| 
						 | 
					0d4d2e02eb | ||
| 
						 | 
					151399a944 | ||
| 
						 | 
					049615e35d | ||
| 
						 | 
					6b72417a00 | ||
| 
						 | 
					aabbe99fcb | ||
| 
						 | 
					8011cd56e3 | ||
| 
						 | 
					d3152655d5 | ||
| 
						 | 
					006cd7083f | ||
| 
						 | 
					bc8923b1ec | ||
| 
						 | 
					1632ef7448 | ||
| 
						 | 
					f1f4fbde2a | ||
| 
						 | 
					1854c48005 | ||
| 
						 | 
					ebda73f867 | ||
| 
						 | 
					bcc311668e | ||
| 
						 | 
					1dd26414df | ||
| 
						 | 
					056389eb1c | ||
| 
						 | 
					a07856a08d | ||
| 
						 | 
					19ce768c6b | ||
| 
						 | 
					aaed77c55e | ||
| 
						 | 
					49270d0431 | ||
| 
						 | 
					673c42b238 | ||
| 
						 | 
					5541b18ba8 | ||
| 
						 | 
					28e117f49f | ||
| 
						 | 
					46bfc05480 | ||
| 
						 | 
					427a37ca3f | ||
| 
						 | 
					39ae3b338f | ||
| 
						 | 
					48f5b3efce | ||
| 
						 | 
					f8dc000699 | ||
| 
						 | 
					bf8d6f9ab8 | ||
| 
						 | 
					17e844a450 | ||
| 
						 | 
					8ca7d12430 | ||
| 
						 | 
					67b9c82ea2 | ||
| 
						 | 
					a6f5b991eb | ||
| 
						 | 
					756587dcb9 | ||
| 
						 | 
					0a084f7b3a | ||
| 
						 | 
					da0a95b23a | ||
| 
						 | 
					599fe418a1 | ||
| 
						 | 
					4519e7b839 | ||
| 
						 | 
					4659b53e7d | ||
| 
						 | 
					dc22495d35 | ||
| 
						 | 
					ab0d964259 | ||
| 
						 | 
					dac3654e2d | ||
| 
						 | 
					989d87cb1a | ||
| 
						 | 
					d6934a02b5 | ||
| 
						 | 
					f9986e9abf | ||
| 
						 | 
					1f5e321ec1 | ||
| 
						 | 
					b6adb6ef58 | ||
| 
						 | 
					bfdaf45141 | ||
| 
						 | 
					69526a354d | ||
| 
						 | 
					778f2b648c | ||
| 
						 | 
					2223317bef | ||
| 
						 | 
					b107586c0c | ||
| 
						 | 
					d544755389 | ||
| 
						 | 
					88398e9ba3 | ||
| 
						 | 
					15c1ac03c8 | ||
| 
						 | 
					c3c6fc7855 | ||
| 
						 | 
					4d8cca8a7e | ||
| 
						 | 
					d61be85581 | ||
| 
						 | 
					9e456a8537 | ||
| 
						 | 
					f179e2b899 | ||
| 
						 | 
					6a60b41431 | ||
| 
						 | 
					c6a47f988c | ||
| 
						 | 
					d0666f289a | ||
| 
						 | 
					d8afda60a9 | ||
| 
						 | 
					804ab36df6 | ||
| 
						 | 
					a41d5174e2 | ||
| 
						 | 
					9c5d953a07 | ||
| 
						 | 
					7b7b18c57e | ||
| 
						 | 
					8eb094b946 | ||
| 
						 | 
					7fa18a63cb | ||
| 
						 | 
					90600a5e3b | ||
| 
						 | 
					23f5908ac7 | ||
| 
						 | 
					e622237d12 | ||
| 
						 | 
					f0816174d2 | ||
| 
						 | 
					057444f844 | ||
| 
						 | 
					725c5f1ad3 | ||
| 
						 | 
					9c8dc84ac1 | ||
| 
						 | 
					e3899ababb | ||
| 
						 | 
					3fc880ac5d | ||
| 
						 | 
					602b2790ca | ||
| 
						 | 
					b05a3ad765 | ||
| 
						 | 
					3d8f4f23af | ||
| 
						 | 
					a74bee5fc7 | ||
| 
						 | 
					55c9e24875 | ||
| 
						 | 
					ebe221948d | ||
| 
						 | 
					b2d951e423 | ||
| 
						 | 
					c5993d10a8 | ||
| 
						 | 
					5be1ae28ef | ||
| 
						 | 
					96db9023b8 | ||
| 
						 | 
					0d7717fc9c | ||
| 
						 | 
					aba7600029 | ||
| 
						 | 
					00acdfbf98 | ||
| 
						 | 
					51624dbdae | ||
| 
						 | 
					9e29df0027 | ||
| 
						 | 
					f54167d1dc | ||
| 
						 | 
					6042582b62 | ||
| 
						 | 
					50522642a0 | ||
| 
						 | 
					bfc3424d1f | ||
| 
						 | 
					1c65936882 | ||
| 
						 | 
					40acdb192e | ||
| 
						 | 
					4b7a4ba29c | ||
| 
						 | 
					e0660c6257 | ||
| 
						 | 
					b4ada742d1 | ||
| 
						 | 
					a93d952cd4 | ||
| 
						 | 
					5b56fec6f5 | ||
| 
						 | 
					32171e4e07 | ||
| 
						 | 
					48e6edabed | ||
| 
						 | 
					069607124d | ||
| 
						 | 
					caf55bfacf | ||
| 
						 | 
					ce3631015e | ||
| 
						 | 
					3ae1b53496 | ||
| 
						 | 
					79bb00534d | ||
| 
						 | 
					c4b16ddc8f | ||
| 
						 | 
					deb3b08ff2 | ||
| 
						 | 
					b45b3efd5d | ||
| 
						 | 
					e420060ac9 | ||
| 
						 | 
					d8ec8a4a65 | ||
| 
						 | 
					040ed7b4d0 | ||
| 
						 | 
					c76e5b08a1 | ||
| 
						 | 
					0071215832 | ||
| 
						 | 
					4a55631e4d | ||
| 
						 | 
					19a68574a9 | ||
| 
						 | 
					f21e6b6ecb | ||
| 
						 | 
					e1549a01c7 | ||
| 
						 | 
					765be74d24 | ||
| 
						 | 
					9614d2c676 | ||
| 
						 | 
					ad03c71ea1 | ||
| 
						 | 
					4eedf86a16 | ||
| 
						 | 
					eb85ee9a88 | ||
| 
						 | 
					fa2026dc88 | ||
| 
						 | 
					fe08007399 | ||
| 
						 | 
					e3ebdcff12 | ||
| 
						 | 
					cb10cf1224 | ||
| 
						 | 
					c0dd71c97c | ||
| 
						 | 
					51478be956 | ||
| 
						 | 
					a7304e4b98 | ||
| 
						 | 
					0d8776344c | ||
| 
						 | 
					197e0ea817 | ||
| 
						 | 
					c776a3f398 | ||
| 
						 | 
					25c9fa6026 | ||
| 
						 | 
					d2dc33d57c | ||
| 
						 | 
					f3dcc8411e | ||
| 
						 | 
					1c2c5e402a | ||
| 
						 | 
					34628967f1 | ||
| 
						 | 
					a6c62f0c25 | ||
| 
						 | 
					ca989269a2 | ||
| 
						 | 
					2ec4181ba9 | ||
| 
						 | 
					0294b2be5f | ||
| 
						 | 
					f1068a1ab7 | ||
| 
						 | 
					cadde467a8 | ||
| 
						 | 
					c2bdcba347 | ||
| 
						 | 
					60df657b3a | ||
| 
						 | 
					17a2d0801f | ||
| 
						 | 
					accb3007ac | ||
| 
						 | 
					b13dff6141 | ||
| 
						 | 
					4ade6a8ca4 | ||
| 
						 | 
					00fadef414 | ||
| 
						 | 
					7ed244a0b3 | ||
| 
						 | 
					e94a23876c | ||
| 
						 | 
					041f681943 | ||
| 
						 | 
					afec9f57da | ||
| 
						 | 
					0ec1a77891 | ||
| 
						 | 
					62c2b6d944 | ||
| 
						 | 
					5b98979712 | ||
| 
						 | 
					9abbf5cce7 | ||
| 
						 | 
					ddfe486e4c | ||
| 
						 | 
					834d30bc63 | ||
| 
						 | 
					e26faa9e0c | ||
| 
						 | 
					025f7dbdd1 | ||
| 
						 | 
					44f4934bde | ||
| 
						 | 
					453ca706cc | ||
| 
						 | 
					5e1ff664f9 | ||
| 
						 | 
					833a896681 | ||
| 
						 | 
					34e43b909f | ||
| 
						 | 
					62036c6fc3 | ||
| 
						 | 
					68dd8512b7 | ||
| 
						 | 
					bbf9f3c654 | ||
| 
						 | 
					2583270191 | ||
| 
						 | 
					3da721dac9 | ||
| 
						 | 
					eb22b7ec75 | ||
| 
						 | 
					b93916149d | ||
| 
						 | 
					82f42a1d2e | ||
| 
						 | 
					a4870de5aa | ||
| 
						 | 
					39aabe59c8 | ||
| 
						 | 
					f4c93b46ed | ||
| 
						 | 
					4af793036f | ||
| 
						 | 
					13bca90ac5 | ||
| 
						 | 
					c9a6ddafc5 | ||
| 
						 | 
					f4a51970d2 | ||
| 
						 | 
					937f125efc | ||
| 
						 | 
					4b61f6d2a6 | ||
| 
						 | 
					d5bff72615 | ||
| 
						 | 
					3b4be0018b | ||
| 
						 | 
					125c2ed8a3 | ||
| 
						 | 
					09da95542a | ||
| 
						 | 
					cc53b38574 | ||
| 
						 | 
					0aeeae0c9c | ||
| 
						 | 
					00c991f028 | ||
| 
						 | 
					55856a7b74 | ||
| 
						 | 
					83a3af9f4e | ||
| 
						 | 
					76bf0cf27c | ||
| 
						 | 
					7cf0529b52 | ||
| 
						 | 
					6c03af135b | ||
| 
						 | 
					5cd1aa4f15 | ||
| 
						 | 
					04b80f4003 | ||
| 
						 | 
					591c55a981 | ||
| 
						 | 
					cd2693862b | ||
| 
						 | 
					25370e93c6 | ||
| 
						 | 
					cdb6c48445 | ||
| 
						 | 
					04b727b4dd | ||
| 
						 | 
					cbd93a0636 | ||
| 
						 | 
					b9e84f007f | ||
| 
						 | 
					29a546720b | ||
| 
						 | 
					0e9dd387ea | ||
| 
						 | 
					79dabcc137 | ||
| 
						 | 
					944bc29f90 | ||
| 
						 | 
					03e1b3a153 | ||
| 
						 | 
					9c95ff968a | ||
| 
						 | 
					96b680f210 | ||
| 
						 | 
					9ab3ce1246 | ||
| 
						 | 
					3972dbe462 | ||
| 
						 | 
					85615e33e5 | ||
| 
						 | 
					f4cfc3444a | ||
| 
						 | 
					24f599af21 | ||
| 
						 | 
					bca0d7fdb5 | ||
| 
						 | 
					bc4ae2cb0b | ||
| 
						 | 
					ef4b9f001a | ||
| 
						 | 
					08f8933fa3 | ||
| 
						 | 
					41958376b5 | ||
| 
						 | 
					9fe4603b82 | ||
| 
						 | 
					147dbb2fe3 | ||
| 
						 | 
					cbf9b4aed3 | ||
| 
						 | 
					625a55324f | ||
| 
						 | 
					3151e328e0 | 
							
								
								
									
										32
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										32
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -1,5 +1,6 @@
 | 
			
		||||
# Object files
 | 
			
		||||
*.o
 | 
			
		||||
*.obj
 | 
			
		||||
 | 
			
		||||
# editor artefacts
 | 
			
		||||
*.swp
 | 
			
		||||
@@ -47,6 +48,21 @@
 | 
			
		||||
*.s
 | 
			
		||||
!/crypto/bn/asm/pa-risc2.s
 | 
			
		||||
!/crypto/bn/asm/pa-risc2W.s
 | 
			
		||||
crypto/aes/asm/a_win32.asm
 | 
			
		||||
crypto/bf/asm/b_win32.asm
 | 
			
		||||
crypto/bn/asm/bn_win32.asm
 | 
			
		||||
crypto/bn/asm/co_win32.asm
 | 
			
		||||
crypto/bn/asm/mt_win32.asm
 | 
			
		||||
crypto/cast/asm/c_win32.asm
 | 
			
		||||
crypto/cpu_win32.asm
 | 
			
		||||
crypto/des/asm/d_win32.asm
 | 
			
		||||
crypto/des/asm/y_win32.asm
 | 
			
		||||
crypto/md5/asm/m5_win32.asm
 | 
			
		||||
crypto/rc4/asm/r4_win32.asm
 | 
			
		||||
crypto/rc5/asm/r5_win32.asm
 | 
			
		||||
crypto/ripemd/asm/rm_win32.asm
 | 
			
		||||
crypto/sha/asm/s1_win32.asm
 | 
			
		||||
crypto/sha/asm/sha512-sse2.asm
 | 
			
		||||
 | 
			
		||||
# Executables
 | 
			
		||||
/apps/openssl
 | 
			
		||||
@@ -75,3 +91,19 @@
 | 
			
		||||
lib
 | 
			
		||||
Makefile.save
 | 
			
		||||
*.bak
 | 
			
		||||
tags
 | 
			
		||||
TAGS
 | 
			
		||||
 | 
			
		||||
# Windows
 | 
			
		||||
/tmp32dll
 | 
			
		||||
/tmp32dll.dbg
 | 
			
		||||
/out32dll
 | 
			
		||||
/out32dll.dbg
 | 
			
		||||
/inc32
 | 
			
		||||
/MINFO
 | 
			
		||||
ms/bcb.mak
 | 
			
		||||
ms/libeay32.def
 | 
			
		||||
ms/nt.mak
 | 
			
		||||
ms/ntdll.mak
 | 
			
		||||
ms/ssleay32.def
 | 
			
		||||
ms/version32.rc
 | 
			
		||||
 
 | 
			
		||||
@@ -10,13 +10,18 @@ OpenSSL project.
 | 
			
		||||
We would like to identify and thank the following such sponsors for their past
 | 
			
		||||
or current significant support of the OpenSSL project:
 | 
			
		||||
 | 
			
		||||
Major support:
 | 
			
		||||
 | 
			
		||||
	Qualys		http://www.qualys.com/
 | 
			
		||||
 | 
			
		||||
Very significant support:
 | 
			
		||||
 | 
			
		||||
	OpenGear: www.opengear.com
 | 
			
		||||
	OpenGear:	http://www.opengear.com/
 | 
			
		||||
 | 
			
		||||
Significant support:
 | 
			
		||||
 | 
			
		||||
	PSW Group: www.psw.net
 | 
			
		||||
	PSW Group:	http://www.psw.net/
 | 
			
		||||
	Acano Ltd.	http://acano.com/
 | 
			
		||||
 | 
			
		||||
Please note that we ask permission to identify sponsors and that some sponsors
 | 
			
		||||
we consider eligible for inclusion here have requested to remain anonymous.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										512
									
								
								CHANGES
									
									
									
									
									
								
							
							
						
						
									
										512
									
								
								CHANGES
									
									
									
									
									
								
							@@ -2,10 +2,381 @@
 | 
			
		||||
 OpenSSL CHANGES
 | 
			
		||||
 _______________
 | 
			
		||||
 | 
			
		||||
 Changes between 1.0.1d and 1.0.1e [11 Feb 2013]
 | 
			
		||||
 Changes between 1.0.1l and 1.0.1m [xx XXX xxxx]
 | 
			
		||||
 | 
			
		||||
  *)
 | 
			
		||||
 | 
			
		||||
 Changes between 1.0.1k and 1.0.1l [15 Jan 2015]
 | 
			
		||||
 | 
			
		||||
  *) Build fixes for the Windows and OpenVMS platforms
 | 
			
		||||
     [Matt Caswell and Richard Levitte]
 | 
			
		||||
 | 
			
		||||
 Changes between 1.0.1j and 1.0.1k [8 Jan 2015]
 | 
			
		||||
 | 
			
		||||
  *) Fix DTLS segmentation fault in dtls1_get_record. A carefully crafted DTLS
 | 
			
		||||
     message can cause a segmentation fault in OpenSSL due to a NULL pointer
 | 
			
		||||
     dereference. This could lead to a Denial Of Service attack. Thanks to
 | 
			
		||||
     Markus Stenberg of Cisco Systems, Inc. for reporting this issue.
 | 
			
		||||
     (CVE-2014-3571)
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Fix DTLS memory leak in dtls1_buffer_record. A memory leak can occur in the
 | 
			
		||||
     dtls1_buffer_record function under certain conditions. In particular this
 | 
			
		||||
     could occur if an attacker sent repeated DTLS records with the same
 | 
			
		||||
     sequence number but for the next epoch. The memory leak could be exploited
 | 
			
		||||
     by an attacker in a Denial of Service attack through memory exhaustion.
 | 
			
		||||
     Thanks to Chris Mueller for reporting this issue.
 | 
			
		||||
     (CVE-2015-0206)
 | 
			
		||||
     [Matt Caswell]
 | 
			
		||||
 | 
			
		||||
  *) Fix issue where no-ssl3 configuration sets method to NULL. When openssl is
 | 
			
		||||
     built with the no-ssl3 option and a SSL v3 ClientHello is received the ssl
 | 
			
		||||
     method would be set to NULL which could later result in a NULL pointer
 | 
			
		||||
     dereference. Thanks to Frank Schmirler for reporting this issue.
 | 
			
		||||
     (CVE-2014-3569)
 | 
			
		||||
     [Kurt Roeckx]
 | 
			
		||||
 | 
			
		||||
  *) Abort handshake if server key exchange message is omitted for ephemeral
 | 
			
		||||
     ECDH ciphersuites.
 | 
			
		||||
 | 
			
		||||
     Thanks to Karthikeyan Bhargavan of the PROSECCO team at INRIA for
 | 
			
		||||
     reporting this issue.
 | 
			
		||||
     (CVE-2014-3572)
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Remove non-export ephemeral RSA code on client and server. This code
 | 
			
		||||
     violated the TLS standard by allowing the use of temporary RSA keys in
 | 
			
		||||
     non-export ciphersuites and could be used by a server to effectively
 | 
			
		||||
     downgrade the RSA key length used to a value smaller than the server
 | 
			
		||||
     certificate. Thanks for Karthikeyan Bhargavan of the PROSECCO team at
 | 
			
		||||
     INRIA or reporting this issue.
 | 
			
		||||
     (CVE-2015-0204)
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Fixed issue where DH client certificates are accepted without verification.
 | 
			
		||||
     An OpenSSL server will accept a DH certificate for client authentication
 | 
			
		||||
     without the certificate verify message. This effectively allows a client to
 | 
			
		||||
     authenticate without the use of a private key. This only affects servers
 | 
			
		||||
     which trust a client certificate authority which issues certificates
 | 
			
		||||
     containing DH keys: these are extremely rare and hardly ever encountered.
 | 
			
		||||
     Thanks for Karthikeyan Bhargavan of the PROSECCO team at INRIA or reporting
 | 
			
		||||
     this issue.
 | 
			
		||||
     (CVE-2015-0205)
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Ensure that the session ID context of an SSL is updated when its
 | 
			
		||||
     SSL_CTX is updated via SSL_set_SSL_CTX.
 | 
			
		||||
 | 
			
		||||
     The session ID context is typically set from the parent SSL_CTX,
 | 
			
		||||
     and can vary with the CTX.
 | 
			
		||||
     [Adam Langley]
 | 
			
		||||
 | 
			
		||||
  *) Fix various certificate fingerprint issues.
 | 
			
		||||
 | 
			
		||||
     By using non-DER or invalid encodings outside the signed portion of a
 | 
			
		||||
     certificate the fingerprint can be changed without breaking the signature.
 | 
			
		||||
     Although no details of the signed portion of the certificate can be changed
 | 
			
		||||
     this can cause problems with some applications: e.g. those using the
 | 
			
		||||
     certificate fingerprint for blacklists.
 | 
			
		||||
 | 
			
		||||
     1. Reject signatures with non zero unused bits.
 | 
			
		||||
 | 
			
		||||
     If the BIT STRING containing the signature has non zero unused bits reject
 | 
			
		||||
     the signature. All current signature algorithms require zero unused bits.
 | 
			
		||||
 | 
			
		||||
     2. Check certificate algorithm consistency.
 | 
			
		||||
 | 
			
		||||
     Check the AlgorithmIdentifier inside TBS matches the one in the
 | 
			
		||||
     certificate signature. NB: this will result in signature failure
 | 
			
		||||
     errors for some broken certificates.
 | 
			
		||||
 | 
			
		||||
     Thanks to Konrad Kraszewski from Google for reporting this issue.
 | 
			
		||||
 | 
			
		||||
     3. Check DSA/ECDSA signatures use DER.
 | 
			
		||||
 | 
			
		||||
     Reencode DSA/ECDSA signatures and compare with the original received
 | 
			
		||||
     signature. Return an error if there is a mismatch.
 | 
			
		||||
 | 
			
		||||
     This will reject various cases including garbage after signature
 | 
			
		||||
     (thanks to Antti Karjalainen and Tuomo Untinen from the Codenomicon CROSS
 | 
			
		||||
     program for discovering this case) and use of BER or invalid ASN.1 INTEGERs
 | 
			
		||||
     (negative or with leading zeroes).
 | 
			
		||||
 | 
			
		||||
     Further analysis was conducted and fixes were developed by Stephen Henson
 | 
			
		||||
     of the OpenSSL core team.
 | 
			
		||||
 | 
			
		||||
     (CVE-2014-8275)
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
   *) Correct Bignum squaring. Bignum squaring (BN_sqr) may produce incorrect
 | 
			
		||||
      results on some platforms, including x86_64. This bug occurs at random
 | 
			
		||||
      with a very low probability, and is not known to be exploitable in any
 | 
			
		||||
      way, though its exact impact is difficult to determine. Thanks to Pieter
 | 
			
		||||
      Wuille (Blockstream) who reported this issue and also suggested an initial
 | 
			
		||||
      fix. Further analysis was conducted by the OpenSSL development team and
 | 
			
		||||
      Adam Langley of Google. The final fix was developed by Andy Polyakov of
 | 
			
		||||
      the OpenSSL core team.
 | 
			
		||||
      (CVE-2014-3570)
 | 
			
		||||
      [Andy Polyakov]
 | 
			
		||||
 | 
			
		||||
   *) Do not resume sessions on the server if the negotiated protocol
 | 
			
		||||
      version does not match the session's version. Resuming with a different
 | 
			
		||||
      version, while not strictly forbidden by the RFC, is of questionable
 | 
			
		||||
      sanity and breaks all known clients.
 | 
			
		||||
      [David Benjamin, Emilia K<>sper]
 | 
			
		||||
 | 
			
		||||
   *) Tighten handling of the ChangeCipherSpec (CCS) message: reject
 | 
			
		||||
      early CCS messages during renegotiation. (Note that because
 | 
			
		||||
      renegotiation is encrypted, this early CCS was not exploitable.)
 | 
			
		||||
      [Emilia K<>sper]
 | 
			
		||||
 | 
			
		||||
   *) Tighten client-side session ticket handling during renegotiation:
 | 
			
		||||
      ensure that the client only accepts a session ticket if the server sends
 | 
			
		||||
      the extension anew in the ServerHello. Previously, a TLS client would
 | 
			
		||||
      reuse the old extension state and thus accept a session ticket if one was
 | 
			
		||||
      announced in the initial ServerHello.
 | 
			
		||||
 | 
			
		||||
      Similarly, ensure that the client requires a session ticket if one
 | 
			
		||||
      was advertised in the ServerHello. Previously, a TLS client would
 | 
			
		||||
      ignore a missing NewSessionTicket message.
 | 
			
		||||
      [Emilia K<>sper]
 | 
			
		||||
 | 
			
		||||
 Changes between 1.0.1i and 1.0.1j [15 Oct 2014]
 | 
			
		||||
 | 
			
		||||
  *) SRTP Memory Leak.
 | 
			
		||||
 | 
			
		||||
     A flaw in the DTLS SRTP extension parsing code allows an attacker, who
 | 
			
		||||
     sends a carefully crafted handshake message, to cause OpenSSL to fail
 | 
			
		||||
     to free up to 64k of memory causing a memory leak. This could be
 | 
			
		||||
     exploited in a Denial Of Service attack. This issue affects OpenSSL
 | 
			
		||||
     1.0.1 server implementations for both SSL/TLS and DTLS regardless of
 | 
			
		||||
     whether SRTP is used or configured. Implementations of OpenSSL that
 | 
			
		||||
     have been compiled with OPENSSL_NO_SRTP defined are not affected.
 | 
			
		||||
 | 
			
		||||
     The fix was developed by the OpenSSL team.
 | 
			
		||||
     (CVE-2014-3513)
 | 
			
		||||
     [OpenSSL team]
 | 
			
		||||
 | 
			
		||||
  *) Session Ticket Memory Leak.
 | 
			
		||||
 | 
			
		||||
     When an OpenSSL SSL/TLS/DTLS server receives a session ticket the
 | 
			
		||||
     integrity of that ticket is first verified. In the event of a session
 | 
			
		||||
     ticket integrity check failing, OpenSSL will fail to free memory
 | 
			
		||||
     causing a memory leak. By sending a large number of invalid session
 | 
			
		||||
     tickets an attacker could exploit this issue in a Denial Of Service
 | 
			
		||||
     attack.
 | 
			
		||||
     (CVE-2014-3567)
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Build option no-ssl3 is incomplete.
 | 
			
		||||
 | 
			
		||||
     When OpenSSL is configured with "no-ssl3" as a build option, servers
 | 
			
		||||
     could accept and complete a SSL 3.0 handshake, and clients could be
 | 
			
		||||
     configured to send them.
 | 
			
		||||
     (CVE-2014-3568)
 | 
			
		||||
     [Akamai and the OpenSSL team]
 | 
			
		||||
 | 
			
		||||
  *) Add support for TLS_FALLBACK_SCSV.
 | 
			
		||||
     Client applications doing fallback retries should call
 | 
			
		||||
     SSL_set_mode(s, SSL_MODE_SEND_FALLBACK_SCSV).
 | 
			
		||||
     (CVE-2014-3566)
 | 
			
		||||
     [Adam Langley, Bodo Moeller]
 | 
			
		||||
 | 
			
		||||
  *) Add additional DigestInfo checks.
 | 
			
		||||
 
 | 
			
		||||
     Reencode DigestInto in DER and check against the original when
 | 
			
		||||
     verifying RSA signature: this will reject any improperly encoded
 | 
			
		||||
     DigestInfo structures.
 | 
			
		||||
 | 
			
		||||
     Note: this is a precautionary measure and no attacks are currently known.
 | 
			
		||||
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
 Changes between 1.0.1h and 1.0.1i [6 Aug 2014]
 | 
			
		||||
 | 
			
		||||
  *) Fix SRP buffer overrun vulnerability. Invalid parameters passed to the
 | 
			
		||||
     SRP code can be overrun an internal buffer. Add sanity check that
 | 
			
		||||
     g, A, B < N to SRP code.
 | 
			
		||||
 | 
			
		||||
     Thanks to Sean Devlin and Watson Ladd of Cryptography Services, NCC
 | 
			
		||||
     Group for discovering this issue.
 | 
			
		||||
     (CVE-2014-3512)
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) A flaw in the OpenSSL SSL/TLS server code causes the server to negotiate
 | 
			
		||||
     TLS 1.0 instead of higher protocol versions when the ClientHello message
 | 
			
		||||
     is badly fragmented. This allows a man-in-the-middle attacker to force a
 | 
			
		||||
     downgrade to TLS 1.0 even if both the server and the client support a
 | 
			
		||||
     higher protocol version, by modifying the client's TLS records.
 | 
			
		||||
 | 
			
		||||
     Thanks to David Benjamin and Adam Langley (Google) for discovering and
 | 
			
		||||
     researching this issue.
 | 
			
		||||
     (CVE-2014-3511)
 | 
			
		||||
     [David Benjamin]
 | 
			
		||||
 | 
			
		||||
  *) OpenSSL DTLS clients enabling anonymous (EC)DH ciphersuites are subject
 | 
			
		||||
     to a denial of service attack. A malicious server can crash the client
 | 
			
		||||
     with a null pointer dereference (read) by specifying an anonymous (EC)DH
 | 
			
		||||
     ciphersuite and sending carefully crafted handshake messages.
 | 
			
		||||
 | 
			
		||||
     Thanks to Felix Gr<47>bert (Google) for discovering and researching this
 | 
			
		||||
     issue.
 | 
			
		||||
     (CVE-2014-3510)
 | 
			
		||||
     [Emilia K<>sper]
 | 
			
		||||
 | 
			
		||||
  *) By sending carefully crafted DTLS packets an attacker could cause openssl
 | 
			
		||||
     to leak memory. This can be exploited through a Denial of Service attack.
 | 
			
		||||
     Thanks to Adam Langley for discovering and researching this issue.
 | 
			
		||||
     (CVE-2014-3507)
 | 
			
		||||
     [Adam Langley]
 | 
			
		||||
 | 
			
		||||
  *) An attacker can force openssl to consume large amounts of memory whilst
 | 
			
		||||
     processing DTLS handshake messages. This can be exploited through a
 | 
			
		||||
     Denial of Service attack.
 | 
			
		||||
     Thanks to Adam Langley for discovering and researching this issue.
 | 
			
		||||
     (CVE-2014-3506)
 | 
			
		||||
     [Adam Langley]
 | 
			
		||||
 | 
			
		||||
  *) An attacker can force an error condition which causes openssl to crash
 | 
			
		||||
     whilst processing DTLS packets due to memory being freed twice. This
 | 
			
		||||
     can be exploited through a Denial of Service attack.
 | 
			
		||||
     Thanks to Adam Langley and Wan-Teh Chang for discovering and researching
 | 
			
		||||
     this issue.
 | 
			
		||||
     (CVE-2014-3505)
 | 
			
		||||
     [Adam Langley]
 | 
			
		||||
 | 
			
		||||
  *) If a multithreaded client connects to a malicious server using a resumed
 | 
			
		||||
     session and the server sends an ec point format extension it could write
 | 
			
		||||
     up to 255 bytes to freed memory.
 | 
			
		||||
 | 
			
		||||
     Thanks to Gabor Tyukasz (LogMeIn Inc) for discovering and researching this
 | 
			
		||||
     issue.
 | 
			
		||||
     (CVE-2014-3509)
 | 
			
		||||
     [Gabor Tyukasz]
 | 
			
		||||
 | 
			
		||||
  *) A malicious server can crash an OpenSSL client with a null pointer
 | 
			
		||||
     dereference (read) by specifying an SRP ciphersuite even though it was not
 | 
			
		||||
     properly negotiated with the client. This can be exploited through a
 | 
			
		||||
     Denial of Service attack.
 | 
			
		||||
 | 
			
		||||
     Thanks to Joonas Kuorilehto and Riku Hietam<61>ki (Codenomicon) for
 | 
			
		||||
     discovering and researching this issue.
 | 
			
		||||
     (CVE-2014-5139)
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) A flaw in OBJ_obj2txt may cause pretty printing functions such as
 | 
			
		||||
     X509_name_oneline, X509_name_print_ex et al. to leak some information
 | 
			
		||||
     from the stack. Applications may be affected if they echo pretty printing
 | 
			
		||||
     output to the attacker.
 | 
			
		||||
 | 
			
		||||
     Thanks to Ivan Fratric (Google) for discovering this issue.
 | 
			
		||||
     (CVE-2014-3508)
 | 
			
		||||
     [Emilia K<>sper, and Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Fix ec_GFp_simple_points_make_affine (thus, EC_POINTs_mul etc.)
 | 
			
		||||
     for corner cases. (Certain input points at infinity could lead to
 | 
			
		||||
     bogus results, with non-infinity inputs mapped to infinity too.)
 | 
			
		||||
     [Bodo Moeller]
 | 
			
		||||
 | 
			
		||||
 Changes between 1.0.1g and 1.0.1h [5 Jun 2014]
 | 
			
		||||
 | 
			
		||||
  *) Fix for SSL/TLS MITM flaw. An attacker using a carefully crafted
 | 
			
		||||
     handshake can force the use of weak keying material in OpenSSL
 | 
			
		||||
     SSL/TLS clients and servers.
 | 
			
		||||
 | 
			
		||||
     Thanks to KIKUCHI Masashi (Lepidum Co. Ltd.) for discovering and
 | 
			
		||||
     researching this issue. (CVE-2014-0224)
 | 
			
		||||
     [KIKUCHI Masashi, Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Fix DTLS recursion flaw. By sending an invalid DTLS handshake to an
 | 
			
		||||
     OpenSSL DTLS client the code can be made to recurse eventually crashing
 | 
			
		||||
     in a DoS attack.
 | 
			
		||||
 | 
			
		||||
     Thanks to Imre Rad (Search-Lab Ltd.) for discovering this issue.
 | 
			
		||||
     (CVE-2014-0221)
 | 
			
		||||
     [Imre Rad, Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Fix DTLS invalid fragment vulnerability. A buffer overrun attack can
 | 
			
		||||
     be triggered by sending invalid DTLS fragments to an OpenSSL DTLS
 | 
			
		||||
     client or server. This is potentially exploitable to run arbitrary
 | 
			
		||||
     code on a vulnerable client or server.
 | 
			
		||||
 | 
			
		||||
     Thanks to J<>ri Aedla for reporting this issue. (CVE-2014-0195)
 | 
			
		||||
     [J<>ri Aedla, Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Fix bug in TLS code where clients enable anonymous ECDH ciphersuites
 | 
			
		||||
     are subject to a denial of service attack.
 | 
			
		||||
 | 
			
		||||
     Thanks to Felix Gr<47>bert and Ivan Fratric at Google for discovering
 | 
			
		||||
     this issue. (CVE-2014-3470)
 | 
			
		||||
     [Felix Gr<47>bert, Ivan Fratric, Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Harmonize version and its documentation. -f flag is used to display
 | 
			
		||||
     compilation flags.
 | 
			
		||||
     [mancha <mancha1@zoho.com>]
 | 
			
		||||
 | 
			
		||||
  *) Fix eckey_priv_encode so it immediately returns an error upon a failure
 | 
			
		||||
     in i2d_ECPrivateKey.
 | 
			
		||||
     [mancha <mancha1@zoho.com>]
 | 
			
		||||
 | 
			
		||||
  *) Fix some double frees. These are not thought to be exploitable.
 | 
			
		||||
     [mancha <mancha1@zoho.com>]
 | 
			
		||||
 | 
			
		||||
 Changes between 1.0.1f and 1.0.1g [7 Apr 2014]
 | 
			
		||||
 | 
			
		||||
  *) A missing bounds check in the handling of the TLS heartbeat extension
 | 
			
		||||
     can be used to reveal up to 64k of memory to a connected client or
 | 
			
		||||
     server.
 | 
			
		||||
 | 
			
		||||
     Thanks for Neel Mehta of Google Security for discovering this bug and to
 | 
			
		||||
     Adam Langley <agl@chromium.org> and Bodo Moeller <bmoeller@acm.org> for
 | 
			
		||||
     preparing the fix (CVE-2014-0160)
 | 
			
		||||
     [Adam Langley, Bodo Moeller]
 | 
			
		||||
 | 
			
		||||
  *) Fix for the attack described in the paper "Recovering OpenSSL
 | 
			
		||||
     ECDSA Nonces Using the FLUSH+RELOAD Cache Side-channel Attack"
 | 
			
		||||
     by Yuval Yarom and Naomi Benger. Details can be obtained from:
 | 
			
		||||
     http://eprint.iacr.org/2014/140
 | 
			
		||||
 | 
			
		||||
     Thanks to Yuval Yarom and Naomi Benger for discovering this
 | 
			
		||||
     flaw and to Yuval Yarom for supplying a fix (CVE-2014-0076)
 | 
			
		||||
     [Yuval Yarom and Naomi Benger]
 | 
			
		||||
 | 
			
		||||
  *) TLS pad extension: draft-agl-tls-padding-03
 | 
			
		||||
 | 
			
		||||
     Workaround for the "TLS hang bug" (see FAQ and PR#2771): if the
 | 
			
		||||
     TLS client Hello record length value would otherwise be > 255 and
 | 
			
		||||
     less that 512 pad with a dummy extension containing zeroes so it
 | 
			
		||||
     is at least 512 bytes long.
 | 
			
		||||
 | 
			
		||||
     [Adam Langley, Steve Henson]
 | 
			
		||||
 | 
			
		||||
 Changes between 1.0.1e and 1.0.1f [6 Jan 2014]
 | 
			
		||||
 | 
			
		||||
  *) Fix for TLS record tampering bug. A carefully crafted invalid 
 | 
			
		||||
     handshake could crash OpenSSL with a NULL pointer exception.
 | 
			
		||||
     Thanks to Anton Johansson for reporting this issues.
 | 
			
		||||
     (CVE-2013-4353)
 | 
			
		||||
 | 
			
		||||
  *) Keep original DTLS digest and encryption contexts in retransmission
 | 
			
		||||
     structures so we can use the previous session parameters if they need
 | 
			
		||||
     to be resent. (CVE-2013-6450)
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Add option SSL_OP_SAFARI_ECDHE_ECDSA_BUG (part of SSL_OP_ALL) which
 | 
			
		||||
     avoids preferring ECDHE-ECDSA ciphers when the client appears to be
 | 
			
		||||
     Safari on OS X.  Safari on OS X 10.8..10.8.3 advertises support for
 | 
			
		||||
     several ECDHE-ECDSA ciphers, but fails to negotiate them.  The bug
 | 
			
		||||
     is fixed in OS X 10.8.4, but Apple have ruled out both hot fixing
 | 
			
		||||
     10.8..10.8.3 and forcing users to upgrade to 10.8.4 or newer.
 | 
			
		||||
     [Rob Stradling, Adam Langley]
 | 
			
		||||
 | 
			
		||||
 Changes between 1.0.1d and 1.0.1e [11 Feb 2013]
 | 
			
		||||
 | 
			
		||||
  *) Correct fix for CVE-2013-0169. The original didn't work on AES-NI
 | 
			
		||||
     supporting platforms or when small records were transferred.
 | 
			
		||||
     [Andy Polyakov, Steve Henson]
 | 
			
		||||
 | 
			
		||||
 Changes between 1.0.1c and 1.0.1d [5 Feb 2013]
 | 
			
		||||
 | 
			
		||||
  *) Make the decoding of SSLv3, TLS and DTLS CBC records constant time.
 | 
			
		||||
@@ -404,6 +775,63 @@
 | 
			
		||||
       Add command line options to s_client/s_server.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
 Changes between 1.0.0j and 1.0.0k [5 Feb 2013]
 | 
			
		||||
 | 
			
		||||
  *) Make the decoding of SSLv3, TLS and DTLS CBC records constant time.
 | 
			
		||||
 | 
			
		||||
     This addresses the flaw in CBC record processing discovered by 
 | 
			
		||||
     Nadhem Alfardan and Kenny Paterson. Details of this attack can be found
 | 
			
		||||
     at: http://www.isg.rhul.ac.uk/tls/     
 | 
			
		||||
 | 
			
		||||
     Thanks go to Nadhem Alfardan and Kenny Paterson of the Information
 | 
			
		||||
     Security Group at Royal Holloway, University of London
 | 
			
		||||
     (www.isg.rhul.ac.uk) for discovering this flaw and Adam Langley and
 | 
			
		||||
     Emilia K<>sper for the initial patch.
 | 
			
		||||
     (CVE-2013-0169)
 | 
			
		||||
     [Emilia K<>sper, Adam Langley, Ben Laurie, Andy Polyakov, Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Return an error when checking OCSP signatures when key is NULL.
 | 
			
		||||
     This fixes a DoS attack. (CVE-2013-0166)
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Call OCSP Stapling callback after ciphersuite has been chosen, so
 | 
			
		||||
     the right response is stapled. Also change SSL_get_certificate()
 | 
			
		||||
     so it returns the certificate actually sent.
 | 
			
		||||
     See http://rt.openssl.org/Ticket/Display.html?id=2836.
 | 
			
		||||
     (This is a backport)
 | 
			
		||||
     [Rob Stradling <rob.stradling@comodo.com>]
 | 
			
		||||
 | 
			
		||||
  *) Fix possible deadlock when decoding public keys.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
 Changes between 1.0.0i and 1.0.0j [10 May 2012]
 | 
			
		||||
 | 
			
		||||
  [NB: OpenSSL 1.0.0i and later 1.0.0 patch levels were released after
 | 
			
		||||
  OpenSSL 1.0.1.]
 | 
			
		||||
 | 
			
		||||
  *) Sanity check record length before skipping explicit IV in DTLS
 | 
			
		||||
     to fix DoS attack.
 | 
			
		||||
 | 
			
		||||
     Thanks to Codenomicon for discovering this issue using Fuzz-o-Matic
 | 
			
		||||
     fuzzing as a service testing platform.
 | 
			
		||||
     (CVE-2012-2333)
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Initialise tkeylen properly when encrypting CMS messages.
 | 
			
		||||
     Thanks to Solar Designer of Openwall for reporting this issue.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
 Changes between 1.0.0h and 1.0.0i [19 Apr 2012]
 | 
			
		||||
 | 
			
		||||
  *) Check for potentially exploitable overflows in asn1_d2i_read_bio
 | 
			
		||||
     BUF_mem_grow and BUF_mem_grow_clean. Refuse attempts to shrink buffer
 | 
			
		||||
     in CRYPTO_realloc_clean.
 | 
			
		||||
 | 
			
		||||
     Thanks to Tavis Ormandy, Google Security Team, for discovering this
 | 
			
		||||
     issue and to Adam Langley <agl@chromium.org> for fixing it.
 | 
			
		||||
     (CVE-2012-2110)
 | 
			
		||||
     [Adam Langley (Google), Tavis Ormandy, Google Security Team]
 | 
			
		||||
 | 
			
		||||
 Changes between 1.0.0g and 1.0.0h [12 Mar 2012]
 | 
			
		||||
 | 
			
		||||
  *) Fix MMA (Bleichenbacher's attack on PKCS #1 v1.5 RSA padding) weakness
 | 
			
		||||
@@ -1394,6 +1822,86 @@
 | 
			
		||||
  *) Change 'Configure' script to enable Camellia by default.
 | 
			
		||||
     [NTT]
 | 
			
		||||
 | 
			
		||||
 Changes between 0.9.8x and 0.9.8y [5 Feb 2013]
 | 
			
		||||
 | 
			
		||||
  *) Make the decoding of SSLv3, TLS and DTLS CBC records constant time.
 | 
			
		||||
 | 
			
		||||
     This addresses the flaw in CBC record processing discovered by 
 | 
			
		||||
     Nadhem Alfardan and Kenny Paterson. Details of this attack can be found
 | 
			
		||||
     at: http://www.isg.rhul.ac.uk/tls/     
 | 
			
		||||
 | 
			
		||||
     Thanks go to Nadhem Alfardan and Kenny Paterson of the Information
 | 
			
		||||
     Security Group at Royal Holloway, University of London
 | 
			
		||||
     (www.isg.rhul.ac.uk) for discovering this flaw and Adam Langley and
 | 
			
		||||
     Emilia K<>sper for the initial patch.
 | 
			
		||||
     (CVE-2013-0169)
 | 
			
		||||
     [Emilia K<>sper, Adam Langley, Ben Laurie, Andy Polyakov, Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Return an error when checking OCSP signatures when key is NULL.
 | 
			
		||||
     This fixes a DoS attack. (CVE-2013-0166)
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Call OCSP Stapling callback after ciphersuite has been chosen, so
 | 
			
		||||
     the right response is stapled. Also change SSL_get_certificate()
 | 
			
		||||
     so it returns the certificate actually sent.
 | 
			
		||||
     See http://rt.openssl.org/Ticket/Display.html?id=2836.
 | 
			
		||||
     (This is a backport)
 | 
			
		||||
     [Rob Stradling <rob.stradling@comodo.com>]
 | 
			
		||||
 | 
			
		||||
  *) Fix possible deadlock when decoding public keys.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
 Changes between 0.9.8w and 0.9.8x [10 May 2012]
 | 
			
		||||
 | 
			
		||||
  *) Sanity check record length before skipping explicit IV in DTLS
 | 
			
		||||
     to fix DoS attack.
 | 
			
		||||
 | 
			
		||||
     Thanks to Codenomicon for discovering this issue using Fuzz-o-Matic
 | 
			
		||||
     fuzzing as a service testing platform.
 | 
			
		||||
     (CVE-2012-2333)
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Initialise tkeylen properly when encrypting CMS messages.
 | 
			
		||||
     Thanks to Solar Designer of Openwall for reporting this issue.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
 Changes between 0.9.8v and 0.9.8w [23 Apr 2012]
 | 
			
		||||
 | 
			
		||||
  *) The fix for CVE-2012-2110 did not take into account that the 
 | 
			
		||||
     'len' argument to BUF_MEM_grow and BUF_MEM_grow_clean is an
 | 
			
		||||
     int in OpenSSL 0.9.8, making it still vulnerable. Fix by 
 | 
			
		||||
     rejecting negative len parameter. (CVE-2012-2131)
 | 
			
		||||
     [Tomas Hoger <thoger@redhat.com>]
 | 
			
		||||
 | 
			
		||||
 Changes between 0.9.8u and 0.9.8v [19 Apr 2012]
 | 
			
		||||
 | 
			
		||||
  *) Check for potentially exploitable overflows in asn1_d2i_read_bio
 | 
			
		||||
     BUF_mem_grow and BUF_mem_grow_clean. Refuse attempts to shrink buffer
 | 
			
		||||
     in CRYPTO_realloc_clean.
 | 
			
		||||
 | 
			
		||||
     Thanks to Tavis Ormandy, Google Security Team, for discovering this
 | 
			
		||||
     issue and to Adam Langley <agl@chromium.org> for fixing it.
 | 
			
		||||
     (CVE-2012-2110)
 | 
			
		||||
     [Adam Langley (Google), Tavis Ormandy, Google Security Team]
 | 
			
		||||
 | 
			
		||||
 Changes between 0.9.8t and 0.9.8u [12 Mar 2012]
 | 
			
		||||
 | 
			
		||||
  *) Fix MMA (Bleichenbacher's attack on PKCS #1 v1.5 RSA padding) weakness
 | 
			
		||||
     in CMS and PKCS7 code. When RSA decryption fails use a random key for
 | 
			
		||||
     content decryption and always return the same error. Note: this attack
 | 
			
		||||
     needs on average 2^20 messages so it only affects automated senders. The
 | 
			
		||||
     old behaviour can be reenabled in the CMS code by setting the
 | 
			
		||||
     CMS_DEBUG_DECRYPT flag: this is useful for debugging and testing where
 | 
			
		||||
     an MMA defence is not necessary.
 | 
			
		||||
     Thanks to Ivan Nestlerode <inestlerode@us.ibm.com> for discovering
 | 
			
		||||
     this issue. (CVE-2012-0884)
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Fix CVE-2011-4619: make sure we really are receiving a 
 | 
			
		||||
     client hello before rejecting multiple SGC restarts. Thanks to
 | 
			
		||||
     Ivan Nestlerode <inestlerode@us.ibm.com> for discovering this bug.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
 Changes between 0.9.8s and 0.9.8t [18 Jan 2012]
 | 
			
		||||
 | 
			
		||||
  *) Fix for DTLS DoS issue introduced by fix for CVE-2011-4109.
 | 
			
		||||
@@ -1401,7 +1909,7 @@
 | 
			
		||||
     Development, Cisco Systems, Inc. for discovering this bug and
 | 
			
		||||
     preparing a fix. (CVE-2012-0050)
 | 
			
		||||
     [Antonio Martin]
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
 Changes between 0.9.8r and 0.9.8s [4 Jan 2012]
 | 
			
		||||
 | 
			
		||||
  *) Nadhem Alfardan and Kenny Paterson have discovered an extension
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										18
									
								
								Configure
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								Configure
									
									
									
									
									
								
							@@ -178,7 +178,7 @@ my %table=(
 | 
			
		||||
"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-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:$gcc_devteam_warn -DBN_DEBUG -DBN_DEBUG_RAND -DCONF_DEBUG -DBIO_PAIR_DEBUG -m64 -DL_ENDIAN -DTERMIO -g -DMD32_REG_T=int::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
 | 
			
		||||
"debug-bodo",	"gcc:$gcc_devteam_warn -Wno-error=overlength-strings -DBN_DEBUG -DBN_DEBUG_RAND -DCONF_DEBUG -DBIO_PAIR_DEBUG -m64 -DL_ENDIAN -DTERMIO -g -DMD32_REG_T=int::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
 | 
			
		||||
"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 -Wno-overlength-strings -g::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK 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)",
 | 
			
		||||
@@ -526,7 +526,7 @@ my %table=(
 | 
			
		||||
# 'perl Configure VC-WIN32' with '-DUNICODE -D_UNICODE'
 | 
			
		||||
"VC-WIN32","cl:-W3 -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
 | 
			
		||||
"debug-VC-WIN32","cl:-W3 -WX -Gs0 -GF -Gy -Zi -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",
 | 
			
		||||
"debug-VC-WIN32","cl:-W3 -Gs0 -GF -Gy -Zi -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",
 | 
			
		||||
"VC-CE","cl::::WINCE::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${no_asm}:win32",
 | 
			
		||||
 | 
			
		||||
# Borland C++ 4.5
 | 
			
		||||
@@ -720,6 +720,7 @@ my %disabled = ( # "what"         => "comment" [or special keyword "experimental
 | 
			
		||||
		 "sctp"       => "default",
 | 
			
		||||
		 "shared"         => "default",
 | 
			
		||||
		 "store"	  => "experimental",
 | 
			
		||||
		 "unit-test"	  => "default",
 | 
			
		||||
		 "zlib"           => "default",
 | 
			
		||||
		 "zlib-dynamic"   => "default"
 | 
			
		||||
	       );
 | 
			
		||||
@@ -727,7 +728,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_EC_NISTP_64_GCC_128 -DOPENSSL_NO_GMP -DOPENSSL_NO_JPAKE -DOPENSSL_NO_MD2 -DOPENSSL_NO_RC5 -DOPENSSL_NO_RFC3779 -DOPENSSL_NO_SCTP -DOPENSSL_NO_STORE";
 | 
			
		||||
my $default_depflags = " -DOPENSSL_NO_EC_NISTP_64_GCC_128 -DOPENSSL_NO_GMP -DOPENSSL_NO_JPAKE -DOPENSSL_NO_MD2 -DOPENSSL_NO_RC5 -DOPENSSL_NO_RFC3779 -DOPENSSL_NO_SCTP -DOPENSSL_NO_STORE -DOPENSSL_NO_UNIT_TEST";
 | 
			
		||||
 | 
			
		||||
# Explicit "no-..." options will be collected in %disabled along with the defaults.
 | 
			
		||||
# To remove something from %disabled, use "enable-foo" (unless it's experimental).
 | 
			
		||||
@@ -803,6 +804,11 @@ PROCESS_ARGS:
 | 
			
		||||
					{
 | 
			
		||||
					$disabled{"tls1"} = "option(tls)"
 | 
			
		||||
					}
 | 
			
		||||
				elsif ($1 eq "ssl3-method")
 | 
			
		||||
					{
 | 
			
		||||
					$disabled{"ssl3-method"} = "option(ssl)";
 | 
			
		||||
					$disabled{"ssl3"} = "option(ssl)";
 | 
			
		||||
					}
 | 
			
		||||
				else
 | 
			
		||||
					{
 | 
			
		||||
					$disabled{$1} = "option";
 | 
			
		||||
@@ -1766,6 +1772,9 @@ open(OUT,'>crypto/opensslconf.h.new') || die "unable to create crypto/opensslcon
 | 
			
		||||
print OUT "/* opensslconf.h */\n";
 | 
			
		||||
print OUT "/* WARNING: Generated automatically from opensslconf.h.in by Configure. */\n\n";
 | 
			
		||||
 | 
			
		||||
print OUT "#ifdef  __cplusplus\n";
 | 
			
		||||
print OUT "extern \"C\" {\n";
 | 
			
		||||
print OUT "#endif\n";
 | 
			
		||||
print OUT "/* OpenSSL was configured with the following options: */\n";
 | 
			
		||||
my $openssl_algorithm_defines_trans = $openssl_algorithm_defines;
 | 
			
		||||
$openssl_experimental_defines =~ s/^\s*#\s*define\s+OPENSSL_NO_(.*)/#ifndef OPENSSL_EXPERIMENTAL_$1\n# ifndef OPENSSL_NO_$1\n#  define OPENSSL_NO_$1\n# endif\n#endif/mg;
 | 
			
		||||
@@ -1870,6 +1879,9 @@ while (<IN>)
 | 
			
		||||
		{ print OUT $_; }
 | 
			
		||||
	}
 | 
			
		||||
close(IN);
 | 
			
		||||
print OUT "#ifdef  __cplusplus\n";
 | 
			
		||||
print OUT "}\n";
 | 
			
		||||
print OUT "#endif\n";
 | 
			
		||||
close(OUT);
 | 
			
		||||
rename("crypto/opensslconf.h","crypto/opensslconf.h.bak") || die "unable to rename crypto/opensslconf.h\n" if -e "crypto/opensslconf.h";
 | 
			
		||||
rename("crypto/opensslconf.h.new","crypto/opensslconf.h") || die "unable to rename crypto/opensslconf.h.new\n";
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										8
									
								
								FAQ
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								FAQ
									
									
									
									
									
								
							@@ -113,11 +113,6 @@ that came with the version of OpenSSL you are using. The pod format
 | 
			
		||||
documentation is included in each OpenSSL distribution under the docs
 | 
			
		||||
directory.
 | 
			
		||||
 | 
			
		||||
For information on parts of libcrypto that are not yet documented, you
 | 
			
		||||
might want to read Ariel Glenn's documentation on SSLeay 0.9, OpenSSL's
 | 
			
		||||
predecessor, at <URL: http://www.columbia.edu/~ariel/ssleay/>.  Much
 | 
			
		||||
of this still applies to OpenSSL.
 | 
			
		||||
 | 
			
		||||
There is some documentation about certificate extensions and PKCS#12
 | 
			
		||||
in doc/openssl.txt
 | 
			
		||||
 | 
			
		||||
@@ -768,6 +763,9 @@ openssl-security@openssl.org if you don't get a prompt reply at least
 | 
			
		||||
acknowledging receipt then resend or mail it directly to one of the
 | 
			
		||||
more active team members (e.g. Steve).
 | 
			
		||||
 | 
			
		||||
Note that bugs only present in the openssl utility are not in general
 | 
			
		||||
considered to be security issues. 
 | 
			
		||||
 | 
			
		||||
[PROG] ========================================================================
 | 
			
		||||
 | 
			
		||||
* Is OpenSSL thread-safe?
 | 
			
		||||
 
 | 
			
		||||
@@ -302,7 +302,8 @@ libcrypto$(SHLIB_EXT): libcrypto.a fips_premain_dso$(EXE_EXT)
 | 
			
		||||
			FIPSLD_CC="$(CC)"; CC=$(FIPSDIR)/bin/fipsld; \
 | 
			
		||||
			export CC FIPSLD_CC FIPSLD_LIBCRYPTO; \
 | 
			
		||||
		fi; \
 | 
			
		||||
		$(MAKE) -e SHLIBDIRS=crypto build-shared; \
 | 
			
		||||
		$(MAKE) -e SHLIBDIRS=crypto  CC="$${CC:-$(CC)}" build-shared && \
 | 
			
		||||
		(touch -c fips_premain_dso$(EXE_EXT) || :); \
 | 
			
		||||
	else \
 | 
			
		||||
		echo "There's no support for shared libraries on this platform" >&2; \
 | 
			
		||||
		exit 1; \
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										238
									
								
								NEWS
									
									
									
									
									
								
							
							
						
						
									
										238
									
								
								NEWS
									
									
									
									
									
								
							@@ -5,11 +5,71 @@
 | 
			
		||||
  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 1.0.1d and OpenSSL 1.0.1e:
 | 
			
		||||
  Major changes between OpenSSL 1.0.1l and OpenSSL 1.0.1m [under development]
 | 
			
		||||
 | 
			
		||||
      o
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 1.0.1k and OpenSSL 1.0.1l [15 Jan 2015]
 | 
			
		||||
 | 
			
		||||
      o Build fixes for the Windows and OpenVMS platforms
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 1.0.1j and OpenSSL 1.0.1k [8 Jan 2015]
 | 
			
		||||
 | 
			
		||||
      o Fix for CVE-2014-3571
 | 
			
		||||
      o Fix for CVE-2015-0206
 | 
			
		||||
      o Fix for CVE-2014-3569
 | 
			
		||||
      o Fix for CVE-2014-3572
 | 
			
		||||
      o Fix for CVE-2015-0204
 | 
			
		||||
      o Fix for CVE-2015-0205
 | 
			
		||||
      o Fix for CVE-2014-8275
 | 
			
		||||
      o Fix for CVE-2014-3570
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 1.0.1i and OpenSSL 1.0.1j [15 Oct 2014]
 | 
			
		||||
 | 
			
		||||
      o Fix for CVE-2014-3513
 | 
			
		||||
      o Fix for CVE-2014-3567
 | 
			
		||||
      o Mitigation for CVE-2014-3566 (SSL protocol vulnerability)
 | 
			
		||||
      o Fix for CVE-2014-3568
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 1.0.1h and OpenSSL 1.0.1i [6 Aug 2014]
 | 
			
		||||
 | 
			
		||||
      o Fix for CVE-2014-3512
 | 
			
		||||
      o Fix for CVE-2014-3511
 | 
			
		||||
      o Fix for CVE-2014-3510
 | 
			
		||||
      o Fix for CVE-2014-3507
 | 
			
		||||
      o Fix for CVE-2014-3506
 | 
			
		||||
      o Fix for CVE-2014-3505
 | 
			
		||||
      o Fix for CVE-2014-3509
 | 
			
		||||
      o Fix for CVE-2014-5139
 | 
			
		||||
      o Fix for CVE-2014-3508
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 1.0.1g and OpenSSL 1.0.1h [5 Jun 2014]
 | 
			
		||||
 | 
			
		||||
      o Fix for CVE-2014-0224
 | 
			
		||||
      o Fix for CVE-2014-0221
 | 
			
		||||
      o Fix for CVE-2014-0198
 | 
			
		||||
      o Fix for CVE-2014-0195
 | 
			
		||||
      o Fix for CVE-2014-3470
 | 
			
		||||
      o Fix for CVE-2010-5298
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 1.0.1f and OpenSSL 1.0.1g [7 Apr 2014]
 | 
			
		||||
 | 
			
		||||
      o Fix for CVE-2014-0160
 | 
			
		||||
      o Add TLS padding extension workaround for broken servers.
 | 
			
		||||
      o Fix for CVE-2014-0076
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 1.0.1e and OpenSSL 1.0.1f [6 Jan 2014]
 | 
			
		||||
 | 
			
		||||
      o Don't include gmt_unix_time in TLS server and client random values
 | 
			
		||||
      o Fix for TLS record tampering bug CVE-2013-4353
 | 
			
		||||
      o Fix for TLS version checking bug CVE-2013-6449
 | 
			
		||||
      o Fix for DTLS retransmission bug CVE-2013-6450
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 1.0.1d and OpenSSL 1.0.1e [11 Feb 2013]:
 | 
			
		||||
 | 
			
		||||
      o Corrected fix for CVE-2013-0169
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 1.0.1c and OpenSSL 1.0.1d:
 | 
			
		||||
  Major changes between OpenSSL 1.0.1c and OpenSSL 1.0.1d [4 Feb 2013]:
 | 
			
		||||
 | 
			
		||||
      o Fix renegotiation in TLS 1.1, 1.2 by using the correct TLS version.
 | 
			
		||||
      o Include the fips configuration module.
 | 
			
		||||
@@ -17,24 +77,24 @@
 | 
			
		||||
      o Fix for SSL/TLS/DTLS CBC plaintext recovery attack CVE-2013-0169
 | 
			
		||||
      o Fix for TLS AESNI record handling flaw CVE-2012-2686
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 1.0.1b and OpenSSL 1.0.1c:
 | 
			
		||||
  Major changes between OpenSSL 1.0.1b and OpenSSL 1.0.1c [10 May 2012]:
 | 
			
		||||
 | 
			
		||||
      o Fix TLS/DTLS record length checking bug CVE-2012-2333
 | 
			
		||||
      o Don't attempt to use non-FIPS composite ciphers in FIPS mode.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 1.0.1a and OpenSSL 1.0.1b:
 | 
			
		||||
  Major changes between OpenSSL 1.0.1a and OpenSSL 1.0.1b [26 Apr 2012]:
 | 
			
		||||
 | 
			
		||||
      o Fix compilation error on non-x86 platforms.
 | 
			
		||||
      o Make FIPS capable OpenSSL ciphers work in non-FIPS mode.
 | 
			
		||||
      o Fix SSL_OP_NO_TLSv1_1 clash with SSL_OP_ALL in OpenSSL 1.0.0
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 1.0.1 and OpenSSL 1.0.1a:
 | 
			
		||||
  Major changes between OpenSSL 1.0.1 and OpenSSL 1.0.1a [19 Apr 2012]:
 | 
			
		||||
 | 
			
		||||
      o Fix for ASN1 overflow bug CVE-2012-2110
 | 
			
		||||
      o Workarounds for some servers that hang on long client hellos.
 | 
			
		||||
      o Fix SEGV in AES code.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 1.0.0h and OpenSSL 1.0.1:
 | 
			
		||||
  Major changes between OpenSSL 1.0.0h and OpenSSL 1.0.1 [14 Mar 2012]:
 | 
			
		||||
 | 
			
		||||
      o TLS/DTLS heartbeat support.
 | 
			
		||||
      o SCTP support.
 | 
			
		||||
@@ -47,17 +107,30 @@
 | 
			
		||||
      o Preliminary FIPS capability for unvalidated 2.0 FIPS module.
 | 
			
		||||
      o SRP support.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 1.0.0g and OpenSSL 1.0.0h:
 | 
			
		||||
  Major changes between OpenSSL 1.0.0j and OpenSSL 1.0.0k [5 Feb 2013]:
 | 
			
		||||
 | 
			
		||||
      o Fix for SSL/TLS/DTLS CBC plaintext recovery attack CVE-2013-0169
 | 
			
		||||
      o Fix OCSP bad key DoS attack CVE-2013-0166
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 1.0.0i and OpenSSL 1.0.0j [10 May 2012]:
 | 
			
		||||
 | 
			
		||||
      o Fix DTLS record length checking bug CVE-2012-2333
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 1.0.0h and OpenSSL 1.0.0i [19 Apr 2012]:
 | 
			
		||||
 | 
			
		||||
      o Fix for ASN1 overflow bug CVE-2012-2110
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 1.0.0g and OpenSSL 1.0.0h [12 Mar 2012]:
 | 
			
		||||
 | 
			
		||||
      o Fix for CMS/PKCS#7 MMA CVE-2012-0884
 | 
			
		||||
      o Corrected fix for CVE-2011-4619
 | 
			
		||||
      o Various DTLS fixes.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 1.0.0f and OpenSSL 1.0.0g:
 | 
			
		||||
  Major changes between OpenSSL 1.0.0f and OpenSSL 1.0.0g [18 Jan 2012]:
 | 
			
		||||
 | 
			
		||||
      o Fix for DTLS DoS issue CVE-2012-0050
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 1.0.0e and OpenSSL 1.0.0f:
 | 
			
		||||
  Major changes between OpenSSL 1.0.0e and OpenSSL 1.0.0f [4 Jan 2012]:
 | 
			
		||||
 | 
			
		||||
      o Fix for DTLS plaintext recovery attack CVE-2011-4108
 | 
			
		||||
      o Clear block padding bytes of SSL 3.0 records CVE-2011-4576
 | 
			
		||||
@@ -65,7 +138,7 @@
 | 
			
		||||
      o Check parameters are not NULL in GOST ENGINE CVE-2012-0027
 | 
			
		||||
      o Check for malformed RFC3779 data CVE-2011-4577
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 1.0.0d and OpenSSL 1.0.0e:
 | 
			
		||||
  Major changes between OpenSSL 1.0.0d and OpenSSL 1.0.0e [6 Sep 2011]:
 | 
			
		||||
 | 
			
		||||
      o Fix for CRL vulnerability issue CVE-2011-3207
 | 
			
		||||
      o Fix for ECDH crashes CVE-2011-3210
 | 
			
		||||
@@ -73,11 +146,11 @@
 | 
			
		||||
      o Support ECDH ciphersuites for certificates using SHA2 algorithms.
 | 
			
		||||
      o Various DTLS fixes.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 1.0.0c and OpenSSL 1.0.0d:
 | 
			
		||||
  Major changes between OpenSSL 1.0.0c and OpenSSL 1.0.0d [8 Feb 2011]:
 | 
			
		||||
 | 
			
		||||
      o Fix for security issue CVE-2011-0014
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 1.0.0b and OpenSSL 1.0.0c:
 | 
			
		||||
  Major changes between OpenSSL 1.0.0b and OpenSSL 1.0.0c [2 Dec 2010]:
 | 
			
		||||
 | 
			
		||||
      o Fix for security issue CVE-2010-4180
 | 
			
		||||
      o Fix for CVE-2010-4252
 | 
			
		||||
@@ -85,18 +158,18 @@
 | 
			
		||||
      o Fix various platform compilation issues.
 | 
			
		||||
      o Corrected fix for security issue CVE-2010-3864.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 1.0.0a and OpenSSL 1.0.0b:
 | 
			
		||||
  Major changes between OpenSSL 1.0.0a and OpenSSL 1.0.0b [16 Nov 2010]:
 | 
			
		||||
 | 
			
		||||
      o Fix for security issue CVE-2010-3864.
 | 
			
		||||
      o Fix for CVE-2010-2939
 | 
			
		||||
      o Fix WIN32 build system for GOST ENGINE.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 1.0.0 and OpenSSL 1.0.0a:
 | 
			
		||||
  Major changes between OpenSSL 1.0.0 and OpenSSL 1.0.0a [1 Jun 2010]:
 | 
			
		||||
 | 
			
		||||
      o Fix for security issue CVE-2010-1633.
 | 
			
		||||
      o GOST MAC and CFB fixes.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.8n and OpenSSL 1.0.0:
 | 
			
		||||
  Major changes between OpenSSL 0.9.8n and OpenSSL 1.0.0 [29 Mar 2010]:
 | 
			
		||||
 | 
			
		||||
      o RFC3280 path validation: sufficient to process PKITS tests.
 | 
			
		||||
      o Integrated support for PVK files and keyblobs.
 | 
			
		||||
@@ -119,20 +192,55 @@
 | 
			
		||||
      o Opaque PRF Input TLS extension support.
 | 
			
		||||
      o Updated time routines to avoid OS limitations.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.8q and OpenSSL 0.9.8r:
 | 
			
		||||
  Major changes between OpenSSL 0.9.8x and OpenSSL 0.9.8y [5 Feb 2013]:
 | 
			
		||||
 | 
			
		||||
      o Fix for SSL/TLS/DTLS CBC plaintext recovery attack CVE-2013-0169
 | 
			
		||||
      o Fix OCSP bad key DoS attack CVE-2013-0166
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.8w and OpenSSL 0.9.8x [10 May 2012]:
 | 
			
		||||
 | 
			
		||||
      o Fix DTLS record length checking bug CVE-2012-2333
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.8v and OpenSSL 0.9.8w [23 Apr 2012]:
 | 
			
		||||
 | 
			
		||||
      o Fix for CVE-2012-2131 (corrected fix for 0.9.8 and CVE-2012-2110)
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.8u and OpenSSL 0.9.8v [19 Apr 2012]:
 | 
			
		||||
 | 
			
		||||
      o Fix for ASN1 overflow bug CVE-2012-2110
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.8t and OpenSSL 0.9.8u [12 Mar 2012]:
 | 
			
		||||
 | 
			
		||||
      o Fix for CMS/PKCS#7 MMA CVE-2012-0884
 | 
			
		||||
      o Corrected fix for CVE-2011-4619
 | 
			
		||||
      o Various DTLS fixes.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.8s and OpenSSL 0.9.8t [18 Jan 2012]:
 | 
			
		||||
 | 
			
		||||
      o Fix for DTLS DoS issue CVE-2012-0050
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.8r and OpenSSL 0.9.8s [4 Jan 2012]:
 | 
			
		||||
 | 
			
		||||
      o Fix for DTLS plaintext recovery attack CVE-2011-4108
 | 
			
		||||
      o Fix policy check double free error CVE-2011-4109
 | 
			
		||||
      o Clear block padding bytes of SSL 3.0 records CVE-2011-4576
 | 
			
		||||
      o Only allow one SGC handshake restart for SSL/TLS CVE-2011-4619
 | 
			
		||||
      o Check for malformed RFC3779 data CVE-2011-4577
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.8q and OpenSSL 0.9.8r [8 Feb 2011]:
 | 
			
		||||
 | 
			
		||||
      o Fix for security issue CVE-2011-0014
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.8p and OpenSSL 0.9.8q:
 | 
			
		||||
  Major changes between OpenSSL 0.9.8p and OpenSSL 0.9.8q [2 Dec 2010]:
 | 
			
		||||
 | 
			
		||||
      o Fix for security issue CVE-2010-4180
 | 
			
		||||
      o Fix for CVE-2010-4252
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.8o and OpenSSL 0.9.8p:
 | 
			
		||||
  Major changes between OpenSSL 0.9.8o and OpenSSL 0.9.8p [16 Nov 2010]:
 | 
			
		||||
 | 
			
		||||
      o Fix for security issue CVE-2010-3864.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.8n and OpenSSL 0.9.8o:
 | 
			
		||||
  Major changes between OpenSSL 0.9.8n and OpenSSL 0.9.8o [1 Jun 2010]:
 | 
			
		||||
 | 
			
		||||
      o Fix for security issue CVE-2010-0742.
 | 
			
		||||
      o Various DTLS fixes.
 | 
			
		||||
@@ -140,12 +248,12 @@
 | 
			
		||||
      o Fix for no-rc4 compilation.
 | 
			
		||||
      o Chil ENGINE unload workaround.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.8m and OpenSSL 0.9.8n:
 | 
			
		||||
  Major changes between OpenSSL 0.9.8m and OpenSSL 0.9.8n [24 Mar 2010]:
 | 
			
		||||
 | 
			
		||||
      o CFB cipher definition fixes.
 | 
			
		||||
      o Fix security issues CVE-2010-0740 and CVE-2010-0433.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.8l and OpenSSL 0.9.8m:
 | 
			
		||||
  Major changes between OpenSSL 0.9.8l and OpenSSL 0.9.8m [25 Feb 2010]:
 | 
			
		||||
 | 
			
		||||
      o Cipher definition fixes.
 | 
			
		||||
      o Workaround for slow RAND_poll() on some WIN32 versions.
 | 
			
		||||
@@ -157,33 +265,33 @@
 | 
			
		||||
      o Ticket and SNI coexistence fixes.
 | 
			
		||||
      o Many fixes to DTLS handling. 
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.8k and OpenSSL 0.9.8l:
 | 
			
		||||
  Major changes between OpenSSL 0.9.8k and OpenSSL 0.9.8l [5 Nov 2009]:
 | 
			
		||||
 | 
			
		||||
      o Temporary work around for CVE-2009-3555: disable renegotiation.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.8j and OpenSSL 0.9.8k:
 | 
			
		||||
  Major changes between OpenSSL 0.9.8j and OpenSSL 0.9.8k [25 Mar 2009]:
 | 
			
		||||
 | 
			
		||||
      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:
 | 
			
		||||
  Major changes between OpenSSL 0.9.8i and OpenSSL 0.9.8j [7 Jan 2009]:
 | 
			
		||||
 | 
			
		||||
      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:
 | 
			
		||||
  Major changes between OpenSSL 0.9.8g and OpenSSL 0.9.8h [28 May 2008]:
 | 
			
		||||
 | 
			
		||||
      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:
 | 
			
		||||
  Major changes between OpenSSL 0.9.8f and OpenSSL 0.9.8g [19 Oct 2007]:
 | 
			
		||||
 | 
			
		||||
      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:
 | 
			
		||||
  Major changes between OpenSSL 0.9.8e and OpenSSL 0.9.8f [11 Oct 2007]:
 | 
			
		||||
 | 
			
		||||
      o Add gcc 4.2 support.
 | 
			
		||||
      o Add support for AES and SSE2 assembly lanugauge optimization
 | 
			
		||||
@@ -194,23 +302,23 @@
 | 
			
		||||
      o RFC4507bis support.
 | 
			
		||||
      o TLS Extensions support.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.8d and OpenSSL 0.9.8e:
 | 
			
		||||
  Major changes between OpenSSL 0.9.8d and OpenSSL 0.9.8e [23 Feb 2007]:
 | 
			
		||||
 | 
			
		||||
      o Various ciphersuite selection fixes.
 | 
			
		||||
      o RFC3779 support.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.8c and OpenSSL 0.9.8d:
 | 
			
		||||
  Major changes between OpenSSL 0.9.8c and OpenSSL 0.9.8d [28 Sep 2006]:
 | 
			
		||||
 | 
			
		||||
      o Introduce limits to prevent malicious key DoS  (CVE-2006-2940)
 | 
			
		||||
      o Fix security issues (CVE-2006-2937, CVE-2006-3737, CVE-2006-4343)
 | 
			
		||||
      o Changes to ciphersuite selection algorithm
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.8b and OpenSSL 0.9.8c:
 | 
			
		||||
  Major changes between OpenSSL 0.9.8b and OpenSSL 0.9.8c [5 Sep 2006]:
 | 
			
		||||
 | 
			
		||||
      o Fix Daniel Bleichenbacher forged signature attack, CVE-2006-4339
 | 
			
		||||
      o New cipher Camellia
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.8a and OpenSSL 0.9.8b:
 | 
			
		||||
  Major changes between OpenSSL 0.9.8a and OpenSSL 0.9.8b [4 May 2006]:
 | 
			
		||||
 | 
			
		||||
      o Cipher string fixes.
 | 
			
		||||
      o Fixes for VC++ 2005.
 | 
			
		||||
@@ -220,12 +328,12 @@
 | 
			
		||||
      o Built in dynamic engine compilation support on Win32.
 | 
			
		||||
      o Fixes auto dynamic engine loading in Win32.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.8 and OpenSSL 0.9.8a:
 | 
			
		||||
  Major changes between OpenSSL 0.9.8 and OpenSSL 0.9.8a [11 Oct 2005]:
 | 
			
		||||
 | 
			
		||||
      o Fix potential SSL 2.0 rollback, CVE-2005-2969
 | 
			
		||||
      o Extended Windows CE support
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.7g and OpenSSL 0.9.8:
 | 
			
		||||
  Major changes between OpenSSL 0.9.7g and OpenSSL 0.9.8 [5 Jul 2005]:
 | 
			
		||||
 | 
			
		||||
      o Major work on the BIGNUM library for higher efficiency and to
 | 
			
		||||
        make operations more streamlined and less contradictory.  This
 | 
			
		||||
@@ -299,36 +407,36 @@
 | 
			
		||||
      o Added initial support for Win64.
 | 
			
		||||
      o Added alternate pkg-config files.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.7l and OpenSSL 0.9.7m:
 | 
			
		||||
  Major changes between OpenSSL 0.9.7l and OpenSSL 0.9.7m [23 Feb 2007]:
 | 
			
		||||
 | 
			
		||||
      o FIPS 1.1.1 module linking.
 | 
			
		||||
      o Various ciphersuite selection fixes.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.7k and OpenSSL 0.9.7l:
 | 
			
		||||
  Major changes between OpenSSL 0.9.7k and OpenSSL 0.9.7l [28 Sep 2006]:
 | 
			
		||||
 | 
			
		||||
      o Introduce limits to prevent malicious key DoS  (CVE-2006-2940)
 | 
			
		||||
      o Fix security issues (CVE-2006-2937, CVE-2006-3737, CVE-2006-4343)
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.7j and OpenSSL 0.9.7k:
 | 
			
		||||
  Major changes between OpenSSL 0.9.7j and OpenSSL 0.9.7k [5 Sep 2006]:
 | 
			
		||||
 | 
			
		||||
      o Fix Daniel Bleichenbacher forged signature attack, CVE-2006-4339
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.7i and OpenSSL 0.9.7j:
 | 
			
		||||
  Major changes between OpenSSL 0.9.7i and OpenSSL 0.9.7j [4 May 2006]:
 | 
			
		||||
 | 
			
		||||
      o Visual C++ 2005 fixes.
 | 
			
		||||
      o Update Windows build system for FIPS.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.7h and OpenSSL 0.9.7i:
 | 
			
		||||
  Major changes between OpenSSL 0.9.7h and OpenSSL 0.9.7i [14 Oct 2005]:
 | 
			
		||||
 | 
			
		||||
      o Give EVP_MAX_MD_SIZE it's old value, except for a FIPS build.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.7g and OpenSSL 0.9.7h:
 | 
			
		||||
  Major changes between OpenSSL 0.9.7g and OpenSSL 0.9.7h [11 Oct 2005]:
 | 
			
		||||
 | 
			
		||||
      o Fix SSL 2.0 Rollback, CVE-2005-2969
 | 
			
		||||
      o Allow use of fixed-length exponent on DSA signing
 | 
			
		||||
      o Default fixed-window RSA, DSA, DH private-key operations
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.7f and OpenSSL 0.9.7g:
 | 
			
		||||
  Major changes between OpenSSL 0.9.7f and OpenSSL 0.9.7g [11 Apr 2005]:
 | 
			
		||||
 | 
			
		||||
      o More compilation issues fixed.
 | 
			
		||||
      o Adaptation to more modern Kerberos API.
 | 
			
		||||
@@ -337,7 +445,7 @@
 | 
			
		||||
      o More constification.
 | 
			
		||||
      o Added processing of proxy certificates (RFC 3820).
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.7e and OpenSSL 0.9.7f:
 | 
			
		||||
  Major changes between OpenSSL 0.9.7e and OpenSSL 0.9.7f [22 Mar 2005]:
 | 
			
		||||
 | 
			
		||||
      o Several compilation issues fixed.
 | 
			
		||||
      o Many memory allocation failure checks added.
 | 
			
		||||
@@ -345,12 +453,12 @@
 | 
			
		||||
      o Mandatory basic checks on certificates.
 | 
			
		||||
      o Performance improvements.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.7d and OpenSSL 0.9.7e:
 | 
			
		||||
  Major changes between OpenSSL 0.9.7d and OpenSSL 0.9.7e [25 Oct 2004]:
 | 
			
		||||
 | 
			
		||||
      o Fix race condition in CRL checking code.
 | 
			
		||||
      o Fixes to PKCS#7 (S/MIME) code.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.7c and OpenSSL 0.9.7d:
 | 
			
		||||
  Major changes between OpenSSL 0.9.7c and OpenSSL 0.9.7d [17 Mar 2004]:
 | 
			
		||||
 | 
			
		||||
      o Security: Fix Kerberos ciphersuite SSL/TLS handshaking bug
 | 
			
		||||
      o Security: Fix null-pointer assignment in do_change_cipher_spec()
 | 
			
		||||
@@ -358,14 +466,14 @@
 | 
			
		||||
      o Multiple X509 verification fixes
 | 
			
		||||
      o Speed up HMAC and other operations
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.7b and OpenSSL 0.9.7c:
 | 
			
		||||
  Major changes between OpenSSL 0.9.7b and OpenSSL 0.9.7c [30 Sep 2003]:
 | 
			
		||||
 | 
			
		||||
      o Security: fix various ASN1 parsing bugs.
 | 
			
		||||
      o New -ignore_err option to OCSP utility.
 | 
			
		||||
      o Various interop and bug fixes in S/MIME code.
 | 
			
		||||
      o SSL/TLS protocol fix for unrequested client certificates.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.7a and OpenSSL 0.9.7b:
 | 
			
		||||
  Major changes between OpenSSL 0.9.7a and OpenSSL 0.9.7b [10 Apr 2003]:
 | 
			
		||||
 | 
			
		||||
      o Security: counter the Klima-Pokorny-Rosa extension of
 | 
			
		||||
        Bleichbacher's attack 
 | 
			
		||||
@@ -376,7 +484,7 @@
 | 
			
		||||
      o ASN.1: treat domainComponent correctly.
 | 
			
		||||
      o Documentation: fixes and additions.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.7 and OpenSSL 0.9.7a:
 | 
			
		||||
  Major changes between OpenSSL 0.9.7 and OpenSSL 0.9.7a [19 Feb 2003]:
 | 
			
		||||
 | 
			
		||||
      o Security: Important security related bugfixes.
 | 
			
		||||
      o Enhanced compatibility with MIT Kerberos.
 | 
			
		||||
@@ -387,7 +495,7 @@
 | 
			
		||||
      o SSL/TLS: now handles manual certificate chain building.
 | 
			
		||||
      o SSL/TLS: certain session ID malfunctions corrected.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.6 and OpenSSL 0.9.7:
 | 
			
		||||
  Major changes between OpenSSL 0.9.6 and OpenSSL 0.9.7 [30 Dec 2002]:
 | 
			
		||||
 | 
			
		||||
      o New library section OCSP.
 | 
			
		||||
      o Complete rewrite of ASN1 code.
 | 
			
		||||
@@ -433,23 +541,23 @@
 | 
			
		||||
      o SSL/TLS: add callback to retrieve SSL/TLS messages.
 | 
			
		||||
      o SSL/TLS: support AES cipher suites (RFC3268).
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.6j and OpenSSL 0.9.6k:
 | 
			
		||||
  Major changes between OpenSSL 0.9.6j and OpenSSL 0.9.6k [30 Sep 2003]:
 | 
			
		||||
 | 
			
		||||
      o Security: fix various ASN1 parsing bugs.
 | 
			
		||||
      o SSL/TLS protocol fix for unrequested client certificates.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.6i and OpenSSL 0.9.6j:
 | 
			
		||||
  Major changes between OpenSSL 0.9.6i and OpenSSL 0.9.6j [10 Apr 2003]:
 | 
			
		||||
 | 
			
		||||
      o Security: counter the Klima-Pokorny-Rosa extension of
 | 
			
		||||
        Bleichbacher's attack 
 | 
			
		||||
      o Security: make RSA blinding default.
 | 
			
		||||
      o Build: shared library support fixes.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.6h and OpenSSL 0.9.6i:
 | 
			
		||||
  Major changes between OpenSSL 0.9.6h and OpenSSL 0.9.6i [19 Feb 2003]:
 | 
			
		||||
 | 
			
		||||
      o Important security related bugfixes.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.6g and OpenSSL 0.9.6h:
 | 
			
		||||
  Major changes between OpenSSL 0.9.6g and OpenSSL 0.9.6h [5 Dec 2002]:
 | 
			
		||||
 | 
			
		||||
      o New configuration targets for Tandem OSS and A/UX.
 | 
			
		||||
      o New OIDs for Microsoft attributes.
 | 
			
		||||
@@ -463,25 +571,25 @@
 | 
			
		||||
      o Fixes for smaller building problems.
 | 
			
		||||
      o Updates of manuals, FAQ and other instructive documents.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.6f and OpenSSL 0.9.6g:
 | 
			
		||||
  Major changes between OpenSSL 0.9.6f and OpenSSL 0.9.6g [9 Aug 2002]:
 | 
			
		||||
 | 
			
		||||
      o Important building fixes on Unix.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.6e and OpenSSL 0.9.6f:
 | 
			
		||||
  Major changes between OpenSSL 0.9.6e and OpenSSL 0.9.6f [8 Aug 2002]:
 | 
			
		||||
 | 
			
		||||
      o Various important bugfixes.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.6d and OpenSSL 0.9.6e:
 | 
			
		||||
  Major changes between OpenSSL 0.9.6d and OpenSSL 0.9.6e [30 Jul 2002]:
 | 
			
		||||
 | 
			
		||||
      o Important security related bugfixes.
 | 
			
		||||
      o Various SSL/TLS library bugfixes.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.6c and OpenSSL 0.9.6d:
 | 
			
		||||
  Major changes between OpenSSL 0.9.6c and OpenSSL 0.9.6d [9 May 2002]:
 | 
			
		||||
 | 
			
		||||
      o Various SSL/TLS library bugfixes.
 | 
			
		||||
      o Fix DH parameter generation for 'non-standard' generators.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.6b and OpenSSL 0.9.6c:
 | 
			
		||||
  Major changes between OpenSSL 0.9.6b and OpenSSL 0.9.6c [21 Dec 2001]:
 | 
			
		||||
 | 
			
		||||
      o Various SSL/TLS library bugfixes.
 | 
			
		||||
      o BIGNUM library fixes.
 | 
			
		||||
@@ -494,7 +602,7 @@
 | 
			
		||||
        Broadcom and Cryptographic Appliance's keyserver
 | 
			
		||||
        [in 0.9.6c-engine release].
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.6a and OpenSSL 0.9.6b:
 | 
			
		||||
  Major changes between OpenSSL 0.9.6a and OpenSSL 0.9.6b [9 Jul 2001]:
 | 
			
		||||
 | 
			
		||||
      o Security fix: PRNG improvements.
 | 
			
		||||
      o Security fix: RSA OAEP check.
 | 
			
		||||
@@ -511,7 +619,7 @@
 | 
			
		||||
      o Increase default size for BIO buffering filter.
 | 
			
		||||
      o Compatibility fixes in some scripts.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.6 and OpenSSL 0.9.6a:
 | 
			
		||||
  Major changes between OpenSSL 0.9.6 and OpenSSL 0.9.6a [5 Apr 2001]:
 | 
			
		||||
 | 
			
		||||
      o Security fix: change behavior of OpenSSL to avoid using
 | 
			
		||||
        environment variables when running as root.
 | 
			
		||||
@@ -536,7 +644,7 @@
 | 
			
		||||
      o New function BN_rand_range().
 | 
			
		||||
      o Add "-rand" option to openssl s_client and s_server.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.5a and OpenSSL 0.9.6:
 | 
			
		||||
  Major changes between OpenSSL 0.9.5a and OpenSSL 0.9.6 [10 Oct 2000]:
 | 
			
		||||
 | 
			
		||||
      o Some documentation for BIO and SSL libraries.
 | 
			
		||||
      o Enhanced chain verification using key identifiers.
 | 
			
		||||
@@ -551,7 +659,7 @@
 | 
			
		||||
    [1] The support for external crypto devices is currently a separate
 | 
			
		||||
        distribution.  See the file README.ENGINE.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.5 and OpenSSL 0.9.5a:
 | 
			
		||||
  Major changes between OpenSSL 0.9.5 and OpenSSL 0.9.5a [1 Apr 2000]:
 | 
			
		||||
 | 
			
		||||
      o Bug fixes for Win32, SuSE Linux, NeXTSTEP and FreeBSD 2.2.8 
 | 
			
		||||
      o Shared library support for HPUX and Solaris-gcc
 | 
			
		||||
@@ -560,7 +668,7 @@
 | 
			
		||||
      o New 'rand' application
 | 
			
		||||
      o New way to check for existence of algorithms from scripts
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.4 and OpenSSL 0.9.5:
 | 
			
		||||
  Major changes between OpenSSL 0.9.4 and OpenSSL 0.9.5 [25 May 2000]:
 | 
			
		||||
 | 
			
		||||
      o S/MIME support in new 'smime' command
 | 
			
		||||
      o Documentation for the OpenSSL command line application
 | 
			
		||||
@@ -596,7 +704,7 @@
 | 
			
		||||
      o Enhanced support for Alpha Linux
 | 
			
		||||
      o Experimental MacOS support
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.3 and OpenSSL 0.9.4:
 | 
			
		||||
  Major changes between OpenSSL 0.9.3 and OpenSSL 0.9.4 [9 Aug 1999]:
 | 
			
		||||
 | 
			
		||||
      o Transparent support for PKCS#8 format private keys: these are used
 | 
			
		||||
        by several software packages and are more secure than the standard
 | 
			
		||||
@@ -607,7 +715,7 @@
 | 
			
		||||
      o New pipe-like BIO that allows using the SSL library when actual I/O
 | 
			
		||||
        must be handled by the application (BIO pair)
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.2b and OpenSSL 0.9.3:
 | 
			
		||||
  Major changes between OpenSSL 0.9.2b and OpenSSL 0.9.3 [24 May 1999]:
 | 
			
		||||
      o Lots of enhancements and cleanups to the Configuration mechanism
 | 
			
		||||
      o RSA OEAP related fixes
 | 
			
		||||
      o Added `openssl ca -revoke' option for revoking a certificate
 | 
			
		||||
@@ -621,7 +729,7 @@
 | 
			
		||||
      o Sparc assembler bignum implementation, optimized hash functions
 | 
			
		||||
      o Option to disable selected ciphers
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.1c and OpenSSL 0.9.2b:
 | 
			
		||||
  Major changes between OpenSSL 0.9.1c and OpenSSL 0.9.2b [22 Mar 1999]:
 | 
			
		||||
      o Fixed a security hole related to session resumption
 | 
			
		||||
      o Fixed RSA encryption routines for the p < q case
 | 
			
		||||
      o "ALL" in cipher lists now means "everything except NULL ciphers"
 | 
			
		||||
@@ -643,7 +751,7 @@
 | 
			
		||||
      o Lots of memory leak fixes.
 | 
			
		||||
      o Lots of bug fixes.
 | 
			
		||||
 | 
			
		||||
  Major changes between SSLeay 0.9.0b and OpenSSL 0.9.1c:
 | 
			
		||||
  Major changes between SSLeay 0.9.0b and OpenSSL 0.9.1c [23 Dec 1998]:
 | 
			
		||||
      o Integration of the popular NO_RSA/NO_DSA patches
 | 
			
		||||
      o Initial support for compression inside the SSL record layer
 | 
			
		||||
      o Added BIO proxy and filtering functionality
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								README
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								README
									
									
									
									
									
								
							@@ -1,5 +1,5 @@
 | 
			
		||||
 | 
			
		||||
 OpenSSL 1.0.1e 11 Feb 2013
 | 
			
		||||
 OpenSSL 1.0.1m-dev
 | 
			
		||||
 | 
			
		||||
 Copyright (c) 1998-2011 The OpenSSL Project
 | 
			
		||||
 Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										160
									
								
								STATUS
									
									
									
									
									
								
							
							
						
						
									
										160
									
								
								STATUS
									
									
									
									
									
								
							@@ -1,160 +0,0 @@
 | 
			
		||||
 | 
			
		||||
  OpenSSL STATUS                           Last modified at
 | 
			
		||||
  ______________                           $Date: 2012/05/10 15:16:36 $
 | 
			
		||||
 | 
			
		||||
  DEVELOPMENT STATE
 | 
			
		||||
 | 
			
		||||
    o  OpenSSL 1.1.0:  Under development...
 | 
			
		||||
    o  OpenSSL 1.0.1e: Released on February  11th, 2013
 | 
			
		||||
    o  OpenSSL 1.0.1d: Released on February   5th, 2013
 | 
			
		||||
    o  OpenSSL 1.0.1c: Released on May       10th, 2012
 | 
			
		||||
    o  OpenSSL 1.0.1b: Released on April     26th, 2012
 | 
			
		||||
    o  OpenSSL 1.0.1a: Released on April     19th, 2012
 | 
			
		||||
    o  OpenSSL 1.0.1:  Released on March     14th, 2012
 | 
			
		||||
    o  OpenSSL 1.0.0h: Released on March     12th, 2012
 | 
			
		||||
    o  OpenSSL 1.0.0g: Released on January   18th, 2012
 | 
			
		||||
    o  OpenSSL 1.0.0f: Released on January    4th, 2012
 | 
			
		||||
    o  OpenSSL 1.0.0e: Released on September  6th, 2011
 | 
			
		||||
    o  OpenSSL 1.0.0d: Released on February   8nd, 2011
 | 
			
		||||
    o  OpenSSL 1.0.0c: Released on December   2nd, 2010
 | 
			
		||||
    o  OpenSSL 1.0.0b: Released on November  16th, 2010
 | 
			
		||||
    o  OpenSSL 1.0.0a: Released on June      1st,  2010
 | 
			
		||||
    o  OpenSSL 1.0.0:  Released on March     29th, 2010
 | 
			
		||||
    o  OpenSSL 0.9.8u: Released on March     12th, 2012
 | 
			
		||||
    o  OpenSSL 0.9.8t: Released on January   18th, 2012
 | 
			
		||||
    o  OpenSSL 0.9.8s: Released on January    4th, 2012
 | 
			
		||||
    o  OpenSSL 0.9.8r: Released on February   8nd, 2011
 | 
			
		||||
    o  OpenSSL 0.9.8q: Released on December   2nd, 2010
 | 
			
		||||
    o  OpenSSL 0.9.8p: Released on November  16th, 2010
 | 
			
		||||
    o  OpenSSL 0.9.8o: Released on June       1st, 2010
 | 
			
		||||
    o  OpenSSL 0.9.8n: Released on March     24th, 2010
 | 
			
		||||
    o  OpenSSL 0.9.8m: Released on February  25th, 2010
 | 
			
		||||
    o  OpenSSL 0.9.8l: Released on November   5th, 2009
 | 
			
		||||
    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
 | 
			
		||||
    o  OpenSSL 0.9.8e: Released on February  23rd, 2007
 | 
			
		||||
    o  OpenSSL 0.9.8d: Released on September 28th, 2006
 | 
			
		||||
    o  OpenSSL 0.9.8c: Released on September  5th, 2006
 | 
			
		||||
    o  OpenSSL 0.9.8b: Released on May        4th, 2006
 | 
			
		||||
    o  OpenSSL 0.9.8a: Released on October   11th, 2005
 | 
			
		||||
    o  OpenSSL 0.9.8:  Released on July       5th, 2005
 | 
			
		||||
    o  OpenSSL 0.9.7m: Released on February  23rd, 2007
 | 
			
		||||
    o  OpenSSL 0.9.7l: Released on September 28th, 2006
 | 
			
		||||
    o  OpenSSL 0.9.7k: Released on September  5th, 2006
 | 
			
		||||
    o  OpenSSL 0.9.7j: Released on May        4th, 2006
 | 
			
		||||
    o  OpenSSL 0.9.7i: Released on October   14th, 2005
 | 
			
		||||
    o  OpenSSL 0.9.7h: Released on October   11th, 2005
 | 
			
		||||
    o  OpenSSL 0.9.7g: Released on April     11th, 2005
 | 
			
		||||
    o  OpenSSL 0.9.7f: Released on March     22nd, 2005
 | 
			
		||||
    o  OpenSSL 0.9.7e: Released on October   25th, 2004
 | 
			
		||||
    o  OpenSSL 0.9.7d: Released on March     17th, 2004
 | 
			
		||||
    o  OpenSSL 0.9.7c: Released on September 30th, 2003
 | 
			
		||||
    o  OpenSSL 0.9.7b: Released on April     10th, 2003
 | 
			
		||||
    o  OpenSSL 0.9.7a: Released on February  19th, 2003
 | 
			
		||||
    o  OpenSSL 0.9.7:  Released on December  31st, 2002
 | 
			
		||||
    o  OpenSSL 0.9.6m: Released on March     17th, 2004
 | 
			
		||||
    o  OpenSSL 0.9.6l: Released on November   4th, 2003
 | 
			
		||||
    o  OpenSSL 0.9.6k: Released on September 30th, 2003
 | 
			
		||||
    o  OpenSSL 0.9.6j: Released on April     10th, 2003
 | 
			
		||||
    o  OpenSSL 0.9.6i: Released on February  19th, 2003
 | 
			
		||||
    o  OpenSSL 0.9.6h: Released on December   5th, 2002
 | 
			
		||||
    o  OpenSSL 0.9.6g: Released on August     9th, 2002
 | 
			
		||||
    o  OpenSSL 0.9.6f: Released on August     8th, 2002
 | 
			
		||||
    o  OpenSSL 0.9.6e: Released on July      30th, 2002
 | 
			
		||||
    o  OpenSSL 0.9.6d: Released on May        9th, 2002
 | 
			
		||||
    o  OpenSSL 0.9.6c: Released on December  21st, 2001
 | 
			
		||||
    o  OpenSSL 0.9.6b: Released on July       9th, 2001
 | 
			
		||||
    o  OpenSSL 0.9.6a: Released on April      5th, 2001
 | 
			
		||||
    o  OpenSSL 0.9.6:  Released on September 24th, 2000
 | 
			
		||||
    o  OpenSSL 0.9.5a: Released on April      1st, 2000
 | 
			
		||||
    o  OpenSSL 0.9.5:  Released on February  28th, 2000
 | 
			
		||||
    o  OpenSSL 0.9.4:  Released on August    09th, 1999
 | 
			
		||||
    o  OpenSSL 0.9.3a: Released on May       29th, 1999
 | 
			
		||||
    o  OpenSSL 0.9.3:  Released on May       25th, 1999
 | 
			
		||||
    o  OpenSSL 0.9.2b: Released on March     22th, 1999
 | 
			
		||||
    o  OpenSSL 0.9.1c: Released on December  23th, 1998
 | 
			
		||||
 | 
			
		||||
  [See also http://www.openssl.org/support/rt.html]
 | 
			
		||||
 | 
			
		||||
  RELEASE SHOWSTOPPERS
 | 
			
		||||
 | 
			
		||||
    o The Makefiles fail with some SysV makes.
 | 
			
		||||
    o 
 | 
			
		||||
 | 
			
		||||
  AVAILABLE PATCHES
 | 
			
		||||
 | 
			
		||||
    o 
 | 
			
		||||
 | 
			
		||||
  IN PROGRESS
 | 
			
		||||
 | 
			
		||||
    o Steve is currently working on (in no particular order):
 | 
			
		||||
        ASN1 code redesign, butchery, replacement.
 | 
			
		||||
        OCSP
 | 
			
		||||
        EVP cipher enhancement.
 | 
			
		||||
        Enhanced certificate chain verification.
 | 
			
		||||
	Private key, certificate and CRL API and implementation.
 | 
			
		||||
	Developing and bugfixing PKCS#7 (S/MIME code).
 | 
			
		||||
        Various X509 issues: character sets, certificate request extensions.
 | 
			
		||||
    o Richard is currently working on:
 | 
			
		||||
	Constification
 | 
			
		||||
	Attribute Certificate support
 | 
			
		||||
	Certificate Pair support
 | 
			
		||||
	Storage Engines (primarly an LDAP storage engine)
 | 
			
		||||
	Certificate chain validation with full RFC 3280 compatibility
 | 
			
		||||
 | 
			
		||||
  NEEDS PATCH
 | 
			
		||||
 | 
			
		||||
    o  0.9.8-dev: COMPLEMENTOFALL and COMPLEMENTOFDEFAULT do not
 | 
			
		||||
       handle ECCdraft cipher suites correctly.
 | 
			
		||||
 | 
			
		||||
    o  apps/ca.c: "Sign the certificate?" - "n" creates empty certificate file
 | 
			
		||||
 | 
			
		||||
    o  "OpenSSL STATUS" is never up-to-date.
 | 
			
		||||
 | 
			
		||||
  OPEN ISSUES
 | 
			
		||||
 | 
			
		||||
    o  The Makefile hierarchy and build mechanism is still not a round thing:
 | 
			
		||||
 | 
			
		||||
       1. The config vs. Configure scripts
 | 
			
		||||
          It's the same nasty situation as for Apache with APACI vs.
 | 
			
		||||
          src/Configure. It confuses.
 | 
			
		||||
          Suggestion: Merge Configure and config into a single configure
 | 
			
		||||
                      script with a Autoconf style interface ;-) and remove
 | 
			
		||||
                      Configure and config. Or even let us use GNU Autoconf
 | 
			
		||||
                      itself. Then we can avoid a lot of those platform checks
 | 
			
		||||
                      which are currently in Configure.
 | 
			
		||||
 | 
			
		||||
    o  Support for Shared Libraries has to be added at least
 | 
			
		||||
       for the major Unix platforms. The details we can rip from the stuff
 | 
			
		||||
       Ralf has done for the Apache src/Configure script. Ben wants the
 | 
			
		||||
       solution to be really simple.
 | 
			
		||||
 | 
			
		||||
       Status: Ralf will look how we can easily incorporate the
 | 
			
		||||
               compiler PIC and linker DSO flags from Apache
 | 
			
		||||
               into the OpenSSL Configure script.
 | 
			
		||||
 | 
			
		||||
               Ulf: +1 for using GNU autoconf and libtool (but not automake,
 | 
			
		||||
                    which apparently is not flexible enough to generate
 | 
			
		||||
                    libcrypto)
 | 
			
		||||
 | 
			
		||||
  WISHES
 | 
			
		||||
 | 
			
		||||
    o  Add variants of DH_generate_parameters() and BN_generate_prime() [etc?]
 | 
			
		||||
       where the callback function can request that the function be aborted.
 | 
			
		||||
       [Gregory Stark <ghstark@pobox.com>, <rayyang2000@yahoo.com>]
 | 
			
		||||
 | 
			
		||||
    o  SRP in TLS.
 | 
			
		||||
       [wished by:
 | 
			
		||||
        Dj <derek@yo.net>, Tom Wu <tom@arcot.com>,
 | 
			
		||||
        Tom Holroyd <tomh@po.crl.go.jp>]
 | 
			
		||||
 | 
			
		||||
       See http://search.ietf.org/internet-drafts/draft-ietf-tls-srp-00.txt
 | 
			
		||||
       as well as http://www-cs-students.stanford.edu/~tjw/srp/.
 | 
			
		||||
 | 
			
		||||
       Tom Holroyd tells us there is a SRP patch for OpenSSH at
 | 
			
		||||
       http://members.tripod.com/professor_tom/archives/, that could
 | 
			
		||||
       be useful.
 | 
			
		||||
							
								
								
									
										72
									
								
								TABLE
									
									
									
									
									
								
							
							
						
						
									
										72
									
								
								TABLE
									
									
									
									
									
								
							@@ -1586,7 +1586,7 @@ $multilib     =
 | 
			
		||||
 | 
			
		||||
*** debug-VC-WIN32
 | 
			
		||||
$cc           = cl
 | 
			
		||||
$cflags       = -W3 -WX -Gs0 -GF -Gy -Zi -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE
 | 
			
		||||
$cflags       = -W3 -Gs0 -GF -Gy -Zi -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = 
 | 
			
		||||
$sys_id       = WIN32
 | 
			
		||||
@@ -1716,6 +1716,39 @@ $ranlib       =
 | 
			
		||||
$arflags      = 
 | 
			
		||||
$multilib     = 
 | 
			
		||||
 | 
			
		||||
*** debug-ben-darwin64
 | 
			
		||||
$cc           = cc
 | 
			
		||||
$cflags       = -Wall -pedantic -DPEDANTIC -Wno-long-long -Wsign-compare -Wmissing-prototypes -Wshadow -Wformat -Werror -DCRYPTO_MDEBUG_ALL -DCRYPTO_MDEBUG_ABORT -DREF_CHECK -DOPENSSL_NO_DEPRECATED -Wno-language-extension-token -Wno-extended-offsetof -arch x86_64 -O3 -DL_ENDIAN -Wall
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$sys_id       = MACOSX
 | 
			
		||||
$lflags       = -Wl,-search_paths_first%
 | 
			
		||||
$bn_ops       = SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL
 | 
			
		||||
$cpuid_obj    = x86_64cpuid.o
 | 
			
		||||
$bn_obj       = x86_64-gcc.o x86_64-mont.o x86_64-mont5.o x86_64-gf2m.o modexp512-x86_64.o
 | 
			
		||||
$des_obj      = 
 | 
			
		||||
$aes_obj      = aes-x86_64.o vpaes-x86_64.o bsaes-x86_64.o aesni-x86_64.o aesni-sha1-x86_64.o
 | 
			
		||||
$bf_obj       = 
 | 
			
		||||
$md5_obj      = md5-x86_64.o
 | 
			
		||||
$sha1_obj     = sha1-x86_64.o sha256-x86_64.o sha512-x86_64.o
 | 
			
		||||
$cast_obj     = 
 | 
			
		||||
$rc4_obj      = 
 | 
			
		||||
$rmd160_obj   = 
 | 
			
		||||
$rc5_obj      = 
 | 
			
		||||
$wp_obj       = wp-x86_64.o
 | 
			
		||||
$cmll_obj     = cmll-x86_64.o cmll_misc.o
 | 
			
		||||
$modes_obj    = ghash-x86_64.o
 | 
			
		||||
$engines_obj  = 
 | 
			
		||||
$perlasm_scheme = macosx
 | 
			
		||||
$dso_scheme   = dlfcn
 | 
			
		||||
$shared_target= darwin-shared
 | 
			
		||||
$shared_cflag = -fPIC -fno-common
 | 
			
		||||
$shared_ldflag = -arch x86_64 -dynamiclib
 | 
			
		||||
$shared_extension = .$(SHLIB_MAJOR).$(SHLIB_MINOR).dylib
 | 
			
		||||
$ranlib       = 
 | 
			
		||||
$arflags      = 
 | 
			
		||||
$multilib     = 
 | 
			
		||||
 | 
			
		||||
*** debug-ben-debug
 | 
			
		||||
$cc           = gcc44
 | 
			
		||||
$cflags       = -Wall -pedantic -DPEDANTIC -Wno-long-long -Wsign-compare -Wmissing-prototypes -Wshadow -Wformat -Werror -DCRYPTO_MDEBUG_ALL -DCRYPTO_MDEBUG_ABORT -DREF_CHECK -DOPENSSL_NO_DEPRECATED -DBN_DEBUG -DCONF_DEBUG -DDEBUG_SAFESTACK -DDEBUG_UNUSED -g3 -O2 -pipe
 | 
			
		||||
@@ -1749,6 +1782,39 @@ $ranlib       =
 | 
			
		||||
$arflags      = 
 | 
			
		||||
$multilib     = 
 | 
			
		||||
 | 
			
		||||
*** debug-ben-debug-64
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -Wall -pedantic -DPEDANTIC -Wno-long-long -Wsign-compare -Wmissing-prototypes -Wshadow -Wformat -Werror -DCRYPTO_MDEBUG_ALL -DCRYPTO_MDEBUG_ABORT -DREF_CHECK -DOPENSSL_NO_DEPRECATED -Wno-error=overlength-strings -DBN_DEBUG -DCONF_DEBUG -DDEBUG_SAFESTACK -DDEBUG_UNUSED -g3 -O3 -pipe
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -pthread -D_THREAD_SAFE -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
$lflags       = 
 | 
			
		||||
$bn_ops       = SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL
 | 
			
		||||
$cpuid_obj    = x86_64cpuid.o
 | 
			
		||||
$bn_obj       = x86_64-gcc.o x86_64-mont.o x86_64-mont5.o x86_64-gf2m.o modexp512-x86_64.o
 | 
			
		||||
$des_obj      = 
 | 
			
		||||
$aes_obj      = aes-x86_64.o vpaes-x86_64.o bsaes-x86_64.o aesni-x86_64.o aesni-sha1-x86_64.o
 | 
			
		||||
$bf_obj       = 
 | 
			
		||||
$md5_obj      = md5-x86_64.o
 | 
			
		||||
$sha1_obj     = sha1-x86_64.o sha256-x86_64.o sha512-x86_64.o
 | 
			
		||||
$cast_obj     = 
 | 
			
		||||
$rc4_obj      = rc4-x86_64.o rc4-md5-x86_64.o
 | 
			
		||||
$rmd160_obj   = 
 | 
			
		||||
$rc5_obj      = 
 | 
			
		||||
$wp_obj       = wp-x86_64.o
 | 
			
		||||
$cmll_obj     = cmll-x86_64.o cmll_misc.o
 | 
			
		||||
$modes_obj    = ghash-x86_64.o
 | 
			
		||||
$engines_obj  = 
 | 
			
		||||
$perlasm_scheme = elf
 | 
			
		||||
$dso_scheme   = dlfcn
 | 
			
		||||
$shared_target= bsd-gcc-shared
 | 
			
		||||
$shared_cflag = -fPIC
 | 
			
		||||
$shared_ldflag = 
 | 
			
		||||
$shared_extension = .so.$(SHLIB_MAJOR).$(SHLIB_MINOR)
 | 
			
		||||
$ranlib       = 
 | 
			
		||||
$arflags      = 
 | 
			
		||||
$multilib     = 
 | 
			
		||||
 | 
			
		||||
*** debug-ben-macos
 | 
			
		||||
$cc           = cc
 | 
			
		||||
$cflags       = -Wall -pedantic -DPEDANTIC -Wno-long-long -Wsign-compare -Wmissing-prototypes -Wshadow -Wformat -Werror -DCRYPTO_MDEBUG_ALL -DCRYPTO_MDEBUG_ABORT -DREF_CHECK -DOPENSSL_NO_DEPRECATED -arch i386 -DBN_DEBUG -DCONF_DEBUG -DDEBUG_SAFESTACK -DDEBUG_UNUSED -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -O3 -DL_ENDIAN -g3 -pipe
 | 
			
		||||
@@ -1949,7 +2015,7 @@ $multilib     =
 | 
			
		||||
 | 
			
		||||
*** debug-bodo
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -Wall -pedantic -DPEDANTIC -Wno-long-long -Wsign-compare -Wmissing-prototypes -Wshadow -Wformat -Werror -DCRYPTO_MDEBUG_ALL -DCRYPTO_MDEBUG_ABORT -DREF_CHECK -DOPENSSL_NO_DEPRECATED -DBN_DEBUG -DBN_DEBUG_RAND -DCONF_DEBUG -DBIO_PAIR_DEBUG -m64 -DL_ENDIAN -DTERMIO -g -DMD32_REG_T=int
 | 
			
		||||
$cflags       = -Wall -pedantic -DPEDANTIC -Wno-long-long -Wsign-compare -Wmissing-prototypes -Wshadow -Wformat -Werror -DCRYPTO_MDEBUG_ALL -DCRYPTO_MDEBUG_ABORT -DREF_CHECK -DOPENSSL_NO_DEPRECATED -Wno-error=overlength-strings -DBN_DEBUG -DBN_DEBUG_RAND -DCONF_DEBUG -DBIO_PAIR_DEBUG -m64 -DL_ENDIAN -DTERMIO -g -DMD32_REG_T=int
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
@@ -2741,7 +2807,7 @@ $multilib     =
 | 
			
		||||
 | 
			
		||||
*** debug-steve64
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -Wall -pedantic -DPEDANTIC -Wno-long-long -Wsign-compare -Wmissing-prototypes -Wshadow -Wformat -Werror -DCRYPTO_MDEBUG_ALL -DCRYPTO_MDEBUG_ABORT -DREF_CHECK -DOPENSSL_NO_DEPRECATED -m64 -DL_ENDIAN -DTERMIO -DCONF_DEBUG -DDEBUG_SAFESTACK -g
 | 
			
		||||
$cflags       = -Wall -pedantic -DPEDANTIC -Wno-long-long -Wsign-compare -Wmissing-prototypes -Wshadow -Wformat -Werror -DCRYPTO_MDEBUG_ALL -DCRYPTO_MDEBUG_ABORT -DREF_CHECK -DOPENSSL_NO_DEPRECATED -m64 -DL_ENDIAN -DTERMIO -DCONF_DEBUG -DDEBUG_SAFESTACK -Wno-overlength-strings -g
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$sys_id       = 
 | 
			
		||||
 
 | 
			
		||||
@@ -577,14 +577,15 @@ openssl.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
 | 
			
		||||
openssl.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
 | 
			
		||||
openssl.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
 | 
			
		||||
openssl.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
 | 
			
		||||
openssl.o: ../include/openssl/pqueue.h ../include/openssl/safestack.h
 | 
			
		||||
openssl.o: ../include/openssl/sha.h ../include/openssl/srtp.h
 | 
			
		||||
openssl.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
 | 
			
		||||
openssl.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
 | 
			
		||||
openssl.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
 | 
			
		||||
openssl.o: ../include/openssl/tls1.h ../include/openssl/txt_db.h
 | 
			
		||||
openssl.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
 | 
			
		||||
openssl.o: ../include/openssl/x509v3.h apps.h openssl.c progs.h s_apps.h
 | 
			
		||||
openssl.o: ../include/openssl/pqueue.h ../include/openssl/rand.h
 | 
			
		||||
openssl.o: ../include/openssl/safestack.h ../include/openssl/sha.h
 | 
			
		||||
openssl.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
 | 
			
		||||
openssl.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
 | 
			
		||||
openssl.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
 | 
			
		||||
openssl.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
 | 
			
		||||
openssl.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
 | 
			
		||||
openssl.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h
 | 
			
		||||
openssl.o: openssl.c progs.h s_apps.h
 | 
			
		||||
passwd.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
 | 
			
		||||
passwd.o: ../include/openssl/buffer.h ../include/openssl/conf.h
 | 
			
		||||
passwd.o: ../include/openssl/crypto.h ../include/openssl/des.h
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										10
									
								
								apps/apps.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								apps/apps.c
									
									
									
									
									
								
							@@ -390,6 +390,8 @@ int chopup_args(ARGS *arg, char *buf, int *argc, char **argv[])
 | 
			
		||||
		{
 | 
			
		||||
		arg->count=20;
 | 
			
		||||
		arg->data=(char **)OPENSSL_malloc(sizeof(char *)*arg->count);
 | 
			
		||||
		if (arg->data == NULL)
 | 
			
		||||
			return 0;
 | 
			
		||||
		}
 | 
			
		||||
	for (i=0; i<arg->count; i++)
 | 
			
		||||
		arg->data[i]=NULL;
 | 
			
		||||
@@ -586,12 +588,12 @@ int password_callback(char *buf, int bufsiz, int verify,
 | 
			
		||||
 | 
			
		||||
		if (ok >= 0)
 | 
			
		||||
			ok = UI_add_input_string(ui,prompt,ui_flags,buf,
 | 
			
		||||
				PW_MIN_LENGTH,BUFSIZ-1);
 | 
			
		||||
				PW_MIN_LENGTH,bufsiz-1);
 | 
			
		||||
		if (ok >= 0 && verify)
 | 
			
		||||
			{
 | 
			
		||||
			buff = (char *)OPENSSL_malloc(bufsiz);
 | 
			
		||||
			ok = UI_add_verify_string(ui,prompt,ui_flags,buff,
 | 
			
		||||
				PW_MIN_LENGTH,BUFSIZ-1, buf);
 | 
			
		||||
				PW_MIN_LENGTH,bufsiz-1, buf);
 | 
			
		||||
			}
 | 
			
		||||
		if (ok >= 0)
 | 
			
		||||
			do
 | 
			
		||||
@@ -1542,6 +1544,8 @@ char *make_config_name()
 | 
			
		||||
 | 
			
		||||
	len=strlen(t)+strlen(OPENSSL_CONF)+2;
 | 
			
		||||
	p=OPENSSL_malloc(len);
 | 
			
		||||
	if (p == NULL)
 | 
			
		||||
		return NULL;
 | 
			
		||||
	BUF_strlcpy(p,t,len);
 | 
			
		||||
#ifndef OPENSSL_SYS_VMS
 | 
			
		||||
	BUF_strlcat(p,"/",len);
 | 
			
		||||
@@ -2841,7 +2845,7 @@ double app_tminterval(int stop,int usertime)
 | 
			
		||||
 | 
			
		||||
	if (proc==NULL)
 | 
			
		||||
		{
 | 
			
		||||
		if (GetVersion() < 0x80000000)
 | 
			
		||||
		if (check_winnt())
 | 
			
		||||
			proc = OpenProcess(PROCESS_QUERY_INFORMATION,FALSE,
 | 
			
		||||
						GetCurrentProcessId());
 | 
			
		||||
		if (proc==NULL) proc = (HANDLE)-1;
 | 
			
		||||
 
 | 
			
		||||
@@ -188,6 +188,7 @@ extern BIO *bio_err;
 | 
			
		||||
			do { CONF_modules_unload(1); destroy_ui_method(); \
 | 
			
		||||
			OBJ_cleanup(); EVP_cleanup(); ENGINE_cleanup(); \
 | 
			
		||||
			CRYPTO_cleanup_all_ex_data(); ERR_remove_thread_state(NULL); \
 | 
			
		||||
			RAND_cleanup(); \
 | 
			
		||||
			ERR_free_strings(); zlib_cleanup();} while(0)
 | 
			
		||||
#  else
 | 
			
		||||
#    define apps_startup() \
 | 
			
		||||
@@ -198,6 +199,7 @@ extern BIO *bio_err;
 | 
			
		||||
			do { CONF_modules_unload(1); destroy_ui_method(); \
 | 
			
		||||
			OBJ_cleanup(); EVP_cleanup(); \
 | 
			
		||||
			CRYPTO_cleanup_all_ex_data(); ERR_remove_thread_state(NULL); \
 | 
			
		||||
			RAND_cleanup(); \
 | 
			
		||||
			ERR_free_strings(); zlib_cleanup(); } while(0)
 | 
			
		||||
#  endif
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -703,7 +703,7 @@ bad:
 | 
			
		||||
		ERR_clear_error();
 | 
			
		||||
#ifdef RL_DEBUG
 | 
			
		||||
	if (!p)
 | 
			
		||||
		BIO_printf(bio_err, "DEBUG: unique_subject undefined\n", p);
 | 
			
		||||
		BIO_printf(bio_err, "DEBUG: unique_subject undefined\n");
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef RL_DEBUG
 | 
			
		||||
	BIO_printf(bio_err, "DEBUG: configured unique_subject is %d\n",
 | 
			
		||||
@@ -1620,12 +1620,14 @@ static int certify(X509 **xret, char *infile, EVP_PKEY *pkey, X509 *x509,
 | 
			
		||||
		{
 | 
			
		||||
		ok=0;
 | 
			
		||||
		BIO_printf(bio_err,"Signature verification problems....\n");
 | 
			
		||||
		ERR_print_errors(bio_err);
 | 
			
		||||
		goto err;
 | 
			
		||||
		}
 | 
			
		||||
	if (i == 0)
 | 
			
		||||
		{
 | 
			
		||||
		ok=0;
 | 
			
		||||
		BIO_printf(bio_err,"Signature did not match the certificate request\n");
 | 
			
		||||
		ERR_print_errors(bio_err);
 | 
			
		||||
		goto err;
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
@@ -2777,6 +2779,9 @@ char *make_revocation_str(int rev_type, char *rev_arg)
 | 
			
		||||
 | 
			
		||||
	revtm = X509_gmtime_adj(NULL, 0);
 | 
			
		||||
 | 
			
		||||
	if (!revtm)
 | 
			
		||||
		return NULL;
 | 
			
		||||
 | 
			
		||||
	i = revtm->length + 1;
 | 
			
		||||
 | 
			
		||||
	if (reason) i += strlen(reason) + 1;
 | 
			
		||||
 
 | 
			
		||||
@@ -96,13 +96,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	char buf[512];
 | 
			
		||||
	BIO *STDout=NULL;
 | 
			
		||||
 | 
			
		||||
#if !defined(OPENSSL_NO_SSL2) && !defined(OPENSSL_NO_SSL3)
 | 
			
		||||
	meth=SSLv23_server_method();
 | 
			
		||||
#elif !defined(OPENSSL_NO_SSL3)
 | 
			
		||||
	meth=SSLv3_server_method();
 | 
			
		||||
#elif !defined(OPENSSL_NO_SSL2)
 | 
			
		||||
	meth=SSLv2_server_method();
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	apps_startup();
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										18
									
								
								apps/crl.c
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								apps/crl.c
									
									
									
									
									
								
							@@ -81,6 +81,9 @@ static const char *crl_usage[]={
 | 
			
		||||
" -in arg         - input file - default stdin\n",
 | 
			
		||||
" -out arg        - output file - default stdout\n",
 | 
			
		||||
" -hash           - print hash value\n",
 | 
			
		||||
#ifndef OPENSSL_NO_MD5
 | 
			
		||||
" -hash_old       - print old-style (MD5) hash value\n",
 | 
			
		||||
#endif
 | 
			
		||||
" -fingerprint    - print the crl fingerprint\n",
 | 
			
		||||
" -issuer         - print issuer DN\n",
 | 
			
		||||
" -lastupdate     - lastUpdate field\n",
 | 
			
		||||
@@ -108,6 +111,9 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	int informat,outformat;
 | 
			
		||||
	char *infile=NULL,*outfile=NULL;
 | 
			
		||||
	int hash=0,issuer=0,lastupdate=0,nextupdate=0,noout=0,text=0;
 | 
			
		||||
#ifndef OPENSSL_NO_MD5
 | 
			
		||||
       int hash_old=0;
 | 
			
		||||
#endif
 | 
			
		||||
	int fingerprint = 0, crlnumber = 0;
 | 
			
		||||
	const char **pp;
 | 
			
		||||
	X509_STORE *store = NULL;
 | 
			
		||||
@@ -192,6 +198,10 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
			text = 1;
 | 
			
		||||
		else if (strcmp(*argv,"-hash") == 0)
 | 
			
		||||
			hash= ++num;
 | 
			
		||||
#ifndef OPENSSL_NO_MD5
 | 
			
		||||
		else if (strcmp(*argv,"-hash_old") == 0)
 | 
			
		||||
			hash_old= ++num;
 | 
			
		||||
#endif
 | 
			
		||||
		else if (strcmp(*argv,"-nameopt") == 0)
 | 
			
		||||
			{
 | 
			
		||||
			if (--argc < 1) goto bad;
 | 
			
		||||
@@ -304,6 +314,14 @@ bad:
 | 
			
		||||
				BIO_printf(bio_out,"%08lx\n",
 | 
			
		||||
					X509_NAME_hash(X509_CRL_get_issuer(x)));
 | 
			
		||||
				}
 | 
			
		||||
#ifndef OPENSSL_NO_MD5
 | 
			
		||||
			if (hash_old == i)
 | 
			
		||||
				{
 | 
			
		||||
				BIO_printf(bio_out,"%08lx\n",
 | 
			
		||||
					X509_NAME_hash_old(
 | 
			
		||||
						X509_CRL_get_issuer(x)));
 | 
			
		||||
				}
 | 
			
		||||
#endif
 | 
			
		||||
			if (lastupdate == i)
 | 
			
		||||
				{
 | 
			
		||||
				BIO_printf(bio_out,"lastUpdate=");
 | 
			
		||||
 
 | 
			
		||||
@@ -141,7 +141,13 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
			{
 | 
			
		||||
			if (--argc < 1) goto bad;
 | 
			
		||||
			if(!certflst) certflst = sk_OPENSSL_STRING_new_null();
 | 
			
		||||
			sk_OPENSSL_STRING_push(certflst,*(++argv));
 | 
			
		||||
			if (!certflst)
 | 
			
		||||
				goto end;
 | 
			
		||||
			if (!sk_OPENSSL_STRING_push(certflst,*(++argv)))
 | 
			
		||||
				{
 | 
			
		||||
				sk_OPENSSL_STRING_free(certflst);
 | 
			
		||||
				goto end;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		else
 | 
			
		||||
			{
 | 
			
		||||
 
 | 
			
		||||
@@ -273,6 +273,8 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
		BIO_printf(bio_err,"-d              to output debug info\n");
 | 
			
		||||
		BIO_printf(bio_err,"-hex            output as hex dump\n");
 | 
			
		||||
		BIO_printf(bio_err,"-binary         output in binary form\n");
 | 
			
		||||
		BIO_printf(bio_err,"-hmac arg       set the HMAC key to arg\n");
 | 
			
		||||
		BIO_printf(bio_err,"-non-fips-allow allow use of non FIPS digest\n");
 | 
			
		||||
		BIO_printf(bio_err,"-sign   file    sign digest using private key in file\n");
 | 
			
		||||
		BIO_printf(bio_err,"-verify file    verify a signature using public key in file\n");
 | 
			
		||||
		BIO_printf(bio_err,"-prverify file  verify a signature using private key in file\n");
 | 
			
		||||
@@ -427,9 +429,9 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
			goto end;
 | 
			
		||||
			}
 | 
			
		||||
		if (do_verify)
 | 
			
		||||
			r = EVP_DigestVerifyInit(mctx, &pctx, md, e, sigkey);
 | 
			
		||||
			r = EVP_DigestVerifyInit(mctx, &pctx, md, NULL, sigkey);
 | 
			
		||||
		else
 | 
			
		||||
			r = EVP_DigestSignInit(mctx, &pctx, md, e, sigkey);
 | 
			
		||||
			r = EVP_DigestSignInit(mctx, &pctx, md, NULL, sigkey);
 | 
			
		||||
		if (!r)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bio_err, "Error setting context\n");
 | 
			
		||||
 
 | 
			
		||||
@@ -105,7 +105,7 @@
 | 
			
		||||
 *                    in the asn1 der encoding
 | 
			
		||||
 *                    possible values: named_curve (default)
 | 
			
		||||
 *                                     explicit
 | 
			
		||||
 * -no_seed         - if 'explicit' parameters are choosen do not use the seed
 | 
			
		||||
 * -no_seed         - if 'explicit' parameters are chosen do not use the seed
 | 
			
		||||
 * -genkey          - generate ec key
 | 
			
		||||
 * -rand file       - files to use for random number input
 | 
			
		||||
 * -engine e        - use engine e, possibly a hardware device
 | 
			
		||||
@@ -286,7 +286,7 @@ bad:
 | 
			
		||||
		BIO_printf(bio_err, "                                   "
 | 
			
		||||
				" explicit\n");
 | 
			
		||||
		BIO_printf(bio_err, " -no_seed          if 'explicit'"
 | 
			
		||||
				" parameters are choosen do not"
 | 
			
		||||
				" parameters are chosen do not"
 | 
			
		||||
				" use the seed\n");
 | 
			
		||||
		BIO_printf(bio_err, " -genkey           generate ec"
 | 
			
		||||
				" key\n");
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										14
									
								
								apps/enc.c
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								apps/enc.c
									
									
									
									
									
								
							@@ -67,7 +67,9 @@
 | 
			
		||||
#include <openssl/x509.h>
 | 
			
		||||
#include <openssl/rand.h>
 | 
			
		||||
#include <openssl/pem.h>
 | 
			
		||||
#ifndef OPENSSL_NO_COMP
 | 
			
		||||
#include <openssl/comp.h>
 | 
			
		||||
#endif
 | 
			
		||||
#include <ctype.h>
 | 
			
		||||
 | 
			
		||||
int set_hex(char *in,unsigned char *out,int size);
 | 
			
		||||
@@ -331,6 +333,18 @@ bad:
 | 
			
		||||
        setup_engine(bio_err, engine, 0);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	if (cipher && EVP_CIPHER_flags(cipher) & EVP_CIPH_FLAG_AEAD_CIPHER)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_printf(bio_err, "AEAD ciphers not supported by the enc utility\n");
 | 
			
		||||
		goto end;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (cipher && (EVP_CIPHER_mode(cipher) == EVP_CIPH_XTS_MODE))
 | 
			
		||||
		{
 | 
			
		||||
		BIO_printf(bio_err, "Ciphers in XTS mode are not supported by the enc utility\n");
 | 
			
		||||
		goto end;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (md && (dgst=EVP_get_digestbyname(md)) == NULL)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_printf(bio_err,"%s is an unsupported message digest type\n",md);
 | 
			
		||||
 
 | 
			
		||||
@@ -773,9 +773,12 @@ $ CCDEFS = "MONOLITH"
 | 
			
		||||
$ IF F$TYPE(USER_CCDEFS) .NES. "" THEN CCDEFS = CCDEFS + "," + USER_CCDEFS
 | 
			
		||||
$ CCEXTRAFLAGS = ""
 | 
			
		||||
$ IF F$TYPE(USER_CCFLAGS) .NES. "" THEN CCEXTRAFLAGS = USER_CCFLAGS
 | 
			
		||||
$ CCDISABLEWARNINGS = "" !!! "LONGLONGTYPE,LONGLONGSUFX,FOUNDCR"
 | 
			
		||||
$ IF F$TYPE(USER_CCDISABLEWARNINGS) .NES. "" THEN -
 | 
			
		||||
	CCDISABLEWARNINGS = CCDISABLEWARNINGS + "," + USER_CCDISABLEWARNINGS
 | 
			
		||||
$ CCDISABLEWARNINGS = "" !!! "MAYLOSEDATA3" !!! "LONGLONGTYPE,LONGLONGSUFX,FOUNDCR"
 | 
			
		||||
$ IF F$TYPE(USER_CCDISABLEWARNINGS) .NES. ""
 | 
			
		||||
$ THEN
 | 
			
		||||
$     IF CCDISABLEWARNINGS .NES. "" THEN CCDISABLEWARNINGS = CCDISABLEWARNINGS + ","
 | 
			
		||||
$     CCDISABLEWARNINGS = CCDISABLEWARNINGS + USER_CCDISABLEWARNINGS
 | 
			
		||||
$ ENDIF
 | 
			
		||||
$!
 | 
			
		||||
$! Check To See If We Have A ZLIB Option.
 | 
			
		||||
$!
 | 
			
		||||
@@ -1064,6 +1067,18 @@ $! Finish up the definition of CC.
 | 
			
		||||
$!
 | 
			
		||||
$ IF COMPILER .EQS. "DECC"
 | 
			
		||||
$ THEN
 | 
			
		||||
$!  Not all compiler versions support MAYLOSEDATA3.
 | 
			
		||||
$   OPT_TEST = "MAYLOSEDATA3"
 | 
			
		||||
$   DEFINE /USER_MODE SYS$ERROR NL:
 | 
			
		||||
$   DEFINE /USER_MODE SYS$OUTPUT NL:
 | 
			
		||||
$   'CC' /NOCROSS_REFERENCE /NOLIST /NOOBJECT -
 | 
			
		||||
      /WARNINGS = DISABLE = ('OPT_TEST', EMPTYFILE) NL:
 | 
			
		||||
$   IF ($SEVERITY)
 | 
			
		||||
$   THEN
 | 
			
		||||
$     IF CCDISABLEWARNINGS .NES. "" THEN -
 | 
			
		||||
        CCDISABLEWARNINGS = CCDISABLEWARNINGS+ ","
 | 
			
		||||
$     CCDISABLEWARNINGS = CCDISABLEWARNINGS+ OPT_TEST
 | 
			
		||||
$   ENDIF
 | 
			
		||||
$   IF CCDISABLEWARNINGS .NES. ""
 | 
			
		||||
$   THEN
 | 
			
		||||
$     CCDISABLEWARNINGS = " /WARNING=(DISABLE=(" + CCDISABLEWARNINGS + "))"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										122
									
								
								apps/ocsp.c
									
									
									
									
									
								
							
							
						
						
									
										122
									
								
								apps/ocsp.c
									
									
									
									
									
								
							@@ -127,6 +127,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	ENGINE *e = NULL;
 | 
			
		||||
	char **args;
 | 
			
		||||
	char *host = NULL, *port = NULL, *path = "/";
 | 
			
		||||
	char *thost = NULL, *tport = NULL, *tpath = NULL;
 | 
			
		||||
	char *reqin = NULL, *respin = NULL;
 | 
			
		||||
	char *reqout = NULL, *respout = NULL;
 | 
			
		||||
	char *signfile = NULL, *keyfile = NULL;
 | 
			
		||||
@@ -204,6 +205,12 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
			}
 | 
			
		||||
		else if (!strcmp(*args, "-url"))
 | 
			
		||||
			{
 | 
			
		||||
			if (thost)
 | 
			
		||||
				OPENSSL_free(thost);
 | 
			
		||||
			if (tport)
 | 
			
		||||
				OPENSSL_free(tport);
 | 
			
		||||
			if (tpath)
 | 
			
		||||
				OPENSSL_free(tpath);
 | 
			
		||||
			if (args[1])
 | 
			
		||||
				{
 | 
			
		||||
				args++;
 | 
			
		||||
@@ -212,6 +219,9 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
					BIO_printf(bio_err, "Error parsing URL\n");
 | 
			
		||||
					badarg = 1;
 | 
			
		||||
					}
 | 
			
		||||
				thost = host;
 | 
			
		||||
				tport = port;
 | 
			
		||||
				tpath = path;
 | 
			
		||||
				}
 | 
			
		||||
			else badarg = 1;
 | 
			
		||||
			}
 | 
			
		||||
@@ -573,51 +583,52 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
		BIO_printf (bio_err, "OCSP utility\n");
 | 
			
		||||
		BIO_printf (bio_err, "Usage ocsp [options]\n");
 | 
			
		||||
		BIO_printf (bio_err, "where options are\n");
 | 
			
		||||
		BIO_printf (bio_err, "-out file          output filename\n");
 | 
			
		||||
		BIO_printf (bio_err, "-issuer file       issuer certificate\n");
 | 
			
		||||
		BIO_printf (bio_err, "-cert file         certificate to check\n");
 | 
			
		||||
		BIO_printf (bio_err, "-serial n          serial number to check\n");
 | 
			
		||||
		BIO_printf (bio_err, "-signer file       certificate to sign OCSP request with\n");
 | 
			
		||||
		BIO_printf (bio_err, "-signkey file      private key to sign OCSP request with\n");
 | 
			
		||||
		BIO_printf (bio_err, "-sign_other file   additional certificates to include in signed request\n");
 | 
			
		||||
		BIO_printf (bio_err, "-no_certs          don't include any certificates in signed request\n");
 | 
			
		||||
		BIO_printf (bio_err, "-req_text          print text form of request\n");
 | 
			
		||||
		BIO_printf (bio_err, "-resp_text         print text form of response\n");
 | 
			
		||||
		BIO_printf (bio_err, "-text              print text form of request and response\n");
 | 
			
		||||
		BIO_printf (bio_err, "-reqout file       write DER encoded OCSP request to \"file\"\n");
 | 
			
		||||
		BIO_printf (bio_err, "-respout file      write DER encoded OCSP reponse to \"file\"\n");
 | 
			
		||||
		BIO_printf (bio_err, "-reqin file        read DER encoded OCSP request from \"file\"\n");
 | 
			
		||||
		BIO_printf (bio_err, "-respin file       read DER encoded OCSP reponse from \"file\"\n");
 | 
			
		||||
		BIO_printf (bio_err, "-nonce             add OCSP nonce to request\n");
 | 
			
		||||
		BIO_printf (bio_err, "-no_nonce          don't add OCSP nonce to request\n");
 | 
			
		||||
		BIO_printf (bio_err, "-url URL           OCSP responder URL\n");
 | 
			
		||||
		BIO_printf (bio_err, "-host host:n       send OCSP request to host on port n\n");
 | 
			
		||||
		BIO_printf (bio_err, "-path              path to use in OCSP request\n");
 | 
			
		||||
		BIO_printf (bio_err, "-CApath dir        trusted certificates directory\n");
 | 
			
		||||
		BIO_printf (bio_err, "-CAfile file       trusted certificates file\n");
 | 
			
		||||
		BIO_printf (bio_err, "-VAfile file       validator certificates file\n");
 | 
			
		||||
		BIO_printf (bio_err, "-validity_period n maximum validity discrepancy in seconds\n");
 | 
			
		||||
		BIO_printf (bio_err, "-status_age n      maximum status age in seconds\n");
 | 
			
		||||
		BIO_printf (bio_err, "-noverify          don't verify response at all\n");
 | 
			
		||||
		BIO_printf (bio_err, "-verify_other file additional certificates to search for signer\n");
 | 
			
		||||
		BIO_printf (bio_err, "-trust_other       don't verify additional certificates\n");
 | 
			
		||||
		BIO_printf (bio_err, "-no_intern         don't search certificates contained in response for signer\n");
 | 
			
		||||
		BIO_printf (bio_err, "-out file            output filename\n");
 | 
			
		||||
		BIO_printf (bio_err, "-issuer file         issuer certificate\n");
 | 
			
		||||
		BIO_printf (bio_err, "-cert file           certificate to check\n");
 | 
			
		||||
		BIO_printf (bio_err, "-serial n            serial number to check\n");
 | 
			
		||||
		BIO_printf (bio_err, "-signer file         certificate to sign OCSP request with\n");
 | 
			
		||||
		BIO_printf (bio_err, "-signkey file        private key to sign OCSP request with\n");
 | 
			
		||||
		BIO_printf (bio_err, "-sign_other file     additional certificates to include in signed request\n");
 | 
			
		||||
		BIO_printf (bio_err, "-no_certs            don't include any certificates in signed request\n");
 | 
			
		||||
		BIO_printf (bio_err, "-req_text            print text form of request\n");
 | 
			
		||||
		BIO_printf (bio_err, "-resp_text           print text form of response\n");
 | 
			
		||||
		BIO_printf (bio_err, "-text                print text form of request and response\n");
 | 
			
		||||
		BIO_printf (bio_err, "-reqout file         write DER encoded OCSP request to \"file\"\n");
 | 
			
		||||
		BIO_printf (bio_err, "-respout file        write DER encoded OCSP reponse to \"file\"\n");
 | 
			
		||||
		BIO_printf (bio_err, "-reqin file          read DER encoded OCSP request from \"file\"\n");
 | 
			
		||||
		BIO_printf (bio_err, "-respin file         read DER encoded OCSP reponse from \"file\"\n");
 | 
			
		||||
		BIO_printf (bio_err, "-nonce               add OCSP nonce to request\n");
 | 
			
		||||
		BIO_printf (bio_err, "-no_nonce            don't add OCSP nonce to request\n");
 | 
			
		||||
		BIO_printf (bio_err, "-url URL             OCSP responder URL\n");
 | 
			
		||||
		BIO_printf (bio_err, "-host host:n         send OCSP request to host on port n\n");
 | 
			
		||||
		BIO_printf (bio_err, "-path                path to use in OCSP request\n");
 | 
			
		||||
		BIO_printf (bio_err, "-CApath dir          trusted certificates directory\n");
 | 
			
		||||
		BIO_printf (bio_err, "-CAfile file         trusted certificates file\n");
 | 
			
		||||
		BIO_printf (bio_err, "-VAfile file         validator certificates file\n");
 | 
			
		||||
		BIO_printf (bio_err, "-validity_period n   maximum validity discrepancy in seconds\n");
 | 
			
		||||
		BIO_printf (bio_err, "-status_age n        maximum status age in seconds\n");
 | 
			
		||||
		BIO_printf (bio_err, "-noverify            don't verify response at all\n");
 | 
			
		||||
		BIO_printf (bio_err, "-verify_other file   additional certificates to search for signer\n");
 | 
			
		||||
		BIO_printf (bio_err, "-trust_other         don't verify additional certificates\n");
 | 
			
		||||
		BIO_printf (bio_err, "-no_intern           don't search certificates contained in response for signer\n");
 | 
			
		||||
		BIO_printf (bio_err, "-no_signature_verify don't check signature on response\n");
 | 
			
		||||
		BIO_printf (bio_err, "-no_cert_verify    don't check signing certificate\n");
 | 
			
		||||
		BIO_printf (bio_err, "-no_chain          don't chain verify response\n");
 | 
			
		||||
		BIO_printf (bio_err, "-no_cert_checks    don't do additional checks on signing certificate\n");
 | 
			
		||||
		BIO_printf (bio_err, "-port num		 port to run responder on\n");
 | 
			
		||||
		BIO_printf (bio_err, "-index file	 certificate status index file\n");
 | 
			
		||||
		BIO_printf (bio_err, "-CA file		 CA certificate\n");
 | 
			
		||||
		BIO_printf (bio_err, "-rsigner file	 responder certificate to sign responses with\n");
 | 
			
		||||
		BIO_printf (bio_err, "-rkey file	 responder key to sign responses with\n");
 | 
			
		||||
		BIO_printf (bio_err, "-rother file	 other certificates to include in response\n");
 | 
			
		||||
		BIO_printf (bio_err, "-resp_no_certs     don't include any certificates in response\n");
 | 
			
		||||
		BIO_printf (bio_err, "-nmin n	 	 number of minutes before next update\n");
 | 
			
		||||
		BIO_printf (bio_err, "-ndays n	 	 number of days before next update\n");
 | 
			
		||||
		BIO_printf (bio_err, "-resp_key_id       identify reponse by signing certificate key ID\n");
 | 
			
		||||
		BIO_printf (bio_err, "-nrequest n        number of requests to accept (default unlimited)\n");
 | 
			
		||||
		BIO_printf (bio_err, "-<dgst alg>     use specified digest in the request\n");
 | 
			
		||||
		BIO_printf (bio_err, "-no_cert_verify      don't check signing certificate\n");
 | 
			
		||||
		BIO_printf (bio_err, "-no_chain            don't chain verify response\n");
 | 
			
		||||
		BIO_printf (bio_err, "-no_cert_checks      don't do additional checks on signing certificate\n");
 | 
			
		||||
		BIO_printf (bio_err, "-port num            port to run responder on\n");
 | 
			
		||||
		BIO_printf (bio_err, "-index file          certificate status index file\n");
 | 
			
		||||
		BIO_printf (bio_err, "-CA file             CA certificate\n");
 | 
			
		||||
		BIO_printf (bio_err, "-rsigner file        responder certificate to sign responses with\n");
 | 
			
		||||
		BIO_printf (bio_err, "-rkey file           responder key to sign responses with\n");
 | 
			
		||||
		BIO_printf (bio_err, "-rother file         other certificates to include in response\n");
 | 
			
		||||
		BIO_printf (bio_err, "-resp_no_certs       don't include any certificates in response\n");
 | 
			
		||||
		BIO_printf (bio_err, "-nmin n              number of minutes before next update\n");
 | 
			
		||||
		BIO_printf (bio_err, "-ndays n             number of days before next update\n");
 | 
			
		||||
		BIO_printf (bio_err, "-resp_key_id         identify reponse by signing certificate key ID\n");
 | 
			
		||||
		BIO_printf (bio_err, "-nrequest n          number of requests to accept (default unlimited)\n");
 | 
			
		||||
		BIO_printf (bio_err, "-<dgst alg>          use specified digest in the request\n");
 | 
			
		||||
		BIO_printf (bio_err, "-timeout n           timeout connection to OCSP responder after n seconds\n");
 | 
			
		||||
		goto end;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@@ -920,12 +931,12 @@ end:
 | 
			
		||||
	sk_X509_pop_free(verify_other, X509_free);
 | 
			
		||||
	sk_CONF_VALUE_pop_free(headers, X509V3_conf_free);
 | 
			
		||||
 | 
			
		||||
	if (use_ssl != -1)
 | 
			
		||||
		{
 | 
			
		||||
		OPENSSL_free(host);
 | 
			
		||||
		OPENSSL_free(port);
 | 
			
		||||
		OPENSSL_free(path);
 | 
			
		||||
		}
 | 
			
		||||
	if (thost)
 | 
			
		||||
		OPENSSL_free(thost);
 | 
			
		||||
	if (tport)
 | 
			
		||||
		OPENSSL_free(tport);
 | 
			
		||||
	if (tpath)
 | 
			
		||||
		OPENSSL_free(tpath);
 | 
			
		||||
 | 
			
		||||
	OPENSSL_EXIT(ret);
 | 
			
		||||
}
 | 
			
		||||
@@ -1388,16 +1399,7 @@ OCSP_RESPONSE *process_responder(BIO *err, OCSP_REQUEST *req,
 | 
			
		||||
	if (use_ssl == 1)
 | 
			
		||||
		{
 | 
			
		||||
		BIO *sbio;
 | 
			
		||||
#if !defined(OPENSSL_NO_SSL2) && !defined(OPENSSL_NO_SSL3)
 | 
			
		||||
		ctx = SSL_CTX_new(SSLv23_client_method());
 | 
			
		||||
#elif !defined(OPENSSL_NO_SSL3)
 | 
			
		||||
		ctx = SSL_CTX_new(SSLv3_client_method());
 | 
			
		||||
#elif !defined(OPENSSL_NO_SSL2)
 | 
			
		||||
		ctx = SSL_CTX_new(SSLv2_client_method());
 | 
			
		||||
#else
 | 
			
		||||
		BIO_printf(err, "SSL is disabled\n");
 | 
			
		||||
			goto end;
 | 
			
		||||
#endif
 | 
			
		||||
		if (ctx == NULL)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(err, "Error creating SSL context.\n");
 | 
			
		||||
@@ -1409,7 +1411,7 @@ OCSP_RESPONSE *process_responder(BIO *err, OCSP_REQUEST *req,
 | 
			
		||||
		}
 | 
			
		||||
	resp = query_responder(err, cbio, path, headers, req, req_timeout);
 | 
			
		||||
	if (!resp)
 | 
			
		||||
		BIO_printf(bio_err, "Error querying OCSP responsder\n");
 | 
			
		||||
		BIO_printf(bio_err, "Error querying OCSP responder\n");
 | 
			
		||||
	end:
 | 
			
		||||
	if (cbio)
 | 
			
		||||
		BIO_free_all(cbio);
 | 
			
		||||
 
 | 
			
		||||
@@ -117,6 +117,7 @@
 | 
			
		||||
#include "apps.h"
 | 
			
		||||
#include <openssl/bio.h>
 | 
			
		||||
#include <openssl/crypto.h>
 | 
			
		||||
#include <openssl/rand.h>
 | 
			
		||||
#include <openssl/lhash.h>
 | 
			
		||||
#include <openssl/conf.h>
 | 
			
		||||
#include <openssl/x509.h>
 | 
			
		||||
@@ -434,9 +435,7 @@ end:
 | 
			
		||||
	if (prog != NULL) lh_FUNCTION_free(prog);
 | 
			
		||||
	if (arg.data != NULL) OPENSSL_free(arg.data);
 | 
			
		||||
 | 
			
		||||
	apps_shutdown();
 | 
			
		||||
 | 
			
		||||
	CRYPTO_mem_leaks(bio_err);
 | 
			
		||||
	if (bio_err != NULL)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_free(bio_err);
 | 
			
		||||
@@ -449,6 +448,9 @@ end:
 | 
			
		||||
		OPENSSL_free(Argv);
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
	apps_shutdown();
 | 
			
		||||
	CRYPTO_mem_leaks(bio_err);
 | 
			
		||||
 | 
			
		||||
	OPENSSL_EXIT(ret);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -112,7 +112,7 @@ 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;
 | 
			
		||||
@@ -130,6 +130,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);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -107,16 +107,16 @@ FUNCTION functions[] = {
 | 
			
		||||
	{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))
 | 
			
		||||
#if !defined(OPENSSL_NO_SOCK)
 | 
			
		||||
	{FUNC_TYPE_GENERAL,"s_server",s_server_main},
 | 
			
		||||
#endif
 | 
			
		||||
#if !defined(OPENSSL_NO_SOCK) && !(defined(OPENSSL_NO_SSL2) && defined(OPENSSL_NO_SSL3))
 | 
			
		||||
#if !defined(OPENSSL_NO_SOCK)
 | 
			
		||||
	{FUNC_TYPE_GENERAL,"s_client",s_client_main},
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_SPEED
 | 
			
		||||
	{FUNC_TYPE_GENERAL,"speed",speed_main},
 | 
			
		||||
#endif
 | 
			
		||||
#if !defined(OPENSSL_NO_SOCK) && !(defined(OPENSSL_NO_SSL2) && defined(OPENSSL_NO_SSL3))
 | 
			
		||||
#if !defined(OPENSSL_NO_SOCK)
 | 
			
		||||
	{FUNC_TYPE_GENERAL,"s_time",s_time_main},
 | 
			
		||||
#endif
 | 
			
		||||
	{FUNC_TYPE_GENERAL,"version",version_main},
 | 
			
		||||
@@ -126,7 +126,7 @@ FUNCTION functions[] = {
 | 
			
		||||
#endif
 | 
			
		||||
	{FUNC_TYPE_GENERAL,"crl2pkcs7",crl2pkcs7_main},
 | 
			
		||||
	{FUNC_TYPE_GENERAL,"sess_id",sess_id_main},
 | 
			
		||||
#if !defined(OPENSSL_NO_SOCK) && !(defined(OPENSSL_NO_SSL2) && defined(OPENSSL_NO_SSL3))
 | 
			
		||||
#if !defined(OPENSSL_NO_SOCK)
 | 
			
		||||
	{FUNC_TYPE_GENERAL,"ciphers",ciphers_main},
 | 
			
		||||
#endif
 | 
			
		||||
	{FUNC_TYPE_GENERAL,"nseq",nseq_main},
 | 
			
		||||
 
 | 
			
		||||
@@ -32,7 +32,7 @@ foreach (@ARGV)
 | 
			
		||||
	push(@files,$_);
 | 
			
		||||
	$str="\t{FUNC_TYPE_GENERAL,\"$_\",${_}_main},\n";
 | 
			
		||||
	if (($_ =~ /^s_/) || ($_ =~ /^ciphers$/))
 | 
			
		||||
		{ print "#if !defined(OPENSSL_NO_SOCK) && !(defined(OPENSSL_NO_SSL2) && defined(OPENSSL_NO_SSL3))\n${str}#endif\n"; } 
 | 
			
		||||
		{ print "#if !defined(OPENSSL_NO_SOCK)\n${str}#endif\n"; } 
 | 
			
		||||
	elsif ( ($_ =~ /^speed$/))
 | 
			
		||||
		{ print "#ifndef OPENSSL_NO_SPEED\n${str}#endif\n"; }
 | 
			
		||||
	elsif ( ($_ =~ /^engine$/))
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										28
									
								
								apps/req.c
									
									
									
									
									
								
							
							
						
						
									
										28
									
								
								apps/req.c
									
									
									
									
									
								
							@@ -644,6 +644,11 @@ bad:
 | 
			
		||||
		if (inrand)
 | 
			
		||||
			app_RAND_load_files(inrand);
 | 
			
		||||
 | 
			
		||||
		if (!NCONF_get_number(req_conf,SECTION,BITS, &newkey))
 | 
			
		||||
			{
 | 
			
		||||
			newkey=DEFAULT_KEY_LENGTH;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		if (keyalg)
 | 
			
		||||
			{
 | 
			
		||||
			genctx = set_keygen_ctx(bio_err, keyalg, &pkey_type, &newkey,
 | 
			
		||||
@@ -652,12 +657,6 @@ bad:
 | 
			
		||||
				goto end;
 | 
			
		||||
			}
 | 
			
		||||
	
 | 
			
		||||
		if (newkey <= 0)
 | 
			
		||||
			{
 | 
			
		||||
			if (!NCONF_get_number(req_conf,SECTION,BITS, &newkey))
 | 
			
		||||
				newkey=DEFAULT_KEY_LENGTH;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		if (newkey < MIN_KEY_LENGTH && (pkey_type == EVP_PKEY_RSA || pkey_type == EVP_PKEY_DSA))
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bio_err,"private key length is too short,\n");
 | 
			
		||||
@@ -1490,7 +1489,13 @@ start:
 | 
			
		||||
#ifdef CHARSET_EBCDIC
 | 
			
		||||
	ebcdic2ascii(buf, buf, i);
 | 
			
		||||
#endif
 | 
			
		||||
	if(!req_check_len(i, n_min, n_max)) goto start;
 | 
			
		||||
	if(!req_check_len(i, n_min, n_max))
 | 
			
		||||
		{
 | 
			
		||||
		if (batch || value)
 | 
			
		||||
			return 0;
 | 
			
		||||
		goto start;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (!X509_NAME_add_entry_by_NID(n,nid, chtype,
 | 
			
		||||
				(unsigned char *) buf, -1,-1,mval)) goto err;
 | 
			
		||||
	ret=1;
 | 
			
		||||
@@ -1549,7 +1554,12 @@ start:
 | 
			
		||||
#ifdef CHARSET_EBCDIC
 | 
			
		||||
	ebcdic2ascii(buf, buf, i);
 | 
			
		||||
#endif
 | 
			
		||||
	if(!req_check_len(i, n_min, n_max)) goto start;
 | 
			
		||||
	if(!req_check_len(i, n_min, n_max))
 | 
			
		||||
		{
 | 
			
		||||
		if (batch || value)
 | 
			
		||||
			return 0;
 | 
			
		||||
		goto start;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if(!X509_REQ_add1_attr_by_NID(req, nid, chtype,
 | 
			
		||||
					(unsigned char *)buf, -1)) {
 | 
			
		||||
@@ -1649,6 +1659,8 @@ static EVP_PKEY_CTX *set_keygen_ctx(BIO *err, const char *gstr, int *pkey_type,
 | 
			
		||||
				keylen = atol(p + 1);
 | 
			
		||||
				*pkeylen = keylen;
 | 
			
		||||
				}
 | 
			
		||||
			else
 | 
			
		||||
				keylen = *pkeylen;
 | 
			
		||||
			}
 | 
			
		||||
		else if (p)
 | 
			
		||||
			paramfile = p + 1;
 | 
			
		||||
 
 | 
			
		||||
@@ -747,6 +747,10 @@ void MS_CALLBACK tlsext_cb(SSL *s, int client_server, int type,
 | 
			
		||||
		break;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
		case TLSEXT_TYPE_padding:
 | 
			
		||||
		extname = "TLS padding";
 | 
			
		||||
		break;
 | 
			
		||||
 | 
			
		||||
		default:
 | 
			
		||||
		extname = "unknown";
 | 
			
		||||
		break;
 | 
			
		||||
 
 | 
			
		||||
@@ -290,6 +290,7 @@ static void sc_usage(void)
 | 
			
		||||
	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_return_error - return verification errors\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");
 | 
			
		||||
@@ -300,6 +301,7 @@ static void sc_usage(void)
 | 
			
		||||
	BIO_printf(bio_err," -CAfile arg   - PEM format file of CA's\n");
 | 
			
		||||
	BIO_printf(bio_err," -reconnect    - Drop and re-make the connection with the same Session-ID\n");
 | 
			
		||||
	BIO_printf(bio_err," -pause        - sleep(1) after each read(2) and write(2) system call\n");
 | 
			
		||||
	BIO_printf(bio_err," -prexit       - print session information even on connection failure\n");
 | 
			
		||||
	BIO_printf(bio_err," -showcerts    - show all certificates in the chain\n");
 | 
			
		||||
	BIO_printf(bio_err," -debug        - extra output\n");
 | 
			
		||||
#ifdef WATT32
 | 
			
		||||
@@ -327,14 +329,17 @@ static void sc_usage(void)
 | 
			
		||||
	BIO_printf(bio_err," -srppass arg      - password for 'user'\n");
 | 
			
		||||
	BIO_printf(bio_err," -srp_lateuser     - SRP username into second ClientHello message\n");
 | 
			
		||||
	BIO_printf(bio_err," -srp_moregroups   - Tolerate other than the known g N values.\n");
 | 
			
		||||
	BIO_printf(bio_err," -srp_strength int - minimal mength in bits for N (default %d).\n",SRP_MINIMAL_N);
 | 
			
		||||
	BIO_printf(bio_err," -srp_strength int - minimal length in bits for N (default %d).\n",SRP_MINIMAL_N);
 | 
			
		||||
#endif
 | 
			
		||||
	BIO_printf(bio_err," -ssl2         - just use SSLv2\n");
 | 
			
		||||
#ifndef OPENSSL_NO_SSL3_METHOD
 | 
			
		||||
	BIO_printf(bio_err," -ssl3         - just use SSLv3\n");
 | 
			
		||||
#endif
 | 
			
		||||
	BIO_printf(bio_err," -tls1_2       - just use TLSv1.2\n");
 | 
			
		||||
	BIO_printf(bio_err," -tls1_1       - just use TLSv1.1\n");
 | 
			
		||||
	BIO_printf(bio_err," -tls1         - just use TLSv1\n");
 | 
			
		||||
	BIO_printf(bio_err," -dtls1        - just use DTLSv1\n");    
 | 
			
		||||
	BIO_printf(bio_err," -fallback_scsv - send TLS_FALLBACK_SCSV\n");
 | 
			
		||||
	BIO_printf(bio_err," -mtu          - set the link layer MTU\n");
 | 
			
		||||
	BIO_printf(bio_err," -no_tls1_2/-no_tls1_1/-no_tls1/-no_ssl3/-no_ssl2 - turn off that protocol\n");
 | 
			
		||||
	BIO_printf(bio_err," -bugs         - Switch on all SSL implementation bug workarounds\n");
 | 
			
		||||
@@ -615,6 +620,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	char *sess_out = NULL;
 | 
			
		||||
	struct sockaddr peer;
 | 
			
		||||
	int peerlen = sizeof(peer);
 | 
			
		||||
	int fallback_scsv = 0;
 | 
			
		||||
	int enable_timeouts = 0 ;
 | 
			
		||||
	long socket_mtu = 0;
 | 
			
		||||
#ifndef OPENSSL_NO_JPAKE
 | 
			
		||||
@@ -803,7 +809,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
		else if	(strcmp(*argv,"-ssl2") == 0)
 | 
			
		||||
			meth=SSLv2_client_method();
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_SSL3
 | 
			
		||||
#ifndef OPENSSL_NO_SSL3_METHOD
 | 
			
		||||
		else if	(strcmp(*argv,"-ssl3") == 0)
 | 
			
		||||
			meth=SSLv3_client_method();
 | 
			
		||||
#endif
 | 
			
		||||
@@ -821,6 +827,10 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
			meth=DTLSv1_client_method();
 | 
			
		||||
			socket_type=SOCK_DGRAM;
 | 
			
		||||
			}
 | 
			
		||||
		else if (strcmp(*argv,"-fallback_scsv") == 0)
 | 
			
		||||
			{
 | 
			
		||||
			fallback_scsv = 1;
 | 
			
		||||
			}
 | 
			
		||||
		else if (strcmp(*argv,"-timeout") == 0)
 | 
			
		||||
			enable_timeouts=1;
 | 
			
		||||
		else if (strcmp(*argv,"-mtu") == 0)
 | 
			
		||||
@@ -1233,6 +1243,10 @@ bad:
 | 
			
		||||
		SSL_set_session(con, sess);
 | 
			
		||||
		SSL_SESSION_free(sess);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (fallback_scsv)
 | 
			
		||||
		SSL_set_mode(con, SSL_MODE_SEND_FALLBACK_SCSV);
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_TLSEXT
 | 
			
		||||
	if (servername != NULL)
 | 
			
		||||
		{
 | 
			
		||||
@@ -1307,10 +1321,22 @@ re_start:
 | 
			
		||||
			BIO_ctrl(sbio, BIO_CTRL_DGRAM_SET_SEND_TIMEOUT, 0, &timeout);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		if (socket_mtu > 28)
 | 
			
		||||
		if (socket_mtu)
 | 
			
		||||
			{
 | 
			
		||||
			if(socket_mtu < DTLS_get_link_min_mtu(con))
 | 
			
		||||
				{
 | 
			
		||||
				BIO_printf(bio_err,"MTU too small. Must be at least %ld\n",
 | 
			
		||||
					DTLS_get_link_min_mtu(con));
 | 
			
		||||
				BIO_free(sbio);
 | 
			
		||||
				goto shut;
 | 
			
		||||
				}
 | 
			
		||||
			SSL_set_options(con, SSL_OP_NO_QUERY_MTU);
 | 
			
		||||
			SSL_set_mtu(con, socket_mtu - 28);
 | 
			
		||||
			if(!DTLS_set_link_mtu(con, socket_mtu))
 | 
			
		||||
				{
 | 
			
		||||
				BIO_printf(bio_err, "Failed to set MTU\n");
 | 
			
		||||
				BIO_free(sbio);
 | 
			
		||||
				goto shut;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		else
 | 
			
		||||
			/* want to do MTU discovery */
 | 
			
		||||
 
 | 
			
		||||
@@ -463,6 +463,7 @@ static void sv_usage(void)
 | 
			
		||||
	BIO_printf(bio_err," -context arg  - set session ID context\n");
 | 
			
		||||
	BIO_printf(bio_err," -verify arg   - turn on peer certificate verification\n");
 | 
			
		||||
	BIO_printf(bio_err," -Verify arg   - turn on peer certificate verification, must have a cert.\n");
 | 
			
		||||
	BIO_printf(bio_err," -verify_return_error - return verification errors\n");
 | 
			
		||||
	BIO_printf(bio_err," -cert arg     - certificate file to use\n");
 | 
			
		||||
	BIO_printf(bio_err,"                 (default is %s)\n",TEST_CERT);
 | 
			
		||||
	BIO_printf(bio_err," -crl_check    - check the peer certificate has not been revoked by its CA.\n" \
 | 
			
		||||
@@ -514,7 +515,9 @@ static void sv_usage(void)
 | 
			
		||||
	BIO_printf(bio_err," -srpuserseed string - A seed string for a default user salt.\n");
 | 
			
		||||
#endif
 | 
			
		||||
	BIO_printf(bio_err," -ssl2         - Just talk SSLv2\n");
 | 
			
		||||
#ifndef OPENSSL_NO_SSL3_METHOD
 | 
			
		||||
	BIO_printf(bio_err," -ssl3         - Just talk SSLv3\n");
 | 
			
		||||
#endif
 | 
			
		||||
	BIO_printf(bio_err," -tls1_2       - Just talk TLSv1.2\n");
 | 
			
		||||
	BIO_printf(bio_err," -tls1_1       - Just talk TLSv1.1\n");
 | 
			
		||||
	BIO_printf(bio_err," -tls1         - Just talk TLSv1\n");
 | 
			
		||||
@@ -534,6 +537,7 @@ static void sv_usage(void)
 | 
			
		||||
	BIO_printf(bio_err," -no_ecdhe     - Disable ephemeral ECDH\n");
 | 
			
		||||
#endif
 | 
			
		||||
	BIO_printf(bio_err," -bugs         - Turn on SSL bug compatibility\n");
 | 
			
		||||
	BIO_printf(bio_err," -hack         - workaround for early Netscape code\n");
 | 
			
		||||
	BIO_printf(bio_err," -www          - Respond to a 'GET /' with a status page\n");
 | 
			
		||||
	BIO_printf(bio_err," -WWW          - Respond to a 'GET /<path> HTTP/1.0' with file ./<path>\n");
 | 
			
		||||
	BIO_printf(bio_err," -HTTP         - Respond to a 'GET /<path> HTTP/1.0' with file ./<path>\n");
 | 
			
		||||
@@ -562,6 +566,10 @@ static void sv_usage(void)
 | 
			
		||||
#endif
 | 
			
		||||
	BIO_printf(bio_err," -keymatexport label   - Export keying material using label\n");
 | 
			
		||||
	BIO_printf(bio_err," -keymatexportlen len  - Export len bytes of keying material (default 20)\n");
 | 
			
		||||
	BIO_printf(bio_err," -status           - respond to certificate status requests\n");
 | 
			
		||||
	BIO_printf(bio_err," -status_verbose   - enable status request verbose printout\n");
 | 
			
		||||
	BIO_printf(bio_err," -status_timeout n - status request responder timeout\n");
 | 
			
		||||
	BIO_printf(bio_err," -status_url URL   - status request fallback URL\n");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static int local_argc=0;
 | 
			
		||||
@@ -739,7 +747,7 @@ static int MS_CALLBACK ssl_servername_cb(SSL *s, int *ad, void *arg)
 | 
			
		||||
	
 | 
			
		||||
	if (servername)
 | 
			
		||||
		{
 | 
			
		||||
    		if (strcmp(servername,p->servername)) 
 | 
			
		||||
    		if (strcasecmp(servername,p->servername)) 
 | 
			
		||||
			return p->extension_error;
 | 
			
		||||
		if (ctx2)
 | 
			
		||||
			{
 | 
			
		||||
@@ -1245,7 +1253,7 @@ int MAIN(int argc, char *argv[])
 | 
			
		||||
		else if	(strcmp(*argv,"-ssl2") == 0)
 | 
			
		||||
			{ meth=SSLv2_server_method(); }
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OPENSSL_NO_SSL3
 | 
			
		||||
#ifndef OPENSSL_NO_SSL3_METHOD
 | 
			
		||||
		else if	(strcmp(*argv,"-ssl3") == 0)
 | 
			
		||||
			{ meth=SSLv3_server_method(); }
 | 
			
		||||
#endif
 | 
			
		||||
@@ -1356,6 +1364,14 @@ bad:
 | 
			
		||||
		sv_usage();
 | 
			
		||||
		goto end;
 | 
			
		||||
		}
 | 
			
		||||
#ifndef OPENSSL_NO_DTLS1
 | 
			
		||||
	if (www && socket_type == SOCK_DGRAM)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_printf(bio_err,
 | 
			
		||||
				"Can't use -HTTP, -www or -WWW with DTLS\n");
 | 
			
		||||
		goto end;
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if !defined(OPENSSL_NO_JPAKE) && !defined(OPENSSL_NO_PSK)
 | 
			
		||||
	if (jpake_secret)
 | 
			
		||||
@@ -2035,10 +2051,24 @@ 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 > 28)
 | 
			
		||||
		if (socket_mtu)
 | 
			
		||||
			{
 | 
			
		||||
			if(socket_mtu < DTLS_get_link_min_mtu(con))
 | 
			
		||||
				{
 | 
			
		||||
				BIO_printf(bio_err,"MTU too small. Must be at least %ld\n",
 | 
			
		||||
					DTLS_get_link_min_mtu(con));
 | 
			
		||||
				ret = -1;
 | 
			
		||||
				BIO_free(sbio);
 | 
			
		||||
				goto err;
 | 
			
		||||
				}
 | 
			
		||||
			SSL_set_options(con, SSL_OP_NO_QUERY_MTU);
 | 
			
		||||
			SSL_set_mtu(con, socket_mtu - 28);
 | 
			
		||||
			if(!DTLS_set_link_mtu(con, socket_mtu))
 | 
			
		||||
				{
 | 
			
		||||
				BIO_printf(bio_err, "Failed to set MTU\n");
 | 
			
		||||
				ret = -1;
 | 
			
		||||
				BIO_free(sbio);
 | 
			
		||||
				goto err;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		else
 | 
			
		||||
			/* want to do MTU discovery */
 | 
			
		||||
 
 | 
			
		||||
@@ -274,7 +274,7 @@ static int init_client_ip(int *sock, unsigned char ip[4], int port, int type)
 | 
			
		||||
		{
 | 
			
		||||
		i=0;
 | 
			
		||||
		i=setsockopt(s,SOL_SOCKET,SO_KEEPALIVE,(char *)&i,sizeof(i));
 | 
			
		||||
		if (i < 0) { perror("keepalive"); return(0); }
 | 
			
		||||
		if (i < 0) { closesocket(s); perror("keepalive"); return(0); }
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
@@ -450,6 +450,7 @@ redoit:
 | 
			
		||||
		if ((*host=(char *)OPENSSL_malloc(strlen(h1->h_name)+1)) == NULL)
 | 
			
		||||
			{
 | 
			
		||||
			perror("OPENSSL_malloc");
 | 
			
		||||
			closesocket(ret);
 | 
			
		||||
			return(0);
 | 
			
		||||
			}
 | 
			
		||||
		BUF_strlcpy(*host,h1->h_name,strlen(h1->h_name)+1);
 | 
			
		||||
@@ -458,11 +459,13 @@ redoit:
 | 
			
		||||
		if (h2 == NULL)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bio_err,"gethostbyname failure\n");
 | 
			
		||||
			closesocket(ret);
 | 
			
		||||
			return(0);
 | 
			
		||||
			}
 | 
			
		||||
		if (h2->h_addrtype != AF_INET)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bio_err,"gethostbyname addr is not AF_INET\n");
 | 
			
		||||
			closesocket(ret);
 | 
			
		||||
			return(0);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
@@ -349,13 +349,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	if (bio_err == NULL)
 | 
			
		||||
		bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
 | 
			
		||||
 | 
			
		||||
#if !defined(OPENSSL_NO_SSL2) && !defined(OPENSSL_NO_SSL3)
 | 
			
		||||
	s_time_meth=SSLv23_client_method();
 | 
			
		||||
#elif !defined(OPENSSL_NO_SSL3)
 | 
			
		||||
	s_time_meth=SSLv3_client_method();
 | 
			
		||||
#elif !defined(OPENSSL_NO_SSL2)
 | 
			
		||||
	s_time_meth=SSLv2_client_method();
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	/* parse the command line arguments */
 | 
			
		||||
	if( parseArgs( argc, argv ) < 0 )
 | 
			
		||||
 
 | 
			
		||||
@@ -541,8 +541,8 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
		{
 | 
			
		||||
		if (!cipher)
 | 
			
		||||
			{
 | 
			
		||||
#ifndef OPENSSL_NO_RC2			
 | 
			
		||||
			cipher = EVP_rc2_40_cbc();
 | 
			
		||||
#ifndef OPENSSL_NO_DES			
 | 
			
		||||
			cipher = EVP_des_ede3_cbc();
 | 
			
		||||
#else
 | 
			
		||||
			BIO_printf(bio_err, "No cipher selected\n");
 | 
			
		||||
			goto end;
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										23
									
								
								apps/speed.c
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								apps/speed.c
									
									
									
									
									
								
							@@ -225,7 +225,7 @@
 | 
			
		||||
 | 
			
		||||
#undef BUFSIZE
 | 
			
		||||
#define BUFSIZE	((long)1024*8+1)
 | 
			
		||||
int run=0;
 | 
			
		||||
static volatile int run=0;
 | 
			
		||||
 | 
			
		||||
static int mr=0;
 | 
			
		||||
static int usertime=1;
 | 
			
		||||
@@ -2727,27 +2727,6 @@ static int do_multi(int multi)
 | 
			
		||||
				k=atoi(sstrsep(&p,sep));
 | 
			
		||||
				sstrsep(&p,sep);
 | 
			
		||||
 | 
			
		||||
				d=atof(sstrsep(&p,sep));
 | 
			
		||||
				if(n)
 | 
			
		||||
					rsa_results[k][0]=1/(1/rsa_results[k][0]+1/d);
 | 
			
		||||
				else
 | 
			
		||||
					rsa_results[k][0]=d;
 | 
			
		||||
 | 
			
		||||
				d=atof(sstrsep(&p,sep));
 | 
			
		||||
				if(n)
 | 
			
		||||
					rsa_results[k][1]=1/(1/rsa_results[k][1]+1/d);
 | 
			
		||||
				else
 | 
			
		||||
					rsa_results[k][1]=d;
 | 
			
		||||
				}
 | 
			
		||||
			else if(!strncmp(buf,"+F2:",4))
 | 
			
		||||
				{
 | 
			
		||||
				int k;
 | 
			
		||||
				double d;
 | 
			
		||||
				
 | 
			
		||||
				p=buf+4;
 | 
			
		||||
				k=atoi(sstrsep(&p,sep));
 | 
			
		||||
				sstrsep(&p,sep);
 | 
			
		||||
 | 
			
		||||
				d=atof(sstrsep(&p,sep));
 | 
			
		||||
				if(n)
 | 
			
		||||
					rsa_results[k][0]=1/(1/rsa_results[k][0]+1/d);
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								config
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								config
									
									
									
									
									
								
							@@ -739,7 +739,7 @@ case "$GUESSOS" in
 | 
			
		||||
			    libc=/usr/lib/libc.so
 | 
			
		||||
			else					# OpenBSD
 | 
			
		||||
			    # ld searches for highest libc.so.* and so do we
 | 
			
		||||
			    libc=`(ls /usr/lib/libc.so.* | tail -1) 2>/dev/null`
 | 
			
		||||
			    libc=`(ls /usr/lib/libc.so.* /lib/libc.so.* | tail -1) 2>/dev/null`
 | 
			
		||||
			fi
 | 
			
		||||
			case "`(file -L $libc) 2>/dev/null`" in
 | 
			
		||||
			*ELF*)	OUT="BSD-x86-elf" ;;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,3 @@
 | 
			
		||||
/* $LP: LPlib/source/LPdir_vms.c,v 1.20 2004/08/26 13:36:05 _cvs_levitte Exp $ */
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 2004, Richard Levitte <richard@levitte.org>
 | 
			
		||||
 * All rights reserved.
 | 
			
		||||
@@ -88,6 +87,12 @@ const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory)
 | 
			
		||||
      size_t filespeclen = strlen(directory);
 | 
			
		||||
      char *filespec = NULL;
 | 
			
		||||
 | 
			
		||||
      if (filespeclen == 0)
 | 
			
		||||
	{
 | 
			
		||||
	  errno = ENOENT;
 | 
			
		||||
	  return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
      /* MUST be a VMS directory specification!  Let's estimate if it is. */
 | 
			
		||||
      if (directory[filespeclen-1] != ']'
 | 
			
		||||
	  && directory[filespeclen-1] != '>'
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,3 @@
 | 
			
		||||
/* $LP: LPlib/source/LPdir_win.c,v 1.10 2004/08/26 13:36:05 _cvs_levitte Exp $ */
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 2004, Richard Levitte <richard@levitte.org>
 | 
			
		||||
 * All rights reserved.
 | 
			
		||||
@@ -37,7 +36,7 @@
 | 
			
		||||
#if defined(LP_SYS_WINCE) && !defined(FindFirstFile)
 | 
			
		||||
# define FindFirstFile FindFirstFileW
 | 
			
		||||
#endif
 | 
			
		||||
#if defined(LP_SYS_WINCE) && !defined(FindFirstFile)
 | 
			
		||||
#if defined(LP_SYS_WINCE) && !defined(FindNextFile)
 | 
			
		||||
# define FindNextFile FindNextFileW
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
@@ -63,6 +62,16 @@ const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory)
 | 
			
		||||
  errno = 0;
 | 
			
		||||
  if (*ctx == NULL)
 | 
			
		||||
    {
 | 
			
		||||
      const char *extdir = directory;
 | 
			
		||||
      char *extdirbuf = NULL;
 | 
			
		||||
      size_t dirlen = strlen (directory);
 | 
			
		||||
 | 
			
		||||
      if (dirlen == 0)
 | 
			
		||||
	{
 | 
			
		||||
	  errno = ENOENT;
 | 
			
		||||
	  return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
      *ctx = (LP_DIR_CTX *)malloc(sizeof(LP_DIR_CTX));
 | 
			
		||||
      if (*ctx == NULL)
 | 
			
		||||
	{
 | 
			
		||||
@@ -71,15 +80,35 @@ const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory)
 | 
			
		||||
	}
 | 
			
		||||
      memset(*ctx, '\0', sizeof(LP_DIR_CTX));
 | 
			
		||||
 | 
			
		||||
      if (directory[dirlen-1] != '*')
 | 
			
		||||
	{
 | 
			
		||||
	  extdirbuf = (char *)malloc(dirlen + 3);
 | 
			
		||||
	  if (extdirbuf == NULL)
 | 
			
		||||
	    {
 | 
			
		||||
	      free(*ctx);
 | 
			
		||||
	      *ctx = NULL;
 | 
			
		||||
	      errno = ENOMEM;
 | 
			
		||||
	      return 0;
 | 
			
		||||
	    }
 | 
			
		||||
	  if (directory[dirlen-1] != '/' && directory[dirlen-1] != '\\')
 | 
			
		||||
	    extdir = strcat(strcpy (extdirbuf,directory),"/*");
 | 
			
		||||
	  else
 | 
			
		||||
	    extdir = strcat(strcpy (extdirbuf,directory),"*");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
      if (sizeof(TCHAR) != sizeof(char))
 | 
			
		||||
	{
 | 
			
		||||
	  TCHAR *wdir = NULL;
 | 
			
		||||
	  /* len_0 denotes string length *with* trailing 0 */ 
 | 
			
		||||
	  size_t index = 0,len_0 = strlen(directory) + 1;
 | 
			
		||||
	  size_t index = 0,len_0 = strlen(extdir) + 1;
 | 
			
		||||
 | 
			
		||||
	  wdir = (TCHAR *)malloc(len_0 * sizeof(TCHAR));
 | 
			
		||||
	  wdir = (TCHAR *)calloc(len_0, sizeof(TCHAR));
 | 
			
		||||
	  if (wdir == NULL)
 | 
			
		||||
	    {
 | 
			
		||||
	      if (extdirbuf != NULL)
 | 
			
		||||
		{
 | 
			
		||||
		  free (extdirbuf);
 | 
			
		||||
		}
 | 
			
		||||
	      free(*ctx);
 | 
			
		||||
	      *ctx = NULL;
 | 
			
		||||
	      errno = ENOMEM;
 | 
			
		||||
@@ -87,17 +116,23 @@ const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory)
 | 
			
		||||
	    }
 | 
			
		||||
 | 
			
		||||
#ifdef LP_MULTIBYTE_AVAILABLE
 | 
			
		||||
	  if (!MultiByteToWideChar(CP_ACP, 0, directory, len_0, (WCHAR *)wdir, len_0))
 | 
			
		||||
	  if (!MultiByteToWideChar(CP_ACP, 0, extdir, len_0, (WCHAR *)wdir, len_0))
 | 
			
		||||
#endif
 | 
			
		||||
	    for (index = 0; index < len_0; index++)
 | 
			
		||||
	      wdir[index] = (TCHAR)directory[index];
 | 
			
		||||
	      wdir[index] = (TCHAR)extdir[index];
 | 
			
		||||
 | 
			
		||||
	  (*ctx)->handle = FindFirstFile(wdir, &(*ctx)->ctx);
 | 
			
		||||
 | 
			
		||||
	  free(wdir);
 | 
			
		||||
	}
 | 
			
		||||
      else
 | 
			
		||||
	(*ctx)->handle = FindFirstFile((TCHAR *)directory, &(*ctx)->ctx);
 | 
			
		||||
	{
 | 
			
		||||
	  (*ctx)->handle = FindFirstFile((TCHAR *)extdir, &(*ctx)->ctx);
 | 
			
		||||
	}
 | 
			
		||||
      if (extdirbuf != NULL)
 | 
			
		||||
	{
 | 
			
		||||
	  free (extdirbuf);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
      if ((*ctx)->handle == INVALID_HANDLE_VALUE)
 | 
			
		||||
	{
 | 
			
		||||
@@ -114,7 +149,6 @@ const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory)
 | 
			
		||||
	  return 0;
 | 
			
		||||
	}
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  if (sizeof(TCHAR) != sizeof(char))
 | 
			
		||||
    {
 | 
			
		||||
      TCHAR *wdir = (*ctx)->ctx.cFileName;
 | 
			
		||||
 
 | 
			
		||||
@@ -31,6 +31,7 @@ CPUID_OBJ=mem_clr.o
 | 
			
		||||
LIBS=
 | 
			
		||||
 | 
			
		||||
GENERAL=Makefile README crypto-lib.com install.com
 | 
			
		||||
TEST=constant_time_test.c
 | 
			
		||||
 | 
			
		||||
LIB= $(TOP)/libcrypto.a
 | 
			
		||||
SHARED_LIB= libcrypto$(SHLIB_EXT)
 | 
			
		||||
@@ -43,7 +44,8 @@ SRC= $(LIBSRC)
 | 
			
		||||
 | 
			
		||||
EXHEADER= crypto.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)
 | 
			
		||||
HEADER=	cryptlib.h buildinf.h md32_common.h o_time.h o_str.h o_dir.h \
 | 
			
		||||
	constant_time_locl.h $(EXHEADER)
 | 
			
		||||
 | 
			
		||||
ALL=    $(GENERAL) $(SRC) $(HEADER)
 | 
			
		||||
 | 
			
		||||
@@ -53,12 +55,7 @@ top:
 | 
			
		||||
all: shared
 | 
			
		||||
 | 
			
		||||
buildinf.h: ../Makefile
 | 
			
		||||
	( echo "#ifndef MK1MF_BUILD"; \
 | 
			
		||||
	echo '  /* auto-generated by crypto/Makefile for crypto/cversion.c */'; \
 | 
			
		||||
	echo '  #define CFLAGS "$(CC) $(CFLAG)"'; \
 | 
			
		||||
	echo '  #define PLATFORM "$(PLATFORM)"'; \
 | 
			
		||||
	echo "  #define DATE \"`LC_ALL=C LC_TIME=C date`\""; \
 | 
			
		||||
	echo '#endif' ) >buildinf.h
 | 
			
		||||
	$(PERL) $(TOP)/util/mkbuildinf.pl "$(CC) $(CFLAGS)" "$(PLATFORM)" >buildinf.h
 | 
			
		||||
 | 
			
		||||
x86cpuid.s:	x86cpuid.pl perlasm/x86asm.pl
 | 
			
		||||
	$(PERL) x86cpuid.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
 | 
			
		||||
@@ -77,7 +74,9 @@ ia64cpuid.s: ia64cpuid.S;	$(CC) $(CFLAGS) -E ia64cpuid.S > $@
 | 
			
		||||
ppccpuid.s:	ppccpuid.pl;	$(PERL) ppccpuid.pl $(PERLASM_SCHEME) $@
 | 
			
		||||
pariscid.s:	pariscid.pl;	$(PERL) pariscid.pl $(PERLASM_SCHEME) $@
 | 
			
		||||
alphacpuid.s:	alphacpuid.pl
 | 
			
		||||
	$(PERL) $< | $(CC) -E - | tee $@ > /dev/null
 | 
			
		||||
	(preproc=/tmp/$$$$.$@; trap "rm $$preproc" INT; \
 | 
			
		||||
	$(PERL) alphacpuid.pl > $$preproc && \
 | 
			
		||||
	$(CC) -E $$preproc > $@ && rm $$preproc)
 | 
			
		||||
 | 
			
		||||
testapps:
 | 
			
		||||
	[ -z "$(THIS)" ] || (	if echo $(SDIRS) | fgrep ' des '; \
 | 
			
		||||
 
 | 
			
		||||
@@ -70,7 +70,7 @@ $pf = ($flavour =~ /nubi/i) ? $t0 : $t2;
 | 
			
		||||
#
 | 
			
		||||
######################################################################
 | 
			
		||||
 | 
			
		||||
$big_endian=(`echo MIPSEL | $ENV{CC} -E -P -`=~/MIPSEL/)?1:0;
 | 
			
		||||
$big_endian=(`echo MIPSEL | $ENV{CC} -E -`=~/MIPSEL/)?1:0 if ($ENV{CC});
 | 
			
		||||
 | 
			
		||||
for (@ARGV) {	$output=$_ if (/^\w[\w\-]*\.\w+$/);	}
 | 
			
		||||
open STDOUT,">$output";
 | 
			
		||||
 
 | 
			
		||||
@@ -1015,7 +1015,8 @@ foreach (split("\n",$code)) {
 | 
			
		||||
		$SIZE_T==4 ? sprintf("extru%s,%d,8,",$1,31-$2)
 | 
			
		||||
		:            sprintf("extrd,u%s,%d,8,",$1,63-$2)/e;
 | 
			
		||||
 | 
			
		||||
	s/,\*/,/ if ($SIZE_T==4);
 | 
			
		||||
	s/,\*/,/			if ($SIZE_T==4);
 | 
			
		||||
	s/\bbv\b(.*\(%r2\))/bve$1/	if ($SIZE_T==8);
 | 
			
		||||
	print $_,"\n";
 | 
			
		||||
}
 | 
			
		||||
close STDOUT;
 | 
			
		||||
 
 | 
			
		||||
@@ -525,6 +525,16 @@ $code.=<<___;
 | 
			
		||||
.type	aesni_ecb_encrypt,\@function,5
 | 
			
		||||
.align	16
 | 
			
		||||
aesni_ecb_encrypt:
 | 
			
		||||
___
 | 
			
		||||
$code.=<<___ if ($win64);
 | 
			
		||||
	lea	-0x58(%rsp),%rsp
 | 
			
		||||
	movaps	%xmm6,(%rsp)
 | 
			
		||||
	movaps	%xmm7,0x10(%rsp)
 | 
			
		||||
	movaps	%xmm8,0x20(%rsp)
 | 
			
		||||
	movaps	%xmm9,0x30(%rsp)
 | 
			
		||||
.Lecb_enc_body:
 | 
			
		||||
___
 | 
			
		||||
$code.=<<___;
 | 
			
		||||
	and	\$-16,$len
 | 
			
		||||
	jz	.Lecb_ret
 | 
			
		||||
 | 
			
		||||
@@ -805,6 +815,16 @@ $code.=<<___;
 | 
			
		||||
	movups	$inout5,0x50($out)
 | 
			
		||||
 | 
			
		||||
.Lecb_ret:
 | 
			
		||||
___
 | 
			
		||||
$code.=<<___ if ($win64);
 | 
			
		||||
	movaps	(%rsp),%xmm6
 | 
			
		||||
	movaps	0x10(%rsp),%xmm7
 | 
			
		||||
	movaps	0x20(%rsp),%xmm8
 | 
			
		||||
	movaps	0x30(%rsp),%xmm9
 | 
			
		||||
	lea	0x58(%rsp),%rsp
 | 
			
		||||
.Lecb_enc_ret:
 | 
			
		||||
___
 | 
			
		||||
$code.=<<___;
 | 
			
		||||
	ret
 | 
			
		||||
.size	aesni_ecb_encrypt,.-aesni_ecb_encrypt
 | 
			
		||||
___
 | 
			
		||||
@@ -2730,28 +2750,9 @@ $code.=<<___;
 | 
			
		||||
.extern	__imp_RtlVirtualUnwind
 | 
			
		||||
___
 | 
			
		||||
$code.=<<___ if ($PREFIX eq "aesni");
 | 
			
		||||
.type	ecb_se_handler,\@abi-omnipotent
 | 
			
		||||
.type	ecb_ccm64_se_handler,\@abi-omnipotent
 | 
			
		||||
.align	16
 | 
			
		||||
ecb_se_handler:
 | 
			
		||||
	push	%rsi
 | 
			
		||||
	push	%rdi
 | 
			
		||||
	push	%rbx
 | 
			
		||||
	push	%rbp
 | 
			
		||||
	push	%r12
 | 
			
		||||
	push	%r13
 | 
			
		||||
	push	%r14
 | 
			
		||||
	push	%r15
 | 
			
		||||
	pushfq
 | 
			
		||||
	sub	\$64,%rsp
 | 
			
		||||
 | 
			
		||||
	mov	152($context),%rax	# pull context->Rsp
 | 
			
		||||
 | 
			
		||||
	jmp	.Lcommon_seh_tail
 | 
			
		||||
.size	ecb_se_handler,.-ecb_se_handler
 | 
			
		||||
 | 
			
		||||
.type	ccm64_se_handler,\@abi-omnipotent
 | 
			
		||||
.align	16
 | 
			
		||||
ccm64_se_handler:
 | 
			
		||||
ecb_ccm64_se_handler:
 | 
			
		||||
	push	%rsi
 | 
			
		||||
	push	%rdi
 | 
			
		||||
	push	%rbx
 | 
			
		||||
@@ -2788,7 +2789,7 @@ ccm64_se_handler:
 | 
			
		||||
	lea	0x58(%rax),%rax		# adjust stack pointer
 | 
			
		||||
 | 
			
		||||
	jmp	.Lcommon_seh_tail
 | 
			
		||||
.size	ccm64_se_handler,.-ccm64_se_handler
 | 
			
		||||
.size	ecb_ccm64_se_handler,.-ecb_ccm64_se_handler
 | 
			
		||||
 | 
			
		||||
.type	ctr32_se_handler,\@abi-omnipotent
 | 
			
		||||
.align	16
 | 
			
		||||
@@ -2993,14 +2994,15 @@ ___
 | 
			
		||||
$code.=<<___ if ($PREFIX eq "aesni");
 | 
			
		||||
.LSEH_info_ecb:
 | 
			
		||||
	.byte	9,0,0,0
 | 
			
		||||
	.rva	ecb_se_handler
 | 
			
		||||
	.rva	ecb_ccm64_se_handler
 | 
			
		||||
	.rva	.Lecb_enc_body,.Lecb_enc_ret		# HandlerData[]
 | 
			
		||||
.LSEH_info_ccm64_enc:
 | 
			
		||||
	.byte	9,0,0,0
 | 
			
		||||
	.rva	ccm64_se_handler
 | 
			
		||||
	.rva	ecb_ccm64_se_handler
 | 
			
		||||
	.rva	.Lccm64_enc_body,.Lccm64_enc_ret	# HandlerData[]
 | 
			
		||||
.LSEH_info_ccm64_dec:
 | 
			
		||||
	.byte	9,0,0,0
 | 
			
		||||
	.rva	ccm64_se_handler
 | 
			
		||||
	.rva	ecb_ccm64_se_handler
 | 
			
		||||
	.rva	.Lccm64_dec_body,.Lccm64_dec_ret	# HandlerData[]
 | 
			
		||||
.LSEH_info_ctr32:
 | 
			
		||||
	.byte	9,0,0,0
 | 
			
		||||
 
 | 
			
		||||
@@ -83,9 +83,9 @@
 | 
			
		||||
# Add decryption procedure. Performance in CPU cycles spent to decrypt
 | 
			
		||||
# one byte out of 4096-byte buffer with 128-bit key is:
 | 
			
		||||
#
 | 
			
		||||
# Core 2	11.0
 | 
			
		||||
# Nehalem	9.16
 | 
			
		||||
# Atom		20.9
 | 
			
		||||
# Core 2	9.83
 | 
			
		||||
# Nehalem	7.74
 | 
			
		||||
# Atom		19.0
 | 
			
		||||
#
 | 
			
		||||
# November 2011.
 | 
			
		||||
#
 | 
			
		||||
@@ -456,6 +456,7 @@ sub MixColumns {
 | 
			
		||||
# modified to emit output in order suitable for feeding back to aesenc[last]
 | 
			
		||||
my @x=@_[0..7];
 | 
			
		||||
my @t=@_[8..15];
 | 
			
		||||
my $inv=@_[16];	# optional
 | 
			
		||||
$code.=<<___;
 | 
			
		||||
	pshufd	\$0x93, @x[0], @t[0]	# x0 <<< 32
 | 
			
		||||
	pshufd	\$0x93, @x[1], @t[1]
 | 
			
		||||
@@ -497,7 +498,8 @@ $code.=<<___;
 | 
			
		||||
	pxor	@t[4], @t[0]
 | 
			
		||||
	 pshufd	\$0x4E, @x[2], @x[6]
 | 
			
		||||
	pxor	@t[5], @t[1]
 | 
			
		||||
 | 
			
		||||
___
 | 
			
		||||
$code.=<<___ if (!$inv);
 | 
			
		||||
	pxor	@t[3], @x[4]
 | 
			
		||||
	pxor	@t[7], @x[5]
 | 
			
		||||
	pxor	@t[6], @x[3]
 | 
			
		||||
@@ -505,9 +507,20 @@ $code.=<<___;
 | 
			
		||||
	pxor	@t[2], @x[6]
 | 
			
		||||
	 movdqa	@t[1], @x[7]
 | 
			
		||||
___
 | 
			
		||||
$code.=<<___ if ($inv);
 | 
			
		||||
	pxor	@x[4], @t[3]
 | 
			
		||||
	pxor	@t[7], @x[5]
 | 
			
		||||
	pxor	@x[3], @t[6]
 | 
			
		||||
	 movdqa	@t[0], @x[3]
 | 
			
		||||
	pxor	@t[2], @x[6]
 | 
			
		||||
	 movdqa	@t[6], @x[2]
 | 
			
		||||
	 movdqa	@t[1], @x[7]
 | 
			
		||||
	 movdqa	@x[6], @x[4]
 | 
			
		||||
	 movdqa	@t[3], @x[6]
 | 
			
		||||
___
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub InvMixColumns {
 | 
			
		||||
sub InvMixColumns_orig {
 | 
			
		||||
my @x=@_[0..7];
 | 
			
		||||
my @t=@_[8..15];
 | 
			
		||||
 | 
			
		||||
@@ -661,6 +674,54 @@ $code.=<<___;
 | 
			
		||||
___
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub InvMixColumns {
 | 
			
		||||
my @x=@_[0..7];
 | 
			
		||||
my @t=@_[8..15];
 | 
			
		||||
 | 
			
		||||
# Thanks to Jussi Kivilinna for providing pointer to
 | 
			
		||||
#
 | 
			
		||||
# | 0e 0b 0d 09 |   | 02 03 01 01 |   | 05 00 04 00 |
 | 
			
		||||
# | 09 0e 0b 0d | = | 01 02 03 01 | x | 00 05 00 04 |
 | 
			
		||||
# | 0d 09 0e 0b |   | 01 01 02 03 |   | 04 00 05 00 |
 | 
			
		||||
# | 0b 0d 09 0e |   | 03 01 01 02 |   | 00 04 00 05 |
 | 
			
		||||
 | 
			
		||||
$code.=<<___;
 | 
			
		||||
	# multiplication by 0x05-0x00-0x04-0x00
 | 
			
		||||
	pshufd	\$0x4E, @x[0], @t[0]
 | 
			
		||||
	pshufd	\$0x4E, @x[6], @t[6]
 | 
			
		||||
	pxor	@x[0], @t[0]
 | 
			
		||||
	pshufd	\$0x4E, @x[7], @t[7]
 | 
			
		||||
	pxor	@x[6], @t[6]
 | 
			
		||||
	pshufd	\$0x4E, @x[1], @t[1]
 | 
			
		||||
	pxor	@x[7], @t[7]
 | 
			
		||||
	pshufd	\$0x4E, @x[2], @t[2]
 | 
			
		||||
	pxor	@x[1], @t[1]
 | 
			
		||||
	pshufd	\$0x4E, @x[3], @t[3]
 | 
			
		||||
	pxor	@x[2], @t[2]
 | 
			
		||||
	 pxor	@t[6], @x[0]
 | 
			
		||||
	 pxor	@t[6], @x[1]
 | 
			
		||||
	pshufd	\$0x4E, @x[4], @t[4]
 | 
			
		||||
	pxor	@x[3], @t[3]
 | 
			
		||||
	 pxor	@t[0], @x[2]
 | 
			
		||||
	 pxor	@t[1], @x[3]
 | 
			
		||||
	pshufd	\$0x4E, @x[5], @t[5]
 | 
			
		||||
	pxor	@x[4], @t[4]
 | 
			
		||||
	 pxor	@t[7], @x[1]
 | 
			
		||||
	 pxor	@t[2], @x[4]
 | 
			
		||||
	pxor	@x[5], @t[5]
 | 
			
		||||
 | 
			
		||||
	 pxor	@t[7], @x[2]
 | 
			
		||||
	 pxor	@t[6], @x[3]
 | 
			
		||||
	 pxor	@t[6], @x[4]
 | 
			
		||||
	 pxor	@t[3], @x[5]
 | 
			
		||||
	 pxor	@t[4], @x[6]
 | 
			
		||||
	 pxor	@t[7], @x[4]
 | 
			
		||||
	 pxor	@t[7], @x[5]
 | 
			
		||||
	 pxor	@t[5], @x[7]
 | 
			
		||||
___
 | 
			
		||||
	&MixColumns	(@x,@t,1);	# flipped 2<->3 and 4<->6
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub aesenc {				# not used
 | 
			
		||||
my @b=@_[0..7];
 | 
			
		||||
my @t=@_[8..15];
 | 
			
		||||
@@ -2028,6 +2089,8 @@ ___
 | 
			
		||||
#	const unsigned char iv[16]);
 | 
			
		||||
#
 | 
			
		||||
my ($twmask,$twres,$twtmp)=@XMM[13..15];
 | 
			
		||||
$arg6=~s/d$//;
 | 
			
		||||
 | 
			
		||||
$code.=<<___;
 | 
			
		||||
.globl	bsaes_xts_encrypt
 | 
			
		||||
.type	bsaes_xts_encrypt,\@abi-omnipotent
 | 
			
		||||
 
 | 
			
		||||
@@ -1060,7 +1060,7 @@ _vpaes_consts:
 | 
			
		||||
.Lk_dsbo:	# decryption sbox final output
 | 
			
		||||
	.quad	0x1387EA537EF94000, 0xC7AA6DB9D4943E2D
 | 
			
		||||
	.quad	0x12D7560F93441D00, 0xCA4B8159D8C58E9C
 | 
			
		||||
.asciz	"Vector Permutaion AES for x86_64/SSSE3, Mike Hamburg (Stanford University)"
 | 
			
		||||
.asciz	"Vector Permutation AES for x86_64/SSSE3, Mike Hamburg (Stanford University)"
 | 
			
		||||
.align	64
 | 
			
		||||
.size	_vpaes_consts,.-_vpaes_consts
 | 
			
		||||
___
 | 
			
		||||
 
 | 
			
		||||
@@ -23,7 +23,7 @@ unsigned int _armv7_tick(void);
 | 
			
		||||
 | 
			
		||||
unsigned int OPENSSL_rdtsc(void)
 | 
			
		||||
	{
 | 
			
		||||
	if (OPENSSL_armcap_P|ARMV7_TICK)
 | 
			
		||||
	if (OPENSSL_armcap_P & ARMV7_TICK)
 | 
			
		||||
		return _armv7_tick();
 | 
			
		||||
	else
 | 
			
		||||
		return 0;
 | 
			
		||||
 
 | 
			
		||||
@@ -136,11 +136,16 @@ ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,
 | 
			
		||||
 | 
			
		||||
	p= *pp;
 | 
			
		||||
	i= *(p++);
 | 
			
		||||
	if (i > 7)
 | 
			
		||||
		{
 | 
			
		||||
		i=ASN1_R_INVALID_BIT_STRING_BITS_LEFT;
 | 
			
		||||
		goto err;
 | 
			
		||||
		}
 | 
			
		||||
	/* We do this to preserve the settings.  If we modify
 | 
			
		||||
	 * the settings, via the _set_bit function, we will recalculate
 | 
			
		||||
	 * on output */
 | 
			
		||||
	ret->flags&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07); /* clear */
 | 
			
		||||
	ret->flags|=(ASN1_STRING_FLAG_BITS_LEFT|(i&0x07)); /* set */
 | 
			
		||||
	ret->flags|=(ASN1_STRING_FLAG_BITS_LEFT|i); /* set */
 | 
			
		||||
 | 
			
		||||
	if (len-- > 1) /* using one because of the bits left byte */
 | 
			
		||||
		{
 | 
			
		||||
 
 | 
			
		||||
@@ -116,7 +116,7 @@ int i2c_ASN1_INTEGER(ASN1_INTEGER *a, unsigned char **pp)
 | 
			
		||||
	int pad=0,ret,i,neg;
 | 
			
		||||
	unsigned char *p,*n,pb=0;
 | 
			
		||||
 | 
			
		||||
	if ((a == NULL) || (a->data == NULL)) return(0);
 | 
			
		||||
	if (a == NULL) return(0);
 | 
			
		||||
	neg=a->type & V_ASN1_NEG;
 | 
			
		||||
	if (a->length == 0)
 | 
			
		||||
		ret=1;
 | 
			
		||||
 
 | 
			
		||||
@@ -283,17 +283,29 @@ err:
 | 
			
		||||
	ASN1err(ASN1_F_D2I_ASN1_OBJECT,i);
 | 
			
		||||
	return(NULL);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
 | 
			
		||||
	     long len)
 | 
			
		||||
	{
 | 
			
		||||
	ASN1_OBJECT *ret=NULL;
 | 
			
		||||
	const unsigned char *p;
 | 
			
		||||
	unsigned char *data;
 | 
			
		||||
	int i;
 | 
			
		||||
	/* Sanity check OID encoding: can't have leading 0x80 in
 | 
			
		||||
	 * subidentifiers, see: X.690 8.19.2
 | 
			
		||||
	int i, length;
 | 
			
		||||
 | 
			
		||||
	/* Sanity check OID encoding.
 | 
			
		||||
	 * Need at least one content octet.
 | 
			
		||||
	 * MSB must be clear in the last octet.
 | 
			
		||||
	 * can't have leading 0x80 in subidentifiers, see: X.690 8.19.2
 | 
			
		||||
	 */
 | 
			
		||||
	for (i = 0, p = *pp; i < len; i++, p++)
 | 
			
		||||
	if (len <= 0 || len > INT_MAX || pp == NULL || (p = *pp) == NULL ||
 | 
			
		||||
	    p[len - 1] & 0x80)
 | 
			
		||||
		{
 | 
			
		||||
		ASN1err(ASN1_F_C2I_ASN1_OBJECT,ASN1_R_INVALID_OBJECT_ENCODING);
 | 
			
		||||
		return NULL;
 | 
			
		||||
		}
 | 
			
		||||
	/* Now 0 < len <= INT_MAX, so the cast is safe. */
 | 
			
		||||
	length = (int)len;
 | 
			
		||||
	for (i = 0; i < length; i++, p++)
 | 
			
		||||
		{
 | 
			
		||||
		if (*p == 0x80 && (!i || !(p[-1] & 0x80)))
 | 
			
		||||
			{
 | 
			
		||||
@@ -316,23 +328,23 @@ ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
 | 
			
		||||
	data = (unsigned char *)ret->data;
 | 
			
		||||
	ret->data = NULL;
 | 
			
		||||
	/* once detached we can change it */
 | 
			
		||||
	if ((data == NULL) || (ret->length < len))
 | 
			
		||||
	if ((data == NULL) || (ret->length < length))
 | 
			
		||||
		{
 | 
			
		||||
		ret->length=0;
 | 
			
		||||
		if (data != NULL) OPENSSL_free(data);
 | 
			
		||||
		data=(unsigned char *)OPENSSL_malloc(len ? (int)len : 1);
 | 
			
		||||
		data=(unsigned char *)OPENSSL_malloc(length);
 | 
			
		||||
		if (data == NULL)
 | 
			
		||||
			{ i=ERR_R_MALLOC_FAILURE; goto err; }
 | 
			
		||||
		ret->flags|=ASN1_OBJECT_FLAG_DYNAMIC_DATA;
 | 
			
		||||
		}
 | 
			
		||||
	memcpy(data,p,(int)len);
 | 
			
		||||
	memcpy(data,p,length);
 | 
			
		||||
	/* reattach data to object, after which it remains const */
 | 
			
		||||
	ret->data  =data;
 | 
			
		||||
	ret->length=(int)len;
 | 
			
		||||
	ret->length=length;
 | 
			
		||||
	ret->sn=NULL;
 | 
			
		||||
	ret->ln=NULL;
 | 
			
		||||
	/* ret->flags=ASN1_OBJECT_FLAG_DYNAMIC; we know it is dynamic */
 | 
			
		||||
	p+=len;
 | 
			
		||||
	p+=length;
 | 
			
		||||
 | 
			
		||||
	if (a != NULL) (*a)=ret;
 | 
			
		||||
	*pp=p;
 | 
			
		||||
 
 | 
			
		||||
@@ -568,6 +568,7 @@ int ASN1_STRING_to_UTF8(unsigned char **out, ASN1_STRING *in)
 | 
			
		||||
	mbflag |= MBSTRING_FLAG;
 | 
			
		||||
	stmp.data = NULL;
 | 
			
		||||
	stmp.length = 0;
 | 
			
		||||
	stmp.flags = 0;
 | 
			
		||||
	ret = ASN1_mbstring_copy(&str, in->data, in->length, mbflag, B_ASN1_UTF8STRING);
 | 
			
		||||
	if(ret < 0) return ret;
 | 
			
		||||
	*out = stmp.data;
 | 
			
		||||
 
 | 
			
		||||
@@ -74,7 +74,7 @@ static int sk_table_cmp(const ASN1_STRING_TABLE * const *a,
 | 
			
		||||
 * certain software (e.g. Netscape) has problems with them.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
static unsigned long global_mask = 0xFFFFFFFFL;
 | 
			
		||||
static unsigned long global_mask = B_ASN1_UTF8STRING;
 | 
			
		||||
 | 
			
		||||
void ASN1_STRING_set_default_mask(unsigned long mask)
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -113,7 +113,7 @@ 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 ASN1_TYPE_cmp(const ASN1_TYPE *a, const ASN1_TYPE *b)
 | 
			
		||||
	{
 | 
			
		||||
	int result = -1;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -196,24 +196,29 @@ ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t,
 | 
			
		||||
	struct tm *ts;
 | 
			
		||||
	struct tm data;
 | 
			
		||||
	size_t len = 20;
 | 
			
		||||
	int free_s = 0;
 | 
			
		||||
 | 
			
		||||
	if (s == NULL)
 | 
			
		||||
		{
 | 
			
		||||
		free_s = 1;
 | 
			
		||||
		s=M_ASN1_UTCTIME_new();
 | 
			
		||||
		}
 | 
			
		||||
	if (s == NULL)
 | 
			
		||||
		return(NULL);
 | 
			
		||||
		goto err;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	ts=OPENSSL_gmtime(&t, &data);
 | 
			
		||||
	if (ts == NULL)
 | 
			
		||||
		return(NULL);
 | 
			
		||||
		goto err;
 | 
			
		||||
 | 
			
		||||
	if (offset_day || offset_sec)
 | 
			
		||||
		{ 
 | 
			
		||||
		if (!OPENSSL_gmtime_adj(ts, offset_day, offset_sec))
 | 
			
		||||
			return NULL;
 | 
			
		||||
			goto err;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if((ts->tm_year < 50) || (ts->tm_year >= 150))
 | 
			
		||||
		return NULL;
 | 
			
		||||
		goto err;
 | 
			
		||||
 | 
			
		||||
	p=(char *)s->data;
 | 
			
		||||
	if ((p == NULL) || ((size_t)s->length < len))
 | 
			
		||||
@@ -222,7 +227,7 @@ ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t,
 | 
			
		||||
		if (p == NULL)
 | 
			
		||||
			{
 | 
			
		||||
			ASN1err(ASN1_F_ASN1_UTCTIME_ADJ,ERR_R_MALLOC_FAILURE);
 | 
			
		||||
			return(NULL);
 | 
			
		||||
			goto err;
 | 
			
		||||
			}
 | 
			
		||||
		if (s->data != NULL)
 | 
			
		||||
			OPENSSL_free(s->data);
 | 
			
		||||
@@ -237,6 +242,10 @@ ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t,
 | 
			
		||||
	ebcdic2ascii(s->data, s->data, s->length);
 | 
			
		||||
#endif
 | 
			
		||||
	return(s);
 | 
			
		||||
	err:
 | 
			
		||||
	if (free_s && s)
 | 
			
		||||
		M_ASN1_UTCTIME_free(s);
 | 
			
		||||
	return NULL;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -261,6 +270,11 @@ int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t)
 | 
			
		||||
	t -= offset*60; /* FIXME: may overflow in extreme cases */
 | 
			
		||||
 | 
			
		||||
	tm = OPENSSL_gmtime(&t, &data);
 | 
			
		||||
	/* NB: -1, 0, 1 already valid return values so use -2 to
 | 
			
		||||
	 * indicate error.
 | 
			
		||||
	 */
 | 
			
		||||
	if (tm == NULL)
 | 
			
		||||
		return -2;
 | 
			
		||||
	
 | 
			
		||||
#define return_cmp(a,b) if ((a)<(b)) return -1; else if ((a)>(b)) return 1
 | 
			
		||||
	year = g2(s->data);
 | 
			
		||||
 
 | 
			
		||||
@@ -90,6 +90,12 @@ int ASN1_verify(i2d_of_void *i2d, X509_ALGOR *a, ASN1_BIT_STRING *signature,
 | 
			
		||||
		ASN1err(ASN1_F_ASN1_VERIFY,ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM);
 | 
			
		||||
		goto err;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (signature->type == V_ASN1_BIT_STRING && signature->flags & 0x7)
 | 
			
		||||
		{
 | 
			
		||||
		ASN1err(ASN1_F_ASN1_VERIFY, ASN1_R_INVALID_BIT_STRING_BITS_LEFT);
 | 
			
		||||
		goto err;
 | 
			
		||||
		}
 | 
			
		||||
	
 | 
			
		||||
	inl=i2d(data,NULL);
 | 
			
		||||
	buf_in=OPENSSL_malloc((unsigned int)inl);
 | 
			
		||||
@@ -146,6 +152,12 @@ int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *a,
 | 
			
		||||
		return -1;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (signature->type == V_ASN1_BIT_STRING && signature->flags & 0x7)
 | 
			
		||||
		{
 | 
			
		||||
		ASN1err(ASN1_F_ASN1_ITEM_VERIFY, ASN1_R_INVALID_BIT_STRING_BITS_LEFT);
 | 
			
		||||
		return -1;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	EVP_MD_CTX_init(&ctx);
 | 
			
		||||
 | 
			
		||||
	/* Convert signature OID into digest and public key OIDs */
 | 
			
		||||
 
 | 
			
		||||
@@ -258,7 +258,12 @@ int EVP_PKEY_asn1_add_alias(int to, int from)
 | 
			
		||||
	if (!ameth)
 | 
			
		||||
		return 0;
 | 
			
		||||
	ameth->pkey_base_id = to;
 | 
			
		||||
	return EVP_PKEY_asn1_add0(ameth);
 | 
			
		||||
	if (!EVP_PKEY_asn1_add0(ameth))
 | 
			
		||||
		{
 | 
			
		||||
		EVP_PKEY_asn1_free(ameth);
 | 
			
		||||
		return 0;
 | 
			
		||||
		}
 | 
			
		||||
	return 1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
int EVP_PKEY_asn1_get0_info(int *ppkey_id, int *ppkey_base_id, int *ppkey_flags,
 | 
			
		||||
 
 | 
			
		||||
@@ -776,7 +776,7 @@ 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);
 | 
			
		||||
int            ASN1_TYPE_cmp(const ASN1_TYPE *a, const ASN1_TYPE *b);
 | 
			
		||||
 | 
			
		||||
ASN1_OBJECT *	ASN1_OBJECT_new(void );
 | 
			
		||||
void		ASN1_OBJECT_free(ASN1_OBJECT *a);
 | 
			
		||||
@@ -1329,6 +1329,7 @@ void ERR_load_ASN1_strings(void);
 | 
			
		||||
#define ASN1_R_ILLEGAL_TIME_VALUE			 184
 | 
			
		||||
#define ASN1_R_INTEGER_NOT_ASCII_FORMAT			 185
 | 
			
		||||
#define ASN1_R_INTEGER_TOO_LARGE_FOR_LONG		 128
 | 
			
		||||
#define ASN1_R_INVALID_BIT_STRING_BITS_LEFT		 220
 | 
			
		||||
#define ASN1_R_INVALID_BMPSTRING_LENGTH			 129
 | 
			
		||||
#define ASN1_R_INVALID_DIGIT				 130
 | 
			
		||||
#define ASN1_R_INVALID_MIME_TYPE			 205
 | 
			
		||||
@@ -1378,6 +1379,7 @@ void ERR_load_ASN1_strings(void);
 | 
			
		||||
#define ASN1_R_TIME_NOT_ASCII_FORMAT			 193
 | 
			
		||||
#define ASN1_R_TOO_LONG					 155
 | 
			
		||||
#define ASN1_R_TYPE_NOT_CONSTRUCTED			 156
 | 
			
		||||
#define ASN1_R_TYPE_NOT_PRIMITIVE			 218
 | 
			
		||||
#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
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
/* crypto/asn1/asn1_err.c */
 | 
			
		||||
/* ====================================================================
 | 
			
		||||
 * Copyright (c) 1999-2011 The OpenSSL Project.  All rights reserved.
 | 
			
		||||
 * Copyright (c) 1999-2014 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
 | 
			
		||||
@@ -246,6 +246,7 @@ static ERR_STRING_DATA ASN1_str_reasons[]=
 | 
			
		||||
{ERR_REASON(ASN1_R_ILLEGAL_TIME_VALUE)   ,"illegal time value"},
 | 
			
		||||
{ERR_REASON(ASN1_R_INTEGER_NOT_ASCII_FORMAT),"integer not ascii format"},
 | 
			
		||||
{ERR_REASON(ASN1_R_INTEGER_TOO_LARGE_FOR_LONG),"integer too large for long"},
 | 
			
		||||
{ERR_REASON(ASN1_R_INVALID_BIT_STRING_BITS_LEFT),"invalid bit string bits left"},
 | 
			
		||||
{ERR_REASON(ASN1_R_INVALID_BMPSTRING_LENGTH),"invalid bmpstring length"},
 | 
			
		||||
{ERR_REASON(ASN1_R_INVALID_DIGIT)        ,"invalid digit"},
 | 
			
		||||
{ERR_REASON(ASN1_R_INVALID_MIME_TYPE)    ,"invalid mime type"},
 | 
			
		||||
@@ -295,6 +296,7 @@ static ERR_STRING_DATA ASN1_str_reasons[]=
 | 
			
		||||
{ERR_REASON(ASN1_R_TIME_NOT_ASCII_FORMAT),"time not ascii format"},
 | 
			
		||||
{ERR_REASON(ASN1_R_TOO_LONG)             ,"too long"},
 | 
			
		||||
{ERR_REASON(ASN1_R_TYPE_NOT_CONSTRUCTED) ,"type not constructed"},
 | 
			
		||||
{ERR_REASON(ASN1_R_TYPE_NOT_PRIMITIVE)   ,"type not primitive"},
 | 
			
		||||
{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"},
 | 
			
		||||
@@ -305,7 +307,7 @@ static ERR_STRING_DATA ASN1_str_reasons[]=
 | 
			
		||||
{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_UNKOWN_FORMAT)        ,"unknown format"},
 | 
			
		||||
{ERR_REASON(ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE),"unsupported any defined by type"},
 | 
			
		||||
{ERR_REASON(ASN1_R_UNSUPPORTED_CIPHER)   ,"unsupported cipher"},
 | 
			
		||||
{ERR_REASON(ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM),"unsupported encryption algorithm"},
 | 
			
		||||
 
 | 
			
		||||
@@ -131,6 +131,9 @@ int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag,
 | 
			
		||||
	*pclass=xclass;
 | 
			
		||||
	if (!asn1_get_length(&p,&inf,plength,(int)max)) goto err;
 | 
			
		||||
 | 
			
		||||
	if (inf && !(ret & V_ASN1_CONSTRUCTED))
 | 
			
		||||
		goto err;
 | 
			
		||||
 | 
			
		||||
#if 0
 | 
			
		||||
	fprintf(stderr,"p=%d + *plength=%ld > omax=%ld + *pp=%d  (%d > %d)\n", 
 | 
			
		||||
		(int)p,*plength,omax,(int)*pp,(int)(p+ *plength),
 | 
			
		||||
 
 | 
			
		||||
@@ -667,6 +667,8 @@ static STACK_OF(MIME_HEADER) *mime_parse_hdr(BIO *bio)
 | 
			
		||||
	int len, state, save_state = 0;
 | 
			
		||||
 | 
			
		||||
	headers = sk_MIME_HEADER_new(mime_hdr_cmp);
 | 
			
		||||
	if (!headers)
 | 
			
		||||
		return NULL;
 | 
			
		||||
	while ((len = BIO_gets(bio, linebuf, MAX_SMLEN)) > 0) {
 | 
			
		||||
	/* If whitespace at line start then continuation line */
 | 
			
		||||
	if(mhdr && isspace((unsigned char)linebuf[0])) state = MIME_NAME;
 | 
			
		||||
 
 | 
			
		||||
@@ -134,15 +134,23 @@ ASN1_STRING *ASN1_pack_string(void *obj, i2d_of_void *i2d, ASN1_STRING **oct)
 | 
			
		||||
		
 | 
			
		||||
	if (!(octmp->length = i2d(obj, NULL))) {
 | 
			
		||||
		ASN1err(ASN1_F_ASN1_PACK_STRING,ASN1_R_ENCODE_ERROR);
 | 
			
		||||
		return NULL;
 | 
			
		||||
		goto err;
 | 
			
		||||
	}
 | 
			
		||||
	if (!(p = OPENSSL_malloc (octmp->length))) {
 | 
			
		||||
		ASN1err(ASN1_F_ASN1_PACK_STRING,ERR_R_MALLOC_FAILURE);
 | 
			
		||||
		return NULL;
 | 
			
		||||
		goto err;
 | 
			
		||||
	}
 | 
			
		||||
	octmp->data = p;
 | 
			
		||||
	i2d (obj, &p);
 | 
			
		||||
	return octmp;
 | 
			
		||||
	err:
 | 
			
		||||
	if (!oct || !*oct)
 | 
			
		||||
		{
 | 
			
		||||
		ASN1_STRING_free(octmp);
 | 
			
		||||
		if (oct)
 | 
			
		||||
			*oct = NULL;
 | 
			
		||||
		}
 | 
			
		||||
	return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -154,7 +154,10 @@ static int asn1_bio_new(BIO *b)
 | 
			
		||||
	if (!ctx)
 | 
			
		||||
		return 0;
 | 
			
		||||
	if (!asn1_bio_init(ctx, DEFAULT_ASN1_BUF_SIZE))
 | 
			
		||||
		{
 | 
			
		||||
		OPENSSL_free(ctx);
 | 
			
		||||
		return 0;
 | 
			
		||||
		}
 | 
			
		||||
	b->init = 1;
 | 
			
		||||
	b->ptr = (char *)ctx;
 | 
			
		||||
	b->flags = 0;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,8 @@
 | 
			
		||||
#!/usr/local/bin/perl -w
 | 
			
		||||
 | 
			
		||||
# Written by Dr Stephen N Henson (steve@openssl.org).
 | 
			
		||||
# Licensed under the terms of the OpenSSL license.
 | 
			
		||||
 | 
			
		||||
use strict;
 | 
			
		||||
 | 
			
		||||
my ($i, @arr);
 | 
			
		||||
 
 | 
			
		||||
@@ -66,7 +66,11 @@ int ASN1_TYPE_set_octetstring(ASN1_TYPE *a, unsigned char *data, int len)
 | 
			
		||||
	ASN1_STRING *os;
 | 
			
		||||
 | 
			
		||||
	if ((os=M_ASN1_OCTET_STRING_new()) == NULL) return(0);
 | 
			
		||||
	if (!M_ASN1_OCTET_STRING_set(os,data,len)) return(0);
 | 
			
		||||
	if (!M_ASN1_OCTET_STRING_set(os,data,len))
 | 
			
		||||
		{
 | 
			
		||||
		M_ASN1_OCTET_STRING_free(os);
 | 
			
		||||
		return 0;
 | 
			
		||||
		}
 | 
			
		||||
	ASN1_TYPE_set(a,V_ASN1_OCTET_STRING,os);
 | 
			
		||||
	return(1);
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -475,6 +475,8 @@ int X509_NAME_print(BIO *bp, X509_NAME *name, int obase)
 | 
			
		||||
	l=80-2-obase;
 | 
			
		||||
 | 
			
		||||
	b=X509_NAME_oneline(name,NULL,0);
 | 
			
		||||
	if (!b)
 | 
			
		||||
		return 0;
 | 
			
		||||
	if (!*b)
 | 
			
		||||
		{
 | 
			
		||||
		OPENSSL_free(b);
 | 
			
		||||
 
 | 
			
		||||
@@ -870,6 +870,14 @@ static int asn1_d2i_ex_primitive(ASN1_VALUE **pval,
 | 
			
		||||
		}
 | 
			
		||||
	else if (cst)
 | 
			
		||||
		{
 | 
			
		||||
		if (utype == V_ASN1_NULL || utype == V_ASN1_BOOLEAN
 | 
			
		||||
			|| utype == V_ASN1_OBJECT || utype == V_ASN1_INTEGER
 | 
			
		||||
			|| utype == V_ASN1_ENUMERATED)
 | 
			
		||||
			{
 | 
			
		||||
			ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE,
 | 
			
		||||
				ASN1_R_TYPE_NOT_PRIMITIVE);
 | 
			
		||||
			return 0;
 | 
			
		||||
			}
 | 
			
		||||
		buf.length = 0;
 | 
			
		||||
		buf.max = 0;
 | 
			
		||||
		buf.data = NULL;
 | 
			
		||||
 
 | 
			
		||||
@@ -453,9 +453,14 @@ static int asn1_set_seq_out(STACK_OF(ASN1_VALUE) *sk, unsigned char **out,
 | 
			
		||||
			{
 | 
			
		||||
			derlst = OPENSSL_malloc(sk_ASN1_VALUE_num(sk)
 | 
			
		||||
						* sizeof(*derlst));
 | 
			
		||||
			tmpdat = OPENSSL_malloc(skcontlen);
 | 
			
		||||
			if (!derlst || !tmpdat)
 | 
			
		||||
			if (!derlst)
 | 
			
		||||
				return 0;
 | 
			
		||||
			tmpdat = OPENSSL_malloc(skcontlen);
 | 
			
		||||
			if (!tmpdat)
 | 
			
		||||
				{
 | 
			
		||||
				OPENSSL_free(derlst);
 | 
			
		||||
				return 0;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	/* If not sorting just output each item */
 | 
			
		||||
 
 | 
			
		||||
@@ -142,3 +142,14 @@ void X509_ALGOR_set_md(X509_ALGOR *alg, const EVP_MD *md)
 | 
			
		||||
	X509_ALGOR_set0(alg, OBJ_nid2obj(EVP_MD_type(md)), param_type, NULL);
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
int X509_ALGOR_cmp(const X509_ALGOR *a, const X509_ALGOR *b)
 | 
			
		||||
	{
 | 
			
		||||
	int rv;
 | 
			
		||||
	rv = OBJ_cmp(a->algorithm, b->algorithm);
 | 
			
		||||
	if (rv)
 | 
			
		||||
		return rv;
 | 
			
		||||
	if (!a->parameter && !b->parameter)
 | 
			
		||||
		return 0;
 | 
			
		||||
	return ASN1_TYPE_cmp(a->parameter, b->parameter);
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -270,6 +270,7 @@ static int crl_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
 | 
			
		||||
				{
 | 
			
		||||
				/* We handle IDP and deltas */
 | 
			
		||||
				if ((nid == NID_issuing_distribution_point)
 | 
			
		||||
					|| (nid == NID_authority_key_identifier)
 | 
			
		||||
					|| (nid == NID_delta_crl))
 | 
			
		||||
					break;;
 | 
			
		||||
				crl->flags |= EXFLAG_CRITICAL;
 | 
			
		||||
 
 | 
			
		||||
@@ -350,6 +350,8 @@ static int x509_name_canon(X509_NAME *a)
 | 
			
		||||
			set = entry->set;
 | 
			
		||||
			}
 | 
			
		||||
		tmpentry = X509_NAME_ENTRY_new();
 | 
			
		||||
		if (!tmpentry)
 | 
			
		||||
			goto err;
 | 
			
		||||
		tmpentry->object = OBJ_dup(entry->object);
 | 
			
		||||
		if (!asn1_string_canon(tmpentry->value, entry->value))
 | 
			
		||||
			goto err;
 | 
			
		||||
 
 | 
			
		||||
@@ -175,6 +175,8 @@ extern "C" {
 | 
			
		||||
#define BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT   45 /* Next DTLS handshake timeout to
 | 
			
		||||
                                              * adjust socket timeouts */
 | 
			
		||||
 | 
			
		||||
#define BIO_CTRL_DGRAM_GET_MTU_OVERHEAD   49
 | 
			
		||||
 | 
			
		||||
#ifndef OPENSSL_NO_SCTP
 | 
			
		||||
/* SCTP stuff */
 | 
			
		||||
#define BIO_CTRL_DGRAM_SCTP_SET_IN_HANDSHAKE	50
 | 
			
		||||
@@ -607,6 +609,8 @@ int BIO_ctrl_reset_read_request(BIO *b);
 | 
			
		||||
         (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_PEER, 0, (char *)peer)
 | 
			
		||||
#define BIO_dgram_set_peer(b,peer) \
 | 
			
		||||
         (int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_PEER, 0, (char *)peer)
 | 
			
		||||
#define BIO_dgram_get_mtu_overhead(b) \
 | 
			
		||||
         (unsigned int)BIO_ctrl((b), BIO_CTRL_DGRAM_GET_MTU_OVERHEAD, 0, NULL)
 | 
			
		||||
 | 
			
		||||
/* These two aren't currently implemented */
 | 
			
		||||
/* int BIO_get_ex_num(BIO *bio); */
 | 
			
		||||
 
 | 
			
		||||
@@ -132,8 +132,8 @@ int BIO_free(BIO *a)
 | 
			
		||||
 | 
			
		||||
	CRYPTO_free_ex_data(CRYPTO_EX_INDEX_BIO, a, &a->ex_data);
 | 
			
		||||
 | 
			
		||||
	if ((a->method == NULL) || (a->method->destroy == NULL)) return(1);
 | 
			
		||||
	a->method->destroy(a);
 | 
			
		||||
	if ((a->method != NULL) && (a->method->destroy != NULL))
 | 
			
		||||
		a->method->destroy(a);
 | 
			
		||||
	OPENSSL_free(a);
 | 
			
		||||
	return(1);
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -454,6 +454,36 @@ static int dgram_write(BIO *b, const char *in, int inl)
 | 
			
		||||
	return(ret);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static long dgram_get_mtu_overhead(bio_dgram_data *data)
 | 
			
		||||
	{
 | 
			
		||||
	long ret;
 | 
			
		||||
 | 
			
		||||
	switch (data->peer.sa.sa_family)
 | 
			
		||||
		{
 | 
			
		||||
		case AF_INET:
 | 
			
		||||
			/* Assume this is UDP - 20 bytes for IP, 8 bytes for UDP */
 | 
			
		||||
			ret = 28;
 | 
			
		||||
			break;
 | 
			
		||||
#if OPENSSL_USE_IPV6
 | 
			
		||||
		case AF_INET6:
 | 
			
		||||
#ifdef IN6_IS_ADDR_V4MAPPED
 | 
			
		||||
			if (IN6_IS_ADDR_V4MAPPED(&data->peer.sa_in6.sin6_addr))
 | 
			
		||||
				/* Assume this is UDP - 20 bytes for IP, 8 bytes for UDP */
 | 
			
		||||
				ret = 28;
 | 
			
		||||
			else
 | 
			
		||||
#endif
 | 
			
		||||
				/* Assume this is UDP - 40 bytes for IP, 8 bytes for UDP */
 | 
			
		||||
				ret = 48;
 | 
			
		||||
			break;
 | 
			
		||||
#endif
 | 
			
		||||
		default:
 | 
			
		||||
			/* We don't know. Go with the historical default */
 | 
			
		||||
			ret = 28;
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
	return ret;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr)
 | 
			
		||||
	{
 | 
			
		||||
	long ret=1;
 | 
			
		||||
@@ -630,23 +660,24 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr)
 | 
			
		||||
#endif
 | 
			
		||||
		break;
 | 
			
		||||
	case BIO_CTRL_DGRAM_GET_FALLBACK_MTU:
 | 
			
		||||
		ret = -dgram_get_mtu_overhead(data);
 | 
			
		||||
		switch (data->peer.sa.sa_family)
 | 
			
		||||
			{
 | 
			
		||||
			case AF_INET:
 | 
			
		||||
				ret = 576 - 20 - 8;
 | 
			
		||||
				ret += 576;
 | 
			
		||||
				break;
 | 
			
		||||
#if OPENSSL_USE_IPV6
 | 
			
		||||
			case AF_INET6:
 | 
			
		||||
#ifdef IN6_IS_ADDR_V4MAPPED
 | 
			
		||||
				if (IN6_IS_ADDR_V4MAPPED(&data->peer.sa_in6.sin6_addr))
 | 
			
		||||
					ret = 576 - 20 - 8;
 | 
			
		||||
					ret += 576;
 | 
			
		||||
				else
 | 
			
		||||
#endif
 | 
			
		||||
					ret = 1280 - 40 - 8;
 | 
			
		||||
					ret += 1280;
 | 
			
		||||
				break;
 | 
			
		||||
#endif
 | 
			
		||||
			default:
 | 
			
		||||
				ret = 576 - 20 - 8;
 | 
			
		||||
				ret += 576;
 | 
			
		||||
				break;
 | 
			
		||||
			}
 | 
			
		||||
		break;
 | 
			
		||||
@@ -847,6 +878,9 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr)
 | 
			
		||||
			ret = 0;
 | 
			
		||||
		break;
 | 
			
		||||
#endif
 | 
			
		||||
	case BIO_CTRL_DGRAM_GET_MTU_OVERHEAD:
 | 
			
		||||
		ret = dgram_get_mtu_overhead(data);
 | 
			
		||||
		break;
 | 
			
		||||
	default:
 | 
			
		||||
		ret=0;
 | 
			
		||||
		break;
 | 
			
		||||
@@ -893,10 +927,18 @@ BIO *BIO_new_dgram_sctp(int fd, int close_flag)
 | 
			
		||||
	/* Activate SCTP-AUTH for DATA and FORWARD-TSN chunks */
 | 
			
		||||
	auth.sauth_chunk = OPENSSL_SCTP_DATA_CHUNK_TYPE;
 | 
			
		||||
	ret = setsockopt(fd, IPPROTO_SCTP, SCTP_AUTH_CHUNK, &auth, sizeof(struct sctp_authchunk));
 | 
			
		||||
	OPENSSL_assert(ret >= 0);
 | 
			
		||||
	if (ret < 0)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_vfree(bio);
 | 
			
		||||
		return(NULL);
 | 
			
		||||
		}
 | 
			
		||||
	auth.sauth_chunk = OPENSSL_SCTP_FORWARD_CUM_TSN_CHUNK_TYPE;
 | 
			
		||||
	ret = setsockopt(fd, IPPROTO_SCTP, SCTP_AUTH_CHUNK, &auth, sizeof(struct sctp_authchunk));
 | 
			
		||||
	OPENSSL_assert(ret >= 0);
 | 
			
		||||
	if (ret < 0)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_vfree(bio);
 | 
			
		||||
		return(NULL);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	/* Test if activation was successful. When using accept(),
 | 
			
		||||
	 * SCTP-AUTH has to be activated for the listening socket
 | 
			
		||||
@@ -905,9 +947,15 @@ BIO *BIO_new_dgram_sctp(int fd, int close_flag)
 | 
			
		||||
	authchunks = OPENSSL_malloc(sockopt_len);
 | 
			
		||||
	memset(authchunks, 0, sizeof(sockopt_len));
 | 
			
		||||
	ret = getsockopt(fd, IPPROTO_SCTP, SCTP_LOCAL_AUTH_CHUNKS, authchunks, &sockopt_len);
 | 
			
		||||
	OPENSSL_assert(ret >= 0);
 | 
			
		||||
	
 | 
			
		||||
	for (p = (unsigned char*) authchunks + sizeof(sctp_assoc_t);
 | 
			
		||||
 | 
			
		||||
	if (ret < 0)
 | 
			
		||||
		{
 | 
			
		||||
		OPENSSL_free(authchunks);
 | 
			
		||||
		BIO_vfree(bio);
 | 
			
		||||
		return(NULL);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	for (p = (unsigned char*) authchunks->gauth_chunks;
 | 
			
		||||
	     p < (unsigned char*) authchunks + sockopt_len;
 | 
			
		||||
	     p += sizeof(uint8_t))
 | 
			
		||||
		{
 | 
			
		||||
@@ -927,16 +975,28 @@ BIO *BIO_new_dgram_sctp(int fd, int close_flag)
 | 
			
		||||
	event.se_type = SCTP_AUTHENTICATION_EVENT;
 | 
			
		||||
	event.se_on = 1;
 | 
			
		||||
	ret = setsockopt(fd, IPPROTO_SCTP, SCTP_EVENT, &event, sizeof(struct sctp_event));
 | 
			
		||||
	OPENSSL_assert(ret >= 0);
 | 
			
		||||
	if (ret < 0)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_vfree(bio);
 | 
			
		||||
		return(NULL);
 | 
			
		||||
		}
 | 
			
		||||
#else
 | 
			
		||||
	sockopt_len = (socklen_t) sizeof(struct sctp_event_subscribe);
 | 
			
		||||
	ret = getsockopt(fd, IPPROTO_SCTP, SCTP_EVENTS, &event, &sockopt_len);
 | 
			
		||||
	OPENSSL_assert(ret >= 0);
 | 
			
		||||
	if (ret < 0)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_vfree(bio);
 | 
			
		||||
		return(NULL);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	event.sctp_authentication_event = 1;
 | 
			
		||||
 | 
			
		||||
	ret = setsockopt(fd, IPPROTO_SCTP, SCTP_EVENTS, &event, sizeof(struct sctp_event_subscribe));
 | 
			
		||||
	OPENSSL_assert(ret >= 0);
 | 
			
		||||
	if (ret < 0)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_vfree(bio);
 | 
			
		||||
		return(NULL);
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
@@ -944,7 +1004,11 @@ BIO *BIO_new_dgram_sctp(int fd, int close_flag)
 | 
			
		||||
	 * larger than the max record size of 2^14 + 2048 + 13
 | 
			
		||||
	 */
 | 
			
		||||
	ret = setsockopt(fd, IPPROTO_SCTP, SCTP_PARTIAL_DELIVERY_POINT, &optval, sizeof(optval));
 | 
			
		||||
	OPENSSL_assert(ret >= 0);
 | 
			
		||||
	if (ret < 0)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_vfree(bio);
 | 
			
		||||
		return(NULL);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	return(bio);
 | 
			
		||||
	}
 | 
			
		||||
@@ -982,7 +1046,12 @@ static int dgram_sctp_free(BIO *a)
 | 
			
		||||
		return 0;
 | 
			
		||||
 | 
			
		||||
	data = (bio_dgram_sctp_data *)a->ptr;
 | 
			
		||||
	if(data != NULL) OPENSSL_free(data);
 | 
			
		||||
	if(data != NULL)
 | 
			
		||||
		{
 | 
			
		||||
		if(data->saved_message.data != NULL)
 | 
			
		||||
			OPENSSL_free(data->saved_message.data);
 | 
			
		||||
		OPENSSL_free(data);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	return(1);
 | 
			
		||||
	}
 | 
			
		||||
@@ -1034,6 +1103,13 @@ static int dgram_sctp_read(BIO *b, char *out, int outl)
 | 
			
		||||
			msg.msg_flags = 0;
 | 
			
		||||
			n = recvmsg(b->num, &msg, 0);
 | 
			
		||||
 | 
			
		||||
			if (n <= 0)
 | 
			
		||||
				{
 | 
			
		||||
				if (n < 0)
 | 
			
		||||
					ret = n;
 | 
			
		||||
				break;
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
			if (msg.msg_controllen > 0)
 | 
			
		||||
				{
 | 
			
		||||
				for (cmsg = CMSG_FIRSTHDR(&msg); cmsg; cmsg = CMSG_NXTHDR(&msg, cmsg))
 | 
			
		||||
@@ -1073,13 +1149,6 @@ static int dgram_sctp_read(BIO *b, char *out, int outl)
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
			if (n <= 0)
 | 
			
		||||
				{
 | 
			
		||||
				if (n < 0)
 | 
			
		||||
					ret = n;
 | 
			
		||||
				break;
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
			if (msg.msg_flags & MSG_NOTIFICATION)
 | 
			
		||||
				{
 | 
			
		||||
				snp = (union sctp_notification*) out;
 | 
			
		||||
@@ -1099,6 +1168,7 @@ static int dgram_sctp_read(BIO *b, char *out, int outl)
 | 
			
		||||
						dgram_sctp_write(data->saved_message.bio, data->saved_message.data,
 | 
			
		||||
						                 data->saved_message.length);
 | 
			
		||||
						OPENSSL_free(data->saved_message.data);
 | 
			
		||||
						data->saved_message.data = NULL;
 | 
			
		||||
						data->saved_message.length = 0;
 | 
			
		||||
						}
 | 
			
		||||
 | 
			
		||||
@@ -1109,16 +1179,28 @@ static int dgram_sctp_read(BIO *b, char *out, int outl)
 | 
			
		||||
					event.se_type = SCTP_SENDER_DRY_EVENT;
 | 
			
		||||
					event.se_on = 0;
 | 
			
		||||
					i = setsockopt(b->num, IPPROTO_SCTP, SCTP_EVENT, &event, sizeof(struct sctp_event));
 | 
			
		||||
					OPENSSL_assert(i >= 0);
 | 
			
		||||
					if (i < 0)
 | 
			
		||||
						{
 | 
			
		||||
						ret = i;
 | 
			
		||||
						break;
 | 
			
		||||
						}
 | 
			
		||||
#else
 | 
			
		||||
					eventsize = sizeof(struct sctp_event_subscribe);
 | 
			
		||||
					i = getsockopt(b->num, IPPROTO_SCTP, SCTP_EVENTS, &event, &eventsize);
 | 
			
		||||
					OPENSSL_assert(i >= 0);
 | 
			
		||||
					if (i < 0)
 | 
			
		||||
						{
 | 
			
		||||
						ret = i;
 | 
			
		||||
						break;
 | 
			
		||||
						}
 | 
			
		||||
 | 
			
		||||
					event.sctp_sender_dry_event = 0;
 | 
			
		||||
 | 
			
		||||
					i = setsockopt(b->num, IPPROTO_SCTP, SCTP_EVENTS, &event, sizeof(struct sctp_event_subscribe));
 | 
			
		||||
					OPENSSL_assert(i >= 0);
 | 
			
		||||
					if (i < 0)
 | 
			
		||||
						{
 | 
			
		||||
						ret = i;
 | 
			
		||||
						break;
 | 
			
		||||
						}
 | 
			
		||||
#endif
 | 
			
		||||
					}
 | 
			
		||||
 | 
			
		||||
@@ -1151,8 +1233,8 @@ static int dgram_sctp_read(BIO *b, char *out, int outl)
 | 
			
		||||
			 */
 | 
			
		||||
			optlen = (socklen_t) sizeof(int);
 | 
			
		||||
			ret = getsockopt(b->num, SOL_SOCKET, SO_RCVBUF, &optval, &optlen);
 | 
			
		||||
			OPENSSL_assert(ret >= 0);
 | 
			
		||||
			OPENSSL_assert(optval >= 18445);
 | 
			
		||||
			if (ret >= 0)
 | 
			
		||||
				OPENSSL_assert(optval >= 18445);
 | 
			
		||||
 | 
			
		||||
			/* Test if SCTP doesn't partially deliver below
 | 
			
		||||
			 * max record size (2^14 + 2048 + 13)
 | 
			
		||||
@@ -1160,8 +1242,8 @@ static int dgram_sctp_read(BIO *b, char *out, int outl)
 | 
			
		||||
			optlen = (socklen_t) sizeof(int);
 | 
			
		||||
			ret = getsockopt(b->num, IPPROTO_SCTP, SCTP_PARTIAL_DELIVERY_POINT,
 | 
			
		||||
			                 &optval, &optlen);
 | 
			
		||||
			OPENSSL_assert(ret >= 0);
 | 
			
		||||
			OPENSSL_assert(optval >= 18445);
 | 
			
		||||
			if (ret >= 0)
 | 
			
		||||
				OPENSSL_assert(optval >= 18445);
 | 
			
		||||
 | 
			
		||||
			/* Partially delivered notification??? Probably a bug.... */
 | 
			
		||||
			OPENSSL_assert(!(msg.msg_flags & MSG_NOTIFICATION));
 | 
			
		||||
@@ -1195,15 +1277,15 @@ static int dgram_sctp_read(BIO *b, char *out, int outl)
 | 
			
		||||
			authchunks = OPENSSL_malloc(optlen);
 | 
			
		||||
			memset(authchunks, 0, sizeof(optlen));
 | 
			
		||||
			ii = getsockopt(b->num, IPPROTO_SCTP, SCTP_PEER_AUTH_CHUNKS, authchunks, &optlen);
 | 
			
		||||
			OPENSSL_assert(ii >= 0);
 | 
			
		||||
 | 
			
		||||
			for (p = (unsigned char*) authchunks + sizeof(sctp_assoc_t);
 | 
			
		||||
				 p < (unsigned char*) authchunks + optlen;
 | 
			
		||||
				 p += sizeof(uint8_t))
 | 
			
		||||
				{
 | 
			
		||||
				if (*p == OPENSSL_SCTP_DATA_CHUNK_TYPE) auth_data = 1;
 | 
			
		||||
				if (*p == OPENSSL_SCTP_FORWARD_CUM_TSN_CHUNK_TYPE) auth_forward = 1;
 | 
			
		||||
				}
 | 
			
		||||
			if (ii >= 0)
 | 
			
		||||
				for (p = (unsigned char*) authchunks->gauth_chunks;
 | 
			
		||||
				     p < (unsigned char*) authchunks + optlen;
 | 
			
		||||
				     p += sizeof(uint8_t))
 | 
			
		||||
					{
 | 
			
		||||
					if (*p == OPENSSL_SCTP_DATA_CHUNK_TYPE) auth_data = 1;
 | 
			
		||||
					if (*p == OPENSSL_SCTP_FORWARD_CUM_TSN_CHUNK_TYPE) auth_forward = 1;
 | 
			
		||||
					}
 | 
			
		||||
 | 
			
		||||
			OPENSSL_free(authchunks);
 | 
			
		||||
 | 
			
		||||
@@ -1258,9 +1340,11 @@ static int dgram_sctp_write(BIO *b, const char *in, int inl)
 | 
			
		||||
	if (data->save_shutdown && !BIO_dgram_sctp_wait_for_dry(b))
 | 
			
		||||
	{
 | 
			
		||||
		data->saved_message.bio = b;
 | 
			
		||||
		data->saved_message.length = inl;
 | 
			
		||||
		if (data->saved_message.data)
 | 
			
		||||
			OPENSSL_free(data->saved_message.data);
 | 
			
		||||
		data->saved_message.data = OPENSSL_malloc(inl);
 | 
			
		||||
		memcpy(data->saved_message.data, in, inl);
 | 
			
		||||
		data->saved_message.length = inl;
 | 
			
		||||
		return inl;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -1333,7 +1417,7 @@ static long dgram_sctp_ctrl(BIO *b, int cmd, long num, void *ptr)
 | 
			
		||||
	bio_dgram_sctp_data *data = NULL;
 | 
			
		||||
	socklen_t sockopt_len = 0;
 | 
			
		||||
	struct sctp_authkeyid authkeyid;
 | 
			
		||||
	struct sctp_authkey *authkey;
 | 
			
		||||
	struct sctp_authkey *authkey = NULL;
 | 
			
		||||
 | 
			
		||||
	data = (bio_dgram_sctp_data *)b->ptr;
 | 
			
		||||
 | 
			
		||||
@@ -1367,6 +1451,10 @@ static long dgram_sctp_ctrl(BIO *b, int cmd, long num, void *ptr)
 | 
			
		||||
		 * Returns always 1.
 | 
			
		||||
		 */
 | 
			
		||||
		break;
 | 
			
		||||
	case BIO_CTRL_DGRAM_GET_MTU_OVERHEAD:
 | 
			
		||||
		/* We allow transport protocol fragmentation so this is irrelevant */
 | 
			
		||||
		ret = 0;
 | 
			
		||||
		break;
 | 
			
		||||
	case BIO_CTRL_DGRAM_SCTP_SET_IN_HANDSHAKE:
 | 
			
		||||
		if (num > 0)
 | 
			
		||||
			data->in_handshake = 1;
 | 
			
		||||
@@ -1388,6 +1476,11 @@ static long dgram_sctp_ctrl(BIO *b, int cmd, long num, void *ptr)
 | 
			
		||||
		/* Add new key */
 | 
			
		||||
		sockopt_len = sizeof(struct sctp_authkey) + 64 * sizeof(uint8_t);
 | 
			
		||||
		authkey = OPENSSL_malloc(sockopt_len);
 | 
			
		||||
		if (authkey == NULL)
 | 
			
		||||
			{
 | 
			
		||||
			ret = -1;
 | 
			
		||||
			break;
 | 
			
		||||
			}
 | 
			
		||||
		memset(authkey, 0x00, sockopt_len);
 | 
			
		||||
		authkey->sca_keynumber = authkeyid.scact_keynumber + 1;
 | 
			
		||||
#ifndef __FreeBSD__
 | 
			
		||||
@@ -1399,6 +1492,8 @@ static long dgram_sctp_ctrl(BIO *b, int cmd, long num, void *ptr)
 | 
			
		||||
		memcpy(&authkey->sca_key[0], ptr, 64 * sizeof(uint8_t));
 | 
			
		||||
 | 
			
		||||
		ret = setsockopt(b->num, IPPROTO_SCTP, SCTP_AUTH_KEY, authkey, sockopt_len);
 | 
			
		||||
		OPENSSL_free(authkey);
 | 
			
		||||
		authkey = NULL;
 | 
			
		||||
		if (ret < 0) break;
 | 
			
		||||
 | 
			
		||||
		/* Reset active key */
 | 
			
		||||
 
 | 
			
		||||
@@ -245,7 +245,7 @@ static int MS_CALLBACK slg_puts(BIO *bp, const char *str)
 | 
			
		||||
 | 
			
		||||
static void xopenlog(BIO* bp, char* name, int level)
 | 
			
		||||
{
 | 
			
		||||
	if (GetVersion() < 0x80000000)
 | 
			
		||||
	if (check_winnt())
 | 
			
		||||
		bp->ptr = RegisterEventSourceA(NULL,name);
 | 
			
		||||
	else
 | 
			
		||||
		bp->ptr = NULL;
 | 
			
		||||
 
 | 
			
		||||
@@ -125,7 +125,9 @@ ppc-mont.s:	asm/ppc-mont.pl;$(PERL) asm/ppc-mont.pl $(PERLASM_SCHEME) $@
 | 
			
		||||
ppc64-mont.s:	asm/ppc64-mont.pl;$(PERL) asm/ppc64-mont.pl $(PERLASM_SCHEME) $@
 | 
			
		||||
 | 
			
		||||
alpha-mont.s:	asm/alpha-mont.pl
 | 
			
		||||
	$(PERL) $< | $(CC) -E - | tee $@ > /dev/null
 | 
			
		||||
	(preproc=/tmp/$$$$.$@; trap "rm $$preproc" INT; \
 | 
			
		||||
	$(PERL) asm/alpha-mont.pl > $$preproc && \
 | 
			
		||||
	$(CC) -E $$preproc > $@ && rm $$preproc)
 | 
			
		||||
 | 
			
		||||
# GNU make "catch all"
 | 
			
		||||
%-mont.s:	asm/%-mont.pl;	$(PERL) $< $(PERLASM_SCHEME) $@
 | 
			
		||||
 
 | 
			
		||||
@@ -133,7 +133,7 @@ $code.=<<___;
 | 
			
		||||
	bnez	$at,1f
 | 
			
		||||
	li	$t0,0
 | 
			
		||||
	slt	$at,$num,17	# on in-order CPU
 | 
			
		||||
	bnezl	$at,bn_mul_mont_internal
 | 
			
		||||
	bnez	$at,bn_mul_mont_internal
 | 
			
		||||
	nop
 | 
			
		||||
1:	jr	$ra
 | 
			
		||||
	li	$a0,0
 | 
			
		||||
 
 | 
			
		||||
@@ -140,10 +140,10 @@ $code.=<<___;
 | 
			
		||||
	.set	reorder
 | 
			
		||||
	li	$minus4,-4
 | 
			
		||||
	and	$ta0,$a2,$minus4
 | 
			
		||||
	$LD	$t0,0($a1)
 | 
			
		||||
	beqz	$ta0,.L_bn_mul_add_words_tail
 | 
			
		||||
 | 
			
		||||
.L_bn_mul_add_words_loop:
 | 
			
		||||
	$LD	$t0,0($a1)
 | 
			
		||||
	$MULTU	$t0,$a3
 | 
			
		||||
	$LD	$t1,0($a0)
 | 
			
		||||
	$LD	$t2,$BNSZ($a1)
 | 
			
		||||
@@ -200,10 +200,9 @@ $code.=<<___;
 | 
			
		||||
	$ADDU	$v0,$ta2
 | 
			
		||||
	sltu	$at,$ta3,$at
 | 
			
		||||
	$ST	$ta3,-$BNSZ($a0)
 | 
			
		||||
	$ADDU	$v0,$at
 | 
			
		||||
	.set	noreorder
 | 
			
		||||
	bgtzl	$ta0,.L_bn_mul_add_words_loop
 | 
			
		||||
	$LD	$t0,0($a1)
 | 
			
		||||
	bgtz	$ta0,.L_bn_mul_add_words_loop
 | 
			
		||||
	$ADDU	$v0,$at
 | 
			
		||||
 | 
			
		||||
	beqz	$a2,.L_bn_mul_add_words_return
 | 
			
		||||
	nop
 | 
			
		||||
@@ -300,10 +299,10 @@ $code.=<<___;
 | 
			
		||||
	.set	reorder
 | 
			
		||||
	li	$minus4,-4
 | 
			
		||||
	and	$ta0,$a2,$minus4
 | 
			
		||||
	$LD	$t0,0($a1)
 | 
			
		||||
	beqz	$ta0,.L_bn_mul_words_tail
 | 
			
		||||
 | 
			
		||||
.L_bn_mul_words_loop:
 | 
			
		||||
	$LD	$t0,0($a1)
 | 
			
		||||
	$MULTU	$t0,$a3
 | 
			
		||||
	$LD	$t2,$BNSZ($a1)
 | 
			
		||||
	$LD	$ta0,2*$BNSZ($a1)
 | 
			
		||||
@@ -341,10 +340,9 @@ $code.=<<___;
 | 
			
		||||
	$ADDU	$v0,$at
 | 
			
		||||
	sltu	$ta3,$v0,$at
 | 
			
		||||
	$ST	$v0,-$BNSZ($a0)
 | 
			
		||||
	$ADDU	$v0,$ta3,$ta2
 | 
			
		||||
	.set	noreorder
 | 
			
		||||
	bgtzl	$ta0,.L_bn_mul_words_loop
 | 
			
		||||
	$LD	$t0,0($a1)
 | 
			
		||||
	bgtz	$ta0,.L_bn_mul_words_loop
 | 
			
		||||
	$ADDU	$v0,$ta3,$ta2
 | 
			
		||||
 | 
			
		||||
	beqz	$a2,.L_bn_mul_words_return
 | 
			
		||||
	nop
 | 
			
		||||
@@ -429,10 +427,10 @@ $code.=<<___;
 | 
			
		||||
	.set	reorder
 | 
			
		||||
	li	$minus4,-4
 | 
			
		||||
	and	$ta0,$a2,$minus4
 | 
			
		||||
	$LD	$t0,0($a1)
 | 
			
		||||
	beqz	$ta0,.L_bn_sqr_words_tail
 | 
			
		||||
 | 
			
		||||
.L_bn_sqr_words_loop:
 | 
			
		||||
	$LD	$t0,0($a1)
 | 
			
		||||
	$MULTU	$t0,$t0
 | 
			
		||||
	$LD	$t2,$BNSZ($a1)
 | 
			
		||||
	$LD	$ta0,2*$BNSZ($a1)
 | 
			
		||||
@@ -463,11 +461,10 @@ $code.=<<___;
 | 
			
		||||
	mflo	$ta3
 | 
			
		||||
	mfhi	$ta2
 | 
			
		||||
	$ST	$ta3,-2*$BNSZ($a0)
 | 
			
		||||
	$ST	$ta2,-$BNSZ($a0)
 | 
			
		||||
 | 
			
		||||
	.set	noreorder
 | 
			
		||||
	bgtzl	$ta0,.L_bn_sqr_words_loop
 | 
			
		||||
	$LD	$t0,0($a1)
 | 
			
		||||
	bgtz	$ta0,.L_bn_sqr_words_loop
 | 
			
		||||
	$ST	$ta2,-$BNSZ($a0)
 | 
			
		||||
 | 
			
		||||
	beqz	$a2,.L_bn_sqr_words_return
 | 
			
		||||
	nop
 | 
			
		||||
@@ -547,10 +544,10 @@ $code.=<<___;
 | 
			
		||||
	.set	reorder
 | 
			
		||||
	li	$minus4,-4
 | 
			
		||||
	and	$at,$a3,$minus4
 | 
			
		||||
	$LD	$t0,0($a1)
 | 
			
		||||
	beqz	$at,.L_bn_add_words_tail
 | 
			
		||||
 | 
			
		||||
.L_bn_add_words_loop:
 | 
			
		||||
	$LD	$t0,0($a1)
 | 
			
		||||
	$LD	$ta0,0($a2)
 | 
			
		||||
	subu	$a3,4
 | 
			
		||||
	$LD	$t1,$BNSZ($a1)
 | 
			
		||||
@@ -589,11 +586,10 @@ $code.=<<___;
 | 
			
		||||
	$ADDU	$t3,$ta3,$v0
 | 
			
		||||
	sltu	$v0,$t3,$ta3
 | 
			
		||||
	$ST	$t3,-$BNSZ($a0)
 | 
			
		||||
	$ADDU	$v0,$t9
 | 
			
		||||
	
 | 
			
		||||
	.set	noreorder
 | 
			
		||||
	bgtzl	$at,.L_bn_add_words_loop
 | 
			
		||||
	$LD	$t0,0($a1)
 | 
			
		||||
	bgtz	$at,.L_bn_add_words_loop
 | 
			
		||||
	$ADDU	$v0,$t9
 | 
			
		||||
 | 
			
		||||
	beqz	$a3,.L_bn_add_words_return
 | 
			
		||||
	nop
 | 
			
		||||
@@ -679,10 +675,10 @@ $code.=<<___;
 | 
			
		||||
	.set	reorder
 | 
			
		||||
	li	$minus4,-4
 | 
			
		||||
	and	$at,$a3,$minus4
 | 
			
		||||
	$LD	$t0,0($a1)
 | 
			
		||||
	beqz	$at,.L_bn_sub_words_tail
 | 
			
		||||
 | 
			
		||||
.L_bn_sub_words_loop:
 | 
			
		||||
	$LD	$t0,0($a1)
 | 
			
		||||
	$LD	$ta0,0($a2)
 | 
			
		||||
	subu	$a3,4
 | 
			
		||||
	$LD	$t1,$BNSZ($a1)
 | 
			
		||||
@@ -722,11 +718,10 @@ $code.=<<___;
 | 
			
		||||
	$SUBU	$t3,$ta3,$v0
 | 
			
		||||
	sgtu	$v0,$t3,$ta3
 | 
			
		||||
	$ST	$t3,-$BNSZ($a0)
 | 
			
		||||
	$ADDU	$v0,$t9
 | 
			
		||||
 | 
			
		||||
	.set	noreorder
 | 
			
		||||
	bgtzl	$at,.L_bn_sub_words_loop
 | 
			
		||||
	$LD	$t0,0($a1)
 | 
			
		||||
	bgtz	$at,.L_bn_sub_words_loop
 | 
			
		||||
	$ADDU	$v0,$t9
 | 
			
		||||
 | 
			
		||||
	beqz	$a3,.L_bn_sub_words_return
 | 
			
		||||
	nop
 | 
			
		||||
@@ -840,8 +835,9 @@ $code.=<<___;
 | 
			
		||||
	sltu	$ta0,$a1,$a2
 | 
			
		||||
	or	$t8,$ta0
 | 
			
		||||
	.set	noreorder
 | 
			
		||||
	beqzl	$at,.L_bn_div_3_words_inner_loop
 | 
			
		||||
	beqz	$at,.L_bn_div_3_words_inner_loop
 | 
			
		||||
	$SUBU	$v0,1
 | 
			
		||||
	$ADDU	$v0,1
 | 
			
		||||
	.set	reorder
 | 
			
		||||
.L_bn_div_3_words_inner_loop_done:
 | 
			
		||||
	.set	noreorder
 | 
			
		||||
@@ -902,7 +898,8 @@ $code.=<<___;
 | 
			
		||||
	and	$t2,$a0
 | 
			
		||||
	$SRL	$at,$a1,$t1
 | 
			
		||||
	.set	noreorder
 | 
			
		||||
	bnezl	$t2,.+8
 | 
			
		||||
	beqz	$t2,.+12
 | 
			
		||||
	nop
 | 
			
		||||
	break	6		# signal overflow
 | 
			
		||||
	.set	reorder
 | 
			
		||||
	$SLL	$a0,$t9
 | 
			
		||||
@@ -917,7 +914,8 @@ $code.=<<___;
 | 
			
		||||
	$SRL	$DH,$a2,4*$BNSZ	# bits
 | 
			
		||||
	sgeu	$at,$a0,$a2
 | 
			
		||||
	.set	noreorder
 | 
			
		||||
	bnezl	$at,.+8
 | 
			
		||||
	beqz	$at,.+12
 | 
			
		||||
	nop
 | 
			
		||||
	$SUBU	$a0,$a2
 | 
			
		||||
	.set	reorder
 | 
			
		||||
 | 
			
		||||
@@ -1874,6 +1872,41 @@ ___
 | 
			
		||||
 | 
			
		||||
($a_4,$a_5,$a_6,$a_7)=($b_0,$b_1,$b_2,$b_3);
 | 
			
		||||
 | 
			
		||||
sub add_c2 () {
 | 
			
		||||
my ($hi,$lo,$c0,$c1,$c2,
 | 
			
		||||
    $warm,      # !$warm denotes first call with specific sequence of
 | 
			
		||||
                # $c_[XYZ] when there is no Z-carry to accumulate yet;
 | 
			
		||||
    $an,$bn     # these two are arguments for multiplication which
 | 
			
		||||
                # result is used in *next* step [which is why it's
 | 
			
		||||
                # commented as "forward multiplication" below];
 | 
			
		||||
    )=@_;
 | 
			
		||||
$code.=<<___;
 | 
			
		||||
	mflo	$lo
 | 
			
		||||
	mfhi	$hi
 | 
			
		||||
	$ADDU	$c0,$lo
 | 
			
		||||
	sltu	$at,$c0,$lo
 | 
			
		||||
	 $MULTU	$an,$bn			# forward multiplication
 | 
			
		||||
	$ADDU	$c0,$lo
 | 
			
		||||
	$ADDU	$at,$hi
 | 
			
		||||
	sltu	$lo,$c0,$lo
 | 
			
		||||
	$ADDU	$c1,$at
 | 
			
		||||
	$ADDU	$hi,$lo
 | 
			
		||||
___
 | 
			
		||||
$code.=<<___	if (!$warm);
 | 
			
		||||
	sltu	$c2,$c1,$at
 | 
			
		||||
	$ADDU	$c1,$hi
 | 
			
		||||
	sltu	$hi,$c1,$hi
 | 
			
		||||
	$ADDU	$c2,$hi
 | 
			
		||||
___
 | 
			
		||||
$code.=<<___	if ($warm);
 | 
			
		||||
	sltu	$at,$c1,$at
 | 
			
		||||
	$ADDU	$c1,$hi
 | 
			
		||||
	$ADDU	$c2,$at
 | 
			
		||||
	sltu	$hi,$c1,$hi
 | 
			
		||||
	$ADDU	$c2,$hi
 | 
			
		||||
___
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
$code.=<<___;
 | 
			
		||||
 | 
			
		||||
.align	5
 | 
			
		||||
@@ -1922,21 +1955,10 @@ $code.=<<___;
 | 
			
		||||
	sltu	$at,$c_2,$t_1
 | 
			
		||||
	$ADDU	$c_3,$t_2,$at
 | 
			
		||||
	$ST	$c_2,$BNSZ($a0)
 | 
			
		||||
 | 
			
		||||
	mflo	$t_1
 | 
			
		||||
	mfhi	$t_2
 | 
			
		||||
	slt	$c_2,$t_2,$zero
 | 
			
		||||
	$SLL	$t_2,1
 | 
			
		||||
	$MULTU	$a_1,$a_1		# mul_add_c(a[1],b[1],c3,c1,c2);
 | 
			
		||||
	slt	$a2,$t_1,$zero
 | 
			
		||||
	$ADDU	$t_2,$a2
 | 
			
		||||
	$SLL	$t_1,1
 | 
			
		||||
	$ADDU	$c_3,$t_1
 | 
			
		||||
	sltu	$at,$c_3,$t_1
 | 
			
		||||
	$ADDU	$t_2,$at
 | 
			
		||||
	$ADDU	$c_1,$t_2
 | 
			
		||||
	sltu	$at,$c_1,$t_2
 | 
			
		||||
	$ADDU	$c_2,$at
 | 
			
		||||
___
 | 
			
		||||
	&add_c2($t_2,$t_1,$c_3,$c_1,$c_2,0,
 | 
			
		||||
		$a_1,$a_1);		# mul_add_c(a[1],b[1],c3,c1,c2);
 | 
			
		||||
$code.=<<___;
 | 
			
		||||
	mflo	$t_1
 | 
			
		||||
	mfhi	$t_2
 | 
			
		||||
	$ADDU	$c_3,$t_1
 | 
			
		||||
@@ -1947,67 +1969,19 @@ $code.=<<___;
 | 
			
		||||
	sltu	$at,$c_1,$t_2
 | 
			
		||||
	$ADDU	$c_2,$at
 | 
			
		||||
	$ST	$c_3,2*$BNSZ($a0)
 | 
			
		||||
 | 
			
		||||
	mflo	$t_1
 | 
			
		||||
	mfhi	$t_2
 | 
			
		||||
	slt	$c_3,$t_2,$zero
 | 
			
		||||
	$SLL	$t_2,1
 | 
			
		||||
	$MULTU	$a_1,$a_2		# mul_add_c2(a[1],b[2],c1,c2,c3);
 | 
			
		||||
	slt	$a2,$t_1,$zero
 | 
			
		||||
	$ADDU	$t_2,$a2
 | 
			
		||||
	$SLL	$t_1,1
 | 
			
		||||
	$ADDU	$c_1,$t_1
 | 
			
		||||
	sltu	$at,$c_1,$t_1
 | 
			
		||||
	$ADDU	$t_2,$at
 | 
			
		||||
	$ADDU	$c_2,$t_2
 | 
			
		||||
	sltu	$at,$c_2,$t_2
 | 
			
		||||
	$ADDU	$c_3,$at
 | 
			
		||||
	mflo	$t_1
 | 
			
		||||
	mfhi	$t_2
 | 
			
		||||
	slt	$at,$t_2,$zero
 | 
			
		||||
	$ADDU	$c_3,$at
 | 
			
		||||
	 $MULTU	$a_4,$a_0		# mul_add_c2(a[4],b[0],c2,c3,c1);
 | 
			
		||||
	$SLL	$t_2,1
 | 
			
		||||
	slt	$a2,$t_1,$zero
 | 
			
		||||
	$ADDU	$t_2,$a2
 | 
			
		||||
	$SLL	$t_1,1
 | 
			
		||||
	$ADDU	$c_1,$t_1
 | 
			
		||||
	sltu	$at,$c_1,$t_1
 | 
			
		||||
	$ADDU	$t_2,$at
 | 
			
		||||
	$ADDU	$c_2,$t_2
 | 
			
		||||
	sltu	$at,$c_2,$t_2
 | 
			
		||||
	$ADDU	$c_3,$at
 | 
			
		||||
___
 | 
			
		||||
	&add_c2($t_2,$t_1,$c_1,$c_2,$c_3,0,
 | 
			
		||||
		$a_1,$a_2);		# mul_add_c2(a[1],b[2],c1,c2,c3);
 | 
			
		||||
	&add_c2($t_2,$t_1,$c_1,$c_2,$c_3,1,
 | 
			
		||||
		$a_4,$a_0);		# mul_add_c2(a[4],b[0],c2,c3,c1);
 | 
			
		||||
$code.=<<___;
 | 
			
		||||
	$ST	$c_1,3*$BNSZ($a0)
 | 
			
		||||
 | 
			
		||||
	mflo	$t_1
 | 
			
		||||
	mfhi	$t_2
 | 
			
		||||
	slt	$c_1,$t_2,$zero
 | 
			
		||||
	$SLL	$t_2,1
 | 
			
		||||
	$MULTU	$a_3,$a_1		# mul_add_c2(a[3],b[1],c2,c3,c1);
 | 
			
		||||
	slt	$a2,$t_1,$zero
 | 
			
		||||
	$ADDU	$t_2,$a2
 | 
			
		||||
	$SLL	$t_1,1
 | 
			
		||||
	$ADDU	$c_2,$t_1
 | 
			
		||||
	sltu	$at,$c_2,$t_1
 | 
			
		||||
	$ADDU	$t_2,$at
 | 
			
		||||
	$ADDU	$c_3,$t_2
 | 
			
		||||
	sltu	$at,$c_3,$t_2
 | 
			
		||||
	$ADDU	$c_1,$at
 | 
			
		||||
	mflo	$t_1
 | 
			
		||||
	mfhi	$t_2
 | 
			
		||||
	slt	$at,$t_2,$zero
 | 
			
		||||
	$ADDU	$c_1,$at
 | 
			
		||||
	$MULTU	$a_2,$a_2		# mul_add_c(a[2],b[2],c2,c3,c1);
 | 
			
		||||
	$SLL	$t_2,1
 | 
			
		||||
	slt	$a2,$t_1,$zero
 | 
			
		||||
	$ADDU	$t_2,$a2
 | 
			
		||||
	$SLL	$t_1,1
 | 
			
		||||
	$ADDU	$c_2,$t_1
 | 
			
		||||
	sltu	$at,$c_2,$t_1
 | 
			
		||||
	$ADDU	$t_2,$at
 | 
			
		||||
	$ADDU	$c_3,$t_2
 | 
			
		||||
	sltu	$at,$c_3,$t_2
 | 
			
		||||
	$ADDU	$c_1,$at
 | 
			
		||||
___
 | 
			
		||||
	&add_c2($t_2,$t_1,$c_2,$c_3,$c_1,0,
 | 
			
		||||
		$a_3,$a_1);		# mul_add_c2(a[3],b[1],c2,c3,c1);
 | 
			
		||||
	&add_c2($t_2,$t_1,$c_2,$c_3,$c_1,1,
 | 
			
		||||
		$a_2,$a_2);		# mul_add_c(a[2],b[2],c2,c3,c1);
 | 
			
		||||
$code.=<<___;
 | 
			
		||||
	mflo	$t_1
 | 
			
		||||
	mfhi	$t_2
 | 
			
		||||
	$ADDU	$c_2,$t_1
 | 
			
		||||
@@ -2018,97 +1992,23 @@ $code.=<<___;
 | 
			
		||||
	sltu	$at,$c_3,$t_2
 | 
			
		||||
	$ADDU	$c_1,$at
 | 
			
		||||
	$ST	$c_2,4*$BNSZ($a0)
 | 
			
		||||
 | 
			
		||||
	mflo	$t_1
 | 
			
		||||
	mfhi	$t_2
 | 
			
		||||
	slt	$c_2,$t_2,$zero
 | 
			
		||||
	$SLL	$t_2,1
 | 
			
		||||
	$MULTU	$a_1,$a_4		# mul_add_c2(a[1],b[4],c3,c1,c2);
 | 
			
		||||
	slt	$a2,$t_1,$zero
 | 
			
		||||
	$ADDU	$t_2,$a2
 | 
			
		||||
	$SLL	$t_1,1
 | 
			
		||||
	$ADDU	$c_3,$t_1
 | 
			
		||||
	sltu	$at,$c_3,$t_1
 | 
			
		||||
	$ADDU	$t_2,$at
 | 
			
		||||
	$ADDU	$c_1,$t_2
 | 
			
		||||
	sltu	$at,$c_1,$t_2
 | 
			
		||||
	$ADDU	$c_2,$at
 | 
			
		||||
	mflo	$t_1
 | 
			
		||||
	mfhi	$t_2
 | 
			
		||||
	slt	$at,$t_2,$zero
 | 
			
		||||
	$ADDU	$c_2,$at
 | 
			
		||||
	$MULTU	$a_2,$a_3		# mul_add_c2(a[2],b[3],c3,c1,c2);
 | 
			
		||||
	$SLL	$t_2,1
 | 
			
		||||
	slt	$a2,$t_1,$zero
 | 
			
		||||
	$ADDU	$t_2,$a2
 | 
			
		||||
	$SLL	$t_1,1
 | 
			
		||||
	$ADDU	$c_3,$t_1
 | 
			
		||||
	sltu	$at,$c_3,$t_1
 | 
			
		||||
	$ADDU	$t_2,$at
 | 
			
		||||
	$ADDU	$c_1,$t_2
 | 
			
		||||
	sltu	$at,$c_1,$t_2
 | 
			
		||||
	$ADDU	$c_2,$at
 | 
			
		||||
	mflo	$t_1
 | 
			
		||||
	mfhi	$t_2
 | 
			
		||||
	slt	$at,$t_2,$zero
 | 
			
		||||
	 $MULTU	$a_6,$a_0		# mul_add_c2(a[6],b[0],c1,c2,c3);
 | 
			
		||||
	$ADDU	$c_2,$at
 | 
			
		||||
	$SLL	$t_2,1
 | 
			
		||||
	slt	$a2,$t_1,$zero
 | 
			
		||||
	$ADDU	$t_2,$a2
 | 
			
		||||
	$SLL	$t_1,1
 | 
			
		||||
	$ADDU	$c_3,$t_1
 | 
			
		||||
	sltu	$at,$c_3,$t_1
 | 
			
		||||
	$ADDU	$t_2,$at
 | 
			
		||||
	$ADDU	$c_1,$t_2
 | 
			
		||||
	sltu	$at,$c_1,$t_2
 | 
			
		||||
	$ADDU	$c_2,$at
 | 
			
		||||
___
 | 
			
		||||
	&add_c2($t_2,$t_1,$c_3,$c_1,$c_2,0,
 | 
			
		||||
		$a_1,$a_4);		# mul_add_c2(a[1],b[4],c3,c1,c2);
 | 
			
		||||
	&add_c2($t_2,$t_1,$c_3,$c_1,$c_2,1,
 | 
			
		||||
		$a_2,$a_3);		# mul_add_c2(a[2],b[3],c3,c1,c2);
 | 
			
		||||
	&add_c2($t_2,$t_1,$c_3,$c_1,$c_2,1,
 | 
			
		||||
		$a_6,$a_0);		# mul_add_c2(a[6],b[0],c1,c2,c3);
 | 
			
		||||
$code.=<<___;
 | 
			
		||||
	$ST	$c_3,5*$BNSZ($a0)
 | 
			
		||||
 | 
			
		||||
	mflo	$t_1
 | 
			
		||||
	mfhi	$t_2
 | 
			
		||||
	slt	$c_3,$t_2,$zero
 | 
			
		||||
	$SLL	$t_2,1
 | 
			
		||||
	$MULTU	$a_5,$a_1		# mul_add_c2(a[5],b[1],c1,c2,c3);
 | 
			
		||||
	slt	$a2,$t_1,$zero
 | 
			
		||||
	$ADDU	$t_2,$a2
 | 
			
		||||
	$SLL	$t_1,1
 | 
			
		||||
	$ADDU	$c_1,$t_1
 | 
			
		||||
	sltu	$at,$c_1,$t_1
 | 
			
		||||
	$ADDU	$t_2,$at
 | 
			
		||||
	$ADDU	$c_2,$t_2
 | 
			
		||||
	sltu	$at,$c_2,$t_2
 | 
			
		||||
	$ADDU	$c_3,$at
 | 
			
		||||
	mflo	$t_1
 | 
			
		||||
	mfhi	$t_2
 | 
			
		||||
	slt	$at,$t_2,$zero
 | 
			
		||||
	$ADDU	$c_3,$at
 | 
			
		||||
	$MULTU	$a_4,$a_2		# mul_add_c2(a[4],b[2],c1,c2,c3);
 | 
			
		||||
	$SLL	$t_2,1
 | 
			
		||||
	slt	$a2,$t_1,$zero
 | 
			
		||||
	$ADDU	$t_2,$a2
 | 
			
		||||
	$SLL	$t_1,1
 | 
			
		||||
	$ADDU	$c_1,$t_1
 | 
			
		||||
	sltu	$at,$c_1,$t_1
 | 
			
		||||
	$ADDU	$t_2,$at
 | 
			
		||||
	$ADDU	$c_2,$t_2
 | 
			
		||||
	sltu	$at,$c_2,$t_2
 | 
			
		||||
	$ADDU	$c_3,$at
 | 
			
		||||
	mflo	$t_1
 | 
			
		||||
	mfhi	$t_2
 | 
			
		||||
	slt	$at,$t_2,$zero
 | 
			
		||||
	$ADDU	$c_3,$at
 | 
			
		||||
	$MULTU	$a_3,$a_3		# mul_add_c(a[3],b[3],c1,c2,c3);
 | 
			
		||||
	$SLL	$t_2,1
 | 
			
		||||
	slt	$a2,$t_1,$zero
 | 
			
		||||
	$ADDU	$t_2,$a2
 | 
			
		||||
	$SLL	$t_1,1
 | 
			
		||||
	$ADDU	$c_1,$t_1
 | 
			
		||||
	sltu	$at,$c_1,$t_1
 | 
			
		||||
	$ADDU	$t_2,$at
 | 
			
		||||
	$ADDU	$c_2,$t_2
 | 
			
		||||
	sltu	$at,$c_2,$t_2
 | 
			
		||||
	$ADDU	$c_3,$at
 | 
			
		||||
___
 | 
			
		||||
	&add_c2($t_2,$t_1,$c_1,$c_2,$c_3,0,
 | 
			
		||||
		$a_5,$a_1);		# mul_add_c2(a[5],b[1],c1,c2,c3);
 | 
			
		||||
	&add_c2($t_2,$t_1,$c_1,$c_2,$c_3,1,
 | 
			
		||||
		$a_4,$a_2);		# mul_add_c2(a[4],b[2],c1,c2,c3);
 | 
			
		||||
	&add_c2($t_2,$t_1,$c_1,$c_2,$c_3,1,
 | 
			
		||||
		$a_3,$a_3);		# mul_add_c(a[3],b[3],c1,c2,c3);
 | 
			
		||||
$code.=<<___;
 | 
			
		||||
	mflo	$t_1
 | 
			
		||||
	mfhi	$t_2
 | 
			
		||||
	$ADDU	$c_1,$t_1
 | 
			
		||||
@@ -2119,112 +2019,25 @@ $code.=<<___;
 | 
			
		||||
	sltu	$at,$c_2,$t_2
 | 
			
		||||
	$ADDU	$c_3,$at
 | 
			
		||||
	$ST	$c_1,6*$BNSZ($a0)
 | 
			
		||||
 | 
			
		||||
	mflo	$t_1
 | 
			
		||||
	mfhi	$t_2
 | 
			
		||||
	slt	$c_1,$t_2,$zero
 | 
			
		||||
	$SLL	$t_2,1
 | 
			
		||||
	$MULTU	$a_1,$a_6		# mul_add_c2(a[1],b[6],c2,c3,c1);
 | 
			
		||||
	slt	$a2,$t_1,$zero
 | 
			
		||||
	$ADDU	$t_2,$a2
 | 
			
		||||
	$SLL	$t_1,1
 | 
			
		||||
	$ADDU	$c_2,$t_1
 | 
			
		||||
	sltu	$at,$c_2,$t_1
 | 
			
		||||
	$ADDU	$t_2,$at
 | 
			
		||||
	$ADDU	$c_3,$t_2
 | 
			
		||||
	sltu	$at,$c_3,$t_2
 | 
			
		||||
	$ADDU	$c_1,$at
 | 
			
		||||
	mflo	$t_1
 | 
			
		||||
	mfhi	$t_2
 | 
			
		||||
	slt	$at,$t_2,$zero
 | 
			
		||||
	$ADDU	$c_1,$at
 | 
			
		||||
	$MULTU	$a_2,$a_5		# mul_add_c2(a[2],b[5],c2,c3,c1);
 | 
			
		||||
	$SLL	$t_2,1
 | 
			
		||||
	slt	$a2,$t_1,$zero
 | 
			
		||||
	$ADDU	$t_2,$a2
 | 
			
		||||
	$SLL	$t_1,1
 | 
			
		||||
	$ADDU	$c_2,$t_1
 | 
			
		||||
	sltu	$at,$c_2,$t_1
 | 
			
		||||
	$ADDU	$t_2,$at
 | 
			
		||||
	$ADDU	$c_3,$t_2
 | 
			
		||||
	sltu	$at,$c_3,$t_2
 | 
			
		||||
	$ADDU	$c_1,$at
 | 
			
		||||
	mflo	$t_1
 | 
			
		||||
	mfhi	$t_2
 | 
			
		||||
	slt	$at,$t_2,$zero
 | 
			
		||||
	$ADDU	$c_1,$at
 | 
			
		||||
	$MULTU	$a_3,$a_4		# mul_add_c2(a[3],b[4],c2,c3,c1);
 | 
			
		||||
	$SLL	$t_2,1
 | 
			
		||||
	slt	$a2,$t_1,$zero
 | 
			
		||||
	$ADDU	$t_2,$a2
 | 
			
		||||
	$SLL	$t_1,1
 | 
			
		||||
	$ADDU	$c_2,$t_1
 | 
			
		||||
	sltu	$at,$c_2,$t_1
 | 
			
		||||
	$ADDU	$t_2,$at
 | 
			
		||||
	$ADDU	$c_3,$t_2
 | 
			
		||||
	sltu	$at,$c_3,$t_2
 | 
			
		||||
	$ADDU	$c_1,$at
 | 
			
		||||
	mflo	$t_1
 | 
			
		||||
	mfhi	$t_2
 | 
			
		||||
	slt	$at,$t_2,$zero
 | 
			
		||||
	$ADDU	$c_1,$at
 | 
			
		||||
	 $MULTU	$a_7,$a_1		# mul_add_c2(a[7],b[1],c3,c1,c2);
 | 
			
		||||
	$SLL	$t_2,1
 | 
			
		||||
	slt	$a2,$t_1,$zero
 | 
			
		||||
	$ADDU	$t_2,$a2
 | 
			
		||||
	$SLL	$t_1,1
 | 
			
		||||
	$ADDU	$c_2,$t_1
 | 
			
		||||
	sltu	$at,$c_2,$t_1
 | 
			
		||||
	$ADDU	$t_2,$at
 | 
			
		||||
	$ADDU	$c_3,$t_2
 | 
			
		||||
	sltu	$at,$c_3,$t_2
 | 
			
		||||
	$ADDU	$c_1,$at
 | 
			
		||||
___
 | 
			
		||||
	&add_c2($t_2,$t_1,$c_2,$c_3,$c_1,0,
 | 
			
		||||
		$a_1,$a_6);		# mul_add_c2(a[1],b[6],c2,c3,c1);
 | 
			
		||||
	&add_c2($t_2,$t_1,$c_2,$c_3,$c_1,1,
 | 
			
		||||
		$a_2,$a_5);		# mul_add_c2(a[2],b[5],c2,c3,c1);
 | 
			
		||||
	&add_c2($t_2,$t_1,$c_2,$c_3,$c_1,1,
 | 
			
		||||
		$a_3,$a_4);		# mul_add_c2(a[3],b[4],c2,c3,c1);
 | 
			
		||||
	&add_c2($t_2,$t_1,$c_2,$c_3,$c_1,1,
 | 
			
		||||
		$a_7,$a_1);		# mul_add_c2(a[7],b[1],c3,c1,c2);
 | 
			
		||||
$code.=<<___;
 | 
			
		||||
	$ST	$c_2,7*$BNSZ($a0)
 | 
			
		||||
 | 
			
		||||
	mflo	$t_1
 | 
			
		||||
	mfhi	$t_2
 | 
			
		||||
	slt	$c_2,$t_2,$zero
 | 
			
		||||
	$SLL	$t_2,1
 | 
			
		||||
	$MULTU	$a_6,$a_2		# mul_add_c2(a[6],b[2],c3,c1,c2);
 | 
			
		||||
	slt	$a2,$t_1,$zero
 | 
			
		||||
	$ADDU	$t_2,$a2
 | 
			
		||||
	$SLL	$t_1,1
 | 
			
		||||
	$ADDU	$c_3,$t_1
 | 
			
		||||
	sltu	$at,$c_3,$t_1
 | 
			
		||||
	$ADDU	$t_2,$at
 | 
			
		||||
	$ADDU	$c_1,$t_2
 | 
			
		||||
	sltu	$at,$c_1,$t_2
 | 
			
		||||
	$ADDU	$c_2,$at
 | 
			
		||||
	mflo	$t_1
 | 
			
		||||
	mfhi	$t_2
 | 
			
		||||
	slt	$at,$t_2,$zero
 | 
			
		||||
	$ADDU	$c_2,$at
 | 
			
		||||
	$MULTU	$a_5,$a_3		# mul_add_c2(a[5],b[3],c3,c1,c2);
 | 
			
		||||
	$SLL	$t_2,1
 | 
			
		||||
	slt	$a2,$t_1,$zero
 | 
			
		||||
	$ADDU	$t_2,$a2
 | 
			
		||||
	$SLL	$t_1,1
 | 
			
		||||
	$ADDU	$c_3,$t_1
 | 
			
		||||
	sltu	$at,$c_3,$t_1
 | 
			
		||||
	$ADDU	$t_2,$at
 | 
			
		||||
	$ADDU	$c_1,$t_2
 | 
			
		||||
	sltu	$at,$c_1,$t_2
 | 
			
		||||
	$ADDU	$c_2,$at
 | 
			
		||||
	mflo	$t_1
 | 
			
		||||
	mfhi	$t_2
 | 
			
		||||
	slt	$at,$t_2,$zero
 | 
			
		||||
	$ADDU	$c_2,$at
 | 
			
		||||
	$MULTU	$a_4,$a_4		# mul_add_c(a[4],b[4],c3,c1,c2);
 | 
			
		||||
	$SLL	$t_2,1
 | 
			
		||||
	slt	$a2,$t_1,$zero
 | 
			
		||||
	$ADDU	$t_2,$a2
 | 
			
		||||
	$SLL	$t_1,1
 | 
			
		||||
	$ADDU	$c_3,$t_1
 | 
			
		||||
	sltu	$at,$c_3,$t_1
 | 
			
		||||
	$ADDU	$t_2,$at
 | 
			
		||||
	$ADDU	$c_1,$t_2
 | 
			
		||||
	sltu	$at,$c_1,$t_2
 | 
			
		||||
	$ADDU	$c_2,$at
 | 
			
		||||
___
 | 
			
		||||
	&add_c2($t_2,$t_1,$c_3,$c_1,$c_2,0,
 | 
			
		||||
		$a_6,$a_2);		# mul_add_c2(a[6],b[2],c3,c1,c2);
 | 
			
		||||
	&add_c2($t_2,$t_1,$c_3,$c_1,$c_2,1,
 | 
			
		||||
		$a_5,$a_3);		# mul_add_c2(a[5],b[3],c3,c1,c2);
 | 
			
		||||
	&add_c2($t_2,$t_1,$c_3,$c_1,$c_2,1,
 | 
			
		||||
		$a_4,$a_4);		# mul_add_c(a[4],b[4],c3,c1,c2);
 | 
			
		||||
$code.=<<___;
 | 
			
		||||
	mflo	$t_1
 | 
			
		||||
	mfhi	$t_2
 | 
			
		||||
	$ADDU	$c_3,$t_1
 | 
			
		||||
@@ -2235,82 +2048,21 @@ $code.=<<___;
 | 
			
		||||
	sltu	$at,$c_1,$t_2
 | 
			
		||||
	$ADDU	$c_2,$at
 | 
			
		||||
	$ST	$c_3,8*$BNSZ($a0)
 | 
			
		||||
 | 
			
		||||
	mflo	$t_1
 | 
			
		||||
	mfhi	$t_2
 | 
			
		||||
	slt	$c_3,$t_2,$zero
 | 
			
		||||
	$SLL	$t_2,1
 | 
			
		||||
	$MULTU	$a_3,$a_6		# mul_add_c2(a[3],b[6],c1,c2,c3);
 | 
			
		||||
	slt	$a2,$t_1,$zero
 | 
			
		||||
	$ADDU	$t_2,$a2
 | 
			
		||||
	$SLL	$t_1,1
 | 
			
		||||
	$ADDU	$c_1,$t_1
 | 
			
		||||
	sltu	$at,$c_1,$t_1
 | 
			
		||||
	$ADDU	$t_2,$at
 | 
			
		||||
	$ADDU	$c_2,$t_2
 | 
			
		||||
	sltu	$at,$c_2,$t_2
 | 
			
		||||
	$ADDU	$c_3,$at
 | 
			
		||||
	mflo	$t_1
 | 
			
		||||
	mfhi	$t_2
 | 
			
		||||
	slt	$at,$t_2,$zero
 | 
			
		||||
	$ADDU	$c_3,$at
 | 
			
		||||
	$MULTU	$a_4,$a_5		# mul_add_c2(a[4],b[5],c1,c2,c3);
 | 
			
		||||
	$SLL	$t_2,1
 | 
			
		||||
	slt	$a2,$t_1,$zero
 | 
			
		||||
	$ADDU	$t_2,$a2
 | 
			
		||||
	$SLL	$t_1,1
 | 
			
		||||
	$ADDU	$c_1,$t_1
 | 
			
		||||
	sltu	$at,$c_1,$t_1
 | 
			
		||||
	$ADDU	$t_2,$at
 | 
			
		||||
	$ADDU	$c_2,$t_2
 | 
			
		||||
	sltu	$at,$c_2,$t_2
 | 
			
		||||
	$ADDU	$c_3,$at
 | 
			
		||||
	mflo	$t_1
 | 
			
		||||
	mfhi	$t_2
 | 
			
		||||
	slt	$at,$t_2,$zero
 | 
			
		||||
	$ADDU	$c_3,$at
 | 
			
		||||
	 $MULTU	$a_7,$a_3		# mul_add_c2(a[7],b[3],c2,c3,c1);
 | 
			
		||||
	$SLL	$t_2,1
 | 
			
		||||
	slt	$a2,$t_1,$zero
 | 
			
		||||
	$ADDU	$t_2,$a2
 | 
			
		||||
	$SLL	$t_1,1
 | 
			
		||||
	$ADDU	$c_1,$t_1
 | 
			
		||||
	sltu	$at,$c_1,$t_1
 | 
			
		||||
	$ADDU	$t_2,$at
 | 
			
		||||
	$ADDU	$c_2,$t_2
 | 
			
		||||
	sltu	$at,$c_2,$t_2
 | 
			
		||||
	$ADDU	$c_3,$at
 | 
			
		||||
___
 | 
			
		||||
	&add_c2($t_2,$t_1,$c_1,$c_2,$c_3,0,
 | 
			
		||||
		$a_3,$a_6);		# mul_add_c2(a[3],b[6],c1,c2,c3);
 | 
			
		||||
	&add_c2($t_2,$t_1,$c_1,$c_2,$c_3,1,
 | 
			
		||||
		$a_4,$a_5);		# mul_add_c2(a[4],b[5],c1,c2,c3);
 | 
			
		||||
	&add_c2($t_2,$t_1,$c_1,$c_2,$c_3,1,
 | 
			
		||||
		$a_7,$a_3);		# mul_add_c2(a[7],b[3],c2,c3,c1);
 | 
			
		||||
$code.=<<___;
 | 
			
		||||
	$ST	$c_1,9*$BNSZ($a0)
 | 
			
		||||
 | 
			
		||||
	mflo	$t_1
 | 
			
		||||
	mfhi	$t_2
 | 
			
		||||
	slt	$c_1,$t_2,$zero
 | 
			
		||||
	$SLL	$t_2,1
 | 
			
		||||
	$MULTU	$a_6,$a_4		# mul_add_c2(a[6],b[4],c2,c3,c1);
 | 
			
		||||
	slt	$a2,$t_1,$zero
 | 
			
		||||
	$ADDU	$t_2,$a2
 | 
			
		||||
	$SLL	$t_1,1
 | 
			
		||||
	$ADDU	$c_2,$t_1
 | 
			
		||||
	sltu	$at,$c_2,$t_1
 | 
			
		||||
	$ADDU	$t_2,$at
 | 
			
		||||
	$ADDU	$c_3,$t_2
 | 
			
		||||
	sltu	$at,$c_3,$t_2
 | 
			
		||||
	$ADDU	$c_1,$at
 | 
			
		||||
	mflo	$t_1
 | 
			
		||||
	mfhi	$t_2
 | 
			
		||||
	slt	$at,$t_2,$zero
 | 
			
		||||
	$ADDU	$c_1,$at
 | 
			
		||||
	$MULTU	$a_5,$a_5		# mul_add_c(a[5],b[5],c2,c3,c1);
 | 
			
		||||
	$SLL	$t_2,1
 | 
			
		||||
	slt	$a2,$t_1,$zero
 | 
			
		||||
	$ADDU	$t_2,$a2
 | 
			
		||||
	$SLL	$t_1,1
 | 
			
		||||
	$ADDU	$c_2,$t_1
 | 
			
		||||
	sltu	$at,$c_2,$t_1
 | 
			
		||||
	$ADDU	$t_2,$at
 | 
			
		||||
	$ADDU	$c_3,$t_2
 | 
			
		||||
	sltu	$at,$c_3,$t_2
 | 
			
		||||
	$ADDU	$c_1,$at
 | 
			
		||||
___
 | 
			
		||||
	&add_c2($t_2,$t_1,$c_2,$c_3,$c_1,0,
 | 
			
		||||
		$a_6,$a_4);		# mul_add_c2(a[6],b[4],c2,c3,c1);
 | 
			
		||||
	&add_c2($t_2,$t_1,$c_2,$c_3,$c_1,1,
 | 
			
		||||
		$a_5,$a_5);		# mul_add_c(a[5],b[5],c2,c3,c1);
 | 
			
		||||
$code.=<<___;
 | 
			
		||||
	mflo	$t_1
 | 
			
		||||
	mfhi	$t_2
 | 
			
		||||
	$ADDU	$c_2,$t_1
 | 
			
		||||
@@ -2321,52 +2073,17 @@ $code.=<<___;
 | 
			
		||||
	sltu	$at,$c_3,$t_2
 | 
			
		||||
	$ADDU	$c_1,$at
 | 
			
		||||
	$ST	$c_2,10*$BNSZ($a0)
 | 
			
		||||
 | 
			
		||||
	mflo	$t_1
 | 
			
		||||
	mfhi	$t_2
 | 
			
		||||
	slt	$c_2,$t_2,$zero
 | 
			
		||||
	$SLL	$t_2,1
 | 
			
		||||
	$MULTU	$a_5,$a_6		# mul_add_c2(a[5],b[6],c3,c1,c2);
 | 
			
		||||
	slt	$a2,$t_1,$zero
 | 
			
		||||
	$ADDU	$t_2,$a2
 | 
			
		||||
	$SLL	$t_1,1
 | 
			
		||||
	$ADDU	$c_3,$t_1
 | 
			
		||||
	sltu	$at,$c_3,$t_1
 | 
			
		||||
	$ADDU	$t_2,$at
 | 
			
		||||
	$ADDU	$c_1,$t_2
 | 
			
		||||
	sltu	$at,$c_1,$t_2
 | 
			
		||||
	$ADDU	$c_2,$at
 | 
			
		||||
	mflo	$t_1
 | 
			
		||||
	mfhi	$t_2
 | 
			
		||||
	slt	$at,$t_2,$zero
 | 
			
		||||
	$ADDU	$c_2,$at
 | 
			
		||||
	 $MULTU	$a_7,$a_5		# mul_add_c2(a[7],b[5],c1,c2,c3);
 | 
			
		||||
	$SLL	$t_2,1
 | 
			
		||||
	slt	$a2,$t_1,$zero
 | 
			
		||||
	$ADDU	$t_2,$a2
 | 
			
		||||
	$SLL	$t_1,1
 | 
			
		||||
	$ADDU	$c_3,$t_1
 | 
			
		||||
	sltu	$at,$c_3,$t_1
 | 
			
		||||
	$ADDU	$t_2,$at
 | 
			
		||||
	$ADDU	$c_1,$t_2
 | 
			
		||||
	sltu	$at,$c_1,$t_2
 | 
			
		||||
	$ADDU	$c_2,$at
 | 
			
		||||
___
 | 
			
		||||
	&add_c2($t_2,$t_1,$c_3,$c_1,$c_2,0,
 | 
			
		||||
		$a_5,$a_6);		# mul_add_c2(a[5],b[6],c3,c1,c2);
 | 
			
		||||
	&add_c2($t_2,$t_1,$c_3,$c_1,$c_2,1,
 | 
			
		||||
		$a_7,$a_5);		# mul_add_c2(a[7],b[5],c1,c2,c3);
 | 
			
		||||
$code.=<<___;
 | 
			
		||||
	$ST	$c_3,11*$BNSZ($a0)
 | 
			
		||||
 | 
			
		||||
	mflo	$t_1
 | 
			
		||||
	mfhi	$t_2
 | 
			
		||||
	slt	$c_3,$t_2,$zero
 | 
			
		||||
	$SLL	$t_2,1
 | 
			
		||||
	$MULTU	$a_6,$a_6		# mul_add_c(a[6],b[6],c1,c2,c3);
 | 
			
		||||
	slt	$a2,$t_1,$zero
 | 
			
		||||
	$ADDU	$t_2,$a2
 | 
			
		||||
	$SLL	$t_1,1
 | 
			
		||||
	$ADDU	$c_1,$t_1
 | 
			
		||||
	sltu	$at,$c_1,$t_1
 | 
			
		||||
	$ADDU	$t_2,$at
 | 
			
		||||
	$ADDU	$c_2,$t_2
 | 
			
		||||
	sltu	$at,$c_2,$t_2
 | 
			
		||||
	$ADDU	$c_3,$at
 | 
			
		||||
___
 | 
			
		||||
	&add_c2($t_2,$t_1,$c_1,$c_2,$c_3,0,
 | 
			
		||||
		$a_6,$a_6);		# mul_add_c(a[6],b[6],c1,c2,c3);
 | 
			
		||||
$code.=<<___;
 | 
			
		||||
	mflo	$t_1
 | 
			
		||||
	mfhi	$t_2
 | 
			
		||||
	$ADDU	$c_1,$t_1
 | 
			
		||||
@@ -2377,21 +2094,10 @@ $code.=<<___;
 | 
			
		||||
	sltu	$at,$c_2,$t_2
 | 
			
		||||
	$ADDU	$c_3,$at
 | 
			
		||||
	$ST	$c_1,12*$BNSZ($a0)
 | 
			
		||||
 | 
			
		||||
	mflo	$t_1
 | 
			
		||||
	mfhi	$t_2
 | 
			
		||||
	slt	$c_1,$t_2,$zero
 | 
			
		||||
	$SLL	$t_2,1
 | 
			
		||||
	 $MULTU	$a_7,$a_7		# mul_add_c(a[7],b[7],c3,c1,c2);
 | 
			
		||||
	slt	$a2,$t_1,$zero
 | 
			
		||||
	$ADDU	$t_2,$a2
 | 
			
		||||
	$SLL	$t_1,1
 | 
			
		||||
	$ADDU	$c_2,$t_1
 | 
			
		||||
	sltu	$at,$c_2,$t_1
 | 
			
		||||
	$ADDU	$t_2,$at
 | 
			
		||||
	$ADDU	$c_3,$t_2
 | 
			
		||||
	sltu	$at,$c_3,$t_2
 | 
			
		||||
	$ADDU	$c_1,$at
 | 
			
		||||
___
 | 
			
		||||
	&add_c2($t_2,$t_1,$c_2,$c_3,$c_1,0,
 | 
			
		||||
		$a_7,$a_7);		# mul_add_c(a[7],b[7],c3,c1,c2);
 | 
			
		||||
$code.=<<___;
 | 
			
		||||
	$ST	$c_2,13*$BNSZ($a0)
 | 
			
		||||
 | 
			
		||||
	mflo	$t_1
 | 
			
		||||
@@ -2459,21 +2165,10 @@ $code.=<<___;
 | 
			
		||||
	sltu	$at,$c_2,$t_1
 | 
			
		||||
	$ADDU	$c_3,$t_2,$at
 | 
			
		||||
	$ST	$c_2,$BNSZ($a0)
 | 
			
		||||
 | 
			
		||||
	mflo	$t_1
 | 
			
		||||
	mfhi	$t_2
 | 
			
		||||
	slt	$c_2,$t_2,$zero
 | 
			
		||||
	$SLL	$t_2,1
 | 
			
		||||
	$MULTU	$a_1,$a_1		# mul_add_c(a[1],b[1],c3,c1,c2);
 | 
			
		||||
	slt	$a2,$t_1,$zero
 | 
			
		||||
	$ADDU	$t_2,$a2
 | 
			
		||||
	$SLL	$t_1,1
 | 
			
		||||
	$ADDU	$c_3,$t_1
 | 
			
		||||
	sltu	$at,$c_3,$t_1
 | 
			
		||||
	$ADDU	$t_2,$at
 | 
			
		||||
	$ADDU	$c_1,$t_2
 | 
			
		||||
	sltu	$at,$c_1,$t_2
 | 
			
		||||
	$ADDU	$c_2,$at
 | 
			
		||||
___
 | 
			
		||||
	&add_c2($t_2,$t_1,$c_3,$c_1,$c_2,0,
 | 
			
		||||
		$a_1,$a_1);		# mul_add_c(a[1],b[1],c3,c1,c2);
 | 
			
		||||
$code.=<<___;
 | 
			
		||||
	mflo	$t_1
 | 
			
		||||
	mfhi	$t_2
 | 
			
		||||
	$ADDU	$c_3,$t_1
 | 
			
		||||
@@ -2484,52 +2179,17 @@ $code.=<<___;
 | 
			
		||||
	sltu	$at,$c_1,$t_2
 | 
			
		||||
	$ADDU	$c_2,$at
 | 
			
		||||
	$ST	$c_3,2*$BNSZ($a0)
 | 
			
		||||
 | 
			
		||||
	mflo	$t_1
 | 
			
		||||
	mfhi	$t_2
 | 
			
		||||
	slt	$c_3,$t_2,$zero
 | 
			
		||||
	$SLL	$t_2,1
 | 
			
		||||
	$MULTU	$a_1,$a_2		# mul_add_c(a2[1],b[2],c1,c2,c3);
 | 
			
		||||
	slt	$a2,$t_1,$zero
 | 
			
		||||
	$ADDU	$t_2,$a2
 | 
			
		||||
	$SLL	$t_1,1
 | 
			
		||||
	$ADDU	$c_1,$t_1
 | 
			
		||||
	sltu	$at,$c_1,$t_1
 | 
			
		||||
	$ADDU	$t_2,$at
 | 
			
		||||
	$ADDU	$c_2,$t_2
 | 
			
		||||
	sltu	$at,$c_2,$t_2
 | 
			
		||||
	$ADDU	$c_3,$at
 | 
			
		||||
	mflo	$t_1
 | 
			
		||||
	mfhi	$t_2
 | 
			
		||||
	slt	$at,$t_2,$zero
 | 
			
		||||
	$ADDU	$c_3,$at
 | 
			
		||||
	 $MULTU	$a_3,$a_1		# mul_add_c2(a[3],b[1],c2,c3,c1);
 | 
			
		||||
	$SLL	$t_2,1
 | 
			
		||||
	slt	$a2,$t_1,$zero
 | 
			
		||||
	$ADDU	$t_2,$a2
 | 
			
		||||
	$SLL	$t_1,1
 | 
			
		||||
	$ADDU	$c_1,$t_1
 | 
			
		||||
	sltu	$at,$c_1,$t_1
 | 
			
		||||
	$ADDU	$t_2,$at
 | 
			
		||||
	$ADDU	$c_2,$t_2
 | 
			
		||||
	sltu	$at,$c_2,$t_2
 | 
			
		||||
	$ADDU	$c_3,$at
 | 
			
		||||
___
 | 
			
		||||
	&add_c2($t_2,$t_1,$c_1,$c_2,$c_3,0,
 | 
			
		||||
		$a_1,$a_2);		# mul_add_c2(a2[1],b[2],c1,c2,c3);
 | 
			
		||||
	&add_c2($t_2,$t_1,$c_1,$c_2,$c_3,1,
 | 
			
		||||
		$a_3,$a_1);		# mul_add_c2(a[3],b[1],c2,c3,c1);
 | 
			
		||||
$code.=<<___;
 | 
			
		||||
	$ST	$c_1,3*$BNSZ($a0)
 | 
			
		||||
 | 
			
		||||
	mflo	$t_1
 | 
			
		||||
	mfhi	$t_2
 | 
			
		||||
	slt	$c_1,$t_2,$zero
 | 
			
		||||
	$SLL	$t_2,1
 | 
			
		||||
	$MULTU	$a_2,$a_2		# mul_add_c(a[2],b[2],c2,c3,c1);
 | 
			
		||||
	slt	$a2,$t_1,$zero
 | 
			
		||||
	$ADDU	$t_2,$a2
 | 
			
		||||
	$SLL	$t_1,1
 | 
			
		||||
	$ADDU	$c_2,$t_1
 | 
			
		||||
	sltu	$at,$c_2,$t_1
 | 
			
		||||
	$ADDU	$t_2,$at
 | 
			
		||||
	$ADDU	$c_3,$t_2
 | 
			
		||||
	sltu	$at,$c_3,$t_2
 | 
			
		||||
	$ADDU	$c_1,$at
 | 
			
		||||
___
 | 
			
		||||
	&add_c2($t_2,$t_1,$c_2,$c_3,$c_1,0,
 | 
			
		||||
		$a_2,$a_2);		# mul_add_c(a[2],b[2],c2,c3,c1);
 | 
			
		||||
$code.=<<___;
 | 
			
		||||
	mflo	$t_1
 | 
			
		||||
	mfhi	$t_2
 | 
			
		||||
	$ADDU	$c_2,$t_1
 | 
			
		||||
@@ -2540,21 +2200,10 @@ $code.=<<___;
 | 
			
		||||
	sltu	$at,$c_3,$t_2
 | 
			
		||||
	$ADDU	$c_1,$at
 | 
			
		||||
	$ST	$c_2,4*$BNSZ($a0)
 | 
			
		||||
 | 
			
		||||
	mflo	$t_1
 | 
			
		||||
	mfhi	$t_2
 | 
			
		||||
	slt	$c_2,$t_2,$zero
 | 
			
		||||
	$SLL	$t_2,1
 | 
			
		||||
	 $MULTU	$a_3,$a_3		# mul_add_c(a[3],b[3],c1,c2,c3);
 | 
			
		||||
	slt	$a2,$t_1,$zero
 | 
			
		||||
	$ADDU	$t_2,$a2
 | 
			
		||||
	$SLL	$t_1,1
 | 
			
		||||
	$ADDU	$c_3,$t_1
 | 
			
		||||
	sltu	$at,$c_3,$t_1
 | 
			
		||||
	$ADDU	$t_2,$at
 | 
			
		||||
	$ADDU	$c_1,$t_2
 | 
			
		||||
	sltu	$at,$c_1,$t_2
 | 
			
		||||
	$ADDU	$c_2,$at
 | 
			
		||||
___
 | 
			
		||||
	&add_c2($t_2,$t_1,$c_3,$c_1,$c_2,0,
 | 
			
		||||
		$a_3,$a_3);		# mul_add_c(a[3],b[3],c1,c2,c3);
 | 
			
		||||
$code.=<<___;
 | 
			
		||||
	$ST	$c_3,5*$BNSZ($a0)
 | 
			
		||||
 | 
			
		||||
	mflo	$t_1
 | 
			
		||||
 
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -40,7 +40,7 @@
 | 
			
		||||
# of arithmetic operations, most notably multiplications. It requires
 | 
			
		||||
# more memory references, most notably to tp[num], but this doesn't
 | 
			
		||||
# seem to exhaust memory port capacity. And indeed, dedicated PA-RISC
 | 
			
		||||
# 2.0 code path, provides virtually same performance as pa-risc2[W].s:
 | 
			
		||||
# 2.0 code path provides virtually same performance as pa-risc2[W].s:
 | 
			
		||||
# it's ~10% better for shortest key length and ~10% worse for longest
 | 
			
		||||
# one.
 | 
			
		||||
#
 | 
			
		||||
@@ -988,6 +988,8 @@ foreach (split("\n",$code)) {
 | 
			
		||||
	# assemble 2.0 instructions in 32-bit mode...
 | 
			
		||||
	s/^\s+([a-z]+)([\S]*)\s+([\S]*)/&assemble($1,$2,$3)/e if ($BN_SZ==4);
 | 
			
		||||
 | 
			
		||||
	s/\bbv\b/bve/gm	if ($SIZE_T==8);
 | 
			
		||||
 | 
			
		||||
	print $_,"\n";
 | 
			
		||||
}
 | 
			
		||||
close STDOUT;
 | 
			
		||||
 
 | 
			
		||||
@@ -189,7 +189,7 @@ BN_ULONG bn_add_words (BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,int
 | 
			
		||||
 | 
			
		||||
	if (n <= 0) return 0;
 | 
			
		||||
 | 
			
		||||
	asm (
 | 
			
		||||
	asm volatile (
 | 
			
		||||
	"	subq	%2,%2		\n"
 | 
			
		||||
	".p2align 4			\n"
 | 
			
		||||
	"1:	movq	(%4,%2,8),%0	\n"
 | 
			
		||||
@@ -200,7 +200,7 @@ BN_ULONG bn_add_words (BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,int
 | 
			
		||||
	"	sbbq	%0,%0		\n"
 | 
			
		||||
		: "=&a"(ret),"+c"(n),"=&r"(i)
 | 
			
		||||
		: "r"(rp),"r"(ap),"r"(bp)
 | 
			
		||||
		: "cc"
 | 
			
		||||
		: "cc", "memory"
 | 
			
		||||
	);
 | 
			
		||||
 | 
			
		||||
  return ret&1;
 | 
			
		||||
@@ -212,7 +212,7 @@ BN_ULONG bn_sub_words (BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,int
 | 
			
		||||
 | 
			
		||||
	if (n <= 0) return 0;
 | 
			
		||||
 | 
			
		||||
	asm (
 | 
			
		||||
	asm volatile (
 | 
			
		||||
	"	subq	%2,%2		\n"
 | 
			
		||||
	".p2align 4			\n"
 | 
			
		||||
	"1:	movq	(%4,%2,8),%0	\n"
 | 
			
		||||
@@ -223,7 +223,7 @@ BN_ULONG bn_sub_words (BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,int
 | 
			
		||||
	"	sbbq	%0,%0		\n"
 | 
			
		||||
		: "=&a"(ret),"+c"(n),"=&r"(i)
 | 
			
		||||
		: "r"(rp),"r"(ap),"r"(bp)
 | 
			
		||||
		: "cc"
 | 
			
		||||
		: "cc", "memory"
 | 
			
		||||
	);
 | 
			
		||||
 | 
			
		||||
  return ret&1;
 | 
			
		||||
@@ -273,6 +273,10 @@ BN_ULONG bn_sub_words(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n)
 | 
			
		||||
/* sqr_add_c(a,i,c0,c1,c2)  -- c+=a[i]^2 for three word number c=(c2,c1,c0) */
 | 
			
		||||
/* sqr_add_c2(a,i,c0,c1,c2) -- c+=2*a[i]*a[j] for three word number c=(c2,c1,c0) */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Keep in mind that carrying into high part of multiplication result
 | 
			
		||||
 * can not overflow, because it cannot be all-ones.
 | 
			
		||||
 */
 | 
			
		||||
#if 0
 | 
			
		||||
/* original macros are kept for reference purposes */
 | 
			
		||||
#define mul_add_c(a,b,c0,c1,c2) {	\
 | 
			
		||||
@@ -287,10 +291,10 @@ BN_ULONG bn_sub_words(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n)
 | 
			
		||||
	BN_ULONG ta=(a),tb=(b),t0;	\
 | 
			
		||||
	t1 = BN_UMULT_HIGH(ta,tb);	\
 | 
			
		||||
	t0 = ta * tb;			\
 | 
			
		||||
	t2 = t1+t1; c2 += (t2<t1)?1:0;	\
 | 
			
		||||
	t1 = t0+t0; t2 += (t1<t0)?1:0;	\
 | 
			
		||||
	c0 += t1; t2 += (c0<t1)?1:0;	\
 | 
			
		||||
	c0 += t0; t2 = t1+((c0<t0)?1:0);\
 | 
			
		||||
	c1 += t2; c2 += (c1<t2)?1:0;	\
 | 
			
		||||
	c0 += t0; t1 += (c0<t0)?1:0;	\
 | 
			
		||||
	c1 += t1; c2 += (c1<t1)?1:0;	\
 | 
			
		||||
	}
 | 
			
		||||
#else
 | 
			
		||||
#define mul_add_c(a,b,c0,c1,c2)	do {	\
 | 
			
		||||
@@ -328,22 +332,14 @@ BN_ULONG bn_sub_words(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n)
 | 
			
		||||
		: "=a"(t1),"=d"(t2)	\
 | 
			
		||||
		: "a"(a),"m"(b)		\
 | 
			
		||||
		: "cc");		\
 | 
			
		||||
	asm ("addq %0,%0; adcq %2,%1"	\
 | 
			
		||||
		: "+d"(t2),"+r"(c2)	\
 | 
			
		||||
		: "g"(0)		\
 | 
			
		||||
		: "cc");		\
 | 
			
		||||
	asm ("addq %0,%0; adcq %2,%1"	\
 | 
			
		||||
		: "+a"(t1),"+d"(t2)	\
 | 
			
		||||
		: "g"(0)		\
 | 
			
		||||
		: "cc");		\
 | 
			
		||||
	asm ("addq %2,%0; adcq %3,%1"	\
 | 
			
		||||
		: "+r"(c0),"+d"(t2)	\
 | 
			
		||||
		: "a"(t1),"g"(0)	\
 | 
			
		||||
		: "cc");		\
 | 
			
		||||
	asm ("addq %2,%0; adcq %3,%1"	\
 | 
			
		||||
		: "+r"(c1),"+r"(c2)	\
 | 
			
		||||
		: "d"(t2),"g"(0)	\
 | 
			
		||||
		: "cc");		\
 | 
			
		||||
	asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"	\
 | 
			
		||||
		: "+r"(c0),"+r"(c1),"+r"(c2)		\
 | 
			
		||||
		: "r"(t1),"r"(t2),"g"(0)		\
 | 
			
		||||
		: "cc");				\
 | 
			
		||||
	asm ("addq %3,%0; adcq %4,%1; adcq %5,%2"	\
 | 
			
		||||
		: "+r"(c0),"+r"(c1),"+r"(c2)		\
 | 
			
		||||
		: "r"(t1),"r"(t2),"g"(0)		\
 | 
			
		||||
		: "cc");				\
 | 
			
		||||
	} while (0)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -31,7 +31,8 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
 | 
			
		||||
( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or
 | 
			
		||||
die "can't locate x86_64-xlate.pl";
 | 
			
		||||
 | 
			
		||||
open STDOUT,"| \"$^X\" $xlate $flavour $output";
 | 
			
		||||
open OUT,"| \"$^X\" $xlate $flavour $output";
 | 
			
		||||
*STDOUT=*OUT;
 | 
			
		||||
 | 
			
		||||
($lo,$hi)=("%rax","%rdx");	$a=$lo;
 | 
			
		||||
($i0,$i1)=("%rsi","%rdi");
 | 
			
		||||
 
 | 
			
		||||
@@ -901,8 +901,8 @@ $code.=<<___;
 | 
			
		||||
	jnz	.Lgather
 | 
			
		||||
___
 | 
			
		||||
$code.=<<___ if ($win64);
 | 
			
		||||
	movaps	%xmm6,(%rsp)
 | 
			
		||||
	movaps	%xmm7,0x10(%rsp)
 | 
			
		||||
	movaps	(%rsp),%xmm6
 | 
			
		||||
	movaps	0x10(%rsp),%xmm7
 | 
			
		||||
	lea	0x28(%rsp),%rsp
 | 
			
		||||
___
 | 
			
		||||
$code.=<<___;
 | 
			
		||||
 
 | 
			
		||||
@@ -538,6 +538,8 @@ BIGNUM *BN_mod_inverse(BIGNUM *ret,
 | 
			
		||||
BIGNUM *BN_mod_sqrt(BIGNUM *ret,
 | 
			
		||||
	const BIGNUM *a, const BIGNUM *n,BN_CTX *ctx);
 | 
			
		||||
 | 
			
		||||
void	BN_consttime_swap(BN_ULONG swap, BIGNUM *a, BIGNUM *b, int nwords);
 | 
			
		||||
 | 
			
		||||
/* Deprecated versions */
 | 
			
		||||
#ifndef OPENSSL_NO_DEPRECATED
 | 
			
		||||
BIGNUM *BN_generate_prime(BIGNUM *ret,int bits,int safe,
 | 
			
		||||
@@ -774,11 +776,22 @@ int RAND_pseudo_bytes(unsigned char *buf,int num);
 | 
			
		||||
 | 
			
		||||
#define bn_fix_top(a)		bn_check_top(a)
 | 
			
		||||
 | 
			
		||||
#define bn_check_size(bn, bits) bn_wcheck_size(bn, ((bits+BN_BITS2-1))/BN_BITS2)
 | 
			
		||||
#define bn_wcheck_size(bn, words) \
 | 
			
		||||
	do { \
 | 
			
		||||
		const BIGNUM *_bnum2 = (bn); \
 | 
			
		||||
		assert((words) <= (_bnum2)->dmax && (words) >= (_bnum2)->top); \
 | 
			
		||||
		/* avoid unused variable warning with NDEBUG */ \
 | 
			
		||||
		(void)(_bnum2); \
 | 
			
		||||
	} while(0)
 | 
			
		||||
 | 
			
		||||
#else /* !BN_DEBUG */
 | 
			
		||||
 | 
			
		||||
#define bn_pollute(a)
 | 
			
		||||
#define bn_check_top(a)
 | 
			
		||||
#define bn_fix_top(a)		bn_correct_top(a)
 | 
			
		||||
#define bn_check_size(bn, bits)
 | 
			
		||||
#define bn_wcheck_size(bn, words)
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -438,6 +438,10 @@ BN_ULONG bn_sub_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, int n)
 | 
			
		||||
/* sqr_add_c(a,i,c0,c1,c2)  -- c+=a[i]^2 for three word number c=(c2,c1,c0) */
 | 
			
		||||
/* sqr_add_c2(a,i,c0,c1,c2) -- c+=2*a[i]*a[j] for three word number c=(c2,c1,c0) */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Keep in mind that carrying into high part of multiplication result
 | 
			
		||||
 * can not overflow, because it cannot be all-ones.
 | 
			
		||||
 */
 | 
			
		||||
#ifdef BN_LLONG
 | 
			
		||||
#define mul_add_c(a,b,c0,c1,c2) \
 | 
			
		||||
	t=(BN_ULLONG)a*b; \
 | 
			
		||||
@@ -478,10 +482,10 @@ BN_ULONG bn_sub_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, int n)
 | 
			
		||||
#define mul_add_c2(a,b,c0,c1,c2) {	\
 | 
			
		||||
	BN_ULONG ta=(a),tb=(b),t0;	\
 | 
			
		||||
	BN_UMULT_LOHI(t0,t1,ta,tb);	\
 | 
			
		||||
	t2 = t1+t1; c2 += (t2<t1)?1:0;	\
 | 
			
		||||
	t1 = t0+t0; t2 += (t1<t0)?1:0;	\
 | 
			
		||||
	c0 += t1; t2 += (c0<t1)?1:0;	\
 | 
			
		||||
	c0 += t0; t2 = t1+((c0<t0)?1:0);\
 | 
			
		||||
	c1 += t2; c2 += (c1<t2)?1:0;	\
 | 
			
		||||
	c0 += t0; t1 += (c0<t0)?1:0;	\
 | 
			
		||||
	c1 += t1; c2 += (c1<t1)?1:0;	\
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
#define sqr_add_c(a,i,c0,c1,c2)	{	\
 | 
			
		||||
@@ -508,10 +512,10 @@ BN_ULONG bn_sub_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, int n)
 | 
			
		||||
	BN_ULONG ta=(a),tb=(b),t0;	\
 | 
			
		||||
	t1 = BN_UMULT_HIGH(ta,tb);	\
 | 
			
		||||
	t0 = ta * tb;			\
 | 
			
		||||
	t2 = t1+t1; c2 += (t2<t1)?1:0;	\
 | 
			
		||||
	t1 = t0+t0; t2 += (t1<t0)?1:0;	\
 | 
			
		||||
	c0 += t1; t2 += (c0<t1)?1:0;	\
 | 
			
		||||
	c0 += t0; t2 = t1+((c0<t0)?1:0);\
 | 
			
		||||
	c1 += t2; c2 += (c1<t2)?1:0;	\
 | 
			
		||||
	c0 += t0; t1 += (c0<t0)?1:0;	\
 | 
			
		||||
	c1 += t1; c2 += (c1<t1)?1:0;	\
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
#define sqr_add_c(a,i,c0,c1,c2)	{	\
 | 
			
		||||
 
 | 
			
		||||
@@ -158,7 +158,7 @@ static void ctxdbg(BN_CTX *ctx)
 | 
			
		||||
	unsigned int bnidx = 0, fpidx = 0;
 | 
			
		||||
	BN_POOL_ITEM *item = ctx->pool.head;
 | 
			
		||||
	BN_STACK *stack = &ctx->stack;
 | 
			
		||||
	fprintf(stderr,"(%08x): ", (unsigned int)ctx);
 | 
			
		||||
	fprintf(stderr,"(%16p): ", ctx);
 | 
			
		||||
	while(bnidx < ctx->used)
 | 
			
		||||
		{
 | 
			
		||||
		fprintf(stderr,"%03x ", item->vals[bnidx++ % BN_CTX_POOL_SIZE].dmax);
 | 
			
		||||
 
 | 
			
		||||
@@ -189,15 +189,17 @@ int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
 | 
			
		||||
	int no_branch=0;
 | 
			
		||||
 | 
			
		||||
	/* Invalid zero-padding would have particularly bad consequences
 | 
			
		||||
	 * in the case of 'num', so don't just rely on bn_check_top() for this one
 | 
			
		||||
	 * so don't just rely on bn_check_top() here
 | 
			
		||||
	 * (bn_check_top() works only for BN_DEBUG builds) */
 | 
			
		||||
	if (num->top > 0 && num->d[num->top - 1] == 0)
 | 
			
		||||
	if ((num->top > 0 && num->d[num->top - 1] == 0) ||
 | 
			
		||||
		(divisor->top > 0 && divisor->d[divisor->top - 1] == 0))
 | 
			
		||||
		{
 | 
			
		||||
		BNerr(BN_F_BN_DIV,BN_R_NOT_INITIALIZED);
 | 
			
		||||
		return 0;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	bn_check_top(num);
 | 
			
		||||
	bn_check_top(divisor);
 | 
			
		||||
 | 
			
		||||
	if ((BN_get_flags(num, BN_FLG_CONSTTIME) != 0) || (BN_get_flags(divisor, BN_FLG_CONSTTIME) != 0))
 | 
			
		||||
		{
 | 
			
		||||
@@ -207,7 +209,7 @@ int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
 | 
			
		||||
	bn_check_top(dv);
 | 
			
		||||
	bn_check_top(rm);
 | 
			
		||||
	/* bn_check_top(num); */ /* 'num' has been checked already */
 | 
			
		||||
	bn_check_top(divisor);
 | 
			
		||||
	/* bn_check_top(divisor); */ /* 'divisor' has been checked already */
 | 
			
		||||
 | 
			
		||||
	if (BN_is_zero(divisor))
 | 
			
		||||
		{
 | 
			
		||||
 
 | 
			
		||||
@@ -680,7 +680,7 @@ int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
 | 
			
		||||
 | 
			
		||||
    /* Dedicated window==4 case improves 512-bit RSA sign by ~15%, but as
 | 
			
		||||
     * 512-bit RSA is hardly relevant, we omit it to spare size... */ 
 | 
			
		||||
    if (window==5)
 | 
			
		||||
    if (window==5 && top>1)
 | 
			
		||||
	{
 | 
			
		||||
	void bn_mul_mont_gather5(BN_ULONG *rp,const BN_ULONG *ap,
 | 
			
		||||
			const void *table,const BN_ULONG *np,
 | 
			
		||||
@@ -874,7 +874,14 @@ int BN_mod_exp_mont_word(BIGNUM *rr, BN_ULONG a, const BIGNUM *p,
 | 
			
		||||
	bits = BN_num_bits(p);
 | 
			
		||||
	if (bits == 0)
 | 
			
		||||
		{
 | 
			
		||||
		ret = BN_one(rr);
 | 
			
		||||
		/* x**0 mod 1 is still zero. */
 | 
			
		||||
		if (BN_is_one(m))
 | 
			
		||||
			{
 | 
			
		||||
			ret = 1;
 | 
			
		||||
			BN_zero(rr);
 | 
			
		||||
			}
 | 
			
		||||
		else
 | 
			
		||||
			ret = BN_one(rr);
 | 
			
		||||
		return ret;
 | 
			
		||||
		}
 | 
			
		||||
	if (a == 0)
 | 
			
		||||
 
 | 
			
		||||
@@ -320,6 +320,15 @@ static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
 | 
			
		||||
		BNerr(BN_F_BN_EXPAND_INTERNAL,ERR_R_MALLOC_FAILURE);
 | 
			
		||||
		return(NULL);
 | 
			
		||||
		}
 | 
			
		||||
#ifdef PURIFY
 | 
			
		||||
	/* Valgrind complains in BN_consttime_swap because we process the whole
 | 
			
		||||
	 * array even if it's not initialised yet. This doesn't matter in that
 | 
			
		||||
	 * function - what's important is constant time operation (we're not
 | 
			
		||||
	 * actually going to use the data)
 | 
			
		||||
	*/
 | 
			
		||||
	memset(a, 0, sizeof(BN_ULONG)*words);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if 1
 | 
			
		||||
	B=b->d;
 | 
			
		||||
	/* Check if the previous number needs to be copied */
 | 
			
		||||
@@ -824,3 +833,55 @@ int bn_cmp_part_words(const BN_ULONG *a, const BN_ULONG *b,
 | 
			
		||||
		}
 | 
			
		||||
	return bn_cmp_words(a,b,cl);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
/* 
 | 
			
		||||
 * Constant-time conditional swap of a and b.  
 | 
			
		||||
 * a and b are swapped if condition is not 0.  The code assumes that at most one bit of condition is set.
 | 
			
		||||
 * nwords is the number of words to swap.  The code assumes that at least nwords are allocated in both a and b,
 | 
			
		||||
 * and that no more than nwords are used by either a or b.
 | 
			
		||||
 * a and b cannot be the same number
 | 
			
		||||
 */
 | 
			
		||||
void BN_consttime_swap(BN_ULONG condition, BIGNUM *a, BIGNUM *b, int nwords)
 | 
			
		||||
	{
 | 
			
		||||
	BN_ULONG t;
 | 
			
		||||
	int i;
 | 
			
		||||
 | 
			
		||||
	bn_wcheck_size(a, nwords);
 | 
			
		||||
	bn_wcheck_size(b, nwords);
 | 
			
		||||
 | 
			
		||||
	assert(a != b);
 | 
			
		||||
	assert((condition & (condition - 1)) == 0);
 | 
			
		||||
	assert(sizeof(BN_ULONG) >= sizeof(int));
 | 
			
		||||
 | 
			
		||||
	condition = ((condition - 1) >> (BN_BITS2 - 1)) - 1;
 | 
			
		||||
 | 
			
		||||
	t = (a->top^b->top) & condition;
 | 
			
		||||
	a->top ^= t;
 | 
			
		||||
	b->top ^= t;
 | 
			
		||||
 | 
			
		||||
#define BN_CONSTTIME_SWAP(ind) \
 | 
			
		||||
	do { \
 | 
			
		||||
		t = (a->d[ind] ^ b->d[ind]) & condition; \
 | 
			
		||||
		a->d[ind] ^= t; \
 | 
			
		||||
		b->d[ind] ^= t; \
 | 
			
		||||
	} while (0)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	switch (nwords) {
 | 
			
		||||
	default:
 | 
			
		||||
		for (i = 10; i < nwords; i++) 
 | 
			
		||||
			BN_CONSTTIME_SWAP(i);
 | 
			
		||||
		/* Fallthrough */
 | 
			
		||||
	case 10: BN_CONSTTIME_SWAP(9); /* Fallthrough */
 | 
			
		||||
	case 9: BN_CONSTTIME_SWAP(8); /* Fallthrough */
 | 
			
		||||
	case 8: BN_CONSTTIME_SWAP(7); /* Fallthrough */
 | 
			
		||||
	case 7: BN_CONSTTIME_SWAP(6); /* Fallthrough */
 | 
			
		||||
	case 6: BN_CONSTTIME_SWAP(5); /* Fallthrough */
 | 
			
		||||
	case 5: BN_CONSTTIME_SWAP(4); /* Fallthrough */
 | 
			
		||||
	case 4: BN_CONSTTIME_SWAP(3); /* Fallthrough */
 | 
			
		||||
	case 3: BN_CONSTTIME_SWAP(2); /* Fallthrough */
 | 
			
		||||
	case 2: BN_CONSTTIME_SWAP(1); /* Fallthrough */
 | 
			
		||||
	case 1: BN_CONSTTIME_SWAP(0);
 | 
			
		||||
	}
 | 
			
		||||
#undef BN_CONSTTIME_SWAP
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -478,32 +478,38 @@ BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to, BN_MONT_CTX *from)
 | 
			
		||||
BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, int lock,
 | 
			
		||||
					const BIGNUM *mod, BN_CTX *ctx)
 | 
			
		||||
	{
 | 
			
		||||
	int got_write_lock = 0;
 | 
			
		||||
	BN_MONT_CTX *ret;
 | 
			
		||||
 | 
			
		||||
	CRYPTO_r_lock(lock);
 | 
			
		||||
	if (!*pmont)
 | 
			
		||||
		{
 | 
			
		||||
		CRYPTO_r_unlock(lock);
 | 
			
		||||
		CRYPTO_w_lock(lock);
 | 
			
		||||
		got_write_lock = 1;
 | 
			
		||||
 | 
			
		||||
		if (!*pmont)
 | 
			
		||||
			{
 | 
			
		||||
			ret = BN_MONT_CTX_new();
 | 
			
		||||
			if (ret && !BN_MONT_CTX_set(ret, mod, ctx))
 | 
			
		||||
				BN_MONT_CTX_free(ret);
 | 
			
		||||
			else
 | 
			
		||||
				*pmont = ret;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	
 | 
			
		||||
	ret = *pmont;
 | 
			
		||||
	
 | 
			
		||||
	if (got_write_lock)
 | 
			
		||||
		CRYPTO_w_unlock(lock);
 | 
			
		||||
	CRYPTO_r_unlock(lock);
 | 
			
		||||
	if (ret)
 | 
			
		||||
		return ret;
 | 
			
		||||
 | 
			
		||||
	/* We don't want to serialise globally while doing our lazy-init math in
 | 
			
		||||
	 * BN_MONT_CTX_set. That punishes threads that are doing independent
 | 
			
		||||
	 * things. Instead, punish the case where more than one thread tries to
 | 
			
		||||
	 * lazy-init the same 'pmont', by having each do the lazy-init math work
 | 
			
		||||
	 * independently and only use the one from the thread that wins the race
 | 
			
		||||
	 * (the losers throw away the work they've done). */
 | 
			
		||||
	ret = BN_MONT_CTX_new();
 | 
			
		||||
	if (!ret)
 | 
			
		||||
		return NULL;
 | 
			
		||||
	if (!BN_MONT_CTX_set(ret, mod, ctx))
 | 
			
		||||
		{
 | 
			
		||||
		BN_MONT_CTX_free(ret);
 | 
			
		||||
		return NULL;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	/* The locked compare-and-set, after the local work is done. */
 | 
			
		||||
	CRYPTO_w_lock(lock);
 | 
			
		||||
	if (*pmont)
 | 
			
		||||
		{
 | 
			
		||||
		BN_MONT_CTX_free(ret);
 | 
			
		||||
		ret = *pmont;
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
		CRYPTO_r_unlock(lock);
 | 
			
		||||
		
 | 
			
		||||
		*pmont = ret;
 | 
			
		||||
	CRYPTO_w_unlock(lock);
 | 
			
		||||
	return ret;
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -286,26 +286,25 @@ const BIGNUM *BN_get0_nist_prime_521(void)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void nist_cp_bn_0(BN_ULONG *buf, BN_ULONG *a, int top, int max)
 | 
			
		||||
static void nist_cp_bn_0(BN_ULONG *dst, const BN_ULONG *src, int top, int max)
 | 
			
		||||
	{
 | 
			
		||||
	int i;
 | 
			
		||||
	BN_ULONG *_tmp1 = (buf), *_tmp2 = (a);
 | 
			
		||||
 | 
			
		||||
#ifdef BN_DEBUG
 | 
			
		||||
	OPENSSL_assert(top <= max);
 | 
			
		||||
#endif
 | 
			
		||||
	for (i = (top); i != 0; i--)
 | 
			
		||||
		*_tmp1++ = *_tmp2++;
 | 
			
		||||
	for (i = (max) - (top); i != 0; i--)
 | 
			
		||||
		*_tmp1++ = (BN_ULONG) 0;
 | 
			
		||||
	for (i = 0; i < top; i++)
 | 
			
		||||
		dst[i] = src[i];
 | 
			
		||||
	for (; i < max; i++)
 | 
			
		||||
		dst[i] = 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static void nist_cp_bn(BN_ULONG *buf, BN_ULONG *a, int top)
 | 
			
		||||
static void nist_cp_bn(BN_ULONG *dst, const BN_ULONG *src, int top)
 | 
			
		||||
	{ 
 | 
			
		||||
	int i;
 | 
			
		||||
	BN_ULONG *_tmp1 = (buf), *_tmp2 = (a);
 | 
			
		||||
	for (i = (top); i != 0; i--)
 | 
			
		||||
		*_tmp1++ = *_tmp2++;
 | 
			
		||||
 | 
			
		||||
	for (i = 0; i < top; i++)
 | 
			
		||||
		dst[i] = src[i];
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
#if BN_BITS2 == 64
 | 
			
		||||
@@ -451,8 +450,9 @@ int BN_nist_mod_192(BIGNUM *r, const BIGNUM *a, const BIGNUM *field,
 | 
			
		||||
	 */
 | 
			
		||||
	mask  = 0-(PTR_SIZE_INT)bn_sub_words(c_d,r_d,_nist_p_192[0],BN_NIST_192_TOP);
 | 
			
		||||
	mask &= 0-(PTR_SIZE_INT)carry;
 | 
			
		||||
	res   = c_d;
 | 
			
		||||
	res   = (BN_ULONG *)
 | 
			
		||||
	 (((PTR_SIZE_INT)c_d&~mask) | ((PTR_SIZE_INT)r_d&mask));
 | 
			
		||||
	 (((PTR_SIZE_INT)res&~mask) | ((PTR_SIZE_INT)r_d&mask));
 | 
			
		||||
	nist_cp_bn(r_d, res, BN_NIST_192_TOP);
 | 
			
		||||
	r->top = BN_NIST_192_TOP;
 | 
			
		||||
	bn_correct_top(r);
 | 
			
		||||
@@ -479,8 +479,11 @@ int BN_nist_mod_224(BIGNUM *r, const BIGNUM *a, const BIGNUM *field,
 | 
			
		||||
	int	top = a->top, i;
 | 
			
		||||
	int	carry;
 | 
			
		||||
	BN_ULONG *r_d, *a_d = a->d;
 | 
			
		||||
	BN_ULONG buf[BN_NIST_224_TOP],
 | 
			
		||||
		 c_d[BN_NIST_224_TOP],
 | 
			
		||||
	union	{
 | 
			
		||||
		BN_ULONG	bn[BN_NIST_224_TOP];
 | 
			
		||||
		unsigned int	ui[BN_NIST_224_TOP*sizeof(BN_ULONG)/sizeof(unsigned int)];
 | 
			
		||||
		} buf;
 | 
			
		||||
	BN_ULONG c_d[BN_NIST_224_TOP],
 | 
			
		||||
		*res;
 | 
			
		||||
	PTR_SIZE_INT mask;
 | 
			
		||||
	union { bn_addsub_f f; PTR_SIZE_INT p; } u;
 | 
			
		||||
@@ -519,18 +522,18 @@ int BN_nist_mod_224(BIGNUM *r, const BIGNUM *a, const BIGNUM *field,
 | 
			
		||||
	/* copy upper 256 bits of 448 bit number ... */
 | 
			
		||||
	nist_cp_bn_0(c_d, a_d + (BN_NIST_224_TOP-1), top - (BN_NIST_224_TOP-1), BN_NIST_224_TOP);
 | 
			
		||||
	/* ... and right shift by 32 to obtain upper 224 bits */
 | 
			
		||||
	nist_set_224(buf, c_d, 14, 13, 12, 11, 10, 9, 8);
 | 
			
		||||
	nist_set_224(buf.bn, c_d, 14, 13, 12, 11, 10, 9, 8);
 | 
			
		||||
	/* truncate lower part to 224 bits too */
 | 
			
		||||
	r_d[BN_NIST_224_TOP-1] &= BN_MASK2l;
 | 
			
		||||
#else
 | 
			
		||||
	nist_cp_bn_0(buf, a_d + BN_NIST_224_TOP, top - BN_NIST_224_TOP, BN_NIST_224_TOP);
 | 
			
		||||
	nist_cp_bn_0(buf.bn, a_d + BN_NIST_224_TOP, top - BN_NIST_224_TOP, BN_NIST_224_TOP);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined(NIST_INT64) && BN_BITS2!=64
 | 
			
		||||
	{
 | 
			
		||||
	NIST_INT64		acc;	/* accumulator */
 | 
			
		||||
	unsigned int		*rp=(unsigned int *)r_d;
 | 
			
		||||
	const unsigned int	*bp=(const unsigned int *)buf;
 | 
			
		||||
	const unsigned int	*bp=(const unsigned int *)buf.ui;
 | 
			
		||||
 | 
			
		||||
	acc  = rp[0];	acc -= bp[7-7];
 | 
			
		||||
			acc -= bp[11-7]; rp[0] = (unsigned int)acc; acc >>= 32;
 | 
			
		||||
@@ -565,13 +568,13 @@ int BN_nist_mod_224(BIGNUM *r, const BIGNUM *a, const BIGNUM *field,
 | 
			
		||||
	{
 | 
			
		||||
	BN_ULONG t_d[BN_NIST_224_TOP];
 | 
			
		||||
 | 
			
		||||
	nist_set_224(t_d, buf, 10, 9, 8, 7, 0, 0, 0);
 | 
			
		||||
	nist_set_224(t_d, buf.bn, 10, 9, 8, 7, 0, 0, 0);
 | 
			
		||||
	carry = (int)bn_add_words(r_d, r_d, t_d, BN_NIST_224_TOP);
 | 
			
		||||
	nist_set_224(t_d, buf, 0, 13, 12, 11, 0, 0, 0);
 | 
			
		||||
	nist_set_224(t_d, buf.bn, 0, 13, 12, 11, 0, 0, 0);
 | 
			
		||||
	carry += (int)bn_add_words(r_d, r_d, t_d, BN_NIST_224_TOP);
 | 
			
		||||
	nist_set_224(t_d, buf, 13, 12, 11, 10, 9, 8, 7);
 | 
			
		||||
	nist_set_224(t_d, buf.bn, 13, 12, 11, 10, 9, 8, 7);
 | 
			
		||||
	carry -= (int)bn_sub_words(r_d, r_d, t_d, BN_NIST_224_TOP);
 | 
			
		||||
	nist_set_224(t_d, buf, 0, 0, 0, 0, 13, 12, 11);
 | 
			
		||||
	nist_set_224(t_d, buf.bn, 0, 0, 0, 0, 13, 12, 11);
 | 
			
		||||
	carry -= (int)bn_sub_words(r_d, r_d, t_d, BN_NIST_224_TOP);
 | 
			
		||||
 | 
			
		||||
#if BN_BITS2==64
 | 
			
		||||
@@ -606,7 +609,8 @@ int BN_nist_mod_224(BIGNUM *r, const BIGNUM *a, const BIGNUM *field,
 | 
			
		||||
	/* otherwise it's effectively same as in BN_nist_mod_192... */
 | 
			
		||||
	mask  = 0-(PTR_SIZE_INT)(*u.f)(c_d,r_d,_nist_p_224[0],BN_NIST_224_TOP);
 | 
			
		||||
	mask &= 0-(PTR_SIZE_INT)carry;
 | 
			
		||||
	res   = (BN_ULONG *)(((PTR_SIZE_INT)c_d&~mask) |
 | 
			
		||||
	res   = c_d;
 | 
			
		||||
	res   = (BN_ULONG *)(((PTR_SIZE_INT)res&~mask) |
 | 
			
		||||
	 ((PTR_SIZE_INT)r_d&mask));
 | 
			
		||||
	nist_cp_bn(r_d, res, BN_NIST_224_TOP);
 | 
			
		||||
	r->top = BN_NIST_224_TOP;
 | 
			
		||||
@@ -805,7 +809,8 @@ int BN_nist_mod_256(BIGNUM *r, const BIGNUM *a, const BIGNUM *field,
 | 
			
		||||
 | 
			
		||||
	mask  = 0-(PTR_SIZE_INT)(*u.f)(c_d,r_d,_nist_p_256[0],BN_NIST_256_TOP);
 | 
			
		||||
	mask &= 0-(PTR_SIZE_INT)carry;
 | 
			
		||||
	res   = (BN_ULONG *)(((PTR_SIZE_INT)c_d&~mask) |
 | 
			
		||||
	res   = c_d;
 | 
			
		||||
	res   = (BN_ULONG *)(((PTR_SIZE_INT)res&~mask) |
 | 
			
		||||
	 ((PTR_SIZE_INT)r_d&mask));
 | 
			
		||||
	nist_cp_bn(r_d, res, BN_NIST_256_TOP);
 | 
			
		||||
	r->top = BN_NIST_256_TOP;
 | 
			
		||||
@@ -1026,7 +1031,8 @@ int BN_nist_mod_384(BIGNUM *r, const BIGNUM *a, const BIGNUM *field,
 | 
			
		||||
 | 
			
		||||
	mask  = 0-(PTR_SIZE_INT)(*u.f)(c_d,r_d,_nist_p_384[0],BN_NIST_384_TOP);
 | 
			
		||||
	mask &= 0-(PTR_SIZE_INT)carry;
 | 
			
		||||
	res   = (BN_ULONG *)(((PTR_SIZE_INT)c_d&~mask) |
 | 
			
		||||
	res   = c_d;
 | 
			
		||||
	res   = (BN_ULONG *)(((PTR_SIZE_INT)res&~mask) |
 | 
			
		||||
	 ((PTR_SIZE_INT)r_d&mask));
 | 
			
		||||
	nist_cp_bn(r_d, res, BN_NIST_384_TOP);
 | 
			
		||||
	r->top = BN_NIST_384_TOP;
 | 
			
		||||
@@ -1082,9 +1088,9 @@ int BN_nist_mod_521(BIGNUM *r, const BIGNUM *a, const BIGNUM *field,
 | 
			
		||||
	/* ... and right shift */
 | 
			
		||||
	for (val=t_d[0],i=0; i<BN_NIST_521_TOP-1; i++)
 | 
			
		||||
		{
 | 
			
		||||
		tmp = val>>BN_NIST_521_RSHIFT;
 | 
			
		||||
		val = t_d[i+1];
 | 
			
		||||
		t_d[i] = (tmp | val<<BN_NIST_521_LSHIFT) & BN_MASK2;
 | 
			
		||||
		t_d[i] = ( val>>BN_NIST_521_RSHIFT |
 | 
			
		||||
			  (tmp=t_d[i+1])<<BN_NIST_521_LSHIFT ) & BN_MASK2;
 | 
			
		||||
		val=tmp;
 | 
			
		||||
		}
 | 
			
		||||
	t_d[i] = val>>BN_NIST_521_RSHIFT;
 | 
			
		||||
	/* lower 521 bits */
 | 
			
		||||
@@ -1092,7 +1098,8 @@ int BN_nist_mod_521(BIGNUM *r, const BIGNUM *a, const BIGNUM *field,
 | 
			
		||||
 | 
			
		||||
	bn_add_words(r_d,r_d,t_d,BN_NIST_521_TOP);
 | 
			
		||||
	mask = 0-(PTR_SIZE_INT)bn_sub_words(t_d,r_d,_nist_p_521,BN_NIST_521_TOP);
 | 
			
		||||
	res  = (BN_ULONG *)(((PTR_SIZE_INT)t_d&~mask) |
 | 
			
		||||
	res  = t_d;
 | 
			
		||||
	res  = (BN_ULONG *)(((PTR_SIZE_INT)res&~mask) |
 | 
			
		||||
	 ((PTR_SIZE_INT)r_d&mask));
 | 
			
		||||
	nist_cp_bn(r_d,res,BN_NIST_521_TOP);
 | 
			
		||||
	r->top = BN_NIST_521_TOP;
 | 
			
		||||
 
 | 
			
		||||
@@ -77,6 +77,7 @@ int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx)
 | 
			
		||||
	if (al <= 0)
 | 
			
		||||
		{
 | 
			
		||||
		r->top=0;
 | 
			
		||||
		r->neg = 0;
 | 
			
		||||
		return 1;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -107,6 +107,7 @@ int test_mod(BIO *bp,BN_CTX *ctx);
 | 
			
		||||
int test_mod_mul(BIO *bp,BN_CTX *ctx);
 | 
			
		||||
int test_mod_exp(BIO *bp,BN_CTX *ctx);
 | 
			
		||||
int test_mod_exp_mont_consttime(BIO *bp,BN_CTX *ctx);
 | 
			
		||||
int test_mod_exp_mont5(BIO *bp, BN_CTX *ctx);
 | 
			
		||||
int test_exp(BIO *bp,BN_CTX *ctx);
 | 
			
		||||
int test_gf2m_add(BIO *bp);
 | 
			
		||||
int test_gf2m_mod(BIO *bp);
 | 
			
		||||
@@ -249,6 +250,7 @@ int main(int argc, char *argv[])
 | 
			
		||||
 | 
			
		||||
	message(out,"BN_mod_exp_mont_consttime");
 | 
			
		||||
	if (!test_mod_exp_mont_consttime(out,ctx)) goto err;
 | 
			
		||||
	if (!test_mod_exp_mont5(out,ctx)) goto err;
 | 
			
		||||
	(void)BIO_flush(out);
 | 
			
		||||
 | 
			
		||||
	message(out,"BN_exp");
 | 
			
		||||
@@ -676,44 +678,98 @@ int test_mul(BIO *bp)
 | 
			
		||||
 | 
			
		||||
int test_sqr(BIO *bp, BN_CTX *ctx)
 | 
			
		||||
	{
 | 
			
		||||
	BIGNUM a,c,d,e;
 | 
			
		||||
	int i;
 | 
			
		||||
	BIGNUM *a,*c,*d,*e;
 | 
			
		||||
	int i, ret = 0;
 | 
			
		||||
 | 
			
		||||
	BN_init(&a);
 | 
			
		||||
	BN_init(&c);
 | 
			
		||||
	BN_init(&d);
 | 
			
		||||
	BN_init(&e);
 | 
			
		||||
	a = BN_new();
 | 
			
		||||
	c = BN_new();
 | 
			
		||||
	d = BN_new();
 | 
			
		||||
	e = BN_new();
 | 
			
		||||
	if (a == NULL || c == NULL || d == NULL || e == NULL)
 | 
			
		||||
		{
 | 
			
		||||
		goto err;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	for (i=0; i<num0; i++)
 | 
			
		||||
		{
 | 
			
		||||
		BN_bntest_rand(&a,40+i*10,0,0);
 | 
			
		||||
		a.neg=rand_neg();
 | 
			
		||||
		BN_sqr(&c,&a,ctx);
 | 
			
		||||
		BN_bntest_rand(a,40+i*10,0,0);
 | 
			
		||||
		a->neg=rand_neg();
 | 
			
		||||
		BN_sqr(c,a,ctx);
 | 
			
		||||
		if (bp != NULL)
 | 
			
		||||
			{
 | 
			
		||||
			if (!results)
 | 
			
		||||
				{
 | 
			
		||||
				BN_print(bp,&a);
 | 
			
		||||
				BN_print(bp,a);
 | 
			
		||||
				BIO_puts(bp," * ");
 | 
			
		||||
				BN_print(bp,&a);
 | 
			
		||||
				BN_print(bp,a);
 | 
			
		||||
				BIO_puts(bp," - ");
 | 
			
		||||
				}
 | 
			
		||||
			BN_print(bp,&c);
 | 
			
		||||
			BN_print(bp,c);
 | 
			
		||||
			BIO_puts(bp,"\n");
 | 
			
		||||
			}
 | 
			
		||||
		BN_div(&d,&e,&c,&a,ctx);
 | 
			
		||||
		BN_sub(&d,&d,&a);
 | 
			
		||||
		if(!BN_is_zero(&d) || !BN_is_zero(&e))
 | 
			
		||||
		    {
 | 
			
		||||
		    fprintf(stderr,"Square test failed!\n");
 | 
			
		||||
		    return 0;
 | 
			
		||||
		    }
 | 
			
		||||
		BN_div(d,e,c,a,ctx);
 | 
			
		||||
		BN_sub(d,d,a);
 | 
			
		||||
		if(!BN_is_zero(d) || !BN_is_zero(e))
 | 
			
		||||
			{
 | 
			
		||||
			fprintf(stderr,"Square test failed!\n");
 | 
			
		||||
			goto err;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	BN_free(&a);
 | 
			
		||||
	BN_free(&c);
 | 
			
		||||
	BN_free(&d);
 | 
			
		||||
	BN_free(&e);
 | 
			
		||||
	return(1);
 | 
			
		||||
 | 
			
		||||
	/* Regression test for a BN_sqr overflow bug. */
 | 
			
		||||
	BN_hex2bn(&a,
 | 
			
		||||
		"80000000000000008000000000000001FFFFFFFFFFFFFFFE0000000000000000");
 | 
			
		||||
	BN_sqr(c, a, ctx);
 | 
			
		||||
	if (bp != NULL)
 | 
			
		||||
		{
 | 
			
		||||
		if (!results)
 | 
			
		||||
			{
 | 
			
		||||
			BN_print(bp,a);
 | 
			
		||||
			BIO_puts(bp," * ");
 | 
			
		||||
			BN_print(bp,a);
 | 
			
		||||
			BIO_puts(bp," - ");
 | 
			
		||||
			}
 | 
			
		||||
		BN_print(bp,c);
 | 
			
		||||
		BIO_puts(bp,"\n");
 | 
			
		||||
		}
 | 
			
		||||
	BN_mul(d, a, a, ctx);
 | 
			
		||||
	if (BN_cmp(c, d))
 | 
			
		||||
		{
 | 
			
		||||
		fprintf(stderr, "Square test failed: BN_sqr and BN_mul produce "
 | 
			
		||||
			"different results!\n");
 | 
			
		||||
		goto err;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	/* Regression test for a BN_sqr overflow bug. */
 | 
			
		||||
	BN_hex2bn(&a,
 | 
			
		||||
		"80000000000000000000000080000001FFFFFFFE000000000000000000000000");
 | 
			
		||||
	BN_sqr(c, a, ctx);
 | 
			
		||||
	if (bp != NULL)
 | 
			
		||||
		{
 | 
			
		||||
		if (!results)
 | 
			
		||||
			{
 | 
			
		||||
			BN_print(bp,a);
 | 
			
		||||
			BIO_puts(bp," * ");
 | 
			
		||||
			BN_print(bp,a);
 | 
			
		||||
			BIO_puts(bp," - ");
 | 
			
		||||
			}
 | 
			
		||||
		BN_print(bp,c);
 | 
			
		||||
		BIO_puts(bp,"\n");
 | 
			
		||||
		}
 | 
			
		||||
	BN_mul(d, a, a, ctx);
 | 
			
		||||
	if (BN_cmp(c, d))
 | 
			
		||||
		{
 | 
			
		||||
		fprintf(stderr, "Square test failed: BN_sqr and BN_mul produce "
 | 
			
		||||
			"different results!\n");
 | 
			
		||||
		goto err;
 | 
			
		||||
		}
 | 
			
		||||
	ret = 1;
 | 
			
		||||
err:
 | 
			
		||||
	if (a != NULL) BN_free(a);
 | 
			
		||||
	if (c != NULL) BN_free(c);
 | 
			
		||||
	if (d != NULL) BN_free(d);
 | 
			
		||||
	if (e != NULL) BN_free(e);
 | 
			
		||||
	return ret;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
int test_mont(BIO *bp, BN_CTX *ctx)
 | 
			
		||||
@@ -1012,6 +1068,80 @@ int test_mod_exp_mont_consttime(BIO *bp, BN_CTX *ctx)
 | 
			
		||||
	return(1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
/* Test constant-time modular exponentiation with 1024-bit inputs,
 | 
			
		||||
 * which on x86_64 cause a different code branch to be taken.
 | 
			
		||||
 */
 | 
			
		||||
int test_mod_exp_mont5(BIO *bp, BN_CTX *ctx)
 | 
			
		||||
	{
 | 
			
		||||
	BIGNUM *a,*p,*m,*d,*e;
 | 
			
		||||
 | 
			
		||||
	BN_MONT_CTX *mont;
 | 
			
		||||
 | 
			
		||||
	a=BN_new();
 | 
			
		||||
	p=BN_new();
 | 
			
		||||
	m=BN_new();
 | 
			
		||||
	d=BN_new();
 | 
			
		||||
	e=BN_new();
 | 
			
		||||
 | 
			
		||||
	mont = BN_MONT_CTX_new();
 | 
			
		||||
 | 
			
		||||
	BN_bntest_rand(m,1024,0,1); /* must be odd for montgomery */
 | 
			
		||||
	/* Zero exponent */
 | 
			
		||||
	BN_bntest_rand(a,1024,0,0);
 | 
			
		||||
	BN_zero(p);
 | 
			
		||||
	if(!BN_mod_exp_mont_consttime(d,a,p,m,ctx,NULL))
 | 
			
		||||
		return 0;
 | 
			
		||||
	if(!BN_is_one(d))
 | 
			
		||||
		{
 | 
			
		||||
		fprintf(stderr, "Modular exponentiation test failed!\n");
 | 
			
		||||
		return 0;
 | 
			
		||||
		}
 | 
			
		||||
	/* Zero input */
 | 
			
		||||
	BN_bntest_rand(p,1024,0,0);
 | 
			
		||||
	BN_zero(a);
 | 
			
		||||
	if(!BN_mod_exp_mont_consttime(d,a,p,m,ctx,NULL))
 | 
			
		||||
		return 0;
 | 
			
		||||
	if(!BN_is_zero(d))
 | 
			
		||||
		{
 | 
			
		||||
		fprintf(stderr, "Modular exponentiation test failed!\n");
 | 
			
		||||
		return 0;
 | 
			
		||||
		}
 | 
			
		||||
	/* Craft an input whose Montgomery representation is 1,
 | 
			
		||||
	 * i.e., shorter than the modulus m, in order to test
 | 
			
		||||
	 * the const time precomputation scattering/gathering.
 | 
			
		||||
	 */
 | 
			
		||||
	BN_one(a);
 | 
			
		||||
	BN_MONT_CTX_set(mont,m,ctx);
 | 
			
		||||
	if(!BN_from_montgomery(e,a,mont,ctx))
 | 
			
		||||
		return 0;
 | 
			
		||||
	if(!BN_mod_exp_mont_consttime(d,e,p,m,ctx,NULL))
 | 
			
		||||
		return 0;
 | 
			
		||||
	if(!BN_mod_exp_simple(a,e,p,m,ctx))
 | 
			
		||||
		return 0;
 | 
			
		||||
	if(BN_cmp(a,d) != 0)
 | 
			
		||||
		{
 | 
			
		||||
		fprintf(stderr,"Modular exponentiation test failed!\n");
 | 
			
		||||
		return 0;
 | 
			
		||||
		}
 | 
			
		||||
	/* Finally, some regular test vectors. */
 | 
			
		||||
	BN_bntest_rand(e,1024,0,0);
 | 
			
		||||
	if(!BN_mod_exp_mont_consttime(d,e,p,m,ctx,NULL))
 | 
			
		||||
		return 0;
 | 
			
		||||
	if(!BN_mod_exp_simple(a,e,p,m,ctx))
 | 
			
		||||
		return 0;
 | 
			
		||||
	if(BN_cmp(a,d) != 0)
 | 
			
		||||
		{
 | 
			
		||||
		fprintf(stderr,"Modular exponentiation test failed!\n");
 | 
			
		||||
		return 0;
 | 
			
		||||
		}
 | 
			
		||||
	BN_free(a);
 | 
			
		||||
	BN_free(p);
 | 
			
		||||
	BN_free(m);
 | 
			
		||||
	BN_free(d);
 | 
			
		||||
	BN_free(e);
 | 
			
		||||
	return(1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
int test_exp(BIO *bp, BN_CTX *ctx)
 | 
			
		||||
	{
 | 
			
		||||
	BIGNUM *a,*b,*d,*e,*one;
 | 
			
		||||
 
 | 
			
		||||
@@ -71,6 +71,43 @@
 | 
			
		||||
 | 
			
		||||
static const char rnd_seed[] = "string to make the random number generator think it has entropy";
 | 
			
		||||
 | 
			
		||||
/* test_exp_mod_zero tests that x**0 mod 1 == 0. It returns zero on success. */
 | 
			
		||||
static int test_exp_mod_zero() {
 | 
			
		||||
	BIGNUM a, p, m;
 | 
			
		||||
	BIGNUM r;
 | 
			
		||||
	BN_CTX *ctx = BN_CTX_new();
 | 
			
		||||
	int ret = 1;
 | 
			
		||||
 | 
			
		||||
	BN_init(&m);
 | 
			
		||||
	BN_one(&m);
 | 
			
		||||
 | 
			
		||||
	BN_init(&a);
 | 
			
		||||
	BN_one(&a);
 | 
			
		||||
 | 
			
		||||
	BN_init(&p);
 | 
			
		||||
	BN_zero(&p);
 | 
			
		||||
 | 
			
		||||
	BN_init(&r);
 | 
			
		||||
	BN_mod_exp(&r, &a, &p, &m, ctx);
 | 
			
		||||
	BN_CTX_free(ctx);
 | 
			
		||||
 | 
			
		||||
	if (BN_is_zero(&r))
 | 
			
		||||
		ret = 0;
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		printf("1**0 mod 1 = ");
 | 
			
		||||
		BN_print_fp(stdout, &r);
 | 
			
		||||
		printf(", should be 0\n");
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	BN_free(&r);
 | 
			
		||||
	BN_free(&a);
 | 
			
		||||
	BN_free(&p);
 | 
			
		||||
	BN_free(&m);
 | 
			
		||||
 | 
			
		||||
	return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int main(int argc, char *argv[])
 | 
			
		||||
	{
 | 
			
		||||
	BN_CTX *ctx;
 | 
			
		||||
@@ -190,7 +227,13 @@ int main(int argc, char *argv[])
 | 
			
		||||
	ERR_remove_thread_state(NULL);
 | 
			
		||||
	CRYPTO_mem_leaks(out);
 | 
			
		||||
	BIO_free(out);
 | 
			
		||||
	printf(" done\n");
 | 
			
		||||
	printf("\n");
 | 
			
		||||
 | 
			
		||||
	if (test_exp_mod_zero() != 0)
 | 
			
		||||
		goto err;
 | 
			
		||||
 | 
			
		||||
	printf("done\n");
 | 
			
		||||
 | 
			
		||||
	EXIT(0);
 | 
			
		||||
err:
 | 
			
		||||
	ERR_load_crypto_strings();
 | 
			
		||||
 
 | 
			
		||||
@@ -179,14 +179,14 @@ int BUF_MEM_grow_clean(BUF_MEM *str, size_t len)
 | 
			
		||||
	return(len);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
void BUF_reverse(unsigned char *out, unsigned char *in, size_t size)
 | 
			
		||||
void BUF_reverse(unsigned char *out, const unsigned char *in, size_t size)
 | 
			
		||||
	{
 | 
			
		||||
	size_t i;
 | 
			
		||||
	if (in)
 | 
			
		||||
		{
 | 
			
		||||
		out += size - 1;
 | 
			
		||||
		for (i = 0; i < size; i++)
 | 
			
		||||
			*in++ = *out--;
 | 
			
		||||
			*out-- = *in++;
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
 
 | 
			
		||||
@@ -88,7 +88,7 @@ int	BUF_MEM_grow_clean(BUF_MEM *str, size_t len);
 | 
			
		||||
char *	BUF_strdup(const char *str);
 | 
			
		||||
char *	BUF_strndup(const char *str, size_t siz);
 | 
			
		||||
void *	BUF_memdup(const void *data, size_t siz);
 | 
			
		||||
void	BUF_reverse(unsigned char *out, unsigned char *in, size_t siz);
 | 
			
		||||
void	BUF_reverse(unsigned char *out, const unsigned char *in, size_t siz);
 | 
			
		||||
 | 
			
		||||
/* safe string functions */
 | 
			
		||||
size_t BUF_strlcpy(char *dst,const char *src,size_t siz);
 | 
			
		||||
 
 | 
			
		||||
@@ -185,6 +185,8 @@ CMS_RecipientInfo *CMS_add1_recipient_cert(CMS_ContentInfo *cms,
 | 
			
		||||
	if (flags & CMS_USE_KEYID)
 | 
			
		||||
		{
 | 
			
		||||
		ktri->version = 2;
 | 
			
		||||
		if (env->version < 2)
 | 
			
		||||
			env->version = 2;
 | 
			
		||||
		type = CMS_RECIPINFO_KEYIDENTIFIER;
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
 
 | 
			
		||||
@@ -463,8 +463,6 @@ int CMS_add0_cert(CMS_ContentInfo *cms, X509 *cert)
 | 
			
		||||
	STACK_OF(CMS_CertificateChoices) **pcerts;
 | 
			
		||||
	int i;
 | 
			
		||||
	pcerts = cms_get0_certificate_choices(cms);
 | 
			
		||||
	if (!pcerts)
 | 
			
		||||
		return 0;
 | 
			
		||||
	if (!pcerts)
 | 
			
		||||
		return 0;
 | 
			
		||||
	for (i = 0; i < sk_CMS_CertificateChoices_num(*pcerts); i++)
 | 
			
		||||
 
 | 
			
		||||
@@ -93,9 +93,10 @@ CMS_RecipientInfo *CMS_add0_recipient_password(CMS_ContentInfo *cms,
 | 
			
		||||
	X509_ALGOR *encalg = NULL;
 | 
			
		||||
	unsigned char iv[EVP_MAX_IV_LENGTH];
 | 
			
		||||
	int ivlen;
 | 
			
		||||
 | 
			
		||||
	env = cms_get0_enveloped(cms);
 | 
			
		||||
	if (!env)
 | 
			
		||||
		goto err;
 | 
			
		||||
		return NULL;
 | 
			
		||||
 | 
			
		||||
	if (wrap_nid <= 0)
 | 
			
		||||
		wrap_nid = NID_id_alg_PWRI_KEK;
 | 
			
		||||
 
 | 
			
		||||
@@ -158,8 +158,8 @@ static void cms_sd_set_version(CMS_SignedData *sd)
 | 
			
		||||
			if (sd->version < 3)
 | 
			
		||||
				sd->version = 3;
 | 
			
		||||
			}
 | 
			
		||||
		else
 | 
			
		||||
			sd->version = 1;
 | 
			
		||||
		else if (si->version < 1)
 | 
			
		||||
			si->version = 1;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (sd->version < 1)
 | 
			
		||||
 
 | 
			
		||||
@@ -611,7 +611,7 @@ int CMS_decrypt_set1_pkey(CMS_ContentInfo *cms, EVP_PKEY *pk, X509 *cert)
 | 
			
		||||
	STACK_OF(CMS_RecipientInfo) *ris;
 | 
			
		||||
	CMS_RecipientInfo *ri;
 | 
			
		||||
	int i, r;
 | 
			
		||||
	int debug = 0;
 | 
			
		||||
	int debug = 0, ri_match = 0;
 | 
			
		||||
	ris = CMS_get0_RecipientInfos(cms);
 | 
			
		||||
	if (ris)
 | 
			
		||||
		debug = cms->d.envelopedData->encryptedContentInfo->debug;
 | 
			
		||||
@@ -620,6 +620,7 @@ int CMS_decrypt_set1_pkey(CMS_ContentInfo *cms, EVP_PKEY *pk, X509 *cert)
 | 
			
		||||
		ri = sk_CMS_RecipientInfo_value(ris, i);
 | 
			
		||||
		if (CMS_RecipientInfo_type(ri) != CMS_RECIPINFO_TRANS)
 | 
			
		||||
				continue;
 | 
			
		||||
		ri_match = 1;
 | 
			
		||||
		/* If we have a cert try matching RecipientInfo
 | 
			
		||||
		 * otherwise try them all.
 | 
			
		||||
		 */
 | 
			
		||||
@@ -655,7 +656,7 @@ int CMS_decrypt_set1_pkey(CMS_ContentInfo *cms, EVP_PKEY *pk, X509 *cert)
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	/* If no cert and not debugging always return success */
 | 
			
		||||
	if (!cert && !debug)
 | 
			
		||||
	if (ri_match && !cert && !debug)
 | 
			
		||||
		{
 | 
			
		||||
		ERR_clear_error();
 | 
			
		||||
		return 1;
 | 
			
		||||
 
 | 
			
		||||
@@ -321,7 +321,7 @@ again:
 | 
			
		||||
			p=eat_ws(conf, end);
 | 
			
		||||
			if (*p != ']')
 | 
			
		||||
				{
 | 
			
		||||
				if (*p != '\0')
 | 
			
		||||
				if (*p != '\0' && ss != p)
 | 
			
		||||
					{
 | 
			
		||||
					ss=p;
 | 
			
		||||
					goto again;
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										206
									
								
								crypto/constant_time_locl.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										206
									
								
								crypto/constant_time_locl.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,206 @@
 | 
			
		||||
/* crypto/constant_time_locl.h */
 | 
			
		||||
/*
 | 
			
		||||
 * Utilities for constant-time cryptography.
 | 
			
		||||
 *
 | 
			
		||||
 * Author: Emilia Kasper (emilia@openssl.org)
 | 
			
		||||
 * Based on previous work by Bodo Moeller, Emilia Kasper, Adam Langley
 | 
			
		||||
 * (Google).
 | 
			
		||||
 * ====================================================================
 | 
			
		||||
 * Copyright (c) 2014 The OpenSSL Project.  All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Redistribution and use in source and binary forms, with or without
 | 
			
		||||
 * modification, are permitted provided that the following conditions
 | 
			
		||||
 * are met:
 | 
			
		||||
 * 1. Redistributions of source code must retain the 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 HEADER_CONSTANT_TIME_LOCL_H
 | 
			
		||||
#define HEADER_CONSTANT_TIME_LOCL_H
 | 
			
		||||
 | 
			
		||||
#include "e_os.h"  /* For 'inline' */
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
extern "C" {
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * The boolean methods return a bitmask of all ones (0xff...f) for true
 | 
			
		||||
 * and 0 for false. This is useful for choosing a value based on the result
 | 
			
		||||
 * of a conditional in constant time. For example,
 | 
			
		||||
 *
 | 
			
		||||
 * if (a < b) {
 | 
			
		||||
 *   c = a;
 | 
			
		||||
 * } else {
 | 
			
		||||
 *   c = b;
 | 
			
		||||
 * }
 | 
			
		||||
 *
 | 
			
		||||
 * can be written as
 | 
			
		||||
 *
 | 
			
		||||
 * unsigned int lt = constant_time_lt(a, b);
 | 
			
		||||
 * c = constant_time_select(lt, a, b);
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Returns the given value with the MSB copied to all the other
 | 
			
		||||
 * bits. Uses the fact that arithmetic shift shifts-in the sign bit.
 | 
			
		||||
 * However, this is not ensured by the C standard so you may need to
 | 
			
		||||
 * replace this with something else on odd CPUs.
 | 
			
		||||
 */
 | 
			
		||||
static inline unsigned int constant_time_msb(unsigned int a);
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Returns 0xff..f if a < b and 0 otherwise.
 | 
			
		||||
 */
 | 
			
		||||
static inline unsigned int constant_time_lt(unsigned int a, unsigned int b);
 | 
			
		||||
/* Convenience method for getting an 8-bit mask. */
 | 
			
		||||
static inline unsigned char constant_time_lt_8(unsigned int a, unsigned int b);
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Returns 0xff..f if a >= b and 0 otherwise.
 | 
			
		||||
 */
 | 
			
		||||
static inline unsigned int constant_time_ge(unsigned int a, unsigned int b);
 | 
			
		||||
/* Convenience method for getting an 8-bit mask. */
 | 
			
		||||
static inline unsigned char constant_time_ge_8(unsigned int a, unsigned int b);
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Returns 0xff..f if a == 0 and 0 otherwise.
 | 
			
		||||
 */
 | 
			
		||||
static inline unsigned int constant_time_is_zero(unsigned int a);
 | 
			
		||||
/* Convenience method for getting an 8-bit mask. */
 | 
			
		||||
static inline unsigned char constant_time_is_zero_8(unsigned int a);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Returns 0xff..f if a == b and 0 otherwise.
 | 
			
		||||
 */
 | 
			
		||||
static inline unsigned int constant_time_eq(unsigned int a, unsigned int b);
 | 
			
		||||
/* Convenience method for getting an 8-bit mask. */
 | 
			
		||||
static inline unsigned char constant_time_eq_8(unsigned int a, unsigned int b);
 | 
			
		||||
/* Signed integers. */
 | 
			
		||||
static inline unsigned int constant_time_eq_int(int a, int b);
 | 
			
		||||
/* Convenience method for getting an 8-bit mask. */
 | 
			
		||||
static inline unsigned char constant_time_eq_int_8(int a, int b);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Returns (mask & a) | (~mask & b).
 | 
			
		||||
 *
 | 
			
		||||
 * When |mask| is all 1s or all 0s (as returned by the methods above),
 | 
			
		||||
 * the select methods return either |a| (if |mask| is nonzero) or |b|
 | 
			
		||||
 * (if |mask| is zero).
 | 
			
		||||
 */
 | 
			
		||||
static inline unsigned int constant_time_select(unsigned int mask,
 | 
			
		||||
	unsigned int a, unsigned int b);
 | 
			
		||||
/* Convenience method for unsigned chars. */
 | 
			
		||||
static inline unsigned char constant_time_select_8(unsigned char mask,
 | 
			
		||||
	unsigned char a, unsigned char b);
 | 
			
		||||
/* Convenience method for signed integers. */
 | 
			
		||||
static inline int constant_time_select_int(unsigned int mask, int a, int b);
 | 
			
		||||
 | 
			
		||||
static inline unsigned int constant_time_msb(unsigned int a)
 | 
			
		||||
	{
 | 
			
		||||
	return 0-(a >> (sizeof(a) * 8 - 1));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static inline unsigned int constant_time_lt(unsigned int a, unsigned int b)
 | 
			
		||||
	{
 | 
			
		||||
	return constant_time_msb(a^((a^b)|((a-b)^b)));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static inline unsigned char constant_time_lt_8(unsigned int a, unsigned int b)
 | 
			
		||||
	{
 | 
			
		||||
	return (unsigned char)(constant_time_lt(a, b));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static inline unsigned int constant_time_ge(unsigned int a, unsigned int b)
 | 
			
		||||
	{
 | 
			
		||||
	return ~constant_time_lt(a, b);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static inline unsigned char constant_time_ge_8(unsigned int a, unsigned int b)
 | 
			
		||||
	{
 | 
			
		||||
	return (unsigned char)(constant_time_ge(a, b));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static inline unsigned int constant_time_is_zero(unsigned int a)
 | 
			
		||||
	{
 | 
			
		||||
	return constant_time_msb(~a & (a - 1));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static inline unsigned char constant_time_is_zero_8(unsigned int a)
 | 
			
		||||
	{
 | 
			
		||||
	return (unsigned char)(constant_time_is_zero(a));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static inline unsigned int constant_time_eq(unsigned int a, unsigned int b)
 | 
			
		||||
	{
 | 
			
		||||
	return constant_time_is_zero(a ^ b);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static inline unsigned char constant_time_eq_8(unsigned int a, unsigned int b)
 | 
			
		||||
	{
 | 
			
		||||
	return (unsigned char)(constant_time_eq(a, b));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static inline unsigned int constant_time_eq_int(int a, int b)
 | 
			
		||||
	{
 | 
			
		||||
	return constant_time_eq((unsigned)(a), (unsigned)(b));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static inline unsigned char constant_time_eq_int_8(int a, int b)
 | 
			
		||||
	{
 | 
			
		||||
	return constant_time_eq_8((unsigned)(a), (unsigned)(b));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static inline unsigned int constant_time_select(unsigned int mask,
 | 
			
		||||
	unsigned int a, unsigned int b)
 | 
			
		||||
	{
 | 
			
		||||
	return (mask & a) | (~mask & b);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static inline unsigned char constant_time_select_8(unsigned char mask,
 | 
			
		||||
	unsigned char a, unsigned char b)
 | 
			
		||||
	{
 | 
			
		||||
	return (unsigned char)(constant_time_select(mask, a, b));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static inline int constant_time_select_int(unsigned int mask, int a, int b)
 | 
			
		||||
	{
 | 
			
		||||
	return (int)(constant_time_select(mask, (unsigned)(a), (unsigned)(b)));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#endif  /* HEADER_CONSTANT_TIME_LOCL_H */
 | 
			
		||||
							
								
								
									
										330
									
								
								crypto/constant_time_test.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										330
									
								
								crypto/constant_time_test.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,330 @@
 | 
			
		||||
/* crypto/constant_time_test.c */
 | 
			
		||||
/*
 | 
			
		||||
 * Utilities for constant-time cryptography.
 | 
			
		||||
 *
 | 
			
		||||
 * Author: Emilia Kasper (emilia@openssl.org)
 | 
			
		||||
 * Based on previous work by Bodo Moeller, Emilia Kasper, Adam Langley
 | 
			
		||||
 * (Google).
 | 
			
		||||
 * ====================================================================
 | 
			
		||||
 * Copyright (c) 2014 The OpenSSL Project.  All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Redistribution and use in source and binary forms, with or without
 | 
			
		||||
 * modification, are permitted provided that the following conditions
 | 
			
		||||
 * are met:
 | 
			
		||||
 * 1. Redistributions of source code must retain the 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 "../crypto/constant_time_locl.h"
 | 
			
		||||
 | 
			
		||||
#include <limits.h>
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
 | 
			
		||||
static const unsigned int CONSTTIME_TRUE = (unsigned)(~0);
 | 
			
		||||
static const unsigned int CONSTTIME_FALSE = 0;
 | 
			
		||||
static const unsigned char CONSTTIME_TRUE_8 = 0xff;
 | 
			
		||||
static const unsigned char CONSTTIME_FALSE_8 = 0;
 | 
			
		||||
 | 
			
		||||
static int test_binary_op(unsigned int (*op)(unsigned int a, unsigned int b),
 | 
			
		||||
	const char* op_name, unsigned int a, unsigned int b, int is_true)
 | 
			
		||||
	{
 | 
			
		||||
	unsigned c = op(a, b);
 | 
			
		||||
	if (is_true && c != CONSTTIME_TRUE)
 | 
			
		||||
		{
 | 
			
		||||
		fprintf(stderr, "Test failed for %s(%du, %du): expected %du "
 | 
			
		||||
			"(TRUE), got %du\n", op_name, a, b, CONSTTIME_TRUE, c);
 | 
			
		||||
		return 1;
 | 
			
		||||
		}
 | 
			
		||||
	else if (!is_true && c != CONSTTIME_FALSE)
 | 
			
		||||
		{
 | 
			
		||||
		fprintf(stderr, "Test failed for  %s(%du, %du): expected %du "
 | 
			
		||||
			"(FALSE), got %du\n", op_name, a, b, CONSTTIME_FALSE,
 | 
			
		||||
			c);
 | 
			
		||||
		return 1;
 | 
			
		||||
		}
 | 
			
		||||
        return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static int test_binary_op_8(unsigned char (*op)(unsigned int a, unsigned int b),
 | 
			
		||||
	const char* op_name, unsigned int a, unsigned int b, int is_true)
 | 
			
		||||
	{
 | 
			
		||||
	unsigned char c = op(a, b);
 | 
			
		||||
	if (is_true && c != CONSTTIME_TRUE_8)
 | 
			
		||||
		{
 | 
			
		||||
		fprintf(stderr, "Test failed for %s(%du, %du): expected %u "
 | 
			
		||||
			"(TRUE), got %u\n", op_name, a, b, CONSTTIME_TRUE_8, c);
 | 
			
		||||
		return 1;
 | 
			
		||||
		}
 | 
			
		||||
	else if (!is_true && c != CONSTTIME_FALSE_8)
 | 
			
		||||
		{
 | 
			
		||||
		fprintf(stderr, "Test failed for  %s(%du, %du): expected %u "
 | 
			
		||||
			"(FALSE), got %u\n", op_name, a, b, CONSTTIME_FALSE_8,
 | 
			
		||||
			c);
 | 
			
		||||
		return 1;
 | 
			
		||||
		}
 | 
			
		||||
        return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static int test_is_zero(unsigned int a)
 | 
			
		||||
	{
 | 
			
		||||
	unsigned int c = constant_time_is_zero(a);
 | 
			
		||||
	if (a == 0 && c != CONSTTIME_TRUE)
 | 
			
		||||
		{
 | 
			
		||||
		fprintf(stderr, "Test failed for constant_time_is_zero(%du): "
 | 
			
		||||
			"expected %du (TRUE), got %du\n", a, CONSTTIME_TRUE, c);
 | 
			
		||||
		return 1;
 | 
			
		||||
		}
 | 
			
		||||
	else if (a != 0 && c != CONSTTIME_FALSE)
 | 
			
		||||
		{
 | 
			
		||||
		fprintf(stderr, "Test failed for constant_time_is_zero(%du): "
 | 
			
		||||
			"expected %du (FALSE), got %du\n", a, CONSTTIME_FALSE,
 | 
			
		||||
			c);
 | 
			
		||||
		return 1;
 | 
			
		||||
		}
 | 
			
		||||
        return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static int test_is_zero_8(unsigned int a)
 | 
			
		||||
	{
 | 
			
		||||
	unsigned char c = constant_time_is_zero_8(a);
 | 
			
		||||
	if (a == 0 && c != CONSTTIME_TRUE_8)
 | 
			
		||||
		{
 | 
			
		||||
		fprintf(stderr, "Test failed for constant_time_is_zero(%du): "
 | 
			
		||||
			"expected %u (TRUE), got %u\n", a, CONSTTIME_TRUE_8, c);
 | 
			
		||||
		return 1;
 | 
			
		||||
		}
 | 
			
		||||
	else if (a != 0 && c != CONSTTIME_FALSE)
 | 
			
		||||
		{
 | 
			
		||||
		fprintf(stderr, "Test failed for constant_time_is_zero(%du): "
 | 
			
		||||
			"expected %u (FALSE), got %u\n", a, CONSTTIME_FALSE_8,
 | 
			
		||||
			c);
 | 
			
		||||
		return 1;
 | 
			
		||||
		}
 | 
			
		||||
        return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static int test_select(unsigned int a, unsigned int b)
 | 
			
		||||
	{
 | 
			
		||||
	unsigned int selected = constant_time_select(CONSTTIME_TRUE, a, b);
 | 
			
		||||
	if (selected != a)
 | 
			
		||||
		{
 | 
			
		||||
		fprintf(stderr, "Test failed for constant_time_select(%du, %du,"
 | 
			
		||||
			"%du): expected %du(first value), got %du\n",
 | 
			
		||||
			CONSTTIME_TRUE, a, b, a, selected);
 | 
			
		||||
		return 1;
 | 
			
		||||
		}
 | 
			
		||||
	selected = constant_time_select(CONSTTIME_FALSE, a, b);
 | 
			
		||||
	if (selected != b)
 | 
			
		||||
		{
 | 
			
		||||
		fprintf(stderr, "Test failed for constant_time_select(%du, %du,"
 | 
			
		||||
			"%du): expected %du(second value), got %du\n",
 | 
			
		||||
			CONSTTIME_FALSE, a, b, b, selected);
 | 
			
		||||
		return 1;
 | 
			
		||||
		}
 | 
			
		||||
	return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static int test_select_8(unsigned char a, unsigned char b)
 | 
			
		||||
	{
 | 
			
		||||
	unsigned char selected = constant_time_select_8(CONSTTIME_TRUE_8, a, b);
 | 
			
		||||
	if (selected != a)
 | 
			
		||||
		{
 | 
			
		||||
		fprintf(stderr, "Test failed for constant_time_select(%u, %u,"
 | 
			
		||||
			"%u): expected %u(first value), got %u\n",
 | 
			
		||||
			CONSTTIME_TRUE, a, b, a, selected);
 | 
			
		||||
		return 1;
 | 
			
		||||
		}
 | 
			
		||||
	selected = constant_time_select_8(CONSTTIME_FALSE_8, a, b);
 | 
			
		||||
	if (selected != b)
 | 
			
		||||
		{
 | 
			
		||||
		fprintf(stderr, "Test failed for constant_time_select(%u, %u,"
 | 
			
		||||
			"%u): expected %u(second value), got %u\n",
 | 
			
		||||
			CONSTTIME_FALSE, a, b, b, selected);
 | 
			
		||||
		return 1;
 | 
			
		||||
		}
 | 
			
		||||
	return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static int test_select_int(int a, int b)
 | 
			
		||||
	{
 | 
			
		||||
	int selected = constant_time_select_int(CONSTTIME_TRUE, a, b);
 | 
			
		||||
	if (selected != a)
 | 
			
		||||
		{
 | 
			
		||||
		fprintf(stderr, "Test failed for constant_time_select(%du, %d,"
 | 
			
		||||
			"%d): expected %d(first value), got %d\n",
 | 
			
		||||
			CONSTTIME_TRUE, a, b, a, selected);
 | 
			
		||||
		return 1;
 | 
			
		||||
		}
 | 
			
		||||
	selected = constant_time_select_int(CONSTTIME_FALSE, a, b);
 | 
			
		||||
	if (selected != b)
 | 
			
		||||
		{
 | 
			
		||||
		fprintf(stderr, "Test failed for constant_time_select(%du, %d,"
 | 
			
		||||
			"%d): expected %d(second value), got %d\n",
 | 
			
		||||
			CONSTTIME_FALSE, a, b, b, selected);
 | 
			
		||||
		return 1;
 | 
			
		||||
		}
 | 
			
		||||
	return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static int test_eq_int(int a, int b)
 | 
			
		||||
	{
 | 
			
		||||
	unsigned int equal = constant_time_eq_int(a, b);
 | 
			
		||||
	if (a == b && equal != CONSTTIME_TRUE)
 | 
			
		||||
		{
 | 
			
		||||
		fprintf(stderr, "Test failed for constant_time_eq_int(%d, %d): "
 | 
			
		||||
			"expected %du(TRUE), got %du\n",
 | 
			
		||||
			a, b, CONSTTIME_TRUE, equal);
 | 
			
		||||
		return 1;
 | 
			
		||||
		}
 | 
			
		||||
	else if (a != b && equal != CONSTTIME_FALSE)
 | 
			
		||||
		{
 | 
			
		||||
		fprintf(stderr, "Test failed for constant_time_eq_int(%d, %d): "
 | 
			
		||||
			"expected %du(FALSE), got %du\n",
 | 
			
		||||
			a, b, CONSTTIME_FALSE, equal);
 | 
			
		||||
		return 1;
 | 
			
		||||
		}
 | 
			
		||||
	return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static int test_eq_int_8(int a, int b)
 | 
			
		||||
	{
 | 
			
		||||
	unsigned char equal = constant_time_eq_int_8(a, b);
 | 
			
		||||
	if (a == b && equal != CONSTTIME_TRUE_8)
 | 
			
		||||
		{
 | 
			
		||||
		fprintf(stderr, "Test failed for constant_time_eq_int_8(%d, %d): "
 | 
			
		||||
			"expected %u(TRUE), got %u\n",
 | 
			
		||||
			a, b, CONSTTIME_TRUE_8, equal);
 | 
			
		||||
		return 1;
 | 
			
		||||
		}
 | 
			
		||||
	else if (a != b && equal != CONSTTIME_FALSE_8)
 | 
			
		||||
		{
 | 
			
		||||
		fprintf(stderr, "Test failed for constant_time_eq_int_8(%d, %d): "
 | 
			
		||||
			"expected %u(FALSE), got %u\n",
 | 
			
		||||
			a, b, CONSTTIME_FALSE_8, equal);
 | 
			
		||||
		return 1;
 | 
			
		||||
		}
 | 
			
		||||
	return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static unsigned int test_values[] = {0, 1, 1024, 12345, 32000, UINT_MAX/2-1,
 | 
			
		||||
                                     UINT_MAX/2, UINT_MAX/2+1, UINT_MAX-1,
 | 
			
		||||
                                     UINT_MAX};
 | 
			
		||||
 | 
			
		||||
static unsigned char test_values_8[] = {0, 1, 2, 20, 32, 127, 128, 129, 255};
 | 
			
		||||
 | 
			
		||||
static int signed_test_values[] = {0, 1, -1, 1024, -1024, 12345, -12345,
 | 
			
		||||
				   32000, -32000, INT_MAX, INT_MIN, INT_MAX-1,
 | 
			
		||||
				   INT_MIN+1};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int main(int argc, char *argv[])
 | 
			
		||||
	{
 | 
			
		||||
	unsigned int a, b, i, j;
 | 
			
		||||
	int c, d;
 | 
			
		||||
	unsigned char e, f;
 | 
			
		||||
	int num_failed = 0, num_all = 0;
 | 
			
		||||
	fprintf(stdout, "Testing constant time operations...\n");
 | 
			
		||||
 | 
			
		||||
	for (i = 0; i < sizeof(test_values)/sizeof(int); ++i)
 | 
			
		||||
		{
 | 
			
		||||
		a = test_values[i];
 | 
			
		||||
		num_failed += test_is_zero(a);
 | 
			
		||||
		num_failed += test_is_zero_8(a);
 | 
			
		||||
		num_all += 2;
 | 
			
		||||
		for (j = 0; j < sizeof(test_values)/sizeof(int); ++j)
 | 
			
		||||
			{
 | 
			
		||||
			b = test_values[j];
 | 
			
		||||
			num_failed += test_binary_op(&constant_time_lt,
 | 
			
		||||
				"constant_time_lt", a, b, a < b);
 | 
			
		||||
			num_failed += test_binary_op_8(&constant_time_lt_8,
 | 
			
		||||
				"constant_time_lt_8", a, b, a < b);
 | 
			
		||||
			num_failed += test_binary_op(&constant_time_lt,
 | 
			
		||||
				"constant_time_lt_8", b, a, b < a);
 | 
			
		||||
			num_failed += test_binary_op_8(&constant_time_lt_8,
 | 
			
		||||
				"constant_time_lt_8", b, a, b < a);
 | 
			
		||||
			num_failed += test_binary_op(&constant_time_ge,
 | 
			
		||||
				"constant_time_ge", a, b, a >= b);
 | 
			
		||||
			num_failed += test_binary_op_8(&constant_time_ge_8,
 | 
			
		||||
				"constant_time_ge_8", a, b, a >= b);
 | 
			
		||||
			num_failed += test_binary_op(&constant_time_ge,
 | 
			
		||||
				"constant_time_ge", b, a, b >= a);
 | 
			
		||||
			num_failed += test_binary_op_8(&constant_time_ge_8,
 | 
			
		||||
				"constant_time_ge_8", b, a, b >= a);
 | 
			
		||||
			num_failed += test_binary_op(&constant_time_eq,
 | 
			
		||||
				"constant_time_eq", a, b, a == b);
 | 
			
		||||
			num_failed += test_binary_op_8(&constant_time_eq_8,
 | 
			
		||||
				"constant_time_eq_8", a, b, a == b);
 | 
			
		||||
			num_failed += test_binary_op(&constant_time_eq,
 | 
			
		||||
				"constant_time_eq", b, a, b == a);
 | 
			
		||||
			num_failed += test_binary_op_8(&constant_time_eq_8,
 | 
			
		||||
				"constant_time_eq_8", b, a, b == a);
 | 
			
		||||
			num_failed += test_select(a, b);
 | 
			
		||||
			num_all += 13;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	for (i = 0; i < sizeof(signed_test_values)/sizeof(int); ++i)
 | 
			
		||||
		{
 | 
			
		||||
		c = signed_test_values[i];
 | 
			
		||||
		for (j = 0; j < sizeof(signed_test_values)/sizeof(int); ++j)
 | 
			
		||||
			{
 | 
			
		||||
			d = signed_test_values[j];
 | 
			
		||||
			num_failed += test_select_int(c, d);
 | 
			
		||||
			num_failed += test_eq_int(c, d);
 | 
			
		||||
			num_failed += test_eq_int_8(c, d);
 | 
			
		||||
			num_all += 3;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	for (i = 0; i < sizeof(test_values_8); ++i)
 | 
			
		||||
		{
 | 
			
		||||
		e = test_values_8[i];
 | 
			
		||||
		for (j = 0; j < sizeof(test_values_8); ++j)
 | 
			
		||||
			{
 | 
			
		||||
			f = test_values_8[j];
 | 
			
		||||
			num_failed += test_select_8(e, f);
 | 
			
		||||
			num_all += 1;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (!num_failed)
 | 
			
		||||
		{
 | 
			
		||||
		fprintf(stdout, "ok (ran %d tests)\n", num_all);
 | 
			
		||||
		return EXIT_SUCCESS;
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		fprintf(stdout, "%d of %d tests failed!\n", num_failed, num_all);
 | 
			
		||||
		return EXIT_FAILURE;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user