Commit Graph

235 Commits

Author SHA1 Message Date
christos 31a62606ea Merge kernel and userland rmd160 and sha2 implementation.
XXX: We still install rmd160.h and sha2.h in /usr/include/crypto, unlike
the other hash functions which get installed in /usr/include for compatibility.
2006-10-27 21:20:48 +00:00
christos 78c43e9064 static comes first 2006-09-03 05:22:36 +00:00
mrg 084c052803 quell GCC 4.1 uninitialised variable warnings.
XXX: we should audit the tree for which old ones are no longer needed
after getting the older compilers out of the tree..
2006-05-10 21:53:14 +00:00
christos 95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
elad e0d3e1c5ea RMD160_DIGEST_STRING_LENGTH is 41, including the terminating NUL. 2005-09-24 21:31:53 +00:00
elad b6c7f93fa8 Install rmd160.h to /usr/include/crypto. 2005-09-24 18:34:59 +00:00
elad ad7f55858f RMD160File() gets const char *, add RMD160FileChunk(). 2005-09-24 18:12:35 +00:00
elad 138b399207 Define RMD160_DIGEST_STRING_LENGTH. 2005-09-24 17:39:15 +00:00
elad 45b120e04b Lint warnings. 2005-09-11 16:11:22 +00:00
elad 7bdf56d9b6 Remove stuff inside #if 0, remove __P macro usage, add helper routines
prototypes inside #ifndef _KERNEL.
2005-08-23 16:23:50 +00:00
elad 935cb376b9 Make this usable both in kernel and userland. 2005-08-22 15:33:08 +00:00
elad 4bbe952358 Install sha2.h to /usr/include/crypto. 2005-08-20 15:42:03 +00:00
tron f84cd33e5f Remove unused functions SHA*_End() and SHA*_Data(). 2005-07-21 15:42:41 +00:00
martin 1ec429dfd5 Constify, to make it compile (at least).
XXX - I'm not sure with what args this is called, but my bet is that
there is no chance this code will work on alignment requiring archs.
2005-06-03 11:31:57 +00:00
christos 87de4cecc4 add a missing const 2005-05-31 00:43:56 +00:00
christos 0a86a6b05d sprinkle const 2005-05-30 04:13:14 +00:00
christos 362a4a0bd5 Yes, it was a cool trick >20 years ago to use "0123456789abcdef"[a] to
implement, xtoa(), but I think defining the samestring 50 times is a bit
too much. Defined HEXDIGITS and hexdigits in subr_prf.c and use it...
2005-05-17 04:14:57 +00:00
blymn 77b4424bf0 Make resultant hash length a symbolic define so other code can reuse the
same define.
2005-04-19 14:05:53 +00:00
perry 477853c351 nuke trailing whitespace 2005-02-26 22:58:54 +00:00
keihan 6979203302 s/netbsd.org/NetBSD.org/g 2003-11-28 08:56:48 +00:00
tls 1f93975cf8 Move the Skipjack algorithm from sys/opencrypto to sys/crypto/skipjack.
There are now no cryptographic algorithms in sys/opencrypto, which,
according to the comment formerly in files.opencrypto, was the original
intent.
2003-11-16 12:07:50 +00:00
itojun 1e4d96a37f bzero() 2nd arg mistake. found by openbsd guys, via kame 2003-09-04 00:11:49 +00:00
itojun 467deb61ca rijndael-api-fst.h is not needed 2003-08-28 08:38:19 +00:00
thorpej d5d0a860bc Add missing RCS ID. 2003-08-27 14:49:44 +00:00
itojun 725b73043b simplify rijndael.c API - always schedule encrypt/decrypt key.
reviewed by thorpej
2003-08-27 14:23:25 +00:00
tron 710886efc2 Fix build problem caused by adding "const", remove "register" usage. 2003-08-27 12:17:18 +00:00
itojun 000061139d typo 2003-08-27 03:35:35 +00:00
itojun 880bf51285 check and panic if key with wrong dir is passed 2003-08-27 02:44:19 +00:00
thorpej e77423d998 * Const poison, ANSI'ify, like newer OpenSSL Blowfish code.
* Add a BF_ecb_encrypt(), which makes for a prettier interface than
  using BF_encrypt()/BF_decrypt() directly.
