func:  SMBencrypt(unsigned char *passwd, const unsigned char *c8, unsigned char *p24) int rc ; unsigned char p14 [ 14 ] , p16 [ 16 ] , p21 [ 21 ] ; memset ( p14 , '\0' , 14 ); memset ( p16 , '\0' , 16 ); memset ( p21 , '\0' , 21 ); memcpy ( p14 , passwd , 14 ); rc = E_P16 ( p14 , p16 ); static E_P16(unsigned char *p14, unsigned char *p16) int rc ; unsigned char sp8 [ 8 ] = { 0x4b , 0x47 , 0x53 , 0x21 , 0x40 , 0x23 , 0x24 , 0x25 } ; rc = smbhash ( p16 , sp8 , p14 ); static smbhash(unsigned char *out, const unsigned char *in, unsigned char *key) int rc ; struct crypto_skcipher * tfm_des ; struct skcipher_request * req ; tfm_des = crypto_alloc_skcipher ( "ecb(des)" , 0 , CRYPTO_ALG_ASYNC ); if ( IS_ERR ( tfm_des ) )  rc = PTR_ERR ( tfm_des ); req = skcipher_request_alloc ( tfm_des , GFP_KERNEL ); if ( ! req )  rc = - ENOMEM; rc = crypto_skcipher_encrypt ( req ); return rc ; if ( rc )  return rc ; rc = smbhash ( p16 + 8 , sp8 , p14 + 7 ); static smbhash(unsigned char *out, const unsigned char *in, unsigned char *key) int rc ; struct crypto_skcipher * tfm_des ; struct skcipher_request * req ; tfm_des = crypto_alloc_skcipher ( "ecb(des)" , 0 , CRYPTO_ALG_ASYNC ); if ( IS_ERR ( tfm_des ) )  rc = PTR_ERR ( tfm_des ); req = skcipher_request_alloc ( tfm_des , GFP_KERNEL ); if ( ! req )  rc = - ENOMEM; rc = crypto_skcipher_encrypt ( req ); return rc ; return rc ; if ( rc )  memcpy ( p21 , p16 , 16 ); rc = E_P24 ( p21 , c8 , p24 ); static E_P24(unsigned char *p21, const unsigned char *c8, unsigned char *p24) rc = smbhash ( p24 , c8 , p21 ); static smbhash(unsigned char *out, const unsigned char *in, unsigned char *key) str_to_key ( key , key2 ); static str_to_key(unsigned char *str, unsigned char *key) key [ 0 ] = str [ 0 ] >> 1; key [ 1 ] = ( ( str [ 0 ] & 0x01 ) << 6 ) | ( str [ 1 ] >> 2 ); key [ 2 ] = ( ( str [ 1 ] & 0x03 ) << 5 ) | ( str [ 2 ] >> 3 ); key [ 3 ] = ( ( str [ 2 ] & 0x07 ) << 4 ) | ( str [ 3 ] >> 4 ); key [ 4 ] = ( ( str [ 3 ] & 0x0F ) << 3 ) | ( str [ 4 ] >> 5 ); key [ 5 ] = ( ( str [ 4 ] & 0x1F ) << 2 ) | ( str [ 5 ] >> 6 ); key [ 6 ] = ( ( str [ 5 ] & 0x3F ) << 1 ) | ( str [ 6 ] >> 7 ); key [ 7 ] = str [ 6 ] & 0x7F; key [ i ] = ( key [ i ] << 1 ); sg_init_one ( & sgin , in , 8 ); sg_init_one ( & sgout , out , 8 ); if ( rc )  return rc ; rc = smbhash ( p24 + 8 , c8 , p21 + 7 ); static smbhash(unsigned char *out, const unsigned char *in, unsigned char *key) str_to_key ( key , key2 ); sg_init_one ( & sgin , in , 8 ); sg_init_one ( & sgout , out , 8 ); if ( rc )  return rc ; rc = smbhash ( p24 + 16 , c8 , p21 + 14 ); static smbhash(unsigned char *out, const unsigned char *in, unsigned char *key) str_to_key ( key , key2 ); sg_init_one ( & sgin , in , 8 ); sg_init_one ( & sgout , out , 8 ); return rc ; return rc ; 