Commit Graph

54 Commits

Author SHA1 Message Date
Marc Dionne
fc4b3ce49b hcrypto: Fix return type for null_Init, null_Update and null_Final
The hc_evp_md_init, hc_evp_md_update and hc_evp_md_final typedefs
are defined as functions returning an int, but null_Init, null_Update
and null_Final are defined as void, and cast with the typedef when
assigned to the function vector.

This might result in some uninitialized value being returned to the
caller, if some of them make use of the return value.  It also causes
warnings if the -Wcast-function-type warning is enabled.

Change the type to in to match the typedef, and return 1 (success).
2022-01-13 16:00:50 -05:00
Nicolas Williams
1c81ddf4e2 Round #2 of scan-build warnings cleanup 2016-11-16 17:03:14 -06:00
Simon Wilkinson
67ac841f8f hcrypto: Fix Win 32 cpp checks
The correct test for a windows build is if defined(_WIN32), not just
if _WIN32. Fix a few places in the build which do the wrong thing, as
it gives compiler warnings.
2016-11-09 15:36:04 +00:00
David Mulder
2bee5966ab The evp-w32.h header should not be included on all platforms 2016-08-02 16:12:46 -06:00
Nicolas Williams
490337f4f9 Make OpenSSL an hcrypto backend proper
This adds a new backend for libhcrypto: the OpenSSL backend.

Now libhcrypto has these backends:

 - hcrypto itself (i.e., the algorithms coded in lib/hcrypto)
 - Common Crypto (OS X)
 - PKCS#11 (specifically for Solaris, but not Solaris-specific)
 - Windows CNG (Windows)
 - OpenSSL (generic)

The ./configure --with-openssl=... option no longer disables the use of
hcrypto.  Instead it enables the use of OpenSSL as a (and the default)
backend in libhcrypto.  The libhcrypto framework is now always used.

OpenSSL should no longer be used directly within Heimdal, except in the
OpenSSL hcrypto backend itself, and files where elliptic curve (EC)
crypto is needed.

Because libhcrypto's EC support is incomplete, we can only use OpenSSL
for EC.  Currently that means separating all EC-using code so that it
does not use hcrypto, thus the libhx509/hxtool and PKINIT EC code has
been moved out of the files it used to be in.
2016-04-15 00:16:17 -05:00
Nicolas Williams
6bbe7f0ffa Implement EVP_CIPH_CTRL_INIT 2016-04-15 00:16:16 -05:00
Nicolas Williams
8033eb298b lib/hcrypto/evp.c: missing MD guards 2016-04-15 00:16:16 -05:00
Nicolas Williams
1e6f88f721 Fix hcrypto evp_md cleanup call protocol 2016-04-15 00:16:14 -05:00
Jeffrey Altman
0f97855826 hcrypto: config/roken cleanup
All source files in lib/hcrypto should be built the same way.
Since this source directory is dependent on libroken then all source
files must be built using the roken.h declarations and included headers.

Also, there is no config.h in the local directory so angle brackets
include of quotes should be used.

Finally, because roken.h includes stdio.h, stdlib.h, stdarg.h, limits.h,
strings.h, sys/types.h, etc., do not include them separately.

Start all source files with

  #include <config.h>
  #include <roken.h>

Change-Id: I09ab47f8a5472018efe6c8b59a0e51fde8f24724
2016-04-10 17:05:07 -05:00
Luke Howard
fdf8782db2 hcrypto: PKCS#11 backend
implement a PKCS#11 backend for hcrypto. tested with Solaris 11 and
SoftHSM, this is now the default when building on Solaris.
2015-12-09 11:08:35 +11:00
Jeffrey Altman
6fbe672451 hcrypto: Default to CommonCrypto on Apple OSes
When __APPLE__ is defined and HCRYPTO_DEF_PROVIDER is not defined,
define HCRYPTO_DEF_PROVIDER to be "cc" so that Apple's CommonCrypto
implementations are used instead of the built-in "hcrypto"
implementations.

Change-Id: I393e5fc3f6c3b9339c96db58d926ff8ea1867cbb
2015-11-24 09:48:44 -05:00
Luke Howard
5023f55208 Add Windows CNG (BCrypt) support to HCrypto EVP API 2015-02-11 16:00:32 +11:00
Love Hornquist Astrand
0879b9831a remove trailing whitespace 2011-05-21 11:57:31 -07:00
Love Hornquist Astrand
b206aeb016 SHA384 2010-09-30 18:22:00 -07:00
Love Hornquist Astrand
b32651c830 SHA512 support 2010-09-29 23:41:15 -07:00
Simon Wilkinson
75df9577e7 Uses unsigned ints for lengths
EVP_BytesToKey uses min() on a mixture of signed and unsigned
paramters. To avoid compiler warnings, use unsigned int for all
of the iv and key lengths in this function.