2003-08-26 23:51:12 +00:00
thorpej 850a45bf66 const an array. 2003-08-26 20:15:13 +00:00
thorpej e6430e4cf8 Const poison, use ANSI-style. 2003-08-26 20:12:22 +00:00
thorpej 793bc7ea32 Take a couple more opportunities to const poison. 2003-08-26 20:07:59 +00:00
thorpej 2d241878c0 Const poison. 2003-08-26 19:58:36 +00:00
thorpej 6de9ce0437 Move the opencrypto CAST-128 implementation to crypto/cast128, removing
the old one.  Rename the functions/structures from cast_* to cast128_*.
Adapt the KAME IPsec to use the new CAST-128 code, which has a simpler
API and smaller footprint.
2003-08-26 16:37:36 +00:00
thorpej aa6632baa6 G/C opencrypto's local copy of rijndael. Adapt the extant rijndael
code for opencrypto's use by adding the simplified API that opencrypto
expects.
2003-08-26 14:24:05 +00:00
thorpej 633cb7d73e Make opencrypto depend on the "ripemd160" and "sha2" attributes, rather
than polluting the crypto algorithm config info with opencrypto knowledge.
2003-08-24 19:26:54 +00:00
elric 73d81f8b40 Ensure that the IV is aligned for strict alignment machines. 2003-08-18 02:36:17 +00:00
martin 99716c5d05 Make this compile for big endian archs.
Fixes PR port-sparc64/22333.
2003-08-01 22:25:55 +00:00
jonathan 33aa54035d Clean up dependencies between opencrypto framework and sys/crypto,
by making the sys/crypto transforms depend on
	(per-transform-config-keyword|opencrypto)

Thanks to  Martin Husemann for double-checking the changes.
2003-07-28 21:28:23 +00:00
he aa96f9d39c Don't declare the sha2.c file twice, instead add opencrypto flag to
existing declaration, and leave behind a comment in files.opencrypto.
2003-07-26 13:49:52 +00:00
itojun 1b39a0b938 add ripemd160 (for AH) 2003-07-25 09:46:05 +00:00
itojun a93a267072 make rijndael_cipherInit() to take binary IV, not hex IV, as before. 2003-07-24 14:51:34 +00:00
itojun d64e1c8d6a add hmac-sha2 support. various cleanups (like avoid hardcoding '16').
from kame
2003-07-22 03:24:23 +00:00
itojun d931d5d70e "make regress" work under regress/sys/crypto/rijndael 2003-07-16 05:27:49 +00:00
itojun 4d4897d334 rijndael-api-fst.c is needed for cgd. pointed out by Love 2003-07-16 05:08:08 +00:00
itojun 281d9d13a5 simplify and update rijndael code. markus@openbsd 2003-07-15 11:00:36 +00:00
drochner 2d89c22fc7 sprinkle some #ifdef __LINT__ until C9X named union member
initialization is digested
2003-02-09 16:25:27 +00:00
itojun f2187f5675 correct panic() condition - it was backwards.
From: Rafal Boni <rafal@attbi.com>
2002-11-18 23:38:46 +00:00
itohy f2cc0d2ae5 add non-ELF .align 2002-11-12 03:03:10 +00:00
thorpej db1c1d81f9 Fix signed/unsigned comparison warnings. 2002-11-07 07:04:13 +00:00
thorpej c74bb099e4 Make the length argument of arc4_setkey() unsigned. 2002-11-07 07:03:11 +00:00
perry e4c3c3c99a /*CONTCOND*/ a sizeof comparison 2002-11-02 07:19:51 +00:00
perry 0cbafb99fa change arc4_ctx to use unsigned values -- kills lint warnings 2002-10-22 21:50:08 +00:00
thorpej 0ab79d5327 * Move config defns for the crypto algorithms into their own files.
Define an attribute for each crypto algorithm, and use that attribute
  to select the files that implement the algorithm.
