Browse Source

tabify

OPENBSD_2_2
kstailey 27 years ago
parent
commit
8acd0c6d95
3 changed files with 53 additions and 54 deletions
  1. +7
    -7
      src/lib/libc/crypt/bcrypt.c
  2. +43
    -44
      src/lib/libc/crypt/blowfish.c
  3. +3
    -3
      src/lib/libc/crypt/md5crypt.c

+ 7
- 7
src/lib/libc/crypt/bcrypt.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: bcrypt.c,v 1.7 1997/07/09 01:08:18 millert Exp $ */
/* $OpenBSD: bcrypt.c,v 1.8 1997/07/23 20:58:26 kstailey Exp $ */
/* /*
* Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de> * Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de>
@ -218,17 +218,17 @@ bcrypt(key, salt)
/* Check for minor versions */ /* Check for minor versions */
if (salt[1] != '$') { if (salt[1] != '$') {
switch(salt[1]) {
switch(salt[1]) {
case 'a': case 'a':
/* 'ab' should not yield the same as 'abab' */
minor = salt[1];
/* 'ab' should not yield the same as 'abab' */
minor = salt[1];
salt++; salt++;
break; break;
default: default:
return error;
return error;
} }
} else } else
minor = 0;
minor = 0;
/* Discard version + "$" identifier */ /* Discard version + "$" identifier */
salt += 2; salt += 2;
@ -282,7 +282,7 @@ bcrypt(key, salt)
encrypted[i++] = '$'; encrypted[i++] = '$';
encrypted[i++] = BCRYPT_VERSION; encrypted[i++] = BCRYPT_VERSION;
if (minor) if (minor)
encrypted[i++] = minor;
encrypted[i++] = minor;
encrypted[i++] = '$'; encrypted[i++] = '$';
snprintf(encrypted + i, 4, "%2.2u$", logr); snprintf(encrypted + i, 4, "%2.2u$", logr);


+ 43
- 44
src/lib/libc/crypt/blowfish.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: blowfish.c,v 1.4 1997/04/30 05:57:05 tholo Exp $ */
/* $OpenBSD: blowfish.c,v 1.5 1997/07/23 20:58:27 kstailey Exp $ */
/* /*
* Blowfish block cipher for OpenBSD * Blowfish block cipher for OpenBSD
* Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de> * Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de>
@ -429,13 +429,13 @@ Blowfish_initstate(c)
0x90d4f869, 0xa65cdea0, 0x3f09252d, 0xc208e69f, 0x90d4f869, 0xa65cdea0, 0x3f09252d, 0xc208e69f,
0xb74e6132, 0xce77e25b, 0x578fdfe3, 0x3ac372e6} 0xb74e6132, 0xce77e25b, 0x578fdfe3, 0x3ac372e6}
}, },
{
0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344,
0xa4093822, 0x299f31d0, 0x082efa98, 0xec4e6c89,
0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c,
0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917,
0x9216d5d9, 0x8979fb1b
} };
{
0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344,
0xa4093822, 0x299f31d0, 0x082efa98, 0xec4e6c89,
0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c,
0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917,
0x9216d5d9, 0x8979fb1b
} };
*c = initstate; *c = initstate;
@ -475,44 +475,43 @@ Blowfish_expand0state(blf_ctx *c, const u_int8_t *key, u_int16_t keybytes)
#else #else
void void
Blowfish_expand0state(c, key, keybytes) Blowfish_expand0state(c, key, keybytes)
blf_ctx *c;
const u_int8_t *key;
u_int16_t keybytes;
blf_ctx *c;
const u_int8_t *key;
u_int16_t keybytes;
#endif #endif
{ {
u_int16_t i;
u_int16_t j;
u_int16_t k;
u_int32_t temp;
u_int32_t datal;
u_int32_t datar;
j = 0;
for (i = 0; i < BLF_N + 2; i++) {
/* Extract 4 int8 to 1 int32 from keystream */
temp = Blowfish_stream2word(key, keybytes, &j);
c->P[i] = c->P[i] ^ temp;
}
j = 0;
datal = 0x00000000;
datar = 0x00000000;
for (i = 0; i < BLF_N + 2; i += 2) {
Blowfish_encipher(c, &datal, &datar);
c->P[i] = datal;
c->P[i + 1] = datar;
}
for (i = 0; i < 4; i++) {
for (k = 0; k < 256; k += 2) {
Blowfish_encipher(c, &datal, &datar);
c->S[i][k] = datal;
c->S[i][k + 1] = datar;
}
}
u_int16_t i;
u_int16_t j;
u_int16_t k;
u_int32_t temp;
u_int32_t datal;
u_int32_t datar;
j = 0;
for (i = 0; i < BLF_N + 2; i++) {
/* Extract 4 int8 to 1 int32 from keystream */
temp = Blowfish_stream2word(key, keybytes, &j);
c->P[i] = c->P[i] ^ temp;
}
j = 0;
datal = 0x00000000;
datar = 0x00000000;
for (i = 0; i < BLF_N + 2; i += 2) {
Blowfish_encipher(c, &datal, &datar);
c->P[i] = datal;
c->P[i + 1] = datar;
}
for (i = 0; i < 4; i++) {
for (k = 0; k < 256; k += 2) {
Blowfish_encipher(c, &datal, &datar);
c->S[i][k] = datal;
c->S[i][k + 1] = datar;
}
}
} }


+ 3
- 3
src/lib/libc/crypt/md5crypt.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: md5crypt.c,v 1.8 1997/06/29 05:48:02 deraadt Exp $ */
/* $OpenBSD: md5crypt.c,v 1.9 1997/07/23 20:58:27 kstailey Exp $ */
/* /*
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
@ -13,7 +13,7 @@
*/ */
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static char rcsid[] = "$OpenBSD: md5crypt.c,v 1.8 1997/06/29 05:48:02 deraadt Exp $";
static char rcsid[] = "$OpenBSD: md5crypt.c,v 1.9 1997/07/23 20:58:27 kstailey Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <unistd.h> #include <unistd.h>
@ -146,7 +146,7 @@ md5crypt(pw, salt)
l = (final[ 2]<<16) | (final[ 8]<<8) | final[14]; to64(p,l,4); p += 4; l = (final[ 2]<<16) | (final[ 8]<<8) | final[14]; to64(p,l,4); p += 4;
l = (final[ 3]<<16) | (final[ 9]<<8) | final[15]; to64(p,l,4); p += 4; l = (final[ 3]<<16) | (final[ 9]<<8) | final[15]; to64(p,l,4); p += 4;
l = (final[ 4]<<16) | (final[10]<<8) | final[ 5]; to64(p,l,4); p += 4; l = (final[ 4]<<16) | (final[10]<<8) | final[ 5]; to64(p,l,4); p += 4;
l = final[11] ; to64(p,l,2); p += 2;
l = final[11] ; to64(p,l,2); p += 2;
*p = '\0'; *p = '\0';
/* Don't leave anything around in vm they could use. */ /* Don't leave anything around in vm they could use. */


Loading…
Cancel
Save