関数 | |
static void | permute (char *out, const char *in, const uchar *p, int n) |
static void | lshift (char *d, int count, int n) |
static void | concat (char *out, char *in1, char *in2, int l1, int l2) |
static void | x_or (char *out, char *in1, char *in2, int n) |
static void | dohash (char *out, char *in, char *key, int forw) |
static void | str_to_key (const unsigned char str[7], unsigned char key[8]) |
void | des_crypt56 (unsigned char *out, const unsigned char *in, const unsigned char *key, int forw) |
void | E_P16 (const unsigned char *p14, unsigned char *p16) |
void | E_P24 (const unsigned char *p21, const unsigned char *c8, unsigned char *p24) |
void | D_P16 (const unsigned char *p14, const unsigned char *in, unsigned char *out) |
void | E_old_pw_hash (unsigned char *p14, const unsigned char *in, unsigned char *out) |
void | des_crypt128 (unsigned char out[8], const unsigned char in[8], const unsigned char key[16]) |
void | des_crypt64 (unsigned char out[8], const unsigned char in[8], const unsigned char key[8]) |
void | des_crypt112 (unsigned char out[8], const unsigned char in[8], const unsigned char key[14], int forw) |
void | cred_hash3 (unsigned char *out, const unsigned char *in, const unsigned char *key, int forw) |
void | des_crypt112_16 (unsigned char out[16], unsigned char in[16], const unsigned char key[14], int forw) |
void | SamOEMhash (unsigned char *data, const unsigned char key[16], size_t len) |
void | SamOEMhashBlob (unsigned char *data, size_t len, DATA_BLOB *key) |
void | sam_pwd_hash (unsigned int rid, const uchar *in, uchar *out, int forw) |
変数 | |
static const uchar | perm1 [56] |
static const uchar | perm2 [48] |
static const uchar | perm3 [64] |
static const uchar | perm4 [48] |
static const uchar | perm5 [32] |
static const uchar | perm6 [64] |
static const uchar | sc [16] = {1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1} |
static const uchar | sbox [8][4][16] |
static void permute | ( | char * | out, | |
const char * | in, | |||
const uchar * | p, | |||
int | n | |||
) | [static] |
static void lshift | ( | char * | d, | |
int | count, | |||
int | n | |||
) | [static] |
static void concat | ( | char * | out, | |
char * | in1, | |||
char * | in2, | |||
int | l1, | |||
int | l2 | |||
) | [static] |
static void x_or | ( | char * | out, | |
char * | in1, | |||
char * | in2, | |||
int | n | |||
) | [static] |
static void dohash | ( | char * | out, | |
char * | in, | |||
char * | key, | |||
int | forw | |||
) | [static] |
参照先 c・concat()・lshift()・perm1・perm2・perm3・perm4・perm5・perm6・permute()・sbox・sc・x_or().
参照元 des_crypt56().
00183 { 00184 int i, j, k; 00185 char pk1[56]; 00186 char c[28]; 00187 char d[28]; 00188 char cd[56]; 00189 char ki[16][48]; 00190 char pd1[64]; 00191 char l[32], r[32]; 00192 char rl[64]; 00193 00194 permute(pk1, key, perm1, 56); 00195 00196 for (i=0;i<28;i++) 00197 c[i] = pk1[i]; 00198 for (i=0;i<28;i++) 00199 d[i] = pk1[i+28]; 00200 00201 for (i=0;i<16;i++) { 00202 lshift(c, sc[i], 28); 00203 lshift(d, sc[i], 28); 00204 00205 concat(cd, c, d, 28, 28); 00206 permute(ki[i], cd, perm2, 48); 00207 } 00208 00209 permute(pd1, in, perm3, 64); 00210 00211 for (j=0;j<32;j++) { 00212 l[j] = pd1[j]; 00213 r[j] = pd1[j+32]; 00214 } 00215 00216 for (i=0;i<16;i++) { 00217 char er[48]; 00218 char erk[48]; 00219 char b[8][6]; 00220 char cb[32]; 00221 char pcb[32]; 00222 char r2[32]; 00223 00224 permute(er, r, perm4, 48); 00225 00226 x_or(erk, er, ki[forw ? i : 15 - i], 48); 00227 00228 for (j=0;j<8;j++) 00229 for (k=0;k<6;k++) 00230 b[j][k] = erk[j*6 + k]; 00231 00232 for (j=0;j<8;j++) { 00233 int m, n; 00234 m = (b[j][0]<<1) | b[j][5]; 00235 00236 n = (b[j][1]<<3) | (b[j][2]<<2) | (b[j][3]<<1) | b[j][4]; 00237 00238 for (k=0;k<4;k++) 00239 b[j][k] = (sbox[j][m][n] & (1<<(3-k)))?1:0; 00240 } 00241 00242 for (j=0;j<8;j++) 00243 for (k=0;k<4;k++) 00244 cb[j*4+k] = b[j][k]; 00245 permute(pcb, cb, perm5, 32); 00246 00247 x_or(r2, l, pcb, 32); 00248 00249 for (j=0;j<32;j++) 00250 l[j] = r[j]; 00251 00252 for (j=0;j<32;j++) 00253 r[j] = r2[j]; 00254 } 00255 00256 concat(rl, r, l, 32, 32); 00257 00258 permute(out, rl, perm6, 64); 00259 }
static void str_to_key | ( | const unsigned char | str[7], | |
unsigned char | key[8] | |||
) | [static] |
参照元 des_crypt56().
00263 { 00264 int i; 00265 00266 key[0] = str[0]>>1; 00267 key[1] = ((str[0]&0x01)<<6) | (str[1]>>2); 00268 key[2] = ((str[1]&0x03)<<5) | (str[2]>>3); 00269 key[3] = ((str[2]&0x07)<<4) | (str[3]>>4); 00270 key[4] = ((str[3]&0x0F)<<3) | (str[4]>>5); 00271 key[5] = ((str[4]&0x1F)<<2) | (str[5]>>6); 00272 key[6] = ((str[5]&0x3F)<<1) | (str[6]>>7); 00273 key[7] = str[6]&0x7F; 00274 for (i=0;i<8;i++) { 00275 key[i] = (key[i]<<1); 00276 } 00277 }
void des_crypt56 | ( | unsigned char * | out, | |
const unsigned char * | in, | |||
const unsigned char * | key, | |||
int | forw | |||
) |
参照先 dohash()・str_to_key().
参照元 cred_hash3()・D_P16()・des_crypt112()・des_crypt112_16()・des_crypt128()・des_crypt64()・E_old_pw_hash()・E_P16()・E_P24()・sam_pwd_hash()・sess_crypt_blob().
00281 { 00282 int i; 00283 char outb[64]; 00284 char inb[64]; 00285 char keyb[64]; 00286 unsigned char key2[8]; 00287 00288 str_to_key(key, key2); 00289 00290 for (i=0;i<64;i++) { 00291 inb[i] = (in[i/8] & (1<<(7-(i%8)))) ? 1 : 0; 00292 keyb[i] = (key2[i/8] & (1<<(7-(i%8)))) ? 1 : 0; 00293 outb[i] = 0; 00294 } 00295 00296 dohash(outb, inb, keyb, forw); 00297 00298 for (i=0;i<8;i++) { 00299 out[i] = 0; 00300 } 00301 00302 for (i=0;i<64;i++) { 00303 if (outb[i]) 00304 out[i/8] |= (1<<(7-(i%8))); 00305 } 00306 }
void E_P16 | ( | const unsigned char * | p14, | |
unsigned char * | p16 | |||
) |
参照先 des_crypt56().
参照元 change_lanman_password()・E_deshash()・ntlm_password_check().
00309 { 00310 unsigned char sp8[8] = {0x4b, 0x47, 0x53, 0x21, 0x40, 0x23, 0x24, 0x25}; 00311 des_crypt56(p16, sp8, p14, 1); 00312 des_crypt56(p16+8, sp8, p14+7, 1); 00313 }
void E_P24 | ( | const unsigned char * | p21, | |
const unsigned char * | c8, | |||
unsigned char * | p24 | |||
) |
参照先 des_crypt56().
参照元 NTLMSSPOWFencrypt()・SMBOWFencrypt().
00316 { 00317 des_crypt56(p24, c8, p21, 1); 00318 des_crypt56(p24+8, c8, p21+7, 1); 00319 des_crypt56(p24+16, c8, p21+14, 1); 00320 }
void D_P16 | ( | const unsigned char * | p14, | |
const unsigned char * | in, | |||
unsigned char * | out | |||
) |
参照先 des_crypt56().
参照元 change_lanman_password()・check_lanman_password().
00323 { 00324 des_crypt56(out, in, p14, 0); 00325 des_crypt56(out+8, in+8, p14+7, 0); 00326 }
void E_old_pw_hash | ( | unsigned char * | p14, | |
const unsigned char * | in, | |||
unsigned char * | out | |||
) |
参照先 des_crypt56().
参照元 check_oem_password()・cli_oem_change_password()・manage_ntlm_change_password_1_request()・rpccli_samr_chgpasswd3()・rpccli_samr_chgpasswd_user().
00329 { 00330 des_crypt56(out, in, p14, 1); 00331 des_crypt56(out+8, in+8, p14+7, 1); 00332 }
void des_crypt128 | ( | unsigned char | out[8], | |
const unsigned char | in[8], | |||
const unsigned char | key[16] | |||
) |
参照先 buf・des_crypt56().
参照元 creds_init_64().
00336 { 00337 unsigned char buf[8]; 00338 00339 des_crypt56(buf, in, key, 1); 00340 des_crypt56(out, buf, key+9, 1); 00341 }
void des_crypt64 | ( | unsigned char | out[8], | |
const unsigned char | in[8], | |||
const unsigned char | key[8] | |||
) |
参照先 buf・des_crypt56().
00345 { 00346 unsigned char buf[8]; 00347 unsigned char key2[8]; 00348 00349 memset(key2,'\0',8); 00350 des_crypt56(buf, in, key, 1); 00351 key2[0] = key[7]; 00352 des_crypt56(out, buf, key2, 1); 00353 }
void des_crypt112 | ( | unsigned char | out[8], | |
const unsigned char | in[8], | |||
const unsigned char | key[14], | |||
int | forw | |||
) |
参照先 buf・des_crypt56().
参照元 creds_init_128()・creds_init_64()・creds_step().
00360 { 00361 unsigned char buf[8]; 00362 des_crypt56(buf, in, key, forw); 00363 des_crypt56(out, buf, key+7, forw); 00364 }
void cred_hash3 | ( | unsigned char * | out, | |
const unsigned char * | in, | |||
const unsigned char * | key, | |||
int | forw | |||
) |
参照先 des_crypt56().
参照元 _net_srv_pwset()・init_q_srv_pwset().
00367 { 00368 unsigned char key2[8]; 00369 00370 memset(key2,'\0',8); 00371 des_crypt56(out, in, key, forw); 00372 key2[0] = key[7]; 00373 des_crypt56(out + 8, in + 8, key2, forw); 00374 }
void des_crypt112_16 | ( | unsigned char | out[16], | |
unsigned char | in[16], | |||
const unsigned char | key[14], | |||
int | forw | |||
) |
参照先 des_crypt56().
00381 { 00382 des_crypt56(out, in, key, forw); 00383 des_crypt56(out + 8, in + 8, key+7, forw); 00384 }
void SamOEMhash | ( | unsigned char * | data, | |
const unsigned char | key[16], | |||
size_t | len | |||
) |
参照先 smb_arc4_crypt()・smb_arc4_init().
参照元 _net_sam_logon_internal()・check_oem_password()・cli_oem_change_password()・encode_or_decode_arc4_passwd_buffer()・init_id_info1()・init_q_srv_pwset2()・make_user_info_netlogon_interactive()・manage_ntlm_change_password_1_request()・ntlmssp_client_challenge()・ntlmssp_server_auth()・rpccli_netlogon_sam_network_logon()・rpccli_samr_chgpasswd3()・rpccli_samr_chgpasswd_user().
00391 { 00392 unsigned char arc4_state[258]; 00393 00394 smb_arc4_init(arc4_state, key, 16); 00395 smb_arc4_crypt(arc4_state, data, len); 00396 }
void SamOEMhashBlob | ( | unsigned char * | data, | |
size_t | len, | |||
DATA_BLOB * | key | |||
) |
参照先 data_blob_::data・data_blob_::length・smb_arc4_crypt()・smb_arc4_init().
参照元 _samr_set_userinfo()・_samr_set_userinfo2()・init_samr_q_set_userinfo2()・init_samr_userinfo_ctr()・netdom_join_domain().
00399 { 00400 unsigned char arc4_state[258]; 00401 00402 smb_arc4_init(arc4_state, key->data, key->length); 00403 smb_arc4_crypt(arc4_state, data, len); 00404 }
void sam_pwd_hash | ( | unsigned int | rid, | |
const uchar * | in, | |||
uchar * | out, | |||
int | forw | |||
) |
参照先 des_crypt56().
参照元 display_account_info()・fetch_account_info_to_ldif()・sam_account_from_delta().
00411 { 00412 uchar s[14]; 00413 00414 s[0] = s[4] = s[8] = s[12] = (uchar)(rid & 0xFF); 00415 s[1] = s[5] = s[9] = s[13] = (uchar)((rid >> 8) & 0xFF); 00416 s[2] = s[6] = s[10] = (uchar)((rid >> 16) & 0xFF); 00417 s[3] = s[7] = s[11] = (uchar)((rid >> 24) & 0xFF); 00418 00419 des_crypt56(out, in, s, forw); 00420 des_crypt56(out+8, in+8, s+7, forw); 00421 }
const uchar perm1[56] [static] |
初期値:
{57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35, 27, 19, 11, 3, 60, 52, 44, 36, 63, 55, 47, 39, 31, 23, 15, 7, 62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29, 21, 13, 5, 28, 20, 12, 4}
const uchar perm2[48] [static] |
初期値:
{14, 17, 11, 24, 1, 5, 3, 28, 15, 6, 21, 10, 23, 19, 12, 4, 26, 8, 16, 7, 27, 20, 13, 2, 41, 52, 31, 37, 47, 55, 30, 40, 51, 45, 33, 48, 44, 49, 39, 56, 34, 53, 46, 42, 50, 36, 29, 32}
const uchar perm3[64] [static] |
const uchar perm4[48] [static] |
const uchar perm5[32] [static] |
const uchar perm6[64] [static] |
const uchar sc[16] = {1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1} [static] |