Lines Matching full:token
85 * parse an RxKAD type XDR format token
92 struct rxrpc_key_token *token, **pptoken; in rxrpc_preparse_xdr_rxkad() local
110 plen = sizeof(*token) + sizeof(*token->kad) + tktlen; in rxrpc_preparse_xdr_rxkad()
113 plen -= sizeof(*token); in rxrpc_preparse_xdr_rxkad()
114 token = kzalloc(sizeof(*token), GFP_KERNEL); in rxrpc_preparse_xdr_rxkad()
115 if (!token) in rxrpc_preparse_xdr_rxkad()
118 token->kad = kzalloc(plen, GFP_KERNEL); in rxrpc_preparse_xdr_rxkad()
119 if (!token->kad) { in rxrpc_preparse_xdr_rxkad()
120 kfree(token); in rxrpc_preparse_xdr_rxkad()
124 token->security_index = RXRPC_SECURITY_RXKAD; in rxrpc_preparse_xdr_rxkad()
125 token->kad->ticket_len = tktlen; in rxrpc_preparse_xdr_rxkad()
126 token->kad->vice_id = ntohl(xdr[0]); in rxrpc_preparse_xdr_rxkad()
127 token->kad->kvno = ntohl(xdr[1]); in rxrpc_preparse_xdr_rxkad()
128 token->kad->start = ntohl(xdr[4]); in rxrpc_preparse_xdr_rxkad()
129 token->kad->expiry = ntohl(xdr[5]); in rxrpc_preparse_xdr_rxkad()
130 token->kad->primary_flag = ntohl(xdr[6]); in rxrpc_preparse_xdr_rxkad()
131 memcpy(&token->kad->session_key, &xdr[2], 8); in rxrpc_preparse_xdr_rxkad()
132 memcpy(&token->kad->ticket, &xdr[8], tktlen); in rxrpc_preparse_xdr_rxkad()
134 _debug("SCIX: %u", token->security_index); in rxrpc_preparse_xdr_rxkad()
135 _debug("TLEN: %u", token->kad->ticket_len); in rxrpc_preparse_xdr_rxkad()
136 _debug("EXPY: %x", token->kad->expiry); in rxrpc_preparse_xdr_rxkad()
137 _debug("KVNO: %u", token->kad->kvno); in rxrpc_preparse_xdr_rxkad()
138 _debug("PRIM: %u", token->kad->primary_flag); in rxrpc_preparse_xdr_rxkad()
140 token->kad->session_key[0], token->kad->session_key[1], in rxrpc_preparse_xdr_rxkad()
141 token->kad->session_key[2], token->kad->session_key[3], in rxrpc_preparse_xdr_rxkad()
142 token->kad->session_key[4], token->kad->session_key[5], in rxrpc_preparse_xdr_rxkad()
143 token->kad->session_key[6], token->kad->session_key[7]); in rxrpc_preparse_xdr_rxkad()
144 if (token->kad->ticket_len >= 8) in rxrpc_preparse_xdr_rxkad()
146 token->kad->ticket[0], token->kad->ticket[1], in rxrpc_preparse_xdr_rxkad()
147 token->kad->ticket[2], token->kad->ticket[3], in rxrpc_preparse_xdr_rxkad()
148 token->kad->ticket[4], token->kad->ticket[5], in rxrpc_preparse_xdr_rxkad()
149 token->kad->ticket[6], token->kad->ticket[7]); in rxrpc_preparse_xdr_rxkad()
159 *pptoken = token; in rxrpc_preparse_xdr_rxkad()
160 expiry = rxrpc_u32_to_time64(token->kad->expiry); in rxrpc_preparse_xdr_rxkad()
186 * free up an RxK5 token
426 * parse an RxK5 type XDR format token
433 struct rxrpc_key_token *token, **pptoken; in rxrpc_preparse_xdr_rxk5() local
443 /* reserve some payload space for this subkey - the length of the token in rxrpc_preparse_xdr_rxk5()
447 token = kzalloc(sizeof(*token), GFP_KERNEL); in rxrpc_preparse_xdr_rxk5()
448 if (!token) in rxrpc_preparse_xdr_rxk5()
453 kfree(token); in rxrpc_preparse_xdr_rxk5()
457 token->security_index = RXRPC_SECURITY_RXK5; in rxrpc_preparse_xdr_rxk5()
458 token->k5 = rxk5; in rxrpc_preparse_xdr_rxk5()
536 *pptoken = token; in rxrpc_preparse_xdr_rxk5()
537 expiry = rxrpc_u32_to_time64(token->k5->endtime); in rxrpc_preparse_xdr_rxk5()
548 kfree(token); in rxrpc_preparse_xdr_rxk5()
559 const __be32 *xdr = prep->data, *token; in rxrpc_preparse_xdr() local
603 /* get the token count */ in rxrpc_preparse_xdr()
612 /* check each token wrapper */ in rxrpc_preparse_xdr()
613 token = xdr; in rxrpc_preparse_xdr()
621 _debug("token: [%x/%zx] %x", toklen, datalen, sec_ix); in rxrpc_preparse_xdr()
638 xdr = token; in rxrpc_preparse_xdr()
640 token = xdr + ((toklen + 3) >> 2); in rxrpc_preparse_xdr()
644 _debug("TOKEN type=%u [%p-%p]", sec_ix, xdr, token); in rxrpc_preparse_xdr()
695 struct rxrpc_key_token *token, **pp; in rxrpc_preparse() local
757 plen = sizeof(*token->kad) + v1->ticket_length; in rxrpc_preparse()
758 prep->quotalen = plen + sizeof(*token); in rxrpc_preparse()
761 token = kzalloc(sizeof(*token), GFP_KERNEL); in rxrpc_preparse()
762 if (!token) in rxrpc_preparse()
764 token->kad = kzalloc(plen, GFP_KERNEL); in rxrpc_preparse()
765 if (!token->kad) in rxrpc_preparse()
768 token->security_index = RXRPC_SECURITY_RXKAD; in rxrpc_preparse()
769 token->kad->ticket_len = v1->ticket_length; in rxrpc_preparse()
770 token->kad->expiry = v1->expiry; in rxrpc_preparse()
771 token->kad->kvno = v1->kvno; in rxrpc_preparse()
772 memcpy(&token->kad->session_key, &v1->session_key, 8); in rxrpc_preparse()
773 memcpy(&token->kad->ticket, v1->ticket, v1->ticket_length); in rxrpc_preparse()
782 *pp = token; in rxrpc_preparse()
783 expiry = rxrpc_u32_to_time64(token->kad->expiry); in rxrpc_preparse()
786 token = NULL; in rxrpc_preparse()
790 kfree(token); in rxrpc_preparse()
796 * Free token list.
798 static void rxrpc_free_token_list(struct rxrpc_key_token *token) in rxrpc_free_token_list() argument
802 for (; token; token = next) { in rxrpc_free_token_list()
803 next = token->next; in rxrpc_free_token_list()
804 switch (token->security_index) { in rxrpc_free_token_list()
806 kfree(token->kad); in rxrpc_free_token_list()
809 if (token->k5) in rxrpc_free_token_list()
810 rxrpc_rxk5_free(token->k5); in rxrpc_free_token_list()
813 pr_err("Unknown token type %x on rxrpc key\n", in rxrpc_free_token_list()
814 token->security_index); in rxrpc_free_token_list()
818 kfree(token); in rxrpc_free_token_list()
1046 const struct rxrpc_key_token *token; in rxrpc_read() local
1067 size += 1 * 4; /* token count */ in rxrpc_read()
1070 for (token = key->payload.data[0]; token; token = token->next) { in rxrpc_read()
1073 switch (token->security_index) { in rxrpc_read()
1077 toksize += RND(token->kad->ticket_len); in rxrpc_read()
1081 princ = &token->k5->client; in rxrpc_read()
1087 princ = &token->k5->server; in rxrpc_read()
1093 toksize += 8 + RND(token->k5->session.data_len); in rxrpc_read()
1097 toksize += 4 + token->k5->n_addresses * 8; in rxrpc_read()
1098 for (loop = 0; loop < token->k5->n_addresses; loop++) in rxrpc_read()
1099 toksize += RND(token->k5->addresses[loop].data_len); in rxrpc_read()
1101 toksize += 4 + RND(token->k5->ticket_len); in rxrpc_read()
1102 toksize += 4 + RND(token->k5->ticket2_len); in rxrpc_read()
1104 toksize += 4 + token->k5->n_authdata * 8; in rxrpc_read()
1105 for (loop = 0; loop < token->k5->n_authdata; loop++) in rxrpc_read()
1106 toksize += RND(token->k5->authdata[loop].data_len); in rxrpc_read()
1110 pr_err("Unsupported key token type (%u)\n", in rxrpc_read()
1111 token->security_index); in rxrpc_read()
1115 _debug("token[%u]: toksize=%u", ntoks, toksize); in rxrpc_read()
1119 size += toksize + 4; /* each token has a length word */ in rxrpc_read()
1167 for (token = key->payload.data[0]; token; token = token->next) { in rxrpc_read()
1171 ENCODE(token->security_index); in rxrpc_read()
1173 switch (token->security_index) { in rxrpc_read()
1175 ENCODE(token->kad->vice_id); in rxrpc_read()
1176 ENCODE(token->kad->kvno); in rxrpc_read()
1177 ENCODE_BYTES(8, token->kad->session_key); in rxrpc_read()
1178 ENCODE(token->kad->start); in rxrpc_read()
1179 ENCODE(token->kad->expiry); in rxrpc_read()
1180 ENCODE(token->kad->primary_flag); in rxrpc_read()
1181 ENCODE_DATA(token->kad->ticket_len, token->kad->ticket); in rxrpc_read()
1185 princ = &token->k5->client; in rxrpc_read()
1191 princ = &token->k5->server; in rxrpc_read()
1197 ENCODE(token->k5->session.tag); in rxrpc_read()
1198 ENCODE_DATA(token->k5->session.data_len, in rxrpc_read()
1199 token->k5->session.data); in rxrpc_read()
1201 ENCODE64(token->k5->authtime); in rxrpc_read()
1202 ENCODE64(token->k5->starttime); in rxrpc_read()
1203 ENCODE64(token->k5->endtime); in rxrpc_read()
1204 ENCODE64(token->k5->renew_till); in rxrpc_read()
1205 ENCODE(token->k5->is_skey); in rxrpc_read()
1206 ENCODE(token->k5->flags); in rxrpc_read()
1208 ENCODE(token->k5->n_addresses); in rxrpc_read()
1209 for (loop = 0; loop < token->k5->n_addresses; loop++) { in rxrpc_read()
1210 ENCODE(token->k5->addresses[loop].tag); in rxrpc_read()
1211 ENCODE_DATA(token->k5->addresses[loop].data_len, in rxrpc_read()
1212 token->k5->addresses[loop].data); in rxrpc_read()
1215 ENCODE_DATA(token->k5->ticket_len, token->k5->ticket); in rxrpc_read()
1216 ENCODE_DATA(token->k5->ticket2_len, token->k5->ticket2); in rxrpc_read()
1218 ENCODE(token->k5->n_authdata); in rxrpc_read()
1219 for (loop = 0; loop < token->k5->n_authdata; loop++) { in rxrpc_read()
1220 ENCODE(token->k5->authdata[loop].tag); in rxrpc_read()
1221 ENCODE_DATA(token->k5->authdata[loop].data_len, in rxrpc_read()
1222 token->k5->authdata[loop].data); in rxrpc_read()