Serguei E. Leontiev [Sun, 11 May 2014 18:46:42 +0000 (19:46 +0100)]
Replace manual ASN1 decoder with ASN1_get_object
Replace manual ASN.1 decoder with ASN1_get object. This
will decode the tag and length properly and check against
it does not exceed the supplied buffer length.
PR#3335
Dr. Stephen Henson [Sat, 10 May 2014 01:04:23 +0000 (02:04 +0100)]
Correct example.
Andy Polyakov [Mon, 12 May 2014 08:35:29 +0000 (10:35 +0200)]
Add "teaser" AES module for PowerISA 2.07.
"Teaser" means that it's not integrated yet and purpose of this
commit is primarily informational, to exhibit design choices,
such as how to handle alignment and endianness. In other words
it's proof-of-concept code that EVP module will build upon.
Matt Caswell [Sun, 11 May 2014 23:38:37 +0000 (00:38 +0100)]
Fixed NULL pointer dereference. See PR#3321
Kurt Roeckx [Thu, 1 May 2014 11:10:01 +0000 (13:10 +0200)]
Set authkey to NULL and check malloc return value.
Martin Brejcha [Thu, 1 May 2014 10:07:09 +0000 (12:07 +0200)]
dgram_sctp_ctrl: authkey memory leak
PR: 3327
Günther Noack [Thu, 1 May 2014 11:33:11 +0000 (13:33 +0200)]
Avoid out-of-bounds write in SSL_get_shared_ciphers
PR: 3317
Viktor Dukhovni [Sun, 11 May 2014 19:28:56 +0000 (20:28 +0100)]
Fix infinite loop. PR#3347
Matt Caswell [Sun, 11 May 2014 10:27:26 +0000 (11:27 +0100)]
Move length check earlier to ensure we don't go beyond the end of the user's buffer. PR#3320
Tim Hudson [Sat, 26 Apr 2014 15:55:47 +0000 (01:55 +1000)]
safety check to ensure we dont send out beyond the users buffer
Matt Caswell [Sat, 10 May 2014 00:19:50 +0000 (01:19 +0100)]
Fixed CRLF in file
Dr. Stephen Henson [Thu, 8 May 2014 12:10:56 +0000 (13:10 +0100)]
Return an error if no recipient type matches.
If the key type does not match any CMS recipient type return
an error instead of using a random key (MMA mitigation). This
does not leak any useful information to an attacker.
PR#3348
Geoff Thorpe [Sat, 26 Apr 2014 05:22:54 +0000 (01:22 -0400)]
s_client/s_server: support unix domain sockets
The "-unix <path>" argument allows s_server and s_client to use a unix
domain socket in the filesystem instead of IPv4 ("-connect", "-port",
"-accept", etc). If s_server exits gracefully, such as when "-naccept"
is used and the requested number of SSL/TLS connections have occurred,
then the domain socket file is removed. On ctrl-C, it is likely that
the stale socket file will be left over, such that s_server would
normally fail to restart with the same arguments. For this reason,
s_server also supports an "-unlink" option, which will clean up any
stale socket file before starting.
If you have any reason to want encrypted IPC within an O/S instance,
this concept might come in handy. Otherwise it just demonstrates that
there is nothing about SSL/TLS that limits it to TCP/IP in any way.
(There might also be benchmarking and profiling use in this path, as
unix domain sockets are much lower overhead than connecting over local
IP addresses).
Signed-off-by: Geoff Thorpe <geoff@openssl.org>
Tim Hudson [Mon, 5 May 2014 00:53:39 +0000 (10:53 +1000)]
coverity 966576 - close socket in error path
Tim Hudson [Mon, 5 May 2014 00:39:30 +0000 (10:39 +1000)]
PR#3342 fix resource leak coverity issue 966577
Tim Hudson [Sun, 4 May 2014 22:22:42 +0000 (08:22 +1000)]
fix coverity issue 966597 - error line is not always initialised
Matt Caswell [Wed, 7 May 2014 22:21:02 +0000 (23:21 +0100)]
Fixed NULL pointer dereference in PKCS7_dataDecode reported by David Ramos in PR#3339
Geoff Thorpe [Sun, 4 May 2014 22:44:14 +0000 (18:44 -0400)]
evp: prevent underflow in base64 decoding
This patch resolves RT ticket #2608.
Thanks to Robert Dugal for originally spotting this, and to David
Ramos for noticing that the ball had been dropped.
Signed-off-by: Geoff Thorpe <geoff@openssl.org>
Geoff Thorpe [Sun, 4 May 2014 20:19:22 +0000 (16:19 -0400)]
bignum: allow concurrent BN_MONT_CTX_set_locked()
The lazy-initialisation of BN_MONT_CTX was serialising all threads, as
noted by Daniel Sands and co at Sandia. This was to handle the case that
2 or more threads race to lazy-init the same context, but stunted all
scalability in the case where 2 or more threads are doing unrelated
things! We favour the latter case by punishing the former. The init work
gets done by each thread that finds the context to be uninitialised, and
we then lock the "set" logic after that work is done - the winning
thread's work gets used, the losing threads throw away what they've done.
Signed-off-by: Geoff Thorpe <geoff@openssl.org>
Dr. Stephen Henson [Tue, 6 May 2014 13:07:37 +0000 (14:07 +0100)]
Initialize num properly.
PR#3289
PR#3345
Dr. Stephen Henson [Mon, 5 May 2014 22:56:43 +0000 (23:56 +0100)]
Set Enveloped data version to 2 if ktri version not zero.
Tim Hudson [Sun, 4 May 2014 20:41:22 +0000 (06:41 +1000)]
- fix coverity issues 966593-966596
Geoff Thorpe [Sun, 4 May 2014 22:46:42 +0000 (18:46 -0400)]
apps/s_server: document '-naccept' cmd-line argument
Signed-off-by: Geoff Thorpe <geoff@openssl.org>
Andy Polyakov [Sun, 4 May 2014 14:56:00 +0000 (16:56 +0200)]
md5/asm/md5-[586|x86_64].pl: +15% on Atom.
[MD5 is hardly relevant, just cleaning up repository]
Andy Polyakov [Sun, 4 May 2014 14:39:59 +0000 (16:39 +0200)]
C64x+ assembply pack: add RC4 module.
Andy Polyakov [Sun, 4 May 2014 14:38:32 +0000 (16:38 +0200)]
C64x+ assembly pack: make it work with older toolchain.
Andy Polyakov [Sun, 4 May 2014 08:57:55 +0000 (10:57 +0200)]
sha/asm/sha1-armv4-large.pl: add NEON and ARMv8 code paths.
sha/asm/sha256-armv4.pl: add ARMv8 code path.
Andy Polyakov [Sun, 4 May 2014 08:55:49 +0000 (10:55 +0200)]
crypto/armcap.c: detect ARMv8 capabilities [in 32-bit build].
David Ramos [Sat, 3 May 2014 10:00:27 +0000 (12:00 +0200)]
Double free in i2o_ECPublicKey
PR: 3338
Geoff Thorpe [Sun, 27 Apr 2014 20:06:50 +0000 (16:06 -0400)]
dso: eliminate VMS code on non-VMS systems
Even though the meat of dso_vms.c is compiled out on non-VMS builds,
the (pre-)compiler still traverses some of the macro handling. This
trips up at least one non-VMS build configuration, so this commit
makes the skip-VMS case more robust.
Signed-off-by: Geoff Thorpe <geoff@openssl.org>
Jeff Trawick [Sun, 13 Apr 2014 13:10:17 +0000 (15:10 +0200)]
typo in SSL_get_peer_cert_chain docs
RT: 3304
Matt Caswell [Wed, 30 Apr 2014 23:23:57 +0000 (00:23 +0100)]
Fixed spelling error in error message. Fix supplied by Marcos Marado
Geoff Thorpe [Wed, 30 Apr 2014 15:39:24 +0000 (11:39 -0400)]
bignum: fix boundary condition in montgomery logic
It's not clear whether this inconsistency could lead to an actual
computation error, but it involved a BIGNUM being passed around the
montgomery logic in an inconsistent state. This was found using flags
-DBN_DEBUG -DBN_DEBUG_RAND, and working backwards from this assertion
in 'ectest';
ectest: bn_mul.c:960: BN_mul: Assertion `(_bnum2->top == 0) ||
(_bnum2->d[_bnum2->top - 1] != 0)' failed
Signed-off-by: Geoff Thorpe <geoff@openssl.org>
Ben Laurie [Tue, 29 Apr 2014 17:19:54 +0000 (18:19 +0100)]
More warnings.
Matt Caswell [Sun, 27 Apr 2014 17:57:34 +0000 (18:57 +0100)]
Fix SSL_CONF_cmd missing =back
Matt Caswell [Sat, 26 Apr 2014 20:56:36 +0000 (21:56 +0100)]
Fixed minor errors in docs
Matt Caswell [Sat, 26 Apr 2014 20:44:26 +0000 (21:44 +0100)]
PKCS5_PBKDF2_HMAC documentation submitted by Jeffrey Walton
Chris Rorvick [Sat, 26 Apr 2014 16:10:45 +0000 (11:10 -0500)]
doc: Add missing =back directive.
Signed-off-by: Chris Rorvick <chris@rorvick.com>
mancha [Fri, 25 Apr 2014 14:58:49 +0000 (14:58 +0000)]
Fix version documentation.
Specify -f is for compilation flags. Add -d to synopsis section.
Closes #77.
mancha [Thu, 24 Apr 2014 19:06:20 +0000 (19:06 +0000)]
Fix eckey_priv_encode()
Fix eckey_priv_encode to return an error on failure of i2d_ECPrivateKey.
Geoff Thorpe [Fri, 25 Apr 2014 04:44:17 +0000 (00:44 -0400)]
make depend
Geoff Thorpe [Fri, 25 Apr 2014 18:27:02 +0000 (14:27 -0400)]
apps: constify some string parameters
There are certainly many more constifiable strings in the various
interfaces, which I hope to get to eventually.
Signed-off-by: Geoff Thorpe <geoff@openssl.org>
Geoff Thorpe [Fri, 25 Apr 2014 05:20:16 +0000 (01:20 -0400)]
util/mkerr.pl: fix perl warning
Gets rid of this;
defined(@array) is deprecated at ../util/mkerr.pl line 792.
(Maybe you should just omit the defined()?)
defined(@array) is deprecated at ../util/mkerr.pl line 800.
(Maybe you should just omit the defined()?)
Signed-off-by: Geoff Thorpe <geoff@openssl.org>
Mark J. Cox [Fri, 25 Apr 2014 07:12:13 +0000 (08:12 +0100)]
Remove latest version, it's pretty redundant and just one more thing
to keep up to date with releases. Reported because
http://www.openssl.org/support/faq.html#MISC1 was out of date
Geoff Thorpe [Fri, 25 Apr 2014 04:58:16 +0000 (00:58 -0400)]
util/mkdef.pl: o_time.h doesn't exist any more
o_time.h was removed in commit
ff49a94, which breaks "make update"
unless mkdir.pl is updated accordingly.
Signed-off-by: Geoff Thorpe <geoff@openssl.org>
Steve Marquess [Thu, 24 Apr 2014 11:13:05 +0000 (07:13 -0400)]
Add new sponsors
Andy Polyakov [Thu, 24 Apr 2014 08:16:58 +0000 (10:16 +0200)]
bn/asm/armv4-gf2m.pl, modes/asm/ghash-armv4.pl: faster multiplication
algorithm suggested in following paper:
Câmara, D.; Gouvêa, C. P. L.; López, J. & Dahab, R.: Fast Software
Polynomial Multiplication on ARM Processors using the NEON Engine.
http://conradoplg.cryptoland.net/files/2010/12/mocrysen13.pdf
Andy Polyakov [Thu, 24 Apr 2014 08:13:30 +0000 (10:13 +0200)]
aes/asm/bsaes-x86_64.pl: Atom-specific optimization.
Ben Laurie [Wed, 23 Apr 2014 06:24:03 +0000 (07:24 +0100)]
Fix use after free.
Ben Laurie [Tue, 22 Apr 2014 11:38:26 +0000 (12:38 +0100)]
Fix double frees.
Kaspar Brand [Mon, 21 Apr 2014 15:52:28 +0000 (16:52 +0100)]
Fix SSL_CTX_get{first,next}_certificate.
Fix typo that stopped SSL_CTX_get_{first,next}_certificate from working.
Dr. Stephen Henson [Wed, 16 Apr 2014 11:15:43 +0000 (12:15 +0100)]
Document -debug_decrypt option.
Dr. Stephen Henson [Tue, 15 Apr 2014 17:48:54 +0000 (18:48 +0100)]
Extension checking fixes.
When looking for an extension we need to set the last found
position to -1 to properly search all extensions.
PR#3309.
Dr. Stephen Henson [Tue, 15 Apr 2014 17:17:12 +0000 (18:17 +0100)]
Clarify CMS_decrypt behaviour.
Dr. Stephen Henson [Fri, 11 Apr 2014 01:50:51 +0000 (02:50 +0100)]
Add new key fingerprint.
Dr. Stephen Henson [Wed, 9 Apr 2014 14:42:40 +0000 (15:42 +0100)]
Fix free errors in ocsp utility.
Keep copy of any host, path and port values allocated by
OCSP_parse_url and free as necessary.
Dr. Stephen Henson [Wed, 9 Apr 2014 14:35:51 +0000 (15:35 +0100)]
ssleay_rand_add returns a value in 1.1.0
Dr. Stephen Henson [Sat, 5 Apr 2014 23:51:06 +0000 (00:51 +0100)]
Update NEWS
Dr. Stephen Henson [Sun, 6 Apr 2014 22:11:20 +0000 (23:11 +0100)]
Return if ssleay_rand_add called with zero num.
Treat a zero length passed to ssleay_rand_add a no op: the existing logic
zeroes the md value which is very bad. OpenSSL itself never does this
internally and the actual call doesn't make sense as it would be passing
zero bytes of entropy.
Thanks to Marcus Meissner <meissner@suse.de> for reporting this bug.
(cherry picked from commit
5be1ae28ef3c4bdec95b94f14e0e939157be550a)
Dr. Stephen Henson [Sat, 5 Apr 2014 23:51:06 +0000 (00:51 +0100)]
Add heartbeat extension bounds check.
A missing bounds check in the handling of the TLS heartbeat extension
can be used to reveal up to 64k of memory to a connected client or
server.
Thanks for Neel Mehta of Google Security for discovering this bug and to
Adam Langley <agl@chromium.org> and Bodo Moeller <bmoeller@acm.org> for
preparing the fix (CVE-2014-0160)
(cherry picked from commit
96db9023b881d7cd9f379b0c154650d6c108e9a3)
Dr. Stephen Henson [Mon, 7 Apr 2014 12:02:10 +0000 (13:02 +0100)]
Document -verify_return_error option.
Andy Polyakov [Sun, 6 Apr 2014 15:19:54 +0000 (17:19 +0200)]
crypto/modes/gcm128.c: more strict aliasing fixes.
Andy Polyakov [Sun, 6 Apr 2014 10:50:36 +0000 (12:50 +0200)]
vpaes-[x86_64|ppc].pl: fix typo, which for some reason triggers rkhunter.
Dr. Stephen Henson [Sat, 5 Apr 2014 19:43:54 +0000 (20:43 +0100)]
Set TLS padding extension value.
Enable TLS padding extension using official value from:
http://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml
Dr. Stephen Henson [Sat, 5 Apr 2014 12:39:35 +0000 (13:39 +0100)]
For more than 160 bits of security disable SHA1 HMAC
Dr. Stephen Henson [Sat, 5 Apr 2014 12:29:41 +0000 (13:29 +0100)]
Update security framework docs.
Dr. Stephen Henson [Fri, 4 Apr 2014 11:46:39 +0000 (12:46 +0100)]
Update FAQ.
Dr. Stephen Henson [Fri, 4 Apr 2014 11:44:43 +0000 (12:44 +0100)]
Use correct length when prompting for password.
Use bufsiz - 1 not BUFSIZ - 1 when prompting for a password in
the openssl utility.
Thanks to Rob Mackinnon, Leviathan Security for reporting this issue.
Dr. Stephen Henson [Thu, 3 Apr 2014 12:27:08 +0000 (13:27 +0100)]
Document new crl option.
Tim Hudson [Thu, 3 Apr 2014 12:23:51 +0000 (13:23 +0100)]
Add option to generate old hash format.
New -hash_old to generate CRL hashes using old
(before OpenSSL 1.0.0) algorithm.
Eric Young [Wed, 2 Apr 2014 18:50:33 +0000 (19:50 +0100)]
Fix base64 decoding bug.
A short PEM encoded sequence if passed to the BIO, and the file
had 2 \n following would fail.
PR#3289
Dr. Stephen Henson [Thu, 24 Jan 2013 13:30:42 +0000 (13:30 +0000)]
Don't try and verify signatures if key is NULL (CVE-2013-0166)
Add additional check to catch this in ASN1_item_verify too.
(cherry picked from commit
66e8211c0b1347970096e04b18aa52567c325200)
Ben Laurie [Sat, 29 Mar 2014 19:51:58 +0000 (19:51 +0000)]
Fix warning.
Dr. Stephen Henson [Fri, 28 Mar 2014 16:40:56 +0000 (16:40 +0000)]
Add initial security framework docs.
Dr. Stephen Henson [Tue, 18 Mar 2014 14:35:22 +0000 (14:35 +0000)]
Set security level in cipher string.
Allow setting of security level in cipher string using the
@SECLEVEL=N syntax.
Dr. Stephen Henson [Sun, 16 Feb 2014 12:50:18 +0000 (12:50 +0000)]
Set security level to zero is ssltest
Since ssltest needs to test low security ciphersuites and keys
set security level to zero so they aren't rejected.
Dr. Stephen Henson [Mon, 17 Feb 2014 00:10:00 +0000 (00:10 +0000)]
Security callback debug print out.
Add a debugging security callback option to s_client/s_server. This will
print out each security parameter as it is accepted or rejected.
Dr. Stephen Henson [Sun, 15 Dec 2013 13:32:24 +0000 (13:32 +0000)]
Security framework.
Security callback: selects which parameters are permitted including
sensible defaults based on bits of security.
The "parameters" which can be selected include: ciphersuites,
curves, key sizes, certificate signature algorithms, supported
signature algorithms, DH parameters, SSL/TLS version, session tickets
and compression.
In some cases prohibiting the use of a parameters will mean they are
not advertised to the peer: for example cipher suites and ECC curves.
In other cases it will abort the handshake: e.g DH parameters or the
peer key size.
Documentation to follow...
Dr. Stephen Henson [Tue, 18 Mar 2014 14:19:22 +0000 (14:19 +0000)]
Check return value of ssl3_output_cert_chain
Dr. Stephen Henson [Tue, 14 Jan 2014 14:55:21 +0000 (14:55 +0000)]
Allow return of supported ciphers.
New function ssl_cipher_disabled.
Check for disabled client ciphers using ssl_cipher_disabled.
New function to return only supported ciphers.
New option to ciphers utility to print only supported ciphers.
Dr. Stephen Henson [Wed, 22 Jan 2014 16:22:48 +0000 (16:22 +0000)]
Auto DH support.
Add auto DH parameter support. This is roughly equivalent to the
ECDH auto curve selection but for DH. An application can just call
SSL_CTX_set_auto_dh(ctx, 1);
and appropriate DH parameters will be used based on the size of the
server key.
Unlike ECDH there is no way a peer can indicate the range of DH parameters
it supports. Some peers cannot handle DH keys larger that 1024 bits for
example. In this case if you call:
SSL_CTX_set_auto_dh(ctx, 2);
Only 1024 bit DH parameters will be used.
If the server key is 7680 bits or more in size then 8192 bit DH parameters
will be used: these will be *very* slow.
The old export ciphersuites aren't supported but those are very
insecure anyway.
Dr. Stephen Henson [Sat, 18 Jan 2014 14:51:40 +0000 (14:51 +0000)]
Add functions returning security bits.
Add functions to return the "bits of security" for various public key
algorithms. Based on SP800-57.
Dr. Stephen Henson [Thu, 27 Mar 2014 16:10:50 +0000 (16:10 +0000)]
Fix memory leak with client auth.
(cherry picked from commit
bc5ec653ba65fedb1619c8182088497de8a97a70)
Dr. Stephen Henson [Thu, 27 Mar 2014 15:51:25 +0000 (15:51 +0000)]
Add -no_resumption_on_reneg to SSL_CONF.
(cherry picked from commit
1f44dac24d1cb752b1a06be9091bb03a88a8598e)
Dr. Stephen Henson [Thu, 27 Mar 2014 14:20:16 +0000 (14:20 +0000)]
Update chain building function.
Don't clear verification errors from the error queue unless
SSL_BUILD_CHAIN_FLAG_CLEAR_ERROR is set.
If errors occur during verification and SSL_BUILD_CHAIN_FLAG_IGNORE_ERROR
is set return 2 so applications can issue warnings.
(cherry picked from commit
2dd6976f6d02f98b30c376951ac38f780a86b3b5)
Emilia Kasper [Mon, 24 Mar 2014 11:33:54 +0000 (12:33 +0100)]
Allow duplicate certs in ssl_build_cert_chain
Dr. Stephen Henson [Wed, 19 Mar 2014 17:28:01 +0000 (17:28 +0000)]
Workaround for some CMS signature formats.
Some CMS SignedData structure use a signature algorithm OID such
as SHA1WithRSA instead of the RSA algorithm OID. Workaround this
case by tolerating the signature if we recognise the OID.
Piotr Sikora [Tue, 18 Mar 2014 23:55:32 +0000 (23:55 +0000)]
Retry callback only after ClientHello received.
Dr. Stephen Henson [Wed, 12 Mar 2014 14:35:54 +0000 (14:35 +0000)]
Update ordinals.
Use a previously unused value as we will be updating multiple released
branches.
(cherry picked from commit
0737acd2a8cc688902b5151cab5dc6737b82fb96)
Dr. Stephen Henson [Wed, 12 Mar 2014 14:16:19 +0000 (14:16 +0000)]
Fix for CVE-2014-0076
Fix for the attack described in the paper "Recovering OpenSSL
ECDSA Nonces Using the FLUSH+RELOAD Cache Side-channel Attack"
by Yuval Yarom and Naomi Benger. Details can be obtained from:
http://eprint.iacr.org/2014/140
Thanks to Yuval Yarom and Naomi Benger for discovering this
flaw and to Yuval Yarom for supplying a fix.
(cherry picked from commit
2198be3483259de374f91e57d247d0fc667aef29)
Conflicts:
CHANGES
Dr. Stephen Henson [Mon, 10 Mar 2014 15:45:30 +0000 (15:45 +0000)]
typo
Dr. Stephen Henson [Sun, 9 Mar 2014 16:12:20 +0000 (16:12 +0000)]
Simplify ssl_add_cert_chain logic.
Dr. Stephen Henson [Fri, 7 Mar 2014 19:04:45 +0000 (19:04 +0000)]
Remove -WX option from debug-VC-WIN32
(cherry picked from commit
7a3e67f029969620966b8a627b8485d83692cca5)
Andy Polyakov [Fri, 7 Mar 2014 10:02:25 +0000 (11:02 +0100)]
engines/ccgost/gosthash.c: simplify and avoid SEGV.
PR: 3275
Andy Polyakov [Fri, 7 Mar 2014 09:30:37 +0000 (10:30 +0100)]
SPARC T4 assembly pack: treat zero input length in CBC.
The problem is that OpenSSH calls EVP_Cipher, which is not as
protective as EVP_CipherUpdate. Formally speaking we ought to
do more checks in *_cipher methods, including rejecting
lengths not divisible by block size (unless ciphertext stealing
is in place). But for now I implement check for zero length in
low-level based on precedent.
PR: 3087, 2775
Andy Polyakov [Thu, 6 Mar 2014 13:19:37 +0000 (14:19 +0100)]
dh_check.c: check BN_CTX_get's return value.
Andy Polyakov [Thu, 6 Mar 2014 13:08:02 +0000 (14:08 +0100)]
test/Makefile: allow emulated test (e.g. under wine).
Submitted by: Roumen Petrov
Andy Polyakov [Thu, 6 Mar 2014 13:03:02 +0000 (14:03 +0100)]
bss_dgram.c,d1_lib.c: make it compile with mingw.
Submitted by: Roumen Petrov
Dr. Stephen Henson [Mon, 3 Mar 2014 23:33:51 +0000 (23:33 +0000)]
For self signed root only indicate one error.
(cherry picked from commit
bdfc0e284c89dd5781259cc19aa264aded538492)
Dr. Stephen Henson [Fri, 28 Feb 2014 17:23:54 +0000 (17:23 +0000)]
PKCS#8 support for alternative PRFs.
Add option to set an alternative to the default hmacWithSHA1 PRF
for PKCS#8 private key encryptions. This is used automatically
by PKCS8_encrypt if the nid specified is a PRF.
Add option to pkcs8 utility.
Update docs.
(cherry picked from commit
b60272b01fcb4f69201b3e1659b4f7e9e9298dfb)