Lines Matching refs:ses
273 build_avpair_blob(struct cifs_ses *ses, const struct nls_table *nls_cp) in build_avpair_blob() argument
281 if (!ses->domainName) { in build_avpair_blob()
282 ses->domainName = kstrdup(defdmname, GFP_KERNEL); in build_avpair_blob()
283 if (!ses->domainName) in build_avpair_blob()
287 dlen = strlen(ses->domainName); in build_avpair_blob()
295 kfree_sensitive(ses->auth_key.response); in build_avpair_blob()
296 ses->auth_key.len = size + 2 * dlen; in build_avpair_blob()
297 ses->auth_key.response = kzalloc(ses->auth_key.len, GFP_KERNEL); in build_avpair_blob()
298 if (!ses->auth_key.response) { in build_avpair_blob()
299 ses->auth_key.len = 0; in build_avpair_blob()
303 blobptr = ses->auth_key.response; in build_avpair_blob()
313 cifs_strtoUTF16((__le16 *)blobptr, ses->domainName, dlen, nls_cp); in build_avpair_blob()
329 find_domain_name(struct cifs_ses *ses, const struct nls_table *nls_cp) in find_domain_name() argument
338 if (!ses->auth_key.len || !ses->auth_key.response) in find_domain_name()
341 blobptr = ses->auth_key.response; in find_domain_name()
342 blobend = blobptr + ses->auth_key.len; in find_domain_name()
357 if (!ses->domainName) { in find_domain_name()
358 ses->domainName = in find_domain_name()
360 if (!ses->domainName) in find_domain_name()
362 cifs_from_utf16(ses->domainName, in find_domain_name()
381 find_timestamp(struct cifs_ses *ses) in find_timestamp() argument
391 if (!ses->auth_key.len || !ses->auth_key.response) in find_timestamp()
394 blobptr = ses->auth_key.response; in find_timestamp()
395 blobend = blobptr + ses->auth_key.len; in find_timestamp()
418 static int calc_ntlmv2_hash(struct cifs_ses *ses, char *ntlmv2_hash, in calc_ntlmv2_hash() argument
429 E_md4hash(ses->password, nt_hash, nls_cp); in calc_ntlmv2_hash()
444 len = ses->user_name ? strlen(ses->user_name) : 0; in calc_ntlmv2_hash()
450 len = cifs_strtoUTF16(user, ses->user_name, len, nls_cp); in calc_ntlmv2_hash()
464 if (ses->domainName) { in calc_ntlmv2_hash()
465 len = strlen(ses->domainName); in calc_ntlmv2_hash()
471 len = cifs_strtoUTF16((__le16 *)domain, ses->domainName, len, in calc_ntlmv2_hash()
481 len = strlen(ses->ip_addr); in calc_ntlmv2_hash()
487 len = cifs_strtoUTF16((__le16 *)server, ses->ip_addr, len, nls_cp); in calc_ntlmv2_hash()
504 CalcNTLMv2_response(const struct cifs_ses *ses, char *ntlmv2_hash, struct shash_desc *hmacmd5) in CalcNTLMv2_response() argument
508 (ses->auth_key.response + CIFS_SESS_KEY_SIZE); in CalcNTLMv2_response()
512 hash_len = ses->auth_key.len - (CIFS_SESS_KEY_SIZE + in CalcNTLMv2_response()
527 if (ses->server->negflavor == CIFS_NEGFLAVOR_EXTENDED) in CalcNTLMv2_response()
528 memcpy(ntlmv2->challenge.key, ses->ntlmssp->cryptkey, CIFS_SERVER_CHALLENGE_SIZE); in CalcNTLMv2_response()
530 memcpy(ntlmv2->challenge.key, ses->server->cryptkey, CIFS_SERVER_CHALLENGE_SIZE); in CalcNTLMv2_response()
547 setup_ntlmv2_rsp(struct cifs_ses *ses, const struct nls_table *nls_cp) in setup_ntlmv2_rsp() argument
563 if (ses->server->negflavor == CIFS_NEGFLAVOR_EXTENDED) { in setup_ntlmv2_rsp()
564 if (!ses->domainName) { in setup_ntlmv2_rsp()
565 if (ses->domainAuto) { in setup_ntlmv2_rsp()
566 rc = find_domain_name(ses, nls_cp); in setup_ntlmv2_rsp()
573 ses->domainName = kstrdup("", GFP_KERNEL); in setup_ntlmv2_rsp()
577 rc = build_avpair_blob(ses, nls_cp); in setup_ntlmv2_rsp()
588 rsp_timestamp = find_timestamp(ses); in setup_ntlmv2_rsp()
591 tilen = ses->auth_key.len; in setup_ntlmv2_rsp()
592 tiblob = ses->auth_key.response; in setup_ntlmv2_rsp()
594 ses->auth_key.response = kmalloc(baselen + tilen, GFP_KERNEL); in setup_ntlmv2_rsp()
595 if (!ses->auth_key.response) { in setup_ntlmv2_rsp()
597 ses->auth_key.len = 0; in setup_ntlmv2_rsp()
600 ses->auth_key.len += baselen; in setup_ntlmv2_rsp()
603 (ses->auth_key.response + CIFS_SESS_KEY_SIZE); in setup_ntlmv2_rsp()
611 memcpy(ses->auth_key.response + baselen, tiblob, tilen); in setup_ntlmv2_rsp()
613 cifs_server_lock(ses->server); in setup_ntlmv2_rsp()
622 rc = calc_ntlmv2_hash(ses, ntlmv2_hash, nls_cp, hmacmd5); in setup_ntlmv2_rsp()
629 rc = CalcNTLMv2_response(ses, ntlmv2_hash, hmacmd5); in setup_ntlmv2_rsp()
654 rc = crypto_shash_final(hmacmd5, ses->auth_key.response); in setup_ntlmv2_rsp()
658 cifs_server_unlock(ses->server); in setup_ntlmv2_rsp()
667 calc_seckey(struct cifs_ses *ses) in calc_seckey() argument
683 cifs_arc4_setkey(ctx_arc4, ses->auth_key.response, CIFS_SESS_KEY_SIZE); in calc_seckey()
684 cifs_arc4_crypt(ctx_arc4, ses->ntlmssp->ciphertext, sec_key, in calc_seckey()
688 memcpy(ses->auth_key.response, sec_key, CIFS_SESS_KEY_SIZE); in calc_seckey()
690 ses->auth_key.len = CIFS_SESS_KEY_SIZE; in calc_seckey()