Mon Mar 16 05:59:22 2009 UTC ()
ansify function definitions


(cegger)
diff -r1.2 -r1.3 src/common/lib/libc/gen/bswap64.c
diff -r1.3 -r1.4 src/common/lib/libc/hash/sha1/sha1.c
diff -r1.3 -r1.4 src/common/lib/libc/md/md4c.c
diff -r1.3 -r1.4 src/common/lib/libc/md/md5c.c
diff -r1.2 -r1.3 src/common/lib/libc/net/__cmsg_alignbytes.c

cvs diff -r1.2 -r1.3 src/common/lib/libc/gen/bswap64.c (expand / switch to unified diff)

--- src/common/lib/libc/gen/bswap64.c 2008/02/16 17:37:13 1.2
+++ src/common/lib/libc/gen/bswap64.c 2009/03/16 05:59:21 1.3
@@ -1,33 +1,32 @@ @@ -1,33 +1,32 @@
1/* $NetBSD: bswap64.c,v 1.2 2008/02/16 17:37:13 apb Exp $ */ 1/* $NetBSD: bswap64.c,v 1.3 2009/03/16 05:59:21 cegger Exp $ */
2 2
3/* 3/*
4 * Written by Manuel Bouyer <bouyer@NetBSD.org>. 4 * Written by Manuel Bouyer <bouyer@NetBSD.org>.
5 * Public domain. 5 * Public domain.
6 */ 6 */
7 7
8#include <sys/cdefs.h> 8#include <sys/cdefs.h>
9#if defined(LIBC_SCCS) && !defined(lint) 9#if defined(LIBC_SCCS) && !defined(lint)
10__RCSID("$NetBSD: bswap64.c,v 1.2 2008/02/16 17:37:13 apb Exp $"); 10__RCSID("$NetBSD: bswap64.c,v 1.3 2009/03/16 05:59:21 cegger Exp $");
11#endif /* LIBC_SCCS and not lint */ 11#endif /* LIBC_SCCS and not lint */
12 12
13#include <sys/types.h> 13#include <sys/types.h>
14#include <machine/bswap.h> 14#include <machine/bswap.h>
15 15
16#undef bswap64 16#undef bswap64
17 17
18uint64_t 18uint64_t
19bswap64(x) 19bswap64(uint64_t x)
20 uint64_t x; 
21{ 20{
22#ifdef _LP64 21#ifdef _LP64
23 /* 22 /*
24 * Assume we have wide enough registers to do it without touching 23 * Assume we have wide enough registers to do it without touching
25 * memory. 24 * memory.
26 */ 25 */
27 return ( (x << 56) & 0xff00000000000000UL ) | 26 return ( (x << 56) & 0xff00000000000000UL ) |
28 ( (x << 40) & 0x00ff000000000000UL ) | 27 ( (x << 40) & 0x00ff000000000000UL ) |
29 ( (x << 24) & 0x0000ff0000000000UL ) | 28 ( (x << 24) & 0x0000ff0000000000UL ) |
30 ( (x << 8) & 0x000000ff00000000UL ) | 29 ( (x << 8) & 0x000000ff00000000UL ) |
31 ( (x >> 8) & 0x00000000ff000000UL ) | 30 ( (x >> 8) & 0x00000000ff000000UL ) |
32 ( (x >> 24) & 0x0000000000ff0000UL ) | 31 ( (x >> 24) & 0x0000000000ff0000UL ) |
33 ( (x >> 40) & 0x000000000000ff00UL ) | 32 ( (x >> 40) & 0x000000000000ff00UL ) |

cvs diff -r1.3 -r1.4 src/common/lib/libc/hash/sha1/sha1.c (expand / switch to unified diff)

--- src/common/lib/libc/hash/sha1/sha1.c 2008/02/16 17:37:13 1.3
+++ src/common/lib/libc/hash/sha1/sha1.c 2009/03/16 05:59:21 1.4
@@ -1,43 +1,43 @@ @@ -1,43 +1,43 @@
1/* $NetBSD: sha1.c,v 1.3 2008/02/16 17:37:13 apb Exp $ */ 1/* $NetBSD: sha1.c,v 1.4 2009/03/16 05:59:21 cegger Exp $ */
2/* $OpenBSD: sha1.c,v 1.9 1997/07/23 21:12:32 kstailey Exp $ */ 2/* $OpenBSD: sha1.c,v 1.9 1997/07/23 21:12:32 kstailey Exp $ */
3 3
4/* 4/*
5 * SHA-1 in C 5 * SHA-1 in C
6 * By Steve Reid <steve@edmweb.com> 6 * By Steve Reid <steve@edmweb.com>
7 * 100% Public Domain 7 * 100% Public Domain
8 * 8 *
9 * Test Vectors (from FIPS PUB 180-1) 9 * Test Vectors (from FIPS PUB 180-1)
10 * "abc" 10 * "abc"
11 * A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D 11 * A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D
12 * "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" 12 * "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
13 * 84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1 13 * 84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1
14 * A million repetitions of "a" 14 * A million repetitions of "a"
15 * 34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F 15 * 34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F
16 */ 16 */
17 17
18#define SHA1HANDSOFF /* Copies data before messing with it. */ 18#define SHA1HANDSOFF /* Copies data before messing with it. */
19 19
20#include <sys/cdefs.h> 20#include <sys/cdefs.h>
21 21
22#if defined(_KERNEL) || defined(_STANDALONE) 22#if defined(_KERNEL) || defined(_STANDALONE)
23__KERNEL_RCSID(0, "$NetBSD: sha1.c,v 1.3 2008/02/16 17:37:13 apb Exp $"); 23__KERNEL_RCSID(0, "$NetBSD: sha1.c,v 1.4 2009/03/16 05:59:21 cegger Exp $");
24 24
25#include <lib/libkern/libkern.h> 25#include <lib/libkern/libkern.h>
26 26
27#else 27#else
28 28
29#if defined(LIBC_SCCS) && !defined(lint) 29#if defined(LIBC_SCCS) && !defined(lint)
30__RCSID("$NetBSD: sha1.c,v 1.3 2008/02/16 17:37:13 apb Exp $"); 30__RCSID("$NetBSD: sha1.c,v 1.4 2009/03/16 05:59:21 cegger Exp $");
31#endif /* LIBC_SCCS and not lint */ 31#endif /* LIBC_SCCS and not lint */
32 32
33#include "namespace.h" 33#include "namespace.h"
34#include <assert.h> 34#include <assert.h>
35#include <string.h> 35#include <string.h>
36 36
37#endif 37#endif
38 38
39#include <sys/types.h> 39#include <sys/types.h>
40#include <sys/sha1.h> 40#include <sys/sha1.h>
41 41
42 42
43#if HAVE_NBTOOL_CONFIG_H 43#if HAVE_NBTOOL_CONFIG_H
@@ -135,29 +135,27 @@ void @@ -135,29 +135,27 @@ void
135do_R4(uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d, uint32_t *e, CHAR64LONG16 *block) 135do_R4(uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d, uint32_t *e, CHAR64LONG16 *block)
136{ 136{
137 nR4(a,b,c,d,e,60); nR4(e,a,b,c,d,61); nR4(d,e,a,b,c,62); nR4(c,d,e,a,b,63); 137 nR4(a,b,c,d,e,60); nR4(e,a,b,c,d,61); nR4(d,e,a,b,c,62); nR4(c,d,e,a,b,63);
138 nR4(b,c,d,e,a,64); nR4(a,b,c,d,e,65); nR4(e,a,b,c,d,66); nR4(d,e,a,b,c,67); 138 nR4(b,c,d,e,a,64); nR4(a,b,c,d,e,65); nR4(e,a,b,c,d,66); nR4(d,e,a,b,c,67);
139 nR4(c,d,e,a,b,68); nR4(b,c,d,e,a,69); nR4(a,b,c,d,e,70); nR4(e,a,b,c,d,71); 139 nR4(c,d,e,a,b,68); nR4(b,c,d,e,a,69); nR4(a,b,c,d,e,70); nR4(e,a,b,c,d,71);
140 nR4(d,e,a,b,c,72); nR4(c,d,e,a,b,73); nR4(b,c,d,e,a,74); nR4(a,b,c,d,e,75); 140 nR4(d,e,a,b,c,72); nR4(c,d,e,a,b,73); nR4(b,c,d,e,a,74); nR4(a,b,c,d,e,75);
141 nR4(e,a,b,c,d,76); nR4(d,e,a,b,c,77); nR4(c,d,e,a,b,78); nR4(b,c,d,e,a,79); 141 nR4(e,a,b,c,d,76); nR4(d,e,a,b,c,77); nR4(c,d,e,a,b,78); nR4(b,c,d,e,a,79);
142} 142}
143#endif 143#endif
144 144
145/* 145/*
146 * Hash a single 512-bit block. This is the core of the algorithm. 146 * Hash a single 512-bit block. This is the core of the algorithm.
147 */ 147 */
148void SHA1Transform(state, buffer) 148void SHA1Transform(uint32_t state[5], const u_char buffer[64])
149 uint32_t state[5]; 
150 const u_char buffer[64]; 
151{ 149{
152 uint32_t a, b, c, d, e; 150 uint32_t a, b, c, d, e;
153 CHAR64LONG16 *block; 151 CHAR64LONG16 *block;
154 152
155#ifdef SHA1HANDSOFF 153#ifdef SHA1HANDSOFF
156 CHAR64LONG16 workspace; 154 CHAR64LONG16 workspace;
157#endif 155#endif
158 156
159 _DIAGASSERT(buffer != 0); 157 _DIAGASSERT(buffer != 0);
160 _DIAGASSERT(state != 0); 158 _DIAGASSERT(state != 0);
161 159
162#ifdef SHA1HANDSOFF 160#ifdef SHA1HANDSOFF
163 block = &workspace; 161 block = &workspace;
@@ -207,78 +205,72 @@ void SHA1Transform(state, buffer) @@ -207,78 +205,72 @@ void SHA1Transform(state, buffer)
207 state[1] += b; 205 state[1] += b;
208 state[2] += c; 206 state[2] += c;
209 state[3] += d; 207 state[3] += d;
210 state[4] += e; 208 state[4] += e;
211 209
212 /* Wipe variables */ 210 /* Wipe variables */
213 a = b = c = d = e = 0; 211 a = b = c = d = e = 0;
214} 212}
215 213
216 214
217/* 215/*
218 * SHA1Init - Initialize new context 216 * SHA1Init - Initialize new context
219 */ 217 */
220void SHA1Init(context) 218void SHA1Init(SHA1_CTX *context)
221 SHA1_CTX *context; 
222{ 219{
223 220
224 _DIAGASSERT(context != 0); 221 _DIAGASSERT(context != 0);
225 222
226 /* SHA1 initialization constants */ 223 /* SHA1 initialization constants */
227 context->state[0] = 0x67452301; 224 context->state[0] = 0x67452301;
228 context->state[1] = 0xEFCDAB89; 225 context->state[1] = 0xEFCDAB89;
229 context->state[2] = 0x98BADCFE; 226 context->state[2] = 0x98BADCFE;
230 context->state[3] = 0x10325476; 227 context->state[3] = 0x10325476;
231 context->state[4] = 0xC3D2E1F0; 228 context->state[4] = 0xC3D2E1F0;
232 context->count[0] = context->count[1] = 0; 229 context->count[0] = context->count[1] = 0;
233} 230}
234 231
235 232
236/* 233/*
237 * Run your data through this. 234 * Run your data through this.
238 */ 235 */
239void SHA1Update(context, data, len) 236void SHA1Update(SHA1_CTX *context, const u_char *data, u_int len)
240 SHA1_CTX *context; 
241 const u_char *data; 
242 u_int len; 
243{ 237{
244 u_int i, j; 238 u_int i, j;
245 239
246 _DIAGASSERT(context != 0); 240 _DIAGASSERT(context != 0);
247 _DIAGASSERT(data != 0); 241 _DIAGASSERT(data != 0);
248 242
249 j = context->count[0]; 243 j = context->count[0];
250 if ((context->count[0] += len << 3) < j) 244 if ((context->count[0] += len << 3) < j)
251 context->count[1] += (len>>29)+1; 245 context->count[1] += (len>>29)+1;
252 j = (j >> 3) & 63; 246 j = (j >> 3) & 63;
253 if ((j + len) > 63) { 247 if ((j + len) > 63) {
254 (void)memcpy(&context->buffer[j], data, (i = 64-j)); 248 (void)memcpy(&context->buffer[j], data, (i = 64-j));
255 SHA1Transform(context->state, context->buffer); 249 SHA1Transform(context->state, context->buffer);
256 for ( ; i + 63 < len; i += 64) 250 for ( ; i + 63 < len; i += 64)
257 SHA1Transform(context->state, &data[i]); 251 SHA1Transform(context->state, &data[i]);
258 j = 0; 252 j = 0;
259 } else { 253 } else {
260 i = 0; 254 i = 0;
261 } 255 }
262 (void)memcpy(&context->buffer[j], &data[i], len - i); 256 (void)memcpy(&context->buffer[j], &data[i], len - i);
263} 257}
264 258
265 259
266/* 260/*
267 * Add padding and return the message digest. 261 * Add padding and return the message digest.
268 */ 262 */
269void SHA1Final(digest, context) 263void SHA1Final(u_char digest[20], SHA1_CTX *context)
270 u_char digest[20]; 
271 SHA1_CTX* context; 
272{ 264{
273 u_int i; 265 u_int i;
274 u_char finalcount[8]; 266 u_char finalcount[8];
275 267
276 _DIAGASSERT(digest != 0); 268 _DIAGASSERT(digest != 0);
277 _DIAGASSERT(context != 0); 269 _DIAGASSERT(context != 0);
278 270
279 for (i = 0; i < 8; i++) { 271 for (i = 0; i < 8; i++) {
280 finalcount[i] = (u_char)((context->count[(i >= 4 ? 0 : 1)] 272 finalcount[i] = (u_char)((context->count[(i >= 4 ? 0 : 1)]
281 >> ((3-(i & 3)) * 8) ) & 255); /* Endian independent */ 273 >> ((3-(i & 3)) * 8) ) & 255); /* Endian independent */
282 } 274 }
283 SHA1Update(context, (const u_char *)"\200", 1); 275 SHA1Update(context, (const u_char *)"\200", 1);
284 while ((context->count[0] & 504) != 448) 276 while ((context->count[0] & 504) != 448)

cvs diff -r1.3 -r1.4 src/common/lib/libc/md/md4c.c (expand / switch to unified diff)

--- src/common/lib/libc/md/md4c.c 2008/02/16 17:37:13 1.3
+++ src/common/lib/libc/md/md4c.c 2009/03/16 05:59:21 1.4
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: md4c.c,v 1.3 2008/02/16 17:37:13 apb Exp $ */ 1/* $NetBSD: md4c.c,v 1.4 2009/03/16 05:59:21 cegger Exp $ */
2 2
3/* 3/*
4 * This file is derived from the RSA Data Security, Inc. MD4 Message-Digest 4 * This file is derived from the RSA Data Security, Inc. MD4 Message-Digest
5 * Algorithm and has been modified by Jason R. Thorpe <thorpej@NetBSD.org> 5 * Algorithm and has been modified by Jason R. Thorpe <thorpej@NetBSD.org>
6 * for portability and formatting. 6 * for portability and formatting.
7 */ 7 */
8 8
9/* 9/*
10 * Copyright (C) 1990-2, RSA Data Security, Inc. All rights reserved. 10 * Copyright (C) 1990-2, RSA Data Security, Inc. All rights reserved.
11 * 11 *
12 * License to copy and use this software is granted provided that it 12 * License to copy and use this software is granted provided that it
13 * is identified as the "RSA Data Security, Inc. MD4 Message-Digest 13 * is identified as the "RSA Data Security, Inc. MD4 Message-Digest
14 * Algorithm" in all material mentioning or referencing this software 14 * Algorithm" in all material mentioning or referencing this software
@@ -21,27 +21,27 @@ @@ -21,27 +21,27 @@
21 * 21 *
22 * RSA Data Security, Inc. makes no representations concerning either 22 * RSA Data Security, Inc. makes no representations concerning either
23 * the merchantability of this software or the suitability of this 23 * the merchantability of this software or the suitability of this
24 * software for any particular purpose. It is provided "as is" 24 * software for any particular purpose. It is provided "as is"
25 * without express or implied warranty of any kind. 25 * without express or implied warranty of any kind.
26 * 26 *
27 * These notices must be retained in any copies of any part of this 27 * These notices must be retained in any copies of any part of this
28 * documentation and/or software. 28 * documentation and/or software.
29 */ 29 */
30 30
31#if !defined(_KERNEL) && !defined(_STANDALONE) 31#if !defined(_KERNEL) && !defined(_STANDALONE)
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33#if defined(LIBC_SCCS) && !defined(lint) 33#if defined(LIBC_SCCS) && !defined(lint)
34__RCSID("$NetBSD: md4c.c,v 1.3 2008/02/16 17:37:13 apb Exp $"); 34__RCSID("$NetBSD: md4c.c,v 1.4 2009/03/16 05:59:21 cegger Exp $");
35#endif /* LIBC_SCCS and not lint */ 35#endif /* LIBC_SCCS and not lint */
36 36
37#include "namespace.h" 37#include "namespace.h"
38 38
39#include <sys/types.h> 39#include <sys/types.h>
40 40
41#include <assert.h> 41#include <assert.h>
42#include <md4.h> 42#include <md4.h>
43#include <string.h> 43#include <string.h>
44 44
45#if HAVE_NBTOOL_CONFIG_H 45#if HAVE_NBTOOL_CONFIG_H
46#include "nbtool_config.h" 46#include "nbtool_config.h"
47#endif 47#endif
@@ -119,51 +119,49 @@ static const unsigned char PADDING[64] = @@ -119,51 +119,49 @@ static const unsigned char PADDING[64] =
119} 119}
120 120
121#if !defined(_KERNEL) && !defined(_STANDALONE) && defined(__weak_alias) 121#if !defined(_KERNEL) && !defined(_STANDALONE) && defined(__weak_alias)
122__weak_alias(MD4Init,_MD4Init) 122__weak_alias(MD4Init,_MD4Init)
123__weak_alias(MD4Update,_MD4Update) 123__weak_alias(MD4Update,_MD4Update)
124__weak_alias(MD4Final,_MD4Final) 124__weak_alias(MD4Final,_MD4Final)
125__weak_alias(MD4Transform,_MD4Transform) 125__weak_alias(MD4Transform,_MD4Transform)
126#endif 126#endif
127 127
128/* 128/*
129 * MD4 initialization. Begins an MD4 operation, writing a new context. 129 * MD4 initialization. Begins an MD4 operation, writing a new context.
130 */ 130 */
131void 131void
132MD4Init(context) 132MD4Init(MD4_CTX *context) /* context */
133 MD4_CTX *context; /* context */ 
134{ 133{
135 134
136 _DIAGASSERT(context != 0); 135 _DIAGASSERT(context != 0);
137 136
138 context->count[0] = context->count[1] = 0; 137 context->count[0] = context->count[1] = 0;
139 138
140 /* Load magic initialization constants. */ 139 /* Load magic initialization constants. */
141 context->state[0] = 0x67452301; 140 context->state[0] = 0x67452301;
142 context->state[1] = 0xefcdab89; 141 context->state[1] = 0xefcdab89;
143 context->state[2] = 0x98badcfe; 142 context->state[2] = 0x98badcfe;
144 context->state[3] = 0x10325476; 143 context->state[3] = 0x10325476;
145} 144}
146 145
147/* 146/*
148 * MD4 block update operation. Continues an MD4 message-digest 147 * MD4 block update operation. Continues an MD4 message-digest
149 * operation, processing another message block, and updating the 148 * operation, processing another message block, and updating the
150 * context. 149 * context.
151 */ 150 */
152void 151void
153MD4Update (context, input, inputLen) 152MD4Update (MD4_CTX *context, /* context */
154 MD4_CTX *context; /* context */ 153 const unsigned char *input, /* input block */
155 const unsigned char *input; /* input block */ 154 unsigned int inputLen) /* length of input block */
156 unsigned int inputLen; /* length of input block */ 
157{ 155{
158 unsigned int i, idx, partLen; 156 unsigned int i, idx, partLen;
159 157
160 _DIAGASSERT(context != 0); 158 _DIAGASSERT(context != 0);
161 _DIAGASSERT(input != 0); 159 _DIAGASSERT(input != 0);
162 160
163 /* Compute number of bytes mod 64 */ 161 /* Compute number of bytes mod 64 */
164 idx = (unsigned int)((context->count[0] >> 3) & 0x3F); 162 idx = (unsigned int)((context->count[0] >> 3) & 0x3F);
165 163
166 /* Update number of bits */ 164 /* Update number of bits */
167 if ((context->count[0] += ((UINT4)inputLen << 3)) 165 if ((context->count[0] += ((UINT4)inputLen << 3))
168 < ((UINT4)inputLen << 3)) 166 < ((UINT4)inputLen << 3))
169 context->count[1]++; 167 context->count[1]++;
@@ -182,29 +180,28 @@ MD4Update (context, input, inputLen) @@ -182,29 +180,28 @@ MD4Update (context, input, inputLen)
182 idx = 0; 180 idx = 0;
183 } else 181 } else
184 i = 0; 182 i = 0;
185 183
186 /* Buffer remaining input */ 184 /* Buffer remaining input */
187 memcpy(&context->buffer[idx], &input[i], inputLen - i); 185 memcpy(&context->buffer[idx], &input[i], inputLen - i);
188} 186}
189 187
190/* 188/*
191 * MD4 finalization. Ends an MD4 message-digest operation, writing the 189 * MD4 finalization. Ends an MD4 message-digest operation, writing the
192 * message digest and zeroing the context. 190 * message digest and zeroing the context.
193 */ 191 */
194void 192void
195MD4Final (digest, context) 193MD4Final (unsigned char digest[16], /* message digest */
196 unsigned char digest[16]; /* message digest */ 194 MD4_CTX *context) /* context */
197 MD4_CTX *context; /* context */ 
198{ 195{
199 unsigned char bits[8]; 196 unsigned char bits[8];
200 unsigned int idx, padLen; 197 unsigned int idx, padLen;
201 198
202 _DIAGASSERT(digest != 0); 199 _DIAGASSERT(digest != 0);
203 _DIAGASSERT(context != 0); 200 _DIAGASSERT(context != 0);
204 201
205 /* Save number of bits */ 202 /* Save number of bits */
206 Encode(bits, context->count, 8); 203 Encode(bits, context->count, 8);
207 204
208 /* Pad out to 56 mod 64. */ 205 /* Pad out to 56 mod 64. */
209 idx = (unsigned int)((context->count[0] >> 3) & 0x3f); 206 idx = (unsigned int)((context->count[0] >> 3) & 0x3f);
210 padLen = (idx < 56) ? (56 - idx) : (120 - idx); 207 padLen = (idx < 56) ? (56 - idx) : (120 - idx);
@@ -214,29 +211,27 @@ MD4Final (digest, context) @@ -214,29 +211,27 @@ MD4Final (digest, context)
214 MD4Update(context, bits, 8); 211 MD4Update(context, bits, 8);
215 212
216 /* Store state in digest */ 213 /* Store state in digest */
217 Encode(digest, context->state, 16); 214 Encode(digest, context->state, 16);
218 215
219 /* Zeroize sensitive information. */ 216 /* Zeroize sensitive information. */
220 memset(context, 0, sizeof(*context)); 217 memset(context, 0, sizeof(*context));
221} 218}
222 219
223/* 220/*
224 * MD4 basic transformation. Transforms state based on block. 221 * MD4 basic transformation. Transforms state based on block.
225 */ 222 */
226static void 223static void
227MD4Transform (state, block) 224MD4Transform (UINT4 state[4], const unsigned char block[64])
228 UINT4 state[4]; 
229 const unsigned char block[64]; 
230{ 225{
231 UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16]; 226 UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16];
232 227
233 Decode(x, block, 64); 228 Decode(x, block, 64);
234 229
235 /* Round 1 */ 230 /* Round 1 */
236 FF (a, b, c, d, x[ 0], S11); /* 1 */ 231 FF (a, b, c, d, x[ 0], S11); /* 1 */
237 FF (d, a, b, c, x[ 1], S12); /* 2 */ 232 FF (d, a, b, c, x[ 1], S12); /* 2 */
238 FF (c, d, a, b, x[ 2], S13); /* 3 */ 233 FF (c, d, a, b, x[ 2], S13); /* 3 */
239 FF (b, c, d, a, x[ 3], S14); /* 4 */ 234 FF (b, c, d, a, x[ 3], S14); /* 4 */
240 FF (a, b, c, d, x[ 4], S11); /* 5 */ 235 FF (a, b, c, d, x[ 4], S11); /* 5 */
241 FF (d, a, b, c, x[ 5], S12); /* 6 */ 236 FF (d, a, b, c, x[ 5], S12); /* 6 */
242 FF (c, d, a, b, x[ 6], S13); /* 7 */ 237 FF (c, d, a, b, x[ 6], S13); /* 7 */
@@ -290,46 +285,40 @@ MD4Transform (state, block) @@ -290,46 +285,40 @@ MD4Transform (state, block)
290 state[1] += b; 285 state[1] += b;
291 state[2] += c; 286 state[2] += c;
292 state[3] += d; 287 state[3] += d;
293 288
294 /* Zeroize sensitive information. */ 289 /* Zeroize sensitive information. */
295 memset(x, 0, sizeof (x)); 290 memset(x, 0, sizeof (x));
296} 291}
297 292
298/* 293/*
299 * Encodes input (UINT4) into output (unsigned char). Assumes len is 294 * Encodes input (UINT4) into output (unsigned char). Assumes len is
300 * a multiple of 4. 295 * a multiple of 4.
301 */ 296 */
302static void 297static void
303Encode(output, input, len) 298Encode(unsigned char *output, UINT4 *input, unsigned int len)
304 unsigned char *output; 
305 UINT4 *input; 
306 unsigned int len; 
307{ 299{
308 unsigned int i, j; 300 unsigned int i, j;
309 301
310 for (i = 0, j = 0; j < len; i++, j += 4) { 302 for (i = 0, j = 0; j < len; i++, j += 4) {
311 output[j] = (unsigned char)(input[i] & 0xff); 303 output[j] = (unsigned char)(input[i] & 0xff);
312 output[j+1] = (unsigned char)((input[i] >> 8) & 0xff); 304 output[j+1] = (unsigned char)((input[i] >> 8) & 0xff);
313 output[j+2] = (unsigned char)((input[i] >> 16) & 0xff); 305 output[j+2] = (unsigned char)((input[i] >> 16) & 0xff);
314 output[j+3] = (unsigned char)((input[i] >> 24) & 0xff); 306 output[j+3] = (unsigned char)((input[i] >> 24) & 0xff);
315 } 307 }
316} 308}
317 309
318/* 310/*
319 * Decodes input (unsigned char) into output (UINT4). Assumes len is 311 * Decodes input (unsigned char) into output (UINT4). Assumes len is
320 * a multiple of 4. 312 * a multiple of 4.
321 */ 313 */
322static void 314static void
323Decode(output, input, len) 315Decode(UINT4 *output, const unsigned char *input, unsigned int len)
324 UINT4 *output; 
325 const unsigned char *input; 
326 unsigned int len; 
327{ 316{
328 unsigned int i, j; 317 unsigned int i, j;
329 318
330 for (i = 0, j = 0; j < len; i++, j += 4) 319 for (i = 0, j = 0; j < len; i++, j += 4)
331 output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) | 320 output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) |
332 (((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24); 321 (((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24);
333} 322}
334 323
335#endif /* HAVE_MD4_H */ 324#endif /* HAVE_MD4_H */

cvs diff -r1.3 -r1.4 src/common/lib/libc/md/md5c.c (expand / switch to unified diff)

--- src/common/lib/libc/md/md5c.c 2008/02/16 17:37:13 1.3
+++ src/common/lib/libc/md/md5c.c 2009/03/16 05:59:21 1.4
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: md5c.c,v 1.3 2008/02/16 17:37:13 apb Exp $ */ 1/* $NetBSD: md5c.c,v 1.4 2009/03/16 05:59:21 cegger Exp $ */
2 2
3/* 3/*
4 * This file is derived from the RSA Data Security, Inc. MD5 Message-Digest 4 * This file is derived from the RSA Data Security, Inc. MD5 Message-Digest
5 * Algorithm and has been modified by Jason R. Thorpe <thorpej@NetBSD.org> 5 * Algorithm and has been modified by Jason R. Thorpe <thorpej@NetBSD.org>
6 * for portability and formatting. 6 * for portability and formatting.
7 */ 7 */
8 8
9/* 9/*
10 * Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All 10 * Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
11 * rights reserved. 11 * rights reserved.
12 * 12 *
13 * License to copy and use this software is granted provided that it 13 * License to copy and use this software is granted provided that it
14 * is identified as the "RSA Data Security, Inc. MD5 Message-Digest 14 * is identified as the "RSA Data Security, Inc. MD5 Message-Digest
@@ -26,27 +26,27 @@ @@ -26,27 +26,27 @@
26 * without express or implied warranty of any kind. 26 * without express or implied warranty of any kind.
27 * 27 *
28 * These notices must be retained in any copies of any part of this 28 * These notices must be retained in any copies of any part of this
29 * documentation and/or software. 29 * documentation and/or software.
30 */ 30 */
31 31
32#if defined(_KERNEL) || defined(_STANDALONE) 32#if defined(_KERNEL) || defined(_STANDALONE)
33#include <sys/param.h> 33#include <sys/param.h>
34#include <sys/md5.h> 34#include <sys/md5.h>
35#include <lib/libkern/libkern.h> 35#include <lib/libkern/libkern.h>
36#else 36#else
37#include <sys/cdefs.h> 37#include <sys/cdefs.h>
38#if defined(LIBC_SCCS) && !defined(lint) 38#if defined(LIBC_SCCS) && !defined(lint)
39__RCSID("$NetBSD: md5c.c,v 1.3 2008/02/16 17:37:13 apb Exp $"); 39__RCSID("$NetBSD: md5c.c,v 1.4 2009/03/16 05:59:21 cegger Exp $");
40#endif /* LIBC_SCCS and not lint */ 40#endif /* LIBC_SCCS and not lint */
41#include "namespace.h" 41#include "namespace.h"
42#include <sys/types.h> 42#include <sys/types.h>
43#include <assert.h> 43#include <assert.h>
44#include <string.h> 44#include <string.h>
45#include <md5.h> 45#include <md5.h>
46#endif /* _KERNEL || _STANDALONE */ 46#endif /* _KERNEL || _STANDALONE */
47 47
48#if HAVE_NBTOOL_CONFIG_H 48#if HAVE_NBTOOL_CONFIG_H
49#include "nbtool_config.h" 49#include "nbtool_config.h"
50#endif 50#endif
51 51
52#if !HAVE_MD5_H 52#if !HAVE_MD5_H
@@ -84,50 +84,48 @@ __weak_alias(MD5Final,_MD5Final) @@ -84,50 +84,48 @@ __weak_alias(MD5Final,_MD5Final)
84__weak_alias(MD5Transform,_MD5Transform) 84__weak_alias(MD5Transform,_MD5Transform)
85#endif 85#endif
86 86
87static void MD5Transform __P((UINT4 [4], const unsigned char [64])); 87static void MD5Transform __P((UINT4 [4], const unsigned char [64]));
88 88
89static void Encode __P((unsigned char *, UINT4 *, unsigned int)); 89static void Encode __P((unsigned char *, UINT4 *, unsigned int));
90static void Decode __P((UINT4 *, const unsigned char *, unsigned int)); 90static void Decode __P((UINT4 *, const unsigned char *, unsigned int));
91 91
92/* 92/*
93 * Encodes input (UINT4) into output (unsigned char). Assumes len is 93 * Encodes input (UINT4) into output (unsigned char). Assumes len is
94 * a multiple of 4. 94 * a multiple of 4.
95 */ 95 */
96static void 96static void
97Encode (output, input, len) 97Encode (unsigned char *output,
98 unsigned char *output; 98 UINT4 *input,
99 UINT4 *input; 99 unsigned int len)
100 unsigned int len; 
101{ 100{
102 unsigned int i, j; 101 unsigned int i, j;
103 102
104 for (i = 0, j = 0; j < len; i++, j += 4) { 103 for (i = 0, j = 0; j < len; i++, j += 4) {
105 output[j] = (unsigned char)(input[i] & 0xff); 104 output[j] = (unsigned char)(input[i] & 0xff);
106 output[j+1] = (unsigned char)((input[i] >> 8) & 0xff); 105 output[j+1] = (unsigned char)((input[i] >> 8) & 0xff);
107 output[j+2] = (unsigned char)((input[i] >> 16) & 0xff); 106 output[j+2] = (unsigned char)((input[i] >> 16) & 0xff);
108 output[j+3] = (unsigned char)((input[i] >> 24) & 0xff); 107 output[j+3] = (unsigned char)((input[i] >> 24) & 0xff);
109 } 108 }
110} 109}
111 110
112/* 111/*
113 * Decodes input (unsigned char) into output (UINT4). Assumes len is 112 * Decodes input (unsigned char) into output (UINT4). Assumes len is
114 * a multiple of 4. 113 * a multiple of 4.
115 */ 114 */
116static void 115static void
117Decode (output, input, len) 116Decode (UINT4 *output,
118 UINT4 *output; 117 const unsigned char *input,
119 const unsigned char *input; 118 unsigned int len)
120 unsigned int len; 
121{ 119{
122 unsigned int i, j; 120 unsigned int i, j;
123 121
124 for (i = 0, j = 0; j < len; i++, j += 4) 122 for (i = 0, j = 0; j < len; i++, j += 4)
125 output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) | 123 output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) |
126 (((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24); 124 (((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24);
127} 125}
128 126
129static const unsigned char PADDING[64] = { 127static const unsigned char PADDING[64] = {
130 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
131 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 129 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
132 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 130 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
133}; 131};
@@ -167,51 +165,49 @@ static const unsigned char PADDING[64] = @@ -167,51 +165,49 @@ static const unsigned char PADDING[64] =
167 (a) += (b); \ 165 (a) += (b); \
168} 166}
169 167
170#define II(a, b, c, d, x, s, ac) { \ 168#define II(a, b, c, d, x, s, ac) { \
171 (a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); \ 169 (a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); \
172 (a) = ROTATE_LEFT ((a), (s)); \ 170 (a) = ROTATE_LEFT ((a), (s)); \
173 (a) += (b); \ 171 (a) += (b); \
174} 172}
175 173
176/* 174/*
177 * MD5 initialization. Begins an MD5 operation, writing a new context. 175 * MD5 initialization. Begins an MD5 operation, writing a new context.
178 */ 176 */
179void 177void
180MD5Init(context) 178MD5Init(MD5_CTX *context)
181 MD5_CTX *context; /* context */ 
182{ 179{
183 180
184 _DIAGASSERT(context != 0); 181 _DIAGASSERT(context != 0);
185 182
186 context->count[0] = context->count[1] = 0; 183 context->count[0] = context->count[1] = 0;
187 184
188 /* Load magic initialization constants. */ 185 /* Load magic initialization constants. */
189 context->state[0] = 0x67452301; 186 context->state[0] = 0x67452301;
190 context->state[1] = 0xefcdab89; 187 context->state[1] = 0xefcdab89;
191 context->state[2] = 0x98badcfe; 188 context->state[2] = 0x98badcfe;
192 context->state[3] = 0x10325476; 189 context->state[3] = 0x10325476;
193} 190}
194 191
195/* 192/*
196 * MD5 block update operation. Continues an MD5 message-digest 193 * MD5 block update operation. Continues an MD5 message-digest
197 * operation, processing another message block, and updating the 194 * operation, processing another message block, and updating the
198 * context. 195 * context.
199 */ 196 */
200void 197void
201MD5Update(context, input, inputLen) 198MD5Update(MD5_CTX *context,
202 MD5_CTX *context; /* context */ 199 const unsigned char *input, /* input block */
203 const unsigned char *input; /* input block */ 200 unsigned int inputLen) /* length of input block */
204 unsigned int inputLen; /* length of input block */ 
205{ 201{
206 unsigned int i, idx, partLen; 202 unsigned int i, idx, partLen;
207 203
208 _DIAGASSERT(context != 0); 204 _DIAGASSERT(context != 0);
209 _DIAGASSERT(input != 0); 205 _DIAGASSERT(input != 0);
210 206
211 /* Compute number of bytes mod 64 */ 207 /* Compute number of bytes mod 64 */
212 idx = (unsigned int)((context->count[0] >> 3) & 0x3F); 208 idx = (unsigned int)((context->count[0] >> 3) & 0x3F);
213 209
214 /* Update number of bits */ 210 /* Update number of bits */
215 if ((context->count[0] += ((UINT4)inputLen << 3)) 211 if ((context->count[0] += ((UINT4)inputLen << 3))
216 < ((UINT4)inputLen << 3)) 212 < ((UINT4)inputLen << 3))
217 context->count[1]++; 213 context->count[1]++;
@@ -230,29 +226,28 @@ MD5Update(context, input, inputLen) @@ -230,29 +226,28 @@ MD5Update(context, input, inputLen)
230 idx = 0; 226 idx = 0;
231 } else 227 } else
232 i = 0; 228 i = 0;
233 229
234 /* Buffer remaining input */ 230 /* Buffer remaining input */
235 memcpy(&context->buffer[idx], &input[i], inputLen - i); 231 memcpy(&context->buffer[idx], &input[i], inputLen - i);
236} 232}
237 233
238/* 234/*
239 * MD5 finalization. Ends an MD5 message-digest operation, writing the 235 * MD5 finalization. Ends an MD5 message-digest operation, writing the
240 * message digest and zeroing the context. 236 * message digest and zeroing the context.
241 */ 237 */
242void 238void
243MD5Final(digest, context) 239MD5Final(unsigned char digest[16], /* message digest */
244 unsigned char digest[16]; /* message digest */ 240 MD5_CTX *context) /* context */
245 MD5_CTX *context; /* context */ 
246{ 241{
247 unsigned char bits[8]; 242 unsigned char bits[8];
248 unsigned int idx, padLen; 243 unsigned int idx, padLen;
249 244
250 _DIAGASSERT(digest != 0); 245 _DIAGASSERT(digest != 0);
251 _DIAGASSERT(context != 0); 246 _DIAGASSERT(context != 0);
252 247
253 /* Save number of bits */ 248 /* Save number of bits */
254 Encode(bits, context->count, 8); 249 Encode(bits, context->count, 8);
255 250
256 /* Pad out to 56 mod 64. */ 251 /* Pad out to 56 mod 64. */
257 idx = (unsigned int)((context->count[0] >> 3) & 0x3f); 252 idx = (unsigned int)((context->count[0] >> 3) & 0x3f);
258 padLen = (idx < 56) ? (56 - idx) : (120 - idx); 253 padLen = (idx < 56) ? (56 - idx) : (120 - idx);
@@ -262,29 +257,27 @@ MD5Final(digest, context) @@ -262,29 +257,27 @@ MD5Final(digest, context)
262 MD5Update(context, bits, 8); 257 MD5Update(context, bits, 8);
263 258
264 /* Store state in digest */ 259 /* Store state in digest */
265 Encode(digest, context->state, 16); 260 Encode(digest, context->state, 16);
266 261
267 /* Zeroize sensitive information. */ 262 /* Zeroize sensitive information. */
268 ZEROIZE((POINTER)(void *)context, sizeof(*context)); 263 ZEROIZE((POINTER)(void *)context, sizeof(*context));
269} 264}
270 265
271/* 266/*
272 * MD5 basic transformation. Transforms state based on block. 267 * MD5 basic transformation. Transforms state based on block.
273 */ 268 */
274static void 269static void
275MD5Transform(state, block) 270MD5Transform(UINT4 state[4], const unsigned char block[64])
276 UINT4 state[4]; 
277 const unsigned char block[64]; 
278{ 271{
279 UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16]; 272 UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16];
280 273
281 Decode(x, block, 64); 274 Decode(x, block, 64);
282 275
283 /* Round 1 */ 276 /* Round 1 */
284 FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */ 277 FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */
285 FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */ 278 FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */
286 FF (c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */ 279 FF (c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */
287 FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */ 280 FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */
288 FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */ 281 FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */
289 FF (d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */ 282 FF (d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */
290 FF (c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */ 283 FF (c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */

cvs diff -r1.2 -r1.3 src/common/lib/libc/net/Attic/__cmsg_alignbytes.c (expand / switch to unified diff)

--- src/common/lib/libc/net/Attic/__cmsg_alignbytes.c 2008/04/28 20:22:53 1.2
+++ src/common/lib/libc/net/Attic/__cmsg_alignbytes.c 2009/03/16 05:59:21 1.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: __cmsg_alignbytes.c,v 1.2 2008/04/28 20:22:53 martin Exp $ */ 1/* $NetBSD: __cmsg_alignbytes.c,v 1.3 2009/03/16 05:59:21 cegger Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2000 The NetBSD Foundation, Inc. 4 * Copyright (c) 2000 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jun-ichiro Hagino. 8 * by Jun-ichiro Hagino.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -22,42 +22,42 @@ @@ -22,42 +22,42 @@
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#if !defined(_KERNEL) && !defined(_STANDALONE) 32#if !defined(_KERNEL) && !defined(_STANDALONE)
33#include <sys/cdefs.h> 33#include <sys/cdefs.h>
34#if defined(LIBC_SCCS) && !defined(lint) 34#if defined(LIBC_SCCS) && !defined(lint)
35__RCSID("$NetBSD: __cmsg_alignbytes.c,v 1.2 2008/04/28 20:22:53 martin Exp $"); 35__RCSID("$NetBSD: __cmsg_alignbytes.c,v 1.3 2009/03/16 05:59:21 cegger Exp $");
36#endif /* LIBC_SCCS and not lint */ 36#endif /* LIBC_SCCS and not lint */
37 37
38#include "namespace.h" 38#include "namespace.h"
39#include <sys/types.h> 39#include <sys/types.h>
40#include <sys/param.h> 40#include <sys/param.h>
41#include <sys/sysctl.h> 41#include <sys/sysctl.h>
42#include <sys/socket.h> 42#include <sys/socket.h>
43#else 43#else
44#include <sys/types.h> 44#include <sys/types.h>
45#include <sys/param.h> 45#include <sys/param.h>
46#include <sys/socket.h> 46#include <sys/socket.h>
47#endif 47#endif
48 48
49int 49int
50__cmsg_alignbytes() 50__cmsg_alignbytes(void)
51{ 51{
52 static int alignbytes = -1; 52 static int alignbytes = -1;
53#ifdef HW_ALIGNBYTES 53#ifdef HW_ALIGNBYTES
54 int mib[2]; 54 int mib[2];
55 size_t len; 55 size_t len;
56 int ret; 56 int ret;
57#endif 57#endif
58 58
59 if (alignbytes > 0) 59 if (alignbytes > 0)
60 return alignbytes; 60 return alignbytes;
61 61
62#ifdef HW_ALIGNBYTES 62#ifdef HW_ALIGNBYTES
63 mib[0] = CTL_HW; 63 mib[0] = CTL_HW;