* Give the "wlan" attribute a dependency on the "arc4" attribute.
* Give the "cgd" pseudo-device the "des", "blowfish", "cast128", and
  "rijndael" attributes.
* Use the new attribute-as-option-dependencies feature of config(8) to
  give the IPSEC_ESP option dependencies on the "des", "blowfish", "cast128",
  and "rijndael" attributes.
2002-10-11 01:52:04 +00:00
elric c242f201c5 Modified to avoid compiler warnings. The specific warning related
to const BF_KEY * vars, and I chose to ``fix'' it in this file
rather than elsewhere in the framework because, although the other
fix was more appropriate, nothing seems to use the code in this
file and hence the risk of disrupting other people was lower.  In
the future, the more appropriate change would be to change blowfish.h
and bf_enc.c to have functions with signatures:

BF_encrypt(BF_LONG *, const BF_KEY *);
BF_decrypt(BF_LONG *, const BF_KEY *);
2002-09-08 07:52:41 +00:00
elric b6db42eac8 Added an include of sys/types.h to get u_int32_t and so on. 2002-09-08 07:41:01 +00:00
elric 7fbd07ccbe Include <sys/types.h> to allow compilation to occur. 2002-09-07 23:35:37 +00:00
elric 29db5af4a5 repoint include file for kernel use. 2002-09-07 22:58:04 +00:00
itojun 971ec4d861 missing IV handling in CBC mode (does not affect ESP code as we have
CBC handling in sys/netinet6/esp_core.c).  sync w/kame
2002-05-24 06:28:06 +00:00
itojun 2ff9b43758 sync blowfish function prototype between i386 assembly and C.
From: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
2002-02-27 01:32:17 +00:00
thorpej 9e94d2a9fe When compiling for userland, need <stdlib.h> for abort() prototype
(noticed by gcc 3.1).
2001-12-31 20:20:28 +00:00
itojun f8321e02a6 fix cast128 with shorter key length. sync with kame 2001-11-27 11:19:36 +00:00
lukem 2565646230 don't need <sys/types.h> when including <sys/param.h> 2001-11-15 09:47:59 +00:00
lukem 4f2ad95259 add RCSIDs 2001-11-13 00:56:55 +00:00
taca 9b6c5002eb Add including <stdio.h> for compiling in user land.
This should fix compile error (really warning) in src/regress/sys/crypto/des.
2001-09-09 15:52:57 +00:00
tls 6b3afc53e0 Add asm versions of blowfish and des transforms for i386.
This also involved updating the in-kernel DES functions to correspond
to the versions in our in-tree OpenSSL, because the des_SPtrans table
has changed; the asm code will not work with the old permutation table!

C and i386 asm code for the DES, 3DES, and Blowfish CBC modes is also
included; it is not currently built as the ESP processing in esp_core.c
splits the CBC operation and the cipher transform apart.  Hopefully that
will be fixed as there is a substantial performance improvement to be had
from doing so.  It will remain necessary to use the C version of the
Blowfish CBC function on some i386 machines, however, as the asm version
uses bswapl, which ony 486 and later processors have.  The DES CBC code
doesn't have this problem.

Finally, change esp_core.c to use the ecb3_encrypt function instead of
calling ecb_encrypt three times; this improves performance a bit, in
particular in the asm case.
2001-09-09 11:03:59 +00:00
tls 3d4146e21f Add asm versions of blowfish and des transforms for i386.
This also involved updating the in-kernel DES functions to correspond
to the versions in our in-tree OpenSSL, because the des_SPtrans table
has changed; the asm code will not work with the old permutation table!