Signed-off-by: Love Hornquist Astrand <lha@h5l.org>
2010-09-18 11:30:06 -07:00
Love Hornquist Astrand
76867d73ab validate args before use 2010-09-08 00:03:39 -07:00
Love Hornquist Astrand
91020dd11d add cfb8-aes modes 2010-06-03 17:20:40 -07:00
Asanka Herath
c4b95f7330 Make build on windows
Signed-off-by: Love Hornquist Astrand <lha@h5l.org>
2009-11-25 02:22:31 +01:00
Love Hornquist Astrand
2b6a34e132 allocate cleam memory for cipher to play with 2009-08-21 07:43:29 -07:00
Love Hornquist Astrand
06f016c1e6 Rename DEF_PROVIDER to HCRYPTO_DEF_PROVIDER 2009-08-17 13:59:17 +02:00
Love Hornquist Astrand
76e01c5084 (EVP_MD_CTX_cleanup): clean out memory 2009-08-16 20:42:38 +02:00
Love Hornquist Astrand
21e8270aa2 Support RC4 in EVP 2009-08-10 11:48:12 +02:00
Love Hornquist Astrand
8276a469ab Add CommonCrypto support, split out all hcrypto specific code to hcrypto module 2009-08-10 09:07:37 +02:00
Love Hörnquist Åstrand
2e5770b7f4 drop digest init
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24468 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-01-25 00:48:59 +00:00
Love Hörnquist Åstrand
af8661bb03 x
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24284 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-01-11 21:49:13 +00:00
Love Hörnquist Åstrand
fa6a8adddc doxygen
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24283 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-01-11 21:49:04 +00:00
Love Hörnquist Åstrand
3a343cc41a add EVP_CIPHER_CTX_ctrl and EVP_CIPHER_CTX_rand_key
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23949 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-10-19 07:56:00 +00:00
Love Hörnquist Åstrand
6937d41a02 remove trailing whitespace
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23815 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-09-13 09:21:03 +00:00
Love Hörnquist Åstrand
e172367898 switch to utf8 encoding of all files
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23814 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-09-13 08:53:55 +00:00
Love Hörnquist Åstrand
c6f0b74fe5 Do incremental encryption.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23641 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-08-19 02:20:14 +00:00
Love Hörnquist Åstrand
61fb057fe7 Try to update buf_len to catch more errors
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23636 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-08-18 20:15:30 +00:00
Love Hörnquist Åstrand
bbc4454631 First implementation of EVP_CipherUpdate and EVP_CipherFinal_ex that
only handle buffers on block bounderies.

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23635 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-08-18 20:15:16 +00:00
Love Hörnquist Åstrand
bec34fc8ac ref to example.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23632 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-08-18 20:14:41 +00:00
Love Hörnquist Åstrand
e0efb981f0 documentation and fix des
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23628 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-08-18 20:13:55 +00:00
Love Hörnquist Åstrand
e8bb6453e2 Dummy EVP_CipherUpdate EVP_CipherFinal_ex
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23624 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-08-18 20:13:10 +00:00
Love Hörnquist Åstrand
de9f33dca8 define HC_DEPRECATED_CRYPTO
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23611 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-08-17 15:56:49 +00:00
Love Hörnquist Åstrand
3cf44d5def add EVP_des_cbc
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23591 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-08-17 14:10:07 +00:00
Love Hörnquist Åstrand
7c6e91521c expose hc_evp_md
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23569 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-08-16 23:04:43 +00:00
Love Hörnquist Åstrand
5fadb08d38 break out the hcrypto part
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23550 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-08-16 23:00:59 +00:00
Love Hörnquist Åstrand
87493aa114 EVP_MD_CTX_init already implemented.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23144 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-04-29 05:47:16 +00:00
Love Hörnquist Åstrand
38153d7b7a deprecate functions that are needed for exported EVP_MD_CTX.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23141 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-04-29 05:47:04 +00:00
Love Hörnquist Åstrand
d87f2f7ea9 Internalize hc_EVP_MD_CTX.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23138 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-04-29 05:46:52 +00:00
Love Hörnquist Åstrand
4d69c8fd82 Fixup key parity before going ahead and using the key.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23122 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-04-28 10:30:28 +00:00
Love Hörnquist Åstrand
699deb5ba2 use DES_set_key_unchecked().
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23119 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-04-28 10:30:14 +00:00
Love Hörnquist Åstrand
626c774600 make compile
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@22379 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-12-29 11:13:26 +00:00
Love Hörnquist Åstrand
e73f5f9b72 Add last of the doxygen documentation for functions in this module.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@22364 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-12-28 15:13:26 +00:00
Love Hörnquist Åstrand
0508c84035 more doxygen
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@22363 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-12-28 13:01:10 +00:00
Love Hörnquist Åstrand
bb9f8932f8 more doxygen
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@22362 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-12-28 13:00:48 +00:00
Love Hörnquist Åstrand
4de14c728e complete the EVP_MD functions doxygen.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@22360 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-12-28 12:26:37 +00:00