summaryrefslogtreecommitdiffstats
path: root/source/libsmb/smbencrypt.c
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>2000-04-03 02:39:42 +0000
committerLuke Leighton <lkcl@samba.org>2000-04-03 02:39:42 +0000
commit12be5496048bec9566d7b70c20bb236e9ad11a07 (patch)
tree170bd143a7fe24524b66482894350ceaf37e870a /source/libsmb/smbencrypt.c
parent54c1d574a88cafbc029cf5aa5ebbd6f27054724c (diff)
downloadsamba-12be5496048bec9566d7b70c20bb236e9ad11a07.tar.gz
samba-12be5496048bec9566d7b70c20bb236e9ad11a07.tar.xz
samba-12be5496048bec9566d7b70c20bb236e9ad11a07.zip
merge of smbd and related files, from cvs main.
Diffstat (limited to 'source/libsmb/smbencrypt.c')
-rw-r--r--source/libsmb/smbencrypt.c90
1 files changed, 45 insertions, 45 deletions
diff --git a/source/libsmb/smbencrypt.c b/source/libsmb/smbencrypt.c
index 1fd10d60e0e..68314adb1c2 100644
--- a/source/libsmb/smbencrypt.c
+++ b/source/libsmb/smbencrypt.c
@@ -224,6 +224,51 @@ void SMBNTencrypt(uchar * pwrd, uchar * c8, uchar * p24)
#endif
}
+BOOL make_oem_passwd_hash(uchar data[516],
+ const char *pwrd, int new_pw_len,
+ const uchar old_pw_hash[16], BOOL unicode)
+{
+ if (new_pw_len == 0)
+ {
+ new_pw_len = strlen(pwrd) * (unicode ? 2 : 1);
+ }
+
+ if (new_pw_len > 512)
+ {
+ DEBUG(0,
+ ("make_oem_passwd_hash: new password is too long.\n"));
+ return False;
+ }
+
+ /*
+ * Now setup the data area.
+ * We need to generate a random fill
+ * for this area to make it harder to
+ * decrypt. JRA.
+ */
+ generate_random_buffer(data, 516, False);
+ if (unicode)
+ {
+ ascii_to_unibuf(&data[512 - new_pw_len], pwrd, new_pw_len);
+ }
+ else
+ {
+ fstrcpy(&data[512 - new_pw_len], pwrd);
+ }
+ SIVAL(data, 512, new_pw_len);
+
+#ifdef DEBUG_PASSWORD
+ DEBUG(100, ("make_oem_passwd_hash\n"));
+ dump_data(100, data, 516);
+#endif
+ if (old_pw_hash != NULL)
+ {
+ SamOEMhash(data, old_pw_hash, True);
+ }
+
+ return True;
+}
+
void SMBOWFencrypt_ntv2(const uchar kr[16],
const uchar * srv_chal, int srv_chal_len,
const uchar * cli_chal, int cli_chal_len,
@@ -416,51 +461,6 @@ void nt_lm_owf_genW(const UNISTR2 *pwd, uchar nt_p16[16], uchar lm_p16[16])
lm_owf_genW(pwd, lm_p16);
}
-BOOL make_oem_passwd_hash(uchar data[516],
- const char *pwrd, int new_pw_len,
- const uchar old_pw_hash[16], BOOL unicode)
-{
- if (new_pw_len == 0)
- {
- new_pw_len = strlen(pwrd) * (unicode ? 2 : 1);
- }
-
- if (new_pw_len > 512)
- {
- DEBUG(0,
- ("make_oem_passwd_hash: new password is too long.\n"));
- return False;
- }
-
- /*
- * Now setup the data area.
- * We need to generate a random fill
- * for this area to make it harder to
- * decrypt. JRA.
- */
- generate_random_buffer(data, 516, False);
- if (unicode)
- {
- ascii_to_unibuf(&data[512 - new_pw_len], pwrd, new_pw_len);
- }
- else
- {
- fstrcpy(&data[512 - new_pw_len], pwrd);
- }
- SIVAL(data, 512, new_pw_len);
-
-#ifdef DEBUG_PASSWORD
- DEBUG(100, ("make_oem_passwd_hash\n"));
- dump_data(100, data, 516);
-#endif
- if (old_pw_hash != NULL)
- {
- SamOEMhash(data, old_pw_hash, True);
- }
-
- return True;
-}
-
BOOL nt_encrypt_string2(STRING2 * out, const STRING2 * in, const uchar * key)
{
const uchar *keyptr = key;