summaryrefslogtreecommitdiff
path: root/source4/heimdal/lib/des
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2006-05-07 04:51:30 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:05:39 -0500
commit835926c87921a0f4186a9331b6e31b2e6f1c0d90 (patch)
tree1086d806019f4f7a86dc7b0073017a0fb876b6c2 /source4/heimdal/lib/des
parent7a0b65efce3669643d21a2e209d4bf2626a5e948 (diff)
downloadsamba-835926c87921a0f4186a9331b6e31b2e6f1c0d90.tar.gz
samba-835926c87921a0f4186a9331b6e31b2e6f1c0d90.tar.bz2
samba-835926c87921a0f4186a9331b6e31b2e6f1c0d90.zip
r15481: Update heimdal/ to match current lorikeet-heimdal.
This includes many useful upstream changes, many of which should reduce warnings in our compile. It also includes a change to the HDB interface, which removes the need for Samba4/lorikeet-heimdal to deviate from upstream for hdb_fetch(). The new flags replace the old entry type enum. (This required the rework in hdb-ldb.c included in this commit) Andrew Bartlett (This used to be commit ef5604b87744c89e66e4d845f45b23563754ec05)
Diffstat (limited to 'source4/heimdal/lib/des')
-rwxr-xr-xsource4/heimdal/lib/des/aes.h4
-rw-r--r--source4/heimdal/lib/des/des.c6
-rw-r--r--source4/heimdal/lib/des/dh.h4
-rw-r--r--source4/heimdal/lib/des/engine.h6
-rw-r--r--source4/heimdal/lib/des/evp.c2
-rw-r--r--source4/heimdal/lib/des/hash.h6
-rw-r--r--source4/heimdal/lib/des/md4.c24
-rw-r--r--source4/heimdal/lib/des/md4.h4
-rw-r--r--source4/heimdal/lib/des/md5.c24
-rw-r--r--source4/heimdal/lib/des/md5.h6
-rw-r--r--source4/heimdal/lib/des/pkcs5.c8
-rwxr-xr-xsource4/heimdal/lib/des/rijndael-alg-fst.c8
-rwxr-xr-xsource4/heimdal/lib/des/rijndael-alg-fst.h8
-rw-r--r--source4/heimdal/lib/des/rnd_keys.c8
-rw-r--r--source4/heimdal/lib/des/sha.c28
-rw-r--r--source4/heimdal/lib/des/sha.h6
-rw-r--r--source4/heimdal/lib/des/sha256.c28
17 files changed, 96 insertions, 84 deletions
diff --git a/source4/heimdal/lib/des/aes.h b/source4/heimdal/lib/des/aes.h
index 8a62c6461d..3ea1c141be 100755
--- a/source4/heimdal/lib/des/aes.h
+++ b/source4/heimdal/lib/des/aes.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*/
-/* $Id: aes.h,v 1.5 2006/01/08 21:47:27 lha Exp $ */
+/* $Id: aes.h,v 1.6 2006/05/05 11:06:35 lha Exp $ */
#ifndef HEIM_AES_H
#define HEIM_AES_H 1
@@ -54,7 +54,7 @@
#define AES_DECRYPT 0
typedef struct aes_key {
- u_int32_t key[(AES_MAXNR+1)*4];
+ uint32_t key[(AES_MAXNR+1)*4];
int rounds;
} AES_KEY;
diff --git a/source4/heimdal/lib/des/des.c b/source4/heimdal/lib/des/des.c
index 32d479e372..5b1f5c29f4 100644
--- a/source4/heimdal/lib/des/des.c
+++ b/source4/heimdal/lib/des/des.c
@@ -45,7 +45,7 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
-RCSID("$Id: des.c,v 1.17 2006/04/14 14:19:36 lha Exp $");
+RCSID("$Id: des.c,v 1.18 2006/04/24 14:26:19 lha Exp $");
#endif
#include <stdio.h>
@@ -513,9 +513,10 @@ DES_cfb64_encrypt(const void *in, void *out,
load(*iv, uiv);
+ assert(*num >= 0 && *num < DES_CBLOCK_LEN);
+
if (forward_encrypt) {
int i = *num;
- assert(i >= 0);
while (length > 0) {
if (i == 0)
@@ -537,7 +538,6 @@ DES_cfb64_encrypt(const void *in, void *out,
} else {
int i = *num;
unsigned char c;
- assert(i >= 0);
while (length > 0) {
if (i == 0) {
diff --git a/source4/heimdal/lib/des/dh.h b/source4/heimdal/lib/des/dh.h
index 419c7d8902..105d298bc3 100644
--- a/source4/heimdal/lib/des/dh.h
+++ b/source4/heimdal/lib/des/dh.h
@@ -32,7 +32,7 @@
*/
/*
- * $Id: dh.h,v 1.5 2006/04/20 18:16:17 lha Exp $
+ * $Id: dh.h,v 1.6 2006/05/06 13:11:15 lha Exp $
*/
#ifndef _HEIM_DH_H
@@ -40,6 +40,7 @@
/* symbol renaming */
#define DH_null_method hc_DH_null_method
+#define DH_imath_method hc_DH_imath_method
#define DH_new hc_DH_new
#define DH_new_method hc_DH_new_method
#define DH_free hc_DH_free
@@ -113,6 +114,7 @@ struct DH {
*/
const DH_METHOD *DH_null_method(void);
+const DH_METHOD *DH_imath_method(void);
DH * DH_new(void);
DH * DH_new_method(ENGINE *);
diff --git a/source4/heimdal/lib/des/engine.h b/source4/heimdal/lib/des/engine.h
index 757d0f75fb..65588f7d78 100644
--- a/source4/heimdal/lib/des/engine.h
+++ b/source4/heimdal/lib/des/engine.h
@@ -32,7 +32,7 @@
*/
/*
- * $Id: engine.h,v 1.5 2006/04/17 13:16:17 lha Exp $
+ * $Id: engine.h,v 1.6 2006/05/06 12:34:36 lha Exp $
*/
#ifndef _HEIM_ENGINE_H
@@ -55,6 +55,10 @@
#define ENGINE_set_name hc_ENGINE_set_name
#define ENGINE_set_destroy_function hc_ENGINE_set_destroy_function
#define ENGINE_up_ref hc_ENGINE_up_ref
+#define ENGINE_get_default_DH hc_ENGINE_get_default_DH
+#define ENGINE_get_default_RSA hc_ENGINE_get_default_RSA
+#define ENGINE_set_default_DH hc_ENGINE_set_default_DH
+#define ENGINE_set_default_RSA hc_ENGINE_set_default_RSA
/*
*
diff --git a/source4/heimdal/lib/des/evp.c b/source4/heimdal/lib/des/evp.c
index 475bb7314e..fd6ac63ec2 100644
--- a/source4/heimdal/lib/des/evp.c
+++ b/source4/heimdal/lib/des/evp.c
@@ -841,11 +841,13 @@ EVP_BytesToKey(const EVP_CIPHER *type,
EVP_DigestUpdate(&c, salt, PKCS5_SALT_LEN);
EVP_DigestFinal_ex(&c, buf, &mds);
+ assert(mds == EVP_MD_size(md));
for (i = 1; i < count; i++) {
EVP_DigestInit_ex(&c, md, NULL);
EVP_DigestUpdate(&c, buf, mds);
EVP_DigestFinal_ex(&c, buf, &mds);
+ assert(mds == EVP_MD_size(md));
}
i = 0;
diff --git a/source4/heimdal/lib/des/hash.h b/source4/heimdal/lib/des/hash.h
index 24217a27a5..b6da9bd8e0 100644
--- a/source4/heimdal/lib/des/hash.h
+++ b/source4/heimdal/lib/des/hash.h
@@ -30,7 +30,7 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
-/* $Id: hash.h,v 1.3 2005/04/27 11:53:48 lha Exp $ */
+/* $Id: hash.h,v 1.4 2006/05/05 11:06:49 lha Exp $ */
/* stuff in common between md4, md5, and sha1 */
@@ -61,8 +61,8 @@
#define CRAYFIX(X) (X)
#endif
-static inline u_int32_t
-cshift (u_int32_t x, unsigned int n)
+static inline uint32_t
+cshift (uint32_t x, unsigned int n)
{
x = CRAYFIX(x);
return CRAYFIX((x << n) | (x >> (32 - n)));
diff --git a/source4/heimdal/lib/des/md4.c b/source4/heimdal/lib/des/md4.c
index 693b8f5c76..ded4fe12e8 100644
--- a/source4/heimdal/lib/des/md4.c
+++ b/source4/heimdal/lib/des/md4.c
@@ -34,7 +34,7 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
-RCSID("$Id: md4.c,v 1.17 2005/04/27 11:54:56 lha Exp $");
+RCSID("$Id: md4.c,v 1.18 2006/05/05 10:22:04 lha Exp $");
#endif
#include "hash.h"
@@ -69,9 +69,9 @@ a = cshift(a + OP(b,c,d) + X[k] + i, s)
#define DO3(a,b,c,d,k,s,i) DOIT(a,b,c,d,k,s,i,H)
static inline void
-calc (struct md4 *m, u_int32_t *data)
+calc (struct md4 *m, uint32_t *data)
{
- u_int32_t AA, BB, CC, DD;
+ uint32_t AA, BB, CC, DD;
AA = A;
BB = B;
@@ -155,10 +155,10 @@ calc (struct md4 *m, u_int32_t *data)
*/
#if defined(WORDS_BIGENDIAN)
-static inline u_int32_t
-swap_u_int32_t (u_int32_t t)
+static inline uint32_t
+swap_uint32_t (uint32_t t)
{
- u_int32_t temp1, temp2;
+ uint32_t temp1, temp2;
temp1 = cshift(t, 16);
temp2 = temp1 >> 8;
@@ -194,15 +194,15 @@ MD4_Update (struct md4 *m, const void *v, size_t len)
if(offset == 64) {
#if defined(WORDS_BIGENDIAN)
int i;
- u_int32_t current[16];
+ uint32_t current[16];
struct x32 *u = (struct x32*)m->save;
for(i = 0; i < 8; i++){
- current[2*i+0] = swap_u_int32_t(u[i].a);
- current[2*i+1] = swap_u_int32_t(u[i].b);
+ current[2*i+0] = swap_uint32_t(u[i].a);
+ current[2*i+1] = swap_uint32_t(u[i].b);
}
calc(m, current);
#else
- calc(m, (u_int32_t*)m->save);
+ calc(m, (uint32_t*)m->save);
#endif
offset = 0;
}
@@ -241,10 +241,10 @@ MD4_Final (void *res, struct md4 *m)
#if 0
{
int i;
- u_int32_t *r = (u_int32_t *)res;
+ uint32_t *r = (uint32_t *)res;
for (i = 0; i < 4; ++i)
- r[i] = swap_u_int32_t (m->counter[i]);
+ r[i] = swap_uint32_t (m->counter[i]);
}
#endif
}
diff --git a/source4/heimdal/lib/des/md4.h b/source4/heimdal/lib/des/md4.h
index 79055e0fb0..f8c011b9b7 100644
--- a/source4/heimdal/lib/des/md4.h
+++ b/source4/heimdal/lib/des/md4.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*/
-/* $Id: md4.h,v 1.10 2006/01/08 21:47:28 lha Exp $ */
+/* $Id: md4.h,v 1.11 2006/05/05 11:07:01 lha Exp $ */
#ifndef HEIM_MD4_H
#define HEIM_MD4_H 1
@@ -49,7 +49,7 @@
struct md4 {
unsigned int sz[2];
- u_int32_t counter[4];
+ uint32_t counter[4];
unsigned char save[64];
};
diff --git a/source4/heimdal/lib/des/md5.c b/source4/heimdal/lib/des/md5.c
index d5b7c245f6..e23d6c8fd7 100644
--- a/source4/heimdal/lib/des/md5.c
+++ b/source4/heimdal/lib/des/md5.c
@@ -34,7 +34,7 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
-RCSID("$Id: md5.c,v 1.17 2005/04/27 11:54:35 lha Exp $");
+RCSID("$Id: md5.c,v 1.18 2006/05/05 10:22:35 lha Exp $");
#endif
#include "hash.h"
@@ -71,9 +71,9 @@ a = b + cshift(a + OP(b,c,d) + X[k] + (i), s)
#define DO4(a,b,c,d,k,s,i) DOIT(a,b,c,d,k,s,i,I)
static inline void
-calc (struct md5 *m, u_int32_t *data)
+calc (struct md5 *m, uint32_t *data)
{
- u_int32_t AA, BB, CC, DD;
+ uint32_t AA, BB, CC, DD;
AA = A;
BB = B;
@@ -179,10 +179,10 @@ calc (struct md5 *m, u_int32_t *data)
*/
#if defined(WORDS_BIGENDIAN)
-static inline u_int32_t
-swap_u_int32_t (u_int32_t t)
+static inline uint32_t
+swap_uint32_t (uint32_t t)
{
- u_int32_t temp1, temp2;
+ uint32_t temp1, temp2;
temp1 = cshift(t, 16);
temp2 = temp1 >> 8;
@@ -218,15 +218,15 @@ MD5_Update (struct md5 *m, const void *v, size_t len)
if(offset == 64){
#if defined(WORDS_BIGENDIAN)
int i;
- u_int32_t current[16];
+ uint32_t current[16];
struct x32 *u = (struct x32*)m->save;
for(i = 0; i < 8; i++){
- current[2*i+0] = swap_u_int32_t(u[i].a);
- current[2*i+1] = swap_u_int32_t(u[i].b);
+ current[2*i+0] = swap_uint32_t(u[i].a);
+ current[2*i+1] = swap_uint32_t(u[i].b);
}
calc(m, current);
#else
- calc(m, (u_int32_t*)m->save);
+ calc(m, (uint32_t*)m->save);
#endif
offset = 0;
}
@@ -265,10 +265,10 @@ MD5_Final (void *res, struct md5 *m)
#if 0
{
int i;
- u_int32_t *r = (u_int32_t *)res;
+ uint32_t *r = (uint32_t *)res;
for (i = 0; i < 4; ++i)
- r[i] = swap_u_int32_t (m->counter[i]);
+ r[i] = swap_uint32_t (m->counter[i]);
}
#endif
}
diff --git a/source4/heimdal/lib/des/md5.h b/source4/heimdal/lib/des/md5.h
index 534bc9917e..54c34fe572 100644
--- a/source4/heimdal/lib/des/md5.h
+++ b/source4/heimdal/lib/des/md5.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*/
-/* $Id: md5.h,v 1.10 2006/01/08 21:47:28 lha Exp $ */
+/* $Id: md5.h,v 1.11 2006/05/05 11:07:11 lha Exp $ */
#ifndef HEIM_MD5_H
#define HEIM_MD5_H 1
@@ -49,7 +49,7 @@
struct md5 {
unsigned int sz[2];
- u_int32_t counter[4];
+ uint32_t counter[4];
unsigned char save[64];
};
@@ -57,6 +57,6 @@ typedef struct md5 MD5_CTX;
void MD5_Init (struct md5 *m);
void MD5_Update (struct md5 *m, const void *p, size_t len);
-void MD5_Final (void *res, struct md5 *m); /* u_int32_t res[4] */
+void MD5_Final (void *res, struct md5 *m); /* uint32_t res[4] */
#endif /* HEIM_MD5_H */
diff --git a/source4/heimdal/lib/des/pkcs5.c b/source4/heimdal/lib/des/pkcs5.c
index 4bfc313741..9ed494ef6f 100644
--- a/source4/heimdal/lib/des/pkcs5.c
+++ b/source4/heimdal/lib/des/pkcs5.c
@@ -35,7 +35,11 @@
#include <config.h>
#endif
-RCSID("$Id: pkcs5.c,v 1.1 2006/02/28 14:16:57 lha Exp $");
+RCSID("$Id: pkcs5.c,v 1.3 2006/05/05 10:23:11 lha Exp $");
+
+#ifdef KRB5
+#include <krb5-types.h>
+#endif
#include <stdio.h>
#include <stdlib.h>
@@ -53,7 +57,7 @@ PKCS5_PBKDF2_HMAC_SHA1(const void * password, size_t password_len,
{
size_t datalen, leftofkey, checksumsize;
char *data, *tmpcksum;
- u_int32_t keypart;
+ uint32_t keypart;
const EVP_MD *md;
unsigned long i;
int j;
diff --git a/source4/heimdal/lib/des/rijndael-alg-fst.c b/source4/heimdal/lib/des/rijndael-alg-fst.c
index 65b36ab741..d6e4f45c18 100755
--- a/source4/heimdal/lib/des/rijndael-alg-fst.c
+++ b/source4/heimdal/lib/des/rijndael-alg-fst.c
@@ -31,7 +31,7 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
-RCSID("$Id: rijndael-alg-fst.c,v 1.2 2004/06/02 20:09:48 lha Exp $");
+RCSID("$Id: rijndael-alg-fst.c,v 1.3 2006/05/05 10:23:41 lha Exp $");
#endif
#ifdef KRB5
@@ -41,9 +41,9 @@ RCSID("$Id: rijndael-alg-fst.c,v 1.2 2004/06/02 20:09:48 lha Exp $");
#include <rijndael-alg-fst.h>
/* the file should not be used from outside */
-typedef u_int8_t u8;
-typedef u_int16_t u16;
-typedef u_int32_t u32;
+typedef uint8_t u8;
+typedef uint16_t u16;
+typedef uint32_t u32;
/*
Te0[x] = S [x].[02, 01, 01, 03];
diff --git a/source4/heimdal/lib/des/rijndael-alg-fst.h b/source4/heimdal/lib/des/rijndael-alg-fst.h
index 6b6e2a5cd3..7e2e1935fd 100755
--- a/source4/heimdal/lib/des/rijndael-alg-fst.h
+++ b/source4/heimdal/lib/des/rijndael-alg-fst.h
@@ -38,9 +38,9 @@
#define RIJNDAEL_MAXKB (256/8)
#define RIJNDAEL_MAXNR 14
-int rijndaelKeySetupEnc(u_int32_t rk[/*4*(Nr + 1)*/], const u_int8_t cipherKey[], int keyBits);
-int rijndaelKeySetupDec(u_int32_t rk[/*4*(Nr + 1)*/], const u_int8_t cipherKey[], int keyBits);
-void rijndaelEncrypt(const u_int32_t rk[/*4*(Nr + 1)*/], int Nr, const u_int8_t pt[16], u_int8_t ct[16]);
-void rijndaelDecrypt(const u_int32_t rk[/*4*(Nr + 1)*/], int Nr, const u_int8_t ct[16], u_int8_t pt[16]);
+int rijndaelKeySetupEnc(uint32_t rk[/*4*(Nr + 1)*/], const uint8_t cipherKey[], int keyBits);
+int rijndaelKeySetupDec(uint32_t rk[/*4*(Nr + 1)*/], const uint8_t cipherKey[], int keyBits);
+void rijndaelEncrypt(const uint32_t rk[/*4*(Nr + 1)*/], int Nr, const uint8_t pt[16], uint8_t ct[16]);
+void rijndaelDecrypt(const uint32_t rk[/*4*(Nr + 1)*/], int Nr, const uint8_t ct[16], uint8_t pt[16]);
#endif /* __RIJNDAEL_ALG_FST_H */
diff --git a/source4/heimdal/lib/des/rnd_keys.c b/source4/heimdal/lib/des/rnd_keys.c
index e27b00defa..e58faefcb0 100644
--- a/source4/heimdal/lib/des/rnd_keys.c
+++ b/source4/heimdal/lib/des/rnd_keys.c
@@ -34,7 +34,7 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
-RCSID("$Id: rnd_keys.c,v 1.70 2006/01/08 21:47:29 lha Exp $");
+RCSID("$Id: rnd_keys.c,v 1.71 2006/05/05 10:24:31 lha Exp $");
#endif
#ifdef KRB5
@@ -82,8 +82,8 @@ static
int
sumFile (const char *name, int len, void *res)
{
- u_int32_t sum[2] = { 0, 0 };
- u_int32_t buf[1024*2];
+ uint32_t sum[2] = { 0, 0 };
+ uint32_t buf[1024*2];
int fd, i;
fd = open (name, 0);
@@ -148,7 +148,7 @@ md5sumFile (const char *name, int len, int32_t sum[4])
* based on an initial des key used as a seed.
*/
static DES_key_schedule sequence_seed;
-static u_int32_t sequence_index[2];
+static uint32_t sequence_index[2];
/*
* Random number generator based on ideas from truerand in cryptolib
diff --git a/source4/heimdal/lib/des/sha.c b/source4/heimdal/lib/des/sha.c
index ca6c1c16d4..fae0fe01cb 100644
--- a/source4/heimdal/lib/des/sha.c
+++ b/source4/heimdal/lib/des/sha.c
@@ -34,7 +34,7 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
-RCSID("$Id: sha.c,v 1.18 2005/04/27 11:55:05 lha Exp $");
+RCSID("$Id: sha.c,v 1.19 2006/05/05 10:25:00 lha Exp $");
#endif
#include "hash.h"
@@ -72,7 +72,7 @@ SHA1_Init (struct sha *m)
#define DO(t,f,k) \
do { \
- u_int32_t temp; \
+ uint32_t temp; \
\
temp = cshift(AA, 5) + f(BB,CC,DD) + EE + data[t] + k; \
EE = DD; \
@@ -83,10 +83,10 @@ do { \
} while(0)
static inline void
-calc (struct sha *m, u_int32_t *in)
+calc (struct sha *m, uint32_t *in)
{
- u_int32_t AA, BB, CC, DD, EE;
- u_int32_t data[80];
+ uint32_t AA, BB, CC, DD, EE;
+ uint32_t data[80];
int i;
AA = A;
@@ -204,11 +204,11 @@ calc (struct sha *m, u_int32_t *in)
*/
#if !defined(WORDS_BIGENDIAN) || defined(_CRAY)
-static inline u_int32_t
-swap_u_int32_t (u_int32_t t)
+static inline uint32_t
+swap_uint32_t (uint32_t t)
{
#define ROL(x,n) ((x)<<(n))|((x)>>(32-(n)))
- u_int32_t temp1, temp2;
+ uint32_t temp1, temp2;
temp1 = cshift(t, 16);
temp2 = temp1 >> 8;
@@ -244,15 +244,15 @@ SHA1_Update (struct sha *m, const void *v, size_t len)
if(offset == 64){
#if !defined(WORDS_BIGENDIAN) || defined(_CRAY)
int i;
- u_int32_t current[16];
+ uint32_t current[16];
struct x32 *u = (struct x32*)m->save;
for(i = 0; i < 8; i++){
- current[2*i+0] = swap_u_int32_t(u[i].a);
- current[2*i+1] = swap_u_int32_t(u[i].b);
+ current[2*i+0] = swap_uint32_t(u[i].a);
+ current[2*i+1] = swap_uint32_t(u[i].b);
}
calc(m, current);
#else
- calc(m, (u_int32_t*)m->save);
+ calc(m, (uint32_t*)m->save);
#endif
offset = 0;
}
@@ -291,10 +291,10 @@ SHA1_Final (void *res, struct sha *m)
#if 0
{
int i;
- u_int32_t *r = (u_int32_t *)res;
+ uint32_t *r = (uint32_t *)res;
for (i = 0; i < 5; ++i)
- r[i] = swap_u_int32_t (m->counter[i]);
+ r[i] = swap_uint32_t (m->counter[i]);
}
#endif
}
diff --git a/source4/heimdal/lib/des/sha.h b/source4/heimdal/lib/des/sha.h
index 6021823f5c..977b9f7bb2 100644
--- a/source4/heimdal/lib/des/sha.h
+++ b/source4/heimdal/lib/des/sha.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*/
-/* $Id: sha.h,v 1.10 2006/04/15 07:54:11 lha Exp $ */
+/* $Id: sha.h,v 1.11 2006/05/05 11:06:21 lha Exp $ */
#ifndef HEIM_SHA_H
#define HEIM_SHA_H 1
@@ -52,7 +52,7 @@
struct sha {
unsigned int sz[2];
- u_int32_t counter[5];
+ uint32_t counter[5];
unsigned char save[64];
};
@@ -70,7 +70,7 @@ void SHA1_Final (void *res, struct sha *m);
struct hc_sha256state {
unsigned int sz[2];
- u_int32_t counter[8];
+ uint32_t counter[8];
unsigned char save[64];
};
diff --git a/source4/heimdal/lib/des/sha256.c b/source4/heimdal/lib/des/sha256.c
index 8c12ce504c..58fb92815a 100644
--- a/source4/heimdal/lib/des/sha256.c
+++ b/source4/heimdal/lib/des/sha256.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995 - 2001, 2006 Kungliga Tekniska Högskolan
+ * Copyright (c) 2006 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -34,7 +34,7 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
-RCSID("$Id: sha256.c,v 1.1 2006/04/15 07:53:07 lha Exp $");
+RCSID("$Id: sha256.c,v 1.2 2006/05/05 10:25:37 lha Exp $");
#endif
#include "hash.h"
@@ -59,7 +59,7 @@ RCSID("$Id: sha256.c,v 1.1 2006/04/15 07:53:07 lha Exp $");
#define G m->counter[6]
#define H m->counter[7]
-static const u_int32_t constant_256[64] = {
+static const uint32_t constant_256[64] = {
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
@@ -94,10 +94,10 @@ SHA256_Init (SHA256_CTX *m)
}
static void
-calc (SHA256_CTX *m, u_int32_t *in)
+calc (SHA256_CTX *m, uint32_t *in)
{
- u_int32_t AA, BB, CC, DD, EE, FF, GG, HH;
- u_int32_t data[64];
+ uint32_t AA, BB, CC, DD, EE, FF, GG, HH;
+ uint32_t data[64];
int i;
AA = A;
@@ -116,7 +116,7 @@ calc (SHA256_CTX *m, u_int32_t *in)
sigma0(data[i-15]) + data[i - 16];
for (i = 0; i < 64; i++) {
- u_int32_t T1, T2;
+ uint32_t T1, T2;
T1 = HH + Sigma1(EE) + Ch(EE, FF, GG) + constant_256[i] + data[i];
T2 = Sigma0(AA) + Maj(AA,BB,CC);
@@ -146,11 +146,11 @@ calc (SHA256_CTX *m, u_int32_t *in)
*/
#if !defined(WORDS_BIGENDIAN) || defined(_CRAY)
-static inline u_int32_t
-swap_u_int32_t (u_int32_t t)
+static inline uint32_t
+swap_uint32_t (uint32_t t)
{
#define ROL(x,n) ((x)<<(n))|((x)>>(32-(n)))
- u_int32_t temp1, temp2;
+ uint32_t temp1, temp2;
temp1 = cshift(t, 16);
temp2 = temp1 >> 8;
@@ -186,15 +186,15 @@ SHA256_Update (SHA256_CTX *m, const void *v, size_t len)
if(offset == 64){
#if !defined(WORDS_BIGENDIAN) || defined(_CRAY)
int i;
- u_int32_t current[16];
+ uint32_t current[16];
struct x32 *u = (struct x32*)m->save;
for(i = 0; i < 8; i++){
- current[2*i+0] = swap_u_int32_t(u[i].a);
- current[2*i+1] = swap_u_int32_t(u[i].b);
+ current[2*i+0] = swap_uint32_t(u[i].a);
+ current[2*i+1] = swap_uint32_t(u[i].b);
}
calc(m, current);
#else
- calc(m, (u_int32_t*)m->save);
+ calc(m, (uint32_t*)m->save);
#endif
offset = 0;
}