Lines Matching refs:hdr
93 struct asn1_hdr hdr; in pkcs5_get_params_pbes2() local
109 if (asn1_get_next(pos, enc_alg_end - pos, &hdr) < 0 || in pkcs5_get_params_pbes2()
110 !asn1_is_sequence(&hdr)) { in pkcs5_get_params_pbes2()
111 asn1_unexpected(&hdr, in pkcs5_get_params_pbes2()
115 pos = hdr.payload; in pkcs5_get_params_pbes2()
116 end = hdr.payload + hdr.length; in pkcs5_get_params_pbes2()
118 if (asn1_get_next(pos, end - pos, &hdr) < 0 || in pkcs5_get_params_pbes2()
119 !asn1_is_sequence(&hdr)) { in pkcs5_get_params_pbes2()
120 asn1_unexpected(&hdr, in pkcs5_get_params_pbes2()
125 pos = hdr.payload; in pkcs5_get_params_pbes2()
126 kdf_end = end = hdr.payload + hdr.length; in pkcs5_get_params_pbes2()
159 if (asn1_get_next(pos, end - pos, &hdr) < 0 || in pkcs5_get_params_pbes2()
160 !asn1_is_sequence(&hdr)) { in pkcs5_get_params_pbes2()
161 asn1_unexpected(&hdr, in pkcs5_get_params_pbes2()
166 pos = hdr.payload; in pkcs5_get_params_pbes2()
167 end = hdr.payload + hdr.length; in pkcs5_get_params_pbes2()
170 if (asn1_get_next(pos, end - pos, &hdr) < 0 || in pkcs5_get_params_pbes2()
171 !asn1_is_octetstring(&hdr) || in pkcs5_get_params_pbes2()
172 hdr.length > sizeof(params->salt)) { in pkcs5_get_params_pbes2()
173 asn1_unexpected(&hdr, in pkcs5_get_params_pbes2()
177 pos = hdr.payload + hdr.length; in pkcs5_get_params_pbes2()
178 os_memcpy(params->salt, hdr.payload, hdr.length); in pkcs5_get_params_pbes2()
179 params->salt_len = hdr.length; in pkcs5_get_params_pbes2()
183 if (asn1_get_next(pos, end - pos, &hdr) < 0 || !asn1_is_integer(&hdr)) { in pkcs5_get_params_pbes2()
184 asn1_unexpected(&hdr, "PKCS #5: Expected INTEGER"); in pkcs5_get_params_pbes2()
187 if (hdr.length == 1) { in pkcs5_get_params_pbes2()
188 params->iter_count = *hdr.payload; in pkcs5_get_params_pbes2()
189 } else if (hdr.length == 2) { in pkcs5_get_params_pbes2()
190 params->iter_count = WPA_GET_BE16(hdr.payload); in pkcs5_get_params_pbes2()
191 } else if (hdr.length == 4) { in pkcs5_get_params_pbes2()
192 params->iter_count = WPA_GET_BE32(hdr.payload); in pkcs5_get_params_pbes2()
196 hdr.payload, hdr.length); in pkcs5_get_params_pbes2()
213 if (asn1_get_next(pos, enc_alg_end - pos, &hdr) < 0 || in pkcs5_get_params_pbes2()
214 !asn1_is_sequence(&hdr)) { in pkcs5_get_params_pbes2()
215 asn1_unexpected(&hdr, in pkcs5_get_params_pbes2()
220 pos = hdr.payload; in pkcs5_get_params_pbes2()
221 end = hdr.payload + hdr.length; in pkcs5_get_params_pbes2()
247 if (asn1_get_next(pos, end - pos, &hdr) < 0 || in pkcs5_get_params_pbes2()
248 !asn1_is_octetstring(&hdr) || hdr.length != 8) { in pkcs5_get_params_pbes2()
249 asn1_unexpected(&hdr, in pkcs5_get_params_pbes2()
253 os_memcpy(params->iv, hdr.payload, hdr.length); in pkcs5_get_params_pbes2()
254 params->iv_len = hdr.length; in pkcs5_get_params_pbes2()
264 struct asn1_hdr hdr; in pkcs5_get_params() local
309 if (asn1_get_next(pos, enc_alg_end - pos, &hdr) < 0 || in pkcs5_get_params()
310 !asn1_is_sequence(&hdr)) { in pkcs5_get_params()
311 asn1_unexpected(&hdr, in pkcs5_get_params()
315 pos = hdr.payload; in pkcs5_get_params()
316 end = hdr.payload + hdr.length; in pkcs5_get_params()
319 if (asn1_get_next(pos, end - pos, &hdr) < 0 || in pkcs5_get_params()
320 !asn1_is_octetstring(&hdr) || hdr.length > sizeof(params->salt)) { in pkcs5_get_params()
321 asn1_unexpected(&hdr, in pkcs5_get_params()
325 pos = hdr.payload + hdr.length; in pkcs5_get_params()
326 os_memcpy(params->salt, hdr.payload, hdr.length); in pkcs5_get_params()
327 params->salt_len = hdr.length; in pkcs5_get_params()
332 if (asn1_get_next(pos, end - pos, &hdr) < 0 || in pkcs5_get_params()
333 !asn1_is_integer(&hdr)) { in pkcs5_get_params()
334 asn1_unexpected(&hdr, "PKCS #5: Expected INTEGER"); in pkcs5_get_params()
337 if (hdr.length == 1) in pkcs5_get_params()
338 params->iter_count = *hdr.payload; in pkcs5_get_params()
339 else if (hdr.length == 2) in pkcs5_get_params()
340 params->iter_count = WPA_GET_BE16(hdr.payload); in pkcs5_get_params()
341 else if (hdr.length == 4) in pkcs5_get_params()
342 params->iter_count = WPA_GET_BE32(hdr.payload); in pkcs5_get_params()
346 hdr.payload, hdr.length); in pkcs5_get_params()