Compare commits
289 Commits
STATE_befo
...
OpenSSL_0_
Author | SHA1 | Date | |
---|---|---|---|
![]() |
48acb9e08a | ||
![]() |
e5706ccbde | ||
![]() |
9a82ef5255 | ||
![]() |
4a1dcb2d03 | ||
![]() |
ef92312b41 | ||
![]() |
4673461789 | ||
![]() |
2f8275c52d | ||
![]() |
39ebb51bba | ||
![]() |
d7227da9a8 | ||
![]() |
ab805194a6 | ||
![]() |
4fac53a757 | ||
![]() |
11198b78a2 | ||
![]() |
573a568dd0 | ||
![]() |
ff3dd00370 | ||
![]() |
2028c2800a | ||
![]() |
fd8766b67e | ||
![]() |
7d210e5194 | ||
![]() |
2e674fc611 | ||
![]() |
5cfd3419c6 | ||
![]() |
9efd4fb891 | ||
![]() |
b2e85f9d93 | ||
![]() |
f10581829d | ||
![]() |
78af3b274f | ||
![]() |
facd9a2024 | ||
![]() |
461f00dd53 | ||
![]() |
22f03eaedf | ||
![]() |
d467c74954 | ||
![]() |
c4c745ccb8 | ||
![]() |
3b66e34e74 | ||
![]() |
2250f475fc | ||
![]() |
ed703912b2 | ||
![]() |
2cddcd1dbb | ||
![]() |
231360a3b7 | ||
![]() |
65ac3faff6 | ||
![]() |
778252741e | ||
![]() |
96e40d97cc | ||
![]() |
4b3743c85a | ||
![]() |
5795665a7d | ||
![]() |
88f1be140c | ||
![]() |
fc16b228fd | ||
![]() |
a5b2ccaaad | ||
![]() |
5dd352c916 | ||
![]() |
3c204aaf50 | ||
![]() |
3ae184d31f | ||
![]() |
3e975124f3 | ||
![]() |
74c467f9f2 | ||
![]() |
1b97c938e9 | ||
![]() |
b3e2acac4e | ||
![]() |
403fa0dc53 | ||
![]() |
f918c330a9 | ||
![]() |
7f52f77efe | ||
![]() |
90b480f2af | ||
![]() |
578c33c010 | ||
![]() |
d6a821b9d7 | ||
![]() |
7d8b5c530f | ||
![]() |
2033da0b23 | ||
![]() |
c4ac954c59 | ||
![]() |
2640aec227 | ||
![]() |
a1037ce3bc | ||
![]() |
249737e53d | ||
![]() |
c70573dee1 | ||
![]() |
6c98ed520d | ||
![]() |
37ceea7333 | ||
![]() |
374b227226 | ||
![]() |
8c4a5016ce | ||
![]() |
1056275825 | ||
![]() |
9634acedaf | ||
![]() |
3a4b0bed49 | ||
![]() |
84f4e33ea3 | ||
![]() |
b093ef7445 | ||
![]() |
405ac901c9 | ||
![]() |
721ccb6cf5 | ||
![]() |
ba05727773 | ||
![]() |
f9332da521 | ||
![]() |
156516ce44 | ||
![]() |
157e44a799 | ||
![]() |
7d2ff3f081 | ||
![]() |
25a87e82d4 | ||
![]() |
e400753ed8 | ||
![]() |
0984fcf118 | ||
![]() |
18cc99ac17 | ||
![]() |
1522c23470 | ||
![]() |
2341e303da | ||
![]() |
dca142029c | ||
![]() |
7448f5e5ed | ||
![]() |
45caf9c50c | ||
![]() |
ace2ca484b | ||
![]() |
7dc584ed91 | ||
![]() |
855f0b4f2f | ||
![]() |
2bf30d6b47 | ||
![]() |
685e7d7225 | ||
![]() |
38dbcb2248 | ||
![]() |
bb3a69f801 | ||
![]() |
55db40d3e0 | ||
![]() |
f1fbf15116 | ||
![]() |
9bdbdda261 | ||
![]() |
ad2057500a | ||
![]() |
d0e3726ca4 | ||
![]() |
75a46764e5 | ||
![]() |
4eceda658b | ||
![]() |
1c511bdb7c | ||
![]() |
f9bd76e4f7 | ||
![]() |
e74e0dedcd | ||
![]() |
dcf6eb2a9e | ||
![]() |
7d2980f09e | ||
![]() |
f1fe6fa6e4 | ||
![]() |
ecb7a9c73a | ||
![]() |
aebe0396e9 | ||
![]() |
4e9a77cf26 | ||
![]() |
14ef32631c | ||
![]() |
500f07c8de | ||
![]() |
ae936dae90 | ||
![]() |
67166dc05c | ||
![]() |
aa9fed8cc2 | ||
![]() |
442eb8a4c3 | ||
![]() |
46805f696d | ||
![]() |
29f6a99432 | ||
![]() |
1f13793b1a | ||
![]() |
08130eb158 | ||
![]() |
b27dfeacc9 | ||
![]() |
fb0f53b2e0 | ||
![]() |
baa521bef5 | ||
![]() |
7bcf65a125 | ||
![]() |
306009bb6a | ||
![]() |
dfc5336975 | ||
![]() |
4cea95a547 | ||
![]() |
b23b3272dc | ||
![]() |
1696aa1891 | ||
![]() |
52407725c9 | ||
![]() |
81da3c3319 | ||
![]() |
7729bc2634 | ||
![]() |
69a305d434 | ||
![]() |
ab5b1cf86b | ||
![]() |
c33387749b | ||
![]() |
c9ca65b469 | ||
![]() |
8e078f45e0 | ||
![]() |
f84ffd0130 | ||
![]() |
300e3d7c73 | ||
![]() |
365c6e4661 | ||
![]() |
1dc03ef706 | ||
![]() |
d4a67e3186 | ||
![]() |
18e10315e5 | ||
![]() |
e9caaa4ad9 | ||
![]() |
a6198b9ed1 | ||
![]() |
a7be294ed7 | ||
![]() |
617f461c9d | ||
![]() |
1dcb6c994f | ||
![]() |
a9ab63c01c | ||
![]() |
f89db4020f | ||
![]() |
393c09659e | ||
![]() |
2d96549cd0 | ||
![]() |
b48892d403 | ||
![]() |
7b907f0bb5 | ||
![]() |
9dfcad117c | ||
![]() |
7018feed88 | ||
![]() |
9be529f12d | ||
![]() |
f5e5277908 | ||
![]() |
c991c6e710 | ||
![]() |
e1f4319279 | ||
![]() |
2826fcc851 | ||
![]() |
37562f753a | ||
![]() |
248252682c | ||
![]() |
cc3586028e | ||
![]() |
f60df86c89 | ||
![]() |
bc7a3a9e99 | ||
![]() |
d3cbf7d86a | ||
![]() |
313bf45e42 | ||
![]() |
ce34d0ac09 | ||
![]() |
4e9dd6b0f5 | ||
![]() |
b6ccbffe2b | ||
![]() |
1aecc34e9e | ||
![]() |
75b9c0044c | ||
![]() |
600b77a93f | ||
![]() |
39335c356b | ||
![]() |
a3c62bb737 | ||
![]() |
2f6263a696 | ||
![]() |
35748f40d6 | ||
![]() |
ed62478192 | ||
![]() |
9e7733a743 | ||
![]() |
fc0bdd1aa8 | ||
![]() |
e9dad4048f | ||
![]() |
ddba94214f | ||
![]() |
e9f970891d | ||
![]() |
a89cf50c59 | ||
![]() |
f90c544039 | ||
![]() |
afcf54a5c9 | ||
![]() |
3671e38af4 | ||
![]() |
4fc3946111 | ||
![]() |
59a941e4a4 | ||
![]() |
a7cd5f3f38 | ||
![]() |
0bdbc5a86e | ||
![]() |
abecef77cf | ||
![]() |
b74dfe6e8e | ||
![]() |
d80f6e0f8c | ||
![]() |
13962f0b15 | ||
![]() |
2fc1f3dd48 | ||
![]() |
f2cbb15468 | ||
![]() |
e38e8b29f8 | ||
![]() |
c03ceadfbd | ||
![]() |
e50baf58ab | ||
![]() |
1750ec5c52 | ||
![]() |
c77bd28775 | ||
![]() |
1619add90c | ||
![]() |
a1a4e8b6bb | ||
![]() |
25f350a058 | ||
![]() |
121cb9ee38 | ||
![]() |
bc173b9fb0 | ||
![]() |
4fd9c70f06 | ||
![]() |
91aeab0de3 | ||
![]() |
c913cf446f | ||
![]() |
a88f39457b | ||
![]() |
2bbaab4a24 | ||
![]() |
1a8f4b57a9 | ||
![]() |
022b31a8c8 | ||
![]() |
dd6b494eb3 | ||
![]() |
c9bea5bad3 | ||
![]() |
296324ea03 | ||
![]() |
fa41e86a28 | ||
![]() |
9e77b7075a | ||
![]() |
5c7f9a627f | ||
![]() |
bc3e3472c1 | ||
![]() |
66bd86e2c2 | ||
![]() |
487fe20490 | ||
![]() |
80d9b1ccd7 | ||
![]() |
69c48301e0 | ||
![]() |
2be9b88135 | ||
![]() |
98fa4fce09 | ||
![]() |
1ec1d17e16 | ||
![]() |
1e11df0dc3 | ||
![]() |
421d474332 | ||
![]() |
58060fa11b | ||
![]() |
cea698f19c | ||
![]() |
48781ef7f7 | ||
![]() |
6d1a837df7 | ||
![]() |
21f422ca5e | ||
![]() |
291ae60b52 | ||
![]() |
3b79d2789d | ||
![]() |
bb9dcc99cf | ||
![]() |
3d59821134 | ||
![]() |
cae111287b | ||
![]() |
e36e473859 | ||
![]() |
d7fb66aa82 | ||
![]() |
344b3b5ce1 | ||
![]() |
3f7cf29124 | ||
![]() |
63dc69fef6 | ||
![]() |
cfe1c195c4 | ||
![]() |
0cd8572b2d | ||
![]() |
7c2831ac90 | ||
![]() |
de603b75fc | ||
![]() |
1244be2eda | ||
![]() |
9f0a373b51 | ||
![]() |
b0701709c1 | ||
![]() |
34aa216a65 | ||
![]() |
a76a29f233 | ||
![]() |
4e06ab75e8 | ||
![]() |
26147fb954 | ||
![]() |
bd53a054b1 | ||
![]() |
211b8685d3 | ||
![]() |
9c75b2d931 | ||
![]() |
54d11e6057 | ||
![]() |
3d7ba69a05 | ||
![]() |
58133d22a8 | ||
![]() |
330e5c5460 | ||
![]() |
ab519c8262 | ||
![]() |
65f29a78b2 | ||
![]() |
c363b5a62f | ||
![]() |
60ed0f94ed | ||
![]() |
f38f8d94a9 | ||
![]() |
679eb352e0 | ||
![]() |
80bbb6578e | ||
![]() |
19cc0f0ab4 | ||
![]() |
14e14ea68c | ||
![]() |
834d37ed86 | ||
![]() |
adcc235ef6 | ||
![]() |
86a0d0234d | ||
![]() |
4598be561a | ||
![]() |
af5db47e99 | ||
![]() |
fb67f40f04 | ||
![]() |
48033c3242 | ||
![]() |
aa1f5b3581 | ||
![]() |
d9d3a69595 | ||
![]() |
f9adfa6d4e | ||
![]() |
85b1fce1ef | ||
![]() |
da566db150 | ||
![]() |
be37dc73f6 | ||
![]() |
976b2c9c2f | ||
![]() |
b74d2cda28 | ||
![]() |
cc5dd9f14e | ||
![]() |
fbfcdc4cef |
@@ -1,4 +1,3 @@
|
||||
openssl.pc
|
||||
Makefile.ssl
|
||||
MINFO
|
||||
makefile.one
|
||||
|
651
CHANGES
651
CHANGES
@@ -2,499 +2,7 @@
|
||||
OpenSSL CHANGES
|
||||
_______________
|
||||
|
||||
Changes between 0.9.7 and 0.9.8 [xx XXX 2002]
|
||||
|
||||
*) Add the ASN.1 structures and functions for CertificatePair, which
|
||||
is defined as follows (according to X.509_4thEditionDraftV6.pdf):
|
||||
|
||||
CertificatePair ::= SEQUENCE {
|
||||
forward [0] Certificate OPTIONAL,
|
||||
reverse [1] Certificate OPTIONAL,
|
||||
-- at least one of the pair shall be present -- }
|
||||
|
||||
Also implement the PEM functions to read and write certificate
|
||||
pairs, and defined the PEM tag as "CERTIFICATE PAIR".
|
||||
|
||||
This needed to be defined, mostly for the sake of the LDAP
|
||||
attribute crossCertificatePair, but may prove useful elsewhere as
|
||||
well.
|
||||
[Richard Levitte]
|
||||
|
||||
*) Make it possible to inhibit symlinking of shared libraries in
|
||||
Makefile.shared, for Cygwin's sake.
|
||||
[Richard Levitte]
|
||||
|
||||
*) Extend the BIGNUM API by creating new macros that behave like
|
||||
functions
|
||||
|
||||
void BN_set_sign(BIGNUM *a, int neg);
|
||||
int BN_get_sign(const BIGNUM *a);
|
||||
|
||||
and avoid the need to access 'a->neg' directly in applications.
|
||||
[Nils Larsch <nla@trustcenter.de>]
|
||||
|
||||
*) Implement fast modular reduction for pseudo-Mersenne primes
|
||||
used in NIST curves (crypto/bn/bn_nist.c, crypto/ec/ecp_nist.c).
|
||||
EC_GROUP_new_curve_GFp() will now automatically use this
|
||||
if applicable.
|
||||
[Nils Larsch <nla@trustcenter.de>]
|
||||
|
||||
*) Add new lock type (CRYPTO_LOCK_BN).
|
||||
[Bodo Moeller]
|
||||
|
||||
*) Change the ENGINE framework to automatically load engines
|
||||
dynamically from specific directories unless they could be
|
||||
found to already be built in or loaded. Move all the
|
||||
current engines except for the cryptodev one to a new
|
||||
directory engines/.
|
||||
The engines in engines/ are built as shared libraries if
|
||||
the "shared" options was given to ./Configure or ./config.
|
||||
Otherwise, they are inserted in libcrypto.a.
|
||||
/usr/local/ssl/engines is the default directory for dynamic
|
||||
engines, but that can be overriden at configure time through
|
||||
the usual use of --prefix and/or --openssldir, and at run
|
||||
time with the environment variable OPENSSL_ENGINES.
|
||||
[Geoff Thorpe and Richard Levitte]
|
||||
|
||||
*) Add Makefile.shared, a helper makefile to build shared
|
||||
libraries. Addapt Makefile.org.
|
||||
[Richard Levitte]
|
||||
|
||||
*) Add version info to Win32 DLLs.
|
||||
[Peter 'Luna' Runestig" <peter@runestig.com>]
|
||||
|
||||
*) Add new 'medium level' PKCS#12 API. Certificates and keys
|
||||
can be added using this API to created arbitrary PKCS#12
|
||||
files while avoiding the low level API.
|
||||
|
||||
New options to PKCS12_create(), key or cert can be NULL and
|
||||
will then be omitted from the output file. The encryption
|
||||
algorithm NIDs can be set to -1 for no encryption, the mac
|
||||
iteration count can be set to 0 to omit the mac.
|
||||
|
||||
Enhance pkcs12 utility by making the -nokeys and -nocerts
|
||||
options work when creating a PKCS#12 file. New option -nomac
|
||||
to omit the mac, NONE can be set for an encryption algorithm.
|
||||
New code is modified to use the enhanced PKCS12_create()
|
||||
instead of the low level API.
|
||||
[Steve Henson]
|
||||
|
||||
*) Extend ASN1 encoder to support indefinite length constructed
|
||||
encoding. This can output sequences tags and octet strings in
|
||||
this form. Modify pk7_asn1.c to support indefinite length
|
||||
encoding. This is experimental and needs additional code to
|
||||
be useful, such as an ASN1 bio and some enhanced streaming
|
||||
PKCS#7 code.
|
||||
|
||||
Extend template encode functionality so that tagging is passed
|
||||
down to the template encoder.
|
||||
[Steve Henson]
|
||||
|
||||
*) Let 'openssl req' fail if an argument to '-newkey' is not
|
||||
recognized instead of using RSA as a default.
|
||||
[Bodo Moeller]
|
||||
|
||||
*) Add support for ECC-based ciphersuites from draft-ietf-tls-ecc-01.txt.
|
||||
As these are not official, they are not included in "ALL";
|
||||
the "ECCdraft" ciphersuite group alias can be used to select them.
|
||||
[Vipul Gupta and Sumit Gupta (Sun Microsystems Laboratories)]
|
||||
|
||||
*) Add ECDH engine support.
|
||||
[Nils Gura and Douglas Stebila (Sun Microsystems Laboratories)]
|
||||
|
||||
*) Add ECDH in new directory crypto/ecdh/.
|
||||
TODO: more general interface (return x coordinate, not its hash)
|
||||
TODO: bug: pad x with leading zeros if necessary
|
||||
[Douglas Stebila (Sun Microsystems Laboratories)]
|
||||
|
||||
*) Let BN_rand_range() abort with an error after 100 iterations
|
||||
without success (which indicates a broken PRNG).
|
||||
[Bodo Moeller]
|
||||
|
||||
*) Change BN_mod_sqrt() so that it verifies that the input value
|
||||
is really the square of the return value. (Previously,
|
||||
BN_mod_sqrt would show GIGO behaviour.)
|
||||
[Bodo Moeller]
|
||||
|
||||
*) Add named elliptic curves over binary fields from X9.62, SECG,
|
||||
and WAP/WTLS; add OIDs that were still missing.
|
||||
|
||||
[Sheueling Chang Shantz and Douglas Stebila
|
||||
(Sun Microsystems Laboratories)]
|
||||
|
||||
*) Extend the EC library for elliptic curves over binary fields
|
||||
(new files ec2_smpl.c, ec2_smpt.c, ec2_mult.c in crypto/ec/).
|
||||
New EC_METHOD:
|
||||
|
||||
EC_GF2m_simple_method
|
||||
|
||||
New API functions:
|
||||
|
||||
EC_GROUP_new_curve_GF2m
|
||||
EC_GROUP_set_curve_GF2m
|
||||
EC_GROUP_get_curve_GF2m
|
||||
EC_POINT_set_affine_coordinates_GF2m
|
||||
EC_POINT_get_affine_coordinates_GF2m
|
||||
EC_POINT_set_compressed_coordinates_GF2m
|
||||
|
||||
Point compression for binary fields is disabled by default for
|
||||
patent reasons (compile with OPENSSL_EC_BIN_PT_COMP defined to
|
||||
enable it).
|
||||
|
||||
As binary polynomials are represented as BIGNUMs, various members
|
||||
of the EC_GROUP and EC_POINT data structures can be shared
|
||||
between the implementations for prime fields and binary fields;
|
||||
the above ..._GF2m functions (except for EX_GROUP_new_curve_GF2m)
|
||||
are essentially identical to their ..._GFp counterparts.
|
||||
(For simplicity, the '..._GFp' prefix has been dropped from
|
||||
various internal method names.)
|
||||
|
||||
An internal 'field_div' method (similar to 'field_mul' and
|
||||
'field_sqr') has been added; this is used only for binary fields.
|
||||
|
||||
[Sheueling Chang Shantz and Douglas Stebila
|
||||
(Sun Microsystems Laboratories)]
|
||||
|
||||
*) Optionally dispatch EC_POINT_mul(), EC_POINT_precompute_mult()
|
||||
through methods ('mul', 'precompute_mult').
|
||||
|
||||
The generic implementations (now internally called 'ec_wNAF_mul'
|
||||
and 'ec_wNAF_precomputed_mult') remain the default if these
|
||||
methods are undefined.
|
||||
|
||||
[Sheueling Chang Shantz and Douglas Stebila
|
||||
(Sun Microsystems Laboratories)]
|
||||
|
||||
*) New function EC_GROUP_get_degree, which is defined through
|
||||
EC_METHOD. For curves over prime fields, this returns the bit
|
||||
length of the modulus.
|
||||
|
||||
[Sheueling Chang Shantz and Douglas Stebila
|
||||
(Sun Microsystems Laboratories)]
|
||||
|
||||
*) New functions EC_GROUP_dup, EC_POINT_dup.
|
||||
(These simply call ..._new and ..._copy).
|
||||
|
||||
[Sheueling Chang Shantz and Douglas Stebila
|
||||
(Sun Microsystems Laboratories)]
|
||||
|
||||
*) Add binary polynomial arithmetic software in crypto/bn/bn_gf2m.c.
|
||||
Polynomials are represented as BIGNUMs (where the sign bit is not
|
||||
used) in the following functions [macros]:
|
||||
|
||||
BN_GF2m_add
|
||||
BN_GF2m_sub [= BN_GF2m_add]
|
||||
BN_GF2m_mod [wrapper for BN_GF2m_mod_arr]
|
||||
BN_GF2m_mod_mul [wrapper for BN_GF2m_mod_mul_arr]
|
||||
BN_GF2m_mod_sqr [wrapper for BN_GF2m_mod_sqr_arr]
|
||||
BN_GF2m_mod_inv
|
||||
BN_GF2m_mod_exp [wrapper for BN_GF2m_mod_exp_arr]
|
||||
BN_GF2m_mod_sqrt [wrapper for BN_GF2m_mod_sqrt_arr]
|
||||
BN_GF2m_mod_solve_quad [wrapper for BN_GF2m_mod_solve_quad_arr]
|
||||
BN_GF2m_cmp [= BN_ucmp]
|
||||
|
||||
(Note that only the 'mod' functions are actually for fields GF(2^m).
|
||||
BN_GF2m_add() is misnomer, but this is for the sake of consistency.)
|
||||
|
||||
For some functions, an the irreducible polynomial defining a
|
||||
field can be given as an 'unsigned int[]' with strictly
|
||||
decreasing elements giving the indices of those bits that are set;
|
||||
i.e., p[] represents the polynomial
|
||||
f(t) = t^p[0] + t^p[1] + ... + t^p[k]
|
||||
where
|
||||
p[0] > p[1] > ... > p[k] = 0.
|
||||
This applies to the following functions:
|
||||
|
||||
BN_GF2m_mod_arr
|
||||
BN_GF2m_mod_mul_arr
|
||||
BN_GF2m_mod_sqr_arr
|
||||
BN_GF2m_mod_inv_arr [wrapper for BN_GF2m_mod_inv]
|
||||
BN_GF2m_mod_div_arr [wrapper for BN_GF2m_mod_div]
|
||||
BN_GF2m_mod_exp_arr
|
||||
BN_GF2m_mod_sqrt_arr
|
||||
BN_GF2m_mod_solve_quad_arr
|
||||
BN_GF2m_poly2arr
|
||||
BN_GF2m_arr2poly
|
||||
|
||||
Conversion can be performed by the following functions:
|
||||
|
||||
BN_GF2m_poly2arr
|
||||
BN_GF2m_arr2poly
|
||||
|
||||
bntest.c has additional tests for binary polynomial arithmetic.
|
||||
|
||||
Two implementations for BN_GF2m_mod_div() are available.
|
||||
The default algorithm simply uses BN_GF2m_mod_inv() and
|
||||
BN_GF2m_mod_mul(). The alternative algorithm is compiled in only
|
||||
if OPENSSL_SUN_GF2M_DIV is defined (patent pending; read the
|
||||
copyright notice in crypto/bn/bn_gf2m.c before enabling it).
|
||||
|
||||
[Sheueling Chang Shantz and Douglas Stebila
|
||||
(Sun Microsystems Laboratories)]
|
||||
|
||||
*) Add new error code 'ERR_R_DISABLED' that can be used when some
|
||||
functionality is disabled at compile-time.
|
||||
[Douglas Stebila <douglas.stebila@sun.com>]
|
||||
|
||||
*) Change default behaviour of 'openssl asn1parse' so that more
|
||||
information is visible when viewing, e.g., a certificate:
|
||||
|
||||
Modify asn1_parse2 (crypto/asn1/asn1_par.c) so that in non-'dump'
|
||||
mode the content of non-printable OCTET STRINGs is output in a
|
||||
style similar to INTEGERs, but with '[HEX DUMP]' prepended to
|
||||
avoid the appearance of a printable string.
|
||||
[Nils Larsch <nla@trustcenter.de>]
|
||||
|
||||
*) Add 'asn1_flag' and 'asn1_form' member to EC_GROUP with access
|
||||
functions
|
||||
EC_GROUP_set_asn1_flag()
|
||||
EC_GROUP_get_asn1_flag()
|
||||
EC_GROUP_set_point_conversion_form()
|
||||
EC_GROUP_get_point_conversion_form()
|
||||
These control ASN1 encoding details:
|
||||
- Curves (i.e., groups) are encoded explicitly unless asn1_flag
|
||||
has been set to OPENSSL_EC_NAMED_CURVE.
|
||||
- Points are encoded in uncompressed form by default; options for
|
||||
asn1_for are as for point2oct, namely
|
||||
POINT_CONVERSION_COMPRESSED
|
||||
POINT_CONVERSION_UNCOMPRESSED
|
||||
POINT_CONVERSION_HYBRID
|
||||
|
||||
Also add 'seed' and 'seed_len' members to EC_GROUP with access
|
||||
functions
|
||||
EC_GROUP_set_seed()
|
||||
EC_GROUP_get0_seed()
|
||||
EC_GROUP_get_seed_len()
|
||||
This is used only for ASN1 purposes (so far).
|
||||
[Nils Larsch <nla@trustcenter.de>]
|
||||
|
||||
*) Add 'field_type' member to EC_METHOD, which holds the NID
|
||||
of the appropriate field type OID. The new function
|
||||
EC_METHOD_get_field_type() returns this value.
|
||||
[Nils Larsch <nla@trustcenter.de>]
|
||||
|
||||
*) Add functions
|
||||
EC_POINT_point2bn()
|
||||
EC_POINT_bn2point()
|
||||
EC_POINT_point2hex()
|
||||
EC_POINT_hex2point()
|
||||
providing useful interfaces to EC_POINT_point2oct() and
|
||||
EC_POINT_oct2point().
|
||||
[Nils Larsch <nla@trustcenter.de>]
|
||||
|
||||
*) Change internals of the EC library so that the functions
|
||||
EC_GROUP_set_generator()
|
||||
EC_GROUP_get_generator()
|
||||
EC_GROUP_get_order()
|
||||
EC_GROUP_get_cofactor()
|
||||
are implemented directly in crypto/ec/ec_lib.c and not dispatched
|
||||
to methods, which would lead to unnecessary code duplication when
|
||||
adding different types of curves.
|
||||
[Nils Larsch <nla@trustcenter.de> with input by Bodo Moeller]
|
||||
|
||||
*) Implement compute_wNAF (crypto/ec/ec_mult.c) without BIGNUM
|
||||
arithmetic, and such that modified wNAFs are generated
|
||||
(which avoid length expansion in many cases).
|
||||
[Bodo Moeller]
|
||||
|
||||
*) Add a function EC_GROUP_check_discriminant() (defined via
|
||||
EC_METHOD) that verifies that the curve discriminant is non-zero.
|
||||
|
||||
Add a function EC_GROUP_check() that makes some sanity tests
|
||||
on a EC_GROUP, its generator and order. This includes
|
||||
EC_GROUP_check_discriminant().
|
||||
[Nils Larsch <nla@trustcenter.de>]
|
||||
|
||||
*) Add ECDSA in new directory crypto/ecdsa/.
|
||||
|
||||
Add applications 'openssl ecparam' and 'openssl ecdsa'
|
||||
(these are based on 'openssl dsaparam' and 'openssl dsa').
|
||||
|
||||
ECDSA support is also included in various other files across the
|
||||
library. Most notably,
|
||||
- 'openssl req' now has a '-newkey ecdsa:file' option;
|
||||
- EVP_PKCS82PKEY (crypto/evp/evp_pkey.c) now can handle ECDSA;
|
||||
- X509_PUBKEY_get (crypto/asn1/x_pubkey.c) and
|
||||
d2i_PublicKey (crypto/asn1/d2i_pu.c) have been modified to make
|
||||
them suitable for ECDSA where domain parameters must be
|
||||
extracted before the specific public key;
|
||||
- ECDSA engine support has been added.
|
||||
[Nils Larsch <nla@trustcenter.de>]
|
||||
|
||||
*) Include some named elliptic curves, and add OIDs from X9.62,
|
||||
SECG, and WAP/WTLS. Each curve can be obtained from the new
|
||||
function
|
||||
EC_GROUP_new_by_nid(),
|
||||
and the list of available named curves can be obtained with
|
||||
EC_get_builtin_curves().
|
||||
Also add a 'curve_name' member to EC_GROUP objects, which can be
|
||||
accessed via
|
||||
EC_GROUP_set_nid()
|
||||
EC_GROUP_get_nid()
|
||||
[Nils Larsch <nla@trustcenter.de, Bodo Moeller]
|
||||
|
||||
Changes between 0.9.6h and 0.9.7 [XX xxx 2002]
|
||||
|
||||
*) In asn1_d2i_read_bio() repeatedly call BIO_read() until all content
|
||||
octets have been read, EOF or an error occurs. Without this change
|
||||
some truncated ASN1 structures will not produce an error.
|
||||
[Steve Henson]
|
||||
|
||||
*) Disable Heimdal support, since it hasn't been fully implemented.
|
||||
Still give the possibility to force the use of Heimdal, but with
|
||||
warnings and a request that patches get sent to openssl-dev.
|
||||
[Richard Levitte]
|
||||
|
||||
*) Add the VC-CE target, introduce the WINCE sysname, and add
|
||||
INSTALL.WCE and appropriate conditionals to make it build.
|
||||
[Steven Reddie <smr@essemer.com.au> via Richard Levitte]
|
||||
|
||||
*) Change the DLL names for Cygwin to cygcrypto-x.y.z.dll and
|
||||
cygssl-x.y.z.dll, where x, y and z are the major, minor and
|
||||
edit numbers of the version.
|
||||
[Corinna Vinschen <vinschen@redhat.com> and Richard Levitte]
|
||||
|
||||
*) Introduce safe string copy and catenation functions
|
||||
(BUF_strlcpy() and BUF_strlcat()).
|
||||
[Ben Laurie (CHATS) and Richard Levitte]
|
||||
|
||||
*) Avoid using fixed-size buffers for one-line DNs.
|
||||
[Ben Laurie (CHATS)]
|
||||
|
||||
*) Add BUF_MEM_grow_clean() to avoid information leakage when
|
||||
resizing buffers containing secrets, and use where appropriate.
|
||||
[Ben Laurie (CHATS)]
|
||||
|
||||
*) Avoid using fixed size buffers for configuration file location.
|
||||
[Ben Laurie (CHATS)]
|
||||
|
||||
*) Avoid filename truncation for various CA files.
|
||||
[Ben Laurie (CHATS)]
|
||||
|
||||
*) Use sizeof in preference to magic numbers.
|
||||
[Ben Laurie (CHATS)]
|
||||
|
||||
*) Avoid filename truncation in cert requests.
|
||||
[Ben Laurie (CHATS)]
|
||||
|
||||
*) Add assertions to check for (supposedly impossible) buffer
|
||||
overflows.
|
||||
[Ben Laurie (CHATS)]
|
||||
|
||||
*) Don't cache truncated DNS entries in the local cache (this could
|
||||
potentially lead to a spoofing attack).
|
||||
[Ben Laurie (CHATS)]
|
||||
|
||||
*) Fix various buffers to be large enough for hex/decimal
|
||||
representations in a platform independent manner.
|
||||
[Ben Laurie (CHATS)]
|
||||
|
||||
*) Add CRYPTO_realloc_clean() to avoid information leakage when
|
||||
resizing buffers containing secrets, and use where appropriate.
|
||||
[Ben Laurie (CHATS)]
|
||||
|
||||
*) Add BIO_indent() to avoid much slightly worrying code to do
|
||||
indents.
|
||||
[Ben Laurie (CHATS)]
|
||||
|
||||
*) Convert sprintf()/BIO_puts() to BIO_printf().
|
||||
[Ben Laurie (CHATS)]
|
||||
|
||||
*) buffer_gets() could terminate with the buffer only half
|
||||
full. Fixed.
|
||||
[Ben Laurie (CHATS)]
|
||||
|
||||
*) Add assertions to prevent user-supplied crypto functions from
|
||||
overflowing internal buffers by having large block sizes, etc.
|
||||
[Ben Laurie (CHATS)]
|
||||
|
||||
*) New OPENSSL_assert() macro (similar to assert(), but enabled
|
||||
unconditionally).
|
||||
[Ben Laurie (CHATS)]
|
||||
|
||||
*) Eliminate unused copy of key in RC4.
|
||||
[Ben Laurie (CHATS)]
|
||||
|
||||
*) Eliminate unused and incorrectly sized buffers for IV in pem.h.
|
||||
[Ben Laurie (CHATS)]
|
||||
|
||||
*) Fix off-by-one error in EGD path.
|
||||
[Ben Laurie (CHATS)]
|
||||
|
||||
*) If RANDFILE path is too long, ignore instead of truncating.
|
||||
[Ben Laurie (CHATS)]
|
||||
|
||||
*) Eliminate unused and incorrectly sized X.509 structure
|
||||
CBCParameter.
|
||||
[Ben Laurie (CHATS)]
|
||||
|
||||
*) Eliminate unused and dangerous function knumber().
|
||||
[Ben Laurie (CHATS)]
|
||||
|
||||
*) Eliminate unused and dangerous structure, KSSL_ERR.
|
||||
[Ben Laurie (CHATS)]
|
||||
|
||||
*) Protect against overlong session ID context length in an encoded
|
||||
session object. Since these are local, this does not appear to be
|
||||
exploitable.
|
||||
[Ben Laurie (CHATS)]
|
||||
|
||||
*) Change from security patch (see 0.9.6e below) that did not affect
|
||||
the 0.9.6 release series:
|
||||
|
||||
Remote buffer overflow in SSL3 protocol - an attacker could
|
||||
supply an oversized master key in Kerberos-enabled versions.
|
||||
(CAN-2002-0657)
|
||||
[Ben Laurie (CHATS)]
|
||||
|
||||
*) Change the SSL kerb5 codes to match RFC 2712.
|
||||
[Richard Levitte]
|
||||
|
||||
*) Make -nameopt work fully for req and add -reqopt switch.
|
||||
[Michael Bell <michael.bell@rz.hu-berlin.de>, Steve Henson]
|
||||
|
||||
*) The "block size" for block ciphers in CFB and OFB mode should be 1.
|
||||
[Steve Henson, reported by Yngve Nysaeter Pettersen <yngve@opera.com>]
|
||||
|
||||
*) Make sure tests can be performed even if the corresponding algorithms
|
||||
have been removed entirely. This was also the last step to make
|
||||
OpenSSL compilable with DJGPP under all reasonable conditions.
|
||||
[Richard Levitte, Doug Kaufman <dkaufman@rahul.net>]
|
||||
|
||||
*) Add cipher selection rules COMPLEMENTOFALL and COMPLEMENTOFDEFAULT
|
||||
to allow version independent disabling of normally unselected ciphers,
|
||||
which may be activated as a side-effect of selecting a single cipher.
|
||||
|
||||
(E.g., cipher list string "RSA" enables ciphersuites that are left
|
||||
out of "ALL" because they do not provide symmetric encryption.
|
||||
"RSA:!COMPLEMEMENTOFALL" avoids these unsafe ciphersuites.)
|
||||
[Lutz Jaenicke, Bodo Moeller]
|
||||
|
||||
*) Add appropriate support for separate platform-dependent build
|
||||
directories. The recommended way to make a platform-dependent
|
||||
build directory is the following (tested on Linux), maybe with
|
||||
some local tweaks:
|
||||
|
||||
# Place yourself outside of the OpenSSL source tree. In
|
||||
# this example, the environment variable OPENSSL_SOURCE
|
||||
# is assumed to contain the absolute OpenSSL source directory.
|
||||
mkdir -p objtree/"`uname -s`-`uname -r`-`uname -m`"
|
||||
cd objtree/"`uname -s`-`uname -r`-`uname -m`"
|
||||
(cd $OPENSSL_SOURCE; find . -type f -o -type l) | while read F; do
|
||||
mkdir -p `dirname $F`
|
||||
ln -s $OPENSSL_SOURCE/$F $F
|
||||
done
|
||||
|
||||
To be absolutely sure not to disturb the source tree, a "make clean"
|
||||
is a good thing. If it isn't successfull, don't worry about it,
|
||||
it probably means the source directory is very clean.
|
||||
[Richard Levitte]
|
||||
|
||||
*) Make sure any ENGINE control commands make local copies of string
|
||||
pointers passed to them whenever necessary. Otherwise it is possible
|
||||
the caller may have overwritten (or deallocated) the original string
|
||||
data when a later ENGINE operation tries to use the stored values.
|
||||
[G<>tz Babin-Ebell <babinebell@trustcenter.de>]
|
||||
Changes between 0.9.6d and 0.9.7 [XX xxx 2002]
|
||||
|
||||
*) Improve diagnostics in file reading and command-line digests.
|
||||
[Ben Laurie aided and abetted by Solar Designer <solar@openwall.com>]
|
||||
@@ -956,8 +464,8 @@ TODO: bug: pad x with leading zeros if necessary
|
||||
[Bodo Moeller, Lutz Jaenicke]
|
||||
|
||||
*) Rationalise EVP so it can be extended: don't include a union of
|
||||
cipher/digest structures, add init/cleanup functions for EVP_MD_CTX
|
||||
(similar to those existing for EVP_CIPHER_CTX).
|
||||
cipher/digest structures, add init/cleanup functions. This also reduces
|
||||
the number of header dependencies.
|
||||
Usage example:
|
||||
|
||||
EVP_MD_CTX md;
|
||||
@@ -1541,15 +1049,14 @@ des-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
handle the new API. Currently only ECB, CBC modes supported. Add new
|
||||
AES OIDs.
|
||||
|
||||
Add TLS AES ciphersuites as described in RFC3268, "Advanced
|
||||
Encryption Standard (AES) Ciphersuites for Transport Layer
|
||||
Security (TLS)". (In beta versions of OpenSSL 0.9.7, these were
|
||||
not enabled by default and were not part of the "ALL" ciphersuite
|
||||
alias because they were not yet official; they could be
|
||||
explicitly requested by specifying the "AESdraft" ciphersuite
|
||||
group alias. In the final release of OpenSSL 0.9.7, the group
|
||||
alias is called "AES" and is part of "ALL".)
|
||||
[Ben Laurie, Steve Henson, Bodo Moeller]
|
||||
Add TLS AES ciphersuites as described in the "AES Ciphersuites
|
||||
for TLS" draft-ietf-tls-ciphersuite-06.txt. As these are not yet
|
||||
official, they are not enabled by default and are not even part
|
||||
of the "ALL" ciphersuite alias; for now, they must be explicitly
|
||||
requested by specifying the new "AESdraft" ciphersuite alias. If
|
||||
you want the default ciphersuite list plus the new ciphersuites,
|
||||
use "DEFAULT:AESdraft:@STRENGTH".
|
||||
[Ben Laurie, Steve Henson, Bodo Moeller]
|
||||
|
||||
*) New function OCSP_copy_nonce() to copy nonce value (if present) from
|
||||
request to response.
|
||||
@@ -2119,106 +1626,7 @@ des-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
*) Clean old EAY MD5 hack from e_os.h.
|
||||
[Richard Levitte]
|
||||
|
||||
Changes between 0.9.6g and 0.9.6h [5 Dec 2002]
|
||||
|
||||
*) New function OPENSSL_cleanse(), which is used to cleanse a section of
|
||||
memory from it's contents. This is done with a counter that will
|
||||
place alternating values in each byte. This can be used to solve
|
||||
two issues: 1) the removal of calls to memset() by highly optimizing
|
||||
compilers, and 2) cleansing with other values than 0, since those can
|
||||
be read through on certain media, for example a swap space on disk.
|
||||
[Geoff Thorpe]
|
||||
|
||||
*) Bugfix: client side session caching did not work with external caching,
|
||||
because the session->cipher setting was not restored when reloading
|
||||
from the external cache. This problem was masked, when
|
||||
SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG (part of SSL_OP_ALL) was set.
|
||||
(Found by Steve Haslam <steve@araqnid.ddts.net>.)
|
||||
[Lutz Jaenicke]
|
||||
|
||||
*) Fix client_certificate (ssl/s2_clnt.c): The permissible total
|
||||
length of the REQUEST-CERTIFICATE message is 18 .. 34, not 17 .. 33.
|
||||
[Zeev Lieber <zeev-l@yahoo.com>]
|
||||
|
||||
*) Undo an undocumented change introduced in 0.9.6e which caused
|
||||
repeated calls to OpenSSL_add_all_ciphers() and
|
||||
OpenSSL_add_all_digests() to be ignored, even after calling
|
||||
EVP_cleanup().
|
||||
[Richard Levitte]
|
||||
|
||||
*) Change the default configuration reader to deal with last line not
|
||||
being properly terminated.
|
||||
[Richard Levitte]
|
||||
|
||||
*) Change X509_NAME_cmp() so it applies the special rules on handling
|
||||
DN values that are of type PrintableString, as well as RDNs of type
|
||||
emailAddress where the value has the type ia5String.
|
||||
[stefank@valicert.com via Richard Levitte]
|
||||
|
||||
*) Add a SSL_SESS_CACHE_NO_INTERNAL_STORE flag to take over half
|
||||
the job SSL_SESS_CACHE_NO_INTERNAL_LOOKUP was inconsistently
|
||||
doing, define a new flag (SSL_SESS_CACHE_NO_INTERNAL) to be
|
||||
the bitwise-OR of the two for use by the majority of applications
|
||||
wanting this behaviour, and update the docs. The documented
|
||||
behaviour and actual behaviour were inconsistent and had been
|
||||
changing anyway, so this is more a bug-fix than a behavioural
|
||||
change.
|
||||
[Geoff Thorpe, diagnosed by Nadav Har'El]
|
||||
|
||||
*) Don't impose a 16-byte length minimum on session IDs in ssl/s3_clnt.c
|
||||
(the SSL 3.0 and TLS 1.0 specifications allow any length up to 32 bytes).
|
||||
[Bodo Moeller]
|
||||
|
||||
*) Fix initialization code race conditions in
|
||||
SSLv23_method(), SSLv23_client_method(), SSLv23_server_method(),
|
||||
SSLv2_method(), SSLv2_client_method(), SSLv2_server_method(),
|
||||
SSLv3_method(), SSLv3_client_method(), SSLv3_server_method(),
|
||||
TLSv1_method(), TLSv1_client_method(), TLSv1_server_method(),
|
||||
ssl2_get_cipher_by_char(),
|
||||
ssl3_get_cipher_by_char().
|
||||
[Patrick McCormick <patrick@tellme.com>, Bodo Moeller]
|
||||
|
||||
*) Reorder cleanup sequence in SSL_CTX_free(): only remove the ex_data after
|
||||
the cached sessions are flushed, as the remove_cb() might use ex_data
|
||||
contents. Bug found by Sam Varshavchik <mrsam@courier-mta.com>
|
||||
(see [openssl.org #212]).
|
||||
[Geoff Thorpe, Lutz Jaenicke]
|
||||
|
||||
*) Fix typo in OBJ_txt2obj which incorrectly passed the content
|
||||
length, instead of the encoding length to d2i_ASN1_OBJECT.
|
||||
[Steve Henson]
|
||||
|
||||
Changes between 0.9.6f and 0.9.6g [9 Aug 2002]
|
||||
|
||||
*) [In 0.9.6g-engine release:]
|
||||
Fix crypto/engine/vendor_defns/cswift.h for WIN32 (use '_stdcall').
|
||||
[Lynn Gazis <lgazis@rainbow.com>]
|
||||
|
||||
Changes between 0.9.6e and 0.9.6f [8 Aug 2002]
|
||||
|
||||
*) Fix ASN1 checks. Check for overflow by comparing with LONG_MAX
|
||||
and get fix the header length calculation.
|
||||
[Florian Weimer <Weimer@CERT.Uni-Stuttgart.DE>,
|
||||
Alon Kantor <alonk@checkpoint.com> (and others),
|
||||
Steve Henson]
|
||||
|
||||
*) Use proper error handling instead of 'assertions' in buffer
|
||||
overflow checks added in 0.9.6e. This prevents DoS (the
|
||||
assertions could call abort()).
|
||||
[Arne Ansper <arne@ats.cyber.ee>, Bodo Moeller]
|
||||
|
||||
Changes between 0.9.6d and 0.9.6e [30 Jul 2002]
|
||||
|
||||
*) Add various sanity checks to asn1_get_length() to reject
|
||||
the ASN1 length bytes if they exceed sizeof(long), will appear
|
||||
negative or the content length exceeds the length of the
|
||||
supplied buffer.
|
||||
[Steve Henson, Adi Stav <stav@mercury.co.il>, James Yonan <jim@ntlp.com>]
|
||||
|
||||
*) Fix cipher selection routines: ciphers without encryption had no flags
|
||||
for the cipher strength set and where therefore not handled correctly
|
||||
by the selection routines (PR #130).
|
||||
[Lutz Jaenicke]
|
||||
Changes between 0.9.6d and 0.9.6e [XX xxx XXXX]
|
||||
|
||||
*) Fix EVP_dsa_sha macro.
|
||||
[Nils Larsch]
|
||||
@@ -2236,35 +1644,6 @@ des-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
applications.
|
||||
[Bodo Moeller]
|
||||
|
||||
*) Changes in security patch:
|
||||
|
||||
Changes marked "(CHATS)" were sponsored by the Defense Advanced
|
||||
Research Projects Agency (DARPA) and Air Force Research Laboratory,
|
||||
Air Force Materiel Command, USAF, under agreement number
|
||||
F30602-01-2-0537.
|
||||
|
||||
*) Add various sanity checks to asn1_get_length() to reject
|
||||
the ASN1 length bytes if they exceed sizeof(long), will appear
|
||||
negative or the content length exceeds the length of the
|
||||
supplied buffer. (CAN-2002-0659)
|
||||
[Steve Henson, Adi Stav <stav@mercury.co.il>, James Yonan <jim@ntlp.com>]
|
||||
|
||||
*) Assertions for various potential buffer overflows, not known to
|
||||
happen in practice.
|
||||
[Ben Laurie (CHATS)]
|
||||
|
||||
*) Various temporary buffers to hold ASCII versions of integers were
|
||||
too small for 64 bit platforms. (CAN-2002-0655)
|
||||
[Matthew Byng-Maddick <mbm@aldigital.co.uk> and Ben Laurie (CHATS)>
|
||||
|
||||
*) Remote buffer overflow in SSL3 protocol - an attacker could
|
||||
supply an oversized session ID to a client. (CAN-2002-0656)
|
||||
[Ben Laurie (CHATS)]
|
||||
|
||||
*) Remote buffer overflow in SSL2 protocol - an attacker could
|
||||
supply an oversized client master key. (CAN-2002-0656)
|
||||
[Ben Laurie (CHATS)]
|
||||
|
||||
Changes between 0.9.6c and 0.9.6d [9 May 2002]
|
||||
|
||||
*) Fix crypto/asn1/a_sign.c so that 'parameters' is omitted (not
|
||||
@@ -2351,13 +1730,13 @@ des-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
|
||||
value is 0.
|
||||
[Richard Levitte]
|
||||
|
||||
*) Add the configuration target linux-s390x.
|
||||
[Neale Ferguson <Neale.Ferguson@SoftwareAG-USA.com> via Richard Levitte]
|
||||
|
||||
*) [In 0.9.6d-engine release:]
|
||||
Fix a crashbug and a logic bug in hwcrhk_load_pubkey().
|
||||
[Toomas Kiisk <vix@cyber.ee> via Richard Levitte]
|
||||
|
||||
*) Add the configuration target linux-s390x.
|
||||
[Neale Ferguson <Neale.Ferguson@SoftwareAG-USA.com> via Richard Levitte]
|
||||
|
||||
*) The earlier bugfix for the SSL3_ST_SW_HELLO_REQ_C case of
|
||||
ssl3_accept (ssl/s3_srvr.c) incorrectly used a local flag
|
||||
variable as an indication that a ClientHello message has been
|
||||
|
194
Configure
194
Configure
@@ -120,7 +120,7 @@ my $alpha_asm="::::::::";
|
||||
# -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
|
||||
|
||||
#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 : $arflags
|
||||
#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=(
|
||||
# File 'TABLE' (created by 'make TABLE') contains the data from this list,
|
||||
@@ -134,7 +134,7 @@ my %table=(
|
||||
|
||||
# Our development configs
|
||||
"purify", "purify gcc:-g -DPURIFY -Wall::(unknown)::-lsocket -lnsl::::",
|
||||
"debug", "gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -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-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)::::",
|
||||
@@ -145,10 +145,8 @@ my %table=(
|
||||
"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 -mcpu=i486 -pedantic -Wall -Werror -Wshadow -pipe::-D_REENTRANT::-rdynamic -ldl:${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn",
|
||||
"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-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 -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -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 -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -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-extreme","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 -W -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wconversion -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-extreme","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 -W -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wconversion -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 -W -Wtraditional -Wundef -Wshadow -Wid-clash-31 -Wcast-align -Wconversion -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 -W -Wtraditional -Wundef -Wshadow -Wid-clash-31 -Wcast-align -Wconversion -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)::::::",
|
||||
|
||||
# Basic configs that should work on any (32 and less bit) box
|
||||
@@ -171,11 +169,11 @@ my %table=(
|
||||
"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)",
|
||||
# -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)",
|
||||
"solaris64-sparcv9-gcc31","gcc:-mcpu=ultrasparc -m64 -O3 -fomit-frame-pointer -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:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
"solaris64-sparcv9-gcc31","gcc:-mcpu=ultrasparc -m64 -O3 -fomit-frame-pointer -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)",
|
||||
# gcc pre-2.8 doesn't understand -mcpu=ultrasparc, so fall down to -mv8
|
||||
# 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)",
|
||||
"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:-m64:.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)",
|
||||
@@ -203,12 +201,13 @@ my %table=(
|
||||
# it's a real mess with -mcpu=ultrasparc option under Linux, but
|
||||
# -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:-ldl: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)",
|
||||
# GCC 3.1 is a requirement
|
||||
"linux64-sparcv9","gcc:-m64 -mcpu=ultrasparc -DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT:ULTRASPARC:-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR::::asm/md5-sparcv9.o::::::dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
# !!!Folowing can't be even tested yet!!!
|
||||
# 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:",
|
||||
|
||||
# Sunos configs, assuming sparc for the gcc one.
|
||||
##"sunos-cc", "cc:-O4 -DNOPROTO -DNOCONST::(unknown):SUNOS::DES_UNROLL:::",
|
||||
"sunos-gcc","gcc:-O3 -mv8 -Dssize_t=int::(unknown):SUNOS::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL DES_PTR DES_RISC1:::",
|
||||
##"sunos-cc", "cc:-O4 -DNOPROTO -DNOCONST::(unknown):::DES_UNROLL:::",
|
||||
"sunos-gcc","gcc:-O3 -mv8 -Dssize_t=int::(unknown):::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL DES_PTR DES_RISC1:::",
|
||||
|
||||
#### IRIX 5.x configs
|
||||
# -mips2 flag is added by ./config when appropriate.
|
||||
@@ -388,10 +387,9 @@ my %table=(
|
||||
"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-m68k", "gcc:-DB_ENDIAN -DTERMIO -O2 -fomit-frame-pointer -Wall::-D_REENTRANT:::BN_LLONG::",
|
||||
"linux-s390", "gcc:-DB_ENDIAN -DTERMIO -DNO_ASM -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
"linux-s390x", "gcc:-DB_ENDIAN -DTERMIO -DNO_ASM -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
"linux-s390", "gcc:-DB_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT:::BN_LLONG::",
|
||||
"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)",
|
||||
"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)",
|
||||
"linux-x86_64", "gcc:-DL_ENDIAN -DNO_ASM ::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG::::::::::dlfcn: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)",
|
||||
"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-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)",
|
||||
@@ -415,13 +413,13 @@ my %table=(
|
||||
"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.0x fails destest with -O
|
||||
"unixware-2.0","cc:-DFILIO_H -DNO_STRINGS_H::-Kthread::-lsocket -lnsl -lresolv -lx:${x86_gcc_des} ${x86_gcc_opts}:::",
|
||||
"unixware-2.0-pentium","cc:-DFILIO_H -DNO_STRINGS_H -Kpentium::-Kthread::-lsocket -lnsl -lresolv -lx:MD2_CHAR RC4_INDEX ${x86_gcc_des}::",
|
||||
"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 -lresolv -lx:${x86_gcc_des} ${x86_gcc_opts}:::",
|
||||
"unixware-2.1-pentium","cc:-O -DFILIO_H -Kpentium::-Kthread::-lsocket -lnsl -lresolv -lx:MD2_CHAR RC4_INDEX ${x86_gcc_des}::",
|
||||
"unixware-2.1-p6","cc:-O -DFILIO_H -Kp6::-Kthread::-lsocket -lnsl -lresolv -lx:MD2_CHAR RC4_INDEX ${x86_gcc_des}::",
|
||||
"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","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)",
|
||||
@@ -439,8 +437,7 @@ my %table=(
|
||||
"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:::",
|
||||
"aix43-cc", "cc:-O -DAIX -DB_ENDIAN -qmaxmem=16384::(unknown):::BN_LLONG RC4_CHAR::::::::::dlfcn:",
|
||||
"aix43-gcc", "gcc:-O1 -DAIX -DB_ENDIAN::(unknown):::BN_LLONG RC4_CHAR::::::::::dlfcn:",
|
||||
"aix64-cc", "cc:-O -DAIX -DB_ENDIAN -qmaxmem=16384 -q64::(unknown):::SIXTY_FOUR_BIT_LONG RC4_CHAR::::::::::dlfcn::::::-X 64",
|
||||
"aix43-gcc", "gcc:-O3 -DAIX -DB_ENDIAN::(unknown):::BN_LLONG RC4_CHAR::::::::::dlfcn:",
|
||||
|
||||
#
|
||||
# Cray T90 and similar (SDSC)
|
||||
@@ -500,7 +497,6 @@ my %table=(
|
||||
# Windows NT, Microsoft Visual C++ 4.0
|
||||
|
||||
"VC-NT","cl::::WINNT::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}::::::::::win32",
|
||||
"VC-CE","cl::::WINCE::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${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-W31-16","cl:::(unknown):WIN16::BN_LLONG MD2_CHAR DES_UNROLL DES_PTR RC4_INDEX SIXTEEN_BIT:::",
|
||||
@@ -521,10 +517,10 @@ my %table=(
|
||||
|
||||
# Cygwin
|
||||
"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 -march=i486 -Wall:::CYGWIN32::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_out_asm}:win32:cygwin-shared:::.dll",
|
||||
"Cygwin", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall:::CYGWIN32::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_out_asm}:win32:cygwin-shared:::.dll",
|
||||
|
||||
# DJGPP
|
||||
"DJGPP", "gcc:-I/dev/env/WATT_ROOT/inc -DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O2 -Wall:::MSDOS:-L/dev/env/WATT_ROOT/lib -lwatt:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}::::::::::",
|
||||
"DJGPP", "gcc:-I/dev/env/DJDIR/watt32/inc -DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O2 -Wall:::MSDOS:-L$ENV{DJDIR}/watt32/lib -lwatt:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}::::::::::",
|
||||
|
||||
# Ultrix from Bernhard Simon <simon@zid.tuwien.ac.at>
|
||||
"ultrix-cc","cc:-std1 -O -Olimit 1000 -DL_ENDIAN::(unknown):::::::",
|
||||
@@ -546,12 +542,9 @@ my %table=(
|
||||
"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
|
||||
"rhapsody-ppc-cc","cc:-O3 -DB_ENDIAN::(unknown):MACOSX_RHAPSODY::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:::",
|
||||
"darwin-ppc-cc","cc:-O3 -fomit-frame-pointer -fno-common -DB_ENDIAN::-D_REENTRANT:MACOSX::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:::::::::::darwin-shared:-fPIC::.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
|
||||
"darwin-i386-cc","cc:-O3 -fomit-frame-pointer -fno-common -DB_ENDIAN::-D_REENTRANT:MACOSX::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:::::::::::darwin-shared:-fPIC::.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
|
||||
|
||||
##### A/UX
|
||||
"aux3-gcc","gcc:-O2 -DTERMIO::(unknown):AUX:-lbsd: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:::::::::::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:::::::::::darwin-shared:-fPIC::.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
|
||||
|
||||
##### Sony NEWS-OS 4.x
|
||||
"newsos4-gcc","gcc:-O -DB_ENDIAN::(unknown):NEWS4:-lmld -liberty:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR::::",
|
||||
@@ -564,16 +557,11 @@ my %table=(
|
||||
|
||||
##### VxWorks for various targets
|
||||
"vxworks-ppc405","ccppc:-g -msoft-float -mlongcall -DCPU=PPC405 -I\$(WIND_BASE)/target/h:::VXWORKS:-r:::::",
|
||||
"vxworks-ppc750","ccppc:-ansi -nostdinc -DPPC750 -D_REENTRANT -fvolatile -fno-builtin -fno-for-scope -fsigned-char -Wall -msoft-float -mlongcall -DCPU=PPC604 -I\$(WIND_BASE)/target/h \$(DEBUG_FLAG):::VXWORKS:-r:::::",
|
||||
"vxworks-ppc750-debug","ccppc:-ansi -nostdinc -DPPC750 -D_REENTRANT -fvolatile -fno-builtin -fno-for-scope -fsigned-char -Wall -msoft-float -mlongcall -DCPU=PPC604 -I\$(WIND_BASE)/target/h -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DDEBUG -g:::VXWORKS:-r:::::",
|
||||
|
||||
##### Compaq Non-Stop Kernel (Tandem)
|
||||
"tandem-c89","c89:-Ww -D__TANDEM -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1 -D_TANDEM_SOURCE -DB_ENDIAN::(unknown):::THIRTY_TWO_BIT:::",
|
||||
|
||||
);
|
||||
|
||||
my @WinTargets=qw(VC-NT VC-CE VC-WIN32 VC-WIN16 VC-W31-16 VC-W31-32 VC-MSDOS
|
||||
BC-32 BC-16 Mingw32 OS2-EMX);
|
||||
my @WinTargets=qw(VC-NT VC-WIN32 VC-WIN16 VC-W31-16 VC-W31-32 VC-MSDOS BC-32
|
||||
BC-16 Mingw32 OS2-EMX);
|
||||
|
||||
my $idx = 0;
|
||||
my $idx_cc = $idx++;
|
||||
@@ -598,7 +586,6 @@ my $idx_shared_cflag = $idx++;
|
||||
my $idx_shared_ldflag = $idx++;
|
||||
my $idx_shared_extension = $idx++;
|
||||
my $idx_ranlib = $idx++;
|
||||
my $idx_arflags = $idx++;
|
||||
|
||||
my $prefix="";
|
||||
my $openssldir="";
|
||||
@@ -718,7 +705,7 @@ PROCESS_ARGS:
|
||||
{ $threads=1; }
|
||||
elsif (/^no-shared$/)
|
||||
{ $no_shared=1; }
|
||||
elsif (/^shared$/ || /^-shared$/ || /^--shared$/)
|
||||
elsif (/^shared$/)
|
||||
{ $no_shared=0; }
|
||||
elsif (/^no-zlib$/)
|
||||
{ $zlib=0; }
|
||||
@@ -746,7 +733,6 @@ PROCESS_ARGS:
|
||||
$openssl_algorithm_defines .= "#define OPENSSL_NO_$algo\n";
|
||||
if ($algo eq "RIJNDAEL")
|
||||
{
|
||||
push @skip, "aes";
|
||||
$flags .= "-DOPENSSL_NO_AES ";
|
||||
$depflags .= "-DOPENSSL_NO_AES ";
|
||||
$openssl_algorithm_defines .= "#define OPENSSL_NO_AES\n";
|
||||
@@ -759,27 +745,6 @@ PROCESS_ARGS:
|
||||
$depflags .= "-DOPENSSL_NO_MDC2 ";
|
||||
$openssl_algorithm_defines .= "#define OPENSSL_NO_MDC2\n";
|
||||
}
|
||||
if ($algo eq "EC")
|
||||
{
|
||||
push @skip, "ecdsa";
|
||||
push @skip, "ecdh";
|
||||
$options .= " no-ecdsa";
|
||||
$options .= " no-ecdh";
|
||||
$flags .= "-DOPENSSL_NO_ECDSA ";
|
||||
$flags .= "-DOPENSSL_NO_ECDH ";
|
||||
$depflags .= "-DOPENSSL_NO_ECDSA ";
|
||||
$depflags .= "-DOPENSSL_NO_ECDH ";
|
||||
$openssl_algorithm_defines .= "#define OPENSSL_NO_ECDSA\n";
|
||||
$openssl_algorithm_defines .= "#define OPENSSL_NO_ECDH\n";
|
||||
}
|
||||
if ($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;
|
||||
@@ -975,7 +940,6 @@ my $shared_cflag = $fields[$idx_shared_cflag];
|
||||
my $shared_ldflag = $fields[$idx_shared_ldflag];
|
||||
my $shared_extension = $fields[$idx_shared_extension];
|
||||
my $ranlib = $fields[$idx_ranlib];
|
||||
my $arflags = $fields[$idx_arflags];
|
||||
|
||||
$cflags="$flags$cflags" if ($flags ne "");
|
||||
|
||||
@@ -994,17 +958,6 @@ else
|
||||
my ($lresolv, $lpath, $lext);
|
||||
if ($withargs{"krb5-flavor"} =~ /^[Hh]eimdal$/)
|
||||
{
|
||||
die "Sorry, Heimdal is currently not supported\n";
|
||||
}
|
||||
##### HACK to force use of Heimdal.
|
||||
##### WARNING: Since we don't really have adequate support for Heimdal,
|
||||
##### using this will break the build. You'll have to make
|
||||
##### changes to the source, and if you do, please send
|
||||
##### patches to openssl-dev@openssl.org
|
||||
if ($withargs{"krb5-flavor"} =~ /^force-[Hh]eimdal$/)
|
||||
{
|
||||
warn "Heimdal isn't really supported. Your build WILL break\n";
|
||||
warn "If you fix the problems, please send a patch to openssl-dev\@openssl.org\n";
|
||||
$withargs{"krb5-dir"} = "/usr/heimdal"
|
||||
if $withargs{"krb5-dir"} eq "";
|
||||
$withargs{"krb5-lib"} = "-L".$withargs{"krb5-dir"}.
|
||||
@@ -1114,7 +1067,7 @@ if ($zlib)
|
||||
{
|
||||
$cflags = "-DZLIB $cflags";
|
||||
$cflags = "-DZLIB_SHARED $cflags" if $zlib == 2;
|
||||
$lflags = "$lflags -lz" if $zlib == 1;
|
||||
$lflags = "$lflags -lz" if $zlib == 2;
|
||||
}
|
||||
|
||||
# You will find shlib_mark1 and shlib_mark2 explained in Makefile.org
|
||||
@@ -1135,17 +1088,6 @@ else
|
||||
$no_shared = 1;
|
||||
}
|
||||
|
||||
if ($no_shared)
|
||||
{
|
||||
$cflags="-DOPENSSL_NO_DYNAMIC_ENGINE $cflags";
|
||||
$openssl_other_defines.="#define OPENSSL_NO_DYNAMIC_ENGINE\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$cflags="-DOPENSSL_NO_STATIC_ENGINE $cflags";
|
||||
$openssl_other_defines.="#define OPENSSL_NO_STATIC_ENGINE\n";
|
||||
}
|
||||
|
||||
if ($sys_id ne "")
|
||||
{
|
||||
$cflags="-DOPENSSL_SYSNAME_$sys_id $cflags";
|
||||
@@ -1190,7 +1132,6 @@ if ($rmd160_obj =~ /\.o$/)
|
||||
$cflags =~ s/([\\\"])/\\\1/g;
|
||||
|
||||
my $version = "unknown";
|
||||
my $version_num = "unknown";
|
||||
my $major = "unknown";
|
||||
my $minor = "unknown";
|
||||
my $shlib_version_number = "unknown";
|
||||
@@ -1202,7 +1143,6 @@ open(IN,'<crypto/opensslv.h') || die "unable to read opensslv.h:$!\n";
|
||||
while (<IN>)
|
||||
{
|
||||
$version=$1 if /OPENSSL.VERSION.TEXT.*OpenSSL (\S+) /;
|
||||
$version_num=$1 if /OPENSSL.VERSION.NUMBER.*0x(\S+)/;
|
||||
$shlib_version_number=$1 if /SHLIB_VERSION_NUMBER *"([^"]+)"/;
|
||||
$shlib_version_history=$1 if /SHLIB_VERSION_HISTORY *"([^"]*)"/;
|
||||
}
|
||||
@@ -1222,8 +1162,7 @@ if ($shlib_version_number =~ /(^[0-9]*)\.([0-9\.]*)/)
|
||||
}
|
||||
|
||||
open(IN,'<Makefile.org') || die "unable to read Makefile.org:$!\n";
|
||||
unlink("$Makefile.new") || die "unable to remove old $Makefile.new:$!\n" if -e "$Makefile.new";
|
||||
open(OUT,">$Makefile.new") || die "unable to create $Makefile.new:$!\n";
|
||||
open(OUT,">$Makefile") || die "unable to create $Makefile:$!\n";
|
||||
print OUT "### Generated automatically from Makefile.org by Configure.\n\n";
|
||||
my $sdirs=0;
|
||||
while (<IN>)
|
||||
@@ -1268,7 +1207,6 @@ while (<IN>)
|
||||
s/^RMD160_ASM_OBJ=.*$/RMD160_ASM_OBJ= $rmd160_obj/;
|
||||
s/^PROCESSOR=.*/PROCESSOR= $processor/;
|
||||
s/^RANLIB=.*/RANLIB= $ranlib/;
|
||||
s/^ARFLAGS=.*/ARFLAGS= $arflags/;
|
||||
s/^PERL=.*/PERL= $perl/;
|
||||
s/^KRB5_INCLUDES=.*/KRB5_INCLUDES=$withargs{"krb5-include"}/;
|
||||
s/^LIBKRB5=.*/LIBKRB5=$withargs{"krb5-lib"}/;
|
||||
@@ -1298,8 +1236,6 @@ while (<IN>)
|
||||
}
|
||||
close(IN);
|
||||
close(OUT);
|
||||
rename($Makefile,"$Makefile.bak") || die "unable to rename $Makefile\n" if -e $Makefile;
|
||||
rename("$Makefile.new",$Makefile) || die "unable to rename $Makefile.new\n";
|
||||
|
||||
print "CC =$cc\n";
|
||||
print "CFLAG =$cflags\n";
|
||||
@@ -1315,7 +1251,6 @@ print "SHA1_OBJ_ASM =$sha1_obj\n";
|
||||
print "RMD160_OBJ_ASM=$rmd160_obj\n";
|
||||
print "PROCESSOR =$processor\n";
|
||||
print "RANLIB =$ranlib\n";
|
||||
print "ARFLAGS =$arflags\n";
|
||||
print "PERL =$perl\n";
|
||||
print "KRB5_INCLUDES =",$withargs{"krb5-include"},"\n"
|
||||
if $withargs{"krb5-include"} ne "";
|
||||
@@ -1371,8 +1306,7 @@ foreach (sort split(/\s+/,$bn_ops))
|
||||
}
|
||||
|
||||
open(IN,'<crypto/opensslconf.h.in') || die "unable to read crypto/opensslconf.h.in:$!\n";
|
||||
unlink("crypto/opensslconf.h.new") || die "unable to remove old crypto/opensslconf.h.new:$!\n" if -e "crypto/opensslconf.h.new";
|
||||
open(OUT,'>crypto/opensslconf.h.new') || die "unable to create crypto/opensslconf.h.new:$!\n";
|
||||
open(OUT,'>crypto/opensslconf.h') || die "unable to create crypto/opensslconf.h:$!\n";
|
||||
print OUT "/* opensslconf.h */\n";
|
||||
print OUT "/* WARNING: Generated automatically from opensslconf.h.in by Configure. */\n\n";
|
||||
|
||||
@@ -1466,8 +1400,6 @@ while (<IN>)
|
||||
}
|
||||
close(IN);
|
||||
close(OUT);
|
||||
rename("crypto/opensslconf.h","crypto/opensslconf.h.bak") || die "unable to rename crypto/opensslconf.h\n" if -e "crypto/opensslconf.h";
|
||||
rename("crypto/opensslconf.h.new","crypto/opensslconf.h") || die "unable to rename crypto/opensslconf.h.new\n";
|
||||
|
||||
|
||||
# Fix the date
|
||||
@@ -1511,7 +1443,6 @@ EOF
|
||||
my $make_targets = "";
|
||||
$make_targets .= " links" if $symlink;
|
||||
$make_targets .= " depend" if $depflags ne "" && $make_depend;
|
||||
$make_targets .= " gentests" if $symlink;
|
||||
(system $make_command.$make_targets) == 0 or exit $?
|
||||
if $make_targets ne "";
|
||||
if ( $perl =~ m@^/@) {
|
||||
@@ -1535,68 +1466,6 @@ EOF
|
||||
}
|
||||
}
|
||||
|
||||
# create the ms/version32.rc file if needed
|
||||
if ($IsWindows) {
|
||||
my ($v1, $v2, $v3, $v4);
|
||||
if ($version_num =~ /(^[0-9a-f]{1})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})/i) {
|
||||
$v1=hex $1;
|
||||
$v2=hex $2;
|
||||
$v3=hex $3;
|
||||
$v4=hex $4;
|
||||
}
|
||||
open (OUT,">ms/version32.rc") || die "Can't open ms/version32.rc";
|
||||
print OUT <<EOF;
|
||||
#include <winver.h>
|
||||
|
||||
LANGUAGE 0x09,0x01
|
||||
|
||||
1 VERSIONINFO
|
||||
FILEVERSION $v1,$v2,$v3,$v4
|
||||
PRODUCTVERSION $v1,$v2,$v3,$v4
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x01L
|
||||
#else
|
||||
FILEFLAGS 0x00L
|
||||
#endif
|
||||
FILEOS VOS__WINDOWS32
|
||||
FILETYPE VFT_DLL
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
// Required:
|
||||
VALUE "CompanyName", "The OpenSSL Project, http://www.openssl.org/\\0"
|
||||
VALUE "FileDescription", "OpenSSL Shared Library\\0"
|
||||
VALUE "FileVersion", "$version\\0"
|
||||
#if defined(CRYPTO)
|
||||
VALUE "InternalName", "libeay32\\0"
|
||||
VALUE "OriginalFilename", "libeay32.dll\\0"
|
||||
#elif defined(SSL)
|
||||
VALUE "InternalName", "ssleay32\\0"
|
||||
VALUE "OriginalFilename", "ssleay32.dll\\0"
|
||||
#endif
|
||||
VALUE "ProductName", "The OpenSSL Toolkit\\0"
|
||||
VALUE "ProductVersion", "$version\\0"
|
||||
// Optional:
|
||||
//VALUE "Comments", "\\0"
|
||||
VALUE "LegalCopyright", "Copyright <20> 1998-2002 The OpenSSL Project. Copyright <20> 1995-1998 Eric A. Young, Tim J. Hudson. All rights reserved.\\0"
|
||||
//VALUE "LegalTrademarks", "\\0"
|
||||
//VALUE "PrivateBuild", "\\0"
|
||||
//VALUE "SpecialBuild", "\\0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 0x4b0
|
||||
END
|
||||
END
|
||||
EOF
|
||||
close(OUT);
|
||||
}
|
||||
|
||||
print <<EOF;
|
||||
|
||||
Configured for $target.
|
||||
@@ -1685,7 +1554,7 @@ sub print_table_entry
|
||||
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 $rc5_obj,my $dso_scheme,my $shared_target,my $shared_cflag,
|
||||
my $shared_ldflag,my $shared_extension,my $ranlib,my $arflags)=
|
||||
my $shared_ldflag,my $shared_extension,my $ranlib)=
|
||||
split(/\s*:\s*/,$table{$target} . ":" x 30 , -1);
|
||||
|
||||
print <<EOF
|
||||
@@ -1713,7 +1582,6 @@ sub print_table_entry
|
||||
\$shared_ldflag = $shared_ldflag
|
||||
\$shared_extension = $shared_extension
|
||||
\$ranlib = $ranlib
|
||||
\$arflags = $arflags
|
||||
EOF
|
||||
}
|
||||
|
||||
|
98
FAQ
98
FAQ
@@ -9,7 +9,6 @@ OpenSSL - Frequently Asked Questions
|
||||
* Where can I get a compiled version of OpenSSL?
|
||||
* Why aren't tools like 'autoconf' and 'libtool' used?
|
||||
* What is an 'engine' version?
|
||||
* How do I check the authenticity of the OpenSSL distribution?
|
||||
|
||||
[LEGAL] Legal questions
|
||||
|
||||
@@ -37,13 +36,9 @@ OpenSSL - Frequently Asked Questions
|
||||
* 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: 1 no implemented"?
|
||||
* Why does the OpenSSL test fail with "bc: stack empty"?
|
||||
* Why does the OpenSSL compilation fail on Alpha Tru64 Unix?
|
||||
* Why does the OpenSSL compilation fail with "ar: command not found"?
|
||||
* Why does the OpenSSL compilation fail on Win32 with VC++?
|
||||
* What is special about OpenSSL on Redhat?
|
||||
* Why does the OpenSSL compilation fail on MacOS X?
|
||||
* Why does the OpenSSL test suite fail on MacOS X?
|
||||
|
||||
[PROG] Questions about programming with OpenSSL
|
||||
|
||||
@@ -66,7 +61,7 @@ OpenSSL - Frequently Asked Questions
|
||||
* Which is the current version of OpenSSL?
|
||||
|
||||
The current version is available from <URL: http://www.openssl.org>.
|
||||
OpenSSL 0.9.6h was released on December 5, 2002.
|
||||
OpenSSL 0.9.6d was released on May 9, 2002.
|
||||
|
||||
In addition to the current stable release, you can also access daily
|
||||
snapshots of the OpenSSL development version at <URL:
|
||||
@@ -137,19 +132,6 @@ hardware. This was realized in a special release '0.9.6-engine'. With
|
||||
version 0.9.7 (not yet released) the changes were merged into the main
|
||||
development line, so that the special release is no longer necessary.
|
||||
|
||||
* How do I check the authenticity of the OpenSSL distribution?
|
||||
|
||||
We provide MD5 digests and ASC signatures of each tarball.
|
||||
Use MD5 to check that a tarball from a mirror site is identical:
|
||||
|
||||
md5sum TARBALL | awk '{print $1;}' | cmp - TARBALL.md5
|
||||
|
||||
You can check authenticity using pgp or gpg. You need the OpenSSL team
|
||||
member public key used to sign it (download it from a key server). Then
|
||||
just do:
|
||||
|
||||
pgp TARBALL.asc
|
||||
|
||||
[LEGAL] =======================================================================
|
||||
|
||||
* Do I need patent licenses to use OpenSSL?
|
||||
@@ -235,13 +217,8 @@ For Solaris 2.6, Tim Nibbe <tnibbe@sprint.net> and others have suggested
|
||||
installing the SUNski package from Sun patch 105710-01 (Sparc) which
|
||||
adds a /dev/random device and make sure it gets used, usually through
|
||||
$RANDFILE. There are probably similar patches for the other Solaris
|
||||
versions. An official statement from Sun with respect to /dev/random
|
||||
support can be found at
|
||||
http://sunsolve.sun.com/pub-cgi/retrieve.pl?doc=fsrdb/27606&zone_32=SUNWski
|
||||
However, be warned that /dev/random is usually a blocking device, which
|
||||
may have some effects on OpenSSL.
|
||||
A third party /dev/random solution for Solaris is available at
|
||||
http://www.cosy.sbg.ac.at/~andi/
|
||||
versions. However, be warned that /dev/random is usually a blocking
|
||||
device, which may have some effects on OpenSSL.
|
||||
|
||||
|
||||
* Why do I get an "unable to write 'random state'" error message?
|
||||
@@ -419,17 +396,6 @@ and compile/install it. GNU bc (see http://www.gnu.org/software/software.html
|
||||
for download instructions) can be safely used, for example.
|
||||
|
||||
|
||||
* Why does the OpenSSL test fail with "bc: stack empty"?
|
||||
|
||||
On some DG/ux versions, bc seems to have a too small stack for calculations
|
||||
that the OpenSSL bntest throws at it. This gets triggered when you run the
|
||||
test suite (using "make test"). The message returned is "bc: stack empty".
|
||||
|
||||
The best way to deal with this is to find another implementation of bc
|
||||
and compile/install it. GNU bc (see http://www.gnu.org/software/software.html
|
||||
for download instructions) can be safely used, for example.
|
||||
|
||||
|
||||
* Why does the OpenSSL compilation fail on Alpha Tru64 Unix?
|
||||
|
||||
On some Alpha installations running Tru64 Unix and Compaq C, the compilation
|
||||
@@ -494,64 +460,6 @@ under 'Program Files'). This needs to be done prior to running NMAKE,
|
||||
and the changes are only valid for the current DOS session.
|
||||
|
||||
|
||||
* What is special about OpenSSL on Redhat?
|
||||
|
||||
Red Hat Linux (release 7.0 and later) include a preinstalled limited
|
||||
version of OpenSSL. For patent reasons, support for IDEA, RC5 and MDC2
|
||||
is disabled in this version. The same may apply to other Linux distributions.
|
||||
Users may therefore wish to install more or all of the features left out.
|
||||
|
||||
To do this you MUST ensure that you do not overwrite the openssl that is in
|
||||
/usr/bin on your Red Hat machine. Several packages depend on this file,
|
||||
including sendmail and ssh. /usr/local/bin is a good alternative choice. The
|
||||
libraries that come with Red Hat 7.0 onwards have different names and so are
|
||||
not affected. (eg For Red Hat 7.2 they are /lib/libssl.so.0.9.6b and
|
||||
/lib/libcrypto.so.0.9.6b with symlinks /lib/libssl.so.2 and
|
||||
/lib/libcrypto.so.2 respectively).
|
||||
|
||||
Please note that we have been advised by Red Hat attempting to recompile the
|
||||
openssl rpm with all the cryptography enabled will not work. All other
|
||||
packages depend on the original Red Hat supplied openssl package. It is also
|
||||
worth noting that due to the way Red Hat supplies its packages, updates to
|
||||
openssl on each distribution never change the package version, only the
|
||||
build number. For example, on Red Hat 7.1, the latest openssl package has
|
||||
version number 0.9.6 and build number 9 even though it contains all the
|
||||
relevant updates in packages up to and including 0.9.6b.
|
||||
|
||||
A possible way around this is to persuade Red Hat to produce a non-US
|
||||
version of Red Hat Linux.
|
||||
|
||||
FYI: Patent numbers and expiry dates of US patents:
|
||||
MDC-2: 4,908,861 13/03/2007
|
||||
IDEA: 5,214,703 25/05/2010
|
||||
RC5: 5,724,428 03/03/2015
|
||||
|
||||
|
||||
* Why does the OpenSSL compilation fail on MacOS X?
|
||||
|
||||
If the failure happens when trying to build the "openssl" binary, with
|
||||
a large number of undefined symbols, it's very probable that you have
|
||||
OpenSSL 0.9.6b delivered with the operating system (you can find out by
|
||||
running '/usr/bin/openssl version') and that you were trying to build
|
||||
OpenSSL 0.9.7 or newer. The problem is that the loader ('ld') in
|
||||
MacOS X has a misfeature that's quite difficult to go around.
|
||||
Look in the file PROBLEMS for a more detailed explanation and for possible
|
||||
solutions.
|
||||
|
||||
|
||||
* Why does the OpenSSL test suite fail on MacOS X?
|
||||
|
||||
If the failure happens when running 'make test' and the RC4 test fails,
|
||||
it's very probable that you have OpenSSL 0.9.6b delivered with the
|
||||
operating system (you can find out by running '/usr/bin/openssl version')
|
||||
and that you were trying to build OpenSSL 0.9.6d. The problem is that
|
||||
the loader ('ld') in MacOS X has a misfeature that's quite difficult to
|
||||
go around and has linked the programs "openssl" and the test programs
|
||||
with /usr/lib/libcrypto.dylib and /usr/lib/libssl.dylib instead of the
|
||||
libraries you just built.
|
||||
Look in the file PROBLEMS for a more detailed explanation and for possible
|
||||
solutions.
|
||||
|
||||
[PROG] ========================================================================
|
||||
|
||||
* Is OpenSSL thread-safe?
|
||||
|
22
INSTALL
22
INSTALL
@@ -139,11 +139,8 @@
|
||||
the failure that aren't problems in OpenSSL itself (like missing
|
||||
standard headers). If it is a problem with OpenSSL itself, please
|
||||
report the problem to <openssl-bugs@openssl.org> (note that your
|
||||
message will be recorded in the request tracker publicly readable
|
||||
via http://www.openssl.org/rt2.html and will be forwarded to a public
|
||||
mailing list). Include the output of "make report" in your message.
|
||||
Please check out the request tracker. Maybe the bug was already
|
||||
reported or has already been fixed.
|
||||
message will be forwarded to a public mailing list). Include the
|
||||
output of "make report" in your message.
|
||||
|
||||
[If you encounter assembler error messages, try the "no-asm"
|
||||
configuration option as an immediate fix.]
|
||||
@@ -161,8 +158,7 @@
|
||||
try removing any compiler optimization flags from the CFLAGS line
|
||||
in Makefile.ssl and run "make clean; make". Please send a bug
|
||||
report to <openssl-bugs@openssl.org>, including the output of
|
||||
"make report" in order to be added to the request tracker at
|
||||
http://www.openssl.org/rt2.html.
|
||||
"make report".
|
||||
|
||||
4. If everything tests ok, install OpenSSL with
|
||||
|
||||
@@ -296,15 +292,3 @@
|
||||
targets for shared library creation, like linux-shared. Those targets
|
||||
can currently be used on their own just as well, but this is expected
|
||||
to change in future versions of OpenSSL.
|
||||
|
||||
Note on random number generation
|
||||
--------------------------------
|
||||
|
||||
Availability of cryptographically secure random numbers is required for
|
||||
secret key generation. OpenSSL provides several options to seed the
|
||||
internal PRNG. If not properly seeded, the internal PRNG will refuse
|
||||
to deliver random bytes and a "PRNG not seeded error" will occur.
|
||||
On systems without /dev/urandom (or similar) device, it may be necessary
|
||||
to install additional support software to obtain random seed.
|
||||
Please check out the manual pages for RAND_add(), RAND_bytes(), RAND_egd(),
|
||||
and the FAQ for more information.
|
||||
|
@@ -12,14 +12,12 @@
|
||||
latest versions of DJGPP, GCC, BINUTILS, BASH, etc. This package
|
||||
requires that PERL and BC also be installed.
|
||||
|
||||
All of these can be obtained from the usual DJGPP mirror sites, such
|
||||
as "ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp". You also need to
|
||||
have the WATT-32 networking package installed before you try to compile
|
||||
openssl. This can be obtained from "http://www.bgnett.no/~giva/".
|
||||
The Makefile assumes that the WATT-32 code is in the directory
|
||||
specified by the environment variable WATT_ROOT. If you have watt-32
|
||||
in directory "watt32" under your main DJGPP directory, specify
|
||||
WATT_ROOT="/dev/env/DJDIR/watt32".
|
||||
All of these can be obtained from the usual DJGPP mirror sites, such as
|
||||
"ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp". You also need to have
|
||||
the WATT-32 networking package installed before you try to compile
|
||||
openssl. This can be obtained from "http://www.bgnett.no/~giva/". The
|
||||
Makefile assumes that the WATT-32 code is in directory "watt32" under
|
||||
/dev/env/DJDIR.
|
||||
|
||||
To compile openssl, start your BASH shell. Then configure for DOS by
|
||||
running "./Configure" with appropriate arguments. The basic syntax for
|
||||
|
@@ -20,12 +20,3 @@
|
||||
|
||||
If that finishes successfully you will find the libraries and programs in the
|
||||
"out" directory.
|
||||
|
||||
Alternatively, you can make a dynamic build that puts the library code into
|
||||
crypto.dll and ssl.dll by running
|
||||
|
||||
> make -f os2-emx-dll.mak
|
||||
|
||||
This will build the above mentioned dlls and a matching pair of import
|
||||
libraries in the "out_dll" directory along with the set of test programs
|
||||
and the openssl application.
|
||||
|
41
INSTALL.W32
41
INSTALL.W32
@@ -2,8 +2,6 @@
|
||||
INSTALLATION ON THE WIN32 PLATFORM
|
||||
----------------------------------
|
||||
|
||||
[Instructions for building for Windows CE can be found in INSTALL.WCE]
|
||||
|
||||
Heres a few comments about building OpenSSL in Windows environments. Most
|
||||
of this is tested on Win32 but it may also work in Win 3.1 with some
|
||||
modification.
|
||||
@@ -84,8 +82,7 @@
|
||||
There are various changes you can make to the Win32 compile environment. By
|
||||
default the library is not compiled with debugging symbols. If you add 'debug'
|
||||
to the mk1mf.pl lines in the do_* batch file then debugging symbols will be
|
||||
compiled in. Note that mk1mf.pl expects the platform to be the last argument
|
||||
on the command line, so 'debug' must appear before that, as all other options.
|
||||
compiled in.
|
||||
|
||||
The default Win32 environment is to leave out any Windows NT specific
|
||||
features.
|
||||
@@ -97,18 +94,6 @@
|
||||
You can also build a static version of the library using the Makefile
|
||||
ms\nt.mak
|
||||
|
||||
Borland C++ builder 5
|
||||
---------------------
|
||||
|
||||
* Configure for building with Borland Builder:
|
||||
> perl Configure BC-32
|
||||
|
||||
* Create the appropriate makefile
|
||||
> ms\do_nasm
|
||||
|
||||
* Build
|
||||
> make -f ms\bcb.mak
|
||||
|
||||
Borland C++ builder 3 and 4
|
||||
---------------------------
|
||||
|
||||
@@ -155,17 +140,17 @@
|
||||
GNU C (Cygwin)
|
||||
--------------
|
||||
|
||||
Cygwin provides a bash shell and GNU tools environment running
|
||||
on NT 4.0, Windows 9x, Windows ME, Windows 2000, and Windows XP.
|
||||
Consequently, a make of OpenSSL with Cygwin is closer to a GNU
|
||||
bash environment such as Linux than to other W32 makes which are
|
||||
based on a single makefile approach. Cygwin implements Posix/Unix
|
||||
calls through cygwin1.dll, and is contrasted to Mingw32 which links
|
||||
dynamically to msvcrt.dll or crtdll.dll.
|
||||
Cygwin provides a bash shell and GNU tools environment running on
|
||||
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
|
||||
than other W32 makes that are based on a single makefile approach.
|
||||
Cygwin implements Posix/Unix calls through cygwin1.dll, and is
|
||||
contrasted to Mingw32 which links dynamically to msvcrt.dll or
|
||||
crtdll.dll.
|
||||
|
||||
To build OpenSSL using Cygwin:
|
||||
|
||||
* Install Cygwin (see http://cygwin.com/)
|
||||
* Install Cygwin (see http://sourceware.cygnus.com/cygwin)
|
||||
|
||||
* 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
|
||||
@@ -191,9 +176,13 @@
|
||||
stripping of carriage returns. To avoid this ensure that a binary
|
||||
mount is used, e.g. mount -b c:\somewhere /home.
|
||||
|
||||
"bc" is not provided in older Cygwin distribution. This causes a
|
||||
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
|
||||
the snapshot 20000524 (Slow!).
|
||||
|
||||
"bc" is not provided in the Cygwin distribution. This causes a
|
||||
non-fatal error in "make test" but is otherwise harmless. If
|
||||
desired and needed, GNU bc can be built with Cygwin without change.
|
||||
desired, GNU bc can be built with Cygwin without change.
|
||||
|
||||
|
||||
Installation
|
||||
|
71
INSTALL.WCE
71
INSTALL.WCE
@@ -1,71 +0,0 @@
|
||||
|
||||
INSTALLATION FOR THE WINDOWS CE PLATFORM
|
||||
----------------------------------------
|
||||
|
||||
Building OpenSSL for Windows CE requires the following external tools:
|
||||
|
||||
* Microsoft eMbedded Visual C++ 3.0
|
||||
* wcecompat compatibility library (www.essemer.com.au)
|
||||
* Optionally ceutils for running automated tests (www.essemer.com.au)
|
||||
|
||||
You also need Perl for Win32. You will need ActiveState Perl, available
|
||||
from http://www.activestate.com/ActivePerl.
|
||||
|
||||
Windows CE support in OpenSSL relies on wcecompat. All Windows CE specific
|
||||
issues should be directed to www.essemer.com.au.
|
||||
|
||||
The C Runtime Library implementation for Windows CE that is included with
|
||||
Microsoft eMbedded Visual C++ 3.0 is incomplete and in some places
|
||||
incorrect. wcecompat plugs the holes and tries to bring the Windows CE
|
||||
CRT to a level that is more compatible with ANSI C. wcecompat goes further
|
||||
and provides low-level IO and stream IO support for stdin/stdout/stderr
|
||||
(which Windows CE does not provide). This IO functionality is not needed
|
||||
by the OpenSSL library itself but is used for the tests and openssl.exe.
|
||||
More information is available at www.essemer.com.au.
|
||||
|
||||
Building
|
||||
--------
|
||||
|
||||
Setup the eMbedded Visual C++ environment. There are batch files for doing
|
||||
this installed with eVC++. For an ARM processor, for example, execute:
|
||||
|
||||
> "C:\Program Files\Microsoft eMbedded Tools\EVC\WCE300\BIN\WCEARM.BAT"
|
||||
|
||||
Next indicate where wcecompat is located:
|
||||
|
||||
> set WCECOMPAT=C:\wcecompat
|
||||
|
||||
Next you should run Configure:
|
||||
|
||||
> perl Configure VC-CE
|
||||
|
||||
Next you need to build the Makefiles:
|
||||
|
||||
> ms\do_ms
|
||||
|
||||
If you get errors about things not having numbers assigned then check the
|
||||
troubleshooting section in INSTALL.W32: you probably won't be able to compile
|
||||
it as it stands.
|
||||
|
||||
Then from the VC++ environment at a prompt do:
|
||||
|
||||
- to build static libraries:
|
||||
|
||||
> nmake -f ms\ce.mak
|
||||
|
||||
- or to build DLLs:
|
||||
|
||||
> nmake -f ms\cedll.mak
|
||||
|
||||
If all is well it should compile and you will have some static libraries and
|
||||
executables in out32, or some DLLs and executables in out32dll. If you want
|
||||
to try the tests then make sure the ceutils are in the path and do:
|
||||
|
||||
> cd out32
|
||||
> ..\ms\testce
|
||||
|
||||
This will copy each of the test programs to the Windows CE device and execute
|
||||
them, displaying the output of the tests on this computer. The output should
|
||||
look similar to the output produced by running the tests for a regular Windows
|
||||
build.
|
||||
|
@@ -1287,7 +1287,7 @@ EXITPOINT:
|
||||
|
||||
// Send some bytes
|
||||
|
||||
int MacSocket_send(const int inSocketNum,const void *inBuff,int inBuffLength)
|
||||
int MacSocket_send(const int inSocketNum,void *inBuff,int inBuffLength)
|
||||
{
|
||||
OSErr errCode = noErr;
|
||||
int bytesSent = 0;
|
||||
@@ -1604,4 +1604,4 @@ EPInfo* epi = (EPInfo*) context;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
*/
|
@@ -62,7 +62,7 @@ int MacSocket_recv(const int inSocketNum,void *outBuff,int outBuffLength,const B
|
||||
|
||||
// Call this to send data on a socket
|
||||
|
||||
int MacSocket_send(const int inSocketNum,const void *inBuff,int inBuffLength);
|
||||
int MacSocket_send(const int inSocketNum,void *inBuff,int inBuffLength);
|
||||
|
||||
|
||||
// If zero bytes were read in a call to MacSocket_recv(), it may be that the remote end has done a half-close
|
||||
|
415
Makefile.org
415
Makefile.org
@@ -59,8 +59,7 @@ DEPFLAG=
|
||||
PEX_LIBS=
|
||||
EX_LIBS=
|
||||
EXE_EXT=
|
||||
ARFLAGS=
|
||||
AR=ar $(ARFLAGS) r
|
||||
AR=ar r
|
||||
RANLIB= ranlib
|
||||
PERL= perl
|
||||
TAR= tar
|
||||
@@ -156,14 +155,18 @@ RMD160_ASM_OBJ= asm/rm86-out.o
|
||||
KRB5_INCLUDES=
|
||||
LIBKRB5=
|
||||
|
||||
DIRS= crypto ssl engines apps test tools
|
||||
# When we're prepared to use shared libraries in the programs we link here
|
||||
# we might set SHLIB_MARK to '$(SHARED_LIBS)'.
|
||||
SHLIB_MARK=
|
||||
|
||||
DIRS= crypto ssl $(SHLIB_MARK) apps test tools
|
||||
SHLIBDIRS= crypto ssl
|
||||
|
||||
# dirs in crypto to build
|
||||
SDIRS= \
|
||||
md2 md4 md5 sha mdc2 hmac ripemd \
|
||||
des rc2 rc4 rc5 idea bf cast \
|
||||
bn ec rsa dsa ecdsa dh ecdh dso engine aes \
|
||||
bn ec rsa dsa dh dso engine aes \
|
||||
buffer bio stack lhash rand err objects \
|
||||
evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp ui krb5
|
||||
|
||||
@@ -172,8 +175,7 @@ SDIRS= \
|
||||
TESTS = alltests
|
||||
|
||||
MAKEFILE= Makefile.ssl
|
||||
NEWMAKE= make
|
||||
MAKE= $(NEWMAKE) -f Makefile.ssl
|
||||
MAKE= make -f Makefile.ssl
|
||||
|
||||
MANDIR=$(OPENSSLDIR)/man
|
||||
MAN1=1
|
||||
@@ -199,33 +201,21 @@ WTARFILE= $(NAME)-win.tar
|
||||
EXHEADER= e_os2.h
|
||||
HEADER= e_os.h
|
||||
|
||||
all: Makefile.ssl build_all openssl.pc
|
||||
# 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
|
||||
|
||||
BUILD_CMD=if echo " $(DIRS) " | grep " $$i " >/dev/null 2>/dev/null; then \
|
||||
all: Makefile.ssl sub_all
|
||||
|
||||
sub_all:
|
||||
@for i in $(DIRS); \
|
||||
do \
|
||||
if [ -d "$$i" ]; then \
|
||||
(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}' EXE_EXT='${EXE_EXT}' SHARED_LIBS='${SHARED_LIBS}' SHLIB_EXT='${SHLIB_EXT}' SHLIB_TARGET='${SHLIB_TARGET}' all ) || exit 1; \
|
||||
else \
|
||||
$(MAKE) $$i; \
|
||||
fi; fi
|
||||
|
||||
sub_all: build_all
|
||||
build_all: build_libs build_apps build_tests build_tools
|
||||
|
||||
build_libs: build_crypto build_ssl build_engines
|
||||
|
||||
build_crypto:
|
||||
@i=crypto; $(BUILD_CMD)
|
||||
build_ssl:
|
||||
@i=ssl; $(BUILD_CMD)
|
||||
build_engines:
|
||||
@i=engines; $(BUILD_CMD)
|
||||
build_apps:
|
||||
@i=apps; $(BUILD_CMD)
|
||||
build_tests:
|
||||
@i=test; $(BUILD_CMD)
|
||||
build_tools:
|
||||
@i=tools; $(BUILD_CMD)
|
||||
fi; \
|
||||
done;
|
||||
|
||||
libcrypto$(SHLIB_EXT): libcrypto.a
|
||||
@if [ "$(SHLIB_TARGET)" != "" ]; then \
|
||||
@@ -256,40 +246,271 @@ clean-shared:
|
||||
done
|
||||
|
||||
link-shared:
|
||||
@ for i in ${SHLIBDIRS}; do \
|
||||
$(NEWMAKE) -f Makefile.shared \
|
||||
LIBNAME=$$i LIBVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR} \
|
||||
LIBCOMPATVERSIONS=";${SHLIB_VERSION_HISTORY}" \
|
||||
symlink.$(SHLIB_TARGET); \
|
||||
libs="$$libs -l$$i"; \
|
||||
@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
|
||||
|
||||
do_bsd-gcc-shared: do_gnu-shared
|
||||
do_linux-shared: do_gnu-shared
|
||||
do_gnu-shared:
|
||||
libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
|
||||
( 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,--no-whole-archive $$libs ${EX_LIBS} -lc ) || exit 1; \
|
||||
libs="$$libs -l$$i"; \
|
||||
done
|
||||
|
||||
build-shared: do_$(SHLIB_TARGET) link-shared
|
||||
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
|
||||
|
||||
do_$(SHLIB_TARGET):
|
||||
@ libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
|
||||
$(NEWMAKE) -f Makefile.shared \
|
||||
CC="$(CC)" LDFLAGS="$(LDFLAGS)" \
|
||||
SHARED_LDFLAGS="$(SHARED_LDFLAGS)" \
|
||||
LIBNAME=$$i LIBVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR} \
|
||||
LIBCOMPATVERSIONS=";${SHLIB_VERSION_HISTORY}" \
|
||||
LIBDEPS="$$libs $(EX_LIBS)" \
|
||||
link_a.$(SHLIB_TARGET); \
|
||||
libs="$$libs -l$$i"; \
|
||||
# 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
|
||||
|
||||
openssl.pc:
|
||||
@ ( echo 'prefix=$(INSTALLTOP)'; \
|
||||
echo 'exec_prefix=$${prefix}'; \
|
||||
echo 'libdir=$${exec_prefix}/lib'; \
|
||||
echo 'includedir=$${prefix}/include'; \
|
||||
echo ''; \
|
||||
echo 'Name: OpenSSL'; \
|
||||
echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
|
||||
echo 'Version: '$(VERSION); \
|
||||
echo 'Requires: '; \
|
||||
echo 'Libs: -L$${libdir} -lssl -lcrypto $(EX_LIBS)'; \
|
||||
echo 'Cflags: -I$${includedir}' ) > openssl.pc
|
||||
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
|
||||
|
||||
# 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:
|
||||
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 \
|
||||
-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
|
||||
do_solaris-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; \
|
||||
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
|
||||
do_irix-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.${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
|
||||
# HP-UX includes the full pathname of libs we depend on, so we would get
|
||||
# ./libcrypto (with ./ as path information) compiled into libssl, hence
|
||||
# we omit the SHLIBDEPS. Applications must be linked with -lssl -lcrypto
|
||||
# anyway.
|
||||
# The object modules are loaded from lib$i.a using the undocumented -Fl
|
||||
# option.
|
||||
#
|
||||
# WARNING: Until DSO is fixed to support a search path, we support SHLIB_PATH
|
||||
# by temporarily specifying "+s"!
|
||||
#
|
||||
do_hpux-shared:
|
||||
for i in ${SHLIBDIRS}; do \
|
||||
( set -x; /usr/ccs/bin/ld ${SHARED_LDFLAGS} \
|
||||
+vnocompatwarnings \
|
||||
-b -z +s \
|
||||
-o lib$$i.sl.${SHLIB_MAJOR}.${SHLIB_MINOR} \
|
||||
+h lib$$i.sl.${SHLIB_MAJOR}.${SHLIB_MINOR} \
|
||||
-Fl lib$$i.a -ldld -lc ) || exit 1; \
|
||||
done
|
||||
|
||||
# This assumes that GNU utilities are *not* used
|
||||
# HP-UX includes the full pathname of libs we depend on, so we would get
|
||||
# ./libcrypto (with ./ as path information) compiled into libssl, hence
|
||||
# we omit the SHLIBDEPS. Applications must be linked with -lssl -lcrypto
|
||||
# anyway.
|
||||
#
|
||||
# HP-UX in 64bit mode has "+s" enabled by default; it will search for
|
||||
# shared libraries along LD_LIBRARY_PATH _and_ SHLIB_PATH.
|
||||
#
|
||||
do_hpux64-shared:
|
||||
for i in ${SHLIBDIRS}; do \
|
||||
( set -x; /usr/ccs/bin/ld ${SHARED_LDFLAGS} \
|
||||
-b -z \
|
||||
-o lib$$i.sl.${SHLIB_MAJOR}.${SHLIB_MINOR} \
|
||||
+h lib$$i.sl.${SHLIB_MAJOR}.${SHLIB_MINOR} \
|
||||
+forceload lib$$i.a -ldl -lc ) || exit 1; \
|
||||
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
|
||||
@echo "Makefile.ssl is older than Makefile.org."
|
||||
@@ -297,7 +518,7 @@ Makefile.ssl: Makefile.org
|
||||
@false
|
||||
|
||||
libclean:
|
||||
rm -f *.so *.so.* engines/*.so *.a */lib */*/lib
|
||||
rm -f *.a */lib */*/lib
|
||||
|
||||
clean:
|
||||
rm -f shlib/*.o *.o core a.out fluff *.map rehash.time testlog make.log cctest cctest.c
|
||||
@@ -309,7 +530,6 @@ clean:
|
||||
rm -f $(LIBS); \
|
||||
fi; \
|
||||
done;
|
||||
rm -f openssl.pc
|
||||
rm -f *.a *.o speed.* *.map *.so .pure core
|
||||
rm -f $(TARFILE)
|
||||
@for i in $(ONEDIRS) ;\
|
||||
@@ -342,10 +562,6 @@ links:
|
||||
fi; \
|
||||
done;
|
||||
|
||||
gentests:
|
||||
@(cd test && echo "generating dummy tests (if needed)..." && \
|
||||
$(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' SDIRS='$(SDIRS)' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' TESTS='${TESTS}' KRB5_INCLUDES='${KRB5_INCLUDES}' LIBKRB5='${LIBKRB5}' EXE_EXT='${EXE_EXT}' SHARED_LIBS='${SHARED_LIBS}' SHLIB_EXT='${SHLIB_EXT}' SHLIB_TARGET='${SHLIB_TARGET}' TESTS='${TESTS}' OPENSSL_DEBUG_MEMORY=on generate );
|
||||
|
||||
dclean:
|
||||
rm -f *.bak
|
||||
@for i in $(DIRS) ;\
|
||||
@@ -360,10 +576,8 @@ rehash: rehash.time
|
||||
rehash.time: certs
|
||||
@(OPENSSL="`pwd`/apps/openssl"; OPENSSL_DEBUG_MEMORY=on; \
|
||||
export OPENSSL OPENSSL_DEBUG_MEMORY; \
|
||||
LD_LIBRARY_PATH="`pwd`"; DYLD_LIBRARY_PATH="`pwd`"; SHLIB_PATH="`pwd`"; LIBPATH="`pwd`"; \
|
||||
if [ "$(PLATFORM)" = "DJGPP" ]; then PATH="`pwd`\;$$PATH"; \
|
||||
elif [ "$(PLATFORM)" != "Cygwin" ]; then PATH="`pwd`:$$PATH"; fi; \
|
||||
export LD_LIBRARY_PATH DYLD_LIBRARY_PATH SHLIB_PATH LIBPATH PATH; \
|
||||
LD_LIBRARY_PATH="`pwd`"; SHLIB_PATH="`pwd`"; LIBPATH="`pwd`"; \
|
||||
export LD_LIBRARY_PATH SHLIB_PATH LIBPATH; \
|
||||
$(PERL) tools/c_rehash certs)
|
||||
touch rehash.time
|
||||
|
||||
@@ -372,10 +586,8 @@ test: tests
|
||||
tests: rehash
|
||||
@(cd test && echo "testing..." && \
|
||||
$(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' SDIRS='$(SDIRS)' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' TESTS='${TESTS}' KRB5_INCLUDES='${KRB5_INCLUDES}' LIBKRB5='${LIBKRB5}' EXE_EXT='${EXE_EXT}' SHARED_LIBS='${SHARED_LIBS}' SHLIB_EXT='${SHLIB_EXT}' SHLIB_TARGET='${SHLIB_TARGET}' TESTS='${TESTS}' OPENSSL_DEBUG_MEMORY=on tests );
|
||||
@LD_LIBRARY_PATH="`pwd`"; DYLD_LIBRARY_PATH="`pwd`"; SHLIB_PATH="`pwd`"; LIBPATH="`pwd`"; \
|
||||
if [ "$(PLATFORM)" = "DJGPP" ]; then PATH="`pwd`\;$$PATH"; \
|
||||
elif [ "$(PLATFORM)" != "Cygwin" ]; then PATH="`pwd`:$$PATH"; fi; \
|
||||
export LD_LIBRARY_PATH DYLD_LIBRARY_PATH SHLIB_PATH LIBPATH PATH; \
|
||||
@LD_LIBRARY_PATH="`pwd`"; SHLIB_PATH="`pwd`"; LIBPATH="`pwd`"; \
|
||||
export LD_LIBRARY_PATH SHLIB_PATH LIBPATH; \
|
||||
apps/openssl version -a
|
||||
|
||||
report:
|
||||
@@ -386,7 +598,7 @@ depend:
|
||||
do \
|
||||
if [ -d "$$i" ]; then \
|
||||
(cd $$i && echo "making dependencies $$i..." && \
|
||||
$(MAKE) SDIRS='${SDIRS}' CFLAG='${CFLAG}' DEPFLAG='${DEPFLAG}' MAKEDEPPROG='${MAKEDEPPROG}' KRB5_INCLUDES='${KRB5_INCLUDES}' PERL='${PERL}' depend ) || exit 1; \
|
||||
$(MAKE) SDIRS='${SDIRS}' DEPFLAG='${DEPFLAG}' MAKEDEPPROG='${MAKEDEPPROG}' KRB5_INCLUDES='${KRB5_INCLUDES}' PERL='${PERL}' depend ) || exit 1; \
|
||||
fi; \
|
||||
done;
|
||||
|
||||
@@ -410,7 +622,7 @@ tags:
|
||||
|
||||
errors:
|
||||
$(PERL) util/mkerr.pl -recurse -write
|
||||
(cd engines; $(MAKE) PERL=$(PERL) errors)
|
||||
(cd crypto/engine; $(MAKE) PERL=$(PERL) errors)
|
||||
|
||||
stacks:
|
||||
$(PERL) util/mkstack.pl -write
|
||||
@@ -438,9 +650,6 @@ update: depend errors stacks util/libeay.num util/ssleay.num crypto/objects/obj_
|
||||
# and read directly, requiring GNU-Tar. Call "make TAR=gtar dist" if the normal
|
||||
# tar does not support the --files-from option.
|
||||
tar:
|
||||
find . -type d -print | xargs chmod 755
|
||||
find . -type f -print | xargs chmod a+r
|
||||
find . -type f -perm -0100 -print | xargs chmod a+x
|
||||
find * \! -path CVS/\* \! -path \*/CVS/\* \! -name CVS \! -name .cvsignore \! -name STATUS \! -name TABLE | sort > ../$(TARFILE).list; \
|
||||
$(TAR) $(TARFLAGS) --files-from ../$(TARFILE).list -cvf - | \
|
||||
tardy --user_number=0 --user_name=openssl \
|
||||
@@ -470,9 +679,7 @@ dist_pem_h:
|
||||
install: all install_docs
|
||||
@$(PERL) $(TOP)/util/mkdir-p.pl $(INSTALL_PREFIX)$(INSTALLTOP)/bin \
|
||||
$(INSTALL_PREFIX)$(INSTALLTOP)/lib \
|
||||
$(INSTALL_PREFIX)$(INSTALLTOP)/lib/pkginfo \
|
||||
$(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl \
|
||||
$(INSTALL_PREFIX)$(OPENSSLDIR)/engines \
|
||||
$(INSTALL_PREFIX)$(OPENSSLDIR)/misc \
|
||||
$(INSTALL_PREFIX)$(OPENSSLDIR)/certs \
|
||||
$(INSTALL_PREFIX)$(OPENSSLDIR)/private \
|
||||
@@ -486,17 +693,16 @@ install: all install_docs
|
||||
do \
|
||||
if [ -d "$$i" ]; then \
|
||||
(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}' EXE_EXT='${EXE_EXT}' SHARED_LIBS='${SHARED_LIBS}' 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; \
|
||||
done
|
||||
@for i in $(LIBS) ;\
|
||||
do \
|
||||
if [ -f "$$i" ]; then \
|
||||
( echo installing $$i; \
|
||||
cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
|
||||
$(RANLIB) $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
|
||||
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
|
||||
mv $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i ); \
|
||||
cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/lib; \
|
||||
$(RANLIB) $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i; \
|
||||
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i ); \
|
||||
fi; \
|
||||
done;
|
||||
@if [ -n "$(SHARED_LIBS)" ]; then \
|
||||
@@ -506,25 +712,21 @@ install: all install_docs
|
||||
if [ -f "$$i" -o -f "$$i.a" ]; then \
|
||||
( echo installing $$i; \
|
||||
if [ "$(PLATFORM)" != "Cygwin" ]; then \
|
||||
cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
|
||||
chmod 555 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
|
||||
mv $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i; \
|
||||
cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/lib; \
|
||||
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i; \
|
||||
else \
|
||||
c=`echo $$i | sed 's/^lib/cyg/'`; \
|
||||
cp $$c $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
|
||||
chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
|
||||
mv $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c; \
|
||||
cp $$i.a $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.a.new; \
|
||||
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.a.new; \
|
||||
mv $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.a.new $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.a; \
|
||||
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; \
|
||||
( here="`pwd`"; \
|
||||
cd $(INSTALL_PREFIX)$(INSTALLTOP)/lib; \
|
||||
$(NEWMAKE) -f $$here/Makefile link-shared ); \
|
||||
make -f $$here/Makefile link-shared ); \
|
||||
fi
|
||||
cp openssl.pc $(INSTALL_PREFIX)$(INSTALLTOP)/lib/pkginfo
|
||||
|
||||
install_docs:
|
||||
@$(PERL) $(TOP)/util/mkdir-p.pl \
|
||||
@@ -532,34 +734,25 @@ install_docs:
|
||||
$(INSTALL_PREFIX)$(MANDIR)/man3 \
|
||||
$(INSTALL_PREFIX)$(MANDIR)/man5 \
|
||||
$(INSTALL_PREFIX)$(MANDIR)/man7
|
||||
@pod2man="`cd util; ./pod2mantest $(PERL)`"; \
|
||||
for i in doc/apps/*.pod; do \
|
||||
@for i in doc/apps/*.pod; do \
|
||||
fn=`basename $$i .pod`; \
|
||||
if [ "$$fn" = "config" ]; then sec=5; else sec=1; fi; \
|
||||
echo "installing man$$sec/$$fn.$$sec"; \
|
||||
echo "installing man$$sec/`basename $$i .pod`.$$sec"; \
|
||||
(cd `$(PERL) util/dirname.pl $$i`; \
|
||||
sh -c "$$pod2man \
|
||||
sh -c "`cd ../../util; ./pod2mantest ignore` \
|
||||
--section=$$sec --center=OpenSSL \
|
||||
--release=$(VERSION) `basename $$i`") \
|
||||
> $(INSTALL_PREFIX)$(MANDIR)/man$$sec/$$fn.$$sec; \
|
||||
$(PERL) util/extract-names.pl < $$i | grep -v "^$$fn" | \
|
||||
while read n; do \
|
||||
util/point.sh $$fn.$$sec $(INSTALL_PREFIX)$(MANDIR)/man$$sec/$$n.$$sec; \
|
||||
done; \
|
||||
done; \
|
||||
for i in doc/crypto/*.pod doc/ssl/*.pod; do \
|
||||
> $(INSTALL_PREFIX)$(MANDIR)/man$$sec/`basename $$i .pod`.$$sec; \
|
||||
done
|
||||
@for i in doc/crypto/*.pod doc/ssl/*.pod; do \
|
||||
fn=`basename $$i .pod`; \
|
||||
if [ "$$fn" = "des_modes" ]; then sec=7; else sec=3; fi; \
|
||||
echo "installing man$$sec/$$fn.$$sec"; \
|
||||
echo "installing man$$sec/`basename $$i .pod`.$$sec"; \
|
||||
(cd `$(PERL) util/dirname.pl $$i`; \
|
||||
sh -c "$$pod2man \
|
||||
sh -c "`cd ../../util; ./pod2mantest ignore` \
|
||||
--section=$$sec --center=OpenSSL \
|
||||
--release=$(VERSION) `basename $$i`") \
|
||||
> $(INSTALL_PREFIX)$(MANDIR)/man$$sec/$$fn.$$sec; \
|
||||
$(PERL) util/extract-names.pl < $$i | grep -v "^$$fn" | \
|
||||
while read n; do \
|
||||
util/point.sh $$fn.$$sec $(INSTALL_PREFIX)$(MANDIR)/man$$sec/$$n.$$sec; \
|
||||
done; \
|
||||
> $(INSTALL_PREFIX)$(MANDIR)/man$$sec/`basename $$i .pod`.$$sec; \
|
||||
done
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
584
Makefile.shared
584
Makefile.shared
@@ -1,584 +0,0 @@
|
||||
#
|
||||
# Helper makefile to link shared libraries in a portable way.
|
||||
# This is much simpler than libtool, and hopefully not too error-prone.
|
||||
#
|
||||
# The following variables need to be set on the command line to build
|
||||
# properly
|
||||
|
||||
# CC contains the current compiler. This one MUST be defined
|
||||
CC=cc
|
||||
# LDFLAGS contains flags to be used when the temporary object file is
|
||||
# created. SHARED_LDFLAGS contains flags to be used when the shared
|
||||
# library is created.
|
||||
LDFLAGS=
|
||||
SHARED_LDFLAGS=
|
||||
|
||||
# LIBNAME contains just the name of thhe library, without prefix ("lib"
|
||||
# on Unix, "cyg" for certain forms under Cygwin...) or suffix (.a, .so,
|
||||
# .dll, ...). This one MUST have a value when using this makefile.
|
||||
# For example, to build libfoo.so, you need to do the following:
|
||||
#LIBNAME=foo
|
||||
LIBNAME=
|
||||
|
||||
# LIBEXTRAS contains extra modules to link together with the library.
|
||||
# For example, if a second library, say libbar.a needs to be linked into
|
||||
# libfoo.so, you need to do the following:
|
||||
#LIBEXTRAS=libbar.a
|
||||
# Note that this MUST be used when using the link_o targets, to hold the
|
||||
# names of all object files that go into the target library.
|
||||
LIBEXTRAS=
|
||||
|
||||
# LIBVERSION contains the current version of the library.
|
||||
# For example, to build libfoo.so.1.2, you need to do the following:
|
||||
#LIBVERSION=1.2
|
||||
LIBVERSION=
|
||||
|
||||
# LIBCOMPATVERSIONS contains the compatibility versions (a list) of
|
||||
# the library. They MUST be in decreasing order.
|
||||
# For example, if libfoo.so.1.2.1 is backward compatible with libfoo.so.1.2
|
||||
# and libfoo.so.1, you need to do the following:
|
||||
#LIBCOMPATVERSIONS=1.2 1
|
||||
# Note that on systems that use sonames, the last number will appear as
|
||||
# part of it.
|
||||
# It's also possible, for systems that support it (Tru64, for example),
|
||||
# to add extra compatibility info with more precision, by adding a second
|
||||
# list of versions, separated from the first with a semicolon, like this:
|
||||
#LIBCOMPATVERSIONS=1.2 1;1.2.0 1.1.2 1.1.1 1.1.0 1.0.0
|
||||
LIBCOMPATVERSIONS=
|
||||
|
||||
# LIBDEPS contains all the flags necessary to cover all necessary
|
||||
# dependencies to other libraries.
|
||||
LIBDEPS=
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# The rest is private to this makefile.
|
||||
|
||||
#DEBUG=:
|
||||
DEBUG=set -x
|
||||
|
||||
top:
|
||||
echo "Trying to use this makefile interactively? Don't."
|
||||
|
||||
CALC_VERSIONS= \
|
||||
SHLIB_COMPAT=; SHLIB_SOVER=; \
|
||||
if [ -n "$(LIBVERSION)$(LIBCOMPATVERSIONS)" ]; then \
|
||||
prev=""; \
|
||||
for v in `echo "$(LIBVERSION) $(LIBCOMPATVERSIONS)" | cut -d';' -f1`; do \
|
||||
SHLIB_SOVER_NODOT=$$v \
|
||||
SHLIB_SOVER=.$$v; \
|
||||
if [ -n "$$prev" ]; then \
|
||||
SHLIB_COMPAT="$$SHLIB_COMPAT .$$prev"; \
|
||||
fi; \
|
||||
prev=$$v; \
|
||||
done; \
|
||||
fi
|
||||
|
||||
LINK_SO= \
|
||||
( $(DEBUG); \
|
||||
nm -Pg $$SHOBJECTS | grep ' [BDT] ' | cut -f1 -d' ' > lib$(LIBNAME).exp; \
|
||||
$$SHAREDCMD $(SHARED_LDFLAGS) $$SHAREDFLAGS -o $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX \
|
||||
$$ALLSYMSFLAGS $$SHOBJECTS $$NOALLSYMSFLAGS $$LIBDEPS ) && \
|
||||
$(SYMLINK_SO); ( $(DEBUG); rm -f lib$(LIBNAME).exp )
|
||||
SYMLINK_SO= \
|
||||
if [ -n "$$INHIBIT_SYMLINKS" ]; then :; else \
|
||||
prev=$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX; \
|
||||
if [ -n "$$SHLIB_COMPAT" ]; then \
|
||||
for x in $$SHLIB_COMPAT; do \
|
||||
( $(DEBUG); rm -f $$SHLIB$$x$$SHLIB_SUFFIX; \
|
||||
ln -s $$prev $$SHLIB$$x$$SHLIB_SUFFIX ); \
|
||||
prev=$$SHLIB$$x$$SHLIB_SUFFIX; \
|
||||
done; \
|
||||
fi; \
|
||||
if [ -n "$$SHLIB_SOVER" ]; then \
|
||||
( $(DEBUG); rm -f $$SHLIB$$SHLIB_SUFFIX; \
|
||||
ln -s $$prev $$SHLIB$$SHLIB_SUFFIX ); \
|
||||
fi; \
|
||||
fi
|
||||
|
||||
LINK_SO_A= SHOBJECTS="lib$(LIBNAME).a $(LIBEXTRAS)"; $(LINK_SO)
|
||||
LINK_SO_O= SHOBJECTS="$(LIBEXTRAS)"; $(LINK_SO)
|
||||
LINK_SO_A_VIA_O= \
|
||||
SHOBJECTS=lib$(LIBNAME).o ALL=$$ALLSYMSFLAGS ALLSYMSFLAGS= NOALLSYMSFLAGS=; \
|
||||
( $(DEBUG); \
|
||||
ld $(LDFLAGS) -r -o lib$(LIBNAME).o $$ALL lib$(LIBNAME).a $(LIBEXTRAS) ); \
|
||||
$(LINK_SO) && rm -f $(LIBNAME).o
|
||||
LINK_SO_A_UNPACKED= \
|
||||
UNPACKDIR=link_tmp.$$$$; rm -rf $$UNPACKDIR; mkdir $$UNPACKDIR; \
|
||||
(cd $$UNPACKDIR; ar x ../lib$(LIBNAME).a) && cp $(LIBEXTRAS) $$UNPACKDIR && \
|
||||
SHOBJECTS=$$UNPACKDIR/*.o; \
|
||||
$(LINK_SO) && rm -rf $$UNPACKDIR
|
||||
|
||||
DETECT_GNU_LD=${CC} -v 2>&1 | grep '^gcc' >/dev/null 2>&1 && \
|
||||
my_ld=`${CC} -print-prog-name=ld 2>&1` && \
|
||||
[ -n "$$my_ld" ] && \
|
||||
$$my_ld -v 2>&1 | grep 'GNU ld' >/dev/null 2>&1
|
||||
DO_GNU=$(CALC_VERSIONS); \
|
||||
SHLIB=lib$(LIBNAME).so \
|
||||
SHLIB_SUFFIX= \
|
||||
LIBDEPS="$(LIBDEPS) -lc" \
|
||||
ALLSYMSFLAGS='-Wl,--whole-archive' \
|
||||
NOALLSYMSFLAGS='-Wl,--no-whole-archive' \
|
||||
SHAREDFLAGS="-shared -Wl,-Bsymbolic -Wl,-soname=$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX" \
|
||||
SHAREDCMD='$(CC)'
|
||||
|
||||
link_o.gnu:
|
||||
@ $(DO_GNU); $(LINK_SO_O)
|
||||
link_a.gnu:
|
||||
@ $(DO_GNU); $(LINK_SO_A)
|
||||
|
||||
# For Darwin AKA Mac OS/X (dyld)
|
||||
link_o.darwin:
|
||||
@ $(CALC_VERSIONS); \
|
||||
SHLIB=lib$(LIBNAME) \
|
||||
SHLIB_SUFFIX=.dylib \
|
||||
LIBDEPS="$(LIBDEPS) -lc" \
|
||||
ALLSYMSFLAGS='-all_load' \
|
||||
NOALLSYMSFLAGS='' \
|
||||
SHAREDFLAGS="-dynamiclib" \
|
||||
SHAREDCMD='$(CC)'; \
|
||||
if [ -n "$(LIBVERSION)" ]; then \
|
||||
SHAREDFLAGS="$SHAREDFLAGS -current_version $(LIBVERSION)"; \
|
||||
fi; \
|
||||
if [ -n "$$SHLIB_SOVER_NODOT" ]; then \
|
||||
SHAREDFLAGS="$SHAREDFLAGS -compatibility_version $$SHLIB_SOVER_NODOT"; \
|
||||
fi; \
|
||||
$(LINK_SO_O)
|
||||
link_a.darwin:
|
||||
@ $(CALC_VERSIONS); \
|
||||
SHLIB=lib$(LIBNAME) \
|
||||
SHLIB_SUFFIX=.dylib \
|
||||
LIBDEPS="$(LIBDEPS) -lc" \
|
||||
ALLSYMSFLAGS='-all_load' \
|
||||
NOALLSYMSFLAGS='' \
|
||||
SHAREDFLAGS="-dynamiclib" \
|
||||
SHAREDCMD='$(CC)'; \
|
||||
if [ -n "$(LIBVERSION)" ]; then \
|
||||
SHAREDFLAGS="$SHAREDFLAGS -current_version $(LIBVERSION)"; \
|
||||
fi; \
|
||||
if [ -n "$$SHLIB_SOVER_NODOT" ]; then \
|
||||
SHAREDFLAGS="$SHAREDFLAGS -compatibility_version $$SHLIB_SOVER_NODOT"; \
|
||||
fi; \
|
||||
$(LINK_SO_A)
|
||||
|
||||
link_o.cygwin:
|
||||
@ $(CALC_VERSIONS); \
|
||||
INHIBIT_SYMLINKS=yes; \
|
||||
SHLIB=cyg$(LIBNAME) \
|
||||
SHLIB_SUFFIX=.dll \
|
||||
LIBDEPS="$(LIBDEPS) -lc" \
|
||||
SHLIB_SOVER=-$(LIBVERSION) \
|
||||
ALLSYMSFLAGS='-Wl,--whole-archive' \
|
||||
NOALLSYMSFLAGS='-Wl,--no-whole-archive' \
|
||||
SHAREDFLAGS="-shared -Wl,-Bsymbolic -Wl,--out-implib,lib$(LIBNAME).dll.a" \
|
||||
SHAREDCMD='${CC}'; \
|
||||
$(LINK_SO_O)
|
||||
link_a.cygwin:
|
||||
@ $(CALC_VERSIONS); \
|
||||
INHIBIT_SYMLINKS=yes; \
|
||||
SHLIB=cyg$(LIBNAME) \
|
||||
SHLIB_SUFFIX=.dll \
|
||||
LIBDEPS="$(LIBDEPS) -lc" \
|
||||
SHLIB_SOVER= \
|
||||
ALLSYMSFLAGS='-Wl,--whole-archive' \
|
||||
NOALLSYMSFLAGS='-Wl,--no-whole-archive' \
|
||||
SHAREDFLAGS="-shared -Wl,-Bsymbolic -Wl,--out-implib,lib$(LIBNAME).dll.a" \
|
||||
SHAREDCMD='${CC}'; \
|
||||
$(LINK_SO_A)
|
||||
|
||||
link_o.alpha-osf1:
|
||||
@ if ${DETECT_GNU_LD}; then \
|
||||
$(DO_GNU); \
|
||||
else \
|
||||
SHLIB=lib$(LIBNAME).so \
|
||||
SHLIB_SUFFIX= \
|
||||
LIBDEPS="$(LIBDEPS) -lc" \
|
||||
SHLIB_HIST=`echo "$(LIBCOMPATVERSIONS)" | cut -d';' -f2 | sed -e 's/ */:/'`; \
|
||||
if [ -n "$$SHLIB_HIST" ]; then \
|
||||
SHLIB_HIST="$${SHLIB_HIST}:$(LIBVERSION)"; \
|
||||
else \
|
||||
SHLIB_HIST="$(LIBVERSION)"; \
|
||||
fi
|
||||
SHLIB_SOVER= \
|
||||
ALLSYMSFLAGS='-all' \
|
||||
NOALLSYMSFLAGS='-none' \
|
||||
SHAREDFLAGS="-shared" \
|
||||
SHAREDCMD='$(CC)'; \
|
||||
if [ -n "$$SHLIB_HIST" ]; then \
|
||||
SHAREDFLAGS="$SHAREDFLAGS -set_version \"$$SHLIB_HIST\""; \
|
||||
fi; \
|
||||
fi; \
|
||||
$(LINK_SO_O)
|
||||
link_a.alpha-osf1:
|
||||
@ if ${DETECT_GNU_LD}; then \
|
||||
$(DO_GNU); \
|
||||
else \
|
||||
SHLIB=lib$(LIBNAME).so \
|
||||
SHLIB_SUFFIX= \
|
||||
LIBDEPS="$(LIBDEPS) -lc" \
|
||||
SHLIB_HIST=`echo "$(LIBCOMPATVERSIONS)" | cut -d';' -f2 | sed -e 's/ */:/'`; \
|
||||
if [ -n "$$SHLIB_HIST" ]; then \
|
||||
SHLIB_HIST="$${SHLIB_HIST}:$(LIBVERSION)"; \
|
||||
else \
|
||||
SHLIB_HIST="$(LIBVERSION)"; \
|
||||
fi
|
||||
SHLIB_SOVER= \
|
||||
ALLSYMSFLAGS='-all' \
|
||||
NOALLSYMSFLAGS='-none' \
|
||||
SHAREDFLAGS="-shared" \
|
||||
SHAREDCMD='$(CC)'; \
|
||||
if [ -n "$$SHLIB_HIST" ]; then \
|
||||
SHAREDFLAGS="$SHAREDFLAGS -set_version \"$$SHLIB_HIST\""; \
|
||||
fi; \
|
||||
fi; \
|
||||
$(LINK_SO_A)
|
||||
|
||||
# The difference between alpha-osf1-shared and tru64-shared is the `-msym'
|
||||
# option passed to the linker.
|
||||
link_o.tru64:
|
||||
@ if ${DETECT_GNU_LD}; then \
|
||||
$(DO_GNU); \
|
||||
else \
|
||||
SHLIB=lib$(LIBNAME).so \
|
||||
SHLIB_SUFFIX= \
|
||||
LIBDEPS="$(LIBDEPS) -lc" \
|
||||
SHLIB_HIST=`echo "$(LIBCOMPATVERSIONS)" | cut -d';' -f2 | sed -e 's/ */:/'`; \
|
||||
if [ -n "$$SHLIB_HIST" ]; then \
|
||||
SHLIB_HIST="$${SHLIB_HIST}:$(LIBVERSION)"; \
|
||||
else \
|
||||
SHLIB_HIST="$(LIBVERSION)"; \
|
||||
fi
|
||||
SHLIB_SOVER= \
|
||||
ALLSYMSFLAGS='-all' \
|
||||
NOALLSYMSFLAGS='-none' \
|
||||
SHAREDFLAGS="-shared -msym" \
|
||||
SHAREDCMD='$(CC)'; \
|
||||
if [ -n "$$SHLIB_HIST" ]; then \
|
||||
SHAREDFLAGS="$SHAREDFLAGS -set_version \"$$SHLIB_HIST\""; \
|
||||
fi; \
|
||||
fi; \
|
||||
$(LINK_SO_O)
|
||||
link_a.tru64:
|
||||
@ if ${DETECT_GNU_LD}; then \
|
||||
$(DO_GNU); \
|
||||
else \
|
||||
SHLIB=lib$(LIBNAME).so \
|
||||
SHLIB_SUFFIX= \
|
||||
LIBDEPS="$(LIBDEPS) -lc" \
|
||||
SHLIB_HIST=`echo "$(LIBCOMPATVERSIONS)" | cut -d';' -f2 | sed -e 's/ */:/'`; \
|
||||
if [ -n "$$SHLIB_HIST" ]; then \
|
||||
SHLIB_HIST="$${SHLIB_HIST}:$(LIBVERSION)"; \
|
||||
else \
|
||||
SHLIB_HIST="$(LIBVERSION)"; \
|
||||
fi
|
||||
SHLIB_SOVER= \
|
||||
ALLSYMSFLAGS='-all' \
|
||||
NOALLSYMSFLAGS='-none' \
|
||||
SHAREDFLAGS="-shared -msym" \
|
||||
SHAREDCMD='$(CC)'; \
|
||||
if [ -n "$$SHLIB_HIST" ]; then \
|
||||
SHAREDFLAGS="$SHAREDFLAGS -set_version \"$$SHLIB_HIST\""; \
|
||||
fi; \
|
||||
fi; \
|
||||
$(LINK_SO_A)
|
||||
|
||||
# The difference between tru64-shared and tru64-shared-rpath is the
|
||||
# -rpath ${LIBRPATH} passed to the linker.
|
||||
link_o.tru64-rpath:
|
||||
@ if ${DETECT_GNU_LD}; then \
|
||||
$(DO_GNU); \
|
||||
else \
|
||||
SHLIB=lib$(LIBNAME).so \
|
||||
SHLIB_SUFFIX= \
|
||||
LIBDEPS="$(LIBDEPS) -lc" \
|
||||
SHLIB_HIST=`echo "$(LIBCOMPATVERSIONS)" | cut -d';' -f2 | sed -e 's/ */:/'`; \
|
||||
if [ -n "$$SHLIB_HIST" ]; then \
|
||||
SHLIB_HIST="$${SHLIB_HIST}:$(LIBVERSION)"; \
|
||||
else \
|
||||
SHLIB_HIST="$(LIBVERSION)"; \
|
||||
fi
|
||||
SHLIB_SOVER= \
|
||||
ALLSYMSFLAGS='-all' \
|
||||
NOALLSYMSFLAGS='-none' \
|
||||
SHAREDFLAGS="-shared -msym -rpath $(LIBRPATH)" \
|
||||
SHAREDCMD='$(CC)'; \
|
||||
if [ -n "$$SHLIB_HIST" ]; then \
|
||||
SHAREDFLAGS="$SHAREDFLAGS -set_version \"$$SHLIB_HIST\""; \
|
||||
fi; \
|
||||
fi; \
|
||||
$(LINK_SO_O)
|
||||
link_a.tru64-rpath:
|
||||
@ if ${DETECT_GNU_LD}; then \
|
||||
$(DO_GNU); \
|
||||
else \
|
||||
SHLIB=lib$(LIBNAME).so \
|
||||
SHLIB_SUFFIX= \
|
||||
LIBDEPS="$(LIBDEPS) -lc" \
|
||||
SHLIB_HIST=`echo "$(LIBCOMPATVERSIONS)" | cut -d';' -f2 | sed -e 's/ */:/'`; \
|
||||
if [ -n "$$SHLIB_HIST" ]; then \
|
||||
SHLIB_HIST="$${SHLIB_HIST}:$(LIBVERSION)"; \
|
||||
else \
|
||||
SHLIB_HIST="$(LIBVERSION)"; \
|
||||
fi
|
||||
SHLIB_SOVER= \
|
||||
ALLSYMSFLAGS='-all' \
|
||||
NOALLSYMSFLAGS='-none' \
|
||||
SHAREDFLAGS="-shared -msym -rpath $(LIBRPATH)" \
|
||||
SHAREDCMD='$(CC)'; \
|
||||
if [ -n "$$SHLIB_HIST" ]; then \
|
||||
SHAREDFLAGS="$SHAREDFLAGS -set_version \"$$SHLIB_HIST\""; \
|
||||
fi; \
|
||||
fi; \
|
||||
$(LINK_SO_A)
|
||||
|
||||
link_o.solaris:
|
||||
@ if ${DETECT_GNU_LD}; then \
|
||||
$(DO_GNU); \
|
||||
else \
|
||||
$(CALC_VERSIONS); \
|
||||
SHLIB=lib$(LIBNAME).so \
|
||||
SHLIB_SUFFIX= \
|
||||
LIBDEPS="$(LIBDEPS) -lc" \
|
||||
ALLSYMSFLAGS='-z allextract' \
|
||||
NOALLSYMSFLAGS='' \
|
||||
SHAREDFLAGS='-G -h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX' \
|
||||
SHAREDCMD='$(CC)'; \
|
||||
fi; \
|
||||
$(LINK_SO_O)
|
||||
link_a.solaris:
|
||||
@ if ${DETECT_GNU_LD}; then \
|
||||
$(DO_GNU); \
|
||||
else \
|
||||
$(CALC_VERSIONS); \
|
||||
SHLIB=lib$(LIBNAME).so \
|
||||
SHLIB_SUFFIX= \
|
||||
LIBDEPS="$(LIBDEPS) -lc" \
|
||||
ALLSYMSFLAGS='-z allextract' \
|
||||
NOALLSYMSFLAGS='' \
|
||||
SHAREDFLAGS='-G -h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX' \
|
||||
SHAREDCMD='$(CC)'; \
|
||||
fi; \
|
||||
$(LINK_SO_A)
|
||||
|
||||
# OpenServer 5 native compilers used
|
||||
# UnixWare 7 and OpenUNIX 8 native compilers used
|
||||
link_o.svr3:
|
||||
@ if ${DETECT_GNU_LD}; then \
|
||||
$(DO_GNU); \
|
||||
else \
|
||||
$(CALC_VERSIONS); \
|
||||
SHLIB=lib$(LIBNAME).so \
|
||||
SHLIB_SUFFIX= \
|
||||
LIBDEPS="$(LIBDEPS) -lc" \
|
||||
ALLSYMSFLAGS='-z allextract' \
|
||||
NOALLSYMSFLAGS='' \
|
||||
SHAREDFLAGS='-G -h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX' \
|
||||
SHAREDCMD='$(CC)'; \
|
||||
fi; \
|
||||
$(LINK_SO_O)
|
||||
link_a.svr3:
|
||||
@ if ${DETECT_GNU_LD}; then \
|
||||
$(DO_GNU); \
|
||||
else \
|
||||
$(CALC_VERSIONS); \
|
||||
SHLIB=lib$(LIBNAME).so \
|
||||
SHLIB_SUFFIX= \
|
||||
LIBDEPS="$(LIBDEPS) -lc" \
|
||||
ALLSYMSFLAGS='-z allextract' \
|
||||
NOALLSYMSFLAGS='' \
|
||||
SHAREDFLAGS='-G -h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX' \
|
||||
SHAREDCMD='$(CC)'; \
|
||||
fi; \
|
||||
$(LINK_SO_A_UNPACKED)
|
||||
|
||||
link_o.irix:
|
||||
@ if ${DETECT_GNU_LD}; then \
|
||||
$(DO_GNU); \
|
||||
else \
|
||||
$(CALC_VERSIONS); \
|
||||
SHLIB=lib$(LIBNAME).so \
|
||||
SHLIB_SUFFIX= \
|
||||
LIBDEPS="$(LIBDEPS) -lc" \
|
||||
ALLSYMSFLAGS='-all' \
|
||||
NOALLSYMSFLAGS='' \
|
||||
SHAREDFLAGS='-shared -Wl,-soname,$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX' \
|
||||
SHAREDCMD='$(CC)'; \
|
||||
fi; \
|
||||
$(LINK_SO_O)
|
||||
link_a.irix:
|
||||
@ if ${DETECT_GNU_LD}; then \
|
||||
$(DO_GNU); \
|
||||
else \
|
||||
$(CALC_VERSIONS); \
|
||||
SHLIB=lib$(LIBNAME).so \
|
||||
SHLIB_SUFFIX= \
|
||||
LIBDEPS="$(LIBDEPS) -lc" \
|
||||
ALLSYMSFLAGS='-all' \
|
||||
NOALLSYMSFLAGS='' \
|
||||
SHAREDFLAGS='-shared -Wl,-soname,$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX' \
|
||||
SHAREDCMD='$(CC)'; \
|
||||
fi; \
|
||||
$(LINK_SO_A)
|
||||
|
||||
# HP-UX includes the full pathname of libs we depend on, so we would get
|
||||
# ./libcrypto (with ./ as path information) compiled into libssl, hence
|
||||
# we omit the SHLIBDEPS. Applications must be linked with -lssl -lcrypto
|
||||
# anyway.
|
||||
# The object modules are loaded from lib$i.a using the undocumented -Fl
|
||||
# option.
|
||||
#
|
||||
# WARNING: Until DSO is fixed to support a search path, we support SHLIB_PATH
|
||||
# by temporarily specifying "+s"!
|
||||
#
|
||||
link_o.hpux32:
|
||||
@ $(CALC_VERSIONS); \
|
||||
SHLIB=lib$(LIBNAME).sl \
|
||||
SHLIB_SUFFIX= \
|
||||
LIBDEPS="$(LIBDEPS) -lc" \
|
||||
ALLSYMSFLAGS='-Fl' \
|
||||
NOALLSYMSFLAGS='' \
|
||||
SHAREDFLAGS='+vnocompatwarnings -b -z +s +h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX' \
|
||||
SHAREDCMD='/usr/ccs/bin/ld'; \
|
||||
$(LINK_SO_O) && chmod a=rx $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX
|
||||
link_a.hpux32:
|
||||
@ $(CALC_VERSIONS); \
|
||||
SHLIB=lib$(LIBNAME).sl \
|
||||
SHLIB_SUFFIX= \
|
||||
LIBDEPS="$(LIBDEPS) -lc" \
|
||||
ALLSYMSFLAGS='-Fl' \
|
||||
NOALLSYMSFLAGS='' \
|
||||
SHAREDFLAGS='+vnocompatwarnings -b -z +s +h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX' \
|
||||
SHAREDCMD='/usr/ccs/bin/ld'; \
|
||||
$(LINK_SO_A) && chmod a=rx $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX
|
||||
|
||||
# HP-UX includes the full pathname of libs we depend on, so we would get
|
||||
# ./libcrypto (with ./ as path information) compiled into libssl, hence
|
||||
# we omit the SHLIBDEPS. Applications must be linked with -lssl -lcrypto
|
||||
# anyway.
|
||||
#
|
||||
# HP-UX in 64bit mode has "+s" enabled by default; it will search for
|
||||
# shared libraries along LD_LIBRARY_PATH _and_ SHLIB_PATH.
|
||||
#
|
||||
link_o.hpux64:
|
||||
@ $(CALC_VERSIONS); \
|
||||
SHLIB=lib$(LIBNAME).sl \
|
||||
SHLIB_SUFFIX= \
|
||||
LIBDEPS="$(LIBDEPS) -lc" \
|
||||
ALLSYMSFLAGS='+forceload' \
|
||||
NOALLSYMSFLAGS='' \
|
||||
SHAREDFLAGS='-b -z +h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX' \
|
||||
SHAREDCMD='/usr/ccs/bin/ld'; \
|
||||
$(LINK_SO_O) && chmod a=rx $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX
|
||||
link_a.hpux64:
|
||||
@ $(CALC_VERSIONS); \
|
||||
SHLIB=lib$(LIBNAME).sl \
|
||||
SHLIB_SUFFIX= \
|
||||
LIBDEPS="$(LIBDEPS) -lc" \
|
||||
ALLSYMSFLAGS='+forceload' \
|
||||
NOALLSYMSFLAGS='' \
|
||||
SHAREDFLAGS='-b -z +h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX' \
|
||||
SHAREDCMD='/usr/ccs/bin/ld'; \
|
||||
$(LINK_SO_A) && chmod a=rx $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX
|
||||
|
||||
link_o.aix:
|
||||
@ $(CALC_VERSIONS); \
|
||||
SHLIB=lib$(LIBNAME).so \
|
||||
SHLIB_SUFFIX= \
|
||||
LIBDEPS="$(LIBDEPS) -lc" \
|
||||
ALLSYMSFLAGS='-bnogc' \
|
||||
NOALLSYMSFLAGS='' \
|
||||
SHAREDFLAGS='-G -bE:lib$(LIBNAME).exp -bM:SRE' \
|
||||
SHAREDCMD='$(CC)'; \
|
||||
$(LINK_SO_O)
|
||||
link_a.aix:
|
||||
@ $(CALC_VERSIONS); \
|
||||
SHLIB=lib$(LIBNAME).so \
|
||||
SHLIB_SUFFIX= \
|
||||
LIBDEPS="$(LIBDEPS) -lc" \
|
||||
ALLSYMSFLAGS='-bnogc' \
|
||||
NOALLSYMSFLAGS='' \
|
||||
SHAREDFLAGS='-G -bE:lib$(LIBNAME).exp -bM:SRE' \
|
||||
SHAREDCMD='$(CC)'; \
|
||||
$(LINK_SO_A_VIA_O)
|
||||
|
||||
link_o.reliantunix:
|
||||
@ $(CALC_VERSIONS); \
|
||||
SHLIB=lib$(LIBNAME).so \
|
||||
SHLIB_SUFFIX= \
|
||||
LIBDEPS="$(LIBDEPS) -lc" \
|
||||
ALLSYMSFLAGS= \
|
||||
NOALLSYMSFLAGS='' \
|
||||
SHAREDFLAGS='-G' \
|
||||
SHAREDCMD='$(CC)'; \
|
||||
$(LINK_SO_O)
|
||||
link_a.reliantunix:
|
||||
@ $(CALC_VERSIONS); \
|
||||
SHLIB=lib$(LIBNAME).so \
|
||||
SHLIB_SUFFIX= \
|
||||
LIBDEPS="$(LIBDEPS) -lc" \
|
||||
ALLSYMSFLAGS= \
|
||||
NOALLSYMSFLAGS='' \
|
||||
SHAREDFLAGS='-G' \
|
||||
SHAREDCMD='$(CC)'; \
|
||||
$(LINK_SO_A_UNPACKED)
|
||||
|
||||
# Targets to build symbolic links when needed
|
||||
symlink.gnu symlink.solaris symlink.svr3 symlink.irix \
|
||||
symlink.aix symlink.reliantunix:
|
||||
@ $(CALC_VERSIONS); \
|
||||
SHLIB=lib$(LIBNAME).so; \
|
||||
$(SYMLINK_SO)
|
||||
symlink.darwin:
|
||||
@ $(CALC_VERSIONS); \
|
||||
SHLIB=lib$(LIBNAME) \
|
||||
SHLIB_SUFFIX=.dylib; \
|
||||
$(SYMLINK_SO)
|
||||
symlink.hpux32 symlink.hpux64:
|
||||
@ $(CALC_VERSIONS); \
|
||||
SHLIB=lib$(LIBNAME).sl; \
|
||||
$(SYMLINK_SO)
|
||||
# The following lines means those specific architectures do no symlinks
|
||||
symlink.cygwin symlib.alpha-osf1 symlink.tru64 symlink.tru64-rpath:
|
||||
|
||||
# Compatibility targets
|
||||
link_o.bsd-gcc-shared link_o.linux-shared link_o.gnu-shared: link_o.gnu
|
||||
link_a.bsd-gcc-shared link_a.linux-shared link_a.gnu-shared: link_a.gnu
|
||||
symlink.bsd-gcc-shared symlink.linux-shared symlink.gnu-shared: symlink.gnu
|
||||
link_o.darwin-shared: link_o.darwin
|
||||
link_a.darwin-shared: link_a.darwin
|
||||
symlink.darwin-shared: symlink.darwin
|
||||
link_o.cygwin-shared: link_o.cygwin
|
||||
link_a.cygwin-shared: link_a.cygwin
|
||||
symlink.cygwin-shared: symlink.cygwin
|
||||
link_o.alpha-osf1-shared: link_o.alpha-osf1
|
||||
link_a.alpha-osf1-shared: link_a.alpha-osf1
|
||||
symlink.alpha-osf1-shared: symlink.alpha-osf1
|
||||
link_o.tru64-shared: link_o.tru64
|
||||
link_a.tru64-shared: link_a.tru64
|
||||
symlink.tru64-shared: symlink.tru64
|
||||
link_o.tru64-shared-rpath: link_o.tru64-rpath
|
||||
link_a.tru64-shared-rpath: link_a.tru64-rpath
|
||||
symlink.tru64-shared-rpath: symlink.tru64-rpath
|
||||
link_o.solaris-shared: link_o.solaris
|
||||
link_a.solaris-shared: link_a.solaris
|
||||
symlink.solaris-shared: symlink.solaris
|
||||
link_o.svr3-shared: link_o.svr3
|
||||
link_a.svr3-shared: link_a.svr3
|
||||
symlink.svr3-shared: symlink.svr3
|
||||
link_o.svr5-shared: link_o.svr3
|
||||
link_a.svr5-shared: link_a.svr3
|
||||
symlink.svr5-shared: symlink.svr3
|
||||
link_o.irix-shared: link_o.irix
|
||||
link_a.irix-shared: link_a.irix
|
||||
symlink.irix-shared: symlink.irix
|
||||
link_o.hpux-shared: link_o.hpux32
|
||||
link_a.hpux-shared: link_a.hpux32
|
||||
symlink.hpux-shared: symlink.hpux32
|
||||
link_o.hpux64-shared: link_o.hpux64
|
||||
link_a.hpux64-shared: link_a.hpux64
|
||||
symlink.hpux64-shared: symlink.hpux64
|
||||
link_o.aix-shared: link_o.aix
|
||||
link_a.aix-shared: link_a.aix
|
||||
symlink.aix-shared: symlink.aix
|
||||
link_o.reliantunix-shared: link_o.reliantunix
|
||||
link_a.reliantunix-shared: link_a.reliantunix
|
||||
symlink.reliantunix-shared: symlink.reliantunix
|
44
NEWS
44
NEWS
@@ -17,18 +17,13 @@
|
||||
a separate distribution.
|
||||
o New elliptic curve library section.
|
||||
o New AES (Rijndael) library section.
|
||||
o Support for new platforms: Windows CE, Tandem OSS, A/UX, AIX 64-bit,
|
||||
Linux x86_64
|
||||
o Extended support for some platforms: VxWorks
|
||||
o Enhanced support for shared libraries.
|
||||
o Support for pkg-config.
|
||||
o Lots of new manuals.
|
||||
o Change DES API to clean up the namespace (some applications link also
|
||||
against libdes providing similar functions having the same name).
|
||||
Provide macros for backward compatibility (will be removed in the
|
||||
future).
|
||||
o Unify handling of cryptographic algorithms (software and engine)
|
||||
to be available via EVP routines for asymmetric and symmetric ciphers.
|
||||
o 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.
|
||||
@@ -36,44 +31,15 @@
|
||||
o Reworked parts of the BIGNUM code.
|
||||
o Support for new engines: Broadcom ubsec, Accelerated Encryption
|
||||
Processing, IBM 4758.
|
||||
o A few new engines added in the demos area.
|
||||
o Extended and corrected OID (object identifier) table.
|
||||
o PRNG: query at more locations for a random device, automatic query for
|
||||
EGD style random sources at several locations.
|
||||
o SSL/TLS: allow optional cipher choice according to server's preference.
|
||||
o SSL/TLS: allow server to explicitly set new session ids.
|
||||
o SSL/TLS: support Kerberos cipher suites (RFC2712).
|
||||
Only supports MIT Kerberos for now.
|
||||
o SSL/TLS: allow more precise control of renegotiations and sessions.
|
||||
o SSL/TLS: add callback to retrieve SSL/TLS messages.
|
||||
o SSL/TLS: support AES cipher suites (RFC3268).
|
||||
|
||||
Major changes between OpenSSL 0.9.6g and OpenSSL 0.9.6h:
|
||||
|
||||
o New configuration targets for Tandem OSS and A/UX.
|
||||
o New OIDs for Microsoft attributes.
|
||||
o Better handling of SSL session caching.
|
||||
o Better comparison of distinguished names.
|
||||
o Better handling of shared libraries in a mixed GNU/non-GNU environment.
|
||||
o Support assembler code with Borland C.
|
||||
o Fixes for length problems.
|
||||
o Fixes for uninitialised variables.
|
||||
o Fixes for memory leaks, some unusual crashes and some race conditions.
|
||||
o Fixes for smaller building problems.
|
||||
o Updates of manuals, FAQ and other instructive documents.
|
||||
|
||||
Major changes between OpenSSL 0.9.6f and OpenSSL 0.9.6g:
|
||||
|
||||
o Important building fixes on Unix.
|
||||
|
||||
Major changes between OpenSSL 0.9.6e and OpenSSL 0.9.6f:
|
||||
|
||||
o Various important bugfixes.
|
||||
|
||||
Major changes between OpenSSL 0.9.6d and OpenSSL 0.9.6e:
|
||||
|
||||
o Important security related bugfixes.
|
||||
o Various SSL/TLS library bugfixes.
|
||||
o SSL/TLS: add draft AES ciphersuites (disabled unless explicitly requested).
|
||||
|
||||
Major changes between OpenSSL 0.9.6c and OpenSSL 0.9.6d:
|
||||
|
||||
@@ -126,7 +92,7 @@
|
||||
o Bug fixes for Win32, HP/UX and Irix.
|
||||
o Bug fixes in BIGNUM, SSL, PKCS#7, PKCS#12, X.509, CONF and
|
||||
memory checking routines.
|
||||
o Bug fixes for RSA operations in threaded environments.
|
||||
o Bug fixes 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.
|
||||
|
64
PROBLEMS
64
PROBLEMS
@@ -1,64 +0,0 @@
|
||||
* System libcrypto.dylib and libssl.dylib are used by system ld on MacOS X.
|
||||
|
||||
|
||||
NOTE: The problem described here only applies when OpenSSL isn't built
|
||||
with shared library support (i.e. without the "shared" configuration
|
||||
option). If you build with shared library support, you will have no
|
||||
problems as long as you set up DYLD_LIBRARY_PATH properly at all times.
|
||||
|
||||
|
||||
This is really a misfeature in ld, which seems to look for .dylib libraries
|
||||
along the whole library path before it bothers looking for .a libraries. This
|
||||
means that -L switches won't matter unless OpenSSL is built with shared
|
||||
library support.
|
||||
|
||||
The workaround may be to change the following lines in apps/Makefile.ssl and
|
||||
test/Makefile.ssl:
|
||||
|
||||
LIBCRYPTO=-L.. -lcrypto
|
||||
LIBSSL=-L.. -lssl
|
||||
|
||||
to:
|
||||
|
||||
LIBCRYPTO=../libcrypto.a
|
||||
LIBSSL=../libssl.a
|
||||
|
||||
It's possible that something similar is needed for shared library support
|
||||
as well. That hasn't been well tested yet.
|
||||
|
||||
|
||||
Another solution that many seem to recommend is to move the libraries
|
||||
/usr/lib/libcrypto.0.9.dylib, /usr/lib/libssl.0.9.dylib to a different
|
||||
directory, build and install OpenSSL and anything that depends on your
|
||||
build, then move libcrypto.0.9.dylib and libssl.0.9.dylib back to their
|
||||
original places. Note that the version numbers on those two libraries
|
||||
may differ on your machine.
|
||||
|
||||
|
||||
As long as Apple doesn't fix the problem with ld, this problem building
|
||||
OpenSSL will remain as is.
|
||||
|
||||
|
||||
* Parallell make leads to errors
|
||||
|
||||
While running tests, running a parallell make is a bad idea. Many test
|
||||
scripts use the same name for output and input files, which means different
|
||||
will interfere with each other and lead to test failure.
|
||||
|
||||
The solution is simple for now: don't run parallell make when testing.
|
||||
|
||||
|
||||
* Bugs in gcc 3.0 triggered
|
||||
|
||||
According to a problem report, there are bugs in gcc 3.0 that are
|
||||
triggered by some of the code in OpenSSL, more specifically in
|
||||
PEM_get_EVP_CIPHER_INFO(). The triggering code is the following:
|
||||
|
||||
header+=11;
|
||||
if (*header != '4') return(0); header++;
|
||||
if (*header != ',') return(0); header++;
|
||||
|
||||
What happens is that gcc might optimize a little too agressively, and
|
||||
you end up with an extra incrementation when *header != '4'.
|
||||
|
||||
We recommend that you upgrade gcc to as high a 3.x version as you can.
|
19
README
19
README
@@ -1,5 +1,5 @@
|
||||
|
||||
OpenSSL 0.9.8-dev XX xxx XXXX
|
||||
OpenSSL 0.9.7-beta2 16 Jun 2002
|
||||
|
||||
Copyright (c) 1998-2002 The OpenSSL Project
|
||||
Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson
|
||||
@@ -122,13 +122,6 @@
|
||||
lists the functions; you will probably have to look at the code to work out
|
||||
how to use them. Look at the example programs.
|
||||
|
||||
PROBLEMS
|
||||
--------
|
||||
|
||||
For some platforms, there are some known problems that may affect the user
|
||||
or application author. We try to collect those in doc/PROBLEMS, with current
|
||||
thoughts on how they should be solved in a future of OpenSSL.
|
||||
|
||||
SUPPORT
|
||||
-------
|
||||
|
||||
@@ -153,13 +146,11 @@
|
||||
- Problem Description (steps that will reproduce the problem, if known)
|
||||
- Stack Traceback (if the application dumps core)
|
||||
|
||||
Report the bug to the OpenSSL project via the Request Tracker
|
||||
(http://www.openssl.org/rt2.html) by mail to:
|
||||
Report the bug to the OpenSSL project at:
|
||||
|
||||
openssl-bugs@openssl.org
|
||||
|
||||
Note that mail to openssl-bugs@openssl.org is recorded in the publicly
|
||||
readable request tracker database and is forwarded to a public
|
||||
Note that mail to openssl-bugs@openssl.org is forwarded to a public
|
||||
mailing list. Confidential mail may be sent to openssl-security@openssl.org
|
||||
(PGP key available from the key servers).
|
||||
|
||||
@@ -173,9 +164,7 @@
|
||||
textual explanation of what your patch does.
|
||||
|
||||
Note: For legal reasons, contributions from the US can be accepted only
|
||||
if a TSA notification and a copy of the patch is sent to crypt@bis.doc.gov;
|
||||
see http://www.bis.doc.gov/Encryption/PubAvailEncSourceCodeNofify.html [sic]
|
||||
and http://w3.access.gpo.gov/bis/ear/pdf/740.pdf (EAR Section 740.13(e)).
|
||||
if a copy of the patch is sent to crypt@bxa.doc.gov
|
||||
|
||||
The preferred format for changes is "diff -u" output. You might
|
||||
generate it like this:
|
||||
|
@@ -154,7 +154,7 @@
|
||||
shared-library that contains the ENGINE implementation, and "NO_VCHECK"
|
||||
might possibly be useful if there is a minor version conflict and you
|
||||
(or a vendor helpdesk) is convinced you can safely ignore it.
|
||||
"ID" is probably only needed if a shared-library implements
|
||||
"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
|
||||
@@ -174,7 +174,7 @@
|
||||
|
||||
ENGINE *e = ENGINE_by_id("dynamic");
|
||||
ENGINE_ctrl_cmd_string(e, "SO_PATH", "/lib/libfoo.so", 0);
|
||||
ENGINE_ctrl_cmd_string(e, "ID", "foo", 0);
|
||||
ENGINE_ctrl_cmd_string(e, "ENGINE_ID", "foo", 0);
|
||||
ENGINE_ctrl_cmd_string(e, "LOAD", NULL, 0);
|
||||
ENGINE_ctrl_cmd_string(e, "CMD_FOO", "some input data", 0);
|
||||
|
||||
@@ -184,7 +184,7 @@
|
||||
|
||||
openssl engine dynamic \
|
||||
-pre SO_PATH:/lib/libfoo.so \
|
||||
-pre ID:foo \
|
||||
-pre ENGINE_ID:foo \
|
||||
-pre LOAD \
|
||||
-pre "CMD_FOO:some input data"
|
||||
|
||||
@@ -192,7 +192,7 @@
|
||||
|
||||
openssl engine -vvvv dynamic \
|
||||
-pre SO_PATH:/lib/libfoo.so \
|
||||
-pre ID:foo \
|
||||
-pre ENGINE_ID:foo \
|
||||
-pre LOAD
|
||||
|
||||
Applications that support the ENGINE API and more specifically, the
|
||||
|
36
STATUS
36
STATUS
@@ -1,20 +1,12 @@
|
||||
|
||||
OpenSSL STATUS Last modified at
|
||||
______________ $Date: 2002/12/07 20:03:42 $
|
||||
______________ $Date: 2002/06/16 11:27:38 $
|
||||
|
||||
DEVELOPMENT STATE
|
||||
|
||||
o OpenSSL 0.9.8: Under development...
|
||||
o OpenSSL 0.9.7-beta5: Released on December 5th, 2002
|
||||
o OpenSSL 0.9.7-beta4: Released on November 19th, 2002
|
||||
Debian GNU/Linux (kernel version 2.4.19, gcc 2.95.4) - PASSED
|
||||
o OpenSSL 0.9.7-beta3: Released on July 30th, 2002
|
||||
o OpenSSL 0.9.7-beta2: Released on June 16th, 2002
|
||||
o OpenSSL 0.9.7-beta1: Released on June 1st, 2002
|
||||
o OpenSSL 0.9.6h: Released on December 5th, 2002
|
||||
o OpenSSL 0.9.6g: Released on August 9th, 2002
|
||||
o OpenSSL 0.9.6f: Released on August 8th, 2002
|
||||
o OpenSSL 0.9.6e: Released on July 30th, 2002
|
||||
o OpenSSL 0.9.7-beta2: Released on June 16th, 2002
|
||||
o OpenSSL 0.9.7-beta1: Released on June 1st, 2002
|
||||
o OpenSSL 0.9.6d: Released on May 9th, 2002
|
||||
o OpenSSL 0.9.6c: Released on December 21st, 2001
|
||||
o OpenSSL 0.9.6b: Released on July 9th, 2001
|
||||
@@ -35,18 +27,6 @@
|
||||
o BN_mod_mul verification fails for mips3-sgi-irix
|
||||
unless configured with no-asm
|
||||
|
||||
o [2002-11-21]
|
||||
PR 343 mentions that scrubbing memory with 'memset(ptr, 0, n)' may
|
||||
be optimized away in modern compilers. This is definitely not good
|
||||
and needs to be fixed immediately. The formula to use is presented
|
||||
in:
|
||||
|
||||
http://online.securityfocus.com/archive/82/297918/2002-10-27/2002-11-02/0
|
||||
|
||||
The problem report that mentions this is:
|
||||
|
||||
https://www.aet.TU-Cottbus.DE/rt2/Ticket/Display.html?id=343
|
||||
|
||||
AVAILABLE PATCHES
|
||||
|
||||
o
|
||||
@@ -68,18 +48,12 @@
|
||||
UTIL (a new set of library functions to support some higher level
|
||||
functionality that is currently missing).
|
||||
Shared library support for VMS.
|
||||
Kerberos 5 authentication (Heimdal)
|
||||
Kerberos 5 authentication
|
||||
Constification
|
||||
Compression
|
||||
Attribute Certificate support
|
||||
Certificate Pair support
|
||||
Storage Engines (primarly an LDAP storage engine)
|
||||
OCSP
|
||||
|
||||
NEEDS PATCH
|
||||
|
||||
o 0.9.8-dev: COMPLEMENTOFALL and COMPLEMENTOFDEFAULT do not
|
||||
handle ECCdraft cipher suites correctly.
|
||||
|
||||
o apps/ca.c: "Sign the certificate?" - "n" creates empty certificate file
|
||||
|
||||
o "OpenSSL STATUS" is never up-to-date.
|
||||
|
@@ -285,7 +285,6 @@ $ if alg_entry .eqs. "" then goto loop2
|
||||
$ if alg_entry .nes. ","
|
||||
$ then
|
||||
$ if alg_entry .eqs. "KRB5" then goto loop ! Special for now
|
||||
$ if alg_entry .eqs. "STATIC_ENGINE" then goto loop ! Special for now
|
||||
$ if f$trnlnm("OPENSSL_NO_"+alg_entry) .nes. "" then goto loop
|
||||
$ goto loop2
|
||||
$ endif
|
||||
|
1
VMS/tcpip_shr_decc.opt
Normal file
1
VMS/tcpip_shr_decc.opt
Normal file
@@ -0,0 +1 @@
|
||||
sys$share:tcpip$ipc_shr.exe/share
|
1504
apps/Makefile.ssl
1504
apps/Makefile.ssl
File diff suppressed because it is too large
Load Diff
148
apps/apps.c
148
apps/apps.c
@@ -114,7 +114,9 @@
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <ctype.h>
|
||||
#define NON_MAIN
|
||||
#include "apps.h"
|
||||
#undef NON_MAIN
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/x509v3.h>
|
||||
@@ -127,17 +129,9 @@
|
||||
#ifdef OPENSSL_SYS_WINDOWS
|
||||
#define strcasecmp _stricmp
|
||||
#else
|
||||
# ifdef NO_STRINGS_H
|
||||
int strcasecmp();
|
||||
# else
|
||||
# include <strings.h>
|
||||
# endif /* NO_STRINGS_H */
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
#define NON_MAIN
|
||||
#include "apps.h"
|
||||
#undef NON_MAIN
|
||||
|
||||
#ifdef OPENSSL_SYS_WINDOWS
|
||||
# include "bss_file.c"
|
||||
#endif
|
||||
@@ -337,7 +331,8 @@ void program_name(char *in, char *out, int size)
|
||||
p++;
|
||||
else
|
||||
p=in;
|
||||
BUF_strlcpy(out,p,size);
|
||||
strncpy(out,p,size-1);
|
||||
out[size-1]='\0';
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -345,7 +340,6 @@ void program_name(char *in, char *out, int size)
|
||||
#ifdef OPENSSL_SYS_WIN32
|
||||
int WIN32_rename(char *from, char *to)
|
||||
{
|
||||
#ifndef OPENSSL_SYS_WINCE
|
||||
/* Windows rename gives an error if 'to' exists, so delete it
|
||||
* first and ignore file not found errror
|
||||
*/
|
||||
@@ -353,46 +347,6 @@ int WIN32_rename(char *from, char *to)
|
||||
return -1;
|
||||
#undef rename
|
||||
return rename(from, to);
|
||||
#else
|
||||
/* convert strings to UNICODE */
|
||||
{
|
||||
BOOL result = FALSE;
|
||||
WCHAR* wfrom;
|
||||
WCHAR* wto;
|
||||
int i;
|
||||
wfrom = malloc((strlen(from)+1)*2);
|
||||
wto = malloc((strlen(to)+1)*2);
|
||||
if (wfrom != NULL && wto != NULL)
|
||||
{
|
||||
for (i=0; i<(int)strlen(from)+1; i++)
|
||||
wfrom[i] = (short)from[i];
|
||||
for (i=0; i<(int)strlen(to)+1; i++)
|
||||
wto[i] = (short)to[i];
|
||||
result = MoveFile(wfrom, wto);
|
||||
}
|
||||
if (wfrom != NULL)
|
||||
free(wfrom);
|
||||
if (wto != NULL)
|
||||
free(wto);
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef OPENSSL_SYS_VMS
|
||||
int VMS_strcasecmp(const char *str1, const char *str2)
|
||||
{
|
||||
while (*str1 && *str2)
|
||||
{
|
||||
int res = toupper(*str1) - toupper(*str2);
|
||||
if (res) return res < 0 ? -1 : 1;
|
||||
}
|
||||
if (*str1)
|
||||
return 1;
|
||||
if (*str2)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -471,20 +425,16 @@ int app_init(long mesgwin)
|
||||
|
||||
int dump_cert_text (BIO *out, X509 *x)
|
||||
{
|
||||
char *p;
|
||||
|
||||
p=X509_NAME_oneline(X509_get_subject_name(x),NULL,0);
|
||||
char buf[256];
|
||||
X509_NAME_oneline(X509_get_subject_name(x),buf,256);
|
||||
BIO_puts(out,"subject=");
|
||||
BIO_puts(out,p);
|
||||
OPENSSL_free(p);
|
||||
BIO_puts(out,buf);
|
||||
|
||||
p=X509_NAME_oneline(X509_get_issuer_name(x),NULL,0);
|
||||
BIO_puts(out,"\nissuer=");
|
||||
BIO_puts(out,p);
|
||||
X509_NAME_oneline(X509_get_issuer_name(x),buf,256);
|
||||
BIO_puts(out,"\nissuer= ");
|
||||
BIO_puts(out,buf);
|
||||
BIO_puts(out,"\n");
|
||||
OPENSSL_free(p);
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ui_open(UI *ui)
|
||||
@@ -615,7 +565,7 @@ int password_callback(char *buf, int bufsiz, int verify,
|
||||
|
||||
if (buff)
|
||||
{
|
||||
OPENSSL_cleanse(buff,(unsigned int)bufsiz);
|
||||
memset(buff,0,(unsigned int)bufsiz);
|
||||
OPENSSL_free(buff);
|
||||
}
|
||||
|
||||
@@ -625,13 +575,13 @@ int password_callback(char *buf, int bufsiz, int verify,
|
||||
{
|
||||
BIO_printf(bio_err, "User interface error\n");
|
||||
ERR_print_errors(bio_err);
|
||||
OPENSSL_cleanse(buf,(unsigned int)bufsiz);
|
||||
memset(buf,0,(unsigned int)bufsiz);
|
||||
res = 0;
|
||||
}
|
||||
if (ok == -2)
|
||||
{
|
||||
BIO_printf(bio_err,"aborted!\n");
|
||||
OPENSSL_cleanse(buf,(unsigned int)bufsiz);
|
||||
memset(buf,0,(unsigned int)bufsiz);
|
||||
res = 0;
|
||||
}
|
||||
UI_free(ui);
|
||||
@@ -844,7 +794,7 @@ end:
|
||||
return(x);
|
||||
}
|
||||
|
||||
EVP_PKEY *load_key(BIO *err, const char *file, int format, int maybe_stdin,
|
||||
EVP_PKEY *load_key(BIO *err, const char *file, int format,
|
||||
const char *pass, ENGINE *e, const char *key_descrip)
|
||||
{
|
||||
BIO *key=NULL;
|
||||
@@ -854,7 +804,7 @@ EVP_PKEY *load_key(BIO *err, const char *file, int format, int maybe_stdin,
|
||||
cb_data.password = pass;
|
||||
cb_data.prompt_info = file;
|
||||
|
||||
if (file == NULL && (!maybe_stdin || format == FORMAT_ENGINE))
|
||||
if (file == NULL)
|
||||
{
|
||||
BIO_printf(err,"no keyfile specified\n");
|
||||
goto end;
|
||||
@@ -874,19 +824,12 @@ EVP_PKEY *load_key(BIO *err, const char *file, int format, int maybe_stdin,
|
||||
ERR_print_errors(err);
|
||||
goto end;
|
||||
}
|
||||
if (file == NULL && maybe_stdin)
|
||||
if (BIO_read_filename(key,file) <= 0)
|
||||
{
|
||||
setvbuf(stdin, NULL, _IONBF, 0);
|
||||
BIO_set_fp(key,stdin,BIO_NOCLOSE);
|
||||
BIO_printf(err, "Error opening %s %s\n", key_descrip, file);
|
||||
ERR_print_errors(err);
|
||||
goto end;
|
||||
}
|
||||
else
|
||||
if (BIO_read_filename(key,file) <= 0)
|
||||
{
|
||||
BIO_printf(err, "Error opening %s %s\n",
|
||||
key_descrip, file);
|
||||
ERR_print_errors(err);
|
||||
goto end;
|
||||
}
|
||||
if (format == FORMAT_ASN1)
|
||||
{
|
||||
pkey=d2i_PrivateKey_bio(key, NULL);
|
||||
@@ -920,7 +863,7 @@ EVP_PKEY *load_key(BIO *err, const char *file, int format, int maybe_stdin,
|
||||
return(pkey);
|
||||
}
|
||||
|
||||
EVP_PKEY *load_pubkey(BIO *err, const char *file, int format, int maybe_stdin,
|
||||
EVP_PKEY *load_pubkey(BIO *err, const char *file, int format,
|
||||
const char *pass, ENGINE *e, const char *key_descrip)
|
||||
{
|
||||
BIO *key=NULL;
|
||||
@@ -930,7 +873,7 @@ EVP_PKEY *load_pubkey(BIO *err, const char *file, int format, int maybe_stdin,
|
||||
cb_data.password = pass;
|
||||
cb_data.prompt_info = file;
|
||||
|
||||
if (file == NULL && (!maybe_stdin || format == FORMAT_ENGINE))
|
||||
if (file == NULL)
|
||||
{
|
||||
BIO_printf(err,"no keyfile specified\n");
|
||||
goto end;
|
||||
@@ -950,18 +893,11 @@ EVP_PKEY *load_pubkey(BIO *err, const char *file, int format, int maybe_stdin,
|
||||
ERR_print_errors(err);
|
||||
goto end;
|
||||
}
|
||||
if (file == NULL && maybe_stdin)
|
||||
if (BIO_read_filename(key,file) <= 0)
|
||||
{
|
||||
setvbuf(stdin, NULL, _IONBF, 0);
|
||||
BIO_set_fp(key,stdin,BIO_NOCLOSE);
|
||||
}
|
||||
else
|
||||
if (BIO_read_filename(key,file) <= 0)
|
||||
{
|
||||
BIO_printf(err, "Error opening %s %s\n",
|
||||
key_descrip, file);
|
||||
ERR_print_errors(err);
|
||||
goto end;
|
||||
BIO_printf(err, "Error opening %s %s\n", key_descrip, file);
|
||||
ERR_print_errors(err);
|
||||
goto end;
|
||||
}
|
||||
if (format == FORMAT_ASN1)
|
||||
{
|
||||
@@ -989,7 +925,7 @@ EVP_PKEY *load_pubkey(BIO *err, const char *file, int format, int maybe_stdin,
|
||||
}
|
||||
|
||||
#if !defined(OPENSSL_NO_RC4) && !defined(OPENSSL_NO_RSA)
|
||||
static EVP_PKEY *
|
||||
EVP_PKEY *
|
||||
load_netscape_key(BIO *err, BIO *key, const char *file,
|
||||
const char *key_descrip, int format)
|
||||
{
|
||||
@@ -1006,7 +942,7 @@ load_netscape_key(BIO *err, BIO *key, const char *file,
|
||||
goto error;
|
||||
for (;;)
|
||||
{
|
||||
if (!BUF_MEM_grow_clean(buf,size+1024*10))
|
||||
if (!BUF_MEM_grow(buf,size+1024*10))
|
||||
goto error;
|
||||
i = BIO_read(key, &(buf->data[size]), 1024*10);
|
||||
size += i;
|
||||
@@ -1134,7 +1070,6 @@ int set_cert_ex(unsigned long *flags, const char *arg)
|
||||
{ "no_extensions", X509_FLAG_NO_EXTENSIONS, 0},
|
||||
{ "no_sigdump", X509_FLAG_NO_SIGDUMP, 0},
|
||||
{ "no_aux", X509_FLAG_NO_AUX, 0},
|
||||
{ "no_attributes", X509_FLAG_NO_ATTRIBUTES, 0},
|
||||
{ "ext_default", X509V3_EXT_DEFAULT, X509V3_EXT_UNKNOWN_MASK},
|
||||
{ "ext_error", X509V3_EXT_ERROR_UNKNOWN, X509V3_EXT_UNKNOWN_MASK},
|
||||
{ "ext_parse", X509V3_EXT_PARSE_UNKNOWN, X509V3_EXT_UNKNOWN_MASK},
|
||||
@@ -1278,20 +1213,18 @@ static int set_table_opts(unsigned long *flags, const char *arg, const NAME_EX_T
|
||||
|
||||
void print_name(BIO *out, char *title, X509_NAME *nm, unsigned long lflags)
|
||||
{
|
||||
char *buf;
|
||||
char buf[256];
|
||||
char mline = 0;
|
||||
int indent = 0;
|
||||
|
||||
if(title) BIO_puts(out, title);
|
||||
if((lflags & XN_FLAG_SEP_MASK) == XN_FLAG_SEP_MULTILINE) {
|
||||
mline = 1;
|
||||
indent = 4;
|
||||
}
|
||||
if(lflags == XN_FLAG_COMPAT) {
|
||||
buf = X509_NAME_oneline(nm, 0, 0);
|
||||
BIO_puts(out, buf);
|
||||
X509_NAME_oneline(nm,buf,256);
|
||||
BIO_puts(out,buf);
|
||||
BIO_puts(out, "\n");
|
||||
OPENSSL_free(buf);
|
||||
} else {
|
||||
if(mline) BIO_puts(out, "\n");
|
||||
X509_NAME_print_ex(out, nm, indent, lflags);
|
||||
@@ -1403,18 +1336,3 @@ int load_config(BIO *err, CONF *cnf)
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
char *make_config_name()
|
||||
{
|
||||
const char *t=X509_get_default_cert_area();
|
||||
char *p;
|
||||
|
||||
p=OPENSSL_malloc(strlen(t)+strlen(OPENSSL_CONF)+2);
|
||||
strcpy(p,t);
|
||||
#ifndef OPENSSL_SYS_VMS
|
||||
strcat(p,"/");
|
||||
#endif
|
||||
strcat(p,OPENSSL_CONF);
|
||||
|
||||
return p;
|
||||
}
|
||||
|
13
apps/apps.h
13
apps/apps.h
@@ -139,21 +139,13 @@ long app_RAND_load_files(char *file); /* `file' is a list of files to read,
|
||||
int WIN32_rename(char *oldname,char *newname);
|
||||
#endif
|
||||
|
||||
/* VMS below version 7.0 doesn't have strcasecmp() */
|
||||
#ifdef OPENSSL_SYS_VMS
|
||||
#define strcasecmp(str1,str2) VMS_strcasecmp((str1),(str2))
|
||||
int VMS_strcasecmp(const char *str1, const char *str2);
|
||||
#endif
|
||||
|
||||
#ifndef MONOLITH
|
||||
|
||||
#define MAIN(a,v) main(a,v)
|
||||
|
||||
#ifndef NON_MAIN
|
||||
CONF *config=NULL;
|
||||
BIO *bio_err=NULL;
|
||||
#else
|
||||
extern CONF *config;
|
||||
extern BIO *bio_err;
|
||||
#endif
|
||||
|
||||
@@ -241,9 +233,9 @@ int app_passwd(BIO *err, char *arg1, char *arg2, char **pass1, char **pass2);
|
||||
int add_oid_section(BIO *err, CONF *conf);
|
||||
X509 *load_cert(BIO *err, const char *file, int format,
|
||||
const char *pass, ENGINE *e, const char *cert_descrip);
|
||||
EVP_PKEY *load_key(BIO *err, const char *file, int format, int maybe_stdin,
|
||||
EVP_PKEY *load_key(BIO *err, const char *file, int format,
|
||||
const char *pass, ENGINE *e, const char *key_descrip);
|
||||
EVP_PKEY *load_pubkey(BIO *err, const char *file, int format, int maybe_stdin,
|
||||
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);
|
||||
@@ -251,7 +243,6 @@ X509_STORE *setup_verify(BIO *bp, char *CAfile, char *CApath);
|
||||
ENGINE *setup_engine(BIO *err, const char *engine, int debug);
|
||||
|
||||
int load_config(BIO *err, CONF *cnf);
|
||||
char *make_config_name(void);
|
||||
|
||||
/* Functions defined in ca.c and also used in ocsp.c */
|
||||
int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold,
|
||||
|
117
apps/asn1pars.c
117
apps/asn1pars.c
@@ -82,8 +82,6 @@
|
||||
|
||||
int MAIN(int, char **);
|
||||
|
||||
static int do_generate(BIO *bio, char *genstr, char *genconf, BUF_MEM *buf);
|
||||
|
||||
int MAIN(int argc, char **argv)
|
||||
{
|
||||
int i,badops=0,offset=0,ret=1,j;
|
||||
@@ -92,7 +90,6 @@ int MAIN(int argc, char **argv)
|
||||
BIO *in=NULL,*out=NULL,*b64=NULL, *derout = NULL;
|
||||
int informat,indent=0, noout = 0, dump = 0;
|
||||
char *infile=NULL,*str=NULL,*prog,*oidfile=NULL, *derfile=NULL;
|
||||
char *genstr=NULL, *genconf=NULL;
|
||||
unsigned char *tmpbuf;
|
||||
BUF_MEM *buf=NULL;
|
||||
STACK *osk=NULL;
|
||||
@@ -170,16 +167,6 @@ int MAIN(int argc, char **argv)
|
||||
if (--argc < 1) goto bad;
|
||||
sk_push(osk,*(++argv));
|
||||
}
|
||||
else if (strcmp(*argv,"-genstr") == 0)
|
||||
{
|
||||
if (--argc < 1) goto bad;
|
||||
genstr= *(++argv);
|
||||
}
|
||||
else if (strcmp(*argv,"-genconf") == 0)
|
||||
{
|
||||
if (--argc < 1) goto bad;
|
||||
genconf= *(++argv);
|
||||
}
|
||||
else
|
||||
{
|
||||
BIO_printf(bio_err,"unknown option %s\n",*argv);
|
||||
@@ -208,8 +195,6 @@ bad:
|
||||
BIO_printf(bio_err," -strparse offset\n");
|
||||
BIO_printf(bio_err," a series of these can be used to 'dig' into multiple\n");
|
||||
BIO_printf(bio_err," ASN1 blob wrappings\n");
|
||||
BIO_printf(bio_err," -genstr str string to generate ASN1 structure from\n");
|
||||
BIO_printf(bio_err," -genconf file file to generate ASN1 structure from\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
@@ -263,39 +248,25 @@ bad:
|
||||
if ((buf=BUF_MEM_new()) == NULL) goto end;
|
||||
if (!BUF_MEM_grow(buf,BUFSIZ*8)) goto end; /* Pre-allocate :-) */
|
||||
|
||||
if (genstr || genconf)
|
||||
if (informat == FORMAT_PEM)
|
||||
{
|
||||
num = do_generate(bio_err, genstr, genconf, buf);
|
||||
if (num < 0)
|
||||
{
|
||||
ERR_print_errors(bio_err);
|
||||
BIO *tmp;
|
||||
|
||||
if ((b64=BIO_new(BIO_f_base64())) == NULL)
|
||||
goto end;
|
||||
}
|
||||
BIO_push(b64,in);
|
||||
tmp=in;
|
||||
in=b64;
|
||||
b64=tmp;
|
||||
}
|
||||
|
||||
else
|
||||
num=0;
|
||||
for (;;)
|
||||
{
|
||||
|
||||
if (informat == FORMAT_PEM)
|
||||
{
|
||||
BIO *tmp;
|
||||
|
||||
if ((b64=BIO_new(BIO_f_base64())) == NULL)
|
||||
goto end;
|
||||
BIO_push(b64,in);
|
||||
tmp=in;
|
||||
in=b64;
|
||||
b64=tmp;
|
||||
}
|
||||
|
||||
num=0;
|
||||
for (;;)
|
||||
{
|
||||
if (!BUF_MEM_grow(buf,(int)num+BUFSIZ)) goto end;
|
||||
i=BIO_read(in,&(buf->data[num]),BUFSIZ);
|
||||
if (i <= 0) break;
|
||||
num+=i;
|
||||
}
|
||||
if (!BUF_MEM_grow(buf,(int)num+BUFSIZ)) goto end;
|
||||
i=BIO_read(in,&(buf->data[num]),BUFSIZ);
|
||||
if (i <= 0) break;
|
||||
num+=i;
|
||||
}
|
||||
str=buf->data;
|
||||
|
||||
@@ -361,64 +332,6 @@ end:
|
||||
if (osk != NULL) sk_free(osk);
|
||||
OBJ_cleanup();
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(ret);
|
||||
EXIT(ret);
|
||||
}
|
||||
|
||||
static int do_generate(BIO *bio, char *genstr, char *genconf, BUF_MEM *buf)
|
||||
{
|
||||
CONF *cnf = NULL;
|
||||
int len;
|
||||
long errline;
|
||||
unsigned char *p;
|
||||
ASN1_TYPE *atyp = NULL;
|
||||
|
||||
if (genconf)
|
||||
{
|
||||
cnf = NCONF_new(NULL);
|
||||
if (!NCONF_load(cnf, genconf, &errline))
|
||||
goto conferr;
|
||||
if (!genstr)
|
||||
genstr = NCONF_get_string(cnf, "default", "asn1");
|
||||
if (!genstr)
|
||||
{
|
||||
BIO_printf(bio, "Can't find 'asn1' in '%s'\n", genconf);
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
||||
atyp = ASN1_generate_nconf(genstr, cnf);
|
||||
NCONF_free(cnf);
|
||||
|
||||
if (!atyp)
|
||||
return -1;
|
||||
|
||||
len = i2d_ASN1_TYPE(atyp, NULL);
|
||||
|
||||
if (len <= 0)
|
||||
goto err;
|
||||
|
||||
if (!BUF_MEM_grow(buf,len))
|
||||
goto err;
|
||||
|
||||
p=(unsigned char *)buf->data;
|
||||
|
||||
i2d_ASN1_TYPE(atyp, &p);
|
||||
|
||||
ASN1_TYPE_free(atyp);
|
||||
return len;
|
||||
|
||||
conferr:
|
||||
|
||||
if (errline > 0)
|
||||
BIO_printf(bio, "Error on line %ld of config file '%s'\n",
|
||||
errline, genconf);
|
||||
else
|
||||
BIO_printf(bio, "Error loading config file '%s'\n", genconf);
|
||||
|
||||
err:
|
||||
NCONF_free(cnf);
|
||||
ASN1_TYPE_free(atyp);
|
||||
|
||||
return -1;
|
||||
|
||||
}
|
||||
|
206
apps/ca.c
206
apps/ca.c
@@ -64,6 +64,7 @@
|
||||
#include <ctype.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "apps.h"
|
||||
#include <openssl/conf.h>
|
||||
#include <openssl/bio.h>
|
||||
#include <openssl/err.h>
|
||||
@@ -79,11 +80,7 @@
|
||||
#ifdef OPENSSL_SYS_WINDOWS
|
||||
#define strcasecmp _stricmp
|
||||
#else
|
||||
# ifdef NO_STRINGS_H
|
||||
int strcasecmp();
|
||||
# else
|
||||
# include <strings.h>
|
||||
# endif /* NO_STRINGS_H */
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
#ifndef W_OK
|
||||
@@ -93,13 +90,11 @@
|
||||
# else
|
||||
# include <unixlib.h>
|
||||
# endif
|
||||
# elif !defined(OPENSSL_SYS_VXWORKS) && !defined(OPENSSL_SYS_WINDOWS)
|
||||
# elif !defined(OPENSSL_SYS_VXWORKS)
|
||||
# include <sys/file.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include "apps.h"
|
||||
|
||||
#ifndef W_OK
|
||||
# define F_OK 0
|
||||
# define X_OK 1
|
||||
@@ -334,7 +329,6 @@ int MAIN(int argc, char **argv)
|
||||
MS_STATIC char buf[3][BSIZE];
|
||||
char *randfile=NULL;
|
||||
char *engine = NULL;
|
||||
char *tofree=NULL;
|
||||
|
||||
#ifdef EFENCE
|
||||
EF_PROTECT_FREE=1;
|
||||
@@ -562,26 +556,25 @@ bad:
|
||||
|
||||
ERR_load_crypto_strings();
|
||||
|
||||
e = setup_engine(bio_err, engine, 0);
|
||||
e = setup_engine(bio_err, engine, 0);
|
||||
|
||||
/*****************************************************************/
|
||||
tofree=NULL;
|
||||
if (configfile == NULL) configfile = getenv("OPENSSL_CONF");
|
||||
if (configfile == NULL) configfile = getenv("SSLEAY_CONF");
|
||||
if (configfile == NULL)
|
||||
{
|
||||
const char *s=X509_get_default_cert_area();
|
||||
|
||||
/* We will just use 'buf[0]' as a temporary buffer. */
|
||||
#ifdef OPENSSL_SYS_VMS
|
||||
tofree=OPENSSL_malloc(strlen(s)+sizeof(CONFIG_FILE));
|
||||
strcpy(tofree,s);
|
||||
strncpy(buf[0],X509_get_default_cert_area(),
|
||||
sizeof(buf[0])-1-sizeof(CONFIG_FILE));
|
||||
#else
|
||||
tofree=OPENSSL_malloc(strlen(s)+sizeof(CONFIG_FILE)+1);
|
||||
strcpy(tofree,s);
|
||||
strcat(tofree,"/");
|
||||
strncpy(buf[0],X509_get_default_cert_area(),
|
||||
sizeof(buf[0])-2-sizeof(CONFIG_FILE));
|
||||
buf[0][sizeof(buf[0])-2-sizeof(CONFIG_FILE)]='\0';
|
||||
strcat(buf[0],"/");
|
||||
#endif
|
||||
strcat(tofree,CONFIG_FILE);
|
||||
configfile=tofree;
|
||||
strcat(buf[0],CONFIG_FILE);
|
||||
configfile=buf[0];
|
||||
}
|
||||
|
||||
BIO_printf(bio_err,"Using configuration from %s\n",configfile);
|
||||
@@ -596,8 +589,6 @@ bad:
|
||||
,errorline,configfile);
|
||||
goto err;
|
||||
}
|
||||
if(tofree)
|
||||
OPENSSL_free(tofree);
|
||||
|
||||
if (!load_config(bio_err, conf))
|
||||
goto err;
|
||||
@@ -704,9 +695,9 @@ bad:
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
pkey = load_key(bio_err, keyfile, keyform, 0, key, e,
|
||||
pkey = load_key(bio_err, keyfile, keyform, key, e,
|
||||
"CA private key");
|
||||
if (key) OPENSSL_cleanse(key,strlen(key));
|
||||
if (key) memset(key,0,strlen(key));
|
||||
if (pkey == NULL)
|
||||
{
|
||||
/* load_key() has already printed an appropriate message */
|
||||
@@ -1163,14 +1154,9 @@ bad:
|
||||
}
|
||||
if (verbose)
|
||||
{
|
||||
if (BN_is_zero(serial))
|
||||
BIO_printf(bio_err,"next serial number is 00\n");
|
||||
else
|
||||
{
|
||||
if ((f=BN_bn2hex(serial)) == NULL) goto err;
|
||||
BIO_printf(bio_err,"next serial number is %s\n",f);
|
||||
OPENSSL_free(f);
|
||||
}
|
||||
if ((f=BN_bn2hex(serial)) == NULL) goto err;
|
||||
BIO_printf(bio_err,"next serial number is %s\n",f);
|
||||
OPENSSL_free(f);
|
||||
}
|
||||
|
||||
if ((attribs=NCONF_get_section(conf,policy)) == NULL)
|
||||
@@ -1290,13 +1276,8 @@ bad:
|
||||
|
||||
BIO_printf(bio_err,"Write out database with %d new entries\n",sk_X509_num(cert_sk));
|
||||
|
||||
if(strlen(serialfile) > BSIZE-5 || strlen(dbfile) > BSIZE-5)
|
||||
{
|
||||
BIO_printf(bio_err,"file name too long\n");
|
||||
goto err;
|
||||
}
|
||||
|
||||
strcpy(buf[0],serialfile);
|
||||
strncpy(buf[0],serialfile,BSIZE-4);
|
||||
buf[0][BSIZE-4]='\0';
|
||||
|
||||
#ifdef OPENSSL_SYS_VMS
|
||||
strcat(buf[0],"-new");
|
||||
@@ -1306,7 +1287,8 @@ bad:
|
||||
|
||||
if (!save_serial(buf[0],serial)) goto err;
|
||||
|
||||
strcpy(buf[1],dbfile);
|
||||
strncpy(buf[1],dbfile,BSIZE-4);
|
||||
buf[1][BSIZE-4]='\0';
|
||||
|
||||
#ifdef OPENSSL_SYS_VMS
|
||||
strcat(buf[1],"-new");
|
||||
@@ -1336,13 +1318,8 @@ bad:
|
||||
j=x->cert_info->serialNumber->length;
|
||||
p=(char *)x->cert_info->serialNumber->data;
|
||||
|
||||
if(strlen(outdir) >= (size_t)(j ? BSIZE-j*2-6 : BSIZE-8))
|
||||
{
|
||||
BIO_printf(bio_err,"certificate file name too long\n");
|
||||
goto err;
|
||||
}
|
||||
|
||||
strcpy(buf[2],outdir);
|
||||
strncpy(buf[2],outdir,BSIZE-(j*2)-6);
|
||||
buf[2][BSIZE-(j*2)-6]='\0';
|
||||
|
||||
#ifndef OPENSSL_SYS_VMS
|
||||
strcat(buf[2],"/");
|
||||
@@ -1473,13 +1450,13 @@ bad:
|
||||
}
|
||||
if ((crldays == 0) && (crlhours == 0))
|
||||
{
|
||||
BIO_printf(bio_err,"cannot lookup how long until the next CRL is issued\n");
|
||||
BIO_printf(bio_err,"cannot lookup how long until the next CRL is issuer\n");
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (verbose) BIO_printf(bio_err,"making CRL\n");
|
||||
if ((crl=X509_CRL_new()) == NULL) goto err;
|
||||
if (!X509_CRL_set_issuer_name(crl, X509_get_subject_name(x509))) goto err;
|
||||
if (!X509_CRL_set_issuer_name(crl, X509_get_issuer_name(x509))) goto err;
|
||||
|
||||
tmptm = ASN1_TIME_new();
|
||||
if (!tmptm) goto err;
|
||||
@@ -1532,11 +1509,6 @@ bad:
|
||||
if (pkey->type == EVP_PKEY_DSA)
|
||||
dgst=EVP_dss1();
|
||||
else
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ECDSA
|
||||
if (pkey->type == EVP_PKEY_EC)
|
||||
dgst=EVP_ecdsa();
|
||||
else
|
||||
#endif
|
||||
dgst=EVP_md5();
|
||||
}
|
||||
@@ -1581,13 +1553,8 @@ bad:
|
||||
if (j <= 0) goto err;
|
||||
X509_free(revcert);
|
||||
|
||||
if(strlen(dbfile) > BSIZE-5)
|
||||
{
|
||||
BIO_printf(bio_err,"filename too long\n");
|
||||
goto err;
|
||||
}
|
||||
|
||||
strcpy(buf[0],dbfile);
|
||||
strncpy(buf[0],dbfile,BSIZE-4);
|
||||
buf[0][BSIZE-4]='\0';
|
||||
#ifndef OPENSSL_SYS_VMS
|
||||
strcat(buf[0],".new");
|
||||
#else
|
||||
@@ -1601,6 +1568,10 @@ bad:
|
||||
}
|
||||
j=TXT_DB_write(out,db);
|
||||
if (j <= 0) goto err;
|
||||
BIO_free_all(out);
|
||||
out = NULL;
|
||||
BIO_free_all(in);
|
||||
in = NULL;
|
||||
strncpy(buf[1],dbfile,BSIZE-4);
|
||||
buf[1][BSIZE-4]='\0';
|
||||
#ifndef OPENSSL_SYS_VMS
|
||||
@@ -1608,10 +1579,6 @@ bad:
|
||||
#else
|
||||
strcat(buf[1],"-old");
|
||||
#endif
|
||||
BIO_free(in);
|
||||
in = NULL;
|
||||
BIO_free(out);
|
||||
out = NULL;
|
||||
if (rename(dbfile,buf[1]) < 0)
|
||||
{
|
||||
BIO_printf(bio_err,"unable to rename %s to %s\n", dbfile, buf[1]);
|
||||
@@ -1631,8 +1598,6 @@ bad:
|
||||
/*****************************************************************/
|
||||
ret=0;
|
||||
err:
|
||||
if(tofree)
|
||||
OPENSSL_free(tofree);
|
||||
BIO_free_all(Cout);
|
||||
BIO_free_all(Sout);
|
||||
BIO_free_all(out);
|
||||
@@ -1652,7 +1617,7 @@ err:
|
||||
NCONF_free(conf);
|
||||
OBJ_cleanup();
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(ret);
|
||||
EXIT(ret);
|
||||
}
|
||||
|
||||
static void lookup_fail(char *name, char *tag)
|
||||
@@ -1717,7 +1682,7 @@ static BIGNUM *load_serial(char *serialfile)
|
||||
ret=ASN1_INTEGER_to_BN(ai,NULL);
|
||||
if (ret == NULL)
|
||||
{
|
||||
BIO_printf(bio_err,"error converting number from bin to BIGNUM\n");
|
||||
BIO_printf(bio_err,"error converting number from bin to BIGNUM");
|
||||
goto err;
|
||||
}
|
||||
err:
|
||||
@@ -2120,11 +2085,9 @@ again2:
|
||||
}
|
||||
}
|
||||
|
||||
if (BN_is_zero(serial))
|
||||
row[DB_serial]=BUF_strdup("00");
|
||||
else
|
||||
row[DB_serial]=BN_bn2hex(serial);
|
||||
if (row[DB_serial] == NULL)
|
||||
row[DB_name]=X509_NAME_oneline(dn_subject,NULL,0);
|
||||
row[DB_serial]=BN_bn2hex(serial);
|
||||
if ((row[DB_name] == NULL) || (row[DB_serial] == NULL))
|
||||
{
|
||||
BIO_printf(bio_err,"Memory allocation failure\n");
|
||||
goto err;
|
||||
@@ -2321,16 +2284,6 @@ again2:
|
||||
EVP_PKEY_copy_parameters(pktmp,pkey);
|
||||
EVP_PKEY_free(pktmp);
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ECDSA
|
||||
if (pkey->type == EVP_PKEY_EC)
|
||||
dgst = EVP_ecdsa();
|
||||
pktmp = X509_get_pubkey(ret);
|
||||
if (EVP_PKEY_missing_parameters(pktmp) &&
|
||||
!EVP_PKEY_missing_parameters(pkey))
|
||||
EVP_PKEY_copy_parameters(pktmp, pkey);
|
||||
EVP_PKEY_free(pktmp);
|
||||
#endif
|
||||
|
||||
|
||||
if (!X509_sign(ret,pkey,dgst))
|
||||
goto err;
|
||||
@@ -2347,10 +2300,10 @@ again2:
|
||||
|
||||
/* row[DB_serial] done already */
|
||||
row[DB_file]=(char *)OPENSSL_malloc(8);
|
||||
row[DB_name]=X509_NAME_oneline(X509_get_subject_name(ret),NULL,0);
|
||||
/* row[DB_name] done already */
|
||||
|
||||
if ((row[DB_type] == NULL) || (row[DB_exp_date] == NULL) ||
|
||||
(row[DB_file] == NULL) || (row[DB_name] == NULL))
|
||||
(row[DB_file] == NULL))
|
||||
{
|
||||
BIO_printf(bio_err,"Memory allocation failure\n");
|
||||
goto err;
|
||||
@@ -2617,10 +2570,7 @@ static int do_revoke(X509 *x509, TXT_DB *db, int type, char *value)
|
||||
row[i]=NULL;
|
||||
row[DB_name]=X509_NAME_oneline(X509_get_subject_name(x509),NULL,0);
|
||||
bn = ASN1_INTEGER_to_BN(X509_get_serialNumber(x509),NULL);
|
||||
if (BN_is_zero(bn))
|
||||
row[DB_serial]=BUF_strdup("00");
|
||||
else
|
||||
row[DB_serial]=BN_bn2hex(bn);
|
||||
row[DB_serial]=BN_bn2hex(bn);
|
||||
BN_free(bn);
|
||||
if ((row[DB_name] == NULL) || (row[DB_serial] == NULL))
|
||||
{
|
||||
@@ -3076,72 +3026,68 @@ X509_NAME *do_subject(char *subject, long chtype)
|
||||
int nid;
|
||||
|
||||
if (!buf || !ne_types || !ne_values)
|
||||
{
|
||||
{
|
||||
BIO_printf(bio_err, "malloc error\n");
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
if (*subject != '/')
|
||||
{
|
||||
{
|
||||
BIO_printf(bio_err, "Subject does not start with '/'.\n");
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
sp++; /* skip leading / */
|
||||
|
||||
while (*sp)
|
||||
{
|
||||
{
|
||||
/* collect type */
|
||||
ne_types[ne_num] = bp;
|
||||
while (*sp)
|
||||
{
|
||||
{
|
||||
if (*sp == '\\') /* is there anything to escape in the type...? */
|
||||
{
|
||||
if (*++sp)
|
||||
*bp++ = *sp++;
|
||||
else
|
||||
{
|
||||
BIO_printf(bio_err, "escape character at end of string\n");
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
else if (*sp == '=')
|
||||
{
|
||||
sp++;
|
||||
*bp++ = '\0';
|
||||
break;
|
||||
}
|
||||
else
|
||||
*bp++ = *sp++;
|
||||
}
|
||||
if (!*sp)
|
||||
{
|
||||
BIO_printf(bio_err, "end of string encountered while processing type of subject name element #%d\n", ne_num);
|
||||
goto error;
|
||||
}
|
||||
ne_values[ne_num] = bp;
|
||||
while (*sp)
|
||||
{
|
||||
if (*sp == '\\')
|
||||
{
|
||||
if (*++sp)
|
||||
*bp++ = *sp++;
|
||||
else
|
||||
{
|
||||
{
|
||||
BIO_printf(bio_err, "escape character at end of string\n");
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
else if (*sp == '/')
|
||||
{
|
||||
else if (*sp == '=')
|
||||
{
|
||||
sp++;
|
||||
*bp++ = '\0';
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
*bp++ = *sp++;
|
||||
}
|
||||
if (!*sp)
|
||||
{
|
||||
BIO_printf(bio_err, "end of string encountered while processing type of subject name element #%d\n", ne_num);
|
||||
goto error;
|
||||
}
|
||||
ne_values[ne_num] = bp;
|
||||
while (*sp)
|
||||
{
|
||||
if (*sp == '\\')
|
||||
if (*++sp)
|
||||
*bp++ = *sp++;
|
||||
else
|
||||
{
|
||||
BIO_printf(bio_err, "escape character at end of string\n");
|
||||
goto error;
|
||||
}
|
||||
else if (*sp == '/')
|
||||
{
|
||||
sp++;
|
||||
break;
|
||||
}
|
||||
else
|
||||
*bp++ = *sp++;
|
||||
}
|
||||
*bp++ = '\0';
|
||||
ne_num++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(n = X509_NAME_new()))
|
||||
goto error;
|
||||
|
@@ -187,7 +187,7 @@ int MAIN(int argc, char **argv)
|
||||
{
|
||||
BIO_puts(STDout,SSL_CIPHER_description(
|
||||
sk_SSL_CIPHER_value(sk,i),
|
||||
buf,sizeof buf));
|
||||
buf,512));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,6 +203,6 @@ end:
|
||||
if (ssl != NULL) SSL_free(ssl);
|
||||
if (STDout != NULL) BIO_free_all(STDout);
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(ret);
|
||||
EXIT(ret);
|
||||
}
|
||||
|
||||
|
@@ -377,7 +377,7 @@ end:
|
||||
X509_STORE_free(store);
|
||||
}
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(ret);
|
||||
EXIT(ret);
|
||||
}
|
||||
|
||||
static X509_CRL *load_crl(char *infile, int format)
|
||||
|
@@ -280,7 +280,7 @@ end:
|
||||
if (crl != NULL) X509_CRL_free(crl);
|
||||
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(ret);
|
||||
EXIT(ret);
|
||||
}
|
||||
|
||||
/*
|
||||
|
10
apps/dgst.c
10
apps/dgst.c
@@ -117,7 +117,7 @@ int MAIN(int argc, char **argv)
|
||||
goto end;
|
||||
|
||||
/* first check the program name */
|
||||
program_name(argv[0],pname,sizeof pname);
|
||||
program_name(argv[0],pname,PROG_NAME_SIZE);
|
||||
|
||||
md=EVP_get_digestbyname(pname);
|
||||
|
||||
@@ -277,10 +277,10 @@ int MAIN(int argc, char **argv)
|
||||
if(keyfile)
|
||||
{
|
||||
if (want_pub)
|
||||
sigkey = load_pubkey(bio_err, keyfile, keyform, 0, NULL,
|
||||
sigkey = load_pubkey(bio_err, keyfile, keyform, NULL,
|
||||
e, "key file");
|
||||
else
|
||||
sigkey = load_key(bio_err, keyfile, keyform, 0, NULL,
|
||||
sigkey = load_key(bio_err, keyfile, keyform, NULL,
|
||||
e, "key file");
|
||||
if (!sigkey)
|
||||
{
|
||||
@@ -356,7 +356,7 @@ int MAIN(int argc, char **argv)
|
||||
end:
|
||||
if (buf != NULL)
|
||||
{
|
||||
OPENSSL_cleanse(buf,BUFSIZE);
|
||||
memset(buf,0,BUFSIZE);
|
||||
OPENSSL_free(buf);
|
||||
}
|
||||
if (in != NULL) BIO_free(in);
|
||||
@@ -365,7 +365,7 @@ end:
|
||||
if(sigbuf) OPENSSL_free(sigbuf);
|
||||
if (bmd != NULL) BIO_free(bmd);
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(err);
|
||||
EXIT(err);
|
||||
}
|
||||
|
||||
int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout,
|
||||
|
@@ -333,6 +333,6 @@ end:
|
||||
if (out != NULL) BIO_free_all(out);
|
||||
if (dh != NULL) DH_free(dh);
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(ret);
|
||||
EXIT(ret);
|
||||
}
|
||||
#endif
|
||||
|
@@ -519,7 +519,7 @@ end:
|
||||
if (out != NULL) BIO_free_all(out);
|
||||
if (dh != NULL) DH_free(dh);
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(ret);
|
||||
EXIT(ret);
|
||||
}
|
||||
|
||||
/* dh_cb is identical to dsa_cb in apps/dsaparam.c */
|
||||
|
@@ -314,6 +314,6 @@ end:
|
||||
if(passin) OPENSSL_free(passin);
|
||||
if(passout) OPENSSL_free(passout);
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(ret);
|
||||
EXIT(ret);
|
||||
}
|
||||
#endif
|
||||
|
@@ -372,7 +372,7 @@ end:
|
||||
if (out != NULL) BIO_free_all(out);
|
||||
if (dsa != NULL) DSA_free(dsa);
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(ret);
|
||||
EXIT(ret);
|
||||
}
|
||||
|
||||
static void MS_CALLBACK dsa_cb(int p, int n, void *arg)
|
||||
|
395
apps/ec.c
395
apps/ec.c
@@ -1,395 +0,0 @@
|
||||
/* apps/ec.c */
|
||||
/*
|
||||
* Written by Nils Larsch for the OpenSSL project.
|
||||
*/
|
||||
/* ====================================================================
|
||||
* 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).
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef OPENSSL_NO_EC
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "apps.h"
|
||||
#include <openssl/bio.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/pem.h>
|
||||
|
||||
#undef PROG
|
||||
#define PROG ec_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
|
||||
* -text - print a text version
|
||||
* -param_out - print the elliptic curve parameters
|
||||
* -conv_form arg - specifies the point encoding form
|
||||
* -param_enc arg - specifies the parameter encoding
|
||||
*/
|
||||
|
||||
int MAIN(int, char **);
|
||||
|
||||
int MAIN(int argc, char **argv)
|
||||
{
|
||||
ENGINE *e = NULL;
|
||||
int ret = 1;
|
||||
EC_KEY *eckey = 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, param_out = 0;
|
||||
char *infile, *outfile, *prog, *engine;
|
||||
char *passargin = NULL, *passargout = NULL;
|
||||
char *passin = NULL, *passout = NULL;
|
||||
point_conversion_form_t form = POINT_CONVERSION_UNCOMPRESSED;
|
||||
int new_form = 0;
|
||||
int asn1_flag = OPENSSL_EC_NAMED_CURVE;
|
||||
int new_asn1_flag = 0;
|
||||
|
||||
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, "-conv_form") == 0)
|
||||
{
|
||||
if (--argc < 1)
|
||||
goto bad;
|
||||
++argv;
|
||||
new_form = 1;
|
||||
if (strcmp(*argv, "compressed") == 0)
|
||||
form = POINT_CONVERSION_COMPRESSED;
|
||||
else if (strcmp(*argv, "uncompressed") == 0)
|
||||
form = POINT_CONVERSION_UNCOMPRESSED;
|
||||
else if (strcmp(*argv, "hybrid") == 0)
|
||||
form = POINT_CONVERSION_HYBRID;
|
||||
else
|
||||
goto bad;
|
||||
}
|
||||
else if (strcmp(*argv, "-param_enc") == 0)
|
||||
{
|
||||
if (--argc < 1)
|
||||
goto bad;
|
||||
++argv;
|
||||
new_asn1_flag = 1;
|
||||
if (strcmp(*argv, "named_curve") == 0)
|
||||
asn1_flag = OPENSSL_EC_NAMED_CURVE;
|
||||
else if (strcmp(*argv, "explicit") == 0)
|
||||
asn1_flag = 0;
|
||||
else
|
||||
goto bad;
|
||||
}
|
||||
else if (strcmp(*argv, "-param_out") == 0)
|
||||
param_out = 1;
|
||||
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, "
|
||||
"instead of 'des' every other \n"
|
||||
" cipher "
|
||||
"supported by OpenSSL can be used\n");
|
||||
BIO_printf(bio_err, " -text print the key\n");
|
||||
BIO_printf(bio_err, " -noout don't print key out\n");
|
||||
BIO_printf(bio_err, " -param_out print the elliptic "
|
||||
"curve parameters\n");
|
||||
BIO_printf(bio_err, " -conv_form arg specifies the "
|
||||
"point conversion form \n");
|
||||
BIO_printf(bio_err, " possible values:"
|
||||
" compressed\n");
|
||||
BIO_printf(bio_err, " "
|
||||
" uncompressed (default)\n");
|
||||
BIO_printf(bio_err, " "
|
||||
" hybrid\n");
|
||||
BIO_printf(bio_err, " -param_enc arg specifies the way"
|
||||
" the ec parameters are encoded\n");
|
||||
BIO_printf(bio_err, " in the asn1 der "
|
||||
"encoding\n");
|
||||
BIO_printf(bio_err, " possilbe values:"
|
||||
" named_curve (default)\n");
|
||||
BIO_printf(bio_err," "
|
||||
"explicit\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 EC key\n");
|
||||
if (informat == FORMAT_ASN1)
|
||||
{
|
||||
if (pubin)
|
||||
eckey = d2i_EC_PUBKEY_bio(in, NULL);
|
||||
else
|
||||
eckey = d2i_ECPrivateKey_bio(in, NULL);
|
||||
}
|
||||
else if (informat == FORMAT_PEM)
|
||||
{
|
||||
if (pubin)
|
||||
eckey = PEM_read_bio_EC_PUBKEY(in, NULL, NULL,
|
||||
NULL);
|
||||
else
|
||||
eckey = PEM_read_bio_ECPrivateKey(in, NULL, NULL,
|
||||
passin);
|
||||
}
|
||||
else
|
||||
{
|
||||
BIO_printf(bio_err, "bad input format specified for key\n");
|
||||
goto end;
|
||||
}
|
||||
if (eckey == 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 (new_form)
|
||||
{
|
||||
EC_GROUP_set_point_conversion_form(eckey->group, form);
|
||||
eckey->conv_form = form;
|
||||
}
|
||||
|
||||
if (new_asn1_flag)
|
||||
EC_GROUP_set_asn1_flag(eckey->group, asn1_flag);
|
||||
|
||||
if (text)
|
||||
if (!EC_KEY_print(out, eckey, 0))
|
||||
{
|
||||
perror(outfile);
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (noout)
|
||||
goto end;
|
||||
|
||||
BIO_printf(bio_err, "writing EC key\n");
|
||||
if (outformat == FORMAT_ASN1)
|
||||
{
|
||||
if (param_out)
|
||||
i = i2d_ECPKParameters_bio(out, eckey->group);
|
||||
else if (pubin || pubout)
|
||||
i = i2d_EC_PUBKEY_bio(out, eckey);
|
||||
else
|
||||
i = i2d_ECPrivateKey_bio(out, eckey);
|
||||
}
|
||||
else if (outformat == FORMAT_PEM)
|
||||
{
|
||||
if (param_out)
|
||||
i = PEM_write_bio_ECPKParameters(out, eckey->group);
|
||||
else if (pubin || pubout)
|
||||
i = PEM_write_bio_EC_PUBKEY(out, eckey);
|
||||
else
|
||||
i = PEM_write_bio_ECPrivateKey(out, eckey, 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 (eckey)
|
||||
EC_KEY_free(eckey);
|
||||
if (passin)
|
||||
OPENSSL_free(passin);
|
||||
if (passout)
|
||||
OPENSSL_free(passout);
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(ret);
|
||||
}
|
||||
#endif
|
709
apps/ecparam.c
709
apps/ecparam.c
@@ -1,709 +0,0 @@
|
||||
/* apps/ecparam.c */
|
||||
/*
|
||||
* Written by Nils Larsch for the OpenSSL project.
|
||||
*/
|
||||
/* ====================================================================
|
||||
* 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 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
|
||||
*
|
||||
* Portions of the attached software ("Contribution") are developed by
|
||||
* SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project.
|
||||
*
|
||||
* The Contribution is licensed pursuant to the OpenSSL open source
|
||||
* license provided above.
|
||||
*
|
||||
* The elliptic curve binary polynomial software is originally written by
|
||||
* Sheueling Chang Shantz and Douglas Stebila of Sun Microsystems Laboratories.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENSSL_NO_EC
|
||||
#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/x509.h>
|
||||
#include <openssl/pem.h>
|
||||
|
||||
#undef PROG
|
||||
#define PROG ecparam_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 - do not print the ec parameter
|
||||
* -text - print the ec parameters in text form
|
||||
* -check - validate the ec parameters
|
||||
* -C - print a 'C' function creating the parameters
|
||||
* -name arg - use the ec parameters with 'short name' name
|
||||
* -list_curves - prints a list of all currently available curve 'short names'
|
||||
* -conv_form arg - specifies the point conversion form
|
||||
* - possible values: compressed
|
||||
* uncompressed (default)
|
||||
* hybrid
|
||||
* -param_enc arg - specifies the way the ec parameters are encoded
|
||||
* in the asn1 der encoding
|
||||
* possible values: named_curve (default)
|
||||
* explicit
|
||||
* -no_seed - if 'explicit' parameters are choosen do not use the seed
|
||||
* -genkey - generate ec key
|
||||
* -rand file - files to use for random number input
|
||||
* -engine e - use engine e, possibly a hardware device
|
||||
*/
|
||||
|
||||
|
||||
static int ecparam_print_var(BIO *,BIGNUM *,const char *,int,unsigned char *);
|
||||
|
||||
int MAIN(int, char **);
|
||||
|
||||
int MAIN(int argc, char **argv)
|
||||
{
|
||||
EC_GROUP *group = NULL;
|
||||
point_conversion_form_t form = POINT_CONVERSION_UNCOMPRESSED;
|
||||
int new_form = 0;
|
||||
int asn1_flag = OPENSSL_EC_NAMED_CURVE;
|
||||
int new_asn1_flag = 0;
|
||||
char *curve_name = NULL, *inrand = NULL;
|
||||
int list_curves = 0, no_seed = 0, check = 0,
|
||||
badops = 0, text = 0, i, need_rand = 0, genkey = 0;
|
||||
char *infile = NULL, *outfile = NULL, *prog;
|
||||
BIO *in = NULL, *out = NULL;
|
||||
int informat, outformat, noout = 0, C = 0, ret = 1;
|
||||
ENGINE *e = NULL;
|
||||
char *engine = NULL;
|
||||
|
||||
BIGNUM *ec_p = NULL, *ec_a = NULL, *ec_b = NULL,
|
||||
*ec_gen = NULL, *ec_order = NULL, *ec_cofactor = NULL;
|
||||
unsigned char *buffer = 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;
|
||||
|
||||
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,"-text") == 0)
|
||||
text = 1;
|
||||
else if (strcmp(*argv,"-C") == 0)
|
||||
C = 1;
|
||||
else if (strcmp(*argv,"-check") == 0)
|
||||
check = 1;
|
||||
else if (strcmp (*argv, "-name") == 0)
|
||||
{
|
||||
if (--argc < 1)
|
||||
goto bad;
|
||||
curve_name = *(++argv);
|
||||
}
|
||||
else if (strcmp(*argv, "-list_curves") == 0)
|
||||
list_curves = 1;
|
||||
else if (strcmp(*argv, "-conv_form") == 0)
|
||||
{
|
||||
if (--argc < 1)
|
||||
goto bad;
|
||||
++argv;
|
||||
new_form = 1;
|
||||
if (strcmp(*argv, "compressed") == 0)
|
||||
form = POINT_CONVERSION_COMPRESSED;
|
||||
else if (strcmp(*argv, "uncompressed") == 0)
|
||||
form = POINT_CONVERSION_UNCOMPRESSED;
|
||||
else if (strcmp(*argv, "hybrid") == 0)
|
||||
form = POINT_CONVERSION_HYBRID;
|
||||
else
|
||||
goto bad;
|
||||
}
|
||||
else if (strcmp(*argv, "-param_enc") == 0)
|
||||
{
|
||||
if (--argc < 1)
|
||||
goto bad;
|
||||
++argv;
|
||||
new_asn1_flag = 1;
|
||||
if (strcmp(*argv, "named_curve") == 0)
|
||||
asn1_flag = OPENSSL_EC_NAMED_CURVE;
|
||||
else if (strcmp(*argv, "explicit") == 0)
|
||||
asn1_flag = 0;
|
||||
else
|
||||
goto bad;
|
||||
}
|
||||
else if (strcmp(*argv, "-no_seed") == 0)
|
||||
no_seed = 1;
|
||||
else if (strcmp(*argv, "-noout") == 0)
|
||||
noout=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, "-engine") == 0)
|
||||
{
|
||||
if (--argc < 1) goto bad;
|
||||
engine = *(++argv);
|
||||
}
|
||||
else
|
||||
{
|
||||
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 - "
|
||||
"default PEM (DER or PEM)\n");
|
||||
BIO_printf(bio_err, " -outform arg output format - "
|
||||
"default PEM\n");
|
||||
BIO_printf(bio_err, " -in arg input file - "
|
||||
"default stdin\n");
|
||||
BIO_printf(bio_err, " -out arg output file - "
|
||||
"default stdout\n");
|
||||
BIO_printf(bio_err, " -noout do not print the "
|
||||
"ec parameter\n");
|
||||
BIO_printf(bio_err, " -text print the ec "
|
||||
"parameters in text form\n");
|
||||
BIO_printf(bio_err, " -check validate the ec "
|
||||
"parameters\n");
|
||||
BIO_printf(bio_err, " -C print a 'C' "
|
||||
"function creating the parameters\n");
|
||||
BIO_printf(bio_err, " -name arg use the "
|
||||
"ec parameters with 'short name' name\n");
|
||||
BIO_printf(bio_err, " -list_curves prints a list of "
|
||||
"all currently available curve 'short names'\n");
|
||||
BIO_printf(bio_err, " -conv_form arg specifies the "
|
||||
"point conversion form \n");
|
||||
BIO_printf(bio_err, " possible values:"
|
||||
" compressed\n");
|
||||
BIO_printf(bio_err, " "
|
||||
" uncompressed (default)\n");
|
||||
BIO_printf(bio_err, " "
|
||||
" hybrid\n");
|
||||
BIO_printf(bio_err, " -param_enc arg specifies the way"
|
||||
" the ec parameters are encoded\n");
|
||||
BIO_printf(bio_err, " in the asn1 der "
|
||||
"encoding\n");
|
||||
BIO_printf(bio_err, " possible values:"
|
||||
" named_curve (default)\n");
|
||||
BIO_printf(bio_err, " "
|
||||
" explicit\n");
|
||||
BIO_printf(bio_err, " -no_seed if 'explicit'"
|
||||
" parameters are choosen do not"
|
||||
" use the seed\n");
|
||||
BIO_printf(bio_err, " -genkey generate ec"
|
||||
" key\n");
|
||||
BIO_printf(bio_err, " -rand file files to use for"
|
||||
" random number input\n");
|
||||
BIO_printf(bio_err, " -engine e use engine e, "
|
||||
"possibly a hardware device\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 (list_curves)
|
||||
{
|
||||
EC_builtin_curve *curves = NULL;
|
||||
size_t crv_len = 0;
|
||||
size_t n = 0;
|
||||
size_t len;
|
||||
|
||||
crv_len = EC_get_builtin_curves(NULL, 0);
|
||||
|
||||
curves = OPENSSL_malloc(sizeof(EC_builtin_curve) * crv_len);
|
||||
|
||||
if (curves == NULL)
|
||||
goto end;
|
||||
|
||||
if (!EC_get_builtin_curves(curves, crv_len))
|
||||
{
|
||||
OPENSSL_free(curves);
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
||||
for (n = 0; n < crv_len; n++)
|
||||
{
|
||||
const char *comment;
|
||||
const char *sname;
|
||||
comment = curves[n].comment;
|
||||
sname = OBJ_nid2sn(curves[n].nid);
|
||||
if (comment == NULL)
|
||||
comment = "CURVE DESCRIPTION NOT AVAILABLE";
|
||||
if (sname == NULL)
|
||||
sname = "";
|
||||
|
||||
len = BIO_printf(out, " %-10s: ", sname);
|
||||
if (len + strlen(comment) > 80)
|
||||
BIO_printf(out, "\n%80s\n", comment);
|
||||
else
|
||||
BIO_printf(out, "%s\n", comment);
|
||||
}
|
||||
|
||||
OPENSSL_free(curves);
|
||||
ret = 0;
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (curve_name != NULL)
|
||||
{
|
||||
int nid = OBJ_sn2nid(curve_name);
|
||||
|
||||
if (nid == 0)
|
||||
{
|
||||
BIO_printf(bio_err, "unknown curve name (%s)\n",
|
||||
curve_name);
|
||||
goto end;
|
||||
}
|
||||
|
||||
group = EC_GROUP_new_by_nid(nid);
|
||||
if (group == NULL)
|
||||
{
|
||||
BIO_printf(bio_err, "unable to create curve (%s)\n",
|
||||
curve_name);
|
||||
goto end;
|
||||
}
|
||||
EC_GROUP_set_asn1_flag(group, asn1_flag);
|
||||
EC_GROUP_set_point_conversion_form(group, form);
|
||||
}
|
||||
else if (informat == FORMAT_ASN1)
|
||||
{
|
||||
group = d2i_ECPKParameters_bio(in, NULL);
|
||||
}
|
||||
else if (informat == FORMAT_PEM)
|
||||
{
|
||||
group = PEM_read_bio_ECPKParameters(in,NULL,NULL,NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
BIO_printf(bio_err, "bad input format specified\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (group == NULL)
|
||||
{
|
||||
BIO_printf(bio_err,
|
||||
"unable to load elliptic curve parameters\n");
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (new_form)
|
||||
EC_GROUP_set_point_conversion_form(group, form);
|
||||
|
||||
if (new_asn1_flag)
|
||||
EC_GROUP_set_asn1_flag(group, asn1_flag);
|
||||
|
||||
if (no_seed)
|
||||
{
|
||||
EC_GROUP_set_seed(group, NULL, 0);
|
||||
}
|
||||
|
||||
if (text)
|
||||
{
|
||||
if (!ECPKParameters_print(out, group, 0))
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (check)
|
||||
{
|
||||
if (group == NULL)
|
||||
BIO_printf(bio_err, "no elliptic curve parameters\n");
|
||||
BIO_printf(bio_err, "checking elliptic curve parameters: ");
|
||||
if (!EC_GROUP_check(group, NULL))
|
||||
{
|
||||
BIO_printf(bio_err, "failed\n");
|
||||
ERR_print_errors(bio_err);
|
||||
}
|
||||
else
|
||||
BIO_printf(bio_err, "ok\n");
|
||||
|
||||
}
|
||||
|
||||
if (C)
|
||||
{
|
||||
size_t buf_len = 0, tmp_len = 0;
|
||||
const EC_POINT *point;
|
||||
int is_prime, len = 0;
|
||||
const EC_METHOD *meth = EC_GROUP_method_of(group);
|
||||
|
||||
if ((ec_p = BN_new()) == NULL || (ec_a = BN_new()) == NULL ||
|
||||
(ec_b = BN_new()) == NULL || (ec_gen = BN_new()) == NULL ||
|
||||
(ec_order = BN_new()) == NULL ||
|
||||
(ec_cofactor = BN_new()) == NULL )
|
||||
{
|
||||
perror("OPENSSL_malloc");
|
||||
goto end;
|
||||
}
|
||||
|
||||
is_prime = (EC_METHOD_get_field_type(meth) ==
|
||||
NID_X9_62_prime_field);
|
||||
|
||||
if (is_prime)
|
||||
{
|
||||
if (!EC_GROUP_get_curve_GFp(group, ec_p, ec_a,
|
||||
ec_b, NULL))
|
||||
goto end;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* TODO */
|
||||
goto end;
|
||||
}
|
||||
|
||||
if ((point = EC_GROUP_get0_generator(group)) == NULL)
|
||||
goto end;
|
||||
if (!EC_POINT_point2bn(group, point,
|
||||
EC_GROUP_get_point_conversion_form(group), ec_gen,
|
||||
NULL))
|
||||
goto end;
|
||||
if (!EC_GROUP_get_order(group, ec_order, NULL))
|
||||
goto end;
|
||||
if (!EC_GROUP_get_cofactor(group, ec_cofactor, NULL))
|
||||
goto end;
|
||||
|
||||
if (!ec_p || !ec_a || !ec_b || !ec_gen ||
|
||||
!ec_order || !ec_cofactor)
|
||||
goto end;
|
||||
|
||||
len = BN_num_bits(ec_order);
|
||||
|
||||
if ((tmp_len = (size_t)BN_num_bytes(ec_p)) > buf_len)
|
||||
buf_len = tmp_len;
|
||||
if ((tmp_len = (size_t)BN_num_bytes(ec_a)) > buf_len)
|
||||
buf_len = tmp_len;
|
||||
if ((tmp_len = (size_t)BN_num_bytes(ec_b)) > buf_len)
|
||||
buf_len = tmp_len;
|
||||
if ((tmp_len = (size_t)BN_num_bytes(ec_gen)) > buf_len)
|
||||
buf_len = tmp_len;
|
||||
if ((tmp_len = (size_t)BN_num_bytes(ec_order)) > buf_len)
|
||||
buf_len = tmp_len;
|
||||
if ((tmp_len = (size_t)BN_num_bytes(ec_cofactor)) > buf_len)
|
||||
buf_len = tmp_len;
|
||||
|
||||
buffer = (unsigned char *)OPENSSL_malloc(buf_len);
|
||||
|
||||
if (buffer == NULL)
|
||||
{
|
||||
perror("OPENSSL_malloc");
|
||||
goto end;
|
||||
}
|
||||
|
||||
ecparam_print_var(out, ec_p, "ec_p", len, buffer);
|
||||
ecparam_print_var(out, ec_a, "ec_a", len, buffer);
|
||||
ecparam_print_var(out, ec_b, "ec_b", len, buffer);
|
||||
ecparam_print_var(out, ec_gen, "ec_gen", len, buffer);
|
||||
ecparam_print_var(out, ec_order, "ec_order", len, buffer);
|
||||
ecparam_print_var(out, ec_cofactor, "ec_cofactor", len,
|
||||
buffer);
|
||||
|
||||
BIO_printf(out, "\n\n");
|
||||
|
||||
BIO_printf(out, "EC_GROUP *get_ec_group_%d(void)\n\t{\n", len);
|
||||
BIO_printf(out, "\tint ok=0;\n");
|
||||
BIO_printf(out, "\tEC_GROUP *group = NULL;\n");
|
||||
BIO_printf(out, "\tEC_POINT *point = NULL;\n");
|
||||
BIO_printf(out, "\tBIGNUM *tmp_1 = NULL, *tmp_2 = NULL, "
|
||||
"*tmp_3 = NULL;\n\n");
|
||||
BIO_printf(out, "\tif ((tmp_1 = BN_bin2bn(ec_p_%d, "
|
||||
"sizeof(ec_p_%d), NULL)) == NULL)\n\t\t"
|
||||
"goto err;\n", len, len);
|
||||
BIO_printf(out, "\tif ((tmp_2 = BN_bin2bn(ec_a_%d, "
|
||||
"sizeof(ec_a_%d), NULL)) == NULL)\n\t\t"
|
||||
"goto err;\n", len, len);
|
||||
BIO_printf(out, "\tif ((tmp_3 = BN_bin2bn(ec_b_%d, "
|
||||
"sizeof(ec_b_%d), NULL)) == NULL)\n\t\t"
|
||||
"goto err;\n", len, len);
|
||||
if (is_prime)
|
||||
{
|
||||
BIO_printf(out, "\tif ((group = EC_GROUP_new_curve_"
|
||||
"GFp(tmp_1, tmp_2, tmp_3, NULL)) == NULL)"
|
||||
"\n\t\tgoto err;\n\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
/* TODO */
|
||||
goto end;
|
||||
}
|
||||
BIO_printf(out, "\t/* build generator */\n");
|
||||
BIO_printf(out, "\tif ((tmp_1 = BN_bin2bn(ec_gen_%d, "
|
||||
"sizeof(ec_gen_%d), tmp_1)) == NULL)"
|
||||
"\n\t\tgoto err;\n", len, len);
|
||||
BIO_printf(out, "\tpoint = EC_POINT_bn2point(group, tmp_1, "
|
||||
"NULL, NULL);\n");
|
||||
BIO_printf(out, "\tif (point == NULL)\n\t\tgoto err;\n");
|
||||
BIO_printf(out, "\tif ((tmp_2 = BN_bin2bn(ec_order_%d, "
|
||||
"sizeof(ec_order_%d), tmp_2)) == NULL)"
|
||||
"\n\t\tgoto err;\n", len, len);
|
||||
BIO_printf(out, "\tif ((tmp_3 = BN_bin2bn(ec_cofactor_%d, "
|
||||
"sizeof(ec_cofactor_%d), tmp_3)) == NULL)"
|
||||
"\n\t\tgoto err;\n", len, len);
|
||||
BIO_printf(out, "\tif (!EC_GROUP_set_generator(group, point,"
|
||||
" tmp_2, tmp_3))\n\t\tgoto err;\n");
|
||||
BIO_printf(out, "\n\tok=1;\n");
|
||||
BIO_printf(out, "err:\n");
|
||||
BIO_printf(out, "\tif (tmp_1)\n\t\tBN_free(tmp_1);\n");
|
||||
BIO_printf(out, "\tif (tmp_2)\n\t\tBN_free(tmp_2);\n");
|
||||
BIO_printf(out, "\tif (tmp_3)\n\t\tBN_free(tmp_3);\n");
|
||||
BIO_printf(out, "\tif (point)\n\t\tEC_POINT_free(point);\n");
|
||||
BIO_printf(out, "\tif (!ok)\n");
|
||||
BIO_printf(out, "\t\t{\n");
|
||||
BIO_printf(out, "\t\tEC_GROUP_free(group);\n");
|
||||
BIO_printf(out, "\t\tgroup = NULL;\n");
|
||||
BIO_printf(out, "\t\t}\n");
|
||||
BIO_printf(out, "\treturn(group);\n\t}\n");
|
||||
}
|
||||
|
||||
if (!noout)
|
||||
{
|
||||
if (outformat == FORMAT_ASN1)
|
||||
i = i2d_ECPKParameters_bio(out, group);
|
||||
else if (outformat == FORMAT_PEM)
|
||||
i = PEM_write_bio_ECPKParameters(out, group);
|
||||
else
|
||||
{
|
||||
BIO_printf(bio_err,"bad output format specified for"
|
||||
" outfile\n");
|
||||
goto end;
|
||||
}
|
||||
if (!i)
|
||||
{
|
||||
BIO_printf(bio_err, "unable to write elliptic "
|
||||
"curve parameters\n");
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
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 (genkey)
|
||||
{
|
||||
EC_KEY *eckey = EC_KEY_new();
|
||||
|
||||
if (eckey == NULL)
|
||||
goto end;
|
||||
|
||||
assert(need_rand);
|
||||
|
||||
eckey->group = group;
|
||||
|
||||
if (!EC_KEY_generate_key(eckey))
|
||||
{
|
||||
eckey->group = NULL;
|
||||
EC_KEY_free(eckey);
|
||||
goto end;
|
||||
}
|
||||
if (outformat == FORMAT_ASN1)
|
||||
i = i2d_ECPrivateKey_bio(out, eckey);
|
||||
else if (outformat == FORMAT_PEM)
|
||||
i = PEM_write_bio_ECPrivateKey(out, eckey, NULL,
|
||||
NULL, 0, NULL, NULL);
|
||||
else
|
||||
{
|
||||
BIO_printf(bio_err, "bad output format specified "
|
||||
"for outfile\n");
|
||||
eckey->group = NULL;
|
||||
EC_KEY_free(eckey);
|
||||
goto end;
|
||||
}
|
||||
eckey->group = NULL;
|
||||
EC_KEY_free(eckey);
|
||||
}
|
||||
|
||||
if (need_rand)
|
||||
app_RAND_write_file(NULL, bio_err);
|
||||
|
||||
ret=0;
|
||||
end:
|
||||
if (ec_p)
|
||||
BN_free(ec_p);
|
||||
if (ec_a)
|
||||
BN_free(ec_a);
|
||||
if (ec_b)
|
||||
BN_free(ec_b);
|
||||
if (ec_gen)
|
||||
BN_free(ec_gen);
|
||||
if (ec_order)
|
||||
BN_free(ec_order);
|
||||
if (ec_cofactor)
|
||||
BN_free(ec_cofactor);
|
||||
if (buffer)
|
||||
OPENSSL_free(buffer);
|
||||
if (in != NULL)
|
||||
BIO_free(in);
|
||||
if (out != NULL)
|
||||
BIO_free_all(out);
|
||||
if (group != NULL)
|
||||
EC_GROUP_free(group);
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(ret);
|
||||
}
|
||||
|
||||
int ecparam_print_var(BIO *out, BIGNUM *in, const char *var,
|
||||
int len, unsigned char *buffer)
|
||||
{
|
||||
BIO_printf(out, "static unsigned char %s_%d[] = {", var, len);
|
||||
if (BN_is_zero(in))
|
||||
BIO_printf(out, "\n\t0x00");
|
||||
else
|
||||
{
|
||||
int i, l;
|
||||
|
||||
l = BN_bn2bin(in, buffer);
|
||||
for (i=0; i<l-1; i++)
|
||||
{
|
||||
if ((i%12) == 0)
|
||||
BIO_printf(out, "\n\t");
|
||||
BIO_printf(out, "0x%02X,", buffer[i]);
|
||||
}
|
||||
if ((i%12) == 0)
|
||||
BIO_printf(out, "\n\t");
|
||||
BIO_printf(out, "0x%02X", buffer[i]);
|
||||
}
|
||||
BIO_printf(out, "\n\t};\n\n");
|
||||
return 1;
|
||||
}
|
||||
#endif
|
22
apps/enc.c
22
apps/enc.c
@@ -102,7 +102,7 @@ int MAIN(int argc, char **argv)
|
||||
{
|
||||
ENGINE *e = NULL;
|
||||
static const char magic[]="Salted__";
|
||||
char mbuf[sizeof magic-1];
|
||||
char mbuf[8]; /* should be 1 smaller than magic */
|
||||
char *strbuf=NULL;
|
||||
unsigned char *buff=NULL,*bufsize=NULL;
|
||||
int bsize=BSIZE,verbose=0;
|
||||
@@ -131,7 +131,7 @@ int MAIN(int argc, char **argv)
|
||||
goto end;
|
||||
|
||||
/* first check the program name */
|
||||
program_name(argv[0],pname,sizeof pname);
|
||||
program_name(argv[0],pname,PROG_NAME_SIZE);
|
||||
if (strcmp(pname,"base64") == 0)
|
||||
base64=1;
|
||||
|
||||
@@ -216,7 +216,7 @@ int MAIN(int argc, char **argv)
|
||||
goto bad;
|
||||
}
|
||||
buf[0]='\0';
|
||||
fgets(buf,sizeof buf,infile);
|
||||
fgets(buf,128,infile);
|
||||
fclose(infile);
|
||||
i=strlen(buf);
|
||||
if ((i > 0) &&
|
||||
@@ -442,12 +442,12 @@ bad:
|
||||
else {
|
||||
if(enc) {
|
||||
if(hsalt) {
|
||||
if(!set_hex(hsalt,salt,sizeof salt)) {
|
||||
if(!set_hex(hsalt,salt,PKCS5_SALT_LEN)) {
|
||||
BIO_printf(bio_err,
|
||||
"invalid hex salt value\n");
|
||||
goto end;
|
||||
}
|
||||
} else if (RAND_pseudo_bytes(salt, sizeof salt) < 0)
|
||||
} else if (RAND_pseudo_bytes(salt, PKCS5_SALT_LEN) < 0)
|
||||
goto end;
|
||||
/* If -P option then don't bother writing */
|
||||
if((printkey != 2)
|
||||
@@ -455,14 +455,14 @@ bad:
|
||||
sizeof magic-1) != sizeof magic-1
|
||||
|| BIO_write(wbio,
|
||||
(char *)salt,
|
||||
sizeof salt) != sizeof salt)) {
|
||||
PKCS5_SALT_LEN) != PKCS5_SALT_LEN)) {
|
||||
BIO_printf(bio_err,"error writing output file\n");
|
||||
goto end;
|
||||
}
|
||||
} else if(BIO_read(rbio,mbuf,sizeof mbuf) != sizeof mbuf
|
||||
|| BIO_read(rbio,
|
||||
(unsigned char *)salt,
|
||||
sizeof salt) != sizeof salt) {
|
||||
PKCS5_SALT_LEN) != PKCS5_SALT_LEN) {
|
||||
BIO_printf(bio_err,"error reading input file\n");
|
||||
goto end;
|
||||
} else if(memcmp(mbuf,magic,sizeof magic-1)) {
|
||||
@@ -481,9 +481,9 @@ bad:
|
||||
* bug picked up by
|
||||
* Larry J. Hughes Jr. <hughes@indiana.edu> */
|
||||
if (str == strbuf)
|
||||
OPENSSL_cleanse(str,SIZE);
|
||||
memset(str,0,SIZE);
|
||||
else
|
||||
OPENSSL_cleanse(str,strlen(str));
|
||||
memset(str,0,strlen(str));
|
||||
}
|
||||
if ((hiv != NULL) && !set_hex(hiv,iv,sizeof iv))
|
||||
{
|
||||
@@ -524,7 +524,7 @@ bad:
|
||||
if (!nosalt)
|
||||
{
|
||||
printf("salt=");
|
||||
for (i=0; i<sizeof salt; i++)
|
||||
for (i=0; i<PKCS5_SALT_LEN; i++)
|
||||
printf("%02X",salt[i]);
|
||||
printf("\n");
|
||||
}
|
||||
@@ -586,7 +586,7 @@ end:
|
||||
if (b64 != NULL) BIO_free(b64);
|
||||
if(pass) OPENSSL_free(pass);
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(ret);
|
||||
EXIT(ret);
|
||||
}
|
||||
|
||||
int set_hex(char *in, unsigned char *out, int size)
|
||||
|
@@ -516,5 +516,5 @@ end:
|
||||
sk_pop_free(post_cmds, identity);
|
||||
if (bio_out != NULL) BIO_free_all(bio_out);
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(ret);
|
||||
EXIT(ret);
|
||||
}
|
||||
|
@@ -122,5 +122,5 @@ int MAIN(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(ret);
|
||||
EXIT(ret);
|
||||
}
|
||||
|
@@ -198,7 +198,7 @@ end:
|
||||
if (out != NULL) BIO_free_all(out);
|
||||
if (dh != NULL) DH_free(dh);
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(ret);
|
||||
EXIT(ret);
|
||||
}
|
||||
|
||||
static void MS_CALLBACK dh_cb(int p, int n, void *arg)
|
||||
|
@@ -246,6 +246,6 @@ end:
|
||||
if (dsa != NULL) DSA_free(dsa);
|
||||
if(passout) OPENSSL_free(passout);
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(ret);
|
||||
EXIT(ret);
|
||||
}
|
||||
#endif
|
||||
|
@@ -258,7 +258,7 @@ err:
|
||||
if (ret != 0)
|
||||
ERR_print_errors(bio_err);
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(ret);
|
||||
EXIT(ret);
|
||||
}
|
||||
|
||||
static void MS_CALLBACK genrsa_cb(int p, int n, void *arg)
|
||||
|
@@ -15,10 +15,22 @@ $!
|
||||
$! It was written so it would try to determine what "C" compiler to
|
||||
$! use or you can specify which "C" compiler to use.
|
||||
$!
|
||||
$! Specify DEBUG or NODEBUG as P1 to compile with or without debugger
|
||||
$! Specify RSAREF as P1 to compile with the RSAREF library instead of
|
||||
$! the regular one. If you specify NORSAREF it will compile with the
|
||||
$! regular RSAREF routines. (Note: If you are in the United States
|
||||
$! you MUST compile with RSAREF unless you have a license from RSA).
|
||||
$!
|
||||
$! Note: The RSAREF libraries are NOT INCLUDED and you have to
|
||||
$! download it from "ftp://ftp.rsa.com/rsaref". You have to
|
||||
$! get the ".tar-Z" file as the ".zip" file dosen't have the
|
||||
$! directory structure stored. You have to extract the file
|
||||
$! into the [.RSAREF] directory under the root directory as that
|
||||
$! is where the scripts will look for the files.
|
||||
$!
|
||||
$! Specify DEBUG or NODEBUG as P2 to compile with or without debugger
|
||||
$! information.
|
||||
$!
|
||||
$! Specify which compiler at P2 to try to compile under.
|
||||
$! Specify which compiler at P3 to try to compile under.
|
||||
$!
|
||||
$! VAXC For VAX C.
|
||||
$! DECC For DEC C.
|
||||
@@ -27,16 +39,16 @@ $!
|
||||
$! If you don't speficy a compiler, it will try to determine which
|
||||
$! "C" compiler to use.
|
||||
$!
|
||||
$! P3, if defined, sets a TCP/IP library to use, through one of the following
|
||||
$! P4, if defined, sets a TCP/IP library to use, through one of the following
|
||||
$! keywords:
|
||||
$!
|
||||
$! UCX for UCX
|
||||
$! SOCKETSHR for SOCKETSHR+NETLIB
|
||||
$! TCPIP for TCPIP (post UCX)
|
||||
$!
|
||||
$! P4, if defined, sets a compiler thread NOT needed on OpenVMS 7.1 (and up)
|
||||
$! P5, if defined, sets a compiler thread NOT needed on OpenVMS 7.1 (and up)
|
||||
$!
|
||||
$! P5, if defined, sets a choice of programs to compile.
|
||||
$! P6, if defined, sets a choice of programs to compile.
|
||||
$!
|
||||
$!
|
||||
$! Define A TCP/IP Library That We Will Need To Link To.
|
||||
@@ -89,6 +101,10 @@ $! Define The CRYPTO Library.
|
||||
$!
|
||||
$ CRYPTO_LIB := SYS$DISK:[-.'ARCH'.EXE.CRYPTO]LIBCRYPTO.OLB
|
||||
$!
|
||||
$! Define The RSAREF Library.
|
||||
$!
|
||||
$ RSAREF_LIB := SYS$DISK:[-.'ARCH'.EXE.RSAREF]LIBRSAGLUE.OLB
|
||||
$!
|
||||
$! Define The SSL Library.
|
||||
$!
|
||||
$ SSL_LIB := SYS$DISK:[-.'ARCH'.EXE.SSL]LIBSSL.OLB
|
||||
@@ -139,13 +155,13 @@ $! Define The Application Files.
|
||||
$!
|
||||
$ LIB_FILES = "VERIFY;ASN1PARS;REQ;DGST;DH;DHPARAM;ENC;PASSWD;GENDH;ERRSTR;"+-
|
||||
"CA;PKCS7;CRL2P7;CRL;"+-
|
||||
"RSA;RSAUTL;DSA;DSAPARAM;EC;ECPARAM;"+-
|
||||
"RSA;RSAUTL;DSA;DSAPARAM;"+-
|
||||
"X509;GENRSA;GENDSA;S_SERVER;S_CLIENT;SPEED;"+-
|
||||
"S_TIME;APPS;S_CB;S_SOCKET;APP_RAND;VERSION;SESS_ID;"+-
|
||||
"CIPHERS;NSEQ;PKCS12;PKCS8;SPKAC;SMIME;RAND;ENGINE;OCSP"
|
||||
$ APP_FILES := OPENSSL,'OBJ_DIR'VERIFY.OBJ,ASN1PARS.OBJ,REQ.OBJ,DGST.OBJ,DH.OBJ,DHPARAM.OBJ,ENC.OBJ,PASSWD.OBJ,GENDH.OBJ,ERRSTR.OBJ,-
|
||||
CA.OBJ,PKCS7.OBJ,CRL2P7.OBJ,CRL.OBJ,-
|
||||
RSA.OBJ,RSAUTL.OBJ,DSA.OBJ,DSAPARAM.OBJ,EC.OBJ,ECPARAM.OBJ,-
|
||||
RSA.OBJ,RSAUTL.OBJ,DSA.OBJ,DSAPARAM.OBJ,-
|
||||
X509.OBJ,GENRSA.OBJ,GENDSA.OBJ,S_SERVER.OBJ,S_CLIENT.OBJ,SPEED.OBJ,-
|
||||
S_TIME.OBJ,APPS.OBJ,S_CB.OBJ,S_SOCKET.OBJ,APP_RAND.OBJ,VERSION.OBJ,SESS_ID.OBJ,-
|
||||
CIPHERS.OBJ,NSEQ.OBJ,PKCS12.OBJ,PKCS8.OBJ,SPKAC.OBJ,SMIME.OBJ,RAND.OBJ,ENGINE.OBJ,OCSP.OBJ
|
||||
@@ -277,31 +293,73 @@ $ WRITE SYS$OUTPUT FILE_NAME," needs a TCP/IP library. Can't link. Skipping.
|
||||
$ GOTO NEXT_FILE
|
||||
$ ENDIF
|
||||
$!
|
||||
$! Link The Program.
|
||||
$! Check To See If We Are To Link With A Specific TCP/IP Library.
|
||||
$! Link The Program, Check To See If We Need To Link With RSAREF Or Not.
|
||||
$!
|
||||
$ IF (TCPIP_LIB.NES."")
|
||||
$ IF (RSAREF.EQS."TRUE")
|
||||
$ THEN
|
||||
$!
|
||||
$! Don't Link With The RSAREF Routines And TCP/IP Library.
|
||||
$! Check To See If We Are To Link With A Specific TCP/IP Library.
|
||||
$!
|
||||
$ LINK/'DEBUGGER'/'TRACEBACK' /EXE='EXE_FILE' -
|
||||
'OBJECT_FILE''EXTRA_OBJ', -
|
||||
'SSL_LIB'/LIBRARY,'CRYPTO_LIB'/LIBRARY, -
|
||||
'TCPIP_LIB','OPT_FILE'/OPTION
|
||||
$ IF (TCPIP_LIB.NES."")
|
||||
$ THEN
|
||||
$!
|
||||
$! Link With The RSAREF Library And A Specific TCP/IP Library.
|
||||
$!
|
||||
$ LINK/'DEBUGGER'/'TRACEBACK' /EXE='EXE_FILE' -
|
||||
'OBJECT_FILE''EXTRA_OBJ', -
|
||||
'SSL_LIB'/LIBRARY,'CRYPTO_LIB'/LIBRARY,'RSAREF_LIB'/LIBRARY, -
|
||||
'TCPIP_LIB','OPT_FILE'/OPTION
|
||||
$!
|
||||
$! Else...
|
||||
$!
|
||||
$ ELSE
|
||||
$!
|
||||
$! Link With The RSAREF Library And NO TCP/IP Library.
|
||||
$!
|
||||
$ LINK/'DEBUGGER'/'TRACEBACK' /EXE='EXE_FILE' -
|
||||
'OBJECT_FILE''EXTRA_OBJ', -
|
||||
'SSL_LIB'/LIBRARY,'CRYPTO_LIB'/LIBRARY,'RSAREF_LIB'/LIBRARY, -
|
||||
'OPT_FILE'/OPTION
|
||||
$!
|
||||
$! End The TCP/IP Library Check.
|
||||
$!
|
||||
$ ENDIF
|
||||
$!
|
||||
$! Else...
|
||||
$!
|
||||
$ ELSE
|
||||
$!
|
||||
$! Don't Link With The RSAREF Routines And Link With A TCP/IP Library.
|
||||
$! Don't Link With The RSAREF Routines.
|
||||
$!
|
||||
$ LINK/'DEBUGGER'/'TRACEBACK' /EXE='EXE_FILE' -
|
||||
'OBJECT_FILE''EXTRA_OBJ', -
|
||||
'SSL_LIB'/LIBRARY,'CRYPTO_LIB'/LIBRARY, -
|
||||
'OPT_FILE'/OPTION
|
||||
$!
|
||||
$! End The TCP/IP Library Check.
|
||||
$! Check To See If We Are To Link With A Specific TCP/IP Library.
|
||||
$!
|
||||
$ IF (TCPIP_LIB.NES."")
|
||||
$ THEN
|
||||
$!
|
||||
$! Don't Link With The RSAREF Routines And TCP/IP Library.
|
||||
$!
|
||||
$ LINK/'DEBUGGER'/'TRACEBACK' /EXE='EXE_FILE' -
|
||||
'OBJECT_FILE''EXTRA_OBJ', -
|
||||
'SSL_LIB'/LIBRARY,'CRYPTO_LIB'/LIBRARY, -
|
||||
'TCPIP_LIB','OPT_FILE'/OPTION
|
||||
$!
|
||||
$! Else...
|
||||
$!
|
||||
$ ELSE
|
||||
$!
|
||||
$! Don't Link With The RSAREF Routines And Link With A TCP/IP Library.
|
||||
$!
|
||||
$ LINK/'DEBUGGER'/'TRACEBACK' /EXE='EXE_FILE' -
|
||||
'OBJECT_FILE''EXTRA_OBJ', -
|
||||
'SSL_LIB'/LIBRARY,'CRYPTO_LIB'/LIBRARY, -
|
||||
'OPT_FILE'/OPTION
|
||||
$!
|
||||
$! End The TCP/IP Library Check.
|
||||
$!
|
||||
$ ENDIF
|
||||
$!
|
||||
$! End The RSAREF Link Check.
|
||||
$!
|
||||
$ ENDIF
|
||||
$!
|
||||
@@ -468,6 +526,32 @@ $! End The Crypto Library Check.
|
||||
$!
|
||||
$ ENDIF
|
||||
$!
|
||||
$! See If We Need The RSAREF Library.
|
||||
$!
|
||||
$ IF (RSAREF.EQS."TRUE")
|
||||
$ THEN
|
||||
$!
|
||||
$! Look For The Library LIBRSAGLUE.OLB.
|
||||
$!
|
||||
$ IF (F$SEARCH(RSAREF_LIB).EQS."")
|
||||
$ THEN
|
||||
$!
|
||||
$! Tell The User We Can't Find The LIBRSAGLUE.OLB Library.
|
||||
$!
|
||||
$ WRITE SYS$OUTPUT ""
|
||||
$ WRITE SYS$OUTPUT "Can't Find The Library ",RSAREF_LIB,"."
|
||||
$ WRITE SYS$OUTPUT "We Can't Link Without It."
|
||||
$ WRITE SYS$OUTPUT ""
|
||||
$!
|
||||
$! Since We Can't Link Without It, Exit.
|
||||
$!
|
||||
$ EXIT
|
||||
$ ENDIF
|
||||
$!
|
||||
$! End The RSAREF Library Check.
|
||||
$!
|
||||
$ ENDIF
|
||||
$!
|
||||
$! Look For The Library LIBSSL.OLB.
|
||||
$!
|
||||
$ IF (F$SEARCH(SSL_LIB).EQS."")
|
||||
@@ -498,10 +582,87 @@ $ CHECK_OPTIONS:
|
||||
$!
|
||||
$! Check To See If P1 Is Blank.
|
||||
$!
|
||||
$ IF (P1.EQS."NODEBUG")
|
||||
$ P1 = "NORSAREF"
|
||||
$ IF (P1.EQS."NORSAREF")
|
||||
$ THEN
|
||||
$!
|
||||
$! P1 Is NODEBUG, So Compile Without Debugger Information.
|
||||
$! P1 Is NORSAREF, So Compile With The Regular RSA Libraries.
|
||||
$!
|
||||
$ RSAREF = "FALSE"
|
||||
$!
|
||||
$! Else...
|
||||
$!
|
||||
$ ELSE
|
||||
$!
|
||||
$! Check To See If We Are To Use The RSAREF Library.
|
||||
$!
|
||||
$ IF (P1.EQS."RSAREF")
|
||||
$ THEN
|
||||
$!
|
||||
$! Check To Make Sure We Have The RSAREF Source Code Directory.
|
||||
$!
|
||||
$ IF (F$SEARCH("SYS$DISK:[-.RSAREF]SOURCE.DIR").EQS."")
|
||||
$ THEN
|
||||
$!
|
||||
$! We Don't Have The RSAREF Souce Code Directory, So Tell The
|
||||
$! User This.
|
||||
$!
|
||||
$ WRITE SYS$OUTPUT ""
|
||||
$ WRITE SYS$OUTPUT "It appears that you don't have the RSAREF Souce Code."
|
||||
$ WRITE SYS$OUTPUT "You need to go to 'ftp://ftp.rsa.com/rsaref'. You have to"
|
||||
$ WRITE SYS$OUTPUT "get the '.tar-Z' file as the '.zip' file dosen't have the"
|
||||
$ WRITE SYS$OUTPUT "directory structure stored. You have to extract the file"
|
||||
$ WRITE SYS$OUTPUT "into the [.RSAREF] directory under the root directory"
|
||||
$ WRITE SYS$OUTPUT "as that is where the scripts will look for the files."
|
||||
$ WRITE SYS$OUTPUT ""
|
||||
$!
|
||||
$! Time To Exit.
|
||||
$!
|
||||
$ EXIT
|
||||
$!
|
||||
$! Else...
|
||||
$!
|
||||
$ ELSE
|
||||
$!
|
||||
$! Compile Using The RSAREF Library.
|
||||
$!
|
||||
$ RSAREF = "TRUE"
|
||||
$!
|
||||
$! End The RSAREF Soure Directory Check.
|
||||
$!
|
||||
$ ENDIF
|
||||
$!
|
||||
$! Else...
|
||||
$!
|
||||
$ ELSE
|
||||
$!
|
||||
$! They Entered An Invalid Option..
|
||||
$!
|
||||
$ WRITE SYS$OUTPUT ""
|
||||
$ WRITE SYS$OUTPUT "The Option ",P1," Is Invalid. The Valid Options Are:"
|
||||
$ WRITE SYS$OUTPUT ""
|
||||
$ WRITE SYS$OUTPUT " RSAREF : Compile With The RSAREF Library."
|
||||
$ WRITE SYS$OUTPUT " NORSAREF : Compile With The Regular RSA Library."
|
||||
$ WRITE SYS$OUTPUT ""
|
||||
$!
|
||||
$! Time To EXIT.
|
||||
$!
|
||||
$ EXIT
|
||||
$!
|
||||
$! End The Valid Arguement Check.
|
||||
$!
|
||||
$ ENDIF
|
||||
$!
|
||||
$! End P1 Check.
|
||||
$!
|
||||
$ ENDIF
|
||||
$!
|
||||
$! Check To See If P2 Is Blank.
|
||||
$!
|
||||
$ IF (P2.EQS."NODEBUG")
|
||||
$ THEN
|
||||
$!
|
||||
$! P2 Is NODEBUG, So Compile Without Debugger Information.
|
||||
$!
|
||||
$ DEBUGGER = "NODEBUG"
|
||||
$ TRACEBACK = "NOTRACEBACK"
|
||||
@@ -516,7 +677,7 @@ $ ELSE
|
||||
$!
|
||||
$! Check To See If We Are To Compile With Debugger Information.
|
||||
$!
|
||||
$ IF (P1.EQS."DEBUG")
|
||||
$ IF (P2.EQS."DEBUG")
|
||||
$ THEN
|
||||
$!
|
||||
$! Compile With Debugger Information.
|
||||
@@ -532,7 +693,7 @@ $!
|
||||
$! Tell The User Entered An Invalid Option..
|
||||
$!
|
||||
$ WRITE SYS$OUTPUT ""
|
||||
$ WRITE SYS$OUTPUT "The Option ",P1," Is Invalid. The Valid Options Are:"
|
||||
$ WRITE SYS$OUTPUT "The Option ",P2," Is Invalid. The Valid Options Are:"
|
||||
$ WRITE SYS$OUTPUT ""
|
||||
$ WRITE SYS$OUTPUT " DEBUG : Compile With The Debugger Information."
|
||||
$ WRITE SYS$OUTPUT " NODEBUG : Compile Without The Debugger Information."
|
||||
@@ -546,13 +707,13 @@ $! End The Valid Arguement Check.
|
||||
$!
|
||||
$ ENDIF
|
||||
$!
|
||||
$! End The P1 Check.
|
||||
$! End The P2 Check.
|
||||
$!
|
||||
$ ENDIF
|
||||
$!
|
||||
$! Check To See If P2 Is Blank.
|
||||
$! Check To See If P3 Is Blank.
|
||||
$!
|
||||
$ IF (P2.EQS."")
|
||||
$ IF (P3.EQS."")
|
||||
$ THEN
|
||||
$!
|
||||
$! O.K., The User Didn't Specify A Compiler, Let's Try To
|
||||
@@ -565,7 +726,7 @@ $ THEN
|
||||
$!
|
||||
$! Looks Like GNUC, Set To Use GNUC.
|
||||
$!
|
||||
$ P2 = "GNUC"
|
||||
$ P3 = "GNUC"
|
||||
$!
|
||||
$! Else...
|
||||
$!
|
||||
@@ -578,7 +739,7 @@ $ THEN
|
||||
$!
|
||||
$! Looks Like DECC, Set To Use DECC.
|
||||
$!
|
||||
$ P2 = "DECC"
|
||||
$ P3 = "DECC"
|
||||
$!
|
||||
$! Else...
|
||||
$!
|
||||
@@ -586,7 +747,7 @@ $ ELSE
|
||||
$!
|
||||
$! Looks Like VAXC, Set To Use VAXC.
|
||||
$!
|
||||
$ P2 = "VAXC"
|
||||
$ P3 = "VAXC"
|
||||
$!
|
||||
$! End The VAXC Compiler Check.
|
||||
$!
|
||||
@@ -600,9 +761,9 @@ $! End The Compiler Check.
|
||||
$!
|
||||
$ ENDIF
|
||||
$!
|
||||
$! Check To See If We Have A Option For P3.
|
||||
$! Check To See If We Have A Option For P4.
|
||||
$!
|
||||
$ IF (P3.EQS."")
|
||||
$ IF (P4.EQS."")
|
||||
$ THEN
|
||||
$!
|
||||
$! Find out what socket library we have available
|
||||
@@ -612,7 +773,7 @@ $ THEN
|
||||
$!
|
||||
$! We have SOCKETSHR, and it is my opinion that it's the best to use.
|
||||
$!
|
||||
$ P3 = "SOCKETSHR"
|
||||
$ P4 = "SOCKETSHR"
|
||||
$!
|
||||
$! Tell the user
|
||||
$!
|
||||
@@ -632,7 +793,7 @@ $ THEN
|
||||
$!
|
||||
$! Last resort: a UCX or UCX-compatible library
|
||||
$!
|
||||
$ P3 = "UCX"
|
||||
$ P4 = "UCX"
|
||||
$!
|
||||
$! Tell the user
|
||||
$!
|
||||
@@ -656,12 +817,12 @@ $ IF F$TYPE(USER_CCDISABLEWARNINGS) .NES. "" THEN -
|
||||
$!
|
||||
$! Check To See If The User Entered A Valid Paramter.
|
||||
$!
|
||||
$ IF (P2.EQS."VAXC").OR.(P2.EQS."DECC").OR.(P2.EQS."GNUC")
|
||||
$ IF (P3.EQS."VAXC").OR.(P3.EQS."DECC").OR.(P3.EQS."GNUC")
|
||||
$ THEN
|
||||
$!
|
||||
$! Check To See If The User Wanted DECC.
|
||||
$!
|
||||
$ IF (P2.EQS."DECC")
|
||||
$ IF (P3.EQS."DECC")
|
||||
$ THEN
|
||||
$!
|
||||
$! Looks Like DECC, Set To Use DECC.
|
||||
@@ -691,7 +852,7 @@ $ ENDIF
|
||||
$!
|
||||
$! Check To See If We Are To Use VAXC.
|
||||
$!
|
||||
$ IF (P2.EQS."VAXC")
|
||||
$ IF (P3.EQS."VAXC")
|
||||
$ THEN
|
||||
$!
|
||||
$! Looks Like VAXC, Set To Use VAXC.
|
||||
@@ -728,7 +889,7 @@ $ ENDIF
|
||||
$!
|
||||
$! Check To See If We Are To Use GNU C.
|
||||
$!
|
||||
$ IF (P2.EQS."GNUC")
|
||||
$ IF (P3.EQS."GNUC")
|
||||
$ THEN
|
||||
$!
|
||||
$! Looks Like GNUC, Set To Use GNUC.
|
||||
@@ -757,6 +918,31 @@ $! Set up default defines
|
||||
$!
|
||||
$ CCDEFS = """FLAT_INC=1""," + CCDEFS
|
||||
$!
|
||||
$! Check To See If We Are To Compile With RSAREF Routines.
|
||||
$!
|
||||
$ IF (RSAREF.EQS."TRUE")
|
||||
$ THEN
|
||||
$!
|
||||
$! Compile With RSAREF.
|
||||
$!
|
||||
$ CCDEFS = CCDEFS + ",""RSAref=1"""
|
||||
$!
|
||||
$! Tell The User This.
|
||||
$!
|
||||
$ WRITE SYS$OUTPUT "Compiling With RSAREF Routines."
|
||||
$!
|
||||
$! Else, We Don't Care. Compile Without The RSAREF Library.
|
||||
$!
|
||||
$ ELSE
|
||||
$!
|
||||
$! Tell The User We Are Compile Without The RSAREF Routines.
|
||||
$!
|
||||
$ WRITE SYS$OUTPUT "Compiling Without The RSAREF Routines.
|
||||
$!
|
||||
$! End The RSAREF Check.
|
||||
$!
|
||||
$ ENDIF
|
||||
$!
|
||||
$! Else The User Entered An Invalid Arguement.
|
||||
$!
|
||||
$ ELSE
|
||||
@@ -764,7 +950,7 @@ $!
|
||||
$! Tell The User We Don't Know What They Want.
|
||||
$!
|
||||
$ WRITE SYS$OUTPUT ""
|
||||
$ WRITE SYS$OUTPUT "The Option ",P2," Is Invalid. The Valid Options Are:"
|
||||
$ WRITE SYS$OUTPUT "The Option ",P3," Is Invalid. The Valid Options Are:"
|
||||
$ WRITE SYS$OUTPUT ""
|
||||
$ WRITE SYS$OUTPUT " VAXC : To Compile With VAX C."
|
||||
$ WRITE SYS$OUTPUT " DECC : To Compile With DEC C."
|
||||
@@ -778,13 +964,13 @@ $ ENDIF
|
||||
$!
|
||||
$! Time to check the contents, and to make sure we get the correct library.
|
||||
$!
|
||||
$ IF P3.EQS."SOCKETSHR" .OR. P3.EQS."MULTINET" .OR. P3.EQS."UCX" -
|
||||
.OR. P3.EQS."TCPIP" .OR. P3.EQS."NONE"
|
||||
$ IF P4.EQS."SOCKETSHR" .OR. P4.EQS."MULTINET" .OR. P4.EQS."UCX" -
|
||||
.OR. P4.EQS."TCPIP" .OR. P4.EQS."NONE"
|
||||
$ THEN
|
||||
$!
|
||||
$! Check to see if SOCKETSHR was chosen
|
||||
$!
|
||||
$ IF P3.EQS."SOCKETSHR"
|
||||
$ IF P4.EQS."SOCKETSHR"
|
||||
$ THEN
|
||||
$!
|
||||
$! Set the library to use SOCKETSHR
|
||||
@@ -797,12 +983,12 @@ $ ENDIF
|
||||
$!
|
||||
$! Check to see if MULTINET was chosen
|
||||
$!
|
||||
$ IF P3.EQS."MULTINET"
|
||||
$ IF P4.EQS."MULTINET"
|
||||
$ THEN
|
||||
$!
|
||||
$! Set the library to use UCX emulation.
|
||||
$!
|
||||
$ P3 = "UCX"
|
||||
$ P4 = "UCX"
|
||||
$!
|
||||
$! Done with MULTINET
|
||||
$!
|
||||
@@ -810,7 +996,7 @@ $ ENDIF
|
||||
$!
|
||||
$! Check to see if UCX was chosen
|
||||
$!
|
||||
$ IF P3.EQS."UCX"
|
||||
$ IF P4.EQS."UCX"
|
||||
$ THEN
|
||||
$!
|
||||
$! Set the library to use UCX.
|
||||
@@ -830,7 +1016,7 @@ $ ENDIF
|
||||
$!
|
||||
$! Check to see if TCPIP (post UCX) was chosen
|
||||
$!
|
||||
$ IF P3.EQS."TCPIP"
|
||||
$ IF P4.EQS."TCPIP"
|
||||
$ THEN
|
||||
$!
|
||||
$! Set the library to use TCPIP.
|
||||
@@ -843,7 +1029,7 @@ $ ENDIF
|
||||
$!
|
||||
$! Check to see if NONE was chosen
|
||||
$!
|
||||
$ IF P3.EQS."NONE"
|
||||
$ IF P4.EQS."NONE"
|
||||
$ THEN
|
||||
$!
|
||||
$! Do not use TCPIP.
|
||||
@@ -856,7 +1042,7 @@ $ ENDIF
|
||||
$!
|
||||
$! Add TCP/IP type to CC definitions.
|
||||
$!
|
||||
$ CCDEFS = CCDEFS + ",TCPIP_TYPE_''P3'"
|
||||
$ CCDEFS = CCDEFS + ",TCPIP_TYPE_''P4'"
|
||||
$!
|
||||
$! Print info
|
||||
$!
|
||||
@@ -869,7 +1055,7 @@ $!
|
||||
$! Tell The User We Don't Know What They Want.
|
||||
$!
|
||||
$ WRITE SYS$OUTPUT ""
|
||||
$ WRITE SYS$OUTPUT "The Option ",P3," Is Invalid. The Valid Options Are:"
|
||||
$ WRITE SYS$OUTPUT "The Option ",P4," Is Invalid. The Valid Options Are:"
|
||||
$ WRITE SYS$OUTPUT ""
|
||||
$ WRITE SYS$OUTPUT " SOCKETSHR : To link with SOCKETSHR TCP/IP library."
|
||||
$ WRITE SYS$OUTPUT " UCX : To link with UCX TCP/IP library."
|
||||
@@ -900,7 +1086,7 @@ $ CC = CC + "/DEFINE=(" + CCDEFS + ")" + CCDISABLEWARNINGS
|
||||
$!
|
||||
$! Show user the result
|
||||
$!
|
||||
$ WRITE/SYMBOL SYS$OUTPUT "Main Compiling Command: ",CC
|
||||
$ WRITE SYS$OUTPUT "Main Compiling Command: ",CC
|
||||
$!
|
||||
$! Special Threads For OpenVMS v7.1 Or Later
|
||||
$!
|
||||
@@ -908,9 +1094,9 @@ $! Written By: Richard Levitte
|
||||
$! richard@levitte.org
|
||||
$!
|
||||
$!
|
||||
$! Check To See If We Have A Option For P4.
|
||||
$! Check To See If We Have A Option For P5.
|
||||
$!
|
||||
$ IF (P4.EQS."")
|
||||
$ IF (P5.EQS."")
|
||||
$ THEN
|
||||
$!
|
||||
$! Get The Version Of VMS We Are Using.
|
||||
@@ -932,15 +1118,15 @@ $! End The VMS Version Check.
|
||||
$!
|
||||
$ ENDIF
|
||||
$!
|
||||
$! End The P4 Check.
|
||||
$! End The P5 Check.
|
||||
$!
|
||||
$ ENDIF
|
||||
$!
|
||||
$! Check if the user wanted to compile just a subset of all the programs.
|
||||
$!
|
||||
$ IF P5 .NES. ""
|
||||
$ IF P6 .NES. ""
|
||||
$ THEN
|
||||
$ PROGRAMS = P5
|
||||
$ PROGRAMS = P6
|
||||
$ ENDIF
|
||||
$!
|
||||
$! Time To RETURN...
|
||||
|
@@ -58,9 +58,9 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "apps.h"
|
||||
#include <openssl/pem.h>
|
||||
#include <openssl/err.h>
|
||||
#include "apps.h"
|
||||
|
||||
#undef PROG
|
||||
#define PROG nseq_main
|
||||
@@ -102,7 +102,7 @@ int MAIN(int argc, char **argv)
|
||||
BIO_printf (bio_err, "-in file input file\n");
|
||||
BIO_printf (bio_err, "-out file output file\n");
|
||||
BIO_printf (bio_err, "-toseq output NS Sequence file\n");
|
||||
OPENSSL_EXIT(1);
|
||||
EXIT(1);
|
||||
}
|
||||
|
||||
if (infile) {
|
||||
@@ -162,6 +162,6 @@ end:
|
||||
BIO_free_all(out);
|
||||
NETSCAPE_CERT_SEQUENCE_free(seq);
|
||||
|
||||
OPENSSL_EXIT(ret);
|
||||
EXIT(ret);
|
||||
}
|
||||
|
||||
|
19
apps/ocsp.c
19
apps/ocsp.c
@@ -58,11 +58,11 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "apps.h"
|
||||
#include <openssl/pem.h>
|
||||
#include <openssl/ocsp.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/ssl.h>
|
||||
#include "apps.h"
|
||||
|
||||
/* Maximum leeway in validity period: default 5 minutes */
|
||||
#define MAX_VALIDITY_PERIOD (5 * 60)
|
||||
@@ -613,11 +613,11 @@ int MAIN(int argc, char **argv)
|
||||
NULL, e, "CA certificate");
|
||||
if (rcertfile)
|
||||
{
|
||||
rother = load_certs(bio_err, rcertfile, FORMAT_PEM,
|
||||
rother = load_certs(bio_err, sign_certfile, FORMAT_PEM,
|
||||
NULL, e, "responder other certificates");
|
||||
if (!rother) goto end;
|
||||
if (!sign_other) goto end;
|
||||
}
|
||||
rkey = load_key(bio_err, rkeyfile, FORMAT_PEM, 0, NULL, NULL,
|
||||
rkey = load_key(bio_err, rkeyfile, FORMAT_PEM, NULL, NULL,
|
||||
"responder private key");
|
||||
if (!rkey)
|
||||
goto end;
|
||||
@@ -663,7 +663,7 @@ int MAIN(int argc, char **argv)
|
||||
NULL, e, "signer certificates");
|
||||
if (!sign_other) goto end;
|
||||
}
|
||||
key = load_key(bio_err, keyfile, FORMAT_PEM, 0, NULL, NULL,
|
||||
key = load_key(bio_err, keyfile, FORMAT_PEM, NULL, NULL,
|
||||
"signer private key");
|
||||
if (!key)
|
||||
goto end;
|
||||
@@ -899,7 +899,7 @@ end:
|
||||
SSL_CTX_free(ctx);
|
||||
}
|
||||
|
||||
OPENSSL_EXIT(ret);
|
||||
EXIT(ret);
|
||||
}
|
||||
|
||||
static int add_ocsp_cert(OCSP_REQUEST **req, X509 *cert, X509 *issuer,
|
||||
@@ -1120,10 +1120,7 @@ static char **lookup_serial(TXT_DB *db, ASN1_INTEGER *ser)
|
||||
char *itmp, *row[DB_NUMBER],**rrow;
|
||||
for (i = 0; i < DB_NUMBER; i++) row[i] = NULL;
|
||||
bn = ASN1_INTEGER_to_BN(ser,NULL);
|
||||
if (BN_is_zero(bn))
|
||||
itmp = BUF_strdup("00");
|
||||
else
|
||||
itmp = BN_bn2hex(bn);
|
||||
itmp = BN_bn2hex(bn);
|
||||
row[DB_serial] = itmp;
|
||||
BN_free(bn);
|
||||
rrow=TXT_DB_get_by_index(db,DB_serial,row);
|
||||
@@ -1179,7 +1176,7 @@ static int do_responder(OCSP_REQUEST **preq, BIO **pcbio, BIO *acbio, char *port
|
||||
|
||||
for(;;)
|
||||
{
|
||||
len = BIO_gets(cbio, inbuf, sizeof inbuf);
|
||||
len = BIO_gets(cbio, inbuf, 1024);
|
||||
if (len <= 0)
|
||||
return 1;
|
||||
/* Look for "POST" signalling start of query */
|
||||
|
@@ -114,7 +114,6 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#define OPENSSL_C /* tells apps.h to use complete apps_startup() */
|
||||
#include "apps.h"
|
||||
#include <openssl/bio.h>
|
||||
#include <openssl/crypto.h>
|
||||
#include <openssl/lhash.h>
|
||||
@@ -124,6 +123,7 @@
|
||||
#include <openssl/ssl.h>
|
||||
#include <openssl/engine.h>
|
||||
#define USE_SOCKETS /* needed for the _O_BINARY defs in the MS world */
|
||||
#include "apps.h"
|
||||
#include "progs.h"
|
||||
#include "s_apps.h"
|
||||
#include <openssl/err.h>
|
||||
@@ -139,11 +139,11 @@ static unsigned long MS_CALLBACK hash(const void *a_void);
|
||||
static int MS_CALLBACK cmp(const void *a_void,const void *b_void);
|
||||
static LHASH *prog_init(void );
|
||||
static int do_cmd(LHASH *prog,int argc,char *argv[]);
|
||||
CONF *config=NULL;
|
||||
char *default_config_file=NULL;
|
||||
|
||||
/* Make sure there is only one when MONOLITH is defined */
|
||||
#ifdef MONOLITH
|
||||
CONF *config=NULL;
|
||||
BIO *bio_err=NULL;
|
||||
#endif
|
||||
|
||||
@@ -218,8 +218,7 @@ int main(int Argc, char *Argv[])
|
||||
#define PROG_NAME_SIZE 39
|
||||
char pname[PROG_NAME_SIZE+1];
|
||||
FUNCTION f,*fp;
|
||||
MS_STATIC char *prompt,buf[1024];
|
||||
char *to_free=NULL;
|
||||
MS_STATIC char *prompt,buf[1024],config_name[256];
|
||||
int n,i,ret=0;
|
||||
int argc;
|
||||
char **argv,*p;
|
||||
@@ -229,10 +228,6 @@ int main(int Argc, char *Argv[])
|
||||
arg.data=NULL;
|
||||
arg.count=0;
|
||||
|
||||
if (bio_err == NULL)
|
||||
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
|
||||
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
|
||||
|
||||
if (getenv("OPENSSL_DEBUG_MEMORY") != NULL) /* if not defined, use compiled-in library defaults */
|
||||
{
|
||||
if (!(0 == strcmp(getenv("OPENSSL_DEBUG_MEMORY"), "off")))
|
||||
@@ -257,12 +252,23 @@ int main(int Argc, char *Argv[])
|
||||
|
||||
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);
|
||||
|
||||
/* Lets load up our environment a little */
|
||||
p=getenv("OPENSSL_CONF");
|
||||
if (p == NULL)
|
||||
p=getenv("SSLEAY_CONF");
|
||||
if (p == NULL)
|
||||
p=to_free=make_config_name();
|
||||
{
|
||||
strcpy(config_name,X509_get_default_cert_area());
|
||||
#ifndef OPENSSL_SYS_VMS
|
||||
strcat(config_name,"/");
|
||||
#endif
|
||||
strcat(config_name,OPENSSL_CONF);
|
||||
p=config_name;
|
||||
}
|
||||
|
||||
default_config_file=p;
|
||||
|
||||
@@ -278,7 +284,7 @@ int main(int Argc, char *Argv[])
|
||||
prog=prog_init();
|
||||
|
||||
/* first check the program name */
|
||||
program_name(Argv[0],pname,sizeof pname);
|
||||
program_name(Argv[0],pname,PROG_NAME_SIZE);
|
||||
|
||||
f.name=pname;
|
||||
fp=(FUNCTION *)lh_retrieve(prog,&f);
|
||||
@@ -306,7 +312,7 @@ int main(int Argc, char *Argv[])
|
||||
{
|
||||
ret=0;
|
||||
p=buf;
|
||||
n=sizeof buf;
|
||||
n=1024;
|
||||
i=0;
|
||||
for (;;)
|
||||
{
|
||||
@@ -340,8 +346,6 @@ int main(int Argc, char *Argv[])
|
||||
BIO_printf(bio_err,"bad exit\n");
|
||||
ret=1;
|
||||
end:
|
||||
if (to_free)
|
||||
OPENSSL_free(to_free);
|
||||
if (config != NULL)
|
||||
{
|
||||
NCONF_free(config);
|
||||
@@ -358,7 +362,7 @@ end:
|
||||
BIO_free(bio_err);
|
||||
bio_err=NULL;
|
||||
}
|
||||
OPENSSL_EXIT(ret);
|
||||
EXIT(ret);
|
||||
}
|
||||
|
||||
#define LIST_STANDARD_COMMANDS "list-standard-commands"
|
||||
|
@@ -19,6 +19,7 @@
|
||||
# include <openssl/des.h>
|
||||
#endif
|
||||
#ifndef NO_MD5CRYPT_1
|
||||
# include <openssl/evp.h>
|
||||
# include <openssl/md5.h>
|
||||
#endif
|
||||
|
||||
@@ -292,7 +293,7 @@ err:
|
||||
if (out)
|
||||
BIO_free_all(out);
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(ret);
|
||||
EXIT(ret);
|
||||
}
|
||||
|
||||
|
||||
@@ -505,6 +506,6 @@ err:
|
||||
int MAIN(int argc, char **argv)
|
||||
{
|
||||
fputs("Program not available.\n", stderr)
|
||||
OPENSSL_EXIT(1);
|
||||
EXIT(1);
|
||||
}
|
||||
#endif
|
||||
|
255
apps/pkcs12.c
255
apps/pkcs12.c
@@ -2,10 +2,10 @@
|
||||
#if !defined(OPENSSL_NO_DES) && !defined(OPENSSL_NO_SHA1)
|
||||
|
||||
/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL
|
||||
* project.
|
||||
* project 1999.
|
||||
*/
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1999-2002 The OpenSSL Project. All rights reserved.
|
||||
* Copyright (c) 1999 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -164,14 +164,10 @@ int MAIN(int argc, char **argv)
|
||||
maciter = PKCS12_DEFAULT_ITER;
|
||||
else if (!strcmp (*args, "-nomaciter"))
|
||||
maciter = 1;
|
||||
else if (!strcmp (*args, "-nomac"))
|
||||
maciter = -1;
|
||||
else if (!strcmp (*args, "-nodes")) enc=NULL;
|
||||
else if (!strcmp (*args, "-certpbe")) {
|
||||
if (args[1]) {
|
||||
args++;
|
||||
if (!strcmp(*args, "NONE"))
|
||||
cert_pbe = -1;
|
||||
cert_pbe=OBJ_txt2nid(*args);
|
||||
if(cert_pbe == NID_undef) {
|
||||
BIO_printf(bio_err,
|
||||
@@ -182,10 +178,7 @@ int MAIN(int argc, char **argv)
|
||||
} else if (!strcmp (*args, "-keypbe")) {
|
||||
if (args[1]) {
|
||||
args++;
|
||||
if (!strcmp(*args, "NONE"))
|
||||
key_pbe = -1;
|
||||
else
|
||||
key_pbe=OBJ_txt2nid(*args);
|
||||
key_pbe=OBJ_txt2nid(*args);
|
||||
if(key_pbe == NID_undef) {
|
||||
BIO_printf(bio_err,
|
||||
"Unknown PBE algorithm %s\n", *args);
|
||||
@@ -364,6 +357,24 @@ int MAIN(int argc, char **argv)
|
||||
goto end;
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (certfile) {
|
||||
if(!(certsin = BIO_new_file(certfile, "r"))) {
|
||||
BIO_printf(bio_err, "Can't open certificate file %s\n", certfile);
|
||||
perror (certfile);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (keyname) {
|
||||
if(!(inkey = BIO_new_file(keyname, "r"))) {
|
||||
BIO_printf(bio_err, "Can't key certificate file %s\n", keyname);
|
||||
perror (keyname);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CRYPTO_MDEBUG
|
||||
CRYPTO_pop_info();
|
||||
CRYPTO_push_info("write files");
|
||||
@@ -388,7 +399,7 @@ int MAIN(int argc, char **argv)
|
||||
#ifdef CRYPTO_MDEBUG
|
||||
CRYPTO_push_info("read MAC password");
|
||||
#endif
|
||||
if(EVP_read_pw_string (macpass, sizeof macpass, "Enter MAC Password:", export_cert))
|
||||
if(EVP_read_pw_string (macpass, 50, "Enter MAC Password:", export_cert))
|
||||
{
|
||||
BIO_printf (bio_err, "Can't read Password\n");
|
||||
goto end;
|
||||
@@ -400,31 +411,27 @@ int MAIN(int argc, char **argv)
|
||||
|
||||
if (export_cert) {
|
||||
EVP_PKEY *key = NULL;
|
||||
X509 *ucert = NULL, *x = NULL;
|
||||
STACK_OF(PKCS12_SAFEBAG) *bags = NULL;
|
||||
STACK_OF(PKCS7) *safes = NULL;
|
||||
PKCS12_SAFEBAG *bag = NULL;
|
||||
PKCS8_PRIV_KEY_INFO *p8 = NULL;
|
||||
PKCS7 *authsafe = NULL;
|
||||
X509 *ucert = NULL;
|
||||
STACK_OF(X509) *certs=NULL;
|
||||
unsigned char *catmp = NULL;
|
||||
char *catmp = NULL;
|
||||
int i;
|
||||
|
||||
if ((options & (NOCERTS|NOKEYS)) == (NOCERTS|NOKEYS))
|
||||
{
|
||||
BIO_printf(bio_err, "Nothing to do!\n");
|
||||
goto export_end;
|
||||
}
|
||||
|
||||
if (options & NOCERTS)
|
||||
chain = 0;
|
||||
unsigned char keyid[EVP_MAX_MD_SIZE];
|
||||
unsigned int keyidlen = 0;
|
||||
|
||||
#ifdef CRYPTO_MDEBUG
|
||||
CRYPTO_push_info("process -export_cert");
|
||||
CRYPTO_push_info("reading private key");
|
||||
#endif
|
||||
if (!(options & NOKEYS))
|
||||
{
|
||||
key = load_key(bio_err, keyname ? keyname : infile,
|
||||
FORMAT_PEM, 1, passin, e, "private key");
|
||||
if (!key)
|
||||
goto export_end;
|
||||
}
|
||||
key = load_key(bio_err, keyname ? keyname : infile, FORMAT_PEM,
|
||||
passin, e, "private key");
|
||||
if (!key) {
|
||||
goto export_end;
|
||||
}
|
||||
|
||||
#ifdef CRYPTO_MDEBUG
|
||||
CRYPTO_pop_info();
|
||||
@@ -432,62 +439,50 @@ int MAIN(int argc, char **argv)
|
||||
#endif
|
||||
|
||||
/* Load in all certs in input file */
|
||||
if(!(options & NOCERTS))
|
||||
{
|
||||
certs = load_certs(bio_err, infile, FORMAT_PEM, NULL, e,
|
||||
"certificates");
|
||||
if (!certs)
|
||||
goto export_end;
|
||||
|
||||
if (key)
|
||||
{
|
||||
/* Look for matching private key */
|
||||
for(i = 0; i < sk_X509_num(certs); i++)
|
||||
{
|
||||
x = sk_X509_value(certs, i);
|
||||
if(X509_check_private_key(x, key))
|
||||
{
|
||||
ucert = x;
|
||||
/* Zero keyid and alias */
|
||||
X509_keyid_set1(ucert, NULL, 0);
|
||||
X509_alias_set1(ucert, NULL, 0);
|
||||
/* Remove from list */
|
||||
sk_X509_delete(certs, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!ucert)
|
||||
{
|
||||
BIO_printf(bio_err, "No certificate matches private key\n");
|
||||
goto export_end;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if(!(certs = load_certs(bio_err, infile, FORMAT_PEM, NULL, e,
|
||||
"certificates"))) {
|
||||
goto export_end;
|
||||
}
|
||||
|
||||
#ifdef CRYPTO_MDEBUG
|
||||
CRYPTO_pop_info();
|
||||
CRYPTO_push_info("reading certs from input 2");
|
||||
#endif
|
||||
|
||||
/* Add any more certificates asked for */
|
||||
if(certfile)
|
||||
{
|
||||
STACK_OF(X509) *morecerts=NULL;
|
||||
if(!(morecerts = load_certs(bio_err, certfile, FORMAT_PEM,
|
||||
NULL, e,
|
||||
"certificates from certfile")))
|
||||
goto export_end;
|
||||
while(sk_X509_num(morecerts) > 0)
|
||||
sk_X509_push(certs, sk_X509_shift(morecerts));
|
||||
sk_X509_free(morecerts);
|
||||
}
|
||||
|
||||
for(i = 0; i < sk_X509_num(certs); i++) {
|
||||
ucert = sk_X509_value(certs, i);
|
||||
if(X509_check_private_key(ucert, key)) {
|
||||
X509_digest(ucert, EVP_sha1(), keyid, &keyidlen);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!keyidlen) {
|
||||
ucert = NULL;
|
||||
BIO_printf(bio_err, "No certificate matches private key\n");
|
||||
goto export_end;
|
||||
}
|
||||
|
||||
#ifdef CRYPTO_MDEBUG
|
||||
CRYPTO_pop_info();
|
||||
CRYPTO_push_info("reading certs from certfile");
|
||||
#endif
|
||||
|
||||
bags = sk_PKCS12_SAFEBAG_new_null ();
|
||||
|
||||
/* Add any more certificates asked for */
|
||||
if (certfile) {
|
||||
STACK_OF(X509) *morecerts=NULL;
|
||||
if(!(morecerts = load_certs(bio_err, certfile, FORMAT_PEM,
|
||||
NULL, e,
|
||||
"certificates from certfile"))) {
|
||||
goto export_end;
|
||||
}
|
||||
while(sk_X509_num(morecerts) > 0) {
|
||||
sk_X509_push(certs, sk_X509_shift(morecerts));
|
||||
}
|
||||
sk_X509_free(morecerts);
|
||||
}
|
||||
|
||||
#ifdef CRYPTO_MDEBUG
|
||||
CRYPTO_pop_info();
|
||||
CRYPTO_push_info("building chain");
|
||||
@@ -513,61 +508,111 @@ int MAIN(int argc, char **argv)
|
||||
/* Exclude verified certificate */
|
||||
for (i = 1; i < sk_X509_num (chain2) ; i++)
|
||||
sk_X509_push(certs, sk_X509_value (chain2, i));
|
||||
/* Free first certificate */
|
||||
X509_free(sk_X509_value(chain2, 0));
|
||||
sk_X509_free(chain2);
|
||||
} else {
|
||||
}
|
||||
sk_X509_free(chain2);
|
||||
if (vret) {
|
||||
BIO_printf (bio_err, "Error %s getting chain.\n",
|
||||
X509_verify_cert_error_string(vret));
|
||||
goto export_end;
|
||||
}
|
||||
}
|
||||
|
||||
/* Add any CA names */
|
||||
#ifdef CRYPTO_MDEBUG
|
||||
CRYPTO_pop_info();
|
||||
CRYPTO_push_info("building bags");
|
||||
#endif
|
||||
|
||||
for (i = 0; i < sk_num(canames); i++)
|
||||
{
|
||||
catmp = (unsigned char *)sk_value(canames, i);
|
||||
X509_alias_set1(sk_X509_value(certs, i), catmp, -1);
|
||||
}
|
||||
|
||||
/* We now have loads of certificates: include them all */
|
||||
for(i = 0; i < sk_X509_num(certs); i++) {
|
||||
X509 *cert = NULL;
|
||||
cert = sk_X509_value(certs, i);
|
||||
bag = PKCS12_x5092certbag(cert);
|
||||
/* If it matches private key set id */
|
||||
if(cert == ucert) {
|
||||
if(name) PKCS12_add_friendlyname(bag, name, -1);
|
||||
PKCS12_add_localkeyid(bag, keyid, keyidlen);
|
||||
} else if((catmp = sk_shift(canames)))
|
||||
PKCS12_add_friendlyname(bag, catmp, -1);
|
||||
sk_PKCS12_SAFEBAG_push(bags, bag);
|
||||
}
|
||||
sk_X509_pop_free(certs, X509_free);
|
||||
certs = NULL;
|
||||
/* ucert is part of certs so it is already freed */
|
||||
ucert = NULL;
|
||||
|
||||
#ifdef CRYPTO_MDEBUG
|
||||
CRYPTO_pop_info();
|
||||
CRYPTO_push_info("reading password");
|
||||
CRYPTO_push_info("encrypting bags");
|
||||
#endif
|
||||
|
||||
if(!noprompt &&
|
||||
EVP_read_pw_string(pass, sizeof pass, "Enter Export Password:", 1))
|
||||
{
|
||||
BIO_printf (bio_err, "Can't read Password\n");
|
||||
goto export_end;
|
||||
}
|
||||
EVP_read_pw_string(pass, 50, "Enter Export Password:", 1)) {
|
||||
BIO_printf (bio_err, "Can't read Password\n");
|
||||
goto export_end;
|
||||
}
|
||||
if (!twopass) strcpy(macpass, pass);
|
||||
/* Turn certbags into encrypted authsafe */
|
||||
authsafe = PKCS12_pack_p7encdata(cert_pbe, cpass, -1, NULL, 0,
|
||||
iter, bags);
|
||||
sk_PKCS12_SAFEBAG_pop_free(bags, PKCS12_SAFEBAG_free);
|
||||
bags = NULL;
|
||||
|
||||
if (!authsafe) {
|
||||
ERR_print_errors (bio_err);
|
||||
goto export_end;
|
||||
}
|
||||
|
||||
safes = sk_PKCS7_new_null ();
|
||||
sk_PKCS7_push (safes, authsafe);
|
||||
|
||||
#ifdef CRYPTO_MDEBUG
|
||||
CRYPTO_pop_info();
|
||||
CRYPTO_push_info("creating PKCS#12 structure");
|
||||
CRYPTO_push_info("building shrouded key bag");
|
||||
#endif
|
||||
|
||||
p12 = PKCS12_create(pass, name, key, ucert, certs,
|
||||
key_pbe, cert_pbe, iter, -1, keytype);
|
||||
/* Make a shrouded key bag */
|
||||
p8 = EVP_PKEY2PKCS8 (key);
|
||||
if(keytype) PKCS8_add_keyusage(p8, keytype);
|
||||
bag = PKCS12_MAKE_SHKEYBAG(key_pbe, cpass, -1, NULL, 0, iter, p8);
|
||||
PKCS8_PRIV_KEY_INFO_free(p8);
|
||||
p8 = NULL;
|
||||
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);
|
||||
bags = sk_PKCS12_SAFEBAG_new_null();
|
||||
sk_PKCS12_SAFEBAG_push (bags, bag);
|
||||
|
||||
if (!p12)
|
||||
{
|
||||
ERR_print_errors (bio_err);
|
||||
goto export_end;
|
||||
}
|
||||
#ifdef CRYPTO_MDEBUG
|
||||
CRYPTO_pop_info();
|
||||
CRYPTO_push_info("encrypting shrouded key bag");
|
||||
#endif
|
||||
|
||||
if (maciter != -1)
|
||||
PKCS12_set_mac(p12, mpass, -1, NULL, 0, maciter, NULL);
|
||||
/* Turn it into unencrypted safe bag */
|
||||
authsafe = PKCS12_pack_p7data (bags);
|
||||
sk_PKCS12_SAFEBAG_pop_free(bags, PKCS12_SAFEBAG_free);
|
||||
bags = NULL;
|
||||
sk_PKCS7_push (safes, authsafe);
|
||||
|
||||
#ifdef CRYPTO_MDEBUG
|
||||
CRYPTO_pop_info();
|
||||
CRYPTO_push_info("building pkcs12");
|
||||
#endif
|
||||
|
||||
p12 = PKCS12_init(NID_pkcs7_data);
|
||||
|
||||
PKCS12_pack_authsafes(p12, safes);
|
||||
|
||||
sk_PKCS7_pop_free(safes, PKCS7_free);
|
||||
safes = NULL;
|
||||
|
||||
PKCS12_set_mac (p12, mpass, -1, NULL, 0, maciter, NULL);
|
||||
|
||||
#ifdef CRYPTO_MDEBUG
|
||||
CRYPTO_pop_info();
|
||||
CRYPTO_push_info("writing pkcs12");
|
||||
#endif
|
||||
|
||||
i2d_PKCS12_bio(out, p12);
|
||||
i2d_PKCS12_bio (out, p12);
|
||||
|
||||
ret = 0;
|
||||
|
||||
@@ -580,6 +625,8 @@ int MAIN(int argc, char **argv)
|
||||
|
||||
if (key) EVP_PKEY_free(key);
|
||||
if (certs) sk_X509_pop_free(certs, X509_free);
|
||||
if (safes) sk_PKCS7_pop_free(safes, PKCS7_free);
|
||||
if (bags) sk_PKCS12_SAFEBAG_pop_free(bags, PKCS12_SAFEBAG_free);
|
||||
if (ucert) X509_free(ucert);
|
||||
|
||||
#ifdef CRYPTO_MDEBUG
|
||||
@@ -597,7 +644,7 @@ int MAIN(int argc, char **argv)
|
||||
#ifdef CRYPTO_MDEBUG
|
||||
CRYPTO_push_info("read import password");
|
||||
#endif
|
||||
if(!noprompt && EVP_read_pw_string(pass, sizeof pass, "Enter Import Password:", 0)) {
|
||||
if(!noprompt && EVP_read_pw_string(pass, 50, "Enter Import Password:", 0)) {
|
||||
BIO_printf (bio_err, "Can't read Password\n");
|
||||
goto end;
|
||||
}
|
||||
@@ -651,7 +698,7 @@ int MAIN(int argc, char **argv)
|
||||
if(passin) OPENSSL_free(passin);
|
||||
if(passout) OPENSSL_free(passout);
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(ret);
|
||||
EXIT(ret);
|
||||
}
|
||||
|
||||
int dump_certs_keys_p12 (BIO *out, PKCS12 *p12, char *pass,
|
||||
|
@@ -89,7 +89,7 @@ int MAIN(int argc, char **argv)
|
||||
int informat,outformat;
|
||||
char *infile,*outfile,*prog;
|
||||
int print_certs=0,text=0,noout=0;
|
||||
int ret=1;
|
||||
int ret=0;
|
||||
char *engine=NULL;
|
||||
|
||||
apps_startup();
|
||||
@@ -301,5 +301,5 @@ end:
|
||||
if (in != NULL) BIO_free(in);
|
||||
if (out != NULL) BIO_free_all(out);
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(ret);
|
||||
EXIT(ret);
|
||||
}
|
||||
|
@@ -63,6 +63,7 @@
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/pkcs12.h>
|
||||
|
||||
#include "apps.h"
|
||||
#define PROG pkcs8_main
|
||||
|
||||
int MAIN(int, char **);
|
||||
@@ -221,8 +222,7 @@ int MAIN(int argc, char **argv)
|
||||
if (topk8)
|
||||
{
|
||||
BIO_free(in); /* Not needed in this section */
|
||||
pkey = load_key(bio_err, infile, informat, 1,
|
||||
passin, e, "key");
|
||||
pkey = load_key(bio_err, infile, informat, passin, e, "key");
|
||||
if (!pkey) {
|
||||
return (1);
|
||||
}
|
||||
@@ -244,8 +244,7 @@ int MAIN(int argc, char **argv)
|
||||
if(passout) p8pass = passout;
|
||||
else {
|
||||
p8pass = pass;
|
||||
if (EVP_read_pw_string(pass, sizeof pass, "Enter Encryption Password:", 1))
|
||||
return (1);
|
||||
EVP_read_pw_string(pass, 50, "Enter Encryption Password:", 1);
|
||||
}
|
||||
app_RAND_load_file(NULL, bio_err, 0);
|
||||
if (!(p8 = PKCS8_encrypt(pbe_nid, cipher,
|
||||
@@ -302,7 +301,7 @@ int MAIN(int argc, char **argv)
|
||||
if(passin) p8pass = passin;
|
||||
else {
|
||||
p8pass = pass;
|
||||
EVP_read_pw_string(pass, sizeof pass, "Enter Password:", 0);
|
||||
EVP_read_pw_string(pass, 50, "Enter Password:", 0);
|
||||
}
|
||||
p8inf = PKCS8_decrypt(p8, p8pass, strlen(p8pass));
|
||||
X509_SIG_free(p8);
|
||||
|
@@ -17,8 +17,6 @@ extern int rsa_main(int argc,char *argv[]);
|
||||
extern int rsautl_main(int argc,char *argv[]);
|
||||
extern int dsa_main(int argc,char *argv[]);
|
||||
extern int dsaparam_main(int argc,char *argv[]);
|
||||
extern int ec_main(int argc,char *argv[]);
|
||||
extern int ecparam_main(int argc,char *argv[]);
|
||||
extern int x509_main(int argc,char *argv[]);
|
||||
extern int genrsa_main(int argc,char *argv[]);
|
||||
extern int gendsa_main(int argc,char *argv[]);
|
||||
@@ -80,12 +78,6 @@ FUNCTION functions[] = {
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
{FUNC_TYPE_GENERAL,"dsaparam",dsaparam_main},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_EC
|
||||
{FUNC_TYPE_GENERAL,"ec",ec_main},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_EC
|
||||
{FUNC_TYPE_GENERAL,"ecparam",ecparam_main},
|
||||
#endif
|
||||
{FUNC_TYPE_GENERAL,"x509",x509_main},
|
||||
#ifndef OPENSSL_NO_RSA
|
||||
|
@@ -33,8 +33,6 @@ foreach (@ARGV)
|
||||
{ print "#ifndef OPENSSL_NO_RSA\n${str}#endif\n"; }
|
||||
elsif ( ($_ =~ /^dsa$/) || ($_ =~ /^gendsa$/) || ($_ =~ /^dsaparam$/))
|
||||
{ print "#ifndef OPENSSL_NO_DSA\n${str}#endif\n"; }
|
||||
elsif ( ($_ =~ /^ec$/) || ($_ =~ /^ecparam$/))
|
||||
{ print "#ifndef OPENSSL_NO_EC\n${str}#endif\n";}
|
||||
elsif ( ($_ =~ /^dh$/) || ($_ =~ /^gendh$/) || ($_ =~ /^dhparam$/))
|
||||
{ print "#ifndef OPENSSL_NO_DH\n${str}#endif\n"; }
|
||||
elsif ( ($_ =~ /^pkcs12$/))
|
||||
|
@@ -213,5 +213,5 @@ err:
|
||||
if (out)
|
||||
BIO_free_all(out);
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(ret);
|
||||
EXIT(ret);
|
||||
}
|
||||
|
141
apps/req.c
141
apps/req.c
@@ -73,7 +73,6 @@
|
||||
#include <openssl/x509v3.h>
|
||||
#include <openssl/objects.h>
|
||||
#include <openssl/pem.h>
|
||||
#include "../crypto/cryptlib.h"
|
||||
|
||||
#define SECTION "req"
|
||||
|
||||
@@ -143,7 +142,6 @@ static int batch=0;
|
||||
#define TYPE_RSA 1
|
||||
#define TYPE_DSA 2
|
||||
#define TYPE_DH 3
|
||||
#define TYPE_EC 4
|
||||
|
||||
int MAIN(int, char **);
|
||||
|
||||
@@ -153,10 +151,7 @@ int MAIN(int argc, char **argv)
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
DSA *dsa_params=NULL;
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ECDSA
|
||||
EC_KEY *ec_params = NULL;
|
||||
#endif
|
||||
unsigned long nmflag = 0, reqflag = 0;
|
||||
unsigned long nmflag = 0;
|
||||
int ex=1,x509=0,days=30;
|
||||
X509 *x509ss=NULL;
|
||||
X509_REQ *req=NULL;
|
||||
@@ -181,7 +176,7 @@ int MAIN(int argc, char **argv)
|
||||
const EVP_MD *md_alg=NULL,*digest=EVP_md5();
|
||||
unsigned long chtype = MBSTRING_ASC;
|
||||
#ifndef MONOLITH
|
||||
char *to_free;
|
||||
MS_STATIC char config_name[256];
|
||||
long errline;
|
||||
#endif
|
||||
|
||||
@@ -323,59 +318,11 @@ int MAIN(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
BIO_free(in);
|
||||
in=NULL;
|
||||
newkey=BN_num_bits(dsa_params->p);
|
||||
in=NULL;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ECDSA
|
||||
if (strncmp("ec:",p,3) == 0)
|
||||
{
|
||||
X509 *xtmp=NULL;
|
||||
EVP_PKEY *dtmp;
|
||||
|
||||
pkey_type=TYPE_EC;
|
||||
p+=3;
|
||||
if ((in=BIO_new_file(p,"r")) == NULL)
|
||||
{
|
||||
perror(p);
|
||||
goto end;
|
||||
}
|
||||
if ((ec_params = EC_KEY_new()) == NULL)
|
||||
goto end;
|
||||
if ((ec_params->group = PEM_read_bio_ECPKParameters(in, NULL, NULL, NULL)) == NULL)
|
||||
{
|
||||
if (ec_params)
|
||||
EC_KEY_free(ec_params);
|
||||
ERR_clear_error();
|
||||
(void)BIO_reset(in);
|
||||
if ((xtmp=PEM_read_bio_X509(in,NULL,NULL,NULL)) == NULL)
|
||||
{
|
||||
BIO_printf(bio_err,"unable to load EC parameters from file\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if ((dtmp=X509_get_pubkey(xtmp))==NULL)
|
||||
goto end;
|
||||
if (dtmp->type == EVP_PKEY_EC)
|
||||
ec_params = ECParameters_dup(dtmp->pkey.eckey);
|
||||
EVP_PKEY_free(dtmp);
|
||||
X509_free(xtmp);
|
||||
if (ec_params == NULL)
|
||||
{
|
||||
BIO_printf(bio_err,"Certificate does not contain EC parameters\n");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
BIO_free(in);
|
||||
in=NULL;
|
||||
|
||||
newkey = EC_GROUP_get_degree(ec_params->group);
|
||||
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DH
|
||||
if (strncmp("dh:",p,4) == 0)
|
||||
{
|
||||
@@ -384,9 +331,7 @@ int MAIN(int argc, char **argv)
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
goto bad;
|
||||
}
|
||||
pkey_type=TYPE_RSA;
|
||||
|
||||
newreq=1;
|
||||
}
|
||||
@@ -411,11 +356,6 @@ int MAIN(int argc, char **argv)
|
||||
if (--argc < 1) goto bad;
|
||||
if (!set_name_ex(&nmflag, *(++argv))) goto bad;
|
||||
}
|
||||
else if (strcmp(*argv,"-reqopt") == 0)
|
||||
{
|
||||
if (--argc < 1) goto bad;
|
||||
if (!set_cert_ex(&reqflag, *(++argv))) goto bad;
|
||||
}
|
||||
else if (strcmp(*argv,"-subject") == 0)
|
||||
subject=1;
|
||||
else if (strcmp(*argv,"-text") == 0)
|
||||
@@ -494,9 +434,6 @@ bad:
|
||||
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 dsa:file generate a new DSA key, parameters taken from CA in 'file'\n");
|
||||
#ifndef OPENSSL_NO_ECDSA
|
||||
BIO_printf(bio_err," -newkey ec:file generate a new EC key, parameters taken from CA in 'file'\n");
|
||||
#endif
|
||||
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," -subj arg set or modify request subject\n");
|
||||
@@ -511,8 +448,7 @@ bad:
|
||||
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," -utf8 input characters are UTF8 (default ASCII)\n");
|
||||
BIO_printf(bio_err," -nameopt arg - various certificate name options\n");
|
||||
BIO_printf(bio_err," -reqopt arg - various request text options\n\n");
|
||||
BIO_printf(bio_err," -nameopt arg - various certificate name options\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
@@ -528,7 +464,14 @@ bad:
|
||||
if (p == NULL)
|
||||
p=getenv("SSLEAY_CONF");
|
||||
if (p == NULL)
|
||||
p=to_free=make_config_name();
|
||||
{
|
||||
strcpy(config_name,X509_get_default_cert_area());
|
||||
#ifndef OPENSSL_SYS_VMS
|
||||
strcat(config_name,"/");
|
||||
#endif
|
||||
strcat(config_name,OPENSSL_CONF);
|
||||
p=config_name;
|
||||
}
|
||||
default_config_file=p;
|
||||
config=NCONF_new(NULL);
|
||||
i=NCONF_load(config, p, &errline);
|
||||
@@ -536,7 +479,7 @@ bad:
|
||||
|
||||
if (template != NULL)
|
||||
{
|
||||
long errline = -1;
|
||||
long errline;
|
||||
|
||||
if( verbose )
|
||||
BIO_printf(bio_err,"Using configuration from %s\n",template);
|
||||
@@ -679,7 +622,7 @@ bad:
|
||||
|
||||
if (keyfile != NULL)
|
||||
{
|
||||
pkey = load_key(bio_err, keyfile, keyform, 0, passin, e,
|
||||
pkey = load_key(bio_err, keyfile, keyform, passin, e,
|
||||
"Private Key");
|
||||
if (!pkey)
|
||||
{
|
||||
@@ -687,8 +630,7 @@ bad:
|
||||
message */
|
||||
goto end;
|
||||
}
|
||||
if (EVP_PKEY_type(pkey->type) == EVP_PKEY_DSA ||
|
||||
EVP_PKEY_type(pkey->type) == EVP_PKEY_EC)
|
||||
if (EVP_PKEY_type(pkey->type) == EVP_PKEY_DSA)
|
||||
{
|
||||
char *randfile = NCONF_get_string(req_conf,SECTION,"RANDFILE");
|
||||
if (randfile == NULL)
|
||||
@@ -712,15 +654,14 @@ bad:
|
||||
newkey=DEFAULT_KEY_LENGTH;
|
||||
}
|
||||
|
||||
if (newkey < MIN_KEY_LENGTH && (pkey_type == TYPE_RSA || pkey_type == TYPE_DSA))
|
||||
if (newkey < MIN_KEY_LENGTH)
|
||||
{
|
||||
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);
|
||||
goto end;
|
||||
}
|
||||
BIO_printf(bio_err,"Generating a %d bit %s private key\n",
|
||||
newkey,(pkey_type == TYPE_RSA)?"RSA":
|
||||
(pkey_type == TYPE_DSA)?"DSA":"EC");
|
||||
newkey,(pkey_type == TYPE_RSA)?"RSA":"DSA");
|
||||
|
||||
if ((pkey=EVP_PKEY_new()) == NULL) goto end;
|
||||
|
||||
@@ -742,15 +683,6 @@ bad:
|
||||
dsa_params=NULL;
|
||||
}
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ECDSA
|
||||
if (pkey_type == TYPE_EC)
|
||||
{
|
||||
if (!EC_KEY_generate_key(ec_params)) goto end;
|
||||
if (!EVP_PKEY_assign_EC_KEY(pkey, ec_params))
|
||||
goto end;
|
||||
ec_params = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
app_RAND_write_file(randfile, bio_err);
|
||||
|
||||
@@ -856,10 +788,6 @@ loop:
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
if (pkey->type == EVP_PKEY_DSA)
|
||||
digest=EVP_dss1();
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ECDSA
|
||||
if (pkey->type == EVP_PKEY_EC)
|
||||
digest=EVP_ecdsa();
|
||||
#endif
|
||||
if (req == NULL)
|
||||
{
|
||||
@@ -1053,9 +981,9 @@ loop:
|
||||
if (text)
|
||||
{
|
||||
if (x509)
|
||||
X509_print_ex(out, x509ss, nmflag, reqflag);
|
||||
X509_print(out,x509ss);
|
||||
else
|
||||
X509_REQ_print_ex(out, req, nmflag, reqflag);
|
||||
X509_REQ_print(out,req);
|
||||
}
|
||||
|
||||
if(subject)
|
||||
@@ -1125,10 +1053,6 @@ loop:
|
||||
}
|
||||
ex=0;
|
||||
end:
|
||||
#ifndef MONOLITH
|
||||
if(to_free)
|
||||
OPENSSL_free(to_free);
|
||||
#endif
|
||||
if (ex)
|
||||
{
|
||||
ERR_print_errors(bio_err);
|
||||
@@ -1145,12 +1069,9 @@ end:
|
||||
OBJ_cleanup();
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
if (dsa_params != NULL) DSA_free(dsa_params);
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ECDSA
|
||||
if (ec_params != NULL) EC_KEY_free(ec_params);
|
||||
#endif
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(ex);
|
||||
EXIT(ex);
|
||||
}
|
||||
|
||||
static int make_REQ(X509_REQ *req, EVP_PKEY *pkey, char *subj, int attribs,
|
||||
@@ -1291,19 +1212,13 @@ start: for (;;)
|
||||
}
|
||||
/* If OBJ not recognised ignore it */
|
||||
if ((nid=OBJ_txt2nid(type)) == NID_undef) goto start;
|
||||
|
||||
if(strlen(v->name) > sizeof buf-9)
|
||||
{
|
||||
BIO_printf(bio_err,"Name '%s' too long\n",v->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
sprintf(buf,"%s_default",v->name);
|
||||
if ((def=NCONF_get_string(req_conf,dn_sect,buf)) == NULL)
|
||||
{
|
||||
ERR_clear_error();
|
||||
def="";
|
||||
}
|
||||
|
||||
sprintf(buf,"%s_value",v->name);
|
||||
if ((value=NCONF_get_string(req_conf,dn_sect,buf)) == NULL)
|
||||
{
|
||||
@@ -1350,12 +1265,6 @@ start2: for (;;)
|
||||
if ((nid=OBJ_txt2nid(type)) == NID_undef)
|
||||
goto start2;
|
||||
|
||||
if(strlen(v->name) > sizeof buf-9)
|
||||
{
|
||||
BIO_printf(bio_err,"Name '%s' too long\n",v->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
sprintf(buf,"%s_default",type);
|
||||
if ((def=NCONF_get_string(req_conf,attr_sect,buf))
|
||||
== NULL)
|
||||
@@ -1459,7 +1368,6 @@ start:
|
||||
(void)BIO_flush(bio_err);
|
||||
if(value != NULL)
|
||||
{
|
||||
OPENSSL_assert(strlen(value) < sizeof buf-2);
|
||||
strcpy(buf,value);
|
||||
strcat(buf,"\n");
|
||||
BIO_printf(bio_err,"%s\n",value);
|
||||
@@ -1469,7 +1377,7 @@ start:
|
||||
buf[0]='\0';
|
||||
if (!batch)
|
||||
{
|
||||
fgets(buf,sizeof buf,stdin);
|
||||
fgets(buf,1024,stdin);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1518,7 +1426,6 @@ start:
|
||||
(void)BIO_flush(bio_err);
|
||||
if (value != NULL)
|
||||
{
|
||||
OPENSSL_assert(strlen(value) < sizeof buf-2);
|
||||
strcpy(buf,value);
|
||||
strcat(buf,"\n");
|
||||
BIO_printf(bio_err,"%s\n",value);
|
||||
@@ -1528,7 +1435,7 @@ start:
|
||||
buf[0]='\0';
|
||||
if (!batch)
|
||||
{
|
||||
fgets(buf,sizeof buf,stdin);
|
||||
fgets(buf,1024,stdin);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -238,12 +238,12 @@ bad:
|
||||
if (pubin)
|
||||
pkey = load_pubkey(bio_err, infile,
|
||||
(informat == FORMAT_NETSCAPE && sgckey ?
|
||||
FORMAT_IISSGC : informat), 1,
|
||||
FORMAT_IISSGC : informat),
|
||||
passin, e, "Public Key");
|
||||
else
|
||||
pkey = load_key(bio_err, infile,
|
||||
(informat == FORMAT_NETSCAPE && sgckey ?
|
||||
FORMAT_IISSGC : informat), 1,
|
||||
FORMAT_IISSGC : informat),
|
||||
passin, e, "Private Key");
|
||||
|
||||
if (pkey != NULL)
|
||||
@@ -369,7 +369,7 @@ end:
|
||||
if(passin) OPENSSL_free(passin);
|
||||
if(passout) OPENSSL_free(passout);
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(ret);
|
||||
EXIT(ret);
|
||||
}
|
||||
#else /* !OPENSSL_NO_RSA */
|
||||
|
||||
|
@@ -169,12 +169,12 @@ int MAIN(int argc, char **argv)
|
||||
|
||||
switch(key_type) {
|
||||
case KEY_PRIVKEY:
|
||||
pkey = load_key(bio_err, keyfile, keyform, 0,
|
||||
pkey = load_key(bio_err, keyfile, keyform,
|
||||
NULL, e, "Private Key");
|
||||
break;
|
||||
|
||||
case KEY_PUBKEY:
|
||||
pkey = load_pubkey(bio_err, keyfile, keyform, 0,
|
||||
pkey = load_pubkey(bio_err, keyfile, keyform,
|
||||
NULL, e, "Public Key");
|
||||
break;
|
||||
|
||||
|
@@ -134,7 +134,7 @@ int MS_CALLBACK verify_callback(int ok, X509_STORE_CTX *ctx)
|
||||
err= X509_STORE_CTX_get_error(ctx);
|
||||
depth= X509_STORE_CTX_get_error_depth(ctx);
|
||||
|
||||
X509_NAME_oneline(X509_get_subject_name(err_cert),buf,sizeof buf);
|
||||
X509_NAME_oneline(X509_get_subject_name(err_cert),buf,256);
|
||||
BIO_printf(bio_err,"depth=%d %s\n",depth,buf);
|
||||
if (!ok)
|
||||
{
|
||||
@@ -154,7 +154,7 @@ int MS_CALLBACK verify_callback(int ok, X509_STORE_CTX *ctx)
|
||||
switch (ctx->error)
|
||||
{
|
||||
case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT:
|
||||
X509_NAME_oneline(X509_get_issuer_name(ctx->current_cert),buf,sizeof buf);
|
||||
X509_NAME_oneline(X509_get_issuer_name(ctx->current_cert),buf,256);
|
||||
BIO_printf(bio_err,"issuer= %s\n",buf);
|
||||
break;
|
||||
case X509_V_ERR_CERT_NOT_YET_VALID:
|
||||
|
@@ -140,14 +140,6 @@ typedef unsigned int u_int;
|
||||
#include <conio.h>
|
||||
#endif
|
||||
|
||||
#ifdef OPENSSL_SYS_WINCE
|
||||
/* Windows CE incorrectly defines fileno as returning void*, so to avoid problems below... */
|
||||
#ifdef fileno
|
||||
#undef fileno
|
||||
#endif
|
||||
#define fileno(a) (int)_fileno(a)
|
||||
#endif
|
||||
|
||||
|
||||
#if (defined(OPENSSL_SYS_VMS) && __VMS_VER < 70000000)
|
||||
/* FIONBIO used as a switch to enable ioctl, and that isn't in VMS < 7.0 */
|
||||
@@ -441,11 +433,6 @@ bad:
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenSSL_add_ssl_algorithms();
|
||||
SSL_load_error_strings();
|
||||
|
||||
e = setup_engine(bio_err, engine_id, 1);
|
||||
|
||||
if (!app_RAND_load_file(NULL, bio_err, 1) && inrand == NULL
|
||||
&& !RAND_status())
|
||||
{
|
||||
@@ -468,6 +455,11 @@ bad:
|
||||
}
|
||||
}
|
||||
|
||||
OpenSSL_add_ssl_algorithms();
|
||||
SSL_load_error_strings();
|
||||
|
||||
e = setup_engine(bio_err, engine_id, 1);
|
||||
|
||||
ctx=SSL_CTX_new(meth);
|
||||
if (ctx == NULL)
|
||||
{
|
||||
@@ -670,11 +662,7 @@ re_start:
|
||||
tv.tv_usec = 0;
|
||||
i=select(width,(void *)&readfds,(void *)&writefds,
|
||||
NULL,&tv);
|
||||
#ifdef OPENSSL_SYS_WINCE
|
||||
if(!i && (!_kbhit() || !read_tty) ) continue;
|
||||
#else
|
||||
if(!i && (!((_kbhit()) || (WAIT_OBJECT_0 == WaitForSingleObject(GetStdHandle(STD_INPUT_HANDLE), 0))) || !read_tty) ) continue;
|
||||
#endif
|
||||
} else i=select(width,(void *)&readfds,(void *)&writefds,
|
||||
NULL,NULL);
|
||||
}
|
||||
@@ -758,8 +746,8 @@ re_start:
|
||||
goto shut;
|
||||
}
|
||||
}
|
||||
#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS)
|
||||
/* Assume Windows/DOS can always write */
|
||||
#ifdef OPENSSL_SYS_WINDOWS
|
||||
/* Assume Windows can always write */
|
||||
else if (!ssl_pending && write_tty)
|
||||
#else
|
||||
else if (!ssl_pending && FD_ISSET(fileno(stdout),&writefds))
|
||||
@@ -840,11 +828,7 @@ printf("read=%d pending=%d peek=%d\n",k,SSL_pending(con),SSL_peek(con,zbuf,10240
|
||||
}
|
||||
|
||||
#ifdef OPENSSL_SYS_WINDOWS
|
||||
#ifdef OPENSSL_SYS_WINCE
|
||||
else if (_kbhit())
|
||||
#else
|
||||
else if ((_kbhit()) || (WAIT_OBJECT_0 == WaitForSingleObject(GetStdHandle(STD_INPUT_HANDLE), 0)))
|
||||
#endif
|
||||
#else
|
||||
else if (FD_ISSET(fileno(stdin),&readfds))
|
||||
#endif
|
||||
@@ -908,16 +892,16 @@ end:
|
||||
if (con != NULL) SSL_free(con);
|
||||
if (con2 != NULL) SSL_free(con2);
|
||||
if (ctx != NULL) SSL_CTX_free(ctx);
|
||||
if (cbuf != NULL) { OPENSSL_cleanse(cbuf,BUFSIZZ); OPENSSL_free(cbuf); }
|
||||
if (sbuf != NULL) { OPENSSL_cleanse(sbuf,BUFSIZZ); OPENSSL_free(sbuf); }
|
||||
if (mbuf != NULL) { OPENSSL_cleanse(mbuf,BUFSIZZ); OPENSSL_free(mbuf); }
|
||||
if (cbuf != NULL) { memset(cbuf,0,BUFSIZZ); OPENSSL_free(cbuf); }
|
||||
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)
|
||||
{
|
||||
BIO_free(bio_c_out);
|
||||
bio_c_out=NULL;
|
||||
}
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(ret);
|
||||
EXIT(ret);
|
||||
}
|
||||
|
||||
|
||||
@@ -946,10 +930,10 @@ static void print_stuff(BIO *bio, SSL *s, int full)
|
||||
for (i=0; i<sk_X509_num(sk); i++)
|
||||
{
|
||||
X509_NAME_oneline(X509_get_subject_name(
|
||||
sk_X509_value(sk,i)),buf,sizeof buf);
|
||||
sk_X509_value(sk,i)),buf,BUFSIZ);
|
||||
BIO_printf(bio,"%2d s:%s\n",i,buf);
|
||||
X509_NAME_oneline(X509_get_issuer_name(
|
||||
sk_X509_value(sk,i)),buf,sizeof buf);
|
||||
sk_X509_value(sk,i)),buf,BUFSIZ);
|
||||
BIO_printf(bio," i:%s\n",buf);
|
||||
if (c_showcerts)
|
||||
PEM_write_bio_X509(bio,sk_X509_value(sk,i));
|
||||
@@ -964,10 +948,10 @@ static void print_stuff(BIO *bio, SSL *s, int full)
|
||||
if (!(c_showcerts && got_a_chain)) /* Redundant if we showed the whole chain */
|
||||
PEM_write_bio_X509(bio,peer);
|
||||
X509_NAME_oneline(X509_get_subject_name(peer),
|
||||
buf,sizeof buf);
|
||||
buf,BUFSIZ);
|
||||
BIO_printf(bio,"subject=%s\n",buf);
|
||||
X509_NAME_oneline(X509_get_issuer_name(peer),
|
||||
buf,sizeof buf);
|
||||
buf,BUFSIZ);
|
||||
BIO_printf(bio,"issuer=%s\n",buf);
|
||||
}
|
||||
else
|
||||
@@ -989,7 +973,7 @@ static void print_stuff(BIO *bio, SSL *s, int full)
|
||||
{
|
||||
BIO_printf(bio,"---\nNo client certificate CA names sent\n");
|
||||
}
|
||||
p=SSL_get_shared_ciphers(s,buf,sizeof buf);
|
||||
p=SSL_get_shared_ciphers(s,buf,BUFSIZ);
|
||||
if (p != NULL)
|
||||
{
|
||||
/* This works only for SSL 2. In later protocol
|
||||
|
126
apps/s_server.c
126
apps/s_server.c
@@ -108,11 +108,6 @@
|
||||
* Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
*/
|
||||
/* ====================================================================
|
||||
* Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
|
||||
* ECC cipher suite support in OpenSSL originally developed by
|
||||
* SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
@@ -149,14 +144,6 @@ typedef unsigned int u_int;
|
||||
#include <conio.h>
|
||||
#endif
|
||||
|
||||
#ifdef OPENSSL_SYS_WINCE
|
||||
/* Windows CE incorrectly defines fileno as returning void*, so to avoid problems below... */
|
||||
#ifdef fileno
|
||||
#undef fileno
|
||||
#endif
|
||||
#define fileno(a) (int)_fileno(a)
|
||||
#endif
|
||||
|
||||
#if (defined(OPENSSL_SYS_VMS) && __VMS_VER < 70000000)
|
||||
/* FIONBIO used as a switch to enable ioctl, and that isn't in VMS < 7.0 */
|
||||
#undef FIONBIO
|
||||
@@ -177,7 +164,6 @@ static int generate_session_id(const SSL *ssl, unsigned char *id,
|
||||
static DH *load_dh_param(char *dhfile);
|
||||
static DH *get_dh512(void);
|
||||
#endif
|
||||
|
||||
#ifdef MONOLITH
|
||||
static void s_server_init(void);
|
||||
#endif
|
||||
@@ -216,7 +202,6 @@ static DH *get_dh512(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* static int load_CA(SSL_CTX *ctx, char *file);*/
|
||||
|
||||
#undef BUFSIZZ
|
||||
@@ -294,11 +279,6 @@ static void sv_usage(void)
|
||||
BIO_printf(bio_err," -dkey arg - second private key file to use (usually for DSA)\n");
|
||||
BIO_printf(bio_err," -dhparam arg - DH parameter file to use, in cert file if not specified\n");
|
||||
BIO_printf(bio_err," or a default set of parameters is used\n");
|
||||
#ifndef OPENSSL_NO_ECDH
|
||||
BIO_printf(bio_err," -named_curve arg - Elliptic curve name to use for ephemeral ECDH keys.\n" \
|
||||
" Use \"openssl ecparam -list_curves\" for all names\n" \
|
||||
" (default is sect163r2).\n");
|
||||
#endif
|
||||
#ifdef FIONBIO
|
||||
BIO_printf(bio_err," -nbio - Run with non-blocking IO\n");
|
||||
#endif
|
||||
@@ -322,9 +302,6 @@ static void sv_usage(void)
|
||||
BIO_printf(bio_err," -no_tls1 - Just disable TLSv1\n");
|
||||
#ifndef OPENSSL_NO_DH
|
||||
BIO_printf(bio_err," -no_dhe - Disable ephemeral DH\n");
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ECDH
|
||||
BIO_printf(bio_err," -no_ecdhe - Disable ephemeral ECDH\n");
|
||||
#endif
|
||||
BIO_printf(bio_err," -bugs - Turn on SSL bug compatibility\n");
|
||||
BIO_printf(bio_err," -www - Respond to a 'GET /' with a status page\n");
|
||||
@@ -343,10 +320,10 @@ static char **local_argv;
|
||||
static int ebcdic_new(BIO *bi);
|
||||
static int ebcdic_free(BIO *a);
|
||||
static int ebcdic_read(BIO *b, char *out, int outl);
|
||||
static int ebcdic_write(BIO *b, const char *in, int inl);
|
||||
static long ebcdic_ctrl(BIO *b, int cmd, long num, void *ptr);
|
||||
static int ebcdic_write(BIO *b, char *in, int inl);
|
||||
static long ebcdic_ctrl(BIO *b, int cmd, long num, char *ptr);
|
||||
static int ebcdic_gets(BIO *bp, char *buf, int size);
|
||||
static int ebcdic_puts(BIO *bp, const char *str);
|
||||
static int ebcdic_puts(BIO *bp, char *str);
|
||||
|
||||
#define BIO_TYPE_EBCDIC_FILTER (18|0x0200)
|
||||
static BIO_METHOD methods_ebcdic=
|
||||
@@ -411,7 +388,7 @@ static int ebcdic_read(BIO *b, char *out, int outl)
|
||||
return(ret);
|
||||
}
|
||||
|
||||
static int ebcdic_write(BIO *b, const char *in, int inl)
|
||||
static int ebcdic_write(BIO *b, char *in, int inl)
|
||||
{
|
||||
EBCDIC_OUTBUFF *wbuf;
|
||||
int ret=0;
|
||||
@@ -444,7 +421,7 @@ static int ebcdic_write(BIO *b, const char *in, int inl)
|
||||
return(ret);
|
||||
}
|
||||
|
||||
static long ebcdic_ctrl(BIO *b, int cmd, long num, void *ptr)
|
||||
static long ebcdic_ctrl(BIO *b, int cmd, long num, char *ptr)
|
||||
{
|
||||
long ret;
|
||||
|
||||
@@ -463,7 +440,7 @@ static long ebcdic_ctrl(BIO *b, int cmd, long num, void *ptr)
|
||||
|
||||
static int ebcdic_gets(BIO *bp, char *buf, int size)
|
||||
{
|
||||
int i, ret=0;
|
||||
int i, ret;
|
||||
if (bp->next_bio == NULL) return(0);
|
||||
/* return(BIO_gets(bp->next_bio,buf,size));*/
|
||||
for (i=0; i<size-1; ++i)
|
||||
@@ -482,7 +459,7 @@ static int ebcdic_gets(BIO *bp, char *buf, int size)
|
||||
return (ret < 0 && i == 0) ? ret : i;
|
||||
}
|
||||
|
||||
static int ebcdic_puts(BIO *bp, const char *str)
|
||||
static int ebcdic_puts(BIO *bp, char *str)
|
||||
{
|
||||
if (bp->next_bio == NULL) return(0);
|
||||
return ebcdic_write(bp, str, strlen(str));
|
||||
@@ -499,11 +476,10 @@ int MAIN(int argc, char *argv[])
|
||||
char *CApath=NULL,*CAfile=NULL;
|
||||
char *context = NULL;
|
||||
char *dhfile = NULL;
|
||||
char *named_curve = NULL;
|
||||
int badop=0,bugs=0;
|
||||
int ret=1;
|
||||
int off=0;
|
||||
int no_tmp_rsa=0,no_dhe=0,no_ecdhe=0,nocert=0;
|
||||
int no_tmp_rsa=0,no_dhe=0,nocert=0;
|
||||
int state=0;
|
||||
SSL_METHOD *meth=NULL;
|
||||
ENGINE *e=NULL;
|
||||
@@ -584,13 +560,6 @@ int MAIN(int argc, char *argv[])
|
||||
if (--argc < 1) goto bad;
|
||||
dhfile = *(++argv);
|
||||
}
|
||||
#ifndef OPENSSL_NO_ECDH
|
||||
else if (strcmp(*argv,"-named_curve") == 0)
|
||||
{
|
||||
if (--argc < 1) goto bad;
|
||||
named_curve = *(++argv);
|
||||
}
|
||||
#endif
|
||||
else if (strcmp(*argv,"-dcert") == 0)
|
||||
{
|
||||
if (--argc < 1) goto bad;
|
||||
@@ -659,8 +628,6 @@ int MAIN(int argc, char *argv[])
|
||||
{ no_tmp_rsa=1; }
|
||||
else if (strcmp(*argv,"-no_dhe") == 0)
|
||||
{ no_dhe=1; }
|
||||
else if (strcmp(*argv,"-no_ecdhe") == 0)
|
||||
{ no_ecdhe=1; }
|
||||
else if (strcmp(*argv,"-www") == 0)
|
||||
{ www=1; }
|
||||
else if (strcmp(*argv,"-WWW") == 0)
|
||||
@@ -716,11 +683,6 @@ bad:
|
||||
goto end;
|
||||
}
|
||||
|
||||
SSL_load_error_strings();
|
||||
OpenSSL_add_ssl_algorithms();
|
||||
|
||||
e = setup_engine(bio_err, engine_id, 1);
|
||||
|
||||
if (!app_RAND_load_file(NULL, bio_err, 1) && inrand == NULL
|
||||
&& !RAND_status())
|
||||
{
|
||||
@@ -743,7 +705,7 @@ bad:
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(OPENSSL_NO_RSA) || !defined(OPENSSL_NO_DSA) || !defined(OPENSSL_NO_ECDSA)
|
||||
#if !defined(OPENSSL_NO_RSA) || !defined(OPENSSL_NO_DSA)
|
||||
if (nocert)
|
||||
#endif
|
||||
{
|
||||
@@ -753,6 +715,11 @@ bad:
|
||||
s_dkey_file=NULL;
|
||||
}
|
||||
|
||||
SSL_load_error_strings();
|
||||
OpenSSL_add_ssl_algorithms();
|
||||
|
||||
e = setup_engine(bio_err, engine_id, 1);
|
||||
|
||||
ctx=SSL_CTX_new(meth);
|
||||
if (ctx == NULL)
|
||||
{
|
||||
@@ -831,59 +798,6 @@ bad:
|
||||
DH_free(dh);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef OPENSSL_NO_ECDH
|
||||
if (!no_ecdhe)
|
||||
{
|
||||
EC_KEY *ecdh=NULL;
|
||||
|
||||
ecdh = EC_KEY_new();
|
||||
if (ecdh == NULL)
|
||||
{
|
||||
BIO_printf(bio_err,"Could not create ECDH struct.\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (named_curve)
|
||||
{
|
||||
int nid = OBJ_sn2nid(named_curve);
|
||||
|
||||
if (nid == 0)
|
||||
{
|
||||
BIO_printf(bio_err, "unknown curve name (%s)\n",
|
||||
named_curve);
|
||||
goto end;
|
||||
}
|
||||
|
||||
ecdh->group = EC_GROUP_new_by_nid(nid);
|
||||
if (ecdh->group == NULL)
|
||||
{
|
||||
BIO_printf(bio_err, "unable to create curve (%s)\n",
|
||||
named_curve);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (ecdh->group != NULL)
|
||||
{
|
||||
BIO_printf(bio_s_out,"Setting temp ECDH parameters\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
BIO_printf(bio_s_out,"Using default temp ECDH parameters\n");
|
||||
ecdh->group=EC_GROUP_new_by_nid(NID_sect163r2);
|
||||
if (ecdh->group == NULL)
|
||||
{
|
||||
BIO_printf(bio_err, "unable to create curve (sect163r2)\n");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
(void)BIO_flush(bio_s_out);
|
||||
|
||||
SSL_CTX_set_tmp_ecdh(ctx,ecdh);
|
||||
EC_KEY_free(ecdh);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!set_cert_stuff(ctx,s_cert_file,s_key_file))
|
||||
goto end;
|
||||
@@ -946,7 +860,7 @@ end:
|
||||
bio_s_out=NULL;
|
||||
}
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(ret);
|
||||
EXIT(ret);
|
||||
}
|
||||
|
||||
static void print_stats(BIO *bio, SSL_CTX *ssl_ctx)
|
||||
@@ -1262,7 +1176,7 @@ err:
|
||||
BIO_printf(bio_s_out,"CONNECTION CLOSED\n");
|
||||
if (buf != NULL)
|
||||
{
|
||||
OPENSSL_cleanse(buf,bufsize);
|
||||
memset(buf,0,bufsize);
|
||||
OPENSSL_free(buf);
|
||||
}
|
||||
if (ret >= 0)
|
||||
@@ -1314,14 +1228,14 @@ static int init_ssl_connection(SSL *con)
|
||||
{
|
||||
BIO_printf(bio_s_out,"Client certificate\n");
|
||||
PEM_write_bio_X509(bio_s_out,peer);
|
||||
X509_NAME_oneline(X509_get_subject_name(peer),buf,sizeof buf);
|
||||
X509_NAME_oneline(X509_get_subject_name(peer),buf,BUFSIZ);
|
||||
BIO_printf(bio_s_out,"subject=%s\n",buf);
|
||||
X509_NAME_oneline(X509_get_issuer_name(peer),buf,sizeof buf);
|
||||
X509_NAME_oneline(X509_get_issuer_name(peer),buf,BUFSIZ);
|
||||
BIO_printf(bio_s_out,"issuer=%s\n",buf);
|
||||
X509_free(peer);
|
||||
}
|
||||
|
||||
if (SSL_get_shared_ciphers(con,buf,sizeof buf) != NULL)
|
||||
if (SSL_get_shared_ciphers(con,buf,BUFSIZ) != NULL)
|
||||
BIO_printf(bio_s_out,"Shared ciphers:%s\n",buf);
|
||||
str=SSL_CIPHER_get_name(SSL_get_current_cipher(con));
|
||||
BIO_printf(bio_s_out,"CIPHER is %s\n",(str != NULL)?str:"(NONE)");
|
||||
@@ -1481,7 +1395,7 @@ static int www_body(char *hostname, int s, unsigned char *context)
|
||||
else
|
||||
{
|
||||
BIO_printf(bio_s_out,"read R BLOCK\n");
|
||||
#if !defined(OPENSSL_SYS_MSDOS) && !defined(__DJGPP__)
|
||||
#ifndef OPENSSL_SYS_MSDOS
|
||||
sleep(1);
|
||||
#endif
|
||||
continue;
|
||||
|
@@ -62,6 +62,8 @@
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include <openssl/e_os2.h>
|
||||
|
||||
/* With IPv6, it looks like Digital has mixed up the proper order of
|
||||
recursive header file inclusion, resulting in the compiler complaining
|
||||
that u_int isn't defined, but only if _POSIX_C_SOURCE is defined, which
|
||||
@@ -79,19 +81,11 @@ typedef unsigned int u_int;
|
||||
#include "s_apps.h"
|
||||
#include <openssl/ssl.h>
|
||||
|
||||
#ifdef FLAT_INC
|
||||
#include "e_os.h"
|
||||
#else
|
||||
#include "../e_os.h"
|
||||
#endif
|
||||
|
||||
#ifndef OPENSSL_NO_SOCK
|
||||
|
||||
static struct hostent *GetHostByName(char *name);
|
||||
#ifdef OPENSSL_SYS_WINDOWS
|
||||
static void ssl_sock_cleanup(void);
|
||||
static void sock_cleanup(void);
|
||||
#endif
|
||||
static int ssl_sock_init(void);
|
||||
static int sock_init(void);
|
||||
static int init_client_ip(int *sock,unsigned char ip[4], int port);
|
||||
static int init_server(int *sock, int port);
|
||||
static int init_server_long(int *sock, int port,char *ip);
|
||||
@@ -124,7 +118,7 @@ static LONG FAR PASCAL topHookProc(HWND hwnd, UINT message, WPARAM wParam,
|
||||
case WM_DESTROY:
|
||||
case WM_CLOSE:
|
||||
SetWindowLong(topWnd,GWL_WNDPROC,(LONG)lpTopWndProc);
|
||||
ssl_sock_cleanup();
|
||||
sock_cleanup();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -141,34 +135,26 @@ static BOOL CALLBACK enumproc(HWND hwnd,LPARAM lParam)
|
||||
#endif /* OPENSSL_SYS_WINDOWS */
|
||||
|
||||
#ifdef OPENSSL_SYS_WINDOWS
|
||||
static void ssl_sock_cleanup(void)
|
||||
static void sock_cleanup(void)
|
||||
{
|
||||
if (wsa_init_done)
|
||||
{
|
||||
wsa_init_done=0;
|
||||
#ifndef OPENSSL_SYS_WINCE
|
||||
WSACancelBlockingCall();
|
||||
#endif
|
||||
WSACleanup();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static int ssl_sock_init(void)
|
||||
static int sock_init(void)
|
||||
{
|
||||
#ifdef WATT32
|
||||
extern int _watt_do_exit;
|
||||
_watt_do_exit = 0;
|
||||
dbug_init();
|
||||
if (sock_init())
|
||||
return (0);
|
||||
#elif defined(OPENSSL_SYS_WINDOWS)
|
||||
#ifdef OPENSSL_SYS_WINDOWS
|
||||
if (!wsa_init_done)
|
||||
{
|
||||
int err;
|
||||
|
||||
#ifdef SIGINT
|
||||
signal(SIGINT,(void (*)(int))ssl_sock_cleanup);
|
||||
signal(SIGINT,(void (*)(int))sock_cleanup);
|
||||
#endif
|
||||
wsa_init_done=1;
|
||||
memset(&wsa_state,0,sizeof(wsa_state));
|
||||
@@ -210,7 +196,7 @@ static int init_client_ip(int *sock, unsigned char ip[4], int port)
|
||||
struct sockaddr_in them;
|
||||
int s,i;
|
||||
|
||||
if (!ssl_sock_init()) return(0);
|
||||
if (!sock_init()) return(0);
|
||||
|
||||
memset((char *)&them,0,sizeof(them));
|
||||
them.sin_family=AF_INET;
|
||||
@@ -275,7 +261,7 @@ static int init_server_long(int *sock, int port, char *ip)
|
||||
struct sockaddr_in server;
|
||||
int s= -1,i;
|
||||
|
||||
if (!ssl_sock_init()) return(0);
|
||||
if (!sock_init()) return(0);
|
||||
|
||||
memset((char *)&server,0,sizeof(server));
|
||||
server.sin_family=AF_INET;
|
||||
@@ -332,7 +318,7 @@ static int do_accept(int acc_sock, int *sock, char **host)
|
||||
int len;
|
||||
/* struct linger ling; */
|
||||
|
||||
if (!ssl_sock_init()) return(0);
|
||||
if (!sock_init()) return(0);
|
||||
|
||||
#ifndef OPENSSL_SYS_WINDOWS
|
||||
redoit:
|
||||
@@ -462,7 +448,7 @@ static int host_ip(char *str, unsigned char ip[4])
|
||||
{ /* do a gethostbyname */
|
||||
struct hostent *he;
|
||||
|
||||
if (!ssl_sock_init()) return(0);
|
||||
if (!sock_init()) return(0);
|
||||
|
||||
he=GetHostByName(str);
|
||||
if (he == NULL)
|
||||
@@ -543,12 +529,9 @@ static struct hostent *GetHostByName(char *name)
|
||||
ret=gethostbyname(name);
|
||||
if (ret == NULL) return(NULL);
|
||||
/* else add to cache */
|
||||
if(strlen(name) < sizeof ghbn_cache[0].name)
|
||||
{
|
||||
strcpy(ghbn_cache[lowi].name,name);
|
||||
memcpy((char *)&(ghbn_cache[lowi].ent),ret,sizeof(struct hostent));
|
||||
ghbn_cache[lowi].order=ghbn_miss+ghbn_hits;
|
||||
}
|
||||
strncpy(ghbn_cache[lowi].name,name,128);
|
||||
memcpy((char *)&(ghbn_cache[lowi].ent),ret,sizeof(struct hostent));
|
||||
ghbn_cache[lowi].order=ghbn_miss+ghbn_hits;
|
||||
return(ret);
|
||||
}
|
||||
else
|
||||
@@ -559,5 +542,3 @@ static struct hostent *GetHostByName(char *name)
|
||||
return(ret);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -85,7 +85,7 @@
|
||||
#include OPENSSL_UNISTD
|
||||
#endif
|
||||
|
||||
#if !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_VXWORKS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC))
|
||||
#if !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_VXWORKS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX)
|
||||
#define TIMES
|
||||
#endif
|
||||
|
||||
@@ -109,6 +109,10 @@
|
||||
#include <sys/timeb.h>
|
||||
#endif
|
||||
|
||||
#ifdef _AIX
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
|
||||
#if defined(sun) || defined(__ultrix)
|
||||
#define _POSIX_SOURCE
|
||||
#include <limits.h>
|
||||
@@ -146,8 +150,6 @@
|
||||
#undef BUFSIZZ
|
||||
#define BUFSIZZ 1024*10
|
||||
|
||||
#define MYBUFSIZ 1024*8
|
||||
|
||||
#undef min
|
||||
#undef max
|
||||
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
||||
@@ -322,11 +324,6 @@ static int parseArgs(int argc, char **argv)
|
||||
{
|
||||
if (--argc < 1) goto bad;
|
||||
s_www_path= *(++argv);
|
||||
if(strlen(s_www_path) > MYBUFSIZ-100)
|
||||
{
|
||||
BIO_printf(bio_err,"-www option too long\n");
|
||||
badop=1;
|
||||
}
|
||||
}
|
||||
else if(strcmp(*argv,"-bugs") == 0)
|
||||
st_bugs=1;
|
||||
@@ -487,7 +484,7 @@ int MAIN(int argc, char **argv)
|
||||
tm_Time_F(START);
|
||||
for (;;)
|
||||
{
|
||||
if (finishtime < (long)time(NULL)) break;
|
||||
if (finishtime < time(NULL)) break;
|
||||
#ifdef WIN32_STUFF
|
||||
|
||||
if( flushWinMsgs(0) == -1 )
|
||||
@@ -538,9 +535,9 @@ int MAIN(int argc, char **argv)
|
||||
}
|
||||
totalTime += tm_Time_F(STOP); /* Add the time for this iteration */
|
||||
|
||||
i=(int)((long)time(NULL)-finishtime+maxTime);
|
||||
i=(int)(time(NULL)-finishtime+maxTime);
|
||||
printf( "\n\n%d connections in %.2fs; %.2f connections/user sec, bytes read %ld\n", nConn, totalTime, ((double)nConn/totalTime),bytes_read);
|
||||
printf( "%d connections in %ld real seconds, %ld bytes read per connection\n",nConn,(long)time(NULL)-finishtime+maxTime,bytes_read/nConn);
|
||||
printf( "%d connections in %ld real seconds, %ld bytes read per connection\n",nConn,time(NULL)-finishtime+maxTime,bytes_read/nConn);
|
||||
|
||||
/* Now loop and time connections using the same session id over and over */
|
||||
|
||||
@@ -572,7 +569,7 @@ next:
|
||||
nConn = 0;
|
||||
totalTime = 0.0;
|
||||
|
||||
finishtime=(long)time(NULL)+maxTime;
|
||||
finishtime=time(NULL)+maxTime;
|
||||
|
||||
printf( "starting\n" );
|
||||
bytes_read=0;
|
||||
@@ -580,7 +577,7 @@ next:
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if (finishtime < (long)time(NULL)) break;
|
||||
if (finishtime < time(NULL)) break;
|
||||
|
||||
#ifdef WIN32_STUFF
|
||||
if( flushWinMsgs(0) == -1 )
|
||||
@@ -630,7 +627,7 @@ next:
|
||||
|
||||
|
||||
printf( "\n\n%d connections in %.2fs; %.2f connections/user sec, bytes read %ld\n", nConn, totalTime, ((double)nConn/totalTime),bytes_read);
|
||||
printf( "%d connections in %ld real seconds, %ld bytes read per connection\n",nConn,(long)time(NULL)-finishtime+maxTime,bytes_read/nConn);
|
||||
printf( "%d connections in %ld real seconds, %ld bytes read per connection\n",nConn,time(NULL)-finishtime+maxTime,bytes_read/nConn);
|
||||
|
||||
ret=0;
|
||||
end:
|
||||
@@ -642,7 +639,7 @@ end:
|
||||
tm_ctx=NULL;
|
||||
}
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(ret);
|
||||
EXIT(ret);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@@ -273,7 +273,7 @@ end:
|
||||
if (out != NULL) BIO_free_all(out);
|
||||
if (x != NULL) SSL_SESSION_free(x);
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(ret);
|
||||
EXIT(ret);
|
||||
}
|
||||
|
||||
static SSL_SESSION *load_sess_id(char *infile, int format)
|
||||
|
@@ -428,7 +428,7 @@ int MAIN(int argc, char **argv)
|
||||
} else keyfile = NULL;
|
||||
|
||||
if(keyfile) {
|
||||
key = load_key(bio_err, keyfile, keyform, 0, passin, e,
|
||||
key = load_key(bio_err, keyfile, keyform, passin, e,
|
||||
"signing key file");
|
||||
if (!key) {
|
||||
goto end;
|
||||
|
639
apps/speed.c
639
apps/speed.c
@@ -55,19 +55,6 @@
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
/* ====================================================================
|
||||
* Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
|
||||
*
|
||||
* Portions of the attached software ("Contribution") are developed by
|
||||
* SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project.
|
||||
*
|
||||
* The Contribution is licensed pursuant to the OpenSSL open source
|
||||
* license provided above.
|
||||
*
|
||||
* The ECDH and ECDSA speed test software is originally written by
|
||||
* Sumit Gupta of Sun Microsystems Laboratories.
|
||||
*
|
||||
*/
|
||||
|
||||
/* most of this code has been pilfered from my libdes speed.c program */
|
||||
|
||||
@@ -75,8 +62,6 @@
|
||||
#define SECONDS 3
|
||||
#define RSA_SECONDS 10
|
||||
#define DSA_SECONDS 10
|
||||
#define ECDSA_SECONDS 10
|
||||
#define ECDH_SECONDS 10
|
||||
|
||||
/* 11-Sep-92 Andrew Daviel Support for Silicon Graphics IRIX added */
|
||||
/* 06-Apr-92 Luke Brennan Support for VMS and add extra signal calls */
|
||||
@@ -199,17 +184,10 @@
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
#include "./testdsa.h"
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ECDSA
|
||||
#include <openssl/ecdsa.h>
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ECDH
|
||||
#include <openssl/ecdh.h>
|
||||
#endif
|
||||
|
||||
/* The following if from times(3) man page. It may need to be changed */
|
||||
#ifndef HZ
|
||||
# if defined(_SC_CLK_TCK) \
|
||||
&& (!defined(OPENSSL_SYS_VMS) || __CTRL_VER >= 70000000)
|
||||
# ifdef _SC_CLK_TCK
|
||||
# define HZ ((double)sysconf(_SC_CLK_TCK))
|
||||
# else
|
||||
# ifndef CLK_TCK
|
||||
@@ -248,10 +226,6 @@ static int do_multi(int multi);
|
||||
#define SIZE_NUM 5
|
||||
#define RSA_NUM 4
|
||||
#define DSA_NUM 3
|
||||
|
||||
#define EC_NUM 16
|
||||
#define MAX_ECDH_SIZE 256
|
||||
|
||||
static const char *names[ALGOR_NUM]={
|
||||
"md2","mdc2","md4","md5","hmac(md5)","sha1","rmd160","rc4",
|
||||
"des cbc","des ede3","idea cbc",
|
||||
@@ -261,9 +235,6 @@ static double results[ALGOR_NUM][SIZE_NUM];
|
||||
static int lengths[SIZE_NUM]={16,64,256,1024,8*1024};
|
||||
static double rsa_results[RSA_NUM][2];
|
||||
static double dsa_results[DSA_NUM][2];
|
||||
static double ecdsa_results[EC_NUM][2];
|
||||
static double ecdh_results[EC_NUM][1];
|
||||
|
||||
|
||||
#ifdef SIGALRM
|
||||
#if defined(__STDC__) || defined(sgi) || defined(_AIX)
|
||||
@@ -506,24 +477,6 @@ int MAIN(int argc, char **argv)
|
||||
#define R_RSA_1024 1
|
||||
#define R_RSA_2048 2
|
||||
#define R_RSA_4096 3
|
||||
|
||||
#define R_EC_P160 0
|
||||
#define R_EC_P192 1
|
||||
#define R_EC_P224 2
|
||||
#define R_EC_P256 3
|
||||
#define R_EC_P384 4
|
||||
#define R_EC_P521 5
|
||||
#define R_EC_K163 6
|
||||
#define R_EC_K233 7
|
||||
#define R_EC_K283 8
|
||||
#define R_EC_K409 9
|
||||
#define R_EC_K571 10
|
||||
#define R_EC_B163 11
|
||||
#define R_EC_B233 12
|
||||
#define R_EC_B283 13
|
||||
#define R_EC_B409 14
|
||||
#define R_EC_B571 15
|
||||
|
||||
#ifndef OPENSSL_NO_RSA
|
||||
RSA *rsa_key[RSA_NUM];
|
||||
long rsa_c[RSA_NUM][2];
|
||||
@@ -539,83 +492,8 @@ int MAIN(int argc, char **argv)
|
||||
long dsa_c[DSA_NUM][2];
|
||||
static unsigned int dsa_bits[DSA_NUM]={512,1024,2048};
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_EC
|
||||
/* We only test over the following curves as they are representative,
|
||||
* To add tests over more curves, simply add the curve NID
|
||||
* and curve name to the following arrays and increase the
|
||||
* EC_NUM value accordingly.
|
||||
*/
|
||||
static unsigned int test_curves[EC_NUM] =
|
||||
{
|
||||
/* Prime Curves */
|
||||
NID_secp160r1,
|
||||
NID_X9_62_prime192v1,
|
||||
NID_secp224r1,
|
||||
NID_X9_62_prime256v1,
|
||||
NID_secp384r1,
|
||||
NID_secp521r1,
|
||||
/* Binary Curves */
|
||||
NID_sect163k1,
|
||||
NID_sect233k1,
|
||||
NID_sect283k1,
|
||||
NID_sect409k1,
|
||||
NID_sect571k1,
|
||||
NID_sect163r2,
|
||||
NID_sect233r1,
|
||||
NID_sect283r1,
|
||||
NID_sect409r1,
|
||||
NID_sect571r1
|
||||
};
|
||||
static char * test_curves_names[EC_NUM] =
|
||||
{
|
||||
/* Prime Curves */
|
||||
"secp160r1",
|
||||
"nistp192",
|
||||
"nistp224",
|
||||
"nistp256",
|
||||
"nistp384",
|
||||
"nistp521",
|
||||
/* Binary Curves */
|
||||
"nistk163",
|
||||
"nistk233",
|
||||
"nistk283",
|
||||
"nistk409",
|
||||
"nistk571",
|
||||
"nistb163",
|
||||
"nistb233",
|
||||
"nistb283",
|
||||
"nistb409",
|
||||
"nistb571"
|
||||
};
|
||||
static int test_curves_bits[EC_NUM] =
|
||||
{
|
||||
160, 192, 224, 256, 384, 521,
|
||||
163, 233, 283, 409, 571,
|
||||
163, 233, 283, 409, 571
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef OPENSSL_NO_ECDSA
|
||||
unsigned char ecdsasig[256];
|
||||
unsigned int ecdsasiglen;
|
||||
EC_KEY *ecdsa[EC_NUM];
|
||||
long ecdsa_c[EC_NUM][2];
|
||||
#endif
|
||||
|
||||
#ifndef OPENSSL_NO_ECDH
|
||||
EC_KEY *ecdh_a[EC_NUM], *ecdh_b[EC_NUM];
|
||||
unsigned char secret_a[MAX_ECDH_SIZE], secret_b[MAX_ECDH_SIZE];
|
||||
int secret_size_a, secret_size_b;
|
||||
int ecdh_checks = 0;
|
||||
int secret_idx = 0;
|
||||
long ecdh_c[EC_NUM][2];
|
||||
#endif
|
||||
|
||||
int rsa_doit[RSA_NUM];
|
||||
int dsa_doit[DSA_NUM];
|
||||
int ecdsa_doit[EC_NUM];
|
||||
int ecdh_doit[EC_NUM];
|
||||
int doit[ALGOR_NUM];
|
||||
int pr_header=0;
|
||||
const EVP_CIPHER *evp_cipher=NULL;
|
||||
@@ -634,17 +512,6 @@ int MAIN(int argc, char **argv)
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
memset(dsa_key,0,sizeof(dsa_key));
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ECDSA
|
||||
for (i=0; i<EC_NUM; i++) ecdsa[i] = NULL;
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ECDH
|
||||
for (i=0; i<EC_NUM; i++)
|
||||
{
|
||||
ecdh_a[i] = NULL;
|
||||
ecdh_b[i] = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
if (bio_err == NULL)
|
||||
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
|
||||
@@ -683,15 +550,6 @@ int MAIN(int argc, char **argv)
|
||||
rsa_doit[i]=0;
|
||||
for (i=0; i<DSA_NUM; i++)
|
||||
dsa_doit[i]=0;
|
||||
#ifndef OPENSSL_NO_ECDSA
|
||||
for (i=0; i<EC_NUM; i++)
|
||||
ecdsa_doit[i]=0;
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ECDH
|
||||
for (i=0; i<EC_NUM; i++)
|
||||
ecdh_doit[i]=0;
|
||||
#endif
|
||||
|
||||
|
||||
j=0;
|
||||
argc--;
|
||||
@@ -910,52 +768,6 @@ int MAIN(int argc, char **argv)
|
||||
dsa_doit[R_DSA_1024]=1;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ECDSA
|
||||
if (strcmp(*argv,"ecdsap160") == 0) ecdsa_doit[R_EC_P160]=2;
|
||||
else if (strcmp(*argv,"ecdsap224") == 0) ecdsa_doit[R_EC_P224]=2;
|
||||
else if (strcmp(*argv,"ecdsap256") == 0) ecdsa_doit[R_EC_P256]=2;
|
||||
else if (strcmp(*argv,"ecdsap384") == 0) ecdsa_doit[R_EC_P384]=2;
|
||||
else if (strcmp(*argv,"ecdsap521") == 0) ecdsa_doit[R_EC_P521]=2;
|
||||
else if (strcmp(*argv,"ecdsak163") == 0) ecdsa_doit[R_EC_K163]=2;
|
||||
else if (strcmp(*argv,"ecdsak233") == 0) ecdsa_doit[R_EC_K233]=2;
|
||||
else if (strcmp(*argv,"ecdsak283") == 0) ecdsa_doit[R_EC_K283]=2;
|
||||
else if (strcmp(*argv,"ecdsak409") == 0) ecdsa_doit[R_EC_K409]=2;
|
||||
else if (strcmp(*argv,"ecdsak571") == 0) ecdsa_doit[R_EC_K571]=2;
|
||||
else if (strcmp(*argv,"ecdsab163") == 0) ecdsa_doit[R_EC_B163]=2;
|
||||
else if (strcmp(*argv,"ecdsab233") == 0) ecdsa_doit[R_EC_B233]=2;
|
||||
else if (strcmp(*argv,"ecdsab283") == 0) ecdsa_doit[R_EC_B283]=2;
|
||||
else if (strcmp(*argv,"ecdsab409") == 0) ecdsa_doit[R_EC_B409]=2;
|
||||
else if (strcmp(*argv,"ecdsab571") == 0) ecdsa_doit[R_EC_B571]=2;
|
||||
else if (strcmp(*argv,"ecdsa") == 0)
|
||||
{
|
||||
for (i=0; i < EC_NUM; i++)
|
||||
ecdsa_doit[i]=1;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ECDH
|
||||
if (strcmp(*argv,"ecdhp160") == 0) ecdh_doit[R_EC_P160]=2;
|
||||
else if (strcmp(*argv,"ecdhp224") == 0) ecdh_doit[R_EC_P224]=2;
|
||||
else if (strcmp(*argv,"ecdhp256") == 0) ecdh_doit[R_EC_P256]=2;
|
||||
else if (strcmp(*argv,"ecdhp384") == 0) ecdh_doit[R_EC_P384]=2;
|
||||
else if (strcmp(*argv,"ecdhp521") == 0) ecdh_doit[R_EC_P521]=2;
|
||||
else if (strcmp(*argv,"ecdhk163") == 0) ecdh_doit[R_EC_K163]=2;
|
||||
else if (strcmp(*argv,"ecdhk233") == 0) ecdh_doit[R_EC_K233]=2;
|
||||
else if (strcmp(*argv,"ecdhk283") == 0) ecdh_doit[R_EC_K283]=2;
|
||||
else if (strcmp(*argv,"ecdhk409") == 0) ecdh_doit[R_EC_K409]=2;
|
||||
else if (strcmp(*argv,"ecdhk571") == 0) ecdh_doit[R_EC_K571]=2;
|
||||
else if (strcmp(*argv,"ecdhb163") == 0) ecdh_doit[R_EC_B163]=2;
|
||||
else if (strcmp(*argv,"ecdhb233") == 0) ecdh_doit[R_EC_B233]=2;
|
||||
else if (strcmp(*argv,"ecdhb283") == 0) ecdh_doit[R_EC_B283]=2;
|
||||
else if (strcmp(*argv,"ecdhb409") == 0) ecdh_doit[R_EC_B409]=2;
|
||||
else if (strcmp(*argv,"ecdhb571") == 0) ecdh_doit[R_EC_B571]=2;
|
||||
else if (strcmp(*argv,"ecdh") == 0)
|
||||
{
|
||||
for (i=0; i < EC_NUM; i++)
|
||||
ecdh_doit[i]=1;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
BIO_printf(bio_err,"Error: bad option or value\n");
|
||||
@@ -1022,18 +834,6 @@ int MAIN(int argc, char **argv)
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
BIO_printf(bio_err,"dsa512 dsa1024 dsa2048\n");
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ECDSA
|
||||
BIO_printf(bio_err,"ecdsap160 ecdsap224 ecdsap256 ecdsap384 ecdsap521\n");
|
||||
BIO_printf(bio_err,"ecdsak163 ecdsak233 ecdsak283 ecdsak409 ecdsak571\n");
|
||||
BIO_printf(bio_err,"ecdsab163 ecdsab233 ecdsab283 ecdsab409 ecdsab571\n");
|
||||
BIO_printf(bio_err,"ecdsa\n");
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ECDH
|
||||
BIO_printf(bio_err,"ecdhp160 ecdhp224 ecdhp256 ecdhp384 ecdhp521\n");
|
||||
BIO_printf(bio_err,"ecdhk163 ecdhk233 ecdhk283 ecdhk409 ecdhk571\n");
|
||||
BIO_printf(bio_err,"ecdhb163 ecdhb233 ecdhb283 ecdhb409 ecdhb571\n");
|
||||
BIO_printf(bio_err,"ecdh\n");
|
||||
#endif
|
||||
|
||||
#ifndef OPENSSL_NO_IDEA
|
||||
BIO_printf(bio_err,"idea ");
|
||||
@@ -1061,7 +861,7 @@ int MAIN(int argc, char **argv)
|
||||
|
||||
BIO_printf(bio_err,"\n");
|
||||
BIO_printf(bio_err,"Available options:\n");
|
||||
#if defined(TIMES) || defined(USE_TOD)
|
||||
#ifdef TIMES
|
||||
BIO_printf(bio_err,"-elapsed measure time in real time instead of CPU user time.\n");
|
||||
#endif
|
||||
BIO_printf(bio_err,"-engine e use engine e, possibly a hardware device.\n");
|
||||
@@ -1263,114 +1063,6 @@ int MAIN(int argc, char **argv)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef OPENSSL_NO_ECDSA
|
||||
ecdsa_c[R_EC_P160][0]=count/1000;
|
||||
ecdsa_c[R_EC_P160][1]=count/1000/2;
|
||||
for (i=R_EC_P224; i<=R_EC_P521; i++)
|
||||
{
|
||||
ecdsa_c[i][0]=ecdsa_c[i-1][0]/2;
|
||||
ecdsa_c[i][1]=ecdsa_c[i-1][1]/2;
|
||||
if ((ecdsa_doit[i] <= 1) && (ecdsa_c[i][0] == 0))
|
||||
ecdsa_doit[i]=0;
|
||||
else
|
||||
{
|
||||
if (ecdsa_c[i] == 0)
|
||||
{
|
||||
ecdsa_c[i][0]=1;
|
||||
ecdsa_c[i][1]=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
ecdsa_c[R_EC_K163][0]=count/1000;
|
||||
ecdsa_c[R_EC_K163][1]=count/1000/2;
|
||||
for (i=R_EC_K233; i<=R_EC_K571; i++)
|
||||
{
|
||||
ecdsa_c[i][0]=ecdsa_c[i-1][0]/2;
|
||||
ecdsa_c[i][1]=ecdsa_c[i-1][1]/2;
|
||||
if ((ecdsa_doit[i] <= 1) && (ecdsa_c[i][0] == 0))
|
||||
ecdsa_doit[i]=0;
|
||||
else
|
||||
{
|
||||
if (ecdsa_c[i] == 0)
|
||||
{
|
||||
ecdsa_c[i][0]=1;
|
||||
ecdsa_c[i][1]=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
ecdsa_c[R_EC_B163][0]=count/1000;
|
||||
ecdsa_c[R_EC_B163][1]=count/1000/2;
|
||||
for (i=R_EC_B233; i<=R_EC_B571; i++)
|
||||
{
|
||||
ecdsa_c[i][0]=ecdsa_c[i-1][0]/2;
|
||||
ecdsa_c[i][1]=ecdsa_c[i-1][1]/2;
|
||||
if ((ecdsa_doit[i] <= 1) && (ecdsa_c[i][0] == 0))
|
||||
ecdsa_doit[i]=0;
|
||||
else
|
||||
{
|
||||
if (ecdsa_c[i] == 0)
|
||||
{
|
||||
ecdsa_c[i][0]=1;
|
||||
ecdsa_c[i][1]=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef OPENSSL_NO_ECDH
|
||||
ecdh_c[R_EC_P160][0]=count/1000;
|
||||
ecdh_c[R_EC_P160][1]=count/1000;
|
||||
for (i=R_EC_P224; i<=R_EC_P521; i++)
|
||||
{
|
||||
ecdh_c[i][0]=ecdh_c[i-1][0]/2;
|
||||
ecdh_c[i][1]=ecdh_c[i-1][1]/2;
|
||||
if ((ecdh_doit[i] <= 1) && (ecdh_c[i][0] == 0))
|
||||
ecdh_doit[i]=0;
|
||||
else
|
||||
{
|
||||
if (ecdh_c[i] == 0)
|
||||
{
|
||||
ecdh_c[i][0]=1;
|
||||
ecdh_c[i][1]=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
ecdh_c[R_EC_K163][0]=count/1000;
|
||||
ecdh_c[R_EC_K163][1]=count/1000;
|
||||
for (i=R_EC_K233; i<=R_EC_K571; i++)
|
||||
{
|
||||
ecdh_c[i][0]=ecdh_c[i-1][0]/2;
|
||||
ecdh_c[i][1]=ecdh_c[i-1][1]/2;
|
||||
if ((ecdh_doit[i] <= 1) && (ecdh_c[i][0] == 0))
|
||||
ecdh_doit[i]=0;
|
||||
else
|
||||
{
|
||||
if (ecdh_c[i] == 0)
|
||||
{
|
||||
ecdh_c[i][0]=1;
|
||||
ecdh_c[i][1]=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
ecdh_c[R_EC_B163][0]=count/1000;
|
||||
ecdh_c[R_EC_B163][1]=count/1000;
|
||||
for (i=R_EC_B233; i<=R_EC_B571; i++)
|
||||
{
|
||||
ecdh_c[i][0]=ecdh_c[i-1][0]/2;
|
||||
ecdh_c[i][1]=ecdh_c[i-1][1]/2;
|
||||
if ((ecdh_doit[i] <= 1) && (ecdh_c[i][0] == 0))
|
||||
ecdh_doit[i]=0;
|
||||
else
|
||||
{
|
||||
if (ecdh_c[i] == 0)
|
||||
{
|
||||
ecdh_c[i][0]=1;
|
||||
ecdh_c[i][1]=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#define COND(d) (count < (d))
|
||||
#define COUNT(d) (d)
|
||||
#else
|
||||
@@ -1895,220 +1587,6 @@ int MAIN(int argc, char **argv)
|
||||
}
|
||||
if (rnd_fake) RAND_cleanup();
|
||||
#endif
|
||||
|
||||
#ifndef OPENSSL_NO_ECDSA
|
||||
if (RAND_status() != 1)
|
||||
{
|
||||
RAND_seed(rnd_seed, sizeof rnd_seed);
|
||||
rnd_fake = 1;
|
||||
}
|
||||
for (j=0; j<EC_NUM; j++)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (!ecdsa_doit[j]) continue; /* Ignore Curve */
|
||||
ecdsa[j] = EC_KEY_new();
|
||||
if (ecdsa[j] == NULL)
|
||||
{
|
||||
BIO_printf(bio_err,"ECDSA failure.\n");
|
||||
ERR_print_errors(bio_err);
|
||||
rsa_count=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ecdsa[j]->group = EC_GROUP_new_by_nid(test_curves[j]);
|
||||
/* Could not obtain group information */
|
||||
if (ecdsa[j]->group == NULL)
|
||||
{
|
||||
BIO_printf(bio_err,"ECDSA failure.Could not obtain group information\n");
|
||||
ERR_print_errors(bio_err);
|
||||
rsa_count=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Perform ECDSA signature test */
|
||||
EC_KEY_generate_key(ecdsa[j]);
|
||||
ret = ECDSA_sign(0, buf, 20, ecdsasig,
|
||||
&ecdsasiglen, ecdsa[j]);
|
||||
if (ret == 0)
|
||||
{
|
||||
BIO_printf(bio_err,"ECDSA sign failure. No ECDSA sign will be done.\n");
|
||||
ERR_print_errors(bio_err);
|
||||
rsa_count=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
pkey_print_message("sign","ecdsa",
|
||||
ecdsa_c[j][0],
|
||||
test_curves_bits[j],
|
||||
ECDSA_SECONDS);
|
||||
|
||||
Time_F(START);
|
||||
for (count=0,run=1; COND(ecdsa_c[j][0]);
|
||||
count++)
|
||||
{
|
||||
ret=ECDSA_sign(0, buf, 20,
|
||||
ecdsasig, &ecdsasiglen,
|
||||
ecdsa[j]);
|
||||
if (ret == 0)
|
||||
{
|
||||
BIO_printf(bio_err, "ECDSA sign failure\n");
|
||||
ERR_print_errors(bio_err);
|
||||
count=1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
d=Time_F(STOP);
|
||||
|
||||
BIO_printf(bio_err, mr ? "+R5:%ld:%d:%.2f\n" :
|
||||
"%ld %d bit ECDSA signs in %.2fs \n",
|
||||
count, test_curves_bits[j], d);
|
||||
ecdsa_results[j][0]=d/(double)count;
|
||||
rsa_count=count;
|
||||
}
|
||||
|
||||
/* Perform ECDSA verification test */
|
||||
ret=ECDSA_verify(0, buf, 20, ecdsasig,
|
||||
ecdsasiglen, ecdsa[j]);
|
||||
if (ret != 1)
|
||||
{
|
||||
BIO_printf(bio_err,"ECDSA verify failure. No ECDSA verify will be done.\n");
|
||||
ERR_print_errors(bio_err);
|
||||
ecdsa_doit[j] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
pkey_print_message("verify","ecdsa",
|
||||
ecdsa_c[j][1],
|
||||
test_curves_bits[j],
|
||||
ECDSA_SECONDS);
|
||||
Time_F(START);
|
||||
for (count=0,run=1; COND(ecdsa_c[j][1]); count++)
|
||||
{
|
||||
ret=ECDSA_verify(0, buf, 20, ecdsasig, ecdsasiglen, ecdsa[j]);
|
||||
if (ret != 1)
|
||||
{
|
||||
BIO_printf(bio_err, "ECDSA verify failure\n");
|
||||
ERR_print_errors(bio_err);
|
||||
count=1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
d=Time_F(STOP);
|
||||
BIO_printf(bio_err, mr? "+R6:%ld:%d:%.2f\n"
|
||||
: "%ld %d bit ECDSA verify in %.2fs\n",
|
||||
count, test_curves_bits[j], d);
|
||||
ecdsa_results[j][1]=d/(double)count;
|
||||
}
|
||||
|
||||
if (rsa_count <= 1)
|
||||
{
|
||||
/* if longer than 10s, don't do any more */
|
||||
for (j++; j<EC_NUM; j++)
|
||||
ecdsa_doit[j]=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (rnd_fake) RAND_cleanup();
|
||||
#endif
|
||||
|
||||
#ifndef OPENSSL_NO_ECDH
|
||||
if (RAND_status() != 1)
|
||||
{
|
||||
RAND_seed(rnd_seed, sizeof rnd_seed);
|
||||
rnd_fake = 1;
|
||||
}
|
||||
for (j=0; j<EC_NUM; j++)
|
||||
{
|
||||
if (!ecdh_doit[j]) continue;
|
||||
ecdh_a[j] = EC_KEY_new();
|
||||
ecdh_b[j] = EC_KEY_new();
|
||||
if ((ecdh_a[j] == NULL) || (ecdh_b[j] == NULL))
|
||||
{
|
||||
BIO_printf(bio_err,"ECDH failure.\n");
|
||||
ERR_print_errors(bio_err);
|
||||
rsa_count=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ecdh_a[j]->group = EC_GROUP_new_by_nid(test_curves[j]);
|
||||
if (ecdh_a[j]->group == NULL)
|
||||
{
|
||||
BIO_printf(bio_err,"ECDH failure.\n");
|
||||
ERR_print_errors(bio_err);
|
||||
rsa_count=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ecdh_b[j]->group = ecdh_a[j]->group;
|
||||
|
||||
/* generate two ECDH key pairs */
|
||||
if (!EC_KEY_generate_key(ecdh_a[j]) ||
|
||||
!EC_KEY_generate_key(ecdh_b[j]))
|
||||
{
|
||||
BIO_printf(bio_err,"ECDH key generation failure.\n");
|
||||
ERR_print_errors(bio_err);
|
||||
rsa_count=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
secret_size_a = ECDH_compute_key(secret_a,
|
||||
ecdh_b[j]->pub_key,
|
||||
ecdh_a[j]);
|
||||
secret_size_b = ECDH_compute_key(secret_b,
|
||||
ecdh_a[j]->pub_key,
|
||||
ecdh_b[j]);
|
||||
if (secret_size_a != secret_size_b)
|
||||
ecdh_checks = 0;
|
||||
else
|
||||
ecdh_checks = 1;
|
||||
|
||||
for (secret_idx = 0;
|
||||
(secret_idx < secret_size_a)
|
||||
&& (ecdh_checks == 1);
|
||||
secret_idx++)
|
||||
{
|
||||
if (secret_a[secret_idx] != secret_b[secret_idx])
|
||||
ecdh_checks = 0;
|
||||
}
|
||||
|
||||
if (ecdh_checks == 0)
|
||||
{
|
||||
BIO_printf(bio_err,"ECDH computations don't match.\n");
|
||||
ERR_print_errors(bio_err);
|
||||
rsa_count=1;
|
||||
}
|
||||
|
||||
pkey_print_message("","ecdh",
|
||||
ecdh_c[j][0],
|
||||
test_curves_bits[j],
|
||||
ECDH_SECONDS);
|
||||
Time_F(START);
|
||||
for (count=0,run=1; COND(ecdh_c[j][0]); count++)
|
||||
{
|
||||
ECDH_compute_key(secret_a,
|
||||
ecdh_b[j]->pub_key,
|
||||
ecdh_a[j]);
|
||||
}
|
||||
d=Time_F(STOP);
|
||||
BIO_printf(bio_err, mr ? "+R7:%ld:%d:%.2f\n" :"%ld %d-bit ECDH ops in %.2fs\n",
|
||||
count, test_curves_bits[j], d);
|
||||
ecdh_results[j][0]=d/(double)count;
|
||||
rsa_count=count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (rsa_count <= 1)
|
||||
{
|
||||
/* if longer than 10s, don't do any more */
|
||||
for (j++; j<EC_NUM; j++)
|
||||
ecdh_doit[j]=0;
|
||||
}
|
||||
}
|
||||
if (rnd_fake) RAND_cleanup();
|
||||
#endif
|
||||
#ifdef HAVE_FORK
|
||||
show_res:
|
||||
#endif
|
||||
@@ -2234,57 +1712,7 @@ show_res:
|
||||
1.0/dsa_results[k][0],1.0/dsa_results[k][1]);
|
||||
}
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ECDSA
|
||||
j=1;
|
||||
for (k=0; k<EC_NUM; k++)
|
||||
{
|
||||
if (!ecdsa_doit[k]) continue;
|
||||
if (j && !mr)
|
||||
{
|
||||
printf("%30ssign verify sign/s verify/s\n"," ");
|
||||
j=0;
|
||||
}
|
||||
|
||||
if (mr)
|
||||
fprintf(stdout,"+F4:%u:%u:%f:%f\n",
|
||||
k, test_curves_bits[k],
|
||||
ecdsa_results[k][0],ecdsa_results[k][1]);
|
||||
else
|
||||
fprintf(stdout,
|
||||
"%4u bit ecdsa (%s) %8.4fs %8.4fs %8.1f %8.1f\n",
|
||||
test_curves_bits[k],
|
||||
test_curves_names[k],
|
||||
ecdsa_results[k][0],ecdsa_results[k][1],
|
||||
1.0/ecdsa_results[k][0],1.0/ecdsa_results[k][1]);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef OPENSSL_NO_ECDH
|
||||
j=1;
|
||||
for (k=0; k<EC_NUM; k++)
|
||||
{
|
||||
if (!ecdh_doit[k]) continue;
|
||||
if (j && !mr)
|
||||
{
|
||||
printf("%30sop op/s\n"," ");
|
||||
j=0;
|
||||
}
|
||||
if (mr)
|
||||
fprintf(stdout,"+F5:%u:%u:%f:%f\n",
|
||||
k, test_curves_bits[k],
|
||||
ecdh_results[k][0], 1.0/ecdh_results[k][0]);
|
||||
|
||||
else
|
||||
fprintf(stdout,"%4u bit ecdh (%s) %8.4fs %8.1f\n",
|
||||
test_curves_bits[k],
|
||||
test_curves_names[k],
|
||||
ecdh_results[k][0], 1.0/ecdh_results[k][0]);
|
||||
}
|
||||
#endif
|
||||
|
||||
mret=0;
|
||||
|
||||
end:
|
||||
ERR_print_errors(bio_err);
|
||||
if (buf != NULL) OPENSSL_free(buf);
|
||||
@@ -2299,24 +1727,8 @@ end:
|
||||
if (dsa_key[i] != NULL)
|
||||
DSA_free(dsa_key[i]);
|
||||
#endif
|
||||
|
||||
#ifndef OPENSSL_NO_ECDSA
|
||||
for (i=0; i<EC_NUM; i++)
|
||||
if (ecdsa[i] != NULL)
|
||||
EC_KEY_free(ecdsa[i]);
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ECDH
|
||||
for (i=0; i<EC_NUM; i++)
|
||||
{
|
||||
if (ecdh_a[i] != NULL)
|
||||
EC_KEY_free(ecdh_a[i]);
|
||||
if (ecdh_b[i] != NULL)
|
||||
EC_KEY_free(ecdh_b[i]);
|
||||
}
|
||||
#endif
|
||||
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(mret);
|
||||
EXIT(mret);
|
||||
}
|
||||
|
||||
static void print_message(const char *s, long num, int length)
|
||||
@@ -2369,7 +1781,7 @@ static char *sstrsep(char **string, const char *delim)
|
||||
if (**string == 0)
|
||||
return NULL;
|
||||
|
||||
memset(isdelim, 0, sizeof isdelim);
|
||||
memset(isdelim, 0, 256);
|
||||
isdelim[0] = 1;
|
||||
|
||||
while (*delim)
|
||||
@@ -2516,49 +1928,6 @@ static int do_multi(int multi)
|
||||
else
|
||||
dsa_results[k][1]=d;
|
||||
}
|
||||
#ifndef OPENSSL_NO_ECDSA
|
||||
else if(!strncmp(buf,"+F4:",4))
|
||||
{
|
||||
int k;
|
||||
double d;
|
||||
|
||||
p=buf+4;
|
||||
k=atoi(sstrsep(&p,sep));
|
||||
sstrsep(&p,sep);
|
||||
|
||||
d=atof(sstrsep(&p,sep));
|
||||
if(n)
|
||||
ecdsa_results[k][0]=1/(1/ecdsa_results[k][0]+1/d);
|
||||
else
|
||||
ecdsa_results[k][0]=d;
|
||||
|
||||
d=atof(sstrsep(&p,sep));
|
||||
if(n)
|
||||
ecdsa_results[k][1]=1/(1/ecdsa_results[k][1]+1/d);
|
||||
else
|
||||
ecdsa_results[k][1]=d;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef OPENSSL_NO_ECDH
|
||||
else if(!strncmp(buf,"+F5:",4))
|
||||
{
|
||||
int k;
|
||||
double d;
|
||||
|
||||
p=buf+4;
|
||||
k=atoi(sstrsep(&p,sep));
|
||||
sstrsep(&p,sep);
|
||||
|
||||
d=atof(sstrsep(&p,sep));
|
||||
if(n)
|
||||
ecdh_results[k][0]=1/(1/ecdh_results[k][0]+1/d);
|
||||
else
|
||||
ecdh_results[k][0]=d;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
else if(!strncmp(buf,"+H:",3))
|
||||
{
|
||||
}
|
||||
|
@@ -186,7 +186,7 @@ bad:
|
||||
if(keyfile) {
|
||||
pkey = load_key(bio_err,
|
||||
strcmp(keyfile, "-") ? keyfile : NULL,
|
||||
FORMAT_PEM, 1, passin, e, "private key");
|
||||
FORMAT_PEM, passin, e, "private key");
|
||||
if(!pkey) {
|
||||
goto end;
|
||||
}
|
||||
@@ -295,5 +295,5 @@ end:
|
||||
EVP_PKEY_free(pkey);
|
||||
if(passin) OPENSSL_free(passin);
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(ret);
|
||||
EXIT(ret);
|
||||
}
|
||||
|
@@ -232,7 +232,7 @@ end:
|
||||
sk_X509_pop_free(untrusted, X509_free);
|
||||
sk_X509_pop_free(trusted, X509_free);
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(ret);
|
||||
EXIT(ret);
|
||||
}
|
||||
|
||||
static int check(X509_STORE *ctx, char *file, STACK_OF(X509) *uchain, STACK_OF(X509) *tchain, int purpose, ENGINE *e)
|
||||
@@ -330,8 +330,7 @@ static int MS_CALLBACK cb(int ok, X509_STORE_CTX *ctx)
|
||||
if (!ok)
|
||||
{
|
||||
X509_NAME_oneline(
|
||||
X509_get_subject_name(ctx->current_cert),buf,
|
||||
sizeof buf);
|
||||
X509_get_subject_name(ctx->current_cert),buf,256);
|
||||
printf("%s\n",buf);
|
||||
printf("error %d at %d depth lookup:%s\n",ctx->error,
|
||||
ctx->error_depth,
|
||||
|
@@ -172,19 +172,7 @@ int MAIN(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
if (version)
|
||||
{
|
||||
if (SSLeay() == SSLEAY_VERSION_NUMBER)
|
||||
{
|
||||
printf("%s\n",SSLeay_version(SSLEAY_VERSION));
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("%s (Library: %s)\n",
|
||||
OPENSSL_VERSION_TEXT,
|
||||
SSLeay_version(SSLEAY_VERSION));
|
||||
}
|
||||
}
|
||||
if (version) printf("%s\n",SSLeay_version(SSLEAY_VERSION));
|
||||
if (date) printf("%s\n",SSLeay_version(SSLEAY_BUILT_ON));
|
||||
if (platform) printf("%s\n",SSLeay_version(SSLEAY_PLATFORM));
|
||||
if (options)
|
||||
@@ -212,5 +200,5 @@ int MAIN(int argc, char **argv)
|
||||
if (dir) printf("%s\n",SSLeay_version(SSLEAY_DIR));
|
||||
end:
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(ret);
|
||||
EXIT(ret);
|
||||
}
|
||||
|
@@ -118,6 +118,7 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
|
||||
HDC hdc;
|
||||
PAINTSTRUCT ps;
|
||||
RECT rect;
|
||||
char buffer[200];
|
||||
static int seeded = 0;
|
||||
|
||||
switch (iMsg)
|
||||
|
40
apps/x509.c
40
apps/x509.c
@@ -122,7 +122,7 @@ static char *x509_usage[]={
|
||||
" -CAkey arg - set the CA key, must be PEM format\n",
|
||||
" missing, it is assumed to be in the CA file.\n",
|
||||
" -CAcreateserial - create serial number file if it does not exist\n",
|
||||
" -CAserial arg - serial file\n",
|
||||
" -CAserial - serial file\n",
|
||||
" -set_serial - serial number to use\n",
|
||||
" -text - print the certificate in text form\n",
|
||||
" -C - print out C code forms\n",
|
||||
@@ -479,7 +479,7 @@ bad:
|
||||
|
||||
if (extfile)
|
||||
{
|
||||
long errorline = -1;
|
||||
long errorline;
|
||||
X509V3_CTX ctx2;
|
||||
extconf = NCONF_new(NULL);
|
||||
if (!NCONF_load(extconf, extfile,&errorline))
|
||||
@@ -770,11 +770,10 @@ bad:
|
||||
int y,z;
|
||||
|
||||
X509_NAME_oneline(X509_get_subject_name(x),
|
||||
buf,sizeof buf);
|
||||
buf,256);
|
||||
BIO_printf(STDout,"/* subject:%s */\n",buf);
|
||||
m=X509_NAME_oneline(
|
||||
X509_get_issuer_name(x),buf,
|
||||
sizeof buf);
|
||||
X509_get_issuer_name(x),buf,256);
|
||||
BIO_printf(STDout,"/* issuer :%s */\n",buf);
|
||||
|
||||
z=i2d_X509(x,NULL);
|
||||
@@ -862,18 +861,14 @@ bad:
|
||||
if (Upkey == NULL)
|
||||
{
|
||||
Upkey=load_key(bio_err,
|
||||
keyfile, keyformat, 0,
|
||||
passin, e, "Private key");
|
||||
keyfile,keyformat, passin, e,
|
||||
"Private key");
|
||||
if (Upkey == NULL) goto end;
|
||||
}
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
if (Upkey->type == EVP_PKEY_DSA)
|
||||
digest=EVP_dss1();
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ECDSA
|
||||
if (Upkey->type == EVP_PKEY_EC)
|
||||
digest=EVP_ecdsa();
|
||||
#endif
|
||||
|
||||
assert(need_rand);
|
||||
if (!sign(x,Upkey,days,clrext,digest,
|
||||
@@ -885,19 +880,14 @@ bad:
|
||||
if (CAkeyfile != NULL)
|
||||
{
|
||||
CApkey=load_key(bio_err,
|
||||
CAkeyfile, CAkeyformat,
|
||||
0, passin, e,
|
||||
"CA Private Key");
|
||||
CAkeyfile,CAkeyformat, passin,
|
||||
e, "CA Private Key");
|
||||
if (CApkey == NULL) goto end;
|
||||
}
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
if (CApkey->type == EVP_PKEY_DSA)
|
||||
digest=EVP_dss1();
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ECDSA
|
||||
if (CApkey->type == EVP_PKEY_EC)
|
||||
digest = EVP_ecdsa();
|
||||
#endif
|
||||
|
||||
assert(need_rand);
|
||||
if (!x509_certify(ctx,CAfile,digest,x,xca,
|
||||
@@ -918,21 +908,15 @@ bad:
|
||||
else
|
||||
{
|
||||
pk=load_key(bio_err,
|
||||
keyfile, FORMAT_PEM, 0,
|
||||
passin, e, "request key");
|
||||
keyfile,FORMAT_PEM, passin, e,
|
||||
"request key");
|
||||
if (pk == NULL) goto end;
|
||||
}
|
||||
|
||||
BIO_printf(bio_err,"Generating certificate request\n");
|
||||
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
if (pk->type == EVP_PKEY_DSA)
|
||||
digest=EVP_dss1();
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ECDSA
|
||||
if (pk->type == EVP_PKEY_EC)
|
||||
digest=EVP_ecdsa();
|
||||
#endif
|
||||
|
||||
rq=X509_to_X509_REQ(x,pk,digest);
|
||||
EVP_PKEY_free(pk);
|
||||
@@ -1029,7 +1013,7 @@ end:
|
||||
sk_ASN1_OBJECT_pop_free(reject, ASN1_OBJECT_free);
|
||||
if (passin) OPENSSL_free(passin);
|
||||
apps_shutdown();
|
||||
OPENSSL_EXIT(ret);
|
||||
EXIT(ret);
|
||||
}
|
||||
|
||||
static ASN1_INTEGER *load_serial(char *CAfile, char *serialfile, int create)
|
||||
@@ -1087,7 +1071,7 @@ static ASN1_INTEGER *load_serial(char *CAfile, char *serialfile, int create)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!a2i_ASN1_INTEGER(io,bs,buf2,sizeof buf2))
|
||||
if (!a2i_ASN1_INTEGER(io,bs,buf2,1024))
|
||||
{
|
||||
BIO_printf(bio_err,"unable to load serial number from %s\n",buf);
|
||||
ERR_print_errors(bio_err);
|
||||
|
24
config
24
config
@@ -351,10 +351,6 @@ case "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in
|
||||
*CRAY*)
|
||||
echo "j90-cray-unicos"; exit 0;
|
||||
;;
|
||||
|
||||
NONSTOP_KERNEL*)
|
||||
echo "nsr-tandem-nsk"; exit 0;
|
||||
;;
|
||||
esac
|
||||
|
||||
#
|
||||
@@ -397,9 +393,6 @@ exit 0
|
||||
GCCVER=`(gcc -dumpversion) 2>/dev/null`
|
||||
if [ "$GCCVER" != "" ]; then
|
||||
CC=gcc
|
||||
# then strip off whatever prefix egcs prepends the number with...
|
||||
# Hopefully, this will work for any future prefixes as well.
|
||||
GCCVER=`echo $GCCVER | sed 's/^[a-zA-Z]*\-//'`
|
||||
# Since gcc 3.1 gcc --version behaviour has changed. gcc -dumpversion
|
||||
# does give us what we want though, so we use that. We just just the
|
||||
# major and minor version numbers.
|
||||
@@ -547,13 +540,12 @@ EOF
|
||||
ppc-apple-darwin*) OUT="darwin-ppc-cc" ;;
|
||||
i386-apple-darwin*) OUT="darwin-i386-cc" ;;
|
||||
sparc64-*-linux2)
|
||||
echo "WARNING! If *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 linux64-sparcv9' *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
|
||||
#Before we can uncomment following lines we have to wait at least
|
||||
#till 64-bit glibc for SPARC is operational:-(
|
||||
#echo "WARNING! If you wish to build 64-bit library, then you have to"
|
||||
#echo " invoke './Configure linux64-sparcv9' *manually*."
|
||||
#echo " Type return if you want to continue, Ctrl-C to abort."
|
||||
#read waste < /dev/tty
|
||||
OUT="linux-sparcv9" ;;
|
||||
sparc-*-linux2)
|
||||
KARCH=`awk '/^type/{print$3}' /proc/cpuinfo`
|
||||
@@ -586,7 +578,6 @@ EOF
|
||||
arm*-*-linux2) OUT="linux-elf-arm" ;;
|
||||
s390-*-linux2) OUT="linux-s390" ;;
|
||||
s390x-*-linux?) OUT="linux-s390x" ;;
|
||||
x86_64-*-linux?) OUT="linux-x86_64" ;;
|
||||
*-*-linux2) OUT="linux-elf"
|
||||
if [ "$GCCVER" -gt 28 ]; then
|
||||
if grep '^model.*Pentium' /proc/cpuinfo >/dev/null ; then
|
||||
@@ -731,7 +722,6 @@ EOF
|
||||
*-*-cygwin) OUT="Cygwin" ;;
|
||||
t3e-cray-unicosmk) OUT="cray-t3e" ;;
|
||||
j90-cray-unicos) OUT="cray-j90" ;;
|
||||
nsr-tandem-nsk) OUT="tandem-c89" ;;
|
||||
*) OUT=`echo $GUESSOS | awk -F- '{print $3}'`;;
|
||||
esac
|
||||
|
||||
@@ -766,7 +756,7 @@ case "$GUESSOS" in
|
||||
i386-*) options="$options 386" ;;
|
||||
esac
|
||||
|
||||
for i in bf cast des dh dsa ec hmac idea md2 md5 mdc2 rc2 rc4 rc5 aes 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
|
||||
if [ ! -d crypto/$i ]
|
||||
then
|
||||
|
@@ -28,7 +28,7 @@ LIBS=
|
||||
|
||||
SDIRS= md2 md5 sha mdc2 hmac ripemd \
|
||||
des rc2 rc4 rc5 idea bf cast \
|
||||
bn ec rsa dsa ecdsa ecdh dh dso engine aes \
|
||||
bn ec rsa dsa dh dso engine aes \
|
||||
buffer bio stack lhash rand err objects \
|
||||
evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp ui krb5
|
||||
|
||||
@@ -36,8 +36,8 @@ GENERAL=Makefile README crypto-lib.com install.com
|
||||
|
||||
LIB= $(TOP)/libcrypto.a
|
||||
SHARED_LIB= libcrypto$(SHLIB_EXT)
|
||||
LIBSRC= cryptlib.c mem.c mem_clr.c mem_dbg.c cversion.c ex_data.c tmdiff.c cpt_err.c ebcdic.c uid.c o_time.c
|
||||
LIBOBJ= cryptlib.o mem.o mem_clr.o mem_dbg.o cversion.o ex_data.o tmdiff.o cpt_err.o ebcdic.o uid.o o_time.o
|
||||
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)
|
||||
|
||||
@@ -98,7 +98,7 @@ lib: $(LIBOBJ)
|
||||
|
||||
shared:
|
||||
if [ -n "$(SHARED_LIBS)" ]; then \
|
||||
(cd ..; $(MAKE) $(SHARED_LIB)); \
|
||||
(cd ..; make $(SHARED_LIB)); \
|
||||
fi
|
||||
|
||||
libs:
|
||||
@@ -136,12 +136,12 @@ lint:
|
||||
|
||||
depend:
|
||||
if [ ! -f buildinf.h ]; then touch buildinf.h; fi # fake buildinf.h if it does not exist
|
||||
$(MAKEDEPEND) -- $(CFLAG) $(INCLUDE) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
|
||||
$(MAKEDEPEND) $(INCLUDE) $(DEPFLAG) $(PROGS) $(LIBSRC)
|
||||
if [ ! -s buildinf.h ]; then rm buildinf.h; fi
|
||||
@for i in $(SDIRS) ;\
|
||||
do \
|
||||
(cd $$i && echo "making depend in crypto/$$i..." && \
|
||||
$(MAKE) MAKEFILE='${MAKEFILE}' INCLUDES='${INCLUDES}' CFLAG='${CFLAG}' DEPFLAG='${DEPFLAG}' PERL='${PERL}' depend ); \
|
||||
$(MAKE) MAKEFILE='${MAKEFILE}' INCLUDES='${INCLUDES}' DEPFLAG='${DEPFLAG}' PERL='${PERL}' depend ); \
|
||||
done;
|
||||
|
||||
clean:
|
||||
@@ -180,7 +180,7 @@ cversion.o: ../include/openssl/err.h ../include/openssl/lhash.h
|
||||
cversion.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
|
||||
cversion.o: ../include/openssl/safestack.h ../include/openssl/stack.h
|
||||
cversion.o: ../include/openssl/symhacks.h buildinf.h cryptlib.h cversion.c
|
||||
ebcdic.o: ../include/openssl/e_os2.h ../include/openssl/opensslconf.h ebcdic.c
|
||||
ebcdic.o: ../include/openssl/opensslconf.h ebcdic.c
|
||||
ex_data.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
|
||||
ex_data.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
|
||||
ex_data.o: ../include/openssl/err.h ../include/openssl/lhash.h
|
||||
@@ -193,10 +193,6 @@ mem.o: ../include/openssl/err.h ../include/openssl/lhash.h
|
||||
mem.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
|
||||
mem.o: ../include/openssl/safestack.h ../include/openssl/stack.h
|
||||
mem.o: ../include/openssl/symhacks.h cryptlib.h mem.c
|
||||
mem_clr.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
|
||||
mem_clr.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
|
||||
mem_clr.o: ../include/openssl/safestack.h ../include/openssl/stack.h
|
||||
mem_clr.o: ../include/openssl/symhacks.h mem_clr.c
|
||||
mem_dbg.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
|
||||
mem_dbg.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
|
||||
mem_dbg.o: ../include/openssl/err.h ../include/openssl/lhash.h
|
||||
|
@@ -75,7 +75,7 @@ lint:
|
||||
lint -DLINT $(INCLUDES) $(SRC)>fluff
|
||||
|
||||
depend:
|
||||
$(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
|
||||
$(MAKEDEPEND) $(INCLUDES) $(DEPFLAG) $(PROGS) $(LIBSRC)
|
||||
|
||||
dclean:
|
||||
$(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
|
||||
|
@@ -99,9 +99,7 @@ void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out,
|
||||
unsigned char *ivec, int *num);
|
||||
void AES_ctr128_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const unsigned long length, const AES_KEY *key,
|
||||
unsigned char counter[AES_BLOCK_SIZE],
|
||||
unsigned char ecount_buf[AES_BLOCK_SIZE],
|
||||
unsigned int *num);
|
||||
unsigned char *counter, unsigned int *num);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@@ -49,13 +49,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AES_DEBUG
|
||||
# ifndef NDEBUG
|
||||
# define NDEBUG
|
||||
# endif
|
||||
#endif
|
||||
#include <assert.h>
|
||||
|
||||
#include <openssl/aes.h>
|
||||
#include "aes_locl.h"
|
||||
|
||||
@@ -63,49 +57,33 @@ void AES_cbc_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const unsigned long length, const AES_KEY *key,
|
||||
unsigned char *ivec, const int enc) {
|
||||
|
||||
unsigned long n;
|
||||
int n;
|
||||
unsigned long len = length;
|
||||
unsigned char tmp[AES_BLOCK_SIZE];
|
||||
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 >= AES_BLOCK_SIZE) {
|
||||
for(n=0; n < AES_BLOCK_SIZE; ++n)
|
||||
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, AES_BLOCK_SIZE);
|
||||
len -= AES_BLOCK_SIZE;
|
||||
in += AES_BLOCK_SIZE;
|
||||
out += AES_BLOCK_SIZE;
|
||||
memcpy(ivec, out, 16);
|
||||
len -= 16;
|
||||
in += 16;
|
||||
out += 16;
|
||||
}
|
||||
if (len) {
|
||||
for(n=0; n < len; ++n)
|
||||
tmp[n] = in[n] ^ ivec[n];
|
||||
for(n=len; n < AES_BLOCK_SIZE; ++n)
|
||||
tmp[n] = ivec[n];
|
||||
AES_encrypt(tmp, tmp, key);
|
||||
memcpy(out, tmp, len);
|
||||
memcpy(ivec, tmp, AES_BLOCK_SIZE);
|
||||
}
|
||||
} else {
|
||||
while (len >= AES_BLOCK_SIZE) {
|
||||
memcpy(tmp, in, AES_BLOCK_SIZE);
|
||||
else
|
||||
while (len > 0) {
|
||||
memcpy(tmp, in, 16);
|
||||
AES_decrypt(in, out, key);
|
||||
for(n=0; n < AES_BLOCK_SIZE; ++n)
|
||||
for(n=0; n < 16; ++n)
|
||||
out[n] ^= ivec[n];
|
||||
memcpy(ivec, tmp, AES_BLOCK_SIZE);
|
||||
len -= AES_BLOCK_SIZE;
|
||||
in += AES_BLOCK_SIZE;
|
||||
out += AES_BLOCK_SIZE;
|
||||
memcpy(ivec, tmp, 16);
|
||||
len -= 16;
|
||||
in += 16;
|
||||
out += 16;
|
||||
}
|
||||
if (len) {
|
||||
memcpy(tmp, in, AES_BLOCK_SIZE);
|
||||
AES_decrypt(tmp, tmp, key);
|
||||
for(n=0; n < len; ++n)
|
||||
out[n] ^= ivec[n];
|
||||
memcpy(ivec, tmp, AES_BLOCK_SIZE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -105,13 +105,7 @@
|
||||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
|
||||
#ifndef AES_DEBUG
|
||||
# ifndef NDEBUG
|
||||
# define NDEBUG
|
||||
# endif
|
||||
#endif
|
||||
#include <assert.h>
|
||||
|
||||
#include <openssl/aes.h>
|
||||
#include "aes_locl.h"
|
||||
|
||||
|
@@ -28,13 +28,7 @@
|
||||
/* Note: rewritten a little bit to provide error control and an OpenSSL-
|
||||
compatible API */
|
||||
|
||||
#ifndef AES_DEBUG
|
||||
# ifndef NDEBUG
|
||||
# define NDEBUG
|
||||
# endif
|
||||
#endif
|
||||
#include <assert.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <openssl/aes.h>
|
||||
#include "aes_locl.h"
|
||||
|
@@ -49,13 +49,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AES_DEBUG
|
||||
# ifndef NDEBUG
|
||||
# define NDEBUG
|
||||
# endif
|
||||
#endif
|
||||
#include <assert.h>
|
||||
|
||||
#include <openssl/aes.h>
|
||||
#include "aes_locl.h"
|
||||
|
||||
@@ -96,31 +90,26 @@ static void AES_ctr128_inc(unsigned char *counter) {
|
||||
|
||||
/* The input encrypted as though 128bit counter mode is being
|
||||
* used. The extra state information to record how much of the
|
||||
* 128bit block we have used is contained in *num, and the
|
||||
* encrypted counter is kept in ecount_buf. Both *num and
|
||||
* ecount_buf must be initialised with zeros before the first
|
||||
* call to AES_ctr128_encrypt().
|
||||
* 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[AES_BLOCK_SIZE],
|
||||
unsigned char ecount_buf[AES_BLOCK_SIZE],
|
||||
unsigned int *num) {
|
||||
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);
|
||||
assert(*num < AES_BLOCK_SIZE);
|
||||
|
||||
n = *num;
|
||||
|
||||
while (l--) {
|
||||
if (n == 0) {
|
||||
AES_encrypt(counter, ecount_buf, key);
|
||||
AES_encrypt(counter, tmp, key);
|
||||
AES_ctr128_inc(counter);
|
||||
}
|
||||
*(out++) = *(in++) ^ ecount_buf[n];
|
||||
*(out++) = *(in++) ^ tmp[n];
|
||||
n = (n+1) % AES_BLOCK_SIZE;
|
||||
}
|
||||
|
||||
|
@@ -49,13 +49,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AES_DEBUG
|
||||
# ifndef NDEBUG
|
||||
# define NDEBUG
|
||||
# endif
|
||||
#endif
|
||||
#include <assert.h>
|
||||
|
||||
#include <openssl/aes.h>
|
||||
#include "aes_locl.h"
|
||||
|
||||
|
@@ -60,9 +60,12 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#if defined(_MSC_VER) && !defined(OPENSSL_SYS_WINCE)
|
||||
#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)); }
|
||||
|
@@ -105,13 +105,7 @@
|
||||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
|
||||
#ifndef AES_DEBUG
|
||||
# ifndef NDEBUG
|
||||
# define NDEBUG
|
||||
# endif
|
||||
#endif
|
||||
#include <assert.h>
|
||||
|
||||
#include <openssl/aes.h>
|
||||
#include "aes_locl.h"
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -120,12 +120,6 @@ ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, unsigned char **pp,
|
||||
unsigned char *p,*s;
|
||||
int i;
|
||||
|
||||
if (len < 1)
|
||||
{
|
||||
i=ASN1_R_STRING_TOO_SHORT;
|
||||
goto err;
|
||||
}
|
||||
|
||||
if ((a == NULL) || ((*a) == NULL))
|
||||
{
|
||||
if ((ret=M_ASN1_BIT_STRING_new()) == NULL) return(NULL);
|
||||
@@ -191,9 +185,7 @@ int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value)
|
||||
if (a->data == NULL)
|
||||
c=(unsigned char *)OPENSSL_malloc(w+1);
|
||||
else
|
||||
c=(unsigned char *)OPENSSL_realloc_clean(a->data,
|
||||
a->length,
|
||||
w+1);
|
||||
c=(unsigned char *)OPENSSL_realloc(a->data,w+1);
|
||||
if (c == NULL) return(0);
|
||||
if (w+1-a->length > 0) memset(c+a->length, 0, w+1-a->length);
|
||||
a->data=c;
|
||||
|
@@ -285,7 +285,7 @@ static int asn1_collate_primitive(ASN1_STRING *a, ASN1_CTX *c)
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (!BUF_MEM_grow_clean(&b,num+os->length))
|
||||
if (!BUF_MEM_grow(&b,num+os->length))
|
||||
{
|
||||
c->error=ERR_R_BUF_LIB;
|
||||
goto err;
|
||||
|
@@ -149,12 +149,7 @@ static int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb)
|
||||
ASN1_CTX c;
|
||||
int want=HEADER_SIZE;
|
||||
int eos=0;
|
||||
#if defined(__GNUC__) && defined(__ia64)
|
||||
/* pathetic compiler bug in all known versions as of Nov. 2002 */
|
||||
long off=0;
|
||||
#else
|
||||
int off=0;
|
||||
#endif
|
||||
int len=0;
|
||||
|
||||
b=BUF_MEM_new();
|
||||
@@ -171,7 +166,7 @@ static int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb)
|
||||
{
|
||||
want-=(len-off);
|
||||
|
||||
if (!BUF_MEM_grow_clean(b,len+want))
|
||||
if (!BUF_MEM_grow(b,len+want))
|
||||
{
|
||||
ASN1err(ASN1_F_ASN1_D2I_BIO,ERR_R_MALLOC_FAILURE);
|
||||
goto err;
|
||||
@@ -226,23 +221,18 @@ static int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb)
|
||||
if (want > (len-off))
|
||||
{
|
||||
want-=(len-off);
|
||||
if (!BUF_MEM_grow_clean(b,len+want))
|
||||
if (!BUF_MEM_grow(b,len+want))
|
||||
{
|
||||
ASN1err(ASN1_F_ASN1_D2I_BIO,ERR_R_MALLOC_FAILURE);
|
||||
goto err;
|
||||
}
|
||||
while (want > 0)
|
||||
i=BIO_read(in,&(b->data[len]),want);
|
||||
if (i <= 0)
|
||||
{
|
||||
i=BIO_read(in,&(b->data[len]),want);
|
||||
if (i <= 0)
|
||||
{
|
||||
ASN1err(ASN1_F_ASN1_D2I_BIO,
|
||||
ASN1_R_NOT_ENOUGH_DATA);
|
||||
goto err;
|
||||
}
|
||||
len+=i;
|
||||
want -= i;
|
||||
ASN1err(ASN1_F_ASN1_D2I_BIO,ASN1_R_NOT_ENOUGH_DATA);
|
||||
goto err;
|
||||
}
|
||||
len+=i;
|
||||
}
|
||||
off+=(int)c.slen;
|
||||
if (eos <= 0)
|
||||
|
@@ -147,7 +147,7 @@ ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(BIGNUM *bn, ASN1_ENUMERATED *ai)
|
||||
ASN1err(ASN1_F_BN_TO_ASN1_ENUMERATED,ERR_R_NESTED_ASN1_ERROR);
|
||||
goto err;
|
||||
}
|
||||
if(BN_get_sign(bn)) ret->type = V_ASN1_NEG_ENUMERATED;
|
||||
if(bn->neg) ret->type = V_ASN1_NEG_ENUMERATED;
|
||||
else ret->type=V_ASN1_ENUMERATED;
|
||||
j=BN_num_bits(bn);
|
||||
len=((j == 0)?0:((j/8)+1));
|
||||
@@ -175,6 +175,6 @@ BIGNUM *ASN1_ENUMERATED_to_BN(ASN1_ENUMERATED *ai, BIGNUM *bn)
|
||||
|
||||
if ((ret=BN_bin2bn(ai->data,ai->length,bn)) == NULL)
|
||||
ASN1err(ASN1_F_ASN1_ENUMERATED_TO_BN,ASN1_R_BN_LIB);
|
||||
else if(ai->type == V_ASN1_NEG_ENUMERATED) BN_set_sign(ret,1);
|
||||
else if(ai->type == V_ASN1_NEG_ENUMERATED) ret->neg = 1;
|
||||
return(ret);
|
||||
}
|
||||
|
@@ -393,8 +393,7 @@ ASN1_INTEGER *BN_to_ASN1_INTEGER(BIGNUM *bn, ASN1_INTEGER *ai)
|
||||
ASN1err(ASN1_F_BN_TO_ASN1_INTEGER,ERR_R_NESTED_ASN1_ERROR);
|
||||
goto err;
|
||||
}
|
||||
if (BN_get_sign(bn))
|
||||
ret->type = V_ASN1_NEG_INTEGER;
|
||||
if(bn->neg) ret->type = V_ASN1_NEG_INTEGER;
|
||||
else ret->type=V_ASN1_INTEGER;
|
||||
j=BN_num_bits(bn);
|
||||
len=((j == 0)?0:((j/8)+1));
|
||||
@@ -427,8 +426,7 @@ BIGNUM *ASN1_INTEGER_to_BN(ASN1_INTEGER *ai, BIGNUM *bn)
|
||||
|
||||
if ((ret=BN_bin2bn(ai->data,ai->length,bn)) == NULL)
|
||||
ASN1err(ASN1_F_ASN1_INTEGER_TO_BN,ASN1_R_BN_LIB);
|
||||
else if(ai->type == V_ASN1_NEG_INTEGER)
|
||||
BN_set_sign(ret, 1);
|
||||
else if(ai->type == V_ASN1_NEG_INTEGER) ret->neg = 1;
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
@@ -183,8 +183,8 @@ int i2a_ASN1_OBJECT(BIO *bp, ASN1_OBJECT *a)
|
||||
|
||||
if ((a == NULL) || (a->data == NULL))
|
||||
return(BIO_write(bp,"NULL",4));
|
||||
i=i2t_ASN1_OBJECT(buf,sizeof buf,a);
|
||||
if (i > sizeof buf) i=sizeof buf;
|
||||
i=i2t_ASN1_OBJECT(buf,80,a);
|
||||
if (i > 80) i=80;
|
||||
BIO_write(bp,buf,i);
|
||||
return(i);
|
||||
}
|
||||
|
@@ -204,9 +204,9 @@ int ASN1_sign(int (*i2d)(), X509_ALGOR *algor1, X509_ALGOR *algor2,
|
||||
err:
|
||||
EVP_MD_CTX_cleanup(&ctx);
|
||||
if (buf_in != NULL)
|
||||
{ OPENSSL_cleanse((char *)buf_in,(unsigned int)inl); OPENSSL_free(buf_in); }
|
||||
{ memset((char *)buf_in,0,(unsigned int)inl); OPENSSL_free(buf_in); }
|
||||
if (buf_out != NULL)
|
||||
{ OPENSSL_cleanse((char *)buf_out,outll); OPENSSL_free(buf_out); }
|
||||
{ memset((char *)buf_out,0,outll); OPENSSL_free(buf_out); }
|
||||
return(outl);
|
||||
}
|
||||
|
||||
@@ -287,8 +287,8 @@ int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,
|
||||
err:
|
||||
EVP_MD_CTX_cleanup(&ctx);
|
||||
if (buf_in != NULL)
|
||||
{ OPENSSL_cleanse((char *)buf_in,(unsigned int)inl); OPENSSL_free(buf_in); }
|
||||
{ memset((char *)buf_in,0,(unsigned int)inl); OPENSSL_free(buf_in); }
|
||||
if (buf_out != NULL)
|
||||
{ OPENSSL_cleanse((char *)buf_out,outll); OPENSSL_free(buf_out); }
|
||||
{ memset((char *)buf_out,0,outll); OPENSSL_free(buf_out); }
|
||||
return(outl);
|
||||
}
|
||||
|
@@ -63,7 +63,6 @@
|
||||
#include <openssl/asn1.h>
|
||||
|
||||
#include "charmap.h"
|
||||
#include "cryptlib.h"
|
||||
|
||||
/* ASN1_STRING_print_ex() and X509_NAME_print_ex().
|
||||
* Enhanced string and name printing routines handling
|
||||
@@ -115,17 +114,14 @@ typedef int char_io(void *arg, const void *buf, int len);
|
||||
static int do_esc_char(unsigned long c, unsigned char flags, char *do_quotes, char_io *io_ch, void *arg)
|
||||
{
|
||||
unsigned char chflgs, chtmp;
|
||||
char tmphex[HEX_SIZE(long)+3];
|
||||
|
||||
if(c > 0xffffffffL)
|
||||
return -1;
|
||||
char tmphex[11];
|
||||
if(c > 0xffff) {
|
||||
BIO_snprintf(tmphex, sizeof tmphex, "\\W%08lX", c);
|
||||
BIO_snprintf(tmphex, 11, "\\W%08lX", c);
|
||||
if(!io_ch(arg, tmphex, 10)) return -1;
|
||||
return 10;
|
||||
}
|
||||
if(c > 0xff) {
|
||||
BIO_snprintf(tmphex, sizeof tmphex, "\\U%04lX", c);
|
||||
BIO_snprintf(tmphex, 11, "\\U%04lX", c);
|
||||
if(!io_ch(arg, tmphex, 6)) return -1;
|
||||
return 6;
|
||||
}
|
||||
@@ -199,7 +195,7 @@ static int do_buf(unsigned char *buf, int buflen,
|
||||
if(type & BUF_TYPE_CONVUTF8) {
|
||||
unsigned char utfbuf[6];
|
||||
int utflen;
|
||||
utflen = UTF8_putc(utfbuf, sizeof utfbuf, c);
|
||||
utflen = UTF8_putc(utfbuf, 6, c);
|
||||
for(i = 0; i < utflen; i++) {
|
||||
/* We don't need to worry about setting orflags correctly
|
||||
* because if utflen==1 its value will be correct anyway
|
||||
@@ -465,7 +461,7 @@ static int do_name_ex(char_io *io_ch, void *arg, X509_NAME *n,
|
||||
if(fn_opt != XN_FLAG_FN_NONE) {
|
||||
int objlen, fld_len;
|
||||
if((fn_opt == XN_FLAG_FN_OID) || (fn_nid==NID_undef) ) {
|
||||
OBJ_obj2txt(objtmp, sizeof objtmp, fn, 1);
|
||||
OBJ_obj2txt(objtmp, 80, fn, 1);
|
||||
fld_len = 0; /* XXX: what should this be? */
|
||||
objbuf = objtmp;
|
||||
} else {
|
||||
@@ -548,7 +544,7 @@ int ASN1_STRING_to_UTF8(unsigned char **out, ASN1_STRING *in)
|
||||
{
|
||||
ASN1_STRING stmp, *str = &stmp;
|
||||
int mbflag, type, ret;
|
||||
if(!in) return -1;
|
||||
if(!*out || !in) return -1;
|
||||
type = in->type;
|
||||
if((type < 0) || (type > 30)) return -1;
|
||||
mbflag = tag2nbyte[type];
|
||||
@@ -557,6 +553,6 @@ int ASN1_STRING_to_UTF8(unsigned char **out, ASN1_STRING *in)
|
||||
stmp.data = NULL;
|
||||
ret = ASN1_mbstring_copy(&str, in->data, in->length, mbflag, B_ASN1_UTF8STRING);
|
||||
if(ret < 0) return ret;
|
||||
*out = stmp.data;
|
||||
if(out) *out = stmp.data;
|
||||
return stmp.length;
|
||||
}
|
||||
|
@@ -152,7 +152,7 @@ ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZE
|
||||
if (t->data[0] >= '5') strcpy(str, "19");
|
||||
else strcpy(str, "20");
|
||||
|
||||
BUF_strlcat(str, (char *)t->data, t->length+2);
|
||||
strcat(str, (char *)t->data);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@@ -62,7 +62,7 @@
|
||||
|
||||
int ASN1_TYPE_get(ASN1_TYPE *a)
|
||||
{
|
||||
if ((a->value.ptr != NULL) || (a->type == V_ASN1_NULL))
|
||||
if (a->value.ptr != NULL)
|
||||
return(a->type);
|
||||
else
|
||||
return(0);
|
||||
|
@@ -103,7 +103,7 @@ int ASN1_verify(int (*i2d)(), X509_ALGOR *a, ASN1_BIT_STRING *signature,
|
||||
EVP_VerifyInit_ex(&ctx,type, NULL);
|
||||
EVP_VerifyUpdate(&ctx,(unsigned char *)buf_in,inl);
|
||||
|
||||
OPENSSL_cleanse(buf_in,(unsigned int)inl);
|
||||
memset(buf_in,0,(unsigned int)inl);
|
||||
OPENSSL_free(buf_in);
|
||||
|
||||
if (EVP_VerifyFinal(&ctx,(unsigned char *)signature->data,
|
||||
@@ -153,7 +153,7 @@ int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *a, ASN1_BIT_STRING *signat
|
||||
EVP_VerifyInit_ex(&ctx,type, NULL);
|
||||
EVP_VerifyUpdate(&ctx,(unsigned char *)buf_in,inl);
|
||||
|
||||
OPENSSL_cleanse(buf_in,(unsigned int)inl);
|
||||
memset(buf_in,0,(unsigned int)inl);
|
||||
OPENSSL_free(buf_in);
|
||||
|
||||
if (EVP_VerifyFinal(&ctx,(unsigned char *)signature->data,
|
||||
|
@@ -70,6 +70,7 @@
|
||||
|
||||
#include <openssl/symhacks.h>
|
||||
|
||||
#include <openssl/e_os2.h>
|
||||
#include <openssl/ossl_typ.h>
|
||||
|
||||
#ifdef OPENSSL_BUILD_SHLIBCRYPTO
|
||||
@@ -191,11 +192,6 @@ typedef struct asn1_object_st
|
||||
} ASN1_OBJECT;
|
||||
|
||||
#define ASN1_STRING_FLAG_BITS_LEFT 0x08 /* Set if 0x07 has bits left value */
|
||||
/* This indicates that the ASN1_STRING is not a real value but just a place
|
||||
* holder for the location where indefinite length constructed data should
|
||||
* be inserted in the memory buffer
|
||||
*/
|
||||
#define ASN1_STRING_FLAG_NDEF 0x010
|
||||
/* This is the base type that holds just about everything :-) */
|
||||
typedef struct asn1_string_st
|
||||
{
|
||||
@@ -284,9 +280,6 @@ typedef struct ASN1_VALUE_st ASN1_VALUE;
|
||||
int i2d_##name(const type *a, unsigned char **out); \
|
||||
DECLARE_ASN1_ITEM(name)
|
||||
|
||||
#define DECLARE_ASN1_NDEF_FUNCTION(name) \
|
||||
int i2d_##name##_NDEF(name *a, unsigned char **out);
|
||||
|
||||
#define DECLARE_ASN1_FUNCTIONS_const(name) \
|
||||
name *name##_new(void); \
|
||||
void name##_free(name *a);
|
||||
@@ -800,8 +793,6 @@ DECLARE_ASN1_FUNCTIONS(ASN1_UTCTIME)
|
||||
DECLARE_ASN1_FUNCTIONS(ASN1_GENERALIZEDTIME)
|
||||
DECLARE_ASN1_FUNCTIONS(ASN1_TIME)
|
||||
|
||||
DECLARE_ASN1_ITEM(ASN1_OCTET_STRING_NDEF)
|
||||
|
||||
ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s,time_t t);
|
||||
int ASN1_TIME_check(ASN1_TIME *t);
|
||||
ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZEDTIME **out);
|
||||
@@ -858,7 +849,6 @@ int ASN1_get_object(unsigned char **pp, long *plength, int *ptag,
|
||||
int ASN1_check_infinite_end(unsigned char **p,long len);
|
||||
void ASN1_put_object(unsigned char **pp, int constructed, int length,
|
||||
int tag, int xclass);
|
||||
int ASN1_put_eoc(unsigned char **pp);
|
||||
int ASN1_object_size(int constructed, int length, int tag);
|
||||
|
||||
/* Used to implement other functions */
|
||||
@@ -945,13 +935,9 @@ ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it);
|
||||
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);
|
||||
int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it);
|
||||
int ASN1_item_ndef_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it);
|
||||
|
||||
void ASN1_add_oid_module(void);
|
||||
|
||||
ASN1_TYPE *ASN1_generate_nconf(char *str, CONF *nconf);
|
||||
ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf);
|
||||
|
||||
/* BEGIN ERROR CODES */
|
||||
/* 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.
|
||||
@@ -965,8 +951,6 @@ void ERR_load_ASN1_strings(void);
|
||||
#define ASN1_F_A2I_ASN1_ENUMERATED 101
|
||||
#define ASN1_F_A2I_ASN1_INTEGER 102
|
||||
#define ASN1_F_A2I_ASN1_STRING 103
|
||||
#define ASN1_F_APPEND_TAG 177
|
||||
#define ASN1_F_ASN1_CB 178
|
||||
#define ASN1_F_ASN1_CHECK_TLEN 104
|
||||
#define ASN1_F_ASN1_COLLATE_PRIMITIVE 105
|
||||
#define ASN1_F_ASN1_COLLECT 106
|
||||
@@ -977,7 +961,6 @@ void ERR_load_ASN1_strings(void);
|
||||
#define ASN1_F_ASN1_DUP 111
|
||||
#define ASN1_F_ASN1_ENUMERATED_SET 112
|
||||
#define ASN1_F_ASN1_ENUMERATED_TO_BN 113
|
||||
#define ASN1_F_ASN1_GENERATE_V3 182
|
||||
#define ASN1_F_ASN1_GET_OBJECT 114
|
||||
#define ASN1_F_ASN1_HEADER_NEW 115
|
||||
#define ASN1_F_ASN1_I2D_BIO 116
|
||||
@@ -993,7 +976,6 @@ void ERR_load_ASN1_strings(void);
|
||||
#define ASN1_F_ASN1_SEQ_PACK 126
|
||||
#define ASN1_F_ASN1_SEQ_UNPACK 127
|
||||
#define ASN1_F_ASN1_SIGN 128
|
||||
#define ASN1_F_ASN1_STR2TYPE 179
|
||||
#define ASN1_F_ASN1_STRING_TABLE_ADD 129
|
||||
#define ASN1_F_ASN1_STRING_TYPE_NEW 130
|
||||
#define ASN1_F_ASN1_TEMPLATE_D2I 131
|
||||
@@ -1003,7 +985,6 @@ void ERR_load_ASN1_strings(void);
|
||||
#define ASN1_F_ASN1_TYPE_GET_OCTETSTRING 135
|
||||
#define ASN1_F_ASN1_UNPACK_STRING 136
|
||||
#define ASN1_F_ASN1_VERIFY 137
|
||||
#define ASN1_F_BITSTR_CB 180
|
||||
#define ASN1_F_BN_TO_ASN1_ENUMERATED 138
|
||||
#define ASN1_F_BN_TO_ASN1_INTEGER 139
|
||||
#define ASN1_F_COLLECT_DATA 140
|
||||
@@ -1028,15 +1009,12 @@ void ERR_load_ASN1_strings(void);
|
||||
#define ASN1_F_D2I_X509_PKEY 159
|
||||
#define ASN1_F_I2D_ASN1_TIME 160
|
||||
#define ASN1_F_I2D_DSA_PUBKEY 161
|
||||
#define ASN1_F_I2D_ECDSA_PUBKEY 174
|
||||
#define ASN1_F_I2D_EC_PUBKEY 176
|
||||
#define ASN1_F_I2D_NETSCAPE_RSA 162
|
||||
#define ASN1_F_I2D_PRIVATEKEY 163
|
||||
#define ASN1_F_I2D_PUBLICKEY 164
|
||||
#define ASN1_F_I2D_RSA_PUBKEY 165
|
||||
#define ASN1_F_LONG_C2I 166
|
||||
#define ASN1_F_OID_MODULE_INIT 175
|
||||
#define ASN1_F_PARSE_TAGGING 181
|
||||
#define ASN1_F_OID_MODULE_INIT 174
|
||||
#define ASN1_F_PKCS5_PBE2_SET 167
|
||||
#define ASN1_F_X509_CINF_NEW 168
|
||||
#define ASN1_F_X509_CRL_ADD0_REVOKED 169
|
||||
@@ -1059,7 +1037,6 @@ void ERR_load_ASN1_strings(void);
|
||||
#define ASN1_R_DATA_IS_WRONG 109
|
||||
#define ASN1_R_DECODE_ERROR 110
|
||||
#define ASN1_R_DECODING_ERROR 111
|
||||
#define ASN1_R_DEPTH_EXCEEDED 173
|
||||
#define ASN1_R_ENCODE_ERROR 112
|
||||
#define ASN1_R_ERROR_LOADING_SECTION 172
|
||||
#define ASN1_R_ERROR_PARSING_SET_ELEMENT 113
|
||||
@@ -1073,57 +1050,38 @@ void ERR_load_ASN1_strings(void);
|
||||
#define ASN1_R_FIELD_MISSING 121
|
||||
#define ASN1_R_FIRST_NUM_TOO_LARGE 122
|
||||
#define ASN1_R_HEADER_TOO_LONG 123
|
||||
#define ASN1_R_ILLEGAL_BITSTRING_FORMAT 174
|
||||
#define ASN1_R_ILLEGAL_BOOLEAN 175
|
||||
#define ASN1_R_ILLEGAL_CHARACTERS 124
|
||||
#define ASN1_R_ILLEGAL_FORMAT 176
|
||||
#define ASN1_R_ILLEGAL_HEX 177
|
||||
#define ASN1_R_ILLEGAL_IMPLICIT_TAG 178
|
||||
#define ASN1_R_ILLEGAL_INTEGER 179
|
||||
#define ASN1_R_ILLEGAL_NESTED_TAGGING 180
|
||||
#define ASN1_R_ILLEGAL_NULL 125
|
||||
#define ASN1_R_ILLEGAL_NULL_VALUE 181
|
||||
#define ASN1_R_ILLEGAL_OBJECT 182
|
||||
#define ASN1_R_ILLEGAL_OPTIONAL_ANY 126
|
||||
#define ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE 170
|
||||
#define ASN1_R_ILLEGAL_TAGGED_ANY 127
|
||||
#define ASN1_R_ILLEGAL_TIME_VALUE 183
|
||||
#define ASN1_R_INTEGER_NOT_ASCII_FORMAT 184
|
||||
#define ASN1_R_INTEGER_TOO_LARGE_FOR_LONG 128
|
||||
#define ASN1_R_INVALID_BMPSTRING_LENGTH 129
|
||||
#define ASN1_R_INVALID_DIGIT 130
|
||||
#define ASN1_R_INVALID_MODIFIER 185
|
||||
#define ASN1_R_INVALID_NUMBER 186
|
||||
#define ASN1_R_INVALID_SEPARATOR 131
|
||||
#define ASN1_R_INVALID_TIME_FORMAT 132
|
||||
#define ASN1_R_INVALID_UNIVERSALSTRING_LENGTH 133
|
||||
#define ASN1_R_INVALID_UTF8STRING 134
|
||||
#define ASN1_R_IV_TOO_LARGE 135
|
||||
#define ASN1_R_LENGTH_ERROR 136
|
||||
#define ASN1_R_LIST_ERROR 187
|
||||
#define ASN1_R_MISSING_EOC 137
|
||||
#define ASN1_R_MISSING_SECOND_NUMBER 138
|
||||
#define ASN1_R_MISSING_VALUE 188
|
||||
#define ASN1_R_MSTRING_NOT_UNIVERSAL 139
|
||||
#define ASN1_R_MSTRING_WRONG_TAG 140
|
||||
#define ASN1_R_NON_HEX_CHARACTERS 141
|
||||
#define ASN1_R_NOT_ASCII_FORMAT 189
|
||||
#define ASN1_R_NOT_ENOUGH_DATA 142
|
||||
#define ASN1_R_NO_MATCHING_CHOICE_TYPE 143
|
||||
#define ASN1_R_NULL_IS_WRONG_LENGTH 144
|
||||
#define ASN1_R_OBJECT_NOT_ASCII_FORMAT 190
|
||||
#define ASN1_R_ODD_NUMBER_OF_CHARS 145
|
||||
#define ASN1_R_PRIVATE_KEY_HEADER_MISSING 146
|
||||
#define ASN1_R_SECOND_NUMBER_TOO_LARGE 147
|
||||
#define ASN1_R_SEQUENCE_LENGTH_MISMATCH 148
|
||||
#define ASN1_R_SEQUENCE_NOT_CONSTRUCTED 149
|
||||
#define ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG 195
|
||||
#define ASN1_R_SHORT_LINE 150
|
||||
#define ASN1_R_STRING_TOO_LONG 151
|
||||
#define ASN1_R_STRING_TOO_SHORT 152
|
||||
#define ASN1_R_TAG_VALUE_TOO_HIGH 153
|
||||
#define ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 154
|
||||
#define ASN1_R_TIME_NOT_ASCII_FORMAT 191
|
||||
#define ASN1_R_TOO_LONG 155
|
||||
#define ASN1_R_TYPE_NOT_CONSTRUCTED 156
|
||||
#define ASN1_R_UNABLE_TO_DECODE_RSA_KEY 157
|
||||
@@ -1133,13 +1091,10 @@ void ERR_load_ASN1_strings(void);
|
||||
#define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM 161
|
||||
#define ASN1_R_UNKNOWN_OBJECT_TYPE 162
|
||||
#define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE 163
|
||||
#define ASN1_R_UNKNOWN_TAG 192
|
||||
#define ASN1_R_UNKOWN_FORMAT 193
|
||||
#define ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE 164
|
||||
#define ASN1_R_UNSUPPORTED_CIPHER 165
|
||||
#define ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM 166
|
||||
#define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE 167
|
||||
#define ASN1_R_UNSUPPORTED_TYPE 194
|
||||
#define ASN1_R_WRONG_TAG 168
|
||||
#define ASN1_R_WRONG_TYPE 169
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/* crypto/asn1/asn1_err.c */
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1999-2002 The OpenSSL Project. All rights reserved.
|
||||
* Copyright (c) 1999 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -70,8 +70,6 @@ static ERR_STRING_DATA ASN1_str_functs[]=
|
||||
{ERR_PACK(0,ASN1_F_A2I_ASN1_ENUMERATED,0), "a2i_ASN1_ENUMERATED"},
|
||||
{ERR_PACK(0,ASN1_F_A2I_ASN1_INTEGER,0), "a2i_ASN1_INTEGER"},
|
||||
{ERR_PACK(0,ASN1_F_A2I_ASN1_STRING,0), "a2i_ASN1_STRING"},
|
||||
{ERR_PACK(0,ASN1_F_APPEND_TAG,0), "APPEND_TAG"},
|
||||
{ERR_PACK(0,ASN1_F_ASN1_CB,0), "ASN1_CB"},
|
||||
{ERR_PACK(0,ASN1_F_ASN1_CHECK_TLEN,0), "ASN1_CHECK_TLEN"},
|
||||
{ERR_PACK(0,ASN1_F_ASN1_COLLATE_PRIMITIVE,0), "ASN1_COLLATE_PRIMITIVE"},
|
||||
{ERR_PACK(0,ASN1_F_ASN1_COLLECT,0), "ASN1_COLLECT"},
|
||||
@@ -82,7 +80,6 @@ static ERR_STRING_DATA ASN1_str_functs[]=
|
||||
{ERR_PACK(0,ASN1_F_ASN1_DUP,0), "ASN1_dup"},
|
||||
{ERR_PACK(0,ASN1_F_ASN1_ENUMERATED_SET,0), "ASN1_ENUMERATED_set"},
|
||||
{ERR_PACK(0,ASN1_F_ASN1_ENUMERATED_TO_BN,0), "ASN1_ENUMERATED_to_BN"},
|
||||
{ERR_PACK(0,ASN1_F_ASN1_GENERATE_V3,0), "ASN1_generate_v3"},
|
||||
{ERR_PACK(0,ASN1_F_ASN1_GET_OBJECT,0), "ASN1_get_object"},
|
||||
{ERR_PACK(0,ASN1_F_ASN1_HEADER_NEW,0), "ASN1_HEADER_new"},
|
||||
{ERR_PACK(0,ASN1_F_ASN1_I2D_BIO,0), "ASN1_i2d_bio"},
|
||||
@@ -98,7 +95,6 @@ static ERR_STRING_DATA ASN1_str_functs[]=
|
||||
{ERR_PACK(0,ASN1_F_ASN1_SEQ_PACK,0), "ASN1_seq_pack"},
|
||||
{ERR_PACK(0,ASN1_F_ASN1_SEQ_UNPACK,0), "ASN1_seq_unpack"},
|
||||
{ERR_PACK(0,ASN1_F_ASN1_SIGN,0), "ASN1_sign"},
|
||||
{ERR_PACK(0,ASN1_F_ASN1_STR2TYPE,0), "ASN1_STR2TYPE"},
|
||||
{ERR_PACK(0,ASN1_F_ASN1_STRING_TABLE_ADD,0), "ASN1_STRING_TABLE_add"},
|
||||
{ERR_PACK(0,ASN1_F_ASN1_STRING_TYPE_NEW,0), "ASN1_STRING_type_new"},
|
||||
{ERR_PACK(0,ASN1_F_ASN1_TEMPLATE_D2I,0), "ASN1_TEMPLATE_D2I"},
|
||||
@@ -108,7 +104,6 @@ static ERR_STRING_DATA ASN1_str_functs[]=
|
||||
{ERR_PACK(0,ASN1_F_ASN1_TYPE_GET_OCTETSTRING,0), "ASN1_TYPE_get_octetstring"},
|
||||
{ERR_PACK(0,ASN1_F_ASN1_UNPACK_STRING,0), "ASN1_unpack_string"},
|
||||
{ERR_PACK(0,ASN1_F_ASN1_VERIFY,0), "ASN1_verify"},
|
||||
{ERR_PACK(0,ASN1_F_BITSTR_CB,0), "BITSTR_CB"},
|
||||
{ERR_PACK(0,ASN1_F_BN_TO_ASN1_ENUMERATED,0), "BN_to_ASN1_ENUMERATED"},
|
||||
{ERR_PACK(0,ASN1_F_BN_TO_ASN1_INTEGER,0), "BN_to_ASN1_INTEGER"},
|
||||
{ERR_PACK(0,ASN1_F_COLLECT_DATA,0), "COLLECT_DATA"},
|
||||
@@ -133,15 +128,12 @@ static ERR_STRING_DATA ASN1_str_functs[]=
|
||||
{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_DSA_PUBKEY,0), "i2d_DSA_PUBKEY"},
|
||||
{ERR_PACK(0,ASN1_F_I2D_ECDSA_PUBKEY,0), "I2D_ECDSA_PUBKEY"},
|
||||
{ERR_PACK(0,ASN1_F_I2D_EC_PUBKEY,0), "i2d_EC_PUBKEY"},
|
||||
{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_PUBLICKEY,0), "i2d_PublicKey"},
|
||||
{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_OID_MODULE_INIT,0), "OID_MODULE_INIT"},
|
||||
{ERR_PACK(0,ASN1_F_PARSE_TAGGING,0), "PARSE_TAGGING"},
|
||||
{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_CRL_ADD0_REVOKED,0), "X509_CRL_add0_revoked"},
|
||||
@@ -167,7 +159,6 @@ static ERR_STRING_DATA ASN1_str_reasons[]=
|
||||
{ASN1_R_DATA_IS_WRONG ,"data is wrong"},
|
||||
{ASN1_R_DECODE_ERROR ,"decode error"},
|
||||
{ASN1_R_DECODING_ERROR ,"decoding error"},
|
||||
{ASN1_R_DEPTH_EXCEEDED ,"depth exceeded"},
|
||||
{ASN1_R_ENCODE_ERROR ,"encode error"},
|
||||
{ASN1_R_ERROR_LOADING_SECTION ,"error loading section"},
|
||||
{ASN1_R_ERROR_PARSING_SET_ELEMENT ,"error parsing set element"},
|
||||
@@ -181,57 +172,38 @@ static ERR_STRING_DATA ASN1_str_reasons[]=
|
||||
{ASN1_R_FIELD_MISSING ,"field missing"},
|
||||
{ASN1_R_FIRST_NUM_TOO_LARGE ,"first num too large"},
|
||||
{ASN1_R_HEADER_TOO_LONG ,"header too long"},
|
||||
{ASN1_R_ILLEGAL_BITSTRING_FORMAT ,"illegal bitstring format"},
|
||||
{ASN1_R_ILLEGAL_BOOLEAN ,"illegal boolean"},
|
||||
{ASN1_R_ILLEGAL_CHARACTERS ,"illegal characters"},
|
||||
{ASN1_R_ILLEGAL_FORMAT ,"illegal format"},
|
||||
{ASN1_R_ILLEGAL_HEX ,"illegal hex"},
|
||||
{ASN1_R_ILLEGAL_IMPLICIT_TAG ,"illegal implicit tag"},
|
||||
{ASN1_R_ILLEGAL_INTEGER ,"illegal integer"},
|
||||
{ASN1_R_ILLEGAL_NESTED_TAGGING ,"illegal nested tagging"},
|
||||
{ASN1_R_ILLEGAL_NULL ,"illegal null"},
|
||||
{ASN1_R_ILLEGAL_NULL_VALUE ,"illegal null value"},
|
||||
{ASN1_R_ILLEGAL_OBJECT ,"illegal object"},
|
||||
{ASN1_R_ILLEGAL_OPTIONAL_ANY ,"illegal optional any"},
|
||||
{ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE ,"illegal options on item template"},
|
||||
{ASN1_R_ILLEGAL_TAGGED_ANY ,"illegal tagged any"},
|
||||
{ASN1_R_ILLEGAL_TIME_VALUE ,"illegal time value"},
|
||||
{ASN1_R_INTEGER_NOT_ASCII_FORMAT ,"integer not ascii format"},
|
||||
{ASN1_R_INTEGER_TOO_LARGE_FOR_LONG ,"integer too large for long"},
|
||||
{ASN1_R_INVALID_BMPSTRING_LENGTH ,"invalid bmpstring length"},
|
||||
{ASN1_R_INVALID_DIGIT ,"invalid digit"},
|
||||
{ASN1_R_INVALID_MODIFIER ,"invalid modifier"},
|
||||
{ASN1_R_INVALID_NUMBER ,"invalid number"},
|
||||
{ASN1_R_INVALID_SEPARATOR ,"invalid separator"},
|
||||
{ASN1_R_INVALID_TIME_FORMAT ,"invalid time format"},
|
||||
{ASN1_R_INVALID_UNIVERSALSTRING_LENGTH ,"invalid universalstring length"},
|
||||
{ASN1_R_INVALID_UTF8STRING ,"invalid utf8string"},
|
||||
{ASN1_R_IV_TOO_LARGE ,"iv too large"},
|
||||
{ASN1_R_LENGTH_ERROR ,"length error"},
|
||||
{ASN1_R_LIST_ERROR ,"list error"},
|
||||
{ASN1_R_MISSING_EOC ,"missing eoc"},
|
||||
{ASN1_R_MISSING_SECOND_NUMBER ,"missing second number"},
|
||||
{ASN1_R_MISSING_VALUE ,"missing value"},
|
||||
{ASN1_R_MSTRING_NOT_UNIVERSAL ,"mstring not universal"},
|
||||
{ASN1_R_MSTRING_WRONG_TAG ,"mstring wrong tag"},
|
||||
{ASN1_R_NON_HEX_CHARACTERS ,"non hex characters"},
|
||||
{ASN1_R_NOT_ASCII_FORMAT ,"not ascii format"},
|
||||
{ASN1_R_NOT_ENOUGH_DATA ,"not enough data"},
|
||||
{ASN1_R_NO_MATCHING_CHOICE_TYPE ,"no matching choice type"},
|
||||
{ASN1_R_NULL_IS_WRONG_LENGTH ,"null is wrong length"},
|
||||
{ASN1_R_OBJECT_NOT_ASCII_FORMAT ,"object not ascii format"},
|
||||
{ASN1_R_ODD_NUMBER_OF_CHARS ,"odd number of chars"},
|
||||
{ASN1_R_PRIVATE_KEY_HEADER_MISSING ,"private key header missing"},
|
||||
{ASN1_R_SECOND_NUMBER_TOO_LARGE ,"second number too large"},
|
||||
{ASN1_R_SEQUENCE_LENGTH_MISMATCH ,"sequence length mismatch"},
|
||||
{ASN1_R_SEQUENCE_NOT_CONSTRUCTED ,"sequence not constructed"},
|
||||
{ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG ,"sequence or set needs config"},
|
||||
{ASN1_R_SHORT_LINE ,"short line"},
|
||||
{ASN1_R_STRING_TOO_LONG ,"string too long"},
|
||||
{ASN1_R_STRING_TOO_SHORT ,"string too short"},
|
||||
{ASN1_R_TAG_VALUE_TOO_HIGH ,"tag value too high"},
|
||||
{ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD,"the asn1 object identifier is not known for this md"},
|
||||
{ASN1_R_TIME_NOT_ASCII_FORMAT ,"time not ascii format"},
|
||||
{ASN1_R_TOO_LONG ,"too long"},
|
||||
{ASN1_R_TYPE_NOT_CONSTRUCTED ,"type not constructed"},
|
||||
{ASN1_R_UNABLE_TO_DECODE_RSA_KEY ,"unable to decode rsa key"},
|
||||
@@ -241,13 +213,10 @@ static ERR_STRING_DATA ASN1_str_reasons[]=
|
||||
{ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM ,"unknown message digest algorithm"},
|
||||
{ASN1_R_UNKNOWN_OBJECT_TYPE ,"unknown object type"},
|
||||
{ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE ,"unknown public key type"},
|
||||
{ASN1_R_UNKNOWN_TAG ,"unknown tag"},
|
||||
{ASN1_R_UNKOWN_FORMAT ,"unkown format"},
|
||||
{ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE ,"unsupported any defined by type"},
|
||||
{ASN1_R_UNSUPPORTED_CIPHER ,"unsupported cipher"},
|
||||
{ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM ,"unsupported encryption algorithm"},
|
||||
{ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE ,"unsupported public key type"},
|
||||
{ASN1_R_UNSUPPORTED_TYPE ,"unsupported type"},
|
||||
{ASN1_R_WRONG_TAG ,"wrong tag"},
|
||||
{ASN1_R_WRONG_TYPE ,"wrong type"},
|
||||
{0,NULL}
|
||||
|
@@ -1,839 +0,0 @@
|
||||
/* asn1_gen.c */
|
||||
/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL
|
||||
* project 2002.
|
||||
*/
|
||||
/* ====================================================================
|
||||
* Copyright (c) 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
|
||||
* 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 "cryptlib.h"
|
||||
#include <openssl/asn1.h>
|
||||
#include <openssl/x509v3.h>
|
||||
|
||||
#define ASN1_GEN_FLAG 0x10000
|
||||
#define ASN1_GEN_FLAG_IMP (ASN1_GEN_FLAG|1)
|
||||
#define ASN1_GEN_FLAG_EXP (ASN1_GEN_FLAG|2)
|
||||
#define ASN1_GEN_FLAG_TAG (ASN1_GEN_FLAG|3)
|
||||
#define ASN1_GEN_FLAG_BITWRAP (ASN1_GEN_FLAG|4)
|
||||
#define ASN1_GEN_FLAG_OCTWRAP (ASN1_GEN_FLAG|5)
|
||||
#define ASN1_GEN_FLAG_SEQWRAP (ASN1_GEN_FLAG|6)
|
||||
#define ASN1_GEN_FLAG_SETWRAP (ASN1_GEN_FLAG|7)
|
||||
#define ASN1_GEN_FLAG_FORMAT (ASN1_GEN_FLAG|8)
|
||||
|
||||
#define ASN1_GEN_STR(str,val) {str, sizeof(str) - 1, val}
|
||||
|
||||
#define ASN1_FLAG_EXP_MAX 20
|
||||
|
||||
/* Input formats */
|
||||
|
||||
/* ASCII: default */
|
||||
#define ASN1_GEN_FORMAT_ASCII 1
|
||||
/* UTF8 */
|
||||
#define ASN1_GEN_FORMAT_UTF8 2
|
||||
/* Hex */
|
||||
#define ASN1_GEN_FORMAT_HEX 3
|
||||
/* List of bits */
|
||||
#define ASN1_GEN_FORMAT_BITLIST 4
|
||||
|
||||
|
||||
struct tag_name_st
|
||||
{
|
||||
char *strnam;
|
||||
int len;
|
||||
int tag;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int exp_tag;
|
||||
int exp_class;
|
||||
int exp_constructed;
|
||||
int exp_pad;
|
||||
long exp_len;
|
||||
} tag_exp_type;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int imp_tag;
|
||||
int imp_class;
|
||||
int utype;
|
||||
int format;
|
||||
const char *str;
|
||||
tag_exp_type exp_list[ASN1_FLAG_EXP_MAX];
|
||||
int exp_count;
|
||||
} tag_exp_arg;
|
||||
|
||||
static int bitstr_cb(const char *elem, int len, void *bitstr);
|
||||
static int asn1_cb(const char *elem, int len, void *bitstr);
|
||||
static int append_exp(tag_exp_arg *arg, int exp_tag, int exp_class, int exp_constructed, int exp_pad, int imp_ok);
|
||||
static int parse_tagging(const char *vstart, int vlen, int *ptag, int *pclass);
|
||||
static ASN1_TYPE *asn1_multi(int utype, const char *section, X509V3_CTX *cnf);
|
||||
static ASN1_TYPE *asn1_str2type(const char *str, int format, int utype);
|
||||
static int asn1_str2tag(const char *tagstr, int len);
|
||||
|
||||
ASN1_TYPE *ASN1_generate_nconf(char *str, CONF *nconf)
|
||||
{
|
||||
X509V3_CTX cnf;
|
||||
|
||||
if (!nconf)
|
||||
return ASN1_generate_v3(str, NULL);
|
||||
|
||||
X509V3_set_nconf(&cnf, nconf);
|
||||
return ASN1_generate_v3(str, &cnf);
|
||||
}
|
||||
|
||||
ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf)
|
||||
{
|
||||
ASN1_TYPE *ret;
|
||||
tag_exp_arg asn1_tags;
|
||||
tag_exp_type *etmp;
|
||||
|
||||
int i, len;
|
||||
|
||||
unsigned char *orig_der = NULL, *new_der = NULL;
|
||||
unsigned char *cpy_start, *p;
|
||||
int cpy_len;
|
||||
long hdr_len;
|
||||
int hdr_constructed = 0, hdr_tag, hdr_class;
|
||||
int r;
|
||||
|
||||
asn1_tags.imp_tag = -1;
|
||||
asn1_tags.imp_class = -1;
|
||||
asn1_tags.format = ASN1_GEN_FORMAT_ASCII;
|
||||
asn1_tags.exp_count = 0;
|
||||
if (CONF_parse_list(str, ',', 1, asn1_cb, &asn1_tags) != 0)
|
||||
return NULL;
|
||||
|
||||
if ((asn1_tags.utype == V_ASN1_SEQUENCE) || (asn1_tags.utype == V_ASN1_SET))
|
||||
{
|
||||
if (!cnf)
|
||||
{
|
||||
ASN1err(ASN1_F_ASN1_GENERATE_V3, ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG);
|
||||
return NULL;
|
||||
}
|
||||
ret = asn1_multi(asn1_tags.utype, asn1_tags.str, cnf);
|
||||
}
|
||||
else
|
||||
ret = asn1_str2type(asn1_tags.str, asn1_tags.format, asn1_tags.utype);
|
||||
|
||||
if (!ret)
|
||||
return NULL;
|
||||
|
||||
/* If no tagging return base type */
|
||||
if ((asn1_tags.imp_tag == -1) && (asn1_tags.exp_count == 0))
|
||||
return ret;
|
||||
|
||||
/* Generate the encoding */
|
||||
cpy_len = i2d_ASN1_TYPE(ret, &orig_der);
|
||||
ASN1_TYPE_free(ret);
|
||||
ret = NULL;
|
||||
/* Set point to start copying for modified encoding */
|
||||
cpy_start = orig_der;
|
||||
|
||||
/* Do we need IMPLICIT tagging? */
|
||||
if (asn1_tags.imp_tag != -1)
|
||||
{
|
||||
/* If IMPLICIT we will replace the underlying tag */
|
||||
/* Skip existing tag+len */
|
||||
r = ASN1_get_object(&cpy_start, &hdr_len, &hdr_tag, &hdr_class, cpy_len);
|
||||
if (r & 0x80)
|
||||
goto err;
|
||||
/* Update copy length */
|
||||
cpy_len -= cpy_start - orig_der;
|
||||
/* For IMPLICIT tagging the length should match the
|
||||
* original length and constructed flag should be
|
||||
* consistent.
|
||||
*/
|
||||
if (r & 0x1)
|
||||
{
|
||||
/* Indefinite length constructed */
|
||||
hdr_constructed = 2;
|
||||
hdr_len = 0;
|
||||
}
|
||||
else
|
||||
/* Just retain constructed flag */
|
||||
hdr_constructed = r & V_ASN1_CONSTRUCTED;
|
||||
/* Work out new length with IMPLICIT tag: ignore constructed
|
||||
* because it will mess up if indefinite length
|
||||
*/
|
||||
len = ASN1_object_size(0, hdr_len, asn1_tags.imp_tag);
|
||||
}
|
||||
else
|
||||
len = cpy_len;
|
||||
|
||||
/* Work out length in any EXPLICIT, starting from end */
|
||||
|
||||
for(i = 0, etmp = asn1_tags.exp_list + asn1_tags.exp_count - 1; i < asn1_tags.exp_count; i++, etmp--)
|
||||
{
|
||||
/* Content length: number of content octets + any padding */
|
||||
len += etmp->exp_pad;
|
||||
etmp->exp_len = len;
|
||||
/* Total object length: length including new header */
|
||||
len = ASN1_object_size(0, len, etmp->exp_tag);
|
||||
}
|
||||
|
||||
/* Allocate buffer for new encoding */
|
||||
|
||||
new_der = OPENSSL_malloc(len);
|
||||
|
||||
/* Generate tagged encoding */
|
||||
|
||||
p = new_der;
|
||||
|
||||
/* Output explicit tags first */
|
||||
|
||||
for (i = 0, etmp = asn1_tags.exp_list; i < asn1_tags.exp_count; i++, etmp++)
|
||||
{
|
||||
ASN1_put_object(&p, etmp->exp_constructed, etmp->exp_len,
|
||||
etmp->exp_tag, etmp->exp_class);
|
||||
if (etmp->exp_pad)
|
||||
*p++ = 0;
|
||||
}
|
||||
|
||||
/* If IMPLICIT, output tag */
|
||||
|
||||
if (asn1_tags.imp_tag != -1)
|
||||
ASN1_put_object(&p, hdr_constructed, hdr_len,
|
||||
asn1_tags.imp_tag, asn1_tags.imp_class);
|
||||
|
||||
/* Copy across original encoding */
|
||||
memcpy(p, cpy_start, cpy_len);
|
||||
|
||||
p = new_der;
|
||||
|
||||
/* Obtain new ASN1_TYPE structure */
|
||||
ret = d2i_ASN1_TYPE(NULL, &p, len);
|
||||
|
||||
err:
|
||||
if (orig_der)
|
||||
OPENSSL_free(orig_der);
|
||||
if (new_der)
|
||||
OPENSSL_free(new_der);
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
static int asn1_cb(const char *elem, int len, void *bitstr)
|
||||
{
|
||||
tag_exp_arg *arg = bitstr;
|
||||
int i;
|
||||
int utype;
|
||||
int vlen = 0;
|
||||
const char *p, *vstart = NULL;
|
||||
|
||||
int tmp_tag, tmp_class;
|
||||
|
||||
for(i = 0, p = elem; i < len; p++, i++)
|
||||
{
|
||||
/* Look for the ':' in name value pairs */
|
||||
if (*p == ':')
|
||||
{
|
||||
vstart = p + 1;
|
||||
vlen = len - (vstart - elem);
|
||||
len = p - elem;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
utype = asn1_str2tag(elem, len);
|
||||
|
||||
if (utype == -1)
|
||||
{
|
||||
ASN1err(ASN1_F_ASN1_CB, ASN1_R_UNKNOWN_TAG);
|
||||
ERR_add_error_data(2, "tag=", elem);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* If this is not a modifier mark end of string and exit */
|
||||
if (!(utype & ASN1_GEN_FLAG))
|
||||
{
|
||||
arg->utype = utype;
|
||||
arg->str = vstart;
|
||||
/* If no value and not end of string, error */
|
||||
if (!vstart && elem[len])
|
||||
{
|
||||
ASN1err(ASN1_F_ASN1_CB, ASN1_R_MISSING_VALUE);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch(utype)
|
||||
{
|
||||
|
||||
case ASN1_GEN_FLAG_IMP:
|
||||
/* Check for illegal multiple IMPLICIT tagging */
|
||||
if (arg->imp_tag != -1)
|
||||
{
|
||||
ASN1err(ASN1_F_ASN1_CB, ASN1_R_ILLEGAL_NESTED_TAGGING);
|
||||
return -1;
|
||||
}
|
||||
if (!parse_tagging(vstart, vlen, &arg->imp_tag, &arg->imp_class))
|
||||
return -1;
|
||||
break;
|
||||
|
||||
case ASN1_GEN_FLAG_EXP:
|
||||
|
||||
if (!parse_tagging(vstart, vlen, &tmp_tag, &tmp_class))
|
||||
return -1;
|
||||
if (!append_exp(arg, tmp_tag, tmp_class, 1, 0, 0))
|
||||
return -1;
|
||||
break;
|
||||
|
||||
case ASN1_GEN_FLAG_SEQWRAP:
|
||||
if (!append_exp(arg, V_ASN1_SEQUENCE, V_ASN1_UNIVERSAL, 1, 0, 1))
|
||||
return -1;
|
||||
break;
|
||||
|
||||
case ASN1_GEN_FLAG_SETWRAP:
|
||||
if (!append_exp(arg, V_ASN1_SET, V_ASN1_UNIVERSAL, 1, 0, 1))
|
||||
return -1;
|
||||
break;
|
||||
|
||||
case ASN1_GEN_FLAG_BITWRAP:
|
||||
if (!append_exp(arg, V_ASN1_BIT_STRING, V_ASN1_UNIVERSAL, 0, 1, 1))
|
||||
return -1;
|
||||
break;
|
||||
|
||||
case ASN1_GEN_FLAG_OCTWRAP:
|
||||
if (!append_exp(arg, V_ASN1_OCTET_STRING, V_ASN1_UNIVERSAL, 0, 0, 1))
|
||||
return -1;
|
||||
break;
|
||||
|
||||
case ASN1_GEN_FLAG_FORMAT:
|
||||
if (!strncmp(vstart, "ASCII", 5))
|
||||
arg->format = ASN1_GEN_FORMAT_ASCII;
|
||||
else if (!strncmp(vstart, "UTF8", 4))
|
||||
arg->format = ASN1_GEN_FORMAT_UTF8;
|
||||
else if (!strncmp(vstart, "HEX", 3))
|
||||
arg->format = ASN1_GEN_FORMAT_HEX;
|
||||
else if (!strncmp(vstart, "BITLIST", 3))
|
||||
arg->format = ASN1_GEN_FORMAT_BITLIST;
|
||||
else
|
||||
{
|
||||
ASN1err(ASN1_F_ASN1_CB, ASN1_R_UNKOWN_FORMAT);
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
static int parse_tagging(const char *vstart, int vlen, int *ptag, int *pclass)
|
||||
{
|
||||
char erch[2];
|
||||
long tag_num;
|
||||
char *eptr;
|
||||
if (!vstart)
|
||||
return 0;
|
||||
tag_num = strtoul(vstart, &eptr, 10);
|
||||
/* Check we haven't gone past max length: should be impossible */
|
||||
if (eptr && *eptr && (eptr > vstart + vlen))
|
||||
return 0;
|
||||
if (tag_num < 0)
|
||||
{
|
||||
ASN1err(ASN1_F_PARSE_TAGGING, ASN1_R_INVALID_NUMBER);
|
||||
return 0;
|
||||
}
|
||||
*ptag = tag_num;
|
||||
/* If we have non numeric characters, parse them */
|
||||
if (eptr)
|
||||
vlen -= eptr - vstart;
|
||||
else
|
||||
vlen = 0;
|
||||
if (vlen)
|
||||
{
|
||||
switch (*eptr)
|
||||
{
|
||||
|
||||
case 'U':
|
||||
*pclass = V_ASN1_UNIVERSAL;
|
||||
break;
|
||||
|
||||
case 'A':
|
||||
*pclass = V_ASN1_APPLICATION;
|
||||
break;
|
||||
|
||||
case 'P':
|
||||
*pclass = V_ASN1_PRIVATE;
|
||||
break;
|
||||
|
||||
case 'C':
|
||||
*pclass = V_ASN1_CONTEXT_SPECIFIC;
|
||||
break;
|
||||
|
||||
default:
|
||||
erch[0] = *eptr;
|
||||
erch[1] = 0;
|
||||
ASN1err(ASN1_F_PARSE_TAGGING, ASN1_R_INVALID_MODIFIER);
|
||||
ERR_add_error_data(2, "Char=", erch);
|
||||
return 0;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
*pclass = V_ASN1_CONTEXT_SPECIFIC;
|
||||
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
/* Handle multiple types: SET and SEQUENCE */
|
||||
|
||||
static ASN1_TYPE *asn1_multi(int utype, const char *section, X509V3_CTX *cnf)
|
||||
{
|
||||
ASN1_TYPE *ret = NULL, *typ = NULL;
|
||||
STACK_OF(ASN1_TYPE) *sk = NULL;
|
||||
STACK_OF(CONF_VALUE) *sect = NULL;
|
||||
unsigned char *der = NULL, *p;
|
||||
int derlen;
|
||||
int i, is_set;
|
||||
sk = sk_ASN1_TYPE_new_null();
|
||||
if (section)
|
||||
{
|
||||
if (!cnf)
|
||||
goto bad;
|
||||
sect = X509V3_get_section(cnf, (char *)section);
|
||||
if (!sect)
|
||||
goto bad;
|
||||
for (i = 0; i < sk_CONF_VALUE_num(sect); i++)
|
||||
{
|
||||
typ = ASN1_generate_v3(sk_CONF_VALUE_value(sect, i)->value, cnf);
|
||||
if (!typ)
|
||||
goto bad;
|
||||
sk_ASN1_TYPE_push(sk, typ);
|
||||
typ = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Now we has a STACK of the components, convert to the correct form */
|
||||
|
||||
if (utype == V_ASN1_SET)
|
||||
is_set = 1;
|
||||
else
|
||||
is_set = 0;
|
||||
|
||||
|
||||
derlen = i2d_ASN1_SET((STACK *)sk, NULL, i2d_ASN1_TYPE, utype, V_ASN1_UNIVERSAL, is_set);
|
||||
der = OPENSSL_malloc(derlen);
|
||||
p = der;
|
||||
i2d_ASN1_SET((STACK *)sk, &p, i2d_ASN1_TYPE, utype, V_ASN1_UNIVERSAL, is_set);
|
||||
|
||||
if (!(ret = ASN1_TYPE_new()))
|
||||
goto bad;
|
||||
|
||||
if (!(ret->value.asn1_string = ASN1_STRING_type_new(utype)))
|
||||
goto bad;
|
||||
|
||||
ret->type = utype;
|
||||
|
||||
ret->value.asn1_string->data = der;
|
||||
ret->value.asn1_string->length = derlen;
|
||||
|
||||
der = NULL;
|
||||
|
||||
bad:
|
||||
|
||||
if (der)
|
||||
OPENSSL_free(der);
|
||||
|
||||
if (sk)
|
||||
sk_ASN1_TYPE_pop_free(sk, ASN1_TYPE_free);
|
||||
if (typ)
|
||||
ASN1_TYPE_free(typ);
|
||||
if (sect)
|
||||
X509V3_section_free(cnf, sect);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int append_exp(tag_exp_arg *arg, int exp_tag, int exp_class, int exp_constructed, int exp_pad, int imp_ok)
|
||||
{
|
||||
tag_exp_type *exp_tmp;
|
||||
/* Can only have IMPLICIT if permitted */
|
||||
if ((arg->imp_tag != -1) && !imp_ok)
|
||||
{
|
||||
ASN1err(ASN1_F_APPEND_TAG, ASN1_R_ILLEGAL_IMPLICIT_TAG);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (arg->exp_count == ASN1_FLAG_EXP_MAX)
|
||||
{
|
||||
ASN1err(ASN1_F_APPEND_TAG, ASN1_R_DEPTH_EXCEEDED);
|
||||
return 0;
|
||||
}
|
||||
|
||||
exp_tmp = &arg->exp_list[arg->exp_count++];
|
||||
|
||||
/* If IMPLICIT set tag to implicit value then
|
||||
* reset implicit tag since it has been used.
|
||||
*/
|
||||
if (arg->imp_tag != -1)
|
||||
{
|
||||
exp_tmp->exp_tag = arg->imp_tag;
|
||||
exp_tmp->exp_class = arg->imp_class;
|
||||
arg->imp_tag = -1;
|
||||
arg->imp_class = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
exp_tmp->exp_tag = exp_tag;
|
||||
exp_tmp->exp_class = exp_class;
|
||||
}
|
||||
exp_tmp->exp_constructed = exp_constructed;
|
||||
exp_tmp->exp_pad = exp_pad;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int asn1_str2tag(const char *tagstr, int len)
|
||||
{
|
||||
int i;
|
||||
static struct tag_name_st *tntmp, tnst [] = {
|
||||
ASN1_GEN_STR("BOOL", V_ASN1_BOOLEAN),
|
||||
ASN1_GEN_STR("BOOLEAN", V_ASN1_BOOLEAN),
|
||||
ASN1_GEN_STR("NULL", V_ASN1_NULL),
|
||||
ASN1_GEN_STR("INT", V_ASN1_INTEGER),
|
||||
ASN1_GEN_STR("INTEGER", V_ASN1_INTEGER),
|
||||
ASN1_GEN_STR("ENUM", V_ASN1_ENUMERATED),
|
||||
ASN1_GEN_STR("ENUMERATED", V_ASN1_ENUMERATED),
|
||||
ASN1_GEN_STR("OID", V_ASN1_OBJECT),
|
||||
ASN1_GEN_STR("OBJECT", V_ASN1_OBJECT),
|
||||
ASN1_GEN_STR("UTCTIME", V_ASN1_UTCTIME),
|
||||
ASN1_GEN_STR("UTC", V_ASN1_UTCTIME),
|
||||
ASN1_GEN_STR("GENERALIZEDTIME", V_ASN1_GENERALIZEDTIME),
|
||||
ASN1_GEN_STR("GENTIME", V_ASN1_GENERALIZEDTIME),
|
||||
ASN1_GEN_STR("OCT", V_ASN1_OCTET_STRING),
|
||||
ASN1_GEN_STR("OCTETSTRING", V_ASN1_OCTET_STRING),
|
||||
ASN1_GEN_STR("BITSTR", V_ASN1_BIT_STRING),
|
||||
ASN1_GEN_STR("BITSTRING", V_ASN1_BIT_STRING),
|
||||
ASN1_GEN_STR("UNIVERSALSTRING", V_ASN1_UNIVERSALSTRING),
|
||||
ASN1_GEN_STR("UNIV", V_ASN1_UNIVERSALSTRING),
|
||||
ASN1_GEN_STR("IA5", V_ASN1_IA5STRING),
|
||||
ASN1_GEN_STR("IA5STRING", V_ASN1_IA5STRING),
|
||||
ASN1_GEN_STR("UTF8", V_ASN1_UTF8STRING),
|
||||
ASN1_GEN_STR("UTF8String", V_ASN1_UTF8STRING),
|
||||
ASN1_GEN_STR("BMP", V_ASN1_BMPSTRING),
|
||||
ASN1_GEN_STR("BMPSTRING", V_ASN1_BMPSTRING),
|
||||
ASN1_GEN_STR("VISIBLESTRING", V_ASN1_VISIBLESTRING),
|
||||
ASN1_GEN_STR("VISIBLE", V_ASN1_VISIBLESTRING),
|
||||
ASN1_GEN_STR("PRINTABLESTRING", V_ASN1_PRINTABLESTRING),
|
||||
ASN1_GEN_STR("PRINTABLE", V_ASN1_PRINTABLESTRING),
|
||||
ASN1_GEN_STR("T61", V_ASN1_T61STRING),
|
||||
ASN1_GEN_STR("T61STRING", V_ASN1_T61STRING),
|
||||
ASN1_GEN_STR("TELETEXSTRING", V_ASN1_T61STRING),
|
||||
|
||||
/* Special cases */
|
||||
ASN1_GEN_STR("SEQUENCE", V_ASN1_SEQUENCE),
|
||||
ASN1_GEN_STR("SEQ", V_ASN1_SEQUENCE),
|
||||
ASN1_GEN_STR("SET", V_ASN1_SET),
|
||||
/* type modifiers */
|
||||
/* Explicit tag */
|
||||
ASN1_GEN_STR("EXP", ASN1_GEN_FLAG_EXP),
|
||||
ASN1_GEN_STR("EXPLICIT", ASN1_GEN_FLAG_EXP),
|
||||
/* Implicit tag */
|
||||
ASN1_GEN_STR("IMP", ASN1_GEN_FLAG_IMP),
|
||||
ASN1_GEN_STR("IMPLICIT", ASN1_GEN_FLAG_IMP),
|
||||
/* OCTET STRING wrapper */
|
||||
ASN1_GEN_STR("OCTWRAP", ASN1_GEN_FLAG_OCTWRAP),
|
||||
/* SEQUENCE wrapper */
|
||||
ASN1_GEN_STR("SEQWRAP", ASN1_GEN_FLAG_SEQWRAP),
|
||||
/* SET wrapper */
|
||||
ASN1_GEN_STR("SETWRAP", ASN1_GEN_FLAG_SEQWRAP),
|
||||
/* BIT STRING wrapper */
|
||||
ASN1_GEN_STR("BITWRAP", ASN1_GEN_FLAG_BITWRAP),
|
||||
ASN1_GEN_STR("FORM", ASN1_GEN_FLAG_FORMAT),
|
||||
ASN1_GEN_STR("FORMAT", ASN1_GEN_FLAG_FORMAT),
|
||||
};
|
||||
|
||||
if (len == -1)
|
||||
len = strlen(tagstr);
|
||||
|
||||
tntmp = tnst;
|
||||
for (i = 0; i < sizeof(tnst) / sizeof(struct tag_name_st); i++, tntmp++)
|
||||
{
|
||||
if ((len == tntmp->len) && !strncmp(tntmp->strnam, tagstr, len))
|
||||
return tntmp->tag;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static ASN1_TYPE *asn1_str2type(const char *str, int format, int utype)
|
||||
{
|
||||
ASN1_TYPE *atmp = NULL;
|
||||
|
||||
CONF_VALUE vtmp;
|
||||
|
||||
unsigned char *rdata;
|
||||
long rdlen;
|
||||
|
||||
int no_unused = 1;
|
||||
|
||||
if (!(atmp = ASN1_TYPE_new()))
|
||||
{
|
||||
ASN1err(ASN1_F_ASN1_STR2TYPE, ERR_R_MALLOC_FAILURE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!str)
|
||||
str = "";
|
||||
|
||||
switch(utype)
|
||||
{
|
||||
|
||||
case V_ASN1_NULL:
|
||||
if (str && *str)
|
||||
{
|
||||
ASN1err(ASN1_F_ASN1_STR2TYPE, ASN1_R_ILLEGAL_NULL_VALUE);
|
||||
goto bad_form;
|
||||
}
|
||||
break;
|
||||
|
||||
case V_ASN1_BOOLEAN:
|
||||
if (format != ASN1_GEN_FORMAT_ASCII)
|
||||
{
|
||||
ASN1err(ASN1_F_ASN1_STR2TYPE, ASN1_R_NOT_ASCII_FORMAT);
|
||||
goto bad_form;
|
||||
}
|
||||
vtmp.value = (char *)str;
|
||||
if (!X509V3_get_value_bool(&vtmp, &atmp->value.boolean))
|
||||
{
|
||||
ASN1err(ASN1_F_ASN1_STR2TYPE, ASN1_R_ILLEGAL_BOOLEAN);
|
||||
goto bad_str;
|
||||
}
|
||||
break;
|
||||
|
||||
case V_ASN1_INTEGER:
|
||||
case V_ASN1_ENUMERATED:
|
||||
if (format != ASN1_GEN_FORMAT_ASCII)
|
||||
{
|
||||
ASN1err(ASN1_F_ASN1_STR2TYPE, ASN1_R_INTEGER_NOT_ASCII_FORMAT);
|
||||
goto bad_form;
|
||||
}
|
||||
if (!(atmp->value.integer = s2i_ASN1_INTEGER(NULL, (char *)str)))
|
||||
{
|
||||
ASN1err(ASN1_F_ASN1_STR2TYPE, ASN1_R_ILLEGAL_INTEGER);
|
||||
goto bad_str;
|
||||
}
|
||||
break;
|
||||
|
||||
case V_ASN1_OBJECT:
|
||||
if (format != ASN1_GEN_FORMAT_ASCII)
|
||||
{
|
||||
ASN1err(ASN1_F_ASN1_STR2TYPE, ASN1_R_OBJECT_NOT_ASCII_FORMAT);
|
||||
goto bad_form;
|
||||
}
|
||||
if (!(atmp->value.object = OBJ_txt2obj(str, 0)))
|
||||
{
|
||||
ASN1err(ASN1_F_ASN1_STR2TYPE, ASN1_R_ILLEGAL_OBJECT);
|
||||
goto bad_str;
|
||||
}
|
||||
break;
|
||||
|
||||
case V_ASN1_UTCTIME:
|
||||
case V_ASN1_GENERALIZEDTIME:
|
||||
if (format != ASN1_GEN_FORMAT_ASCII)
|
||||
{
|
||||
ASN1err(ASN1_F_ASN1_STR2TYPE, ASN1_R_TIME_NOT_ASCII_FORMAT);
|
||||
goto bad_form;
|
||||
}
|
||||
if (!(atmp->value.asn1_string = ASN1_STRING_new()))
|
||||
{
|
||||
ASN1err(ASN1_F_ASN1_STR2TYPE, ERR_R_MALLOC_FAILURE);
|
||||
goto bad_str;
|
||||
}
|
||||
if (!ASN1_STRING_set(atmp->value.asn1_string, str, -1))
|
||||
{
|
||||
ASN1err(ASN1_F_ASN1_STR2TYPE, ERR_R_MALLOC_FAILURE);
|
||||
goto bad_str;
|
||||
}
|
||||
atmp->value.asn1_string->type = utype;
|
||||
if (!ASN1_TIME_check(atmp->value.asn1_string))
|
||||
{
|
||||
ASN1err(ASN1_F_ASN1_STR2TYPE, ASN1_R_ILLEGAL_TIME_VALUE);
|
||||
goto bad_str;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case V_ASN1_BMPSTRING:
|
||||
case V_ASN1_PRINTABLESTRING:
|
||||
case V_ASN1_IA5STRING:
|
||||
case V_ASN1_T61STRING:
|
||||
case V_ASN1_UTF8STRING:
|
||||
case V_ASN1_VISIBLESTRING:
|
||||
case V_ASN1_UNIVERSALSTRING:
|
||||
|
||||
if (format == ASN1_GEN_FORMAT_ASCII)
|
||||
format = MBSTRING_ASC;
|
||||
else if (format == ASN1_GEN_FORMAT_UTF8)
|
||||
format = MBSTRING_UTF8;
|
||||
else
|
||||
{
|
||||
ASN1err(ASN1_F_ASN1_STR2TYPE, ASN1_R_ILLEGAL_FORMAT);
|
||||
goto bad_form;
|
||||
}
|
||||
|
||||
|
||||
if (ASN1_mbstring_copy(&atmp->value.asn1_string, (unsigned char *)str,
|
||||
-1, format, ASN1_tag2bit(utype)) <= 0)
|
||||
{
|
||||
ASN1err(ASN1_F_ASN1_STR2TYPE, ERR_R_MALLOC_FAILURE);
|
||||
goto bad_str;
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case V_ASN1_BIT_STRING:
|
||||
|
||||
case V_ASN1_OCTET_STRING:
|
||||
|
||||
if (!(atmp->value.asn1_string = ASN1_STRING_new()))
|
||||
{
|
||||
ASN1err(ASN1_F_ASN1_STR2TYPE, ERR_R_MALLOC_FAILURE);
|
||||
goto bad_form;
|
||||
}
|
||||
|
||||
if (format == ASN1_GEN_FORMAT_HEX)
|
||||
{
|
||||
|
||||
if (!(rdata = string_to_hex((char *)str, &rdlen)))
|
||||
{
|
||||
ASN1err(ASN1_F_ASN1_STR2TYPE, ASN1_R_ILLEGAL_HEX);
|
||||
goto bad_str;
|
||||
}
|
||||
|
||||
atmp->value.asn1_string->data = rdata;
|
||||
atmp->value.asn1_string->length = rdlen;
|
||||
atmp->value.asn1_string->type = utype;
|
||||
|
||||
}
|
||||
else if (format == ASN1_GEN_FORMAT_ASCII)
|
||||
ASN1_STRING_set(atmp->value.asn1_string, str, -1);
|
||||
else if ((format == ASN1_GEN_FORMAT_BITLIST) && (utype == V_ASN1_BIT_STRING))
|
||||
{
|
||||
if (!CONF_parse_list(str, ',', 1, bitstr_cb, atmp->value.bit_string))
|
||||
{
|
||||
ASN1err(ASN1_F_ASN1_STR2TYPE, ASN1_R_LIST_ERROR);
|
||||
goto bad_str;
|
||||
}
|
||||
no_unused = 0;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
ASN1err(ASN1_F_ASN1_STR2TYPE, ASN1_R_ILLEGAL_BITSTRING_FORMAT);
|
||||
goto bad_form;
|
||||
}
|
||||
|
||||
if ((utype == V_ASN1_BIT_STRING) && no_unused)
|
||||
{
|
||||
atmp->value.asn1_string->flags
|
||||
&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07);
|
||||
atmp->value.asn1_string->flags
|
||||
|= ASN1_STRING_FLAG_BITS_LEFT;
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
ASN1err(ASN1_F_ASN1_STR2TYPE, ASN1_R_UNSUPPORTED_TYPE);
|
||||
goto bad_str;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
atmp->type = utype;
|
||||
return atmp;
|
||||
|
||||
|
||||
bad_str:
|
||||
ERR_add_error_data(2, "string=", str);
|
||||
bad_form:
|
||||
|
||||
ASN1_TYPE_free(atmp);
|
||||
return NULL;
|
||||
|
||||
}
|
||||
|
||||
static int bitstr_cb(const char *elem, int len, void *bitstr)
|
||||
{
|
||||
long bitnum;
|
||||
char *eptr;
|
||||
if (!elem)
|
||||
return 0;
|
||||
bitnum = strtoul(elem, &eptr, 10);
|
||||
if (eptr && *eptr && (eptr != elem + len))
|
||||
return 0;
|
||||
if (bitnum < 0)
|
||||
{
|
||||
ASN1err(ASN1_F_BITSTR_CB, ASN1_R_INVALID_NUMBER);
|
||||
return 0;
|
||||
}
|
||||
if (!ASN1_BIT_STRING_set_bit(bitstr, bitnum, 1))
|
||||
{
|
||||
ASN1err(ASN1_F_BITSTR_CB, ERR_R_MALLOC_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
@@ -57,7 +57,6 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
#include "cryptlib.h"
|
||||
#include <openssl/asn1.h>
|
||||
#include <openssl/asn1_mac.h>
|
||||
@@ -125,13 +124,15 @@ int ASN1_get_object(unsigned char **pp, long *plength, int *ptag, int *pclass,
|
||||
(int)(omax+ *pp));
|
||||
|
||||
#endif
|
||||
if (*plength > (omax - (p - *pp)))
|
||||
#if 0
|
||||
if ((p+ *plength) > (omax+ *pp))
|
||||
{
|
||||
ASN1err(ASN1_F_ASN1_GET_OBJECT,ASN1_R_TOO_LONG);
|
||||
/* Set this so that even if things are not long enough
|
||||
* the values are set correctly */
|
||||
ret|=0x80;
|
||||
}
|
||||
#endif
|
||||
*pp=p;
|
||||
return(ret|inf);
|
||||
err:
|
||||
@@ -142,7 +143,7 @@ err:
|
||||
static int asn1_get_length(unsigned char **pp, int *inf, long *rl, int max)
|
||||
{
|
||||
unsigned char *p= *pp;
|
||||
unsigned long ret=0;
|
||||
long ret=0;
|
||||
int i;
|
||||
|
||||
if (max-- < 1) return(0);
|
||||
@@ -158,8 +159,6 @@ static int asn1_get_length(unsigned char **pp, int *inf, long *rl, int max)
|
||||
i= *p&0x7f;
|
||||
if (*(p++) & 0x80)
|
||||
{
|
||||
if (i > sizeof(long))
|
||||
return 0;
|
||||
if (max-- == 0) return(0);
|
||||
while (i-- > 0)
|
||||
{
|
||||
@@ -171,10 +170,8 @@ static int asn1_get_length(unsigned char **pp, int *inf, long *rl, int max)
|
||||
else
|
||||
ret=i;
|
||||
}
|
||||
if (ret > LONG_MAX)
|
||||
return 0;
|
||||
*pp=p;
|
||||
*rl=(long)ret;
|
||||
*rl=ret;
|
||||
return(1);
|
||||
}
|
||||
|
||||
@@ -203,22 +200,13 @@ void ASN1_put_object(unsigned char **pp, int constructed, int length, int tag,
|
||||
}
|
||||
p += ttag;
|
||||
}
|
||||
if (constructed == 2)
|
||||
*(p++)=0x80;
|
||||
if ((constructed == 2) && (length == 0))
|
||||
*(p++)=0x80; /* der_put_length would output 0 instead */
|
||||
else
|
||||
asn1_put_length(&p,length);
|
||||
*pp=p;
|
||||
}
|
||||
|
||||
int ASN1_put_eoc(unsigned char **pp)
|
||||
{
|
||||
unsigned char *p = *pp;
|
||||
*p++ = 0;
|
||||
*p++ = 0;
|
||||
*pp = p;
|
||||
return 2;
|
||||
}
|
||||
|
||||
static void asn1_put_length(unsigned char **pp, int length)
|
||||
{
|
||||
unsigned char *p= *pp;
|
||||
@@ -256,8 +244,8 @@ int ASN1_object_size(int constructed, int length, int tag)
|
||||
ret++;
|
||||
}
|
||||
}
|
||||
if (constructed == 2)
|
||||
return ret + 3;
|
||||
if ((length == 0) && (constructed == 2))
|
||||
ret+=2;
|
||||
ret++;
|
||||
if (length > 127)
|
||||
{
|
||||
@@ -419,7 +407,7 @@ int ASN1_STRING_cmp(ASN1_STRING *a, ASN1_STRING *b)
|
||||
|
||||
void asn1_add_error(unsigned char *address, int offset)
|
||||
{
|
||||
char buf1[DECIMAL_SIZE(address)+1],buf2[DECIMAL_SIZE(offset)+1];
|
||||
char buf1[16],buf2[16];
|
||||
|
||||
sprintf(buf1,"%lu",(unsigned long)address);
|
||||
sprintf(buf2,"%d",offset);
|
||||
|
@@ -79,7 +79,12 @@ static int asn1_print_info(BIO *bp, int tag, int xclass, int constructed,
|
||||
else
|
||||
p="prim: ";
|
||||
if (BIO_write(bp,p,6) < 6) goto err;
|
||||
BIO_indent(bp,indent,128);
|
||||
if (indent)
|
||||
{
|
||||
if (indent > 128) indent=128;
|
||||
memset(str,' ',indent);
|
||||
if (BIO_write(bp,str,indent) < indent) goto err;
|
||||
}
|
||||
|
||||
p=str;
|
||||
if ((xclass & V_ASN1_PRIVATE) == V_ASN1_PRIVATE)
|
||||
@@ -256,11 +261,9 @@ static int asn1_parse2(BIO *bp, unsigned char **pp, long length, int offset,
|
||||
|
||||
opp=op;
|
||||
os=d2i_ASN1_OCTET_STRING(NULL,&opp,len+hl);
|
||||
if (os != NULL && os->length > 0)
|
||||
if (os != NULL)
|
||||
{
|
||||
opp = os->data;
|
||||
/* testing whether the octet string is
|
||||
* printable */
|
||||
opp=os->data;
|
||||
for (i=0; i<os->length; i++)
|
||||
{
|
||||
if (( (opp[i] < ' ') &&
|
||||
@@ -273,8 +276,7 @@ static int asn1_parse2(BIO *bp, unsigned char **pp, long length, int offset,
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (printable)
|
||||
/* printable string */
|
||||
if (printable && (os->length > 0))
|
||||
{
|
||||
if (BIO_write(bp,":",1) <= 0)
|
||||
goto end;
|
||||
@@ -282,21 +284,8 @@ static int asn1_parse2(BIO *bp, unsigned char **pp, long length, int offset,
|
||||
os->length) <= 0)
|
||||
goto end;
|
||||
}
|
||||
else if (!dump)
|
||||
/* not printable => print octet string
|
||||
* as hex dump */
|
||||
{
|
||||
if (BIO_write(bp,"[HEX DUMP]:",11) <= 0)
|
||||
goto end;
|
||||
for (i=0; i<os->length; i++)
|
||||
{
|
||||
if (BIO_printf(bp,"%02X"
|
||||
, opp[i]) <= 0)
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
else
|
||||
/* print the normal dump */
|
||||
if (!printable && (os->length > 0)
|
||||
&& dump)
|
||||
{
|
||||
if (!nl)
|
||||
{
|
||||
@@ -304,15 +293,11 @@ static int asn1_parse2(BIO *bp, unsigned char **pp, long length, int offset,
|
||||
goto end;
|
||||
}
|
||||
if (BIO_dump_indent(bp,(char *)opp,
|
||||
((dump == -1 || dump >
|
||||
os->length)?os->length:dump),
|
||||
((dump == -1 || dump > os->length)?os->length:dump),
|
||||
dump_indent) <= 0)
|
||||
goto end;
|
||||
nl=1;
|
||||
}
|
||||
}
|
||||
if (os != NULL)
|
||||
{
|
||||
M_ASN1_OCTET_STRING_free(os);
|
||||
os=NULL;
|
||||
}
|
||||
|
@@ -112,7 +112,7 @@ extern "C" {
|
||||
/* Macros to aid ASN1 template writing */
|
||||
|
||||
#define ASN1_ITEM_TEMPLATE(tname) \
|
||||
static const ASN1_TEMPLATE tname##_item_tt
|
||||
const static ASN1_TEMPLATE tname##_item_tt
|
||||
|
||||
#define ASN1_ITEM_TEMPLATE_END(tname) \
|
||||
;\
|
||||
@@ -150,7 +150,7 @@ extern "C" {
|
||||
*/
|
||||
|
||||
#define ASN1_SEQUENCE(tname) \
|
||||
static const ASN1_TEMPLATE tname##_seq_tt[]
|
||||
const static ASN1_TEMPLATE tname##_seq_tt[]
|
||||
|
||||
#define ASN1_SEQUENCE_END(stname) ASN1_SEQUENCE_END_name(stname, stname)
|
||||
|
||||
@@ -166,37 +166,22 @@ extern "C" {
|
||||
#stname \
|
||||
ASN1_ITEM_end(tname)
|
||||
|
||||
#define ASN1_NDEF_SEQUENCE(tname) \
|
||||
ASN1_SEQUENCE(tname)
|
||||
|
||||
#define ASN1_SEQUENCE_cb(tname, cb) \
|
||||
static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \
|
||||
const static ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \
|
||||
ASN1_SEQUENCE(tname)
|
||||
|
||||
#define ASN1_BROKEN_SEQUENCE(tname) \
|
||||
static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_BROKEN, 0, 0, 0, 0}; \
|
||||
const static ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_BROKEN, 0, 0, 0, 0}; \
|
||||
ASN1_SEQUENCE(tname)
|
||||
|
||||
#define ASN1_SEQUENCE_ref(tname, cb, lck) \
|
||||
static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_REFCOUNT, offsetof(tname, references), lck, cb, 0}; \
|
||||
const static ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_REFCOUNT, offsetof(tname, references), lck, cb, 0}; \
|
||||
ASN1_SEQUENCE(tname)
|
||||
|
||||
#define ASN1_SEQUENCE_enc(tname, enc, cb) \
|
||||
static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_ENCODING, 0, 0, cb, offsetof(tname, enc)}; \
|
||||
const static ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_ENCODING, 0, 0, cb, offsetof(tname, enc)}; \
|
||||
ASN1_SEQUENCE(tname)
|
||||
|
||||
#define ASN1_NDEF_SEQUENCE_END(tname) \
|
||||
;\
|
||||
ASN1_ITEM_start(tname) \
|
||||
ASN1_ITYPE_NDEF_SEQUENCE,\
|
||||
V_ASN1_SEQUENCE,\
|
||||
tname##_seq_tt,\
|
||||
sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
|
||||
NULL,\
|
||||
sizeof(tname),\
|
||||
#tname \
|
||||
ASN1_ITEM_end(tname)
|
||||
|
||||
#define ASN1_BROKEN_SEQUENCE_END(stname) ASN1_SEQUENCE_END_ref(stname, stname)
|
||||
|
||||
#define ASN1_SEQUENCE_END_enc(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname)
|
||||
@@ -239,10 +224,10 @@ extern "C" {
|
||||
*/
|
||||
|
||||
#define ASN1_CHOICE(tname) \
|
||||
static const ASN1_TEMPLATE tname##_ch_tt[]
|
||||
const static ASN1_TEMPLATE tname##_ch_tt[]
|
||||
|
||||
#define ASN1_CHOICE_cb(tname, cb) \
|
||||
static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \
|
||||
const static ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \
|
||||
ASN1_CHOICE(tname)
|
||||
|
||||
#define ASN1_CHOICE_END(stname) ASN1_CHOICE_END_name(stname, stname)
|
||||
@@ -368,20 +353,16 @@ extern "C" {
|
||||
#define ASN1_EXP_SEQUENCE_OF_OPT(stname, field, type, tag) \
|
||||
ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL)
|
||||
|
||||
/* EXPLICIT OPTIONAL using indefinite length constructed form */
|
||||
#define ASN1_NDEF_EXP_OPT(stname, field, type, tag) \
|
||||
ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_NDEF)
|
||||
|
||||
/* Macros for the ASN1_ADB structure */
|
||||
|
||||
#define ASN1_ADB(name) \
|
||||
static const ASN1_ADB_TABLE name##_adbtbl[]
|
||||
const static ASN1_ADB_TABLE name##_adbtbl[]
|
||||
|
||||
#ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION
|
||||
|
||||
#define ASN1_ADB_END(name, flags, field, app_table, def, none) \
|
||||
;\
|
||||
static const ASN1_ADB name##_adb = {\
|
||||
const static ASN1_ADB name##_adb = {\
|
||||
flags,\
|
||||
offsetof(name, field),\
|
||||
app_table,\
|
||||
@@ -395,9 +376,9 @@ extern "C" {
|
||||
|
||||
#define ASN1_ADB_END(name, flags, field, app_table, def, none) \
|
||||
;\
|
||||
static const ASN1_ITEM *name##_adb(void) \
|
||||
const static ASN1_ITEM *name##_adb(void) \
|
||||
{ \
|
||||
static const ASN1_ADB internal_adb = \
|
||||
const static ASN1_ADB internal_adb = \
|
||||
{\
|
||||
flags,\
|
||||
offsetof(name, field),\
|
||||
@@ -416,7 +397,7 @@ extern "C" {
|
||||
#define ADB_ENTRY(val, template) {val, template}
|
||||
|
||||
#define ASN1_ADB_TEMPLATE(name) \
|
||||
static const ASN1_TEMPLATE name##_tt
|
||||
const static ASN1_TEMPLATE name##_tt
|
||||
|
||||
/* This is the ASN1 template structure that defines
|
||||
* a wrapper round the actual type. It determines the
|
||||
@@ -537,13 +518,6 @@ struct ASN1_ADB_TABLE_st {
|
||||
|
||||
#define ASN1_TFLG_COMBINE (0x1<<10)
|
||||
|
||||
/* This flag when present in a SEQUENCE OF, SET OF
|
||||
* or EXPLICIT causes indefinite length constructed
|
||||
* encoding to be used if required.
|
||||
*/
|
||||
|
||||
#define ASN1_TFLG_NDEF (0x1<<11)
|
||||
|
||||
/* This is the actual ASN1 item itself */
|
||||
|
||||
struct ASN1_ITEM_st {
|
||||
@@ -596,25 +570,19 @@ const char *sname; /* Structure name */
|
||||
* has a special meaning, it is used as a mask
|
||||
* of acceptable types using the B_ASN1 constants.
|
||||
*
|
||||
* NDEF_SEQUENCE is the same as SEQUENCE except
|
||||
* that it will use indefinite length constructed
|
||||
* encoding if requested.
|
||||
*
|
||||
*/
|
||||
|
||||
#define ASN1_ITYPE_PRIMITIVE 0x0
|
||||
#define ASN1_ITYPE_PRIMITIVE 0x0
|
||||
|
||||
#define ASN1_ITYPE_SEQUENCE 0x1
|
||||
#define ASN1_ITYPE_SEQUENCE 0x1
|
||||
|
||||
#define ASN1_ITYPE_CHOICE 0x2
|
||||
#define ASN1_ITYPE_CHOICE 0x2
|
||||
|
||||
#define ASN1_ITYPE_COMPAT 0x3
|
||||
#define ASN1_ITYPE_COMPAT 0x3
|
||||
|
||||
#define ASN1_ITYPE_EXTERN 0x4
|
||||
#define ASN1_ITYPE_EXTERN 0x4
|
||||
|
||||
#define ASN1_ITYPE_MSTRING 0x5
|
||||
|
||||
#define ASN1_ITYPE_NDEF_SEQUENCE 0x6
|
||||
#define ASN1_ITYPE_MSTRING 0x5
|
||||
|
||||
/* Cache for ASN1 tag and length, so we
|
||||
* don't keep re-reading it for things
|
||||
@@ -799,12 +767,6 @@ typedef struct ASN1_AUX_st {
|
||||
return ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\
|
||||
}
|
||||
|
||||
#define IMPLEMENT_ASN1_NDEF_FUNCTION(stname) \
|
||||
int i2d_##stname##_NDEF(stname *a, unsigned char **out) \
|
||||
{ \
|
||||
return ASN1_item_ndef_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(stname));\
|
||||
}
|
||||
|
||||
/* This includes evil casts to remove const: they will go away when full
|
||||
* ASN1 constification is done.
|
||||
*/
|
||||
|
@@ -68,9 +68,6 @@
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
#include <openssl/dsa.h>
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_EC
|
||||
#include <openssl/ec.h>
|
||||
#endif
|
||||
|
||||
EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, unsigned char **pp,
|
||||
long length)
|
||||
@@ -110,16 +107,6 @@ EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, unsigned char **pp,
|
||||
goto err;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_EC
|
||||
case EVP_PKEY_EC:
|
||||
if ((ret->pkey.eckey = d2i_ECPrivateKey(NULL,
|
||||
(const unsigned char **)pp, length)) == NULL)
|
||||
{
|
||||
ASN1err(ASN1_F_D2I_PRIVATEKEY, ERR_R_ASN1_LIB);
|
||||
goto err;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
ASN1err(ASN1_F_D2I_PRIVATEKEY,ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE);
|
||||
@@ -151,10 +138,7 @@ EVP_PKEY *d2i_AutoPrivateKey(EVP_PKEY **a, unsigned char **pp,
|
||||
/* Since we only need to discern "traditional format" RSA and DSA
|
||||
* keys we can just count the elements.
|
||||
*/
|
||||
if(sk_ASN1_TYPE_num(inkey) == 6)
|
||||
keytype = EVP_PKEY_DSA;
|
||||
else if (sk_ASN1_TYPE_num(inkey) == 4)
|
||||
keytype = EVP_PKEY_EC;
|
||||
if(sk_ASN1_TYPE_num(inkey) == 6) keytype = EVP_PKEY_DSA;
|
||||
else keytype = EVP_PKEY_RSA;
|
||||
sk_ASN1_TYPE_pop_free(inkey, ASN1_TYPE_free);
|
||||
return d2i_PrivateKey(keytype, a, pp, length);
|
||||
|
@@ -68,9 +68,6 @@
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
#include <openssl/dsa.h>
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_EC
|
||||
#include <openssl/ec.h>
|
||||
#endif
|
||||
|
||||
EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, unsigned char **pp,
|
||||
long length)
|
||||
@@ -103,24 +100,13 @@ EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, unsigned char **pp,
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
case EVP_PKEY_DSA:
|
||||
if ((ret->pkey.dsa=d2i_DSAPublicKey(&(ret->pkey.dsa),
|
||||
if ((ret->pkey.dsa=d2i_DSAPublicKey(NULL,
|
||||
(const unsigned char **)pp,length)) == NULL) /* TMP UGLY CAST */
|
||||
{
|
||||
ASN1err(ASN1_F_D2I_PUBLICKEY,ERR_R_ASN1_LIB);
|
||||
goto err;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_EC
|
||||
case EVP_PKEY_EC:
|
||||
if ((ret->pkey.eckey = ECPublicKey_set_octet_string(
|
||||
&(ret->pkey.eckey), (const unsigned char **)pp,
|
||||
length)) == NULL)
|
||||
{
|
||||
ASN1err(ASN1_F_D2I_PUBLICKEY, ERR_R_ASN1_LIB);
|
||||
goto err;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
ASN1err(ASN1_F_D2I_PUBLICKEY,ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user