Lines Matching defs:map

103 	 * We keep both b64u and decoded in temp mapped using map / map_b64,
119 args->jws->map.buf[m] = args->temp;
132 args->jws->map.len[m] = (unsigned int)n;
173 lws_jws_map_bzero(struct lws_jws_map *map)
180 if (map->buf[n])
181 lws_explicit_bzero((void *)map->buf[n], map->len[n]);
187 lws_jws_map_bzero(&jws->map);
192 lws_jws_dup_element(struct lws_jws_map *map, int idx, char *temp, int *temp_len,
203 map->len[idx] = (uint32_t)in_len;
204 map->buf[idx] = temp;
212 lws_jws_encode_b64_element(struct lws_jws_map *map, int idx,
225 map->len[idx] = (unsigned int)n;
226 map->buf[idx] = temp;
234 lws_jws_randomize_element(struct lws_context *context, struct lws_jws_map *map,
244 map->len[idx] = (uint32_t)random_len;
245 map->buf[idx] = temp;
258 lws_jws_alloc_element(struct lws_jws_map *map, int idx, char *temp,
267 map->len[idx] = (uint32_t)len;
268 map->buf[idx] = temp;
296 lws_jws_b64_compact_map(const char *in, int len, struct lws_jws_map *map)
300 memset(map, 0, sizeof(*map));
302 map->buf[me] = (char *)in;
303 map->len[me] = 0;
309 map->buf[me] = (char *)in;
310 map->len[me] = 0;
313 map->len[me]++;
319 /* b64 in, map contains decoded elements, if non-NULL,
324 lws_jws_compact_decode(const char *in, int len, struct lws_jws_map *map,
331 map_b64 = map;
334 memset(map, 0, sizeof(*map));
348 /* replace the map entry with the decoded content */
350 map->buf[m] = out;
352 map->buf[m] = NULL;
353 map->len[m++] = (unsigned int)n;
365 lws_jws_compact_decode_map(struct lws_jws_map *map_b64, struct lws_jws_map *map,
377 /* replace the map entry with the decoded content */
378 map->buf[m] = out;
379 map->len[m++] = (unsigned int)n;
414 const struct lws_jws_map *map, /* non-b64 */
420 if (!map->buf[n]) {
425 m = lws_jws_base64_enc(map->buf[n], map->len[n], buf, (size_t)*len);
438 * This takes both a base64 -encoded map and a plaintext map.
445 lws_jws_sig_confirm(struct lws_jws_map *map_b64, struct lws_jws_map *map,
461 if (!map_b64->buf[LJWS_SIG] && !map->buf[LJWS_UHDR])
464 if (lws_jws_parse_jose(&jose, map->buf[LJWS_JOSE], (int)map->len[LJWS_JOSE],
530 (uint8_t *)map->buf[LJWS_SIG],
531 map->len[LJWS_SIG]);
574 if (lws_timingsafe_bcmp(digest, map->buf[2], (uint32_t)h_len)) {
649 (uint8_t *)map->buf[LJWS_SIG],
650 map->len[LJWS_SIG]);
667 /* it's already a b64 map, we will make a temp plain version */
675 struct lws_jws_map map;
678 n = lws_jws_compact_decode_map(map_b64, &map, temp, temp_len);
682 return lws_jws_sig_confirm(map_b64, &map, jwk, context);
692 struct lws_jws_map *map, struct lws_jwk *jwk,
702 n = lws_jws_compact_decode(in, (int)len, map, &map_b64, temp, temp_len);
706 return lws_jws_sig_confirm(&map_b64, map, jwk, context);
712 lws_jws_sig_confirm_compact(struct lws_jws_map *map, struct lws_jwk *jwk,
718 if (lws_jws_compact_encode(&map_b64, map, temp, temp_len) < 0)
721 return lws_jws_sig_confirm(&map_b64, map, jwk, context);
736 return lws_jws_sig_confirm(&jws->map_b64, &jws->map, jwk, context);
972 n = (size_t)lws_jws_compact_decode(com, (int)len, &jws.map, &jws.map_b64,
986 if (lws_jws_parse_jose(&jose, jws.map.buf[LJWS_JOSE],
987 (int)jws.map.len[LJWS_JOSE], temp, &tl) < 0) {
1015 if (lws_jws_sig_confirm(&jws.map_b64, &jws.map, jwk, ctx) < 0) {
1023 if (*out_len < jws.map.len[LJWS_PYLD] + 1) {
1029 memcpy(out, jws.map.buf[LJWS_PYLD], jws.map.len[LJWS_PYLD]);
1030 *out_len = jws.map.len[LJWS_PYLD];
1031 out[jws.map.len[LJWS_PYLD]] = '\0';
1070 if (lws_jws_alloc_element(&jws.map, LJWS_JOSE, info->temp, &tlr,
1084 jws.map.len[LJWS_JOSE] = (uint32_t)lws_snprintf(
1085 (char *)jws.map.buf[LJWS_JOSE], (size_t)otl,
1099 memcpy((char *)jws.map.buf[LJWS_JOSE], info->jose_hdr,
1101 jws.map.len[LJWS_JOSE] = (uint32_t)actual_hdr_len;
1120 /* add the plaintext from stdin to the map and a b64 version */
1122 jws.map.buf[LJWS_PYLD] = q;
1123 jws.map.len[LJWS_PYLD] = (uint32_t)n;
1126 jws.map.buf[LJWS_PYLD],
1127 jws.map.len[LJWS_PYLD]))
1133 /* add the b64 JOSE header to the b64 map */
1136 jws.map.buf[LJWS_JOSE],
1137 jws.map.len[LJWS_JOSE]))
1143 /* prepare the space for the b64 signature in the map */
1173 jws.map.buf[LJWS_PYLD] = NULL;
1174 jws.map.len[LJWS_PYLD] = 0;