summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorkstailey <>1997-07-23 20:58:27 +0000
committerkstailey <>1997-07-23 20:58:27 +0000
commitca43f2862f17342c461b4076c026d963cb8c602c (patch)
tree1588fba4691b558b9a4baa61950f220b5053012c /src
parentae4be7efc430e0553bfdfcdb1dd9c4123cd9db5a (diff)
downloadopenbsd-ca43f2862f17342c461b4076c026d963cb8c602c.tar.gz
openbsd-ca43f2862f17342c461b4076c026d963cb8c602c.tar.bz2
openbsd-ca43f2862f17342c461b4076c026d963cb8c602c.zip
tabify
Diffstat (limited to 'src')
-rw-r--r--src/lib/libc/crypt/bcrypt.c14
-rw-r--r--src/lib/libc/crypt/blowfish.c87
-rw-r--r--src/lib/libc/crypt/md5crypt.c6
3 files changed, 53 insertions, 54 deletions
diff --git a/src/lib/libc/crypt/bcrypt.c b/src/lib/libc/crypt/bcrypt.c
index 6f78afdddf..42418767ee 100644
--- a/src/lib/libc/crypt/bcrypt.c
+++ b/src/lib/libc/crypt/bcrypt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bcrypt.c,v 1.7 1997/07/09 01:08:18 millert Exp $ */ 1/* $OpenBSD: bcrypt.c,v 1.8 1997/07/23 20:58:26 kstailey Exp $ */
2 2
3/* 3/*
4 * Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de> 4 * Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de>
@@ -218,17 +218,17 @@ bcrypt(key, salt)
218 218
219 /* Check for minor versions */ 219 /* Check for minor versions */
220 if (salt[1] != '$') { 220 if (salt[1] != '$') {
221 switch(salt[1]) { 221 switch(salt[1]) {
222 case 'a': 222 case 'a':
223 /* 'ab' should not yield the same as 'abab' */ 223 /* 'ab' should not yield the same as 'abab' */
224 minor = salt[1]; 224 minor = salt[1];
225 salt++; 225 salt++;
226 break; 226 break;
227 default: 227 default:
228 return error; 228 return error;
229 } 229 }
230 } else 230 } else
231 minor = 0; 231 minor = 0;
232 232
233 /* Discard version + "$" identifier */ 233 /* Discard version + "$" identifier */
234 salt += 2; 234 salt += 2;
@@ -282,7 +282,7 @@ bcrypt(key, salt)
282 encrypted[i++] = '$'; 282 encrypted[i++] = '$';
283 encrypted[i++] = BCRYPT_VERSION; 283 encrypted[i++] = BCRYPT_VERSION;
284 if (minor) 284 if (minor)
285 encrypted[i++] = minor; 285 encrypted[i++] = minor;
286 encrypted[i++] = '$'; 286 encrypted[i++] = '$';
287 287
288 snprintf(encrypted + i, 4, "%2.2u$", logr); 288 snprintf(encrypted + i, 4, "%2.2u$", logr);
diff --git a/src/lib/libc/crypt/blowfish.c b/src/lib/libc/crypt/blowfish.c
index 46568d2318..b9cd41f960 100644
--- a/src/lib/libc/crypt/blowfish.c
+++ b/src/lib/libc/crypt/blowfish.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: blowfish.c,v 1.4 1997/04/30 05:57:05 tholo Exp $ */ 1/* $OpenBSD: blowfish.c,v 1.5 1997/07/23 20:58:27 kstailey Exp $ */
2/* 2/*
3 * Blowfish block cipher for OpenBSD 3 * Blowfish block cipher for OpenBSD
4 * Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de> 4 * Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de>
@@ -429,13 +429,13 @@ Blowfish_initstate(c)
429 0x90d4f869, 0xa65cdea0, 0x3f09252d, 0xc208e69f, 429 0x90d4f869, 0xa65cdea0, 0x3f09252d, 0xc208e69f,
430 0xb74e6132, 0xce77e25b, 0x578fdfe3, 0x3ac372e6} 430 0xb74e6132, 0xce77e25b, 0x578fdfe3, 0x3ac372e6}
431 }, 431 },
432 { 432 {
433 0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344, 433 0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344,
434 0xa4093822, 0x299f31d0, 0x082efa98, 0xec4e6c89, 434 0xa4093822, 0x299f31d0, 0x082efa98, 0xec4e6c89,
435 0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c, 435 0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c,
436 0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917, 436 0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917,
437 0x9216d5d9, 0x8979fb1b 437 0x9216d5d9, 0x8979fb1b
438 } }; 438 } };
439 439
440 *c = initstate; 440 *c = initstate;
441 441
@@ -475,44 +475,43 @@ Blowfish_expand0state(blf_ctx *c, const u_int8_t *key, u_int16_t keybytes)
475#else 475#else
476void 476void
477Blowfish_expand0state(c, key, keybytes) 477Blowfish_expand0state(c, key, keybytes)
478 blf_ctx *c; 478 blf_ctx *c;
479 const u_int8_t *key; 479 const u_int8_t *key;
480 u_int16_t keybytes; 480 u_int16_t keybytes;
481#endif 481#endif
482{ 482{
483 u_int16_t i; 483 u_int16_t i;
484 u_int16_t j; 484 u_int16_t j;
485 u_int16_t k; 485 u_int16_t k;
486 u_int32_t temp; 486 u_int32_t temp;
487 u_int32_t datal; 487 u_int32_t datal;
488 u_int32_t datar; 488 u_int32_t datar;
489 489
490 j = 0; 490 j = 0;
491 for (i = 0; i < BLF_N + 2; i++) { 491 for (i = 0; i < BLF_N + 2; i++) {
492 /* Extract 4 int8 to 1 int32 from keystream */ 492 /* Extract 4 int8 to 1 int32 from keystream */
493 temp = Blowfish_stream2word(key, keybytes, &j); 493 temp = Blowfish_stream2word(key, keybytes, &j);
494 c->P[i] = c->P[i] ^ temp; 494 c->P[i] = c->P[i] ^ temp;
495 } 495 }
496 496
497 j = 0; 497 j = 0;
498 datal = 0x00000000; 498 datal = 0x00000000;
499 datar = 0x00000000; 499 datar = 0x00000000;
500 for (i = 0; i < BLF_N + 2; i += 2) { 500 for (i = 0; i < BLF_N + 2; i += 2) {
501 Blowfish_encipher(c, &datal, &datar); 501 Blowfish_encipher(c, &datal, &datar);
502 502
503 c->P[i] = datal; 503 c->P[i] = datal;
504 c->P[i + 1] = datar; 504 c->P[i + 1] = datar;
505 } 505 }
506 506
507 for (i = 0; i < 4; i++) { 507 for (i = 0; i < 4; i++) {
508 for (k = 0; k < 256; k += 2) { 508 for (k = 0; k < 256; k += 2) {
509 Blowfish_encipher(c, &datal, &datar); 509 Blowfish_encipher(c, &datal, &datar);
510 510
511 c->S[i][k] = datal; 511 c->S[i][k] = datal;
512 c->S[i][k + 1] = datar; 512 c->S[i][k + 1] = datar;
513 } 513 }
514 } 514 }
515
516} 515}
517 516
518 517
diff --git a/src/lib/libc/crypt/md5crypt.c b/src/lib/libc/crypt/md5crypt.c
index 318626a2e6..7ec60f38e0 100644
--- a/src/lib/libc/crypt/md5crypt.c
+++ b/src/lib/libc/crypt/md5crypt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: md5crypt.c,v 1.8 1997/06/29 05:48:02 deraadt Exp $ */ 1/* $OpenBSD: md5crypt.c,v 1.9 1997/07/23 20:58:27 kstailey Exp $ */
2 2
3/* 3/*
4 * ---------------------------------------------------------------------------- 4 * ----------------------------------------------------------------------------
@@ -13,7 +13,7 @@
13 */ 13 */
14 14
15#if defined(LIBC_SCCS) && !defined(lint) 15#if defined(LIBC_SCCS) && !defined(lint)
16static char rcsid[] = "$OpenBSD: md5crypt.c,v 1.8 1997/06/29 05:48:02 deraadt Exp $"; 16static char rcsid[] = "$OpenBSD: md5crypt.c,v 1.9 1997/07/23 20:58:27 kstailey Exp $";
17#endif /* LIBC_SCCS and not lint */ 17#endif /* LIBC_SCCS and not lint */
18 18
19#include <unistd.h> 19#include <unistd.h>
@@ -146,7 +146,7 @@ md5crypt(pw, salt)
146 l = (final[ 2]<<16) | (final[ 8]<<8) | final[14]; to64(p,l,4); p += 4; 146 l = (final[ 2]<<16) | (final[ 8]<<8) | final[14]; to64(p,l,4); p += 4;
147 l = (final[ 3]<<16) | (final[ 9]<<8) | final[15]; to64(p,l,4); p += 4; 147 l = (final[ 3]<<16) | (final[ 9]<<8) | final[15]; to64(p,l,4); p += 4;
148 l = (final[ 4]<<16) | (final[10]<<8) | final[ 5]; to64(p,l,4); p += 4; 148 l = (final[ 4]<<16) | (final[10]<<8) | final[ 5]; to64(p,l,4); p += 4;
149 l = final[11] ; to64(p,l,2); p += 2; 149 l = final[11] ; to64(p,l,2); p += 2;
150 *p = '\0'; 150 *p = '\0';
151 151
152 /* Don't leave anything around in vm they could use. */ 152 /* Don't leave anything around in vm they could use. */