Lines Matching refs:ses
265 int setup_ntlm_response(struct cifs_ses *ses, const struct nls_table *nls_cp) in setup_ntlm_response() argument
271 if (!ses) in setup_ntlm_response()
274 ses->auth_key.response = kmalloc(temp_len, GFP_KERNEL); in setup_ntlm_response()
275 if (!ses->auth_key.response) in setup_ntlm_response()
278 ses->auth_key.len = temp_len; in setup_ntlm_response()
280 rc = SMBNTencrypt(ses->password, ses->server->cryptkey, in setup_ntlm_response()
281 ses->auth_key.response + CIFS_SESS_KEY_SIZE, nls_cp); in setup_ntlm_response()
288 rc = E_md4hash(ses->password, temp_key, nls_cp); in setup_ntlm_response()
295 rc = mdfour(ses->auth_key.response, temp_key, CIFS_SESS_KEY_SIZE); in setup_ntlm_response()
347 build_avpair_blob(struct cifs_ses *ses, const struct nls_table *nls_cp) in build_avpair_blob() argument
355 if (!ses->domainName) { in build_avpair_blob()
356 ses->domainName = kstrdup(defdmname, GFP_KERNEL); in build_avpair_blob()
357 if (!ses->domainName) in build_avpair_blob()
361 dlen = strlen(ses->domainName); in build_avpair_blob()
369 ses->auth_key.len = size + 2 * dlen; in build_avpair_blob()
370 ses->auth_key.response = kzalloc(ses->auth_key.len, GFP_KERNEL); in build_avpair_blob()
371 if (!ses->auth_key.response) { in build_avpair_blob()
372 ses->auth_key.len = 0; in build_avpair_blob()
376 blobptr = ses->auth_key.response; in build_avpair_blob()
386 cifs_strtoUTF16((__le16 *)blobptr, ses->domainName, dlen, nls_cp); in build_avpair_blob()
402 find_domain_name(struct cifs_ses *ses, const struct nls_table *nls_cp) in find_domain_name() argument
411 if (!ses->auth_key.len || !ses->auth_key.response) in find_domain_name()
414 blobptr = ses->auth_key.response; in find_domain_name()
415 blobend = blobptr + ses->auth_key.len; in find_domain_name()
430 if (!ses->domainName) { in find_domain_name()
431 ses->domainName = in find_domain_name()
433 if (!ses->domainName) in find_domain_name()
435 cifs_from_utf16(ses->domainName, in find_domain_name()
454 find_timestamp(struct cifs_ses *ses) in find_timestamp() argument
463 if (!ses->auth_key.len || !ses->auth_key.response) in find_timestamp()
466 blobptr = ses->auth_key.response; in find_timestamp()
467 blobend = blobptr + ses->auth_key.len; in find_timestamp()
489 static int calc_ntlmv2_hash(struct cifs_ses *ses, char *ntlmv2_hash, in calc_ntlmv2_hash() argument
499 if (!ses->server->secmech.sdeschmacmd5) { in calc_ntlmv2_hash()
505 E_md4hash(ses->password, nt_hash, nls_cp); in calc_ntlmv2_hash()
507 rc = crypto_shash_setkey(ses->server->secmech.hmacmd5, nt_hash, in calc_ntlmv2_hash()
514 rc = crypto_shash_init(&ses->server->secmech.sdeschmacmd5->shash); in calc_ntlmv2_hash()
521 len = ses->user_name ? strlen(ses->user_name) : 0; in calc_ntlmv2_hash()
529 len = cifs_strtoUTF16(user, ses->user_name, len, nls_cp); in calc_ntlmv2_hash()
535 rc = crypto_shash_update(&ses->server->secmech.sdeschmacmd5->shash, in calc_ntlmv2_hash()
544 if (ses->domainName) { in calc_ntlmv2_hash()
545 len = strlen(ses->domainName); in calc_ntlmv2_hash()
552 len = cifs_strtoUTF16((__le16 *)domain, ses->domainName, len, in calc_ntlmv2_hash()
555 crypto_shash_update(&ses->server->secmech.sdeschmacmd5->shash, in calc_ntlmv2_hash()
565 len = strlen(ses->serverName); in calc_ntlmv2_hash()
572 len = cifs_strtoUTF16((__le16 *)server, ses->serverName, len, in calc_ntlmv2_hash()
575 crypto_shash_update(&ses->server->secmech.sdeschmacmd5->shash, in calc_ntlmv2_hash()
585 rc = crypto_shash_final(&ses->server->secmech.sdeschmacmd5->shash, in calc_ntlmv2_hash()
594 CalcNTLMv2_response(const struct cifs_ses *ses, char *ntlmv2_hash) in CalcNTLMv2_response() argument
598 (ses->auth_key.response + CIFS_SESS_KEY_SIZE); in CalcNTLMv2_response()
602 hash_len = ses->auth_key.len - (CIFS_SESS_KEY_SIZE + in CalcNTLMv2_response()
605 if (!ses->server->secmech.sdeschmacmd5) { in CalcNTLMv2_response()
610 rc = crypto_shash_setkey(ses->server->secmech.hmacmd5, in CalcNTLMv2_response()
618 rc = crypto_shash_init(&ses->server->secmech.sdeschmacmd5->shash); in CalcNTLMv2_response()
624 if (ses->server->negflavor == CIFS_NEGFLAVOR_EXTENDED) in CalcNTLMv2_response()
626 ses->ntlmssp->cryptkey, CIFS_SERVER_CHALLENGE_SIZE); in CalcNTLMv2_response()
629 ses->server->cryptkey, CIFS_SERVER_CHALLENGE_SIZE); in CalcNTLMv2_response()
630 rc = crypto_shash_update(&ses->server->secmech.sdeschmacmd5->shash, in CalcNTLMv2_response()
638 rc = crypto_shash_final(&ses->server->secmech.sdeschmacmd5->shash, in CalcNTLMv2_response()
678 setup_ntlmv2_rsp(struct cifs_ses *ses, const struct nls_table *nls_cp) in setup_ntlmv2_rsp() argument
688 if (ses->server->negflavor == CIFS_NEGFLAVOR_EXTENDED) { in setup_ntlmv2_rsp()
689 if (!ses->domainName) { in setup_ntlmv2_rsp()
690 rc = find_domain_name(ses, nls_cp); in setup_ntlmv2_rsp()
698 rc = build_avpair_blob(ses, nls_cp); in setup_ntlmv2_rsp()
709 rsp_timestamp = find_timestamp(ses); in setup_ntlmv2_rsp()
712 tilen = ses->auth_key.len; in setup_ntlmv2_rsp()
713 tiblob = ses->auth_key.response; in setup_ntlmv2_rsp()
715 ses->auth_key.response = kmalloc(baselen + tilen, GFP_KERNEL); in setup_ntlmv2_rsp()
716 if (!ses->auth_key.response) { in setup_ntlmv2_rsp()
718 ses->auth_key.len = 0; in setup_ntlmv2_rsp()
721 ses->auth_key.len += baselen; in setup_ntlmv2_rsp()
724 (ses->auth_key.response + CIFS_SESS_KEY_SIZE); in setup_ntlmv2_rsp()
732 memcpy(ses->auth_key.response + baselen, tiblob, tilen); in setup_ntlmv2_rsp()
734 rc = crypto_hmacmd5_alloc(ses->server); in setup_ntlmv2_rsp()
741 rc = calc_ntlmv2_hash(ses, ntlmv2_hash, nls_cp); in setup_ntlmv2_rsp()
748 rc = CalcNTLMv2_response(ses, ntlmv2_hash); in setup_ntlmv2_rsp()
755 rc = crypto_shash_setkey(ses->server->secmech.hmacmd5, in setup_ntlmv2_rsp()
763 rc = crypto_shash_init(&ses->server->secmech.sdeschmacmd5->shash); in setup_ntlmv2_rsp()
769 rc = crypto_shash_update(&ses->server->secmech.sdeschmacmd5->shash, in setup_ntlmv2_rsp()
777 rc = crypto_shash_final(&ses->server->secmech.sdeschmacmd5->shash, in setup_ntlmv2_rsp()
778 ses->auth_key.response); in setup_ntlmv2_rsp()
789 calc_seckey(struct cifs_ses *ses) in calc_seckey() argument
808 rc = crypto_blkcipher_setkey(tfm_arc4, ses->auth_key.response, in calc_seckey()
817 sg_init_one(&sgout, ses->ntlmssp->ciphertext, CIFS_CPHTXT_SIZE); in calc_seckey()
827 memcpy(ses->auth_key.response, sec_key, CIFS_SESS_KEY_SIZE); in calc_seckey()
829 ses->auth_key.len = CIFS_SESS_KEY_SIZE; in calc_seckey()