Lines Matching refs:ses

258 build_avpair_blob(struct cifs_ses *ses, const struct nls_table *nls_cp)  in build_avpair_blob()  argument
266 if (!ses->domainName) { in build_avpair_blob()
267 ses->domainName = kstrdup(defdmname, GFP_KERNEL); in build_avpair_blob()
268 if (!ses->domainName) in build_avpair_blob()
272 dlen = strlen(ses->domainName); in build_avpair_blob()
280 ses->auth_key.len = size + 2 * dlen; in build_avpair_blob()
281 ses->auth_key.response = kzalloc(ses->auth_key.len, GFP_KERNEL); in build_avpair_blob()
282 if (!ses->auth_key.response) { in build_avpair_blob()
283 ses->auth_key.len = 0; in build_avpair_blob()
287 blobptr = ses->auth_key.response; in build_avpair_blob()
297 cifs_strtoUTF16((__le16 *)blobptr, ses->domainName, dlen, nls_cp); in build_avpair_blob()
313 find_domain_name(struct cifs_ses *ses, const struct nls_table *nls_cp) in find_domain_name() argument
322 if (!ses->auth_key.len || !ses->auth_key.response) in find_domain_name()
325 blobptr = ses->auth_key.response; in find_domain_name()
326 blobend = blobptr + ses->auth_key.len; in find_domain_name()
341 if (!ses->domainName) { in find_domain_name()
342 ses->domainName = in find_domain_name()
344 if (!ses->domainName) in find_domain_name()
346 cifs_from_utf16(ses->domainName, in find_domain_name()
365 find_timestamp(struct cifs_ses *ses) in find_timestamp() argument
375 if (!ses->auth_key.len || !ses->auth_key.response) in find_timestamp()
378 blobptr = ses->auth_key.response; in find_timestamp()
379 blobend = blobptr + ses->auth_key.len; in find_timestamp()
402 static int calc_ntlmv2_hash(struct cifs_ses *ses, char *ntlmv2_hash, in calc_ntlmv2_hash() argument
412 if (!ses->server->secmech.sdeschmacmd5) { in calc_ntlmv2_hash()
418 E_md4hash(ses->password, nt_hash, nls_cp); in calc_ntlmv2_hash()
420 rc = crypto_shash_setkey(ses->server->secmech.hmacmd5, nt_hash, in calc_ntlmv2_hash()
427 rc = crypto_shash_init(&ses->server->secmech.sdeschmacmd5->shash); in calc_ntlmv2_hash()
434 len = ses->user_name ? strlen(ses->user_name) : 0; in calc_ntlmv2_hash()
442 len = cifs_strtoUTF16(user, ses->user_name, len, nls_cp); in calc_ntlmv2_hash()
448 rc = crypto_shash_update(&ses->server->secmech.sdeschmacmd5->shash, in calc_ntlmv2_hash()
457 if (ses->domainName) { in calc_ntlmv2_hash()
458 len = strlen(ses->domainName); in calc_ntlmv2_hash()
465 len = cifs_strtoUTF16((__le16 *)domain, ses->domainName, len, in calc_ntlmv2_hash()
468 crypto_shash_update(&ses->server->secmech.sdeschmacmd5->shash, in calc_ntlmv2_hash()
478 len = strlen(ses->ip_addr); in calc_ntlmv2_hash()
485 len = cifs_strtoUTF16((__le16 *)server, ses->ip_addr, len, in calc_ntlmv2_hash()
488 crypto_shash_update(&ses->server->secmech.sdeschmacmd5->shash, in calc_ntlmv2_hash()
498 rc = crypto_shash_final(&ses->server->secmech.sdeschmacmd5->shash, in calc_ntlmv2_hash()
507 CalcNTLMv2_response(const struct cifs_ses *ses, char *ntlmv2_hash) in CalcNTLMv2_response() argument
511 (ses->auth_key.response + CIFS_SESS_KEY_SIZE); in CalcNTLMv2_response()
515 hash_len = ses->auth_key.len - (CIFS_SESS_KEY_SIZE + in CalcNTLMv2_response()
518 if (!ses->server->secmech.sdeschmacmd5) { in CalcNTLMv2_response()
523 rc = crypto_shash_setkey(ses->server->secmech.hmacmd5, in CalcNTLMv2_response()
531 rc = crypto_shash_init(&ses->server->secmech.sdeschmacmd5->shash); in CalcNTLMv2_response()
537 if (ses->server->negflavor == CIFS_NEGFLAVOR_EXTENDED) in CalcNTLMv2_response()
539 ses->ntlmssp->cryptkey, CIFS_SERVER_CHALLENGE_SIZE); in CalcNTLMv2_response()
542 ses->server->cryptkey, CIFS_SERVER_CHALLENGE_SIZE); in CalcNTLMv2_response()
543 rc = crypto_shash_update(&ses->server->secmech.sdeschmacmd5->shash, in CalcNTLMv2_response()
551 rc = crypto_shash_final(&ses->server->secmech.sdeschmacmd5->shash, in CalcNTLMv2_response()
560 setup_ntlmv2_rsp(struct cifs_ses *ses, const struct nls_table *nls_cp) in setup_ntlmv2_rsp() argument
575 if (ses->server->negflavor == CIFS_NEGFLAVOR_EXTENDED) { in setup_ntlmv2_rsp()
576 if (!ses->domainName) { in setup_ntlmv2_rsp()
577 if (ses->domainAuto) { in setup_ntlmv2_rsp()
578 rc = find_domain_name(ses, nls_cp); in setup_ntlmv2_rsp()
585 ses->domainName = kstrdup("", GFP_KERNEL); in setup_ntlmv2_rsp()
589 rc = build_avpair_blob(ses, nls_cp); in setup_ntlmv2_rsp()
600 rsp_timestamp = find_timestamp(ses); in setup_ntlmv2_rsp()
603 tilen = ses->auth_key.len; in setup_ntlmv2_rsp()
604 tiblob = ses->auth_key.response; in setup_ntlmv2_rsp()
606 ses->auth_key.response = kmalloc(baselen + tilen, GFP_KERNEL); in setup_ntlmv2_rsp()
607 if (!ses->auth_key.response) { in setup_ntlmv2_rsp()
609 ses->auth_key.len = 0; in setup_ntlmv2_rsp()
612 ses->auth_key.len += baselen; in setup_ntlmv2_rsp()
615 (ses->auth_key.response + CIFS_SESS_KEY_SIZE); in setup_ntlmv2_rsp()
623 memcpy(ses->auth_key.response + baselen, tiblob, tilen); in setup_ntlmv2_rsp()
625 mutex_lock(&ses->server->srv_mutex); in setup_ntlmv2_rsp()
628 &ses->server->secmech.hmacmd5, in setup_ntlmv2_rsp()
629 &ses->server->secmech.sdeschmacmd5); in setup_ntlmv2_rsp()
635 rc = calc_ntlmv2_hash(ses, ntlmv2_hash, nls_cp); in setup_ntlmv2_rsp()
642 rc = CalcNTLMv2_response(ses, ntlmv2_hash); in setup_ntlmv2_rsp()
649 rc = crypto_shash_setkey(ses->server->secmech.hmacmd5, in setup_ntlmv2_rsp()
657 rc = crypto_shash_init(&ses->server->secmech.sdeschmacmd5->shash); in setup_ntlmv2_rsp()
663 rc = crypto_shash_update(&ses->server->secmech.sdeschmacmd5->shash, in setup_ntlmv2_rsp()
671 rc = crypto_shash_final(&ses->server->secmech.sdeschmacmd5->shash, in setup_ntlmv2_rsp()
672 ses->auth_key.response); in setup_ntlmv2_rsp()
677 mutex_unlock(&ses->server->srv_mutex); in setup_ntlmv2_rsp()
685 calc_seckey(struct cifs_ses *ses) in calc_seckey() argument
701 cifs_arc4_setkey(ctx_arc4, ses->auth_key.response, CIFS_SESS_KEY_SIZE); in calc_seckey()
702 cifs_arc4_crypt(ctx_arc4, ses->ntlmssp->ciphertext, sec_key, in calc_seckey()
706 memcpy(ses->auth_key.response, sec_key, CIFS_SESS_KEY_SIZE); in calc_seckey()
708 ses->auth_key.len = CIFS_SESS_KEY_SIZE; in calc_seckey()