Compare commits
1204 Commits
OpenSSL-en
...
BEFORE_COM
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fe8767737b | ||
|
|
606efc54e6 | ||
|
|
7711de24f9 | ||
|
|
eee6c81af8 | ||
|
|
b89670ef0e | ||
|
|
0fccb00b5b | ||
|
|
72da660ddb | ||
|
|
46ffee4792 | ||
|
|
c0a953650b | ||
|
|
0424fe1a8f | ||
|
|
544a2aea4b | ||
|
|
60e5f36d27 | ||
|
|
2469361c0f | ||
|
|
6fa865a325 | ||
|
|
e9ba69631b | ||
|
|
d80a8d1919 | ||
|
|
d0ff2a237b | ||
|
|
6e5dd63c77 | ||
|
|
dc014d43af | ||
|
|
2f9cf160e4 | ||
|
|
336c35dc9e | ||
|
|
72b5215645 | ||
|
|
06bed64317 | ||
|
|
c559759265 | ||
|
|
b4000e8ad8 | ||
|
|
21d5ed98d5 | ||
|
|
e9a182fa30 | ||
|
|
b6db386ffd | ||
|
|
2c975b501d | ||
|
|
279fe3b1c5 | ||
|
|
98a9092af1 | ||
|
|
87108f5af9 | ||
|
|
f257d984b7 | ||
|
|
b889d6a8e8 | ||
|
|
47234cd3d2 | ||
|
|
2c8d0dccfc | ||
|
|
a4f576a378 | ||
|
|
3def5a010e | ||
|
|
294bd1e2f3 | ||
|
|
253ef2187c | ||
|
|
c0455cbb18 | ||
|
|
17e2c77a77 | ||
|
|
b52f3818f4 | ||
|
|
cc12975514 | ||
|
|
9738f395c6 | ||
|
|
d4294c8984 | ||
|
|
8df61b5011 | ||
|
|
f1e6643751 | ||
|
|
6991bf196c | ||
|
|
822a4c1bdb | ||
|
|
a5868b3fe2 | ||
|
|
4edfacb983 | ||
|
|
c6efe6f59e | ||
|
|
35c2b3a9ac | ||
|
|
af9675e75a | ||
|
|
8b2f9cdfad | ||
|
|
01682a8b3c | ||
|
|
8b07f23c30 | ||
|
|
45932ad508 | ||
|
|
ce94682ce1 | ||
|
|
2d7ab7e9ea | ||
|
|
6176df94ed | ||
|
|
a8f8788248 | ||
|
|
d5d007abe3 | ||
|
|
151457ab16 | ||
|
|
dde3e83129 | ||
|
|
8f182fdc69 | ||
|
|
1064acafc4 | ||
|
|
ff8e412ceb | ||
|
|
e9cbcb1d98 | ||
|
|
ea7fc0311c | ||
|
|
30911232c1 | ||
|
|
2940a1298e | ||
|
|
f916052eab | ||
|
|
2fb3f002d0 | ||
|
|
82b0bf0b87 | ||
|
|
3a7cef3e76 | ||
|
|
592c0e0273 | ||
|
|
08b977b5a5 | ||
|
|
85fb12d554 | ||
|
|
b975183c41 | ||
|
|
083100e2ab | ||
|
|
241d2ba1da | ||
|
|
e4fb49775b | ||
|
|
381a146dc6 | ||
|
|
b4a262832a | ||
|
|
6d498d478e | ||
|
|
d0561b5c2d | ||
|
|
4f4b192402 | ||
|
|
0ae1661ba2 | ||
|
|
4e9ef338fc | ||
|
|
d16e1131b4 | ||
|
|
a18894d159 | ||
|
|
dfee50ecd9 | ||
|
|
10189984f9 | ||
|
|
d8425465a3 | ||
|
|
1fc02dcf6a | ||
|
|
83d092f785 | ||
|
|
4825092bbe | ||
|
|
bbd79bdf03 | ||
|
|
a096e9b719 | ||
|
|
ddab25a90d | ||
|
|
ffbe98b763 | ||
|
|
d7a9bb0a2a | ||
|
|
0d81c69b8e | ||
|
|
401cd0af0f | ||
|
|
c7b41e67f0 | ||
|
|
003144a8e8 | ||
|
|
af1cb47e65 | ||
|
|
e8e7fbdb16 | ||
|
|
d5c21afd4b | ||
|
|
1afa967909 | ||
|
|
85b7b80434 | ||
|
|
fe0f662310 | ||
|
|
90453438ff | ||
|
|
2e63f3b733 | ||
|
|
125cc35b59 | ||
|
|
7e58aa7d71 | ||
|
|
be3d90de02 | ||
|
|
82652aaf17 | ||
|
|
17d6bb8158 | ||
|
|
11c26ecf81 | ||
|
|
99d5b23023 | ||
|
|
611ba3f4a1 | ||
|
|
af28dd6c75 | ||
|
|
e79ec456be | ||
|
|
3e268d2717 | ||
|
|
c46acbacde | ||
|
|
304d90425f | ||
|
|
bfaa8a89e1 | ||
|
|
de941e289e | ||
|
|
1d28453529 | ||
|
|
690ecff795 | ||
|
|
234c73767d | ||
|
|
497810cae7 | ||
|
|
cbc9d9713d | ||
|
|
98fa4fe8c5 | ||
|
|
0b4c91c0fc | ||
|
|
b9b43196e1 | ||
|
|
bf6a9e66d6 | ||
|
|
0c372b94f7 | ||
|
|
26e1237380 | ||
|
|
4882171df5 | ||
|
|
931627e6a0 | ||
|
|
274a2c9970 | ||
|
|
006fcc22a8 | ||
|
|
709c51c424 | ||
|
|
9bc448546e | ||
|
|
0dc092334b | ||
|
|
36c194638e | ||
|
|
45fb737950 | ||
|
|
a01273bae3 | ||
|
|
2c17323e15 | ||
|
|
870694b3da | ||
|
|
87a4b4d1f4 | ||
|
|
8ecf5104b3 | ||
|
|
2b3aeffbbd | ||
|
|
2c2f9e2cc3 | ||
|
|
2d9b1b3ffa | ||
|
|
f070480275 | ||
|
|
49f1597de2 | ||
|
|
b44e425f39 | ||
|
|
93683c3cf8 | ||
|
|
a08ee55e2d | ||
|
|
3bac6d9479 | ||
|
|
5c5143de48 | ||
|
|
c8cd7d9e0f | ||
|
|
e0a6cdcf30 | ||
|
|
a0ecb9b8fc | ||
|
|
4bf4bc784f | ||
|
|
9437fef8cc | ||
|
|
16b0384bd2 | ||
|
|
87ebdd8a71 | ||
|
|
7d68189d8a | ||
|
|
26414ee013 | ||
|
|
5c62f68e14 | ||
|
|
0d22b5dace | ||
|
|
023ec151df | ||
|
|
59dbdb51dc | ||
|
|
92d1bc09cb | ||
|
|
d62bfb39cd | ||
|
|
ce4b274aa1 | ||
|
|
334f1842fc | ||
|
|
b12540520d | ||
|
|
0d7b9b8b7e | ||
|
|
31188ee1a8 | ||
|
|
4a3e6bce79 | ||
|
|
a3829cb720 | ||
|
|
e84be9b495 | ||
|
|
3a3ca3f515 | ||
|
|
032c49b8b3 | ||
|
|
3208ff58ca | ||
|
|
6707d22a40 | ||
|
|
3647bee263 | ||
|
|
e2aebccba1 | ||
|
|
3e563bcea7 | ||
|
|
92f91ff48b | ||
|
|
b3dfaaa143 | ||
|
|
5b7848a345 | ||
|
|
915c6a21ba | ||
|
|
58706d595b | ||
|
|
236be53269 | ||
|
|
1fc1bd382b | ||
|
|
a60033f106 | ||
|
|
3613e6fc57 | ||
|
|
f8e21776f9 | ||
|
|
006723cf76 | ||
|
|
aa89bcd279 | ||
|
|
f19759a182 | ||
|
|
d009bcbfb6 | ||
|
|
4b71f63ac0 | ||
|
|
3adb8c3854 | ||
|
|
02e666d59f | ||
|
|
5b2d6ff07e | ||
|
|
877b2fbd3c | ||
|
|
afeab58a3c | ||
|
|
744c49a81b | ||
|
|
9c5b91fd0b | ||
|
|
290d3eab76 | ||
|
|
46dae77c23 | ||
|
|
a6cd870784 | ||
|
|
97879bcd57 | ||
|
|
ab1dee1efc | ||
|
|
e072aa535d | ||
|
|
48f9859d2a | ||
|
|
48b5083ca0 | ||
|
|
cd64618674 | ||
|
|
5d7e960adf | ||
|
|
f0d6ee6be8 | ||
|
|
e65991f977 | ||
|
|
3e83e686ba | ||
|
|
8f06b00373 | ||
|
|
1dea1f4509 | ||
|
|
44411db8e0 | ||
|
|
23ac7a1407 | ||
|
|
dda640835f | ||
|
|
6cc3700314 | ||
|
|
cc1489d2f2 | ||
|
|
016029c69f | ||
|
|
516b848286 | ||
|
|
c4202285ef | ||
|
|
49e045482a | ||
|
|
d8309efc72 | ||
|
|
f43acc8a50 | ||
|
|
ba47f5c9b0 | ||
|
|
4d94ae00d5 | ||
|
|
60d8bae30d | ||
|
|
0caec9e8f8 | ||
|
|
4f85a2e21e | ||
|
|
945e15a253 | ||
|
|
1fe198b6f9 | ||
|
|
78d6603aad | ||
|
|
7241ae1a0a | ||
|
|
5f58d6a5e0 | ||
|
|
acfe628b6e | ||
|
|
182d8435f0 | ||
|
|
4de920c91d | ||
|
|
3cd039dd8f | ||
|
|
81269a81ee | ||
|
|
3537525e00 | ||
|
|
d38f3ad1ee | ||
|
|
e083f91497 | ||
|
|
ba2cad19cf | ||
|
|
db0a1efcc9 | ||
|
|
9074521458 | ||
|
|
f924200e1b | ||
|
|
de2f6e4dae | ||
|
|
44bdb056d4 | ||
|
|
c31bbf1e68 | ||
|
|
5e68f8ce15 | ||
|
|
b9a3ef4c6e | ||
|
|
1955b87423 | ||
|
|
866eedb936 | ||
|
|
f701551f36 | ||
|
|
adc4df3616 | ||
|
|
1199e2d8cf | ||
|
|
0f180d1d1d | ||
|
|
072569e0f1 | ||
|
|
ba9786e4b8 | ||
|
|
613599ffff | ||
|
|
c9c21d3b89 | ||
|
|
d0d046eca2 | ||
|
|
2a81428489 | ||
|
|
7073e9e2a0 | ||
|
|
d866df33a1 | ||
|
|
b77fcddb6b | ||
|
|
f6fbd470e3 | ||
|
|
63810d8566 | ||
|
|
123c401967 | ||
|
|
a3fffd648b | ||
|
|
2d57b73a50 | ||
|
|
f14845d999 | ||
|
|
80bb905d3d | ||
|
|
a297985f42 | ||
|
|
404dcc5e8e | ||
|
|
8242a6a9fc | ||
|
|
17bcb8d465 | ||
|
|
72165799a8 | ||
|
|
f1c2a9de45 | ||
|
|
52b66a622d | ||
|
|
273db408a8 | ||
|
|
957b6db3b1 | ||
|
|
a14e2d9dfe | ||
|
|
a8b94d6409 | ||
|
|
fe19c448f0 | ||
|
|
fcf6473199 | ||
|
|
1285221370 | ||
|
|
5dcf517d84 | ||
|
|
9b2f486c9e | ||
|
|
24995f3a10 | ||
|
|
0fc5cf0870 | ||
|
|
f78d4a35f8 | ||
|
|
df5eaa8a52 | ||
|
|
6ce46d69f5 | ||
|
|
575e664a7c | ||
|
|
7389c848d4 | ||
|
|
4d393410f3 | ||
|
|
bd69750360 | ||
|
|
c9501c223f | ||
|
|
9dd5ae6553 | ||
|
|
e1e876072d | ||
|
|
dd2589494f | ||
|
|
1cfa8a397f | ||
|
|
bdae099862 | ||
|
|
cca28b291c | ||
|
|
062d3e39e7 | ||
|
|
e29f478a7a | ||
|
|
1b58b616e3 | ||
|
|
c70d381775 | ||
|
|
508d8b1617 | ||
|
|
8c74b5e56c | ||
|
|
c59ba5b528 | ||
|
|
45d87a1ffe | ||
|
|
a3feb21bbe | ||
|
|
37530362fa | ||
|
|
fd69886aed | ||
|
|
fd795679bb | ||
|
|
e523f5f389 | ||
|
|
e4dd79bbc8 | ||
|
|
bc37d996fc | ||
|
|
31cafe53c9 | ||
|
|
dc4ddcd2bb | ||
|
|
5256b021f3 | ||
|
|
1bb68d62ab | ||
|
|
4ab1e7ceaf | ||
|
|
06623ff028 | ||
|
|
67d48c8cc8 | ||
|
|
d59fb0dd2f | ||
|
|
245f44e2ab | ||
|
|
e5d6528a12 | ||
|
|
980afccf98 | ||
|
|
9bd2cd745f | ||
|
|
015fbde807 | ||
|
|
ba1b888384 | ||
|
|
6f9079fd50 | ||
|
|
c938563a81 | ||
|
|
40928698bb | ||
|
|
138d8ab0c7 | ||
|
|
47cc5525a2 | ||
|
|
67fec850e1 | ||
|
|
82db6e1646 | ||
|
|
e7227322b3 | ||
|
|
a5595fde9a | ||
|
|
95f8c7195c | ||
|
|
dcbbf83dba | ||
|
|
3c89d78dba | ||
|
|
84fcd6f83e | ||
|
|
a92ae07091 | ||
|
|
68809d3969 | ||
|
|
d6a89fcf88 | ||
|
|
ef5f6a08ff | ||
|
|
7c517a04b1 | ||
|
|
d78e52987e | ||
|
|
755cc53a6e | ||
|
|
1226c472b7 | ||
|
|
4d7072f4b5 | ||
|
|
b5348a095d | ||
|
|
66df02fd98 | ||
|
|
206eb6a11d | ||
|
|
f11fd3f4e1 | ||
|
|
29b108f939 | ||
|
|
31106cc750 | ||
|
|
ff3fa48fc7 | ||
|
|
87166e1fb6 | ||
|
|
f3e24baddf | ||
|
|
a6977ee73d | ||
|
|
d4704d5245 | ||
|
|
8f0edcb3d2 | ||
|
|
35e25255e0 | ||
|
|
c3fbf5d9a8 | ||
|
|
55e42c93a8 | ||
|
|
6a0dec9584 | ||
|
|
21a85f1977 | ||
|
|
322de0c8c1 | ||
|
|
6a9af68b56 | ||
|
|
b6e4dac217 | ||
|
|
8a0a9392ab | ||
|
|
bcbe4e5254 | ||
|
|
47ff5c6279 | ||
|
|
898f856c44 | ||
|
|
883b0c2274 | ||
|
|
4f94d1a8b1 | ||
|
|
1d4581c2dd | ||
|
|
c05940edc7 | ||
|
|
c507a16e49 | ||
|
|
308f028e28 | ||
|
|
e4a6cf421a | ||
|
|
329636d6e3 | ||
|
|
9163b8fb23 | ||
|
|
a542db90c6 | ||
|
|
a7ce69dbd7 | ||
|
|
9d93ce246c | ||
|
|
76c4336c43 | ||
|
|
e71adb85c5 | ||
|
|
033c51f0a3 | ||
|
|
452d1595a6 | ||
|
|
0d197a833c | ||
|
|
e0031b80ee | ||
|
|
b19941ab05 | ||
|
|
752938daab | ||
|
|
c78515f55e | ||
|
|
3ba1f11147 | ||
|
|
bbc206fdf7 | ||
|
|
2bd065dfbe | ||
|
|
6d7dbc12f2 | ||
|
|
83c40e7fc0 | ||
|
|
b5fe234588 | ||
|
|
e1a00d7d1d | ||
|
|
acf60ef707 | ||
|
|
c85a157854 | ||
|
|
0c5d16e4f5 | ||
|
|
bd2af5e707 | ||
|
|
58d55afa6f | ||
|
|
6343e2fac3 | ||
|
|
b476df64a1 | ||
|
|
1d46b6b3b9 | ||
|
|
bbb35447c4 | ||
|
|
6276f1e100 | ||
|
|
5b8a57ecae | ||
|
|
817dfc18a3 | ||
|
|
0b0b2a8087 | ||
|
|
c23d16ac19 | ||
|
|
1b28ed575b | ||
|
|
135c0af1bb | ||
|
|
475918410b | ||
|
|
3102792161 | ||
|
|
a291182757 | ||
|
|
b26ca3408c | ||
|
|
83978bd37a | ||
|
|
a3790c0d01 | ||
|
|
63b6090f7c | ||
|
|
c5571db0c2 | ||
|
|
e0457d5f7c | ||
|
|
ae52ec9869 | ||
|
|
0b33bc6b72 | ||
|
|
7aa983c6db | ||
|
|
2b90b1f344 | ||
|
|
65123f8064 | ||
|
|
1d8634b110 | ||
|
|
29e0c30c2a | ||
|
|
cf82191d77 | ||
|
|
3a8a0a3945 | ||
|
|
c5d4ab7e35 | ||
|
|
b955dbd325 | ||
|
|
45582d1e2b | ||
|
|
60c50cbf9c | ||
|
|
3a3619b46a | ||
|
|
b83eddc578 | ||
|
|
7f558334ad | ||
|
|
6229a5607c | ||
|
|
6acc3b9689 | ||
|
|
66aa856698 | ||
|
|
f559f31bef | ||
|
|
3210b4fd14 | ||
|
|
a7b42009c4 | ||
|
|
7b5ffd6834 | ||
|
|
9b55da73ca | ||
|
|
e7156ff2e8 | ||
|
|
437db75b94 | ||
|
|
1586365835 | ||
|
|
7d5b04db4e | ||
|
|
48b0cf8b10 | ||
|
|
b693f941fd | ||
|
|
c602e7f4e8 | ||
|
|
1fc6d41bf6 | ||
|
|
a41477f92e | ||
|
|
5f68c5feef | ||
|
|
ee84a5a7fb | ||
|
|
66d3e7481e | ||
|
|
0e21156333 | ||
|
|
f533b7780e | ||
|
|
cc2f5a8022 | ||
|
|
b441bf9226 | ||
|
|
2a9aca32dc | ||
|
|
89da653fa6 | ||
|
|
af50b58c3f | ||
|
|
4d635a7001 | ||
|
|
ce15d5a9dc | ||
|
|
ba1c602281 | ||
|
|
cfc781be6e | ||
|
|
84acc3c2bc | ||
|
|
c2e4f17c1a | ||
|
|
979689aa5c | ||
|
|
a3faebd104 | ||
|
|
025c7737b2 | ||
|
|
513d4b4c16 | ||
|
|
7ef701519b | ||
|
|
50d194af4d | ||
|
|
287973746e | ||
|
|
f1558bb424 | ||
|
|
6ca487992b | ||
|
|
cf3a5cebd7 | ||
|
|
a661b65357 | ||
|
|
98e6654938 | ||
|
|
cecd263878 | ||
|
|
31fe950d2b | ||
|
|
db6a87d8cc | ||
|
|
7beb408771 | ||
|
|
51008ffce1 | ||
|
|
3811eed8d5 | ||
|
|
581f1c8494 | ||
|
|
41ebed27fa | ||
|
|
bf21446a2a | ||
|
|
e72d734d5f | ||
|
|
20d2186c87 | ||
|
|
9ba3ec9176 | ||
|
|
8f71fb8d98 | ||
|
|
48948d53b6 | ||
|
|
dbec19622e | ||
|
|
2ce15df528 | ||
|
|
681bfae499 | ||
|
|
5dd955dcd2 | ||
|
|
56fa8e69cf | ||
|
|
67d0738aba | ||
|
|
b8a61e7362 | ||
|
|
dd5e774664 | ||
|
|
6b86bad5ef | ||
|
|
712557128b | ||
|
|
3009e9f9ef | ||
|
|
b30245dae0 | ||
|
|
116daf4c2f | ||
|
|
cb40bdaf57 | ||
|
|
4b12506891 | ||
|
|
cf98440178 | ||
|
|
c500d44735 | ||
|
|
18eda73234 | ||
|
|
7526e2c043 | ||
|
|
6d52f260bf | ||
|
|
752f2b6785 | ||
|
|
e1c279b63d | ||
|
|
467889703a | ||
|
|
3a457cca86 | ||
|
|
285046ec51 | ||
|
|
f8000b9345 | ||
|
|
77a8eb352f | ||
|
|
114697bef3 | ||
|
|
2aa9043ad3 | ||
|
|
1a095560f7 | ||
|
|
f329b8d73b | ||
|
|
3d90a32429 | ||
|
|
e3a7463c5d | ||
|
|
796c6eadcb | ||
|
|
b485e5b7e3 | ||
|
|
d1cc7b8f22 | ||
|
|
1cf9d58cb4 | ||
|
|
0cff933416 | ||
|
|
c41b29e5db | ||
|
|
65fb3fa630 | ||
|
|
0b0f08dbc7 | ||
|
|
5c32657c80 | ||
|
|
07cee70258 | ||
|
|
4ba163cbf9 | ||
|
|
2bfb2398e3 | ||
|
|
a4a8f7b3ef | ||
|
|
34c66925aa | ||
|
|
cb7fd76f57 | ||
|
|
de822715b2 | ||
|
|
89f534e1d3 | ||
|
|
d46c1a8126 | ||
|
|
e32587d5a6 | ||
|
|
7876e4488f | ||
|
|
1a19f83d4c | ||
|
|
db8c838c6a | ||
|
|
37da54b10e | ||
|
|
0fea7ed4a4 | ||
|
|
dbeac560aa | ||
|
|
89eeccacde | ||
|
|
c9fc143972 | ||
|
|
004aa803a9 | ||
|
|
c921a5e1d4 | ||
|
|
0b4b9a11f5 | ||
|
|
d7e0299792 | ||
|
|
9dfdf0ad1d | ||
|
|
3b04cdd706 | ||
|
|
11a57c7be5 | ||
|
|
b370230b78 | ||
|
|
50a381b789 | ||
|
|
534aaf3731 | ||
|
|
6dc5d570d0 | ||
|
|
cb78486d97 | ||
|
|
9c9aa4f145 | ||
|
|
b6d1e52d45 | ||
|
|
f185e725a0 | ||
|
|
591ccf586d | ||
|
|
b7061c61b0 | ||
|
|
8a428200a6 | ||
|
|
10b2328fea | ||
|
|
98c2a26ea6 | ||
|
|
965b6dad44 | ||
|
|
a3d8c0fc5d | ||
|
|
a32d795aae | ||
|
|
ef3dc028ef | ||
|
|
2413a3975f | ||
|
|
3b0b5abae3 | ||
|
|
b49124f6d9 | ||
|
|
2260ad21fb | ||
|
|
6b0e9facf4 | ||
|
|
c404ff7955 | ||
|
|
8e2f6b79ea | ||
|
|
ee60d9fb28 | ||
|
|
be6d77005f | ||
|
|
b263b66746 | ||
|
|
5294dd705d | ||
|
|
2b67158673 | ||
|
|
db744f8950 | ||
|
|
e059b19ddb | ||
|
|
997a54c981 | ||
|
|
b78e502104 | ||
|
|
b6d0054a52 | ||
|
|
117df10db4 | ||
|
|
d300bcca7f | ||
|
|
d59c3e5046 | ||
|
|
6d8566f2eb | ||
|
|
4e1b0d8904 | ||
|
|
8ce2912fbc | ||
|
|
1372965e2e | ||
|
|
1a1422643b | ||
|
|
409960491d | ||
|
|
96bd6f730a | ||
|
|
c0f5dd070b | ||
|
|
9d7a8d3578 | ||
|
|
4dec4f646d | ||
|
|
2cb924b052 | ||
|
|
51ac0cfe44 | ||
|
|
16e819e1d8 | ||
|
|
1023cfe70d | ||
|
|
8e0a2d8461 | ||
|
|
e13ae96d7c | ||
|
|
9f29ec4721 | ||
|
|
b9a20b5057 | ||
|
|
c2222c2ea2 | ||
|
|
336da5642d | ||
|
|
8573fa1806 | ||
|
|
a52c2fb296 | ||
|
|
41450b27f2 | ||
|
|
e72d5983f2 | ||
|
|
5a85385387 | ||
|
|
5e54b4f364 | ||
|
|
5ba372b17c | ||
|
|
f9b0f47c0c | ||
|
|
4deeadf7dc | ||
|
|
384eff877c | ||
|
|
68dbba9817 | ||
|
|
ea7150b070 | ||
|
|
cb42ce0b67 | ||
|
|
e8330cf5ac | ||
|
|
7d34470458 | ||
|
|
f1047cebea | ||
|
|
da8a2e6f90 | ||
|
|
546ec5a9b3 | ||
|
|
e3fefbfd56 | ||
|
|
3b80e3aa9e | ||
|
|
14cfde9c83 | ||
|
|
9cabef963c | ||
|
|
ce9eab79a7 | ||
|
|
e9e202cfa8 | ||
|
|
d83ae69455 | ||
|
|
bb4f7a8d52 | ||
|
|
619b2c03dc | ||
|
|
aa4c2de10e | ||
|
|
6c36f7a9f2 | ||
|
|
78f7923580 | ||
|
|
978ebf0141 | ||
|
|
a9ed4da8eb | ||
|
|
e1a4814cd4 | ||
|
|
3cad81f6fe | ||
|
|
4450107afb | ||
|
|
908efd3b73 | ||
|
|
1a7691c059 | ||
|
|
f524ddbe04 | ||
|
|
541814c403 | ||
|
|
5013540224 | ||
|
|
94cb5ee63c | ||
|
|
fc9c61bc3b | ||
|
|
e815d3015e | ||
|
|
dc2a33d680 | ||
|
|
7ba45bf133 | ||
|
|
d98a4b7366 | ||
|
|
889a54c467 | ||
|
|
9d07fd03e3 | ||
|
|
a8a1878256 | ||
|
|
5b46eee0f5 | ||
|
|
e5e6a94fbf | ||
|
|
d9ff889073 | ||
|
|
e4decc418a | ||
|
|
cf5bfbfc21 | ||
|
|
567fef894e | ||
|
|
6ee2a1365e | ||
|
|
435037d4e4 | ||
|
|
c5de8996cc | ||
|
|
2dc5383a20 | ||
|
|
9391f97715 | ||
|
|
5b16639538 | ||
|
|
1738bb61e1 | ||
|
|
91b3f0e691 | ||
|
|
6ac4e8bd6e | ||
|
|
983495c4b2 | ||
|
|
931a23a5a5 | ||
|
|
72849dce81 | ||
|
|
2618893114 | ||
|
|
36026dfc01 | ||
|
|
79aa04ef27 | ||
|
|
3a0799977b | ||
|
|
e19ea55783 | ||
|
|
8716dbea40 | ||
|
|
e9bc66c84f | ||
|
|
c078798c60 | ||
|
|
de73cca923 | ||
|
|
b1051789d6 | ||
|
|
4db73c1bb8 | ||
|
|
3ae34e3a8c | ||
|
|
1f3b65801b | ||
|
|
5e2c4e23f4 | ||
|
|
35780c2139 | ||
|
|
ceff5fec5a | ||
|
|
4897dc4056 | ||
|
|
35e33f0e52 | ||
|
|
a844e27baa | ||
|
|
0783bf151c | ||
|
|
566bdf2bda | ||
|
|
eb6dc02b23 | ||
|
|
78435364ec | ||
|
|
5cbc2e8bc1 | ||
|
|
e7cf7fcd21 | ||
|
|
bb8aab0211 | ||
|
|
0fbf5f7102 | ||
|
|
f1b2807478 | ||
|
|
faacb092f8 | ||
|
|
b439a74620 | ||
|
|
3132ab8ce6 | ||
|
|
bfd7bb3eb6 | ||
|
|
11c8f0b79d | ||
|
|
c4068186ac | ||
|
|
0a93a68020 | ||
|
|
f2ab7d1392 | ||
|
|
c41ab9ade5 | ||
|
|
141e584998 | ||
|
|
336736ef35 | ||
|
|
df7cb13525 | ||
|
|
d93eb21c7c | ||
|
|
a403188f92 | ||
|
|
82b2230527 | ||
|
|
a8a004987c | ||
|
|
0e36019977 | ||
|
|
354c3ace73 | ||
|
|
52129c0b0b | ||
|
|
a52877a2f1 | ||
|
|
cdd7c3ce92 | ||
|
|
c1497b4d19 | ||
|
|
b2ed462934 | ||
|
|
bb766a0ad6 | ||
|
|
b65f851318 | ||
|
|
35bf35411c | ||
|
|
54fbc77dc8 | ||
|
|
9e09eebf94 | ||
|
|
45a2f93906 | ||
|
|
6982c0da4e | ||
|
|
b7727ee616 | ||
|
|
f0446ca8d7 | ||
|
|
6bc847e49e | ||
|
|
3f1c4e49a3 | ||
|
|
37a7cd1a11 | ||
|
|
3a2d9c4dd0 | ||
|
|
e51d1321fc | ||
|
|
b9fdb3eb99 | ||
|
|
d66ace9da5 | ||
|
|
db75357110 | ||
|
|
0713f8abe6 | ||
|
|
93d9121a77 | ||
|
|
92dad6cc84 | ||
|
|
61454a9f8c | ||
|
|
bb2297a41d | ||
|
|
75e98d0563 | ||
|
|
e9eb000c53 | ||
|
|
1ba01caaa3 | ||
|
|
5cd6571fae | ||
|
|
6383bbe525 | ||
|
|
06da6e4977 | ||
|
|
b72faddc47 | ||
|
|
d92f0bb6e9 | ||
|
|
710e5d5639 | ||
|
|
6da980e2b5 | ||
|
|
37f599bcec | ||
|
|
8408f4fbc7 | ||
|
|
534164ef90 | ||
|
|
e32c852e1e | ||
|
|
dbfc0f8c2b | ||
|
|
3728974460 | ||
|
|
fdc2bbcacb | ||
|
|
c2a3358b60 | ||
|
|
882e891284 | ||
|
|
05bbf78afd | ||
|
|
99ecb90a99 | ||
|
|
dbad169019 | ||
|
|
3ba5d1cf2e | ||
|
|
be2e2c3297 | ||
|
|
ed0015284b | ||
|
|
6d03b73e35 | ||
|
|
622d3d3592 | ||
|
|
0e06354402 | ||
|
|
62c271610b | ||
|
|
db089ad60d | ||
|
|
1f0c9ad7e1 | ||
|
|
06efc222f9 | ||
|
|
de3333bae4 | ||
|
|
924875e53b | ||
|
|
3a64458217 | ||
|
|
ea71c22731 | ||
|
|
dc706cd35f | ||
|
|
1241126adf | ||
|
|
19da130053 | ||
|
|
a75b191502 | ||
|
|
e5cb260365 | ||
|
|
6aecef815c | ||
|
|
daba492c3a | ||
|
|
24cff6ced5 | ||
|
|
ac7b42610f | ||
|
|
7abe76e1bd | ||
|
|
7bc03ded12 | ||
|
|
ea3b8af50a | ||
|
|
badb910f3c | ||
|
|
3866752e7e | ||
|
|
3e3dac9f97 | ||
|
|
397ba0f08a | ||
|
|
07ad8f5d17 | ||
|
|
47c3448a97 | ||
|
|
4db48ec0bd | ||
|
|
c518ade1fd | ||
|
|
acdf4afb91 | ||
|
|
6d3dec92fb | ||
|
|
2d3b6a5be7 | ||
|
|
81d1998e09 | ||
|
|
6b46ca135a | ||
|
|
fa293e4e4b | ||
|
|
24cbf3efc6 | ||
|
|
534a1ed0cb | ||
|
|
ee306a1332 | ||
|
|
45442167b0 | ||
|
|
131645ecce | ||
|
|
f1ca5f5b89 | ||
|
|
e452de9d87 | ||
|
|
a0256f462a | ||
|
|
82d5d46c14 | ||
|
|
0665dd6852 | ||
|
|
98fc09b18a | ||
|
|
192ebef8cf | ||
|
|
b01ab14338 | ||
|
|
2a96235bf7 | ||
|
|
1cf9bf00f4 | ||
|
|
a5224c3420 | ||
|
|
af436bc158 | ||
|
|
ab603c6987 | ||
|
|
9c11a0e541 | ||
|
|
8de83bf876 | ||
|
|
679df234b7 | ||
|
|
26eaab0990 | ||
|
|
7be96d7c9f | ||
|
|
d11493934c | ||
|
|
c62da732a4 | ||
|
|
a1a63a4239 | ||
|
|
103a434386 | ||
|
|
567671e291 | ||
|
|
d8a750ee7f | ||
|
|
9c10b2c8d3 | ||
|
|
56a106115f | ||
|
|
e9ad0d2c31 | ||
|
|
97639f0d73 | ||
|
|
e3a4f8b84c | ||
|
|
7e99812432 | ||
|
|
2a1ef75435 | ||
|
|
c148d70978 | ||
|
|
7b6055d1af | ||
|
|
f31b12503e | ||
|
|
f82197ad75 | ||
|
|
3f37e73bae | ||
|
|
0774f470d9 | ||
|
|
d7a9e91688 | ||
|
|
601cb9be20 | ||
|
|
f3229ee19a | ||
|
|
219a3580b7 | ||
|
|
d63c6bd397 | ||
|
|
fdb61e583a | ||
|
|
b8e2f83ae6 | ||
|
|
93dbd83570 | ||
|
|
5be022712a | ||
|
|
43f9391bcc | ||
|
|
c1c971654b | ||
|
|
72b1072fbd | ||
|
|
3bfd99bfbb | ||
|
|
a169e82065 | ||
|
|
c80410c50c | ||
|
|
dc01b6b1f2 | ||
|
|
b7a26e6daf | ||
|
|
ce16450a89 | ||
|
|
9d2e51c199 | ||
|
|
1e325f6149 | ||
|
|
c458a33196 | ||
|
|
7953b8ff1b | ||
|
|
b1460627f3 | ||
|
|
5abc8ae6f9 | ||
|
|
6a184a6098 | ||
|
|
3d5e97f560 | ||
|
|
54c7559a7e | ||
|
|
0c9de428ae | ||
|
|
f13def508c | ||
|
|
1ae6ddac91 | ||
|
|
55dcfa421c | ||
|
|
c04f8cf44a | ||
|
|
870d986131 | ||
|
|
4f272c17f5 | ||
|
|
fd3e027faa | ||
|
|
235dd0a22a | ||
|
|
b589977b9e | ||
|
|
291e4a6ebe | ||
|
|
2d2ed9dffd | ||
|
|
8ada6e7705 | ||
|
|
7f657f342a | ||
|
|
20e8f0ee27 | ||
|
|
429266b7e4 | ||
|
|
2c7bc88d78 | ||
|
|
54f7ebe789 | ||
|
|
dd499e74de | ||
|
|
19a6e8b32c | ||
|
|
ed5538dc2b | ||
|
|
b8ffcf49ed | ||
|
|
eb929eef14 | ||
|
|
2cd3ad9bdd | ||
|
|
323f289c48 | ||
|
|
a45e4a5537 | ||
|
|
b7fe2f9675 | ||
|
|
6dcd1c9109 | ||
|
|
2fe5adc36c | ||
|
|
839590f576 | ||
|
|
e0a8d1f94e | ||
|
|
9ad0f6812f | ||
|
|
a3376fe8fc | ||
|
|
3cc1f498a1 | ||
|
|
c6c0035ea5 | ||
|
|
531d630b5c | ||
|
|
853b1eb424 | ||
|
|
09a2615fb2 | ||
|
|
285b42756a | ||
|
|
508f15cdab | ||
|
|
52c0d30078 | ||
|
|
10997ee8ab | ||
|
|
8a774dc9a6 | ||
|
|
200bc9e3e8 | ||
|
|
7dd0ee0495 | ||
|
|
76569fc662 | ||
|
|
f2a253e0dd | ||
|
|
0ad0eaf61c | ||
|
|
47b0f48dd9 | ||
|
|
44e48abc44 | ||
|
|
f420de027f | ||
|
|
ecf186065c | ||
|
|
20e021bf41 | ||
|
|
8ca2ae775d | ||
|
|
ee8aa8217a | ||
|
|
2b49dd1e8f | ||
|
|
30a54b9085 | ||
|
|
1e7e62f8cd | ||
|
|
5352823fbf | ||
|
|
20251f01ea | ||
|
|
528f6b81db | ||
|
|
27bfba299e | ||
|
|
1690863acc | ||
|
|
397211323c | ||
|
|
a87f50fb5a | ||
|
|
31bc51c8cf | ||
|
|
be487c429e | ||
|
|
80340f1fe9 | ||
|
|
d918f85146 | ||
|
|
a95541d61e | ||
|
|
30b4c2724e | ||
|
|
2adc929367 | ||
|
|
7e97837274 | ||
|
|
4cb73bf8e4 | ||
|
|
79bb8d0077 | ||
|
|
6c1a3e4f58 | ||
|
|
76c919c1a3 | ||
|
|
98405f240b | ||
|
|
181355616e | ||
|
|
b49a5b2dc0 | ||
|
|
713f226114 | ||
|
|
d57d85ff35 | ||
|
|
74daa124c2 | ||
|
|
b8e35bd66e | ||
|
|
e8734731d3 | ||
|
|
9e0fcabeca | ||
|
|
6482dec1bb | ||
|
|
81b5eeed6a | ||
|
|
365359dd79 | ||
|
|
2757be06de | ||
|
|
d0afe49d3e | ||
|
|
81b31b7087 | ||
|
|
2643b122fc | ||
|
|
88db657ac2 | ||
|
|
1f0af2c073 | ||
|
|
2ed2d1515e | ||
|
|
bb5b16a36c | ||
|
|
5892855c5f | ||
|
|
a6e859e9ec | ||
|
|
99c65cef0f | ||
|
|
496da8b918 | ||
|
|
739862384c | ||
|
|
0a647c2b8b | ||
|
|
429e4f0de8 | ||
|
|
2d10c7156c | ||
|
|
299053becd | ||
|
|
1449bda052 | ||
|
|
56bb1a7c83 | ||
|
|
96aaf806d8 | ||
|
|
d70e5100c0 | ||
|
|
4831e626aa | ||
|
|
33ab4699ba | ||
|
|
595cc5b4b8 | ||
|
|
29fb08c2de | ||
|
|
7babdf2029 | ||
|
|
4b3270f78e | ||
|
|
3351b8d007 | ||
|
|
4b49bf6a93 | ||
|
|
926a56bfe3 | ||
|
|
d6f188be71 | ||
|
|
016cadfb54 | ||
|
|
bdee69f718 | ||
|
|
ff43e2e155 | ||
|
|
f53948856e | ||
|
|
14056ee2ee | ||
|
|
b545dc6775 | ||
|
|
027902999e | ||
|
|
9a310a5d4e | ||
|
|
a63d5eaab2 | ||
|
|
6af59bc095 | ||
|
|
24cc290b85 | ||
|
|
8e264a933f | ||
|
|
f0b54fefe9 | ||
|
|
cf2d9e09b3 | ||
|
|
d02408ad8a | ||
|
|
7ae551fd03 | ||
|
|
c2e45f6ddf | ||
|
|
f9a4ad4fa6 | ||
|
|
10645a4f13 | ||
|
|
06cb0353e5 | ||
|
|
b41f836e5f | ||
|
|
26a81abffc | ||
|
|
ab03b0df4c | ||
|
|
e5a77633cf | ||
|
|
6f8a82c7af | ||
|
|
7a7f47ea80 | ||
|
|
0ce5f3e4f5 | ||
|
|
21023745e2 | ||
|
|
a679116f6f | ||
|
|
3988bb34aa | ||
|
|
9e78e6c3f8 | ||
|
|
3caff6092a | ||
|
|
0d96bf8950 | ||
|
|
91dc71f98d | ||
|
|
b7b6c047ca | ||
|
|
0ea659475c | ||
|
|
1e20bb0648 | ||
|
|
c962479bdf | ||
|
|
b31ccc362c | ||
|
|
0cd5866726 | ||
|
|
2a8a10eda6 | ||
|
|
f11bc84080 | ||
|
|
e2f3ae1252 | ||
|
|
40fcda292f | ||
|
|
59bc3126c5 | ||
|
|
4d6115a5cc | ||
|
|
3a25b96caf | ||
|
|
6e6d04e29a | ||
|
|
48ff225300 | ||
|
|
a4a9d97a3e | ||
|
|
404f952aa3 | ||
|
|
dcd87618ab | ||
|
|
d54bf14559 | ||
|
|
ea3a429efe | ||
|
|
e3f1223fe4 | ||
|
|
7ef6e3fe2f | ||
|
|
197322455d | ||
|
|
4f19a0672b | ||
|
|
854e076df8 | ||
|
|
cb2a0e1319 | ||
|
|
638b0d4277 | ||
|
|
f2346808de | ||
|
|
d7818facb9 | ||
|
|
bcf95a2183 | ||
|
|
f7181a9179 | ||
|
|
9237ba8b66 | ||
|
|
95874603b0 | ||
|
|
ed2e24d564 | ||
|
|
c9fd77e9dd | ||
|
|
a9d2bc4902 | ||
|
|
c3bdbcf639 | ||
|
|
d9a770e6ea | ||
|
|
35feed50f0 | ||
|
|
a116afa42e | ||
|
|
b4542fb307 | ||
|
|
1f224bf029 | ||
|
|
4d231b4359 | ||
|
|
ac0f1d0b14 | ||
|
|
124d8cf701 | ||
|
|
7d0d0996aa | ||
|
|
9cddbf14db | ||
|
|
5f1fddbbe7 | ||
|
|
027e257b1d | ||
|
|
93f117003e | ||
|
|
42748c084e | ||
|
|
77dd9c1850 | ||
|
|
83d968df60 | ||
|
|
4ac881ede3 | ||
|
|
ccd2cd3e64 | ||
|
|
6186ef9338 | ||
|
|
6bcac6e578 | ||
|
|
967d95f096 | ||
|
|
26c7750827 | ||
|
|
5a16d270ab | ||
|
|
3a465d5ec9 | ||
|
|
413a4a0461 | ||
|
|
a95d2c5133 | ||
|
|
1876cc32ae | ||
|
|
4e2a08ddd4 | ||
|
|
61e2c34a10 | ||
|
|
e56b54a376 | ||
|
|
0da945bb20 | ||
|
|
69443d0da0 | ||
|
|
e4dc18d7e5 | ||
|
|
3f86a2b147 | ||
|
|
fd664b9fc6 | ||
|
|
722ca2781c | ||
|
|
1c72eebf89 | ||
|
|
69ce8bb952 | ||
|
|
50b8ba0201 | ||
|
|
c9fd9152bd | ||
|
|
f891abccf2 | ||
|
|
e2effdbc6b | ||
|
|
b10ae320f7 | ||
|
|
5d3ab9b096 | ||
|
|
4fea8145e2 | ||
|
|
884e26080f | ||
|
|
9946491fcc | ||
|
|
ae6dfff5bf | ||
|
|
307bf4dae2 | ||
|
|
96d65fc022 | ||
|
|
080b8cadfa | ||
|
|
7cdd2aa128 | ||
|
|
7d7672f119 | ||
|
|
6a5b52efa0 | ||
|
|
6d864b7030 | ||
|
|
71a39dd4be | ||
|
|
500230ee94 | ||
|
|
347177e052 | ||
|
|
b7883fbb6e | ||
|
|
a77e023ab4 | ||
|
|
812cb5638c | ||
|
|
77a0f1d727 | ||
|
|
b9a18f3b8d | ||
|
|
73aeb61c3f | ||
|
|
3041903844 | ||
|
|
ad8ee98617 | ||
|
|
bc29d0e5d4 | ||
|
|
f89aebb1c4 | ||
|
|
1d7fb4f0c5 | ||
|
|
81a6c7817f | ||
|
|
5238fccc15 | ||
|
|
fba9046490 | ||
|
|
8a2908a24a | ||
|
|
e8b12f7a6f | ||
|
|
271da5a2e0 | ||
|
|
26fbabf3d1 | ||
|
|
37cdcb4d8a | ||
|
|
57b6534e53 | ||
|
|
8bf49ea170 | ||
|
|
02ee8626fb | ||
|
|
6276e5b41b | ||
|
|
51740b12ae | ||
|
|
6e6783056e | ||
|
|
791bd0cd2b | ||
|
|
e890dcdb19 | ||
|
|
5ddcb8664a | ||
|
|
09c4b4e0b7 | ||
|
|
368101778e | ||
|
|
535d79da63 | ||
|
|
4f69172d25 |
525
Configure
525
Configure
@@ -10,7 +10,7 @@ use strict;
|
|||||||
|
|
||||||
# see INSTALL for instructions.
|
# see INSTALL for instructions.
|
||||||
|
|
||||||
my $usage="Usage: Configure [no-<cipher> ...] [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [no-hw-xxx|no-hw] [no-threads] [no-asm] [no-dso] [no-krb5] [386] [--prefix=DIR] [--openssldir=OPENSSLDIR] [--with-xxx=vvv] os/compiler[:flags]\n";
|
my $usage="Usage: Configure [no-<cipher> ...] [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [no-hw-xxx|no-hw] [[no-]threads] [[no-]shared] [[no-]zlib|zlib-dynamic] [no-asm] [no-dso] [no-krb5] [386] [--prefix=DIR] [--openssldir=OPENSSLDIR] [--with-xxx[=vvv]] [--test-sanity] os/compiler[:flags]\n";
|
||||||
|
|
||||||
# Options:
|
# Options:
|
||||||
#
|
#
|
||||||
@@ -25,13 +25,18 @@ my $usage="Usage: Configure [no-<cipher> ...] [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-
|
|||||||
#
|
#
|
||||||
# --with-krb5-dir Declare where Kerberos 5 lives. The libraries are expected
|
# --with-krb5-dir Declare where Kerberos 5 lives. The libraries are expected
|
||||||
# to live in the subdirectory lib/ and the header files in
|
# to live in the subdirectory lib/ and the header files in
|
||||||
# include/.
|
# include/. A value is required.
|
||||||
# --with-krb5-lib Declare where the Kerberos 5 libraries live.
|
# --with-krb5-lib Declare where the Kerberos 5 libraries live. A value is
|
||||||
|
# required.
|
||||||
# (Default: KRB5_DIR/lib)
|
# (Default: KRB5_DIR/lib)
|
||||||
# --with-krb5-include Declare where the Kerberos 5 header files live.
|
# --with-krb5-include Declare where the Kerberos 5 header files live. A
|
||||||
|
# value is required.
|
||||||
# (Default: KRB5_DIR/include)
|
# (Default: KRB5_DIR/include)
|
||||||
# --with-krb5-flavor Declare what flavor of Kerberos 5 is used. Currently
|
# --with-krb5-flavor Declare what flavor of Kerberos 5 is used. Currently
|
||||||
# supported values are "MIT" and "Heimdal".
|
# supported values are "MIT" and "Heimdal". A value is required.
|
||||||
|
#
|
||||||
|
# --test-sanity Make a number of sanity checks on the data in this file.
|
||||||
|
# This is a debugging tool for OpenSSL developers.
|
||||||
#
|
#
|
||||||
# no-hw-xxx do not compile support for specific crypto hardware.
|
# no-hw-xxx do not compile support for specific crypto hardware.
|
||||||
# Generic OpenSSL-style methods relating to this support
|
# Generic OpenSSL-style methods relating to this support
|
||||||
@@ -46,6 +51,9 @@ my $usage="Usage: Configure [no-<cipher> ...] [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-
|
|||||||
# no-dso do not compile in any native shared-library methods. This
|
# no-dso do not compile in any native shared-library methods. This
|
||||||
# will ensure that all methods just return NULL.
|
# will ensure that all methods just return NULL.
|
||||||
# no-krb5 do not compile in any KRB5 library or code.
|
# no-krb5 do not compile in any KRB5 library or code.
|
||||||
|
# [no-]zlib [don't] compile support for zlib compression.
|
||||||
|
# zlib-dynamic Like "zlib", but the zlib library is expected to be a shared
|
||||||
|
# library and will be loaded in run-time by the OpenSSL library.
|
||||||
# 386 generate 80386 code
|
# 386 generate 80386 code
|
||||||
# no-<cipher> build without specified algorithm (rsa, idea, rc5, ...)
|
# no-<cipher> build without specified algorithm (rsa, idea, rc5, ...)
|
||||||
# -<xxx> +<xxx> compiler options are passed through
|
# -<xxx> +<xxx> compiler options are passed through
|
||||||
@@ -104,10 +112,15 @@ my $x86_elf_asm="asm/bn86-elf.o asm/co86-elf.o:asm/dx86-elf.o asm/yx86-elf.o:asm
|
|||||||
my $x86_out_asm="asm/bn86-out.o asm/co86-out.o:asm/dx86-out.o asm/yx86-out.o:asm/bx86-out.o:asm/mx86-out.o:asm/sx86-out.o:asm/cx86-out.o:asm/rx86-out.o:asm/rm86-out.o:asm/r586-out.o";
|
my $x86_out_asm="asm/bn86-out.o asm/co86-out.o:asm/dx86-out.o asm/yx86-out.o:asm/bx86-out.o:asm/mx86-out.o:asm/sx86-out.o:asm/cx86-out.o:asm/rx86-out.o:asm/rm86-out.o:asm/r586-out.o";
|
||||||
my $x86_bsdi_asm="asm/bn86bsdi.o asm/co86bsdi.o:asm/dx86bsdi.o asm/yx86bsdi.o:asm/bx86bsdi.o:asm/mx86bsdi.o:asm/sx86bsdi.o:asm/cx86bsdi.o:asm/rx86bsdi.o:asm/rm86bsdi.o:asm/r586bsdi.o";
|
my $x86_bsdi_asm="asm/bn86bsdi.o asm/co86bsdi.o:asm/dx86bsdi.o asm/yx86bsdi.o:asm/bx86bsdi.o:asm/mx86bsdi.o:asm/sx86bsdi.o:asm/cx86bsdi.o:asm/rx86bsdi.o:asm/rm86bsdi.o:asm/r586bsdi.o";
|
||||||
|
|
||||||
|
my $mips3_irix_asm="asm/mips3.o::::::::";
|
||||||
|
# There seems to be boundary faults in asm/alpha.s.
|
||||||
|
#my $alpha_asm="asm/alpha.o::::::::";
|
||||||
|
my $alpha_asm="::::::::";
|
||||||
|
|
||||||
# -DB_ENDIAN slows things down on a sparc for md5, but helps sha1.
|
# -DB_ENDIAN slows things down on a sparc for md5, but helps sha1.
|
||||||
# So the md5_locl.h file has an undef B_ENDIAN if sun is defined
|
# So the md5_locl.h file has an undef B_ENDIAN if sun is defined
|
||||||
|
|
||||||
#config-string $cc : $cflags : $unistd : $thread_cflag : $sys_id : $lflags : $bn_ops : $bn_obj : $des_obj : $bf_obj : $md5_obj : $sha1_obj : $cast_obj : $rc4_obj : $rmd160_obj : $rc5_obj : $dso_scheme : $shared_target : $shared_cflag
|
#config-string $cc : $cflags : $unistd : $thread_cflag : $sys_id : $lflags : $bn_ops : $bn_obj : $des_obj : $bf_obj : $md5_obj : $sha1_obj : $cast_obj : $rc4_obj : $rmd160_obj : $rc5_obj : $dso_scheme : $shared_target : $shared_cflag : $shared_ldflag : $shared_extension : $ranlib
|
||||||
|
|
||||||
my %table=(
|
my %table=(
|
||||||
# File 'TABLE' (created by 'make TABLE') contains the data from this list,
|
# File 'TABLE' (created by 'make TABLE') contains the data from this list,
|
||||||
@@ -123,52 +136,61 @@ my %table=(
|
|||||||
"purify", "purify gcc:-g -DPURIFY -Wall::(unknown)::-lsocket -lnsl::::",
|
"purify", "purify gcc:-g -DPURIFY -Wall::(unknown)::-lsocket -lnsl::::",
|
||||||
"debug", "gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -ggdb -g2 -Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations -Werror::(unknown)::-lefence::::",
|
"debug", "gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -ggdb -g2 -Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations -Werror::(unknown)::-lefence::::",
|
||||||
"debug-ben", "gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::asm/bn86-elf.o asm/co86-elf.o",
|
"debug-ben", "gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::asm/bn86-elf.o asm/co86-elf.o",
|
||||||
|
"debug-ben-openbsd","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DOPENSSL_OPENBSD_DEV_CRYPTO -DOPENSSL_NO_ASM -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::",
|
||||||
|
"debug-ben-openbsd-debug","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DOPENSSL_OPENBSD_DEV_CRYPTO -DOPENSSL_NO_ASM -g3 -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::",
|
||||||
"debug-ben-debug", "gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -g3 -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::::",
|
"debug-ben-debug", "gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -g3 -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::::",
|
||||||
"debug-ben-strict", "gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DCONST_STRICT -O2 -Wall -Wshadow -Werror -Wpointer-arith -Wcast-qual -Wwrite-strings -pipe::(unknown)::::::",
|
"debug-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-rse","cc:-DTERMIOS -DL_ENDIAN -pipe -O -g -ggdb3 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
|
||||||
"debug-bodo", "gcc:-DL_ENDIAN -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DBIO_PAIR_DEBUG -DPEDANTIC -g -m486 -pedantic -Wshadow -Wall::-D_REENTRANT:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
|
"debug-bodo", "gcc:-DL_ENDIAN -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DBIO_PAIR_DEBUG -DPEDANTIC -g -m486 -pedantic -Wshadow -Wall::-D_REENTRANT:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
|
||||||
"debug-ulf", "gcc:-DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -g -O2 -m486 -Wall -Werror -Wshadow -pipe::-D_REENTRANT:::${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
|
"debug-ulf", "gcc:-DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -g -O2 -m486 -Wall -Werror -Wshadow -pipe::-D_REENTRANT:::${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
|
||||||
"debug-steve", "gcc:-DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG_ALL -DPEDANTIC -g -m486 -pedantic -Wall -Werror -Wshadow -pipe::-D_REENTRANT:::${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
|
"debug-steve", "gcc:-DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG_ALL -DPEDANTIC -g -mcpu=i486 -pedantic -Wall -Werror -Wshadow -pipe::-D_REENTRANT::-rdynamic -ldl:${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn",
|
||||||
"debug-levitte-linux-elf","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -m486 -pedantic -ansi -Wall -Wshadow -Wid-clash-31 -Wno-long-long -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
"debug-steve-linux-pseudo64", "gcc:-DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG_ALL -DOPENSSL_NO_ASM -g -mcpu=i486 -Wall -Werror -Wshadow -pipe::-D_REENTRANT::-rdynamic -ldl:SIXTY_FOUR_BIT::dlfcn",
|
||||||
"debug-levitte-linux-noasm","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -m486 -pedantic -ansi -Wall -Wshadow -Wid-clash-31 -Wno-long-long -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}::::::::::dlfcn:linux-shared:-fPIC:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
"debug-levitte-linux-elf","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -Wshadow -Wid-clash-31 -Wno-long-long -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
|
"debug-levitte-linux-noasm","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -Wshadow -Wid-clash-31 -Wno-long-long -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
"dist", "cc:-O::(unknown)::::::",
|
"dist", "cc:-O::(unknown)::::::",
|
||||||
|
|
||||||
# Basic configs that should work on any (32 and less bit) box
|
# Basic configs that should work on any (32 and less bit) box
|
||||||
"gcc", "gcc:-O3::(unknown):::BN_LLONG:::",
|
"gcc", "gcc:-O3::(unknown):::BN_LLONG:::",
|
||||||
"cc", "cc:-O::(unknown)::::::",
|
"cc", "cc:-O::(unknown)::::::",
|
||||||
|
|
||||||
#### Solaris x86 setups
|
#### Solaris x86 with GNU C setups
|
||||||
# -DOPENSSL_NO_INLINE_ASM switches off inline assembler. We have to do it
|
# -DOPENSSL_NO_INLINE_ASM switches off inline assembler. We have to do it
|
||||||
# here because whenever GNU C instantiates an assembler template it
|
# here because whenever GNU C instantiates an assembler template it
|
||||||
# surrounds it with #APP #NO_APP comment pair which (at least Solaris
|
# surrounds it with #APP #NO_APP comment pair which (at least Solaris
|
||||||
# 7_x86) /usr/ccs/bin/as fails to assemble with "Illegal mnemonic"
|
# 7_x86) /usr/ccs/bin/as fails to assemble with "Illegal mnemonic"
|
||||||
# error message.
|
# error message.
|
||||||
"solaris-x86-gcc","gcc:-O3 -fomit-frame-pointer -m486 -Wall -DL_ENDIAN -DOPENSSL_NO_INLINE_ASM::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_sol_asm}:dlfcn:solaris-shared:-fPIC:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
"solaris-x86-gcc","gcc:-O3 -fomit-frame-pointer -m486 -Wall -DL_ENDIAN -DOPENSSL_NO_INLINE_ASM::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_sol_asm}:dlfcn:solaris-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
|
|
||||||
|
#### Solaris x86 with Sun C setups
|
||||||
|
"solaris-x86-cc","cc:-fast -O -Xa::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_UNROLL BF_PTR::::::::::dlfcn:solaris-shared:-KPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
|
|
||||||
#### SPARC Solaris with GNU C setups
|
#### SPARC Solaris with GNU C setups
|
||||||
"solaris-sparcv7-gcc","gcc:-O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::::::::::dlfcn:solaris-shared:-fPIC:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
"solaris-sparcv7-gcc","gcc:-O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::::::::::dlfcn:solaris-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
"solaris-sparcv8-gcc","gcc:-mv8 -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8.o:::::::::dlfcn:solaris-shared:-fPIC:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
"solaris-sparcv8-gcc","gcc:-mv8 -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8.o:::::::::dlfcn:solaris-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
"solaris-sparcv9-gcc","gcc:-mcpu=ultrasparc -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8plus.o:::asm/md5-sparcv8plus.o::::::dlfcn:solaris-shared:-fPIC:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
# -m32 should be safe to add as long as driver recognizes -mcpu=ultrasparc
|
||||||
|
"solaris-sparcv9-gcc","gcc:-m32 -mcpu=ultrasparc -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8plus.o:::asm/md5-sparcv8plus.o::::::dlfcn:solaris-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
# gcc pre-2.8 doesn't understand -mcpu=ultrasparc, so fall down to -mv8
|
# gcc pre-2.8 doesn't understand -mcpu=ultrasparc, so fall down to -mv8
|
||||||
# but keep the assembler modules.
|
# but keep the assembler modules.
|
||||||
"solaris-sparcv9-gcc27","gcc:-mv8 -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8plus-gcc27.o:::asm/md5-sparcv8plus-gcc27.o::::::dlfcn:solaris-shared:-fPIC:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
"solaris-sparcv9-gcc27","gcc:-mv8 -O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8plus-gcc27.o:::asm/md5-sparcv8plus-gcc27.o::::::dlfcn:solaris-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
|
"solaris64-sparcv9-gcc","gcc:-m64 -mcpu=ultrasparc -O3 -Wall -DB_ENDIAN::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL BF_PTR::::asm/md5-sparcv9.o::::::dlfcn:solaris-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
|
|
||||||
####
|
####
|
||||||
"debug-solaris-sparcv8-gcc","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -O -g -mv8 -Wall -DB_ENDIAN::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8.o:::::::::dlfcn:solaris-shared:-fPIC:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
"debug-solaris-sparcv8-gcc","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -O -g -mv8 -Wall -DB_ENDIAN::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8.o:::::::::dlfcn:solaris-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
"debug-solaris-sparcv9-gcc","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -O -g -mcpu=ultrasparc -Wall -DB_ENDIAN::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8plus.o:::::::::dlfcn:solaris-shared:-fPIC:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
"debug-solaris-sparcv9-gcc","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -O -g -mcpu=ultrasparc -Wall -DB_ENDIAN::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8plus.o:::::::::dlfcn:solaris-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
|
|
||||||
#### SPARC Solaris with Sun C setups
|
#### SPARC Solaris with Sun C setups
|
||||||
# DO NOT use /xO[34] on sparc with SC3.0. It is broken, and will not pass the tests
|
# DO NOT use /xO[34] on sparc with SC3.0. It is broken, and will not pass the tests
|
||||||
"solaris-sparc-sc3","cc:-fast -O -Xa -DB_ENDIAN::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_UNROLL BF_PTR::::::::::dlfcn:solaris-shared:-KPIC:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
"solaris-sparc-sc3","cc:-fast -O -Xa -DB_ENDIAN::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_UNROLL BF_PTR::::::::::dlfcn:solaris-shared:-KPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
# SC4.0 doesn't pass 'make test', upgrade to SC5.0 or SC4.2.
|
# SC4.0 doesn't pass 'make test', upgrade to SC5.0 or SC4.2.
|
||||||
# SC4.2 is ok, better than gcc even on bn as long as you tell it -xarch=v8
|
# SC4.2 is ok, better than gcc even on bn as long as you tell it -xarch=v8
|
||||||
# SC5.0 note: Compiler common patch 107357-01 or later is required!
|
# SC5.0 note: Compiler common patch 107357-01 or later is required!
|
||||||
"solaris-sparcv7-cc","cc:-xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR::::::::::dlfcn:solaris-shared:-KPIC:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
"solaris-sparcv7-cc","cc:-xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR::::::::::dlfcn:solaris-shared:-KPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
"solaris-sparcv8-cc","cc:-xarch=v8 -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR:asm/sparcv8.o:::::::::dlfcn:solaris-shared:-KPIC:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
"solaris-sparcv8-cc","cc:-xarch=v8 -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR:asm/sparcv8.o:::::::::dlfcn:solaris-shared:-KPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
"solaris-sparcv9-cc","cc:-xtarget=ultra -xarch=v8plus -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK_LL DES_PTR DES_RISC1 DES_UNROLL BF_PTR:asm/sparcv8plus.o:::asm/md5-sparcv8plus.o::::::dlfcn:solaris-shared:-KPIC:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
"solaris-sparcv9-cc","cc:-xtarget=ultra -xarch=v8plus -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK_LL DES_PTR DES_RISC1 DES_UNROLL BF_PTR:asm/sparcv8plus.o:::asm/md5-sparcv8plus.o::::::dlfcn:solaris-shared:-KPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
"solaris64-sparcv9-cc","cc:-xtarget=ultra -xarch=v9 -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL BF_PTR::::asm/md5-sparcv9.o::::::dlfcn:solaris-shared:-KPIC:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):/usr/ccs/bin/ar rs",
|
"solaris64-sparcv9-cc","cc:-xtarget=ultra -xarch=v9 -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL BF_PTR::::asm/md5-sparcv9.o::::::dlfcn:solaris-shared:-KPIC:-xarch=v9:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):/usr/ccs/bin/ar rs",
|
||||||
####
|
####
|
||||||
"debug-solaris-sparcv8-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -xarch=v8 -g -O -xstrconst -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR:asm/sparcv8.o:::::::::dlfcn:solaris-shared:-KPIC:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
"debug-solaris-sparcv8-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -xarch=v8 -g -O -xstrconst -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR:asm/sparcv8.o:::::::::dlfcn:solaris-shared:-KPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
"debug-solaris-sparcv9-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -xtarget=ultra -xarch=v8plus -g -O -xstrconst -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK_LL DES_PTR DES_RISC1 DES_UNROLL BF_PTR:asm/sparcv8plus.o:::asm/md5-sparcv8plus.o::::::dlfcn:solaris-shared:-KPIC:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
"debug-solaris-sparcv9-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -xtarget=ultra -xarch=v8plus -g -O -xstrconst -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK_LL DES_PTR DES_RISC1 DES_UNROLL BF_PTR:asm/sparcv8plus.o:::asm/md5-sparcv8plus.o::::::dlfcn:solaris-shared:-KPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
|
|
||||||
#### SPARC Linux setups
|
#### SPARC Linux setups
|
||||||
"linux-sparcv7","gcc:-DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT:::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::",
|
"linux-sparcv7","gcc:-DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT:::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::",
|
||||||
@@ -177,7 +199,7 @@ my %table=(
|
|||||||
"linux-sparcv8","gcc:-mv8 -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall -DBN_DIV2W::-D_REENTRANT:::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8.o::::",
|
"linux-sparcv8","gcc:-mv8 -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall -DBN_DIV2W::-D_REENTRANT:::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8.o::::",
|
||||||
# it's a real mess with -mcpu=ultrasparc option under Linux, but
|
# it's a real mess with -mcpu=ultrasparc option under Linux, but
|
||||||
# -Wa,-Av8plus should do the trick no matter what.
|
# -Wa,-Av8plus should do the trick no matter what.
|
||||||
"linux-sparcv9","gcc:-mcpu=ultrasparc -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall -Wa,-Av8plus -DBN_DIV2W::-D_REENTRANT:ULTRASPARC::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8plus.o:::asm/md5-sparcv8plus.o:",
|
"linux-sparcv9","gcc:-mcpu=ultrasparc -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall -Wa,-Av8plus -DBN_DIV2W::-D_REENTRANT:ULTRASPARC::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:asm/sparcv8plus.o:::asm/md5-sparcv8plus.o::::::dlfcn:linux-shared:-fPIC:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
# !!!Folowing can't be even tested yet!!!
|
# !!!Folowing can't be even tested yet!!!
|
||||||
# We have to wait till 64-bit glibc for SPARC is operational!!!
|
# We have to wait till 64-bit glibc for SPARC is operational!!!
|
||||||
#"linux64-sparcv9","sparc64-linux-gcc:-m64 -mcpu=v9 -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall -DBN_DIV2W::-D_REENTRANT:ULTRASPARC::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::::asm/md5-sparcv9.o:",
|
#"linux64-sparcv9","sparc64-linux-gcc:-m64 -mcpu=v9 -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall -DBN_DIV2W::-D_REENTRANT:ULTRASPARC::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::::asm/md5-sparcv9.o:",
|
||||||
@@ -188,17 +210,17 @@ my %table=(
|
|||||||
|
|
||||||
#### IRIX 5.x configs
|
#### IRIX 5.x configs
|
||||||
# -mips2 flag is added by ./config when appropriate.
|
# -mips2 flag is added by ./config when appropriate.
|
||||||
"irix-gcc","gcc:-O3 -DTERMIOS -DB_ENDIAN::(unknown):::BN_LLONG MD2_CHAR RC4_INDEX RC4_CHAR RC4_CHUNK DES_UNROLL DES_RISC2 DES_PTR BF_PTR::::::::::dlfcn:irix-shared::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
"irix-gcc","gcc:-O3 -DTERMIOS -DB_ENDIAN::(unknown):::BN_LLONG MD2_CHAR RC4_INDEX RC4_CHAR RC4_CHUNK DES_UNROLL DES_RISC2 DES_PTR BF_PTR::::::::::dlfcn:irix-shared:::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
"irix-cc", "cc:-O2 -use_readonly_const -DTERMIOS -DB_ENDIAN::(unknown):::BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC2 DES_UNROLL BF_PTR::::::::::dlfcn:irix-shared::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
"irix-cc", "cc:-O2 -use_readonly_const -DTERMIOS -DB_ENDIAN::(unknown):::BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC2 DES_UNROLL BF_PTR::::::::::dlfcn:irix-shared:::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
#### IRIX 6.x configs
|
#### IRIX 6.x configs
|
||||||
# Only N32 and N64 ABIs are supported. If you need O32 ABI build, invoke
|
# Only N32 and N64 ABIs are supported. If you need O32 ABI build, invoke
|
||||||
# './Configure irix-[g]cc' manually.
|
# './Configure irix-[g]cc' manually.
|
||||||
# -mips4 flag is added by ./config when appropriate.
|
# -mips4 flag is added by ./config when appropriate.
|
||||||
"irix-mips3-gcc","gcc:-mabi=n32 -mmips-as -O3 -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::MD2_CHAR RC4_INDEX RC4_CHAR RC4_CHUNK_LL DES_UNROLL DES_RISC2 DES_PTR BF_PTR SIXTY_FOUR_BIT:asm/mips3.o:::::::::dlfcn:irix-shared::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
"irix-mips3-gcc","gcc:-mabi=n32 -mmips-as -O3 -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::MD2_CHAR RC4_INDEX RC4_CHAR RC4_CHUNK_LL DES_UNROLL DES_RISC2 DES_PTR BF_PTR SIXTY_FOUR_BIT:${mips3_irix_asm}:dlfcn:irix-shared:::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
"irix-mips3-cc", "cc:-n32 -O2 -use_readonly_const -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::DES_PTR RC4_CHAR RC4_CHUNK_LL DES_RISC2 DES_UNROLL BF_PTR SIXTY_FOUR_BIT:asm/mips3.o:::::::::dlfcn:irix-shared::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
"irix-mips3-cc", "cc:-n32 -O2 -use_readonly_const -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::DES_PTR RC4_CHAR RC4_CHUNK_LL DES_RISC2 DES_UNROLL BF_PTR SIXTY_FOUR_BIT:${mips3_irix_asm}:dlfcn:irix-shared:::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
# N64 ABI builds.
|
# N64 ABI builds.
|
||||||
"irix64-mips4-gcc","gcc:-mabi=64 -mips4 -mmips-as -O3 -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::RC4_CHAR RC4_CHUNK DES_RISC2 DES_UNROLL SIXTY_FOUR_BIT_LONG:asm/mips3.o:::::::::dlfcn:irix-shared::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
"irix64-mips4-gcc","gcc:-mabi=64 -mips4 -mmips-as -O3 -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::RC4_CHAR RC4_CHUNK DES_RISC2 DES_UNROLL SIXTY_FOUR_BIT_LONG:${mips3_irix_asm}:dlfcn:irix-shared:::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
"irix64-mips4-cc", "cc:-64 -mips4 -O2 -use_readonly_const -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::RC4_CHAR RC4_CHUNK DES_RISC2 DES_UNROLL SIXTY_FOUR_BIT_LONG:asm/mips3.o:::::::::dlfcn:irix-shared::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
"irix64-mips4-cc", "cc:-64 -mips4 -O2 -use_readonly_const -DTERMIOS -DB_ENDIAN -DBN_DIV3W::-D_SGI_MP_SOURCE:::RC4_CHAR RC4_CHUNK DES_RISC2 DES_UNROLL SIXTY_FOUR_BIT_LONG:${mips3_irix_asm}:dlfcn:irix-shared:::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
|
|
||||||
#### Unified HP-UX ANSI C configs.
|
#### Unified HP-UX ANSI C configs.
|
||||||
# Special notes:
|
# Special notes:
|
||||||
@@ -216,7 +238,7 @@ my %table=(
|
|||||||
# - Keep in mind that the HP compiler by default generates code
|
# - Keep in mind that the HP compiler by default generates code
|
||||||
# suitable for execution on the host you're currently compiling at.
|
# suitable for execution on the host you're currently compiling at.
|
||||||
# If the toolkit is ment to be used on various PA-RISC processors
|
# If the toolkit is ment to be used on various PA-RISC processors
|
||||||
# consider './config +Dportable'.
|
# consider './config +DAportable'.
|
||||||
# - +DD64 is chosen in favour of +DA2.0W because it's ment to be
|
# - +DD64 is chosen in favour of +DA2.0W because it's ment to be
|
||||||
# compatible with *future* releases.
|
# compatible with *future* releases.
|
||||||
# - If you run ./Configure hpux-parisc-[g]cc manually don't forget to
|
# - If you run ./Configure hpux-parisc-[g]cc manually don't forget to
|
||||||
@@ -230,41 +252,53 @@ my %table=(
|
|||||||
#
|
#
|
||||||
#!#"hpux-parisc-cc","cc:-Ae +O3 +ESlit -z -DB_ENDIAN -DBN_DIV2W -DMD32_XARRAY::::-ldld:BN_LLONG DES_PTR DES_UNROLL DES_RISC1::::::::::dl",
|
#!#"hpux-parisc-cc","cc:-Ae +O3 +ESlit -z -DB_ENDIAN -DBN_DIV2W -DMD32_XARRAY::::-ldld:BN_LLONG DES_PTR DES_UNROLL DES_RISC1::::::::::dl",
|
||||||
# Since there is mention of this in shlib/hpux10-cc.sh
|
# Since there is mention of this in shlib/hpux10-cc.sh
|
||||||
"hpux-parisc-cc-o4","cc:-Ae +O4 +ESlit -z -DB_ENDIAN -DBN_DIV2W -DMD32_XARRAY::::-ldld:BN_LLONG DES_PTR DES_UNROLL DES_RISC1::::::::::dl:hpux-shared:+Z:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
"hpux-parisc-cc-o4","cc:-Ae +O4 +ESlit -z -DB_ENDIAN -DBN_DIV2W -DMD32_XARRAY::::-ldld:BN_LLONG DES_PTR DES_UNROLL DES_RISC1::::::::::dl:hpux-shared:+Z::.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
"hpux-parisc-gcc","gcc:-O3 -DB_ENDIAN -DBN_DIV2W::::-Wl,+s -ldld:BN_LLONG DES_PTR DES_UNROLL DES_RISC1::::::::::dl:hpux-shared:-fPIC:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
"hpux-parisc-gcc","gcc:-O3 -DB_ENDIAN -DBN_DIV2W::::-Wl,+s -ldld:BN_LLONG DES_PTR DES_UNROLL DES_RISC1::::::::::dl:hpux-shared:-fPIC::.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
"hpux64-parisc-cc","cc:-Ae +DD64 +O3 +ESlit -z -DB_ENDIAN -DMD32_XARRAY::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT::::::::::dlfcn:hpux64-shared:+Z:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
"hpux64-parisc-cc","cc:-Ae +DD64 +O3 +ESlit -z -DB_ENDIAN -DMD32_XARRAY::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT::::::::::dlfcn:hpux64-shared:+Z::.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
|
|
||||||
|
# IA-64 targets
|
||||||
|
# I have no idea if this one actually works, feedback needed. <appro>
|
||||||
|
"hpux-ia64-cc","cc:-Ae +DD32 +O3 +ESlit -z -DB_ENDIAN::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT:asm/ia64-cpp.o:::::::::dlfcn:hpux-shared:+Z::.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
|
# Frank Geurts <frank.geurts@nl.abnamro.com> has patiently assisted with
|
||||||
|
# with debugging of the following config.
|
||||||
|
"hpux64-ia64-cc","cc:-Ae +DD64 +O3 +ESlit -z -DB_ENDIAN::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT:asm/ia64-cpp.o:::::::::dlfcn:hpux64-shared:+Z::.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
|
|
||||||
# More attempts at unified 10.X and 11.X targets for HP C compiler.
|
# More attempts at unified 10.X and 11.X targets for HP C compiler.
|
||||||
#
|
#
|
||||||
# Chris Ruemmler <ruemmler@cup.hp.com>
|
# Chris Ruemmler <ruemmler@cup.hp.com>
|
||||||
# Kevin Steves <ks@hp.se>
|
# Kevin Steves <ks@hp.se>
|
||||||
"hpux-parisc-cc","cc:+O3 +Optrs_strongly_typed +Olibcalls -Ae +ESlit -DB_ENDIAN -DBN_DIV2W -DMD32_XARRAY::-D_REENTRANT::-Wl,+s -ldld:MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT::::::::::dl:hpux-shared:+Z:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
"hpux-parisc-cc","cc:+O3 +Optrs_strongly_typed +Olibcalls -Ae +ESlit -DB_ENDIAN -DBN_DIV2W -DMD32_XARRAY::-D_REENTRANT::-Wl,+s -ldld:MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT::::::::::dl:hpux-shared:+Z::.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
"hpux-parisc2-cc","cc:+DA2.0 +DS2.0 +O3 +Optrs_strongly_typed +Olibcalls -Ae +ESlit -DB_ENDIAN -DMD32_XARRAY::-D_REENTRANT::-Wl,+s -ldld:SIXTY_FOUR_BIT MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT:asm/pa-risc2.o:::::::::dl:hpux-shared:+Z:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
"hpux-parisc2-cc","cc:+DA2.0 +DS2.0 +O3 +Optrs_strongly_typed +Olibcalls -Ae +ESlit -DB_ENDIAN -DMD32_XARRAY::-D_REENTRANT::-Wl,+s -ldld:SIXTY_FOUR_BIT MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT:asm/pa-risc2.o:::::::::dl:hpux-shared:+Z::.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
"hpux64-parisc2-cc","cc:+DD64 +O3 +Optrs_strongly_typed +Olibcalls -Ae +ESlit -DB_ENDIAN -DMD32_XARRAY::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT:asm/pa-risc2W.o:::::::::dlfcn:hpux64-shared:+Z:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
"hpux64-parisc2-cc","cc:+DD64 +O3 +Optrs_strongly_typed +Olibcalls -Ae +ESlit -DB_ENDIAN -DMD32_XARRAY::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT:asm/pa-risc2W.o:::::::::dlfcn:hpux64-shared:+Z::.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
"hpux-parisc1_1-cc","cc:+DA1.1 +DS1.1 +O3 +Optrs_strongly_typed +Olibcalls -Ae +ESlit -DB_ENDIAN -DMD32_XARRAY::-D_REENTRANT::-Wl,+s -ldld:MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT::::::::::dl:hpux-shared:+Z:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
# Isn't the line below meaningless? HP-UX cc optimizes for host by default.
|
||||||
|
# hpux-parisc1_0-cc with +DAportable flag would make more sense. <appro>
|
||||||
|
"hpux-parisc1_1-cc","cc:+DA1.1 +DS1.1 +O3 +Optrs_strongly_typed +Olibcalls -Ae +ESlit -DB_ENDIAN -DMD32_XARRAY::-D_REENTRANT::-Wl,+s -ldld:MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT::::::::::dl:hpux-shared:+Z::.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
|
|
||||||
# HPUX 9.X config.
|
# HPUX 9.X config.
|
||||||
# Don't use the bundled cc. It is broken. Use HP ANSI C if possible, or
|
# Don't use the bundled cc. It is broken. Use HP ANSI C if possible, or
|
||||||
# egcs. gcc 2.8.1 is also broken.
|
# egcs. gcc 2.8.1 is also broken.
|
||||||
|
|
||||||
"hpux-cc", "cc:-DB_ENDIAN -DBN_DIV2W -DMD32_XARRAY -Ae +ESlit +O3 -z::(unknown)::-Wl,+s -ldld:BN_LLONG DES_PTR DES_UNROLL DES_RISC1::::::::::dl:hpux-shared:+Z:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
"hpux-cc", "cc:-DB_ENDIAN -DBN_DIV2W -DMD32_XARRAY -Ae +ESlit +O3 -z::(unknown)::-Wl,+s -ldld:BN_LLONG DES_PTR DES_UNROLL DES_RISC1::::::::::dl:hpux-shared:+Z::.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
# If hpux-cc fails (e.g. during "make test"), try the next one; otherwise,
|
# If hpux-cc fails (e.g. during "make test"), try the next one; otherwise,
|
||||||
# please report your OS and compiler version to the openssl-bugs@openssl.org
|
# please report your OS and compiler version to the openssl-bugs@openssl.org
|
||||||
# mailing list.
|
# mailing list.
|
||||||
"hpux-brokencc", "cc:-DB_ENDIAN -DBN_DIV2W -Ae +ESlit +O2 -z::(unknown)::-Wl,+s -ldld:DES_PTR DES_UNROLL DES_RISC1::::::::::dl:hpux-shared:+Z:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
"hpux-brokencc", "cc:-DB_ENDIAN -DBN_DIV2W -Ae +ESlit +O2 -z::(unknown)::-Wl,+s -ldld:DES_PTR DES_UNROLL DES_RISC1::::::::::dl:hpux-shared:+Z::.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
|
|
||||||
"hpux-gcc", "gcc:-DB_ENDIAN -DBN_DIV2W -O3::(unknown)::-Wl,+s -ldld:BN_LLONG DES_PTR DES_UNROLL DES_RISC1::::::::::dl:hpux-shared:-fPIC:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
"hpux-gcc", "gcc:-DB_ENDIAN -DBN_DIV2W -O3::(unknown)::-Wl,+s -ldld:BN_LLONG DES_PTR DES_UNROLL DES_RISC1::::::::::dl:hpux-shared:-fPIC::.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
# If hpux-gcc fails, try this one:
|
# If hpux-gcc fails, try this one:
|
||||||
"hpux-brokengcc", "gcc:-DB_ENDIAN -DBN_DIV2W -O3::(unknown)::-Wl,+s -ldld:DES_PTR DES_UNROLL DES_RISC1::::::::::dl:hpux-shared:-fPIC:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
"hpux-brokengcc", "gcc:-DB_ENDIAN -DBN_DIV2W -O3::(unknown)::-Wl,+s -ldld:DES_PTR DES_UNROLL DES_RISC1::::::::::dl:hpux-shared:-fPIC::.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
|
|
||||||
|
# HPUX 9.X on Motorola 68k platforms with gcc
|
||||||
|
"hpux-m68k-gcc", "gcc:-DB_ENDIAN -DBN_DIV2W -O3::(unknown):::BN_LLONG DES_PTR DES_UNROLL:::::::::::::",
|
||||||
|
|
||||||
# HPUX 10.X config. Supports threads.
|
# HPUX 10.X config. Supports threads.
|
||||||
"hpux10-cc", "cc:-DB_ENDIAN -DBN_DIV2W -DMD32_XARRAY -Ae +ESlit +O3 -z::-D_REENTRANT::-Wl,+s -ldld:BN_LLONG DES_PTR DES_UNROLL DES_RISC1::::::::::dl:hpux-shared:+Z:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
"hpux10-cc", "cc:-DB_ENDIAN -DBN_DIV2W -DMD32_XARRAY -Ae +ESlit +O3 -z::-D_REENTRANT::-Wl,+s -ldld:BN_LLONG DES_PTR DES_UNROLL DES_RISC1::::::::::dl:hpux-shared:+Z::.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
# If hpux10-cc fails, try this one (if still fails, try deleting BN_LLONG):
|
# If hpux10-cc fails, try this one (if still fails, try deleting BN_LLONG):
|
||||||
"hpux10-brokencc", "cc:-DB_ENDIAN -DBN_DIV2W -Ae +ESlit +O2 -z::-D_REENTRANT::-Wl,+s -ldld:BN_LLONG DES_PTR DES_UNROLL DES_RISC1::::::::::dl:hpux-shared:+Z:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
"hpux10-brokencc", "cc:-DB_ENDIAN -DBN_DIV2W -Ae +ESlit +O2 -z::-D_REENTRANT::-Wl,+s -ldld:BN_LLONG DES_PTR DES_UNROLL DES_RISC1::::::::::dl:hpux-shared:+Z::.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
|
|
||||||
"hpux10-gcc", "gcc:-DB_ENDIAN -DBN_DIV2W -O3::-D_REENTRANT::-Wl,+s -ldld:BN_LLONG DES_PTR DES_UNROLL DES_RISC1::::::::::dl:hpux-shared:-fPIC:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
"hpux10-gcc", "gcc:-DB_ENDIAN -DBN_DIV2W -O3::-D_REENTRANT::-Wl,+s -ldld:BN_LLONG DES_PTR DES_UNROLL DES_RISC1::::::::::dl:hpux-shared:-fPIC::.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
# If hpux10-gcc fails, try this one:
|
# If hpux10-gcc fails, try this one:
|
||||||
"hpux10-brokengcc", "gcc:-DB_ENDIAN -DBN_DIV2W -O3::-D_REENTRANT::-Wl,+s -ldld:DES_PTR DES_UNROLL DES_RISC1::::::::::dl:hpux-shared:-fPIC:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
"hpux10-brokengcc", "gcc:-DB_ENDIAN -DBN_DIV2W -O3::-D_REENTRANT::-Wl,+s -ldld:DES_PTR DES_UNROLL DES_RISC1::::::::::dl:hpux-shared:-fPIC::.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
|
|
||||||
# HPUX 11.X from www.globus.org.
|
# HPUX 11.X from www.globus.org.
|
||||||
# Only works on PA-RISC 2.0 cpus, and not optimized. Why?
|
# Only works on PA-RISC 2.0 cpus, and not optimized. Why?
|
||||||
@@ -275,13 +309,43 @@ my %table=(
|
|||||||
#### HP MPE/iX http://jazz.external.hp.com/src/openssl/
|
#### HP MPE/iX http://jazz.external.hp.com/src/openssl/
|
||||||
"MPE/iX-gcc", "gcc:-D_ENDIAN -DBN_DIV2W -O3 -D_POSIX_SOURCE -D_SOCKET_SOURCE -I/SYSLOG/PUB::(unknown):MPE:-L/SYSLOG/PUB -lsyslog -lsocket -lcurses:BN_LLONG DES_PTR DES_UNROLL DES_RISC1:::",
|
"MPE/iX-gcc", "gcc:-D_ENDIAN -DBN_DIV2W -O3 -D_POSIX_SOURCE -D_SOCKET_SOURCE -I/SYSLOG/PUB::(unknown):MPE:-L/SYSLOG/PUB -lsyslog -lsocket -lcurses:BN_LLONG DES_PTR DES_UNROLL DES_RISC1:::",
|
||||||
|
|
||||||
# Dec Alpha, OSF/1 - the alpha164-cc is the flags for a 21164A with
|
#### PARISC Linux setups
|
||||||
# the new compiler
|
"linux-parisc","gcc:-DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall -DBN_DIV2W::-D_REENTRANT:::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::",
|
||||||
|
|
||||||
|
# Dec Alpha, OSF/1 - the alpha164-cc is historical, for the conversion
|
||||||
|
# from the older DEC C Compiler to the newer compiler. It's now the
|
||||||
|
# same as the preferred entry, alpha-cc. If you are still using the
|
||||||
|
# older compiler (you're at 3.x or earlier, or perhaps very early 4.x)
|
||||||
|
# you should use `alphaold-cc'.
|
||||||
|
#
|
||||||
|
# "What's in a name? That which we call a rose
|
||||||
|
# By any other word would smell as sweet."
|
||||||
|
#
|
||||||
|
# - William Shakespeare, "Romeo & Juliet", Act II, scene II.
|
||||||
|
#
|
||||||
|
# For OSF/1 3.2b and earlier, and Digital UNIX 3.2c - 3.2g, with the
|
||||||
|
# vendor compiler, use alphaold-cc.
|
||||||
|
# For Digital UNIX 4.0 - 4.0e, with the vendor compiler, use alpha-cc.
|
||||||
|
# For Tru64 UNIX 4.f - current, with the vendor compiler, use alpha-cc.
|
||||||
|
#
|
||||||
|
# There's also an alternate target available (which `config' will never
|
||||||
|
# select) called alpha-cc-rpath. This target builds an RPATH into the
|
||||||
|
# shared libraries, which is very convenient on Tru64 since binaries
|
||||||
|
# linked against that shared library will automatically inherit that RPATH,
|
||||||
|
# and hence know where to look for the openssl libraries, even if they're in
|
||||||
|
# an odd place.
|
||||||
|
#
|
||||||
# For gcc, the following gave a %50 speedup on a 164 over the 'DES_INT' version
|
# For gcc, the following gave a %50 speedup on a 164 over the 'DES_INT' version
|
||||||
"alpha-gcc","gcc:-O3::(unknown):::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_UNROLL DES_RISC1:asm/alpha.o:::::::::dlfcn:tru64-shared::.so",
|
#
|
||||||
"alpha-cc", "cc:-std1 -tune host -O4 -readonly_strings::(unknown):::SIXTY_FOUR_BIT_LONG RC4_CHUNK:asm/alpha.o:::::::::dlfcn:tru64-shared::.so",
|
"alpha-gcc","gcc:-O3::(unknown):::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_UNROLL DES_RISC1:${alpha_asm}:dlfcn:alpha-osf1-shared:::.so",
|
||||||
"alpha164-cc", "cc:-std1 -tune host -fast -readonly_strings::(unknown):::SIXTY_FOUR_BIT_LONG RC4_CHUNK:asm/alpha.o:::::::::dlfcn:tru64-shared::.so",
|
"alphaold-cc", "cc:-std1 -tune host -O4 -readonly_strings::(unknown):::SIXTY_FOUR_BIT_LONG RC4_CHUNK:${alpha_asm}:dlfcn:alpha-osf1-shared:::.so",
|
||||||
"FreeBSD-alpha","gcc:-DTERMIOS -O -fomit-frame-pointer::(unknown):::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_PTR DES_RISC2::::::::::dlfcn:bsd-gcc-shared:-fPIC:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
"alpha164-cc", "cc:-std1 -tune host -fast -readonly_strings::-pthread:::SIXTY_FOUR_BIT_LONG RC4_CHUNK:${alpha_asm}:dlfcn:tru64-shared:::.so",
|
||||||
|
"alpha-cc", "cc:-std1 -tune host -fast -readonly_strings::-pthread:::SIXTY_FOUR_BIT_LONG RC4_CHUNK:${alpha_asm}:dlfcn:tru64-shared:::.so",
|
||||||
|
"alpha-cc-rpath", "cc:-std1 -tune host -fast -readonly_strings::-pthread:::SIXTY_FOUR_BIT_LONG RC4_CHUNK:${alpha_asm}:dlfcn:tru64-shared-rpath:::.so",
|
||||||
|
#
|
||||||
|
# This probably belongs in a different section.
|
||||||
|
#
|
||||||
|
"FreeBSD-alpha","gcc:-DTERMIOS -O -fomit-frame-pointer::(unknown):::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_PTR DES_RISC2::::::::::dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
|
|
||||||
#### Alpha Linux with GNU C and Compaq C setups
|
#### Alpha Linux with GNU C and Compaq C setups
|
||||||
# Special notes:
|
# Special notes:
|
||||||
@@ -296,33 +360,39 @@ my %table=(
|
|||||||
#
|
#
|
||||||
# <appro@fy.chalmers.se>
|
# <appro@fy.chalmers.se>
|
||||||
#
|
#
|
||||||
"linux-alpha-gcc","gcc:-O3 -DL_ENDIAN -DTERMIO::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_RISC1 DES_UNROLL:asm/alpha.o:::::::::dlfcn:linux-shared:-fPIC:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
"linux-alpha-gcc","gcc:-O3 -DL_ENDIAN -DTERMIO::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_RISC1 DES_UNROLL:${alpha_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
"linux-alpha+bwx-gcc","gcc:-O3 -DL_ENDIAN -DTERMIO::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL:asm/alpha.o:::::::::dlfcn:linux-shared:-fPIC:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
"linux-alpha+bwx-gcc","gcc:-O3 -DL_ENDIAN -DTERMIO::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL:${alpha_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
"linux-alpha-ccc","ccc:-fast -readonly_strings -DL_ENDIAN -DTERMIO::-D_REENTRANT:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL:asm/alpha.o::",
|
"linux-alpha-ccc","ccc:-fast -readonly_strings -DL_ENDIAN -DTERMIO::-D_REENTRANT:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL:${alpha_asm}",
|
||||||
"linux-alpha+bwx-ccc","ccc:-fast -readonly_strings -DL_ENDIAN -DTERMIO::-D_REENTRANT:::SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL:asm/alpha.o::",
|
"linux-alpha+bwx-ccc","ccc:-fast -readonly_strings -DL_ENDIAN -DTERMIO::-D_REENTRANT:::SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL:${alpha_asm}",
|
||||||
|
|
||||||
# assembler versions -- currently defunct:
|
# assembler versions -- currently defunct:
|
||||||
##"OpenBSD-alpha","gcc:-DTERMIOS -O3 -fomit-frame-pointer:::(unknown):SIXTY_FOUR_BIT_LONG DES_INT DES_PTR DES_RISC2:asm/alpha.o::",
|
##"OpenBSD-alpha","gcc:-DTERMIOS -O3 -fomit-frame-pointer:::(unknown):SIXTY_FOUR_BIT_LONG DES_INT DES_PTR DES_RISC2:${alpha_asm}",
|
||||||
|
|
||||||
# The intel boxes :-), It would be worth seeing if bsdi-gcc can use the
|
# The intel boxes :-), It would be worth seeing if bsdi-gcc can use the
|
||||||
# bn86-elf.o file file since it is hand tweaked assembler.
|
# bn86-elf.o file file since it is hand tweaked assembler.
|
||||||
"linux-elf", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
"linux-elf", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
"debug-linux-elf","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -m486 -Wall::-D_REENTRANT::-lefence -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn",
|
"linux-pentium", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -mcpu=pentium -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
|
"linux-ppro", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -mcpu=pentiumpro -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
|
"linux-k6", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -mcpu=k6 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
|
"debug-linux-pentium","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -mcpu=pentium -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn",
|
||||||
|
"debug-linux-ppro","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -mcpu=pentiumpro -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn",
|
||||||
|
"debug-linux-elf","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -m486 -Wall::-D_REENTRANT::-lefence -ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
"debug-linux-elf-noefence","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -m486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn",
|
"debug-linux-elf-noefence","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -m486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn",
|
||||||
"linux-aout", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m486 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_out_asm}",
|
"linux-aout", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m486 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_out_asm}",
|
||||||
"linux-mipsel", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::(unknown):::BN_LLONG:::",
|
"linux-mipsel", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::(unknown):::BN_LLONG:::",
|
||||||
"linux-mips", "gcc:-DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::(unknown):::BN_LLONG:::",
|
"linux-mips", "gcc:-DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::(unknown):::BN_LLONG:::",
|
||||||
"linux-ppc", "gcc:-DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL::::::::::dlfcn:linux-shared:-fPIC:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
"linux-ppc", "gcc:-DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
"linux-m68k", "gcc:-DB_ENDIAN -DTERMIO -O2 -fomit-frame-pointer -Wall::-D_REENTRANT:::BN_LLONG::",
|
"linux-m68k", "gcc:-DB_ENDIAN -DTERMIO -O2 -fomit-frame-pointer -Wall::-D_REENTRANT:::BN_LLONG::",
|
||||||
"linux-s390", "gcc:-DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT:::BN_LLONG::",
|
"linux-s390", "gcc:-DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT:::BN_LLONG::",
|
||||||
"linux-ia64", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::(unknown):::SIXTY_FOUR_BIT_LONG::",
|
"linux-s390x", "gcc:-DB_ENDIAN -DTERMIO -DNO_ASM -O3 -fomit-frame-pointer -Wall::-D_REENTRANT:::SIXTY_FOUR_BIT_LONG:::::::::::linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
"NetBSD-sparc", "gcc:-DTERMIOS -O3 -fomit-frame-pointer -mv8 -Wall -DB_ENDIAN::(unknown):::BN_LLONG MD2_CHAR RC4_INDEX DES_UNROLL::::::::::dlfcn:bsd-gcc-shared:-fPIC:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
"linux-ia64", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK RC4_CHAR:asm/ia64.o:::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
"NetBSD-m68", "gcc:-DTERMIOS -O3 -fomit-frame-pointer -Wall -DB_ENDIAN::(unknown):::BN_LLONG MD2_CHAR RC4_INDEX DES_UNROLL::::::::::dlfcn:bsd-gcc-shared:-fPIC:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
"NetBSD-sparc", "gcc:-DTERMIOS -O3 -fomit-frame-pointer -mv8 -Wall -DB_ENDIAN::(unknown):::BN_LLONG MD2_CHAR RC4_INDEX DES_UNROLL::::::::::dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
"NetBSD-x86", "gcc:-DTERMIOS -O3 -fomit-frame-pointer -m486 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}::::::::::dlfcn:bsd-gcc-shared:-fPIC:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
"NetBSD-m68", "gcc:-DTERMIOS -O3 -fomit-frame-pointer -Wall -DB_ENDIAN::(unknown):::BN_LLONG MD2_CHAR RC4_INDEX DES_UNROLL::::::::::dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
"FreeBSD-elf", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall::-pthread -D_REENTRANT -D_THREAD_SAFE -D_THREADSAFE:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-gcc-shared:-fPIC:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
"NetBSD-x86", "gcc:-DTERMIOS -O3 -fomit-frame-pointer -m486 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}::::::::::dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
|
"FreeBSD-elf", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall::-pthread -D_REENTRANT -D_THREAD_SAFE -D_THREADSAFE:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
"FreeBSD", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_out_asm}",
|
"FreeBSD", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_out_asm}",
|
||||||
"bsdi-gcc", "gcc:-O3 -ffast-math -DL_ENDIAN -DPERL5 -m486::(unknown):::RSA_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_bsdi_asm}",
|
"bsdi-gcc", "gcc:-O3 -ffast-math -DL_ENDIAN -DPERL5 -m486::(unknown):::RSA_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_bsdi_asm}",
|
||||||
"bsdi-elf-gcc", "gcc:-DPERL5 -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-gcc-shared:-fPIC:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
"bsdi-elf-gcc", "gcc:-DPERL5 -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall::(unknown)::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
"nextstep", "cc:-O -Wall:<libc.h>:(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:::",
|
"nextstep", "cc:-O -Wall:<libc.h>:(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:::",
|
||||||
"nextstep3.3", "cc:-O3 -Wall:<libc.h>:(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:::",
|
"nextstep3.3", "cc:-O3 -Wall:<libc.h>:(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:::",
|
||||||
|
|
||||||
@@ -332,22 +402,41 @@ my %table=(
|
|||||||
# QNX 4
|
# QNX 4
|
||||||
"qnx4", "cc:-DL_ENDIAN -DTERMIO::(unknown):::${x86_gcc_des} ${x86_gcc_opts}:",
|
"qnx4", "cc:-DL_ENDIAN -DTERMIO::(unknown):::${x86_gcc_des} ${x86_gcc_opts}:",
|
||||||
|
|
||||||
# Linux on ARM
|
# QNX 6
|
||||||
"linux-elf-arm","gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT:::BN_LLONG::::::::::dlfcn:linux-shared:-fPIC:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
"qnx6", "cc:-DL_ENDIAN -DTERMIOS::(unknown)::-lsocket:${x86_gcc_des} ${x86_gcc_opts}:",
|
||||||
|
|
||||||
# UnixWare 2.0
|
# Linux on ARM
|
||||||
"unixware-2.0","cc:-O -DFILIO_H::(unknown)::-lsocket -lnsl:${x86_gcc_des} ${x86_gcc_opts}:::",
|
"linux-elf-arm","gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT:::BN_LLONG::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
"unixware-2.0-pentium","cc:-O -DFILIO_H -Kpentium -Kthread::(unknown)::-lsocket -lnsl:MD2_CHAR RC4_INDEX ${x86_gcc_des}::",
|
|
||||||
|
# UnixWare 2.0x fails destest with -O
|
||||||
|
"unixware-2.0","cc:-DFILIO_H::-Kthread::-lsocket -lnsl -lx:${x86_gcc_des} ${x86_gcc_opts}:::",
|
||||||
|
"unixware-2.0-pentium","cc:-DFILIO_H -Kpentium::-Kthread::-lsocket -lnsl -lx:MD2_CHAR RC4_INDEX ${x86_gcc_des}::",
|
||||||
|
|
||||||
|
# UnixWare 2.1
|
||||||
|
"unixware-2.1","cc:-O -DFILIO_H::-Kthread::-lsocket -lnsl -lx:${x86_gcc_des} ${x86_gcc_opts}:::",
|
||||||
|
"unixware-2.1-pentium","cc:-O -DFILIO_H -Kpentium::-Kthread::-lsocket -lnsl -lx:MD2_CHAR RC4_INDEX ${x86_gcc_des}::",
|
||||||
|
"unixware-2.1-p6","cc:-O -DFILIO_H -Kp6::-Kthread::-lsocket -lnsl -lx:MD2_CHAR RC4_INDEX ${x86_gcc_des}::",
|
||||||
|
|
||||||
# UnixWare 7
|
# UnixWare 7
|
||||||
"unixware-7","cc:-O -DFILIO_H -Kalloca::-Kthread::-lsocket -lnsl:MD2_CHAR RC4_INDEX ${x86_gcc_des}::",
|
"unixware-7","cc:-O -DFILIO_H -Kalloca::-Kthread::-lsocket -lnsl:BN_LLONG MD2_CHAR RC4_INDEX ${x86_gcc_des}::::::::::dlfcn:svr5-shared:-Kpic::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
|
"unixware-7-pentium","cc:-O -DFILIO_H -Kalloca -Kpentium::-Kthread::-lsocket -lnsl:BN_LLONG MD2_CHAR RC4_INDEX ${x86_gcc_des}::::::::::dlfcn:svr5-shared:-Kpic::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
|
"unixware-7-pentium_pro","cc:-O -DFILIO_H -Kalloca -Kpentium_pro::-Kthread::-lsocket -lnsl:BN_LLONG MD2_CHAR RC4_INDEX ${x86_gcc_des}::::::::::dlfcn:svr5-shared:-Kpic::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
|
"unixware-7-gcc","gcc:-DL_ENDIAN -DFILIO_H -O3 -fomit-frame-pointer -m486 -Wall::-D_REENTRANT::-lsocket -lnsl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}::::::::::dlfcn:gnu-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
|
|
||||||
|
# OpenUNIX 8
|
||||||
|
"OpenUNIX-8","cc:-O -DFILIO_H -Kalloca::-Kthread::-lsocket -lnsl:BN_LLONG MD2_CHAR RC4_INDEX ${x86_gcc_des}::::::::::dlfcn:svr5-shared:-Kpic::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
|
"OpenUNIX-8-gcc","gcc:-O -DFILIO_H -fomit-frame-pointer::-pthread::-lsocket -lnsl:BN_LLONG MD2_CHAR RC4_INDEX ${x86_gcc_des}::::::::::dlfcn:svr5-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
|
"OpenUNIX-8-pentium","cc:-O -DFILIO_H -Kalloca -Kpentium::-Kthread::-lsocket -lnsl:BN_LLONG MD2_CHAR RC4_INDEX ${x86_gcc_des}::::::::::dlfcn:svr5-shared:-Kpic::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
|
"OpenUNIX-8-pentium_pro","cc:-O -DFILIO_H -Kalloca -Kpentium_pro::-Kthread::-lsocket -lnsl:BN_LLONG MD2_CHAR RC4_INDEX ${x86_gcc_des}::::::::::dlfcn:svr5-shared:-Kpic::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
|
|
||||||
# IBM's AIX.
|
# IBM's AIX.
|
||||||
"aix-cc", "cc:-O -DB_ENDIAN -qmaxmem=16384::(unknown):AIX::BN_LLONG RC4_CHAR:::",
|
"aix-cc", "cc:-O -DB_ENDIAN -qmaxmem=16384::(unknown):AIX::BN_LLONG RC4_CHAR:::",
|
||||||
"aix-gcc", "gcc:-O3 -DB_ENDIAN::(unknown):AIX::BN_LLONG RC4_CHAR:::",
|
"aix-gcc", "gcc:-O3 -DB_ENDIAN::(unknown):AIX::BN_LLONG RC4_CHAR:::",
|
||||||
|
"aix43-cc", "cc:-O -DAIX -DB_ENDIAN -qmaxmem=16384::(unknown):::BN_LLONG RC4_CHAR::::::::::dlfcn:",
|
||||||
|
"aix43-gcc", "gcc:-O3 -DAIX -DB_ENDIAN::(unknown):::BN_LLONG RC4_CHAR::::::::::dlfcn:",
|
||||||
|
|
||||||
#
|
#
|
||||||
# Cray T90 (SDSC)
|
# Cray T90 and similar (SDSC)
|
||||||
# It's Big-endian, but the algorithms work properly when B_ENDIAN is NOT
|
# It's Big-endian, but the algorithms work properly when B_ENDIAN is NOT
|
||||||
# defined. The T90 ints and longs are 8 bytes long, and apparently the
|
# defined. The T90 ints and longs are 8 bytes long, and apparently the
|
||||||
# B_ENDIAN code assumes 4 byte ints. Fortunately, the non-B_ENDIAN and
|
# B_ENDIAN code assumes 4 byte ints. Fortunately, the non-B_ENDIAN and
|
||||||
@@ -357,7 +446,10 @@ my %table=(
|
|||||||
#'Taking the address of a bit field is not allowed. '
|
#'Taking the address of a bit field is not allowed. '
|
||||||
#'An expression with bit field exists as the operand of "sizeof" '
|
#'An expression with bit field exists as the operand of "sizeof" '
|
||||||
# (written by Wayne Schroeder <schroede@SDSC.EDU>)
|
# (written by Wayne Schroeder <schroede@SDSC.EDU>)
|
||||||
"cray-t90-cc", "cc: -DBIT_FIELD_LIMITS -DTERMIOS::(unknown):CRAY::SIXTY_FOUR_BIT_LONG DES_INT:::",
|
#
|
||||||
|
# j90 is considered the base machine type for unicos machines,
|
||||||
|
# so this configuration is now called "cray-j90" ...
|
||||||
|
"cray-j90", "cc: -DBIT_FIELD_LIMITS -DTERMIOS::(unknown):CRAY::SIXTY_FOUR_BIT_LONG DES_INT:::",
|
||||||
|
|
||||||
#
|
#
|
||||||
# Cray T3E (Research Center Juelich, beckman@acl.lanl.gov)
|
# Cray T3E (Research Center Juelich, beckman@acl.lanl.gov)
|
||||||
@@ -371,27 +463,37 @@ my %table=(
|
|||||||
|
|
||||||
# DGUX, 88100.
|
# DGUX, 88100.
|
||||||
"dgux-R3-gcc", "gcc:-O3 -fomit-frame-pointer::(unknown):::RC4_INDEX DES_UNROLL:::",
|
"dgux-R3-gcc", "gcc:-O3 -fomit-frame-pointer::(unknown):::RC4_INDEX DES_UNROLL:::",
|
||||||
"dgux-R4-gcc", "gcc:-O3 -fomit-frame-pointer::(unknown)::-lnsl -lsocket:RC4_INDEX:RC4_INDEX DES_UNROLL:::",
|
"dgux-R4-gcc", "gcc:-O3 -fomit-frame-pointer::(unknown)::-lnsl -lsocket:RC4_INDEX DES_UNROLL:::",
|
||||||
"dgux-R4-x86-gcc", "gcc:-O3 -fomit-frame-pointer -DL_ENDIAN::(unknown)::-lnsl -lsocket:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
|
"dgux-R4-x86-gcc", "gcc:-O3 -fomit-frame-pointer -DL_ENDIAN::(unknown)::-lnsl -lsocket:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}",
|
||||||
|
|
||||||
|
# SCO 3 - Tim Rice <tim@multitalents.net>
|
||||||
|
"sco3-gcc", "gcc:-O3 -fomit-frame-pointer -Dssize_t=int -DNO_SYS_UN_H::(unknown)::-lsocket:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:::", # the SCO assembler doesn't seem to like our assembler files ...
|
||||||
|
|
||||||
# SCO 5 - Ben Laurie <ben@algroup.co.uk> says the -O breaks the
|
# SCO 5 - Ben Laurie <ben@algroup.co.uk> says the -O breaks the
|
||||||
# SCO cc.
|
# SCO cc.
|
||||||
"sco5-cc", "cc:::(unknown)::-lsocket:${x86_gcc_des} ${x86_gcc_opts}:::", # des options?
|
"sco5-cc", "cc:-belf::(unknown)::-lsocket -lresolv -lnsl:${x86_gcc_des} ${x86_gcc_opts}::::::::::dlfcn:svr3-shared:-Kpic", # des options?
|
||||||
"sco5-gcc", "gcc:-O3 -fomit-frame-pointer::(unknown)::-lsocket:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:::", # the SCO assembler doesn't seem to like our assembler files ...
|
"sco5-cc-pentium", "cc:-Kpentium::(unknown)::-lsocket:${x86_gcc_des} ${x86_gcc_opts}:::", # des options?
|
||||||
|
"sco5-gcc", "gcc:-O3 -fomit-frame-pointer::(unknown)::-lsocket -lresolv -lnsl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:svr3-shared:-fPIC", # the SCO assembler doesn't seem to like our assembler files ...
|
||||||
|
|
||||||
# Sinix/ReliantUNIX RM400
|
# Sinix/ReliantUNIX RM400
|
||||||
# NOTE: The CDS++ Compiler up to V2.0Bsomething has the IRIX_CC_BUG optimizer problem. Better use -g */
|
# NOTE: The CDS++ Compiler up to V2.0Bsomething has the IRIX_CC_BUG optimizer problem. Better use -g */
|
||||||
"ReliantUNIX","cc:-KPIC -g -DTERMIOS -DB_ENDIAN::-Kthread:SNI:-lsocket -lnsl -lc -L/usr/ucblib -lucb:BN_LLONG DES_PTR DES_RISC2 DES_UNROLL BF_PTR:::",
|
"ReliantUNIX","cc:-KPIC -g -DTERMIOS -DB_ENDIAN::-Kthread:SNI:-lsocket -lnsl -lc -L/usr/ucblib -lucb:BN_LLONG DES_PTR DES_RISC2 DES_UNROLL BF_PTR::::::::::dlfcn:reliantunix-shared::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
"SINIX","cc:-O::(unknown):SNI:-lsocket -lnsl -lc -L/usr/ucblib -lucb:RC4_INDEX RC4_CHAR:::",
|
"SINIX","cc:-O::(unknown):SNI:-lsocket -lnsl -lc -L/usr/ucblib -lucb:RC4_INDEX RC4_CHAR:::",
|
||||||
"SINIX-N","/usr/ucb/cc:-O2 -misaligned::(unknown)::-lucb:RC4_INDEX RC4_CHAR:::",
|
"SINIX-N","/usr/ucb/cc:-O2 -misaligned::(unknown)::-lucb:RC4_INDEX RC4_CHAR:::",
|
||||||
|
|
||||||
# SIEMENS BS2000/OSD: an EBCDIC-based mainframe
|
# SIEMENS BS2000/OSD: an EBCDIC-based mainframe
|
||||||
"BS2000-OSD","c89:-O -XLLML -XLLMK -XL -DB_ENDIAN -DTERMIOS -DCHARSET_EBCDIC::(unknown)::-lsocket -lnsl:THIRTY_TWO_BIT DES_PTR DES_UNROLL MD2_CHAR RC4_INDEX RC4_CHAR BF_PTR:::",
|
"BS2000-OSD","c89:-O -XLLML -XLLMK -XL -DB_ENDIAN -DTERMIOS -DCHARSET_EBCDIC::(unknown)::-lsocket -lnsl:THIRTY_TWO_BIT DES_PTR DES_UNROLL MD2_CHAR RC4_INDEX RC4_CHAR BF_PTR:::",
|
||||||
|
|
||||||
|
# OS/390 Unix an EBCDIC-based Unix system on IBM mainframe
|
||||||
|
# You need to compile using the c89.sh wrapper in the tools directory, because the
|
||||||
|
# IBM compiler does not like the -L switch after any object modules.
|
||||||
|
#
|
||||||
|
"OS390-Unix","c89.sh:-O -DB_ENDIAN -DCHARSET_EBCDIC -DNO_SYS_PARAM_H -D_ALL_SOURCE::(unknown):::THIRTY_TWO_BIT DES_PTR DES_UNROLL MD2_CHAR RC4_INDEX RC4_CHAR BF_PTR:::",
|
||||||
|
|
||||||
# Windows NT, Microsoft Visual C++ 4.0
|
# Windows NT, Microsoft Visual C++ 4.0
|
||||||
|
|
||||||
"VC-NT","cl::::WINNT::BN_LLONG RC4_INDEX ${x86_gcc_opts}::::::::::win32",
|
"VC-NT","cl::::WINNT::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}::::::::::win32",
|
||||||
"VC-WIN32","cl::::WIN32::BN_LLONG RC4_INDEX ${x86_gcc_opts}::::::::::win32",
|
"VC-WIN32","cl::::WIN32::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}::::::::::win32",
|
||||||
"VC-WIN16","cl:::(unknown):WIN16::MD2_CHAR DES_UNROLL DES_PTR RC4_INDEX THIRTY_TWO_BIT:::",
|
"VC-WIN16","cl:::(unknown):WIN16::MD2_CHAR DES_UNROLL DES_PTR RC4_INDEX THIRTY_TWO_BIT:::",
|
||||||
"VC-W31-16","cl:::(unknown):WIN16::BN_LLONG MD2_CHAR DES_UNROLL DES_PTR RC4_INDEX SIXTEEN_BIT:::",
|
"VC-W31-16","cl:::(unknown):WIN16::BN_LLONG MD2_CHAR DES_UNROLL DES_PTR RC4_INDEX SIXTEEN_BIT:::",
|
||||||
"VC-W31-32","cl::::WIN16::BN_LLONG MD2_CHAR DES_UNROLL DES_PTR RC4_INDEX THIRTY_TWO_BIT:::",
|
"VC-W31-32","cl::::WIN16::BN_LLONG MD2_CHAR DES_UNROLL DES_PTR RC4_INDEX THIRTY_TWO_BIT:::",
|
||||||
@@ -406,8 +508,9 @@ my %table=(
|
|||||||
# and its library files in util/pl/*)
|
# and its library files in util/pl/*)
|
||||||
"Mingw32", "gcc:-DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall:::::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}::::::::::win32",
|
"Mingw32", "gcc:-DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall:::::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}::::::::::win32",
|
||||||
|
|
||||||
# CygWin32
|
# Cygwin
|
||||||
"CygWin32", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall:::CYGWIN32::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}::::::::::win32",
|
"Cygwin-pre1.3", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall::(unknown):CYGWIN32::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}::::::::::win32",
|
||||||
|
"Cygwin", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall:::CYGWIN32::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}::::::::::win32:cygwin-shared:::.dll",
|
||||||
|
|
||||||
# Ultrix from Bernhard Simon <simon@zid.tuwien.ac.at>
|
# Ultrix from Bernhard Simon <simon@zid.tuwien.ac.at>
|
||||||
"ultrix-cc","cc:-std1 -O -Olimit 1000 -DL_ENDIAN::(unknown):::::::",
|
"ultrix-cc","cc:-std1 -O -Olimit 1000 -DL_ENDIAN::(unknown):::::::",
|
||||||
@@ -416,14 +519,21 @@ my %table=(
|
|||||||
##"ultrix","cc:-O2 -DNOPROTO -DNOCONST -DL_ENDIAN::(unknown):::::::",
|
##"ultrix","cc:-O2 -DNOPROTO -DNOCONST -DL_ENDIAN::(unknown):::::::",
|
||||||
|
|
||||||
# Some OpenBSD from Bob Beck <beck@obtuse.com>
|
# Some OpenBSD from Bob Beck <beck@obtuse.com>
|
||||||
"OpenBSD-alpha","gcc:-DTERMIOS -O3 -fomit-frame-pointer::(unknown):::SIXTY_FOUR_BIT_LONG DES_INT DES_PTR DES_RISC2::::::::::dlfcn:bsd-gcc-shared:-fPIC:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
"OpenBSD", "gcc:-DTERMIOS -O3 -fomit-frame-pointer::(unknown):::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL::::::::::dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
"OpenBSD-x86", "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -m486::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_out_asm}:dlfcn:bsd-gcc-shared:-fPIC:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
"OpenBSD-alpha", "gcc:-DTERMIOS -O3 -fomit-frame-pointer::(unknown):::SIXTY_FOUR_BIT_LONG DES_INT DES_PTR DES_RISC2::::::::::dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
"OpenBSD", "gcc:-DTERMIOS -O3 -fomit-frame-pointer::(unknown):::BN_LLONG RC2_CHAR RC4_INDEX DES_UNROLL::::::::::dlfcn:bsd-gcc-shared:-fPIC:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
"OpenBSD-i386", "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_out_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
"OpenBSD-mips","gcc:-O2 -DL_ENDIAN::(unknown)::BN_LLONG MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC2 DES_PTR BF_PTR:::::::::::dlfcn:bsd-gcc-shared:-fPIC:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
"OpenBSD-m68k", "gcc:-DTERMIOS -O3 -fomit-frame-pointer::(unknown):::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL::::::::::dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
|
"OpenBSD-m88k", "gcc:-DTERMIOS -O3 -fomit-frame-pointer::(unknown):::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL::::::::::dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
|
"OpenBSD-mips", "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer::(unknown):::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL DES_RISC2::::::::::dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
|
"OpenBSD-powerpc", "gcc:-DTERMIOS -O3 -fomit-frame-pointer::(unknown):::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL::::::::::dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
|
"OpenBSD-sparc", "gcc:-DTERMIOS -O3 -fomit-frame-pointer::(unknown):::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL::::::::::dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
|
"OpenBSD-sparc64", "gcc:-DB_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer::(unknown):::SIXTY_FOUR_BIT_LONG DES_INT DES_PTR DES_RISC2 BF_PTR::::::::::dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
|
"OpenBSD-vax", "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer::(unknown):::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL::::::::::dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
|
"OpenBSD-hppa", "gcc:-DTERMIOS -O3 -fomit-frame-pointer::(unknown):::BN_LLONG RC2_CHAR RC4_INDEX DES_UNROLL::::::::::dlfcn:bsd-gcc-shared:-fPIC:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||||
|
|
||||||
##### MacOS X (a.k.a. Rhapsody or Darwin) setup
|
##### MacOS X (a.k.a. Rhapsody or Darwin) setup
|
||||||
"rhapsody-ppc-cc","cc:-O3 -DB_ENDIAN::(unknown):MACOSX::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:::",
|
"rhapsody-ppc-cc","cc:-O3 -DB_ENDIAN::(unknown):MACOSX::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:::",
|
||||||
"darwin-ppc-cc","cc:-O3 -nostdinc -I/System/Library/Frameworks/System.framework/Headers -I/System/Library/Frameworks/System.frameworks/Headers/bsd -I/usr/include -fomit-frame-pointer -Wall -DB_ENDIAN::(unknown):MACOSX::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::::::::::::-fPIC",
|
"darwin-ppc-cc","cc:-O3 -nostdinc -I/System/Library/Frameworks/System.framework/Headers -I/System/Library/Frameworks/System.frameworks/Headers/bsd -I/usr/include -fomit-frame-pointer -Wall -DB_ENDIAN::(unknown):MACOSX::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:::::::::::darwin-shared:-fPIC:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
|
||||||
"darwin-i386-cc","cc:-O3 -nostdinc -I/System/Library/Frameworks/System.framework/Headers -I/System/Library/Frameworks/System.frameworks/Headers/bsd -I/usr/include -fomit-frame-pointer -Wall -DB_ENDIAN::(unknown):MACOSX::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::::::::::::-fPIC",
|
"darwin-i386-cc","cc:-O3 -nostdinc -I/System/Library/Frameworks/System.framework/Headers -I/System/Library/Frameworks/System.frameworks/Headers/bsd -I/usr/include -fomit-frame-pointer -Wall -DB_ENDIAN::(unknown):MACOSX::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::::::::::::-fPIC",
|
||||||
|
|
||||||
##### Sony NEWS-OS 4.x
|
##### Sony NEWS-OS 4.x
|
||||||
@@ -432,16 +542,48 @@ my %table=(
|
|||||||
##### GNU Hurd
|
##### GNU Hurd
|
||||||
"hurd-x86", "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -m486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC",
|
"hurd-x86", "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -m486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC",
|
||||||
|
|
||||||
|
##### OS/2 EMX
|
||||||
|
"OS2-EMX", "gcc::::::::",
|
||||||
|
|
||||||
|
##### VxWorks for various targets
|
||||||
|
"vxworks-ppc405","ccppc:-g -msoft-float -mlongcall -DCPU=PPC405 -I\$(WIND_BASE)/target/h:::VXWORKS:-r:::::",
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
my @WinTargets=qw(VC-NT VC-WIN32 VC-WIN16 VC-W31-16 VC-W31-32 VC-MSDOS BC-32
|
my @WinTargets=qw(VC-NT VC-WIN32 VC-WIN16 VC-W31-16 VC-W31-32 VC-MSDOS BC-32
|
||||||
BC-16 Mingw32);
|
BC-16 Mingw32 OS2-EMX);
|
||||||
|
|
||||||
|
my $idx = 0;
|
||||||
|
my $idx_cc = $idx++;
|
||||||
|
my $idx_cflags = $idx++;
|
||||||
|
my $idx_unistd = $idx++;
|
||||||
|
my $idx_thread_cflag = $idx++;
|
||||||
|
my $idx_sys_id = $idx++;
|
||||||
|
my $idx_lflags = $idx++;
|
||||||
|
my $idx_bn_ops = $idx++;
|
||||||
|
my $idx_bn_obj = $idx++;
|
||||||
|
my $idx_des_obj = $idx++;
|
||||||
|
my $idx_bf_obj = $idx++;
|
||||||
|
my $idx_md5_obj = $idx++;
|
||||||
|
my $idx_sha1_obj = $idx++;
|
||||||
|
my $idx_cast_obj = $idx++;
|
||||||
|
my $idx_rc4_obj = $idx++;
|
||||||
|
my $idx_rmd160_obj = $idx++;
|
||||||
|
my $idx_rc5_obj = $idx++;
|
||||||
|
my $idx_dso_scheme = $idx++;
|
||||||
|
my $idx_shared_target = $idx++;
|
||||||
|
my $idx_shared_cflag = $idx++;
|
||||||
|
my $idx_shared_ldflag = $idx++;
|
||||||
|
my $idx_shared_extension = $idx++;
|
||||||
|
my $idx_ranlib = $idx++;
|
||||||
|
|
||||||
my $prefix="";
|
my $prefix="";
|
||||||
my $openssldir="";
|
my $openssldir="";
|
||||||
|
my $exe_ext="";
|
||||||
my $install_prefix="";
|
my $install_prefix="";
|
||||||
my $no_threads=0;
|
my $no_threads=0;
|
||||||
my $no_shared=1;
|
my $no_shared=1;
|
||||||
|
my $zlib=0;
|
||||||
my $no_krb5=0;
|
my $no_krb5=0;
|
||||||
my $threads=0;
|
my $threads=0;
|
||||||
my $no_asm=0;
|
my $no_asm=0;
|
||||||
@@ -470,6 +612,14 @@ my $processor="";
|
|||||||
my $default_ranlib;
|
my $default_ranlib;
|
||||||
my $perl;
|
my $perl;
|
||||||
|
|
||||||
|
my $no_ssl2=0;
|
||||||
|
my $no_ssl3=0;
|
||||||
|
my $no_tls1=0;
|
||||||
|
my $no_md5=0;
|
||||||
|
my $no_sha=0;
|
||||||
|
my $no_rsa=0;
|
||||||
|
my $no_dh=0;
|
||||||
|
|
||||||
$default_ranlib= &which("ranlib") or $default_ranlib="true";
|
$default_ranlib= &which("ranlib") or $default_ranlib="true";
|
||||||
$perl=$ENV{'PERL'} or $perl=&which("perl5") or $perl=&which("perl")
|
$perl=$ENV{'PERL'} or $perl=&which("perl5") or $perl=&which("perl")
|
||||||
or $perl="perl";
|
or $perl="perl";
|
||||||
@@ -512,7 +662,11 @@ PROCESS_ARGS:
|
|||||||
foreach (@argvcopy)
|
foreach (@argvcopy)
|
||||||
{
|
{
|
||||||
s /^-no-/no-/; # some people just can't read the instructions
|
s /^-no-/no-/; # some people just can't read the instructions
|
||||||
if (/^no-asm$/)
|
if (/^--test-sanity$/)
|
||||||
|
{
|
||||||
|
exit(&test_sanity());
|
||||||
|
}
|
||||||
|
elsif (/^no-asm$/)
|
||||||
{
|
{
|
||||||
$no_asm=1;
|
$no_asm=1;
|
||||||
$flags .= "-DOPENSSL_NO_ASM ";
|
$flags .= "-DOPENSSL_NO_ASM ";
|
||||||
@@ -542,8 +696,22 @@ PROCESS_ARGS:
|
|||||||
{ $no_shared=1; }
|
{ $no_shared=1; }
|
||||||
elsif (/^shared$/)
|
elsif (/^shared$/)
|
||||||
{ $no_shared=0; }
|
{ $no_shared=0; }
|
||||||
|
elsif (/^no-zlib$/)
|
||||||
|
{ $zlib=0; }
|
||||||
|
elsif (/^zlib$/)
|
||||||
|
{ $zlib=1; }
|
||||||
|
elsif (/^zlib-dynamic$/)
|
||||||
|
{ $zlib=2; }
|
||||||
elsif (/^no-symlinks$/)
|
elsif (/^no-symlinks$/)
|
||||||
{ $symlink=0; }
|
{ $symlink=0; }
|
||||||
|
elsif (/^no-ssl$/)
|
||||||
|
{ $no_ssl2 = $no_ssl3 = 1; }
|
||||||
|
elsif (/^no-ssl2$/)
|
||||||
|
{ $no_ssl2 = 1; }
|
||||||
|
elsif (/^no-ssl3$/)
|
||||||
|
{ $no_ssl3 = 1; }
|
||||||
|
elsif (/^no-tls1?$/)
|
||||||
|
{ $no_tls1 = 1; }
|
||||||
elsif (/^no-(.+)$/)
|
elsif (/^no-(.+)$/)
|
||||||
{
|
{
|
||||||
my $algo=$1;
|
my $algo=$1;
|
||||||
@@ -552,6 +720,12 @@ PROCESS_ARGS:
|
|||||||
$flags .= "-DOPENSSL_NO_$algo ";
|
$flags .= "-DOPENSSL_NO_$algo ";
|
||||||
$depflags .= "-DOPENSSL_NO_$algo ";
|
$depflags .= "-DOPENSSL_NO_$algo ";
|
||||||
$openssl_algorithm_defines .= "#define OPENSSL_NO_$algo\n";
|
$openssl_algorithm_defines .= "#define OPENSSL_NO_$algo\n";
|
||||||
|
if ($algo eq "RIJNDAEL")
|
||||||
|
{
|
||||||
|
$flags .= "-DOPENSSL_NO_AES ";
|
||||||
|
$depflags .= "-DOPENSSL_NO_AES ";
|
||||||
|
$openssl_algorithm_defines .= "#define OPENSSL_NO_AES\n";
|
||||||
|
}
|
||||||
if ($algo eq "DES")
|
if ($algo eq "DES")
|
||||||
{
|
{
|
||||||
push @skip, "mdc2";
|
push @skip, "mdc2";
|
||||||
@@ -560,6 +734,30 @@ PROCESS_ARGS:
|
|||||||
$depflags .= "-DOPENSSL_NO_MDC2 ";
|
$depflags .= "-DOPENSSL_NO_MDC2 ";
|
||||||
$openssl_algorithm_defines .= "#define OPENSSL_NO_MDC2\n";
|
$openssl_algorithm_defines .= "#define OPENSSL_NO_MDC2\n";
|
||||||
}
|
}
|
||||||
|
if ($algo eq "EC" || $algo eq "SHA" || $algo eq "SHA1")
|
||||||
|
{
|
||||||
|
push @skip, "ecdsa";
|
||||||
|
$options .= " no-ecdsa";
|
||||||
|
$flags .= "-DOPENSSL_NO_ECDSA ";
|
||||||
|
$depflags .= "-DOPENSSL_NO_ECDSA ";
|
||||||
|
$openssl_algorithm_defines .= "#define OPENSSL_NO_ECDSA\n";
|
||||||
|
}
|
||||||
|
if ($algo eq "MD5")
|
||||||
|
{
|
||||||
|
$no_md5 = 1;
|
||||||
|
}
|
||||||
|
if ($algo eq "SHA")
|
||||||
|
{
|
||||||
|
$no_sha = 1;
|
||||||
|
}
|
||||||
|
if ($algo eq "RSA")
|
||||||
|
{
|
||||||
|
$no_rsa = 1;
|
||||||
|
}
|
||||||
|
if ($algo eq "DH")
|
||||||
|
{
|
||||||
|
$no_dh = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
elsif (/^reconfigure/ || /^reconf/)
|
elsif (/^reconfigure/ || /^reconf/)
|
||||||
{
|
{
|
||||||
@@ -644,6 +842,39 @@ PROCESS_ARGS:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$no_ssl3=1 if ($no_md5 || $no_sha);
|
||||||
|
$no_ssl3=1 if ($no_rsa && $no_dh);
|
||||||
|
|
||||||
|
$no_ssl2=1 if ($no_md5);
|
||||||
|
$no_ssl2=1 if ($no_rsa);
|
||||||
|
|
||||||
|
$no_tls1=1 if ($no_md5 || $no_sha);
|
||||||
|
$no_tls1=1 if ($no_dh);
|
||||||
|
|
||||||
|
if ($no_ssl2)
|
||||||
|
{
|
||||||
|
push @skip,"SSL2";
|
||||||
|
$flags .= "-DOPENSSL_NO_SSL2 ";
|
||||||
|
$depflags .= "-DOPENSSL_NO_SSL2 ";
|
||||||
|
$openssl_algorithm_defines .= "#define OPENSSL_NO_SSL2\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($no_ssl3)
|
||||||
|
{
|
||||||
|
push @skip,"SSL3";
|
||||||
|
$flags .= "-DOPENSSL_NO_SSL3 ";
|
||||||
|
$depflags .= "-DOPENSSL_NO_SSL3 ";
|
||||||
|
$openssl_algorithm_defines .= "#define OPENSSL_NO_SSL3\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($no_tls1)
|
||||||
|
{
|
||||||
|
push @skip,"TLS1";
|
||||||
|
$flags .= "-DOPENSSL_NO_TLS1 ";
|
||||||
|
$depflags .= "-DOPENSSL_NO_TLS1 ";
|
||||||
|
$openssl_algorithm_defines .= "#define OPENSSL_NO_TLS1\n";
|
||||||
|
}
|
||||||
|
|
||||||
if ($target eq "TABLE") {
|
if ($target eq "TABLE") {
|
||||||
foreach $target (sort keys %table) {
|
foreach $target (sort keys %table) {
|
||||||
print_table_entry($target);
|
print_table_entry($target);
|
||||||
@@ -659,12 +890,17 @@ if ($target eq "LIST") {
|
|||||||
exit 0;
|
exit 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($target =~ m/^CygWin32(-.*)$/) {
|
||||||
|
$target = "Cygwin".$1;
|
||||||
|
}
|
||||||
|
|
||||||
print "Configuring for $target\n";
|
print "Configuring for $target\n";
|
||||||
|
|
||||||
&usage if (!defined($table{$target}));
|
&usage if (!defined($table{$target}));
|
||||||
|
|
||||||
my $IsWindows=scalar grep /^$target$/,@WinTargets;
|
my $IsWindows=scalar grep /^$target$/,@WinTargets;
|
||||||
|
|
||||||
|
$exe_ext=".exe" if ($target eq "Cygwin");
|
||||||
$openssldir="/usr/local/ssl" if ($openssldir eq "" and $prefix eq "");
|
$openssldir="/usr/local/ssl" if ($openssldir eq "" and $prefix eq "");
|
||||||
$prefix=$openssldir if $prefix eq "";
|
$prefix=$openssldir if $prefix eq "";
|
||||||
|
|
||||||
@@ -677,12 +913,30 @@ $openssldir=$prefix . "/" . $openssldir if $openssldir !~ /^\//;
|
|||||||
|
|
||||||
print "IsWindows=$IsWindows\n";
|
print "IsWindows=$IsWindows\n";
|
||||||
|
|
||||||
(my $cc,my $cflags,my $unistd,my $thread_cflag,my $sys_id,my $lflags,
|
my @fields = split(/\s*:\s*/,$table{$target} . ":" x 30 , -1);
|
||||||
my $bn_ops,my $bn_obj,my $des_obj,my $bf_obj,
|
my $cc = $fields[$idx_cc];
|
||||||
my $md5_obj,my $sha1_obj,my $cast_obj,my $rc4_obj,my $rmd160_obj,
|
my $cflags = $fields[$idx_cflags];
|
||||||
my $rc5_obj,my $dso_scheme,my $shared_target,my $shared_cflag,
|
my $unistd = $fields[$idx_unistd];
|
||||||
my $shared_extension,my $ranlib)=
|
my $thread_cflag = $fields[$idx_thread_cflag];
|
||||||
split(/\s*:\s*/,$table{$target} . ":" x 30 , -1);
|
my $sys_id = $fields[$idx_sys_id];
|
||||||
|
my $lflags = $fields[$idx_lflags];
|
||||||
|
my $bn_ops = $fields[$idx_bn_ops];
|
||||||
|
my $bn_obj = $fields[$idx_bn_obj];
|
||||||
|
my $des_obj = $fields[$idx_des_obj];
|
||||||
|
my $bf_obj = $fields[$idx_bf_obj];
|
||||||
|
$md5_obj = $fields[$idx_md5_obj];
|
||||||
|
$sha1_obj = $fields[$idx_sha1_obj];
|
||||||
|
my $cast_obj = $fields[$idx_cast_obj];
|
||||||
|
my $rc4_obj = $fields[$idx_rc4_obj];
|
||||||
|
$rmd160_obj = $fields[$idx_rmd160_obj];
|
||||||
|
my $rc5_obj = $fields[$idx_rc5_obj];
|
||||||
|
my $dso_scheme = $fields[$idx_dso_scheme];
|
||||||
|
my $shared_target = $fields[$idx_shared_target];
|
||||||
|
my $shared_cflag = $fields[$idx_shared_cflag];
|
||||||
|
my $shared_ldflag = $fields[$idx_shared_ldflag];
|
||||||
|
my $shared_extension = $fields[$idx_shared_extension];
|
||||||
|
my $ranlib = $fields[$idx_ranlib];
|
||||||
|
|
||||||
$cflags="$flags$cflags" if ($flags ne "");
|
$cflags="$flags$cflags" if ($flags ne "");
|
||||||
|
|
||||||
# Kerberos settings. The flavor must be provided from outside, either through
|
# Kerberos settings. The flavor must be provided from outside, either through
|
||||||
@@ -697,6 +951,7 @@ if ($no_krb5
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
my ($lresolv, $lpath, $lext);
|
||||||
if ($withargs{"krb5-flavor"} =~ /^[Hh]eimdal$/)
|
if ($withargs{"krb5-flavor"} =~ /^[Hh]eimdal$/)
|
||||||
{
|
{
|
||||||
$withargs{"krb5-dir"} = "/usr/heimdal"
|
$withargs{"krb5-dir"} = "/usr/heimdal"
|
||||||
@@ -706,7 +961,7 @@ else
|
|||||||
if $withargs{"krb5-lib"} eq "";
|
if $withargs{"krb5-lib"} eq "";
|
||||||
$cflags="-DKRB5_HEIMDAL $cflags";
|
$cflags="-DKRB5_HEIMDAL $cflags";
|
||||||
}
|
}
|
||||||
if ($withargs{"krb5-flavor"} =~ /^[Mm][Ii][Tt]$/)
|
if ($withargs{"krb5-flavor"} =~ /^[Mm][Ii][Tt]/)
|
||||||
{
|
{
|
||||||
$withargs{"krb5-dir"} = "/usr/kerberos"
|
$withargs{"krb5-dir"} = "/usr/kerberos"
|
||||||
if $withargs{"krb5-dir"} eq "";
|
if $withargs{"krb5-dir"} eq "";
|
||||||
@@ -714,9 +969,27 @@ else
|
|||||||
"/lib -lgssapi_krb5 -lkrb5 -lcom_err -lk5crypto"
|
"/lib -lgssapi_krb5 -lkrb5 -lcom_err -lk5crypto"
|
||||||
if $withargs{"krb5-lib"} eq "";
|
if $withargs{"krb5-lib"} eq "";
|
||||||
$cflags="-DKRB5_MIT $cflags";
|
$cflags="-DKRB5_MIT $cflags";
|
||||||
|
$withargs{"krb5-flavor"} =~ s/^[Mm][Ii][Tt][._-]*//;
|
||||||
|
if ($withargs{"krb5-flavor"} =~ /^1[._-]*[01]/)
|
||||||
|
{
|
||||||
|
$cflags="-DKRB5_MIT_OLD11 $cflags";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
LRESOLV:
|
||||||
|
foreach $lpath ("/lib", "/usr/lib")
|
||||||
|
{
|
||||||
|
foreach $lext ("a", "so")
|
||||||
|
{
|
||||||
|
$lresolv = "$lpath/libresolv.$lext";
|
||||||
|
last LRESOLV if (-r "$lresolv");
|
||||||
|
$lresolv = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$withargs{"krb5-lib"} .= " -lresolv"
|
||||||
|
if ("$lresolv");
|
||||||
$withargs{"krb5-include"} = "-I".$withargs{"krb5-dir"}."/include"
|
$withargs{"krb5-include"} = "-I".$withargs{"krb5-dir"}."/include"
|
||||||
if $withargs{"krb5-include"} eq "" && $withargs{"krb5-dir"} ne "";
|
if $withargs{"krb5-include"} eq "" &&
|
||||||
|
$withargs{"krb5-dir"} ne "";
|
||||||
}
|
}
|
||||||
|
|
||||||
# The DSO code currently always implements all functions so that no
|
# The DSO code currently always implements all functions so that no
|
||||||
@@ -782,8 +1055,15 @@ if ($no_asm)
|
|||||||
|
|
||||||
if ($threads)
|
if ($threads)
|
||||||
{
|
{
|
||||||
$cflags=$thread_cflags;
|
$cflags=$thread_cflags;
|
||||||
$openssl_thread_defines .= $thread_defines;
|
$openssl_thread_defines .= $thread_defines;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($zlib)
|
||||||
|
{
|
||||||
|
$cflags = "-DZLIB $cflags";
|
||||||
|
$cflags = "-DZLIB_SHARED $cflags" if $zlib == 2;
|
||||||
|
$lflags = "$lflags -lz" if $zlib == 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
# You will find shlib_mark1 and shlib_mark2 explained in Makefile.org
|
# You will find shlib_mark1 and shlib_mark2 explained in Makefile.org
|
||||||
@@ -884,7 +1164,7 @@ while (<IN>)
|
|||||||
if ($sdirs) {
|
if ($sdirs) {
|
||||||
my $dir;
|
my $dir;
|
||||||
foreach $dir (@skip) {
|
foreach $dir (@skip) {
|
||||||
s/ $dir / /;
|
s/([ ])$dir /\1/;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$sdirs = 0 unless /\\$/;
|
$sdirs = 0 unless /\\$/;
|
||||||
@@ -907,6 +1187,7 @@ while (<IN>)
|
|||||||
s/^CFLAG=.*$/CFLAG= $cflags/;
|
s/^CFLAG=.*$/CFLAG= $cflags/;
|
||||||
s/^DEPFLAG=.*$/DEPFLAG= $depflags/;
|
s/^DEPFLAG=.*$/DEPFLAG= $depflags/;
|
||||||
s/^EX_LIBS=.*$/EX_LIBS= $lflags/;
|
s/^EX_LIBS=.*$/EX_LIBS= $lflags/;
|
||||||
|
s/^EXE_EXT=.*$/EXE_EXT= $exe_ext/;
|
||||||
s/^BN_ASM=.*$/BN_ASM= $bn_obj/;
|
s/^BN_ASM=.*$/BN_ASM= $bn_obj/;
|
||||||
s/^DES_ENC=.*$/DES_ENC= $des_obj/;
|
s/^DES_ENC=.*$/DES_ENC= $des_obj/;
|
||||||
s/^BF_ENC=.*$/BF_ENC= $bf_obj/;
|
s/^BF_ENC=.*$/BF_ENC= $bf_obj/;
|
||||||
@@ -934,6 +1215,7 @@ while (<IN>)
|
|||||||
my $sotmp = $1;
|
my $sotmp = $1;
|
||||||
s/^SHARED_LIBS_LINK_EXTS=.*/SHARED_LIBS_LINK_EXTS=.s$sotmp.\$(SHLIB_MAJOR) .s$sotmp/;
|
s/^SHARED_LIBS_LINK_EXTS=.*/SHARED_LIBS_LINK_EXTS=.s$sotmp.\$(SHLIB_MAJOR) .s$sotmp/;
|
||||||
}
|
}
|
||||||
|
s/^SHARED_LDFLAGS=.*/SHARED_LDFLAGS=$shared_ldflag/;
|
||||||
print OUT $_."\n";
|
print OUT $_."\n";
|
||||||
}
|
}
|
||||||
close(IN);
|
close(IN);
|
||||||
@@ -1021,7 +1303,9 @@ $openssl_thread_defines =~ s/^\s*#\s*define\s+(.*)/#ifndef $1\n# define $1\n#end
|
|||||||
$openssl_sys_defines =~ s/^\s*#\s*define\s+(.*)/#ifndef $1\n# define $1\n#endif/mg;
|
$openssl_sys_defines =~ s/^\s*#\s*define\s+(.*)/#ifndef $1\n# define $1\n#endif/mg;
|
||||||
$openssl_other_defines =~ s/^\s*#\s*define\s+(.*)/#ifndef $1\n# define $1\n#endif/mg;
|
$openssl_other_defines =~ s/^\s*#\s*define\s+(.*)/#ifndef $1\n# define $1\n#endif/mg;
|
||||||
print OUT $openssl_sys_defines;
|
print OUT $openssl_sys_defines;
|
||||||
|
print OUT "#ifndef OPENSSL_DOING_MAKEDEPEND\n\n";
|
||||||
print OUT $openssl_algorithm_defines;
|
print OUT $openssl_algorithm_defines;
|
||||||
|
print OUT "\n#endif /* OPENSSL_DOING_MAKEDEPEND */\n";
|
||||||
print OUT $openssl_thread_defines;
|
print OUT $openssl_thread_defines;
|
||||||
print OUT $openssl_other_defines,"\n";
|
print OUT $openssl_other_defines,"\n";
|
||||||
|
|
||||||
@@ -1244,7 +1528,7 @@ sub print_table_entry
|
|||||||
my $bn_ops,my $bn_obj,my $des_obj,my $bf_obj,
|
my $bn_ops,my $bn_obj,my $des_obj,my $bf_obj,
|
||||||
my $md5_obj,my $sha1_obj,my $cast_obj,my $rc4_obj,my $rmd160_obj,
|
my $md5_obj,my $sha1_obj,my $cast_obj,my $rc4_obj,my $rmd160_obj,
|
||||||
my $rc5_obj,my $dso_scheme,my $shared_target,my $shared_cflag,
|
my $rc5_obj,my $dso_scheme,my $shared_target,my $shared_cflag,
|
||||||
my $shared_extension,my $ranlib)=
|
my $shared_ldflag,my $shared_extension,my $ranlib)=
|
||||||
split(/\s*:\s*/,$table{$target} . ":" x 30 , -1);
|
split(/\s*:\s*/,$table{$target} . ":" x 30 , -1);
|
||||||
|
|
||||||
print <<EOF
|
print <<EOF
|
||||||
@@ -1269,7 +1553,44 @@ sub print_table_entry
|
|||||||
\$dso_scheme = $dso_scheme
|
\$dso_scheme = $dso_scheme
|
||||||
\$shared_target= $shared_target
|
\$shared_target= $shared_target
|
||||||
\$shared_cflag = $shared_cflag
|
\$shared_cflag = $shared_cflag
|
||||||
|
\$shared_ldflag = $shared_ldflag
|
||||||
\$shared_extension = $shared_extension
|
\$shared_extension = $shared_extension
|
||||||
\$ranlib = $ranlib
|
\$ranlib = $ranlib
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub test_sanity
|
||||||
|
{
|
||||||
|
my $errorcnt = 0;
|
||||||
|
|
||||||
|
print STDERR "=" x 70, "\n";
|
||||||
|
print STDERR "=== SANITY TESTING!\n";
|
||||||
|
print STDERR "=== No configuration will be done, all other arguments will be ignored!\n";
|
||||||
|
print STDERR "=" x 70, "\n";
|
||||||
|
|
||||||
|
foreach $target (sort keys %table)
|
||||||
|
{
|
||||||
|
@fields = split(/\s*:\s*/,$table{$target} . ":" x 30 , -1);
|
||||||
|
|
||||||
|
if ($fields[$idx_dso_scheme-1] =~ /^(dl|dlfcn|win32|vms)$/)
|
||||||
|
{
|
||||||
|
$errorcnt++;
|
||||||
|
print STDERR "SANITY ERROR: '$target' has the dso_scheme [$idx_dso_scheme] values\n";
|
||||||
|
print STDERR " in the previous field\n";
|
||||||
|
}
|
||||||
|
elsif ($fields[$idx_dso_scheme+1] =~ /^(dl|dlfcn|win32|vms)$/)
|
||||||
|
{
|
||||||
|
$errorcnt++;
|
||||||
|
print STDERR "SANITY ERROR: '$target' has the dso_scheme [$idx_dso_scheme] values\n";
|
||||||
|
print STDERR " in the following field\n";
|
||||||
|
}
|
||||||
|
elsif ($fields[$idx_dso_scheme] !~ /^(dl|dlfcn|win32|vms|)$/)
|
||||||
|
{
|
||||||
|
$errorcnt++;
|
||||||
|
print STDERR "SANITY ERROR: '$target' has the dso_scheme [$idx_dso_scheme] field = ",$fields[$idx_dso_scheme],"\n";
|
||||||
|
print STDERR " valid values are 'dl', 'dlfcn', 'win32' and 'vms'\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print STDERR "No sanity errors detected!\n" if $errorcnt == 0;
|
||||||
|
return $errorcnt;
|
||||||
|
}
|
||||||
|
|||||||
195
FAQ
195
FAQ
@@ -8,6 +8,7 @@ OpenSSL - Frequently Asked Questions
|
|||||||
* How can I contact the OpenSSL developers?
|
* How can I contact the OpenSSL developers?
|
||||||
* Where can I get a compiled version of OpenSSL?
|
* Where can I get a compiled version of OpenSSL?
|
||||||
* Why aren't tools like 'autoconf' and 'libtool' used?
|
* Why aren't tools like 'autoconf' and 'libtool' used?
|
||||||
|
* What is an 'engine' version?
|
||||||
|
|
||||||
[LEGAL] Legal questions
|
[LEGAL] Legal questions
|
||||||
|
|
||||||
@@ -17,6 +18,7 @@ OpenSSL - Frequently Asked Questions
|
|||||||
[USER] Questions on using the OpenSSL applications
|
[USER] Questions on using the OpenSSL applications
|
||||||
|
|
||||||
* Why do I get a "PRNG not seeded" error message?
|
* Why do I get a "PRNG not seeded" error message?
|
||||||
|
* Why do I get an "unable to write 'random state'" error message?
|
||||||
* How do I create certificates or certificate requests?
|
* How do I create certificates or certificate requests?
|
||||||
* Why can't I create certificate requests?
|
* Why can't I create certificate requests?
|
||||||
* Why does <SSL program> fail with a certificate verify error?
|
* Why does <SSL program> fail with a certificate verify error?
|
||||||
@@ -26,13 +28,15 @@ OpenSSL - Frequently Asked Questions
|
|||||||
* How can I remove the passphrase on a private key?
|
* How can I remove the passphrase on a private key?
|
||||||
* Why can't I use OpenSSL certificates with SSL client authentication?
|
* Why can't I use OpenSSL certificates with SSL client authentication?
|
||||||
* Why does my browser give a warning about a mismatched hostname?
|
* Why does my browser give a warning about a mismatched hostname?
|
||||||
|
* How do I install a CA certificate into a browser?
|
||||||
|
* Why is OpenSSL x509 DN output not conformant to RFC2253?
|
||||||
|
|
||||||
[BUILD] Questions about building and testing OpenSSL
|
[BUILD] Questions about building and testing OpenSSL
|
||||||
|
|
||||||
* Why does the linker complain about undefined symbols?
|
* Why does the linker complain about undefined symbols?
|
||||||
* Why does the OpenSSL test fail with "bc: command not found"?
|
* Why does the OpenSSL test fail with "bc: command not found"?
|
||||||
* Why does the OpenSSL test fail with "bc: 1 no implemented"?
|
* Why does the OpenSSL test fail with "bc: 1 no implemented"?
|
||||||
* Why does the OpenSSL compilation fail on Alpha True64 Unix?
|
* Why does the OpenSSL compilation fail on Alpha Tru64 Unix?
|
||||||
* Why does the OpenSSL compilation fail with "ar: command not found"?
|
* Why does the OpenSSL compilation fail with "ar: command not found"?
|
||||||
* Why does the OpenSSL compilation fail on Win32 with VC++?
|
* Why does the OpenSSL compilation fail on Win32 with VC++?
|
||||||
|
|
||||||
@@ -47,6 +51,7 @@ OpenSSL - Frequently Asked Questions
|
|||||||
* Why do I get errors about unknown algorithms?
|
* Why do I get errors about unknown algorithms?
|
||||||
* Why can't the OpenSSH configure script detect OpenSSL?
|
* Why can't the OpenSSH configure script detect OpenSSL?
|
||||||
* Can I use OpenSSL's SSL library with non-blocking I/O?
|
* Can I use OpenSSL's SSL library with non-blocking I/O?
|
||||||
|
* Why doesn't my server application receive a client certificate?
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
|
|
||||||
@@ -55,7 +60,7 @@ OpenSSL - Frequently Asked Questions
|
|||||||
* Which is the current version of OpenSSL?
|
* Which is the current version of OpenSSL?
|
||||||
|
|
||||||
The current version is available from <URL: http://www.openssl.org>.
|
The current version is available from <URL: http://www.openssl.org>.
|
||||||
OpenSSL 0.9.6 was released on September 24th, 2000.
|
OpenSSL 0.9.6d was released on May 9, 2002.
|
||||||
|
|
||||||
In addition to the current stable release, you can also access daily
|
In addition to the current stable release, you can also access daily
|
||||||
snapshots of the OpenSSL development version at <URL:
|
snapshots of the OpenSSL development version at <URL:
|
||||||
@@ -119,6 +124,12 @@ A number of Linux and *BSD distributions include OpenSSL.
|
|||||||
autoconf will probably be used in future OpenSSL versions. If it was
|
autoconf will probably be used in future OpenSSL versions. If it was
|
||||||
less Unix-centric, it might have been used much earlier.
|
less Unix-centric, it might have been used much earlier.
|
||||||
|
|
||||||
|
* What is an 'engine' version?
|
||||||
|
|
||||||
|
With version 0.9.6 OpenSSL was extended to interface to external crypto
|
||||||
|
hardware. This was realized in a special release '0.9.6-engine'. With
|
||||||
|
version 0.9.7 (not yet released) the changes were merged into the main
|
||||||
|
development line, so that the special release is no longer necessary.
|
||||||
|
|
||||||
[LEGAL] =======================================================================
|
[LEGAL] =======================================================================
|
||||||
|
|
||||||
@@ -144,7 +155,7 @@ holders claim that you infringe on their rights if you use OpenSSL with
|
|||||||
their software on operating systems that don't normally include OpenSSL.
|
their software on operating systems that don't normally include OpenSSL.
|
||||||
|
|
||||||
If you develop open source software that uses OpenSSL, you may find it
|
If you develop open source software that uses OpenSSL, you may find it
|
||||||
useful to choose an other license than the GPL, or state explicitely that
|
useful to choose an other license than the GPL, or state explicitly that
|
||||||
"This program is released under the GPL with the additional exemption that
|
"This program is released under the GPL with the additional exemption that
|
||||||
compiling, linking, and/or using OpenSSL is allowed." If you are using
|
compiling, linking, and/or using OpenSSL is allowed." If you are using
|
||||||
GPL software developed by others, you may want to ask the copyright holder
|
GPL software developed by others, you may want to ask the copyright holder
|
||||||
@@ -160,6 +171,7 @@ correctly. Many open source operating systems provide a "randomness
|
|||||||
device" that serves this purpose. On other systems, applications have
|
device" that serves this purpose. On other systems, applications have
|
||||||
to call the RAND_add() or RAND_seed() function with appropriate data
|
to call the RAND_add() or RAND_seed() function with appropriate data
|
||||||
before generating keys or performing public key encryption.
|
before generating keys or performing public key encryption.
|
||||||
|
(These functions initialize the pseudo-random number generator, PRNG.)
|
||||||
|
|
||||||
Some broken applications do not do this. As of version 0.9.5, the
|
Some broken applications do not do this. As of version 0.9.5, the
|
||||||
OpenSSL functions that need randomness report an error if the random
|
OpenSSL functions that need randomness report an error if the random
|
||||||
@@ -169,18 +181,36 @@ application you are using. It is likely that it never worked
|
|||||||
correctly. OpenSSL 0.9.5 and later make the error visible by refusing
|
correctly. OpenSSL 0.9.5 and later make the error visible by refusing
|
||||||
to perform potentially insecure encryption.
|
to perform potentially insecure encryption.
|
||||||
|
|
||||||
On systems without /dev/urandom, it is a good idea to use the Entropy
|
On systems without /dev/urandom and /dev/random, it is a good idea to
|
||||||
Gathering Demon; see the RAND_egd() manpage for details.
|
use the Entropy Gathering Demon (EGD); see the RAND_egd() manpage for
|
||||||
|
details. Starting with version 0.9.7, OpenSSL will automatically look
|
||||||
|
for an EGD socket at /var/run/egd-pool, /dev/egd-pool, /etc/egd-pool and
|
||||||
|
/etc/entropy.
|
||||||
|
|
||||||
Most components of the openssl command line tool try to use the
|
Most components of the openssl command line utility automatically try
|
||||||
file $HOME/.rnd (or $RANDFILE, if this environment variable is set)
|
to seed the random number generator from a file. The name of the
|
||||||
for seeding the PRNG. If this file does not exist or is too short,
|
default seeding file is determined as follows: If environment variable
|
||||||
the "PRNG not seeded" error message may occur.
|
RANDFILE is set, then it names the seeding file. Otherwise if
|
||||||
|
environment variable HOME is set, then the seeding file is $HOME/.rnd.
|
||||||
|
If neither RANDFILE nor HOME is set, versions up to OpenSSL 0.9.6 will
|
||||||
|
use file .rnd in the current directory while OpenSSL 0.9.6a uses no
|
||||||
|
default seeding file at all. OpenSSL 0.9.6b and later will behave
|
||||||
|
similarly to 0.9.6a, but will use a default of "C:\" for HOME on
|
||||||
|
Windows systems if the environment variable has not been set.
|
||||||
|
|
||||||
[Note to OpenSSL 0.9.5 users: The command "openssl rsa" in version
|
If the default seeding file does not exist or is too short, the "PRNG
|
||||||
0.9.5 does not do this and will fail on systems without /dev/urandom
|
not seeded" error message may occur.
|
||||||
when trying to password-encrypt an RSA key! This is a bug in the
|
|
||||||
library; try a later version instead.]
|
The openssl command line utility will write back a new state to the
|
||||||
|
default seeding file (and create this file if necessary) unless
|
||||||
|
there was no sufficient seeding.
|
||||||
|
|
||||||
|
Pointing $RANDFILE to an Entropy Gathering Daemon socket does not work.
|
||||||
|
Use the "-rand" option of the OpenSSL command line tools instead.
|
||||||
|
The $RANDFILE environment variable and $HOME/.rnd are only used by the
|
||||||
|
OpenSSL command line tools. Applications using the OpenSSL library
|
||||||
|
provide their own configuration options to specify the entropy source,
|
||||||
|
please check out the documentation coming the with application.
|
||||||
|
|
||||||
For Solaris 2.6, Tim Nibbe <tnibbe@sprint.net> and others have suggested
|
For Solaris 2.6, Tim Nibbe <tnibbe@sprint.net> and others have suggested
|
||||||
installing the SUNski package from Sun patch 105710-01 (Sparc) which
|
installing the SUNski package from Sun patch 105710-01 (Sparc) which
|
||||||
@@ -190,6 +220,18 @@ versions. However, be warned that /dev/random is usually a blocking
|
|||||||
device, which may have some effects on OpenSSL.
|
device, which may have some effects on OpenSSL.
|
||||||
|
|
||||||
|
|
||||||
|
* Why do I get an "unable to write 'random state'" error message?
|
||||||
|
|
||||||
|
|
||||||
|
Sometimes the openssl command line utility does not abort with
|
||||||
|
a "PRNG not seeded" error message, but complains that it is
|
||||||
|
"unable to write 'random state'". This message refers to the
|
||||||
|
default seeding file (see previous answer). A possible reason
|
||||||
|
is that no default filename is known because neither RANDFILE
|
||||||
|
nor HOME is set. (Versions up to 0.9.6 used file ".rnd" in the
|
||||||
|
current directory in this case, but this has changed with 0.9.6a.)
|
||||||
|
|
||||||
|
|
||||||
* How do I create certificates or certificate requests?
|
* How do I create certificates or certificate requests?
|
||||||
|
|
||||||
Check out the CA.pl(1) manual page. This provides a simple wrapper round
|
Check out the CA.pl(1) manual page. This provides a simple wrapper round
|
||||||
@@ -264,7 +306,7 @@ there is little point presenting a certificate which the server will
|
|||||||
reject.
|
reject.
|
||||||
|
|
||||||
The solution is to add the relevant CA certificate to your servers "trusted
|
The solution is to add the relevant CA certificate to your servers "trusted
|
||||||
CA list". How you do this depends on the server sofware in uses. You can
|
CA list". How you do this depends on the server software in uses. You can
|
||||||
print out the servers list of acceptable CAs using the OpenSSL s_client tool:
|
print out the servers list of acceptable CAs using the OpenSSL s_client tool:
|
||||||
|
|
||||||
openssl s_client -connect www.some.host:443 -prexit
|
openssl s_client -connect www.some.host:443 -prexit
|
||||||
@@ -283,6 +325,33 @@ Browsers expect the server's hostname to match the value in the commonName
|
|||||||
(CN) field of the certificate. If it does not then you get a warning.
|
(CN) field of the certificate. If it does not then you get a warning.
|
||||||
|
|
||||||
|
|
||||||
|
* How do I install a CA certificate into a browser?
|
||||||
|
|
||||||
|
The usual way is to send the DER encoded certificate to the browser as
|
||||||
|
MIME type application/x-x509-ca-cert, for example by clicking on an appropriate
|
||||||
|
link. On MSIE certain extensions such as .der or .cacert may also work, or you
|
||||||
|
can import the certificate using the certificate import wizard.
|
||||||
|
|
||||||
|
You can convert a certificate to DER form using the command:
|
||||||
|
|
||||||
|
openssl x509 -in ca.pem -outform DER -out ca.der
|
||||||
|
|
||||||
|
Occasionally someone suggests using a command such as:
|
||||||
|
|
||||||
|
openssl pkcs12 -export -out cacert.p12 -in cacert.pem -inkey cakey.pem
|
||||||
|
|
||||||
|
DO NOT DO THIS! This command will give away your CAs private key and
|
||||||
|
reduces its security to zero: allowing anyone to forge certificates in
|
||||||
|
whatever name they choose.
|
||||||
|
|
||||||
|
* Why is OpenSSL x509 DN output not conformant to RFC2253?
|
||||||
|
|
||||||
|
The ways to print out the oneline format of the DN (Distinguished Name) have
|
||||||
|
been extended in version 0.9.7 of OpenSSL. Using the new X509_NAME_print_ex()
|
||||||
|
interface, the "-nameopt" option could be introduded. See the manual
|
||||||
|
page of the "openssl x509" commandline tool for details. The old behaviour
|
||||||
|
has however been left as default for the sake of compatibility.
|
||||||
|
|
||||||
[BUILD] =======================================================================
|
[BUILD] =======================================================================
|
||||||
|
|
||||||
* Why does the linker complain about undefined symbols?
|
* Why does the linker complain about undefined symbols?
|
||||||
@@ -326,9 +395,9 @@ and compile/install it. GNU bc (see http://www.gnu.org/software/software.html
|
|||||||
for download instructions) can be safely used, for example.
|
for download instructions) can be safely used, for example.
|
||||||
|
|
||||||
|
|
||||||
* Why does the OpenSSL compilation fail on Alpha True64 Unix?
|
* Why does the OpenSSL compilation fail on Alpha Tru64 Unix?
|
||||||
|
|
||||||
On some Alpha installations running True64 Unix and Compaq C, the compilation
|
On some Alpha installations running Tru64 Unix and Compaq C, the compilation
|
||||||
of crypto/sha/sha_dgst.c fails with the message 'Fatal: Insufficient virtual
|
of crypto/sha/sha_dgst.c fails with the message 'Fatal: Insufficient virtual
|
||||||
memory to continue compilation.' As far as the tests have shown, this may be
|
memory to continue compilation.' As far as the tests have shown, this may be
|
||||||
a compiler bug. What happens is that it eats up a lot of resident memory
|
a compiler bug. What happens is that it eats up a lot of resident memory
|
||||||
@@ -406,10 +475,43 @@ OpenSSL. This is described in the threads(3) manpage.
|
|||||||
|
|
||||||
* I've compiled a program under Windows and it crashes: why?
|
* I've compiled a program under Windows and it crashes: why?
|
||||||
|
|
||||||
This is usually because you've missed the comment in INSTALL.W32. You
|
This is usually because you've missed the comment in INSTALL.W32.
|
||||||
must link with the multithreaded DLL version of the VC++ runtime library
|
Your application must link against the same version of the Win32
|
||||||
otherwise the conflict will cause a program to crash: typically on the
|
C-Runtime against which your openssl libraries were linked. The
|
||||||
first BIO related read or write operation.
|
default version for OpenSSL is /MD - "Multithreaded DLL".
|
||||||
|
|
||||||
|
If you are using Microsoft Visual C++'s IDE (Visual Studio), in
|
||||||
|
many cases, your new project most likely defaulted to "Debug
|
||||||
|
Singlethreaded" - /ML. This is NOT interchangeable with /MD and your
|
||||||
|
program will crash, typically on the first BIO related read or write
|
||||||
|
operation.
|
||||||
|
|
||||||
|
For each of the six possible link stage configurations within Win32,
|
||||||
|
your application must link against the same by which OpenSSL was
|
||||||
|
built. If you are using MS Visual C++ (Studio) this can be changed
|
||||||
|
by:
|
||||||
|
|
||||||
|
1. Select Settings... from the Project Menu.
|
||||||
|
2. Select the C/C++ Tab.
|
||||||
|
3. Select "Code Generation from the "Category" drop down list box
|
||||||
|
4. Select the Appropriate library (see table below) from the "Use
|
||||||
|
run-time library" drop down list box. Perform this step for both
|
||||||
|
your debug and release versions of your application (look at the
|
||||||
|
top left of the settings panel to change between the two)
|
||||||
|
|
||||||
|
Single Threaded /ML - MS VC++ often defaults to
|
||||||
|
this for the release
|
||||||
|
version of a new project.
|
||||||
|
Debug Single Threaded /MLd - MS VC++ often defaults to
|
||||||
|
this for the debug version
|
||||||
|
of a new project.
|
||||||
|
Multithreaded /MT
|
||||||
|
Debug Multithreaded /MTd
|
||||||
|
Multithreaded DLL /MD - OpenSSL defaults to this.
|
||||||
|
Debug Multithreaded DLL /MDd
|
||||||
|
|
||||||
|
Note that debug and release libraries are NOT interchangeable. If you
|
||||||
|
built OpenSSL with /MD your application must use /MD and cannot use /MDd.
|
||||||
|
|
||||||
|
|
||||||
* How do I read or write a DER encoded buffer using the ASN1 functions?
|
* How do I read or write a DER encoded buffer using the ASN1 functions?
|
||||||
@@ -490,44 +592,16 @@ OpenSSL_add_all_algorithms(). See the manual page for more information.
|
|||||||
|
|
||||||
* Why can't the OpenSSH configure script detect OpenSSL?
|
* Why can't the OpenSSH configure script detect OpenSSL?
|
||||||
|
|
||||||
There is a problem with OpenSSH 1.2.2p1, in that the configure script
|
Several reasons for problems with the automatic detection exist.
|
||||||
can't find the installed OpenSSL libraries. The problem is actually
|
OpenSSH requires at least version 0.9.5a of the OpenSSL libraries.
|
||||||
a small glitch that is easily solved with the following patch to be
|
Sometimes the distribution has installed an older version in the system
|
||||||
applied to the OpenSSH distribution:
|
locations that is detected instead of a new one installed. The OpenSSL
|
||||||
|
library might have been compiled for another CPU or another mode (32/64 bits).
|
||||||
----- snip:start -----
|
Permissions might be wrong.
|
||||||
--- openssh-1.2.2p1/configure.in.orig Thu Mar 23 18:56:58 2000
|
|
||||||
+++ openssh-1.2.2p1/configure.in Thu Mar 23 18:55:05 2000
|
|
||||||
@@ -152,10 +152,10 @@
|
|
||||||
AC_MSG_CHECKING([for OpenSSL/SSLeay directory])
|
|
||||||
for ssldir in "" $tryssldir /usr /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg /opt /opt/openssl ; do
|
|
||||||
if test ! -z "$ssldir" ; then
|
|
||||||
- LIBS="$saved_LIBS -L$ssldir"
|
|
||||||
+ LIBS="$saved_LIBS -L$ssldir/lib"
|
|
||||||
CFLAGS="$CFLAGS -I$ssldir/include"
|
|
||||||
if test "x$need_dash_r" = "x1" ; then
|
|
||||||
- LIBS="$LIBS -R$ssldir"
|
|
||||||
+ LIBS="$LIBS -R$ssldir/lib"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
LIBS="$LIBS -lcrypto"
|
|
||||||
--- openssh-1.2.2p1/configure.orig Thu Mar 23 18:55:02 2000
|
|
||||||
+++ openssh-1.2.2p1/configure Thu Mar 23 18:57:08 2000
|
|
||||||
@@ -1890,10 +1890,10 @@
|
|
||||||
echo "configure:1891: checking for OpenSSL/SSLeay directory" >&5
|
|
||||||
for ssldir in "" $tryssldir /usr /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg /opt /opt/openssl ; do
|
|
||||||
if test ! -z "$ssldir" ; then
|
|
||||||
- LIBS="$saved_LIBS -L$ssldir"
|
|
||||||
+ LIBS="$saved_LIBS -L$ssldir/lib"
|
|
||||||
CFLAGS="$CFLAGS -I$ssldir/include"
|
|
||||||
if test "x$need_dash_r" = "x1" ; then
|
|
||||||
- LIBS="$LIBS -R$ssldir"
|
|
||||||
+ LIBS="$LIBS -R$ssldir/lib"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
LIBS="$LIBS -lcrypto"
|
|
||||||
----- snip:end -----
|
|
||||||
|
|
||||||
|
The general answer is to check the config.log file generated when running
|
||||||
|
the OpenSSH configure script. It should contain the detailed information
|
||||||
|
on why the OpenSSL library was not detected or considered incompatible.
|
||||||
|
|
||||||
* Can I use OpenSSL's SSL library with non-blocking I/O?
|
* Can I use OpenSSL's SSL library with non-blocking I/O?
|
||||||
|
|
||||||
@@ -543,5 +617,12 @@ requiring a bi-directional message exchange; both SSL_read() and
|
|||||||
SSL_write() will try to continue any pending handshake.
|
SSL_write() will try to continue any pending handshake.
|
||||||
|
|
||||||
|
|
||||||
|
* Why doesn't my server application receive a client certificate?
|
||||||
|
|
||||||
|
Due to the TLS protocol definition, a client will only send a certificate,
|
||||||
|
if explicitly asked by the server. Use the SSL_VERIFY_PEER flag of the
|
||||||
|
SSL_CTX_set_verify() function to enable the use of client certificates.
|
||||||
|
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
|
|
||||||
|
|||||||
17
INSTALL
17
INSTALL
@@ -7,8 +7,11 @@
|
|||||||
|
|
||||||
To install OpenSSL, you will need:
|
To install OpenSSL, you will need:
|
||||||
|
|
||||||
|
* make
|
||||||
* Perl 5
|
* Perl 5
|
||||||
* an ANSI C compiler
|
* an ANSI C compiler
|
||||||
|
* a development environment in form of development libraries and C
|
||||||
|
header files
|
||||||
* a supported Unix operating system
|
* a supported Unix operating system
|
||||||
|
|
||||||
Quick Start
|
Quick Start
|
||||||
@@ -50,6 +53,15 @@
|
|||||||
This will usually require additional system-dependent options!
|
This will usually require additional system-dependent options!
|
||||||
See "Note on multi-threading" below.
|
See "Note on multi-threading" below.
|
||||||
|
|
||||||
|
no-zlib Don't try to build with support for zlib compression and
|
||||||
|
decompression.
|
||||||
|
|
||||||
|
zlib Build with support for zlib compression/decompression.
|
||||||
|
|
||||||
|
zlib-dynamic Like "zlib", but has OpenSSL load the zlib library dynamically
|
||||||
|
when needed. This is only supported on systems where loading
|
||||||
|
of shared libraries is supported. This is the default choice.
|
||||||
|
|
||||||
no-shared Don't try to create shared libraries.
|
no-shared Don't try to create shared libraries.
|
||||||
|
|
||||||
shared In addition to the usual static libraries, create shared
|
shared In addition to the usual static libraries, create shared
|
||||||
@@ -266,6 +278,11 @@
|
|||||||
Note on shared libraries
|
Note on shared libraries
|
||||||
------------------------
|
------------------------
|
||||||
|
|
||||||
|
Shared library is currently an experimental feature. The only reason to
|
||||||
|
have them would be to conserve memory on systems where several program
|
||||||
|
are using OpenSSL. Binary backward compatibility can't be guaranteed
|
||||||
|
before OpenSSL version 1.0.
|
||||||
|
|
||||||
For some systems, the OpenSSL Configure script knows what is needed to
|
For some systems, the OpenSSL Configure script knows what is needed to
|
||||||
build shared libraries for libcrypto and libssl. On these systems,
|
build shared libraries for libcrypto and libssl. On these systems,
|
||||||
the shared libraries are currently not created by default, but giving
|
the shared libraries are currently not created by default, but giving
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
OpenSSL - Port To The Macintosh
|
OpenSSL - Port To The Macintosh OS 9 or Earlier
|
||||||
===============================
|
===============================================
|
||||||
|
|
||||||
Thanks to Roy Wood <roy@centricsystems.ca> initial support for MacOS (pre
|
Thanks to Roy Wood <roy@centricsystems.ca> initial support for Mac OS (pre
|
||||||
X) is now provided. "Initial" means that unlike other platforms where you
|
X) is now provided. "Initial" means that unlike other platforms where you
|
||||||
get an SDK and a "swiss army" openssl application, on Macintosh you only
|
get an SDK and a "swiss army" openssl application, on Macintosh you only
|
||||||
get one sample application which fetches a page over HTTPS(*) and dumps it
|
get one sample application which fetches a page over HTTPS(*) and dumps it
|
||||||
|
|||||||
22
INSTALL.OS2
Normal file
22
INSTALL.OS2
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
|
||||||
|
Installation on OS/2
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
You need to have the following tools installed:
|
||||||
|
|
||||||
|
* EMX GCC
|
||||||
|
* PERL
|
||||||
|
* GNU make
|
||||||
|
|
||||||
|
|
||||||
|
To build the makefile, run
|
||||||
|
|
||||||
|
> os2\os2-emx
|
||||||
|
|
||||||
|
This will configure OpenSSL and create OS2-EMX.mak which you then use to
|
||||||
|
build the OpenSSL libraries & programs by running
|
||||||
|
|
||||||
|
> make -f os2-emx.mak
|
||||||
|
|
||||||
|
If that finishes successfully you will find the libraries and programs in the
|
||||||
|
"out" directory.
|
||||||
22
INSTALL.VMS
22
INSTALL.VMS
@@ -8,6 +8,7 @@ Intro:
|
|||||||
|
|
||||||
This file is divided in the following parts:
|
This file is divided in the following parts:
|
||||||
|
|
||||||
|
Requirements - Mandatory reading.
|
||||||
Checking the distribution - Mandatory reading.
|
Checking the distribution - Mandatory reading.
|
||||||
Compilation - Mandatory reading.
|
Compilation - Mandatory reading.
|
||||||
Logical names - Mandatory reading.
|
Logical names - Mandatory reading.
|
||||||
@@ -19,15 +20,24 @@ This file is divided in the following parts:
|
|||||||
TODO - Things that are to come.
|
TODO - Things that are to come.
|
||||||
|
|
||||||
|
|
||||||
|
Requirements:
|
||||||
|
=============
|
||||||
|
|
||||||
|
To build and install OpenSSL, you will need:
|
||||||
|
|
||||||
|
* DEC C or some other ANSI C compiler. VAX C is *not* supported.
|
||||||
|
[Note: OpenSSL has only been tested with DEC C. Compiling with
|
||||||
|
a different ANSI C compiler may require some work]
|
||||||
|
|
||||||
Checking the distribution:
|
Checking the distribution:
|
||||||
==========================
|
==========================
|
||||||
|
|
||||||
There have been reports of places where the distribution didn't quite get
|
There have been reports of places where the distribution didn't quite get
|
||||||
through, for example if you've copied the tree from a NFS-mounted unix
|
through, for example if you've copied the tree from a NFS-mounted Unix
|
||||||
mount point.
|
mount point.
|
||||||
|
|
||||||
The easiest way to check if everything got through as it should is to check
|
The easiest way to check if everything got through as it should is to check
|
||||||
for oen of the following files:
|
for one of the following files:
|
||||||
|
|
||||||
[.CRYPTO]OPENSSLCONF.H_IN
|
[.CRYPTO]OPENSSLCONF.H_IN
|
||||||
[.CRYPTO]OPENSSLCONF_H.IN
|
[.CRYPTO]OPENSSLCONF_H.IN
|
||||||
@@ -59,7 +69,7 @@ for a command procedure name xxx-LIB.COM (in the library directories)
|
|||||||
or MAKExxx.COM (in the program directories) and read the comments at
|
or MAKExxx.COM (in the program directories) and read the comments at
|
||||||
the top to understand how to use them. However, if you want to
|
the top to understand how to use them. However, if you want to
|
||||||
compile all you can get, the simplest is to use MAKEVMS.COM in the top
|
compile all you can get, the simplest is to use MAKEVMS.COM in the top
|
||||||
directory. The syntax is trhe following:
|
directory. The syntax is the following:
|
||||||
|
|
||||||
@MAKEVMS <option> <rsaref-p> <debug-p> [<compiler>]
|
@MAKEVMS <option> <rsaref-p> <debug-p> [<compiler>]
|
||||||
|
|
||||||
@@ -69,7 +79,7 @@ directory. The syntax is trhe following:
|
|||||||
CONFIG Just build the "[.CRYPTO]OPENSSLCONF.H" file.
|
CONFIG Just build the "[.CRYPTO]OPENSSLCONF.H" file.
|
||||||
BUILDINF Just build the "[.INCLUDE]BUILDINF.H" file.
|
BUILDINF Just build the "[.INCLUDE]BUILDINF.H" file.
|
||||||
SOFTLINKS Just copies some files, to simulate Unix soft links.
|
SOFTLINKS Just copies some files, to simulate Unix soft links.
|
||||||
BUILDALL Same as ALL, except CONFIG, BUILDINF and SOFTILNKS aren't done.
|
BUILDALL Same as ALL, except CONFIG, BUILDINF and SOFTLINKS aren't done.
|
||||||
RSAREF Just build the "[.xxx.EXE.RSAREF]LIBRSAGLUE.OLB" library.
|
RSAREF Just build the "[.xxx.EXE.RSAREF]LIBRSAGLUE.OLB" library.
|
||||||
CRYPTO Just build the "[.xxx.EXE.CRYPTO]LIBCRYPTO.OLB" library.
|
CRYPTO Just build the "[.xxx.EXE.CRYPTO]LIBCRYPTO.OLB" library.
|
||||||
SSL Just build the "[.xxx.EXE.SSL]LIBSSL.OLB" library.
|
SSL Just build the "[.xxx.EXE.SSL]LIBSSL.OLB" library.
|
||||||
@@ -82,7 +92,7 @@ directory. The syntax is trhe following:
|
|||||||
RSAREF compile using the RSAREF Library
|
RSAREF compile using the RSAREF Library
|
||||||
NORSAREF compile without using RSAREF
|
NORSAREF compile without using RSAREF
|
||||||
|
|
||||||
Note 0: The RASREF library IS NO LONGER NEEDED. The RSA patent
|
Note 0: The RSAREF library IS NO LONGER NEEDED. The RSA patent
|
||||||
expires September 20, 2000, and RSA Security chose to make
|
expires September 20, 2000, and RSA Security chose to make
|
||||||
the algorithm public domain two weeks before that.
|
the algorithm public domain two weeks before that.
|
||||||
|
|
||||||
@@ -254,7 +264,7 @@ following before you start compiling:
|
|||||||
The USER_CCDISABLEWARNINGS is there because otherwise, DEC C will complain
|
The USER_CCDISABLEWARNINGS is there because otherwise, DEC C will complain
|
||||||
that those macros have been changed.
|
that those macros have been changed.
|
||||||
|
|
||||||
Note: Currently, this is only usefull for library compilation. The
|
Note: Currently, this is only useful for library compilation. The
|
||||||
programs will still be linked with the current version of the
|
programs will still be linked with the current version of the
|
||||||
C library shareable image, and will thus complain if they are
|
C library shareable image, and will thus complain if they are
|
||||||
faced with an older version of the same C library shareable image.
|
faced with an older version of the same C library shareable image.
|
||||||
|
|||||||
60
INSTALL.W32
60
INSTALL.W32
@@ -2,16 +2,19 @@
|
|||||||
INSTALLATION ON THE WIN32 PLATFORM
|
INSTALLATION ON THE WIN32 PLATFORM
|
||||||
----------------------------------
|
----------------------------------
|
||||||
|
|
||||||
Heres a few comments about building OpenSSL in Windows environments. Most of
|
Heres a few comments about building OpenSSL in Windows environments. Most
|
||||||
this is tested on Win32 but it may also work in Win 3.1 with some
|
of this is tested on Win32 but it may also work in Win 3.1 with some
|
||||||
modification.
|
modification.
|
||||||
|
|
||||||
You need Perl for Win32 (available from http://www.activestate.com/ActivePerl)
|
You need Perl for Win32. Unless you will build on Cygwin, you will need
|
||||||
|
ActiveState Perl, available from http://www.activestate.com/ActivePerl.
|
||||||
|
For Cygwin users, there's more info in the Cygwin section.
|
||||||
|
|
||||||
and one of the following C compilers:
|
and one of the following C compilers:
|
||||||
|
|
||||||
* Visual C++
|
* Visual C++
|
||||||
* Borland C
|
* Borland C
|
||||||
* GNU C (Mingw32 or Cygwin32)
|
* GNU C (Mingw32 or Cygwin)
|
||||||
|
|
||||||
If you want to compile in the assembly language routines with Visual C++ then
|
If you want to compile in the assembly language routines with Visual C++ then
|
||||||
you will need an assembler. This is worth doing because it will result in
|
you will need an assembler. This is worth doing because it will result in
|
||||||
@@ -78,7 +81,7 @@
|
|||||||
|
|
||||||
There are various changes you can make to the Win32 compile environment. By
|
There are various changes you can make to the Win32 compile environment. By
|
||||||
default the library is not compiled with debugging symbols. If you add 'debug'
|
default the library is not compiled with debugging symbols. If you add 'debug'
|
||||||
to the mk1mk.pl lines in the do_* batch file then debugging symbols will be
|
to the mk1mf.pl lines in the do_* batch file then debugging symbols will be
|
||||||
compiled in.
|
compiled in.
|
||||||
|
|
||||||
The default Win32 environment is to leave out any Windows NT specific
|
The default Win32 environment is to leave out any Windows NT specific
|
||||||
@@ -109,10 +112,10 @@
|
|||||||
* Compiler installation:
|
* Compiler installation:
|
||||||
|
|
||||||
Mingw32 is available from <ftp://ftp.xraylith.wisc.edu/pub/khan/
|
Mingw32 is available from <ftp://ftp.xraylith.wisc.edu/pub/khan/
|
||||||
gnu-win32/mingw32/gcc-2.95.2/gcc-2.95.2-msvcrt.exe>. GNU make is at
|
gnu-win32/mingw32/gcc-2.95.2/gcc-2.95.2-msvcrt.exe>. Extract it
|
||||||
<ftp://agnes.dida.physik.uni-essen.de/home/janjaap/mingw32/binaries/
|
to a directory such as C:\gcc-2.95.2 and add c:\gcc-2.95.2\bin to
|
||||||
make-3.76.1.zip>. Install both of them in C:\egcs-1.1.2 and run
|
the PATH environment variable in "System Properties"; or edit and
|
||||||
C:\egcs-1.1.2\mingw32.bat to set the PATH.
|
run C:\gcc-2.95.2\mingw32.bat to set the PATH.
|
||||||
|
|
||||||
* Compile OpenSSL:
|
* Compile OpenSSL:
|
||||||
|
|
||||||
@@ -134,28 +137,30 @@
|
|||||||
> cd out
|
> cd out
|
||||||
> ..\ms\test
|
> ..\ms\test
|
||||||
|
|
||||||
GNU C (CygWin32)
|
GNU C (Cygwin)
|
||||||
---------------
|
--------------
|
||||||
|
|
||||||
CygWin32 provides a bash shell and GNU tools environment running on
|
Cygwin provides a bash shell and GNU tools environment running on
|
||||||
NT 4.0, Windows 9x and Windows 2000. Consequently, a make of OpenSSL
|
NT 4.0, Windows 9x and Windows 2000. Consequently, a make of OpenSSL
|
||||||
with CygWin is closer to a GNU bash environment such as Linux rather
|
with Cygwin is closer to a GNU bash environment such as Linux rather
|
||||||
than other W32 makes that are based on a single makefile approach.
|
than other W32 makes that are based on a single makefile approach.
|
||||||
CygWin32 implements Posix/Unix calls through cygwin1.dll, and is
|
Cygwin implements Posix/Unix calls through cygwin1.dll, and is
|
||||||
contrasted to Mingw32 which links dynamically to msvcrt.dll or
|
contrasted to Mingw32 which links dynamically to msvcrt.dll or
|
||||||
crtdll.dll.
|
crtdll.dll.
|
||||||
|
|
||||||
To build OpenSSL using CygWin32:
|
To build OpenSSL using Cygwin:
|
||||||
|
|
||||||
* Install CygWin32 (see http://sourceware.cygnus.com/cygwin)
|
* Install Cygwin (see http://sourceware.cygnus.com/cygwin)
|
||||||
|
|
||||||
* Install Perl and ensure it is in the path
|
* Install Perl and ensure it is in the path (recent Cygwin perl
|
||||||
|
(version 5.6.1-2 of the latter has been reported to work) or
|
||||||
|
ActivePerl)
|
||||||
|
|
||||||
* Run the CygWin bash shell
|
* Run the Cygwin bash shell
|
||||||
|
|
||||||
* $ tar zxvf openssl-x.x.x.tar.gz
|
* $ tar zxvf openssl-x.x.x.tar.gz
|
||||||
$ cd openssl-x.x.x
|
$ cd openssl-x.x.x
|
||||||
$ ./Configure no-threads CygWin32
|
$ ./config
|
||||||
[...]
|
[...]
|
||||||
$ make
|
$ make
|
||||||
[...]
|
[...]
|
||||||
@@ -164,27 +169,28 @@
|
|||||||
|
|
||||||
This will create a default install in /usr/local/ssl.
|
This will create a default install in /usr/local/ssl.
|
||||||
|
|
||||||
CygWin32 Notes:
|
Cygwin Notes:
|
||||||
|
|
||||||
"make test" and normal file operations may fail in directories
|
"make test" and normal file operations may fail in directories
|
||||||
mounted as text (i.e. mount -t c:\somewhere /home) due to CygWin
|
mounted as text (i.e. mount -t c:\somewhere /home) due to Cygwin
|
||||||
stripping of carriage returns. To avoid this ensure that a binary
|
stripping of carriage returns. To avoid this ensure that a binary
|
||||||
mount is used, e.g. mount -b c:\somewhere /home.
|
mount is used, e.g. mount -b c:\somewhere /home.
|
||||||
|
|
||||||
As of version 1.1.1 CygWin32 is relatively unstable in its handling
|
As of version 1.1.1 Cygwin is relatively unstable in its handling
|
||||||
of cr/lf issues. These make procedures succeeded with versions 1.1 and
|
of cr/lf issues. These make procedures succeeded with versions 1.1 and
|
||||||
the snapshot 20000524 (Slow!).
|
the snapshot 20000524 (Slow!).
|
||||||
|
|
||||||
"bc" is not provided in the CygWin32 distribution. This causes a
|
"bc" is not provided in the Cygwin distribution. This causes a
|
||||||
non-fatal error in "make test" but is otherwise harmless. If
|
non-fatal error in "make test" but is otherwise harmless. If
|
||||||
desired, GNU bc can be built with CygWin32 without change.
|
desired, GNU bc can be built with Cygwin without change.
|
||||||
|
|
||||||
|
|
||||||
Installation
|
Installation
|
||||||
------------
|
------------
|
||||||
|
|
||||||
There's currently no real installation procedure for Win32. There are,
|
If you used the Cygwin procedure above, you have already installed and
|
||||||
however, some suggestions:
|
can skip this section. For all other procedures, there's currently no real
|
||||||
|
installation procedure for Win32. There are, however, some suggestions:
|
||||||
|
|
||||||
- do nothing. The include files are found in the inc32/ subdirectory,
|
- do nothing. The include files are found in the inc32/ subdirectory,
|
||||||
all binaries are found in out32dll/ or out32/ depending if you built
|
all binaries are found in out32dll/ or out32/ depending if you built
|
||||||
@@ -256,5 +262,5 @@
|
|||||||
malloc(), free() and realloc() as the application. However there are many
|
malloc(), free() and realloc() as the application. However there are many
|
||||||
standard library functions used by OpenSSL that call malloc() internally
|
standard library functions used by OpenSSL that call malloc() internally
|
||||||
(e.g. fopen()), and OpenSSL cannot change these; so in general you cannot
|
(e.g. fopen()), and OpenSSL cannot change these; so in general you cannot
|
||||||
rely on CYRPTO_malloc_init() solving your problem, and you should
|
rely on CRYPTO_malloc_init() solving your problem, and you should
|
||||||
consistently use the multithreaded library.
|
consistently use the multithreaded library.
|
||||||
|
|||||||
2
LICENSE
2
LICENSE
@@ -12,7 +12,7 @@
|
|||||||
---------------
|
---------------
|
||||||
|
|
||||||
/* ====================================================================
|
/* ====================================================================
|
||||||
* Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved.
|
* Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
|
|||||||
321
Makefile.org
321
Makefile.org
@@ -56,8 +56,9 @@ CC= gcc
|
|||||||
#CFLAG= -DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m486 -Wall -Wuninitialized -DSHA1_ASM -DMD5_ASM -DRMD160_ASM
|
#CFLAG= -DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m486 -Wall -Wuninitialized -DSHA1_ASM -DMD5_ASM -DRMD160_ASM
|
||||||
CFLAG= -DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall -DSHA1_ASM -DMD5_ASM -DRMD160_ASM
|
CFLAG= -DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall -DSHA1_ASM -DMD5_ASM -DRMD160_ASM
|
||||||
DEPFLAG=
|
DEPFLAG=
|
||||||
PEX_LIBS= -L. -L.. -L../.. -L../../..
|
PEX_LIBS=
|
||||||
EX_LIBS=
|
EX_LIBS=
|
||||||
|
EXE_EXT=
|
||||||
AR=ar r
|
AR=ar r
|
||||||
RANLIB= ranlib
|
RANLIB= ranlib
|
||||||
PERL= perl
|
PERL= perl
|
||||||
@@ -165,9 +166,9 @@ SHLIBDIRS= crypto ssl
|
|||||||
SDIRS= \
|
SDIRS= \
|
||||||
md2 md4 md5 sha mdc2 hmac ripemd \
|
md2 md4 md5 sha mdc2 hmac ripemd \
|
||||||
des rc2 rc4 rc5 idea bf cast \
|
des rc2 rc4 rc5 idea bf cast \
|
||||||
bn ec rsa dsa dh dso engine rijndael \
|
bn ec rsa dsa ecdsa dh dso engine aes \
|
||||||
buffer bio stack lhash rand err objects \
|
buffer bio stack lhash rand err objects \
|
||||||
evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp
|
evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp ui krb5
|
||||||
|
|
||||||
# tests to perform. "alltests" is a special word indicating that all tests
|
# tests to perform. "alltests" is a special word indicating that all tests
|
||||||
# should be performed.
|
# should be performed.
|
||||||
@@ -190,6 +191,7 @@ SHARED_CRYPTO=libcrypto$(SHLIB_EXT)
|
|||||||
SHARED_SSL=libssl$(SHLIB_EXT)
|
SHARED_SSL=libssl$(SHLIB_EXT)
|
||||||
SHARED_LIBS=
|
SHARED_LIBS=
|
||||||
SHARED_LIBS_LINK_EXTS=
|
SHARED_LIBS_LINK_EXTS=
|
||||||
|
SHARED_LDFLAGS=
|
||||||
|
|
||||||
GENERAL= Makefile
|
GENERAL= Makefile
|
||||||
BASENAME= openssl
|
BASENAME= openssl
|
||||||
@@ -202,23 +204,18 @@ HEADER= e_os.h
|
|||||||
# When we're prepared to use shared libraries in the programs we link here
|
# When we're prepared to use shared libraries in the programs we link here
|
||||||
# we might remove 'clean-shared' from the targets to perform at this stage
|
# we might remove 'clean-shared' from the targets to perform at this stage
|
||||||
|
|
||||||
all: clean-shared Makefile.ssl sub_all
|
all: Makefile.ssl sub_all
|
||||||
|
|
||||||
sub_all:
|
sub_all:
|
||||||
@for i in $(DIRS); \
|
@for i in $(DIRS); \
|
||||||
do \
|
do \
|
||||||
if [ -d "$$i" ]; then \
|
if [ -d "$$i" ]; then \
|
||||||
(cd $$i && echo "making all in $$i..." && \
|
(cd $$i && echo "making all in $$i..." && \
|
||||||
$(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' SDIRS='$(SDIRS)' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' KRB5_INCLUDES='${KRB5_INCLUDES}' LIBKRB5='${LIBKRB5}' all ) || exit 1; \
|
$(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' SDIRS='$(SDIRS)' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' KRB5_INCLUDES='${KRB5_INCLUDES}' LIBKRB5='${LIBKRB5}' EXE_EXT='${EXE_EXT}' SHARED_LIBS='${SHARED_LIBS}' SHLIB_EXT='${SHLIB_EXT}' SHLIB_TARGET='${SHLIB_TARGET}' all ) || exit 1; \
|
||||||
else \
|
else \
|
||||||
$(MAKE) $$i; \
|
$(MAKE) $$i; \
|
||||||
fi; \
|
fi; \
|
||||||
done; \
|
done;
|
||||||
if echo "$(DIRS)" | \
|
|
||||||
egrep '(^| )(crypto|ssl)( |$$)' > /dev/null 2>&1 && \
|
|
||||||
[ -n "$(SHARED_LIBS)" ]; then \
|
|
||||||
$(MAKE) $(SHARED_LIBS); \
|
|
||||||
fi
|
|
||||||
|
|
||||||
libcrypto$(SHLIB_EXT): libcrypto.a
|
libcrypto$(SHLIB_EXT): libcrypto.a
|
||||||
@if [ "$(SHLIB_TARGET)" != "" ]; then \
|
@if [ "$(SHLIB_TARGET)" != "" ]; then \
|
||||||
@@ -226,9 +223,10 @@ libcrypto$(SHLIB_EXT): libcrypto.a
|
|||||||
else \
|
else \
|
||||||
echo "There's no support for shared libraries on this platform" >&2; \
|
echo "There's no support for shared libraries on this platform" >&2; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
libssl$(SHLIB_EXT): libcrypto$(SHLIB_EXT) libssl.a
|
libssl$(SHLIB_EXT): libcrypto$(SHLIB_EXT) libssl.a
|
||||||
@if [ "$(SHLIB_TARGET)" != "" ]; then \
|
@if [ "$(SHLIB_TARGET)" != "" ]; then \
|
||||||
$(MAKE) SHLIBDIRS=ssl SHLIBDEPS='-L. -lcrypto' build-shared; \
|
$(MAKE) SHLIBDIRS=ssl SHLIBDEPS='-lcrypto' build-shared; \
|
||||||
else \
|
else \
|
||||||
echo "There's no support for shared libraries on this platform" >&2; \
|
echo "There's no support for shared libraries on this platform" >&2; \
|
||||||
fi
|
fi
|
||||||
@@ -242,58 +240,181 @@ clean-shared:
|
|||||||
done; \
|
done; \
|
||||||
fi; \
|
fi; \
|
||||||
( set -x; rm -f lib$$i$(SHLIB_EXT) ); \
|
( set -x; rm -f lib$$i$(SHLIB_EXT) ); \
|
||||||
done
|
if [ "$(PLATFORM)" = "Cygwin" ]; then \
|
||||||
|
( set -x; rm -f cyg$$i$(SHLIB_EXT) lib$$i$(SHLIB_EXT).a ); \
|
||||||
link-shared:
|
|
||||||
@for i in $(SHLIBDIRS); do \
|
|
||||||
prev=lib$$i$(SHLIB_EXT); \
|
|
||||||
if [ -n "$(SHARED_LIBS_LINK_EXTS)" ]; then \
|
|
||||||
tmp="$(SHARED_LIBS_LINK_EXTS)"; \
|
|
||||||
for j in $${tmp:-x}; do \
|
|
||||||
( set -x; ln -s -f $$prev lib$$i$$j ); \
|
|
||||||
prev=lib$$i$$j; \
|
|
||||||
done; \
|
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
|
|
||||||
|
link-shared:
|
||||||
|
@if [ -n "$(SHARED_LIBS_LINK_EXTS)" ]; then \
|
||||||
|
tmp="$(SHARED_LIBS_LINK_EXTS)"; \
|
||||||
|
for i in $(SHLIBDIRS); do \
|
||||||
|
prev=lib$$i$(SHLIB_EXT); \
|
||||||
|
for j in $${tmp:-x}; do \
|
||||||
|
( set -x; ln -f -s $$prev lib$$i$$j ); \
|
||||||
|
prev=lib$$i$$j; \
|
||||||
|
done; \
|
||||||
|
done; \
|
||||||
|
fi
|
||||||
|
|
||||||
build-shared: clean-shared do_$(SHLIB_TARGET) link-shared
|
build-shared: clean-shared do_$(SHLIB_TARGET) link-shared
|
||||||
|
|
||||||
do_bsd-gcc-shared: linux-shared
|
do_bsd-gcc-shared: do_gnu-shared
|
||||||
do_linux-shared:
|
do_linux-shared: do_gnu-shared
|
||||||
libs='${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
|
do_gnu-shared:
|
||||||
( set -x; ${CC} -shared -o lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
|
libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
|
||||||
-Wl,-S,-soname=lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
|
( set -x; ${CC} ${SHARED_LDFLAGS} \
|
||||||
|
-shared -o lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
|
||||||
|
-Wl,-soname=lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
|
||||||
|
-Wl,-Bsymbolic \
|
||||||
-Wl,--whole-archive lib$$i.a \
|
-Wl,--whole-archive lib$$i.a \
|
||||||
-Wl,--no-whole-archive $$libs ${EX_LIBS} -lc ) || exit 1; \
|
-Wl,--no-whole-archive $$libs ${EX_LIBS} -lc ) || exit 1; \
|
||||||
libs="$$libs -L. -l$$i"; \
|
libs="$$libs -l$$i"; \
|
||||||
|
done
|
||||||
|
|
||||||
|
DETECT_GNU_LD=${CC} -v 2>&1 | grep '^gcc' >/dev/null 2>&1 && \
|
||||||
|
collect2=`gcc -print-prog-name=collect2 2>&1` && \
|
||||||
|
[ -n "$$collect2" ] && \
|
||||||
|
my_ld=`$$collect2 --help 2>&1 | grep Usage: | sed 's/^Usage: *\([^ ][^ ]*\).*/\1/'` && \
|
||||||
|
[ -n "$$my_ld" ] && \
|
||||||
|
$$my_ld -v 2>&1 | grep 'GNU ld' >/dev/null 2>&1
|
||||||
|
|
||||||
|
# For Darwin AKA Mac OS/X (dyld)
|
||||||
|
do_darwin-shared:
|
||||||
|
libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
|
||||||
|
( set -x ; ${CC} --verbose -dynamiclib -o lib$$i${SHLIB_EXT} \
|
||||||
|
lib$$i.a $$libs -all_load -current_version ${SHLIB_MAJOR}.${SHLIB_MINOR} \
|
||||||
|
-compatibility_version ${SHLIB_MAJOR}.`echo ${SHLIB_MINOR} | cut -d. -f1` \
|
||||||
|
-install_name ${INSTALLTOP}/lib/lib$$i${SHLIB_EXT} ) || exit 1; \
|
||||||
|
libs="$$libs -l`basename $$i${SHLIB_EXT} .dylib`"; \
|
||||||
|
echo "" ; \
|
||||||
|
done
|
||||||
|
|
||||||
|
do_cygwin-shared:
|
||||||
|
libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
|
||||||
|
( set -x; ${CC} -shared -o cyg$$i.dll \
|
||||||
|
-Wl,-Bsymbolic \
|
||||||
|
-Wl,--whole-archive lib$$i.a \
|
||||||
|
-Wl,--out-implib,lib$$i.dll.a \
|
||||||
|
-Wl,--no-whole-archive $$libs ) || exit 1; \
|
||||||
|
libs="$$libs -l$$i"; \
|
||||||
done
|
done
|
||||||
|
|
||||||
# This assumes that GNU utilities are *not* used
|
# This assumes that GNU utilities are *not* used
|
||||||
|
do_alpha-osf1-shared:
|
||||||
|
if ${DETECT_GNU_LD}; then \
|
||||||
|
$(MAKE) do_gnu-shared; \
|
||||||
|
else \
|
||||||
|
libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
|
||||||
|
( set -x; ${CC} ${SHARED_LDFLAGS} \
|
||||||
|
-shared -o lib$$i.so \
|
||||||
|
-set_version "${SHLIB_VERSION_HISTORY}${SHLIB_VERSION_NUMBER}" \
|
||||||
|
-all lib$$i.a -none $$libs ${EX_LIBS} -lc ) || exit 1; \
|
||||||
|
libs="$$libs -l$$i"; \
|
||||||
|
done; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
# This assumes that GNU utilities are *not* used
|
||||||
|
# The difference between alpha-osf1-shared and tru64-shared is the `-msym'
|
||||||
|
# option passed to the linker.
|
||||||
do_tru64-shared:
|
do_tru64-shared:
|
||||||
libs='${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
|
if ${DETECT_GNU_LD}; then \
|
||||||
( set -x; ${CC} -shared -no_archive -o lib$$i.so \
|
$(MAKE) do_gnu-shared; \
|
||||||
-set_version "${SHLIB_VERSION_HISTORY}${SHLIB_VERSION_NUMBER}" \
|
else \
|
||||||
-all lib$$i.a -none $$libs ${EX_LIBS} -lc ) || exit 1; \
|
libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
|
||||||
libs="$$libs -L. -l$$i"; \
|
( set -x; ${CC} ${SHARED_LDFLAGS} \
|
||||||
done
|
-shared -msym -o lib$$i.so \
|
||||||
|
-set_version "${SHLIB_VERSION_HISTORY}${SHLIB_VERSION_NUMBER}" \
|
||||||
|
-all lib$$i.a -none $$libs ${EX_LIBS} -lc ) || exit 1; \
|
||||||
|
libs="$$libs -l$$i"; \
|
||||||
|
done; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
# This assumes that GNU utilities are *not* used
|
||||||
|
# The difference between tru64-shared and tru64-shared-rpath is the
|
||||||
|
# -rpath ${INSTALLTOP}/lib passed to the linker.
|
||||||
|
do_tru64-shared-rpath:
|
||||||
|
if ${DETECT_GNU_LD}; then \
|
||||||
|
$(MAKE) do_gnu-shared; \
|
||||||
|
else \
|
||||||
|
libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
|
||||||
|
( set -x; ${CC} ${SHARED_LDFLAGS} \
|
||||||
|
-shared -msym -o lib$$i.so \
|
||||||
|
-rpath ${INSTALLTOP}/lib \
|
||||||
|
-set_version "${SHLIB_VERSION_HISTORY}${SHLIB_VERSION_NUMBER}" \
|
||||||
|
-all lib$$i.a -none $$libs ${EX_LIBS} -lc ) || exit 1; \
|
||||||
|
libs="$$libs -l$$i"; \
|
||||||
|
done; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# This assumes that GNU utilities are *not* used
|
# This assumes that GNU utilities are *not* used
|
||||||
do_solaris-shared:
|
do_solaris-shared:
|
||||||
libs='${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
|
if ${DETECT_GNU_LD}; then \
|
||||||
( set -x; ${CC} -G -o lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
|
$(MAKE) do_gnu-shared; \
|
||||||
-h lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
|
else \
|
||||||
-z allextract lib$$i.a $$libs ${EX_LIBS} -lc ) || exit 1; \
|
libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
|
||||||
libs="$$libs -L. -l$$i"; \
|
( PATH=/usr/ccs/bin:$$PATH ; export PATH; \
|
||||||
done
|
set -x; ${CC} ${SHARED_LDFLAGS} \
|
||||||
|
-G -o lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
|
||||||
|
-h lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
|
||||||
|
-z allextract lib$$i.a $$libs ${EX_LIBS} -lc ) || exit 1; \
|
||||||
|
libs="$$libs -l$$i"; \
|
||||||
|
done; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
# OpenServer 5 native compilers used
|
||||||
|
do_svr3-shared:
|
||||||
|
if ${DETECT_GNU_LD}; then \
|
||||||
|
$(MAKE) do_gnu-shared; \
|
||||||
|
else \
|
||||||
|
libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
|
||||||
|
( PATH=/usr/ccs/bin:$$PATH ; export PATH; \
|
||||||
|
find . -name "*.o" -print > allobjs ; \
|
||||||
|
OBJS= ; export OBJS ; \
|
||||||
|
for obj in `ar t lib$$i.a` ; do \
|
||||||
|
OBJS="$${OBJS} `grep $$obj allobjs`" ; \
|
||||||
|
done ; \
|
||||||
|
set -x; ${CC} -G -o lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
|
||||||
|
-h lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
|
||||||
|
$${OBJS} $$libs ${EX_LIBS} ) || exit 1; \
|
||||||
|
libs="$$libs -l$$i"; \
|
||||||
|
done; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
# UnixWare 7 and OpenUNIX 8 native compilers used
|
||||||
|
do_svr5-shared:
|
||||||
|
if ${DETECT_GNU_LD}; then \
|
||||||
|
$(MAKE) do_gnu-shared; \
|
||||||
|
else \
|
||||||
|
libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
|
||||||
|
( PATH=/usr/ccs/bin:$$PATH ; export PATH; \
|
||||||
|
find . -name "*.o" -print > allobjs ; \
|
||||||
|
OBJS= ; export OBJS ; \
|
||||||
|
for obj in `ar t lib$$i.a` ; do \
|
||||||
|
OBJS="$${OBJS} `grep $$obj allobjs`" ; \
|
||||||
|
done ; \
|
||||||
|
set -x; ${CC} ${SHARED_LDFLAGS} \
|
||||||
|
-G -o lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
|
||||||
|
-h lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
|
||||||
|
$${OBJS} $$libs ${EX_LIBS} ) || exit 1; \
|
||||||
|
libs="$$libs -l$$i"; \
|
||||||
|
done; \
|
||||||
|
fi
|
||||||
|
|
||||||
# This assumes that GNU utilities are *not* used
|
# This assumes that GNU utilities are *not* used
|
||||||
do_irix-shared:
|
do_irix-shared:
|
||||||
libs='${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
|
if ${DETECT_GNU_LD}; then \
|
||||||
( set -x; ${CC} -shared -o lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
|
$(MAKE) do_gnu-shared; \
|
||||||
-Wl,-soname,lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
|
else \
|
||||||
-all lib$$i.a $$libs ${EX_LIBS} -lc) || exit 1; \
|
libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
|
||||||
libs="$$libs -L. -l$$i"; \
|
( set -x; ${CC} ${SHARED_LDFLAGS} \
|
||||||
done
|
-shared -o lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
|
||||||
|
-Wl,-soname,lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
|
||||||
|
-all lib$$i.a $$libs ${EX_LIBS} -lc) || exit 1; \
|
||||||
|
libs="$$libs -l$$i"; \
|
||||||
|
done; \
|
||||||
|
fi
|
||||||
|
|
||||||
# This assumes that GNU utilities are *not* used
|
# This assumes that GNU utilities are *not* used
|
||||||
# HP-UX includes the full pathname of libs we depend on, so we would get
|
# HP-UX includes the full pathname of libs we depend on, so we would get
|
||||||
@@ -308,7 +429,8 @@ do_irix-shared:
|
|||||||
#
|
#
|
||||||
do_hpux-shared:
|
do_hpux-shared:
|
||||||
for i in ${SHLIBDIRS}; do \
|
for i in ${SHLIBDIRS}; do \
|
||||||
( set -x; /usr/ccs/bin/ld +vnocompatwarnings \
|
( set -x; /usr/ccs/bin/ld ${SHARED_LDFLAGS} \
|
||||||
|
+vnocompatwarnings \
|
||||||
-b -z +s \
|
-b -z +s \
|
||||||
-o lib$$i.sl.${SHLIB_MAJOR}.${SHLIB_MINOR} \
|
-o lib$$i.sl.${SHLIB_MAJOR}.${SHLIB_MINOR} \
|
||||||
+h lib$$i.sl.${SHLIB_MAJOR}.${SHLIB_MINOR} \
|
+h lib$$i.sl.${SHLIB_MAJOR}.${SHLIB_MINOR} \
|
||||||
@@ -326,12 +448,70 @@ do_hpux-shared:
|
|||||||
#
|
#
|
||||||
do_hpux64-shared:
|
do_hpux64-shared:
|
||||||
for i in ${SHLIBDIRS}; do \
|
for i in ${SHLIBDIRS}; do \
|
||||||
( set -x; /usr/ccs/bin/ld -b -z \
|
( set -x; /usr/ccs/bin/ld ${SHARED_LDFLAGS} \
|
||||||
|
-b -z \
|
||||||
-o lib$$i.sl.${SHLIB_MAJOR}.${SHLIB_MINOR} \
|
-o lib$$i.sl.${SHLIB_MAJOR}.${SHLIB_MINOR} \
|
||||||
+h lib$$i.sl.${SHLIB_MAJOR}.${SHLIB_MINOR} \
|
+h lib$$i.sl.${SHLIB_MAJOR}.${SHLIB_MINOR} \
|
||||||
+forceload lib$$i.a -ldl -lc ) || exit 1; \
|
+forceload lib$$i.a -ldl -lc ) || exit 1; \
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# The following method is said to work on all platforms. Tests will
|
||||||
|
# determine if that's how it's gong to be used.
|
||||||
|
# This assumes that for all but GNU systems, GNU utilities are *not* used.
|
||||||
|
# ALLSYMSFLAGS would be:
|
||||||
|
# GNU systems: --whole-archive
|
||||||
|
# Tru64 Unix: -all
|
||||||
|
# Solaris: -z allextract
|
||||||
|
# Irix: -all
|
||||||
|
# HP/UX-32bit: -Fl
|
||||||
|
# HP/UX-64bit: +forceload
|
||||||
|
# AIX: -bnogc
|
||||||
|
# SHAREDFLAGS would be:
|
||||||
|
# GNU systems: -shared -Wl,-soname=lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
|
||||||
|
# Tru64 Unix: -shared \
|
||||||
|
# -set_version "${SHLIB_VERSION_HISTORY}${SHLIB_VERSION_NUMBER}"
|
||||||
|
# Solaris: -G -h lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
|
||||||
|
# Irix: -shared -Wl,-soname,lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
|
||||||
|
# HP/UX-32bit: +vnocompatwarnings -b -z +s \
|
||||||
|
# +h lib$$i.sl.${SHLIB_MAJOR}.${SHLIB_MINOR}
|
||||||
|
# HP/UX-64bit: -b -z +h lib$$i.sl.${SHLIB_MAJOR}.${SHLIB_MINOR}
|
||||||
|
# AIX: -G -bE:lib$$i.exp -bM:SRE
|
||||||
|
# SHAREDCMD would be:
|
||||||
|
# GNU systems: $(CC)
|
||||||
|
# Tru64 Unix: $(CC)
|
||||||
|
# Solaris: $(CC)
|
||||||
|
# Irix: $(CC)
|
||||||
|
# HP/UX-32bit: /usr/ccs/bin/ld
|
||||||
|
# HP/UX-64bit: /usr/ccs/bin/ld
|
||||||
|
# AIX: $(CC)
|
||||||
|
ALLSYMSFLAG=-bnogc
|
||||||
|
SHAREDFLAGS=${SHARED_LDFLAGS} -G -bE:lib$$i.exp -bM:SRE
|
||||||
|
SHAREDCMD=$(CC)
|
||||||
|
do_aix-shared:
|
||||||
|
libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
|
||||||
|
( set -x; \
|
||||||
|
ld -r -o $$i.o $(ALLSYMSFLAG) lib$$i.a && \
|
||||||
|
( nm -Pg lib$$i.o | grep ' [BD] ' | cut -f1 -d' ' > lib$$i.exp; \
|
||||||
|
$(SHAREDCMD) $(SHAREDFLAG) -o lib$$i.so lib$$i.o \
|
||||||
|
$$libs ${EX_LIBS} ) ) \
|
||||||
|
|| exit 1; \
|
||||||
|
libs="$$libs -l$$i"; \
|
||||||
|
done
|
||||||
|
|
||||||
|
do_reliantunix-shared:
|
||||||
|
libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
|
||||||
|
tmpdir=/tmp/openssl.$$$$ ; rm -rf $$tmpdir ; \
|
||||||
|
( set -x; \
|
||||||
|
( Opwd=`pwd` ; mkdir $$tmpdir || exit 1; \
|
||||||
|
cd $$tmpdir || exit 1 ; ar x $$Opwd/lib$$i.a ; \
|
||||||
|
${CC} -G -o lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} *.o \
|
||||||
|
) || exit 1; \
|
||||||
|
cp $$tmpdir/lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} . ; \
|
||||||
|
) || exit 1; \
|
||||||
|
rm -rf $$tmpdir ; \
|
||||||
|
libs="$$libs -l$$i"; \
|
||||||
|
done
|
||||||
|
|
||||||
Makefile.ssl: Makefile.org
|
Makefile.ssl: Makefile.org
|
||||||
@echo "Makefile.ssl is older than Makefile.org."
|
@echo "Makefile.ssl is older than Makefile.org."
|
||||||
@echo "Reconfigure the source tree (via './config' or 'perl Configure'), please."
|
@echo "Reconfigure the source tree (via './config' or 'perl Configure'), please."
|
||||||
@@ -394,15 +574,21 @@ dclean:
|
|||||||
|
|
||||||
rehash: rehash.time
|
rehash: rehash.time
|
||||||
rehash.time: certs
|
rehash.time: certs
|
||||||
@(OPENSSL="`pwd`/apps/openssl"; OPENSSL_DEBUG_MEMORY=on; export OPENSSL OPENSSL_DEBUG_MEMORY; $(PERL) tools/c_rehash certs)
|
@(OPENSSL="`pwd`/apps/openssl"; OPENSSL_DEBUG_MEMORY=on; \
|
||||||
|
export OPENSSL OPENSSL_DEBUG_MEMORY; \
|
||||||
|
LD_LIBRARY_PATH="`pwd`"; SHLIB_PATH="`pwd`"; LIBPATH="`pwd`"; \
|
||||||
|
export LD_LIBRARY_PATH SHLIB_PATH LIBPATH; \
|
||||||
|
$(PERL) tools/c_rehash certs)
|
||||||
touch rehash.time
|
touch rehash.time
|
||||||
|
|
||||||
test: tests
|
test: tests
|
||||||
|
|
||||||
tests: rehash
|
tests: rehash
|
||||||
@(cd test && echo "testing..." && \
|
@(cd test && echo "testing..." && \
|
||||||
$(MAKE) CC='${CC}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SDIRS='${SDIRS}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' PERL='${PERL}' TESTS='${TESTS}' KRB5_INCLUDES='${KRB5_INCLUDES}' LIBKRB5='${LIBKRB5}' OPENSSL_DEBUG_MEMORY=on tests );
|
$(MAKE) CC='${CC}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SDIRS='${SDIRS}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' PERL='${PERL}' TESTS='${TESTS}' KRB5_INCLUDES='${KRB5_INCLUDES}' LIBKRB5='${LIBKRB5}' EXE_EXT='${EXE_EXT}' OPENSSL_DEBUG_MEMORY=on tests );
|
||||||
@apps/openssl version -a
|
@LD_LIBRARY_PATH="`pwd`"; SHLIB_PATH="`pwd`"; LIBPATH="`pwd`"; \
|
||||||
|
export LD_LIBRARY_PATH SHLIB_PATH LIBPATH; \
|
||||||
|
apps/openssl version -a
|
||||||
|
|
||||||
report:
|
report:
|
||||||
@$(PERL) util/selftest.pl
|
@$(PERL) util/selftest.pl
|
||||||
@@ -412,7 +598,7 @@ depend:
|
|||||||
do \
|
do \
|
||||||
if [ -d "$$i" ]; then \
|
if [ -d "$$i" ]; then \
|
||||||
(cd $$i && echo "making dependencies $$i..." && \
|
(cd $$i && echo "making dependencies $$i..." && \
|
||||||
$(MAKE) SDIRS='${SDIRS}' DEPFLAG='${DEPFLAG}' MAKEDEPPROG='${MAKEDEPPROG}' depend ) || exit 1; \
|
$(MAKE) SDIRS='${SDIRS}' DEPFLAG='${DEPFLAG}' MAKEDEPPROG='${MAKEDEPPROG}' KRB5_INCLUDES='${KRB5_INCLUDES}' depend ) || exit 1; \
|
||||||
fi; \
|
fi; \
|
||||||
done;
|
done;
|
||||||
|
|
||||||
@@ -436,6 +622,7 @@ tags:
|
|||||||
|
|
||||||
errors:
|
errors:
|
||||||
$(PERL) util/mkerr.pl -recurse -write
|
$(PERL) util/mkerr.pl -recurse -write
|
||||||
|
(cd crypto/engine; $(MAKE) PERL=$(PERL) errors)
|
||||||
|
|
||||||
stacks:
|
stacks:
|
||||||
$(PERL) util/mkstack.pl -write
|
$(PERL) util/mkstack.pl -write
|
||||||
@@ -468,7 +655,7 @@ tar:
|
|||||||
|
|
||||||
tar-snap:
|
tar-snap:
|
||||||
@$(TAR) $(TARFLAGS) -cvf - \
|
@$(TAR) $(TARFLAGS) -cvf - \
|
||||||
`find * \! -path CVS/\* \! -path \*/CVS/\* \! -name CVS \! -name .cvsignore \! -name STATUS \! -name TABLE \! -name '*.o' \! -name '*.a' \! -name '*.so' \! -name '*.so.*' \! -name 'openssl' \! -name '*test' \! -name '.#*' | sort` |\
|
`find * \! -path CVS/\* \! -path \*/CVS/\* \! -name CVS \! -name .cvsignore \! -name STATUS \! -name TABLE \! -name '*.o' \! -name '*.a' \! -name '*.so' \! -name '*.so.*' \! -name 'openssl' \! -name '*test' \! -name '.#*' \! -name '*~' | sort` |\
|
||||||
tardy --user_number=0 --user_name=openssl \
|
tardy --user_number=0 --user_name=openssl \
|
||||||
--group_number=0 --group_name=openssl \
|
--group_number=0 --group_name=openssl \
|
||||||
--prefix=openssl-$(VERSION) - > ../$(TARFILE);\
|
--prefix=openssl-$(VERSION) - > ../$(TARFILE);\
|
||||||
@@ -500,7 +687,7 @@ install: all install_docs
|
|||||||
do \
|
do \
|
||||||
if [ -d "$$i" ]; then \
|
if [ -d "$$i" ]; then \
|
||||||
(cd $$i; echo "installing $$i..."; \
|
(cd $$i; echo "installing $$i..."; \
|
||||||
$(MAKE) CC='${CC}' CFLAG='${CFLAG}' INSTALL_PREFIX='${INSTALL_PREFIX}' INSTALLTOP='${INSTALLTOP}' OPENSSLDIR='${OPENSSLDIR}' EX_LIBS='${EX_LIBS}' SDIRS='${SDIRS}' RANLIB='${RANLIB}' install ); \
|
$(MAKE) CC='${CC}' CFLAG='${CFLAG}' INSTALL_PREFIX='${INSTALL_PREFIX}' INSTALLTOP='${INSTALLTOP}' OPENSSLDIR='${OPENSSLDIR}' EX_LIBS='${EX_LIBS}' SDIRS='${SDIRS}' RANLIB='${RANLIB}' EXE_EXT='${EXE_EXT}' install ); \
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
@for i in $(LIBS) ;\
|
@for i in $(LIBS) ;\
|
||||||
@@ -510,17 +697,25 @@ install: all install_docs
|
|||||||
cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/lib; \
|
cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/lib; \
|
||||||
$(RANLIB) $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i; \
|
$(RANLIB) $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i; \
|
||||||
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i ); \
|
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i ); \
|
||||||
fi \
|
fi; \
|
||||||
done
|
done;
|
||||||
@if [ -n "$(SHARED_LIBS)" ]; then \
|
@if [ -n "$(SHARED_LIBS)" ]; then \
|
||||||
tmp="$(SHARED_LIBS)"; \
|
tmp="$(SHARED_LIBS)"; \
|
||||||
for i in $${tmp:-x}; \
|
for i in $${tmp:-x}; \
|
||||||
do \
|
do \
|
||||||
if [ -f "$$i" ]; then \
|
if [ -f "$$i" -o -f "$$i.a" ]; then \
|
||||||
( echo installing $$i; \
|
( echo installing $$i; \
|
||||||
cp -f $$i $(INSTALL_PREFIX)$(INSTALLTOP)/lib; \
|
if [ "$(PLATFORM)" != "Cygwin" ]; then \
|
||||||
chmod 555 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i ); \
|
cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/lib; \
|
||||||
fi \
|
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i; \
|
||||||
|
else \
|
||||||
|
c=`echo $$i | sed 's/^lib/cyg/'`; \
|
||||||
|
cp $$c $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c; \
|
||||||
|
chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c; \
|
||||||
|
cp $$i.a $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.a; \
|
||||||
|
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.a; \
|
||||||
|
fi ); \
|
||||||
|
fi; \
|
||||||
done; \
|
done; \
|
||||||
( here="`pwd`"; \
|
( here="`pwd`"; \
|
||||||
cd $(INSTALL_PREFIX)$(INSTALLTOP)/lib; \
|
cd $(INSTALL_PREFIX)$(INSTALLTOP)/lib; \
|
||||||
@@ -535,7 +730,7 @@ install_docs:
|
|||||||
$(INSTALL_PREFIX)$(MANDIR)/man7
|
$(INSTALL_PREFIX)$(MANDIR)/man7
|
||||||
@for i in doc/apps/*.pod; do \
|
@for i in doc/apps/*.pod; do \
|
||||||
fn=`basename $$i .pod`; \
|
fn=`basename $$i .pod`; \
|
||||||
sec=`[ "$$fn" = "config" ] && echo 5 || echo 1`; \
|
if [ "$$fn" = "config" ]; then sec=5; else sec=1; fi; \
|
||||||
echo "installing man$$sec/`basename $$i .pod`.$$sec"; \
|
echo "installing man$$sec/`basename $$i .pod`.$$sec"; \
|
||||||
(cd `dirname $$i`; \
|
(cd `dirname $$i`; \
|
||||||
$(PERL) ../../util/pod2man.pl --section=$$sec --center=OpenSSL \
|
$(PERL) ../../util/pod2man.pl --section=$$sec --center=OpenSSL \
|
||||||
@@ -544,7 +739,7 @@ install_docs:
|
|||||||
done
|
done
|
||||||
@for i in doc/crypto/*.pod doc/ssl/*.pod; do \
|
@for i in doc/crypto/*.pod doc/ssl/*.pod; do \
|
||||||
fn=`basename $$i .pod`; \
|
fn=`basename $$i .pod`; \
|
||||||
sec=`[ "$$fn" = "des_modes" ] && echo 7 || echo 3`; \
|
if [ "$$fn" = "des_modes" ]; then sec=7; else sec=3; fi; \
|
||||||
echo "installing man$$sec/`basename $$i .pod`.$$sec"; \
|
echo "installing man$$sec/`basename $$i .pod`.$$sec"; \
|
||||||
(cd `dirname $$i`; \
|
(cd `dirname $$i`; \
|
||||||
$(PERL) ../../util/pod2man.pl --section=$$sec --center=OpenSSL \
|
$(PERL) ../../util/pod2man.pl --section=$$sec --center=OpenSSL \
|
||||||
|
|||||||
97
NEWS
97
NEWS
@@ -8,7 +8,97 @@
|
|||||||
Major changes between OpenSSL 0.9.6 and OpenSSL 0.9.7:
|
Major changes between OpenSSL 0.9.6 and OpenSSL 0.9.7:
|
||||||
|
|
||||||
o New library section OCSP.
|
o New library section OCSP.
|
||||||
o Complete haul-over of the ASN.1 library section.
|
o Complete rewrite of ASN1 code.
|
||||||
|
o CRL checking in verify code and openssl utility.
|
||||||
|
o Extension copying in 'ca' utility.
|
||||||
|
o Flexible display options in 'ca' utility.
|
||||||
|
o Provisional support for international characters with UTF8.
|
||||||
|
o Support for external crypto devices ('engine') is no longer
|
||||||
|
a separate distribution.
|
||||||
|
o New elliptic curve library section.
|
||||||
|
o New AES (Rijndael) library section.
|
||||||
|
o Change DES API to clean up the namespace (some applications link also
|
||||||
|
against libdes providing similar functions having the same name).
|
||||||
|
Provide macros for backward compatibility (will be removed in the
|
||||||
|
future).
|
||||||
|
o Unifiy handling of cryptographic algorithms (software and
|
||||||
|
engine) to be available via EVP routines for asymmetric and
|
||||||
|
symmetric ciphers.
|
||||||
|
o NCONF: new configuration handling routines.
|
||||||
|
o Change API to use more 'const' modifiers to improve error checking
|
||||||
|
and help optimizers.
|
||||||
|
o Finally remove references to RSAref.
|
||||||
|
o Reworked parts of the BIGNUM code.
|
||||||
|
o Support for new engines: Broadcom ubsec, Accelerated Encryption
|
||||||
|
Processing, IBM 4758.
|
||||||
|
o PRNG: query at more locations for a random device, automatic query for
|
||||||
|
EGD style random sources at several locations.
|
||||||
|
o SSL/TLS: allow optional cipher choice according to server's preference.
|
||||||
|
o SSL/TLS: allow server to explicitly set new session ids.
|
||||||
|
o SSL/TLS: support Kerberos cipher suites (RFC2712).
|
||||||
|
o SSL/TLS: allow more precise control of renegotiations and sessions.
|
||||||
|
o SSL/TLS: add callback to retrieve SSL/TLS messages.
|
||||||
|
o SSL/TLS: add draft AES ciphersuites (disabled unless explicitly requested).
|
||||||
|
|
||||||
|
Major changes between OpenSSL 0.9.6c and OpenSSL 0.9.6d:
|
||||||
|
|
||||||
|
o Various SSL/TLS library bugfixes.
|
||||||
|
o Fix DH parameter generation for 'non-standard' generators.
|
||||||
|
|
||||||
|
Major changes between OpenSSL 0.9.6b and OpenSSL 0.9.6c:
|
||||||
|
|
||||||
|
o Various SSL/TLS library bugfixes.
|
||||||
|
o BIGNUM library fixes.
|
||||||
|
o RSA OAEP and random number generation fixes.
|
||||||
|
o Object identifiers corrected and added.
|
||||||
|
o Add assembler BN routines for IA64.
|
||||||
|
o Add support for OS/390 Unix, UnixWare with gcc, OpenUNIX 8,
|
||||||
|
MIPS Linux; shared library support for Irix, HP-UX.
|
||||||
|
o Add crypto accelerator support for AEP, Baltimore SureWare,
|
||||||
|
Broadcom and Cryptographic Appliance's keyserver
|
||||||
|
[in 0.9.6c-engine release].
|
||||||
|
|
||||||
|
Major changes between OpenSSL 0.9.6a and OpenSSL 0.9.6b:
|
||||||
|
|
||||||
|
o Security fix: PRNG improvements.
|
||||||
|
o Security fix: RSA OAEP check.
|
||||||
|
o Security fix: Reinsert and fix countermeasure to Bleichbacher's
|
||||||
|
attack.
|
||||||
|
o MIPS bug fix in BIGNUM.
|
||||||
|
o Bug fix in "openssl enc".
|
||||||
|
o Bug fix in X.509 printing routine.
|
||||||
|
o Bug fix in DSA verification routine and DSA S/MIME verification.
|
||||||
|
o Bug fix to make PRNG thread-safe.
|
||||||
|
o Bug fix in RAND_file_name().
|
||||||
|
o Bug fix in compatibility mode trust settings.
|
||||||
|
o Bug fix in blowfish EVP.
|
||||||
|
o Increase default size for BIO buffering filter.
|
||||||
|
o Compatibility fixes in some scripts.
|
||||||
|
|
||||||
|
Major changes between OpenSSL 0.9.6 and OpenSSL 0.9.6a:
|
||||||
|
|
||||||
|
o Security fix: change behavior of OpenSSL to avoid using
|
||||||
|
environment variables when running as root.
|
||||||
|
o Security fix: check the result of RSA-CRT to reduce the
|
||||||
|
possibility of deducing the private key from an incorrectly
|
||||||
|
calculated signature.
|
||||||
|
o Security fix: prevent Bleichenbacher's DSA attack.
|
||||||
|
o Security fix: Zero the premaster secret after deriving the
|
||||||
|
master secret in DH ciphersuites.
|
||||||
|
o Reimplement SSL_peek(), which had various problems.
|
||||||
|
o Compatibility fix: the function des_encrypt() renamed to
|
||||||
|
des_encrypt1() to avoid clashes with some Unixen libc.
|
||||||
|
o Bug fixes for Win32, HP/UX and Irix.
|
||||||
|
o Bug fixes in BIGNUM, SSL, PKCS#7, PKCS#12, X.509, CONF and
|
||||||
|
memory checking routines.
|
||||||
|
o Bug fixes for RSA operations in threaded enviroments.
|
||||||
|
o Bug fixes in misc. openssl applications.
|
||||||
|
o Remove a few potential memory leaks.
|
||||||
|
o Add tighter checks of BIGNUM routines.
|
||||||
|
o Shared library support has been reworked for generality.
|
||||||
|
o More documentation.
|
||||||
|
o New function BN_rand_range().
|
||||||
|
o Add "-rand" option to openssl s_client and s_server.
|
||||||
|
|
||||||
Major changes between OpenSSL 0.9.5a and OpenSSL 0.9.6:
|
Major changes between OpenSSL 0.9.5a and OpenSSL 0.9.6:
|
||||||
|
|
||||||
@@ -19,9 +109,12 @@
|
|||||||
o New 'rsautl' application, low level RSA utility.
|
o New 'rsautl' application, low level RSA utility.
|
||||||
o MD4 now included.
|
o MD4 now included.
|
||||||
o Bugfix for SSL rollback padding check.
|
o Bugfix for SSL rollback padding check.
|
||||||
o Support for external crypto devices.
|
o Support for external crypto devices [1].
|
||||||
o Enhanced EVP interface.
|
o Enhanced EVP interface.
|
||||||
|
|
||||||
|
[1] The support for external crypto devices is currently a separate
|
||||||
|
distribution. See the file README.ENGINE.
|
||||||
|
|
||||||
Major changes between OpenSSL 0.9.5 and OpenSSL 0.9.5a:
|
Major changes between OpenSSL 0.9.5 and OpenSSL 0.9.5a:
|
||||||
|
|
||||||
o Bug fixes for Win32, SuSE Linux, NeXTSTEP and FreeBSD 2.2.8
|
o Bug fixes for Win32, SuSE Linux, NeXTSTEP and FreeBSD 2.2.8
|
||||||
|
|||||||
8
README
8
README
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
OpenSSL 0.9.7-dev 24 Sep 2000
|
OpenSSL 0.9.8-dev XX xxx XXXX
|
||||||
|
|
||||||
Copyright (c) 1998-2000 The OpenSSL Project
|
Copyright (c) 1998-2002 The OpenSSL Project
|
||||||
Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson
|
Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@
|
|||||||
|
|
||||||
X.509v3 certificates
|
X.509v3 certificates
|
||||||
X509 encoding/decoding into/from binary ASN1 and a PEM
|
X509 encoding/decoding into/from binary ASN1 and a PEM
|
||||||
based ascii-binary encoding which supports encryption with a
|
based ASCII-binary encoding which supports encryption with a
|
||||||
private key. Program to generate RSA and DSA certificate
|
private key. Program to generate RSA and DSA certificate
|
||||||
requests and to generate RSA and DSA certificates.
|
requests and to generate RSA and DSA certificates.
|
||||||
|
|
||||||
@@ -97,7 +97,7 @@
|
|||||||
locations around the world. _YOU_ are responsible for ensuring that your use
|
locations around the world. _YOU_ are responsible for ensuring that your use
|
||||||
of any algorithms is legal by checking if there are any patents in your
|
of any algorithms is legal by checking if there are any patents in your
|
||||||
country. The file contains some of the patents that we know about or are
|
country. The file contains some of the patents that we know about or are
|
||||||
rumoured to exist. This is not a definitive list.
|
rumored to exist. This is not a definitive list.
|
||||||
|
|
||||||
RSA Security holds software patents on the RC5 algorithm. If you
|
RSA Security holds software patents on the RC5 algorithm. If you
|
||||||
intend to use this cipher, you must contact RSA Security for
|
intend to use this cipher, you must contact RSA Security for
|
||||||
|
|||||||
290
README.ENGINE
290
README.ENGINE
@@ -1,43 +1,289 @@
|
|||||||
|
|
||||||
ENGINE
|
ENGINE
|
||||||
======
|
======
|
||||||
|
|
||||||
With OpenSSL 0.9.6, a new component has been added to support external
|
With OpenSSL 0.9.6, a new component was added to support alternative
|
||||||
crypto devices, for example accelerator cards. The component is called
|
cryptography implementations, most commonly for interfacing with external
|
||||||
ENGINE, and has still a pretty experimental status and almost no
|
crypto devices (eg. accelerator cards). This component is called ENGINE,
|
||||||
documentation. It's designed to be faily easily extensible by the
|
and its presence in OpenSSL 0.9.6 (and subsequent bug-fix releases)
|
||||||
calling programs.
|
caused a little confusion as 0.9.6** releases were rolled in two
|
||||||
|
versions, a "standard" and an "engine" version. In development for 0.9.7,
|
||||||
|
the ENGINE code has been merged into the main branch and will be present
|
||||||
|
in the standard releases from 0.9.7 forwards.
|
||||||
|
|
||||||
There's currently built-in support for the following crypto devices:
|
There are currently built-in ENGINE implementations for the following
|
||||||
|
crypto devices:
|
||||||
|
|
||||||
o CryptoSwift
|
o CryptoSwift
|
||||||
o Compaq Atalla
|
o Compaq Atalla
|
||||||
o nCipher CHIL
|
o nCipher CHIL
|
||||||
o Nuron
|
o Nuron
|
||||||
|
o Broadcom uBSec
|
||||||
|
|
||||||
A number of things are still needed and are being worked on:
|
In addition, dynamic binding to external ENGINE implementations is now
|
||||||
|
provided by a special ENGINE called "dynamic". See the "DYNAMIC ENGINE"
|
||||||
|
section below for details.
|
||||||
|
|
||||||
o A better way of handling the methods that are handled by the
|
At this stage, a number of things are still needed and are being worked on:
|
||||||
engines.
|
|
||||||
o Documentation!
|
1 Integration of EVP support.
|
||||||
|
2 Configuration support.
|
||||||
|
3 Documentation!
|
||||||
|
|
||||||
|
1 With respect to EVP, this relates to support for ciphers and digests in
|
||||||
|
the ENGINE model so that alternative implementations of existing
|
||||||
|
algorithms/modes (or previously unimplemented ones) can be provided by
|
||||||
|
ENGINE implementations.
|
||||||
|
|
||||||
|
2 Configuration support currently exists in the ENGINE API itself, in the
|
||||||
|
form of "control commands". These allow an application to expose to the
|
||||||
|
user/admin the set of commands and parameter types a given ENGINE
|
||||||
|
implementation supports, and for an application to directly feed string
|
||||||
|
based input to those ENGINEs, in the form of name-value pairs. This is an
|
||||||
|
extensible way for ENGINEs to define their own "configuration" mechanisms
|
||||||
|
that are specific to a given ENGINE (eg. for a particular hardware
|
||||||
|
device) but that should be consistent across *all* OpenSSL-based
|
||||||
|
applications when they use that ENGINE. Work is in progress (or at least
|
||||||
|
in planning) for supporting these control commands from the CONF (or
|
||||||
|
NCONF) code so that applications using OpenSSL's existing configuration
|
||||||
|
file format can have ENGINE settings specified in much the same way.
|
||||||
|
Presently however, applications must use the ENGINE API itself to provide
|
||||||
|
such functionality. To see first hand the types of commands available
|
||||||
|
with the various compiled-in ENGINEs (see further down for dynamic
|
||||||
|
ENGINEs), use the "engine" openssl utility with full verbosity, ie;
|
||||||
|
openssl engine -vvvv
|
||||||
|
|
||||||
|
3 Documentation? Volunteers welcome! The source code is reasonably well
|
||||||
|
self-documenting, but some summaries and usage instructions are needed -
|
||||||
|
moreover, they are needed in the same POD format the existing OpenSSL
|
||||||
|
documentation is provided in. Any complete or incomplete contributions
|
||||||
|
would help make this happen.
|
||||||
|
|
||||||
|
STABILITY & BUG-REPORTS
|
||||||
|
=======================
|
||||||
|
|
||||||
What already exists is fairly stable as far as it has been tested, but
|
What already exists is fairly stable as far as it has been tested, but
|
||||||
the test base has been a bit small most of the time.
|
the test base has been a bit small most of the time. For the most part,
|
||||||
|
the vendors of the devices these ENGINEs support have contributed to the
|
||||||
|
development and/or testing of the implementations, and *usually* (with no
|
||||||
|
guarantees) have experience in using the ENGINE support to drive their
|
||||||
|
devices from common OpenSSL-based applications. Bugs and/or inexplicable
|
||||||
|
behaviour in using a specific ENGINE implementation should be sent to the
|
||||||
|
author of that implementation (if it is mentioned in the corresponding C
|
||||||
|
file), and in the case of implementations for commercial hardware
|
||||||
|
devices, also through whatever vendor support channels are available. If
|
||||||
|
none of this is possible, or the problem seems to be something about the
|
||||||
|
ENGINE API itself (ie. not necessarily specific to a particular ENGINE
|
||||||
|
implementation) then you should mail complete details to the relevant
|
||||||
|
OpenSSL mailing list. For a definition of "complete details", refer to
|
||||||
|
the OpenSSL "README" file. As for which list to send it to;
|
||||||
|
|
||||||
|
openssl-users: if you are *using* the ENGINE abstraction, either in an
|
||||||
|
pre-compiled application or in your own application code.
|
||||||
|
|
||||||
No external crypto device is chosen unless you say so. You have actively
|
openssl-dev: if you are discussing problems with OpenSSL source code.
|
||||||
tell the openssl utility commands to use it through a new command line
|
|
||||||
switch called "-engine". And if you want to use the ENGINE library to
|
|
||||||
do something similar, you must also explicitely choose an external crypto
|
|
||||||
device, or the built-in crypto routines will be used, just as in the
|
|
||||||
default OpenSSL distribution.
|
|
||||||
|
|
||||||
|
USAGE
|
||||||
|
=====
|
||||||
|
|
||||||
|
The default "openssl" ENGINE is always chosen when performing crypto
|
||||||
|
operations unless you specify otherwise. You must actively tell the
|
||||||
|
openssl utility commands to use anything else through a new command line
|
||||||
|
switch called "-engine". Also, if you want to use the ENGINE support in
|
||||||
|
your own code to do something similar, you must likewise explicitly
|
||||||
|
select the ENGINE implementation you want.
|
||||||
|
|
||||||
|
Depending on the type of hardware, system, and configuration, "settings"
|
||||||
|
may need to be applied to an ENGINE for it to function as expected/hoped.
|
||||||
|
The recommended way of doing this is for the application to support
|
||||||
|
ENGINE "control commands" so that each ENGINE implementation can provide
|
||||||
|
whatever configuration primitives it might require and the application
|
||||||
|
can allow the user/admin (and thus the hardware vendor's support desk
|
||||||
|
also) to provide any such input directly to the ENGINE implementation.
|
||||||
|
This way, applications do not need to know anything specific to any
|
||||||
|
device, they only need to provide the means to carry such user/admin
|
||||||
|
input through to the ENGINE in question. Ie. this connects *you* (and
|
||||||
|
your helpdesk) to the specific ENGINE implementation (and device), and
|
||||||
|
allows application authors to not get buried in hassle supporting
|
||||||
|
arbitrary devices they know (and care) nothing about.
|
||||||
|
|
||||||
|
A new "openssl" utility, "openssl engine", has been added in that allows
|
||||||
|
for testing and examination of ENGINE implementations. Basic usage
|
||||||
|
instructions are available by specifying the "-?" command line switch.
|
||||||
|
|
||||||
|
DYNAMIC ENGINES
|
||||||
|
===============
|
||||||
|
|
||||||
|
The new "dynamic" ENGINE provides a low-overhead way to support ENGINE
|
||||||
|
implementations that aren't pre-compiled and linked into OpenSSL-based
|
||||||
|
applications. This could be because existing compiled-in implementations
|
||||||
|
have known problems and you wish to use a newer version with an existing
|
||||||
|
application. It could equally be because the application (or OpenSSL
|
||||||
|
library) you are using simply doesn't have support for the ENGINE you
|
||||||
|
wish to use, and the ENGINE provider (eg. hardware vendor) is providing
|
||||||
|
you with a self-contained implementation in the form of a shared-library.
|
||||||
|
The other use-case for "dynamic" is with applications that wish to
|
||||||
|
maintain the smallest foot-print possible and so do not link in various
|
||||||
|
ENGINE implementations from OpenSSL, but instead leaves you to provide
|
||||||
|
them, if you want them, in the form of "dynamic"-loadable
|
||||||
|
shared-libraries. It should be possible for hardware vendors to provide
|
||||||
|
their own shared-libraries to support arbitrary hardware to work with
|
||||||
|
applications based on OpenSSL 0.9.7 or later. If you're using an
|
||||||
|
application based on 0.9.7 (or later) and the support you desire is only
|
||||||
|
announced for versions later than the one you need, ask the vendor to
|
||||||
|
backport their ENGINE to the version you need.
|
||||||
|
|
||||||
|
How does "dynamic" work?
|
||||||
|
------------------------
|
||||||
|
The dynamic ENGINE has a special flag in its implementation such that
|
||||||
|
every time application code asks for the 'dynamic' ENGINE, it in fact
|
||||||
|
gets its own copy of it. As such, multi-threaded code (or code that
|
||||||
|
multiplexes multiple uses of 'dynamic' in a single application in any
|
||||||
|
way at all) does not get confused by 'dynamic' being used to do many
|
||||||
|
independent things. Other ENGINEs typically don't do this so there is
|
||||||
|
only ever 1 ENGINE structure of its type (and reference counts are used
|
||||||
|
to keep order). The dynamic ENGINE itself provides absolutely no
|
||||||
|
cryptographic functionality, and any attempt to "initialise" the ENGINE
|
||||||
|
automatically fails. All it does provide are a few "control commands"
|
||||||
|
that can be used to control how it will load an external ENGINE
|
||||||
|
implementation from a shared-library. To see these control commands,
|
||||||
|
use the command-line;
|
||||||
|
|
||||||
|
openssl engine -vvvv dynamic
|
||||||
|
|
||||||
|
The "SO_PATH" control command should be used to identify the
|
||||||
|
shared-library that contains the ENGINE implementation, and "NO_VCHECK"
|
||||||
|
might possibly be useful if there is a minor version conflict and you
|
||||||
|
(or a vendor helpdesk) is convinced you can safely ignore it.
|
||||||
|
"ENGINE_ID" is probably only needed if a shared-library implements
|
||||||
|
multiple ENGINEs, but if you know the engine id you expect to be using,
|
||||||
|
it doesn't hurt to specify it (and this provides a sanity check if
|
||||||
|
nothing else). "LIST_ADD" is only required if you actually wish the
|
||||||
|
loaded ENGINE to be discoverable by application code later on using the
|
||||||
|
ENGINE's "id". For most applications, this isn't necessary - but some
|
||||||
|
application authors may have nifty reasons for using it. The "LOAD"
|
||||||
|
command is the only one that takes no parameters and is the command
|
||||||
|
that uses the settings from any previous commands to actually *load*
|
||||||
|
the shared-library ENGINE implementation. If this command succeeds, the
|
||||||
|
(copy of the) 'dynamic' ENGINE will magically morph into the ENGINE
|
||||||
|
that has been loaded from the shared-library. As such, any control
|
||||||
|
commands supported by the loaded ENGINE could then be executed as per
|
||||||
|
normal. Eg. if ENGINE "foo" is implemented in the shared-library
|
||||||
|
"libfoo.so" and it supports some special control command "CMD_FOO", the
|
||||||
|
following code would load and use it (NB: obviously this code has no
|
||||||
|
error checking);
|
||||||
|
|
||||||
|
ENGINE *e = ENGINE_by_id("dynamic");
|
||||||
|
ENGINE_ctrl_cmd_string(e, "SO_PATH", "/lib/libfoo.so", 0);
|
||||||
|
ENGINE_ctrl_cmd_string(e, "ENGINE_ID", "foo", 0);
|
||||||
|
ENGINE_ctrl_cmd_string(e, "LOAD", NULL, 0);
|
||||||
|
ENGINE_ctrl_cmd_string(e, "CMD_FOO", "some input data", 0);
|
||||||
|
|
||||||
|
For testing, the "openssl engine" utility can be useful for this sort
|
||||||
|
of thing. For example the above code excerpt would achieve much the
|
||||||
|
same result as;
|
||||||
|
|
||||||
|
openssl engine dynamic \
|
||||||
|
-pre SO_PATH:/lib/libfoo.so \
|
||||||
|
-pre ENGINE_ID:foo \
|
||||||
|
-pre LOAD \
|
||||||
|
-pre "CMD_FOO:some input data"
|
||||||
|
|
||||||
|
Or to simply see the list of commands supported by the "foo" ENGINE;
|
||||||
|
|
||||||
|
openssl engine -vvvv dynamic \
|
||||||
|
-pre SO_PATH:/lib/libfoo.so \
|
||||||
|
-pre ENGINE_ID:foo \
|
||||||
|
-pre LOAD
|
||||||
|
|
||||||
|
Applications that support the ENGINE API and more specifically, the
|
||||||
|
"control commands" mechanism, will provide some way for you to pass
|
||||||
|
such commands through to ENGINEs. As such, you would select "dynamic"
|
||||||
|
as the ENGINE to use, and the parameters/commands you pass would
|
||||||
|
control the *actual* ENGINE used. Each command is actually a name-value
|
||||||
|
pair and the value can sometimes be omitted (eg. the "LOAD" command).
|
||||||
|
Whilst the syntax demonstrated in "openssl engine" uses a colon to
|
||||||
|
separate the command name from the value, applications may provide
|
||||||
|
their own syntax for making that separation (eg. a win32 registry
|
||||||
|
key-value pair may be used by some applications). The reason for the
|
||||||
|
"-pre" syntax in the "openssl engine" utility is that some commands
|
||||||
|
might be issued to an ENGINE *after* it has been initialised for use.
|
||||||
|
Eg. if an ENGINE implementation requires a smart-card to be inserted
|
||||||
|
during initialisation (or a PIN to be typed, or whatever), there may be
|
||||||
|
a control command you can issue afterwards to "forget" the smart-card
|
||||||
|
so that additional initialisation is no longer possible. In
|
||||||
|
applications such as web-servers, where potentially volatile code may
|
||||||
|
run on the same host system, this may provide some arguable security
|
||||||
|
value. In such a case, the command would be passed to the ENGINE after
|
||||||
|
it has been initialised for use, and so the "-post" switch would be
|
||||||
|
used instead. Applications may provide a different syntax for
|
||||||
|
supporting this distinction, and some may simply not provide it at all
|
||||||
|
("-pre" is almost always what you're after, in reality).
|
||||||
|
|
||||||
|
How do I build a "dynamic" ENGINE?
|
||||||
|
----------------------------------
|
||||||
|
This question is trickier - currently OpenSSL bundles various ENGINE
|
||||||
|
implementations that are statically built in, and any application that
|
||||||
|
calls the "ENGINE_load_builtin_engines()" function will automatically
|
||||||
|
have all such ENGINEs available (and occupying memory). Applications
|
||||||
|
that don't call that function have no ENGINEs available like that and
|
||||||
|
would have to use "dynamic" to load any such ENGINE - but on the other
|
||||||
|
hand such applications would only have the memory footprint of any
|
||||||
|
ENGINEs explicitly loaded using user/admin provided control commands.
|
||||||
|
The main advantage of not statically linking ENGINEs and only using
|
||||||
|
"dynamic" for hardware support is that any installation using no
|
||||||
|
"external" ENGINE suffers no unnecessary memory footprint from unused
|
||||||
|
ENGINEs. Likewise, installations that do require an ENGINE incur the
|
||||||
|
overheads from only *that* ENGINE once it has been loaded.
|
||||||
|
|
||||||
|
Sounds good? Maybe, but currently building an ENGINE implementation as
|
||||||
|
a shared-library that can be loaded by "dynamic" isn't automated in
|
||||||
|
OpenSSL's build process. It can be done manually quite easily however.
|
||||||
|
Such a shared-library can either be built with any OpenSSL code it
|
||||||
|
needs statically linked in, or it can link dynamically against OpenSSL
|
||||||
|
if OpenSSL itself is built as a shared library. The instructions are
|
||||||
|
the same in each case, but in the former (statically linked any
|
||||||
|
dependencies on OpenSSL) you must ensure OpenSSL is built with
|
||||||
|
position-independent code ("PIC"). The default OpenSSL compilation may
|
||||||
|
already specify the relevant flags to do this, but you should consult
|
||||||
|
with your compiler documentation if you are in any doubt.
|
||||||
|
|
||||||
|
This example will show building the "atalla" ENGINE in the
|
||||||
|
crypto/engine/ directory as a shared-library for use via the "dynamic"
|
||||||
|
ENGINE.
|
||||||
|
1) "cd" to the crypto/engine/ directory of a pre-compiled OpenSSL
|
||||||
|
source tree.
|
||||||
|
2) Recompile at least one source file so you can see all the compiler
|
||||||
|
flags (and syntax) being used to build normally. Eg;
|
||||||
|
touch hw_atalla.c ; make
|
||||||
|
will rebuild "hw_atalla.o" using all such flags.
|
||||||
|
3) Manually enter the same compilation line to compile the
|
||||||
|
"hw_atalla.c" file but with the following two changes;
|
||||||
|
(a) add "-DENGINE_DYNAMIC_SUPPORT" to the command line switches,
|
||||||
|
(b) change the output file from "hw_atalla.o" to something new,
|
||||||
|
eg. "tmp_atalla.o"
|
||||||
|
4) Link "tmp_atalla.o" into a shared-library using the top-level
|
||||||
|
OpenSSL libraries to resolve any dependencies. The syntax for doing
|
||||||
|
this depends heavily on your system/compiler and is a nightmare
|
||||||
|
known well to anyone who has worked with shared-library portability
|
||||||
|
before. 'gcc' on Linux, for example, would use the following syntax;
|
||||||
|
gcc -shared -o dyn_atalla.so tmp_atalla.o -L../.. -lcrypto
|
||||||
|
5) Test your shared library using "openssl engine" as explained in the
|
||||||
|
previous section. Eg. from the top-level directory, you might try;
|
||||||
|
apps/openssl engine -vvvv dynamic \
|
||||||
|
-pre SO_PATH:./crypto/engine/dyn_atalla.so -pre LOAD
|
||||||
|
If the shared-library loads successfully, you will see both "-pre"
|
||||||
|
commands marked as "SUCCESS" and the list of control commands
|
||||||
|
displayed (because of "-vvvv") will be the control commands for the
|
||||||
|
*atalla* ENGINE (ie. *not* the 'dynamic' ENGINE). You can also add
|
||||||
|
the "-t" switch to the utility if you want it to try and initialise
|
||||||
|
the atalla ENGINE for use to test any possible hardware/driver
|
||||||
|
issues.
|
||||||
|
|
||||||
PROBLEMS
|
PROBLEMS
|
||||||
========
|
========
|
||||||
|
|
||||||
It seems like the ENGINE part doesn't work too well with Cryptoswift on
|
It seems like the ENGINE part doesn't work too well with CryptoSwift on Win32.
|
||||||
Win32. A quick test done right before the release showed that trying
|
A quick test done right before the release showed that trying "openssl speed
|
||||||
"openssl speed -engine cswift" generated errors. If the DSO gets enabled,
|
-engine cswift" generated errors. If the DSO gets enabled, an attempt is made
|
||||||
an attempt is made to write at memory address 0x00000002.
|
to write at memory address 0x00000002.
|
||||||
|
|
||||||
|
|||||||
61
STATUS
61
STATUS
@@ -1,11 +1,14 @@
|
|||||||
|
|
||||||
OpenSSL STATUS Last modified at
|
OpenSSL STATUS Last modified at
|
||||||
______________ $Date: 2001/02/22 15:10:11 $
|
______________ $Date: 2002/05/16 10:01:53 $
|
||||||
|
|
||||||
DEVELOPMENT STATE
|
DEVELOPMENT STATE
|
||||||
|
|
||||||
o OpenSSL 0.9.7: Under development...
|
o OpenSSL 0.9.7: Under development...
|
||||||
o OpenSSL 0.9.6a: Bugfix release -- under development...
|
o OpenSSL 0.9.6d: Released on May 9th, 2002
|
||||||
|
o OpenSSL 0.9.6c: Released on December 21st, 2001
|
||||||
|
o OpenSSL 0.9.6b: Released on July 9th, 2001
|
||||||
|
o OpenSSL 0.9.6a: Released on April 5th, 2001
|
||||||
o OpenSSL 0.9.6: Released on September 24th, 2000
|
o OpenSSL 0.9.6: Released on September 24th, 2000
|
||||||
o OpenSSL 0.9.5a: Released on April 1st, 2000
|
o OpenSSL 0.9.5a: Released on April 1st, 2000
|
||||||
o OpenSSL 0.9.5: Released on February 28th, 2000
|
o OpenSSL 0.9.5: Released on February 28th, 2000
|
||||||
@@ -15,9 +18,12 @@
|
|||||||
o OpenSSL 0.9.2b: Released on March 22th, 1999
|
o OpenSSL 0.9.2b: Released on March 22th, 1999
|
||||||
o OpenSSL 0.9.1c: Released on December 23th, 1998
|
o OpenSSL 0.9.1c: Released on December 23th, 1998
|
||||||
|
|
||||||
|
[See also http://www.openssl.org/support/rt2.html]
|
||||||
|
|
||||||
RELEASE SHOWSTOPPERS
|
RELEASE SHOWSTOPPERS
|
||||||
|
|
||||||
o
|
o BN_mod_mul verification fails for mips3-sgi-irix
|
||||||
|
unless configured with no-asm
|
||||||
|
|
||||||
AVAILABLE PATCHES
|
AVAILABLE PATCHES
|
||||||
|
|
||||||
@@ -36,31 +42,24 @@
|
|||||||
o Geoff and Richard are currently working on:
|
o Geoff and Richard are currently working on:
|
||||||
ENGINE (the new code that gives hardware support among others).
|
ENGINE (the new code that gives hardware support among others).
|
||||||
o Richard is currently working on:
|
o Richard is currently working on:
|
||||||
|
UI (User Interface)
|
||||||
UTIL (a new set of library functions to support some higher level
|
UTIL (a new set of library functions to support some higher level
|
||||||
functionality that is currently missing).
|
functionality that is currently missing).
|
||||||
Shared library support for VMS.
|
Shared library support for VMS.
|
||||||
OCSP
|
|
||||||
Kerberos 5 authentication
|
Kerberos 5 authentication
|
||||||
Constification
|
Constification
|
||||||
|
OCSP
|
||||||
|
|
||||||
NEEDS PATCH
|
NEEDS PATCH
|
||||||
|
|
||||||
o apps/ca.c: "Sign the certificate?" - "n" creates empty certificate file
|
o apps/ca.c: "Sign the certificate?" - "n" creates empty certificate file
|
||||||
|
|
||||||
o OpenSSL_0_9_6-stable:
|
o "OpenSSL STATUS" is never up-to-date.
|
||||||
#include <openssl/e_os.h> in exported header files is illegal since
|
|
||||||
e_os.h is suitable only for library-internal use.
|
|
||||||
|
|
||||||
o Whenever strncpy is used, make sure the resulting string is NULL-terminated
|
|
||||||
or an error is reported
|
|
||||||
|
|
||||||
OPEN ISSUES
|
OPEN ISSUES
|
||||||
|
|
||||||
o crypto/ex_data.c is not really thread-safe and so must be used
|
o Do we want the EVP API changes in 0.9.7?
|
||||||
with care (e.g., extra locking where necessary, or don't call
|
Can compatibility be improved?
|
||||||
CRYPTO_get_ex_new_index once multiple threads exist).
|
|
||||||
The current API is not suitable for everything that it pretends
|
|
||||||
to offer.
|
|
||||||
|
|
||||||
o The Makefile hierarchy and build mechanism is still not a round thing:
|
o The Makefile hierarchy and build mechanism is still not a round thing:
|
||||||
|
|
||||||
@@ -86,22 +85,20 @@
|
|||||||
which apparently is not flexible enough to generate
|
which apparently is not flexible enough to generate
|
||||||
libcrypto)
|
libcrypto)
|
||||||
|
|
||||||
|
|
||||||
o The perl/ stuff needs a major overhaul. Currently it's
|
|
||||||
totally obsolete. Either we clean it up and enhance it to be up-to-date
|
|
||||||
with the C code or we also could replace it with the really nice
|
|
||||||
Net::SSLeay package we can find under
|
|
||||||
http://www.neuronio.pt/SSLeay.pm.html. Ralf uses this package for a
|
|
||||||
longer time and it works fine and is a nice Perl module. Best would be
|
|
||||||
to convince the author to work for the OpenSSL project and create a
|
|
||||||
Net::OpenSSL or Crypt::OpenSSL package out of it and maintains it for
|
|
||||||
us.
|
|
||||||
|
|
||||||
Status: Ralf thinks we should both contact the author of Net::SSLeay
|
|
||||||
and look how much effort it is to bring Eric's perl/ stuff up
|
|
||||||
to date.
|
|
||||||
Paul +1
|
|
||||||
|
|
||||||
WISHES
|
WISHES
|
||||||
|
|
||||||
o
|
o Add variants of DH_generate_parameters() and BN_generate_prime() [etc?]
|
||||||
|
where the callback function can request that the function be aborted.
|
||||||
|
[Gregory Stark <ghstark@pobox.com>, <rayyang2000@yahoo.com>]
|
||||||
|
|
||||||
|
o SRP in TLS.
|
||||||
|
[wished by:
|
||||||
|
Dj <derek@yo.net>, Tom Wu <tom@arcot.com>,
|
||||||
|
Tom Holroyd <tomh@po.crl.go.jp>]
|
||||||
|
|
||||||
|
See http://search.ietf.org/internet-drafts/draft-ietf-tls-srp-00.txt
|
||||||
|
as well as http://www-cs-students.stanford.edu/~tjw/srp/.
|
||||||
|
|
||||||
|
Tom Holroyd tells us there is a SRP patch for OpenSSH at
|
||||||
|
http://members.tripod.com/professor_tom/archives/, that could
|
||||||
|
be useful.
|
||||||
|
|||||||
353
VMS/mkshared.com
Normal file
353
VMS/mkshared.com
Normal file
@@ -0,0 +1,353 @@
|
|||||||
|
$! MKSHARED.COM -- script to created shareable images on VMS
|
||||||
|
$!
|
||||||
|
$! No command line parameters. This should be run at the start of the source
|
||||||
|
$! tree (the same directory where one finds INSTALL.VMS).
|
||||||
|
$!
|
||||||
|
$! Input: [.UTIL]LIBEAY.NUM,[.AXP.EXE.CRYPTO]LIBCRYPTO.OLB
|
||||||
|
$! [.UTIL]SSLEAY.NUM,[.AXP.EXE.SSL]LIBSSL.OLB
|
||||||
|
$! Output: [.AXP.EXE.CRYPTO]LIBCRYPTO.OPT,.MAP,.EXE
|
||||||
|
$! [.AXP.EXE.SSL]LIBSSL.OPT,.MAP,.EXE
|
||||||
|
$!
|
||||||
|
$! So far, tests have only been made on VMS for Alpha. VAX will come in time.
|
||||||
|
$! ===========================================================================
|
||||||
|
$
|
||||||
|
$! ----- Prepare info for processing: version number and file info
|
||||||
|
$ gosub read_version_info
|
||||||
|
$ if libver .eqs. ""
|
||||||
|
$ then
|
||||||
|
$ write sys$error "ERROR: Couldn't find any library version info..."
|
||||||
|
$ exit
|
||||||
|
$ endif
|
||||||
|
$
|
||||||
|
$ if f$getsyi("CPU") .ge. 128
|
||||||
|
$ then
|
||||||
|
$ libid = "Crypto"
|
||||||
|
$ libnum = "[.UTIL]LIBEAY.NUM"
|
||||||
|
$ libdir = "[.AXP.EXE.CRYPTO]"
|
||||||
|
$ libolb = "''libdir'LIBCRYPTO.OLB"
|
||||||
|
$ libopt = "''libdir'LIBCRYPTO.OPT"
|
||||||
|
$ libmap = "''libdir'LIBCRYPTO.MAP"
|
||||||
|
$ libgoal= "''libdir'LIBCRYPTO.EXE"
|
||||||
|
$ libref = ""
|
||||||
|
$ gosub create_axp_shr
|
||||||
|
$ libid = "SSL"
|
||||||
|
$ libnum = "[.UTIL]SSLEAY.NUM"
|
||||||
|
$ libdir = "[.AXP.EXE.SSL]"
|
||||||
|
$ libolb = "''libdir'LIBSSL.OLB"
|
||||||
|
$ libopt = "''libdir'LIBSSL.OPT"
|
||||||
|
$ libmap = "''libdir'LIBSSL.MAP"
|
||||||
|
$ libgoal= "''libdir'LIBSSL.EXE"
|
||||||
|
$ libref = "[.AXP.EXE.CRYPTO]LIBCRYPTO.EXE"
|
||||||
|
$ gosub create_axp_shr
|
||||||
|
$ else
|
||||||
|
$ libtit = "CRYPTO_TRANSFER_VECTOR"
|
||||||
|
$ libid = "Crypto"
|
||||||
|
$ libnum = "[.UTIL]LIBEAY.NUM"
|
||||||
|
$ libdir = "[.VAX.EXE.CRYPTO]"
|
||||||
|
$ libmar = "''libdir'LIBCRYPTO.MAR"
|
||||||
|
$ libolb = "''libdir'LIBCRYPTO.OLB"
|
||||||
|
$ libopt = "''libdir'LIBCRYPTO.OPT"
|
||||||
|
$ libobj = "''libdir'LIBCRYPTO.OBJ"
|
||||||
|
$ libmap = "''libdir'LIBCRYPTO.MAP"
|
||||||
|
$ libgoal= "''libdir'LIBCRYPTO.EXE"
|
||||||
|
$ libref = ""
|
||||||
|
$ libvec = "LIBCRYPTO"
|
||||||
|
$ gosub create_vax_shr
|
||||||
|
$ libtit = "SSL_TRANSFER_VECTOR"
|
||||||
|
$ libid = "SSL"
|
||||||
|
$ libnum = "[.UTIL]SSLEAY.NUM"
|
||||||
|
$ libdir = "[.VAX.EXE.SSL]"
|
||||||
|
$ libmar = "''libdir'LIBSSL.MAR"
|
||||||
|
$ libolb = "''libdir'LIBSSL.OLB"
|
||||||
|
$ libopt = "''libdir'LIBSSL.OPT"
|
||||||
|
$ libobj = "''libdir'LIBSSL.OBJ"
|
||||||
|
$ libmap = "''libdir'LIBSSL.MAP"
|
||||||
|
$ libgoal= "''libdir'LIBSSL.EXE"
|
||||||
|
$ libref = "[.VAX.EXE.CRYPTO]LIBCRYPTO.EXE"
|
||||||
|
$ libvec = "LIBSSL"
|
||||||
|
$ gosub create_vax_shr
|
||||||
|
$ endif
|
||||||
|
$ exit
|
||||||
|
$
|
||||||
|
$! ----- Soubroutines to actually build the shareable libraries
|
||||||
|
$! The way things work, there's a main shareable library creator for each
|
||||||
|
$! supported architecture, which is called from the main code above.
|
||||||
|
$! The creator will define a number of variables to tell the next levels of
|
||||||
|
$! subroutines what routines to use to write to the option files, call the
|
||||||
|
$! main processor, read_func_num, and when that is done, it will write version
|
||||||
|
$! data at the end of the .opt file, close it, and link the library.
|
||||||
|
$!
|
||||||
|
$! read_func_num reads through a .num file and calls the writer routine for
|
||||||
|
$! each line. It's also responsible for checking that order is properly kept
|
||||||
|
$! in the .num file, check that each line applies to VMS and the architecture,
|
||||||
|
$! and to fill in "holes" with dummy entries.
|
||||||
|
$!
|
||||||
|
$! The creator routines depend on the following variables:
|
||||||
|
$! libnum The name of the .num file to use as input
|
||||||
|
$! libolb The name of the object library to build from
|
||||||
|
$! libid The identification string of the shareable library
|
||||||
|
$! libopt The name of the .opt file to write
|
||||||
|
$! libtit The title of the assembler transfer vector file (VAX only)
|
||||||
|
$! libmar The name of the assembler transfer vector file (VAX only)
|
||||||
|
$! libmap The name of the map file to write
|
||||||
|
$! libgoal The name of the shareable library to write
|
||||||
|
$! libref The name of a shareable library to link in
|
||||||
|
$!
|
||||||
|
$! read_func_num depends on the following variables from the creator:
|
||||||
|
$! libwriter The name of the writer routine to call for each .num file line
|
||||||
|
$! -----
|
||||||
|
$
|
||||||
|
$! ----- Subroutines for AXP
|
||||||
|
$! -----
|
||||||
|
$! The creator routine
|
||||||
|
$ create_axp_shr:
|
||||||
|
$ open/write opt 'libopt'
|
||||||
|
$ write opt "identification=""",libid," ",libverstr,""""
|
||||||
|
$ write opt libolb,"/lib"
|
||||||
|
$ if libref .nes. "" then write opt libref,"/SHARE"
|
||||||
|
$ write opt "SYMBOL_VECTOR=(-"
|
||||||
|
$ libfirstentry := true
|
||||||
|
$ libwrch := opt
|
||||||
|
$ libwriter := write_axp_transfer_entry
|
||||||
|
$ textcount = 0
|
||||||
|
$ gosub read_func_num
|
||||||
|
$ write opt ")"
|
||||||
|
$ write opt "GSMATCH=",libvmatch,",",libver
|
||||||
|
$ close opt
|
||||||
|
$ link/map='libmap'/full/share='libgoal' 'libopt'/option
|
||||||
|
$ return
|
||||||
|
$
|
||||||
|
$! The record writer routine
|
||||||
|
$ write_axp_transfer_entry:
|
||||||
|
$ if libentry .eqs. ".dummy" then return
|
||||||
|
$ if info_kind .eqs. "VARIABLE"
|
||||||
|
$ then
|
||||||
|
$ pr:=DATA
|
||||||
|
$ else
|
||||||
|
$ pr:=PROCEDURE
|
||||||
|
$ endif
|
||||||
|
$ textcount_this = f$length(pr) + f$length(libentry) + 5
|
||||||
|
$ if textcount + textcount_this .gt. 1024
|
||||||
|
$ then
|
||||||
|
$ write opt ")"
|
||||||
|
$ write opt "SYMBOL_VECTOR=(-"
|
||||||
|
$ textcount = 16
|
||||||
|
$ libfirstentry := true
|
||||||
|
$ endif
|
||||||
|
$ if libfirstentry
|
||||||
|
$ then
|
||||||
|
$ write 'libwrch' " ",libentry,"=",pr," -"
|
||||||
|
$ else
|
||||||
|
$ write 'libwrch' " ,",libentry,"=",pr," -"
|
||||||
|
$ endif
|
||||||
|
$ libfirstentry := false
|
||||||
|
$ textcount = textcount + textcount_this
|
||||||
|
$ return
|
||||||
|
$
|
||||||
|
$! ----- Subroutines for AXP
|
||||||
|
$! -----
|
||||||
|
$! The creator routine
|
||||||
|
$ create_vax_shr:
|
||||||
|
$ open/write mar 'libmar'
|
||||||
|
$ type sys$input:/out=mar:
|
||||||
|
;
|
||||||
|
; Transfer vector for VAX shareable image
|
||||||
|
;
|
||||||
|
$ write mar " .TITLE ",libtit
|
||||||
|
$ write mar " .IDENT /",libid,"/"
|
||||||
|
$ type sys$input:/out=mar:
|
||||||
|
;
|
||||||
|
; Define macro to assist in building transfer vector entries. Each entry
|
||||||
|
; should take no more than 8 bytes.
|
||||||
|
;
|
||||||
|
.MACRO FTRANSFER_ENTRY routine
|
||||||
|
.ALIGN QUAD
|
||||||
|
.TRANSFER routine
|
||||||
|
.MASK routine
|
||||||
|
JMP routine+2
|
||||||
|
.ENDM FTRANSFER_ENTRY
|
||||||
|
;
|
||||||
|
; Place entries in own program section.
|
||||||
|
;
|
||||||
|
$ write mar " .PSECT $$",libvec,",QUAD,PIC,USR,CON,REL,LCL,SHR,EXE,RD,NOWRT"
|
||||||
|
$ write mar libvec,"_xfer:"
|
||||||
|
$ libwrch := mar
|
||||||
|
$ libwriter := write_vax_ftransfer_entry
|
||||||
|
$ gosub read_func_num
|
||||||
|
$ type sys$input:/out=mar:
|
||||||
|
;
|
||||||
|
; Allocate extra storage at end of vector to allow for expansion.
|
||||||
|
;
|
||||||
|
$ write mar " .BLKB 32768-<.-",libvec,"_xfer> ; 64 pages total."
|
||||||
|
$! libwriter := write_vax_vtransfer_entry
|
||||||
|
$! gosub read_func_num
|
||||||
|
$ write mar " .END"
|
||||||
|
$ close mar
|
||||||
|
$ open/write opt 'libopt'
|
||||||
|
$ write opt "identification=""",libid," ",libverstr,""""
|
||||||
|
$ write opt libobj
|
||||||
|
$ write opt libolb,"/lib"
|
||||||
|
$ if libref .nes. "" then write opt libref,"/SHARE"
|
||||||
|
$ type sys$input:/out=opt:
|
||||||
|
!
|
||||||
|
! Ensure transfer vector is at beginning of image
|
||||||
|
!
|
||||||
|
CLUSTER=FIRST
|
||||||
|
$ write opt "COLLECT=FIRST,$$",libvec
|
||||||
|
$ write opt "GSMATCH=",libvmatch,",",libver
|
||||||
|
$ type sys$input:/out=opt:
|
||||||
|
!
|
||||||
|
! make psects nonshareable so image can be installed.
|
||||||
|
!
|
||||||
|
PSECT_ATTR=$CHAR_STRING_CONSTANTS,NOWRT
|
||||||
|
$ libwrch := opt
|
||||||
|
$ libwriter := write_vax_psect_attr
|
||||||
|
$ gosub read_func_num
|
||||||
|
$ close opt
|
||||||
|
$ macro/obj='libobj' 'libmar'
|
||||||
|
$ link/map='libmap'/full/share='libgoal' 'libopt'/option
|
||||||
|
$ return
|
||||||
|
$
|
||||||
|
$! The record writer routine for VAX functions
|
||||||
|
$ write_vax_ftransfer_entry:
|
||||||
|
$ if info_kind .nes. "FUNCTION" then return
|
||||||
|
$ if libentry .eqs ".dummy"
|
||||||
|
$ then
|
||||||
|
$ write 'libwrch' " .BLKB 8" ! Dummy is zeroes...
|
||||||
|
$ else
|
||||||
|
$ write 'libwrch' " FTRANSFER_ENTRY ",libentry
|
||||||
|
$ endif
|
||||||
|
$ return
|
||||||
|
$! The record writer routine for VAX variables (should never happen!)
|
||||||
|
$ write_vax_psect_attr:
|
||||||
|
$ if info_kind .nes. "VARIABLE" then return
|
||||||
|
$ if libentry .eqs ".dummy" then return
|
||||||
|
$ write 'libwrch' "PSECT_ATTR=",libentry,",NOSHR"
|
||||||
|
$ return
|
||||||
|
$
|
||||||
|
$! ----- Common subroutines
|
||||||
|
$! -----
|
||||||
|
$! The .num file reader. This one has great responsability.
|
||||||
|
$ read_func_num:
|
||||||
|
$ open libnum 'libnum'
|
||||||
|
$ goto read_nums
|
||||||
|
$
|
||||||
|
$ read_nums:
|
||||||
|
$ libentrynum=0
|
||||||
|
$ liblastentry:=false
|
||||||
|
$ entrycount=0
|
||||||
|
$ loop:
|
||||||
|
$ read/end=loop_end/err=loop_end libnum line
|
||||||
|
$ entrynum=f$int(f$element(1," ",f$edit(line,"COMPRESS,TRIM")))
|
||||||
|
$ entryinfo=f$element(2," ",f$edit(line,"COMPRESS,TRIM"))
|
||||||
|
$ curentry=f$element(0," ",f$edit(line,"COMPRESS,TRIM"))
|
||||||
|
$ info_exist=f$element(0,":",entryinfo)
|
||||||
|
$ info_platforms=","+f$element(1,":",entryinfo)+","
|
||||||
|
$ info_kind=f$element(2,":",entryinfo)
|
||||||
|
$ info_algorithms=","+f$element(3,":",entryinfo)+","
|
||||||
|
$ if info_exist .eqs. "NOEXIST" then goto loop
|
||||||
|
$ truesum = 0
|
||||||
|
$ falsesum = 0
|
||||||
|
$ negatives = 1
|
||||||
|
$ plat_i = 0
|
||||||
|
$ loop1:
|
||||||
|
$ plat_entry = f$element(plat_i,",",info_platforms)
|
||||||
|
$ plat_i = plat_i + 1
|
||||||
|
$ if plat_entry .eqs. "" then goto loop1
|
||||||
|
$ if plat_entry .nes. ","
|
||||||
|
$ then
|
||||||
|
$ if f$extract(0,1,plat_entry) .nes. "!" then negatives = 0
|
||||||
|
$ if f$getsyi("CPU") .lt. 128
|
||||||
|
$ then
|
||||||
|
$ if plat_entry .eqs. "EXPORT_VAR_AS_FUNCTION" then -
|
||||||
|
$ truesum = truesum + 1
|
||||||
|
$ if plat_entry .eqs. "!EXPORT_VAR_AS_FUNCTION" then -
|
||||||
|
$ falsesum = falsesum + 1
|
||||||
|
$ endif
|
||||||
|
$ if plat_entry .eqs. "VMS" then truesum = truesum + 1
|
||||||
|
$ if plat_entry .eqs. "!VMS" then falsesum = falsesum + 1
|
||||||
|
$ goto loop1
|
||||||
|
$ endif
|
||||||
|
$ endloop1:
|
||||||
|
$!DEBUG!$ if info_platforms - "EXPORT_VAR_AS_FUNCTION" .nes. info_platforms
|
||||||
|
$!DEBUG!$ then
|
||||||
|
$!DEBUG!$ write sys$output line
|
||||||
|
$!DEBUG!$ write sys$output " truesum = ",truesum,-
|
||||||
|
$!DEBUG! ", negatives = ",negatives,", falsesum = ",falsesum
|
||||||
|
$!DEBUG!$ endif
|
||||||
|
$ if falsesum .ne. 0 then goto loop
|
||||||
|
$ if truesum+negatives .eq. 0 then goto loop
|
||||||
|
$ alg_i = 0
|
||||||
|
$ loop2:
|
||||||
|
$ alg_entry = f$element(alg_i,",",info_algorithms)
|
||||||
|
$ alg_i = alg_i + 1
|
||||||
|
$ if alg_entry .eqs. "" then goto loop2
|
||||||
|
$ if alg_entry .nes. ","
|
||||||
|
$ then
|
||||||
|
$ if alg_entry .eqs. "KRB5" then goto loop ! Special for now
|
||||||
|
$ if f$trnlnm("OPENSSL_NO_"+alg_entry) .nes. "" then goto loop
|
||||||
|
$ goto loop2
|
||||||
|
$ endif
|
||||||
|
$ endloop2:
|
||||||
|
$ if info_platforms - "EXPORT_VAR_AS_FUNCTION" .nes. info_platforms
|
||||||
|
$ then
|
||||||
|
$!DEBUG!$ write sys$output curentry," ; ",entrynum," ; ",entryinfo
|
||||||
|
$ endif
|
||||||
|
$ redo:
|
||||||
|
$ next:=loop
|
||||||
|
$ tolibentry=curentry
|
||||||
|
$ if libentrynum .ne. entrynum
|
||||||
|
$ then
|
||||||
|
$ entrycount=entrycount+1
|
||||||
|
$ if entrycount .lt. entrynum
|
||||||
|
$ then
|
||||||
|
$!DEBUG!$ write sys$output "Info: entrycount: ''entrycount', entrynum: ''entrynum' => 0"
|
||||||
|
$ tolibentry=".dummy"
|
||||||
|
$ next:=redo
|
||||||
|
$ endif
|
||||||
|
$ if entrycount .gt. entrynum
|
||||||
|
$ then
|
||||||
|
$ write sys$error "Decreasing library entry numbers! Can't continue"
|
||||||
|
$ write sys$error """",line,""""
|
||||||
|
$ close libnum
|
||||||
|
$ return
|
||||||
|
$ endif
|
||||||
|
$ libentry=tolibentry
|
||||||
|
$!DEBUG!$ write sys$output entrycount," ",libentry," ",entryinfo
|
||||||
|
$ if libentry .nes. "" .and. libwriter .nes. "" then gosub 'libwriter'
|
||||||
|
$ else
|
||||||
|
$ write sys$error "Info: ""''curentry'"" is an alias for ""''libentry'"". Overriding..."
|
||||||
|
$ endif
|
||||||
|
$ libentrynum=entrycount
|
||||||
|
$ goto 'next'
|
||||||
|
$ loop_end:
|
||||||
|
$ close libnum
|
||||||
|
$ return
|
||||||
|
$
|
||||||
|
$! The version number reader
|
||||||
|
$ read_version_info:
|
||||||
|
$ libver = ""
|
||||||
|
$ open/read vf [.CRYPTO]OPENSSLV.H
|
||||||
|
$ loop_rvi:
|
||||||
|
$ read/err=endloop_rvi/end=endloop_rvi vf rvi_line
|
||||||
|
$ if rvi_line - "SHLIB_VERSION_NUMBER """ .eqs. rvi_line then -
|
||||||
|
goto loop_rvi
|
||||||
|
$ libverstr = f$element(1,"""",rvi_line)
|
||||||
|
$ libvmajor = f$element(0,".",libverstr)
|
||||||
|
$ libvminor = f$element(1,".",libverstr)
|
||||||
|
$ libvedit = f$element(2,".",libverstr)
|
||||||
|
$ libvpatch = f$cvui(0,8,f$extract(1,1,libvedit)+"@")-f$cvui(0,8,"@")
|
||||||
|
$ libvedit = f$extract(0,1,libvedit)
|
||||||
|
$ libver = f$string(f$int(libvmajor)*100)+","+-
|
||||||
|
f$string(f$int(libvminor)*100+f$int(libvedit)*10+f$int(libvpatch))
|
||||||
|
$ if libvmajor .eqs. "0"
|
||||||
|
$ then
|
||||||
|
$ libvmatch = "EQUAL"
|
||||||
|
$ else
|
||||||
|
$ ! Starting with the 1.0 release, backward compatibility should be
|
||||||
|
$ ! kept, so switch over to the following
|
||||||
|
$ libvmatch = "LEQUAL"
|
||||||
|
$ endif
|
||||||
|
$ endloop_rvi:
|
||||||
|
$ close vf
|
||||||
|
$ return
|
||||||
1264
apps/Makefile.ssl
1264
apps/Makefile.ssl
File diff suppressed because it is too large
Load Diff
523
apps/apps.c
523
apps/apps.c
@@ -55,6 +55,59 @@
|
|||||||
* copied and put under another distribution licence
|
* copied and put under another distribution licence
|
||||||
* [including the GNU Public Licence.]
|
* [including the GNU Public Licence.]
|
||||||
*/
|
*/
|
||||||
|
/* ====================================================================
|
||||||
|
* Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in
|
||||||
|
* the documentation and/or other materials provided with the
|
||||||
|
* distribution.
|
||||||
|
*
|
||||||
|
* 3. All advertising materials mentioning features or use of this
|
||||||
|
* software must display the following acknowledgment:
|
||||||
|
* "This product includes software developed by the OpenSSL Project
|
||||||
|
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
||||||
|
*
|
||||||
|
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||||
|
* endorse or promote products derived from this software without
|
||||||
|
* prior written permission. For written permission, please contact
|
||||||
|
* openssl-core@openssl.org.
|
||||||
|
*
|
||||||
|
* 5. Products derived from this software may not be called "OpenSSL"
|
||||||
|
* nor may "OpenSSL" appear in their names without prior written
|
||||||
|
* permission of the OpenSSL Project.
|
||||||
|
*
|
||||||
|
* 6. Redistributions of any form whatsoever must retain the following
|
||||||
|
* acknowledgment:
|
||||||
|
* "This product includes software developed by the OpenSSL Project
|
||||||
|
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||||
|
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||||
|
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||||
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||||
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
* ====================================================================
|
||||||
|
*
|
||||||
|
* This product includes cryptographic software written by Eric Young
|
||||||
|
* (eay@cryptsoft.com). This product includes software written by Tim
|
||||||
|
* Hudson (tjh@cryptsoft.com).
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -66,9 +119,12 @@
|
|||||||
#undef NON_MAIN
|
#undef NON_MAIN
|
||||||
#include <openssl/err.h>
|
#include <openssl/err.h>
|
||||||
#include <openssl/x509.h>
|
#include <openssl/x509.h>
|
||||||
|
#include <openssl/x509v3.h>
|
||||||
#include <openssl/pem.h>
|
#include <openssl/pem.h>
|
||||||
#include <openssl/pkcs12.h>
|
#include <openssl/pkcs12.h>
|
||||||
|
#include <openssl/ui.h>
|
||||||
#include <openssl/safestack.h>
|
#include <openssl/safestack.h>
|
||||||
|
#include <openssl/engine.h>
|
||||||
|
|
||||||
#ifdef OPENSSL_SYS_WINDOWS
|
#ifdef OPENSSL_SYS_WINDOWS
|
||||||
#define strcasecmp _stricmp
|
#define strcasecmp _stricmp
|
||||||
@@ -86,7 +142,17 @@ typedef struct {
|
|||||||
unsigned long mask;
|
unsigned long mask;
|
||||||
} NAME_EX_TBL;
|
} NAME_EX_TBL;
|
||||||
|
|
||||||
|
static UI_METHOD *ui_method = NULL;
|
||||||
|
|
||||||
static int set_table_opts(unsigned long *flags, const char *arg, const NAME_EX_TBL *in_tbl);
|
static int set_table_opts(unsigned long *flags, const char *arg, const NAME_EX_TBL *in_tbl);
|
||||||
|
static int set_multi_opts(unsigned long *flags, const char *arg, const NAME_EX_TBL *in_tbl);
|
||||||
|
|
||||||
|
#if !defined(OPENSSL_NO_RC4) && !defined(OPENSSL_NO_RSA)
|
||||||
|
/* Looks like this stuff is worth moving into separate function */
|
||||||
|
static EVP_PKEY *
|
||||||
|
load_netscape_key(BIO *err, BIO *key, const char *file,
|
||||||
|
const char *key_descrip, int format);
|
||||||
|
#endif
|
||||||
|
|
||||||
int app_init(long mesgwin);
|
int app_init(long mesgwin);
|
||||||
#ifdef undef /* never finished - probably never will be :-) */
|
#ifdef undef /* never finished - probably never will be :-) */
|
||||||
@@ -267,16 +333,13 @@ void program_name(char *in, char *out, int size)
|
|||||||
#ifdef OPENSSL_SYS_WIN32
|
#ifdef OPENSSL_SYS_WIN32
|
||||||
int WIN32_rename(char *from, char *to)
|
int WIN32_rename(char *from, char *to)
|
||||||
{
|
{
|
||||||
#ifdef OPENSSL_SYS_WINNT
|
/* Windows rename gives an error if 'to' exists, so delete it
|
||||||
int ret;
|
* first and ignore file not found errror
|
||||||
/* Note: MoveFileEx() doesn't work under Win95, Win98 */
|
*/
|
||||||
|
if((remove(to) != 0) && (errno != ENOENT))
|
||||||
ret=MoveFileEx(from,to,MOVEFILE_REPLACE_EXISTING|MOVEFILE_COPY_ALLOWED);
|
return -1;
|
||||||
return(ret?0:-1);
|
#undef rename
|
||||||
#else
|
return rename(from, to);
|
||||||
unlink(to);
|
|
||||||
return MoveFile(from, to);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -367,6 +430,159 @@ int dump_cert_text (BIO *out, X509 *x)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int ui_open(UI *ui)
|
||||||
|
{
|
||||||
|
return UI_method_get_opener(UI_OpenSSL())(ui);
|
||||||
|
}
|
||||||
|
static int ui_read(UI *ui, UI_STRING *uis)
|
||||||
|
{
|
||||||
|
if (UI_get_input_flags(uis) & UI_INPUT_FLAG_DEFAULT_PWD
|
||||||
|
&& UI_get0_user_data(ui))
|
||||||
|
{
|
||||||
|
switch(UI_get_string_type(uis))
|
||||||
|
{
|
||||||
|
case UIT_PROMPT:
|
||||||
|
case UIT_VERIFY:
|
||||||
|
{
|
||||||
|
const char *password =
|
||||||
|
((PW_CB_DATA *)UI_get0_user_data(ui))->password;
|
||||||
|
if (password[0] != '\0')
|
||||||
|
{
|
||||||
|
UI_set_result(ui, uis, password);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return UI_method_get_reader(UI_OpenSSL())(ui, uis);
|
||||||
|
}
|
||||||
|
static int ui_write(UI *ui, UI_STRING *uis)
|
||||||
|
{
|
||||||
|
if (UI_get_input_flags(uis) & UI_INPUT_FLAG_DEFAULT_PWD
|
||||||
|
&& UI_get0_user_data(ui))
|
||||||
|
{
|
||||||
|
switch(UI_get_string_type(uis))
|
||||||
|
{
|
||||||
|
case UIT_PROMPT:
|
||||||
|
case UIT_VERIFY:
|
||||||
|
{
|
||||||
|
const char *password =
|
||||||
|
((PW_CB_DATA *)UI_get0_user_data(ui))->password;
|
||||||
|
if (password[0] != '\0')
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return UI_method_get_writer(UI_OpenSSL())(ui, uis);
|
||||||
|
}
|
||||||
|
static int ui_close(UI *ui)
|
||||||
|
{
|
||||||
|
return UI_method_get_closer(UI_OpenSSL())(ui);
|
||||||
|
}
|
||||||
|
int setup_ui_method()
|
||||||
|
{
|
||||||
|
ui_method = UI_create_method("OpenSSL application user interface");
|
||||||
|
UI_method_set_opener(ui_method, ui_open);
|
||||||
|
UI_method_set_reader(ui_method, ui_read);
|
||||||
|
UI_method_set_writer(ui_method, ui_write);
|
||||||
|
UI_method_set_closer(ui_method, ui_close);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
void destroy_ui_method()
|
||||||
|
{
|
||||||
|
if(ui_method)
|
||||||
|
{
|
||||||
|
UI_destroy_method(ui_method);
|
||||||
|
ui_method = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int password_callback(char *buf, int bufsiz, int verify,
|
||||||
|
PW_CB_DATA *cb_tmp)
|
||||||
|
{
|
||||||
|
UI *ui = NULL;
|
||||||
|
int res = 0;
|
||||||
|
const char *prompt_info = NULL;
|
||||||
|
const char *password = NULL;
|
||||||
|
PW_CB_DATA *cb_data = (PW_CB_DATA *)cb_tmp;
|
||||||
|
|
||||||
|
if (cb_data)
|
||||||
|
{
|
||||||
|
if (cb_data->password)
|
||||||
|
password = cb_data->password;
|
||||||
|
if (cb_data->prompt_info)
|
||||||
|
prompt_info = cb_data->prompt_info;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (password)
|
||||||
|
{
|
||||||
|
res = strlen(password);
|
||||||
|
if (res > bufsiz)
|
||||||
|
res = bufsiz;
|
||||||
|
memcpy(buf, password, res);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
ui = UI_new_method(ui_method);
|
||||||
|
if (ui)
|
||||||
|
{
|
||||||
|
int ok = 0;
|
||||||
|
char *buff = NULL;
|
||||||
|
int ui_flags = 0;
|
||||||
|
char *prompt = NULL;
|
||||||
|
|
||||||
|
prompt = UI_construct_prompt(ui, "pass phrase",
|
||||||
|
cb_data->prompt_info);
|
||||||
|
|
||||||
|
ui_flags |= UI_INPUT_FLAG_DEFAULT_PWD;
|
||||||
|
UI_ctrl(ui, UI_CTRL_PRINT_ERRORS, 1, 0, 0);
|
||||||
|
|
||||||
|
if (ok >= 0)
|
||||||
|
ok = UI_add_input_string(ui,prompt,ui_flags,buf,
|
||||||
|
PW_MIN_LENGTH,BUFSIZ-1);
|
||||||
|
if (ok >= 0 && verify)
|
||||||
|
{
|
||||||
|
buff = (char *)OPENSSL_malloc(bufsiz);
|
||||||
|
ok = UI_add_verify_string(ui,prompt,ui_flags,buff,
|
||||||
|
PW_MIN_LENGTH,BUFSIZ-1, buf);
|
||||||
|
}
|
||||||
|
if (ok >= 0)
|
||||||
|
do
|
||||||
|
{
|
||||||
|
ok = UI_process(ui);
|
||||||
|
}
|
||||||
|
while (ok < 0 && UI_ctrl(ui, UI_CTRL_IS_REDOABLE, 0, 0, 0));
|
||||||
|
|
||||||
|
if (buff)
|
||||||
|
{
|
||||||
|
memset(buff,0,(unsigned int)bufsiz);
|
||||||
|
OPENSSL_free(buff);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ok >= 0)
|
||||||
|
res = strlen(buf);
|
||||||
|
if (ok == -1)
|
||||||
|
{
|
||||||
|
BIO_printf(bio_err, "User interface error\n");
|
||||||
|
ERR_print_errors(bio_err);
|
||||||
|
memset(buf,0,(unsigned int)bufsiz);
|
||||||
|
res = 0;
|
||||||
|
}
|
||||||
|
if (ok == -2)
|
||||||
|
{
|
||||||
|
BIO_printf(bio_err,"aborted!\n");
|
||||||
|
memset(buf,0,(unsigned int)bufsiz);
|
||||||
|
res = 0;
|
||||||
|
}
|
||||||
|
UI_free(ui);
|
||||||
|
OPENSSL_free(prompt);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
static char *app_get_pass(BIO *err, char *arg, int keepbio);
|
static char *app_get_pass(BIO *err, char *arg, int keepbio);
|
||||||
|
|
||||||
int app_passwd(BIO *err, char *arg1, char *arg2, char **pass1, char **pass2)
|
int app_passwd(BIO *err, char *arg1, char *arg2, char **pass1, char **pass2)
|
||||||
@@ -442,18 +658,18 @@ static char *app_get_pass(BIO *err, char *arg, int keepbio)
|
|||||||
return BUF_strdup(tpass);
|
return BUF_strdup(tpass);
|
||||||
}
|
}
|
||||||
|
|
||||||
int add_oid_section(BIO *err, LHASH *conf)
|
int add_oid_section(BIO *err, CONF *conf)
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
STACK_OF(CONF_VALUE) *sktmp;
|
STACK_OF(CONF_VALUE) *sktmp;
|
||||||
CONF_VALUE *cnf;
|
CONF_VALUE *cnf;
|
||||||
int i;
|
int i;
|
||||||
if(!(p=CONF_get_string(conf,NULL,"oid_section")))
|
if(!(p=NCONF_get_string(conf,NULL,"oid_section")))
|
||||||
{
|
{
|
||||||
ERR_clear_error();
|
ERR_clear_error();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if(!(sktmp = CONF_get_section(conf, p))) {
|
if(!(sktmp = NCONF_get_section(conf, p))) {
|
||||||
BIO_printf(err, "problem loading oid section %s\n", p);
|
BIO_printf(err, "problem loading oid section %s\n", p);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -468,7 +684,8 @@ int add_oid_section(BIO *err, LHASH *conf)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
X509 *load_cert(BIO *err, char *file, int format)
|
X509 *load_cert(BIO *err, const char *file, int format,
|
||||||
|
const char *pass, ENGINE *e, const char *cert_descrip)
|
||||||
{
|
{
|
||||||
ASN1_HEADER *ah=NULL;
|
ASN1_HEADER *ah=NULL;
|
||||||
BUF_MEM *buf=NULL;
|
BUF_MEM *buf=NULL;
|
||||||
@@ -490,7 +707,9 @@ X509 *load_cert(BIO *err, char *file, int format)
|
|||||||
{
|
{
|
||||||
if (BIO_read_filename(cert,file) <= 0)
|
if (BIO_read_filename(cert,file) <= 0)
|
||||||
{
|
{
|
||||||
perror(file);
|
BIO_printf(err, "Error opening %s %s\n",
|
||||||
|
cert_descrip, file);
|
||||||
|
ERR_print_errors(err);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -541,7 +760,8 @@ X509 *load_cert(BIO *err, char *file, int format)
|
|||||||
ah->data=NULL;
|
ah->data=NULL;
|
||||||
}
|
}
|
||||||
else if (format == FORMAT_PEM)
|
else if (format == FORMAT_PEM)
|
||||||
x=PEM_read_bio_X509_AUX(cert,NULL,NULL,NULL);
|
x=PEM_read_bio_X509_AUX(cert,NULL,
|
||||||
|
(pem_password_cb *)password_callback, NULL);
|
||||||
else if (format == FORMAT_PKCS12)
|
else if (format == FORMAT_PKCS12)
|
||||||
{
|
{
|
||||||
PKCS12 *p12 = d2i_PKCS12_bio(cert, NULL);
|
PKCS12 *p12 = d2i_PKCS12_bio(cert, NULL);
|
||||||
@@ -551,7 +771,8 @@ X509 *load_cert(BIO *err, char *file, int format)
|
|||||||
p12 = NULL;
|
p12 = NULL;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
BIO_printf(err,"bad input format specified for input cert\n");
|
BIO_printf(err,"bad input format specified for %s\n",
|
||||||
|
cert_descrip);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
end:
|
end:
|
||||||
@@ -566,10 +787,15 @@ end:
|
|||||||
return(x);
|
return(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
EVP_PKEY *load_key(BIO *err, char *file, int format, char *pass, ENGINE *e)
|
EVP_PKEY *load_key(BIO *err, const char *file, int format,
|
||||||
|
const char *pass, ENGINE *e, const char *key_descrip)
|
||||||
{
|
{
|
||||||
BIO *key=NULL;
|
BIO *key=NULL;
|
||||||
EVP_PKEY *pkey=NULL;
|
EVP_PKEY *pkey=NULL;
|
||||||
|
PW_CB_DATA cb_data;
|
||||||
|
|
||||||
|
cb_data.password = pass;
|
||||||
|
cb_data.prompt_info = file;
|
||||||
|
|
||||||
if (file == NULL)
|
if (file == NULL)
|
||||||
{
|
{
|
||||||
@@ -581,7 +807,8 @@ EVP_PKEY *load_key(BIO *err, char *file, int format, char *pass, ENGINE *e)
|
|||||||
if (!e)
|
if (!e)
|
||||||
BIO_printf(bio_err,"no engine specified\n");
|
BIO_printf(bio_err,"no engine specified\n");
|
||||||
else
|
else
|
||||||
pkey = ENGINE_load_private_key(e, file, pass);
|
pkey = ENGINE_load_private_key(e, file,
|
||||||
|
ui_method, &cb_data);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
key=BIO_new(BIO_s_file());
|
key=BIO_new(BIO_s_file());
|
||||||
@@ -592,7 +819,8 @@ EVP_PKEY *load_key(BIO *err, char *file, int format, char *pass, ENGINE *e)
|
|||||||
}
|
}
|
||||||
if (BIO_read_filename(key,file) <= 0)
|
if (BIO_read_filename(key,file) <= 0)
|
||||||
{
|
{
|
||||||
perror(file);
|
BIO_printf(err, "Error opening %s %s\n", key_descrip, file);
|
||||||
|
ERR_print_errors(err);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
if (format == FORMAT_ASN1)
|
if (format == FORMAT_ASN1)
|
||||||
@@ -601,8 +829,13 @@ EVP_PKEY *load_key(BIO *err, char *file, int format, char *pass, ENGINE *e)
|
|||||||
}
|
}
|
||||||
else if (format == FORMAT_PEM)
|
else if (format == FORMAT_PEM)
|
||||||
{
|
{
|
||||||
pkey=PEM_read_bio_PrivateKey(key,NULL,NULL,pass);
|
pkey=PEM_read_bio_PrivateKey(key,NULL,
|
||||||
|
(pem_password_cb *)password_callback, &cb_data);
|
||||||
}
|
}
|
||||||
|
#if !defined(OPENSSL_NO_RC4) && !defined(OPENSSL_NO_RSA)
|
||||||
|
else if (format == FORMAT_NETSCAPE || format == FORMAT_IISSGC)
|
||||||
|
pkey = load_netscape_key(err, key, file, key_descrip, format);
|
||||||
|
#endif
|
||||||
else if (format == FORMAT_PKCS12)
|
else if (format == FORMAT_PKCS12)
|
||||||
{
|
{
|
||||||
PKCS12 *p12 = d2i_PKCS12_bio(key, NULL);
|
PKCS12 *p12 = d2i_PKCS12_bio(key, NULL);
|
||||||
@@ -613,20 +846,25 @@ EVP_PKEY *load_key(BIO *err, char *file, int format, char *pass, ENGINE *e)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
BIO_printf(err,"bad input format specified for key\n");
|
BIO_printf(err,"bad input format specified for key file\n");
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
end:
|
end:
|
||||||
if (key != NULL) BIO_free(key);
|
if (key != NULL) BIO_free(key);
|
||||||
if (pkey == NULL)
|
if (pkey == NULL)
|
||||||
BIO_printf(err,"unable to load Private Key\n");
|
BIO_printf(err,"unable to load %s\n", key_descrip);
|
||||||
return(pkey);
|
return(pkey);
|
||||||
}
|
}
|
||||||
|
|
||||||
EVP_PKEY *load_pubkey(BIO *err, char *file, int format, ENGINE *e)
|
EVP_PKEY *load_pubkey(BIO *err, const char *file, int format,
|
||||||
|
const char *pass, ENGINE *e, const char *key_descrip)
|
||||||
{
|
{
|
||||||
BIO *key=NULL;
|
BIO *key=NULL;
|
||||||
EVP_PKEY *pkey=NULL;
|
EVP_PKEY *pkey=NULL;
|
||||||
|
PW_CB_DATA cb_data;
|
||||||
|
|
||||||
|
cb_data.password = pass;
|
||||||
|
cb_data.prompt_info = file;
|
||||||
|
|
||||||
if (file == NULL)
|
if (file == NULL)
|
||||||
{
|
{
|
||||||
@@ -638,7 +876,8 @@ EVP_PKEY *load_pubkey(BIO *err, char *file, int format, ENGINE *e)
|
|||||||
if (!e)
|
if (!e)
|
||||||
BIO_printf(bio_err,"no engine specified\n");
|
BIO_printf(bio_err,"no engine specified\n");
|
||||||
else
|
else
|
||||||
pkey = ENGINE_load_public_key(e, file, NULL);
|
pkey = ENGINE_load_public_key(e, file,
|
||||||
|
ui_method, &cb_data);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
key=BIO_new(BIO_s_file());
|
key=BIO_new(BIO_s_file());
|
||||||
@@ -649,7 +888,8 @@ EVP_PKEY *load_pubkey(BIO *err, char *file, int format, ENGINE *e)
|
|||||||
}
|
}
|
||||||
if (BIO_read_filename(key,file) <= 0)
|
if (BIO_read_filename(key,file) <= 0)
|
||||||
{
|
{
|
||||||
perror(file);
|
BIO_printf(err, "Error opening %s %s\n", key_descrip, file);
|
||||||
|
ERR_print_errors(err);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
if (format == FORMAT_ASN1)
|
if (format == FORMAT_ASN1)
|
||||||
@@ -658,27 +898,83 @@ EVP_PKEY *load_pubkey(BIO *err, char *file, int format, ENGINE *e)
|
|||||||
}
|
}
|
||||||
else if (format == FORMAT_PEM)
|
else if (format == FORMAT_PEM)
|
||||||
{
|
{
|
||||||
pkey=PEM_read_bio_PUBKEY(key,NULL,NULL,NULL);
|
pkey=PEM_read_bio_PUBKEY(key,NULL,
|
||||||
|
(pem_password_cb *)password_callback, &cb_data);
|
||||||
}
|
}
|
||||||
|
#if !defined(OPENSSL_NO_RC4) && !defined(OPENSSL_NO_RSA)
|
||||||
|
else if (format == FORMAT_NETSCAPE || format == FORMAT_IISSGC)
|
||||||
|
pkey = load_netscape_key(err, key, file, key_descrip, format);
|
||||||
|
#endif
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
BIO_printf(err,"bad input format specified for key\n");
|
BIO_printf(err,"bad input format specified for key file\n");
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
end:
|
end:
|
||||||
if (key != NULL) BIO_free(key);
|
if (key != NULL) BIO_free(key);
|
||||||
if (pkey == NULL)
|
if (pkey == NULL)
|
||||||
BIO_printf(err,"unable to load Public Key\n");
|
BIO_printf(err,"unable to load %s\n", key_descrip);
|
||||||
return(pkey);
|
return(pkey);
|
||||||
}
|
}
|
||||||
|
|
||||||
STACK_OF(X509) *load_certs(BIO *err, char *file, int format)
|
#if !defined(OPENSSL_NO_RC4) && !defined(OPENSSL_NO_RSA)
|
||||||
|
EVP_PKEY *
|
||||||
|
load_netscape_key(BIO *err, BIO *key, const char *file,
|
||||||
|
const char *key_descrip, int format)
|
||||||
|
{
|
||||||
|
EVP_PKEY *pkey;
|
||||||
|
BUF_MEM *buf;
|
||||||
|
RSA *rsa;
|
||||||
|
const unsigned char *p;
|
||||||
|
int size, i;
|
||||||
|
|
||||||
|
buf=BUF_MEM_new();
|
||||||
|
pkey = EVP_PKEY_new();
|
||||||
|
size = 0;
|
||||||
|
if (buf == NULL || pkey == NULL)
|
||||||
|
goto error;
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
if (!BUF_MEM_grow(buf,size+1024*10))
|
||||||
|
goto error;
|
||||||
|
i = BIO_read(key, &(buf->data[size]), 1024*10);
|
||||||
|
size += i;
|
||||||
|
if (i == 0)
|
||||||
|
break;
|
||||||
|
if (i < 0)
|
||||||
|
{
|
||||||
|
BIO_printf(err, "Error reading %s %s",
|
||||||
|
key_descrip, file);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
p=(unsigned char *)buf->data;
|
||||||
|
rsa = d2i_RSA_NET(NULL,&p,(long)size,NULL,
|
||||||
|
(format == FORMAT_IISSGC ? 1 : 0));
|
||||||
|
if (rsa == NULL)
|
||||||
|
goto error;
|
||||||
|
BUF_MEM_free(buf);
|
||||||
|
EVP_PKEY_set1_RSA(pkey, rsa);
|
||||||
|
return pkey;
|
||||||
|
error:
|
||||||
|
BUF_MEM_free(buf);
|
||||||
|
EVP_PKEY_free(pkey);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
#endif /* ndef OPENSSL_NO_RC4 */
|
||||||
|
|
||||||
|
STACK_OF(X509) *load_certs(BIO *err, const char *file, int format,
|
||||||
|
const char *pass, ENGINE *e, const char *cert_descrip)
|
||||||
{
|
{
|
||||||
BIO *certs;
|
BIO *certs;
|
||||||
int i;
|
int i;
|
||||||
STACK_OF(X509) *othercerts = NULL;
|
STACK_OF(X509) *othercerts = NULL;
|
||||||
STACK_OF(X509_INFO) *allcerts = NULL;
|
STACK_OF(X509_INFO) *allcerts = NULL;
|
||||||
X509_INFO *xi;
|
X509_INFO *xi;
|
||||||
|
PW_CB_DATA cb_data;
|
||||||
|
|
||||||
|
cb_data.password = pass;
|
||||||
|
cb_data.prompt_info = file;
|
||||||
|
|
||||||
if((certs = BIO_new(BIO_s_file())) == NULL)
|
if((certs = BIO_new(BIO_s_file())) == NULL)
|
||||||
{
|
{
|
||||||
@@ -692,7 +988,9 @@ STACK_OF(X509) *load_certs(BIO *err, char *file, int format)
|
|||||||
{
|
{
|
||||||
if (BIO_read_filename(certs,file) <= 0)
|
if (BIO_read_filename(certs,file) <= 0)
|
||||||
{
|
{
|
||||||
perror(file);
|
BIO_printf(err, "Error opening %s %s\n",
|
||||||
|
cert_descrip, file);
|
||||||
|
ERR_print_errors(err);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -706,7 +1004,8 @@ STACK_OF(X509) *load_certs(BIO *err, char *file, int format)
|
|||||||
othercerts = NULL;
|
othercerts = NULL;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
allcerts = PEM_X509_INFO_read_bio(certs, NULL, NULL, NULL);
|
allcerts = PEM_X509_INFO_read_bio(certs, NULL,
|
||||||
|
(pem_password_cb *)password_callback, &cb_data);
|
||||||
for(i = 0; i < sk_X509_INFO_num(allcerts); i++)
|
for(i = 0; i < sk_X509_INFO_num(allcerts); i++)
|
||||||
{
|
{
|
||||||
xi = sk_X509_INFO_value (allcerts, i);
|
xi = sk_X509_INFO_value (allcerts, i);
|
||||||
@@ -719,7 +1018,8 @@ STACK_OF(X509) *load_certs(BIO *err, char *file, int format)
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
BIO_printf(err,"bad input format specified for input cert\n");
|
BIO_printf(err,"bad input format specified for %s\n",
|
||||||
|
cert_descrip);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
end:
|
end:
|
||||||
@@ -744,10 +1044,14 @@ end:
|
|||||||
/* BIO_dump unknown extensions */
|
/* BIO_dump unknown extensions */
|
||||||
#define X509V3_EXT_DUMP_UNKNOWN (3L << 16)
|
#define X509V3_EXT_DUMP_UNKNOWN (3L << 16)
|
||||||
|
|
||||||
|
#define X509_FLAG_CA (X509_FLAG_NO_ISSUER | X509_FLAG_NO_PUBKEY | \
|
||||||
|
X509_FLAG_NO_HEADER | X509_FLAG_NO_VERSION)
|
||||||
|
|
||||||
int set_cert_ex(unsigned long *flags, const char *arg)
|
int set_cert_ex(unsigned long *flags, const char *arg)
|
||||||
{
|
{
|
||||||
static const NAME_EX_TBL cert_tbl[] = {
|
static const NAME_EX_TBL cert_tbl[] = {
|
||||||
{ "compatible", X509_FLAG_COMPAT, 0xffffffffl},
|
{ "compatible", X509_FLAG_COMPAT, 0xffffffffl},
|
||||||
|
{ "ca_default", X509_FLAG_CA, 0xffffffffl},
|
||||||
{ "no_header", X509_FLAG_NO_HEADER, 0},
|
{ "no_header", X509_FLAG_NO_HEADER, 0},
|
||||||
{ "no_version", X509_FLAG_NO_VERSION, 0},
|
{ "no_version", X509_FLAG_NO_VERSION, 0},
|
||||||
{ "no_serial", X509_FLAG_NO_SERIAL, 0},
|
{ "no_serial", X509_FLAG_NO_SERIAL, 0},
|
||||||
@@ -765,7 +1069,7 @@ int set_cert_ex(unsigned long *flags, const char *arg)
|
|||||||
{ "ext_dump", X509V3_EXT_DUMP_UNKNOWN, X509V3_EXT_UNKNOWN_MASK},
|
{ "ext_dump", X509V3_EXT_DUMP_UNKNOWN, X509V3_EXT_UNKNOWN_MASK},
|
||||||
{ NULL, 0, 0}
|
{ NULL, 0, 0}
|
||||||
};
|
};
|
||||||
return set_table_opts(flags, arg, cert_tbl);
|
return set_multi_opts(flags, arg, cert_tbl);
|
||||||
}
|
}
|
||||||
|
|
||||||
int set_name_ex(unsigned long *flags, const char *arg)
|
int set_name_ex(unsigned long *flags, const char *arg)
|
||||||
@@ -790,15 +1094,89 @@ int set_name_ex(unsigned long *flags, const char *arg)
|
|||||||
{ "nofname", XN_FLAG_FN_NONE, XN_FLAG_FN_MASK},
|
{ "nofname", XN_FLAG_FN_NONE, XN_FLAG_FN_MASK},
|
||||||
{ "sname", XN_FLAG_FN_SN, XN_FLAG_FN_MASK},
|
{ "sname", XN_FLAG_FN_SN, XN_FLAG_FN_MASK},
|
||||||
{ "lname", XN_FLAG_FN_LN, XN_FLAG_FN_MASK},
|
{ "lname", XN_FLAG_FN_LN, XN_FLAG_FN_MASK},
|
||||||
|
{ "align", XN_FLAG_FN_ALIGN, 0},
|
||||||
{ "oid", XN_FLAG_FN_OID, XN_FLAG_FN_MASK},
|
{ "oid", XN_FLAG_FN_OID, XN_FLAG_FN_MASK},
|
||||||
{ "space_eq", XN_FLAG_SPC_EQ, 0},
|
{ "space_eq", XN_FLAG_SPC_EQ, 0},
|
||||||
{ "dump_unknown", XN_FLAG_DUMP_UNKNOWN_FIELDS, 0},
|
{ "dump_unknown", XN_FLAG_DUMP_UNKNOWN_FIELDS, 0},
|
||||||
{ "RFC2253", XN_FLAG_RFC2253, 0xffffffffL},
|
{ "RFC2253", XN_FLAG_RFC2253, 0xffffffffL},
|
||||||
{ "oneline", XN_FLAG_ONELINE, 0xffffffffL},
|
{ "oneline", XN_FLAG_ONELINE, 0xffffffffL},
|
||||||
{ "multiline", XN_FLAG_MULTILINE, 0xffffffffL},
|
{ "multiline", XN_FLAG_MULTILINE, 0xffffffffL},
|
||||||
|
{ "ca_default", XN_FLAG_MULTILINE, 0xffffffffL},
|
||||||
{ NULL, 0, 0}
|
{ NULL, 0, 0}
|
||||||
};
|
};
|
||||||
return set_table_opts(flags, arg, ex_tbl);
|
return set_multi_opts(flags, arg, ex_tbl);
|
||||||
|
}
|
||||||
|
|
||||||
|
int set_ext_copy(int *copy_type, const char *arg)
|
||||||
|
{
|
||||||
|
if (!strcasecmp(arg, "none"))
|
||||||
|
*copy_type = EXT_COPY_NONE;
|
||||||
|
else if (!strcasecmp(arg, "copy"))
|
||||||
|
*copy_type = EXT_COPY_ADD;
|
||||||
|
else if (!strcasecmp(arg, "copyall"))
|
||||||
|
*copy_type = EXT_COPY_ALL;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int copy_extensions(X509 *x, X509_REQ *req, int copy_type)
|
||||||
|
{
|
||||||
|
STACK_OF(X509_EXTENSION) *exts = NULL;
|
||||||
|
X509_EXTENSION *ext, *tmpext;
|
||||||
|
ASN1_OBJECT *obj;
|
||||||
|
int i, idx, ret = 0;
|
||||||
|
if (!x || !req || (copy_type == EXT_COPY_NONE))
|
||||||
|
return 1;
|
||||||
|
exts = X509_REQ_get_extensions(req);
|
||||||
|
|
||||||
|
for(i = 0; i < sk_X509_EXTENSION_num(exts); i++) {
|
||||||
|
ext = sk_X509_EXTENSION_value(exts, i);
|
||||||
|
obj = X509_EXTENSION_get_object(ext);
|
||||||
|
idx = X509_get_ext_by_OBJ(x, obj, -1);
|
||||||
|
/* Does extension exist? */
|
||||||
|
if (idx != -1) {
|
||||||
|
/* If normal copy don't override existing extension */
|
||||||
|
if (copy_type == EXT_COPY_ADD)
|
||||||
|
continue;
|
||||||
|
/* Delete all extensions of same type */
|
||||||
|
do {
|
||||||
|
tmpext = X509_get_ext(x, idx);
|
||||||
|
X509_delete_ext(x, idx);
|
||||||
|
X509_EXTENSION_free(tmpext);
|
||||||
|
idx = X509_get_ext_by_OBJ(x, obj, -1);
|
||||||
|
} while (idx != -1);
|
||||||
|
}
|
||||||
|
if (!X509_add_ext(x, ext, -1))
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = 1;
|
||||||
|
|
||||||
|
end:
|
||||||
|
|
||||||
|
sk_X509_EXTENSION_pop_free(exts, X509_EXTENSION_free);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static int set_multi_opts(unsigned long *flags, const char *arg, const NAME_EX_TBL *in_tbl)
|
||||||
|
{
|
||||||
|
STACK_OF(CONF_VALUE) *vals;
|
||||||
|
CONF_VALUE *val;
|
||||||
|
int i, ret = 1;
|
||||||
|
if(!arg) return 0;
|
||||||
|
vals = X509V3_parse_list(arg);
|
||||||
|
for (i = 0; i < sk_CONF_VALUE_num(vals); i++) {
|
||||||
|
val = sk_CONF_VALUE_value(vals, i);
|
||||||
|
if (!set_table_opts(flags, val->name, in_tbl))
|
||||||
|
ret = 0;
|
||||||
|
}
|
||||||
|
sk_CONF_VALUE_pop_free(vals, X509V3_conf_free);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int set_table_opts(unsigned long *flags, const char *arg, const NAME_EX_TBL *in_tbl)
|
static int set_table_opts(unsigned long *flags, const char *arg, const NAME_EX_TBL *in_tbl)
|
||||||
@@ -876,3 +1254,78 @@ X509_STORE *setup_verify(BIO *bp, char *CAfile, char *CApath)
|
|||||||
X509_STORE_free(store);
|
X509_STORE_free(store);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Try to load an engine in a shareable library */
|
||||||
|
ENGINE *try_load_engine(BIO *err, const char *engine, int debug)
|
||||||
|
{
|
||||||
|
ENGINE *e = ENGINE_by_id("dynamic");
|
||||||
|
if (e)
|
||||||
|
{
|
||||||
|
if (!ENGINE_ctrl_cmd_string(e, "SO_PATH", engine, 0)
|
||||||
|
|| !ENGINE_ctrl_cmd_string(e, "LOAD", NULL, 0))
|
||||||
|
{
|
||||||
|
ENGINE_free(e);
|
||||||
|
e = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
|
||||||
|
ENGINE *setup_engine(BIO *err, const char *engine, int debug)
|
||||||
|
{
|
||||||
|
ENGINE *e = NULL;
|
||||||
|
|
||||||
|
if (engine)
|
||||||
|
{
|
||||||
|
if(strcmp(engine, "auto") == 0)
|
||||||
|
{
|
||||||
|
BIO_printf(err,"enabling auto ENGINE support\n");
|
||||||
|
ENGINE_register_all_complete();
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
if((e = ENGINE_by_id(engine)) == NULL
|
||||||
|
&& (e = try_load_engine(err, engine, debug)) == NULL)
|
||||||
|
{
|
||||||
|
BIO_printf(err,"invalid engine \"%s\"\n", engine);
|
||||||
|
ERR_print_errors(err);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
ENGINE_ctrl(e, ENGINE_CTRL_SET_LOGSTREAM,
|
||||||
|
0, err, 0);
|
||||||
|
}
|
||||||
|
ENGINE_ctrl_cmd(e, "SET_USER_INTERFACE", 0, ui_method, 0, 1);
|
||||||
|
if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
|
||||||
|
{
|
||||||
|
BIO_printf(err,"can't use that engine\n");
|
||||||
|
ERR_print_errors(err);
|
||||||
|
ENGINE_free(e);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
BIO_printf(err,"engine \"%s\" set.\n", ENGINE_get_id(e));
|
||||||
|
|
||||||
|
/* Free our "structural" reference. */
|
||||||
|
ENGINE_free(e);
|
||||||
|
}
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
|
||||||
|
int load_config(BIO *err, CONF *cnf)
|
||||||
|
{
|
||||||
|
if (!cnf)
|
||||||
|
cnf = config;
|
||||||
|
if (!cnf)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
OPENSSL_load_builtin_modules();
|
||||||
|
|
||||||
|
if (CONF_modules_load(cnf, NULL, 0) <= 0)
|
||||||
|
{
|
||||||
|
BIO_printf(err, "Error configuring OpenSSL\n");
|
||||||
|
ERR_print_errors(err);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|||||||
126
apps/apps.h
126
apps/apps.h
@@ -55,6 +55,59 @@
|
|||||||
* copied and put under another distribution licence
|
* copied and put under another distribution licence
|
||||||
* [including the GNU Public Licence.]
|
* [including the GNU Public Licence.]
|
||||||
*/
|
*/
|
||||||
|
/* ====================================================================
|
||||||
|
* Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in
|
||||||
|
* the documentation and/or other materials provided with the
|
||||||
|
* distribution.
|
||||||
|
*
|
||||||
|
* 3. All advertising materials mentioning features or use of this
|
||||||
|
* software must display the following acknowledgment:
|
||||||
|
* "This product includes software developed by the OpenSSL Project
|
||||||
|
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
||||||
|
*
|
||||||
|
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||||
|
* endorse or promote products derived from this software without
|
||||||
|
* prior written permission. For written permission, please contact
|
||||||
|
* openssl-core@openssl.org.
|
||||||
|
*
|
||||||
|
* 5. Products derived from this software may not be called "OpenSSL"
|
||||||
|
* nor may "OpenSSL" appear in their names without prior written
|
||||||
|
* permission of the OpenSSL Project.
|
||||||
|
*
|
||||||
|
* 6. Redistributions of any form whatsoever must retain the following
|
||||||
|
* acknowledgment:
|
||||||
|
* "This product includes software developed by the OpenSSL Project
|
||||||
|
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||||
|
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||||
|
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||||
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||||
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
* ====================================================================
|
||||||
|
*
|
||||||
|
* This product includes cryptographic software written by Eric Young
|
||||||
|
* (eay@cryptsoft.com). This product includes software written by Tim
|
||||||
|
* Hudson (tjh@cryptsoft.com).
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef HEADER_APPS_H
|
#ifndef HEADER_APPS_H
|
||||||
#define HEADER_APPS_H
|
#define HEADER_APPS_H
|
||||||
@@ -67,7 +120,9 @@
|
|||||||
#include <openssl/x509.h>
|
#include <openssl/x509.h>
|
||||||
#include <openssl/lhash.h>
|
#include <openssl/lhash.h>
|
||||||
#include <openssl/conf.h>
|
#include <openssl/conf.h>
|
||||||
|
#include <openssl/txt_db.h>
|
||||||
#include <openssl/engine.h>
|
#include <openssl/engine.h>
|
||||||
|
#include <openssl/ossl_typ.h>
|
||||||
|
|
||||||
int app_RAND_load_file(const char *file, BIO *bio_e, int dont_warn);
|
int app_RAND_load_file(const char *file, BIO *bio_e, int dont_warn);
|
||||||
int app_RAND_write_file(const char *file, BIO *bio_e);
|
int app_RAND_write_file(const char *file, BIO *bio_e);
|
||||||
@@ -101,7 +156,7 @@ extern BIO *bio_err;
|
|||||||
#else
|
#else
|
||||||
|
|
||||||
#define MAIN(a,v) PROG(a,v)
|
#define MAIN(a,v) PROG(a,v)
|
||||||
extern LHASH *config;
|
extern CONF *config;
|
||||||
extern char *default_config_file;
|
extern char *default_config_file;
|
||||||
extern BIO *bio_err;
|
extern BIO *bio_err;
|
||||||
|
|
||||||
@@ -116,24 +171,34 @@ extern BIO *bio_err;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MONOLITH) && !defined(OPENSSL_C)
|
#if defined(MONOLITH) && !defined(OPENSSL_C)
|
||||||
# define apps_startup() do_pipe_sig()
|
# define apps_startup() \
|
||||||
|
do_pipe_sig()
|
||||||
|
# define apps_shutdown()
|
||||||
#else
|
#else
|
||||||
# if defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_WIN16) || \
|
# if defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_WIN16) || \
|
||||||
defined(OPENSSL_SYS_WIN32)
|
defined(OPENSSL_SYS_WIN32)
|
||||||
# ifdef _O_BINARY
|
# ifdef _O_BINARY
|
||||||
# define apps_startup() \
|
# define apps_startup() \
|
||||||
_fmode=_O_BINARY; do_pipe_sig(); CRYPTO_malloc_init(); \
|
do { _fmode=_O_BINARY; do_pipe_sig(); CRYPTO_malloc_init(); \
|
||||||
OpenSSL_add_all_algorithms(); ENGINE_load_builtin_engines()
|
ERR_load_crypto_strings(); OpenSSL_add_all_algorithms(); \
|
||||||
|
ENGINE_load_builtin_engines(); setup_ui_method(); } while(0)
|
||||||
# else
|
# else
|
||||||
# define apps_startup() \
|
# define apps_startup() \
|
||||||
_fmode=O_BINARY; do_pipe_sig(); CRYPTO_malloc_init(); \
|
do { _fmode=O_BINARY; do_pipe_sig(); CRYPTO_malloc_init(); \
|
||||||
OpenSSL_add_all_algorithms(); ENGINE_load_builtin_engines()
|
ERR_load_crypto_strings(); OpenSSL_add_all_algorithms(); \
|
||||||
|
ENGINE_load_builtin_engines(); setup_ui_method(); } while(0)
|
||||||
# endif
|
# endif
|
||||||
# else
|
# else
|
||||||
# define apps_startup() \
|
# define apps_startup() \
|
||||||
do_pipe_sig(); OpenSSL_add_all_algorithms(); \
|
do { do_pipe_sig(); OpenSSL_add_all_algorithms(); \
|
||||||
ENGINE_load_builtin_engines()
|
ERR_load_crypto_strings(); ENGINE_load_builtin_engines(); \
|
||||||
|
setup_ui_method(); } while(0)
|
||||||
# endif
|
# endif
|
||||||
|
# define apps_shutdown() \
|
||||||
|
do { CONF_modules_unload(1); destroy_ui_method(); \
|
||||||
|
EVP_cleanup(); ENGINE_cleanup(); \
|
||||||
|
CRYPTO_cleanup_all_ex_data(); ERR_remove_state(0); \
|
||||||
|
ERR_free_strings(); } while(0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct args_st
|
typedef struct args_st
|
||||||
@@ -142,6 +207,19 @@ typedef struct args_st
|
|||||||
int count;
|
int count;
|
||||||
} ARGS;
|
} ARGS;
|
||||||
|
|
||||||
|
#define PW_MIN_LENGTH 4
|
||||||
|
typedef struct pw_cb_data
|
||||||
|
{
|
||||||
|
const void *password;
|
||||||
|
const char *prompt_info;
|
||||||
|
} PW_CB_DATA;
|
||||||
|
|
||||||
|
int password_callback(char *buf, int bufsiz, int verify,
|
||||||
|
PW_CB_DATA *cb_data);
|
||||||
|
|
||||||
|
int setup_ui_method();
|
||||||
|
void destroy_ui_method();
|
||||||
|
|
||||||
int should_retry(int i);
|
int should_retry(int i);
|
||||||
int args_from_file(char *file, int *argc, char **argv[]);
|
int args_from_file(char *file, int *argc, char **argv[]);
|
||||||
int str2fmt(char *s);
|
int str2fmt(char *s);
|
||||||
@@ -153,13 +231,29 @@ void print_name(BIO *out, char *title, X509_NAME *nm, unsigned long lflags);
|
|||||||
#endif
|
#endif
|
||||||
int set_cert_ex(unsigned long *flags, const char *arg);
|
int set_cert_ex(unsigned long *flags, const char *arg);
|
||||||
int set_name_ex(unsigned long *flags, const char *arg);
|
int set_name_ex(unsigned long *flags, const char *arg);
|
||||||
|
int set_ext_copy(int *copy_type, const char *arg);
|
||||||
|
int copy_extensions(X509 *x, X509_REQ *req, int copy_type);
|
||||||
int app_passwd(BIO *err, char *arg1, char *arg2, char **pass1, char **pass2);
|
int app_passwd(BIO *err, char *arg1, char *arg2, char **pass1, char **pass2);
|
||||||
int add_oid_section(BIO *err, LHASH *conf);
|
int add_oid_section(BIO *err, CONF *conf);
|
||||||
X509 *load_cert(BIO *err, char *file, int format);
|
X509 *load_cert(BIO *err, const char *file, int format,
|
||||||
EVP_PKEY *load_key(BIO *err, char *file, int format, char *pass, ENGINE *e);
|
const char *pass, ENGINE *e, const char *cert_descrip);
|
||||||
EVP_PKEY *load_pubkey(BIO *err, char *file, int format, ENGINE *e);
|
EVP_PKEY *load_key(BIO *err, const char *file, int format,
|
||||||
STACK_OF(X509) *load_certs(BIO *err, char *file, int format);
|
const char *pass, ENGINE *e, const char *key_descrip);
|
||||||
|
EVP_PKEY *load_pubkey(BIO *err, const char *file, int format,
|
||||||
|
const char *pass, ENGINE *e, const char *key_descrip);
|
||||||
|
STACK_OF(X509) *load_certs(BIO *err, const char *file, int format,
|
||||||
|
const char *pass, ENGINE *e, const char *cert_descrip);
|
||||||
X509_STORE *setup_verify(BIO *bp, char *CAfile, char *CApath);
|
X509_STORE *setup_verify(BIO *bp, char *CAfile, char *CApath);
|
||||||
|
ENGINE *setup_engine(BIO *err, const char *engine, int debug);
|
||||||
|
|
||||||
|
int load_config(BIO *err, CONF *cnf);
|
||||||
|
|
||||||
|
/* Functions defined in ca.c and also used in ocsp.c */
|
||||||
|
int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold,
|
||||||
|
ASN1_GENERALIZEDTIME **pinvtm, char *str);
|
||||||
|
int make_serial_index(TXT_DB *db);
|
||||||
|
|
||||||
|
X509_NAME *do_subject(char *str, long chtype);
|
||||||
|
|
||||||
#define FORMAT_UNDEF 0
|
#define FORMAT_UNDEF 0
|
||||||
#define FORMAT_ASN1 1
|
#define FORMAT_ASN1 1
|
||||||
@@ -169,6 +263,12 @@ X509_STORE *setup_verify(BIO *bp, char *CAfile, char *CApath);
|
|||||||
#define FORMAT_PKCS12 5
|
#define FORMAT_PKCS12 5
|
||||||
#define FORMAT_SMIME 6
|
#define FORMAT_SMIME 6
|
||||||
#define FORMAT_ENGINE 7
|
#define FORMAT_ENGINE 7
|
||||||
|
#define FORMAT_IISSGC 8 /* XXX this stupid macro helps us to avoid
|
||||||
|
* adding yet another param to load_*key() */
|
||||||
|
|
||||||
|
#define EXT_COPY_NONE 0
|
||||||
|
#define EXT_COPY_ADD 1
|
||||||
|
#define EXT_COPY_ALL 2
|
||||||
|
|
||||||
#define NETSCAPE_CERT_HDR "certificate"
|
#define NETSCAPE_CERT_HDR "certificate"
|
||||||
|
|
||||||
|
|||||||
@@ -103,6 +103,9 @@ int MAIN(int argc, char **argv)
|
|||||||
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
|
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
|
||||||
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
|
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
|
||||||
|
|
||||||
|
if (!load_config(bio_err, NULL))
|
||||||
|
goto end;
|
||||||
|
|
||||||
prog=argv[0];
|
prog=argv[0];
|
||||||
argc--;
|
argc--;
|
||||||
argv++;
|
argv++;
|
||||||
@@ -329,6 +332,7 @@ end:
|
|||||||
if (at != NULL) ASN1_TYPE_free(at);
|
if (at != NULL) ASN1_TYPE_free(at);
|
||||||
if (osk != NULL) sk_free(osk);
|
if (osk != NULL) sk_free(osk);
|
||||||
OBJ_cleanup();
|
OBJ_cleanup();
|
||||||
|
apps_shutdown();
|
||||||
EXIT(ret);
|
EXIT(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -202,6 +202,7 @@ end:
|
|||||||
if (ctx != NULL) SSL_CTX_free(ctx);
|
if (ctx != NULL) SSL_CTX_free(ctx);
|
||||||
if (ssl != NULL) SSL_free(ssl);
|
if (ssl != NULL) SSL_free(ssl);
|
||||||
if (STDout != NULL) BIO_free_all(STDout);
|
if (STDout != NULL) BIO_free_all(STDout);
|
||||||
|
apps_shutdown();
|
||||||
EXIT(ret);
|
EXIT(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
23
apps/crl.c
23
apps/crl.c
@@ -87,6 +87,7 @@ static char *crl_usage[]={
|
|||||||
" -noout - no CRL output\n",
|
" -noout - no CRL output\n",
|
||||||
" -CAfile name - verify CRL using certificates in file \"name\"\n",
|
" -CAfile name - verify CRL using certificates in file \"name\"\n",
|
||||||
" -CApath dir - verify CRL using certificates in \"dir\"\n",
|
" -CApath dir - verify CRL using certificates in \"dir\"\n",
|
||||||
|
" -nameopt arg - various certificate name options\n",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -97,6 +98,7 @@ int MAIN(int, char **);
|
|||||||
|
|
||||||
int MAIN(int argc, char **argv)
|
int MAIN(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
unsigned long nmflag = 0;
|
||||||
X509_CRL *x=NULL;
|
X509_CRL *x=NULL;
|
||||||
char *CAfile = NULL, *CApath = NULL;
|
char *CAfile = NULL, *CApath = NULL;
|
||||||
int ret=1,i,num,badops=0;
|
int ret=1,i,num,badops=0;
|
||||||
@@ -105,7 +107,7 @@ int MAIN(int argc, char **argv)
|
|||||||
char *infile=NULL,*outfile=NULL;
|
char *infile=NULL,*outfile=NULL;
|
||||||
int hash=0,issuer=0,lastupdate=0,nextupdate=0,noout=0,text=0;
|
int hash=0,issuer=0,lastupdate=0,nextupdate=0,noout=0,text=0;
|
||||||
int fingerprint = 0;
|
int fingerprint = 0;
|
||||||
char **pp,buf[256];
|
char **pp;
|
||||||
X509_STORE *store = NULL;
|
X509_STORE *store = NULL;
|
||||||
X509_STORE_CTX ctx;
|
X509_STORE_CTX ctx;
|
||||||
X509_LOOKUP *lookup = NULL;
|
X509_LOOKUP *lookup = NULL;
|
||||||
@@ -120,6 +122,9 @@ int MAIN(int argc, char **argv)
|
|||||||
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
|
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
|
||||||
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
|
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
|
||||||
|
|
||||||
|
if (!load_config(bio_err, NULL))
|
||||||
|
goto end;
|
||||||
|
|
||||||
if (bio_out == NULL)
|
if (bio_out == NULL)
|
||||||
if ((bio_out=BIO_new(BIO_s_file())) != NULL)
|
if ((bio_out=BIO_new(BIO_s_file())) != NULL)
|
||||||
{
|
{
|
||||||
@@ -185,6 +190,11 @@ int MAIN(int argc, char **argv)
|
|||||||
text = 1;
|
text = 1;
|
||||||
else if (strcmp(*argv,"-hash") == 0)
|
else if (strcmp(*argv,"-hash") == 0)
|
||||||
hash= ++num;
|
hash= ++num;
|
||||||
|
else if (strcmp(*argv,"-nameopt") == 0)
|
||||||
|
{
|
||||||
|
if (--argc < 1) goto bad;
|
||||||
|
if (!set_name_ex(&nmflag, *(++argv))) goto bad;
|
||||||
|
}
|
||||||
else if (strcmp(*argv,"-issuer") == 0)
|
else if (strcmp(*argv,"-issuer") == 0)
|
||||||
issuer= ++num;
|
issuer= ++num;
|
||||||
else if (strcmp(*argv,"-lastupdate") == 0)
|
else if (strcmp(*argv,"-lastupdate") == 0)
|
||||||
@@ -235,7 +245,11 @@ bad:
|
|||||||
X509_LOOKUP_add_dir(lookup,NULL,X509_FILETYPE_DEFAULT);
|
X509_LOOKUP_add_dir(lookup,NULL,X509_FILETYPE_DEFAULT);
|
||||||
ERR_clear_error();
|
ERR_clear_error();
|
||||||
|
|
||||||
X509_STORE_CTX_init(&ctx, store, NULL, NULL);
|
if(!X509_STORE_CTX_init(&ctx, store, NULL, NULL)) {
|
||||||
|
BIO_printf(bio_err,
|
||||||
|
"Error initialising X509 store\n");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
i = X509_STORE_get_by_subject(&ctx, X509_LU_X509,
|
i = X509_STORE_get_by_subject(&ctx, X509_LU_X509,
|
||||||
X509_CRL_get_issuer(x), &xobj);
|
X509_CRL_get_issuer(x), &xobj);
|
||||||
@@ -264,9 +278,7 @@ bad:
|
|||||||
{
|
{
|
||||||
if (issuer == i)
|
if (issuer == i)
|
||||||
{
|
{
|
||||||
X509_NAME_oneline(X509_CRL_get_issuer(x),
|
print_name(bio_out, "issuer=", X509_CRL_get_issuer(x), nmflag);
|
||||||
buf,256);
|
|
||||||
BIO_printf(bio_out,"issuer= %s\n",buf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hash == i)
|
if (hash == i)
|
||||||
@@ -364,6 +376,7 @@ end:
|
|||||||
X509_STORE_CTX_cleanup(&ctx);
|
X509_STORE_CTX_cleanup(&ctx);
|
||||||
X509_STORE_free(store);
|
X509_STORE_free(store);
|
||||||
}
|
}
|
||||||
|
apps_shutdown();
|
||||||
EXIT(ret);
|
EXIT(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -166,7 +166,8 @@ bad:
|
|||||||
BIO_printf(bio_err," -certfile arg certificates file of chain to a trusted CA\n");
|
BIO_printf(bio_err," -certfile arg certificates file of chain to a trusted CA\n");
|
||||||
BIO_printf(bio_err," (can be used more than once)\n");
|
BIO_printf(bio_err," (can be used more than once)\n");
|
||||||
BIO_printf(bio_err," -nocrl no crl to load, just certs from '-certfile'\n");
|
BIO_printf(bio_err," -nocrl no crl to load, just certs from '-certfile'\n");
|
||||||
EXIT(1);
|
ret = 1;
|
||||||
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
ERR_load_crypto_strings();
|
ERR_load_crypto_strings();
|
||||||
@@ -278,6 +279,7 @@ end:
|
|||||||
if (p7 != NULL) PKCS7_free(p7);
|
if (p7 != NULL) PKCS7_free(p7);
|
||||||
if (crl != NULL) X509_CRL_free(crl);
|
if (crl != NULL) X509_CRL_free(crl);
|
||||||
|
|
||||||
|
apps_shutdown();
|
||||||
EXIT(ret);
|
EXIT(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
76
apps/dgst.c
76
apps/dgst.c
@@ -66,7 +66,6 @@
|
|||||||
#include <openssl/objects.h>
|
#include <openssl/objects.h>
|
||||||
#include <openssl/x509.h>
|
#include <openssl/x509.h>
|
||||||
#include <openssl/pem.h>
|
#include <openssl/pem.h>
|
||||||
#include <openssl/engine.h>
|
|
||||||
|
|
||||||
#undef BUFSIZE
|
#undef BUFSIZE
|
||||||
#define BUFSIZE 1024*8
|
#define BUFSIZE 1024*8
|
||||||
@@ -89,8 +88,8 @@ int MAIN(int argc, char **argv)
|
|||||||
BIO *bmd=NULL;
|
BIO *bmd=NULL;
|
||||||
BIO *out = NULL;
|
BIO *out = NULL;
|
||||||
const char *name;
|
const char *name;
|
||||||
#define PROG_NAME_SIZE 16
|
#define PROG_NAME_SIZE 39
|
||||||
char pname[PROG_NAME_SIZE];
|
char pname[PROG_NAME_SIZE+1];
|
||||||
int separator=0;
|
int separator=0;
|
||||||
int debug=0;
|
int debug=0;
|
||||||
int keyform=FORMAT_PEM;
|
int keyform=FORMAT_PEM;
|
||||||
@@ -113,6 +112,9 @@ int MAIN(int argc, char **argv)
|
|||||||
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
|
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
|
||||||
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
|
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
|
||||||
|
|
||||||
|
if (!load_config(bio_err, NULL))
|
||||||
|
goto end;
|
||||||
|
|
||||||
/* first check the program name */
|
/* first check the program name */
|
||||||
program_name(argv[0],pname,PROG_NAME_SIZE);
|
program_name(argv[0],pname,PROG_NAME_SIZE);
|
||||||
|
|
||||||
@@ -225,23 +227,7 @@ int MAIN(int argc, char **argv)
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (engine != NULL)
|
e = setup_engine(bio_err, engine, 0);
|
||||||
{
|
|
||||||
if((e = ENGINE_by_id(engine)) == NULL)
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"invalid engine \"%s\"\n",
|
|
||||||
engine);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"can't use that engine\n");
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
|
|
||||||
/* Free our "structural" reference. */
|
|
||||||
ENGINE_free(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
in=BIO_new(BIO_s_file());
|
in=BIO_new(BIO_s_file());
|
||||||
bmd=BIO_new(BIO_f_md());
|
bmd=BIO_new(BIO_f_md());
|
||||||
@@ -289,52 +275,19 @@ int MAIN(int argc, char **argv)
|
|||||||
|
|
||||||
if(keyfile)
|
if(keyfile)
|
||||||
{
|
{
|
||||||
if (keyform == FORMAT_PEM)
|
if (want_pub)
|
||||||
{
|
sigkey = load_pubkey(bio_err, keyfile, keyform, NULL,
|
||||||
BIO *keybio;
|
e, "key file");
|
||||||
keybio = BIO_new_file(keyfile, "r");
|
|
||||||
if(!keybio)
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,
|
|
||||||
"Error opening key file %s\n",
|
|
||||||
keyfile);
|
|
||||||
ERR_print_errors(bio_err);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
if(want_pub)
|
|
||||||
sigkey = PEM_read_bio_PUBKEY(keybio,
|
|
||||||
NULL, NULL, NULL);
|
|
||||||
else
|
|
||||||
sigkey = PEM_read_bio_PrivateKey(keybio,
|
|
||||||
NULL, NULL, NULL);
|
|
||||||
BIO_free(keybio);
|
|
||||||
}
|
|
||||||
else if (keyform == FORMAT_ENGINE)
|
|
||||||
{
|
|
||||||
if (!e)
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"no engine specified\n");
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
if (want_pub)
|
|
||||||
sigkey = ENGINE_load_public_key(e, keyfile, NULL);
|
|
||||||
else
|
|
||||||
sigkey = ENGINE_load_private_key(e, keyfile, NULL);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
|
sigkey = load_key(bio_err, keyfile, keyform, NULL,
|
||||||
|
e, "key file");
|
||||||
|
if (!sigkey)
|
||||||
{
|
{
|
||||||
BIO_printf(bio_err,
|
/* load_[pub]key() has already printed an appropriate
|
||||||
"bad input format specified for key file\n");
|
message */
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!sigkey) {
|
|
||||||
BIO_printf(bio_err, "Error reading key file %s\n",
|
|
||||||
keyfile);
|
|
||||||
ERR_print_errors(bio_err);
|
|
||||||
goto end;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if(sigfile && sigkey) {
|
if(sigfile && sigkey) {
|
||||||
BIO *sigbio;
|
BIO *sigbio;
|
||||||
@@ -396,6 +349,7 @@ end:
|
|||||||
EVP_PKEY_free(sigkey);
|
EVP_PKEY_free(sigkey);
|
||||||
if(sigbuf) OPENSSL_free(sigbuf);
|
if(sigbuf) OPENSSL_free(sigbuf);
|
||||||
if (bmd != NULL) BIO_free(bmd);
|
if (bmd != NULL) BIO_free(bmd);
|
||||||
|
apps_shutdown();
|
||||||
EXIT(err);
|
EXIT(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
23
apps/dh.c
23
apps/dh.c
@@ -69,7 +69,6 @@
|
|||||||
#include <openssl/dh.h>
|
#include <openssl/dh.h>
|
||||||
#include <openssl/x509.h>
|
#include <openssl/x509.h>
|
||||||
#include <openssl/pem.h>
|
#include <openssl/pem.h>
|
||||||
#include <openssl/engine.h>
|
|
||||||
|
|
||||||
#undef PROG
|
#undef PROG
|
||||||
#define PROG dh_main
|
#define PROG dh_main
|
||||||
@@ -101,6 +100,9 @@ int MAIN(int argc, char **argv)
|
|||||||
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
|
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
|
||||||
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
|
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
|
||||||
|
|
||||||
|
if (!load_config(bio_err, NULL))
|
||||||
|
goto end;
|
||||||
|
|
||||||
engine=NULL;
|
engine=NULL;
|
||||||
infile=NULL;
|
infile=NULL;
|
||||||
outfile=NULL;
|
outfile=NULL;
|
||||||
@@ -174,23 +176,7 @@ bad:
|
|||||||
|
|
||||||
ERR_load_crypto_strings();
|
ERR_load_crypto_strings();
|
||||||
|
|
||||||
if (engine != NULL)
|
e = setup_engine(bio_err, engine, 0);
|
||||||
{
|
|
||||||
if((e = ENGINE_by_id(engine)) == NULL)
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"invalid engine \"%s\"\n",
|
|
||||||
engine);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"can't use that engine\n");
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
|
|
||||||
/* Free our "structural" reference. */
|
|
||||||
ENGINE_free(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
in=BIO_new(BIO_s_file());
|
in=BIO_new(BIO_s_file());
|
||||||
out=BIO_new(BIO_s_file());
|
out=BIO_new(BIO_s_file());
|
||||||
@@ -346,6 +332,7 @@ end:
|
|||||||
if (in != NULL) BIO_free(in);
|
if (in != NULL) BIO_free(in);
|
||||||
if (out != NULL) BIO_free_all(out);
|
if (out != NULL) BIO_free_all(out);
|
||||||
if (dh != NULL) DH_free(dh);
|
if (dh != NULL) DH_free(dh);
|
||||||
|
apps_shutdown();
|
||||||
EXIT(ret);
|
EXIT(ret);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -121,7 +121,6 @@
|
|||||||
#include <openssl/dh.h>
|
#include <openssl/dh.h>
|
||||||
#include <openssl/x509.h>
|
#include <openssl/x509.h>
|
||||||
#include <openssl/pem.h>
|
#include <openssl/pem.h>
|
||||||
#include <openssl/engine.h>
|
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_DSA
|
#ifndef OPENSSL_NO_DSA
|
||||||
#include <openssl/dsa.h>
|
#include <openssl/dsa.h>
|
||||||
@@ -167,6 +166,9 @@ int MAIN(int argc, char **argv)
|
|||||||
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
|
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
|
||||||
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
|
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
|
||||||
|
|
||||||
|
if (!load_config(bio_err, NULL))
|
||||||
|
goto end;
|
||||||
|
|
||||||
infile=NULL;
|
infile=NULL;
|
||||||
outfile=NULL;
|
outfile=NULL;
|
||||||
informat=FORMAT_PEM;
|
informat=FORMAT_PEM;
|
||||||
@@ -257,23 +259,7 @@ bad:
|
|||||||
|
|
||||||
ERR_load_crypto_strings();
|
ERR_load_crypto_strings();
|
||||||
|
|
||||||
if (engine != NULL)
|
e = setup_engine(bio_err, engine, 0);
|
||||||
{
|
|
||||||
if((e = ENGINE_by_id(engine)) == NULL)
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"invalid engine \"%s\"\n",
|
|
||||||
engine);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"can't use that engine\n");
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
|
|
||||||
/* Free our "structural" reference. */
|
|
||||||
ENGINE_free(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (g && !num)
|
if (g && !num)
|
||||||
num = DEFBITS;
|
num = DEFBITS;
|
||||||
@@ -504,7 +490,7 @@ bad:
|
|||||||
printf("\tif ((dh->p == NULL) || (dh->g == NULL))\n");
|
printf("\tif ((dh->p == NULL) || (dh->g == NULL))\n");
|
||||||
printf("\t\t{ DH_free(dh); return(NULL); }\n");
|
printf("\t\t{ DH_free(dh); return(NULL); }\n");
|
||||||
if (dh->length)
|
if (dh->length)
|
||||||
printf("\tdh->length = %d;\n", dh->length);
|
printf("\tdh->length = %ld;\n", dh->length);
|
||||||
printf("\treturn(dh);\n\t}\n");
|
printf("\treturn(dh);\n\t}\n");
|
||||||
OPENSSL_free(data);
|
OPENSSL_free(data);
|
||||||
}
|
}
|
||||||
@@ -532,6 +518,7 @@ end:
|
|||||||
if (in != NULL) BIO_free(in);
|
if (in != NULL) BIO_free(in);
|
||||||
if (out != NULL) BIO_free_all(out);
|
if (out != NULL) BIO_free_all(out);
|
||||||
if (dh != NULL) DH_free(dh);
|
if (dh != NULL) DH_free(dh);
|
||||||
|
apps_shutdown();
|
||||||
EXIT(ret);
|
EXIT(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
30
apps/dsa.c
30
apps/dsa.c
@@ -68,7 +68,6 @@
|
|||||||
#include <openssl/evp.h>
|
#include <openssl/evp.h>
|
||||||
#include <openssl/x509.h>
|
#include <openssl/x509.h>
|
||||||
#include <openssl/pem.h>
|
#include <openssl/pem.h>
|
||||||
#include <openssl/engine.h>
|
|
||||||
|
|
||||||
#undef PROG
|
#undef PROG
|
||||||
#define PROG dsa_main
|
#define PROG dsa_main
|
||||||
@@ -80,6 +79,9 @@
|
|||||||
* -des - encrypt output if PEM format with DES in cbc mode
|
* -des - encrypt output if PEM format with DES in cbc mode
|
||||||
* -des3 - encrypt output if PEM format
|
* -des3 - encrypt output if PEM format
|
||||||
* -idea - encrypt output if PEM format
|
* -idea - encrypt output if PEM format
|
||||||
|
* -aes128 - encrypt output if PEM format
|
||||||
|
* -aes192 - encrypt output if PEM format
|
||||||
|
* -aes256 - encrypt output if PEM format
|
||||||
* -text - print a text version
|
* -text - print a text version
|
||||||
* -modulus - print the DSA public key
|
* -modulus - print the DSA public key
|
||||||
*/
|
*/
|
||||||
@@ -107,6 +109,9 @@ int MAIN(int argc, char **argv)
|
|||||||
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
|
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
|
||||||
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
|
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
|
||||||
|
|
||||||
|
if (!load_config(bio_err, NULL))
|
||||||
|
goto end;
|
||||||
|
|
||||||
engine=NULL;
|
engine=NULL;
|
||||||
infile=NULL;
|
infile=NULL;
|
||||||
outfile=NULL;
|
outfile=NULL;
|
||||||
@@ -189,6 +194,10 @@ bad:
|
|||||||
BIO_printf(bio_err," -des3 encrypt PEM output with ede cbc des using 168 bit key\n");
|
BIO_printf(bio_err," -des3 encrypt PEM output with ede cbc des using 168 bit key\n");
|
||||||
#ifndef OPENSSL_NO_IDEA
|
#ifndef OPENSSL_NO_IDEA
|
||||||
BIO_printf(bio_err," -idea encrypt PEM output with cbc idea\n");
|
BIO_printf(bio_err," -idea encrypt PEM output with cbc idea\n");
|
||||||
|
#endif
|
||||||
|
#ifndef OPENSSL_NO_AES
|
||||||
|
BIO_printf(bio_err," -aes128, -aes192, -aes256\n");
|
||||||
|
BIO_printf(bio_err," encrypt PEM output with cbc aes\n");
|
||||||
#endif
|
#endif
|
||||||
BIO_printf(bio_err," -text print the key in text\n");
|
BIO_printf(bio_err," -text print the key in text\n");
|
||||||
BIO_printf(bio_err," -noout don't print key out\n");
|
BIO_printf(bio_err," -noout don't print key out\n");
|
||||||
@@ -198,23 +207,7 @@ bad:
|
|||||||
|
|
||||||
ERR_load_crypto_strings();
|
ERR_load_crypto_strings();
|
||||||
|
|
||||||
if (engine != NULL)
|
e = setup_engine(bio_err, engine, 0);
|
||||||
{
|
|
||||||
if((e = ENGINE_by_id(engine)) == NULL)
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"invalid engine \"%s\"\n",
|
|
||||||
engine);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"can't use that engine\n");
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
|
|
||||||
/* Free our "structural" reference. */
|
|
||||||
ENGINE_free(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!app_passwd(bio_err, passargin, passargout, &passin, &passout)) {
|
if(!app_passwd(bio_err, passargin, passargout, &passin, &passout)) {
|
||||||
BIO_printf(bio_err, "Error getting passwords\n");
|
BIO_printf(bio_err, "Error getting passwords\n");
|
||||||
@@ -320,6 +313,7 @@ end:
|
|||||||
if(dsa != NULL) DSA_free(dsa);
|
if(dsa != NULL) DSA_free(dsa);
|
||||||
if(passin) OPENSSL_free(passin);
|
if(passin) OPENSSL_free(passin);
|
||||||
if(passout) OPENSSL_free(passout);
|
if(passout) OPENSSL_free(passout);
|
||||||
|
apps_shutdown();
|
||||||
EXIT(ret);
|
EXIT(ret);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -69,7 +69,6 @@
|
|||||||
#include <openssl/dsa.h>
|
#include <openssl/dsa.h>
|
||||||
#include <openssl/x509.h>
|
#include <openssl/x509.h>
|
||||||
#include <openssl/pem.h>
|
#include <openssl/pem.h>
|
||||||
#include <openssl/engine.h>
|
|
||||||
|
|
||||||
#undef PROG
|
#undef PROG
|
||||||
#define PROG dsaparam_main
|
#define PROG dsaparam_main
|
||||||
@@ -107,6 +106,9 @@ int MAIN(int argc, char **argv)
|
|||||||
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
|
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
|
||||||
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
|
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
|
||||||
|
|
||||||
|
if (!load_config(bio_err, NULL))
|
||||||
|
goto end;
|
||||||
|
|
||||||
infile=NULL;
|
infile=NULL;
|
||||||
outfile=NULL;
|
outfile=NULL;
|
||||||
informat=FORMAT_PEM;
|
informat=FORMAT_PEM;
|
||||||
@@ -184,9 +186,10 @@ bad:
|
|||||||
BIO_printf(bio_err," -outform arg output format - DER or PEM\n");
|
BIO_printf(bio_err," -outform arg output format - DER or PEM\n");
|
||||||
BIO_printf(bio_err," -in arg input file\n");
|
BIO_printf(bio_err," -in arg input file\n");
|
||||||
BIO_printf(bio_err," -out arg output file\n");
|
BIO_printf(bio_err," -out arg output file\n");
|
||||||
BIO_printf(bio_err," -text print the key in text\n");
|
BIO_printf(bio_err," -text print as text\n");
|
||||||
BIO_printf(bio_err," -C Output C code\n");
|
BIO_printf(bio_err," -C Output C code\n");
|
||||||
BIO_printf(bio_err," -noout no output\n");
|
BIO_printf(bio_err," -noout no output\n");
|
||||||
|
BIO_printf(bio_err," -genkey generate a DSA key\n");
|
||||||
BIO_printf(bio_err," -rand files to use for random number input\n");
|
BIO_printf(bio_err," -rand files to use for random number input\n");
|
||||||
BIO_printf(bio_err," -engine e use engine e, possibly a hardware device.\n");
|
BIO_printf(bio_err," -engine e use engine e, possibly a hardware device.\n");
|
||||||
BIO_printf(bio_err," number number of bits to use for generating private key\n");
|
BIO_printf(bio_err," number number of bits to use for generating private key\n");
|
||||||
@@ -232,23 +235,7 @@ bad:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (engine != NULL)
|
e = setup_engine(bio_err, engine, 0);
|
||||||
{
|
|
||||||
if((e = ENGINE_by_id(engine)) == NULL)
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"invalid engine \"%s\"\n",
|
|
||||||
engine);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"can't use that engine\n");
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
|
|
||||||
/* Free our "structural" reference. */
|
|
||||||
ENGINE_free(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (need_rand)
|
if (need_rand)
|
||||||
{
|
{
|
||||||
@@ -384,6 +371,7 @@ end:
|
|||||||
if (in != NULL) BIO_free(in);
|
if (in != NULL) BIO_free(in);
|
||||||
if (out != NULL) BIO_free_all(out);
|
if (out != NULL) BIO_free_all(out);
|
||||||
if (dsa != NULL) DSA_free(dsa);
|
if (dsa != NULL) DSA_free(dsa);
|
||||||
|
apps_shutdown();
|
||||||
EXIT(ret);
|
EXIT(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
445
apps/ecdsa.c
Normal file
445
apps/ecdsa.c
Normal file
@@ -0,0 +1,445 @@
|
|||||||
|
/* apps/ecdsa.c */
|
||||||
|
/* ====================================================================
|
||||||
|
* Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in
|
||||||
|
* the documentation and/or other materials provided with the
|
||||||
|
* distribution.
|
||||||
|
*
|
||||||
|
* 3. All advertising materials mentioning features or use of this
|
||||||
|
* software must display the following acknowledgment:
|
||||||
|
* "This product includes software developed by the OpenSSL Project
|
||||||
|
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
||||||
|
*
|
||||||
|
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||||
|
* endorse or promote products derived from this software without
|
||||||
|
* prior written permission. For written permission, please contact
|
||||||
|
* openssl-core@openssl.org.
|
||||||
|
*
|
||||||
|
* 5. Products derived from this software may not be called "OpenSSL"
|
||||||
|
* nor may "OpenSSL" appear in their names without prior written
|
||||||
|
* permission of the OpenSSL Project.
|
||||||
|
*
|
||||||
|
* 6. Redistributions of any form whatsoever must retain the following
|
||||||
|
* acknowledgment:
|
||||||
|
* "This product includes software developed by the OpenSSL Project
|
||||||
|
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||||
|
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||||
|
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||||
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||||
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
* ====================================================================
|
||||||
|
*
|
||||||
|
* This product includes cryptographic software written by Eric Young
|
||||||
|
* (eay@cryptsoft.com). This product includes software written by Tim
|
||||||
|
* Hudson (tjh@cryptsoft.com).
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This package is an SSL implementation written
|
||||||
|
* by Eric Young (eay@cryptsoft.com).
|
||||||
|
* The implementation was written so as to conform with Netscapes SSL.
|
||||||
|
*
|
||||||
|
* This library is free for commercial and non-commercial use as long as
|
||||||
|
* the following conditions are aheared to. The following conditions
|
||||||
|
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||||
|
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||||
|
* included with this distribution is covered by the same copyright terms
|
||||||
|
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||||
|
*
|
||||||
|
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||||
|
* the code are not to be removed.
|
||||||
|
* If this package is used in a product, Eric Young should be given attribution
|
||||||
|
* as the author of the parts of the library used.
|
||||||
|
* This can be in the form of a textual message at program startup or
|
||||||
|
* in documentation (online or textual) provided with the package.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* 3. All advertising materials mentioning features or use of this software
|
||||||
|
* must display the following acknowledgement:
|
||||||
|
* "This product includes cryptographic software written by
|
||||||
|
* Eric Young (eay@cryptsoft.com)"
|
||||||
|
* The word 'cryptographic' can be left out if the rouines from the library
|
||||||
|
* being used are not cryptographic related :-).
|
||||||
|
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||||
|
* the apps directory (application code) you must include an acknowledgement:
|
||||||
|
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* The licence and distribution terms for any publically available version or
|
||||||
|
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||||
|
* copied and put under another distribution licence
|
||||||
|
* [including the GNU Public Licence.]
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OPENSSL_NO_ECDSA
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include "apps.h"
|
||||||
|
#include <openssl/bio.h>
|
||||||
|
#include <openssl/err.h>
|
||||||
|
#include <openssl/ecdsa.h>
|
||||||
|
#include <openssl/evp.h>
|
||||||
|
#include <openssl/x509.h>
|
||||||
|
#include <openssl/pem.h>
|
||||||
|
|
||||||
|
#undef PROG
|
||||||
|
#define PROG ecdsa_main
|
||||||
|
|
||||||
|
/* -inform arg - input format - default PEM (one of DER, NET or PEM)
|
||||||
|
* -outform arg - output format - default PEM
|
||||||
|
* -in arg - input file - default stdin
|
||||||
|
* -out arg - output file - default stdout
|
||||||
|
* -des - encrypt output if PEM format with DES in cbc mode
|
||||||
|
* -des3 - encrypt output if PEM format
|
||||||
|
* -idea - encrypt output if PEM format
|
||||||
|
* -aes128 - encrypt output if PEM format
|
||||||
|
* -aes192 - encrypt output if PEM format
|
||||||
|
* -aes256 - encrypt output if PEM format
|
||||||
|
* -text - print a text version
|
||||||
|
* -pub - print the ECDSA public key
|
||||||
|
* -compressed - print the public key in compressed form ( default )
|
||||||
|
* -hybrid - print the public key in hybrid form
|
||||||
|
* -uncompressed - print the public key in uncompressed form
|
||||||
|
* the last three options ( compressed, hybrid and uncompressed )
|
||||||
|
* are only used if the "-pub" option is also selected.
|
||||||
|
* For a precise description of the the meaning of compressed,
|
||||||
|
* hybrid and uncompressed please refer to the X9.62 standart.
|
||||||
|
* All three forms represents ways to express the ecdsa public
|
||||||
|
* key ( a point on a elliptic curve ) as octet string. Let len be
|
||||||
|
* the length ( in bytes ) of an element of the field over which
|
||||||
|
* the curve is defined, then a compressed octet string has the form
|
||||||
|
* 0x02 + result of BN_bn2bin() of the x coordinate of the public key
|
||||||
|
*/
|
||||||
|
|
||||||
|
int MAIN(int, char **);
|
||||||
|
|
||||||
|
int MAIN(int argc, char **argv)
|
||||||
|
{
|
||||||
|
ENGINE *e = NULL;
|
||||||
|
int ret = 1;
|
||||||
|
ECDSA *ecdsa = NULL;
|
||||||
|
int i, badops = 0;
|
||||||
|
const EVP_CIPHER *enc = NULL;
|
||||||
|
BIO *in = NULL, *out = NULL;
|
||||||
|
int informat, outformat, text=0, noout=0;
|
||||||
|
int pubin = 0, pubout = 0;
|
||||||
|
char *infile, *outfile, *prog, *engine;
|
||||||
|
char *passargin = NULL, *passargout = NULL;
|
||||||
|
char *passin = NULL, *passout = NULL;
|
||||||
|
int pub = 0, point_form = 0;
|
||||||
|
unsigned char *buffer = NULL;
|
||||||
|
unsigned int buf_len = 0;
|
||||||
|
BIGNUM *tmp_bn = NULL;
|
||||||
|
|
||||||
|
apps_startup();
|
||||||
|
|
||||||
|
if (bio_err == NULL)
|
||||||
|
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
|
||||||
|
BIO_set_fp(bio_err, stderr, BIO_NOCLOSE|BIO_FP_TEXT);
|
||||||
|
|
||||||
|
if (!load_config(bio_err, NULL))
|
||||||
|
goto end;
|
||||||
|
|
||||||
|
engine = NULL;
|
||||||
|
infile = NULL;
|
||||||
|
outfile = NULL;
|
||||||
|
informat = FORMAT_PEM;
|
||||||
|
outformat = FORMAT_PEM;
|
||||||
|
|
||||||
|
prog = argv[0];
|
||||||
|
argc--;
|
||||||
|
argv++;
|
||||||
|
while (argc >= 1)
|
||||||
|
{
|
||||||
|
if (strcmp(*argv,"-inform") == 0)
|
||||||
|
{
|
||||||
|
if (--argc < 1) goto bad;
|
||||||
|
informat=str2fmt(*(++argv));
|
||||||
|
}
|
||||||
|
else if (strcmp(*argv,"-outform") == 0)
|
||||||
|
{
|
||||||
|
if (--argc < 1) goto bad;
|
||||||
|
outformat=str2fmt(*(++argv));
|
||||||
|
}
|
||||||
|
else if (strcmp(*argv,"-in") == 0)
|
||||||
|
{
|
||||||
|
if (--argc < 1) goto bad;
|
||||||
|
infile= *(++argv);
|
||||||
|
}
|
||||||
|
else if (strcmp(*argv,"-out") == 0)
|
||||||
|
{
|
||||||
|
if (--argc < 1) goto bad;
|
||||||
|
outfile= *(++argv);
|
||||||
|
}
|
||||||
|
else if (strcmp(*argv,"-passin") == 0)
|
||||||
|
{
|
||||||
|
if (--argc < 1) goto bad;
|
||||||
|
passargin= *(++argv);
|
||||||
|
}
|
||||||
|
else if (strcmp(*argv,"-passout") == 0)
|
||||||
|
{
|
||||||
|
if (--argc < 1) goto bad;
|
||||||
|
passargout= *(++argv);
|
||||||
|
}
|
||||||
|
else if (strcmp(*argv, "-engine") == 0)
|
||||||
|
{
|
||||||
|
if (--argc < 1) goto bad;
|
||||||
|
engine= *(++argv);
|
||||||
|
}
|
||||||
|
else if (strcmp(*argv, "-noout") == 0)
|
||||||
|
noout = 1;
|
||||||
|
else if (strcmp(*argv, "-text") == 0)
|
||||||
|
text = 1;
|
||||||
|
else if (strcmp(*argv, "-pub") == 0)
|
||||||
|
{
|
||||||
|
pub = 1;
|
||||||
|
buffer = (unsigned char *)(*(argv+1));
|
||||||
|
if (strcmp((char *)buffer, "compressed") == 0)
|
||||||
|
point_form = POINT_CONVERSION_COMPRESSED;
|
||||||
|
else if (strcmp((char *)buffer, "hybrid") == 0)
|
||||||
|
point_form = POINT_CONVERSION_HYBRID;
|
||||||
|
else if (strcmp((char *)buffer, "uncompressed") == 0)
|
||||||
|
point_form = POINT_CONVERSION_UNCOMPRESSED;
|
||||||
|
if (point_form)
|
||||||
|
{
|
||||||
|
argc--;
|
||||||
|
argv++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (strcmp(*argv, "-pubin") == 0)
|
||||||
|
pubin=1;
|
||||||
|
else if (strcmp(*argv, "-pubout") == 0)
|
||||||
|
pubout=1;
|
||||||
|
else if ((enc=EVP_get_cipherbyname(&(argv[0][1]))) == NULL)
|
||||||
|
{
|
||||||
|
BIO_printf(bio_err,"unknown option %s\n",*argv);
|
||||||
|
badops=1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
argc--;
|
||||||
|
argv++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (badops)
|
||||||
|
{
|
||||||
|
bad:
|
||||||
|
BIO_printf(bio_err, "%s [options] <infile >outfile\n",prog);
|
||||||
|
BIO_printf(bio_err, "where options are\n");
|
||||||
|
BIO_printf(bio_err, " -inform arg input format - DER or PEM\n");
|
||||||
|
BIO_printf(bio_err, " -outform arg output format - DER or PEM\n");
|
||||||
|
BIO_printf(bio_err, " -in arg input file\n");
|
||||||
|
BIO_printf(bio_err, " -passin arg input file pass phrase source\n");
|
||||||
|
BIO_printf(bio_err, " -out arg output file\n");
|
||||||
|
BIO_printf(bio_err, " -passout arg output file pass phrase source\n");
|
||||||
|
BIO_printf(bio_err, " -engine e use engine e, possibly a hardware device.\n");
|
||||||
|
BIO_printf(bio_err, " -des encrypt PEM output with cbc des\n");
|
||||||
|
BIO_printf(bio_err, " -des3 encrypt PEM output with ede cbc des using 168 bit key\n");
|
||||||
|
#ifndef OPENSSL_NO_IDEA
|
||||||
|
BIO_printf(bio_err, " -idea encrypt PEM output with cbc idea\n");
|
||||||
|
#endif
|
||||||
|
#ifndef OPENSSL_NO_AES
|
||||||
|
BIO_printf(bio_err, " -aes128, -aes192, -aes256\n");
|
||||||
|
BIO_printf(bio_err, " encrypt PEM output with cbc aes\n");
|
||||||
|
#endif
|
||||||
|
BIO_printf(bio_err, " -text print the key in text\n");
|
||||||
|
BIO_printf(bio_err, " -noout don't print key out\n");
|
||||||
|
BIO_printf(bio_err, " -pub [compressed | hybrid | uncompressed] \n");
|
||||||
|
BIO_printf(bio_err, " compressed print the public key in compressed form ( default )\n");
|
||||||
|
BIO_printf(bio_err, " hybrid print the public key in hybrid form\n");
|
||||||
|
BIO_printf(bio_err, " uncompressed print the public key in uncompressed form\n");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
ERR_load_crypto_strings();
|
||||||
|
|
||||||
|
e = setup_engine(bio_err, engine, 0);
|
||||||
|
|
||||||
|
if(!app_passwd(bio_err, passargin, passargout, &passin, &passout))
|
||||||
|
{
|
||||||
|
BIO_printf(bio_err, "Error getting passwords\n");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
in = BIO_new(BIO_s_file());
|
||||||
|
out = BIO_new(BIO_s_file());
|
||||||
|
if ((in == NULL) || (out == NULL))
|
||||||
|
{
|
||||||
|
ERR_print_errors(bio_err);
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (infile == NULL)
|
||||||
|
BIO_set_fp(in,stdin,BIO_NOCLOSE);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (BIO_read_filename(in,infile) <= 0)
|
||||||
|
{
|
||||||
|
perror(infile);
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BIO_printf(bio_err,"read ECDSA key\n");
|
||||||
|
if (informat == FORMAT_ASN1)
|
||||||
|
{
|
||||||
|
if (pubin)
|
||||||
|
ecdsa = d2i_ECDSA_PUBKEY_bio(in, NULL);
|
||||||
|
else
|
||||||
|
ecdsa = d2i_ECDSAPrivateKey_bio(in, NULL);
|
||||||
|
} else if (informat == FORMAT_PEM)
|
||||||
|
{
|
||||||
|
if (pubin)
|
||||||
|
ecdsa = PEM_read_bio_ECDSA_PUBKEY(in, NULL, NULL, NULL);
|
||||||
|
else
|
||||||
|
ecdsa = PEM_read_bio_ECDSAPrivateKey(in, NULL, NULL, passin);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
BIO_printf(bio_err, "bad input format specified for key\n");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
if (ecdsa == NULL)
|
||||||
|
{
|
||||||
|
BIO_printf(bio_err,"unable to load Key\n");
|
||||||
|
ERR_print_errors(bio_err);
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (outfile == NULL)
|
||||||
|
{
|
||||||
|
BIO_set_fp(out, stdout, BIO_NOCLOSE);
|
||||||
|
#ifdef OPENSSL_SYS_VMS
|
||||||
|
{
|
||||||
|
BIO *tmpbio = BIO_new(BIO_f_linebuffer());
|
||||||
|
out = BIO_push(tmpbio, out);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (BIO_write_filename(out, outfile) <= 0)
|
||||||
|
{
|
||||||
|
perror(outfile);
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (text)
|
||||||
|
if (!ECDSA_print(out, ecdsa, 0))
|
||||||
|
{
|
||||||
|
perror(outfile);
|
||||||
|
ERR_print_errors(bio_err);
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pub)
|
||||||
|
{
|
||||||
|
fprintf(stdout, "Public Key (");
|
||||||
|
if (point_form == POINT_CONVERSION_COMPRESSED)
|
||||||
|
fprintf(stdout, "COMPRESSED");
|
||||||
|
else if (point_form == POINT_CONVERSION_UNCOMPRESSED)
|
||||||
|
fprintf(stdout, "UNCOMPRESSED");
|
||||||
|
else if (point_form == POINT_CONVERSION_HYBRID)
|
||||||
|
fprintf(stdout, "HYBRID");
|
||||||
|
fprintf(stdout, ")=");
|
||||||
|
buf_len = EC_POINT_point2oct(ecdsa->group, EC_GROUP_get0_generator(ecdsa->group),
|
||||||
|
point_form, NULL, 0, NULL);
|
||||||
|
if (!buf_len)
|
||||||
|
{
|
||||||
|
BIO_printf(bio_err,"invalid public key length\n");
|
||||||
|
ERR_print_errors(bio_err);
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
if ((tmp_bn = BN_new()) == NULL ||
|
||||||
|
(buffer = OPENSSL_malloc(buf_len)) == NULL) goto end;
|
||||||
|
if (!EC_POINT_point2oct(ecdsa->group, EC_GROUP_get0_generator(ecdsa->group),
|
||||||
|
point_form, buffer, buf_len, NULL) ||
|
||||||
|
!BN_bin2bn(buffer, buf_len, tmp_bn))
|
||||||
|
{
|
||||||
|
BIO_printf(bio_err,"can not encode public key\n");
|
||||||
|
ERR_print_errors(bio_err);
|
||||||
|
OPENSSL_free(buffer);
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
BN_print(out, tmp_bn);
|
||||||
|
fprintf(stdout,"\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (noout)
|
||||||
|
goto end;
|
||||||
|
BIO_printf(bio_err, "writing ECDSA key\n");
|
||||||
|
if (outformat == FORMAT_ASN1)
|
||||||
|
{
|
||||||
|
if(pubin || pubout)
|
||||||
|
i = i2d_ECDSA_PUBKEY_bio(out, ecdsa);
|
||||||
|
else
|
||||||
|
i = i2d_ECDSAPrivateKey_bio(out, ecdsa);
|
||||||
|
} else if (outformat == FORMAT_PEM)
|
||||||
|
{
|
||||||
|
if(pubin || pubout)
|
||||||
|
i = PEM_write_bio_ECDSA_PUBKEY(out, ecdsa);
|
||||||
|
else
|
||||||
|
i = PEM_write_bio_ECDSAPrivateKey(out, ecdsa, enc,
|
||||||
|
NULL, 0, NULL, passout);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
BIO_printf(bio_err, "bad output format specified for outfile\n");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
if (!i)
|
||||||
|
{
|
||||||
|
BIO_printf(bio_err, "unable to write private key\n");
|
||||||
|
ERR_print_errors(bio_err);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ret=0;
|
||||||
|
end:
|
||||||
|
if (in) BIO_free(in);
|
||||||
|
if (out) BIO_free_all(out);
|
||||||
|
if (ecdsa) ECDSA_free(ecdsa);
|
||||||
|
if (tmp_bn) BN_free(tmp_bn);
|
||||||
|
if (passin) OPENSSL_free(passin);
|
||||||
|
if (passout) OPENSSL_free(passout);
|
||||||
|
apps_shutdown();
|
||||||
|
EXIT(ret);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
660
apps/ecdsaparam.c
Normal file
660
apps/ecdsaparam.c
Normal file
@@ -0,0 +1,660 @@
|
|||||||
|
/* apps/ecdsaparam.c */
|
||||||
|
/* ====================================================================
|
||||||
|
* Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in
|
||||||
|
* the documentation and/or other materials provided with the
|
||||||
|
* distribution.
|
||||||
|
*
|
||||||
|
* 3. All advertising materials mentioning features or use of this
|
||||||
|
* software must display the following acknowledgment:
|
||||||
|
* "This product includes software developed by the OpenSSL Project
|
||||||
|
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
||||||
|
*
|
||||||
|
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||||
|
* endorse or promote products derived from this software without
|
||||||
|
* prior written permission. For written permission, please contact
|
||||||
|
* openssl-core@openssl.org.
|
||||||
|
*
|
||||||
|
* 5. Products derived from this software may not be called "OpenSSL"
|
||||||
|
* nor may "OpenSSL" appear in their names without prior written
|
||||||
|
* permission of the OpenSSL Project.
|
||||||
|
*
|
||||||
|
* 6. Redistributions of any form whatsoever must retain the following
|
||||||
|
* acknowledgment:
|
||||||
|
* "This product includes software developed by the OpenSSL Project
|
||||||
|
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||||
|
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||||
|
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||||
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||||
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
* ====================================================================
|
||||||
|
*
|
||||||
|
* This product includes cryptographic software written by Eric Young
|
||||||
|
* (eay@cryptsoft.com). This product includes software written by Tim
|
||||||
|
* Hudson (tjh@cryptsoft.com).
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This package is an SSL implementation written
|
||||||
|
* by Eric Young (eay@cryptsoft.com).
|
||||||
|
* The implementation was written so as to conform with Netscapes SSL.
|
||||||
|
*
|
||||||
|
* This library is free for commercial and non-commercial use as long as
|
||||||
|
* the following conditions are aheared to. The following conditions
|
||||||
|
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||||
|
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||||
|
* included with this distribution is covered by the same copyright terms
|
||||||
|
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||||
|
*
|
||||||
|
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||||
|
* the code are not to be removed.
|
||||||
|
* If this package is used in a product, Eric Young should be given attribution
|
||||||
|
* as the author of the parts of the library used.
|
||||||
|
* This can be in the form of a textual message at program startup or
|
||||||
|
* in documentation (online or textual) provided with the package.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* 3. All advertising materials mentioning features or use of this software
|
||||||
|
* must display the following acknowledgement:
|
||||||
|
* "This product includes cryptographic software written by
|
||||||
|
* Eric Young (eay@cryptsoft.com)"
|
||||||
|
* The word 'cryptographic' can be left out if the rouines from the library
|
||||||
|
* being used are not cryptographic related :-).
|
||||||
|
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||||
|
* the apps directory (application code) you must include an acknowledgement:
|
||||||
|
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* The licence and distribution terms for any publically available version or
|
||||||
|
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||||
|
* copied and put under another distribution licence
|
||||||
|
* [including the GNU Public Licence.]
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OPENSSL_NO_ECDSA
|
||||||
|
#include <assert.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "apps.h"
|
||||||
|
#include <openssl/bio.h>
|
||||||
|
#include <openssl/err.h>
|
||||||
|
#include <openssl/bn.h>
|
||||||
|
#include <openssl/ec.h>
|
||||||
|
#include <openssl/ecdsa.h>
|
||||||
|
#include <openssl/x509.h>
|
||||||
|
#include <openssl/pem.h>
|
||||||
|
|
||||||
|
#undef PROG
|
||||||
|
#define PROG ecdsaparam_main
|
||||||
|
|
||||||
|
/* -inform arg - input format - default PEM (DER or PEM)
|
||||||
|
* -outform arg - output format - default PEM
|
||||||
|
* -in arg - input file - default stdin
|
||||||
|
* -out arg - output file - default stdout
|
||||||
|
* -noout
|
||||||
|
* -text
|
||||||
|
* -check - validate the ec parameters
|
||||||
|
* -C
|
||||||
|
* -noout
|
||||||
|
* -genkey - generate a private public keypair based on the supplied curve
|
||||||
|
* -named_curve - use the curve oid instead of the parameters
|
||||||
|
* -NIST_192 - use the NIST recommended curve parameters over a 192 bit prime field
|
||||||
|
* -NIST_224 - use the NIST recommended curve parameters over a 224 bit prime field
|
||||||
|
* -NIST_256 - use the NIST recommended curve parameters over a 256 bit prime field
|
||||||
|
* -NIST_384 - use the NIST recommended curve parameters over a 384 bit prime field
|
||||||
|
* -NIST_521 - use the NIST recommended curve parameters over a 521 bit prime field
|
||||||
|
* -X9_62_192v1 - use the X9_62 192v1 example curve over a 192 bit prime field
|
||||||
|
* -X9_62_192v2 - use the X9_62 192v2 example curve over a 192 bit prime field
|
||||||
|
* -X9_62_192v3 - use the X9_62 192v3 example curve over a 192 bit prime field
|
||||||
|
* -X9_62_239v1 - use the X9_62 239v1 example curve over a 239 bit prime field
|
||||||
|
* -X9_62_239v2 - use the X9_62 239v2 example curve over a 239 bit prime field
|
||||||
|
* -X9_62_239v3 - use the X9_62 239v3 example curve over a 239 bit prime field
|
||||||
|
* -X9_62_256v1 - use the X9_62 239v1 example curve over a 256 bit prime field
|
||||||
|
* -SECG_PRIME_112R1 - use the SECG 112r1 recommended curve over a 112 bit prime field
|
||||||
|
* -SECG_PRIME_112R2 - use the SECG 112r2 recommended curve over a 112 bit prime field
|
||||||
|
* -SECG_PRIME_128R1 - use the SECG 128r1 recommended curve over a 128 bit prime field
|
||||||
|
* -SECG_PRIME_128R2 - use the SECG 128r2 recommended curve over a 128 bit prime field
|
||||||
|
* -SECG_PRIME_160K1 - use the SECG 160k1 recommended curve over a 160 bit prime field
|
||||||
|
* -SECG_PRIME_160R1 - use the SECG 160r1 recommended curve over a 160 bit prime field
|
||||||
|
* -SECG_PRIME_160R2 - use the SECG 160r2 recommended curve over a 160 bit prime field
|
||||||
|
* -SECG_PRIME_192K1 - use the SECG 192k1 recommended curve over a 192 bit prime field
|
||||||
|
* -SECG_PRIME_192R1 - use the SECG 192r1 recommended curve over a 192 bit prime field
|
||||||
|
* -SECG_PRIME_224K1 - use the SECG 224k1 recommended curve over a 224 bit prime field
|
||||||
|
* -SECG_PRIME_224R1 - use the SECG 224r1 recommended curve over a 224 bit prime field
|
||||||
|
* -SECG_PRIME_256K1 - use the SECG 256k1 recommended curve over a 256 bit prime field
|
||||||
|
* -SECG_PRIME_256R1 - use the SECG 256r1 recommended curve over a 256 bit prime field
|
||||||
|
* -SECG_PRIME_384R1 - use the SECG 384r1 recommended curve over a 384 bit prime field
|
||||||
|
* -SECG_PRIME_521R1 - use the SECG 521r1 recommended curve over a 521 bit prime field
|
||||||
|
* -WTLS_6 - use the WAP/WTLS recommended curve number 6 over a 112 bit field
|
||||||
|
* -WTLS_8 - use the WAP/WTLS recommended curve number 8 over a 112 bit field
|
||||||
|
* -WTLS_9 - use the WAP/WTLS recommended curve number 9 over a 160 bit field
|
||||||
|
*/
|
||||||
|
|
||||||
|
int MAIN(int, char **);
|
||||||
|
|
||||||
|
int MAIN(int argc, char **argv)
|
||||||
|
{
|
||||||
|
ENGINE *e = NULL;
|
||||||
|
ECDSA *ecdsa = NULL;
|
||||||
|
int i, badops = 0, text = 0;
|
||||||
|
BIO *in = NULL, *out = NULL;
|
||||||
|
int informat, outformat, noout = 0, C = 0, ret = 1;
|
||||||
|
char *infile, *outfile, *prog, *inrand = NULL;
|
||||||
|
int genkey = 0;
|
||||||
|
int check = 0;
|
||||||
|
int need_rand = 0;
|
||||||
|
char *engine=NULL;
|
||||||
|
int curve_type = EC_GROUP_NO_CURVE;
|
||||||
|
int named_curve = 0;
|
||||||
|
BIGNUM *tmp_1 = NULL, *tmp_2 = NULL, *tmp_3 = NULL, *tmp_4 = NULL, *tmp_5 = NULL,
|
||||||
|
*tmp_6 = NULL, *tmp_7 = NULL;
|
||||||
|
BN_CTX *ctx = NULL;
|
||||||
|
EC_POINT *point = NULL;
|
||||||
|
unsigned char *data = NULL;
|
||||||
|
|
||||||
|
apps_startup();
|
||||||
|
|
||||||
|
if (bio_err == NULL)
|
||||||
|
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
|
||||||
|
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
|
||||||
|
|
||||||
|
if (!load_config(bio_err, NULL))
|
||||||
|
goto end;
|
||||||
|
|
||||||
|
infile=NULL;
|
||||||
|
outfile=NULL;
|
||||||
|
informat=FORMAT_PEM;
|
||||||
|
outformat=FORMAT_PEM;
|
||||||
|
|
||||||
|
prog=argv[0];
|
||||||
|
argc--;
|
||||||
|
argv++;
|
||||||
|
while (argc >= 1)
|
||||||
|
{
|
||||||
|
if (strcmp(*argv,"-inform") == 0)
|
||||||
|
{
|
||||||
|
if (--argc < 1) goto bad;
|
||||||
|
informat=str2fmt(*(++argv));
|
||||||
|
}
|
||||||
|
else if (strcmp(*argv,"-outform") == 0)
|
||||||
|
{
|
||||||
|
if (--argc < 1) goto bad;
|
||||||
|
outformat=str2fmt(*(++argv));
|
||||||
|
}
|
||||||
|
else if (strcmp(*argv,"-in") == 0)
|
||||||
|
{
|
||||||
|
if (--argc < 1) goto bad;
|
||||||
|
infile= *(++argv);
|
||||||
|
}
|
||||||
|
else if (strcmp(*argv,"-out") == 0)
|
||||||
|
{
|
||||||
|
if (--argc < 1) goto bad;
|
||||||
|
outfile= *(++argv);
|
||||||
|
}
|
||||||
|
else if(strcmp(*argv, "-engine") == 0)
|
||||||
|
{
|
||||||
|
if (--argc < 1) goto bad;
|
||||||
|
engine = *(++argv);
|
||||||
|
}
|
||||||
|
else if (strcmp(*argv,"-text") == 0)
|
||||||
|
text = 1;
|
||||||
|
else if (strcmp(*argv,"-C") == 0)
|
||||||
|
C = 1;
|
||||||
|
else if (strcmp(*argv,"-check") == 0)
|
||||||
|
check = 1;
|
||||||
|
else if (strcmp(*argv,"-genkey") == 0)
|
||||||
|
{
|
||||||
|
genkey = 1;
|
||||||
|
need_rand = 1;
|
||||||
|
}
|
||||||
|
else if (strcmp(*argv,"-rand") == 0)
|
||||||
|
{
|
||||||
|
if (--argc < 1) goto bad;
|
||||||
|
inrand= *(++argv);
|
||||||
|
need_rand=1;
|
||||||
|
}
|
||||||
|
else if (strcmp(*argv, "-named_curve") == 0)
|
||||||
|
named_curve = 1;
|
||||||
|
else if (strcmp(*argv, "-NIST_192") == 0)
|
||||||
|
curve_type = EC_GROUP_NIST_PRIME_192;
|
||||||
|
else if (strcmp(*argv, "-NIST_224") == 0)
|
||||||
|
curve_type = EC_GROUP_NIST_PRIME_224;
|
||||||
|
else if (strcmp(*argv, "-NIST_256") == 0)
|
||||||
|
curve_type = EC_GROUP_NIST_PRIME_256;
|
||||||
|
else if (strcmp(*argv, "-NIST_384") == 0)
|
||||||
|
curve_type = EC_GROUP_NIST_PRIME_384;
|
||||||
|
else if (strcmp(*argv, "-NIST_521") == 0)
|
||||||
|
curve_type = EC_GROUP_NIST_PRIME_521;
|
||||||
|
else if (strcmp(*argv, "-X9_62_192v1") == 0)
|
||||||
|
curve_type = EC_GROUP_X9_62_PRIME_192V1;
|
||||||
|
else if (strcmp(*argv, "-X9_62_192v2") == 0)
|
||||||
|
curve_type = EC_GROUP_X9_62_PRIME_192V2;
|
||||||
|
else if (strcmp(*argv, "-X9_62_192v3") == 0)
|
||||||
|
curve_type = EC_GROUP_X9_62_PRIME_192V3;
|
||||||
|
else if (strcmp(*argv, "-X9_62_239v1") == 0)
|
||||||
|
curve_type = EC_GROUP_X9_62_PRIME_239V1;
|
||||||
|
else if (strcmp(*argv, "-X9_62_239v2") == 0)
|
||||||
|
curve_type = EC_GROUP_X9_62_PRIME_239V2;
|
||||||
|
else if (strcmp(*argv, "-X9_62_239v3") == 0)
|
||||||
|
curve_type = EC_GROUP_X9_62_PRIME_239V3;
|
||||||
|
else if (strcmp(*argv, "-X9_62_256v1") == 0)
|
||||||
|
curve_type = EC_GROUP_X9_62_PRIME_256V1;
|
||||||
|
else if (strcmp(*argv, "-SECG_PRIME_112R1") == 0)
|
||||||
|
curve_type = EC_GROUP_SECG_PRIME_112R1;
|
||||||
|
else if (strcmp(*argv, "-SECG_PRIME_112R2") == 0)
|
||||||
|
curve_type = EC_GROUP_SECG_PRIME_112R2;
|
||||||
|
else if (strcmp(*argv, "-SECG_PRIME_128R1") == 0)
|
||||||
|
curve_type = EC_GROUP_SECG_PRIME_128R1;
|
||||||
|
else if (strcmp(*argv, "-SECG_PRIME_128R2") == 0)
|
||||||
|
curve_type = EC_GROUP_SECG_PRIME_128R2;
|
||||||
|
else if (strcmp(*argv, "-SECG_PRIME_160K1") == 0)
|
||||||
|
curve_type = EC_GROUP_SECG_PRIME_160K1;
|
||||||
|
else if (strcmp(*argv, "-SECG_PRIME_160R1") == 0)
|
||||||
|
curve_type = EC_GROUP_SECG_PRIME_160R1;
|
||||||
|
else if (strcmp(*argv, "-SECG_PRIME_160R2") == 0)
|
||||||
|
curve_type = EC_GROUP_SECG_PRIME_160R2;
|
||||||
|
else if (strcmp(*argv, "-SECG_PRIME_192K1") == 0)
|
||||||
|
curve_type = EC_GROUP_SECG_PRIME_192K1;
|
||||||
|
else if (strcmp(*argv, "-SECG_PRIME_192R1") == 0)
|
||||||
|
curve_type = EC_GROUP_SECG_PRIME_192R1;
|
||||||
|
else if (strcmp(*argv, "-SECG_PRIME_224K1") == 0)
|
||||||
|
curve_type = EC_GROUP_SECG_PRIME_224K1;
|
||||||
|
else if (strcmp(*argv, "-SECG_PRIME_224R1") == 0)
|
||||||
|
curve_type = EC_GROUP_SECG_PRIME_224R1;
|
||||||
|
else if (strcmp(*argv, "-SECG_PRIME_256K1") == 0)
|
||||||
|
curve_type = EC_GROUP_SECG_PRIME_256K1;
|
||||||
|
else if (strcmp(*argv, "-SECG_PRIME_256R1") == 0)
|
||||||
|
curve_type = EC_GROUP_SECG_PRIME_256R1;
|
||||||
|
else if (strcmp(*argv, "-SECG_PRIME_384R1") == 0)
|
||||||
|
curve_type = EC_GROUP_SECG_PRIME_384R1;
|
||||||
|
else if (strcmp(*argv, "-SECG_PRIME_521R1") == 0)
|
||||||
|
curve_type = EC_GROUP_SECG_PRIME_521R1;
|
||||||
|
else if (strcmp(*argv, "-WTLS_6") == 0)
|
||||||
|
curve_type = EC_GROUP_WTLS_6;
|
||||||
|
else if (strcmp(*argv, "-WTLS_8") == 0)
|
||||||
|
curve_type = EC_GROUP_WTLS_8;
|
||||||
|
else if (strcmp(*argv, "-WTLS_9") == 0)
|
||||||
|
curve_type = EC_GROUP_WTLS_9;
|
||||||
|
else if (strcmp(*argv, "-noout") == 0)
|
||||||
|
noout=1;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BIO_printf(bio_err,"unknown option %s\n",*argv);
|
||||||
|
badops=1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
argc--;
|
||||||
|
argv++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (badops)
|
||||||
|
{
|
||||||
|
bad:
|
||||||
|
BIO_printf(bio_err,"%s [options] [bits] <infile >outfile\n",prog);
|
||||||
|
BIO_printf(bio_err,"where options are\n");
|
||||||
|
BIO_printf(bio_err," -inform arg input format - DER or PEM\n");
|
||||||
|
BIO_printf(bio_err," -outform arg output format - DER or PEM\n");
|
||||||
|
BIO_printf(bio_err," -in arg input file\n");
|
||||||
|
BIO_printf(bio_err," -out arg output file\n");
|
||||||
|
BIO_printf(bio_err," -text print as text\n");
|
||||||
|
BIO_printf(bio_err," -C Output C code\n");
|
||||||
|
BIO_printf(bio_err," -check validate the ec parameters\n");
|
||||||
|
BIO_printf(bio_err," -noout no output\n");
|
||||||
|
BIO_printf(bio_err," -rand files to use for random number input\n");
|
||||||
|
BIO_printf(bio_err," -engine e use engine e, possibly a hardware device.\n");
|
||||||
|
BIO_printf(bio_err," -named_curve use the curve oid instead of the parameters\n");
|
||||||
|
BIO_printf(bio_err," -NIST_192 use the NIST recommended curve parameters over a 192 bit prime field\n");
|
||||||
|
BIO_printf(bio_err," -NIST_224 use the NIST recommended curve parameters over a 224 bit prime field\n");
|
||||||
|
BIO_printf(bio_err," -NIST_256 use the NIST recommended curve parameters over a 256 bit prime field\n");
|
||||||
|
BIO_printf(bio_err," -NIST_384 use the NIST recommended curve parameters over a 384 bit prime field\n");
|
||||||
|
BIO_printf(bio_err," -NIST_521 use the NIST recommended curve parameters over a 521 bit prime field\n");
|
||||||
|
BIO_printf(bio_err," -X9_62_192v1 use the X9_62 192v1 example curve over a 192 bit prime field\n");
|
||||||
|
BIO_printf(bio_err," -X9_62_192v2 use the X9_62 192v2 example curve over a 192 bit prime field\n");
|
||||||
|
BIO_printf(bio_err," -X9_62_192v3 use the X9_62 192v3 example curve over a 192 bit prime field\n");
|
||||||
|
BIO_printf(bio_err," -X9_62_239v1 use the X9_62 239v1 example curve over a 239 bit prime field\n");
|
||||||
|
BIO_printf(bio_err," -X9_62_239v2 use the X9_62 239v2 example curve over a 239 bit prime field\n");
|
||||||
|
BIO_printf(bio_err," -X9_62_239v3 use the X9_62 239v3 example curve over a 239 bit prime field\n");
|
||||||
|
BIO_printf(bio_err," -X9_62_256v1 use the X9_62 239v1 example curve over a 256 bit prime field\n");
|
||||||
|
BIO_printf(bio_err," -SECG_PRIME_112R1 use the SECG 112r1 recommended curve over a 112 bit prime field\n");
|
||||||
|
BIO_printf(bio_err," -SECG_PRIME_112R2 use the SECG 112r2 recommended curve over a 112 bit prime field\n");
|
||||||
|
BIO_printf(bio_err," -SECG_PRIME_128R1 use the SECG 128r1 recommended curve over a 128 bit prime field\n");
|
||||||
|
BIO_printf(bio_err," -SECG_PRIME_128R2 use the SECG 128r2 recommended curve over a 128 bit prime field\n");
|
||||||
|
BIO_printf(bio_err," -SECG_PRIME_160K1 use the SECG 160k1 recommended curve over a 160 bit prime field\n");
|
||||||
|
BIO_printf(bio_err," -SECG_PRIME_160R1 use the SECG 160r1 recommended curve over a 160 bit prime field\n");
|
||||||
|
BIO_printf(bio_err," -SECG_PRIME_160R2 use the SECG 160r2 recommended curve over a 160 bit prime field\n");
|
||||||
|
BIO_printf(bio_err," -SECG_PRIME_192K1 use the SECG 192k1 recommended curve over a 192 bit prime field\n");
|
||||||
|
BIO_printf(bio_err," -SECG_PRIME_192R1 use the SECG 192r1 recommended curve over a 192 bit prime field\n");
|
||||||
|
BIO_printf(bio_err," -SECG_PRIME_224K1 use the SECG 224k1 recommended curve over a 224 bit prime field\n");
|
||||||
|
BIO_printf(bio_err," -SECG_PRIME_224R1 use the SECG 224r1 recommended curve over a 224 bit prime field\n");
|
||||||
|
BIO_printf(bio_err," -SECG_PRIME_256K1 use the SECG 256k1 recommended curve over a 256 bit prime field\n");
|
||||||
|
BIO_printf(bio_err," -SECG_PRIME_256R1 use the SECG 256r1 recommended curve over a 256 bit prime field\n");
|
||||||
|
BIO_printf(bio_err," -SECG_PRIME_384R1 use the SECG 384r1 recommended curve over a 384 bit prime field\n");
|
||||||
|
BIO_printf(bio_err," -SECG_PRIME_521R1 use the SECG 521r1 recommended curve over a 521 bit prime field\n");
|
||||||
|
BIO_printf(bio_err," -WTLS_6 use the WAP/WTLS recommended curve number 6 over a 112 bit field\n");
|
||||||
|
BIO_printf(bio_err," -WTLS_8 use the WAP/WTLS recommended curve number 8 over a 112 bit field\n");
|
||||||
|
BIO_printf(bio_err," -WTLS_9 use the WAP/WTLS recommended curve number 9 over a 112 bit field\n");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
ERR_load_crypto_strings();
|
||||||
|
|
||||||
|
in=BIO_new(BIO_s_file());
|
||||||
|
out=BIO_new(BIO_s_file());
|
||||||
|
if ((in == NULL) || (out == NULL))
|
||||||
|
{
|
||||||
|
ERR_print_errors(bio_err);
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (infile == NULL)
|
||||||
|
BIO_set_fp(in,stdin,BIO_NOCLOSE);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (BIO_read_filename(in,infile) <= 0)
|
||||||
|
{
|
||||||
|
perror(infile);
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (outfile == NULL)
|
||||||
|
{
|
||||||
|
BIO_set_fp(out,stdout,BIO_NOCLOSE);
|
||||||
|
#ifdef OPENSSL_SYS_VMS
|
||||||
|
{
|
||||||
|
BIO *tmpbio = BIO_new(BIO_f_linebuffer());
|
||||||
|
out = BIO_push(tmpbio, out);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (BIO_write_filename(out,outfile) <= 0)
|
||||||
|
{
|
||||||
|
perror(outfile);
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
e = setup_engine(bio_err, engine, 0);
|
||||||
|
|
||||||
|
if (need_rand)
|
||||||
|
{
|
||||||
|
app_RAND_load_file(NULL, bio_err, (inrand != NULL));
|
||||||
|
if (inrand != NULL)
|
||||||
|
BIO_printf(bio_err,"%ld semi-random bytes loaded\n",
|
||||||
|
app_RAND_load_files(inrand));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (curve_type != EC_GROUP_NO_CURVE)
|
||||||
|
{
|
||||||
|
if ((ecdsa = ECDSA_new()) == NULL)
|
||||||
|
goto end;
|
||||||
|
ecdsa->group = EC_GROUP_new_by_name(curve_type);
|
||||||
|
if (named_curve)
|
||||||
|
ECDSA_set_parameter_flags(ecdsa, ECDSA_FLAG_NAMED_CURVE);
|
||||||
|
}
|
||||||
|
else if (informat == FORMAT_ASN1)
|
||||||
|
ecdsa = d2i_ECDSAParameters_bio(in,NULL);
|
||||||
|
else if (informat == FORMAT_PEM)
|
||||||
|
ecdsa = PEM_read_bio_ECDSAParameters(in, NULL, NULL, NULL);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BIO_printf(bio_err, "bad input format specified\n");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
if (ecdsa == NULL)
|
||||||
|
{
|
||||||
|
BIO_printf(bio_err, "unable to load ECDSA parameters\n");
|
||||||
|
ERR_print_errors(bio_err);
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (text)
|
||||||
|
{
|
||||||
|
ECDSAParameters_print(out, ecdsa);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (check)
|
||||||
|
{
|
||||||
|
if (ecdsa == NULL)
|
||||||
|
BIO_printf(bio_err, "no elliptic curve parameters\n");
|
||||||
|
BIO_printf(bio_err, "checking elliptic curve parameters: ");
|
||||||
|
if (!EC_GROUP_check(ecdsa->group, NULL))
|
||||||
|
{
|
||||||
|
BIO_printf(bio_err, "failed\n");
|
||||||
|
ERR_print_errors(bio_err);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
BIO_printf(bio_err, "ok\n");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (C)
|
||||||
|
{ /* TODO: characteristic two */
|
||||||
|
int l, len, bits_p;
|
||||||
|
if ((tmp_1 = BN_new()) == NULL || (tmp_2 = BN_new()) == NULL ||
|
||||||
|
(tmp_3 = BN_new()) == NULL || (tmp_4 = BN_new()) == NULL ||
|
||||||
|
(tmp_5 = BN_new()) == NULL || (tmp_6 = BN_new()) == NULL ||
|
||||||
|
(tmp_7 = BN_new()) == NULL || (ctx = BN_CTX_new()) == NULL)
|
||||||
|
{
|
||||||
|
perror("OPENSSL_malloc");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
if (!EC_GROUP_get_curve_GFp(ecdsa->group, tmp_1, tmp_2, tmp_3, ctx))
|
||||||
|
goto end;
|
||||||
|
if ((point = EC_GROUP_get0_generator(ecdsa->group)) == NULL)
|
||||||
|
goto end;
|
||||||
|
if (!EC_POINT_get_affine_coordinates_GFp(ecdsa->group, point, tmp_4, tmp_5, ctx))
|
||||||
|
goto end;
|
||||||
|
if (!EC_GROUP_get_order(ecdsa->group, tmp_6, ctx))
|
||||||
|
goto end;
|
||||||
|
if (!EC_GROUP_get_cofactor(ecdsa->group, tmp_7, ctx))
|
||||||
|
goto end;
|
||||||
|
|
||||||
|
len = BN_num_bytes(tmp_1);
|
||||||
|
bits_p = BN_num_bits(tmp_1);
|
||||||
|
data=(unsigned char *)OPENSSL_malloc(len+20);
|
||||||
|
if (data == NULL)
|
||||||
|
{
|
||||||
|
perror("OPENSSL_malloc");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
l = BN_bn2bin(tmp_1, data);
|
||||||
|
printf("static unsigned char ecdsa%d_p[]={", bits_p);
|
||||||
|
for (i=0; i<l; i++)
|
||||||
|
{
|
||||||
|
if ((i%12) == 0) printf("\n\t");
|
||||||
|
printf("0x%02X,",data[i]);
|
||||||
|
}
|
||||||
|
printf("\n\t};\n\n");
|
||||||
|
|
||||||
|
l = BN_bn2bin(tmp_2, data);
|
||||||
|
printf("static unsigned char ecdsa%d_a[]={",bits_p);
|
||||||
|
for (i=0; i<l; i++)
|
||||||
|
{
|
||||||
|
if ((i%12) == 0) printf("\n\t");
|
||||||
|
printf("0x%02X,",data[i]);
|
||||||
|
}
|
||||||
|
printf("\n\t};\n");
|
||||||
|
|
||||||
|
l = BN_bn2bin(tmp_3, data);
|
||||||
|
printf("static unsigned char ecdsa%d_b[]={", bits_p);
|
||||||
|
for (i=0; i<l; i++)
|
||||||
|
{
|
||||||
|
if ((i%12) == 0) printf("\n\t");
|
||||||
|
printf("0x%02X,",data[i]);
|
||||||
|
}
|
||||||
|
printf("\n\t};\n\n");
|
||||||
|
|
||||||
|
l = BN_bn2bin(tmp_4, data);
|
||||||
|
printf("static unsigned char ecdsa%d_x[]={", bits_p);
|
||||||
|
for (i=0; i<l; i++)
|
||||||
|
{
|
||||||
|
if ((i%12) == 0) printf("\n\t");
|
||||||
|
printf("0x%02X,",data[i]);
|
||||||
|
}
|
||||||
|
printf("\n\t};\n");
|
||||||
|
|
||||||
|
l = BN_bn2bin(tmp_5, data);
|
||||||
|
printf("static unsigned char ecdsa%d_y[]={", bits_p);
|
||||||
|
for (i=0; i<l; i++)
|
||||||
|
{
|
||||||
|
if ((i%12) == 0) printf("\n\t");
|
||||||
|
printf("0x%02X,",data[i]);
|
||||||
|
}
|
||||||
|
printf("\n\t};\n");
|
||||||
|
|
||||||
|
l = BN_bn2bin(tmp_6, data);
|
||||||
|
printf("static unsigned char ecdsa%d_o[]={", bits_p);
|
||||||
|
for (i=0; i<l; i++)
|
||||||
|
{
|
||||||
|
if ((i%12) == 0) printf("\n\t");
|
||||||
|
printf("0x%02X,",data[i]);
|
||||||
|
}
|
||||||
|
printf("\n\t};\n");
|
||||||
|
|
||||||
|
l = BN_bn2bin(tmp_7, data);
|
||||||
|
printf("static unsigned char ecdsa%d_c[]={", bits_p);
|
||||||
|
for (i=0; i<l; i++)
|
||||||
|
{
|
||||||
|
if ((i%12) == 0) printf("\n\t");
|
||||||
|
printf("0x%02X,",data[i]);
|
||||||
|
}
|
||||||
|
printf("\n\t};\n\n");
|
||||||
|
|
||||||
|
/* FIXME:
|
||||||
|
* generated code should check for errors
|
||||||
|
*/
|
||||||
|
|
||||||
|
printf("ECDSA *get_ecdsa%d(void)\n\t{\n",bits_p);
|
||||||
|
printf("\tint ok=0;\n");
|
||||||
|
printf("\tECDSA *ecdsa=NULL;\n");
|
||||||
|
printf("\tEC_POINT *point=NULL;\n");
|
||||||
|
printf("\tBIGNUM *tmp_1=NULL,*tmp_2=NULL,*tmp_3=NULL;\n\n");
|
||||||
|
printf("\tif ((ecdsa=ECDSA_new()) == NULL)\n");
|
||||||
|
printf("\t\treturn(NULL);\n\n");
|
||||||
|
printf("\t/* generate EC_GROUP structure */\n");
|
||||||
|
printf("\tif ((tmp_1 = BN_bin2bn(ecdsa%d_p, sizeof(ecdsa%d_p), NULL)) == NULL) goto err;\n", bits_p, bits_p);
|
||||||
|
printf("\tif ((tmp_2 = BN_bin2bn(ecdsa%d_a, sizeof(ecdsa%d_a), NULL)) == NULL) goto err;\n", bits_p, bits_p);
|
||||||
|
printf("\tif ((tmp_3 = BN_bin2bn(ecdsa%d_b, sizeof(ecdsa%d_b), NULL)) == NULL) goto err;\n", bits_p, bits_p);
|
||||||
|
printf("\tif ((ecdsa->group = EC_GROUP_new_curve_GFp(tmp_1, tmp_2, tmp_3, NULL)) == NULL) goto err;\n\n");
|
||||||
|
printf("\t/* build generator */\n");
|
||||||
|
printf("\tif (!BN_bin2bn(ecdsa%d_x, sizeof(ecdsa%d_x), tmp_1)) goto err;\n", bits_p, bits_p);
|
||||||
|
printf("\tif (!BN_bin2bn(ecdsa%d_y, sizeof(ecdsa%d_y), tmp_2)) goto err;\n", bits_p, bits_p);
|
||||||
|
printf("\tif ((point = EC_POINT_new(ecdsa->group)) == NULL) goto err;\n");
|
||||||
|
printf("\tif (!EC_POINT_set_affine_coordinates_GFp(ecdsa->group, point, tmp_1, tmp_2, NULL)) goto err;\n");
|
||||||
|
printf("\t/* set generator, order and cofactor */\n");
|
||||||
|
printf("\tif (!BN_bin2bn(ecdsa%d_o, sizeof(ecdsa%d_o), tmp_1)) goto err;\n", bits_p, bits_p);
|
||||||
|
printf("\tif (!BN_bin2bn(ecdsa%d_c, sizeof(ecdsa%d_c), tmp_2)) goto err;\n", bits_p, bits_p);
|
||||||
|
printf("\tif (!EC_GROUP_set_generator(ecdsa->group, point, tmp_1, tmp_2)) goto err;\n");
|
||||||
|
printf("\n\tok=1;\n");
|
||||||
|
printf("err:\n");
|
||||||
|
printf("\tif (tmp_1) BN_free(tmp_1);\n");
|
||||||
|
printf("\tif (tmp_2) BN_free(tmp_2);\n");
|
||||||
|
printf("\tif (tmp_3) BN_free(tmp_3);\n");
|
||||||
|
printf("\tif (point) EC_POINT_free(point);\n");
|
||||||
|
printf("\tif (!ok)\n");
|
||||||
|
printf("\t\t{\n");
|
||||||
|
printf("\t\tECDSA_free(ecdsa);\n");
|
||||||
|
printf("\t\tecdsa = NULL;\n");
|
||||||
|
printf("\t\t}\n");
|
||||||
|
printf("\treturn(ecdsa);\n\t}\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!noout)
|
||||||
|
{
|
||||||
|
if (outformat == FORMAT_ASN1)
|
||||||
|
i = i2d_ECDSAParameters_bio(out, ecdsa);
|
||||||
|
else if (outformat == FORMAT_PEM)
|
||||||
|
i = PEM_write_bio_ECDSAParameters(out, ecdsa);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BIO_printf(bio_err,"bad output format specified for outfile\n");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
if (!i)
|
||||||
|
{
|
||||||
|
BIO_printf(bio_err, "unable to write ECDSA parameters\n");
|
||||||
|
ERR_print_errors(bio_err);
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (genkey)
|
||||||
|
{
|
||||||
|
ECDSA *ecdsakey;
|
||||||
|
|
||||||
|
assert(need_rand);
|
||||||
|
if ((ecdsakey = ECDSAParameters_dup(ecdsa)) == NULL) goto end;
|
||||||
|
if (!ECDSA_generate_key(ecdsakey)) goto end;
|
||||||
|
if (outformat == FORMAT_ASN1)
|
||||||
|
i = i2d_ECDSAPrivateKey_bio(out, ecdsakey);
|
||||||
|
else if (outformat == FORMAT_PEM)
|
||||||
|
i = PEM_write_bio_ECDSAPrivateKey(out, ecdsakey, NULL, NULL, 0, NULL, NULL);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BIO_printf(bio_err, "bad output format specified for outfile\n");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
ECDSA_free(ecdsakey);
|
||||||
|
}
|
||||||
|
if (need_rand)
|
||||||
|
app_RAND_write_file(NULL, bio_err);
|
||||||
|
ret=0;
|
||||||
|
end:
|
||||||
|
if (in != NULL) BIO_free(in);
|
||||||
|
if (out != NULL) BIO_free_all(out);
|
||||||
|
if (ecdsa != NULL) ECDSA_free(ecdsa);
|
||||||
|
if (tmp_1) BN_free(tmp_1);
|
||||||
|
if (tmp_2) BN_free(tmp_2);
|
||||||
|
if (tmp_3) BN_free(tmp_3);
|
||||||
|
if (tmp_3) BN_free(tmp_4);
|
||||||
|
if (tmp_3) BN_free(tmp_5);
|
||||||
|
if (tmp_3) BN_free(tmp_6);
|
||||||
|
if (tmp_3) BN_free(tmp_7);
|
||||||
|
if (ctx) BN_CTX_free(ctx);
|
||||||
|
if (data) OPENSSL_free(data);
|
||||||
|
apps_shutdown();
|
||||||
|
EXIT(ret);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
38
apps/enc.c
38
apps/enc.c
@@ -66,11 +66,7 @@
|
|||||||
#include <openssl/objects.h>
|
#include <openssl/objects.h>
|
||||||
#include <openssl/x509.h>
|
#include <openssl/x509.h>
|
||||||
#include <openssl/rand.h>
|
#include <openssl/rand.h>
|
||||||
#ifndef OPENSSL_NO_MD5
|
|
||||||
#include <openssl/md5.h>
|
|
||||||
#endif
|
|
||||||
#include <openssl/pem.h>
|
#include <openssl/pem.h>
|
||||||
#include <openssl/engine.h>
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
int set_hex(char *in,unsigned char *out,int size);
|
int set_hex(char *in,unsigned char *out,int size);
|
||||||
@@ -121,8 +117,8 @@ int MAIN(int argc, char **argv)
|
|||||||
const EVP_CIPHER *cipher=NULL,*c;
|
const EVP_CIPHER *cipher=NULL,*c;
|
||||||
char *inf=NULL,*outf=NULL;
|
char *inf=NULL,*outf=NULL;
|
||||||
BIO *in=NULL,*out=NULL,*b64=NULL,*benc=NULL,*rbio=NULL,*wbio=NULL;
|
BIO *in=NULL,*out=NULL,*b64=NULL,*benc=NULL,*rbio=NULL,*wbio=NULL;
|
||||||
#define PROG_NAME_SIZE 16
|
#define PROG_NAME_SIZE 39
|
||||||
char pname[PROG_NAME_SIZE];
|
char pname[PROG_NAME_SIZE+1];
|
||||||
char *engine = NULL;
|
char *engine = NULL;
|
||||||
|
|
||||||
apps_startup();
|
apps_startup();
|
||||||
@@ -131,6 +127,9 @@ int MAIN(int argc, char **argv)
|
|||||||
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
|
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
|
||||||
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
|
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
|
||||||
|
|
||||||
|
if (!load_config(bio_err, NULL))
|
||||||
|
goto end;
|
||||||
|
|
||||||
/* first check the program name */
|
/* first check the program name */
|
||||||
program_name(argv[0],pname,PROG_NAME_SIZE);
|
program_name(argv[0],pname,PROG_NAME_SIZE);
|
||||||
if (strcmp(pname,"base64") == 0)
|
if (strcmp(pname,"base64") == 0)
|
||||||
@@ -285,23 +284,7 @@ bad:
|
|||||||
argv++;
|
argv++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (engine != NULL)
|
e = setup_engine(bio_err, engine, 0);
|
||||||
{
|
|
||||||
if((e = ENGINE_by_id(engine)) == NULL)
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"invalid engine \"%s\"\n",
|
|
||||||
engine);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"can't use that engine\n");
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
|
|
||||||
/* Free our "structural" reference. */
|
|
||||||
ENGINE_free(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bufsize != NULL)
|
if (bufsize != NULL)
|
||||||
{
|
{
|
||||||
@@ -507,6 +490,14 @@ bad:
|
|||||||
BIO_printf(bio_err,"invalid hex iv value\n");
|
BIO_printf(bio_err,"invalid hex iv value\n");
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
if ((hiv == NULL) && (str == NULL))
|
||||||
|
{
|
||||||
|
/* No IV was explicitly set and no IV was generated
|
||||||
|
* during EVP_BytesToKey. Hence the IV is undefined,
|
||||||
|
* making correct decryption impossible. */
|
||||||
|
BIO_printf(bio_err, "iv undefined\n");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
if ((hkey != NULL) && !set_hex(hkey,key,sizeof key))
|
if ((hkey != NULL) && !set_hex(hkey,key,sizeof key))
|
||||||
{
|
{
|
||||||
BIO_printf(bio_err,"invalid hex key value\n");
|
BIO_printf(bio_err,"invalid hex key value\n");
|
||||||
@@ -594,6 +585,7 @@ end:
|
|||||||
if (benc != NULL) BIO_free(benc);
|
if (benc != NULL) BIO_free(benc);
|
||||||
if (b64 != NULL) BIO_free(b64);
|
if (b64 != NULL) BIO_free(b64);
|
||||||
if(pass) OPENSSL_free(pass);
|
if(pass) OPENSSL_free(pass);
|
||||||
|
apps_shutdown();
|
||||||
EXIT(ret);
|
EXIT(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
335
apps/engine.c
335
apps/engine.c
@@ -72,9 +72,20 @@
|
|||||||
|
|
||||||
static char *engine_usage[]={
|
static char *engine_usage[]={
|
||||||
"usage: engine opts [engine ...]\n",
|
"usage: engine opts [engine ...]\n",
|
||||||
" -v - verbose mode, a textual listing of the engines in OpenSSL\n",
|
" -v[v[v[v]]] - verbose mode, for each engine, list its 'control commands'\n",
|
||||||
|
" -vv will additionally display each command's description\n",
|
||||||
|
" -vvv will also add the input flags for each command\n",
|
||||||
|
" -vvvv will also show internal input flags\n",
|
||||||
" -c - for each engine, also list the capabilities\n",
|
" -c - for each engine, also list the capabilities\n",
|
||||||
" -t - for each engine, check that they are really available\n",
|
" -t - for each engine, check that they are really available\n",
|
||||||
|
" -pre <cmd> - runs command 'cmd' against the ENGINE before any attempts\n",
|
||||||
|
" to load it (if -t is used)\n",
|
||||||
|
" -post <cmd> - runs command 'cmd' against the ENGINE after loading it\n",
|
||||||
|
" (only used if -t is also provided)\n",
|
||||||
|
" NB: -pre and -post will be applied to all ENGINEs supplied on the command\n",
|
||||||
|
" line, or all supported ENGINEs if none are specified.\n",
|
||||||
|
" Eg. '-pre \"SO_PATH:/lib/libdriver.so\"' calls command \"SO_PATH\" with\n",
|
||||||
|
" argument \"/lib/libdriver.so\".\n",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -83,7 +94,7 @@ static void identity(void *ptr)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int append_buf(char **buf, char *s, int *size, int step)
|
static int append_buf(char **buf, const char *s, int *size, int step)
|
||||||
{
|
{
|
||||||
int l = strlen(s);
|
int l = strlen(s);
|
||||||
|
|
||||||
@@ -115,6 +126,216 @@ static int append_buf(char **buf, char *s, int *size, int step)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int util_flags(BIO *bio_out, unsigned int flags, const char *indent)
|
||||||
|
{
|
||||||
|
int started = 0, err = 0;
|
||||||
|
/* Indent before displaying input flags */
|
||||||
|
BIO_printf(bio_out, "%s%s(input flags): ", indent, indent);
|
||||||
|
if(flags == 0)
|
||||||
|
{
|
||||||
|
BIO_printf(bio_out, "<no flags>\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
/* If the object is internal, mark it in a way that shows instead of
|
||||||
|
* having it part of all the other flags, even if it really is. */
|
||||||
|
if(flags & ENGINE_CMD_FLAG_INTERNAL)
|
||||||
|
{
|
||||||
|
BIO_printf(bio_out, "[Internal] ");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(flags & ENGINE_CMD_FLAG_NUMERIC)
|
||||||
|
{
|
||||||
|
if(started)
|
||||||
|
{
|
||||||
|
BIO_printf(bio_out, "|");
|
||||||
|
err = 1;
|
||||||
|
}
|
||||||
|
BIO_printf(bio_out, "NUMERIC");
|
||||||
|
started = 1;
|
||||||
|
}
|
||||||
|
/* Now we check that no combinations of the mutually exclusive NUMERIC,
|
||||||
|
* STRING, and NO_INPUT flags have been used. Future flags that can be
|
||||||
|
* OR'd together with these would need to added after these to preserve
|
||||||
|
* the testing logic. */
|
||||||
|
if(flags & ENGINE_CMD_FLAG_STRING)
|
||||||
|
{
|
||||||
|
if(started)
|
||||||
|
{
|
||||||
|
BIO_printf(bio_out, "|");
|
||||||
|
err = 1;
|
||||||
|
}
|
||||||
|
BIO_printf(bio_out, "STRING");
|
||||||
|
started = 1;
|
||||||
|
}
|
||||||
|
if(flags & ENGINE_CMD_FLAG_NO_INPUT)
|
||||||
|
{
|
||||||
|
if(started)
|
||||||
|
{
|
||||||
|
BIO_printf(bio_out, "|");
|
||||||
|
err = 1;
|
||||||
|
}
|
||||||
|
BIO_printf(bio_out, "NO_INPUT");
|
||||||
|
started = 1;
|
||||||
|
}
|
||||||
|
/* Check for unknown flags */
|
||||||
|
flags = flags & ~ENGINE_CMD_FLAG_NUMERIC &
|
||||||
|
~ENGINE_CMD_FLAG_STRING &
|
||||||
|
~ENGINE_CMD_FLAG_NO_INPUT &
|
||||||
|
~ENGINE_CMD_FLAG_INTERNAL;
|
||||||
|
if(flags)
|
||||||
|
{
|
||||||
|
if(started) BIO_printf(bio_out, "|");
|
||||||
|
BIO_printf(bio_out, "<0x%04X>", flags);
|
||||||
|
}
|
||||||
|
if(err)
|
||||||
|
BIO_printf(bio_out, " <illegal flags!>");
|
||||||
|
BIO_printf(bio_out, "\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int util_verbose(ENGINE *e, int verbose, BIO *bio_out, const char *indent)
|
||||||
|
{
|
||||||
|
static const int line_wrap = 78;
|
||||||
|
int num;
|
||||||
|
int ret = 0;
|
||||||
|
char *name = NULL;
|
||||||
|
char *desc = NULL;
|
||||||
|
int flags;
|
||||||
|
int xpos = 0;
|
||||||
|
STACK *cmds = NULL;
|
||||||
|
if(!ENGINE_ctrl(e, ENGINE_CTRL_HAS_CTRL_FUNCTION, 0, NULL, NULL) ||
|
||||||
|
((num = ENGINE_ctrl(e, ENGINE_CTRL_GET_FIRST_CMD_TYPE,
|
||||||
|
0, NULL, NULL)) <= 0))
|
||||||
|
{
|
||||||
|
#if 0
|
||||||
|
BIO_printf(bio_out, "%s<no control commands>\n", indent);
|
||||||
|
#endif
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
cmds = sk_new_null();
|
||||||
|
|
||||||
|
if(!cmds)
|
||||||
|
goto err;
|
||||||
|
do {
|
||||||
|
int len;
|
||||||
|
/* Get the command input flags */
|
||||||
|
if((flags = ENGINE_ctrl(e, ENGINE_CTRL_GET_CMD_FLAGS, num,
|
||||||
|
NULL, NULL)) < 0)
|
||||||
|
goto err;
|
||||||
|
if (!(flags & ENGINE_CMD_FLAG_INTERNAL) || verbose >= 4)
|
||||||
|
{
|
||||||
|
/* Get the command name */
|
||||||
|
if((len = ENGINE_ctrl(e, ENGINE_CTRL_GET_NAME_LEN_FROM_CMD, num,
|
||||||
|
NULL, NULL)) <= 0)
|
||||||
|
goto err;
|
||||||
|
if((name = OPENSSL_malloc(len + 1)) == NULL)
|
||||||
|
goto err;
|
||||||
|
if(ENGINE_ctrl(e, ENGINE_CTRL_GET_NAME_FROM_CMD, num, name,
|
||||||
|
NULL) <= 0)
|
||||||
|
goto err;
|
||||||
|
/* Get the command description */
|
||||||
|
if((len = ENGINE_ctrl(e, ENGINE_CTRL_GET_DESC_LEN_FROM_CMD, num,
|
||||||
|
NULL, NULL)) < 0)
|
||||||
|
goto err;
|
||||||
|
if(len > 0)
|
||||||
|
{
|
||||||
|
if((desc = OPENSSL_malloc(len + 1)) == NULL)
|
||||||
|
goto err;
|
||||||
|
if(ENGINE_ctrl(e, ENGINE_CTRL_GET_DESC_FROM_CMD, num, desc,
|
||||||
|
NULL) <= 0)
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
/* Now decide on the output */
|
||||||
|
if(xpos == 0)
|
||||||
|
/* Do an indent */
|
||||||
|
xpos = BIO_printf(bio_out, indent);
|
||||||
|
else
|
||||||
|
/* Otherwise prepend a ", " */
|
||||||
|
xpos += BIO_printf(bio_out, ", ");
|
||||||
|
if(verbose == 1)
|
||||||
|
{
|
||||||
|
/* We're just listing names, comma-delimited */
|
||||||
|
if((xpos > (int)strlen(indent)) &&
|
||||||
|
(xpos + (int)strlen(name) > line_wrap))
|
||||||
|
{
|
||||||
|
BIO_printf(bio_out, "\n");
|
||||||
|
xpos = BIO_printf(bio_out, indent);
|
||||||
|
}
|
||||||
|
xpos += BIO_printf(bio_out, "%s", name);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* We're listing names plus descriptions */
|
||||||
|
BIO_printf(bio_out, "%s: %s\n", name,
|
||||||
|
(desc == NULL) ? "<no description>" : desc);
|
||||||
|
/* ... and sometimes input flags */
|
||||||
|
if((verbose >= 3) && !util_flags(bio_out, flags,
|
||||||
|
indent))
|
||||||
|
goto err;
|
||||||
|
xpos = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
OPENSSL_free(name); name = NULL;
|
||||||
|
if(desc) { OPENSSL_free(desc); desc = NULL; }
|
||||||
|
/* Move to the next command */
|
||||||
|
num = ENGINE_ctrl(e, ENGINE_CTRL_GET_NEXT_CMD_TYPE,
|
||||||
|
num, NULL, NULL);
|
||||||
|
} while(num > 0);
|
||||||
|
if(xpos > 0)
|
||||||
|
BIO_printf(bio_out, "\n");
|
||||||
|
ret = 1;
|
||||||
|
err:
|
||||||
|
if(cmds) sk_pop_free(cmds, identity);
|
||||||
|
if(name) OPENSSL_free(name);
|
||||||
|
if(desc) OPENSSL_free(desc);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void util_do_cmds(ENGINE *e, STACK *cmds, BIO *bio_out, const char *indent)
|
||||||
|
{
|
||||||
|
int loop, res, num = sk_num(cmds);
|
||||||
|
if(num < 0)
|
||||||
|
{
|
||||||
|
BIO_printf(bio_out, "[Error]: internal stack error\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for(loop = 0; loop < num; loop++)
|
||||||
|
{
|
||||||
|
char buf[256];
|
||||||
|
const char *cmd, *arg;
|
||||||
|
cmd = sk_value(cmds, loop);
|
||||||
|
res = 1; /* assume success */
|
||||||
|
/* Check if this command has no ":arg" */
|
||||||
|
if((arg = strstr(cmd, ":")) == NULL)
|
||||||
|
{
|
||||||
|
if(!ENGINE_ctrl_cmd_string(e, cmd, NULL, 0))
|
||||||
|
res = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if((int)(arg - cmd) > 254)
|
||||||
|
{
|
||||||
|
BIO_printf(bio_out,"[Error]: command name too long\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
memcpy(buf, cmd, (int)(arg - cmd));
|
||||||
|
buf[arg-cmd] = '\0';
|
||||||
|
arg++; /* Move past the ":" */
|
||||||
|
/* Call the command with the argument */
|
||||||
|
if(!ENGINE_ctrl_cmd_string(e, buf, arg, 0))
|
||||||
|
res = 0;
|
||||||
|
}
|
||||||
|
if(res)
|
||||||
|
BIO_printf(bio_out, "[Success]: %s\n", cmd);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BIO_printf(bio_out, "[Failure]: %s\n", cmd);
|
||||||
|
ERR_print_errors(bio_out);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int MAIN(int, char **);
|
int MAIN(int, char **);
|
||||||
|
|
||||||
int MAIN(int argc, char **argv)
|
int MAIN(int argc, char **argv)
|
||||||
@@ -124,14 +345,20 @@ int MAIN(int argc, char **argv)
|
|||||||
int verbose=0, list_cap=0, test_avail=0;
|
int verbose=0, list_cap=0, test_avail=0;
|
||||||
ENGINE *e;
|
ENGINE *e;
|
||||||
STACK *engines = sk_new_null();
|
STACK *engines = sk_new_null();
|
||||||
int badops=0;
|
STACK *pre_cmds = sk_new_null();
|
||||||
|
STACK *post_cmds = sk_new_null();
|
||||||
|
int badops=1;
|
||||||
BIO *bio_out=NULL;
|
BIO *bio_out=NULL;
|
||||||
|
const char *indent = " ";
|
||||||
|
|
||||||
apps_startup();
|
apps_startup();
|
||||||
SSL_load_error_strings();
|
SSL_load_error_strings();
|
||||||
|
|
||||||
if (bio_err == NULL)
|
if (bio_err == NULL)
|
||||||
bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
|
bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
|
||||||
|
|
||||||
|
if (!load_config(bio_err, NULL))
|
||||||
|
goto end;
|
||||||
bio_out=BIO_new_fp(stdout,BIO_NOCLOSE);
|
bio_out=BIO_new_fp(stdout,BIO_NOCLOSE);
|
||||||
#ifdef OPENSSL_SYS_VMS
|
#ifdef OPENSSL_SYS_VMS
|
||||||
{
|
{
|
||||||
@@ -144,25 +371,38 @@ int MAIN(int argc, char **argv)
|
|||||||
argv++;
|
argv++;
|
||||||
while (argc >= 1)
|
while (argc >= 1)
|
||||||
{
|
{
|
||||||
if (strcmp(*argv,"-v") == 0)
|
if (strncmp(*argv,"-v",2) == 0)
|
||||||
verbose=1;
|
{
|
||||||
|
if(strspn(*argv + 1, "v") < strlen(*argv + 1))
|
||||||
|
goto skip_arg_loop;
|
||||||
|
if((verbose=strlen(*argv + 1)) > 4)
|
||||||
|
goto skip_arg_loop;
|
||||||
|
}
|
||||||
else if (strcmp(*argv,"-c") == 0)
|
else if (strcmp(*argv,"-c") == 0)
|
||||||
list_cap=1;
|
list_cap=1;
|
||||||
else if (strcmp(*argv,"-t") == 0)
|
else if (strcmp(*argv,"-t") == 0)
|
||||||
test_avail=1;
|
test_avail=1;
|
||||||
|
else if (strcmp(*argv,"-pre") == 0)
|
||||||
|
{
|
||||||
|
argc--; argv++;
|
||||||
|
sk_push(pre_cmds,*argv);
|
||||||
|
}
|
||||||
|
else if (strcmp(*argv,"-post") == 0)
|
||||||
|
{
|
||||||
|
argc--; argv++;
|
||||||
|
sk_push(post_cmds,*argv);
|
||||||
|
}
|
||||||
else if ((strncmp(*argv,"-h",2) == 0) ||
|
else if ((strncmp(*argv,"-h",2) == 0) ||
|
||||||
(strcmp(*argv,"-?") == 0))
|
(strcmp(*argv,"-?") == 0))
|
||||||
{
|
goto skip_arg_loop;
|
||||||
badops=1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
sk_push(engines,*argv);
|
sk_push(engines,*argv);
|
||||||
}
|
|
||||||
argc--;
|
argc--;
|
||||||
argv++;
|
argv++;
|
||||||
}
|
}
|
||||||
|
/* Looks like everything went OK */
|
||||||
|
badops = 0;
|
||||||
|
skip_arg_loop:
|
||||||
|
|
||||||
if (badops)
|
if (badops)
|
||||||
{
|
{
|
||||||
@@ -185,26 +425,22 @@ int MAIN(int argc, char **argv)
|
|||||||
if ((e = ENGINE_by_id(id)) != NULL)
|
if ((e = ENGINE_by_id(id)) != NULL)
|
||||||
{
|
{
|
||||||
const char *name = ENGINE_get_name(e);
|
const char *name = ENGINE_get_name(e);
|
||||||
BIO_printf(bio_out, "%s (%s)", name, id);
|
/* Do "id" first, then "name". Easier to auto-parse. */
|
||||||
if (list_cap || test_avail)
|
BIO_printf(bio_out, "(%s) %s\n", id, name);
|
||||||
BIO_printf(bio_out, ":");
|
util_do_cmds(e, pre_cmds, bio_out, indent);
|
||||||
if (test_avail)
|
if (strcmp(ENGINE_get_id(e), id) != 0)
|
||||||
{
|
{
|
||||||
if (ENGINE_init(e))
|
BIO_printf(bio_out, "Loaded: (%s) %s\n",
|
||||||
{
|
ENGINE_get_id(e), ENGINE_get_name(e));
|
||||||
BIO_printf(bio_out, " available");
|
|
||||||
ENGINE_finish(e);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
BIO_printf(bio_out, " unavailable");
|
|
||||||
ERR_clear_error();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (list_cap)
|
if (list_cap)
|
||||||
{
|
{
|
||||||
int cap_size = 256;
|
int cap_size = 256;
|
||||||
char *cap_buf = NULL;
|
char *cap_buf = NULL;
|
||||||
|
int k,n;
|
||||||
|
const int *nids;
|
||||||
|
ENGINE_CIPHERS_PTR fn_c;
|
||||||
|
ENGINE_DIGESTS_PTR fn_d;
|
||||||
|
|
||||||
if (ENGINE_get_RSA(e) != NULL
|
if (ENGINE_get_RSA(e) != NULL
|
||||||
&& !append_buf(&cap_buf, "RSA",
|
&& !append_buf(&cap_buf, "RSA",
|
||||||
@@ -223,12 +459,50 @@ int MAIN(int argc, char **argv)
|
|||||||
&cap_size, 256))
|
&cap_size, 256))
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
if (*cap_buf != '\0')
|
fn_c = ENGINE_get_ciphers(e);
|
||||||
BIO_printf(bio_out, " [%s]", cap_buf);
|
if(!fn_c) goto skip_ciphers;
|
||||||
|
n = fn_c(e, NULL, &nids, 0);
|
||||||
|
for(k=0 ; k < n ; ++k)
|
||||||
|
if(!append_buf(&cap_buf,
|
||||||
|
OBJ_nid2sn(nids[k]),
|
||||||
|
&cap_size, 256))
|
||||||
|
goto end;
|
||||||
|
|
||||||
|
skip_ciphers:
|
||||||
|
fn_d = ENGINE_get_digests(e);
|
||||||
|
if(!fn_d) goto skip_digests;
|
||||||
|
n = fn_d(e, NULL, &nids, 0);
|
||||||
|
for(k=0 ; k < n ; ++k)
|
||||||
|
if(!append_buf(&cap_buf,
|
||||||
|
OBJ_nid2sn(nids[k]),
|
||||||
|
&cap_size, 256))
|
||||||
|
goto end;
|
||||||
|
|
||||||
|
skip_digests:
|
||||||
|
if (cap_buf && (*cap_buf != '\0'))
|
||||||
|
BIO_printf(bio_out, " [%s]\n", cap_buf);
|
||||||
|
|
||||||
OPENSSL_free(cap_buf);
|
OPENSSL_free(cap_buf);
|
||||||
}
|
}
|
||||||
BIO_printf(bio_out, "\n");
|
if(test_avail)
|
||||||
|
{
|
||||||
|
BIO_printf(bio_out, "%s", indent);
|
||||||
|
if (ENGINE_init(e))
|
||||||
|
{
|
||||||
|
BIO_printf(bio_out, "[ available ]\n");
|
||||||
|
util_do_cmds(e, post_cmds, bio_out, indent);
|
||||||
|
ENGINE_finish(e);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BIO_printf(bio_out, "[ unavailable ]\n");
|
||||||
|
ERR_print_errors_fp(stdout);
|
||||||
|
ERR_clear_error();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if((verbose > 0) && !util_verbose(e, verbose, bio_out, indent))
|
||||||
|
goto end;
|
||||||
|
ENGINE_free(e);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ERR_print_errors(bio_err);
|
ERR_print_errors(bio_err);
|
||||||
@@ -238,6 +512,9 @@ int MAIN(int argc, char **argv)
|
|||||||
end:
|
end:
|
||||||
ERR_print_errors(bio_err);
|
ERR_print_errors(bio_err);
|
||||||
sk_pop_free(engines, identity);
|
sk_pop_free(engines, identity);
|
||||||
|
sk_pop_free(pre_cmds, identity);
|
||||||
|
sk_pop_free(post_cmds, identity);
|
||||||
if (bio_out != NULL) BIO_free_all(bio_out);
|
if (bio_out != NULL) BIO_free_all(bio_out);
|
||||||
|
apps_shutdown();
|
||||||
EXIT(ret);
|
EXIT(ret);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,5 +121,6 @@ int MAIN(int argc, char **argv)
|
|||||||
ret++;
|
ret++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
apps_shutdown();
|
||||||
EXIT(ret);
|
EXIT(ret);
|
||||||
}
|
}
|
||||||
|
|||||||
23
apps/gendh.c
23
apps/gendh.c
@@ -70,7 +70,6 @@
|
|||||||
#include <openssl/dh.h>
|
#include <openssl/dh.h>
|
||||||
#include <openssl/x509.h>
|
#include <openssl/x509.h>
|
||||||
#include <openssl/pem.h>
|
#include <openssl/pem.h>
|
||||||
#include <openssl/engine.h>
|
|
||||||
|
|
||||||
#define DEFBITS 512
|
#define DEFBITS 512
|
||||||
#undef PROG
|
#undef PROG
|
||||||
@@ -97,6 +96,9 @@ int MAIN(int argc, char **argv)
|
|||||||
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
|
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
|
||||||
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
|
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
|
||||||
|
|
||||||
|
if (!load_config(bio_err, NULL))
|
||||||
|
goto end;
|
||||||
|
|
||||||
argv++;
|
argv++;
|
||||||
argc--;
|
argc--;
|
||||||
for (;;)
|
for (;;)
|
||||||
@@ -143,23 +145,7 @@ bad:
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (engine != NULL)
|
e = setup_engine(bio_err, engine, 0);
|
||||||
{
|
|
||||||
if((e = ENGINE_by_id(engine)) == NULL)
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"invalid engine \"%s\"\n",
|
|
||||||
engine);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"can't use that engine\n");
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
|
|
||||||
/* Free our "structural" reference. */
|
|
||||||
ENGINE_free(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
out=BIO_new(BIO_s_file());
|
out=BIO_new(BIO_s_file());
|
||||||
if (out == NULL)
|
if (out == NULL)
|
||||||
@@ -211,6 +197,7 @@ end:
|
|||||||
ERR_print_errors(bio_err);
|
ERR_print_errors(bio_err);
|
||||||
if (out != NULL) BIO_free_all(out);
|
if (out != NULL) BIO_free_all(out);
|
||||||
if (dh != NULL) DH_free(dh);
|
if (dh != NULL) DH_free(dh);
|
||||||
|
apps_shutdown();
|
||||||
EXIT(ret);
|
EXIT(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,6 @@
|
|||||||
#include <openssl/dsa.h>
|
#include <openssl/dsa.h>
|
||||||
#include <openssl/x509.h>
|
#include <openssl/x509.h>
|
||||||
#include <openssl/pem.h>
|
#include <openssl/pem.h>
|
||||||
#include <openssl/engine.h>
|
|
||||||
|
|
||||||
#define DEFBITS 512
|
#define DEFBITS 512
|
||||||
#undef PROG
|
#undef PROG
|
||||||
@@ -94,6 +93,9 @@ int MAIN(int argc, char **argv)
|
|||||||
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
|
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
|
||||||
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
|
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
|
||||||
|
|
||||||
|
if (!load_config(bio_err, NULL))
|
||||||
|
goto end;
|
||||||
|
|
||||||
argv++;
|
argv++;
|
||||||
argc--;
|
argc--;
|
||||||
for (;;)
|
for (;;)
|
||||||
@@ -130,6 +132,14 @@ int MAIN(int argc, char **argv)
|
|||||||
#ifndef OPENSSL_NO_IDEA
|
#ifndef OPENSSL_NO_IDEA
|
||||||
else if (strcmp(*argv,"-idea") == 0)
|
else if (strcmp(*argv,"-idea") == 0)
|
||||||
enc=EVP_idea_cbc();
|
enc=EVP_idea_cbc();
|
||||||
|
#endif
|
||||||
|
#ifndef OPENSSL_NO_AES
|
||||||
|
else if (strcmp(*argv,"-aes128") == 0)
|
||||||
|
enc=EVP_aes_128_cbc();
|
||||||
|
else if (strcmp(*argv,"-aes192") == 0)
|
||||||
|
enc=EVP_aes_192_cbc();
|
||||||
|
else if (strcmp(*argv,"-aes256") == 0)
|
||||||
|
enc=EVP_aes_256_cbc();
|
||||||
#endif
|
#endif
|
||||||
else if (**argv != '-' && dsaparams == NULL)
|
else if (**argv != '-' && dsaparams == NULL)
|
||||||
{
|
{
|
||||||
@@ -152,6 +162,10 @@ bad:
|
|||||||
#endif
|
#endif
|
||||||
#ifndef OPENSSL_NO_IDEA
|
#ifndef OPENSSL_NO_IDEA
|
||||||
BIO_printf(bio_err," -idea - encrypt the generated key with IDEA in cbc mode\n");
|
BIO_printf(bio_err," -idea - encrypt the generated key with IDEA in cbc mode\n");
|
||||||
|
#endif
|
||||||
|
#ifndef OPENSSL_NO_AES
|
||||||
|
BIO_printf(bio_err," -aes128, -aes192, -aes256\n");
|
||||||
|
BIO_printf(bio_err," encrypt PEM output with cbc aes\n");
|
||||||
#endif
|
#endif
|
||||||
BIO_printf(bio_err," -engine e - use engine e, possibly a hardware device.\n");
|
BIO_printf(bio_err," -engine e - use engine e, possibly a hardware device.\n");
|
||||||
BIO_printf(bio_err," -rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR);
|
BIO_printf(bio_err," -rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR);
|
||||||
@@ -162,23 +176,7 @@ bad:
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (engine != NULL)
|
e = setup_engine(bio_err, engine, 0);
|
||||||
{
|
|
||||||
if((e = ENGINE_by_id(engine)) == NULL)
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"invalid engine \"%s\"\n",
|
|
||||||
engine);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"can't use that engine\n");
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
|
|
||||||
/* Free our "structural" reference. */
|
|
||||||
ENGINE_free(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!app_passwd(bio_err, NULL, passargout, NULL, &passout)) {
|
if(!app_passwd(bio_err, NULL, passargout, NULL, &passout)) {
|
||||||
BIO_printf(bio_err, "Error getting password\n");
|
BIO_printf(bio_err, "Error getting password\n");
|
||||||
@@ -247,6 +245,7 @@ end:
|
|||||||
if (out != NULL) BIO_free_all(out);
|
if (out != NULL) BIO_free_all(out);
|
||||||
if (dsa != NULL) DSA_free(dsa);
|
if (dsa != NULL) DSA_free(dsa);
|
||||||
if(passout) OPENSSL_free(passout);
|
if(passout) OPENSSL_free(passout);
|
||||||
|
apps_shutdown();
|
||||||
EXIT(ret);
|
EXIT(ret);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -69,7 +69,7 @@
|
|||||||
#include <openssl/evp.h>
|
#include <openssl/evp.h>
|
||||||
#include <openssl/x509.h>
|
#include <openssl/x509.h>
|
||||||
#include <openssl/pem.h>
|
#include <openssl/pem.h>
|
||||||
#include <openssl/engine.h>
|
#include <openssl/rand.h>
|
||||||
|
|
||||||
#define DEFBITS 512
|
#define DEFBITS 512
|
||||||
#undef PROG
|
#undef PROG
|
||||||
@@ -99,6 +99,9 @@ int MAIN(int argc, char **argv)
|
|||||||
if (bio_err == NULL)
|
if (bio_err == NULL)
|
||||||
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
|
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
|
||||||
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
|
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
|
||||||
|
|
||||||
|
if (!load_config(bio_err, NULL))
|
||||||
|
goto err;
|
||||||
if ((out=BIO_new(BIO_s_file())) == NULL)
|
if ((out=BIO_new(BIO_s_file())) == NULL)
|
||||||
{
|
{
|
||||||
BIO_printf(bio_err,"unable to create BIO for output\n");
|
BIO_printf(bio_err,"unable to create BIO for output\n");
|
||||||
@@ -138,6 +141,14 @@ int MAIN(int argc, char **argv)
|
|||||||
#ifndef OPENSSL_NO_IDEA
|
#ifndef OPENSSL_NO_IDEA
|
||||||
else if (strcmp(*argv,"-idea") == 0)
|
else if (strcmp(*argv,"-idea") == 0)
|
||||||
enc=EVP_idea_cbc();
|
enc=EVP_idea_cbc();
|
||||||
|
#endif
|
||||||
|
#ifndef OPENSSL_NO_AES
|
||||||
|
else if (strcmp(*argv,"-aes128") == 0)
|
||||||
|
enc=EVP_aes_128_cbc();
|
||||||
|
else if (strcmp(*argv,"-aes192") == 0)
|
||||||
|
enc=EVP_aes_192_cbc();
|
||||||
|
else if (strcmp(*argv,"-aes256") == 0)
|
||||||
|
enc=EVP_aes_256_cbc();
|
||||||
#endif
|
#endif
|
||||||
else if (strcmp(*argv,"-passout") == 0)
|
else if (strcmp(*argv,"-passout") == 0)
|
||||||
{
|
{
|
||||||
@@ -157,6 +168,10 @@ bad:
|
|||||||
BIO_printf(bio_err," -des3 encrypt the generated key with DES in ede cbc mode (168 bit key)\n");
|
BIO_printf(bio_err," -des3 encrypt the generated key with DES in ede cbc mode (168 bit key)\n");
|
||||||
#ifndef OPENSSL_NO_IDEA
|
#ifndef OPENSSL_NO_IDEA
|
||||||
BIO_printf(bio_err," -idea encrypt the generated key with IDEA in cbc mode\n");
|
BIO_printf(bio_err," -idea encrypt the generated key with IDEA in cbc mode\n");
|
||||||
|
#endif
|
||||||
|
#ifndef OPENSSL_NO_AES
|
||||||
|
BIO_printf(bio_err," -aes128, -aes192, -aes256\n");
|
||||||
|
BIO_printf(bio_err," encrypt PEM output with cbc aes\n");
|
||||||
#endif
|
#endif
|
||||||
BIO_printf(bio_err," -out file output the key to 'file\n");
|
BIO_printf(bio_err," -out file output the key to 'file\n");
|
||||||
BIO_printf(bio_err," -passout arg output file pass phrase source\n");
|
BIO_printf(bio_err," -passout arg output file pass phrase source\n");
|
||||||
@@ -176,23 +191,7 @@ bad:
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (engine != NULL)
|
e = setup_engine(bio_err, engine, 0);
|
||||||
{
|
|
||||||
if((e = ENGINE_by_id(engine)) == NULL)
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"invalid engine \"%s\"\n",
|
|
||||||
engine);
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"can't use that engine\n");
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
|
|
||||||
/* Free our "structural" reference. */
|
|
||||||
ENGINE_free(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (outfile == NULL)
|
if (outfile == NULL)
|
||||||
{
|
{
|
||||||
@@ -242,8 +241,14 @@ bad:
|
|||||||
l+=rsa->e->d[i];
|
l+=rsa->e->d[i];
|
||||||
}
|
}
|
||||||
BIO_printf(bio_err,"e is %ld (0x%lX)\n",l,l);
|
BIO_printf(bio_err,"e is %ld (0x%lX)\n",l,l);
|
||||||
if (!PEM_write_bio_RSAPrivateKey(out,rsa,enc,NULL,0,NULL, passout))
|
{
|
||||||
|
PW_CB_DATA cb_data;
|
||||||
|
cb_data.password = passout;
|
||||||
|
cb_data.prompt_info = outfile;
|
||||||
|
if (!PEM_write_bio_RSAPrivateKey(out,rsa,enc,NULL,0,
|
||||||
|
(pem_password_cb *)password_callback,&cb_data))
|
||||||
goto err;
|
goto err;
|
||||||
|
}
|
||||||
|
|
||||||
ret=0;
|
ret=0;
|
||||||
err:
|
err:
|
||||||
@@ -252,6 +257,7 @@ err:
|
|||||||
if(passout) OPENSSL_free(passout);
|
if(passout) OPENSSL_free(passout);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
ERR_print_errors(bio_err);
|
ERR_print_errors(bio_err);
|
||||||
|
apps_shutdown();
|
||||||
EXIT(ret);
|
EXIT(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1113,6 +1113,7 @@ $!
|
|||||||
$! Save directory information
|
$! Save directory information
|
||||||
$!
|
$!
|
||||||
$ __HERE = F$PARSE(F$PARSE("A.;",F$ENVIRONMENT("PROCEDURE"))-"A.;","[]A.;") - "A.;"
|
$ __HERE = F$PARSE(F$PARSE("A.;",F$ENVIRONMENT("PROCEDURE"))-"A.;","[]A.;") - "A.;"
|
||||||
|
$ __HERE = F$EDIT(__HERE,"UPCASE")
|
||||||
$ __TOP = __HERE - "APPS]"
|
$ __TOP = __HERE - "APPS]"
|
||||||
$ __INCLUDE = __TOP + "INCLUDE.OPENSSL]"
|
$ __INCLUDE = __TOP + "INCLUDE.OPENSSL]"
|
||||||
$!
|
$!
|
||||||
|
|||||||
519
apps/ocsp.c
519
apps/ocsp.c
@@ -67,6 +67,19 @@
|
|||||||
/* Maximum leeway in validity period: default 5 minutes */
|
/* Maximum leeway in validity period: default 5 minutes */
|
||||||
#define MAX_VALIDITY_PERIOD (5 * 60)
|
#define MAX_VALIDITY_PERIOD (5 * 60)
|
||||||
|
|
||||||
|
/* CA index.txt definitions */
|
||||||
|
#define DB_type 0
|
||||||
|
#define DB_exp_date 1
|
||||||
|
#define DB_rev_date 2
|
||||||
|
#define DB_serial 3 /* index - unique */
|
||||||
|
#define DB_file 4
|
||||||
|
#define DB_name 5 /* index - unique for active */
|
||||||
|
#define DB_NUMBER 6
|
||||||
|
|
||||||
|
#define DB_TYPE_REV 'R'
|
||||||
|
#define DB_TYPE_EXP 'E'
|
||||||
|
#define DB_TYPE_VAL 'V'
|
||||||
|
|
||||||
static int add_ocsp_cert(OCSP_REQUEST **req, X509 *cert, X509 *issuer,
|
static int add_ocsp_cert(OCSP_REQUEST **req, X509 *cert, X509 *issuer,
|
||||||
STACK_OF(OCSP_CERTID) *ids);
|
STACK_OF(OCSP_CERTID) *ids);
|
||||||
static int add_ocsp_serial(OCSP_REQUEST **req, char *serial, X509 *issuer,
|
static int add_ocsp_serial(OCSP_REQUEST **req, char *serial, X509 *issuer,
|
||||||
@@ -75,6 +88,16 @@ static int print_ocsp_summary(BIO *out, OCSP_BASICRESP *bs, OCSP_REQUEST *req,
|
|||||||
STACK *names, STACK_OF(OCSP_CERTID) *ids,
|
STACK *names, STACK_OF(OCSP_CERTID) *ids,
|
||||||
long nsec, long maxage);
|
long nsec, long maxage);
|
||||||
|
|
||||||
|
static int make_ocsp_response(OCSP_RESPONSE **resp, OCSP_REQUEST *req, TXT_DB *db,
|
||||||
|
X509 *ca, X509 *rcert, EVP_PKEY *rkey,
|
||||||
|
STACK_OF(X509) *rother, unsigned long flags,
|
||||||
|
int nmin, int ndays);
|
||||||
|
|
||||||
|
static char **lookup_serial(TXT_DB *db, ASN1_INTEGER *ser);
|
||||||
|
static BIO *init_responder(char *port);
|
||||||
|
static int do_responder(OCSP_REQUEST **preq, BIO **pcbio, BIO *acbio, char *port);
|
||||||
|
static int send_ocsp_response(BIO *cbio, OCSP_RESPONSE *resp);
|
||||||
|
|
||||||
#undef PROG
|
#undef PROG
|
||||||
#define PROG ocsp_main
|
#define PROG ocsp_main
|
||||||
|
|
||||||
@@ -82,35 +105,49 @@ int MAIN(int, char **);
|
|||||||
|
|
||||||
int MAIN(int argc, char **argv)
|
int MAIN(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
ENGINE *e = NULL;
|
||||||
char **args;
|
char **args;
|
||||||
char *host = NULL, *port = NULL, *path = "/";
|
char *host = NULL, *port = NULL, *path = "/";
|
||||||
char *reqin = NULL, *respin = NULL;
|
char *reqin = NULL, *respin = NULL;
|
||||||
char *reqout = NULL, *respout = NULL;
|
char *reqout = NULL, *respout = NULL;
|
||||||
char *signfile = NULL, *keyfile = NULL;
|
char *signfile = NULL, *keyfile = NULL;
|
||||||
|
char *rsignfile = NULL, *rkeyfile = NULL;
|
||||||
char *outfile = NULL;
|
char *outfile = NULL;
|
||||||
int add_nonce = 1, noverify = 0, use_ssl = -1;
|
int add_nonce = 1, noverify = 0, use_ssl = -1;
|
||||||
OCSP_REQUEST *req = NULL;
|
OCSP_REQUEST *req = NULL;
|
||||||
OCSP_RESPONSE *resp = NULL;
|
OCSP_RESPONSE *resp = NULL;
|
||||||
OCSP_BASICRESP *bs = NULL;
|
OCSP_BASICRESP *bs = NULL;
|
||||||
X509 *issuer = NULL, *cert = NULL;
|
X509 *issuer = NULL, *cert = NULL;
|
||||||
X509 *signer = NULL;
|
X509 *signer = NULL, *rsigner = NULL;
|
||||||
EVP_PKEY *key = NULL;
|
EVP_PKEY *key = NULL, *rkey = NULL;
|
||||||
BIO *cbio = NULL, *derbio = NULL;
|
BIO *acbio = NULL, *cbio = NULL;
|
||||||
|
BIO *derbio = NULL;
|
||||||
BIO *out = NULL;
|
BIO *out = NULL;
|
||||||
int req_text = 0, resp_text = 0;
|
int req_text = 0, resp_text = 0;
|
||||||
long nsec = MAX_VALIDITY_PERIOD, maxage = -1;
|
long nsec = MAX_VALIDITY_PERIOD, maxage = -1;
|
||||||
char *CAfile = NULL, *CApath = NULL;
|
char *CAfile = NULL, *CApath = NULL;
|
||||||
X509_STORE *store = NULL;
|
X509_STORE *store = NULL;
|
||||||
SSL_CTX *ctx = NULL;
|
SSL_CTX *ctx = NULL;
|
||||||
STACK_OF(X509) *sign_other = NULL, *verify_other = NULL;
|
STACK_OF(X509) *sign_other = NULL, *verify_other = NULL, *rother = NULL;
|
||||||
char *sign_certfile = NULL, *verify_certfile = NULL;
|
char *sign_certfile = NULL, *verify_certfile = NULL, *rcertfile = NULL;
|
||||||
unsigned long sign_flags = 0, verify_flags = 0;
|
unsigned long sign_flags = 0, verify_flags = 0, rflags = 0;
|
||||||
int ret = 1;
|
int ret = 1;
|
||||||
|
int accept_count = -1;
|
||||||
int badarg = 0;
|
int badarg = 0;
|
||||||
int i;
|
int i;
|
||||||
STACK *reqnames = NULL;
|
STACK *reqnames = NULL;
|
||||||
STACK_OF(OCSP_CERTID) *ids = NULL;
|
STACK_OF(OCSP_CERTID) *ids = NULL;
|
||||||
|
|
||||||
|
X509 *rca_cert = NULL;
|
||||||
|
char *ridx_filename = NULL;
|
||||||
|
char *rca_filename = NULL;
|
||||||
|
TXT_DB *rdb = NULL;
|
||||||
|
int nmin = 0, ndays = -1;
|
||||||
|
|
||||||
if (bio_err == NULL) bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
|
if (bio_err == NULL) bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
|
||||||
|
|
||||||
|
if (!load_config(bio_err, NULL))
|
||||||
|
goto end;
|
||||||
SSL_load_error_strings();
|
SSL_load_error_strings();
|
||||||
args = argv + 1;
|
args = argv + 1;
|
||||||
reqnames = sk_new_null();
|
reqnames = sk_new_null();
|
||||||
@@ -148,12 +185,25 @@ int MAIN(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
else badarg = 1;
|
else badarg = 1;
|
||||||
}
|
}
|
||||||
|
else if (!strcmp(*args, "-port"))
|
||||||
|
{
|
||||||
|
if (args[1])
|
||||||
|
{
|
||||||
|
args++;
|
||||||
|
port = *args;
|
||||||
|
}
|
||||||
|
else badarg = 1;
|
||||||
|
}
|
||||||
else if (!strcmp(*args, "-noverify"))
|
else if (!strcmp(*args, "-noverify"))
|
||||||
noverify = 1;
|
noverify = 1;
|
||||||
else if (!strcmp(*args, "-nonce"))
|
else if (!strcmp(*args, "-nonce"))
|
||||||
add_nonce = 2;
|
add_nonce = 2;
|
||||||
else if (!strcmp(*args, "-no_nonce"))
|
else if (!strcmp(*args, "-no_nonce"))
|
||||||
add_nonce = 0;
|
add_nonce = 0;
|
||||||
|
else if (!strcmp(*args, "-resp_no_certs"))
|
||||||
|
rflags |= OCSP_NOCERTS;
|
||||||
|
else if (!strcmp(*args, "-resp_key_id"))
|
||||||
|
rflags |= OCSP_RESPID_KEY;
|
||||||
else if (!strcmp(*args, "-no_certs"))
|
else if (!strcmp(*args, "-no_certs"))
|
||||||
sign_flags |= OCSP_NOCERTS;
|
sign_flags |= OCSP_NOCERTS;
|
||||||
else if (!strcmp(*args, "-no_signature_verify"))
|
else if (!strcmp(*args, "-no_signature_verify"))
|
||||||
@@ -326,7 +376,8 @@ int MAIN(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
args++;
|
args++;
|
||||||
X509_free(issuer);
|
X509_free(issuer);
|
||||||
issuer = load_cert(bio_err, *args, FORMAT_PEM);
|
issuer = load_cert(bio_err, *args, FORMAT_PEM,
|
||||||
|
NULL, e, "issuer certificate");
|
||||||
if(!issuer) goto end;
|
if(!issuer) goto end;
|
||||||
}
|
}
|
||||||
else badarg = 1;
|
else badarg = 1;
|
||||||
@@ -337,7 +388,8 @@ int MAIN(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
args++;
|
args++;
|
||||||
X509_free(cert);
|
X509_free(cert);
|
||||||
cert = load_cert(bio_err, *args, FORMAT_PEM);
|
cert = load_cert(bio_err, *args, FORMAT_PEM,
|
||||||
|
NULL, e, "certificate");
|
||||||
if(!cert) goto end;
|
if(!cert) goto end;
|
||||||
if(!add_ocsp_cert(&req, cert, issuer, ids))
|
if(!add_ocsp_cert(&req, cert, issuer, ids))
|
||||||
goto end;
|
goto end;
|
||||||
@@ -358,12 +410,107 @@ int MAIN(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
else badarg = 1;
|
else badarg = 1;
|
||||||
}
|
}
|
||||||
|
else if (!strcmp(*args, "-index"))
|
||||||
|
{
|
||||||
|
if (args[1])
|
||||||
|
{
|
||||||
|
args++;
|
||||||
|
ridx_filename = *args;
|
||||||
|
}
|
||||||
|
else badarg = 1;
|
||||||
|
}
|
||||||
|
else if (!strcmp(*args, "-CA"))
|
||||||
|
{
|
||||||
|
if (args[1])
|
||||||
|
{
|
||||||
|
args++;
|
||||||
|
rca_filename = *args;
|
||||||
|
}
|
||||||
|
else badarg = 1;
|
||||||
|
}
|
||||||
|
else if (!strcmp (*args, "-nmin"))
|
||||||
|
{
|
||||||
|
if (args[1])
|
||||||
|
{
|
||||||
|
args++;
|
||||||
|
nmin = atol(*args);
|
||||||
|
if (nmin < 0)
|
||||||
|
{
|
||||||
|
BIO_printf(bio_err,
|
||||||
|
"Illegal update period %s\n",
|
||||||
|
*args);
|
||||||
|
badarg = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ndays == -1)
|
||||||
|
ndays = 0;
|
||||||
|
else badarg = 1;
|
||||||
|
}
|
||||||
|
else if (!strcmp (*args, "-nrequest"))
|
||||||
|
{
|
||||||
|
if (args[1])
|
||||||
|
{
|
||||||
|
args++;
|
||||||
|
accept_count = atol(*args);
|
||||||
|
if (accept_count < 0)
|
||||||
|
{
|
||||||
|
BIO_printf(bio_err,
|
||||||
|
"Illegal accept count %s\n",
|
||||||
|
*args);
|
||||||
|
badarg = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else badarg = 1;
|
||||||
|
}
|
||||||
|
else if (!strcmp (*args, "-ndays"))
|
||||||
|
{
|
||||||
|
if (args[1])
|
||||||
|
{
|
||||||
|
args++;
|
||||||
|
ndays = atol(*args);
|
||||||
|
if (ndays < 0)
|
||||||
|
{
|
||||||
|
BIO_printf(bio_err,
|
||||||
|
"Illegal update period %s\n",
|
||||||
|
*args);
|
||||||
|
badarg = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else badarg = 1;
|
||||||
|
}
|
||||||
|
else if (!strcmp(*args, "-rsigner"))
|
||||||
|
{
|
||||||
|
if (args[1])
|
||||||
|
{
|
||||||
|
args++;
|
||||||
|
rsignfile = *args;
|
||||||
|
}
|
||||||
|
else badarg = 1;
|
||||||
|
}
|
||||||
|
else if (!strcmp(*args, "-rkey"))
|
||||||
|
{
|
||||||
|
if (args[1])
|
||||||
|
{
|
||||||
|
args++;
|
||||||
|
rkeyfile = *args;
|
||||||
|
}
|
||||||
|
else badarg = 1;
|
||||||
|
}
|
||||||
|
else if (!strcmp(*args, "-rother"))
|
||||||
|
{
|
||||||
|
if (args[1])
|
||||||
|
{
|
||||||
|
args++;
|
||||||
|
rcertfile = *args;
|
||||||
|
}
|
||||||
|
else badarg = 1;
|
||||||
|
}
|
||||||
else badarg = 1;
|
else badarg = 1;
|
||||||
args++;
|
args++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Have we anything to do? */
|
/* Have we anything to do? */
|
||||||
if (!req && !reqin && !respin) badarg = 1;
|
if (!req && !reqin && !respin && !(port && ridx_filename)) badarg = 1;
|
||||||
|
|
||||||
if (badarg)
|
if (badarg)
|
||||||
{
|
{
|
||||||
@@ -403,6 +550,17 @@ int MAIN(int argc, char **argv)
|
|||||||
BIO_printf (bio_err, "-no_cert_verify don't check signing certificate\n");
|
BIO_printf (bio_err, "-no_cert_verify don't check signing certificate\n");
|
||||||
BIO_printf (bio_err, "-no_chain don't chain verify response\n");
|
BIO_printf (bio_err, "-no_chain don't chain verify response\n");
|
||||||
BIO_printf (bio_err, "-no_cert_checks don't do additional checks on signing certificate\n");
|
BIO_printf (bio_err, "-no_cert_checks don't do additional checks on signing certificate\n");
|
||||||
|
BIO_printf (bio_err, "-port num port to run responder on\n");
|
||||||
|
BIO_printf (bio_err, "-index file certificate status index file\n");
|
||||||
|
BIO_printf (bio_err, "-CA file CA certificate\n");
|
||||||
|
BIO_printf (bio_err, "-rsigner file responder certificate to sign requests with\n");
|
||||||
|
BIO_printf (bio_err, "-rkey file responder key to sign requests with\n");
|
||||||
|
BIO_printf (bio_err, "-rother file other certificates to include in response\n");
|
||||||
|
BIO_printf (bio_err, "-resp_no_certs don't include any certificates in response\n");
|
||||||
|
BIO_printf (bio_err, "-nmin n number of minutes before next update\n");
|
||||||
|
BIO_printf (bio_err, "-ndays n number of days before next update\n");
|
||||||
|
BIO_printf (bio_err, "-resp_key_id identify reponse by signing certificate key ID\n");
|
||||||
|
BIO_printf (bio_err, "-nrequest n number of requests to accept (default unlimited)\n");
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -434,7 +592,54 @@ int MAIN(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!req && (signfile || reqout || host || add_nonce))
|
if (!req && port)
|
||||||
|
{
|
||||||
|
acbio = init_responder(port);
|
||||||
|
if (!acbio)
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rsignfile && !rdb)
|
||||||
|
{
|
||||||
|
if (!rkeyfile) rkeyfile = rsignfile;
|
||||||
|
rsigner = load_cert(bio_err, rsignfile, FORMAT_PEM,
|
||||||
|
NULL, e, "responder certificate");
|
||||||
|
if (!rsigner)
|
||||||
|
{
|
||||||
|
BIO_printf(bio_err, "Error loading responder certificate\n");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
rca_cert = load_cert(bio_err, rca_filename, FORMAT_PEM,
|
||||||
|
NULL, e, "CA certificate");
|
||||||
|
if (rcertfile)
|
||||||
|
{
|
||||||
|
rother = load_certs(bio_err, sign_certfile, FORMAT_PEM,
|
||||||
|
NULL, e, "responder other certificates");
|
||||||
|
if (!sign_other) goto end;
|
||||||
|
}
|
||||||
|
rkey = load_key(bio_err, rkeyfile, FORMAT_PEM, NULL, NULL,
|
||||||
|
"responder private key");
|
||||||
|
if (!rkey)
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
if(acbio)
|
||||||
|
BIO_printf(bio_err, "Waiting for OCSP client connections...\n");
|
||||||
|
|
||||||
|
redo_accept:
|
||||||
|
|
||||||
|
if (acbio)
|
||||||
|
{
|
||||||
|
if (!do_responder(&req, &cbio, acbio, port))
|
||||||
|
goto end;
|
||||||
|
if (!req)
|
||||||
|
{
|
||||||
|
resp = OCSP_response_create(OCSP_RESPONSE_STATUS_MALFORMEDREQUEST, NULL);
|
||||||
|
send_ocsp_response(cbio, resp);
|
||||||
|
goto done_resp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!req && (signfile || reqout || host || add_nonce || ridx_filename))
|
||||||
{
|
{
|
||||||
BIO_printf(bio_err, "Need an OCSP request for this operation!\n");
|
BIO_printf(bio_err, "Need an OCSP request for this operation!\n");
|
||||||
goto end;
|
goto end;
|
||||||
@@ -445,7 +650,8 @@ int MAIN(int argc, char **argv)
|
|||||||
if (signfile)
|
if (signfile)
|
||||||
{
|
{
|
||||||
if (!keyfile) keyfile = signfile;
|
if (!keyfile) keyfile = signfile;
|
||||||
signer = load_cert(bio_err, signfile, FORMAT_PEM);
|
signer = load_cert(bio_err, signfile, FORMAT_PEM,
|
||||||
|
NULL, e, "signer certificate");
|
||||||
if (!signer)
|
if (!signer)
|
||||||
{
|
{
|
||||||
BIO_printf(bio_err, "Error loading signer certificate\n");
|
BIO_printf(bio_err, "Error loading signer certificate\n");
|
||||||
@@ -453,15 +659,14 @@ int MAIN(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
if (sign_certfile)
|
if (sign_certfile)
|
||||||
{
|
{
|
||||||
sign_other = load_certs(bio_err, sign_certfile, FORMAT_PEM);
|
sign_other = load_certs(bio_err, sign_certfile, FORMAT_PEM,
|
||||||
|
NULL, e, "signer certificates");
|
||||||
if (!sign_other) goto end;
|
if (!sign_other) goto end;
|
||||||
}
|
}
|
||||||
key = load_key(bio_err, keyfile, FORMAT_PEM, NULL, NULL);
|
key = load_key(bio_err, keyfile, FORMAT_PEM, NULL, NULL,
|
||||||
|
"signer private key");
|
||||||
if (!key)
|
if (!key)
|
||||||
{
|
|
||||||
BIO_printf(bio_err, "Error loading signer private key\n");
|
|
||||||
goto end;
|
goto end;
|
||||||
}
|
|
||||||
if (!OCSP_request_sign(req, signer, key, EVP_sha1(), sign_other, sign_flags))
|
if (!OCSP_request_sign(req, signer, key, EVP_sha1(), sign_other, sign_flags))
|
||||||
{
|
{
|
||||||
BIO_printf(bio_err, "Error signing OCSP request\n");
|
BIO_printf(bio_err, "Error signing OCSP request\n");
|
||||||
@@ -469,21 +674,41 @@ int MAIN(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reqout)
|
|
||||||
{
|
|
||||||
derbio = BIO_new_file(reqout, "wb");
|
|
||||||
if (!derbio)
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err, "Error opening file %s\n", reqout);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
i2d_OCSP_REQUEST_bio(derbio, req);
|
|
||||||
BIO_free(derbio);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (req_text && req) OCSP_REQUEST_print(out, req, 0);
|
if (req_text && req) OCSP_REQUEST_print(out, req, 0);
|
||||||
|
|
||||||
if (host)
|
if (ridx_filename && (!rkey || !rsigner || !rca_cert))
|
||||||
|
{
|
||||||
|
BIO_printf(bio_err, "Need a responder certificate, key and CA for this operation!\n");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ridx_filename && !rdb)
|
||||||
|
{
|
||||||
|
BIO *db_bio = NULL;
|
||||||
|
db_bio = BIO_new_file(ridx_filename, "r");
|
||||||
|
if (!db_bio)
|
||||||
|
{
|
||||||
|
BIO_printf(bio_err, "Error opening index file %s\n", ridx_filename);
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
rdb = TXT_DB_read(db_bio, DB_NUMBER);
|
||||||
|
BIO_free(db_bio);
|
||||||
|
if (!rdb)
|
||||||
|
{
|
||||||
|
BIO_printf(bio_err, "Error reading index file %s\n", ridx_filename);
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
if (!make_serial_index(rdb))
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rdb)
|
||||||
|
{
|
||||||
|
i = make_ocsp_response(&resp, req, rdb, rca_cert, rsigner, rkey, rother, rflags, nmin, ndays);
|
||||||
|
if (cbio)
|
||||||
|
send_ocsp_response(cbio, resp);
|
||||||
|
}
|
||||||
|
else if (host)
|
||||||
{
|
{
|
||||||
cbio = BIO_new_connect(host);
|
cbio = BIO_new_connect(host);
|
||||||
if (!cbio)
|
if (!cbio)
|
||||||
@@ -537,6 +762,8 @@ int MAIN(int argc, char **argv)
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
done_resp:
|
||||||
|
|
||||||
if (respout)
|
if (respout)
|
||||||
{
|
{
|
||||||
derbio = BIO_new_file(respout, "wb");
|
derbio = BIO_new_file(respout, "wb");
|
||||||
@@ -561,11 +788,31 @@ int MAIN(int argc, char **argv)
|
|||||||
|
|
||||||
if (resp_text) OCSP_RESPONSE_print(out, resp, 0);
|
if (resp_text) OCSP_RESPONSE_print(out, resp, 0);
|
||||||
|
|
||||||
store = setup_verify(bio_err, CAfile, CApath);
|
/* If running as responder don't verify our own response */
|
||||||
if(!store) goto end;
|
if (cbio)
|
||||||
|
{
|
||||||
|
if (accept_count > 0)
|
||||||
|
accept_count--;
|
||||||
|
/* Redo if more connections needed */
|
||||||
|
if (accept_count)
|
||||||
|
{
|
||||||
|
BIO_free_all(cbio);
|
||||||
|
cbio = NULL;
|
||||||
|
OCSP_REQUEST_free(req);
|
||||||
|
req = NULL;
|
||||||
|
OCSP_RESPONSE_free(resp);
|
||||||
|
resp = NULL;
|
||||||
|
goto redo_accept;
|
||||||
|
}
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!store)
|
||||||
|
store = setup_verify(bio_err, CAfile, CApath);
|
||||||
if (verify_certfile)
|
if (verify_certfile)
|
||||||
{
|
{
|
||||||
verify_other = load_certs(bio_err, verify_certfile, FORMAT_PEM);
|
verify_other = load_certs(bio_err, verify_certfile, FORMAT_PEM,
|
||||||
|
NULL, e, "validator certificate");
|
||||||
if (!verify_other) goto end;
|
if (!verify_other) goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -613,9 +860,14 @@ end:
|
|||||||
X509_free(signer);
|
X509_free(signer);
|
||||||
X509_STORE_free(store);
|
X509_STORE_free(store);
|
||||||
EVP_PKEY_free(key);
|
EVP_PKEY_free(key);
|
||||||
|
EVP_PKEY_free(rkey);
|
||||||
X509_free(issuer);
|
X509_free(issuer);
|
||||||
X509_free(cert);
|
X509_free(cert);
|
||||||
|
X509_free(rsigner);
|
||||||
|
X509_free(rca_cert);
|
||||||
|
TXT_DB_free(rdb);
|
||||||
BIO_free_all(cbio);
|
BIO_free_all(cbio);
|
||||||
|
BIO_free_all(acbio);
|
||||||
BIO_free(out);
|
BIO_free(out);
|
||||||
OCSP_REQUEST_free(req);
|
OCSP_REQUEST_free(req);
|
||||||
OCSP_RESPONSE_free(resp);
|
OCSP_RESPONSE_free(resp);
|
||||||
@@ -754,3 +1006,206 @@ static int print_ocsp_summary(BIO *out, OCSP_BASICRESP *bs, OCSP_REQUEST *req,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int make_ocsp_response(OCSP_RESPONSE **resp, OCSP_REQUEST *req, TXT_DB *db,
|
||||||
|
X509 *ca, X509 *rcert, EVP_PKEY *rkey,
|
||||||
|
STACK_OF(X509) *rother, unsigned long flags,
|
||||||
|
int nmin, int ndays)
|
||||||
|
{
|
||||||
|
ASN1_TIME *thisupd = NULL, *nextupd = NULL;
|
||||||
|
OCSP_CERTID *cid, *ca_id = NULL;
|
||||||
|
OCSP_BASICRESP *bs = NULL;
|
||||||
|
int i, id_count, ret = 1;
|
||||||
|
|
||||||
|
|
||||||
|
id_count = OCSP_request_onereq_count(req);
|
||||||
|
|
||||||
|
if (id_count <= 0)
|
||||||
|
{
|
||||||
|
*resp = OCSP_response_create(OCSP_RESPONSE_STATUS_MALFORMEDREQUEST, NULL);
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
ca_id = OCSP_cert_to_id(EVP_sha1(), NULL, ca);
|
||||||
|
|
||||||
|
bs = OCSP_BASICRESP_new();
|
||||||
|
thisupd = X509_gmtime_adj(NULL, 0);
|
||||||
|
if (ndays != -1)
|
||||||
|
nextupd = X509_gmtime_adj(NULL, nmin * 60 + ndays * 3600 * 24 );
|
||||||
|
|
||||||
|
/* Examine each certificate id in the request */
|
||||||
|
for (i = 0; i < id_count; i++)
|
||||||
|
{
|
||||||
|
OCSP_ONEREQ *one;
|
||||||
|
ASN1_INTEGER *serial;
|
||||||
|
char **inf;
|
||||||
|
one = OCSP_request_onereq_get0(req, i);
|
||||||
|
cid = OCSP_onereq_get0_id(one);
|
||||||
|
/* Is this request about our CA? */
|
||||||
|
if (OCSP_id_issuer_cmp(ca_id, cid))
|
||||||
|
{
|
||||||
|
OCSP_basic_add1_status(bs, cid,
|
||||||
|
V_OCSP_CERTSTATUS_UNKNOWN,
|
||||||
|
0, NULL,
|
||||||
|
thisupd, nextupd);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
OCSP_id_get0_info(NULL, NULL, NULL, &serial, cid);
|
||||||
|
inf = lookup_serial(db, serial);
|
||||||
|
if (!inf)
|
||||||
|
OCSP_basic_add1_status(bs, cid,
|
||||||
|
V_OCSP_CERTSTATUS_UNKNOWN,
|
||||||
|
0, NULL,
|
||||||
|
thisupd, nextupd);
|
||||||
|
else if (inf[DB_type][0] == DB_TYPE_VAL)
|
||||||
|
OCSP_basic_add1_status(bs, cid,
|
||||||
|
V_OCSP_CERTSTATUS_GOOD,
|
||||||
|
0, NULL,
|
||||||
|
thisupd, nextupd);
|
||||||
|
else if (inf[DB_type][0] == DB_TYPE_REV)
|
||||||
|
{
|
||||||
|
ASN1_OBJECT *inst = NULL;
|
||||||
|
ASN1_TIME *revtm = NULL;
|
||||||
|
ASN1_GENERALIZEDTIME *invtm = NULL;
|
||||||
|
OCSP_SINGLERESP *single;
|
||||||
|
int reason = -1;
|
||||||
|
unpack_revinfo(&revtm, &reason, &inst, &invtm, inf[DB_rev_date]);
|
||||||
|
single = OCSP_basic_add1_status(bs, cid,
|
||||||
|
V_OCSP_CERTSTATUS_REVOKED,
|
||||||
|
reason, revtm,
|
||||||
|
thisupd, nextupd);
|
||||||
|
if (invtm)
|
||||||
|
OCSP_SINGLERESP_add1_ext_i2d(single, NID_invalidity_date, invtm, 0, 0);
|
||||||
|
else if (inst)
|
||||||
|
OCSP_SINGLERESP_add1_ext_i2d(single, NID_hold_instruction_code, inst, 0, 0);
|
||||||
|
ASN1_OBJECT_free(inst);
|
||||||
|
ASN1_TIME_free(revtm);
|
||||||
|
ASN1_GENERALIZEDTIME_free(invtm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
OCSP_copy_nonce(bs, req);
|
||||||
|
|
||||||
|
OCSP_basic_sign(bs, rcert, rkey, EVP_sha1(), rother, flags);
|
||||||
|
|
||||||
|
*resp = OCSP_response_create(OCSP_RESPONSE_STATUS_SUCCESSFUL, bs);
|
||||||
|
|
||||||
|
end:
|
||||||
|
ASN1_TIME_free(thisupd);
|
||||||
|
ASN1_TIME_free(nextupd);
|
||||||
|
OCSP_CERTID_free(ca_id);
|
||||||
|
OCSP_BASICRESP_free(bs);
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static char **lookup_serial(TXT_DB *db, ASN1_INTEGER *ser)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
BIGNUM *bn = NULL;
|
||||||
|
char *itmp, *row[DB_NUMBER],**rrow;
|
||||||
|
for (i = 0; i < DB_NUMBER; i++) row[i] = NULL;
|
||||||
|
bn = ASN1_INTEGER_to_BN(ser,NULL);
|
||||||
|
itmp = BN_bn2hex(bn);
|
||||||
|
row[DB_serial] = itmp;
|
||||||
|
BN_free(bn);
|
||||||
|
rrow=TXT_DB_get_by_index(db,DB_serial,row);
|
||||||
|
OPENSSL_free(itmp);
|
||||||
|
return rrow;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Quick and dirty OCSP server: read in and parse input request */
|
||||||
|
|
||||||
|
static BIO *init_responder(char *port)
|
||||||
|
{
|
||||||
|
BIO *acbio = NULL, *bufbio = NULL;
|
||||||
|
bufbio = BIO_new(BIO_f_buffer());
|
||||||
|
if (!bufbio)
|
||||||
|
goto err;
|
||||||
|
acbio = BIO_new_accept(port);
|
||||||
|
if (!acbio)
|
||||||
|
goto err;
|
||||||
|
BIO_set_accept_bios(acbio, bufbio);
|
||||||
|
bufbio = NULL;
|
||||||
|
|
||||||
|
if (BIO_do_accept(acbio) <= 0)
|
||||||
|
{
|
||||||
|
BIO_printf(bio_err, "Error setting up accept BIO\n");
|
||||||
|
ERR_print_errors(bio_err);
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
|
||||||
|
return acbio;
|
||||||
|
|
||||||
|
err:
|
||||||
|
BIO_free_all(acbio);
|
||||||
|
BIO_free(bufbio);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int do_responder(OCSP_REQUEST **preq, BIO **pcbio, BIO *acbio, char *port)
|
||||||
|
{
|
||||||
|
int have_post = 0, len;
|
||||||
|
OCSP_REQUEST *req = NULL;
|
||||||
|
char inbuf[1024];
|
||||||
|
BIO *cbio = NULL;
|
||||||
|
|
||||||
|
if (BIO_do_accept(acbio) <= 0)
|
||||||
|
{
|
||||||
|
BIO_printf(bio_err, "Error accepting connection\n");
|
||||||
|
ERR_print_errors(bio_err);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
cbio = BIO_pop(acbio);
|
||||||
|
*pcbio = cbio;
|
||||||
|
|
||||||
|
for(;;)
|
||||||
|
{
|
||||||
|
len = BIO_gets(cbio, inbuf, 1024);
|
||||||
|
if (len <= 0)
|
||||||
|
return 1;
|
||||||
|
/* Look for "POST" signalling start of query */
|
||||||
|
if (!have_post)
|
||||||
|
{
|
||||||
|
if(strncmp(inbuf, "POST", 4))
|
||||||
|
{
|
||||||
|
BIO_printf(bio_err, "Invalid request\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
have_post = 1;
|
||||||
|
}
|
||||||
|
/* Look for end of headers */
|
||||||
|
if ((inbuf[0] == '\r') || (inbuf[0] == '\n'))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Try to read OCSP request */
|
||||||
|
|
||||||
|
req = d2i_OCSP_REQUEST_bio(cbio, NULL);
|
||||||
|
|
||||||
|
if (!req)
|
||||||
|
{
|
||||||
|
BIO_printf(bio_err, "Error parsing OCSP request\n");
|
||||||
|
ERR_print_errors(bio_err);
|
||||||
|
}
|
||||||
|
|
||||||
|
*preq = req;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static int send_ocsp_response(BIO *cbio, OCSP_RESPONSE *resp)
|
||||||
|
{
|
||||||
|
char http_resp[] =
|
||||||
|
"HTTP/1.0 200 OK\r\nContent-type: application/ocsp-response\r\n"
|
||||||
|
"Content-Length: %d\r\n\r\n";
|
||||||
|
if (!cbio)
|
||||||
|
return 0;
|
||||||
|
BIO_printf(cbio, http_resp, i2d_OCSP_RESPONSE(resp, NULL));
|
||||||
|
i2d_OCSP_RESPONSE_bio(cbio, resp);
|
||||||
|
BIO_flush(cbio);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@
|
|||||||
* [including the GNU Public Licence.]
|
* [including the GNU Public Licence.]
|
||||||
*/
|
*/
|
||||||
/* ====================================================================
|
/* ====================================================================
|
||||||
* Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved.
|
* Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -121,6 +121,7 @@
|
|||||||
#include <openssl/x509.h>
|
#include <openssl/x509.h>
|
||||||
#include <openssl/pem.h>
|
#include <openssl/pem.h>
|
||||||
#include <openssl/ssl.h>
|
#include <openssl/ssl.h>
|
||||||
|
#include <openssl/engine.h>
|
||||||
#define USE_SOCKETS /* needed for the _O_BINARY defs in the MS world */
|
#define USE_SOCKETS /* needed for the _O_BINARY defs in the MS world */
|
||||||
#include "apps.h"
|
#include "apps.h"
|
||||||
#include "progs.h"
|
#include "progs.h"
|
||||||
@@ -138,7 +139,7 @@ static unsigned long MS_CALLBACK hash(const void *a_void);
|
|||||||
static int MS_CALLBACK cmp(const void *a_void,const void *b_void);
|
static int MS_CALLBACK cmp(const void *a_void,const void *b_void);
|
||||||
static LHASH *prog_init(void );
|
static LHASH *prog_init(void );
|
||||||
static int do_cmd(LHASH *prog,int argc,char *argv[]);
|
static int do_cmd(LHASH *prog,int argc,char *argv[]);
|
||||||
LHASH *config=NULL;
|
CONF *config=NULL;
|
||||||
char *default_config_file=NULL;
|
char *default_config_file=NULL;
|
||||||
|
|
||||||
/* Make sure there is only one when MONOLITH is defined */
|
/* Make sure there is only one when MONOLITH is defined */
|
||||||
@@ -214,8 +215,8 @@ static void lock_dbg_cb(int mode, int type, const char *file, int line)
|
|||||||
int main(int Argc, char *Argv[])
|
int main(int Argc, char *Argv[])
|
||||||
{
|
{
|
||||||
ARGS arg;
|
ARGS arg;
|
||||||
#define PROG_NAME_SIZE 16
|
#define PROG_NAME_SIZE 39
|
||||||
char pname[PROG_NAME_SIZE];
|
char pname[PROG_NAME_SIZE+1];
|
||||||
FUNCTION f,*fp;
|
FUNCTION f,*fp;
|
||||||
MS_STATIC char *prompt,buf[1024],config_name[256];
|
MS_STATIC char *prompt,buf[1024],config_name[256];
|
||||||
int n,i,ret=0;
|
int n,i,ret=0;
|
||||||
@@ -227,12 +228,17 @@ int main(int Argc, char *Argv[])
|
|||||||
arg.data=NULL;
|
arg.data=NULL;
|
||||||
arg.count=0;
|
arg.count=0;
|
||||||
|
|
||||||
if (getenv("OPENSSL_DEBUG_MEMORY") != NULL)
|
if (getenv("OPENSSL_DEBUG_MEMORY") != NULL) /* if not defined, use compiled-in library defaults */
|
||||||
{
|
{
|
||||||
if (!(0 == strcmp(getenv("OPENSSL_DEBUG_MEMORY"), "off")))
|
if (!(0 == strcmp(getenv("OPENSSL_DEBUG_MEMORY"), "off")))
|
||||||
{
|
{
|
||||||
CRYPTO_malloc_debug_init();
|
CRYPTO_malloc_debug_init();
|
||||||
CRYPTO_dbg_set_options(V_CRYPTO_MDEBUG_ALL);
|
CRYPTO_set_mem_debug_options(V_CRYPTO_MDEBUG_ALL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* OPENSSL_DEBUG_MEMORY=off */
|
||||||
|
CRYPTO_set_mem_debug_functions(0, 0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
|
CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
|
||||||
@@ -250,9 +256,6 @@ int main(int Argc, char *Argv[])
|
|||||||
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
|
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
|
||||||
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
|
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
|
||||||
|
|
||||||
ERR_load_crypto_strings();
|
|
||||||
ENGINE_load_builtin_engines();
|
|
||||||
|
|
||||||
/* Lets load up our environment a little */
|
/* Lets load up our environment a little */
|
||||||
p=getenv("OPENSSL_CONF");
|
p=getenv("OPENSSL_CONF");
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
@@ -269,8 +272,14 @@ int main(int Argc, char *Argv[])
|
|||||||
|
|
||||||
default_config_file=p;
|
default_config_file=p;
|
||||||
|
|
||||||
config=CONF_load(config,p,&errline);
|
config=NCONF_new(NULL);
|
||||||
if (config == NULL) ERR_clear_error();
|
i=NCONF_load(config,p,&errline);
|
||||||
|
if (i == 0)
|
||||||
|
{
|
||||||
|
NCONF_free(config);
|
||||||
|
config = NULL;
|
||||||
|
ERR_clear_error();
|
||||||
|
}
|
||||||
|
|
||||||
prog=prog_init();
|
prog=prog_init();
|
||||||
|
|
||||||
@@ -339,15 +348,13 @@ int main(int Argc, char *Argv[])
|
|||||||
end:
|
end:
|
||||||
if (config != NULL)
|
if (config != NULL)
|
||||||
{
|
{
|
||||||
CONF_free(config);
|
NCONF_free(config);
|
||||||
config=NULL;
|
config=NULL;
|
||||||
}
|
}
|
||||||
if (prog != NULL) lh_free(prog);
|
if (prog != NULL) lh_free(prog);
|
||||||
if (arg.data != NULL) OPENSSL_free(arg.data);
|
if (arg.data != NULL) OPENSSL_free(arg.data);
|
||||||
ERR_remove_state(0);
|
|
||||||
|
|
||||||
EVP_cleanup();
|
apps_shutdown();
|
||||||
ERR_free_strings();
|
|
||||||
|
|
||||||
CRYPTO_mem_leaks(bio_err);
|
CRYPTO_mem_leaks(bio_err);
|
||||||
if (bio_err != NULL)
|
if (bio_err != NULL)
|
||||||
|
|||||||
@@ -48,6 +48,14 @@ RANDFILE = $dir/private/.rand # private random number file
|
|||||||
|
|
||||||
x509_extensions = usr_cert # The extentions to add to the cert
|
x509_extensions = usr_cert # The extentions to add to the cert
|
||||||
|
|
||||||
|
# Comment out the following two lines for the "traditional"
|
||||||
|
# (and highly broken) format.
|
||||||
|
name_opt = ca_default # Subject Name options
|
||||||
|
cert_opt = ca_default # Certificate field options
|
||||||
|
|
||||||
|
# Extension copying option: use with caution.
|
||||||
|
# copy_extensions = copy
|
||||||
|
|
||||||
# Extensions to add to a CRL. Note: Netscape communicator chokes on V2 CRLs
|
# Extensions to add to a CRL. Note: Netscape communicator chokes on V2 CRLs
|
||||||
# so this is commented out by default to leave a V1 CRL.
|
# so this is commented out by default to leave a V1 CRL.
|
||||||
# crl_extensions = crl_ext
|
# crl_extensions = crl_ext
|
||||||
@@ -180,6 +188,9 @@ authorityKeyIdentifier=keyid,issuer:always
|
|||||||
# This stuff is for subjectAltName and issuerAltname.
|
# This stuff is for subjectAltName and issuerAltname.
|
||||||
# Import the email address.
|
# Import the email address.
|
||||||
# subjectAltName=email:copy
|
# subjectAltName=email:copy
|
||||||
|
# An alternative to produce certificates that aren't
|
||||||
|
# deprecated according to PKIX.
|
||||||
|
# subjectAltName=email:move
|
||||||
|
|
||||||
# Copy subject details
|
# Copy subject details
|
||||||
# issuerAltName=issuer:copy
|
# issuerAltName=issuer:copy
|
||||||
|
|||||||
@@ -15,11 +15,11 @@
|
|||||||
#include <openssl/err.h>
|
#include <openssl/err.h>
|
||||||
#include <openssl/evp.h>
|
#include <openssl/evp.h>
|
||||||
#include <openssl/rand.h>
|
#include <openssl/rand.h>
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_DES
|
#ifndef OPENSSL_NO_DES
|
||||||
# include <openssl/des.h>
|
# include <openssl/des.h>
|
||||||
#endif
|
#endif
|
||||||
#ifndef NO_MD5CRYPT_1
|
#ifndef NO_MD5CRYPT_1
|
||||||
|
# include <openssl/evp.h>
|
||||||
# include <openssl/md5.h>
|
# include <openssl/md5.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -79,6 +79,9 @@ int MAIN(int argc, char **argv)
|
|||||||
if (bio_err == NULL)
|
if (bio_err == NULL)
|
||||||
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
|
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
|
||||||
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
|
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
|
||||||
|
|
||||||
|
if (!load_config(bio_err, NULL))
|
||||||
|
goto err;
|
||||||
out = BIO_new(BIO_s_file());
|
out = BIO_new(BIO_s_file());
|
||||||
if (out == NULL)
|
if (out == NULL)
|
||||||
goto err;
|
goto err;
|
||||||
@@ -289,6 +292,7 @@ err:
|
|||||||
BIO_free(in);
|
BIO_free(in);
|
||||||
if (out)
|
if (out)
|
||||||
BIO_free_all(out);
|
BIO_free_all(out);
|
||||||
|
apps_shutdown();
|
||||||
EXIT(ret);
|
EXIT(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -310,7 +314,7 @@ static char *md5crypt(const char *passwd, const char *magic, const char *salt)
|
|||||||
unsigned char buf[MD5_DIGEST_LENGTH];
|
unsigned char buf[MD5_DIGEST_LENGTH];
|
||||||
char *salt_out;
|
char *salt_out;
|
||||||
int n, i;
|
int n, i;
|
||||||
MD5_CTX md;
|
EVP_MD_CTX md,md2;
|
||||||
size_t passwd_len, salt_len;
|
size_t passwd_len, salt_len;
|
||||||
|
|
||||||
passwd_len = strlen(passwd);
|
passwd_len = strlen(passwd);
|
||||||
@@ -325,49 +329,47 @@ static char *md5crypt(const char *passwd, const char *magic, const char *salt)
|
|||||||
salt_len = strlen(salt_out);
|
salt_len = strlen(salt_out);
|
||||||
assert(salt_len <= 8);
|
assert(salt_len <= 8);
|
||||||
|
|
||||||
MD5_Init(&md);
|
EVP_MD_CTX_init(&md);
|
||||||
MD5_Update(&md, passwd, passwd_len);
|
EVP_DigestInit_ex(&md,EVP_md5(), NULL);
|
||||||
MD5_Update(&md, "$", 1);
|
EVP_DigestUpdate(&md, passwd, passwd_len);
|
||||||
MD5_Update(&md, magic, strlen(magic));
|
EVP_DigestUpdate(&md, "$", 1);
|
||||||
MD5_Update(&md, "$", 1);
|
EVP_DigestUpdate(&md, magic, strlen(magic));
|
||||||
MD5_Update(&md, salt_out, salt_len);
|
EVP_DigestUpdate(&md, "$", 1);
|
||||||
|
EVP_DigestUpdate(&md, salt_out, salt_len);
|
||||||
|
|
||||||
{
|
EVP_MD_CTX_init(&md2);
|
||||||
MD5_CTX md2;
|
EVP_DigestInit_ex(&md2,EVP_md5(), NULL);
|
||||||
|
EVP_DigestUpdate(&md2, passwd, passwd_len);
|
||||||
|
EVP_DigestUpdate(&md2, salt_out, salt_len);
|
||||||
|
EVP_DigestUpdate(&md2, passwd, passwd_len);
|
||||||
|
EVP_DigestFinal_ex(&md2, buf, NULL);
|
||||||
|
|
||||||
MD5_Init(&md2);
|
|
||||||
MD5_Update(&md2, passwd, passwd_len);
|
|
||||||
MD5_Update(&md2, salt_out, salt_len);
|
|
||||||
MD5_Update(&md2, passwd, passwd_len);
|
|
||||||
MD5_Final(buf, &md2);
|
|
||||||
}
|
|
||||||
for (i = passwd_len; i > sizeof buf; i -= sizeof buf)
|
for (i = passwd_len; i > sizeof buf; i -= sizeof buf)
|
||||||
MD5_Update(&md, buf, sizeof buf);
|
EVP_DigestUpdate(&md, buf, sizeof buf);
|
||||||
MD5_Update(&md, buf, i);
|
EVP_DigestUpdate(&md, buf, i);
|
||||||
|
|
||||||
n = passwd_len;
|
n = passwd_len;
|
||||||
while (n)
|
while (n)
|
||||||
{
|
{
|
||||||
MD5_Update(&md, (n & 1) ? "\0" : passwd, 1);
|
EVP_DigestUpdate(&md, (n & 1) ? "\0" : passwd, 1);
|
||||||
n >>= 1;
|
n >>= 1;
|
||||||
}
|
}
|
||||||
MD5_Final(buf, &md);
|
EVP_DigestFinal_ex(&md, buf, NULL);
|
||||||
|
|
||||||
for (i = 0; i < 1000; i++)
|
for (i = 0; i < 1000; i++)
|
||||||
{
|
{
|
||||||
MD5_CTX md2;
|
EVP_DigestInit_ex(&md2,EVP_md5(), NULL);
|
||||||
|
EVP_DigestUpdate(&md2, (i & 1) ? (unsigned char *) passwd : buf,
|
||||||
MD5_Init(&md2);
|
(i & 1) ? passwd_len : sizeof buf);
|
||||||
MD5_Update(&md2, (i & 1) ? (unsigned char *) passwd : buf,
|
|
||||||
(i & 1) ? passwd_len : sizeof buf);
|
|
||||||
if (i % 3)
|
if (i % 3)
|
||||||
MD5_Update(&md2, salt_out, salt_len);
|
EVP_DigestUpdate(&md2, salt_out, salt_len);
|
||||||
if (i % 7)
|
if (i % 7)
|
||||||
MD5_Update(&md2, passwd, passwd_len);
|
EVP_DigestUpdate(&md2, passwd, passwd_len);
|
||||||
MD5_Update(&md2, (i & 1) ? buf : (unsigned char *) passwd,
|
EVP_DigestUpdate(&md2, (i & 1) ? buf : (unsigned char *) passwd,
|
||||||
(i & 1) ? sizeof buf : passwd_len);
|
(i & 1) ? sizeof buf : passwd_len);
|
||||||
MD5_Final(buf, &md2);
|
EVP_DigestFinal_ex(&md2, buf, NULL);
|
||||||
}
|
}
|
||||||
|
EVP_MD_CTX_cleanup(&md2);
|
||||||
|
|
||||||
{
|
{
|
||||||
/* transform buf into output string */
|
/* transform buf into output string */
|
||||||
@@ -405,6 +407,7 @@ static char *md5crypt(const char *passwd, const char *magic, const char *salt)
|
|||||||
*output = 0;
|
*output = 0;
|
||||||
assert(strlen(out_buf) < sizeof(out_buf));
|
assert(strlen(out_buf) < sizeof(out_buf));
|
||||||
}
|
}
|
||||||
|
EVP_MD_CTX_cleanup(&md);
|
||||||
|
|
||||||
return out_buf;
|
return out_buf;
|
||||||
}
|
}
|
||||||
@@ -479,7 +482,7 @@ static int do_passwd(int passed_salt, char **salt_p, char **salt_malloc_p,
|
|||||||
/* now compute password hash */
|
/* now compute password hash */
|
||||||
#ifndef OPENSSL_NO_DES
|
#ifndef OPENSSL_NO_DES
|
||||||
if (usecrypt)
|
if (usecrypt)
|
||||||
hash = des_crypt(passwd, *salt_p);
|
hash = DES_crypt(passwd, *salt_p);
|
||||||
#endif
|
#endif
|
||||||
#ifndef NO_MD5CRYPT_1
|
#ifndef NO_MD5CRYPT_1
|
||||||
if (use1 || useapr1)
|
if (use1 || useapr1)
|
||||||
|
|||||||
@@ -66,7 +66,6 @@
|
|||||||
#include <openssl/err.h>
|
#include <openssl/err.h>
|
||||||
#include <openssl/pem.h>
|
#include <openssl/pem.h>
|
||||||
#include <openssl/pkcs12.h>
|
#include <openssl/pkcs12.h>
|
||||||
#include <openssl/engine.h>
|
|
||||||
|
|
||||||
#define PROG pkcs12_main
|
#define PROG pkcs12_main
|
||||||
|
|
||||||
@@ -96,9 +95,10 @@ int MAIN(int argc, char **argv)
|
|||||||
ENGINE *e = NULL;
|
ENGINE *e = NULL;
|
||||||
char *infile=NULL, *outfile=NULL, *keyname = NULL;
|
char *infile=NULL, *outfile=NULL, *keyname = NULL;
|
||||||
char *certfile=NULL;
|
char *certfile=NULL;
|
||||||
BIO *in=NULL, *out = NULL, *inkey = NULL, *certsin = NULL;
|
BIO *in=NULL, *out = NULL;
|
||||||
char **args;
|
char **args;
|
||||||
char *name = NULL;
|
char *name = NULL;
|
||||||
|
char *csp_name = NULL;
|
||||||
PKCS12 *p12 = NULL;
|
PKCS12 *p12 = NULL;
|
||||||
char pass[50], macpass[50];
|
char pass[50], macpass[50];
|
||||||
int export_cert = 0;
|
int export_cert = 0;
|
||||||
@@ -127,6 +127,9 @@ int MAIN(int argc, char **argv)
|
|||||||
enc = EVP_des_ede3_cbc();
|
enc = EVP_des_ede3_cbc();
|
||||||
if (bio_err == NULL ) bio_err = BIO_new_fp (stderr, BIO_NOCLOSE);
|
if (bio_err == NULL ) bio_err = BIO_new_fp (stderr, BIO_NOCLOSE);
|
||||||
|
|
||||||
|
if (!load_config(bio_err, NULL))
|
||||||
|
goto end;
|
||||||
|
|
||||||
args = argv + 1;
|
args = argv + 1;
|
||||||
|
|
||||||
|
|
||||||
@@ -151,6 +154,11 @@ int MAIN(int argc, char **argv)
|
|||||||
else if (!strcmp (*args, "-idea")) enc=EVP_idea_cbc();
|
else if (!strcmp (*args, "-idea")) enc=EVP_idea_cbc();
|
||||||
#endif
|
#endif
|
||||||
else if (!strcmp (*args, "-des3")) enc = EVP_des_ede3_cbc();
|
else if (!strcmp (*args, "-des3")) enc = EVP_des_ede3_cbc();
|
||||||
|
#ifndef OPENSSL_NO_AES
|
||||||
|
else if (!strcmp(*args,"-aes128")) enc=EVP_aes_128_cbc();
|
||||||
|
else if (!strcmp(*args,"-aes192")) enc=EVP_aes_192_cbc();
|
||||||
|
else if (!strcmp(*args,"-aes256")) enc=EVP_aes_256_cbc();
|
||||||
|
#endif
|
||||||
else if (!strcmp (*args, "-noiter")) iter = 1;
|
else if (!strcmp (*args, "-noiter")) iter = 1;
|
||||||
else if (!strcmp (*args, "-maciter"))
|
else if (!strcmp (*args, "-maciter"))
|
||||||
maciter = PKCS12_DEFAULT_ITER;
|
maciter = PKCS12_DEFAULT_ITER;
|
||||||
@@ -197,6 +205,11 @@ int MAIN(int argc, char **argv)
|
|||||||
args++;
|
args++;
|
||||||
name = *args;
|
name = *args;
|
||||||
} else badarg = 1;
|
} else badarg = 1;
|
||||||
|
} else if (!strcmp (*args, "-CSP")) {
|
||||||
|
if (args[1]) {
|
||||||
|
args++;
|
||||||
|
csp_name = *args;
|
||||||
|
} else badarg = 1;
|
||||||
} else if (!strcmp (*args, "-caname")) {
|
} else if (!strcmp (*args, "-caname")) {
|
||||||
if (args[1]) {
|
if (args[1]) {
|
||||||
args++;
|
args++;
|
||||||
@@ -274,6 +287,10 @@ int MAIN(int argc, char **argv)
|
|||||||
BIO_printf (bio_err, "-des3 encrypt private keys with triple DES (default)\n");
|
BIO_printf (bio_err, "-des3 encrypt private keys with triple DES (default)\n");
|
||||||
#ifndef OPENSSL_NO_IDEA
|
#ifndef OPENSSL_NO_IDEA
|
||||||
BIO_printf (bio_err, "-idea encrypt private keys with idea\n");
|
BIO_printf (bio_err, "-idea encrypt private keys with idea\n");
|
||||||
|
#endif
|
||||||
|
#ifndef OPENSSL_NO_AES
|
||||||
|
BIO_printf (bio_err, "-aes128, -aes192, -aes256\n");
|
||||||
|
BIO_printf (bio_err, " encrypt PEM output with cbc aes\n");
|
||||||
#endif
|
#endif
|
||||||
BIO_printf (bio_err, "-nodes don't encrypt private keys\n");
|
BIO_printf (bio_err, "-nodes don't encrypt private keys\n");
|
||||||
BIO_printf (bio_err, "-noiter don't use encryption iteration\n");
|
BIO_printf (bio_err, "-noiter don't use encryption iteration\n");
|
||||||
@@ -294,19 +311,7 @@ int MAIN(int argc, char **argv)
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (engine != NULL) {
|
e = setup_engine(bio_err, engine, 0);
|
||||||
if((e = ENGINE_by_id(engine)) == NULL) {
|
|
||||||
BIO_printf(bio_err,"invalid engine \"%s\"\n", engine);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
if(!ENGINE_set_default(e, ENGINE_METHOD_ALL)) {
|
|
||||||
BIO_printf(bio_err,"can't use that engine\n");
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
|
|
||||||
/* Free our "structural" reference. */
|
|
||||||
ENGINE_free(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(passarg) {
|
if(passarg) {
|
||||||
if(export_cert) passargout = passarg;
|
if(export_cert) passargout = passarg;
|
||||||
@@ -352,6 +357,7 @@ int MAIN(int argc, char **argv)
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
if (certfile) {
|
if (certfile) {
|
||||||
if(!(certsin = BIO_new_file(certfile, "r"))) {
|
if(!(certsin = BIO_new_file(certfile, "r"))) {
|
||||||
BIO_printf(bio_err, "Can't open certificate file %s\n", certfile);
|
BIO_printf(bio_err, "Can't open certificate file %s\n", certfile);
|
||||||
@@ -367,6 +373,7 @@ int MAIN(int argc, char **argv)
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CRYPTO_MDEBUG
|
#ifdef CRYPTO_MDEBUG
|
||||||
CRYPTO_pop_info();
|
CRYPTO_pop_info();
|
||||||
@@ -420,12 +427,9 @@ int MAIN(int argc, char **argv)
|
|||||||
CRYPTO_push_info("process -export_cert");
|
CRYPTO_push_info("process -export_cert");
|
||||||
CRYPTO_push_info("reading private key");
|
CRYPTO_push_info("reading private key");
|
||||||
#endif
|
#endif
|
||||||
key = PEM_read_bio_PrivateKey(inkey ? inkey : in, NULL, NULL, passin);
|
key = load_key(bio_err, keyname ? keyname : infile, FORMAT_PEM,
|
||||||
if (!inkey) (void) BIO_reset(in);
|
passin, e, "private key");
|
||||||
else BIO_free(inkey);
|
|
||||||
if (!key) {
|
if (!key) {
|
||||||
BIO_printf (bio_err, "Error loading private key\n");
|
|
||||||
ERR_print_errors(bio_err);
|
|
||||||
goto export_end;
|
goto export_end;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -434,12 +438,9 @@ int MAIN(int argc, char **argv)
|
|||||||
CRYPTO_push_info("reading certs from input");
|
CRYPTO_push_info("reading certs from input");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
certs = sk_X509_new_null();
|
|
||||||
|
|
||||||
/* Load in all certs in input file */
|
/* Load in all certs in input file */
|
||||||
if(!cert_load(in, certs)) {
|
if(!(certs = load_certs(bio_err, infile, FORMAT_PEM, NULL, e,
|
||||||
BIO_printf(bio_err, "Error loading certificates from input\n");
|
"certificates"))) {
|
||||||
ERR_print_errors(bio_err);
|
|
||||||
goto export_end;
|
goto export_end;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -469,13 +470,17 @@ int MAIN(int argc, char **argv)
|
|||||||
bags = sk_PKCS12_SAFEBAG_new_null ();
|
bags = sk_PKCS12_SAFEBAG_new_null ();
|
||||||
|
|
||||||
/* Add any more certificates asked for */
|
/* Add any more certificates asked for */
|
||||||
if (certsin) {
|
if (certfile) {
|
||||||
if(!cert_load(certsin, certs)) {
|
STACK_OF(X509) *morecerts=NULL;
|
||||||
BIO_printf(bio_err, "Error loading certificates from certfile\n");
|
if(!(morecerts = load_certs(bio_err, certfile, FORMAT_PEM,
|
||||||
ERR_print_errors(bio_err);
|
NULL, e,
|
||||||
|
"certificates from certfile"))) {
|
||||||
goto export_end;
|
goto export_end;
|
||||||
}
|
}
|
||||||
BIO_free(certsin);
|
while(sk_X509_num(morecerts) > 0) {
|
||||||
|
sk_X509_push(certs, sk_X509_shift(morecerts));
|
||||||
|
}
|
||||||
|
sk_X509_free(morecerts);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CRYPTO_MDEBUG
|
#ifdef CRYPTO_MDEBUG
|
||||||
@@ -572,6 +577,7 @@ int MAIN(int argc, char **argv)
|
|||||||
PKCS8_PRIV_KEY_INFO_free(p8);
|
PKCS8_PRIV_KEY_INFO_free(p8);
|
||||||
p8 = NULL;
|
p8 = NULL;
|
||||||
if (name) PKCS12_add_friendlyname (bag, name, -1);
|
if (name) PKCS12_add_friendlyname (bag, name, -1);
|
||||||
|
if(csp_name) PKCS12_add_CSPName_asc(bag, csp_name, -1);
|
||||||
PKCS12_add_localkeyid (bag, keyid, keyidlen);
|
PKCS12_add_localkeyid (bag, keyid, keyidlen);
|
||||||
bags = sk_PKCS12_SAFEBAG_new_null();
|
bags = sk_PKCS12_SAFEBAG_new_null();
|
||||||
sk_PKCS12_SAFEBAG_push (bags, bag);
|
sk_PKCS12_SAFEBAG_push (bags, bag);
|
||||||
@@ -691,6 +697,7 @@ int MAIN(int argc, char **argv)
|
|||||||
if (canames) sk_free(canames);
|
if (canames) sk_free(canames);
|
||||||
if(passin) OPENSSL_free(passin);
|
if(passin) OPENSSL_free(passin);
|
||||||
if(passout) OPENSSL_free(passout);
|
if(passout) OPENSSL_free(passout);
|
||||||
|
apps_shutdown();
|
||||||
EXIT(ret);
|
EXIT(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -772,7 +779,10 @@ int dump_certs_pkeys_bag (BIO *out, PKCS12_SAFEBAG *bag, char *pass,
|
|||||||
print_attribs (out, bag->attrib, "Bag Attributes");
|
print_attribs (out, bag->attrib, "Bag Attributes");
|
||||||
if (!(p8 = PKCS12_decrypt_skey(bag, pass, passlen)))
|
if (!(p8 = PKCS12_decrypt_skey(bag, pass, passlen)))
|
||||||
return 0;
|
return 0;
|
||||||
if (!(pkey = EVP_PKCS82PKEY (p8))) return 0;
|
if (!(pkey = EVP_PKCS82PKEY (p8))) {
|
||||||
|
PKCS8_PRIV_KEY_INFO_free(p8);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
print_attribs (out, p8->attributes, "Key Attributes");
|
print_attribs (out, p8->attributes, "Key Attributes");
|
||||||
PKCS8_PRIV_KEY_INFO_free(p8);
|
PKCS8_PRIV_KEY_INFO_free(p8);
|
||||||
PEM_write_bio_PrivateKey (out, pkey, enc, NULL, 0, NULL, pempass);
|
PEM_write_bio_PrivateKey (out, pkey, enc, NULL, 0, NULL, pempass);
|
||||||
@@ -820,6 +830,9 @@ int get_cert_chain (X509 *cert, X509_STORE *store, STACK_OF(X509) **chain)
|
|||||||
STACK_OF(X509) *chn;
|
STACK_OF(X509) *chn;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
/* FIXME: Should really check the return status of X509_STORE_CTX_init
|
||||||
|
* for an error, but how that fits into the return value of this
|
||||||
|
* function is less obvious. */
|
||||||
X509_STORE_CTX_init(&store_ctx, store, cert, NULL);
|
X509_STORE_CTX_init(&store_ctx, store, cert, NULL);
|
||||||
if (X509_verify_cert(&store_ctx) <= 0) {
|
if (X509_verify_cert(&store_ctx) <= 0) {
|
||||||
i = X509_STORE_CTX_get_error (&store_ctx);
|
i = X509_STORE_CTX_get_error (&store_ctx);
|
||||||
|
|||||||
23
apps/pkcs7.c
23
apps/pkcs7.c
@@ -67,7 +67,6 @@
|
|||||||
#include <openssl/x509.h>
|
#include <openssl/x509.h>
|
||||||
#include <openssl/pkcs7.h>
|
#include <openssl/pkcs7.h>
|
||||||
#include <openssl/pem.h>
|
#include <openssl/pem.h>
|
||||||
#include <openssl/engine.h>
|
|
||||||
|
|
||||||
#undef PROG
|
#undef PROG
|
||||||
#define PROG pkcs7_main
|
#define PROG pkcs7_main
|
||||||
@@ -163,28 +162,13 @@ bad:
|
|||||||
BIO_printf(bio_err," -text print full details of certificates\n");
|
BIO_printf(bio_err," -text print full details of certificates\n");
|
||||||
BIO_printf(bio_err," -noout don't output encoded data\n");
|
BIO_printf(bio_err," -noout don't output encoded data\n");
|
||||||
BIO_printf(bio_err," -engine e use engine e, possibly a hardware device.\n");
|
BIO_printf(bio_err," -engine e use engine e, possibly a hardware device.\n");
|
||||||
EXIT(1);
|
ret = 1;
|
||||||
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
ERR_load_crypto_strings();
|
ERR_load_crypto_strings();
|
||||||
|
|
||||||
if (engine != NULL)
|
e = setup_engine(bio_err, engine, 0);
|
||||||
{
|
|
||||||
if((e = ENGINE_by_id(engine)) == NULL)
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"invalid engine \"%s\"\n",
|
|
||||||
engine);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"can't use that engine\n");
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
|
|
||||||
/* Free our "structural" reference. */
|
|
||||||
ENGINE_free(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
in=BIO_new(BIO_s_file());
|
in=BIO_new(BIO_s_file());
|
||||||
out=BIO_new(BIO_s_file());
|
out=BIO_new(BIO_s_file());
|
||||||
@@ -316,5 +300,6 @@ end:
|
|||||||
if (p7 != NULL) PKCS7_free(p7);
|
if (p7 != NULL) PKCS7_free(p7);
|
||||||
if (in != NULL) BIO_free(in);
|
if (in != NULL) BIO_free(in);
|
||||||
if (out != NULL) BIO_free_all(out);
|
if (out != NULL) BIO_free_all(out);
|
||||||
|
apps_shutdown();
|
||||||
EXIT(ret);
|
EXIT(ret);
|
||||||
}
|
}
|
||||||
|
|||||||
41
apps/pkcs8.c
41
apps/pkcs8.c
@@ -62,7 +62,6 @@
|
|||||||
#include <openssl/err.h>
|
#include <openssl/err.h>
|
||||||
#include <openssl/evp.h>
|
#include <openssl/evp.h>
|
||||||
#include <openssl/pkcs12.h>
|
#include <openssl/pkcs12.h>
|
||||||
#include <openssl/engine.h>
|
|
||||||
|
|
||||||
#include "apps.h"
|
#include "apps.h"
|
||||||
#define PROG pkcs8_main
|
#define PROG pkcs8_main
|
||||||
@@ -84,13 +83,16 @@ int MAIN(int argc, char **argv)
|
|||||||
int nocrypt = 0;
|
int nocrypt = 0;
|
||||||
X509_SIG *p8;
|
X509_SIG *p8;
|
||||||
PKCS8_PRIV_KEY_INFO *p8inf;
|
PKCS8_PRIV_KEY_INFO *p8inf;
|
||||||
EVP_PKEY *pkey;
|
EVP_PKEY *pkey=NULL;
|
||||||
char pass[50], *passin = NULL, *passout = NULL, *p8pass = NULL;
|
char pass[50], *passin = NULL, *passout = NULL, *p8pass = NULL;
|
||||||
int badarg = 0;
|
int badarg = 0;
|
||||||
char *engine=NULL;
|
char *engine=NULL;
|
||||||
|
|
||||||
if (bio_err == NULL) bio_err = BIO_new_fp (stderr, BIO_NOCLOSE);
|
if (bio_err == NULL) bio_err = BIO_new_fp (stderr, BIO_NOCLOSE);
|
||||||
|
|
||||||
|
if (!load_config(bio_err, NULL))
|
||||||
|
goto end;
|
||||||
|
|
||||||
informat=FORMAT_PEM;
|
informat=FORMAT_PEM;
|
||||||
outformat=FORMAT_PEM;
|
outformat=FORMAT_PEM;
|
||||||
|
|
||||||
@@ -185,23 +187,7 @@ int MAIN(int argc, char **argv)
|
|||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (engine != NULL)
|
e = setup_engine(bio_err, engine, 0);
|
||||||
{
|
|
||||||
if((e = ENGINE_by_id(engine)) == NULL)
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"invalid engine \"%s\"\n",
|
|
||||||
engine);
|
|
||||||
return (1);
|
|
||||||
}
|
|
||||||
if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"can't use that engine\n");
|
|
||||||
return (1);
|
|
||||||
}
|
|
||||||
BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
|
|
||||||
/* Free our "structural" reference. */
|
|
||||||
ENGINE_free(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!app_passwd(bio_err, passargin, passargout, &passin, &passout)) {
|
if(!app_passwd(bio_err, passargin, passargout, &passin, &passout)) {
|
||||||
BIO_printf(bio_err, "Error getting passwords\n");
|
BIO_printf(bio_err, "Error getting passwords\n");
|
||||||
@@ -233,21 +219,13 @@ int MAIN(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (topk8) {
|
if (topk8)
|
||||||
if(informat == FORMAT_PEM)
|
{
|
||||||
pkey = PEM_read_bio_PrivateKey(in, NULL, NULL, passin);
|
BIO_free(in); /* Not needed in this section */
|
||||||
else if(informat == FORMAT_ASN1)
|
pkey = load_key(bio_err, infile, informat, passin, e, "key");
|
||||||
pkey = d2i_PrivateKey_bio(in, NULL);
|
|
||||||
else {
|
|
||||||
BIO_printf(bio_err, "Bad format specified for key\n");
|
|
||||||
return (1);
|
|
||||||
}
|
|
||||||
if (!pkey) {
|
if (!pkey) {
|
||||||
BIO_printf(bio_err, "Error reading key\n", outfile);
|
|
||||||
ERR_print_errors(bio_err);
|
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
BIO_free(in);
|
|
||||||
if (!(p8inf = EVP_PKEY2PKCS8_broken(pkey, p8_broken))) {
|
if (!(p8inf = EVP_PKEY2PKCS8_broken(pkey, p8_broken))) {
|
||||||
BIO_printf(bio_err, "Error converting key\n", outfile);
|
BIO_printf(bio_err, "Error converting key\n", outfile);
|
||||||
ERR_print_errors(bio_err);
|
ERR_print_errors(bio_err);
|
||||||
@@ -372,6 +350,7 @@ int MAIN(int argc, char **argv)
|
|||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
end:
|
||||||
EVP_PKEY_free(pkey);
|
EVP_PKEY_free(pkey);
|
||||||
BIO_free_all(out);
|
BIO_free_all(out);
|
||||||
BIO_free(in);
|
BIO_free(in);
|
||||||
|
|||||||
40
apps/progs.h
40
apps/progs.h
@@ -17,6 +17,8 @@ extern int rsa_main(int argc,char *argv[]);
|
|||||||
extern int rsautl_main(int argc,char *argv[]);
|
extern int rsautl_main(int argc,char *argv[]);
|
||||||
extern int dsa_main(int argc,char *argv[]);
|
extern int dsa_main(int argc,char *argv[]);
|
||||||
extern int dsaparam_main(int argc,char *argv[]);
|
extern int dsaparam_main(int argc,char *argv[]);
|
||||||
|
extern int ecdsa_main(int argc,char *argv[]);
|
||||||
|
extern int ecdsaparam_main(int argc,char *argv[]);
|
||||||
extern int x509_main(int argc,char *argv[]);
|
extern int x509_main(int argc,char *argv[]);
|
||||||
extern int genrsa_main(int argc,char *argv[]);
|
extern int genrsa_main(int argc,char *argv[]);
|
||||||
extern int gendsa_main(int argc,char *argv[]);
|
extern int gendsa_main(int argc,char *argv[]);
|
||||||
@@ -78,6 +80,12 @@ FUNCTION functions[] = {
|
|||||||
#endif
|
#endif
|
||||||
#ifndef OPENSSL_NO_DSA
|
#ifndef OPENSSL_NO_DSA
|
||||||
{FUNC_TYPE_GENERAL,"dsaparam",dsaparam_main},
|
{FUNC_TYPE_GENERAL,"dsaparam",dsaparam_main},
|
||||||
|
#endif
|
||||||
|
#ifndef OPENSSL_NO_ECDSA
|
||||||
|
{FUNC_TYPE_GENERAL,"ecdsa",ecdsa_main},
|
||||||
|
#endif
|
||||||
|
#ifndef OPENSSL_NO_ECDSA
|
||||||
|
{FUNC_TYPE_GENERAL,"ecdsaparam",ecdsaparam_main},
|
||||||
#endif
|
#endif
|
||||||
{FUNC_TYPE_GENERAL,"x509",x509_main},
|
{FUNC_TYPE_GENERAL,"x509",x509_main},
|
||||||
#ifndef OPENSSL_NO_RSA
|
#ifndef OPENSSL_NO_RSA
|
||||||
@@ -113,13 +121,45 @@ FUNCTION functions[] = {
|
|||||||
{FUNC_TYPE_GENERAL,"rand",rand_main},
|
{FUNC_TYPE_GENERAL,"rand",rand_main},
|
||||||
{FUNC_TYPE_GENERAL,"engine",engine_main},
|
{FUNC_TYPE_GENERAL,"engine",engine_main},
|
||||||
{FUNC_TYPE_GENERAL,"ocsp",ocsp_main},
|
{FUNC_TYPE_GENERAL,"ocsp",ocsp_main},
|
||||||
|
#ifndef OPENSSL_NO_MD2
|
||||||
{FUNC_TYPE_MD,"md2",dgst_main},
|
{FUNC_TYPE_MD,"md2",dgst_main},
|
||||||
|
#endif
|
||||||
|
#ifndef OPENSSL_NO_MD4
|
||||||
{FUNC_TYPE_MD,"md4",dgst_main},
|
{FUNC_TYPE_MD,"md4",dgst_main},
|
||||||
|
#endif
|
||||||
|
#ifndef OPENSSL_NO_MD5
|
||||||
{FUNC_TYPE_MD,"md5",dgst_main},
|
{FUNC_TYPE_MD,"md5",dgst_main},
|
||||||
|
#endif
|
||||||
|
#ifndef OPENSSL_NO_SHA
|
||||||
{FUNC_TYPE_MD,"sha",dgst_main},
|
{FUNC_TYPE_MD,"sha",dgst_main},
|
||||||
|
#endif
|
||||||
|
#ifndef OPENSSL_NO_SHA1
|
||||||
{FUNC_TYPE_MD,"sha1",dgst_main},
|
{FUNC_TYPE_MD,"sha1",dgst_main},
|
||||||
|
#endif
|
||||||
|
#ifndef OPENSSL_NO_MDC2
|
||||||
{FUNC_TYPE_MD,"mdc2",dgst_main},
|
{FUNC_TYPE_MD,"mdc2",dgst_main},
|
||||||
|
#endif
|
||||||
|
#ifndef OPENSSL_NO_RMD160
|
||||||
{FUNC_TYPE_MD,"rmd160",dgst_main},
|
{FUNC_TYPE_MD,"rmd160",dgst_main},
|
||||||
|
#endif
|
||||||
|
#ifndef OPENSSL_NO_AES
|
||||||
|
{FUNC_TYPE_CIPHER,"aes-128-cbc",enc_main},
|
||||||
|
#endif
|
||||||
|
#ifndef OPENSSL_NO_AES
|
||||||
|
{FUNC_TYPE_CIPHER,"aes-128-ecb",enc_main},
|
||||||
|
#endif
|
||||||
|
#ifndef OPENSSL_NO_AES
|
||||||
|
{FUNC_TYPE_CIPHER,"aes-192-cbc",enc_main},
|
||||||
|
#endif
|
||||||
|
#ifndef OPENSSL_NO_AES
|
||||||
|
{FUNC_TYPE_CIPHER,"aes-192-ecb",enc_main},
|
||||||
|
#endif
|
||||||
|
#ifndef OPENSSL_NO_AES
|
||||||
|
{FUNC_TYPE_CIPHER,"aes-256-cbc",enc_main},
|
||||||
|
#endif
|
||||||
|
#ifndef OPENSSL_NO_AES
|
||||||
|
{FUNC_TYPE_CIPHER,"aes-256-ecb",enc_main},
|
||||||
|
#endif
|
||||||
{FUNC_TYPE_CIPHER,"base64",enc_main},
|
{FUNC_TYPE_CIPHER,"base64",enc_main},
|
||||||
#ifndef OPENSSL_NO_DES
|
#ifndef OPENSSL_NO_DES
|
||||||
{FUNC_TYPE_CIPHER,"des",enc_main},
|
{FUNC_TYPE_CIPHER,"des",enc_main},
|
||||||
|
|||||||
@@ -28,15 +28,17 @@ foreach (@ARGV)
|
|||||||
push(@files,$_);
|
push(@files,$_);
|
||||||
$str="\t{FUNC_TYPE_GENERAL,\"$_\",${_}_main},\n";
|
$str="\t{FUNC_TYPE_GENERAL,\"$_\",${_}_main},\n";
|
||||||
if (($_ =~ /^s_/) || ($_ =~ /^ciphers$/))
|
if (($_ =~ /^s_/) || ($_ =~ /^ciphers$/))
|
||||||
{ print "#if !defined(NO_SOCK) && !(defined(NO_SSL2) && defined(NO_SSL3))\n${str}#endif\n"; }
|
{ print "#if !defined(OPENSSL_NO_SOCK) && !(defined(OPENSSL_NO_SSL2) && defined(OPENSSL_NO_SSL3))\n${str}#endif\n"; }
|
||||||
elsif ( ($_ =~ /^rsa$/) || ($_ =~ /^genrsa$/) || ($_ =~ /^rsautl$/))
|
elsif ( ($_ =~ /^rsa$/) || ($_ =~ /^genrsa$/) || ($_ =~ /^rsautl$/))
|
||||||
{ print "#ifndef NO_RSA\n${str}#endif\n"; }
|
{ print "#ifndef OPENSSL_NO_RSA\n${str}#endif\n"; }
|
||||||
elsif ( ($_ =~ /^dsa$/) || ($_ =~ /^gendsa$/) || ($_ =~ /^dsaparam$/))
|
elsif ( ($_ =~ /^dsa$/) || ($_ =~ /^gendsa$/) || ($_ =~ /^dsaparam$/))
|
||||||
{ print "#ifndef NO_DSA\n${str}#endif\n"; }
|
{ print "#ifndef OPENSSL_NO_DSA\n${str}#endif\n"; }
|
||||||
|
elsif ( ($_ =~ /^ecdsa$/) || ($_ =~ /^ecdsaparam$/))
|
||||||
|
{ print "#ifndef OPENSSL_NO_ECDSA\n${str}#endif\n";}
|
||||||
elsif ( ($_ =~ /^dh$/) || ($_ =~ /^gendh$/) || ($_ =~ /^dhparam$/))
|
elsif ( ($_ =~ /^dh$/) || ($_ =~ /^gendh$/) || ($_ =~ /^dhparam$/))
|
||||||
{ print "#ifndef NO_DH\n${str}#endif\n"; }
|
{ print "#ifndef OPENSSL_NO_DH\n${str}#endif\n"; }
|
||||||
elsif ( ($_ =~ /^pkcs12$/))
|
elsif ( ($_ =~ /^pkcs12$/))
|
||||||
{ print "#if !defined(NO_DES) && !defined(NO_SHA1)\n${str}#endif\n"; }
|
{ print "#if !defined(OPENSSL_NO_DES) && !defined(OPENSSL_NO_SHA1)\n${str}#endif\n"; }
|
||||||
else
|
else
|
||||||
{ print $str; }
|
{ print $str; }
|
||||||
}
|
}
|
||||||
@@ -44,10 +46,13 @@ foreach (@ARGV)
|
|||||||
foreach ("md2","md4","md5","sha","sha1","mdc2","rmd160")
|
foreach ("md2","md4","md5","sha","sha1","mdc2","rmd160")
|
||||||
{
|
{
|
||||||
push(@files,$_);
|
push(@files,$_);
|
||||||
printf "\t{FUNC_TYPE_MD,\"%s\",dgst_main},\n",$_;
|
printf "#ifndef OPENSSL_NO_".uc($_)."\n\t{FUNC_TYPE_MD,\"".$_."\",dgst_main},\n#endif\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (
|
foreach (
|
||||||
|
"aes-128-cbc", "aes-128-ecb",
|
||||||
|
"aes-192-cbc", "aes-192-ecb",
|
||||||
|
"aes-256-cbc", "aes-256-ecb",
|
||||||
"base64",
|
"base64",
|
||||||
"des", "des3", "desx", "idea", "rc4", "rc4-40",
|
"des", "des3", "desx", "idea", "rc4", "rc4-40",
|
||||||
"rc2", "bf", "cast", "rc5",
|
"rc2", "bf", "cast", "rc5",
|
||||||
@@ -64,13 +69,14 @@ foreach (
|
|||||||
push(@files,$_);
|
push(@files,$_);
|
||||||
|
|
||||||
$t=sprintf("\t{FUNC_TYPE_CIPHER,\"%s\",enc_main},\n",$_);
|
$t=sprintf("\t{FUNC_TYPE_CIPHER,\"%s\",enc_main},\n",$_);
|
||||||
if ($_ =~ /des/) { $t="#ifndef NO_DES\n${t}#endif\n"; }
|
if ($_ =~ /des/) { $t="#ifndef OPENSSL_NO_DES\n${t}#endif\n"; }
|
||||||
elsif ($_ =~ /idea/) { $t="#ifndef NO_IDEA\n${t}#endif\n"; }
|
elsif ($_ =~ /aes/) { $t="#ifndef OPENSSL_NO_AES\n${t}#endif\n"; }
|
||||||
elsif ($_ =~ /rc4/) { $t="#ifndef NO_RC4\n${t}#endif\n"; }
|
elsif ($_ =~ /idea/) { $t="#ifndef OPENSSL_NO_IDEA\n${t}#endif\n"; }
|
||||||
elsif ($_ =~ /rc2/) { $t="#ifndef NO_RC2\n${t}#endif\n"; }
|
elsif ($_ =~ /rc4/) { $t="#ifndef OPENSSL_NO_RC4\n${t}#endif\n"; }
|
||||||
elsif ($_ =~ /bf/) { $t="#ifndef NO_BF\n${t}#endif\n"; }
|
elsif ($_ =~ /rc2/) { $t="#ifndef OPENSSL_NO_RC2\n${t}#endif\n"; }
|
||||||
elsif ($_ =~ /cast/) { $t="#ifndef NO_CAST\n${t}#endif\n"; }
|
elsif ($_ =~ /bf/) { $t="#ifndef OPENSSL_NO_BF\n${t}#endif\n"; }
|
||||||
elsif ($_ =~ /rc5/) { $t="#ifndef NO_RC5\n${t}#endif\n"; }
|
elsif ($_ =~ /cast/) { $t="#ifndef OPENSSL_NO_CAST\n${t}#endif\n"; }
|
||||||
|
elsif ($_ =~ /rc5/) { $t="#ifndef OPENSSL_NO_RC5\n${t}#endif\n"; }
|
||||||
print $t;
|
print $t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
76
apps/rand.c
76
apps/rand.c
@@ -1,4 +1,57 @@
|
|||||||
/* apps/rand.c */
|
/* apps/rand.c */
|
||||||
|
/* ====================================================================
|
||||||
|
* Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in
|
||||||
|
* the documentation and/or other materials provided with the
|
||||||
|
* distribution.
|
||||||
|
*
|
||||||
|
* 3. All advertising materials mentioning features or use of this
|
||||||
|
* software must display the following acknowledgment:
|
||||||
|
* "This product includes software developed by the OpenSSL Project
|
||||||
|
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
||||||
|
*
|
||||||
|
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||||
|
* endorse or promote products derived from this software without
|
||||||
|
* prior written permission. For written permission, please contact
|
||||||
|
* openssl-core@openssl.org.
|
||||||
|
*
|
||||||
|
* 5. Products derived from this software may not be called "OpenSSL"
|
||||||
|
* nor may "OpenSSL" appear in their names without prior written
|
||||||
|
* permission of the OpenSSL Project.
|
||||||
|
*
|
||||||
|
* 6. Redistributions of any form whatsoever must retain the following
|
||||||
|
* acknowledgment:
|
||||||
|
* "This product includes software developed by the OpenSSL Project
|
||||||
|
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||||
|
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||||
|
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||||
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||||
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
* ====================================================================
|
||||||
|
*
|
||||||
|
* This product includes cryptographic software written by Eric Young
|
||||||
|
* (eay@cryptsoft.com). This product includes software written by Tim
|
||||||
|
* Hudson (tjh@cryptsoft.com).
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
#include "apps.h"
|
#include "apps.h"
|
||||||
|
|
||||||
@@ -9,7 +62,6 @@
|
|||||||
#include <openssl/bio.h>
|
#include <openssl/bio.h>
|
||||||
#include <openssl/err.h>
|
#include <openssl/err.h>
|
||||||
#include <openssl/rand.h>
|
#include <openssl/rand.h>
|
||||||
#include <openssl/engine.h>
|
|
||||||
|
|
||||||
#undef PROG
|
#undef PROG
|
||||||
#define PROG rand_main
|
#define PROG rand_main
|
||||||
@@ -40,6 +92,9 @@ int MAIN(int argc, char **argv)
|
|||||||
if ((bio_err = BIO_new(BIO_s_file())) != NULL)
|
if ((bio_err = BIO_new(BIO_s_file())) != NULL)
|
||||||
BIO_set_fp(bio_err, stderr, BIO_NOCLOSE|BIO_FP_TEXT);
|
BIO_set_fp(bio_err, stderr, BIO_NOCLOSE|BIO_FP_TEXT);
|
||||||
|
|
||||||
|
if (!load_config(bio_err, NULL))
|
||||||
|
goto err;
|
||||||
|
|
||||||
badopt = 0;
|
badopt = 0;
|
||||||
i = 0;
|
i = 0;
|
||||||
while (!badopt && argv[++i] != NULL)
|
while (!badopt && argv[++i] != NULL)
|
||||||
@@ -101,23 +156,7 @@ int MAIN(int argc, char **argv)
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (engine != NULL)
|
e = setup_engine(bio_err, engine, 0);
|
||||||
{
|
|
||||||
if((e = ENGINE_by_id(engine)) == NULL)
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"invalid engine \"%s\"\n",
|
|
||||||
engine);
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"can't use that engine\n");
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
|
|
||||||
/* Free our "structural" reference. */
|
|
||||||
ENGINE_free(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
app_RAND_load_file(NULL, bio_err, (inrand != NULL));
|
app_RAND_load_file(NULL, bio_err, (inrand != NULL));
|
||||||
if (inrand != NULL)
|
if (inrand != NULL)
|
||||||
@@ -173,5 +212,6 @@ err:
|
|||||||
ERR_print_errors(bio_err);
|
ERR_print_errors(bio_err);
|
||||||
if (out)
|
if (out)
|
||||||
BIO_free_all(out);
|
BIO_free_all(out);
|
||||||
|
apps_shutdown();
|
||||||
EXIT(ret);
|
EXIT(ret);
|
||||||
}
|
}
|
||||||
|
|||||||
455
apps/req.c
455
apps/req.c
@@ -73,7 +73,6 @@
|
|||||||
#include <openssl/x509v3.h>
|
#include <openssl/x509v3.h>
|
||||||
#include <openssl/objects.h>
|
#include <openssl/objects.h>
|
||||||
#include <openssl/pem.h>
|
#include <openssl/pem.h>
|
||||||
#include <openssl/engine.h>
|
|
||||||
|
|
||||||
#define SECTION "req"
|
#define SECTION "req"
|
||||||
|
|
||||||
@@ -85,6 +84,7 @@
|
|||||||
#define V3_EXTENSIONS "x509_extensions"
|
#define V3_EXTENSIONS "x509_extensions"
|
||||||
#define REQ_EXTENSIONS "req_extensions"
|
#define REQ_EXTENSIONS "req_extensions"
|
||||||
#define STRING_MASK "string_mask"
|
#define STRING_MASK "string_mask"
|
||||||
|
#define UTF8_IN "utf8"
|
||||||
|
|
||||||
#define DEFAULT_KEY_LENGTH 512
|
#define DEFAULT_KEY_LENGTH 512
|
||||||
#define MIN_KEY_LENGTH 384
|
#define MIN_KEY_LENGTH 384
|
||||||
@@ -106,38 +106,43 @@
|
|||||||
* -rand file(s) - load the file(s) into the PRNG.
|
* -rand file(s) - load the file(s) into the PRNG.
|
||||||
* -newkey - make a key and a request.
|
* -newkey - make a key and a request.
|
||||||
* -modulus - print RSA modulus.
|
* -modulus - print RSA modulus.
|
||||||
|
* -pubkey - output Public Key.
|
||||||
* -x509 - output a self signed X509 structure instead.
|
* -x509 - output a self signed X509 structure instead.
|
||||||
* -asn1-kludge - output new certificate request in a format that some CA's
|
* -asn1-kludge - output new certificate request in a format that some CA's
|
||||||
* require. This format is wrong
|
* require. This format is wrong
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int make_REQ(X509_REQ *req,EVP_PKEY *pkey,char *dn,int attribs);
|
static int make_REQ(X509_REQ *req,EVP_PKEY *pkey,char *dn,int attribs,
|
||||||
static int build_subject(X509_REQ *req, char *subj);
|
unsigned long chtype);
|
||||||
|
static int build_subject(X509_REQ *req, char *subj, unsigned long chtype);
|
||||||
static int prompt_info(X509_REQ *req,
|
static int prompt_info(X509_REQ *req,
|
||||||
STACK_OF(CONF_VALUE) *dn_sk, char *dn_sect,
|
STACK_OF(CONF_VALUE) *dn_sk, char *dn_sect,
|
||||||
STACK_OF(CONF_VALUE) *attr_sk, char *attr_sect, int attribs);
|
STACK_OF(CONF_VALUE) *attr_sk, char *attr_sect, int attribs,
|
||||||
|
unsigned long chtype);
|
||||||
static int auto_info(X509_REQ *req, STACK_OF(CONF_VALUE) *sk,
|
static int auto_info(X509_REQ *req, STACK_OF(CONF_VALUE) *sk,
|
||||||
STACK_OF(CONF_VALUE) *attr, int attribs);
|
STACK_OF(CONF_VALUE) *attr, int attribs,
|
||||||
|
unsigned long chtype);
|
||||||
static int add_attribute_object(X509_REQ *req, char *text,
|
static int add_attribute_object(X509_REQ *req, char *text,
|
||||||
char *def, char *value, int nid, int min,
|
char *def, char *value, int nid, int n_min,
|
||||||
int max);
|
int n_max, unsigned long chtype);
|
||||||
static int add_DN_object(X509_NAME *n, char *text, char *def, char *value,
|
static int add_DN_object(X509_NAME *n, char *text, char *def, char *value,
|
||||||
int nid,int min,int max);
|
int nid,int n_min,int n_max, unsigned long chtype);
|
||||||
#ifndef OPENSSL_NO_RSA
|
#ifndef OPENSSL_NO_RSA
|
||||||
static void MS_CALLBACK req_cb(int p,int n,void *arg);
|
static void MS_CALLBACK req_cb(int p,int n,void *arg);
|
||||||
#endif
|
#endif
|
||||||
static int req_check_len(int len,int min,int max);
|
static int req_check_len(int len,int n_min,int n_max);
|
||||||
static int check_end(char *str, char *end);
|
static int check_end(char *str, char *end);
|
||||||
#ifndef MONOLITH
|
#ifndef MONOLITH
|
||||||
static char *default_config_file=NULL;
|
static char *default_config_file=NULL;
|
||||||
static LHASH *config=NULL;
|
static CONF *config=NULL;
|
||||||
#endif
|
#endif
|
||||||
static LHASH *req_conf=NULL;
|
static CONF *req_conf=NULL;
|
||||||
static int batch=0;
|
static int batch=0;
|
||||||
|
|
||||||
#define TYPE_RSA 1
|
#define TYPE_RSA 1
|
||||||
#define TYPE_DSA 2
|
#define TYPE_DSA 2
|
||||||
#define TYPE_DH 3
|
#define TYPE_DH 3
|
||||||
|
#define TYPE_ECDSA 4
|
||||||
|
|
||||||
int MAIN(int, char **);
|
int MAIN(int, char **);
|
||||||
|
|
||||||
@@ -146,16 +151,20 @@ int MAIN(int argc, char **argv)
|
|||||||
ENGINE *e = NULL;
|
ENGINE *e = NULL;
|
||||||
#ifndef OPENSSL_NO_DSA
|
#ifndef OPENSSL_NO_DSA
|
||||||
DSA *dsa_params=NULL;
|
DSA *dsa_params=NULL;
|
||||||
|
#endif
|
||||||
|
#ifndef OPENSSL_NO_ECDSA
|
||||||
|
ECDSA *ecdsa_params = NULL;
|
||||||
#endif
|
#endif
|
||||||
unsigned long nmflag = 0;
|
unsigned long nmflag = 0;
|
||||||
int ex=1,x509=0,days=30;
|
int ex=1,x509=0,days=30;
|
||||||
X509 *x509ss=NULL;
|
X509 *x509ss=NULL;
|
||||||
X509_REQ *req=NULL;
|
X509_REQ *req=NULL;
|
||||||
EVP_PKEY *pkey=NULL;
|
EVP_PKEY *pkey=NULL;
|
||||||
int i,badops=0,newreq=0,newkey= -1,verbose=0,pkey_type=TYPE_RSA;
|
int i=0,badops=0,newreq=0,verbose=0,pkey_type=TYPE_RSA;
|
||||||
|
long newkey = -1;
|
||||||
BIO *in=NULL,*out=NULL;
|
BIO *in=NULL,*out=NULL;
|
||||||
int informat,outformat,verify=0,noout=0,text=0,keyform=FORMAT_PEM;
|
int informat,outformat,verify=0,noout=0,text=0,keyform=FORMAT_PEM;
|
||||||
int nodes=0,kludge=0,newhdr=0,subject=0;
|
int nodes=0,kludge=0,newhdr=0,subject=0,pubkey=0;
|
||||||
char *infile,*outfile,*prog,*keyfile=NULL,*template=NULL,*keyout=NULL;
|
char *infile,*outfile,*prog,*keyfile=NULL,*template=NULL,*keyout=NULL;
|
||||||
char *engine=NULL;
|
char *engine=NULL;
|
||||||
char *extensions = NULL;
|
char *extensions = NULL;
|
||||||
@@ -169,8 +178,10 @@ int MAIN(int argc, char **argv)
|
|||||||
char *p;
|
char *p;
|
||||||
char *subj = NULL;
|
char *subj = NULL;
|
||||||
const EVP_MD *md_alg=NULL,*digest=EVP_md5();
|
const EVP_MD *md_alg=NULL,*digest=EVP_md5();
|
||||||
|
unsigned long chtype = MBSTRING_ASC;
|
||||||
#ifndef MONOLITH
|
#ifndef MONOLITH
|
||||||
MS_STATIC char config_name[256];
|
MS_STATIC char config_name[256];
|
||||||
|
long errline;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
req_conf = NULL;
|
req_conf = NULL;
|
||||||
@@ -213,6 +224,10 @@ int MAIN(int argc, char **argv)
|
|||||||
if (--argc < 1) goto bad;
|
if (--argc < 1) goto bad;
|
||||||
keyfile= *(++argv);
|
keyfile= *(++argv);
|
||||||
}
|
}
|
||||||
|
else if (strcmp(*argv,"-pubkey") == 0)
|
||||||
|
{
|
||||||
|
pubkey=1;
|
||||||
|
}
|
||||||
else if (strcmp(*argv,"-new") == 0)
|
else if (strcmp(*argv,"-new") == 0)
|
||||||
{
|
{
|
||||||
newreq=1;
|
newreq=1;
|
||||||
@@ -295,7 +310,7 @@ int MAIN(int argc, char **argv)
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
dtmp=X509_get_pubkey(xtmp);
|
if ((dtmp=X509_get_pubkey(xtmp)) == NULL) goto end;
|
||||||
if (dtmp->type == EVP_PKEY_DSA)
|
if (dtmp->type == EVP_PKEY_DSA)
|
||||||
dsa_params=DSAparams_dup(dtmp->pkey.dsa);
|
dsa_params=DSAparams_dup(dtmp->pkey.dsa);
|
||||||
EVP_PKEY_free(dtmp);
|
EVP_PKEY_free(dtmp);
|
||||||
@@ -307,8 +322,60 @@ int MAIN(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
BIO_free(in);
|
BIO_free(in);
|
||||||
newkey=BN_num_bits(dsa_params->p);
|
|
||||||
in=NULL;
|
in=NULL;
|
||||||
|
newkey=BN_num_bits(dsa_params->p);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
#ifndef OPENSSL_NO_ECDSA
|
||||||
|
if (strncmp("ecdsa:",p,4) == 0)
|
||||||
|
{
|
||||||
|
X509 *xtmp=NULL;
|
||||||
|
EVP_PKEY *dtmp;
|
||||||
|
|
||||||
|
pkey_type=TYPE_ECDSA;
|
||||||
|
p+=6;
|
||||||
|
if ((in=BIO_new_file(p,"r")) == NULL)
|
||||||
|
{
|
||||||
|
perror(p);
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
if ((ecdsa_params = PEM_read_bio_ECDSAParameters(in, NULL, NULL, NULL)) == NULL)
|
||||||
|
{
|
||||||
|
ERR_clear_error();
|
||||||
|
(void)BIO_reset(in);
|
||||||
|
if ((xtmp=PEM_read_bio_X509(in,NULL,NULL,NULL)) == NULL)
|
||||||
|
{
|
||||||
|
BIO_printf(bio_err,"unable to load ECDSA parameters from file\n");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((dtmp=X509_get_pubkey(xtmp)) == NULL) goto end;
|
||||||
|
if (dtmp->type == EVP_PKEY_ECDSA)
|
||||||
|
ecdsa_params = ECDSAParameters_dup(dtmp->pkey.ecdsa);
|
||||||
|
EVP_PKEY_free(dtmp);
|
||||||
|
X509_free(xtmp);
|
||||||
|
if (ecdsa_params == NULL)
|
||||||
|
{
|
||||||
|
BIO_printf(bio_err,"Certificate does not contain ECDSA parameters\n");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BIO_free(in);
|
||||||
|
in=NULL;
|
||||||
|
|
||||||
|
{
|
||||||
|
BIGNUM *order = BN_new();
|
||||||
|
|
||||||
|
if (!order)
|
||||||
|
goto end;
|
||||||
|
if (!EC_GROUP_get_order(ecdsa_params->group, order, NULL))
|
||||||
|
goto end;
|
||||||
|
newkey = BN_num_bits(order);
|
||||||
|
BN_free(order);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
@@ -338,6 +405,8 @@ int MAIN(int argc, char **argv)
|
|||||||
noout=1;
|
noout=1;
|
||||||
else if (strcmp(*argv,"-verbose") == 0)
|
else if (strcmp(*argv,"-verbose") == 0)
|
||||||
verbose=1;
|
verbose=1;
|
||||||
|
else if (strcmp(*argv,"-utf8") == 0)
|
||||||
|
chtype = MBSTRING_UTF8;
|
||||||
else if (strcmp(*argv,"-nameopt") == 0)
|
else if (strcmp(*argv,"-nameopt") == 0)
|
||||||
{
|
{
|
||||||
if (--argc < 1) goto bad;
|
if (--argc < 1) goto bad;
|
||||||
@@ -405,6 +474,7 @@ bad:
|
|||||||
BIO_printf(bio_err," -in arg input file\n");
|
BIO_printf(bio_err," -in arg input file\n");
|
||||||
BIO_printf(bio_err," -out arg output file\n");
|
BIO_printf(bio_err," -out arg output file\n");
|
||||||
BIO_printf(bio_err," -text text form of request\n");
|
BIO_printf(bio_err," -text text form of request\n");
|
||||||
|
BIO_printf(bio_err," -pubkey output public key\n");
|
||||||
BIO_printf(bio_err," -noout do not output REQ\n");
|
BIO_printf(bio_err," -noout do not output REQ\n");
|
||||||
BIO_printf(bio_err," -verify verify signature on REQ\n");
|
BIO_printf(bio_err," -verify verify signature on REQ\n");
|
||||||
BIO_printf(bio_err," -modulus RSA modulus\n");
|
BIO_printf(bio_err," -modulus RSA modulus\n");
|
||||||
@@ -420,7 +490,8 @@ bad:
|
|||||||
BIO_printf(bio_err," the random number generator\n");
|
BIO_printf(bio_err," the random number generator\n");
|
||||||
BIO_printf(bio_err," -newkey rsa:bits generate a new RSA key of 'bits' in size\n");
|
BIO_printf(bio_err," -newkey rsa:bits generate a new RSA key of 'bits' in size\n");
|
||||||
BIO_printf(bio_err," -newkey dsa:file generate a new DSA key, parameters taken from CA in 'file'\n");
|
BIO_printf(bio_err," -newkey dsa:file generate a new DSA key, parameters taken from CA in 'file'\n");
|
||||||
BIO_printf(bio_err," -[digest] Digest to sign with (md5, sha1, md2, mdc2)\n");
|
BIO_printf(bio_err," -newkey ecdsa:file generate a new ECDSA key, parameters taken from CA in 'file'\n");
|
||||||
|
BIO_printf(bio_err," -[digest] Digest to sign with (md5, sha1, md2, mdc2, md4)\n");
|
||||||
BIO_printf(bio_err," -config file request template file.\n");
|
BIO_printf(bio_err," -config file request template file.\n");
|
||||||
BIO_printf(bio_err," -subj arg set or modify request subject\n");
|
BIO_printf(bio_err," -subj arg set or modify request subject\n");
|
||||||
BIO_printf(bio_err," -new new request.\n");
|
BIO_printf(bio_err," -new new request.\n");
|
||||||
@@ -433,6 +504,8 @@ bad:
|
|||||||
BIO_printf(bio_err," have been reported as requiring\n");
|
BIO_printf(bio_err," have been reported as requiring\n");
|
||||||
BIO_printf(bio_err," -extensions .. specify certificate extension section (override value in config file)\n");
|
BIO_printf(bio_err," -extensions .. specify certificate extension section (override value in config file)\n");
|
||||||
BIO_printf(bio_err," -reqexts .. specify request extension section (override value in config file)\n");
|
BIO_printf(bio_err," -reqexts .. specify request extension section (override value in config file)\n");
|
||||||
|
BIO_printf(bio_err," -utf8 input characters are UTF8 (default ASCII)\n");
|
||||||
|
BIO_printf(bio_err," -nameopt arg - various certificate name options\n");
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -457,16 +530,19 @@ bad:
|
|||||||
p=config_name;
|
p=config_name;
|
||||||
}
|
}
|
||||||
default_config_file=p;
|
default_config_file=p;
|
||||||
config=CONF_load(config,p,NULL);
|
config=NCONF_new(NULL);
|
||||||
|
i=NCONF_load(config, p, &errline);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (template != NULL)
|
if (template != NULL)
|
||||||
{
|
{
|
||||||
long errline;
|
long errline;
|
||||||
|
|
||||||
BIO_printf(bio_err,"Using configuration from %s\n",template);
|
if( verbose )
|
||||||
req_conf=CONF_load(NULL,template,&errline);
|
BIO_printf(bio_err,"Using configuration from %s\n",template);
|
||||||
if (req_conf == NULL)
|
req_conf=NCONF_new(NULL);
|
||||||
|
i=NCONF_load(req_conf,template,&errline);
|
||||||
|
if (i == 0)
|
||||||
{
|
{
|
||||||
BIO_printf(bio_err,"error on line %ld of %s\n",errline,template);
|
BIO_printf(bio_err,"error on line %ld of %s\n",errline,template);
|
||||||
goto end;
|
goto end;
|
||||||
@@ -475,7 +551,8 @@ bad:
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
req_conf=config;
|
req_conf=config;
|
||||||
BIO_printf(bio_err,"Using configuration from %s\n",
|
if( verbose )
|
||||||
|
BIO_printf(bio_err,"Using configuration from %s\n",
|
||||||
default_config_file);
|
default_config_file);
|
||||||
if (req_conf == NULL)
|
if (req_conf == NULL)
|
||||||
{
|
{
|
||||||
@@ -485,7 +562,9 @@ bad:
|
|||||||
|
|
||||||
if (req_conf != NULL)
|
if (req_conf != NULL)
|
||||||
{
|
{
|
||||||
p=CONF_get_string(req_conf,NULL,"oid_file");
|
if (!load_config(bio_err, req_conf))
|
||||||
|
goto end;
|
||||||
|
p=NCONF_get_string(req_conf,NULL,"oid_file");
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
ERR_clear_error();
|
ERR_clear_error();
|
||||||
if (p != NULL)
|
if (p != NULL)
|
||||||
@@ -511,7 +590,7 @@ bad:
|
|||||||
|
|
||||||
if (md_alg == NULL)
|
if (md_alg == NULL)
|
||||||
{
|
{
|
||||||
p=CONF_get_string(req_conf,SECTION,"default_md");
|
p=NCONF_get_string(req_conf,SECTION,"default_md");
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
ERR_clear_error();
|
ERR_clear_error();
|
||||||
if (p != NULL)
|
if (p != NULL)
|
||||||
@@ -523,7 +602,7 @@ bad:
|
|||||||
|
|
||||||
if (!extensions)
|
if (!extensions)
|
||||||
{
|
{
|
||||||
extensions = CONF_get_string(req_conf, SECTION, V3_EXTENSIONS);
|
extensions = NCONF_get_string(req_conf, SECTION, V3_EXTENSIONS);
|
||||||
if (!extensions)
|
if (!extensions)
|
||||||
ERR_clear_error();
|
ERR_clear_error();
|
||||||
}
|
}
|
||||||
@@ -531,8 +610,8 @@ bad:
|
|||||||
/* Check syntax of file */
|
/* Check syntax of file */
|
||||||
X509V3_CTX ctx;
|
X509V3_CTX ctx;
|
||||||
X509V3_set_ctx_test(&ctx);
|
X509V3_set_ctx_test(&ctx);
|
||||||
X509V3_set_conf_lhash(&ctx, req_conf);
|
X509V3_set_nconf(&ctx, req_conf);
|
||||||
if(!X509V3_EXT_add_conf(req_conf, &ctx, extensions, NULL)) {
|
if(!X509V3_EXT_add_nconf(req_conf, &ctx, extensions, NULL)) {
|
||||||
BIO_printf(bio_err,
|
BIO_printf(bio_err,
|
||||||
"Error Loading extension section %s\n", extensions);
|
"Error Loading extension section %s\n", extensions);
|
||||||
goto end;
|
goto end;
|
||||||
@@ -541,19 +620,19 @@ bad:
|
|||||||
|
|
||||||
if(!passin)
|
if(!passin)
|
||||||
{
|
{
|
||||||
passin = CONF_get_string(req_conf, SECTION, "input_password");
|
passin = NCONF_get_string(req_conf, SECTION, "input_password");
|
||||||
if (!passin)
|
if (!passin)
|
||||||
ERR_clear_error();
|
ERR_clear_error();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!passout)
|
if(!passout)
|
||||||
{
|
{
|
||||||
passout = CONF_get_string(req_conf, SECTION, "output_password");
|
passout = NCONF_get_string(req_conf, SECTION, "output_password");
|
||||||
if (!passout)
|
if (!passout)
|
||||||
ERR_clear_error();
|
ERR_clear_error();
|
||||||
}
|
}
|
||||||
|
|
||||||
p = CONF_get_string(req_conf, SECTION, STRING_MASK);
|
p = NCONF_get_string(req_conf, SECTION, STRING_MASK);
|
||||||
if (!p)
|
if (!p)
|
||||||
ERR_clear_error();
|
ERR_clear_error();
|
||||||
|
|
||||||
@@ -562,9 +641,19 @@ bad:
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (chtype != MBSTRING_UTF8)
|
||||||
|
{
|
||||||
|
p = NCONF_get_string(req_conf, SECTION, UTF8_IN);
|
||||||
|
if (!p)
|
||||||
|
ERR_clear_error();
|
||||||
|
else if (!strcmp(p, "yes"))
|
||||||
|
chtype = MBSTRING_UTF8;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if(!req_exts)
|
if(!req_exts)
|
||||||
{
|
{
|
||||||
req_exts = CONF_get_string(req_conf, SECTION, REQ_EXTENSIONS);
|
req_exts = NCONF_get_string(req_conf, SECTION, REQ_EXTENSIONS);
|
||||||
if (!req_exts)
|
if (!req_exts)
|
||||||
ERR_clear_error();
|
ERR_clear_error();
|
||||||
}
|
}
|
||||||
@@ -572,8 +661,8 @@ bad:
|
|||||||
/* Check syntax of file */
|
/* Check syntax of file */
|
||||||
X509V3_CTX ctx;
|
X509V3_CTX ctx;
|
||||||
X509V3_set_ctx_test(&ctx);
|
X509V3_set_ctx_test(&ctx);
|
||||||
X509V3_set_conf_lhash(&ctx, req_conf);
|
X509V3_set_nconf(&ctx, req_conf);
|
||||||
if(!X509V3_EXT_add_conf(req_conf, &ctx, req_exts, NULL)) {
|
if(!X509V3_EXT_add_nconf(req_conf, &ctx, req_exts, NULL)) {
|
||||||
BIO_printf(bio_err,
|
BIO_printf(bio_err,
|
||||||
"Error Loading request extension section %s\n",
|
"Error Loading request extension section %s\n",
|
||||||
req_exts);
|
req_exts);
|
||||||
@@ -586,65 +675,21 @@ bad:
|
|||||||
if ((in == NULL) || (out == NULL))
|
if ((in == NULL) || (out == NULL))
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
if (engine != NULL)
|
e = setup_engine(bio_err, engine, 0);
|
||||||
{
|
|
||||||
if((e = ENGINE_by_id(engine)) == NULL)
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"invalid engine \"%s\"\n",
|
|
||||||
engine);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"can't use that engine\n");
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
|
|
||||||
/* Free our "structural" reference. */
|
|
||||||
ENGINE_free(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (keyfile != NULL)
|
if (keyfile != NULL)
|
||||||
{
|
{
|
||||||
if (keyform == FORMAT_ENGINE)
|
pkey = load_key(bio_err, keyfile, keyform, passin, e,
|
||||||
|
"Private Key");
|
||||||
|
if (!pkey)
|
||||||
{
|
{
|
||||||
if (!e)
|
/* load_key() has already printed an appropriate
|
||||||
{
|
message */
|
||||||
BIO_printf(bio_err,"no engine specified\n");
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
pkey = ENGINE_load_private_key(e, keyfile, NULL);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (BIO_read_filename(in,keyfile) <= 0)
|
|
||||||
{
|
|
||||||
perror(keyfile);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (keyform == FORMAT_ASN1)
|
|
||||||
pkey=d2i_PrivateKey_bio(in,NULL);
|
|
||||||
else if (keyform == FORMAT_PEM)
|
|
||||||
{
|
|
||||||
pkey=PEM_read_bio_PrivateKey(in,NULL,NULL,
|
|
||||||
passin);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"bad input format specified for X509 request\n");
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pkey == NULL)
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"unable to load Private key\n");
|
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
if (EVP_PKEY_type(pkey->type) == EVP_PKEY_DSA)
|
if (EVP_PKEY_type(pkey->type) == EVP_PKEY_DSA || EVP_PKEY_type(pkey->type) == EVP_PKEY_ECDSA)
|
||||||
{
|
{
|
||||||
char *randfile = CONF_get_string(req_conf,SECTION,"RANDFILE");
|
char *randfile = NCONF_get_string(req_conf,SECTION,"RANDFILE");
|
||||||
if (randfile == NULL)
|
if (randfile == NULL)
|
||||||
ERR_clear_error();
|
ERR_clear_error();
|
||||||
app_RAND_load_file(randfile, bio_err, 0);
|
app_RAND_load_file(randfile, bio_err, 0);
|
||||||
@@ -653,7 +698,7 @@ bad:
|
|||||||
|
|
||||||
if (newreq && (pkey == NULL))
|
if (newreq && (pkey == NULL))
|
||||||
{
|
{
|
||||||
char *randfile = CONF_get_string(req_conf,SECTION,"RANDFILE");
|
char *randfile = NCONF_get_string(req_conf,SECTION,"RANDFILE");
|
||||||
if (randfile == NULL)
|
if (randfile == NULL)
|
||||||
ERR_clear_error();
|
ERR_clear_error();
|
||||||
app_RAND_load_file(randfile, bio_err, 0);
|
app_RAND_load_file(randfile, bio_err, 0);
|
||||||
@@ -662,19 +707,19 @@ bad:
|
|||||||
|
|
||||||
if (newkey <= 0)
|
if (newkey <= 0)
|
||||||
{
|
{
|
||||||
newkey=(int)CONF_get_number(req_conf,SECTION,BITS);
|
if (!NCONF_get_number(req_conf,SECTION,BITS, &newkey))
|
||||||
if (newkey <= 0)
|
|
||||||
newkey=DEFAULT_KEY_LENGTH;
|
newkey=DEFAULT_KEY_LENGTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newkey < MIN_KEY_LENGTH)
|
if (newkey < MIN_KEY_LENGTH && (pkey_type == TYPE_RSA || pkey_type == TYPE_DSA))
|
||||||
|
/* TODO: appropriate minimal keylength for the different algorithm (esp. ECDSA) */
|
||||||
{
|
{
|
||||||
BIO_printf(bio_err,"private key length is too short,\n");
|
BIO_printf(bio_err,"private key length is too short,\n");
|
||||||
BIO_printf(bio_err,"it needs to be at least %d bits, not %d\n",MIN_KEY_LENGTH,newkey);
|
BIO_printf(bio_err,"it needs to be at least %d bits, not %d\n",MIN_KEY_LENGTH,newkey);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
BIO_printf(bio_err,"Generating a %d bit %s private key\n",
|
BIO_printf(bio_err,"Generating a %d bit %s private key\n",
|
||||||
newkey,(pkey_type == TYPE_RSA)?"RSA":"DSA");
|
newkey,(pkey_type == TYPE_RSA)?"RSA":(pkey_type == TYPE_DSA)?"DSA":"ECDSA");
|
||||||
|
|
||||||
if ((pkey=EVP_PKEY_new()) == NULL) goto end;
|
if ((pkey=EVP_PKEY_new()) == NULL) goto end;
|
||||||
|
|
||||||
@@ -696,6 +741,14 @@ bad:
|
|||||||
dsa_params=NULL;
|
dsa_params=NULL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef OPENSSL_NO_ECDSA
|
||||||
|
if (pkey_type == TYPE_ECDSA)
|
||||||
|
{
|
||||||
|
if (!ECDSA_generate_key(ecdsa_params)) goto end;
|
||||||
|
if (!EVP_PKEY_assign_ECDSA(pkey, ecdsa_params)) goto end;
|
||||||
|
ecdsa_params = NULL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
app_RAND_write_file(randfile, bio_err);
|
app_RAND_write_file(randfile, bio_err);
|
||||||
|
|
||||||
@@ -703,7 +756,7 @@ bad:
|
|||||||
|
|
||||||
if (keyout == NULL)
|
if (keyout == NULL)
|
||||||
{
|
{
|
||||||
keyout=CONF_get_string(req_conf,SECTION,KEYFILE);
|
keyout=NCONF_get_string(req_conf,SECTION,KEYFILE);
|
||||||
if (keyout == NULL)
|
if (keyout == NULL)
|
||||||
ERR_clear_error();
|
ERR_clear_error();
|
||||||
}
|
}
|
||||||
@@ -729,11 +782,11 @@ bad:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
p=CONF_get_string(req_conf,SECTION,"encrypt_rsa_key");
|
p=NCONF_get_string(req_conf,SECTION,"encrypt_rsa_key");
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
{
|
{
|
||||||
ERR_clear_error();
|
ERR_clear_error();
|
||||||
p=CONF_get_string(req_conf,SECTION,"encrypt_key");
|
p=NCONF_get_string(req_conf,SECTION,"encrypt_key");
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
ERR_clear_error();
|
ERR_clear_error();
|
||||||
}
|
}
|
||||||
@@ -801,6 +854,10 @@ loop:
|
|||||||
#ifndef OPENSSL_NO_DSA
|
#ifndef OPENSSL_NO_DSA
|
||||||
if (pkey->type == EVP_PKEY_DSA)
|
if (pkey->type == EVP_PKEY_DSA)
|
||||||
digest=EVP_dss1();
|
digest=EVP_dss1();
|
||||||
|
#endif
|
||||||
|
#ifndef OPENSSL_NO_ECDSA
|
||||||
|
if (pkey->type == EVP_PKEY_ECDSA)
|
||||||
|
digest=EVP_ecdsa();
|
||||||
#endif
|
#endif
|
||||||
if (req == NULL)
|
if (req == NULL)
|
||||||
{
|
{
|
||||||
@@ -810,7 +867,7 @@ loop:
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
i=make_REQ(req,pkey,subj,!x509);
|
i=make_REQ(req,pkey,subj,!x509, chtype);
|
||||||
subj=NULL; /* done processing '-subj' option */
|
subj=NULL; /* done processing '-subj' option */
|
||||||
if ((kludge > 0) && !sk_X509_ATTRIBUTE_num(req->req_info->attributes))
|
if ((kludge > 0) && !sk_X509_ATTRIBUTE_num(req->req_info->attributes))
|
||||||
{
|
{
|
||||||
@@ -832,28 +889,29 @@ loop:
|
|||||||
/* Set version to V3 */
|
/* Set version to V3 */
|
||||||
if(!X509_set_version(x509ss, 2)) goto end;
|
if(!X509_set_version(x509ss, 2)) goto end;
|
||||||
if (serial)
|
if (serial)
|
||||||
X509_set_serialNumber(x509ss, serial);
|
{
|
||||||
|
if (!X509_set_serialNumber(x509ss, serial)) goto end;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
ASN1_INTEGER_set(X509_get_serialNumber(x509ss),0L);
|
{
|
||||||
|
if (!ASN1_INTEGER_set(X509_get_serialNumber(x509ss),0L)) goto end;
|
||||||
|
}
|
||||||
|
|
||||||
X509_set_issuer_name(x509ss,
|
if (!X509_set_issuer_name(x509ss, X509_REQ_get_subject_name(req))) goto end;
|
||||||
X509_REQ_get_subject_name(req));
|
if (!X509_gmtime_adj(X509_get_notBefore(x509ss),0)) goto end;
|
||||||
X509_gmtime_adj(X509_get_notBefore(x509ss),0);
|
if (!X509_gmtime_adj(X509_get_notAfter(x509ss), (long)60*60*24*days)) goto end;
|
||||||
X509_gmtime_adj(X509_get_notAfter(x509ss),
|
if (!X509_set_subject_name(x509ss, X509_REQ_get_subject_name(req))) goto end;
|
||||||
(long)60*60*24*days);
|
|
||||||
X509_set_subject_name(x509ss,
|
|
||||||
X509_REQ_get_subject_name(req));
|
|
||||||
tmppkey = X509_REQ_get_pubkey(req);
|
tmppkey = X509_REQ_get_pubkey(req);
|
||||||
X509_set_pubkey(x509ss,tmppkey);
|
if (!tmppkey || !X509_set_pubkey(x509ss,tmppkey)) goto end;
|
||||||
EVP_PKEY_free(tmppkey);
|
EVP_PKEY_free(tmppkey);
|
||||||
|
|
||||||
/* Set up V3 context struct */
|
/* Set up V3 context struct */
|
||||||
|
|
||||||
X509V3_set_ctx(&ext_ctx, x509ss, x509ss, NULL, NULL, 0);
|
X509V3_set_ctx(&ext_ctx, x509ss, x509ss, NULL, NULL, 0);
|
||||||
X509V3_set_conf_lhash(&ext_ctx, req_conf);
|
X509V3_set_nconf(&ext_ctx, req_conf);
|
||||||
|
|
||||||
/* Add extensions */
|
/* Add extensions */
|
||||||
if(extensions && !X509V3_EXT_add_conf(req_conf,
|
if(extensions && !X509V3_EXT_add_nconf(req_conf,
|
||||||
&ext_ctx, extensions, x509ss))
|
&ext_ctx, extensions, x509ss))
|
||||||
{
|
{
|
||||||
BIO_printf(bio_err,
|
BIO_printf(bio_err,
|
||||||
@@ -872,10 +930,10 @@ loop:
|
|||||||
/* Set up V3 context struct */
|
/* Set up V3 context struct */
|
||||||
|
|
||||||
X509V3_set_ctx(&ext_ctx, NULL, NULL, req, NULL, 0);
|
X509V3_set_ctx(&ext_ctx, NULL, NULL, req, NULL, 0);
|
||||||
X509V3_set_conf_lhash(&ext_ctx, req_conf);
|
X509V3_set_nconf(&ext_ctx, req_conf);
|
||||||
|
|
||||||
/* Add extensions */
|
/* Add extensions */
|
||||||
if(req_exts && !X509V3_EXT_REQ_add_conf(req_conf,
|
if(req_exts && !X509V3_EXT_REQ_add_nconf(req_conf,
|
||||||
&ext_ctx, req_exts, req))
|
&ext_ctx, req_exts, req))
|
||||||
{
|
{
|
||||||
BIO_printf(bio_err,
|
BIO_printf(bio_err,
|
||||||
@@ -902,7 +960,7 @@ loop:
|
|||||||
print_name(bio_err, "old subject=", X509_REQ_get_subject_name(req), nmflag);
|
print_name(bio_err, "old subject=", X509_REQ_get_subject_name(req), nmflag);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (build_subject(req, subj) == 0)
|
if (build_subject(req, subj, chtype) == 0)
|
||||||
{
|
{
|
||||||
BIO_printf(bio_err, "ERROR: cannot modify subject\n");
|
BIO_printf(bio_err, "ERROR: cannot modify subject\n");
|
||||||
ex=1;
|
ex=1;
|
||||||
@@ -941,12 +999,13 @@ loop:
|
|||||||
else if (i == 0)
|
else if (i == 0)
|
||||||
{
|
{
|
||||||
BIO_printf(bio_err,"verify failure\n");
|
BIO_printf(bio_err,"verify failure\n");
|
||||||
|
ERR_print_errors(bio_err);
|
||||||
}
|
}
|
||||||
else /* if (i > 0) */
|
else /* if (i > 0) */
|
||||||
BIO_printf(bio_err,"verify OK\n");
|
BIO_printf(bio_err,"verify OK\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (noout && !text && !modulus && !subject)
|
if (noout && !text && !modulus && !subject && !pubkey)
|
||||||
{
|
{
|
||||||
ex=0;
|
ex=0;
|
||||||
goto end;
|
goto end;
|
||||||
@@ -975,6 +1034,20 @@ loop:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pubkey)
|
||||||
|
{
|
||||||
|
EVP_PKEY *tpubkey;
|
||||||
|
tpubkey=X509_REQ_get_pubkey(req);
|
||||||
|
if (tpubkey == NULL)
|
||||||
|
{
|
||||||
|
BIO_printf(bio_err,"Error getting public key\n");
|
||||||
|
ERR_print_errors(bio_err);
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
PEM_write_bio_PUBKEY(out, tpubkey);
|
||||||
|
EVP_PKEY_free(tpubkey);
|
||||||
|
}
|
||||||
|
|
||||||
if (text)
|
if (text)
|
||||||
{
|
{
|
||||||
if (x509)
|
if (x509)
|
||||||
@@ -993,24 +1066,25 @@ loop:
|
|||||||
|
|
||||||
if (modulus)
|
if (modulus)
|
||||||
{
|
{
|
||||||
EVP_PKEY *pubkey;
|
EVP_PKEY *tpubkey;
|
||||||
|
|
||||||
if (x509)
|
if (x509)
|
||||||
pubkey=X509_get_pubkey(x509ss);
|
tpubkey=X509_get_pubkey(x509ss);
|
||||||
else
|
else
|
||||||
pubkey=X509_REQ_get_pubkey(req);
|
tpubkey=X509_REQ_get_pubkey(req);
|
||||||
if (pubkey == NULL)
|
if (tpubkey == NULL)
|
||||||
{
|
{
|
||||||
fprintf(stdout,"Modulus=unavailable\n");
|
fprintf(stdout,"Modulus=unavailable\n");
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
fprintf(stdout,"Modulus=");
|
fprintf(stdout,"Modulus=");
|
||||||
#ifndef OPENSSL_NO_RSA
|
#ifndef OPENSSL_NO_RSA
|
||||||
if (pubkey->type == EVP_PKEY_RSA)
|
if (tpubkey->type == EVP_PKEY_RSA)
|
||||||
BN_print(out,pubkey->pkey.rsa->n);
|
BN_print(out,tpubkey->pkey.rsa->n);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
fprintf(stdout,"Wrong Algorithm type");
|
fprintf(stdout,"Wrong Algorithm type");
|
||||||
|
EVP_PKEY_free(tpubkey);
|
||||||
fprintf(stdout,"\n");
|
fprintf(stdout,"\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1053,7 +1127,7 @@ end:
|
|||||||
{
|
{
|
||||||
ERR_print_errors(bio_err);
|
ERR_print_errors(bio_err);
|
||||||
}
|
}
|
||||||
if ((req_conf != NULL) && (req_conf != config)) CONF_free(req_conf);
|
if ((req_conf != NULL) && (req_conf != config)) NCONF_free(req_conf);
|
||||||
BIO_free(in);
|
BIO_free(in);
|
||||||
BIO_free_all(out);
|
BIO_free_all(out);
|
||||||
EVP_PKEY_free(pkey);
|
EVP_PKEY_free(pkey);
|
||||||
@@ -1066,36 +1140,41 @@ end:
|
|||||||
#ifndef OPENSSL_NO_DSA
|
#ifndef OPENSSL_NO_DSA
|
||||||
if (dsa_params != NULL) DSA_free(dsa_params);
|
if (dsa_params != NULL) DSA_free(dsa_params);
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef OPENSSL_NO_ECDSA
|
||||||
|
if (ecdsa_params != NULL) ECDSA_free(ecdsa_params);
|
||||||
|
#endif
|
||||||
|
apps_shutdown();
|
||||||
EXIT(ex);
|
EXIT(ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int make_REQ(X509_REQ *req, EVP_PKEY *pkey, char *subj, int attribs)
|
static int make_REQ(X509_REQ *req, EVP_PKEY *pkey, char *subj, int attribs,
|
||||||
|
unsigned long chtype)
|
||||||
{
|
{
|
||||||
int ret=0,i;
|
int ret=0,i;
|
||||||
char no_prompt = 0;
|
char no_prompt = 0;
|
||||||
STACK_OF(CONF_VALUE) *dn_sk, *attr_sk = NULL;
|
STACK_OF(CONF_VALUE) *dn_sk, *attr_sk = NULL;
|
||||||
char *tmp, *dn_sect,*attr_sect;
|
char *tmp, *dn_sect,*attr_sect;
|
||||||
|
|
||||||
tmp=CONF_get_string(req_conf,SECTION,PROMPT);
|
tmp=NCONF_get_string(req_conf,SECTION,PROMPT);
|
||||||
if (tmp == NULL)
|
if (tmp == NULL)
|
||||||
ERR_clear_error();
|
ERR_clear_error();
|
||||||
if((tmp != NULL) && !strcmp(tmp, "no")) no_prompt = 1;
|
if((tmp != NULL) && !strcmp(tmp, "no")) no_prompt = 1;
|
||||||
|
|
||||||
dn_sect=CONF_get_string(req_conf,SECTION,DISTINGUISHED_NAME);
|
dn_sect=NCONF_get_string(req_conf,SECTION,DISTINGUISHED_NAME);
|
||||||
if (dn_sect == NULL)
|
if (dn_sect == NULL)
|
||||||
{
|
{
|
||||||
BIO_printf(bio_err,"unable to find '%s' in config\n",
|
BIO_printf(bio_err,"unable to find '%s' in config\n",
|
||||||
DISTINGUISHED_NAME);
|
DISTINGUISHED_NAME);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
dn_sk=CONF_get_section(req_conf,dn_sect);
|
dn_sk=NCONF_get_section(req_conf,dn_sect);
|
||||||
if (dn_sk == NULL)
|
if (dn_sk == NULL)
|
||||||
{
|
{
|
||||||
BIO_printf(bio_err,"unable to get '%s' section\n",dn_sect);
|
BIO_printf(bio_err,"unable to get '%s' section\n",dn_sect);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
attr_sect=CONF_get_string(req_conf,SECTION,ATTRIBUTES);
|
attr_sect=NCONF_get_string(req_conf,SECTION,ATTRIBUTES);
|
||||||
if (attr_sect == NULL)
|
if (attr_sect == NULL)
|
||||||
{
|
{
|
||||||
ERR_clear_error();
|
ERR_clear_error();
|
||||||
@@ -1103,7 +1182,7 @@ static int make_REQ(X509_REQ *req, EVP_PKEY *pkey, char *subj, int attribs)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
attr_sk=CONF_get_section(req_conf,attr_sect);
|
attr_sk=NCONF_get_section(req_conf,attr_sect);
|
||||||
if (attr_sk == NULL)
|
if (attr_sk == NULL)
|
||||||
{
|
{
|
||||||
BIO_printf(bio_err,"unable to get '%s' section\n",attr_sect);
|
BIO_printf(bio_err,"unable to get '%s' section\n",attr_sect);
|
||||||
@@ -1115,81 +1194,39 @@ static int make_REQ(X509_REQ *req, EVP_PKEY *pkey, char *subj, int attribs)
|
|||||||
if (!X509_REQ_set_version(req,0L)) goto err; /* version 1 */
|
if (!X509_REQ_set_version(req,0L)) goto err; /* version 1 */
|
||||||
|
|
||||||
if (no_prompt)
|
if (no_prompt)
|
||||||
i = auto_info(req, dn_sk, attr_sk, attribs);
|
i = auto_info(req, dn_sk, attr_sk, attribs, chtype);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (subj)
|
if (subj)
|
||||||
i = build_subject(req, subj);
|
i = build_subject(req, subj, chtype);
|
||||||
else
|
else
|
||||||
i = prompt_info(req, dn_sk, dn_sect, attr_sk, attr_sect, attribs);
|
i = prompt_info(req, dn_sk, dn_sect, attr_sk, attr_sect, attribs, chtype);
|
||||||
}
|
}
|
||||||
if(!i) goto err;
|
if(!i) goto err;
|
||||||
|
|
||||||
X509_REQ_set_pubkey(req,pkey);
|
if (!X509_REQ_set_pubkey(req,pkey)) goto err;
|
||||||
|
|
||||||
ret=1;
|
ret=1;
|
||||||
err:
|
err:
|
||||||
return(ret);
|
return(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int build_subject(X509_REQ *req, char *subject)
|
/*
|
||||||
|
* subject is expected to be in the format /type0=value0/type1=value1/type2=...
|
||||||
|
* where characters may be escaped by \
|
||||||
|
*/
|
||||||
|
static int build_subject(X509_REQ *req, char *subject, unsigned long chtype)
|
||||||
{
|
{
|
||||||
X509_NAME *n = NULL;
|
X509_NAME *n;
|
||||||
|
|
||||||
int i, nid, ne_num=0;
|
if (!(n = do_subject(subject, chtype)))
|
||||||
|
return 0;
|
||||||
char *ne_name = NULL;
|
|
||||||
char *ne_value = NULL;
|
|
||||||
|
|
||||||
char *tmp = NULL;
|
|
||||||
char *p[2];
|
|
||||||
|
|
||||||
char *str_list[256];
|
|
||||||
|
|
||||||
p[0] = ",/";
|
|
||||||
p[1] = "=";
|
|
||||||
|
|
||||||
n = X509_NAME_new();
|
|
||||||
|
|
||||||
tmp = strtok(subject, p[0]);
|
|
||||||
while((tmp != NULL) && (ne_num < (sizeof str_list/sizeof *str_list)))
|
|
||||||
{
|
|
||||||
char *token = tmp;
|
|
||||||
|
|
||||||
while (token[0] == ' ')
|
|
||||||
token++;
|
|
||||||
str_list[ne_num] = token;
|
|
||||||
|
|
||||||
tmp = strtok(NULL, p[0]);
|
|
||||||
ne_num++;
|
|
||||||
}
|
|
||||||
|
|
||||||
for(i = 0; i < ne_num; i++)
|
|
||||||
{
|
|
||||||
ne_name = strtok(str_list[i], p[1]);
|
|
||||||
ne_value = strtok(NULL, p[1]);
|
|
||||||
|
|
||||||
if ((nid=OBJ_txt2nid(ne_name)) == NID_undef)
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err, "Subject Attribute %s has no known NID, skipped\n", ne_name);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ne_value == NULL)
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err, "No value provided for Subject Attribute %s, skipped\n", ne_name);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!X509_NAME_add_entry_by_NID(n, nid, MBSTRING_ASC, (unsigned char*)ne_value, -1,-1,0))
|
|
||||||
{
|
|
||||||
X509_NAME_free(n);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!X509_REQ_set_subject_name(req, n))
|
if (!X509_REQ_set_subject_name(req, n))
|
||||||
|
{
|
||||||
|
X509_NAME_free(n);
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
X509_NAME_free(n);
|
X509_NAME_free(n);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -1197,12 +1234,14 @@ static int build_subject(X509_REQ *req, char *subject)
|
|||||||
|
|
||||||
static int prompt_info(X509_REQ *req,
|
static int prompt_info(X509_REQ *req,
|
||||||
STACK_OF(CONF_VALUE) *dn_sk, char *dn_sect,
|
STACK_OF(CONF_VALUE) *dn_sk, char *dn_sect,
|
||||||
STACK_OF(CONF_VALUE) *attr_sk, char *attr_sect, int attribs)
|
STACK_OF(CONF_VALUE) *attr_sk, char *attr_sect, int attribs,
|
||||||
|
unsigned long chtype)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char *p,*q;
|
char *p,*q;
|
||||||
char buf[100];
|
char buf[100];
|
||||||
int nid,min,max;
|
int nid;
|
||||||
|
long n_min,n_max;
|
||||||
char *type,*def,*value;
|
char *type,*def,*value;
|
||||||
CONF_VALUE *v;
|
CONF_VALUE *v;
|
||||||
X509_NAME *subj;
|
X509_NAME *subj;
|
||||||
@@ -1247,27 +1286,29 @@ start: for (;;)
|
|||||||
/* If OBJ not recognised ignore it */
|
/* If OBJ not recognised ignore it */
|
||||||
if ((nid=OBJ_txt2nid(type)) == NID_undef) goto start;
|
if ((nid=OBJ_txt2nid(type)) == NID_undef) goto start;
|
||||||
sprintf(buf,"%s_default",v->name);
|
sprintf(buf,"%s_default",v->name);
|
||||||
if ((def=CONF_get_string(req_conf,dn_sect,buf)) == NULL)
|
if ((def=NCONF_get_string(req_conf,dn_sect,buf)) == NULL)
|
||||||
{
|
{
|
||||||
ERR_clear_error();
|
ERR_clear_error();
|
||||||
def="";
|
def="";
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(buf,"%s_value",v->name);
|
sprintf(buf,"%s_value",v->name);
|
||||||
if ((value=CONF_get_string(req_conf,dn_sect,buf)) == NULL)
|
if ((value=NCONF_get_string(req_conf,dn_sect,buf)) == NULL)
|
||||||
{
|
{
|
||||||
ERR_clear_error();
|
ERR_clear_error();
|
||||||
value=NULL;
|
value=NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(buf,"%s_min",v->name);
|
sprintf(buf,"%s_min",v->name);
|
||||||
min=(int)CONF_get_number(req_conf,dn_sect,buf);
|
if (!NCONF_get_number(req_conf,dn_sect,buf, &n_min))
|
||||||
|
n_min = -1;
|
||||||
|
|
||||||
sprintf(buf,"%s_max",v->name);
|
sprintf(buf,"%s_max",v->name);
|
||||||
max=(int)CONF_get_number(req_conf,dn_sect,buf);
|
if (!NCONF_get_number(req_conf,dn_sect,buf, &n_max))
|
||||||
|
n_max = -1;
|
||||||
|
|
||||||
if (!add_DN_object(subj,v->value,def,value,nid,
|
if (!add_DN_object(subj,v->value,def,value,nid,
|
||||||
min,max))
|
n_min,n_max, chtype))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (X509_NAME_entry_count(subj) == 0)
|
if (X509_NAME_entry_count(subj) == 0)
|
||||||
@@ -1298,7 +1339,7 @@ start2: for (;;)
|
|||||||
goto start2;
|
goto start2;
|
||||||
|
|
||||||
sprintf(buf,"%s_default",type);
|
sprintf(buf,"%s_default",type);
|
||||||
if ((def=CONF_get_string(req_conf,attr_sect,buf))
|
if ((def=NCONF_get_string(req_conf,attr_sect,buf))
|
||||||
== NULL)
|
== NULL)
|
||||||
{
|
{
|
||||||
ERR_clear_error();
|
ERR_clear_error();
|
||||||
@@ -1307,7 +1348,7 @@ start2: for (;;)
|
|||||||
|
|
||||||
|
|
||||||
sprintf(buf,"%s_value",type);
|
sprintf(buf,"%s_value",type);
|
||||||
if ((value=CONF_get_string(req_conf,attr_sect,buf))
|
if ((value=NCONF_get_string(req_conf,attr_sect,buf))
|
||||||
== NULL)
|
== NULL)
|
||||||
{
|
{
|
||||||
ERR_clear_error();
|
ERR_clear_error();
|
||||||
@@ -1315,13 +1356,15 @@ start2: for (;;)
|
|||||||
}
|
}
|
||||||
|
|
||||||
sprintf(buf,"%s_min",type);
|
sprintf(buf,"%s_min",type);
|
||||||
min=(int)CONF_get_number(req_conf,attr_sect,buf);
|
if (!NCONF_get_number(req_conf,attr_sect,buf, &n_min))
|
||||||
|
n_min = -1;
|
||||||
|
|
||||||
sprintf(buf,"%s_max",type);
|
sprintf(buf,"%s_max",type);
|
||||||
max=(int)CONF_get_number(req_conf,attr_sect,buf);
|
if (!NCONF_get_number(req_conf,attr_sect,buf, &n_max))
|
||||||
|
n_max = -1;
|
||||||
|
|
||||||
if (!add_attribute_object(req,
|
if (!add_attribute_object(req,
|
||||||
v->value,def,value,nid,min,max))
|
v->value,def,value,nid,n_min,n_max, chtype))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1337,7 +1380,7 @@ start2: for (;;)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int auto_info(X509_REQ *req, STACK_OF(CONF_VALUE) *dn_sk,
|
static int auto_info(X509_REQ *req, STACK_OF(CONF_VALUE) *dn_sk,
|
||||||
STACK_OF(CONF_VALUE) *attr_sk, int attribs)
|
STACK_OF(CONF_VALUE) *attr_sk, int attribs, unsigned long chtype)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char *p,*q;
|
char *p,*q;
|
||||||
@@ -1365,7 +1408,7 @@ static int auto_info(X509_REQ *req, STACK_OF(CONF_VALUE) *dn_sk,
|
|||||||
if(*p) type = p;
|
if(*p) type = p;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!X509_NAME_add_entry_by_txt(subj,type, MBSTRING_ASC,
|
if (!X509_NAME_add_entry_by_txt(subj,type, chtype,
|
||||||
(unsigned char *) v->value,-1,-1,0)) return 0;
|
(unsigned char *) v->value,-1,-1,0)) return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1380,7 +1423,7 @@ static int auto_info(X509_REQ *req, STACK_OF(CONF_VALUE) *dn_sk,
|
|||||||
for (i = 0; i < sk_CONF_VALUE_num(attr_sk); i++)
|
for (i = 0; i < sk_CONF_VALUE_num(attr_sk); i++)
|
||||||
{
|
{
|
||||||
v=sk_CONF_VALUE_value(attr_sk,i);
|
v=sk_CONF_VALUE_value(attr_sk,i);
|
||||||
if(!X509_REQ_add1_attr_by_txt(req, v->name, MBSTRING_ASC,
|
if(!X509_REQ_add1_attr_by_txt(req, v->name, chtype,
|
||||||
(unsigned char *)v->value, -1)) return 0;
|
(unsigned char *)v->value, -1)) return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1389,7 +1432,7 @@ static int auto_info(X509_REQ *req, STACK_OF(CONF_VALUE) *dn_sk,
|
|||||||
|
|
||||||
|
|
||||||
static int add_DN_object(X509_NAME *n, char *text, char *def, char *value,
|
static int add_DN_object(X509_NAME *n, char *text, char *def, char *value,
|
||||||
int nid, int min, int max)
|
int nid, int n_min, int n_max, unsigned long chtype)
|
||||||
{
|
{
|
||||||
int i,ret=0;
|
int i,ret=0;
|
||||||
MS_STATIC char buf[1024];
|
MS_STATIC char buf[1024];
|
||||||
@@ -1436,8 +1479,8 @@ start:
|
|||||||
#ifdef CHARSET_EBCDIC
|
#ifdef CHARSET_EBCDIC
|
||||||
ebcdic2ascii(buf, buf, i);
|
ebcdic2ascii(buf, buf, i);
|
||||||
#endif
|
#endif
|
||||||
if(!req_check_len(i, min, max)) goto start;
|
if(!req_check_len(i, n_min, n_max)) goto start;
|
||||||
if (!X509_NAME_add_entry_by_NID(n,nid, MBSTRING_ASC,
|
if (!X509_NAME_add_entry_by_NID(n,nid, chtype,
|
||||||
(unsigned char *) buf, -1,-1,0)) goto err;
|
(unsigned char *) buf, -1,-1,0)) goto err;
|
||||||
ret=1;
|
ret=1;
|
||||||
err:
|
err:
|
||||||
@@ -1445,8 +1488,8 @@ err:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int add_attribute_object(X509_REQ *req, char *text,
|
static int add_attribute_object(X509_REQ *req, char *text,
|
||||||
char *def, char *value, int nid, int min,
|
char *def, char *value, int nid, int n_min,
|
||||||
int max)
|
int n_max, unsigned long chtype)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
static char buf[1024];
|
static char buf[1024];
|
||||||
@@ -1494,9 +1537,9 @@ start:
|
|||||||
#ifdef CHARSET_EBCDIC
|
#ifdef CHARSET_EBCDIC
|
||||||
ebcdic2ascii(buf, buf, i);
|
ebcdic2ascii(buf, buf, i);
|
||||||
#endif
|
#endif
|
||||||
if(!req_check_len(i, min, max)) goto start;
|
if(!req_check_len(i, n_min, n_max)) goto start;
|
||||||
|
|
||||||
if(!X509_REQ_add1_attr_by_NID(req, nid, MBSTRING_ASC,
|
if(!X509_REQ_add1_attr_by_NID(req, nid, chtype,
|
||||||
(unsigned char *)buf, -1)) {
|
(unsigned char *)buf, -1)) {
|
||||||
BIO_printf(bio_err, "Error adding attribute\n");
|
BIO_printf(bio_err, "Error adding attribute\n");
|
||||||
ERR_print_errors(bio_err);
|
ERR_print_errors(bio_err);
|
||||||
@@ -1525,16 +1568,16 @@ static void MS_CALLBACK req_cb(int p, int n, void *arg)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int req_check_len(int len, int min, int max)
|
static int req_check_len(int len, int n_min, int n_max)
|
||||||
{
|
{
|
||||||
if (len < min)
|
if ((n_min > 0) && (len < n_min))
|
||||||
{
|
{
|
||||||
BIO_printf(bio_err,"string is too short, it needs to be at least %d bytes long\n",min);
|
BIO_printf(bio_err,"string is too short, it needs to be at least %d bytes long\n",n_min);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
if ((max != 0) && (len > max))
|
if ((n_max >= 0) && (len > n_max))
|
||||||
{
|
{
|
||||||
BIO_printf(bio_err,"string is too long, it needs to be less than %d bytes long\n",max);
|
BIO_printf(bio_err,"string is too long, it needs to be less than %d bytes long\n",n_max);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
return(1);
|
return(1);
|
||||||
|
|||||||
105
apps/rsa.c
105
apps/rsa.c
@@ -68,7 +68,6 @@
|
|||||||
#include <openssl/evp.h>
|
#include <openssl/evp.h>
|
||||||
#include <openssl/x509.h>
|
#include <openssl/x509.h>
|
||||||
#include <openssl/pem.h>
|
#include <openssl/pem.h>
|
||||||
#include <openssl/engine.h>
|
|
||||||
|
|
||||||
#undef PROG
|
#undef PROG
|
||||||
#define PROG rsa_main
|
#define PROG rsa_main
|
||||||
@@ -80,6 +79,9 @@
|
|||||||
* -des - encrypt output if PEM format with DES in cbc mode
|
* -des - encrypt output if PEM format with DES in cbc mode
|
||||||
* -des3 - encrypt output if PEM format
|
* -des3 - encrypt output if PEM format
|
||||||
* -idea - encrypt output if PEM format
|
* -idea - encrypt output if PEM format
|
||||||
|
* -aes128 - encrypt output if PEM format
|
||||||
|
* -aes192 - encrypt output if PEM format
|
||||||
|
* -aes256 - encrypt output if PEM format
|
||||||
* -text - print a text version
|
* -text - print a text version
|
||||||
* -modulus - print the RSA key modulus
|
* -modulus - print the RSA key modulus
|
||||||
* -check - verify key consistency
|
* -check - verify key consistency
|
||||||
@@ -96,7 +98,7 @@ int MAIN(int argc, char **argv)
|
|||||||
RSA *rsa=NULL;
|
RSA *rsa=NULL;
|
||||||
int i,badops=0, sgckey=0;
|
int i,badops=0, sgckey=0;
|
||||||
const EVP_CIPHER *enc=NULL;
|
const EVP_CIPHER *enc=NULL;
|
||||||
BIO *in=NULL,*out=NULL;
|
BIO *out=NULL;
|
||||||
int informat,outformat,text=0,check=0,noout=0;
|
int informat,outformat,text=0,check=0,noout=0;
|
||||||
int pubin = 0, pubout = 0;
|
int pubin = 0, pubout = 0;
|
||||||
char *infile,*outfile,*prog;
|
char *infile,*outfile,*prog;
|
||||||
@@ -111,6 +113,9 @@ int MAIN(int argc, char **argv)
|
|||||||
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
|
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
|
||||||
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
|
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
|
||||||
|
|
||||||
|
if (!load_config(bio_err, NULL))
|
||||||
|
goto end;
|
||||||
|
|
||||||
infile=NULL;
|
infile=NULL;
|
||||||
outfile=NULL;
|
outfile=NULL;
|
||||||
informat=FORMAT_PEM;
|
informat=FORMAT_PEM;
|
||||||
@@ -196,6 +201,10 @@ bad:
|
|||||||
BIO_printf(bio_err," -des3 encrypt PEM output with ede cbc des using 168 bit key\n");
|
BIO_printf(bio_err," -des3 encrypt PEM output with ede cbc des using 168 bit key\n");
|
||||||
#ifndef OPENSSL_NO_IDEA
|
#ifndef OPENSSL_NO_IDEA
|
||||||
BIO_printf(bio_err," -idea encrypt PEM output with cbc idea\n");
|
BIO_printf(bio_err," -idea encrypt PEM output with cbc idea\n");
|
||||||
|
#endif
|
||||||
|
#ifndef OPENSSL_NO_AES
|
||||||
|
BIO_printf(bio_err," -aes128, -aes192, -aes256\n");
|
||||||
|
BIO_printf(bio_err," encrypt PEM output with cbc aes\n");
|
||||||
#endif
|
#endif
|
||||||
BIO_printf(bio_err," -text print the key in text\n");
|
BIO_printf(bio_err," -text print the key in text\n");
|
||||||
BIO_printf(bio_err," -noout don't print key out\n");
|
BIO_printf(bio_err," -noout don't print key out\n");
|
||||||
@@ -209,23 +218,7 @@ bad:
|
|||||||
|
|
||||||
ERR_load_crypto_strings();
|
ERR_load_crypto_strings();
|
||||||
|
|
||||||
if (engine != NULL)
|
e = setup_engine(bio_err, engine, 0);
|
||||||
{
|
|
||||||
if((e = ENGINE_by_id(engine)) == NULL)
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"invalid engine \"%s\"\n",
|
|
||||||
engine);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"can't use that engine\n");
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
|
|
||||||
/* Free our "structural" reference. */
|
|
||||||
ENGINE_free(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!app_passwd(bio_err, passargin, passargout, &passin, &passout)) {
|
if(!app_passwd(bio_err, passargin, passargout, &passin, &passout)) {
|
||||||
BIO_printf(bio_err, "Error getting passwords\n");
|
BIO_printf(bio_err, "Error getting passwords\n");
|
||||||
@@ -237,69 +230,29 @@ bad:
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
in=BIO_new(BIO_s_file());
|
|
||||||
out=BIO_new(BIO_s_file());
|
out=BIO_new(BIO_s_file());
|
||||||
if ((in == NULL) || (out == NULL))
|
|
||||||
{
|
|
||||||
ERR_print_errors(bio_err);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (infile == NULL)
|
{
|
||||||
BIO_set_fp(in,stdin,BIO_NOCLOSE);
|
EVP_PKEY *pkey;
|
||||||
else
|
|
||||||
{
|
|
||||||
if (BIO_read_filename(in,infile) <= 0)
|
|
||||||
{
|
|
||||||
perror(infile);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
BIO_printf(bio_err,"read RSA key\n");
|
if (pubin)
|
||||||
if (informat == FORMAT_ASN1) {
|
pkey = load_pubkey(bio_err, infile,
|
||||||
if (pubin) rsa=d2i_RSA_PUBKEY_bio(in,NULL);
|
(informat == FORMAT_NETSCAPE && sgckey ?
|
||||||
else rsa=d2i_RSAPrivateKey_bio(in,NULL);
|
FORMAT_IISSGC : informat),
|
||||||
|
passin, e, "Public Key");
|
||||||
|
else
|
||||||
|
pkey = load_key(bio_err, infile,
|
||||||
|
(informat == FORMAT_NETSCAPE && sgckey ?
|
||||||
|
FORMAT_IISSGC : informat),
|
||||||
|
passin, e, "Private Key");
|
||||||
|
|
||||||
|
if (pkey != NULL)
|
||||||
|
rsa = pkey == NULL ? NULL : EVP_PKEY_get1_RSA(pkey);
|
||||||
|
EVP_PKEY_free(pkey);
|
||||||
}
|
}
|
||||||
#ifndef OPENSSL_NO_RC4
|
|
||||||
else if (informat == FORMAT_NETSCAPE)
|
|
||||||
{
|
|
||||||
BUF_MEM *buf=NULL;
|
|
||||||
const unsigned char *p;
|
|
||||||
int size=0;
|
|
||||||
|
|
||||||
buf=BUF_MEM_new();
|
|
||||||
for (;;)
|
|
||||||
{
|
|
||||||
if ((buf == NULL) || (!BUF_MEM_grow(buf,size+1024*10)))
|
|
||||||
goto end;
|
|
||||||
i=BIO_read(in,&(buf->data[size]),1024*10);
|
|
||||||
size+=i;
|
|
||||||
if (i == 0) break;
|
|
||||||
if (i < 0)
|
|
||||||
{
|
|
||||||
perror("reading private key");
|
|
||||||
BUF_MEM_free(buf);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
p=(unsigned char *)buf->data;
|
|
||||||
rsa=d2i_RSA_NET(NULL,&p,(long)size,NULL, sgckey);
|
|
||||||
BUF_MEM_free(buf);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
else if (informat == FORMAT_PEM) {
|
|
||||||
if(pubin) rsa=PEM_read_bio_RSA_PUBKEY(in,NULL,NULL,NULL);
|
|
||||||
else rsa=PEM_read_bio_RSAPrivateKey(in,NULL, NULL,passin);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"bad input format specified for key\n");
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
if (rsa == NULL)
|
if (rsa == NULL)
|
||||||
{
|
{
|
||||||
BIO_printf(bio_err,"unable to load key\n");
|
|
||||||
ERR_print_errors(bio_err);
|
ERR_print_errors(bio_err);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
@@ -411,11 +364,11 @@ bad:
|
|||||||
else
|
else
|
||||||
ret=0;
|
ret=0;
|
||||||
end:
|
end:
|
||||||
if(in != NULL) BIO_free(in);
|
|
||||||
if(out != NULL) BIO_free_all(out);
|
if(out != NULL) BIO_free_all(out);
|
||||||
if(rsa != NULL) RSA_free(rsa);
|
if(rsa != NULL) RSA_free(rsa);
|
||||||
if(passin) OPENSSL_free(passin);
|
if(passin) OPENSSL_free(passin);
|
||||||
if(passout) OPENSSL_free(passout);
|
if(passout) OPENSSL_free(passout);
|
||||||
|
apps_shutdown();
|
||||||
EXIT(ret);
|
EXIT(ret);
|
||||||
}
|
}
|
||||||
#else /* !OPENSSL_NO_RSA */
|
#else /* !OPENSSL_NO_RSA */
|
||||||
|
|||||||
@@ -62,7 +62,6 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <openssl/err.h>
|
#include <openssl/err.h>
|
||||||
#include <openssl/pem.h>
|
#include <openssl/pem.h>
|
||||||
#include <openssl/engine.h>
|
|
||||||
|
|
||||||
#define RSA_SIGN 1
|
#define RSA_SIGN 1
|
||||||
#define RSA_VERIFY 2
|
#define RSA_VERIFY 2
|
||||||
@@ -105,6 +104,9 @@ int MAIN(int argc, char **argv)
|
|||||||
argv++;
|
argv++;
|
||||||
|
|
||||||
if(!bio_err) bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
|
if(!bio_err) bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
|
||||||
|
|
||||||
|
if (!load_config(bio_err, NULL))
|
||||||
|
goto end;
|
||||||
ERR_load_crypto_strings();
|
ERR_load_crypto_strings();
|
||||||
OpenSSL_add_all_algorithms();
|
OpenSSL_add_all_algorithms();
|
||||||
pad = RSA_PKCS1_PADDING;
|
pad = RSA_PKCS1_PADDING;
|
||||||
@@ -120,6 +122,9 @@ int MAIN(int argc, char **argv)
|
|||||||
} else if(!strcmp(*argv, "-inkey")) {
|
} else if(!strcmp(*argv, "-inkey")) {
|
||||||
if (--argc < 1) badarg = 1;
|
if (--argc < 1) badarg = 1;
|
||||||
keyfile = *(++argv);
|
keyfile = *(++argv);
|
||||||
|
} else if (strcmp(*argv,"-keyform") == 0) {
|
||||||
|
if (--argc < 1) badarg = 1;
|
||||||
|
keyform=str2fmt(*(++argv));
|
||||||
} else if(!strcmp(*argv, "-engine")) {
|
} else if(!strcmp(*argv, "-engine")) {
|
||||||
if (--argc < 1) badarg = 1;
|
if (--argc < 1) badarg = 1;
|
||||||
engine = *(++argv);
|
engine = *(++argv);
|
||||||
@@ -157,38 +162,25 @@ int MAIN(int argc, char **argv)
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (engine != NULL)
|
e = setup_engine(bio_err, engine, 0);
|
||||||
{
|
|
||||||
if((e = ENGINE_by_id(engine)) == NULL)
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"invalid engine \"%s\"\n",
|
|
||||||
engine);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"can't use that engine\n");
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
|
|
||||||
/* Free our "structural" reference. */
|
|
||||||
ENGINE_free(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* FIXME: seed PRNG only if needed */
|
/* FIXME: seed PRNG only if needed */
|
||||||
app_RAND_load_file(NULL, bio_err, 0);
|
app_RAND_load_file(NULL, bio_err, 0);
|
||||||
|
|
||||||
switch(key_type) {
|
switch(key_type) {
|
||||||
case KEY_PRIVKEY:
|
case KEY_PRIVKEY:
|
||||||
pkey = load_key(bio_err, keyfile, keyform, NULL, e);
|
pkey = load_key(bio_err, keyfile, keyform,
|
||||||
|
NULL, e, "Private Key");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_PUBKEY:
|
case KEY_PUBKEY:
|
||||||
pkey = load_pubkey(bio_err, keyfile, keyform, e);
|
pkey = load_pubkey(bio_err, keyfile, keyform,
|
||||||
|
NULL, e, "Public Key");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_CERT:
|
case KEY_CERT:
|
||||||
x = load_cert(bio_err, keyfile, keyform);
|
x = load_cert(bio_err, keyfile, keyform,
|
||||||
|
NULL, e, "Certificate");
|
||||||
if(x) {
|
if(x) {
|
||||||
pkey = X509_get_pubkey(x);
|
pkey = X509_get_pubkey(x);
|
||||||
X509_free(x);
|
X509_free(x);
|
||||||
@@ -197,7 +189,6 @@ int MAIN(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!pkey) {
|
if(!pkey) {
|
||||||
BIO_printf(bio_err, "Error loading key\n");
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -302,6 +293,7 @@ static void usage()
|
|||||||
BIO_printf(bio_err, "-in file input file\n");
|
BIO_printf(bio_err, "-in file input file\n");
|
||||||
BIO_printf(bio_err, "-out file output file\n");
|
BIO_printf(bio_err, "-out file output file\n");
|
||||||
BIO_printf(bio_err, "-inkey file input key\n");
|
BIO_printf(bio_err, "-inkey file input key\n");
|
||||||
|
BIO_printf(bio_err, "-keyform arg private key format - default PEM\n");
|
||||||
BIO_printf(bio_err, "-pubin input is an RSA public\n");
|
BIO_printf(bio_err, "-pubin input is an RSA public\n");
|
||||||
BIO_printf(bio_err, "-certin input is a certificate carrying an RSA public key\n");
|
BIO_printf(bio_err, "-certin input is a certificate carrying an RSA public key\n");
|
||||||
BIO_printf(bio_err, "-ssl use SSL v2 padding\n");
|
BIO_printf(bio_err, "-ssl use SSL v2 padding\n");
|
||||||
@@ -313,6 +305,8 @@ static void usage()
|
|||||||
BIO_printf(bio_err, "-encrypt encrypt with public key\n");
|
BIO_printf(bio_err, "-encrypt encrypt with public key\n");
|
||||||
BIO_printf(bio_err, "-decrypt decrypt with private key\n");
|
BIO_printf(bio_err, "-decrypt decrypt with private key\n");
|
||||||
BIO_printf(bio_err, "-hexdump hex dump output\n");
|
BIO_printf(bio_err, "-hexdump hex dump output\n");
|
||||||
|
BIO_printf(bio_err, "-engine e use engine e, possibly a hardware device.\n");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -55,6 +55,59 @@
|
|||||||
* copied and put under another distribution licence
|
* copied and put under another distribution licence
|
||||||
* [including the GNU Public Licence.]
|
* [including the GNU Public Licence.]
|
||||||
*/
|
*/
|
||||||
|
/* ====================================================================
|
||||||
|
* Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in
|
||||||
|
* the documentation and/or other materials provided with the
|
||||||
|
* distribution.
|
||||||
|
*
|
||||||
|
* 3. All advertising materials mentioning features or use of this
|
||||||
|
* software must display the following acknowledgment:
|
||||||
|
* "This product includes software developed by the OpenSSL Project
|
||||||
|
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
||||||
|
*
|
||||||
|
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||||
|
* endorse or promote products derived from this software without
|
||||||
|
* prior written permission. For written permission, please contact
|
||||||
|
* openssl-core@openssl.org.
|
||||||
|
*
|
||||||
|
* 5. Products derived from this software may not be called "OpenSSL"
|
||||||
|
* nor may "OpenSSL" appear in their names without prior written
|
||||||
|
* permission of the OpenSSL Project.
|
||||||
|
*
|
||||||
|
* 6. Redistributions of any form whatsoever must retain the following
|
||||||
|
* acknowledgment:
|
||||||
|
* "This product includes software developed by the OpenSSL Project
|
||||||
|
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||||
|
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||||
|
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||||
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||||
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
* ====================================================================
|
||||||
|
*
|
||||||
|
* This product includes cryptographic software written by Eric Young
|
||||||
|
* (eay@cryptsoft.com). This product includes software written by Tim
|
||||||
|
* Hudson (tjh@cryptsoft.com).
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <openssl/opensslconf.h>
|
#include <openssl/opensslconf.h>
|
||||||
@@ -89,13 +142,9 @@ typedef fd_mask fd_set;
|
|||||||
int do_server(int port, int *ret, int (*cb) (), char *context);
|
int do_server(int port, int *ret, int (*cb) (), char *context);
|
||||||
#ifdef HEADER_X509_H
|
#ifdef HEADER_X509_H
|
||||||
int MS_CALLBACK verify_callback(int ok, X509_STORE_CTX *ctx);
|
int MS_CALLBACK verify_callback(int ok, X509_STORE_CTX *ctx);
|
||||||
#else
|
|
||||||
int MS_CALLBACK verify_callback(int ok, char *ctx);
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef HEADER_SSL_H
|
#ifdef HEADER_SSL_H
|
||||||
int set_cert_stuff(SSL_CTX *ctx, char *cert_file, char *key_file);
|
int set_cert_stuff(SSL_CTX *ctx, char *cert_file, char *key_file);
|
||||||
#else
|
|
||||||
int set_cert_stuff(char *ctx, char *cert_file, char *key_file);
|
|
||||||
#endif
|
#endif
|
||||||
int init_client(int *sock, char *server, int port);
|
int init_client(int *sock, char *server, int port);
|
||||||
int should_retry(int i);
|
int should_retry(int i);
|
||||||
@@ -106,8 +155,6 @@ long MS_CALLBACK bio_dump_cb(BIO *bio, int cmd, const char *argp,
|
|||||||
int argi, long argl, long ret);
|
int argi, long argl, long ret);
|
||||||
|
|
||||||
#ifdef HEADER_SSL_H
|
#ifdef HEADER_SSL_H
|
||||||
void MS_CALLBACK apps_ssl_info_callback(SSL *s, int where, int ret);
|
void MS_CALLBACK apps_ssl_info_callback(const SSL *s, int where, int ret);
|
||||||
#else
|
void MS_CALLBACK msg_cb(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg);
|
||||||
void MS_CALLBACK apps_ssl_info_callback(char *s, int where, int ret);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
313
apps/s_cb.c
313
apps/s_cb.c
@@ -55,6 +55,59 @@
|
|||||||
* copied and put under another distribution licence
|
* copied and put under another distribution licence
|
||||||
* [including the GNU Public Licence.]
|
* [including the GNU Public Licence.]
|
||||||
*/
|
*/
|
||||||
|
/* ====================================================================
|
||||||
|
* Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in
|
||||||
|
* the documentation and/or other materials provided with the
|
||||||
|
* distribution.
|
||||||
|
*
|
||||||
|
* 3. All advertising materials mentioning features or use of this
|
||||||
|
* software must display the following acknowledgment:
|
||||||
|
* "This product includes software developed by the OpenSSL Project
|
||||||
|
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
||||||
|
*
|
||||||
|
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||||
|
* endorse or promote products derived from this software without
|
||||||
|
* prior written permission. For written permission, please contact
|
||||||
|
* openssl-core@openssl.org.
|
||||||
|
*
|
||||||
|
* 5. Products derived from this software may not be called "OpenSSL"
|
||||||
|
* nor may "OpenSSL" appear in their names without prior written
|
||||||
|
* permission of the OpenSSL Project.
|
||||||
|
*
|
||||||
|
* 6. Redistributions of any form whatsoever must retain the following
|
||||||
|
* acknowledgment:
|
||||||
|
* "This product includes software developed by the OpenSSL Project
|
||||||
|
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||||
|
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||||
|
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||||
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||||
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
* ====================================================================
|
||||||
|
*
|
||||||
|
* This product includes cryptographic software written by Eric Young
|
||||||
|
* (eay@cryptsoft.com). This product includes software written by Tim
|
||||||
|
* Hudson (tjh@cryptsoft.com).
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -200,7 +253,7 @@ long MS_CALLBACK bio_dump_cb(BIO *bio, int cmd, const char *argp, int argi,
|
|||||||
return(ret);
|
return(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MS_CALLBACK apps_ssl_info_callback(SSL *s, int where, int ret)
|
void MS_CALLBACK apps_ssl_info_callback(const SSL *s, int where, int ret)
|
||||||
{
|
{
|
||||||
char *str;
|
char *str;
|
||||||
int w;
|
int w;
|
||||||
@@ -236,3 +289,261 @@ void MS_CALLBACK apps_ssl_info_callback(SSL *s, int where, int ret)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MS_CALLBACK msg_cb(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg)
|
||||||
|
{
|
||||||
|
BIO *bio = arg;
|
||||||
|
const char *str_write_p, *str_version, *str_content_type = "", *str_details1 = "", *str_details2= "";
|
||||||
|
|
||||||
|
str_write_p = write_p ? ">>>" : "<<<";
|
||||||
|
|
||||||
|
switch (version)
|
||||||
|
{
|
||||||
|
case SSL2_VERSION:
|
||||||
|
str_version = "SSL 2.0";
|
||||||
|
break;
|
||||||
|
case SSL3_VERSION:
|
||||||
|
str_version = "SSL 3.0 ";
|
||||||
|
break;
|
||||||
|
case TLS1_VERSION:
|
||||||
|
str_version = "TLS 1.0 ";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
str_version = "???";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (version == SSL2_VERSION)
|
||||||
|
{
|
||||||
|
str_details1 = "???";
|
||||||
|
|
||||||
|
if (len > 0)
|
||||||
|
{
|
||||||
|
switch (((unsigned char*)buf)[0])
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
str_details1 = ", ERROR:";
|
||||||
|
str_details2 = " ???";
|
||||||
|
if (len >= 3)
|
||||||
|
{
|
||||||
|
unsigned err = (((unsigned char*)buf)[1]<<8) + ((unsigned char*)buf)[2];
|
||||||
|
|
||||||
|
switch (err)
|
||||||
|
{
|
||||||
|
case 0x0001:
|
||||||
|
str_details2 = " NO-CIPHER-ERROR";
|
||||||
|
break;
|
||||||
|
case 0x0002:
|
||||||
|
str_details2 = " NO-CERTIFICATE-ERROR";
|
||||||
|
break;
|
||||||
|
case 0x0004:
|
||||||
|
str_details2 = " BAD-CERTIFICATE-ERROR";
|
||||||
|
break;
|
||||||
|
case 0x0006:
|
||||||
|
str_details2 = " UNSUPPORTED-CERTIFICATE-TYPE-ERROR";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
str_details1 = ", CLIENT-HELLO";
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
str_details1 = ", CLIENT-MASTER-KEY";
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
str_details1 = ", CLIENT-FINISHED";
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
str_details1 = ", SERVER-HELLO";
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
str_details1 = ", SERVER-VERIFY";
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
str_details1 = ", SERVER-FINISHED";
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
str_details1 = ", REQUEST-CERTIFICATE";
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
str_details1 = ", CLIENT-CERTIFICATE";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (version == SSL3_VERSION || version == TLS1_VERSION)
|
||||||
|
{
|
||||||
|
switch (content_type)
|
||||||
|
{
|
||||||
|
case 20:
|
||||||
|
str_content_type = "ChangeCipherSpec";
|
||||||
|
break;
|
||||||
|
case 21:
|
||||||
|
str_content_type = "Alert";
|
||||||
|
break;
|
||||||
|
case 22:
|
||||||
|
str_content_type = "Handshake";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (content_type == 21) /* Alert */
|
||||||
|
{
|
||||||
|
str_details1 = ", ???";
|
||||||
|
|
||||||
|
if (len == 2)
|
||||||
|
{
|
||||||
|
switch (((unsigned char*)buf)[0])
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
str_details1 = ", warning";
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
str_details1 = ", fatal";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
str_details2 = " ???";
|
||||||
|
switch (((unsigned char*)buf)[1])
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
str_details2 = " close_notify";
|
||||||
|
break;
|
||||||
|
case 10:
|
||||||
|
str_details2 = " unexpected_message";
|
||||||
|
break;
|
||||||
|
case 20:
|
||||||
|
str_details2 = " bad_record_mac";
|
||||||
|
break;
|
||||||
|
case 21:
|
||||||
|
str_details2 = " decryption_failed";
|
||||||
|
break;
|
||||||
|
case 22:
|
||||||
|
str_details2 = " record_overflow";
|
||||||
|
break;
|
||||||
|
case 30:
|
||||||
|
str_details2 = " decompression_failure";
|
||||||
|
break;
|
||||||
|
case 40:
|
||||||
|
str_details2 = " handshake_failure";
|
||||||
|
break;
|
||||||
|
case 42:
|
||||||
|
str_details2 = " bad_certificate";
|
||||||
|
break;
|
||||||
|
case 43:
|
||||||
|
str_details2 = " unsupported_certificate";
|
||||||
|
break;
|
||||||
|
case 44:
|
||||||
|
str_details2 = " certificate_revoked";
|
||||||
|
break;
|
||||||
|
case 45:
|
||||||
|
str_details2 = " certificate_expired";
|
||||||
|
break;
|
||||||
|
case 46:
|
||||||
|
str_details2 = " certificate_unknown";
|
||||||
|
break;
|
||||||
|
case 47:
|
||||||
|
str_details2 = " illegal_parameter";
|
||||||
|
break;
|
||||||
|
case 48:
|
||||||
|
str_details2 = " unknown_ca";
|
||||||
|
break;
|
||||||
|
case 49:
|
||||||
|
str_details2 = " access_denied";
|
||||||
|
break;
|
||||||
|
case 50:
|
||||||
|
str_details2 = " decode_error";
|
||||||
|
break;
|
||||||
|
case 51:
|
||||||
|
str_details2 = " decrypt_error";
|
||||||
|
break;
|
||||||
|
case 60:
|
||||||
|
str_details2 = " export_restriction";
|
||||||
|
break;
|
||||||
|
case 70:
|
||||||
|
str_details2 = " protocol_version";
|
||||||
|
break;
|
||||||
|
case 71:
|
||||||
|
str_details2 = " insufficient_security";
|
||||||
|
break;
|
||||||
|
case 80:
|
||||||
|
str_details2 = " internal_error";
|
||||||
|
break;
|
||||||
|
case 90:
|
||||||
|
str_details2 = " user_canceled";
|
||||||
|
break;
|
||||||
|
case 100:
|
||||||
|
str_details2 = " no_renegotiation";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (content_type == 22) /* Handshake */
|
||||||
|
{
|
||||||
|
str_details1 = "???";
|
||||||
|
|
||||||
|
if (len > 0)
|
||||||
|
{
|
||||||
|
switch (((unsigned char*)buf)[0])
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
str_details1 = ", HelloRequest";
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
str_details1 = ", ClientHello";
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
str_details1 = ", ServerHello";
|
||||||
|
break;
|
||||||
|
case 11:
|
||||||
|
str_details1 = ", Certificate";
|
||||||
|
break;
|
||||||
|
case 12:
|
||||||
|
str_details1 = ", ServerKeyExchange";
|
||||||
|
break;
|
||||||
|
case 13:
|
||||||
|
str_details1 = ", CertificateRequest";
|
||||||
|
break;
|
||||||
|
case 14:
|
||||||
|
str_details1 = ", ServerHelloDone";
|
||||||
|
break;
|
||||||
|
case 15:
|
||||||
|
str_details1 = ", CertificateVerify";
|
||||||
|
break;
|
||||||
|
case 16:
|
||||||
|
str_details1 = ", ClientKeyExchange";
|
||||||
|
break;
|
||||||
|
case 20:
|
||||||
|
str_details1 = ", Finished";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BIO_printf(bio, "%s %s%s [length %04lx]%s%s\n", str_write_p, str_version, str_content_type, (unsigned long)len, str_details1, str_details2);
|
||||||
|
|
||||||
|
if (len > 0)
|
||||||
|
{
|
||||||
|
size_t num, i;
|
||||||
|
|
||||||
|
BIO_printf(bio, " ");
|
||||||
|
num = len;
|
||||||
|
#if 0
|
||||||
|
if (num > 16)
|
||||||
|
num = 16;
|
||||||
|
#endif
|
||||||
|
for (i = 0; i < num; i++)
|
||||||
|
{
|
||||||
|
if (i % 16 == 0 && i > 0)
|
||||||
|
BIO_printf(bio, "\n ");
|
||||||
|
BIO_printf(bio, " %02x", ((unsigned char*)buf)[i]);
|
||||||
|
}
|
||||||
|
if (i < len)
|
||||||
|
BIO_printf(bio, " ...");
|
||||||
|
BIO_printf(bio, "\n");
|
||||||
|
}
|
||||||
|
BIO_flush(bio);
|
||||||
|
}
|
||||||
|
|||||||
140
apps/s_client.c
140
apps/s_client.c
@@ -55,6 +55,59 @@
|
|||||||
* copied and put under another distribution licence
|
* copied and put under another distribution licence
|
||||||
* [including the GNU Public Licence.]
|
* [including the GNU Public Licence.]
|
||||||
*/
|
*/
|
||||||
|
/* ====================================================================
|
||||||
|
* Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in
|
||||||
|
* the documentation and/or other materials provided with the
|
||||||
|
* distribution.
|
||||||
|
*
|
||||||
|
* 3. All advertising materials mentioning features or use of this
|
||||||
|
* software must display the following acknowledgment:
|
||||||
|
* "This product includes software developed by the OpenSSL Project
|
||||||
|
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
||||||
|
*
|
||||||
|
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||||
|
* endorse or promote products derived from this software without
|
||||||
|
* prior written permission. For written permission, please contact
|
||||||
|
* openssl-core@openssl.org.
|
||||||
|
*
|
||||||
|
* 5. Products derived from this software may not be called "OpenSSL"
|
||||||
|
* nor may "OpenSSL" appear in their names without prior written
|
||||||
|
* permission of the OpenSSL Project.
|
||||||
|
*
|
||||||
|
* 6. Redistributions of any form whatsoever must retain the following
|
||||||
|
* acknowledgment:
|
||||||
|
* "This product includes software developed by the OpenSSL Project
|
||||||
|
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||||
|
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||||
|
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||||
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||||
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
* ====================================================================
|
||||||
|
*
|
||||||
|
* This product includes cryptographic software written by Eric Young
|
||||||
|
* (eay@cryptsoft.com). This product includes software written by Tim
|
||||||
|
* Hudson (tjh@cryptsoft.com).
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -80,7 +133,7 @@ typedef unsigned int u_int;
|
|||||||
#include <openssl/ssl.h>
|
#include <openssl/ssl.h>
|
||||||
#include <openssl/err.h>
|
#include <openssl/err.h>
|
||||||
#include <openssl/pem.h>
|
#include <openssl/pem.h>
|
||||||
#include <openssl/engine.h>
|
#include <openssl/rand.h>
|
||||||
#include "s_apps.h"
|
#include "s_apps.h"
|
||||||
|
|
||||||
#ifdef OPENSSL_SYS_WINDOWS
|
#ifdef OPENSSL_SYS_WINDOWS
|
||||||
@@ -113,6 +166,7 @@ static int c_nbio=0;
|
|||||||
#endif
|
#endif
|
||||||
static int c_Pause=0;
|
static int c_Pause=0;
|
||||||
static int c_debug=0;
|
static int c_debug=0;
|
||||||
|
static int c_msg=0;
|
||||||
static int c_showcerts=0;
|
static int c_showcerts=0;
|
||||||
|
|
||||||
static void sc_usage(void);
|
static void sc_usage(void);
|
||||||
@@ -139,6 +193,7 @@ static void sc_usage(void)
|
|||||||
BIO_printf(bio_err," -pause - sleep(1) after each read(2) and write(2) system call\n");
|
BIO_printf(bio_err," -pause - sleep(1) after each read(2) and write(2) system call\n");
|
||||||
BIO_printf(bio_err," -showcerts - show all certificates in the chain\n");
|
BIO_printf(bio_err," -showcerts - show all certificates in the chain\n");
|
||||||
BIO_printf(bio_err," -debug - extra output\n");
|
BIO_printf(bio_err," -debug - extra output\n");
|
||||||
|
BIO_printf(bio_err," -msg - Show protocol messages\n");
|
||||||
BIO_printf(bio_err," -nbio_test - more ssl protocol testing\n");
|
BIO_printf(bio_err," -nbio_test - more ssl protocol testing\n");
|
||||||
BIO_printf(bio_err," -state - print the 'ssl' states\n");
|
BIO_printf(bio_err," -state - print the 'ssl' states\n");
|
||||||
#ifdef FIONBIO
|
#ifdef FIONBIO
|
||||||
@@ -155,6 +210,10 @@ static void sc_usage(void)
|
|||||||
BIO_printf(bio_err," -serverpref - Use server's cipher preferences (only SSLv2)\n");
|
BIO_printf(bio_err," -serverpref - Use server's cipher preferences (only SSLv2)\n");
|
||||||
BIO_printf(bio_err," -cipher - preferred cipher to use, use the 'openssl ciphers'\n");
|
BIO_printf(bio_err," -cipher - preferred cipher to use, use the 'openssl ciphers'\n");
|
||||||
BIO_printf(bio_err," command to see what is available\n");
|
BIO_printf(bio_err," command to see what is available\n");
|
||||||
|
BIO_printf(bio_err," -starttls prot - use the STARTTLS command before starting TLS\n");
|
||||||
|
BIO_printf(bio_err," for those protocols that support it, where\n");
|
||||||
|
BIO_printf(bio_err," 'prot' defines which one to assume. Currently,\n");
|
||||||
|
BIO_printf(bio_err," only \"smtp\" is supported.\n");
|
||||||
BIO_printf(bio_err," -engine id - Initialise and use the specified engine\n");
|
BIO_printf(bio_err," -engine id - Initialise and use the specified engine\n");
|
||||||
BIO_printf(bio_err," -rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR);
|
BIO_printf(bio_err," -rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR);
|
||||||
|
|
||||||
@@ -166,8 +225,9 @@ int MAIN(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
int off=0;
|
int off=0;
|
||||||
SSL *con=NULL,*con2=NULL;
|
SSL *con=NULL,*con2=NULL;
|
||||||
|
X509_STORE *store = NULL;
|
||||||
int s,k,width,state=0;
|
int s,k,width,state=0;
|
||||||
char *cbuf=NULL,*sbuf=NULL;
|
char *cbuf=NULL,*sbuf=NULL,*mbuf=NULL;
|
||||||
int cbuf_len,cbuf_off;
|
int cbuf_len,cbuf_off;
|
||||||
int sbuf_len,sbuf_off;
|
int sbuf_len,sbuf_off;
|
||||||
fd_set readfds,writefds;
|
fd_set readfds,writefds;
|
||||||
@@ -181,7 +241,8 @@ int MAIN(int argc, char **argv)
|
|||||||
int write_tty,read_tty,write_ssl,read_ssl,tty_on,ssl_pending;
|
int write_tty,read_tty,write_ssl,read_ssl,tty_on,ssl_pending;
|
||||||
SSL_CTX *ctx=NULL;
|
SSL_CTX *ctx=NULL;
|
||||||
int ret=1,in_init=1,i,nbio_test=0;
|
int ret=1,in_init=1,i,nbio_test=0;
|
||||||
int prexit = 0;
|
int smtp_starttls = 0;
|
||||||
|
int prexit = 0, vflags = 0;
|
||||||
SSL_METHOD *meth=NULL;
|
SSL_METHOD *meth=NULL;
|
||||||
BIO *sbio;
|
BIO *sbio;
|
||||||
char *inrand=NULL;
|
char *inrand=NULL;
|
||||||
@@ -204,13 +265,18 @@ int MAIN(int argc, char **argv)
|
|||||||
c_quiet=0;
|
c_quiet=0;
|
||||||
c_ign_eof=0;
|
c_ign_eof=0;
|
||||||
c_debug=0;
|
c_debug=0;
|
||||||
|
c_msg=0;
|
||||||
c_showcerts=0;
|
c_showcerts=0;
|
||||||
|
|
||||||
if (bio_err == NULL)
|
if (bio_err == NULL)
|
||||||
bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
|
bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
|
||||||
|
|
||||||
|
if (!load_config(bio_err, NULL))
|
||||||
|
goto end;
|
||||||
|
|
||||||
if ( ((cbuf=OPENSSL_malloc(BUFSIZZ)) == NULL) ||
|
if ( ((cbuf=OPENSSL_malloc(BUFSIZZ)) == NULL) ||
|
||||||
((sbuf=OPENSSL_malloc(BUFSIZZ)) == NULL))
|
((sbuf=OPENSSL_malloc(BUFSIZZ)) == NULL) ||
|
||||||
|
((mbuf=OPENSSL_malloc(BUFSIZZ)) == NULL))
|
||||||
{
|
{
|
||||||
BIO_printf(bio_err,"out of memory\n");
|
BIO_printf(bio_err,"out of memory\n");
|
||||||
goto end;
|
goto end;
|
||||||
@@ -255,6 +321,10 @@ int MAIN(int argc, char **argv)
|
|||||||
if (--argc < 1) goto bad;
|
if (--argc < 1) goto bad;
|
||||||
cert_file= *(++argv);
|
cert_file= *(++argv);
|
||||||
}
|
}
|
||||||
|
else if (strcmp(*argv,"-crl_check") == 0)
|
||||||
|
vflags |= X509_V_FLAG_CRL_CHECK;
|
||||||
|
else if (strcmp(*argv,"-crl_check_all") == 0)
|
||||||
|
vflags |= X509_V_FLAG_CRL_CHECK|X509_V_FLAG_CRL_CHECK_ALL;
|
||||||
else if (strcmp(*argv,"-prexit") == 0)
|
else if (strcmp(*argv,"-prexit") == 0)
|
||||||
prexit=1;
|
prexit=1;
|
||||||
else if (strcmp(*argv,"-crlf") == 0)
|
else if (strcmp(*argv,"-crlf") == 0)
|
||||||
@@ -270,6 +340,8 @@ int MAIN(int argc, char **argv)
|
|||||||
c_Pause=1;
|
c_Pause=1;
|
||||||
else if (strcmp(*argv,"-debug") == 0)
|
else if (strcmp(*argv,"-debug") == 0)
|
||||||
c_debug=1;
|
c_debug=1;
|
||||||
|
else if (strcmp(*argv,"-msg") == 0)
|
||||||
|
c_msg=1;
|
||||||
else if (strcmp(*argv,"-showcerts") == 0)
|
else if (strcmp(*argv,"-showcerts") == 0)
|
||||||
c_showcerts=1;
|
c_showcerts=1;
|
||||||
else if (strcmp(*argv,"-nbio_test") == 0)
|
else if (strcmp(*argv,"-nbio_test") == 0)
|
||||||
@@ -326,6 +398,15 @@ int MAIN(int argc, char **argv)
|
|||||||
else if (strcmp(*argv,"-nbio") == 0)
|
else if (strcmp(*argv,"-nbio") == 0)
|
||||||
{ c_nbio=1; }
|
{ c_nbio=1; }
|
||||||
#endif
|
#endif
|
||||||
|
else if (strcmp(*argv,"-starttls") == 0)
|
||||||
|
{
|
||||||
|
if (--argc < 1) goto bad;
|
||||||
|
++argv;
|
||||||
|
if (strcmp(*argv,"smtp") == 0)
|
||||||
|
smtp_starttls = 1;
|
||||||
|
else
|
||||||
|
goto bad;
|
||||||
|
}
|
||||||
else if (strcmp(*argv,"-engine") == 0)
|
else if (strcmp(*argv,"-engine") == 0)
|
||||||
{
|
{
|
||||||
if (--argc < 1) goto bad;
|
if (--argc < 1) goto bad;
|
||||||
@@ -363,7 +444,7 @@ bad:
|
|||||||
|
|
||||||
if (bio_c_out == NULL)
|
if (bio_c_out == NULL)
|
||||||
{
|
{
|
||||||
if (c_quiet)
|
if (c_quiet && !c_debug && !c_msg)
|
||||||
{
|
{
|
||||||
bio_c_out=BIO_new(BIO_s_null());
|
bio_c_out=BIO_new(BIO_s_null());
|
||||||
}
|
}
|
||||||
@@ -377,28 +458,7 @@ bad:
|
|||||||
OpenSSL_add_ssl_algorithms();
|
OpenSSL_add_ssl_algorithms();
|
||||||
SSL_load_error_strings();
|
SSL_load_error_strings();
|
||||||
|
|
||||||
if (engine_id != NULL)
|
e = setup_engine(bio_err, engine_id, 1);
|
||||||
{
|
|
||||||
if((e = ENGINE_by_id(engine_id)) == NULL)
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"invalid engine\n");
|
|
||||||
ERR_print_errors(bio_err);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
if (c_debug)
|
|
||||||
{
|
|
||||||
ENGINE_ctrl(e, ENGINE_CTRL_SET_LOGSTREAM,
|
|
||||||
0, bio_err, 0);
|
|
||||||
}
|
|
||||||
if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"can't use that engine\n");
|
|
||||||
ERR_print_errors(bio_err);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
BIO_printf(bio_err,"engine \"%s\" set.\n", engine_id);
|
|
||||||
ENGINE_free(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx=SSL_CTX_new(meth);
|
ctx=SSL_CTX_new(meth);
|
||||||
if (ctx == NULL)
|
if (ctx == NULL)
|
||||||
@@ -436,6 +496,8 @@ bad:
|
|||||||
/* goto end; */
|
/* goto end; */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
store = SSL_CTX_get_cert_store(ctx);
|
||||||
|
X509_STORE_set_flags(store, vflags);
|
||||||
|
|
||||||
con=SSL_new(ctx);
|
con=SSL_new(ctx);
|
||||||
#ifndef OPENSSL_NO_KRB5
|
#ifndef OPENSSL_NO_KRB5
|
||||||
@@ -485,6 +547,11 @@ re_start:
|
|||||||
BIO_set_callback(sbio,bio_dump_cb);
|
BIO_set_callback(sbio,bio_dump_cb);
|
||||||
BIO_set_callback_arg(sbio,bio_c_out);
|
BIO_set_callback_arg(sbio,bio_c_out);
|
||||||
}
|
}
|
||||||
|
if (c_msg)
|
||||||
|
{
|
||||||
|
SSL_set_msg_callback(con, msg_cb);
|
||||||
|
SSL_set_msg_callback_arg(con, bio_c_out);
|
||||||
|
}
|
||||||
|
|
||||||
SSL_set_bio(con,sbio,sbio);
|
SSL_set_bio(con,sbio,sbio);
|
||||||
SSL_set_connect_state(con);
|
SSL_set_connect_state(con);
|
||||||
@@ -503,6 +570,14 @@ re_start:
|
|||||||
sbuf_len=0;
|
sbuf_len=0;
|
||||||
sbuf_off=0;
|
sbuf_off=0;
|
||||||
|
|
||||||
|
/* This is an ugly hack that does a lot of assumptions */
|
||||||
|
if (smtp_starttls)
|
||||||
|
{
|
||||||
|
BIO_read(sbio,mbuf,BUFSIZZ);
|
||||||
|
BIO_printf(sbio,"STARTTLS\r\n");
|
||||||
|
BIO_read(sbio,sbuf,BUFSIZZ);
|
||||||
|
}
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
FD_ZERO(&readfds);
|
FD_ZERO(&readfds);
|
||||||
@@ -522,6 +597,13 @@ re_start:
|
|||||||
print_stuff(bio_c_out,con,full_log);
|
print_stuff(bio_c_out,con,full_log);
|
||||||
if (full_log > 0) full_log--;
|
if (full_log > 0) full_log--;
|
||||||
|
|
||||||
|
if (smtp_starttls)
|
||||||
|
{
|
||||||
|
BIO_printf(bio_err,"%s",mbuf);
|
||||||
|
/* We don't need to know any more */
|
||||||
|
smtp_starttls = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (reconnect)
|
if (reconnect)
|
||||||
{
|
{
|
||||||
reconnect--;
|
reconnect--;
|
||||||
@@ -812,11 +894,13 @@ end:
|
|||||||
if (ctx != NULL) SSL_CTX_free(ctx);
|
if (ctx != NULL) SSL_CTX_free(ctx);
|
||||||
if (cbuf != NULL) { memset(cbuf,0,BUFSIZZ); OPENSSL_free(cbuf); }
|
if (cbuf != NULL) { memset(cbuf,0,BUFSIZZ); OPENSSL_free(cbuf); }
|
||||||
if (sbuf != NULL) { memset(sbuf,0,BUFSIZZ); OPENSSL_free(sbuf); }
|
if (sbuf != NULL) { memset(sbuf,0,BUFSIZZ); OPENSSL_free(sbuf); }
|
||||||
|
if (mbuf != NULL) { memset(mbuf,0,BUFSIZZ); OPENSSL_free(mbuf); }
|
||||||
if (bio_c_out != NULL)
|
if (bio_c_out != NULL)
|
||||||
{
|
{
|
||||||
BIO_free(bio_c_out);
|
BIO_free(bio_c_out);
|
||||||
bio_c_out=NULL;
|
bio_c_out=NULL;
|
||||||
}
|
}
|
||||||
|
apps_shutdown();
|
||||||
EXIT(ret);
|
EXIT(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -938,5 +1022,7 @@ static void print_stuff(BIO *bio, SSL *s, int full)
|
|||||||
BIO_printf(bio,"---\n");
|
BIO_printf(bio,"---\n");
|
||||||
if (peer != NULL)
|
if (peer != NULL)
|
||||||
X509_free(peer);
|
X509_free(peer);
|
||||||
|
/* flush, or debugging output gets mixed with http response */
|
||||||
|
BIO_flush(bio);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
164
apps/s_server.c
164
apps/s_server.c
@@ -55,6 +55,59 @@
|
|||||||
* copied and put under another distribution licence
|
* copied and put under another distribution licence
|
||||||
* [including the GNU Public Licence.]
|
* [including the GNU Public Licence.]
|
||||||
*/
|
*/
|
||||||
|
/* ====================================================================
|
||||||
|
* Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in
|
||||||
|
* the documentation and/or other materials provided with the
|
||||||
|
* distribution.
|
||||||
|
*
|
||||||
|
* 3. All advertising materials mentioning features or use of this
|
||||||
|
* software must display the following acknowledgment:
|
||||||
|
* "This product includes software developed by the OpenSSL Project
|
||||||
|
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
||||||
|
*
|
||||||
|
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||||
|
* endorse or promote products derived from this software without
|
||||||
|
* prior written permission. For written permission, please contact
|
||||||
|
* openssl-core@openssl.org.
|
||||||
|
*
|
||||||
|
* 5. Products derived from this software may not be called "OpenSSL"
|
||||||
|
* nor may "OpenSSL" appear in their names without prior written
|
||||||
|
* permission of the OpenSSL Project.
|
||||||
|
*
|
||||||
|
* 6. Redistributions of any form whatsoever must retain the following
|
||||||
|
* acknowledgment:
|
||||||
|
* "This product includes software developed by the OpenSSL Project
|
||||||
|
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||||
|
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||||
|
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||||
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||||
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
* ====================================================================
|
||||||
|
*
|
||||||
|
* This product includes cryptographic software written by Eric Young
|
||||||
|
* (eay@cryptsoft.com). This product includes software written by Tim
|
||||||
|
* Hudson (tjh@cryptsoft.com).
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -84,7 +137,7 @@ typedef unsigned int u_int;
|
|||||||
#include <openssl/pem.h>
|
#include <openssl/pem.h>
|
||||||
#include <openssl/x509.h>
|
#include <openssl/x509.h>
|
||||||
#include <openssl/ssl.h>
|
#include <openssl/ssl.h>
|
||||||
#include <openssl/engine.h>
|
#include <openssl/rand.h>
|
||||||
#include "s_apps.h"
|
#include "s_apps.h"
|
||||||
|
|
||||||
#ifdef OPENSSL_SYS_WINDOWS
|
#ifdef OPENSSL_SYS_WINDOWS
|
||||||
@@ -177,6 +230,7 @@ static int www=0;
|
|||||||
|
|
||||||
static BIO *bio_s_out=NULL;
|
static BIO *bio_s_out=NULL;
|
||||||
static int s_debug=0;
|
static int s_debug=0;
|
||||||
|
static int s_msg=0;
|
||||||
static int s_quiet=0;
|
static int s_quiet=0;
|
||||||
|
|
||||||
static int hack=0;
|
static int hack=0;
|
||||||
@@ -202,6 +256,7 @@ static void s_server_init(void)
|
|||||||
|
|
||||||
bio_s_out=NULL;
|
bio_s_out=NULL;
|
||||||
s_debug=0;
|
s_debug=0;
|
||||||
|
s_msg=0;
|
||||||
s_quiet=0;
|
s_quiet=0;
|
||||||
hack=0;
|
hack=0;
|
||||||
engine_id=NULL;
|
engine_id=NULL;
|
||||||
@@ -230,6 +285,7 @@ static void sv_usage(void)
|
|||||||
BIO_printf(bio_err," -nbio_test - test with the non-blocking test bio\n");
|
BIO_printf(bio_err," -nbio_test - test with the non-blocking test bio\n");
|
||||||
BIO_printf(bio_err," -crlf - convert LF from terminal into CRLF\n");
|
BIO_printf(bio_err," -crlf - convert LF from terminal into CRLF\n");
|
||||||
BIO_printf(bio_err," -debug - Print more output\n");
|
BIO_printf(bio_err," -debug - Print more output\n");
|
||||||
|
BIO_printf(bio_err," -msg - Show protocol messages\n");
|
||||||
BIO_printf(bio_err," -state - Print the SSL states\n");
|
BIO_printf(bio_err," -state - Print the SSL states\n");
|
||||||
BIO_printf(bio_err," -CApath arg - PEM format directory of CA's\n");
|
BIO_printf(bio_err," -CApath arg - PEM format directory of CA's\n");
|
||||||
BIO_printf(bio_err," -CAfile arg - PEM format file of CA's\n");
|
BIO_printf(bio_err," -CAfile arg - PEM format file of CA's\n");
|
||||||
@@ -414,6 +470,8 @@ int MAIN(int, char **);
|
|||||||
|
|
||||||
int MAIN(int argc, char *argv[])
|
int MAIN(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
X509_STORE *store = NULL;
|
||||||
|
int vflags = 0;
|
||||||
short port=PORT;
|
short port=PORT;
|
||||||
char *CApath=NULL,*CAfile=NULL;
|
char *CApath=NULL,*CAfile=NULL;
|
||||||
char *context = NULL;
|
char *context = NULL;
|
||||||
@@ -446,6 +504,9 @@ int MAIN(int argc, char *argv[])
|
|||||||
if (bio_err == NULL)
|
if (bio_err == NULL)
|
||||||
bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
|
bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
|
||||||
|
|
||||||
|
if (!load_config(bio_err, NULL))
|
||||||
|
goto end;
|
||||||
|
|
||||||
verify_depth=0;
|
verify_depth=0;
|
||||||
#ifdef FIONBIO
|
#ifdef FIONBIO
|
||||||
s_nbio=0;
|
s_nbio=0;
|
||||||
@@ -518,6 +579,14 @@ int MAIN(int argc, char *argv[])
|
|||||||
if (--argc < 1) goto bad;
|
if (--argc < 1) goto bad;
|
||||||
CApath= *(++argv);
|
CApath= *(++argv);
|
||||||
}
|
}
|
||||||
|
else if (strcmp(*argv,"-crl_check") == 0)
|
||||||
|
{
|
||||||
|
vflags |= X509_V_FLAG_CRL_CHECK;
|
||||||
|
}
|
||||||
|
else if (strcmp(*argv,"-crl_check") == 0)
|
||||||
|
{
|
||||||
|
vflags |= X509_V_FLAG_CRL_CHECK|X509_V_FLAG_CRL_CHECK_ALL;
|
||||||
|
}
|
||||||
else if (strcmp(*argv,"-serverpref") == 0)
|
else if (strcmp(*argv,"-serverpref") == 0)
|
||||||
{ off|=SSL_OP_CIPHER_SERVER_PREFERENCE; }
|
{ off|=SSL_OP_CIPHER_SERVER_PREFERENCE; }
|
||||||
else if (strcmp(*argv,"-cipher") == 0)
|
else if (strcmp(*argv,"-cipher") == 0)
|
||||||
@@ -543,6 +612,8 @@ int MAIN(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
else if (strcmp(*argv,"-debug") == 0)
|
else if (strcmp(*argv,"-debug") == 0)
|
||||||
{ s_debug=1; }
|
{ s_debug=1; }
|
||||||
|
else if (strcmp(*argv,"-msg") == 0)
|
||||||
|
{ s_msg=1; }
|
||||||
else if (strcmp(*argv,"-hack") == 0)
|
else if (strcmp(*argv,"-hack") == 0)
|
||||||
{ hack=1; }
|
{ hack=1; }
|
||||||
else if (strcmp(*argv,"-state") == 0)
|
else if (strcmp(*argv,"-state") == 0)
|
||||||
@@ -623,7 +694,7 @@ bad:
|
|||||||
|
|
||||||
if (bio_s_out == NULL)
|
if (bio_s_out == NULL)
|
||||||
{
|
{
|
||||||
if (s_quiet && !s_debug)
|
if (s_quiet && !s_debug && !s_msg)
|
||||||
{
|
{
|
||||||
bio_s_out=BIO_new(BIO_s_null());
|
bio_s_out=BIO_new(BIO_s_null());
|
||||||
}
|
}
|
||||||
@@ -634,7 +705,7 @@ bad:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(OPENSSL_NO_RSA) || !defined(OPENSSL_NO_DSA)
|
#if !defined(OPENSSL_NO_RSA) || !defined(OPENSSL_NO_DSA) || !defined(OPENSSL_NO_ECDSA)
|
||||||
if (nocert)
|
if (nocert)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
@@ -647,28 +718,7 @@ bad:
|
|||||||
SSL_load_error_strings();
|
SSL_load_error_strings();
|
||||||
OpenSSL_add_ssl_algorithms();
|
OpenSSL_add_ssl_algorithms();
|
||||||
|
|
||||||
if (engine_id != NULL)
|
e = setup_engine(bio_err, engine_id, 1);
|
||||||
{
|
|
||||||
if((e = ENGINE_by_id(engine_id)) == NULL)
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"invalid engine\n");
|
|
||||||
ERR_print_errors(bio_err);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
if (s_debug)
|
|
||||||
{
|
|
||||||
ENGINE_ctrl(e, ENGINE_CTRL_SET_LOGSTREAM,
|
|
||||||
0, bio_err, 0);
|
|
||||||
}
|
|
||||||
if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"can't use that engine\n");
|
|
||||||
ERR_print_errors(bio_err);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
BIO_printf(bio_err,"engine \"%s\" set.\n", engine_id);
|
|
||||||
ENGINE_free(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx=SSL_CTX_new(meth);
|
ctx=SSL_CTX_new(meth);
|
||||||
if (ctx == NULL)
|
if (ctx == NULL)
|
||||||
@@ -696,7 +746,6 @@ bad:
|
|||||||
if (bugs) SSL_CTX_set_options(ctx,SSL_OP_ALL);
|
if (bugs) SSL_CTX_set_options(ctx,SSL_OP_ALL);
|
||||||
if (hack) SSL_CTX_set_options(ctx,SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG);
|
if (hack) SSL_CTX_set_options(ctx,SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG);
|
||||||
SSL_CTX_set_options(ctx,off);
|
SSL_CTX_set_options(ctx,off);
|
||||||
if (hack) SSL_CTX_set_options(ctx,SSL_OP_NON_EXPORT_FIRST);
|
|
||||||
|
|
||||||
if (state) SSL_CTX_set_info_callback(ctx,apps_ssl_info_callback);
|
if (state) SSL_CTX_set_info_callback(ctx,apps_ssl_info_callback);
|
||||||
|
|
||||||
@@ -721,6 +770,8 @@ bad:
|
|||||||
ERR_print_errors(bio_err);
|
ERR_print_errors(bio_err);
|
||||||
/* goto end; */
|
/* goto end; */
|
||||||
}
|
}
|
||||||
|
store = SSL_CTX_get_cert_store(ctx);
|
||||||
|
X509_STORE_set_flags(store, vflags);
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_DH
|
#ifndef OPENSSL_NO_DH
|
||||||
if (!no_dhe)
|
if (!no_dhe)
|
||||||
@@ -808,6 +859,7 @@ end:
|
|||||||
BIO_free(bio_s_out);
|
BIO_free(bio_s_out);
|
||||||
bio_s_out=NULL;
|
bio_s_out=NULL;
|
||||||
}
|
}
|
||||||
|
apps_shutdown();
|
||||||
EXIT(ret);
|
EXIT(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -871,8 +923,10 @@ static int sv_body(char *hostname, int s, unsigned char *context)
|
|||||||
#ifndef OPENSSL_NO_KRB5
|
#ifndef OPENSSL_NO_KRB5
|
||||||
if ((con->kssl_ctx = kssl_ctx_new()) != NULL)
|
if ((con->kssl_ctx = kssl_ctx_new()) != NULL)
|
||||||
{
|
{
|
||||||
kssl_ctx_setstring(con->kssl_ctx, KSSL_SERVICE, KRB5SVC);
|
kssl_ctx_setstring(con->kssl_ctx, KSSL_SERVICE,
|
||||||
kssl_ctx_setstring(con->kssl_ctx, KSSL_KEYTAB, KRB5KEYTAB);
|
KRB5SVC);
|
||||||
|
kssl_ctx_setstring(con->kssl_ctx, KSSL_KEYTAB,
|
||||||
|
KRB5KEYTAB);
|
||||||
}
|
}
|
||||||
#endif /* OPENSSL_NO_KRB5 */
|
#endif /* OPENSSL_NO_KRB5 */
|
||||||
if(context)
|
if(context)
|
||||||
@@ -899,6 +953,11 @@ static int sv_body(char *hostname, int s, unsigned char *context)
|
|||||||
BIO_set_callback(SSL_get_rbio(con),bio_dump_cb);
|
BIO_set_callback(SSL_get_rbio(con),bio_dump_cb);
|
||||||
BIO_set_callback_arg(SSL_get_rbio(con),bio_s_out);
|
BIO_set_callback_arg(SSL_get_rbio(con),bio_s_out);
|
||||||
}
|
}
|
||||||
|
if (s_msg)
|
||||||
|
{
|
||||||
|
SSL_set_msg_callback(con, msg_cb);
|
||||||
|
SSL_set_msg_callback_arg(con, bio_s_out);
|
||||||
|
}
|
||||||
|
|
||||||
width=s+1;
|
width=s+1;
|
||||||
for (;;)
|
for (;;)
|
||||||
@@ -1257,6 +1316,13 @@ static int www_body(char *hostname, int s, unsigned char *context)
|
|||||||
if (!BIO_set_write_buffer_size(io,bufsize)) goto err;
|
if (!BIO_set_write_buffer_size(io,bufsize)) goto err;
|
||||||
|
|
||||||
if ((con=SSL_new(ctx)) == NULL) goto err;
|
if ((con=SSL_new(ctx)) == NULL) goto err;
|
||||||
|
#ifndef OPENSSL_NO_KRB5
|
||||||
|
if ((con->kssl_ctx = kssl_ctx_new()) != NULL)
|
||||||
|
{
|
||||||
|
kssl_ctx_setstring(con->kssl_ctx, KSSL_SERVICE, KRB5SVC);
|
||||||
|
kssl_ctx_setstring(con->kssl_ctx, KSSL_KEYTAB, KRB5KEYTAB);
|
||||||
|
}
|
||||||
|
#endif /* OPENSSL_NO_KRB5 */
|
||||||
if(context) SSL_set_session_id_context(con, context,
|
if(context) SSL_set_session_id_context(con, context,
|
||||||
strlen((char *)context));
|
strlen((char *)context));
|
||||||
|
|
||||||
@@ -1284,6 +1350,11 @@ static int www_body(char *hostname, int s, unsigned char *context)
|
|||||||
BIO_set_callback(SSL_get_rbio(con),bio_dump_cb);
|
BIO_set_callback(SSL_get_rbio(con),bio_dump_cb);
|
||||||
BIO_set_callback_arg(SSL_get_rbio(con),bio_s_out);
|
BIO_set_callback_arg(SSL_get_rbio(con),bio_s_out);
|
||||||
}
|
}
|
||||||
|
if (s_msg)
|
||||||
|
{
|
||||||
|
SSL_set_msg_callback(con, msg_cb);
|
||||||
|
SSL_set_msg_callback_arg(con, bio_s_out);
|
||||||
|
}
|
||||||
|
|
||||||
blank=0;
|
blank=0;
|
||||||
for (;;)
|
for (;;)
|
||||||
@@ -1423,20 +1494,33 @@ static int www_body(char *hostname, int s, unsigned char *context)
|
|||||||
{
|
{
|
||||||
BIO *file;
|
BIO *file;
|
||||||
char *p,*e;
|
char *p,*e;
|
||||||
static char *text="HTTP/1.0 200 ok\r\n"
|
static char *text="HTTP/1.0 200 ok\r\nContent-type: text/plain\r\n\r\n";
|
||||||
"Content-type: text/plain\r\n\r\n";
|
|
||||||
|
|
||||||
/* skip the '/' */
|
/* skip the '/' */
|
||||||
p= &(buf[5]);
|
p= &(buf[5]);
|
||||||
dot=0;
|
|
||||||
|
dot = 1;
|
||||||
for (e=p; *e != '\0'; e++)
|
for (e=p; *e != '\0'; e++)
|
||||||
{
|
{
|
||||||
if (e[0] == ' ') break;
|
if (e[0] == ' ')
|
||||||
if ( (e[0] == '.') &&
|
break;
|
||||||
(strncmp(&(e[-1]),"/../",4) == 0))
|
|
||||||
dot=1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
switch (dot)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
dot = (e[0] == '.') ? 2 : 0;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
dot = (e[0] == '.') ? 3 : 0;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
dot = (e[0] == '/') ? -1 : 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (dot == 0)
|
||||||
|
dot = (e[0] == '/') ? 1 : 0;
|
||||||
|
}
|
||||||
|
dot = (dot == 3) || (dot == -1); /* filename contains ".." component */
|
||||||
|
|
||||||
if (*e == '\0')
|
if (*e == '\0')
|
||||||
{
|
{
|
||||||
@@ -1460,9 +1544,11 @@ static int www_body(char *hostname, int s, unsigned char *context)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
/* append if a directory lookup */
|
/* append if a directory lookup */
|
||||||
if (e[-1] == '/')
|
if (e[-1] == '/')
|
||||||
strcat(p,"index.html");
|
strcat(p,"index.html");
|
||||||
|
#endif
|
||||||
|
|
||||||
/* if a directory, do the index thang */
|
/* if a directory, do the index thang */
|
||||||
if (stat(p,&st_buf) < 0)
|
if (stat(p,&st_buf) < 0)
|
||||||
@@ -1474,7 +1560,13 @@ static int www_body(char *hostname, int s, unsigned char *context)
|
|||||||
}
|
}
|
||||||
if (S_ISDIR(st_buf.st_mode))
|
if (S_ISDIR(st_buf.st_mode))
|
||||||
{
|
{
|
||||||
|
#if 0 /* must check buffer size */
|
||||||
strcat(p,"/index.html");
|
strcat(p,"/index.html");
|
||||||
|
#else
|
||||||
|
BIO_puts(io,text);
|
||||||
|
BIO_printf(io,"'%s' is a directory\r\n",p);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((file=BIO_new_file(p,"r")) == NULL)
|
if ((file=BIO_new_file(p,"r")) == NULL)
|
||||||
|
|||||||
@@ -67,22 +67,25 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#define USE_SOCKETS
|
||||||
|
#include "apps.h"
|
||||||
#ifdef OPENSSL_NO_STDIO
|
#ifdef OPENSSL_NO_STDIO
|
||||||
#define APPS_WIN16
|
#define APPS_WIN16
|
||||||
#endif
|
#endif
|
||||||
#define USE_SOCKETS
|
|
||||||
#include <openssl/x509.h>
|
#include <openssl/x509.h>
|
||||||
#include <openssl/ssl.h>
|
#include <openssl/ssl.h>
|
||||||
#include <openssl/pem.h>
|
#include <openssl/pem.h>
|
||||||
#include "apps.h"
|
|
||||||
#include "s_apps.h"
|
#include "s_apps.h"
|
||||||
#include <openssl/err.h>
|
#include <openssl/err.h>
|
||||||
#ifdef WIN32_STUFF
|
#ifdef WIN32_STUFF
|
||||||
#include "winmain.h"
|
#include "winmain.h"
|
||||||
#include "wintext.h"
|
#include "wintext.h"
|
||||||
#endif
|
#endif
|
||||||
|
#if !defined(OPENSSL_SYS_MSDOS)
|
||||||
|
#include OPENSSL_UNISTD
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !defined(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX)
|
#if !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_VXWORKS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX)
|
||||||
#define TIMES
|
#define TIMES
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -102,7 +105,7 @@
|
|||||||
#undef TIMES
|
#undef TIMES
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef TIMES
|
#if !defined(TIMES) && !defined(OPENSSL_SYS_VXWORKS)
|
||||||
#include <sys/timeb.h>
|
#include <sys/timeb.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -119,11 +122,19 @@
|
|||||||
/* The following if from times(3) man page. It may need to be changed
|
/* The following if from times(3) man page. It may need to be changed
|
||||||
*/
|
*/
|
||||||
#ifndef HZ
|
#ifndef HZ
|
||||||
#ifndef CLK_TCK
|
# ifdef _SC_CLK_TCK
|
||||||
#define HZ 100.0
|
# define HZ ((double)sysconf(_SC_CLK_TCK))
|
||||||
#else /* CLK_TCK */
|
# else
|
||||||
#define HZ ((double)CLK_TCK)
|
# ifndef CLK_TCK
|
||||||
#endif
|
# ifndef _BSD_CLK_TCK_ /* FreeBSD hack */
|
||||||
|
# define HZ 100.0
|
||||||
|
# else /* _BSD_CLK_TCK_ */
|
||||||
|
# define HZ ((double)_BSD_CLK_TCK_)
|
||||||
|
# endif
|
||||||
|
# else /* CLK_TCK */
|
||||||
|
# define HZ ((double)CLK_TCK)
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#undef PROG
|
#undef PROG
|
||||||
@@ -139,6 +150,8 @@
|
|||||||
#undef BUFSIZZ
|
#undef BUFSIZZ
|
||||||
#define BUFSIZZ 1024*10
|
#define BUFSIZZ 1024*10
|
||||||
|
|
||||||
|
#undef min
|
||||||
|
#undef max
|
||||||
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
||||||
#define max(a,b) (((a) > (b)) ? (a) : (b))
|
#define max(a,b) (((a) > (b)) ? (a) : (b))
|
||||||
|
|
||||||
@@ -368,6 +381,22 @@ static double tm_Time_F(int s)
|
|||||||
ret=((double)(tend.tms_utime-tstart.tms_utime))/HZ;
|
ret=((double)(tend.tms_utime-tstart.tms_utime))/HZ;
|
||||||
return((ret == 0.0)?1e-6:ret);
|
return((ret == 0.0)?1e-6:ret);
|
||||||
}
|
}
|
||||||
|
#elif defined(OPENSSL_SYS_VXWORKS)
|
||||||
|
{
|
||||||
|
static unsigned long tick_start, tick_end;
|
||||||
|
|
||||||
|
if( s == START )
|
||||||
|
{
|
||||||
|
tick_start = tickGet();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tick_end = tickGet();
|
||||||
|
ret = (double)(tick_end - tick_start) / (double)sysClkRateGet();
|
||||||
|
return((ret == 0.0)?1e-6:ret);
|
||||||
|
}
|
||||||
|
}
|
||||||
#else /* !times() */
|
#else /* !times() */
|
||||||
static struct timeb tstart,tend;
|
static struct timeb tstart,tend;
|
||||||
long i;
|
long i;
|
||||||
@@ -443,7 +472,6 @@ int MAIN(int argc, char **argv)
|
|||||||
|
|
||||||
if (tm_cipher == NULL ) {
|
if (tm_cipher == NULL ) {
|
||||||
fprintf( stderr, "No CIPHER specified\n" );
|
fprintf( stderr, "No CIPHER specified\n" );
|
||||||
/* EXIT(1); */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(perform & 1)) goto next;
|
if (!(perform & 1)) goto next;
|
||||||
@@ -610,6 +638,7 @@ end:
|
|||||||
SSL_CTX_free(tm_ctx);
|
SSL_CTX_free(tm_ctx);
|
||||||
tm_ctx=NULL;
|
tm_ctx=NULL;
|
||||||
}
|
}
|
||||||
|
apps_shutdown();
|
||||||
EXIT(ret);
|
EXIT(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -272,6 +272,7 @@ bad:
|
|||||||
end:
|
end:
|
||||||
if (out != NULL) BIO_free_all(out);
|
if (out != NULL) BIO_free_all(out);
|
||||||
if (x != NULL) SSL_SESSION_free(x);
|
if (x != NULL) SSL_SESSION_free(x);
|
||||||
|
apps_shutdown();
|
||||||
EXIT(ret);
|
EXIT(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
95
apps/smime.c
95
apps/smime.c
@@ -64,7 +64,6 @@
|
|||||||
#include <openssl/crypto.h>
|
#include <openssl/crypto.h>
|
||||||
#include <openssl/pem.h>
|
#include <openssl/pem.h>
|
||||||
#include <openssl/err.h>
|
#include <openssl/err.h>
|
||||||
#include <openssl/engine.h>
|
|
||||||
|
|
||||||
#undef PROG
|
#undef PROG
|
||||||
#define PROG smime_main
|
#define PROG smime_main
|
||||||
@@ -97,18 +96,28 @@ int MAIN(int argc, char **argv)
|
|||||||
STACK_OF(X509) *encerts = NULL, *other = NULL;
|
STACK_OF(X509) *encerts = NULL, *other = NULL;
|
||||||
BIO *in = NULL, *out = NULL, *indata = NULL;
|
BIO *in = NULL, *out = NULL, *indata = NULL;
|
||||||
int badarg = 0;
|
int badarg = 0;
|
||||||
int flags = PKCS7_DETACHED;
|
int flags = PKCS7_DETACHED, store_flags = 0;
|
||||||
char *to = NULL, *from = NULL, *subject = NULL;
|
char *to = NULL, *from = NULL, *subject = NULL;
|
||||||
char *CAfile = NULL, *CApath = NULL;
|
char *CAfile = NULL, *CApath = NULL;
|
||||||
char *passargin = NULL, *passin = NULL;
|
char *passargin = NULL, *passin = NULL;
|
||||||
char *inrand = NULL;
|
char *inrand = NULL;
|
||||||
int need_rand = 0;
|
int need_rand = 0;
|
||||||
int informat = FORMAT_SMIME, outformat = FORMAT_SMIME;
|
int informat = FORMAT_SMIME, outformat = FORMAT_SMIME;
|
||||||
|
int keyform = FORMAT_PEM;
|
||||||
char *engine=NULL;
|
char *engine=NULL;
|
||||||
|
|
||||||
args = argv + 1;
|
args = argv + 1;
|
||||||
ret = 1;
|
ret = 1;
|
||||||
|
|
||||||
|
apps_startup();
|
||||||
|
|
||||||
|
if (bio_err == NULL)
|
||||||
|
if ((bio_err = BIO_new(BIO_s_file())) != NULL)
|
||||||
|
BIO_set_fp(bio_err, stderr, BIO_NOCLOSE|BIO_FP_TEXT);
|
||||||
|
|
||||||
|
if (!load_config(bio_err, NULL))
|
||||||
|
goto end;
|
||||||
|
|
||||||
while (!badarg && *args && *args[0] == '-') {
|
while (!badarg && *args && *args[0] == '-') {
|
||||||
if (!strcmp (*args, "-encrypt")) operation = SMIME_ENCRYPT;
|
if (!strcmp (*args, "-encrypt")) operation = SMIME_ENCRYPT;
|
||||||
else if (!strcmp (*args, "-decrypt")) operation = SMIME_DECRYPT;
|
else if (!strcmp (*args, "-decrypt")) operation = SMIME_DECRYPT;
|
||||||
@@ -128,6 +137,14 @@ int MAIN(int argc, char **argv)
|
|||||||
cipher = EVP_rc2_cbc();
|
cipher = EVP_rc2_cbc();
|
||||||
else if (!strcmp (*args, "-rc2-64"))
|
else if (!strcmp (*args, "-rc2-64"))
|
||||||
cipher = EVP_rc2_64_cbc();
|
cipher = EVP_rc2_64_cbc();
|
||||||
|
#endif
|
||||||
|
#ifndef OPENSSL_NO_AES
|
||||||
|
else if (!strcmp(*args,"-aes128"))
|
||||||
|
cipher = EVP_aes_128_cbc();
|
||||||
|
else if (!strcmp(*args,"-aes192"))
|
||||||
|
cipher = EVP_aes_192_cbc();
|
||||||
|
else if (!strcmp(*args,"-aes256"))
|
||||||
|
cipher = EVP_aes_256_cbc();
|
||||||
#endif
|
#endif
|
||||||
else if (!strcmp (*args, "-text"))
|
else if (!strcmp (*args, "-text"))
|
||||||
flags |= PKCS7_TEXT;
|
flags |= PKCS7_TEXT;
|
||||||
@@ -149,6 +166,10 @@ int MAIN(int argc, char **argv)
|
|||||||
flags |= PKCS7_BINARY;
|
flags |= PKCS7_BINARY;
|
||||||
else if (!strcmp (*args, "-nosigs"))
|
else if (!strcmp (*args, "-nosigs"))
|
||||||
flags |= PKCS7_NOSIGS;
|
flags |= PKCS7_NOSIGS;
|
||||||
|
else if (!strcmp (*args, "-crl_check"))
|
||||||
|
store_flags |= X509_V_FLAG_CRL_CHECK;
|
||||||
|
else if (!strcmp (*args, "-crl_check_all"))
|
||||||
|
store_flags |= X509_V_FLAG_CRL_CHECK|X509_V_FLAG_CRL_CHECK_ALL;
|
||||||
else if (!strcmp(*args,"-rand")) {
|
else if (!strcmp(*args,"-rand")) {
|
||||||
if (args[1]) {
|
if (args[1]) {
|
||||||
args++;
|
args++;
|
||||||
@@ -195,6 +216,11 @@ int MAIN(int argc, char **argv)
|
|||||||
args++;
|
args++;
|
||||||
keyfile = *args;
|
keyfile = *args;
|
||||||
} else badarg = 1;
|
} else badarg = 1;
|
||||||
|
} else if (!strcmp (*args, "-keyform")) {
|
||||||
|
if (args[1]) {
|
||||||
|
args++;
|
||||||
|
keyform = str2fmt(*args);
|
||||||
|
} else badarg = 1;
|
||||||
} else if (!strcmp (*args, "-certfile")) {
|
} else if (!strcmp (*args, "-certfile")) {
|
||||||
if (args[1]) {
|
if (args[1]) {
|
||||||
args++;
|
args++;
|
||||||
@@ -274,6 +300,10 @@ int MAIN(int argc, char **argv)
|
|||||||
BIO_printf (bio_err, "-rc2-40 encrypt with RC2-40 (default)\n");
|
BIO_printf (bio_err, "-rc2-40 encrypt with RC2-40 (default)\n");
|
||||||
BIO_printf (bio_err, "-rc2-64 encrypt with RC2-64\n");
|
BIO_printf (bio_err, "-rc2-64 encrypt with RC2-64\n");
|
||||||
BIO_printf (bio_err, "-rc2-128 encrypt with RC2-128\n");
|
BIO_printf (bio_err, "-rc2-128 encrypt with RC2-128\n");
|
||||||
|
#endif
|
||||||
|
#ifndef OPENSSL_NO_AES
|
||||||
|
BIO_printf (bio_err, "-aes128, -aes192, -aes256\n");
|
||||||
|
BIO_printf (bio_err, " encrypt PEM output with cbc aes\n");
|
||||||
#endif
|
#endif
|
||||||
BIO_printf (bio_err, "-nointern don't search certificates in message for signer\n");
|
BIO_printf (bio_err, "-nointern don't search certificates in message for signer\n");
|
||||||
BIO_printf (bio_err, "-nosigs don't verify message signature\n");
|
BIO_printf (bio_err, "-nosigs don't verify message signature\n");
|
||||||
@@ -288,6 +318,7 @@ int MAIN(int argc, char **argv)
|
|||||||
BIO_printf (bio_err, "-in file input file\n");
|
BIO_printf (bio_err, "-in file input file\n");
|
||||||
BIO_printf (bio_err, "-inform arg input format SMIME (default), PEM or DER\n");
|
BIO_printf (bio_err, "-inform arg input format SMIME (default), PEM or DER\n");
|
||||||
BIO_printf (bio_err, "-inkey file input private key (if not signer or recipient)\n");
|
BIO_printf (bio_err, "-inkey file input private key (if not signer or recipient)\n");
|
||||||
|
BIO_printf (bio_err, "-keyform arg input private key format (PEM or ENGINE)\n");
|
||||||
BIO_printf (bio_err, "-out file output file\n");
|
BIO_printf (bio_err, "-out file output file\n");
|
||||||
BIO_printf (bio_err, "-outform arg output format SMIME (default), PEM or DER\n");
|
BIO_printf (bio_err, "-outform arg output format SMIME (default), PEM or DER\n");
|
||||||
BIO_printf (bio_err, "-content file supply or override content for detached signature\n");
|
BIO_printf (bio_err, "-content file supply or override content for detached signature\n");
|
||||||
@@ -297,7 +328,10 @@ int MAIN(int argc, char **argv)
|
|||||||
BIO_printf (bio_err, "-text include or delete text MIME headers\n");
|
BIO_printf (bio_err, "-text include or delete text MIME headers\n");
|
||||||
BIO_printf (bio_err, "-CApath dir trusted certificates directory\n");
|
BIO_printf (bio_err, "-CApath dir trusted certificates directory\n");
|
||||||
BIO_printf (bio_err, "-CAfile file trusted certificates file\n");
|
BIO_printf (bio_err, "-CAfile file trusted certificates file\n");
|
||||||
|
BIO_printf (bio_err, "-crl_check check revocation status of signer's certificate using CRLs\n");
|
||||||
|
BIO_printf (bio_err, "-crl_check_all check revocation status of signer's certificate chain using CRLs\n");
|
||||||
BIO_printf (bio_err, "-engine e use engine e, possibly a hardware device.\n");
|
BIO_printf (bio_err, "-engine e use engine e, possibly a hardware device.\n");
|
||||||
|
BIO_printf (bio_err, "-passin arg input file pass phrase source\n");
|
||||||
BIO_printf(bio_err, "-rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR);
|
BIO_printf(bio_err, "-rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR);
|
||||||
BIO_printf(bio_err, " load the file (or the files in the directory) into\n");
|
BIO_printf(bio_err, " load the file (or the files in the directory) into\n");
|
||||||
BIO_printf(bio_err, " the random number generator\n");
|
BIO_printf(bio_err, " the random number generator\n");
|
||||||
@@ -305,23 +339,7 @@ int MAIN(int argc, char **argv)
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (engine != NULL)
|
e = setup_engine(bio_err, engine, 0);
|
||||||
{
|
|
||||||
if((e = ENGINE_by_id(engine)) == NULL)
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"invalid engine \"%s\"\n",
|
|
||||||
engine);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"can't use that engine\n");
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
|
|
||||||
/* Free our "structural" reference. */
|
|
||||||
ENGINE_free(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!app_passwd(bio_err, passargin, NULL, &passin, NULL)) {
|
if(!app_passwd(bio_err, passargin, NULL, &passin, NULL)) {
|
||||||
BIO_printf(bio_err, "Error getting password\n");
|
BIO_printf(bio_err, "Error getting password\n");
|
||||||
@@ -358,8 +376,11 @@ int MAIN(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
encerts = sk_X509_new_null();
|
encerts = sk_X509_new_null();
|
||||||
while (*args) {
|
while (*args) {
|
||||||
if(!(cert = load_cert(bio_err,*args,FORMAT_PEM))) {
|
if(!(cert = load_cert(bio_err,*args,FORMAT_PEM,
|
||||||
|
NULL, e, "recipient certificate file"))) {
|
||||||
|
#if 0 /* An appropriate message is already printed */
|
||||||
BIO_printf(bio_err, "Can't read recipient certificate file %s\n", *args);
|
BIO_printf(bio_err, "Can't read recipient certificate file %s\n", *args);
|
||||||
|
#endif
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
sk_X509_push(encerts, cert);
|
sk_X509_push(encerts, cert);
|
||||||
@@ -369,23 +390,32 @@ int MAIN(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(signerfile && (operation == SMIME_SIGN)) {
|
if(signerfile && (operation == SMIME_SIGN)) {
|
||||||
if(!(signer = load_cert(bio_err,signerfile,FORMAT_PEM))) {
|
if(!(signer = load_cert(bio_err,signerfile,FORMAT_PEM, NULL,
|
||||||
|
e, "signer certificate"))) {
|
||||||
|
#if 0 /* An appropri message has already been printed */
|
||||||
BIO_printf(bio_err, "Can't read signer certificate file %s\n", signerfile);
|
BIO_printf(bio_err, "Can't read signer certificate file %s\n", signerfile);
|
||||||
|
#endif
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(certfile) {
|
if(certfile) {
|
||||||
if(!(other = load_certs(bio_err,certfile,FORMAT_PEM))) {
|
if(!(other = load_certs(bio_err,certfile,FORMAT_PEM, NULL,
|
||||||
|
e, "certificate file"))) {
|
||||||
|
#if 0 /* An appropriate message has already been printed */
|
||||||
BIO_printf(bio_err, "Can't read certificate file %s\n", certfile);
|
BIO_printf(bio_err, "Can't read certificate file %s\n", certfile);
|
||||||
|
#endif
|
||||||
ERR_print_errors(bio_err);
|
ERR_print_errors(bio_err);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(recipfile && (operation == SMIME_DECRYPT)) {
|
if(recipfile && (operation == SMIME_DECRYPT)) {
|
||||||
if(!(recip = load_cert(bio_err,recipfile,FORMAT_PEM))) {
|
if(!(recip = load_cert(bio_err,recipfile,FORMAT_PEM,NULL,
|
||||||
|
e, "recipient certificate file"))) {
|
||||||
|
#if 0 /* An appropriate message has alrady been printed */
|
||||||
BIO_printf(bio_err, "Can't read recipient certificate file %s\n", recipfile);
|
BIO_printf(bio_err, "Can't read recipient certificate file %s\n", recipfile);
|
||||||
|
#endif
|
||||||
ERR_print_errors(bio_err);
|
ERR_print_errors(bio_err);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
@@ -398,11 +428,11 @@ int MAIN(int argc, char **argv)
|
|||||||
} else keyfile = NULL;
|
} else keyfile = NULL;
|
||||||
|
|
||||||
if(keyfile) {
|
if(keyfile) {
|
||||||
if(!(key = load_key(bio_err,keyfile, FORMAT_PEM, passin, NULL))) {
|
key = load_key(bio_err, keyfile, keyform, passin, e,
|
||||||
BIO_printf(bio_err, "Can't read recipient certificate file %s\n", keyfile);
|
"signing key file");
|
||||||
ERR_print_errors(bio_err);
|
if (!key) {
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (infile) {
|
if (infile) {
|
||||||
@@ -431,15 +461,20 @@ int MAIN(int argc, char **argv)
|
|||||||
|
|
||||||
if(operation == SMIME_VERIFY) {
|
if(operation == SMIME_VERIFY) {
|
||||||
if(!(store = setup_verify(bio_err, CAfile, CApath))) goto end;
|
if(!(store = setup_verify(bio_err, CAfile, CApath))) goto end;
|
||||||
|
X509_STORE_set_flags(store, store_flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ret = 3;
|
ret = 3;
|
||||||
|
|
||||||
if(operation == SMIME_ENCRYPT) {
|
if(operation == SMIME_ENCRYPT) {
|
||||||
p7 = PKCS7_encrypt(encerts, in, cipher, flags);
|
p7 = PKCS7_encrypt(encerts, in, cipher, flags);
|
||||||
} else if(operation == SMIME_SIGN) {
|
} else if(operation == SMIME_SIGN) {
|
||||||
p7 = PKCS7_sign(signer, key, other, in, flags);
|
p7 = PKCS7_sign(signer, key, other, in, flags);
|
||||||
BIO_reset(in);
|
if (BIO_reset(in) != 0 && (flags & PKCS7_DETACHED)) {
|
||||||
|
BIO_printf(bio_err, "Can't rewind input file\n");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if(informat == FORMAT_SMIME)
|
if(informat == FORMAT_SMIME)
|
||||||
p7 = SMIME_read_PKCS7(in, &indata);
|
p7 = SMIME_read_PKCS7(in, &indata);
|
||||||
@@ -479,9 +514,9 @@ int MAIN(int argc, char **argv)
|
|||||||
} else if(operation == SMIME_VERIFY) {
|
} else if(operation == SMIME_VERIFY) {
|
||||||
STACK_OF(X509) *signers;
|
STACK_OF(X509) *signers;
|
||||||
if(PKCS7_verify(p7, other, store, indata, out, flags)) {
|
if(PKCS7_verify(p7, other, store, indata, out, flags)) {
|
||||||
BIO_printf(bio_err, "Verification Successful\n");
|
BIO_printf(bio_err, "Verification successful\n");
|
||||||
} else {
|
} else {
|
||||||
BIO_printf(bio_err, "Verification Failure\n");
|
BIO_printf(bio_err, "Verification failure\n");
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
signers = PKCS7_get0_signers(p7, other, flags);
|
signers = PKCS7_get0_signers(p7, other, flags);
|
||||||
|
|||||||
882
apps/speed.c
882
apps/speed.c
File diff suppressed because it is too large
Load Diff
50
apps/spkac.c
50
apps/spkac.c
@@ -69,7 +69,6 @@
|
|||||||
#include <openssl/lhash.h>
|
#include <openssl/lhash.h>
|
||||||
#include <openssl/x509.h>
|
#include <openssl/x509.h>
|
||||||
#include <openssl/pem.h>
|
#include <openssl/pem.h>
|
||||||
#include <openssl/engine.h>
|
|
||||||
|
|
||||||
#undef PROG
|
#undef PROG
|
||||||
#define PROG spkac_main
|
#define PROG spkac_main
|
||||||
@@ -84,13 +83,13 @@ int MAIN(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
ENGINE *e = NULL;
|
ENGINE *e = NULL;
|
||||||
int i,badops=0, ret = 1;
|
int i,badops=0, ret = 1;
|
||||||
BIO *in = NULL,*out = NULL, *key = NULL;
|
BIO *in = NULL,*out = NULL;
|
||||||
int verify=0,noout=0,pubkey=0;
|
int verify=0,noout=0,pubkey=0;
|
||||||
char *infile = NULL,*outfile = NULL,*prog;
|
char *infile = NULL,*outfile = NULL,*prog;
|
||||||
char *passargin = NULL, *passin = NULL;
|
char *passargin = NULL, *passin = NULL;
|
||||||
char *spkac = "SPKAC", *spksect = "default", *spkstr = NULL;
|
char *spkac = "SPKAC", *spksect = "default", *spkstr = NULL;
|
||||||
char *challenge = NULL, *keyfile = NULL;
|
char *challenge = NULL, *keyfile = NULL;
|
||||||
LHASH *conf = NULL;
|
CONF *conf = NULL;
|
||||||
NETSCAPE_SPKI *spki = NULL;
|
NETSCAPE_SPKI *spki = NULL;
|
||||||
EVP_PKEY *pkey = NULL;
|
EVP_PKEY *pkey = NULL;
|
||||||
char *engine=NULL;
|
char *engine=NULL;
|
||||||
@@ -99,6 +98,9 @@ int MAIN(int argc, char **argv)
|
|||||||
|
|
||||||
if (!bio_err) bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
|
if (!bio_err) bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
|
||||||
|
|
||||||
|
if (!load_config(bio_err, NULL))
|
||||||
|
goto end;
|
||||||
|
|
||||||
prog=argv[0];
|
prog=argv[0];
|
||||||
argc--;
|
argc--;
|
||||||
argv++;
|
argv++;
|
||||||
@@ -179,36 +181,13 @@ bad:
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (engine != NULL)
|
e = setup_engine(bio_err, engine, 0);
|
||||||
{
|
|
||||||
if((e = ENGINE_by_id(engine)) == NULL)
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"invalid engine \"%s\"\n",
|
|
||||||
engine);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"can't use that engine\n");
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
|
|
||||||
/* Free our "structural" reference. */
|
|
||||||
ENGINE_free(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(keyfile) {
|
if(keyfile) {
|
||||||
if(strcmp(keyfile, "-")) key = BIO_new_file(keyfile, "r");
|
pkey = load_key(bio_err,
|
||||||
else key = BIO_new_fp(stdin, BIO_NOCLOSE);
|
strcmp(keyfile, "-") ? keyfile : NULL,
|
||||||
if(!key) {
|
FORMAT_PEM, passin, e, "private key");
|
||||||
BIO_printf(bio_err, "Error opening key file\n");
|
|
||||||
ERR_print_errors(bio_err);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
pkey = PEM_read_bio_PrivateKey(key, NULL, NULL, passin);
|
|
||||||
if(!pkey) {
|
if(!pkey) {
|
||||||
BIO_printf(bio_err, "Error reading private key\n");
|
|
||||||
ERR_print_errors(bio_err);
|
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
spki = NETSCAPE_SPKI_new();
|
spki = NETSCAPE_SPKI_new();
|
||||||
@@ -251,15 +230,16 @@ bad:
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
conf = CONF_load_bio(NULL, in, NULL);
|
conf = NCONF_new(NULL);
|
||||||
|
i = NCONF_load_bio(conf, in, NULL);
|
||||||
|
|
||||||
if(!conf) {
|
if(!i) {
|
||||||
BIO_printf(bio_err, "Error parsing config file\n");
|
BIO_printf(bio_err, "Error parsing config file\n");
|
||||||
ERR_print_errors(bio_err);
|
ERR_print_errors(bio_err);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
spkstr = CONF_get_string(conf, spksect, spkac);
|
spkstr = NCONF_get_string(conf, spksect, spkac);
|
||||||
|
|
||||||
if(!spkstr) {
|
if(!spkstr) {
|
||||||
BIO_printf(bio_err, "Can't find SPKAC called \"%s\"\n", spkac);
|
BIO_printf(bio_err, "Can't find SPKAC called \"%s\"\n", spkac);
|
||||||
@@ -308,12 +288,12 @@ bad:
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
end:
|
end:
|
||||||
CONF_free(conf);
|
NCONF_free(conf);
|
||||||
NETSCAPE_SPKI_free(spki);
|
NETSCAPE_SPKI_free(spki);
|
||||||
BIO_free(in);
|
BIO_free(in);
|
||||||
BIO_free_all(out);
|
BIO_free_all(out);
|
||||||
BIO_free(key);
|
|
||||||
EVP_PKEY_free(pkey);
|
EVP_PKEY_free(pkey);
|
||||||
if(passin) OPENSSL_free(passin);
|
if(passin) OPENSSL_free(passin);
|
||||||
|
apps_shutdown();
|
||||||
EXIT(ret);
|
EXIT(ret);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,18 @@
|
|||||||
DSA *get_dsa512(void );
|
DSA *get_dsa512(void );
|
||||||
DSA *get_dsa1024(void );
|
DSA *get_dsa1024(void );
|
||||||
DSA *get_dsa2048(void );
|
DSA *get_dsa2048(void );
|
||||||
|
static unsigned char dsa512_priv[] = {
|
||||||
|
0x65,0xe5,0xc7,0x38,0x60,0x24,0xb5,0x89,0xd4,0x9c,0xeb,0x4c,
|
||||||
|
0x9c,0x1d,0x7a,0x22,0xbd,0xd1,0xc2,0xd2,
|
||||||
|
};
|
||||||
|
static unsigned char dsa512_pub[] = {
|
||||||
|
0x00,0x95,0xa7,0x0d,0xec,0x93,0x68,0xba,0x5f,0xf7,0x5f,0x07,
|
||||||
|
0xf2,0x3b,0xad,0x6b,0x01,0xdc,0xbe,0xec,0xde,0x04,0x7a,0x3a,
|
||||||
|
0x27,0xb3,0xec,0x49,0xfd,0x08,0x43,0x3d,0x7e,0xa8,0x2c,0x5e,
|
||||||
|
0x7b,0xbb,0xfc,0xf4,0x6e,0xeb,0x6c,0xb0,0x6e,0xf8,0x02,0x12,
|
||||||
|
0x8c,0x38,0x5d,0x83,0x56,0x7d,0xee,0x53,0x05,0x3e,0x24,0x84,
|
||||||
|
0xbe,0xba,0x0a,0x6b,0xc8,
|
||||||
|
};
|
||||||
static unsigned char dsa512_p[]={
|
static unsigned char dsa512_p[]={
|
||||||
0x9D,0x1B,0x69,0x8E,0x26,0xDB,0xF2,0x2B,0x11,0x70,0x19,0x86,
|
0x9D,0x1B,0x69,0x8E,0x26,0xDB,0xF2,0x2B,0x11,0x70,0x19,0x86,
|
||||||
0xF6,0x19,0xC8,0xF8,0x19,0xF2,0x18,0x53,0x94,0x46,0x06,0xD0,
|
0xF6,0x19,0xC8,0xF8,0x19,0xF2,0x18,0x53,0x94,0x46,0x06,0xD0,
|
||||||
@@ -29,14 +41,34 @@ DSA *get_dsa512()
|
|||||||
DSA *dsa;
|
DSA *dsa;
|
||||||
|
|
||||||
if ((dsa=DSA_new()) == NULL) return(NULL);
|
if ((dsa=DSA_new()) == NULL) return(NULL);
|
||||||
|
dsa->priv_key=BN_bin2bn(dsa512_priv,sizeof(dsa512_priv),NULL);
|
||||||
|
dsa->pub_key=BN_bin2bn(dsa512_pub,sizeof(dsa512_pub),NULL);
|
||||||
dsa->p=BN_bin2bn(dsa512_p,sizeof(dsa512_p),NULL);
|
dsa->p=BN_bin2bn(dsa512_p,sizeof(dsa512_p),NULL);
|
||||||
dsa->q=BN_bin2bn(dsa512_q,sizeof(dsa512_q),NULL);
|
dsa->q=BN_bin2bn(dsa512_q,sizeof(dsa512_q),NULL);
|
||||||
dsa->g=BN_bin2bn(dsa512_g,sizeof(dsa512_g),NULL);
|
dsa->g=BN_bin2bn(dsa512_g,sizeof(dsa512_g),NULL);
|
||||||
if ((dsa->p == NULL) || (dsa->q == NULL) || (dsa->g == NULL))
|
if ((dsa->priv_key == NULL) || (dsa->pub_key == NULL) || (dsa->p == NULL) ||
|
||||||
|
(dsa->q == NULL) || (dsa->g == NULL))
|
||||||
return(NULL);
|
return(NULL);
|
||||||
return(dsa);
|
return(dsa);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static unsigned char dsa1024_priv[]={
|
||||||
|
0x7d,0x21,0xda,0xbb,0x62,0x15,0x47,0x36,0x07,0x67,0x12,0xe8,
|
||||||
|
0x8c,0xaa,0x1c,0xcd,0x38,0x12,0x61,0x18,
|
||||||
|
};
|
||||||
|
static unsigned char dsa1024_pub[]={
|
||||||
|
0x3c,0x4e,0x9c,0x2a,0x7f,0x16,0xc1,0x25,0xeb,0xac,0x78,0x63,
|
||||||
|
0x90,0x14,0x8c,0x8b,0xf4,0x68,0x43,0x3c,0x2d,0xee,0x65,0x50,
|
||||||
|
0x7d,0x9c,0x8f,0x8c,0x8a,0x51,0xd6,0x11,0x2b,0x99,0xaf,0x1e,
|
||||||
|
0x90,0x97,0xb5,0xd3,0xa6,0x20,0x25,0xd6,0xfe,0x43,0x02,0xd5,
|
||||||
|
0x91,0x7d,0xa7,0x8c,0xdb,0xc9,0x85,0xa3,0x36,0x48,0xf7,0x68,
|
||||||
|
0xaa,0x60,0xb1,0xf7,0x05,0x68,0x3a,0xa3,0x3f,0xd3,0x19,0x82,
|
||||||
|
0xd8,0x82,0x7a,0x77,0xfb,0xef,0xf4,0x15,0x0a,0xeb,0x06,0x04,
|
||||||
|
0x7f,0x53,0x07,0x0c,0xbc,0xcb,0x2d,0x83,0xdb,0x3e,0xd1,0x28,
|
||||||
|
0xa5,0xa1,0x31,0xe0,0x67,0xfa,0x50,0xde,0x9b,0x07,0x83,0x7e,
|
||||||
|
0x2c,0x0b,0xc3,0x13,0x50,0x61,0xe5,0xad,0xbd,0x36,0xb8,0x97,
|
||||||
|
0x4e,0x40,0x7d,0xe8,0x83,0x0d,0xbc,0x4b
|
||||||
|
};
|
||||||
static unsigned char dsa1024_p[]={
|
static unsigned char dsa1024_p[]={
|
||||||
0xA7,0x3F,0x6E,0x85,0xBF,0x41,0x6A,0x29,0x7D,0xF0,0x9F,0x47,
|
0xA7,0x3F,0x6E,0x85,0xBF,0x41,0x6A,0x29,0x7D,0xF0,0x9F,0x47,
|
||||||
0x19,0x30,0x90,0x9A,0x09,0x1D,0xDA,0x6A,0x33,0x1E,0xC5,0x3D,
|
0x19,0x30,0x90,0x9A,0x09,0x1D,0xDA,0x6A,0x33,0x1E,0xC5,0x3D,
|
||||||
@@ -73,14 +105,45 @@ DSA *get_dsa1024()
|
|||||||
DSA *dsa;
|
DSA *dsa;
|
||||||
|
|
||||||
if ((dsa=DSA_new()) == NULL) return(NULL);
|
if ((dsa=DSA_new()) == NULL) return(NULL);
|
||||||
|
dsa->priv_key=BN_bin2bn(dsa1024_priv,sizeof(dsa1024_priv),NULL);
|
||||||
|
dsa->pub_key=BN_bin2bn(dsa1024_pub,sizeof(dsa1024_pub),NULL);
|
||||||
dsa->p=BN_bin2bn(dsa1024_p,sizeof(dsa1024_p),NULL);
|
dsa->p=BN_bin2bn(dsa1024_p,sizeof(dsa1024_p),NULL);
|
||||||
dsa->q=BN_bin2bn(dsa1024_q,sizeof(dsa1024_q),NULL);
|
dsa->q=BN_bin2bn(dsa1024_q,sizeof(dsa1024_q),NULL);
|
||||||
dsa->g=BN_bin2bn(dsa1024_g,sizeof(dsa1024_g),NULL);
|
dsa->g=BN_bin2bn(dsa1024_g,sizeof(dsa1024_g),NULL);
|
||||||
if ((dsa->p == NULL) || (dsa->q == NULL) || (dsa->g == NULL))
|
if ((dsa->priv_key == NULL) || (dsa->pub_key == NULL) || (dsa->p == NULL) ||
|
||||||
|
(dsa->q == NULL) || (dsa->g == NULL))
|
||||||
return(NULL);
|
return(NULL);
|
||||||
return(dsa);
|
return(dsa);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static unsigned char dsa2048_priv[]={
|
||||||
|
0x32,0x67,0x92,0xf6,0xc4,0xe2,0xe2,0xe8,0xa0,0x8b,0x6b,0x45,
|
||||||
|
0x0c,0x8a,0x76,0xb0,0xee,0xcf,0x91,0xa7,
|
||||||
|
};
|
||||||
|
static unsigned char dsa2048_pub[]={
|
||||||
|
0x17,0x8f,0xa8,0x11,0x84,0x92,0xec,0x83,0x47,0xc7,0x6a,0xb0,
|
||||||
|
0x92,0xaf,0x5a,0x20,0x37,0xa3,0x64,0x79,0xd2,0xd0,0x3d,0xcd,
|
||||||
|
0xe0,0x61,0x88,0x88,0x21,0xcc,0x74,0x5d,0xce,0x4c,0x51,0x47,
|
||||||
|
0xf0,0xc5,0x5c,0x4c,0x82,0x7a,0xaf,0x72,0xad,0xb9,0xe0,0x53,
|
||||||
|
0xf2,0x78,0xb7,0xf0,0xb5,0x48,0x7f,0x8a,0x3a,0x18,0xd1,0x9f,
|
||||||
|
0x8b,0x7d,0xa5,0x47,0xb7,0x95,0xab,0x98,0xf8,0x7b,0x74,0x50,
|
||||||
|
0x56,0x8e,0x57,0xf0,0xee,0xf5,0xb7,0xba,0xab,0x85,0x86,0xf9,
|
||||||
|
0x2b,0xef,0x41,0x56,0xa0,0xa4,0x9f,0xb7,0x38,0x00,0x46,0x0a,
|
||||||
|
0xa6,0xf1,0xfc,0x1f,0xd8,0x4e,0x85,0x44,0x92,0x43,0x21,0x5d,
|
||||||
|
0x6e,0xcc,0xc2,0xcb,0x26,0x31,0x0d,0x21,0xc4,0xbd,0x8d,0x24,
|
||||||
|
0xbc,0xd9,0x18,0x19,0xd7,0xdc,0xf1,0xe7,0x93,0x50,0x48,0x03,
|
||||||
|
0x2c,0xae,0x2e,0xe7,0x49,0x88,0x5f,0x93,0x57,0x27,0x99,0x36,
|
||||||
|
0xb4,0x20,0xab,0xfc,0xa7,0x2b,0xf2,0xd9,0x98,0xd7,0xd4,0x34,
|
||||||
|
0x9d,0x96,0x50,0x58,0x9a,0xea,0x54,0xf3,0xee,0xf5,0x63,0x14,
|
||||||
|
0xee,0x85,0x83,0x74,0x76,0xe1,0x52,0x95,0xc3,0xf7,0xeb,0x04,
|
||||||
|
0x04,0x7b,0xa7,0x28,0x1b,0xcc,0xea,0x4a,0x4e,0x84,0xda,0xd8,
|
||||||
|
0x9c,0x79,0xd8,0x9b,0x66,0x89,0x2f,0xcf,0xac,0xd7,0x79,0xf9,
|
||||||
|
0xa9,0xd8,0x45,0x13,0x78,0xb9,0x00,0x14,0xc9,0x7e,0x22,0x51,
|
||||||
|
0x86,0x67,0xb0,0x9f,0x26,0x11,0x23,0xc8,0x38,0xd7,0x70,0x1d,
|
||||||
|
0x15,0x8e,0x4d,0x4f,0x95,0x97,0x40,0xa1,0xc2,0x7e,0x01,0x18,
|
||||||
|
0x72,0xf4,0x10,0xe6,0x8d,0x52,0x16,0x7f,0xf2,0xc9,0xf8,0x33,
|
||||||
|
0x8b,0x33,0xb7,0xce,
|
||||||
|
};
|
||||||
static unsigned char dsa2048_p[]={
|
static unsigned char dsa2048_p[]={
|
||||||
0xA0,0x25,0xFA,0xAD,0xF4,0x8E,0xB9,0xE5,0x99,0xF3,0x5D,0x6F,
|
0xA0,0x25,0xFA,0xAD,0xF4,0x8E,0xB9,0xE5,0x99,0xF3,0x5D,0x6F,
|
||||||
0x4F,0x83,0x34,0xE2,0x7E,0xCF,0x6F,0xBF,0x30,0xAF,0x6F,0x81,
|
0x4F,0x83,0x34,0xE2,0x7E,0xCF,0x6F,0xBF,0x30,0xAF,0x6F,0x81,
|
||||||
@@ -139,10 +202,13 @@ DSA *get_dsa2048()
|
|||||||
DSA *dsa;
|
DSA *dsa;
|
||||||
|
|
||||||
if ((dsa=DSA_new()) == NULL) return(NULL);
|
if ((dsa=DSA_new()) == NULL) return(NULL);
|
||||||
|
dsa->priv_key=BN_bin2bn(dsa2048_priv,sizeof(dsa2048_priv),NULL);
|
||||||
|
dsa->pub_key=BN_bin2bn(dsa2048_pub,sizeof(dsa2048_pub),NULL);
|
||||||
dsa->p=BN_bin2bn(dsa2048_p,sizeof(dsa2048_p),NULL);
|
dsa->p=BN_bin2bn(dsa2048_p,sizeof(dsa2048_p),NULL);
|
||||||
dsa->q=BN_bin2bn(dsa2048_q,sizeof(dsa2048_q),NULL);
|
dsa->q=BN_bin2bn(dsa2048_q,sizeof(dsa2048_q),NULL);
|
||||||
dsa->g=BN_bin2bn(dsa2048_g,sizeof(dsa2048_g),NULL);
|
dsa->g=BN_bin2bn(dsa2048_g,sizeof(dsa2048_g),NULL);
|
||||||
if ((dsa->p == NULL) || (dsa->q == NULL) || (dsa->g == NULL))
|
if ((dsa->priv_key == NULL) || (dsa->pub_key == NULL) || (dsa->p == NULL) ||
|
||||||
|
(dsa->q == NULL) || (dsa->g == NULL))
|
||||||
return(NULL);
|
return(NULL);
|
||||||
return(dsa);
|
return(dsa);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,15 +65,14 @@
|
|||||||
#include <openssl/x509.h>
|
#include <openssl/x509.h>
|
||||||
#include <openssl/x509v3.h>
|
#include <openssl/x509v3.h>
|
||||||
#include <openssl/pem.h>
|
#include <openssl/pem.h>
|
||||||
#include <openssl/engine.h>
|
|
||||||
|
|
||||||
#undef PROG
|
#undef PROG
|
||||||
#define PROG verify_main
|
#define PROG verify_main
|
||||||
|
|
||||||
static int MS_CALLBACK cb(int ok, X509_STORE_CTX *ctx);
|
static int MS_CALLBACK cb(int ok, X509_STORE_CTX *ctx);
|
||||||
static int check(X509_STORE *ctx, char *file, STACK_OF(X509) *uchain, STACK_OF(X509) *tchain, int purpose);
|
static int check(X509_STORE *ctx, char *file, STACK_OF(X509) *uchain, STACK_OF(X509) *tchain, int purpose, ENGINE *e);
|
||||||
static STACK_OF(X509) *load_untrusted(char *file);
|
static STACK_OF(X509) *load_untrusted(char *file);
|
||||||
static int v_verbose=0, issuer_checks = 0;
|
static int v_verbose=0, vflags = 0;
|
||||||
|
|
||||||
int MAIN(int, char **);
|
int MAIN(int, char **);
|
||||||
|
|
||||||
@@ -101,6 +100,9 @@ int MAIN(int argc, char **argv)
|
|||||||
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
|
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
|
||||||
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
|
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
|
||||||
|
|
||||||
|
if (!load_config(bio_err, NULL))
|
||||||
|
goto end;
|
||||||
|
|
||||||
argc--;
|
argc--;
|
||||||
argv++;
|
argv++;
|
||||||
for (;;)
|
for (;;)
|
||||||
@@ -147,8 +149,14 @@ int MAIN(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
else if (strcmp(*argv,"-help") == 0)
|
else if (strcmp(*argv,"-help") == 0)
|
||||||
goto end;
|
goto end;
|
||||||
|
else if (strcmp(*argv,"-ignore_critical") == 0)
|
||||||
|
vflags |= X509_V_FLAG_IGNORE_CRITICAL;
|
||||||
else if (strcmp(*argv,"-issuer_checks") == 0)
|
else if (strcmp(*argv,"-issuer_checks") == 0)
|
||||||
issuer_checks=1;
|
vflags |= X509_V_FLAG_CB_ISSUER_CHECK;
|
||||||
|
else if (strcmp(*argv,"-crl_check") == 0)
|
||||||
|
vflags |= X509_V_FLAG_CRL_CHECK;
|
||||||
|
else if (strcmp(*argv,"-crl_check_all") == 0)
|
||||||
|
vflags |= X509_V_FLAG_CRL_CHECK|X509_V_FLAG_CRL_CHECK_ALL;
|
||||||
else if (strcmp(*argv,"-verbose") == 0)
|
else if (strcmp(*argv,"-verbose") == 0)
|
||||||
v_verbose=1;
|
v_verbose=1;
|
||||||
else if (argv[0][0] == '-')
|
else if (argv[0][0] == '-')
|
||||||
@@ -162,23 +170,7 @@ int MAIN(int argc, char **argv)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (engine != NULL)
|
e = setup_engine(bio_err, engine, 0);
|
||||||
{
|
|
||||||
if((e = ENGINE_by_id(engine)) == NULL)
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"invalid engine \"%s\"\n",
|
|
||||||
engine);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"can't use that engine\n");
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
|
|
||||||
/* Free our "structural" reference. */
|
|
||||||
ENGINE_free(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
lookup=X509_STORE_add_lookup(cert_ctx,X509_LOOKUP_file());
|
lookup=X509_STORE_add_lookup(cert_ctx,X509_LOOKUP_file());
|
||||||
if (lookup == NULL) abort();
|
if (lookup == NULL) abort();
|
||||||
@@ -220,14 +212,14 @@ int MAIN(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc < 1) check(cert_ctx, NULL, untrusted, trusted, purpose);
|
if (argc < 1) check(cert_ctx, NULL, untrusted, trusted, purpose, e);
|
||||||
else
|
else
|
||||||
for (i=0; i<argc; i++)
|
for (i=0; i<argc; i++)
|
||||||
check(cert_ctx,argv[i], untrusted, trusted, purpose);
|
check(cert_ctx,argv[i], untrusted, trusted, purpose, e);
|
||||||
ret=0;
|
ret=0;
|
||||||
end:
|
end:
|
||||||
if (ret == 1) {
|
if (ret == 1) {
|
||||||
BIO_printf(bio_err,"usage: verify [-verbose] [-CApath path] [-CAfile file] [-purpose purpose] [-engine e] cert1 cert2 ...\n");
|
BIO_printf(bio_err,"usage: verify [-verbose] [-CApath path] [-CAfile file] [-purpose purpose] [-crl_check] [-engine e] cert1 cert2 ...\n");
|
||||||
BIO_printf(bio_err,"recognized usages:\n");
|
BIO_printf(bio_err,"recognized usages:\n");
|
||||||
for(i = 0; i < X509_PURPOSE_get_count(); i++) {
|
for(i = 0; i < X509_PURPOSE_get_count(); i++) {
|
||||||
X509_PURPOSE *ptmp;
|
X509_PURPOSE *ptmp;
|
||||||
@@ -239,42 +231,19 @@ end:
|
|||||||
if (cert_ctx != NULL) X509_STORE_free(cert_ctx);
|
if (cert_ctx != NULL) X509_STORE_free(cert_ctx);
|
||||||
sk_X509_pop_free(untrusted, X509_free);
|
sk_X509_pop_free(untrusted, X509_free);
|
||||||
sk_X509_pop_free(trusted, X509_free);
|
sk_X509_pop_free(trusted, X509_free);
|
||||||
|
apps_shutdown();
|
||||||
EXIT(ret);
|
EXIT(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int check(X509_STORE *ctx, char *file, STACK_OF(X509) *uchain, STACK_OF(X509) *tchain, int purpose)
|
static int check(X509_STORE *ctx, char *file, STACK_OF(X509) *uchain, STACK_OF(X509) *tchain, int purpose, ENGINE *e)
|
||||||
{
|
{
|
||||||
X509 *x=NULL;
|
X509 *x=NULL;
|
||||||
BIO *in=NULL;
|
|
||||||
int i=0,ret=0;
|
int i=0,ret=0;
|
||||||
X509_STORE_CTX *csc;
|
X509_STORE_CTX *csc;
|
||||||
|
|
||||||
in=BIO_new(BIO_s_file());
|
x = load_cert(bio_err, file, FORMAT_PEM, NULL, e, "certificate file");
|
||||||
if (in == NULL)
|
|
||||||
{
|
|
||||||
ERR_print_errors(bio_err);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (file == NULL)
|
|
||||||
BIO_set_fp(in,stdin,BIO_NOCLOSE);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (BIO_read_filename(in,file) <= 0)
|
|
||||||
{
|
|
||||||
perror(file);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
x=PEM_read_bio_X509(in,NULL,NULL,NULL);
|
|
||||||
if (x == NULL)
|
if (x == NULL)
|
||||||
{
|
|
||||||
fprintf(stdout,"%s: unable to load certificate file\n",
|
|
||||||
(file == NULL)?"stdin":file);
|
|
||||||
ERR_print_errors(bio_err);
|
|
||||||
goto end;
|
goto end;
|
||||||
}
|
|
||||||
fprintf(stdout,"%s: ",(file == NULL)?"stdin":file);
|
fprintf(stdout,"%s: ",(file == NULL)?"stdin":file);
|
||||||
|
|
||||||
csc = X509_STORE_CTX_new();
|
csc = X509_STORE_CTX_new();
|
||||||
@@ -283,11 +252,14 @@ static int check(X509_STORE *ctx, char *file, STACK_OF(X509) *uchain, STACK_OF(X
|
|||||||
ERR_print_errors(bio_err);
|
ERR_print_errors(bio_err);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
X509_STORE_CTX_init(csc,ctx,x,uchain);
|
X509_STORE_set_flags(ctx, vflags);
|
||||||
|
if(!X509_STORE_CTX_init(csc,ctx,x,uchain))
|
||||||
|
{
|
||||||
|
ERR_print_errors(bio_err);
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
if(tchain) X509_STORE_CTX_trusted_stack(csc, tchain);
|
if(tchain) X509_STORE_CTX_trusted_stack(csc, tchain);
|
||||||
if(purpose >= 0) X509_STORE_CTX_set_purpose(csc, purpose);
|
if(purpose >= 0) X509_STORE_CTX_set_purpose(csc, purpose);
|
||||||
if(issuer_checks)
|
|
||||||
X509_STORE_CTX_set_flags(csc, X509_V_FLAG_CB_ISSUER_CHECK);
|
|
||||||
i=X509_verify_cert(csc);
|
i=X509_verify_cert(csc);
|
||||||
X509_STORE_CTX_free(csc);
|
X509_STORE_CTX_free(csc);
|
||||||
|
|
||||||
@@ -301,7 +273,6 @@ end:
|
|||||||
else
|
else
|
||||||
ERR_print_errors(bio_err);
|
ERR_print_errors(bio_err);
|
||||||
if (x != NULL) X509_free(x);
|
if (x != NULL) X509_free(x);
|
||||||
if (in != NULL) BIO_free(in);
|
|
||||||
|
|
||||||
return(ret);
|
return(ret);
|
||||||
}
|
}
|
||||||
@@ -375,6 +346,9 @@ static int MS_CALLBACK cb(int ok, X509_STORE_CTX *ctx)
|
|||||||
if (ctx->error == X509_V_ERR_PATH_LENGTH_EXCEEDED) ok=1;
|
if (ctx->error == X509_V_ERR_PATH_LENGTH_EXCEEDED) ok=1;
|
||||||
if (ctx->error == X509_V_ERR_INVALID_PURPOSE) ok=1;
|
if (ctx->error == X509_V_ERR_INVALID_PURPOSE) ok=1;
|
||||||
if (ctx->error == X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT) ok=1;
|
if (ctx->error == X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT) ok=1;
|
||||||
|
if (ctx->error == X509_V_ERR_CRL_HAS_EXPIRED) ok=1;
|
||||||
|
if (ctx->error == X509_V_ERR_CRL_NOT_YET_VALID) ok=1;
|
||||||
|
if (ctx->error == X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION) ok=1;
|
||||||
}
|
}
|
||||||
if (!v_verbose)
|
if (!v_verbose)
|
||||||
ERR_clear_error();
|
ERR_clear_error();
|
||||||
|
|||||||
@@ -55,6 +55,59 @@
|
|||||||
* copied and put under another distribution licence
|
* copied and put under another distribution licence
|
||||||
* [including the GNU Public Licence.]
|
* [including the GNU Public Licence.]
|
||||||
*/
|
*/
|
||||||
|
/* ====================================================================
|
||||||
|
* Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in
|
||||||
|
* the documentation and/or other materials provided with the
|
||||||
|
* distribution.
|
||||||
|
*
|
||||||
|
* 3. All advertising materials mentioning features or use of this
|
||||||
|
* software must display the following acknowledgment:
|
||||||
|
* "This product includes software developed by the OpenSSL Project
|
||||||
|
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
||||||
|
*
|
||||||
|
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||||
|
* endorse or promote products derived from this software without
|
||||||
|
* prior written permission. For written permission, please contact
|
||||||
|
* openssl-core@openssl.org.
|
||||||
|
*
|
||||||
|
* 5. Products derived from this software may not be called "OpenSSL"
|
||||||
|
* nor may "OpenSSL" appear in their names without prior written
|
||||||
|
* permission of the OpenSSL Project.
|
||||||
|
*
|
||||||
|
* 6. Redistributions of any form whatsoever must retain the following
|
||||||
|
* acknowledgment:
|
||||||
|
* "This product includes software developed by the OpenSSL Project
|
||||||
|
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||||
|
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||||
|
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||||
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||||
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
* ====================================================================
|
||||||
|
*
|
||||||
|
* This product includes cryptographic software written by Eric Young
|
||||||
|
* (eay@cryptsoft.com). This product includes software written by Tim
|
||||||
|
* Hudson (tjh@cryptsoft.com).
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -62,6 +115,21 @@
|
|||||||
#include "apps.h"
|
#include "apps.h"
|
||||||
#include <openssl/evp.h>
|
#include <openssl/evp.h>
|
||||||
#include <openssl/crypto.h>
|
#include <openssl/crypto.h>
|
||||||
|
#ifndef OPENSSL_NO_MD2
|
||||||
|
# include <openssl/md2.h>
|
||||||
|
#endif
|
||||||
|
#ifndef OPENSSL_NO_RC4
|
||||||
|
# include <openssl/rc4.h>
|
||||||
|
#endif
|
||||||
|
#ifndef OPENSSL_NO_DES
|
||||||
|
# include <openssl/des.h>
|
||||||
|
#endif
|
||||||
|
#ifndef OPENSSL_NO_IDEA
|
||||||
|
# include <openssl/idea.h>
|
||||||
|
#endif
|
||||||
|
#ifndef OPENSSL_NO_BF
|
||||||
|
# include <openssl/blowfish.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#undef PROG
|
#undef PROG
|
||||||
#define PROG version_main
|
#define PROG version_main
|
||||||
@@ -118,7 +186,7 @@ int MAIN(int argc, char **argv)
|
|||||||
printf("%s ",RC4_options());
|
printf("%s ",RC4_options());
|
||||||
#endif
|
#endif
|
||||||
#ifndef OPENSSL_NO_DES
|
#ifndef OPENSSL_NO_DES
|
||||||
printf("%s ",des_options());
|
printf("%s ",DES_options());
|
||||||
#endif
|
#endif
|
||||||
#ifndef OPENSSL_NO_IDEA
|
#ifndef OPENSSL_NO_IDEA
|
||||||
printf("%s ",idea_options());
|
printf("%s ",idea_options());
|
||||||
@@ -131,5 +199,6 @@ int MAIN(int argc, char **argv)
|
|||||||
if (cflags) printf("%s\n",SSLeay_version(SSLEAY_CFLAGS));
|
if (cflags) printf("%s\n",SSLeay_version(SSLEAY_CFLAGS));
|
||||||
if (dir) printf("%s\n",SSLeay_version(SSLEAY_DIR));
|
if (dir) printf("%s\n",SSLeay_version(SSLEAY_DIR));
|
||||||
end:
|
end:
|
||||||
|
apps_shutdown();
|
||||||
EXIT(ret);
|
EXIT(ret);
|
||||||
}
|
}
|
||||||
|
|||||||
80
apps/x509.c
80
apps/x509.c
@@ -73,7 +73,6 @@
|
|||||||
#include <openssl/x509v3.h>
|
#include <openssl/x509v3.h>
|
||||||
#include <openssl/objects.h>
|
#include <openssl/objects.h>
|
||||||
#include <openssl/pem.h>
|
#include <openssl/pem.h>
|
||||||
#include <openssl/engine.h>
|
|
||||||
|
|
||||||
#undef PROG
|
#undef PROG
|
||||||
#define PROG x509_main
|
#define PROG x509_main
|
||||||
@@ -139,10 +138,10 @@ NULL
|
|||||||
|
|
||||||
static int MS_CALLBACK callb(int ok, X509_STORE_CTX *ctx);
|
static int MS_CALLBACK callb(int ok, X509_STORE_CTX *ctx);
|
||||||
static int sign (X509 *x, EVP_PKEY *pkey,int days,int clrext, const EVP_MD *digest,
|
static int sign (X509 *x, EVP_PKEY *pkey,int days,int clrext, const EVP_MD *digest,
|
||||||
LHASH *conf, char *section);
|
CONF *conf, char *section);
|
||||||
static int x509_certify (X509_STORE *ctx,char *CAfile,const EVP_MD *digest,
|
static int x509_certify (X509_STORE *ctx,char *CAfile,const EVP_MD *digest,
|
||||||
X509 *x,X509 *xca,EVP_PKEY *pkey,char *serial,
|
X509 *x,X509 *xca,EVP_PKEY *pkey,char *serial,
|
||||||
int create,int days, int clrext, LHASH *conf, char *section,
|
int create,int days, int clrext, CONF *conf, char *section,
|
||||||
ASN1_INTEGER *sno);
|
ASN1_INTEGER *sno);
|
||||||
static int purpose_print(BIO *bio, X509 *cert, X509_PURPOSE *pt);
|
static int purpose_print(BIO *bio, X509 *cert, X509_PURPOSE *pt);
|
||||||
static int reqfile=0;
|
static int reqfile=0;
|
||||||
@@ -179,7 +178,7 @@ int MAIN(int argc, char **argv)
|
|||||||
int fingerprint=0;
|
int fingerprint=0;
|
||||||
char buf[256];
|
char buf[256];
|
||||||
const EVP_MD *md_alg,*digest=EVP_md5();
|
const EVP_MD *md_alg,*digest=EVP_md5();
|
||||||
LHASH *extconf = NULL;
|
CONF *extconf = NULL;
|
||||||
char *extsect = NULL, *extfile = NULL, *passin = NULL, *passargin = NULL;
|
char *extsect = NULL, *extfile = NULL, *passin = NULL, *passargin = NULL;
|
||||||
int need_rand = 0;
|
int need_rand = 0;
|
||||||
int checkend=0,checkoffset=0;
|
int checkend=0,checkoffset=0;
|
||||||
@@ -192,6 +191,9 @@ int MAIN(int argc, char **argv)
|
|||||||
|
|
||||||
if (bio_err == NULL)
|
if (bio_err == NULL)
|
||||||
bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
|
bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
|
||||||
|
|
||||||
|
if (!load_config(bio_err, NULL))
|
||||||
|
goto end;
|
||||||
STDout=BIO_new_fp(stdout,BIO_NOCLOSE);
|
STDout=BIO_new_fp(stdout,BIO_NOCLOSE);
|
||||||
#ifdef OPENSSL_SYS_VMS
|
#ifdef OPENSSL_SYS_VMS
|
||||||
{
|
{
|
||||||
@@ -448,23 +450,7 @@ bad:
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (engine != NULL)
|
e = setup_engine(bio_err, engine, 0);
|
||||||
{
|
|
||||||
if((e = ENGINE_by_id(engine)) == NULL)
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"invalid engine \"%s\"\n",
|
|
||||||
engine);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"can't use that engine\n");
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
|
|
||||||
/* Free our "structural" reference. */
|
|
||||||
ENGINE_free(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (need_rand)
|
if (need_rand)
|
||||||
app_RAND_load_file(NULL, bio_err, 0);
|
app_RAND_load_file(NULL, bio_err, 0);
|
||||||
@@ -495,7 +481,8 @@ bad:
|
|||||||
{
|
{
|
||||||
long errorline;
|
long errorline;
|
||||||
X509V3_CTX ctx2;
|
X509V3_CTX ctx2;
|
||||||
if (!(extconf=CONF_load(NULL,extfile,&errorline)))
|
extconf = NCONF_new(NULL);
|
||||||
|
if (!NCONF_load(extconf, extfile,&errorline))
|
||||||
{
|
{
|
||||||
if (errorline <= 0)
|
if (errorline <= 0)
|
||||||
BIO_printf(bio_err,
|
BIO_printf(bio_err,
|
||||||
@@ -509,7 +496,7 @@ bad:
|
|||||||
}
|
}
|
||||||
if (!extsect)
|
if (!extsect)
|
||||||
{
|
{
|
||||||
extsect = CONF_get_string(extconf, "default", "extensions");
|
extsect = NCONF_get_string(extconf, "default", "extensions");
|
||||||
if (!extsect)
|
if (!extsect)
|
||||||
{
|
{
|
||||||
ERR_clear_error();
|
ERR_clear_error();
|
||||||
@@ -517,8 +504,8 @@ bad:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
X509V3_set_ctx_test(&ctx2);
|
X509V3_set_ctx_test(&ctx2);
|
||||||
X509V3_set_conf_lhash(&ctx2, extconf);
|
X509V3_set_nconf(&ctx2, extconf);
|
||||||
if (!X509V3_EXT_add_conf(extconf, &ctx2, extsect, NULL))
|
if (!X509V3_EXT_add_nconf(extconf, &ctx2, extsect, NULL))
|
||||||
{
|
{
|
||||||
BIO_printf(bio_err,
|
BIO_printf(bio_err,
|
||||||
"Error Loading extension section %s\n",
|
"Error Loading extension section %s\n",
|
||||||
@@ -619,12 +606,12 @@ bad:
|
|||||||
EVP_PKEY_free(pkey);
|
EVP_PKEY_free(pkey);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
x=load_cert(bio_err,infile,informat);
|
x=load_cert(bio_err,infile,informat,NULL,e,"Certificate");
|
||||||
|
|
||||||
if (x == NULL) goto end;
|
if (x == NULL) goto end;
|
||||||
if (CA_flag)
|
if (CA_flag)
|
||||||
{
|
{
|
||||||
xca=load_cert(bio_err,CAfile,CAformat);
|
xca=load_cert(bio_err,CAfile,CAformat,NULL,e,"CA Certificate");
|
||||||
if (xca == NULL) goto end;
|
if (xca == NULL) goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -874,13 +861,18 @@ bad:
|
|||||||
if (Upkey == NULL)
|
if (Upkey == NULL)
|
||||||
{
|
{
|
||||||
Upkey=load_key(bio_err,
|
Upkey=load_key(bio_err,
|
||||||
keyfile,keyformat, passin, e);
|
keyfile,keyformat, passin, e,
|
||||||
|
"Private key");
|
||||||
if (Upkey == NULL) goto end;
|
if (Upkey == NULL) goto end;
|
||||||
}
|
}
|
||||||
#ifndef OPENSSL_NO_DSA
|
#ifndef OPENSSL_NO_DSA
|
||||||
if (Upkey->type == EVP_PKEY_DSA)
|
if (Upkey->type == EVP_PKEY_DSA)
|
||||||
digest=EVP_dss1();
|
digest=EVP_dss1();
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef OPENSSL_NO_ECDSA
|
||||||
|
if (Upkey->type == EVP_PKEY_ECDSA)
|
||||||
|
digest=EVP_ecdsa();
|
||||||
|
#endif
|
||||||
|
|
||||||
assert(need_rand);
|
assert(need_rand);
|
||||||
if (!sign(x,Upkey,days,clrext,digest,
|
if (!sign(x,Upkey,days,clrext,digest,
|
||||||
@@ -893,13 +885,17 @@ bad:
|
|||||||
{
|
{
|
||||||
CApkey=load_key(bio_err,
|
CApkey=load_key(bio_err,
|
||||||
CAkeyfile,CAkeyformat, passin,
|
CAkeyfile,CAkeyformat, passin,
|
||||||
e);
|
e, "CA Private Key");
|
||||||
if (CApkey == NULL) goto end;
|
if (CApkey == NULL) goto end;
|
||||||
}
|
}
|
||||||
#ifndef OPENSSL_NO_DSA
|
#ifndef OPENSSL_NO_DSA
|
||||||
if (CApkey->type == EVP_PKEY_DSA)
|
if (CApkey->type == EVP_PKEY_DSA)
|
||||||
digest=EVP_dss1();
|
digest=EVP_dss1();
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef OPENSSL_NO_ECDSA
|
||||||
|
if (CApkey->type == EVP_PKEY_ECDSA)
|
||||||
|
digest = EVP_ecdsa();
|
||||||
|
#endif
|
||||||
|
|
||||||
assert(need_rand);
|
assert(need_rand);
|
||||||
if (!x509_certify(ctx,CAfile,digest,x,xca,
|
if (!x509_certify(ctx,CAfile,digest,x,xca,
|
||||||
@@ -920,7 +916,8 @@ bad:
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
pk=load_key(bio_err,
|
pk=load_key(bio_err,
|
||||||
keyfile,FORMAT_PEM, passin, e);
|
keyfile,FORMAT_PEM, passin, e,
|
||||||
|
"request key");
|
||||||
if (pk == NULL) goto end;
|
if (pk == NULL) goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -928,6 +925,8 @@ bad:
|
|||||||
|
|
||||||
if (pk->type == EVP_PKEY_DSA)
|
if (pk->type == EVP_PKEY_DSA)
|
||||||
digest=EVP_dss1();
|
digest=EVP_dss1();
|
||||||
|
else if (pk->type == EVP_PKEY_ECDSA)
|
||||||
|
digest=EVP_ecdsa();
|
||||||
|
|
||||||
rq=X509_to_X509_REQ(x,pk,digest);
|
rq=X509_to_X509_REQ(x,pk,digest);
|
||||||
EVP_PKEY_free(pk);
|
EVP_PKEY_free(pk);
|
||||||
@@ -1009,7 +1008,7 @@ end:
|
|||||||
if (need_rand)
|
if (need_rand)
|
||||||
app_RAND_write_file(NULL, bio_err);
|
app_RAND_write_file(NULL, bio_err);
|
||||||
OBJ_cleanup();
|
OBJ_cleanup();
|
||||||
CONF_free(extconf);
|
NCONF_free(extconf);
|
||||||
BIO_free_all(out);
|
BIO_free_all(out);
|
||||||
BIO_free_all(STDout);
|
BIO_free_all(STDout);
|
||||||
X509_STORE_free(ctx);
|
X509_STORE_free(ctx);
|
||||||
@@ -1023,6 +1022,7 @@ end:
|
|||||||
sk_ASN1_OBJECT_pop_free(trust, ASN1_OBJECT_free);
|
sk_ASN1_OBJECT_pop_free(trust, ASN1_OBJECT_free);
|
||||||
sk_ASN1_OBJECT_pop_free(reject, ASN1_OBJECT_free);
|
sk_ASN1_OBJECT_pop_free(reject, ASN1_OBJECT_free);
|
||||||
if (passin) OPENSSL_free(passin);
|
if (passin) OPENSSL_free(passin);
|
||||||
|
apps_shutdown();
|
||||||
EXIT(ret);
|
EXIT(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1129,7 +1129,7 @@ static ASN1_INTEGER *load_serial(char *CAfile, char *serialfile, int create)
|
|||||||
|
|
||||||
static int x509_certify(X509_STORE *ctx, char *CAfile, const EVP_MD *digest,
|
static int x509_certify(X509_STORE *ctx, char *CAfile, const EVP_MD *digest,
|
||||||
X509 *x, X509 *xca, EVP_PKEY *pkey, char *serialfile, int create,
|
X509 *x, X509 *xca, EVP_PKEY *pkey, char *serialfile, int create,
|
||||||
int days, int clrext, LHASH *conf, char *section, ASN1_INTEGER *sno)
|
int days, int clrext, CONF *conf, char *section, ASN1_INTEGER *sno)
|
||||||
{
|
{
|
||||||
int ret=0;
|
int ret=0;
|
||||||
ASN1_INTEGER *bs=NULL;
|
ASN1_INTEGER *bs=NULL;
|
||||||
@@ -1140,7 +1140,11 @@ static int x509_certify(X509_STORE *ctx, char *CAfile, const EVP_MD *digest,
|
|||||||
EVP_PKEY_copy_parameters(upkey,pkey);
|
EVP_PKEY_copy_parameters(upkey,pkey);
|
||||||
EVP_PKEY_free(upkey);
|
EVP_PKEY_free(upkey);
|
||||||
|
|
||||||
X509_STORE_CTX_init(&xsc,ctx,x,NULL);
|
if(!X509_STORE_CTX_init(&xsc,ctx,x,NULL))
|
||||||
|
{
|
||||||
|
BIO_printf(bio_err,"Error initialising X509 store\n");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
if (sno) bs = sno;
|
if (sno) bs = sno;
|
||||||
else if (!(bs = load_serial(CAfile, serialfile, create)))
|
else if (!(bs = load_serial(CAfile, serialfile, create)))
|
||||||
goto end;
|
goto end;
|
||||||
@@ -1179,8 +1183,8 @@ static int x509_certify(X509_STORE *ctx, char *CAfile, const EVP_MD *digest,
|
|||||||
X509V3_CTX ctx2;
|
X509V3_CTX ctx2;
|
||||||
X509_set_version(x,2); /* version 3 certificate */
|
X509_set_version(x,2); /* version 3 certificate */
|
||||||
X509V3_set_ctx(&ctx2, xca, x, NULL, NULL, 0);
|
X509V3_set_ctx(&ctx2, xca, x, NULL, NULL, 0);
|
||||||
X509V3_set_conf_lhash(&ctx2, conf);
|
X509V3_set_nconf(&ctx2, conf);
|
||||||
if (!X509V3_EXT_add_conf(conf, &ctx2, section, x)) goto end;
|
if (!X509V3_EXT_add_nconf(conf, &ctx2, section, x)) goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!X509_sign(x,pkey,digest)) goto end;
|
if (!X509_sign(x,pkey,digest)) goto end;
|
||||||
@@ -1226,7 +1230,7 @@ static int MS_CALLBACK callb(int ok, X509_STORE_CTX *ctx)
|
|||||||
|
|
||||||
/* self sign */
|
/* self sign */
|
||||||
static int sign(X509 *x, EVP_PKEY *pkey, int days, int clrext, const EVP_MD *digest,
|
static int sign(X509 *x, EVP_PKEY *pkey, int days, int clrext, const EVP_MD *digest,
|
||||||
LHASH *conf, char *section)
|
CONF *conf, char *section)
|
||||||
{
|
{
|
||||||
|
|
||||||
EVP_PKEY *pktmp;
|
EVP_PKEY *pktmp;
|
||||||
@@ -1256,8 +1260,8 @@ static int sign(X509 *x, EVP_PKEY *pkey, int days, int clrext, const EVP_MD *dig
|
|||||||
X509V3_CTX ctx;
|
X509V3_CTX ctx;
|
||||||
X509_set_version(x,2); /* version 3 certificate */
|
X509_set_version(x,2); /* version 3 certificate */
|
||||||
X509V3_set_ctx(&ctx, x, x, NULL, NULL, 0);
|
X509V3_set_ctx(&ctx, x, x, NULL, NULL, 0);
|
||||||
X509V3_set_conf_lhash(&ctx, conf);
|
X509V3_set_nconf(&ctx, conf);
|
||||||
if (!X509V3_EXT_add_conf(conf, &ctx, section, x)) goto err;
|
if (!X509V3_EXT_add_nconf(conf, &ctx, section, x)) goto err;
|
||||||
}
|
}
|
||||||
if (!X509_sign(x,pkey,digest)) goto err;
|
if (!X509_sign(x,pkey,digest)) goto err;
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
224
config
224
config
@@ -74,10 +74,18 @@ if [ "x$XREL" != "x" ]; then
|
|||||||
echo "whatever-whatever-sco5"; exit 0
|
echo "whatever-whatever-sco5"; exit 0
|
||||||
;;
|
;;
|
||||||
4.2MP)
|
4.2MP)
|
||||||
if [ "x$VERSION" = "x2.1.1" ]; then
|
if [ "x$VERSION" = "x2.01" ]; then
|
||||||
|
echo "${MACHINE}-whatever-unixware201"; exit 0
|
||||||
|
elif [ "x$VERSION" = "x2.02" ]; then
|
||||||
|
echo "${MACHINE}-whatever-unixware202"; exit 0
|
||||||
|
elif [ "x$VERSION" = "x2.03" ]; then
|
||||||
|
echo "${MACHINE}-whatever-unixware203"; exit 0
|
||||||
|
elif [ "x$VERSION" = "x2.1.1" ]; then
|
||||||
echo "${MACHINE}-whatever-unixware211"; exit 0
|
echo "${MACHINE}-whatever-unixware211"; exit 0
|
||||||
elif [ "x$VERSION" = "x2.1.2" ]; then
|
elif [ "x$VERSION" = "x2.1.2" ]; then
|
||||||
echo "${MACHINE}-whatever-unixware212"; exit 0
|
echo "${MACHINE}-whatever-unixware212"; exit 0
|
||||||
|
elif [ "x$VERSION" = "x2.1.3" ]; then
|
||||||
|
echo "${MACHINE}-whatever-unixware213"; exit 0
|
||||||
else
|
else
|
||||||
echo "${MACHINE}-whatever-unixware2"; exit 0
|
echo "${MACHINE}-whatever-unixware2"; exit 0
|
||||||
fi
|
fi
|
||||||
@@ -85,6 +93,11 @@ if [ "x$XREL" != "x" ]; then
|
|||||||
4.2)
|
4.2)
|
||||||
echo "whatever-whatever-unixware1"; exit 0
|
echo "whatever-whatever-unixware1"; exit 0
|
||||||
;;
|
;;
|
||||||
|
OpenUNIX)
|
||||||
|
if [ "`echo x$VERSION | sed -e 's/\..*//'`" = "x8" ]; then
|
||||||
|
echo "${MACHINE}-unknown-OpenUNIX${VERSION}"; exit 0
|
||||||
|
fi
|
||||||
|
;;
|
||||||
5)
|
5)
|
||||||
if [ "`echo x$VERSION | sed -e 's/\..*//'`" = "x7" ]; then
|
if [ "`echo x$VERSION | sed -e 's/\..*//'`" = "x7" ]; then
|
||||||
echo "${MACHINE}-sco-unixware7"; exit 0
|
echo "${MACHINE}-sco-unixware7"; exit 0
|
||||||
@@ -104,6 +117,14 @@ case "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in
|
|||||||
echo "m68k-apple-aux3"; exit 0
|
echo "m68k-apple-aux3"; exit 0
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
AIX:[3456789]:4:*)
|
||||||
|
echo "${MACHINE}-ibm-aix43"; exit 0
|
||||||
|
;;
|
||||||
|
|
||||||
|
AIX:*:[56789]:*)
|
||||||
|
echo "${MACHINE}-ibm-aix43"; exit 0
|
||||||
|
;;
|
||||||
|
|
||||||
AIX:*)
|
AIX:*)
|
||||||
echo "${MACHINE}-ibm-aix"; exit 0
|
echo "${MACHINE}-ibm-aix"; exit 0
|
||||||
;;
|
;;
|
||||||
@@ -119,10 +140,7 @@ case "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in
|
|||||||
HP-UX:*)
|
HP-UX:*)
|
||||||
HPUXVER=`echo ${RELEASE}|sed -e 's/[^.]*.[0B]*//'`
|
HPUXVER=`echo ${RELEASE}|sed -e 's/[^.]*.[0B]*//'`
|
||||||
case "$HPUXVER" in
|
case "$HPUXVER" in
|
||||||
11.*)
|
1[0-9].*) # HPUX 10 and 11 targets are unified
|
||||||
echo "${MACHINE}-hp-hpux11"; exit 0
|
|
||||||
;;
|
|
||||||
10.*)
|
|
||||||
echo "${MACHINE}-hp-hpux10"; exit 0
|
echo "${MACHINE}-hp-hpux10"; exit 0
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
@@ -208,15 +226,33 @@ case "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in
|
|||||||
echo "${MACHINE}-whatever-openbsd"; exit 0
|
echo "${MACHINE}-whatever-openbsd"; exit 0
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
OpenUNIX:*)
|
||||||
|
echo "${MACHINE}-unknown-OpenUNIX${VERSION}"; exit 0
|
||||||
|
;;
|
||||||
|
|
||||||
OSF1:*:*:*alpha*)
|
OSF1:*:*:*alpha*)
|
||||||
echo "${MACHINE}-dec-osf"; exit 0
|
OSFMAJOR=`echo ${RELEASE}| sed -e 's/^V\([0-9]*\)\..*$/\1/'`
|
||||||
|
case "$OSFMAJOR" in
|
||||||
|
4|5)
|
||||||
|
echo "${MACHINE}-dec-tru64"; exit 0
|
||||||
|
;;
|
||||||
|
1|2|3)
|
||||||
|
echo "${MACHINE}-dec-osf"; exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "${MACHINE}-dec-osf"; exit 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
;;
|
;;
|
||||||
|
|
||||||
QNX:*)
|
QNX:*)
|
||||||
case "$VERSION" in
|
case "$RELEASE" in
|
||||||
4*)
|
4*)
|
||||||
echo "${MACHINE}-whatever-qnx4"
|
echo "${MACHINE}-whatever-qnx4"
|
||||||
;;
|
;;
|
||||||
|
6*)
|
||||||
|
echo "${MACHINE}-whatever-qnx6"
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
echo "${MACHINE}-whatever-qnx"
|
echo "${MACHINE}-whatever-qnx"
|
||||||
;;
|
;;
|
||||||
@@ -296,6 +332,25 @@ case "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in
|
|||||||
echo "mips-sony-newsos4"; exit 0;
|
echo "mips-sony-newsos4"; exit 0;
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
CYGWIN*)
|
||||||
|
case "$RELEASE" in
|
||||||
|
[bB]*|1.0|1.[12].*)
|
||||||
|
echo "${MACHINE}-whatever-cygwin_pre1.3"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "${MACHINE}-whatever-cygwin"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
|
||||||
|
*"CRAY T3E")
|
||||||
|
echo "t3e-cray-unicosmk"; exit 0;
|
||||||
|
;;
|
||||||
|
|
||||||
|
*CRAY*)
|
||||||
|
echo "j90-cray-unicos"; exit 0;
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -345,8 +400,18 @@ if [ "$GCCVER" != "" ]; then
|
|||||||
else
|
else
|
||||||
CC=cc
|
CC=cc
|
||||||
fi
|
fi
|
||||||
|
GCCVER=${GCCVER:-0}
|
||||||
|
|
||||||
if [ "$SYSTEM" = "SunOS" ]; then
|
if [ "$SYSTEM" = "SunOS" ]; then
|
||||||
|
if [ $GCCVER -ge 30 ]; then
|
||||||
|
# 64-bit ABI isn't officially supported in gcc 3.0, but it appears
|
||||||
|
# to be working, at the very least 'make test' passes...
|
||||||
|
if gcc -v -E -x c /dev/null 2>&1 | grep __arch64__ > /dev/null; then
|
||||||
|
GCC_ARCH="-m64"
|
||||||
|
else
|
||||||
|
GCC_ARCH="-m32"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
# check for WorkShop C, expected output is "cc: blah-blah C x.x"
|
# check for WorkShop C, expected output is "cc: blah-blah C x.x"
|
||||||
CCVER=`(cc -V 2>&1) 2>/dev/null | \
|
CCVER=`(cc -V 2>&1) 2>/dev/null | \
|
||||||
egrep -e '^cc: .* C [0-9]\.[0-9]' | \
|
egrep -e '^cc: .* C [0-9]\.[0-9]' | \
|
||||||
@@ -377,7 +442,6 @@ if [ "${SYSTEM}-${MACHINE}" = "Linux-alpha" ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
GCCVER=${GCCVER:-0}
|
|
||||||
CCVER=${CCVER:-0}
|
CCVER=${CCVER:-0}
|
||||||
|
|
||||||
# read the output of the embedded GuessOS
|
# read the output of the embedded GuessOS
|
||||||
@@ -410,9 +474,9 @@ case "$GUESSOS" in
|
|||||||
mips4-sgi-irix64)
|
mips4-sgi-irix64)
|
||||||
echo "WARNING! If you wish to build 64-bit library, then you have to"
|
echo "WARNING! If you wish to build 64-bit library, then you have to"
|
||||||
echo " invoke './Configure irix64-mips4-$CC' *manually*."
|
echo " invoke './Configure irix64-mips4-$CC' *manually*."
|
||||||
echo " Type return if you want to continue, Ctrl-C to abort."
|
|
||||||
if [ "$TEST" = "false" ]; then
|
if [ "$TEST" = "false" ]; then
|
||||||
read waste < /dev/tty
|
echo " You have about 5 seconds to press Ctrl-C to abort."
|
||||||
|
(stty -icanon min 0 time 50; read waste) < /dev/tty
|
||||||
fi
|
fi
|
||||||
CPU=`(hinv -t cpu) 2>/dev/null | sed 's/^CPU:[^R]*R\([0-9]*\).*/\1/'`
|
CPU=`(hinv -t cpu) 2>/dev/null | sed 's/^CPU:[^R]*R\([0-9]*\).*/\1/'`
|
||||||
CPU=${CPU:-0}
|
CPU=${CPU:-0}
|
||||||
@@ -453,6 +517,10 @@ EOF
|
|||||||
${CC} -o dummy dummy.c && OUT=`./dummy ${MACHINE}`
|
${CC} -o dummy dummy.c && OUT=`./dummy ${MACHINE}`
|
||||||
rm dummy dummy.c
|
rm dummy dummy.c
|
||||||
;;
|
;;
|
||||||
|
ppc64-*-linux2)
|
||||||
|
#Use the standard target for PPC architecture until we create a
|
||||||
|
#special one for the 64bit architecture.
|
||||||
|
OUT="linux-ppc" ;;
|
||||||
ppc-*-linux2) OUT="linux-ppc" ;;
|
ppc-*-linux2) OUT="linux-ppc" ;;
|
||||||
m68k-*-linux*) OUT="linux-m68k" ;;
|
m68k-*-linux*) OUT="linux-m68k" ;;
|
||||||
ia64-*-linux?) OUT="linux-ia64" ;;
|
ia64-*-linux?) OUT="linux-ia64" ;;
|
||||||
@@ -475,21 +543,76 @@ EOF
|
|||||||
sun4d) OUT="linux-sparcv8" ;;
|
sun4d) OUT="linux-sparcv8" ;;
|
||||||
*) OUT="linux-sparcv7" ;;
|
*) OUT="linux-sparcv7" ;;
|
||||||
esac ;;
|
esac ;;
|
||||||
|
parisc-*-linux2)
|
||||||
|
CPUARCH=`awk '/cpu family/{print substr($5,1,3)}' /proc/cpuinfo`
|
||||||
|
CPUSCHEDULE=`awk '/^cpu.[ ]: PA/{print substr($3,3)}' /proc/cpuinfo`
|
||||||
|
|
||||||
|
# ??TODO ?? Model transformations
|
||||||
|
# 0. CPU Architecture for the 1.1 processor has letter suffixes. We strip that off
|
||||||
|
# assuming no further arch. identification will ever be used by GCC.
|
||||||
|
# 1. I'm most concerned about whether is a 7300LC is closer to a 7100 versus a 7100LC.
|
||||||
|
# 2. The variant 64-bit processors cause concern should GCC support explicit schedulers
|
||||||
|
# for these chips in the future.
|
||||||
|
# PA7300LC -> 7100LC (1.1)
|
||||||
|
# PA8200 -> 8000 (2.0)
|
||||||
|
# PA8500 -> 8000 (2.0)
|
||||||
|
# PA8600 -> 8000 (2.0)
|
||||||
|
|
||||||
|
CPUSCHEDULE=`echo $CPUSCHEDULE|sed -e 's/7300LC/7100LC/' -e 's/8?00/8000/'`
|
||||||
|
# Finish Model transformations
|
||||||
|
|
||||||
|
options="$options -mschedule=$CPUSCHEDULE -march=$CPUARCH"
|
||||||
|
OUT="linux-parisc" ;;
|
||||||
arm*-*-linux2) OUT="linux-elf-arm" ;;
|
arm*-*-linux2) OUT="linux-elf-arm" ;;
|
||||||
s390-*-linux2) OUT="linux-s390" ;;
|
s390-*-linux2) OUT="linux-s390" ;;
|
||||||
*-*-linux2) OUT="linux-elf" ;;
|
s390x-*-linux?) OUT="linux-s390x" ;;
|
||||||
|
*-*-linux2) OUT="linux-elf"
|
||||||
|
if [ "$GCCVER" -gt 28 ]; then
|
||||||
|
if grep '^model.*Pentium' /proc/cpuinfo >/dev/null ; then
|
||||||
|
OUT="linux-pentium"
|
||||||
|
fi
|
||||||
|
if grep '^model.*Pentium Pro' /proc/cpuinfo >/dev/null ; then
|
||||||
|
OUT="linux-ppro"
|
||||||
|
fi
|
||||||
|
if grep '^model.*K6' /proc/cpuinfo >/dev/null ; then
|
||||||
|
OUT="linux-k6"
|
||||||
|
fi
|
||||||
|
fi ;;
|
||||||
*-*-linux1) OUT="linux-aout" ;;
|
*-*-linux1) OUT="linux-aout" ;;
|
||||||
sun4u*-*-solaris2)
|
sun4u*-*-solaris2)
|
||||||
|
OUT="solaris-sparcv9-$CC"
|
||||||
ISA64=`(isalist) 2>/dev/null | grep sparcv9`
|
ISA64=`(isalist) 2>/dev/null | grep sparcv9`
|
||||||
if [ "$ISA64" != "" -a "$CC" = "cc" -a $CCVER -ge 50 ]; then
|
if [ "$ISA64" != "" ]; then
|
||||||
|
if [ "$CC" = "cc" -a $CCVER -ge 50 ]; then
|
||||||
echo "WARNING! If you wish to build 64-bit library, then you have to"
|
echo "WARNING! If you wish to build 64-bit library, then you have to"
|
||||||
echo " invoke './Configure solaris64-sparcv9-cc' *manually*."
|
echo " invoke './Configure solaris64-sparcv9-cc' *manually*."
|
||||||
echo " Type return if you want to continue, Ctrl-C to abort."
|
|
||||||
if [ "$TEST" = "false" ]; then
|
if [ "$TEST" = "false" ]; then
|
||||||
read waste < /dev/tty
|
echo " You have about 5 seconds to press Ctrl-C to abort."
|
||||||
|
(stty -icanon min 0 time 50; read waste) < /dev/tty
|
||||||
fi
|
fi
|
||||||
|
elif [ "$CC" = "gcc" -a "$GCC_ARCH" = "-m64" ]; then
|
||||||
|
# $GCC_ARCH denotes default ABI chosen by compiler driver
|
||||||
|
# (first one found on the $PATH). I assume that user
|
||||||
|
# expects certain consistency with the rest of his builds
|
||||||
|
# and therefore switch over to 64-bit. <appro>
|
||||||
|
OUT="solaris64-sparcv9-gcc"
|
||||||
|
echo "WARNING! If you wish to build 32-bit library, then you have to"
|
||||||
|
echo " invoke './Configure solaris-sparcv9-gcc' *manually*."
|
||||||
|
if [ "$TEST" = "false" ]; then
|
||||||
|
echo " You have about 5 seconds to press Ctrl-C to abort."
|
||||||
|
(stty -icanon min 0 time 50; read waste) < /dev/tty
|
||||||
|
fi
|
||||||
|
elif [ "$GCC_ARCH" = "-m32" ]; then
|
||||||
|
echo "NOTICE! If you *know* that your GNU C supports 64-bit/V9 ABI"
|
||||||
|
echo " and wish to build 64-bit library, then you have to"
|
||||||
|
echo " invoke './Configure solaris64-sparcv9-gcc' *manually*."
|
||||||
|
if [ "$TEST" = "false" ]; then
|
||||||
|
echo " You have about 5 seconds to press Ctrl-C to abort."
|
||||||
|
(stty -icanon min 0 time 50; read waste) < /dev/tty
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
OUT="solaris-sparcv9-$CC" ;;
|
;;
|
||||||
sun4m-*-solaris2) OUT="solaris-sparcv8-$CC" ;;
|
sun4m-*-solaris2) OUT="solaris-sparcv8-$CC" ;;
|
||||||
sun4d-*-solaris2) OUT="solaris-sparcv8-$CC" ;;
|
sun4d-*-solaris2) OUT="solaris-sparcv8-$CC" ;;
|
||||||
sun4*-*-solaris2) OUT="solaris-sparcv7-$CC" ;;
|
sun4*-*-solaris2) OUT="solaris-sparcv7-$CC" ;;
|
||||||
@@ -501,28 +624,83 @@ EOF
|
|||||||
*86*-*-netbsd) OUT="NetBSD-x86" ;;
|
*86*-*-netbsd) OUT="NetBSD-x86" ;;
|
||||||
sun3*-*-netbsd) OUT="NetBSD-m68" ;;
|
sun3*-*-netbsd) OUT="NetBSD-m68" ;;
|
||||||
*-*-netbsd) OUT="NetBSD-sparc" ;;
|
*-*-netbsd) OUT="NetBSD-sparc" ;;
|
||||||
*86*-*-openbsd) OUT="OpenBSD-x86" ;;
|
|
||||||
alpha*-*-openbsd) OUT="OpenBSD-alpha" ;;
|
alpha*-*-openbsd) OUT="OpenBSD-alpha" ;;
|
||||||
|
*86*-*-openbsd) OUT="OpenBSD-i386" ;;
|
||||||
|
m68k*-*-openbsd) OUT="OpenBSD-m68k" ;;
|
||||||
|
m88k*-*-openbsd) OUT="OpenBSD-m88k" ;;
|
||||||
|
mips*-*-openbsd) OUT="OpenBSD-mips" ;;
|
||||||
pmax*-*-openbsd) OUT="OpenBSD-mips" ;;
|
pmax*-*-openbsd) OUT="OpenBSD-mips" ;;
|
||||||
|
powerpc*-*-openbsd) OUT="OpenBSD-powerpc" ;;
|
||||||
|
sparc64*-*-openbsd) OUT="OpenBSD-sparc64" ;;
|
||||||
|
sparc*-*-openbsd) OUT="OpenBSD-sparc" ;;
|
||||||
|
vax*-*-openbsd) OUT="OpenBSD-vax" ;;
|
||||||
|
hppa*-*-openbsd) OUT="OpenBSD-hppa" ;;
|
||||||
*-*-openbsd) OUT="OpenBSD" ;;
|
*-*-openbsd) OUT="OpenBSD" ;;
|
||||||
*86*-*-bsdi4) OUT="bsdi-elf-gcc" ;;
|
*86*-*-bsdi4) OUT="bsdi-elf-gcc" ;;
|
||||||
*-*-osf) OUT="alpha-cc" ;;
|
*-*-osf) OUT="alphaold-cc" ;;
|
||||||
|
*-*-tru64) OUT="alpha-cc" ;;
|
||||||
|
*-*-OpenUNIX*)
|
||||||
|
if [ "$CC" = "gcc" ]; then
|
||||||
|
OUT="OpenUNIX-8-gcc"
|
||||||
|
else
|
||||||
|
OUT="OpenUNIX-8"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
*-*-unixware7) OUT="unixware-7" ;;
|
*-*-unixware7) OUT="unixware-7" ;;
|
||||||
*-*-UnixWare7) OUT="unixware-7" ;;
|
*-*-UnixWare7) OUT="unixware-7" ;;
|
||||||
*-*-Unixware7) OUT="unixware-7" ;;
|
*-*-Unixware7) OUT="unixware-7" ;;
|
||||||
*-*-unixware[1-2]*) OUT="unixware-2.0" ;;
|
*-*-unixware20*) OUT="unixware-2.0" ;;
|
||||||
*-*-UnixWare[1-2]*) OUT="unixware-2.0" ;;
|
*-*-unixware21*) OUT="unixware-2.1" ;;
|
||||||
*-*-Unixware[1-2]*) OUT="unixware-2.0" ;;
|
*-*-UnixWare20*) OUT="unixware-2.0" ;;
|
||||||
|
*-*-UnixWare21*) OUT="unixware-2.1" ;;
|
||||||
|
*-*-Unixware20*) OUT="unixware-2.0" ;;
|
||||||
|
*-*-Unixware21*) OUT="unixware-2.1" ;;
|
||||||
BS2000-siemens-sysv4) OUT="BS2000-OSD" ;;
|
BS2000-siemens-sysv4) OUT="BS2000-OSD" ;;
|
||||||
RM*-siemens-sysv4) OUT="ReliantUNIX" ;;
|
RM*-siemens-sysv4) OUT="ReliantUNIX" ;;
|
||||||
*-siemens-sysv4) OUT="SINIX" ;;
|
*-siemens-sysv4) OUT="SINIX" ;;
|
||||||
*-hpux1*) OUT="hpux-parisc-$CC"
|
*-hpux1*)
|
||||||
options="$options -D_REENTRANT" ;;
|
OUT="hpux-parisc-$CC"
|
||||||
|
KERNEL_BITS=`(getconf KERNEL_BITS) 2>/dev/null`
|
||||||
|
KERNEL_BITS=${KERNEL_BITS:-32}
|
||||||
|
CPU_VERSION=`(getconf CPU_VERSION) 2>/dev/null`
|
||||||
|
CPU_VERSION=${CPU_VERSION:-0}
|
||||||
|
# See <sys/unistd.h> for further info on CPU_VERSION.
|
||||||
|
if [ $CPU_VERSION -ge 768 ]; then # IA-64 CPU
|
||||||
|
echo "NOTICE! 64-bit is the only ABI currently operational on HP-UXi."
|
||||||
|
echo " Post request to openssl-dev@openssl.org for 32-bit support."
|
||||||
|
if [ "$TEST" = "false" ]; then
|
||||||
|
(stty -icanon min 0 time 50; read waste) < /dev/tty
|
||||||
|
fi
|
||||||
|
OUT="hpux64-ia64-cc"
|
||||||
|
elif [ $CPU_VERSION -ge 532 ]; then # PA-RISC 2.x CPU
|
||||||
|
if [ "$CC" = "cc" ]; then
|
||||||
|
OUT="hpux-parisc2-cc" # can't we have hpux-parisc2-gcc?
|
||||||
|
fi
|
||||||
|
if [ $KERNEL_BITS -eq 64 -a "$CC" = "cc" ]; then
|
||||||
|
echo "WARNING! If you wish to build 64-bit library then you have to"
|
||||||
|
echo " invoke './Configure hpux64-parisc2-cc' *manually*."
|
||||||
|
if [ "$TEST" = "false" ]; then
|
||||||
|
echo " You have about 5 seconds to press Ctrl-C to abort."
|
||||||
|
(stty -icanon min 0 time 50; read waste) < /dev/tty
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
elif [ $CPU_VERSION -ge 528 ]; then # PA-RISC 1.1+ CPU
|
||||||
|
:
|
||||||
|
elif [ $CPU_VERSION -ge 523 ]; then # PA-RISC 1.0 CPU
|
||||||
|
:
|
||||||
|
else # Motorola(?) CPU
|
||||||
|
OUT="hpux-$CC"
|
||||||
|
fi
|
||||||
|
options="$options -D_REENTRANT" ;;
|
||||||
*-hpux) OUT="hpux-parisc-$CC" ;;
|
*-hpux) OUT="hpux-parisc-$CC" ;;
|
||||||
# these are all covered by the catchall below
|
# these are all covered by the catchall below
|
||||||
# *-aix) OUT="aix-$CC" ;;
|
# *-aix) OUT="aix-$CC" ;;
|
||||||
# *-dgux) OUT="dgux" ;;
|
# *-dgux) OUT="dgux" ;;
|
||||||
mips-sony-newsos4) OUT="newsos4-gcc" ;;
|
mips-sony-newsos4) OUT="newsos4-gcc" ;;
|
||||||
|
*-*-cygwin_pre1.3) OUT="Cygwin-pre1.3" ;;
|
||||||
|
*-*-cygwin) OUT="Cygwin" ;;
|
||||||
|
t3e-cray-unicosmk) OUT="cray-t3e" ;;
|
||||||
|
j90-cray-unicos) OUT="cray-j90" ;;
|
||||||
*) OUT=`echo $GUESSOS | awk -F- '{print $3}'`;;
|
*) OUT=`echo $GUESSOS | awk -F- '{print $3}'`;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@@ -557,7 +735,7 @@ case "$GUESSOS" in
|
|||||||
i386-*) options="$options 386" ;;
|
i386-*) options="$options 386" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
for i in bf cast des dh dsa ec hmac md2 md5 mdc2 rc2 rc4 rc5 ripemd rsa sha
|
for i in bf cast des dh dsa ec hmac idea md2 md5 mdc2 rc2 rc4 rc5 rijndael ripemd rsa sha
|
||||||
do
|
do
|
||||||
if [ ! -d crypto/$i ]
|
if [ ! -d crypto/$i ]
|
||||||
then
|
then
|
||||||
|
|||||||
@@ -28,34 +28,36 @@ LIBS=
|
|||||||
|
|
||||||
SDIRS= md2 md5 sha mdc2 hmac ripemd \
|
SDIRS= md2 md5 sha mdc2 hmac ripemd \
|
||||||
des rc2 rc4 rc5 idea bf cast \
|
des rc2 rc4 rc5 idea bf cast \
|
||||||
bn ec rsa dsa dh dso engine rijndael \
|
bn ec rsa dsa ecdsa dh dso engine aes \
|
||||||
buffer bio stack lhash rand err objects \
|
buffer bio stack lhash rand err objects \
|
||||||
evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp
|
evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp ui krb5
|
||||||
|
|
||||||
GENERAL=Makefile README crypto-lib.com install.com
|
GENERAL=Makefile README crypto-lib.com install.com
|
||||||
|
|
||||||
LIB= $(TOP)/libcrypto.a
|
LIB= $(TOP)/libcrypto.a
|
||||||
LIBSRC= cryptlib.c mem.c mem_dbg.c cversion.c ex_data.c tmdiff.c cpt_err.c ebcdic.c uid.c
|
SHARED_LIB= libcrypto$(SHLIB_EXT)
|
||||||
LIBOBJ= cryptlib.o mem.o mem_dbg.o cversion.o ex_data.o tmdiff.o cpt_err.o ebcdic.o uid.o
|
LIBSRC= cryptlib.c mem.c mem_dbg.c cversion.c ex_data.c tmdiff.c cpt_err.c ebcdic.c uid.c o_time.c
|
||||||
|
LIBOBJ= cryptlib.o mem.o mem_dbg.o cversion.o ex_data.o tmdiff.o cpt_err.o ebcdic.o uid.o o_time.o
|
||||||
|
|
||||||
SRC= $(LIBSRC)
|
SRC= $(LIBSRC)
|
||||||
|
|
||||||
EXHEADER= crypto.h tmdiff.h opensslv.h opensslconf.h ebcdic.h symhacks.h
|
EXHEADER= crypto.h tmdiff.h opensslv.h opensslconf.h ebcdic.h symhacks.h \
|
||||||
HEADER= cryptlib.h buildinf.h md32_common.h $(EXHEADER)
|
ossl_typ.h
|
||||||
|
HEADER= cryptlib.h buildinf.h md32_common.h o_time.h $(EXHEADER)
|
||||||
|
|
||||||
ALL= $(GENERAL) $(SRC) $(HEADER)
|
ALL= $(GENERAL) $(SRC) $(HEADER)
|
||||||
|
|
||||||
top:
|
top:
|
||||||
@(cd ..; $(MAKE) DIRS=$(DIR) all)
|
@(cd ..; $(MAKE) DIRS=$(DIR) all)
|
||||||
|
|
||||||
all: buildinf.h lib subdirs
|
all: buildinf.h lib subdirs shared
|
||||||
|
|
||||||
buildinf.h: ../Makefile.ssl
|
buildinf.h: ../Makefile.ssl
|
||||||
( echo "#ifndef MK1MF_BUILD"; \
|
( echo "#ifndef MK1MF_BUILD"; \
|
||||||
echo " /* auto-generated by crypto/Makefile.ssl for crypto/cversion.c */"; \
|
echo " /* auto-generated by crypto/Makefile.ssl for crypto/cversion.c */"; \
|
||||||
echo " #define CFLAGS \"$(CC) $(CFLAG)\""; \
|
echo " #define CFLAGS \"$(CC) $(CFLAG)\""; \
|
||||||
echo " #define PLATFORM \"$(PLATFORM)\""; \
|
echo " #define PLATFORM \"$(PLATFORM)\""; \
|
||||||
echo " #define DATE \"`date`\""; \
|
echo " #define DATE \"`LC_ALL=C LC_TIME=C date`\""; \
|
||||||
echo "#endif" ) >buildinf.h
|
echo "#endif" ) >buildinf.h
|
||||||
|
|
||||||
testapps:
|
testapps:
|
||||||
@@ -94,6 +96,11 @@ lib: $(LIBOBJ)
|
|||||||
$(RANLIB) $(LIB) || echo Never mind.
|
$(RANLIB) $(LIB) || echo Never mind.
|
||||||
@touch lib
|
@touch lib
|
||||||
|
|
||||||
|
shared:
|
||||||
|
if [ -n "$(SHARED_LIBS)" ]; then \
|
||||||
|
(cd ..; make $(SHARED_LIB)); \
|
||||||
|
fi
|
||||||
|
|
||||||
libs:
|
libs:
|
||||||
@for i in $(SDIRS) ;\
|
@for i in $(SDIRS) ;\
|
||||||
do \
|
do \
|
||||||
@@ -192,6 +199,8 @@ mem_dbg.o: ../include/openssl/err.h ../include/openssl/lhash.h
|
|||||||
mem_dbg.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
|
mem_dbg.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
|
||||||
mem_dbg.o: ../include/openssl/safestack.h ../include/openssl/stack.h
|
mem_dbg.o: ../include/openssl/safestack.h ../include/openssl/stack.h
|
||||||
mem_dbg.o: ../include/openssl/symhacks.h cryptlib.h mem_dbg.c
|
mem_dbg.o: ../include/openssl/symhacks.h cryptlib.h mem_dbg.c
|
||||||
|
o_time.o: ../include/openssl/e_os2.h ../include/openssl/opensslconf.h o_time.c
|
||||||
|
o_time.o: o_time.h
|
||||||
tmdiff.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
|
tmdiff.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
|
||||||
tmdiff.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
|
tmdiff.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
|
||||||
tmdiff.o: ../include/openssl/err.h ../include/openssl/lhash.h
|
tmdiff.o: ../include/openssl/err.h ../include/openssl/lhash.h
|
||||||
|
|||||||
2
crypto/aes/.cvsignore
Normal file
2
crypto/aes/.cvsignore
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
lib
|
||||||
|
Makefile.save
|
||||||
103
crypto/aes/Makefile.ssl
Normal file
103
crypto/aes/Makefile.ssl
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
#
|
||||||
|
# crypto/aes/Makefile
|
||||||
|
#
|
||||||
|
|
||||||
|
DIR= aes
|
||||||
|
TOP= ../..
|
||||||
|
CC= cc
|
||||||
|
CPP= $(CC) -E
|
||||||
|
INCLUDES=
|
||||||
|
CFLAG=-g
|
||||||
|
INSTALL_PREFIX=
|
||||||
|
OPENSSLDIR= /usr/local/ssl
|
||||||
|
INSTALLTOP= /usr/local/ssl
|
||||||
|
MAKE= make -f Makefile.ssl
|
||||||
|
MAKEDEPPROG= makedepend
|
||||||
|
MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
|
||||||
|
MAKEFILE= Makefile.ssl
|
||||||
|
AR= ar r
|
||||||
|
|
||||||
|
# CFLAGS= -mpentiumpro $(INCLUDES) $(CFLAG) -O3 -fexpensive-optimizations -funroll-loops -fforce-addr
|
||||||
|
CFLAGS= $(INCLUDES) $(CFLAG)
|
||||||
|
|
||||||
|
GENERAL=Makefile
|
||||||
|
#TEST=aestest.c
|
||||||
|
TEST=
|
||||||
|
APPS=
|
||||||
|
|
||||||
|
LIB=$(TOP)/libcrypto.a
|
||||||
|
LIBSRC=aes_core.c aes_misc.c aes_ecb.c aes_cbc.c aes_cfb.c aes_ofb.c aes_ctr.c
|
||||||
|
LIBOBJ=aes_core.o aes_misc.o aes_ecb.o aes_cbc.o aes_cfb.o aes_ofb.o aes_ctr.o
|
||||||
|
|
||||||
|
SRC= $(LIBSRC)
|
||||||
|
|
||||||
|
EXHEADER= aes.h
|
||||||
|
HEADER= aes_locl.h $(EXHEADER)
|
||||||
|
|
||||||
|
ALL= $(GENERAL) $(SRC) $(HEADER)
|
||||||
|
|
||||||
|
top:
|
||||||
|
(cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
|
||||||
|
|
||||||
|
all: lib
|
||||||
|
|
||||||
|
lib: $(LIBOBJ)
|
||||||
|
$(AR) $(LIB) $(LIBOBJ)
|
||||||
|
$(RANLIB) $(LIB) || echo Never mind.
|
||||||
|
@touch lib
|
||||||
|
|
||||||
|
$(LIBOBJ): $(LIBSRC)
|
||||||
|
|
||||||
|
files:
|
||||||
|
$(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
|
||||||
|
|
||||||
|
links:
|
||||||
|
@$(TOP)/util/point.sh Makefile.ssl Makefile
|
||||||
|
@$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
|
||||||
|
@$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
|
||||||
|
@$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
|
||||||
|
|
||||||
|
install: installs
|
||||||
|
|
||||||
|
installs:
|
||||||
|
@for i in $(EXHEADER) ; \
|
||||||
|
do \
|
||||||
|
(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
|
||||||
|
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
|
||||||
|
done;
|
||||||
|
|
||||||
|
tags:
|
||||||
|
ctags $(SRC)
|
||||||
|
|
||||||
|
tests:
|
||||||
|
|
||||||
|
lint:
|
||||||
|
lint -DLINT $(INCLUDES) $(SRC)>fluff
|
||||||
|
|
||||||
|
depend:
|
||||||
|
$(MAKEDEPEND) $(INCLUDES) $(DEPFLAG) $(PROGS) $(LIBSRC)
|
||||||
|
|
||||||
|
dclean:
|
||||||
|
$(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
|
||||||
|
mv -f Makefile.new $(MAKEFILE)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
|
||||||
|
|
||||||
|
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||||
|
|
||||||
|
aes_cbc.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h
|
||||||
|
aes_cbc.o: ../../include/openssl/opensslconf.h aes_cbc.c aes_locl.h
|
||||||
|
aes_cfb.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h
|
||||||
|
aes_cfb.o: ../../include/openssl/opensslconf.h aes_cfb.c aes_locl.h
|
||||||
|
aes_core.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h
|
||||||
|
aes_core.o: ../../include/openssl/opensslconf.h aes_core.c aes_locl.h
|
||||||
|
aes_ctr.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h
|
||||||
|
aes_ctr.o: ../../include/openssl/opensslconf.h aes_ctr.c aes_locl.h
|
||||||
|
aes_ecb.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h
|
||||||
|
aes_ecb.o: ../../include/openssl/opensslconf.h aes_ecb.c aes_locl.h
|
||||||
|
aes_misc.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h
|
||||||
|
aes_misc.o: ../../include/openssl/opensslconf.h
|
||||||
|
aes_misc.o: ../../include/openssl/opensslv.h aes_locl.h aes_misc.c
|
||||||
|
aes_ofb.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h
|
||||||
|
aes_ofb.o: ../../include/openssl/opensslconf.h aes_locl.h aes_ofb.c
|
||||||
3
crypto/aes/README
Normal file
3
crypto/aes/README
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
This is an OpenSSL-compatible version of AES (also called Rijndael).
|
||||||
|
aes_core.c is basically the same as rijndael-alg-fst.c but with an
|
||||||
|
API that looks like the rest of the OpenSSL symmetric cipher suite.
|
||||||
109
crypto/aes/aes.h
Normal file
109
crypto/aes/aes.h
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
/* crypto/aes/aes.h -*- mode:C; c-file-style: "eay" -*- */
|
||||||
|
/* ====================================================================
|
||||||
|
* Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in
|
||||||
|
* the documentation and/or other materials provided with the
|
||||||
|
* distribution.
|
||||||
|
*
|
||||||
|
* 3. All advertising materials mentioning features or use of this
|
||||||
|
* software must display the following acknowledgment:
|
||||||
|
* "This product includes software developed by the OpenSSL Project
|
||||||
|
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
||||||
|
*
|
||||||
|
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||||
|
* endorse or promote products derived from this software without
|
||||||
|
* prior written permission. For written permission, please contact
|
||||||
|
* openssl-core@openssl.org.
|
||||||
|
*
|
||||||
|
* 5. Products derived from this software may not be called "OpenSSL"
|
||||||
|
* nor may "OpenSSL" appear in their names without prior written
|
||||||
|
* permission of the OpenSSL Project.
|
||||||
|
*
|
||||||
|
* 6. Redistributions of any form whatsoever must retain the following
|
||||||
|
* acknowledgment:
|
||||||
|
* "This product includes software developed by the OpenSSL Project
|
||||||
|
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||||
|
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||||
|
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||||
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||||
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
* ====================================================================
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HEADER_AES_H
|
||||||
|
#define HEADER_AES_H
|
||||||
|
|
||||||
|
#ifdef OPENSSL_NO_AES
|
||||||
|
#error AES is disabled.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static const int AES_DECRYPT = 0;
|
||||||
|
static const int AES_ENCRYPT = 1;
|
||||||
|
/* Because array size can't be a const in C, the following two are macros.
|
||||||
|
Both sizes are in bytes. */
|
||||||
|
#define AES_MAXNR 14
|
||||||
|
#define AES_BLOCK_SIZE 16
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* This should be a hidden type, but EVP requires that the size be known */
|
||||||
|
struct aes_key_st {
|
||||||
|
unsigned long rd_key[4 *(AES_MAXNR + 1)];
|
||||||
|
int rounds;
|
||||||
|
};
|
||||||
|
typedef struct aes_key_st AES_KEY;
|
||||||
|
|
||||||
|
const char *AES_options(void);
|
||||||
|
|
||||||
|
int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
|
||||||
|
AES_KEY *key);
|
||||||
|
int AES_set_decrypt_key(const unsigned char *userKey, const int bits,
|
||||||
|
AES_KEY *key);
|
||||||
|
|
||||||
|
void AES_encrypt(const unsigned char *in, unsigned char *out,
|
||||||
|
const AES_KEY *key);
|
||||||
|
void AES_decrypt(const unsigned char *in, unsigned char *out,
|
||||||
|
const AES_KEY *key);
|
||||||
|
|
||||||
|
void AES_ecb_encrypt(const unsigned char *in, unsigned char *out,
|
||||||
|
const AES_KEY *key, const int enc);
|
||||||
|
void AES_cbc_encrypt(const unsigned char *in, unsigned char *out,
|
||||||
|
const unsigned long length, const AES_KEY *key,
|
||||||
|
unsigned char *ivec, const int enc);
|
||||||
|
void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out,
|
||||||
|
const unsigned long length, const AES_KEY *key,
|
||||||
|
unsigned char *ivec, int *num, const int enc);
|
||||||
|
void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out,
|
||||||
|
const unsigned long length, const AES_KEY *key,
|
||||||
|
unsigned char *ivec, int *num);
|
||||||
|
void AES_ctr128_encrypt(const unsigned char *in, unsigned char *out,
|
||||||
|
const unsigned long length, const AES_KEY *key,
|
||||||
|
unsigned char *counter, unsigned int *num);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* !HEADER_AES_H */
|
||||||
89
crypto/aes/aes_cbc.c
Normal file
89
crypto/aes/aes_cbc.c
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
/* crypto/aes/aes_cbc.c -*- mode:C; c-file-style: "eay" -*- */
|
||||||
|
/* ====================================================================
|
||||||
|
* Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in
|
||||||
|
* the documentation and/or other materials provided with the
|
||||||
|
* distribution.
|
||||||
|
*
|
||||||
|
* 3. All advertising materials mentioning features or use of this
|
||||||
|
* software must display the following acknowledgment:
|
||||||
|
* "This product includes software developed by the OpenSSL Project
|
||||||
|
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
||||||
|
*
|
||||||
|
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||||
|
* endorse or promote products derived from this software without
|
||||||
|
* prior written permission. For written permission, please contact
|
||||||
|
* openssl-core@openssl.org.
|
||||||
|
*
|
||||||
|
* 5. Products derived from this software may not be called "OpenSSL"
|
||||||
|
* nor may "OpenSSL" appear in their names without prior written
|
||||||
|
* permission of the OpenSSL Project.
|
||||||
|
*
|
||||||
|
* 6. Redistributions of any form whatsoever must retain the following
|
||||||
|
* acknowledgment:
|
||||||
|
* "This product includes software developed by the OpenSSL Project
|
||||||
|
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||||
|
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||||
|
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||||
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||||
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
* ====================================================================
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
#include <openssl/aes.h>
|
||||||
|
#include "aes_locl.h"
|
||||||
|
|
||||||
|
void AES_cbc_encrypt(const unsigned char *in, unsigned char *out,
|
||||||
|
const unsigned long length, const AES_KEY *key,
|
||||||
|
unsigned char *ivec, const int enc) {
|
||||||
|
|
||||||
|
int n;
|
||||||
|
unsigned long len = length;
|
||||||
|
unsigned char tmp[16];
|
||||||
|
|
||||||
|
assert(in && out && key && ivec);
|
||||||
|
assert(length % AES_BLOCK_SIZE == 0);
|
||||||
|
assert((AES_ENCRYPT == enc)||(AES_DECRYPT == enc));
|
||||||
|
|
||||||
|
if (AES_ENCRYPT == enc)
|
||||||
|
while (len > 0) {
|
||||||
|
for(n=0; n < 16; ++n)
|
||||||
|
tmp[n] = in[n] ^ ivec[n];
|
||||||
|
AES_encrypt(tmp, out, key);
|
||||||
|
memcpy(ivec, out, 16);
|
||||||
|
len -= 16;
|
||||||
|
in += 16;
|
||||||
|
out += 16;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
while (len > 0) {
|
||||||
|
memcpy(tmp, in, 16);
|
||||||
|
AES_decrypt(in, out, key);
|
||||||
|
for(n=0; n < 16; ++n)
|
||||||
|
out[n] ^= ivec[n];
|
||||||
|
memcpy(ivec, tmp, 16);
|
||||||
|
len -= 16;
|
||||||
|
in += 16;
|
||||||
|
out += 16;
|
||||||
|
}
|
||||||
|
}
|
||||||
151
crypto/aes/aes_cfb.c
Normal file
151
crypto/aes/aes_cfb.c
Normal file
@@ -0,0 +1,151 @@
|
|||||||
|
/* crypto/aes/aes_cfb.c -*- mode:C; c-file-style: "eay" -*- */
|
||||||
|
/* ====================================================================
|
||||||
|
* Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in
|
||||||
|
* the documentation and/or other materials provided with the
|
||||||
|
* distribution.
|
||||||
|
*
|
||||||
|
* 3. All advertising materials mentioning features or use of this
|
||||||
|
* software must display the following acknowledgment:
|
||||||
|
* "This product includes software developed by the OpenSSL Project
|
||||||
|
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
||||||
|
*
|
||||||
|
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||||
|
* endorse or promote products derived from this software without
|
||||||
|
* prior written permission. For written permission, please contact
|
||||||
|
* openssl-core@openssl.org.
|
||||||
|
*
|
||||||
|
* 5. Products derived from this software may not be called "OpenSSL"
|
||||||
|
* nor may "OpenSSL" appear in their names without prior written
|
||||||
|
* permission of the OpenSSL Project.
|
||||||
|
*
|
||||||
|
* 6. Redistributions of any form whatsoever must retain the following
|
||||||
|
* acknowledgment:
|
||||||
|
* "This product includes software developed by the OpenSSL Project
|
||||||
|
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||||
|
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||||
|
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||||
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||||
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
* ====================================================================
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This package is an SSL implementation written
|
||||||
|
* by Eric Young (eay@cryptsoft.com).
|
||||||
|
* The implementation was written so as to conform with Netscapes SSL.
|
||||||
|
*
|
||||||
|
* This library is free for commercial and non-commercial use as long as
|
||||||
|
* the following conditions are aheared to. The following conditions
|
||||||
|
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||||
|
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||||
|
* included with this distribution is covered by the same copyright terms
|
||||||
|
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||||
|
*
|
||||||
|
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||||
|
* the code are not to be removed.
|
||||||
|
* If this package is used in a product, Eric Young should be given attribution
|
||||||
|
* as the author of the parts of the library used.
|
||||||
|
* This can be in the form of a textual message at program startup or
|
||||||
|
* in documentation (online or textual) provided with the package.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* 3. All advertising materials mentioning features or use of this software
|
||||||
|
* must display the following acknowledgement:
|
||||||
|
* "This product includes cryptographic software written by
|
||||||
|
* Eric Young (eay@cryptsoft.com)"
|
||||||
|
* The word 'cryptographic' can be left out if the rouines from the library
|
||||||
|
* being used are not cryptographic related :-).
|
||||||
|
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||||
|
* the apps directory (application code) you must include an acknowledgement:
|
||||||
|
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* The licence and distribution terms for any publically available version or
|
||||||
|
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||||
|
* copied and put under another distribution licence
|
||||||
|
* [including the GNU Public Licence.]
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
#include <openssl/aes.h>
|
||||||
|
#include "aes_locl.h"
|
||||||
|
|
||||||
|
/* The input and output encrypted as though 128bit cfb mode is being
|
||||||
|
* used. The extra state information to record how much of the
|
||||||
|
* 128bit block we have used is contained in *num;
|
||||||
|
*/
|
||||||
|
|
||||||
|
void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out,
|
||||||
|
const unsigned long length, const AES_KEY *key,
|
||||||
|
unsigned char *ivec, int *num, const int enc) {
|
||||||
|
|
||||||
|
unsigned int n;
|
||||||
|
unsigned long l = length;
|
||||||
|
unsigned char c;
|
||||||
|
|
||||||
|
assert(in && out && key && ivec && num);
|
||||||
|
|
||||||
|
n = *num;
|
||||||
|
|
||||||
|
if (enc) {
|
||||||
|
while (l--) {
|
||||||
|
if (n == 0) {
|
||||||
|
AES_encrypt(ivec, ivec, key);
|
||||||
|
}
|
||||||
|
ivec[n] = *(out++) = *(in++) ^ ivec[n];
|
||||||
|
n = (n+1) % AES_BLOCK_SIZE;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
while (l--) {
|
||||||
|
if (n == 0) {
|
||||||
|
AES_decrypt(ivec, ivec, key);
|
||||||
|
}
|
||||||
|
c = *(in);
|
||||||
|
*(out++) = *(in++) ^ ivec[n];
|
||||||
|
ivec[n] = c;
|
||||||
|
n = (n+1) % AES_BLOCK_SIZE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*num=n;
|
||||||
|
}
|
||||||
|
|
||||||
1251
crypto/aes/aes_core.c
Normal file
1251
crypto/aes/aes_core.c
Normal file
File diff suppressed because it is too large
Load Diff
117
crypto/aes/aes_ctr.c
Normal file
117
crypto/aes/aes_ctr.c
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
/* crypto/aes/aes_ctr.c -*- mode:C; c-file-style: "eay" -*- */
|
||||||
|
/* ====================================================================
|
||||||
|
* Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in
|
||||||
|
* the documentation and/or other materials provided with the
|
||||||
|
* distribution.
|
||||||
|
*
|
||||||
|
* 3. All advertising materials mentioning features or use of this
|
||||||
|
* software must display the following acknowledgment:
|
||||||
|
* "This product includes software developed by the OpenSSL Project
|
||||||
|
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
||||||
|
*
|
||||||
|
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||||
|
* endorse or promote products derived from this software without
|
||||||
|
* prior written permission. For written permission, please contact
|
||||||
|
* openssl-core@openssl.org.
|
||||||
|
*
|
||||||
|
* 5. Products derived from this software may not be called "OpenSSL"
|
||||||
|
* nor may "OpenSSL" appear in their names without prior written
|
||||||
|
* permission of the OpenSSL Project.
|
||||||
|
*
|
||||||
|
* 6. Redistributions of any form whatsoever must retain the following
|
||||||
|
* acknowledgment:
|
||||||
|
* "This product includes software developed by the OpenSSL Project
|
||||||
|
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||||
|
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||||
|
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||||
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||||
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
* ====================================================================
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
#include <openssl/aes.h>
|
||||||
|
#include "aes_locl.h"
|
||||||
|
|
||||||
|
/* NOTE: CTR mode is big-endian. The rest of the AES code
|
||||||
|
* is endian-neutral. */
|
||||||
|
|
||||||
|
/* increment counter (128-bit int) by 2^64 */
|
||||||
|
static void AES_ctr128_inc(unsigned char *counter) {
|
||||||
|
unsigned long c;
|
||||||
|
|
||||||
|
/* Grab 3rd dword of counter and increment */
|
||||||
|
#ifdef L_ENDIAN
|
||||||
|
c = GETU32(counter + 8);
|
||||||
|
c++;
|
||||||
|
PUTU32(counter + 8, c);
|
||||||
|
#else
|
||||||
|
c = GETU32(counter + 4);
|
||||||
|
c++;
|
||||||
|
PUTU32(counter + 4, c);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* if no overflow, we're done */
|
||||||
|
if (c)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* Grab top dword of counter and increment */
|
||||||
|
#ifdef L_ENDIAN
|
||||||
|
c = GETU32(counter + 12);
|
||||||
|
c++;
|
||||||
|
PUTU32(counter + 12, c);
|
||||||
|
#else
|
||||||
|
c = GETU32(counter + 0);
|
||||||
|
c++;
|
||||||
|
PUTU32(counter + 0, c);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The input encrypted as though 128bit counter mode is being
|
||||||
|
* used. The extra state information to record how much of the
|
||||||
|
* 128bit block we have used is contained in *num;
|
||||||
|
*/
|
||||||
|
void AES_ctr128_encrypt(const unsigned char *in, unsigned char *out,
|
||||||
|
const unsigned long length, const AES_KEY *key,
|
||||||
|
unsigned char *counter, unsigned int *num) {
|
||||||
|
|
||||||
|
unsigned int n;
|
||||||
|
unsigned long l=length;
|
||||||
|
unsigned char tmp[AES_BLOCK_SIZE];
|
||||||
|
|
||||||
|
assert(in && out && key && counter && num);
|
||||||
|
|
||||||
|
n = *num;
|
||||||
|
|
||||||
|
while (l--) {
|
||||||
|
if (n == 0) {
|
||||||
|
AES_ctr128_inc(counter);
|
||||||
|
AES_encrypt(counter, tmp, key);
|
||||||
|
}
|
||||||
|
*(out++) = *(in++) ^ tmp[n];
|
||||||
|
n = (n+1) % AES_BLOCK_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
|
*num=n;
|
||||||
|
}
|
||||||
67
crypto/aes/aes_ecb.c
Normal file
67
crypto/aes/aes_ecb.c
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
/* crypto/aes/aes_ecb.c -*- mode:C; c-file-style: "eay" -*- */
|
||||||
|
/* ====================================================================
|
||||||
|
* Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in
|
||||||
|
* the documentation and/or other materials provided with the
|
||||||
|
* distribution.
|
||||||
|
*
|
||||||
|
* 3. All advertising materials mentioning features or use of this
|
||||||
|
* software must display the following acknowledgment:
|
||||||
|
* "This product includes software developed by the OpenSSL Project
|
||||||
|
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
||||||
|
*
|
||||||
|
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||||
|
* endorse or promote products derived from this software without
|
||||||
|
* prior written permission. For written permission, please contact
|
||||||
|
* openssl-core@openssl.org.
|
||||||
|
*
|
||||||
|
* 5. Products derived from this software may not be called "OpenSSL"
|
||||||
|
* nor may "OpenSSL" appear in their names without prior written
|
||||||
|
* permission of the OpenSSL Project.
|
||||||
|
*
|
||||||
|
* 6. Redistributions of any form whatsoever must retain the following
|
||||||
|
* acknowledgment:
|
||||||
|
* "This product includes software developed by the OpenSSL Project
|
||||||
|
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||||
|
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||||
|
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||||
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||||
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
* ====================================================================
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
#include <openssl/aes.h>
|
||||||
|
#include "aes_locl.h"
|
||||||
|
|
||||||
|
void AES_ecb_encrypt(const unsigned char *in, unsigned char *out,
|
||||||
|
const AES_KEY *key, const int enc) {
|
||||||
|
|
||||||
|
assert(in && out && key);
|
||||||
|
assert((AES_ENCRYPT == enc)||(AES_DECRYPT == enc));
|
||||||
|
|
||||||
|
if (AES_ENCRYPT == enc)
|
||||||
|
AES_encrypt(in, out, key);
|
||||||
|
else
|
||||||
|
AES_decrypt(in, out, key);
|
||||||
|
}
|
||||||
|
|
||||||
88
crypto/aes/aes_locl.h
Normal file
88
crypto/aes/aes_locl.h
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
/* crypto/aes/aes.h -*- mode:C; c-file-style: "eay" -*- */
|
||||||
|
/* ====================================================================
|
||||||
|
* Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in
|
||||||
|
* the documentation and/or other materials provided with the
|
||||||
|
* distribution.
|
||||||
|
*
|
||||||
|
* 3. All advertising materials mentioning features or use of this
|
||||||
|
* software must display the following acknowledgment:
|
||||||
|
* "This product includes software developed by the OpenSSL Project
|
||||||
|
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
||||||
|
*
|
||||||
|
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||||
|
* endorse or promote products derived from this software without
|
||||||
|
* prior written permission. For written permission, please contact
|
||||||
|
* openssl-core@openssl.org.
|
||||||
|
*
|
||||||
|
* 5. Products derived from this software may not be called "OpenSSL"
|
||||||
|
* nor may "OpenSSL" appear in their names without prior written
|
||||||
|
* permission of the OpenSSL Project.
|
||||||
|
*
|
||||||
|
* 6. Redistributions of any form whatsoever must retain the following
|
||||||
|
* acknowledgment:
|
||||||
|
* "This product includes software developed by the OpenSSL Project
|
||||||
|
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||||
|
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||||
|
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||||
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||||
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
* ====================================================================
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HEADER_AES_LOCL_H
|
||||||
|
#define HEADER_AES_LOCL_H
|
||||||
|
|
||||||
|
#include <openssl/e_os2.h>
|
||||||
|
|
||||||
|
#ifdef OPENSSL_NO_AES
|
||||||
|
#error AES is disabled.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#if defined(__STDC__) || defined(OPENSSL_SYS_VMS) || defined(M_XENIX) || defined(OPENSSL_SYS_MSDOS)
|
||||||
|
#include <string.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
# define SWAP(x) (_lrotl(x, 8) & 0x00ff00ff | _lrotr(x, 8) & 0xff00ff00)
|
||||||
|
# define GETU32(p) SWAP(*((u32 *)(p)))
|
||||||
|
# define PUTU32(ct, st) { *((u32 *)(ct)) = SWAP((st)); }
|
||||||
|
#else
|
||||||
|
# define GETU32(pt) (((u32)(pt)[0] << 24) ^ ((u32)(pt)[1] << 16) ^ ((u32)(pt)[2] << 8) ^ ((u32)(pt)[3]))
|
||||||
|
# define PUTU32(ct, st) { (ct)[0] = (u8)((st) >> 24); (ct)[1] = (u8)((st) >> 16); (ct)[2] = (u8)((st) >> 8); (ct)[3] = (u8)(st); }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef unsigned long u32;
|
||||||
|
typedef unsigned short u16;
|
||||||
|
typedef unsigned char u8;
|
||||||
|
|
||||||
|
#define MAXKC (256/32)
|
||||||
|
#define MAXKB (256/8)
|
||||||
|
#define MAXNR 14
|
||||||
|
|
||||||
|
/* This controls loop-unrolling in aes_core.c */
|
||||||
|
#undef FULL_UNROLL
|
||||||
|
|
||||||
|
#endif /* !HEADER_AES_LOCL_H */
|
||||||
64
crypto/aes/aes_misc.c
Normal file
64
crypto/aes/aes_misc.c
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
/* crypto/aes/aes_misc.c -*- mode:C; c-file-style: "eay" -*- */
|
||||||
|
/* ====================================================================
|
||||||
|
* Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in
|
||||||
|
* the documentation and/or other materials provided with the
|
||||||
|
* distribution.
|
||||||
|
*
|
||||||
|
* 3. All advertising materials mentioning features or use of this
|
||||||
|
* software must display the following acknowledgment:
|
||||||
|
* "This product includes software developed by the OpenSSL Project
|
||||||
|
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
||||||
|
*
|
||||||
|
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||||
|
* endorse or promote products derived from this software without
|
||||||
|
* prior written permission. For written permission, please contact
|
||||||
|
* openssl-core@openssl.org.
|
||||||
|
*
|
||||||
|
* 5. Products derived from this software may not be called "OpenSSL"
|
||||||
|
* nor may "OpenSSL" appear in their names without prior written
|
||||||
|
* permission of the OpenSSL Project.
|
||||||
|
*
|
||||||
|
* 6. Redistributions of any form whatsoever must retain the following
|
||||||
|
* acknowledgment:
|
||||||
|
* "This product includes software developed by the OpenSSL Project
|
||||||
|
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||||
|
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||||
|
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||||
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||||
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
* ====================================================================
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <openssl/opensslv.h>
|
||||||
|
#include <openssl/aes.h>
|
||||||
|
#include "aes_locl.h"
|
||||||
|
|
||||||
|
const char *AES_version="AES" OPENSSL_VERSION_PTEXT;
|
||||||
|
|
||||||
|
const char *AES_options(void) {
|
||||||
|
#ifdef FULL_UNROLL
|
||||||
|
return "aes(full)";
|
||||||
|
#else
|
||||||
|
return "aes(partial)";
|
||||||
|
#endif
|
||||||
|
}
|
||||||
136
crypto/aes/aes_ofb.c
Normal file
136
crypto/aes/aes_ofb.c
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
/* crypto/aes/aes_ofb.c -*- mode:C; c-file-style: "eay" -*- */
|
||||||
|
/* ====================================================================
|
||||||
|
* Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in
|
||||||
|
* the documentation and/or other materials provided with the
|
||||||
|
* distribution.
|
||||||
|
*
|
||||||
|
* 3. All advertising materials mentioning features or use of this
|
||||||
|
* software must display the following acknowledgment:
|
||||||
|
* "This product includes software developed by the OpenSSL Project
|
||||||
|
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
||||||
|
*
|
||||||
|
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||||
|
* endorse or promote products derived from this software without
|
||||||
|
* prior written permission. For written permission, please contact
|
||||||
|
* openssl-core@openssl.org.
|
||||||
|
*
|
||||||
|
* 5. Products derived from this software may not be called "OpenSSL"
|
||||||
|
* nor may "OpenSSL" appear in their names without prior written
|
||||||
|
* permission of the OpenSSL Project.
|
||||||
|
*
|
||||||
|
* 6. Redistributions of any form whatsoever must retain the following
|
||||||
|
* acknowledgment:
|
||||||
|
* "This product includes software developed by the OpenSSL Project
|
||||||
|
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||||
|
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||||
|
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||||
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||||
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
* ====================================================================
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This package is an SSL implementation written
|
||||||
|
* by Eric Young (eay@cryptsoft.com).
|
||||||
|
* The implementation was written so as to conform with Netscapes SSL.
|
||||||
|
*
|
||||||
|
* This library is free for commercial and non-commercial use as long as
|
||||||
|
* the following conditions are aheared to. The following conditions
|
||||||
|
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||||
|
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||||
|
* included with this distribution is covered by the same copyright terms
|
||||||
|
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||||
|
*
|
||||||
|
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||||
|
* the code are not to be removed.
|
||||||
|
* If this package is used in a product, Eric Young should be given attribution
|
||||||
|
* as the author of the parts of the library used.
|
||||||
|
* This can be in the form of a textual message at program startup or
|
||||||
|
* in documentation (online or textual) provided with the package.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* 3. All advertising materials mentioning features or use of this software
|
||||||
|
* must display the following acknowledgement:
|
||||||
|
* "This product includes cryptographic software written by
|
||||||
|
* Eric Young (eay@cryptsoft.com)"
|
||||||
|
* The word 'cryptographic' can be left out if the rouines from the library
|
||||||
|
* being used are not cryptographic related :-).
|
||||||
|
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||||
|
* the apps directory (application code) you must include an acknowledgement:
|
||||||
|
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* The licence and distribution terms for any publically available version or
|
||||||
|
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||||
|
* copied and put under another distribution licence
|
||||||
|
* [including the GNU Public Licence.]
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
#include <openssl/aes.h>
|
||||||
|
#include "aes_locl.h"
|
||||||
|
|
||||||
|
/* The input and output encrypted as though 128bit ofb mode is being
|
||||||
|
* used. The extra state information to record how much of the
|
||||||
|
* 128bit block we have used is contained in *num;
|
||||||
|
*/
|
||||||
|
void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out,
|
||||||
|
const unsigned long length, const AES_KEY *key,
|
||||||
|
unsigned char *ivec, int *num) {
|
||||||
|
|
||||||
|
unsigned int n;
|
||||||
|
unsigned long l=length;
|
||||||
|
|
||||||
|
assert(in && out && key && ivec && num);
|
||||||
|
|
||||||
|
n = *num;
|
||||||
|
|
||||||
|
while (l--) {
|
||||||
|
if (n == 0) {
|
||||||
|
AES_encrypt(ivec, ivec, key);
|
||||||
|
}
|
||||||
|
*(out++) = *(in++) ^ ivec[n];
|
||||||
|
n = (n+1) % AES_BLOCK_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
|
*num=n;
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -172,6 +172,7 @@ int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value)
|
|||||||
w=n/8;
|
w=n/8;
|
||||||
v=1<<(7-(n&0x07));
|
v=1<<(7-(n&0x07));
|
||||||
iv= ~v;
|
iv= ~v;
|
||||||
|
if (!value) v=0;
|
||||||
|
|
||||||
a->flags&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07); /* clear, set on write */
|
a->flags&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07); /* clear, set on write */
|
||||||
|
|
||||||
|
|||||||
@@ -60,24 +60,6 @@
|
|||||||
#include "cryptlib.h"
|
#include "cryptlib.h"
|
||||||
#include <openssl/asn1.h>
|
#include <openssl/asn1.h>
|
||||||
|
|
||||||
static unsigned long tag2bit[32]={
|
|
||||||
0, 0, 0, B_ASN1_BIT_STRING, /* tags 0 - 3 */
|
|
||||||
B_ASN1_OCTET_STRING, 0, 0, B_ASN1_UNKNOWN,/* tags 4- 7 */
|
|
||||||
B_ASN1_UNKNOWN, B_ASN1_UNKNOWN, B_ASN1_UNKNOWN, B_ASN1_UNKNOWN,/* tags 8-11 */
|
|
||||||
B_ASN1_UTF8STRING,B_ASN1_UNKNOWN,B_ASN1_UNKNOWN,B_ASN1_UNKNOWN,/* tags 12-15 */
|
|
||||||
0, 0, B_ASN1_NUMERICSTRING,B_ASN1_PRINTABLESTRING, /* tags 16-19 */
|
|
||||||
B_ASN1_T61STRING,B_ASN1_VIDEOTEXSTRING,B_ASN1_IA5STRING, /* tags 20-22 */
|
|
||||||
B_ASN1_UTCTIME, B_ASN1_GENERALIZEDTIME, /* tags 23-24 */
|
|
||||||
B_ASN1_GRAPHICSTRING,B_ASN1_ISO64STRING,B_ASN1_GENERALSTRING, /* tags 25-27 */
|
|
||||||
B_ASN1_UNIVERSALSTRING,B_ASN1_UNKNOWN,B_ASN1_BMPSTRING,B_ASN1_UNKNOWN, /* tags 28-31 */
|
|
||||||
};
|
|
||||||
|
|
||||||
unsigned long ASN1_tag2bit(int tag)
|
|
||||||
{
|
|
||||||
if((tag < 0) || (tag > 30)) return 0;
|
|
||||||
return tag2bit[tag];
|
|
||||||
}
|
|
||||||
|
|
||||||
static int asn1_collate_primitive(ASN1_STRING *a, ASN1_CTX *c);
|
static int asn1_collate_primitive(ASN1_STRING *a, ASN1_CTX *c);
|
||||||
/* type is a 'bitmap' of acceptable string types.
|
/* type is a 'bitmap' of acceptable string types.
|
||||||
*/
|
*/
|
||||||
@@ -99,7 +81,7 @@ ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a, unsigned char **pp,
|
|||||||
i=ASN1_R_TAG_VALUE_TOO_HIGH;;
|
i=ASN1_R_TAG_VALUE_TOO_HIGH;;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
if (!(tag2bit[tag] & type))
|
if (!(ASN1_tag2bit(tag) & type))
|
||||||
{
|
{
|
||||||
i=ASN1_R_WRONG_TYPE;
|
i=ASN1_R_WRONG_TYPE;
|
||||||
goto err;
|
goto err;
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ int ASN1_digest(int (*i2d)(), const EVP_MD *type, char *data,
|
|||||||
p=str;
|
p=str;
|
||||||
i2d(data,&p);
|
i2d(data,&p);
|
||||||
|
|
||||||
EVP_Digest(str, i, md, len, type);
|
EVP_Digest(str, i, md, len, type, NULL);
|
||||||
OPENSSL_free(str);
|
OPENSSL_free(str);
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
@@ -99,7 +99,7 @@ int ASN1_item_digest(const ASN1_ITEM *it, const EVP_MD *type, void *asn,
|
|||||||
i=ASN1_item_i2d(asn,&str, it);
|
i=ASN1_item_i2d(asn,&str, it);
|
||||||
if (!str) return(0);
|
if (!str) return(0);
|
||||||
|
|
||||||
EVP_Digest(str, i, md, len, type);
|
EVP_Digest(str, i, md, len, type, NULL);
|
||||||
OPENSSL_free(str);
|
OPENSSL_free(str);
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,6 +61,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include "cryptlib.h"
|
#include "cryptlib.h"
|
||||||
|
#include "o_time.h"
|
||||||
#include <openssl/asn1.h>
|
#include <openssl/asn1.h>
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
@@ -145,6 +146,19 @@ int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *d)
|
|||||||
|
|
||||||
if ((n < min[i]) || (n > max[i])) goto err;
|
if ((n < min[i]) || (n > max[i])) goto err;
|
||||||
}
|
}
|
||||||
|
/* Optional fractional seconds: decimal point followed by one
|
||||||
|
* or more digits.
|
||||||
|
*/
|
||||||
|
if (a[o] == '.')
|
||||||
|
{
|
||||||
|
if (++o > l) goto err;
|
||||||
|
i = o;
|
||||||
|
while ((a[o] >= '0') && (a[o] <= '9') && (o <= l))
|
||||||
|
o++;
|
||||||
|
/* Must have at least one digit after decimal point */
|
||||||
|
if (i == o) goto err;
|
||||||
|
}
|
||||||
|
|
||||||
if (a[o] == 'Z')
|
if (a[o] == 'Z')
|
||||||
o++;
|
o++;
|
||||||
else if ((a[o] == '+') || (a[o] == '-'))
|
else if ((a[o] == '+') || (a[o] == '-'))
|
||||||
@@ -193,21 +207,17 @@ ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,
|
|||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
struct tm *ts;
|
struct tm *ts;
|
||||||
#if defined(OPENSSL_THREADS) && !defined(OPENSSL_SYS_WIN32)
|
|
||||||
struct tm data;
|
struct tm data;
|
||||||
#endif
|
|
||||||
|
|
||||||
if (s == NULL)
|
if (s == NULL)
|
||||||
s=M_ASN1_GENERALIZEDTIME_new();
|
s=M_ASN1_GENERALIZEDTIME_new();
|
||||||
if (s == NULL)
|
if (s == NULL)
|
||||||
return(NULL);
|
return(NULL);
|
||||||
|
|
||||||
#if defined(OPENSSL_THREADS) && !defined(OPENSSL_SYS_WIN32)
|
ts=OPENSSL_gmtime(&t, &data);
|
||||||
gmtime_r(&t,&data); /* should return &data, but doesn't on some systems, so we don't even look at the return value */
|
if (ts == NULL)
|
||||||
ts=&data;
|
return(NULL);
|
||||||
#else
|
|
||||||
ts=gmtime(&t);
|
|
||||||
#endif
|
|
||||||
p=(char *)s->data;
|
p=(char *)s->data;
|
||||||
if ((p == NULL) || (s->length < 16))
|
if ((p == NULL) || (s->length < 16))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -55,6 +55,59 @@
|
|||||||
* copied and put under another distribution licence
|
* copied and put under another distribution licence
|
||||||
* [including the GNU Public Licence.]
|
* [including the GNU Public Licence.]
|
||||||
*/
|
*/
|
||||||
|
/* ====================================================================
|
||||||
|
* Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in
|
||||||
|
* the documentation and/or other materials provided with the
|
||||||
|
* distribution.
|
||||||
|
*
|
||||||
|
* 3. All advertising materials mentioning features or use of this
|
||||||
|
* software must display the following acknowledgment:
|
||||||
|
* "This product includes software developed by the OpenSSL Project
|
||||||
|
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
||||||
|
*
|
||||||
|
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||||
|
* endorse or promote products derived from this software without
|
||||||
|
* prior written permission. For written permission, please contact
|
||||||
|
* openssl-core@openssl.org.
|
||||||
|
*
|
||||||
|
* 5. Products derived from this software may not be called "OpenSSL"
|
||||||
|
* nor may "OpenSSL" appear in their names without prior written
|
||||||
|
* permission of the OpenSSL Project.
|
||||||
|
*
|
||||||
|
* 6. Redistributions of any form whatsoever must retain the following
|
||||||
|
* acknowledgment:
|
||||||
|
* "This product includes software developed by the OpenSSL Project
|
||||||
|
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||||
|
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||||
|
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||||
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||||
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
* ====================================================================
|
||||||
|
*
|
||||||
|
* This product includes cryptographic software written by Eric Young
|
||||||
|
* (eay@cryptsoft.com). This product includes software written by Tim
|
||||||
|
* Hudson (tjh@cryptsoft.com).
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
@@ -82,6 +135,7 @@ int ASN1_sign(int (*i2d)(), X509_ALGOR *algor1, X509_ALGOR *algor2,
|
|||||||
int i,inl=0,outl=0,outll=0;
|
int i,inl=0,outl=0,outll=0;
|
||||||
X509_ALGOR *a;
|
X509_ALGOR *a;
|
||||||
|
|
||||||
|
EVP_MD_CTX_init(&ctx);
|
||||||
for (i=0; i<2; i++)
|
for (i=0; i<2; i++)
|
||||||
{
|
{
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
@@ -89,7 +143,14 @@ int ASN1_sign(int (*i2d)(), X509_ALGOR *algor1, X509_ALGOR *algor2,
|
|||||||
else
|
else
|
||||||
a=algor2;
|
a=algor2;
|
||||||
if (a == NULL) continue;
|
if (a == NULL) continue;
|
||||||
if ( (a->parameter == NULL) ||
|
if (type->pkey_type == NID_dsaWithSHA1)
|
||||||
|
{
|
||||||
|
/* special case: RFC 2459 tells us to omit 'parameters'
|
||||||
|
* with id-dsa-with-sha1 */
|
||||||
|
ASN1_TYPE_free(a->parameter);
|
||||||
|
a->parameter = NULL;
|
||||||
|
}
|
||||||
|
else if ((a->parameter == NULL) ||
|
||||||
(a->parameter->type != V_ASN1_NULL))
|
(a->parameter->type != V_ASN1_NULL))
|
||||||
{
|
{
|
||||||
ASN1_TYPE_free(a->parameter);
|
ASN1_TYPE_free(a->parameter);
|
||||||
@@ -122,7 +183,7 @@ int ASN1_sign(int (*i2d)(), X509_ALGOR *algor1, X509_ALGOR *algor2,
|
|||||||
p=buf_in;
|
p=buf_in;
|
||||||
|
|
||||||
i2d(data,&p);
|
i2d(data,&p);
|
||||||
EVP_SignInit(&ctx,type);
|
EVP_SignInit_ex(&ctx,type, NULL);
|
||||||
EVP_SignUpdate(&ctx,(unsigned char *)buf_in,inl);
|
EVP_SignUpdate(&ctx,(unsigned char *)buf_in,inl);
|
||||||
if (!EVP_SignFinal(&ctx,(unsigned char *)buf_out,
|
if (!EVP_SignFinal(&ctx,(unsigned char *)buf_out,
|
||||||
(unsigned int *)&outl,pkey))
|
(unsigned int *)&outl,pkey))
|
||||||
@@ -141,7 +202,7 @@ int ASN1_sign(int (*i2d)(), X509_ALGOR *algor1, X509_ALGOR *algor2,
|
|||||||
signature->flags&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07);
|
signature->flags&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07);
|
||||||
signature->flags|=ASN1_STRING_FLAG_BITS_LEFT;
|
signature->flags|=ASN1_STRING_FLAG_BITS_LEFT;
|
||||||
err:
|
err:
|
||||||
memset(&ctx,0,sizeof(ctx));
|
EVP_MD_CTX_cleanup(&ctx);
|
||||||
if (buf_in != NULL)
|
if (buf_in != NULL)
|
||||||
{ memset((char *)buf_in,0,(unsigned int)inl); OPENSSL_free(buf_in); }
|
{ memset((char *)buf_in,0,(unsigned int)inl); OPENSSL_free(buf_in); }
|
||||||
if (buf_out != NULL)
|
if (buf_out != NULL)
|
||||||
@@ -160,6 +221,7 @@ int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,
|
|||||||
int i,inl=0,outl=0,outll=0;
|
int i,inl=0,outl=0,outll=0;
|
||||||
X509_ALGOR *a;
|
X509_ALGOR *a;
|
||||||
|
|
||||||
|
EVP_MD_CTX_init(&ctx);
|
||||||
for (i=0; i<2; i++)
|
for (i=0; i<2; i++)
|
||||||
{
|
{
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
@@ -167,7 +229,14 @@ int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,
|
|||||||
else
|
else
|
||||||
a=algor2;
|
a=algor2;
|
||||||
if (a == NULL) continue;
|
if (a == NULL) continue;
|
||||||
if ( (a->parameter == NULL) ||
|
if (type->pkey_type == NID_dsaWithSHA1)
|
||||||
|
{
|
||||||
|
/* special case: RFC 2459 tells us to omit 'parameters'
|
||||||
|
* with id-dsa-with-sha1 */
|
||||||
|
ASN1_TYPE_free(a->parameter);
|
||||||
|
a->parameter = NULL;
|
||||||
|
}
|
||||||
|
else if ((a->parameter == NULL) ||
|
||||||
(a->parameter->type != V_ASN1_NULL))
|
(a->parameter->type != V_ASN1_NULL))
|
||||||
{
|
{
|
||||||
ASN1_TYPE_free(a->parameter);
|
ASN1_TYPE_free(a->parameter);
|
||||||
@@ -197,7 +266,7 @@ int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
EVP_SignInit(&ctx,type);
|
EVP_SignInit_ex(&ctx,type, NULL);
|
||||||
EVP_SignUpdate(&ctx,(unsigned char *)buf_in,inl);
|
EVP_SignUpdate(&ctx,(unsigned char *)buf_in,inl);
|
||||||
if (!EVP_SignFinal(&ctx,(unsigned char *)buf_out,
|
if (!EVP_SignFinal(&ctx,(unsigned char *)buf_out,
|
||||||
(unsigned int *)&outl,pkey))
|
(unsigned int *)&outl,pkey))
|
||||||
@@ -216,7 +285,7 @@ int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,
|
|||||||
signature->flags&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07);
|
signature->flags&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07);
|
||||||
signature->flags|=ASN1_STRING_FLAG_BITS_LEFT;
|
signature->flags|=ASN1_STRING_FLAG_BITS_LEFT;
|
||||||
err:
|
err:
|
||||||
memset(&ctx,0,sizeof(ctx));
|
EVP_MD_CTX_cleanup(&ctx);
|
||||||
if (buf_in != NULL)
|
if (buf_in != NULL)
|
||||||
{ memset((char *)buf_in,0,(unsigned int)inl); OPENSSL_free(buf_in); }
|
{ memset((char *)buf_in,0,(unsigned int)inl); OPENSSL_free(buf_in); }
|
||||||
if (buf_out != NULL)
|
if (buf_out != NULL)
|
||||||
|
|||||||
@@ -371,6 +371,8 @@ static int do_indent(char_io *io_ch, void *arg, int indent)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define FN_WIDTH_LN 25
|
||||||
|
#define FN_WIDTH_SN 10
|
||||||
|
|
||||||
static int do_name_ex(char_io *io_ch, void *arg, X509_NAME *n,
|
static int do_name_ex(char_io *io_ch, void *arg, X509_NAME *n,
|
||||||
int indent, unsigned long flags)
|
int indent, unsigned long flags)
|
||||||
@@ -456,19 +458,29 @@ static int do_name_ex(char_io *io_ch, void *arg, X509_NAME *n,
|
|||||||
val = X509_NAME_ENTRY_get_data(ent);
|
val = X509_NAME_ENTRY_get_data(ent);
|
||||||
fn_nid = OBJ_obj2nid(fn);
|
fn_nid = OBJ_obj2nid(fn);
|
||||||
if(fn_opt != XN_FLAG_FN_NONE) {
|
if(fn_opt != XN_FLAG_FN_NONE) {
|
||||||
int objlen;
|
int objlen, fld_len;
|
||||||
if((fn_opt == XN_FLAG_FN_OID) || (fn_nid==NID_undef) ) {
|
if((fn_opt == XN_FLAG_FN_OID) || (fn_nid==NID_undef) ) {
|
||||||
OBJ_obj2txt(objtmp, 80, fn, 1);
|
OBJ_obj2txt(objtmp, 80, fn, 1);
|
||||||
|
fld_len = 0; /* XXX: what should this be? */
|
||||||
objbuf = objtmp;
|
objbuf = objtmp;
|
||||||
} else {
|
} else {
|
||||||
if(fn_opt == XN_FLAG_FN_SN)
|
if(fn_opt == XN_FLAG_FN_SN) {
|
||||||
|
fld_len = FN_WIDTH_SN;
|
||||||
objbuf = OBJ_nid2sn(fn_nid);
|
objbuf = OBJ_nid2sn(fn_nid);
|
||||||
else if(fn_opt == XN_FLAG_FN_LN)
|
} else if(fn_opt == XN_FLAG_FN_LN) {
|
||||||
|
fld_len = FN_WIDTH_LN;
|
||||||
objbuf = OBJ_nid2ln(fn_nid);
|
objbuf = OBJ_nid2ln(fn_nid);
|
||||||
else objbuf = "";
|
} else {
|
||||||
|
fld_len = 0; /* XXX: what should this be? */
|
||||||
|
objbuf = "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
objlen = strlen(objbuf);
|
objlen = strlen(objbuf);
|
||||||
if(!io_ch(arg, objbuf, objlen)) return -1;
|
if(!io_ch(arg, objbuf, objlen)) return -1;
|
||||||
|
if ((objlen < fld_len) && (flags & XN_FLAG_FN_ALIGN)) {
|
||||||
|
if (!do_indent(io_ch, arg, fld_len - objlen)) return -1;
|
||||||
|
outlen += fld_len - objlen;
|
||||||
|
}
|
||||||
if(!io_ch(arg, sep_eq, sep_eq_len)) return -1;
|
if(!io_ch(arg, sep_eq, sep_eq_len)) return -1;
|
||||||
outlen += objlen + sep_eq_len;
|
outlen += objlen + sep_eq_len;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,9 +105,9 @@ int ASN1_STRING_set_default_mask_asc(char *p)
|
|||||||
mask = strtoul(p + 5, &end, 0);
|
mask = strtoul(p + 5, &end, 0);
|
||||||
if(*end) return 0;
|
if(*end) return 0;
|
||||||
} else if(!strcmp(p, "nombstr"))
|
} else if(!strcmp(p, "nombstr"))
|
||||||
mask = ~(B_ASN1_BMPSTRING|B_ASN1_UTF8STRING);
|
mask = ~((unsigned long)(B_ASN1_BMPSTRING|B_ASN1_UTF8STRING));
|
||||||
else if(!strcmp(p, "pkix"))
|
else if(!strcmp(p, "pkix"))
|
||||||
mask = ~B_ASN1_T61STRING;
|
mask = ~((unsigned long)B_ASN1_T61STRING);
|
||||||
else if(!strcmp(p, "utf8only")) mask = B_ASN1_UTF8STRING;
|
else if(!strcmp(p, "utf8only")) mask = B_ASN1_UTF8STRING;
|
||||||
else if(!strcmp(p, "default"))
|
else if(!strcmp(p, "default"))
|
||||||
mask = 0xFFFFFFFFL;
|
mask = 0xFFFFFFFFL;
|
||||||
@@ -170,8 +170,10 @@ static ASN1_STRING_TABLE tbl_standard[] = {
|
|||||||
{NID_givenName, 1, ub_name, DIRSTRING_TYPE, 0},
|
{NID_givenName, 1, ub_name, DIRSTRING_TYPE, 0},
|
||||||
{NID_surname, 1, ub_name, DIRSTRING_TYPE, 0},
|
{NID_surname, 1, ub_name, DIRSTRING_TYPE, 0},
|
||||||
{NID_initials, 1, ub_name, DIRSTRING_TYPE, 0},
|
{NID_initials, 1, ub_name, DIRSTRING_TYPE, 0},
|
||||||
|
{NID_friendlyName, -1, -1, B_ASN1_BMPSTRING, STABLE_NO_MASK},
|
||||||
{NID_name, 1, ub_name, DIRSTRING_TYPE, 0},
|
{NID_name, 1, ub_name, DIRSTRING_TYPE, 0},
|
||||||
{NID_dnQualifier, -1, -1, B_ASN1_PRINTABLESTRING, STABLE_NO_MASK}
|
{NID_dnQualifier, -1, -1, B_ASN1_PRINTABLESTRING, STABLE_NO_MASK},
|
||||||
|
{NID_ms_csp_name, -1, -1, B_ASN1_BMPSTRING, STABLE_NO_MASK}
|
||||||
};
|
};
|
||||||
|
|
||||||
static int sk_table_cmp(const ASN1_STRING_TABLE * const *a,
|
static int sk_table_cmp(const ASN1_STRING_TABLE * const *a,
|
||||||
|
|||||||
@@ -64,6 +64,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include "cryptlib.h"
|
#include "cryptlib.h"
|
||||||
|
#include "o_time.h"
|
||||||
#include <openssl/asn1t.h>
|
#include <openssl/asn1t.h>
|
||||||
|
|
||||||
IMPLEMENT_ASN1_MSTRING(ASN1_TIME, B_ASN1_TIME)
|
IMPLEMENT_ASN1_MSTRING(ASN1_TIME, B_ASN1_TIME)
|
||||||
@@ -100,14 +101,11 @@ int i2d_ASN1_TIME(ASN1_TIME *a, unsigned char **pp)
|
|||||||
ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t t)
|
ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t t)
|
||||||
{
|
{
|
||||||
struct tm *ts;
|
struct tm *ts;
|
||||||
#if defined(OPENSSL_THREADS) && !defined(OPENSSL_SYS_WIN32) && !defined(__CYGWIN32__)
|
|
||||||
struct tm data;
|
struct tm data;
|
||||||
|
|
||||||
gmtime_r(&t,&data);
|
ts=OPENSSL_gmtime(&t,&data);
|
||||||
ts=&data; /* should return &data, but doesn't on some systems, so we don't even look at the return value */
|
if (ts == NULL)
|
||||||
#else
|
return NULL;
|
||||||
ts=gmtime(&t);
|
|
||||||
#endif
|
|
||||||
if((ts->tm_year >= 50) && (ts->tm_year < 150))
|
if((ts->tm_year >= 50) && (ts->tm_year < 150))
|
||||||
return ASN1_UTCTIME_set(s, t);
|
return ASN1_UTCTIME_set(s, t);
|
||||||
return ASN1_GENERALIZEDTIME_set(s,t);
|
return ASN1_GENERALIZEDTIME_set(s,t);
|
||||||
|
|||||||
@@ -59,12 +59,8 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include "cryptlib.h"
|
#include "cryptlib.h"
|
||||||
|
#include "o_time.h"
|
||||||
#include <openssl/asn1.h>
|
#include <openssl/asn1.h>
|
||||||
#ifdef OPENSSL_SYS_VMS
|
|
||||||
#include <descrip.h>
|
|
||||||
#include <lnmdef.h>
|
|
||||||
#include <starlet.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
int i2d_ASN1_UTCTIME(ASN1_UTCTIME *a, unsigned char **pp)
|
int i2d_ASN1_UTCTIME(ASN1_UTCTIME *a, unsigned char **pp)
|
||||||
@@ -191,59 +187,17 @@ ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t)
|
|||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
struct tm *ts;
|
struct tm *ts;
|
||||||
#if defined(OPENSSL_THREADS) && !defined(OPENSSL_SYS_WIN32) && !defined(__CYGWIN32__)
|
|
||||||
|
|
||||||
struct tm data;
|
struct tm data;
|
||||||
#endif
|
|
||||||
|
|
||||||
if (s == NULL)
|
if (s == NULL)
|
||||||
s=M_ASN1_UTCTIME_new();
|
s=M_ASN1_UTCTIME_new();
|
||||||
if (s == NULL)
|
if (s == NULL)
|
||||||
return(NULL);
|
return(NULL);
|
||||||
|
|
||||||
#if defined(OPENSSL_THREADS) && !defined(OPENSSL_SYS_WIN32) && !defined(__CYGWIN32__)
|
ts=OPENSSL_gmtime(&t, &data);
|
||||||
gmtime_r(&t,&data); /* should return &data, but doesn't on some systems, so we don't even look at the return value */
|
|
||||||
ts=&data;
|
|
||||||
#else
|
|
||||||
ts=gmtime(&t);
|
|
||||||
#endif
|
|
||||||
#ifdef OPENSSL_SYS_VMS
|
|
||||||
if (ts == NULL)
|
if (ts == NULL)
|
||||||
{
|
return(NULL);
|
||||||
static $DESCRIPTOR(tabnam,"LNM$DCL_LOGICAL");
|
|
||||||
static $DESCRIPTOR(lognam,"SYS$TIMEZONE_DIFFERENTIAL");
|
|
||||||
char result[256];
|
|
||||||
unsigned int reslen = 0;
|
|
||||||
struct {
|
|
||||||
short buflen;
|
|
||||||
short code;
|
|
||||||
void *bufaddr;
|
|
||||||
unsigned int *reslen;
|
|
||||||
} itemlist[] = {
|
|
||||||
{ 0, LNM$_STRING, 0, 0 },
|
|
||||||
{ 0, 0, 0, 0 },
|
|
||||||
};
|
|
||||||
int status;
|
|
||||||
|
|
||||||
/* Get the value for SYS$TIMEZONE_DIFFERENTIAL */
|
|
||||||
itemlist[0].buflen = sizeof(result);
|
|
||||||
itemlist[0].bufaddr = result;
|
|
||||||
itemlist[0].reslen = &reslen;
|
|
||||||
status = sys$trnlnm(0, &tabnam, &lognam, 0, itemlist);
|
|
||||||
if (!(status & 1))
|
|
||||||
return NULL;
|
|
||||||
result[reslen] = '\0';
|
|
||||||
|
|
||||||
/* Get the numerical value of the equivalence string */
|
|
||||||
status = atoi(result);
|
|
||||||
|
|
||||||
/* and use it to move time to GMT */
|
|
||||||
t -= status;
|
|
||||||
|
|
||||||
/* then convert the result to the time structure */
|
|
||||||
ts=(struct tm *)localtime(&t);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
p=(char *)s->data;
|
p=(char *)s->data;
|
||||||
if ((p == NULL) || (s->length < 14))
|
if ((p == NULL) || (s->length < 14))
|
||||||
{
|
{
|
||||||
@@ -284,11 +238,7 @@ int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t)
|
|||||||
|
|
||||||
t -= offset*60; /* FIXME: may overflow in extreme cases */
|
t -= offset*60; /* FIXME: may overflow in extreme cases */
|
||||||
|
|
||||||
#if defined(OPENSSL_THREADS) && !defined(OPENSSL_SYS_WIN32) && !defined(__CYGWIN32__)
|
{ struct tm data; tm = OPENSSL_gmtime(&t, &data); }
|
||||||
{ struct tm data; gmtime_r(&t, &data); tm = &data; }
|
|
||||||
#else
|
|
||||||
tm = gmtime(&t);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define return_cmp(a,b) if ((a)<(b)) return -1; else if ((a)>(b)) return 1
|
#define return_cmp(a,b) if ((a)<(b)) return -1; else if ((a)>(b)) return 1
|
||||||
year = g2(s->data);
|
year = g2(s->data);
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ int ASN1_verify(int (*i2d)(), X509_ALGOR *a, ASN1_BIT_STRING *signature,
|
|||||||
unsigned char *p,*buf_in=NULL;
|
unsigned char *p,*buf_in=NULL;
|
||||||
int ret= -1,i,inl;
|
int ret= -1,i,inl;
|
||||||
|
|
||||||
|
EVP_MD_CTX_init(&ctx);
|
||||||
i=OBJ_obj2nid(a->algorithm);
|
i=OBJ_obj2nid(a->algorithm);
|
||||||
type=EVP_get_digestbyname(OBJ_nid2sn(i));
|
type=EVP_get_digestbyname(OBJ_nid2sn(i));
|
||||||
if (type == NULL)
|
if (type == NULL)
|
||||||
@@ -99,7 +100,7 @@ int ASN1_verify(int (*i2d)(), X509_ALGOR *a, ASN1_BIT_STRING *signature,
|
|||||||
p=buf_in;
|
p=buf_in;
|
||||||
|
|
||||||
i2d(data,&p);
|
i2d(data,&p);
|
||||||
EVP_VerifyInit(&ctx,type);
|
EVP_VerifyInit_ex(&ctx,type, NULL);
|
||||||
EVP_VerifyUpdate(&ctx,(unsigned char *)buf_in,inl);
|
EVP_VerifyUpdate(&ctx,(unsigned char *)buf_in,inl);
|
||||||
|
|
||||||
memset(buf_in,0,(unsigned int)inl);
|
memset(buf_in,0,(unsigned int)inl);
|
||||||
@@ -117,6 +118,7 @@ int ASN1_verify(int (*i2d)(), X509_ALGOR *a, ASN1_BIT_STRING *signature,
|
|||||||
/* memset(&ctx,0,sizeof(ctx)); */
|
/* memset(&ctx,0,sizeof(ctx)); */
|
||||||
ret=1;
|
ret=1;
|
||||||
err:
|
err:
|
||||||
|
EVP_MD_CTX_cleanup(&ctx);
|
||||||
return(ret);
|
return(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,6 +133,7 @@ int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *a, ASN1_BIT_STRING *signat
|
|||||||
unsigned char *buf_in=NULL;
|
unsigned char *buf_in=NULL;
|
||||||
int ret= -1,i,inl;
|
int ret= -1,i,inl;
|
||||||
|
|
||||||
|
EVP_MD_CTX_init(&ctx);
|
||||||
i=OBJ_obj2nid(a->algorithm);
|
i=OBJ_obj2nid(a->algorithm);
|
||||||
type=EVP_get_digestbyname(OBJ_nid2sn(i));
|
type=EVP_get_digestbyname(OBJ_nid2sn(i));
|
||||||
if (type == NULL)
|
if (type == NULL)
|
||||||
@@ -147,7 +150,7 @@ int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *a, ASN1_BIT_STRING *signat
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
EVP_VerifyInit(&ctx,type);
|
EVP_VerifyInit_ex(&ctx,type, NULL);
|
||||||
EVP_VerifyUpdate(&ctx,(unsigned char *)buf_in,inl);
|
EVP_VerifyUpdate(&ctx,(unsigned char *)buf_in,inl);
|
||||||
|
|
||||||
memset(buf_in,0,(unsigned int)inl);
|
memset(buf_in,0,(unsigned int)inl);
|
||||||
@@ -165,6 +168,7 @@ int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *a, ASN1_BIT_STRING *signat
|
|||||||
/* memset(&ctx,0,sizeof(ctx)); */
|
/* memset(&ctx,0,sizeof(ctx)); */
|
||||||
ret=1;
|
ret=1;
|
||||||
err:
|
err:
|
||||||
|
EVP_MD_CTX_cleanup(&ctx);
|
||||||
return(ret);
|
return(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -71,6 +71,7 @@
|
|||||||
#include <openssl/symhacks.h>
|
#include <openssl/symhacks.h>
|
||||||
|
|
||||||
#include <openssl/e_os2.h>
|
#include <openssl/e_os2.h>
|
||||||
|
#include <openssl/ossl_typ.h>
|
||||||
|
|
||||||
#ifdef OPENSSL_BUILD_SHLIBCRYPTO
|
#ifdef OPENSSL_BUILD_SHLIBCRYPTO
|
||||||
# undef OPENSSL_EXTERN
|
# undef OPENSSL_EXTERN
|
||||||
@@ -246,44 +247,6 @@ DECLARE_STACK_OF(ASN1_STRING_TABLE)
|
|||||||
#define ub_title 64
|
#define ub_title 64
|
||||||
#define ub_email_address 128
|
#define ub_email_address 128
|
||||||
|
|
||||||
#ifdef NO_ASN1_TYPEDEFS
|
|
||||||
#define ASN1_INTEGER ASN1_STRING
|
|
||||||
#define ASN1_ENUMERATED ASN1_STRING
|
|
||||||
#define ASN1_BIT_STRING ASN1_STRING
|
|
||||||
#define ASN1_OCTET_STRING ASN1_STRING
|
|
||||||
#define ASN1_PRINTABLESTRING ASN1_STRING
|
|
||||||
#define ASN1_T61STRING ASN1_STRING
|
|
||||||
#define ASN1_IA5STRING ASN1_STRING
|
|
||||||
#define ASN1_UTCTIME ASN1_STRING
|
|
||||||
#define ASN1_GENERALIZEDTIME ASN1_STRING
|
|
||||||
#define ASN1_TIME ASN1_STRING
|
|
||||||
#define ASN1_GENERALSTRING ASN1_STRING
|
|
||||||
#define ASN1_UNIVERSALSTRING ASN1_STRING
|
|
||||||
#define ASN1_BMPSTRING ASN1_STRING
|
|
||||||
#define ASN1_VISIBLESTRING ASN1_STRING
|
|
||||||
#define ASN1_UTF8STRING ASN1_STRING
|
|
||||||
#define ASN1_BOOLEAN int
|
|
||||||
#define ASN1_NULL int
|
|
||||||
#else
|
|
||||||
typedef struct asn1_string_st ASN1_INTEGER;
|
|
||||||
typedef struct asn1_string_st ASN1_ENUMERATED;
|
|
||||||
typedef struct asn1_string_st ASN1_BIT_STRING;
|
|
||||||
typedef struct asn1_string_st ASN1_OCTET_STRING;
|
|
||||||
typedef struct asn1_string_st ASN1_PRINTABLESTRING;
|
|
||||||
typedef struct asn1_string_st ASN1_T61STRING;
|
|
||||||
typedef struct asn1_string_st ASN1_IA5STRING;
|
|
||||||
typedef struct asn1_string_st ASN1_GENERALSTRING;
|
|
||||||
typedef struct asn1_string_st ASN1_UNIVERSALSTRING;
|
|
||||||
typedef struct asn1_string_st ASN1_BMPSTRING;
|
|
||||||
typedef struct asn1_string_st ASN1_UTCTIME;
|
|
||||||
typedef struct asn1_string_st ASN1_TIME;
|
|
||||||
typedef struct asn1_string_st ASN1_GENERALIZEDTIME;
|
|
||||||
typedef struct asn1_string_st ASN1_VISIBLESTRING;
|
|
||||||
typedef struct asn1_string_st ASN1_UTF8STRING;
|
|
||||||
typedef int ASN1_BOOLEAN;
|
|
||||||
typedef int ASN1_NULL;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Declarations for template structures: for full definitions
|
/* Declarations for template structures: for full definitions
|
||||||
* see asn1t.h
|
* see asn1t.h
|
||||||
*/
|
*/
|
||||||
@@ -477,6 +440,8 @@ typedef const ASN1_ITEM * ASN1_ITEM_EXP(void);
|
|||||||
DECLARE_STACK_OF(ASN1_INTEGER)
|
DECLARE_STACK_OF(ASN1_INTEGER)
|
||||||
DECLARE_ASN1_SET_OF(ASN1_INTEGER)
|
DECLARE_ASN1_SET_OF(ASN1_INTEGER)
|
||||||
|
|
||||||
|
DECLARE_STACK_OF(ASN1_GENERALSTRING)
|
||||||
|
|
||||||
typedef struct asn1_type_st
|
typedef struct asn1_type_st
|
||||||
{
|
{
|
||||||
int type;
|
int type;
|
||||||
@@ -822,6 +787,7 @@ DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, DISPLAYTEXT)
|
|||||||
DECLARE_ASN1_FUNCTIONS(ASN1_PRINTABLESTRING)
|
DECLARE_ASN1_FUNCTIONS(ASN1_PRINTABLESTRING)
|
||||||
DECLARE_ASN1_FUNCTIONS(ASN1_T61STRING)
|
DECLARE_ASN1_FUNCTIONS(ASN1_T61STRING)
|
||||||
DECLARE_ASN1_FUNCTIONS(ASN1_IA5STRING)
|
DECLARE_ASN1_FUNCTIONS(ASN1_IA5STRING)
|
||||||
|
DECLARE_ASN1_FUNCTIONS(ASN1_GENERALSTRING)
|
||||||
DECLARE_ASN1_FUNCTIONS(ASN1_UTCTIME)
|
DECLARE_ASN1_FUNCTIONS(ASN1_UTCTIME)
|
||||||
DECLARE_ASN1_FUNCTIONS(ASN1_GENERALIZEDTIME)
|
DECLARE_ASN1_FUNCTIONS(ASN1_GENERALIZEDTIME)
|
||||||
DECLARE_ASN1_FUNCTIONS(ASN1_TIME)
|
DECLARE_ASN1_FUNCTIONS(ASN1_TIME)
|
||||||
@@ -922,8 +888,6 @@ void ASN1_HEADER_free(ASN1_HEADER *a);
|
|||||||
|
|
||||||
int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s);
|
int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s);
|
||||||
|
|
||||||
void ERR_load_ASN1_strings(void);
|
|
||||||
|
|
||||||
/* Not used that much at this point, except for the first two */
|
/* Not used that much at this point, except for the first two */
|
||||||
ASN1_METHOD *X509_asn1_meth(void);
|
ASN1_METHOD *X509_asn1_meth(void);
|
||||||
ASN1_METHOD *RSAPrivateKey_asn1_meth(void);
|
ASN1_METHOD *RSAPrivateKey_asn1_meth(void);
|
||||||
@@ -971,11 +935,13 @@ void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it);
|
|||||||
ASN1_VALUE * ASN1_item_d2i(ASN1_VALUE **val, unsigned char **in, long len, const ASN1_ITEM *it);
|
ASN1_VALUE * ASN1_item_d2i(ASN1_VALUE **val, unsigned char **in, long len, const ASN1_ITEM *it);
|
||||||
int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it);
|
int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it);
|
||||||
|
|
||||||
|
void ASN1_add_oid_module(void);
|
||||||
|
|
||||||
/* BEGIN ERROR CODES */
|
/* BEGIN ERROR CODES */
|
||||||
/* The following lines are auto generated by the script mkerr.pl. Any changes
|
/* The following lines are auto generated by the script mkerr.pl. Any changes
|
||||||
* made after this point may be overwritten when the script is next run.
|
* made after this point may be overwritten when the script is next run.
|
||||||
*/
|
*/
|
||||||
|
void ERR_load_ASN1_strings(void);
|
||||||
|
|
||||||
/* Error codes for the ASN1 functions. */
|
/* Error codes for the ASN1 functions. */
|
||||||
|
|
||||||
@@ -1042,11 +1008,13 @@ int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it);
|
|||||||
#define ASN1_F_D2I_X509_PKEY 159
|
#define ASN1_F_D2I_X509_PKEY 159
|
||||||
#define ASN1_F_I2D_ASN1_TIME 160
|
#define ASN1_F_I2D_ASN1_TIME 160
|
||||||
#define ASN1_F_I2D_DSA_PUBKEY 161
|
#define ASN1_F_I2D_DSA_PUBKEY 161
|
||||||
|
#define ASN1_F_I2D_ECDSA_PUBKEY 174
|
||||||
#define ASN1_F_I2D_NETSCAPE_RSA 162
|
#define ASN1_F_I2D_NETSCAPE_RSA 162
|
||||||
#define ASN1_F_I2D_PRIVATEKEY 163
|
#define ASN1_F_I2D_PRIVATEKEY 163
|
||||||
#define ASN1_F_I2D_PUBLICKEY 164
|
#define ASN1_F_I2D_PUBLICKEY 164
|
||||||
#define ASN1_F_I2D_RSA_PUBKEY 165
|
#define ASN1_F_I2D_RSA_PUBKEY 165
|
||||||
#define ASN1_F_LONG_C2I 166
|
#define ASN1_F_LONG_C2I 166
|
||||||
|
#define ASN1_F_OID_MODULE_INIT 175
|
||||||
#define ASN1_F_PKCS5_PBE2_SET 167
|
#define ASN1_F_PKCS5_PBE2_SET 167
|
||||||
#define ASN1_F_X509_CINF_NEW 168
|
#define ASN1_F_X509_CINF_NEW 168
|
||||||
#define ASN1_F_X509_CRL_ADD0_REVOKED 169
|
#define ASN1_F_X509_CRL_ADD0_REVOKED 169
|
||||||
@@ -1056,6 +1024,7 @@ int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it);
|
|||||||
#define ASN1_F_X509_PKEY_NEW 173
|
#define ASN1_F_X509_PKEY_NEW 173
|
||||||
|
|
||||||
/* Reason codes. */
|
/* Reason codes. */
|
||||||
|
#define ASN1_R_ADDING_OBJECT 171
|
||||||
#define ASN1_R_AUX_ERROR 100
|
#define ASN1_R_AUX_ERROR 100
|
||||||
#define ASN1_R_BAD_CLASS 101
|
#define ASN1_R_BAD_CLASS 101
|
||||||
#define ASN1_R_BAD_OBJECT_HEADER 102
|
#define ASN1_R_BAD_OBJECT_HEADER 102
|
||||||
@@ -1069,6 +1038,7 @@ int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it);
|
|||||||
#define ASN1_R_DECODE_ERROR 110
|
#define ASN1_R_DECODE_ERROR 110
|
||||||
#define ASN1_R_DECODING_ERROR 111
|
#define ASN1_R_DECODING_ERROR 111
|
||||||
#define ASN1_R_ENCODE_ERROR 112
|
#define ASN1_R_ENCODE_ERROR 112
|
||||||
|
#define ASN1_R_ERROR_LOADING_SECTION 172
|
||||||
#define ASN1_R_ERROR_PARSING_SET_ELEMENT 113
|
#define ASN1_R_ERROR_PARSING_SET_ELEMENT 113
|
||||||
#define ASN1_R_ERROR_SETTING_CIPHER_PARAMS 114
|
#define ASN1_R_ERROR_SETTING_CIPHER_PARAMS 114
|
||||||
#define ASN1_R_EXPECTING_AN_INTEGER 115
|
#define ASN1_R_EXPECTING_AN_INTEGER 115
|
||||||
@@ -1132,4 +1102,3 @@ int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it);
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* crypto/asn1/asn1_err.c */
|
/* crypto/asn1/asn1_err.c */
|
||||||
/* ====================================================================
|
/* ====================================================================
|
||||||
* Copyright (c) 1999 The OpenSSL Project. All rights reserved.
|
* Copyright (c) 1999-2002 The OpenSSL Project. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -128,11 +128,13 @@ static ERR_STRING_DATA ASN1_str_functs[]=
|
|||||||
{ERR_PACK(0,ASN1_F_D2I_X509_PKEY,0), "d2i_X509_PKEY"},
|
{ERR_PACK(0,ASN1_F_D2I_X509_PKEY,0), "d2i_X509_PKEY"},
|
||||||
{ERR_PACK(0,ASN1_F_I2D_ASN1_TIME,0), "I2D_ASN1_TIME"},
|
{ERR_PACK(0,ASN1_F_I2D_ASN1_TIME,0), "I2D_ASN1_TIME"},
|
||||||
{ERR_PACK(0,ASN1_F_I2D_DSA_PUBKEY,0), "i2d_DSA_PUBKEY"},
|
{ERR_PACK(0,ASN1_F_I2D_DSA_PUBKEY,0), "i2d_DSA_PUBKEY"},
|
||||||
|
{ERR_PACK(0,ASN1_F_I2D_ECDSA_PUBKEY,0), "i2d_ECDSA_PUBKEY"},
|
||||||
{ERR_PACK(0,ASN1_F_I2D_NETSCAPE_RSA,0), "i2d_Netscape_RSA"},
|
{ERR_PACK(0,ASN1_F_I2D_NETSCAPE_RSA,0), "i2d_Netscape_RSA"},
|
||||||
{ERR_PACK(0,ASN1_F_I2D_PRIVATEKEY,0), "i2d_PrivateKey"},
|
{ERR_PACK(0,ASN1_F_I2D_PRIVATEKEY,0), "i2d_PrivateKey"},
|
||||||
{ERR_PACK(0,ASN1_F_I2D_PUBLICKEY,0), "i2d_PublicKey"},
|
{ERR_PACK(0,ASN1_F_I2D_PUBLICKEY,0), "i2d_PublicKey"},
|
||||||
{ERR_PACK(0,ASN1_F_I2D_RSA_PUBKEY,0), "i2d_RSA_PUBKEY"},
|
{ERR_PACK(0,ASN1_F_I2D_RSA_PUBKEY,0), "i2d_RSA_PUBKEY"},
|
||||||
{ERR_PACK(0,ASN1_F_LONG_C2I,0), "LONG_C2I"},
|
{ERR_PACK(0,ASN1_F_LONG_C2I,0), "LONG_C2I"},
|
||||||
|
{ERR_PACK(0,ASN1_F_OID_MODULE_INIT,0), "OID_MODULE_INIT"},
|
||||||
{ERR_PACK(0,ASN1_F_PKCS5_PBE2_SET,0), "PKCS5_pbe2_set"},
|
{ERR_PACK(0,ASN1_F_PKCS5_PBE2_SET,0), "PKCS5_pbe2_set"},
|
||||||
{ERR_PACK(0,ASN1_F_X509_CINF_NEW,0), "X509_CINF_NEW"},
|
{ERR_PACK(0,ASN1_F_X509_CINF_NEW,0), "X509_CINF_NEW"},
|
||||||
{ERR_PACK(0,ASN1_F_X509_CRL_ADD0_REVOKED,0), "X509_CRL_add0_revoked"},
|
{ERR_PACK(0,ASN1_F_X509_CRL_ADD0_REVOKED,0), "X509_CRL_add0_revoked"},
|
||||||
@@ -145,6 +147,7 @@ static ERR_STRING_DATA ASN1_str_functs[]=
|
|||||||
|
|
||||||
static ERR_STRING_DATA ASN1_str_reasons[]=
|
static ERR_STRING_DATA ASN1_str_reasons[]=
|
||||||
{
|
{
|
||||||
|
{ASN1_R_ADDING_OBJECT ,"adding object"},
|
||||||
{ASN1_R_AUX_ERROR ,"aux error"},
|
{ASN1_R_AUX_ERROR ,"aux error"},
|
||||||
{ASN1_R_BAD_CLASS ,"bad class"},
|
{ASN1_R_BAD_CLASS ,"bad class"},
|
||||||
{ASN1_R_BAD_OBJECT_HEADER ,"bad object header"},
|
{ASN1_R_BAD_OBJECT_HEADER ,"bad object header"},
|
||||||
@@ -158,6 +161,7 @@ static ERR_STRING_DATA ASN1_str_reasons[]=
|
|||||||
{ASN1_R_DECODE_ERROR ,"decode error"},
|
{ASN1_R_DECODE_ERROR ,"decode error"},
|
||||||
{ASN1_R_DECODING_ERROR ,"decoding error"},
|
{ASN1_R_DECODING_ERROR ,"decoding error"},
|
||||||
{ASN1_R_ENCODE_ERROR ,"encode error"},
|
{ASN1_R_ENCODE_ERROR ,"encode error"},
|
||||||
|
{ASN1_R_ERROR_LOADING_SECTION ,"error loading section"},
|
||||||
{ASN1_R_ERROR_PARSING_SET_ELEMENT ,"error parsing set element"},
|
{ASN1_R_ERROR_PARSING_SET_ELEMENT ,"error parsing set element"},
|
||||||
{ASN1_R_ERROR_SETTING_CIPHER_PARAMS ,"error setting cipher params"},
|
{ASN1_R_ERROR_SETTING_CIPHER_PARAMS ,"error setting cipher params"},
|
||||||
{ASN1_R_EXPECTING_AN_INTEGER ,"expecting an integer"},
|
{ASN1_R_EXPECTING_AN_INTEGER ,"expecting an integer"},
|
||||||
|
|||||||
@@ -780,6 +780,12 @@ typedef struct ASN1_AUX_st {
|
|||||||
return ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\
|
return ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define IMPLEMENT_ASN1_DUP_FUNCTION(stname) \
|
||||||
|
stname * stname##_dup(stname *x) \
|
||||||
|
{ \
|
||||||
|
return ASN1_item_dup(ASN1_ITEM_rptr(stname), x); \
|
||||||
|
}
|
||||||
|
|
||||||
#define IMPLEMENT_ASN1_FUNCTIONS_const(name) \
|
#define IMPLEMENT_ASN1_FUNCTIONS_const(name) \
|
||||||
IMPLEMENT_ASN1_FUNCTIONS_const_fname(name, name, name)
|
IMPLEMENT_ASN1_FUNCTIONS_const_fname(name, name, name)
|
||||||
|
|
||||||
|
|||||||
95
crypto/asn1/asn_moid.c
Normal file
95
crypto/asn1/asn_moid.c
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
/* asn_moid.c */
|
||||||
|
/* Written by Stephen Henson (shenson@bigfoot.com) for the OpenSSL
|
||||||
|
* project 2001.
|
||||||
|
*/
|
||||||
|
/* ====================================================================
|
||||||
|
* Copyright (c) 2001 The OpenSSL Project. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in
|
||||||
|
* the documentation and/or other materials provided with the
|
||||||
|
* distribution.
|
||||||
|
*
|
||||||
|
* 3. All advertising materials mentioning features or use of this
|
||||||
|
* software must display the following acknowledgment:
|
||||||
|
* "This product includes software developed by the OpenSSL Project
|
||||||
|
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
|
||||||
|
*
|
||||||
|
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||||
|
* endorse or promote products derived from this software without
|
||||||
|
* prior written permission. For written permission, please contact
|
||||||
|
* licensing@OpenSSL.org.
|
||||||
|
*
|
||||||
|
* 5. Products derived from this software may not be called "OpenSSL"
|
||||||
|
* nor may "OpenSSL" appear in their names without prior written
|
||||||
|
* permission of the OpenSSL Project.
|
||||||
|
*
|
||||||
|
* 6. Redistributions of any form whatsoever must retain the following
|
||||||
|
* acknowledgment:
|
||||||
|
* "This product includes software developed by the OpenSSL Project
|
||||||
|
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||||
|
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||||
|
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||||
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||||
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
* ====================================================================
|
||||||
|
*
|
||||||
|
* This product includes cryptographic software written by Eric Young
|
||||||
|
* (eay@cryptsoft.com). This product includes software written by Tim
|
||||||
|
* Hudson (tjh@cryptsoft.com).
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <openssl/crypto.h>
|
||||||
|
#include "cryptlib.h"
|
||||||
|
#include <openssl/conf.h>
|
||||||
|
#include <openssl/dso.h>
|
||||||
|
#include <openssl/x509.h>
|
||||||
|
|
||||||
|
/* Simple ASN1 OID module: add all objects in a given section */
|
||||||
|
|
||||||
|
static int oid_module_init(CONF_IMODULE *md, const CONF *cnf)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
const char *oid_section;
|
||||||
|
STACK_OF(CONF_VALUE) *sktmp;
|
||||||
|
CONF_VALUE *oval;
|
||||||
|
oid_section = CONF_imodule_get_value(md);
|
||||||
|
if(!(sktmp = NCONF_get_section(cnf, oid_section)))
|
||||||
|
{
|
||||||
|
ASN1err(ASN1_F_OID_MODULE_INIT, ASN1_R_ERROR_LOADING_SECTION);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
for(i = 0; i < sk_CONF_VALUE_num(sktmp); i++)
|
||||||
|
{
|
||||||
|
oval = sk_CONF_VALUE_value(sktmp, i);
|
||||||
|
if(OBJ_create(oval->value, oval->name, oval->name) == NID_undef)
|
||||||
|
{
|
||||||
|
ASN1err(ASN1_F_OID_MODULE_INIT, ASN1_R_ADDING_OBJECT);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ASN1_add_oid_module(void)
|
||||||
|
{
|
||||||
|
CONF_module_add("oid_section", oid_module_init, 0);
|
||||||
|
}
|
||||||
@@ -62,6 +62,15 @@
|
|||||||
#include <openssl/evp.h>
|
#include <openssl/evp.h>
|
||||||
#include <openssl/objects.h>
|
#include <openssl/objects.h>
|
||||||
#include <openssl/asn1.h>
|
#include <openssl/asn1.h>
|
||||||
|
#ifndef OPENSSL_NO_RSA
|
||||||
|
#include <openssl/rsa.h>
|
||||||
|
#endif
|
||||||
|
#ifndef OPENSSL_NO_DSA
|
||||||
|
#include <openssl/dsa.h>
|
||||||
|
#endif
|
||||||
|
#ifndef OPENSSL_NO_ECDSA
|
||||||
|
#include <openssl/ecdsa.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, unsigned char **pp,
|
EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, unsigned char **pp,
|
||||||
long length)
|
long length)
|
||||||
@@ -101,6 +110,16 @@ EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, unsigned char **pp,
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
#ifndef OPENSSL_NO_ECDSA
|
||||||
|
case EVP_PKEY_ECDSA:
|
||||||
|
if ((ret->pkey.ecdsa = d2i_ECDSAPrivateKey(NULL,
|
||||||
|
(const unsigned char **)pp, length)) == NULL)
|
||||||
|
{
|
||||||
|
ASN1err(ASN1_F_D2I_PRIVATEKEY, ERR_R_ASN1_LIB);
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
ASN1err(ASN1_F_D2I_PRIVATEKEY,ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE);
|
ASN1err(ASN1_F_D2I_PRIVATEKEY,ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE);
|
||||||
@@ -132,7 +151,10 @@ EVP_PKEY *d2i_AutoPrivateKey(EVP_PKEY **a, unsigned char **pp,
|
|||||||
/* Since we only need to discern "traditional format" RSA and DSA
|
/* Since we only need to discern "traditional format" RSA and DSA
|
||||||
* keys we can just count the elements.
|
* keys we can just count the elements.
|
||||||
*/
|
*/
|
||||||
if(sk_ASN1_TYPE_num(inkey) == 6) keytype = EVP_PKEY_DSA;
|
if(sk_ASN1_TYPE_num(inkey) == 6)
|
||||||
|
keytype = EVP_PKEY_DSA;
|
||||||
|
else if (sk_ASN1_TYPE_num(inkey) == 4)
|
||||||
|
keytype = EVP_PKEY_ECDSA;
|
||||||
else keytype = EVP_PKEY_RSA;
|
else keytype = EVP_PKEY_RSA;
|
||||||
sk_ASN1_TYPE_pop_free(inkey, ASN1_TYPE_free);
|
sk_ASN1_TYPE_pop_free(inkey, ASN1_TYPE_free);
|
||||||
return d2i_PrivateKey(keytype, a, pp, length);
|
return d2i_PrivateKey(keytype, a, pp, length);
|
||||||
|
|||||||
@@ -62,6 +62,15 @@
|
|||||||
#include <openssl/evp.h>
|
#include <openssl/evp.h>
|
||||||
#include <openssl/objects.h>
|
#include <openssl/objects.h>
|
||||||
#include <openssl/asn1.h>
|
#include <openssl/asn1.h>
|
||||||
|
#ifndef OPENSSL_NO_RSA
|
||||||
|
#include <openssl/rsa.h>
|
||||||
|
#endif
|
||||||
|
#ifndef OPENSSL_NO_DSA
|
||||||
|
#include <openssl/dsa.h>
|
||||||
|
#endif
|
||||||
|
#ifndef OPENSSL_NO_ECDSA
|
||||||
|
#include <openssl/ecdsa.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, unsigned char **pp,
|
EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, unsigned char **pp,
|
||||||
long length)
|
long length)
|
||||||
@@ -94,13 +103,23 @@ EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, unsigned char **pp,
|
|||||||
#endif
|
#endif
|
||||||
#ifndef OPENSSL_NO_DSA
|
#ifndef OPENSSL_NO_DSA
|
||||||
case EVP_PKEY_DSA:
|
case EVP_PKEY_DSA:
|
||||||
if ((ret->pkey.dsa=d2i_DSAPublicKey(NULL,
|
if ((ret->pkey.dsa=d2i_DSAPublicKey(&(ret->pkey.dsa),
|
||||||
(const unsigned char **)pp,length)) == NULL) /* TMP UGLY CAST */
|
(const unsigned char **)pp,length)) == NULL) /* TMP UGLY CAST */
|
||||||
{
|
{
|
||||||
ASN1err(ASN1_F_D2I_PUBLICKEY,ERR_R_ASN1_LIB);
|
ASN1err(ASN1_F_D2I_PUBLICKEY,ERR_R_ASN1_LIB);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
#ifndef OPENSSL_NO_ECDSA
|
||||||
|
case EVP_PKEY_ECDSA:
|
||||||
|
if ((ret->pkey.ecdsa = ECDSAPublicKey_set_octet_string(&(ret->pkey.ecdsa),
|
||||||
|
(const unsigned char **)pp, length)) == NULL)
|
||||||
|
{
|
||||||
|
ASN1err(ASN1_F_D2I_PUBLICKEY, ERR_R_ASN1_LIB);
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
ASN1err(ASN1_F_D2I_PUBLICKEY,ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE);
|
ASN1err(ASN1_F_D2I_PUBLICKEY,ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE);
|
||||||
|
|||||||
@@ -61,6 +61,15 @@
|
|||||||
#include <openssl/bn.h>
|
#include <openssl/bn.h>
|
||||||
#include <openssl/evp.h>
|
#include <openssl/evp.h>
|
||||||
#include <openssl/objects.h>
|
#include <openssl/objects.h>
|
||||||
|
#ifndef OPENSSL_NO_RSA
|
||||||
|
#include <openssl/rsa.h>
|
||||||
|
#endif
|
||||||
|
#ifndef OPENSSL_NO_DSA
|
||||||
|
#include <openssl/dsa.h>
|
||||||
|
#endif
|
||||||
|
#ifndef OPENSSL_NO_ECDSA
|
||||||
|
#include <openssl/ecdsa.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
int i2d_PrivateKey(EVP_PKEY *a, unsigned char **pp)
|
int i2d_PrivateKey(EVP_PKEY *a, unsigned char **pp)
|
||||||
{
|
{
|
||||||
@@ -77,6 +86,12 @@ int i2d_PrivateKey(EVP_PKEY *a, unsigned char **pp)
|
|||||||
return(i2d_DSAPrivateKey(a->pkey.dsa,pp));
|
return(i2d_DSAPrivateKey(a->pkey.dsa,pp));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef OPENSSL_NO_ECDSA
|
||||||
|
if (a->type == EVP_PKEY_ECDSA)
|
||||||
|
{
|
||||||
|
return(i2d_ECDSAPrivateKey(a->pkey.ecdsa, pp));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
ASN1err(ASN1_F_I2D_PRIVATEKEY,ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE);
|
ASN1err(ASN1_F_I2D_PRIVATEKEY,ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE);
|
||||||
return(-1);
|
return(-1);
|
||||||
|
|||||||
@@ -61,6 +61,15 @@
|
|||||||
#include <openssl/bn.h>
|
#include <openssl/bn.h>
|
||||||
#include <openssl/evp.h>
|
#include <openssl/evp.h>
|
||||||
#include <openssl/objects.h>
|
#include <openssl/objects.h>
|
||||||
|
#ifndef OPENSSL_NO_RSA
|
||||||
|
#include <openssl/rsa.h>
|
||||||
|
#endif
|
||||||
|
#ifndef OPENSSL_NO_DSA
|
||||||
|
#include <openssl/dsa.h>
|
||||||
|
#endif
|
||||||
|
#ifndef OPENSSL_NO_ECDSA
|
||||||
|
#include <openssl/ecdsa.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
int i2d_PublicKey(EVP_PKEY *a, unsigned char **pp)
|
int i2d_PublicKey(EVP_PKEY *a, unsigned char **pp)
|
||||||
{
|
{
|
||||||
@@ -73,6 +82,10 @@ int i2d_PublicKey(EVP_PKEY *a, unsigned char **pp)
|
|||||||
#ifndef OPENSSL_NO_DSA
|
#ifndef OPENSSL_NO_DSA
|
||||||
case EVP_PKEY_DSA:
|
case EVP_PKEY_DSA:
|
||||||
return(i2d_DSAPublicKey(a->pkey.dsa,pp));
|
return(i2d_DSAPublicKey(a->pkey.dsa,pp));
|
||||||
|
#endif
|
||||||
|
#ifndef OPENSSL_NO_ECDSA
|
||||||
|
case EVP_PKEY_ECDSA:
|
||||||
|
return(ECDSAPublicKey_get_octet_string(a->pkey.ecdsa, pp));
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
ASN1err(ASN1_F_I2D_PUBLICKEY,ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE);
|
ASN1err(ASN1_F_I2D_PUBLICKEY,ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE);
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ int i2d_RSA_NET(const RSA *a, unsigned char **pp, int (*cb)(), int sgckey)
|
|||||||
i = strlen((char *)buf);
|
i = strlen((char *)buf);
|
||||||
/* If the key is used for SGC the algorithm is modified a little. */
|
/* If the key is used for SGC the algorithm is modified a little. */
|
||||||
if(sgckey) {
|
if(sgckey) {
|
||||||
EVP_Digest(buf, i, buf, NULL, EVP_md5());
|
EVP_Digest(buf, i, buf, NULL, EVP_md5(), NULL);
|
||||||
memcpy(buf + 16, "SGCKEYSALT", 10);
|
memcpy(buf + 16, "SGCKEYSALT", 10);
|
||||||
i = 26;
|
i = 26;
|
||||||
}
|
}
|
||||||
@@ -207,9 +207,9 @@ int i2d_RSA_NET(const RSA *a, unsigned char **pp, int (*cb)(), int sgckey)
|
|||||||
/* Encrypt private key in place */
|
/* Encrypt private key in place */
|
||||||
zz = enckey->enckey->digest->data;
|
zz = enckey->enckey->digest->data;
|
||||||
EVP_CIPHER_CTX_init(&ctx);
|
EVP_CIPHER_CTX_init(&ctx);
|
||||||
EVP_EncryptInit(&ctx,EVP_rc4(),key,NULL);
|
EVP_EncryptInit_ex(&ctx,EVP_rc4(),NULL,key,NULL);
|
||||||
EVP_EncryptUpdate(&ctx,zz,&i,zz,pkeylen);
|
EVP_EncryptUpdate(&ctx,zz,&i,zz,pkeylen);
|
||||||
EVP_EncryptFinal(&ctx,zz + i,&j);
|
EVP_EncryptFinal_ex(&ctx,zz + i,&j);
|
||||||
EVP_CIPHER_CTX_cleanup(&ctx);
|
EVP_CIPHER_CTX_cleanup(&ctx);
|
||||||
|
|
||||||
ret = i2d_NETSCAPE_ENCRYPTED_PKEY(enckey, pp);
|
ret = i2d_NETSCAPE_ENCRYPTED_PKEY(enckey, pp);
|
||||||
@@ -284,7 +284,7 @@ static RSA *d2i_RSA_NET_2(RSA **a, ASN1_OCTET_STRING *os,
|
|||||||
|
|
||||||
i = strlen((char *)buf);
|
i = strlen((char *)buf);
|
||||||
if(sgckey){
|
if(sgckey){
|
||||||
EVP_Digest(buf, i, buf, NULL, EVP_md5());
|
EVP_Digest(buf, i, buf, NULL, EVP_md5(), NULL);
|
||||||
memcpy(buf + 16, "SGCKEYSALT", 10);
|
memcpy(buf + 16, "SGCKEYSALT", 10);
|
||||||
i = 26;
|
i = 26;
|
||||||
}
|
}
|
||||||
@@ -293,9 +293,9 @@ static RSA *d2i_RSA_NET_2(RSA **a, ASN1_OCTET_STRING *os,
|
|||||||
memset(buf,0,256);
|
memset(buf,0,256);
|
||||||
|
|
||||||
EVP_CIPHER_CTX_init(&ctx);
|
EVP_CIPHER_CTX_init(&ctx);
|
||||||
EVP_DecryptInit(&ctx,EVP_rc4(),key,NULL);
|
EVP_DecryptInit_ex(&ctx,EVP_rc4(),NULL, key,NULL);
|
||||||
EVP_DecryptUpdate(&ctx,os->data,&i,os->data,os->length);
|
EVP_DecryptUpdate(&ctx,os->data,&i,os->data,os->length);
|
||||||
EVP_DecryptFinal(&ctx,&(os->data[i]),&j);
|
EVP_DecryptFinal_ex(&ctx,&(os->data[i]),&j);
|
||||||
EVP_CIPHER_CTX_cleanup(&ctx);
|
EVP_CIPHER_CTX_cleanup(&ctx);
|
||||||
os->length=i+j;
|
os->length=i+j;
|
||||||
|
|
||||||
|
|||||||
@@ -116,8 +116,10 @@ X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter,
|
|||||||
if (RAND_pseudo_bytes(iv, EVP_CIPHER_iv_length(cipher)) < 0)
|
if (RAND_pseudo_bytes(iv, EVP_CIPHER_iv_length(cipher)) < 0)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
|
EVP_CIPHER_CTX_init(&ctx);
|
||||||
|
|
||||||
/* Dummy cipherinit to just setup the IV */
|
/* Dummy cipherinit to just setup the IV */
|
||||||
EVP_CipherInit(&ctx, cipher, NULL, iv, 0);
|
EVP_CipherInit_ex(&ctx, cipher, NULL, NULL, iv, 0);
|
||||||
if(EVP_CIPHER_param_to_asn1(&ctx, scheme->parameter) < 0) {
|
if(EVP_CIPHER_param_to_asn1(&ctx, scheme->parameter) < 0) {
|
||||||
ASN1err(ASN1_F_PKCS5_PBE2_SET,
|
ASN1err(ASN1_F_PKCS5_PBE2_SET,
|
||||||
ASN1_R_ERROR_SETTING_CIPHER_PARAMS);
|
ASN1_R_ERROR_SETTING_CIPHER_PARAMS);
|
||||||
|
|||||||
@@ -69,26 +69,29 @@
|
|||||||
#ifndef OPENSSL_NO_DSA
|
#ifndef OPENSSL_NO_DSA
|
||||||
#include <openssl/dsa.h>
|
#include <openssl/dsa.h>
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef OPENSSL_NO_ECDSA
|
||||||
|
#include <openssl/ecdsa.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
static int print(BIO *fp,const char *str,BIGNUM *num,
|
static int print(BIO *fp,const char *str,BIGNUM *num,
|
||||||
unsigned char *buf,int off);
|
unsigned char *buf,int off);
|
||||||
#ifndef OPENSSL_NO_RSA
|
#ifndef OPENSSL_NO_RSA
|
||||||
#ifndef OPENSSL_NO_FP_API
|
#ifndef OPENSSL_NO_FP_API
|
||||||
int RSA_print_fp(FILE *fp, const RSA *x, int off)
|
int RSA_print_fp(FILE *fp, const RSA *x, int off)
|
||||||
{
|
{
|
||||||
BIO *b;
|
BIO *b;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if ((b=BIO_new(BIO_s_file())) == NULL)
|
if ((b=BIO_new(BIO_s_file())) == NULL)
|
||||||
{
|
{
|
||||||
RSAerr(RSA_F_RSA_PRINT_FP,ERR_R_BUF_LIB);
|
RSAerr(RSA_F_RSA_PRINT_FP,ERR_R_BUF_LIB);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
BIO_set_fp(b,fp,BIO_NOCLOSE);
|
BIO_set_fp(b,fp,BIO_NOCLOSE);
|
||||||
ret=RSA_print(b,x,off);
|
ret=RSA_print(b,x,off);
|
||||||
BIO_free(b);
|
BIO_free(b);
|
||||||
return(ret);
|
return(ret);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int RSA_print(BIO *bp, const RSA *x, int off)
|
int RSA_print(BIO *bp, const RSA *x, int off)
|
||||||
@@ -209,6 +212,150 @@ err:
|
|||||||
}
|
}
|
||||||
#endif /* !OPENSSL_NO_DSA */
|
#endif /* !OPENSSL_NO_DSA */
|
||||||
|
|
||||||
|
#ifndef OPENSSL_NO_ECDSA
|
||||||
|
#ifndef OPENSSL_NO_FP_API
|
||||||
|
int ECDSA_print_fp(FILE *fp, const ECDSA *x, int off)
|
||||||
|
{
|
||||||
|
BIO *b;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if ((b=BIO_new(BIO_s_file())) == NULL)
|
||||||
|
{
|
||||||
|
ECDSAerr(ECDSA_F_ECDSA_PRINT_FP, ERR_R_BIO_LIB);
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
BIO_set_fp(b, fp, BIO_NOCLOSE);
|
||||||
|
ret = ECDSA_print(b, x, off);
|
||||||
|
BIO_free(b);
|
||||||
|
return(ret);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int ECDSA_print(BIO *bp, const ECDSA *x, int off)
|
||||||
|
{
|
||||||
|
char str[128];
|
||||||
|
unsigned char *buffer=NULL;
|
||||||
|
int i, buf_len=0, ret=0, reason=ERR_R_BIO_LIB;
|
||||||
|
BIGNUM *tmp_1=NULL, *tmp_2=NULL, *tmp_3=NULL,
|
||||||
|
*tmp_4=NULL, *tmp_5=NULL, *tmp_6=NULL,
|
||||||
|
*tmp_7=NULL;
|
||||||
|
BN_CTX *ctx=NULL;
|
||||||
|
EC_POINT *point=NULL;
|
||||||
|
|
||||||
|
/* TODO: fields other than prime fields */
|
||||||
|
|
||||||
|
if (!x || !x->group)
|
||||||
|
{
|
||||||
|
reason = ECDSA_R_MISSING_PARAMETERS;
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
if ((tmp_1 = BN_new()) == NULL || (tmp_2 = BN_new()) == NULL ||
|
||||||
|
(tmp_3 = BN_new()) == NULL || (ctx = BN_CTX_new()) == NULL ||
|
||||||
|
(tmp_6 = BN_new()) == NULL || (tmp_7 = BN_new()) == NULL)
|
||||||
|
{
|
||||||
|
reason = ERR_R_MALLOC_FAILURE;
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
if (!EC_GROUP_get_curve_GFp(x->group, tmp_1, tmp_2, tmp_3, ctx))
|
||||||
|
{
|
||||||
|
reason = ERR_R_EC_LIB;
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
if ((point = EC_GROUP_get0_generator(x->group)) == NULL)
|
||||||
|
{
|
||||||
|
reason = ERR_R_EC_LIB;
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
if (!EC_GROUP_get_order(x->group, tmp_6, NULL) || !EC_GROUP_get_cofactor(x->group, tmp_7, NULL))
|
||||||
|
{
|
||||||
|
reason = ERR_R_EC_LIB;
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
if ((buf_len = EC_POINT_point2oct(x->group, point, ECDSA_get_conversion_form(x), NULL, 0, ctx)) == 0)
|
||||||
|
{
|
||||||
|
reason = ECDSA_R_UNEXPECTED_PARAMETER_LENGTH;
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
if ((buffer = OPENSSL_malloc(buf_len)) == NULL)
|
||||||
|
{
|
||||||
|
reason = ERR_R_MALLOC_FAILURE;
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
if (!EC_POINT_point2oct(x->group, point, ECDSA_get_conversion_form(x),
|
||||||
|
buffer, buf_len, ctx)) goto err;
|
||||||
|
if ((tmp_4 = BN_bin2bn(buffer, buf_len, NULL)) == NULL)
|
||||||
|
{
|
||||||
|
reason = ERR_R_BN_LIB;
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
if ((i = EC_POINT_point2oct(x->group, x->pub_key, ECDSA_get_conversion_form(x), NULL, 0, ctx)) == 0)
|
||||||
|
{
|
||||||
|
reason = ECDSA_R_UNEXPECTED_PARAMETER_LENGTH;
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
if (i > buf_len && (buffer = OPENSSL_realloc(buffer, i)) == NULL)
|
||||||
|
{
|
||||||
|
reason = ERR_R_MALLOC_FAILURE;
|
||||||
|
buf_len = i;
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
if (!EC_POINT_point2oct(x->group, x->pub_key, ECDSA_get_conversion_form(x),
|
||||||
|
buffer, buf_len, ctx))
|
||||||
|
{
|
||||||
|
reason = ERR_R_EC_LIB;
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
if ((tmp_5 = BN_bin2bn(buffer, buf_len, NULL)) == NULL)
|
||||||
|
{
|
||||||
|
reason = ERR_R_BN_LIB;
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
if (tmp_1 != NULL)
|
||||||
|
i = BN_num_bytes(tmp_1)*2;
|
||||||
|
else
|
||||||
|
i=256;
|
||||||
|
if ((i + 10) > buf_len && (buffer = OPENSSL_realloc(buffer, i+10)) == NULL)
|
||||||
|
{
|
||||||
|
reason = ERR_R_MALLOC_FAILURE;
|
||||||
|
buf_len = i;
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
if (off)
|
||||||
|
{
|
||||||
|
if (off > 128) off=128;
|
||||||
|
memset(str,' ',off);
|
||||||
|
}
|
||||||
|
if (x->priv_key != NULL)
|
||||||
|
{
|
||||||
|
if (off && (BIO_write(bp, str, off) <= 0)) goto err;
|
||||||
|
if (BIO_printf(bp, "Private-Key: (%d bit)\n", BN_num_bits(tmp_1)) <= 0) goto err;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((x->priv_key != NULL) && !print(bp, "priv:", x->priv_key, buffer, off)) goto err;
|
||||||
|
if ((tmp_5 != NULL) && !print(bp, "pub: ", tmp_5, buffer, off)) goto err;
|
||||||
|
if ((tmp_1 != NULL) && !print(bp, "P: ", tmp_1, buffer, off)) goto err;
|
||||||
|
if ((tmp_2 != NULL) && !print(bp, "A: ", tmp_2, buffer, off)) goto err;
|
||||||
|
if ((tmp_3 != NULL) && !print(bp, "B: ", tmp_3, buffer, off)) goto err;
|
||||||
|
if ((tmp_4 != NULL) && !print(bp, "Gen: ", tmp_4, buffer, off)) goto err;
|
||||||
|
if ((tmp_6 != NULL) && !print(bp, "Order: ", tmp_6, buffer, off)) goto err;
|
||||||
|
if ((tmp_7 != NULL) && !print(bp, "Cofactor: ", tmp_7, buffer, off)) goto err;
|
||||||
|
ret=1;
|
||||||
|
err:
|
||||||
|
if (!ret)
|
||||||
|
ECDSAerr(ECDSA_F_ECDSA_PRINT, reason);
|
||||||
|
if (tmp_1) BN_free(tmp_1);
|
||||||
|
if (tmp_2) BN_free(tmp_2);
|
||||||
|
if (tmp_3) BN_free(tmp_3);
|
||||||
|
if (tmp_4) BN_free(tmp_4);
|
||||||
|
if (tmp_5) BN_free(tmp_5);
|
||||||
|
if (tmp_6) BN_free(tmp_6);
|
||||||
|
if (tmp_7) BN_free(tmp_7);
|
||||||
|
if (ctx) BN_CTX_free(ctx);
|
||||||
|
if (buffer != NULL) OPENSSL_free(buffer);
|
||||||
|
return(ret);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static int print(BIO *bp, const char *number, BIGNUM *num, unsigned char *buf,
|
static int print(BIO *bp, const char *number, BIGNUM *num, unsigned char *buf,
|
||||||
int off)
|
int off)
|
||||||
{
|
{
|
||||||
@@ -262,20 +409,20 @@ static int print(BIO *bp, const char *number, BIGNUM *num, unsigned char *buf,
|
|||||||
#ifndef OPENSSL_NO_DH
|
#ifndef OPENSSL_NO_DH
|
||||||
#ifndef OPENSSL_NO_FP_API
|
#ifndef OPENSSL_NO_FP_API
|
||||||
int DHparams_print_fp(FILE *fp, const DH *x)
|
int DHparams_print_fp(FILE *fp, const DH *x)
|
||||||
{
|
{
|
||||||
BIO *b;
|
BIO *b;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if ((b=BIO_new(BIO_s_file())) == NULL)
|
if ((b=BIO_new(BIO_s_file())) == NULL)
|
||||||
{
|
{
|
||||||
DHerr(DH_F_DHPARAMS_PRINT_FP,ERR_R_BUF_LIB);
|
DHerr(DH_F_DHPARAMS_PRINT_FP,ERR_R_BUF_LIB);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
BIO_set_fp(b,fp,BIO_NOCLOSE);
|
BIO_set_fp(b,fp,BIO_NOCLOSE);
|
||||||
ret=DHparams_print(b, x);
|
ret=DHparams_print(b, x);
|
||||||
BIO_free(b);
|
BIO_free(b);
|
||||||
return(ret);
|
return(ret);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int DHparams_print(BIO *bp, const DH *x)
|
int DHparams_print(BIO *bp, const DH *x)
|
||||||
@@ -315,20 +462,20 @@ err:
|
|||||||
#ifndef OPENSSL_NO_DSA
|
#ifndef OPENSSL_NO_DSA
|
||||||
#ifndef OPENSSL_NO_FP_API
|
#ifndef OPENSSL_NO_FP_API
|
||||||
int DSAparams_print_fp(FILE *fp, const DSA *x)
|
int DSAparams_print_fp(FILE *fp, const DSA *x)
|
||||||
{
|
{
|
||||||
BIO *b;
|
BIO *b;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if ((b=BIO_new(BIO_s_file())) == NULL)
|
if ((b=BIO_new(BIO_s_file())) == NULL)
|
||||||
{
|
{
|
||||||
DSAerr(DSA_F_DSAPARAMS_PRINT_FP,ERR_R_BUF_LIB);
|
DSAerr(DSA_F_DSAPARAMS_PRINT_FP,ERR_R_BUF_LIB);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
BIO_set_fp(b,fp,BIO_NOCLOSE);
|
BIO_set_fp(b,fp,BIO_NOCLOSE);
|
||||||
ret=DSAparams_print(b, x);
|
ret=DSAparams_print(b, x);
|
||||||
BIO_free(b);
|
BIO_free(b);
|
||||||
return(ret);
|
return(ret);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int DSAparams_print(BIO *bp, const DSA *x)
|
int DSAparams_print(BIO *bp, const DSA *x)
|
||||||
@@ -359,3 +506,95 @@ err:
|
|||||||
|
|
||||||
#endif /* !OPENSSL_NO_DSA */
|
#endif /* !OPENSSL_NO_DSA */
|
||||||
|
|
||||||
|
#ifndef OPENSSL_NO_ECDSA
|
||||||
|
#ifndef OPENSSL_NO_FP_API
|
||||||
|
int ECDSAParameters_print_fp(FILE *fp, const ECDSA *x)
|
||||||
|
{
|
||||||
|
BIO *b;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if ((b=BIO_new(BIO_s_file())) == NULL)
|
||||||
|
{
|
||||||
|
ECDSAerr(ECDSA_F_ECDSAPARAMETERS_PRINT_FP, ERR_R_BIO_LIB);
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
BIO_set_fp(b, fp, BIO_NOCLOSE);
|
||||||
|
ret = ECDSAParameters_print(b, x);
|
||||||
|
BIO_free(b);
|
||||||
|
return(ret);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int ECDSAParameters_print(BIO *bp, const ECDSA *x)
|
||||||
|
{
|
||||||
|
unsigned char *buffer=NULL;
|
||||||
|
int buf_len;
|
||||||
|
int reason=ERR_R_EC_LIB, i, ret=0;
|
||||||
|
BIGNUM *tmp_1=NULL, *tmp_2=NULL, *tmp_3=NULL, *tmp_4=NULL,
|
||||||
|
*tmp_5=NULL, *tmp_6=NULL;
|
||||||
|
BN_CTX *ctx=NULL;
|
||||||
|
EC_POINT *point=NULL;
|
||||||
|
|
||||||
|
/* TODO: fields other than prime fields */
|
||||||
|
if (!x || !x->group)
|
||||||
|
{
|
||||||
|
reason = ECDSA_R_MISSING_PARAMETERS;
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
if ((tmp_1 = BN_new()) == NULL || (tmp_2 = BN_new()) == NULL ||
|
||||||
|
(tmp_3 = BN_new()) == NULL || (tmp_5 = BN_new()) == NULL ||
|
||||||
|
(tmp_6 = BN_new()) == NULL || (ctx = BN_CTX_new()) == NULL)
|
||||||
|
{
|
||||||
|
reason = ERR_R_MALLOC_FAILURE;
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
if (!EC_GROUP_get_curve_GFp(x->group, tmp_1, tmp_2, tmp_3, ctx)) goto err;
|
||||||
|
if ((point = EC_GROUP_get0_generator(x->group)) == NULL) goto err;
|
||||||
|
if (!EC_GROUP_get_order(x->group, tmp_5, ctx)) goto err;
|
||||||
|
if (!EC_GROUP_get_cofactor(x->group, tmp_6, ctx)) goto err;
|
||||||
|
buf_len = EC_POINT_point2oct(x->group, point, ECDSA_get_conversion_form(x), NULL, 0, ctx);
|
||||||
|
if (!buf_len || (buffer = OPENSSL_malloc(buf_len)) == NULL)
|
||||||
|
{
|
||||||
|
reason = ERR_R_MALLOC_FAILURE;
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
if (!EC_POINT_point2oct(x->group, point, ECDSA_get_conversion_form(x), buffer, buf_len, ctx))
|
||||||
|
{
|
||||||
|
reason = ERR_R_EC_LIB;
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
if ((tmp_4 = BN_bin2bn(buffer, buf_len, NULL)) == NULL)
|
||||||
|
{
|
||||||
|
reason = ERR_R_BN_LIB;
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
|
||||||
|
i = BN_num_bits(tmp_1) + 10;
|
||||||
|
if (i > buf_len && (buffer = OPENSSL_realloc(buffer, i)) == NULL)
|
||||||
|
{
|
||||||
|
reason=ERR_R_MALLOC_FAILURE;
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (BIO_printf(bp, "ECDSA-Parameters: (%d bit)\n", BN_num_bits(tmp_1)) <= 0) goto err;
|
||||||
|
if (!print(bp, "Prime p:", tmp_1, buffer, 4)) goto err;
|
||||||
|
if (!print(bp, "Curve a:", tmp_2, buffer, 4)) goto err;
|
||||||
|
if (!print(bp, "Curve b:", tmp_3, buffer, 4)) goto err;
|
||||||
|
if (!print(bp, "Generator (compressed):", tmp_4, buffer, 4)) goto err;
|
||||||
|
if (!print(bp, "Order:", tmp_5, buffer, 4)) goto err;
|
||||||
|
if (!print(bp, "Cofactor:", tmp_6, buffer, 4)) goto err;
|
||||||
|
ret=1;
|
||||||
|
err:
|
||||||
|
if (tmp_1) BN_free(tmp_1);
|
||||||
|
if (tmp_2) BN_free(tmp_2);
|
||||||
|
if (tmp_3) BN_free(tmp_3);
|
||||||
|
if (tmp_4) BN_free(tmp_4);
|
||||||
|
if (tmp_5) BN_free(tmp_5);
|
||||||
|
if (tmp_6) BN_free(tmp_6);
|
||||||
|
if (ctx) BN_CTX_free(ctx);
|
||||||
|
if (buffer) OPENSSL_free(buffer);
|
||||||
|
ECDSAerr(ECDSA_F_ECDSAPARAMETERS_PRINT, reason);
|
||||||
|
return(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user