C and i386 asm code for the DES, 3DES, and Blowfish CBC modes is also
included; it is not currently built as the ESP processing in esp_core.c
splits the CBC operation and the cipher transform apart.  Hopefully that
will be fixed as there is a substantial performance improvement to be had
from doing so.  It will remain necessary to use the C version of the
Blowfish CBC function on some i386 machines, however, as the asm version
uses bswapl, which ony 486 and later processors have.  The DES CBC code
doesn't have this problem.

Finally, change esp_core.c to use the ecb3_encrypt function instead of
calling ecb_encrypt three times; this improves performance a bit, in
particular in the asm case.
2001-09-09 11:00:59 +00:00
thorpej 05b5ee3074 bzero -> memset, bcopy -> memcpy 2001-07-18 16:50:27 +00:00
itojun 7925bc6220 properl y check DES weak key. KAME PR 363 2001-07-03 14:29:45 +00:00
itojun 78458be84d correct binary key material handling. sync with kame 2001-05-27 01:40:16 +00:00
itojun 00e5ad3408 remove files we no longer need/maintain. sync with kame 2001-05-27 01:03:53 +00:00
kleink 19f61e4df3 Need a memcpy() declaration. 2001-05-23 00:02:24 +00:00
kleink 5c9e69f795 Fix several alignment problems in this implementation due to its use of
word32 pointers to access data stored in word8 arrays:
* align transformation tables on 32-bit boundaries,
* align key schedule on 32-bit boundary,
* align temporaries on 32-bit boundaries,
* align plaintext and ciphertext used in round transformations on 32-bit
  boundaries.
2001-05-22 23:45:41 +00:00
itojun dc3424f555 pass key to rijndael logic as binary, not hexadecimal string.
sync with kame
2001-03-02 15:42:39 +00:00
jdolecek 522f569810 make some more constant arrays 'const' 2001-02-21 21:39:52 +00:00
itojun 7236276c18 sync with kame.
- include string.h (instead of sys/systm.h) on userland compilation.
  make compilation under src/regress/sys/crypto happier.  from minoura
- (blowfish) KNF.
2000-11-06 14:11:40 +00:00
itojun a09dcd7432 avoid assert, memcpy and memset (necessary to BSD code sharing).
sync with kame
2000-10-03 03:17:19 +00:00
itojun b7a15a9d51 $NetBSD$ 2000-10-02 17:19:15 +00:00
itojun e3eae405da rijndael logic, based on 2.4/from kame 2000-10-02 17:16:40 +00:00
itojun e24e3dffad remove a comment, which is now bogus due to the previous change.
sync with kame.
2000-08-31 14:53:48 +00:00
itojun 65fbdbe744 repair DES on LP64. past code did not interoperate with non-LP64, due to
incorrect computed results.
remove unnecessary #ifdef/#define.  sync with kame.
2000-08-31 07:33:04 +00:00
itojun 8b93101dc8 avoid unnecessary #include <sys/mbuf.h> 2000-08-31 06:59:17 +00:00
itojun 0f1649155f make the code friendly with LP64 machines.
- use u_int32_t for 32bit quantity unsigned integer type.
- s/unsigned long/BF_LONG/ (BF_LONG = u_int32_t) where appropriate.
- prototype cleanup - due to *BSD code sharing, we still are using __P().
part of PR 10918.  sync with kame.
2000-08-31 06:46:21 +00:00
onoe 793eb28211 Support WEP functions for awi driver.
arc4 implementation by Kalle Kaukonen has been added.
	define "wlan" in files.
		XXX: only awi depends on wlan for now.
	Allow authentication for adhoc (IBSS) mode.
Disable adhoc mode without bssid (mediaopt adhoc,flag0) for FH radio.
	FH cannot work without synchronization by beacons.
Align IP header for ethernet encapsulation (IFF_FLAG0) mode.
Print available access points for IFF_DEBUG.
2000-07-04 14:27:56 +00:00
thorpej 599c8087c7 Import the IPsec crypto code from netbsd-cryptosrc-intl. 2000-06-14 19:45:33 +00:00