Lines Matching refs:builder
139 static int jwt_add_header(struct jwt_builder *builder) in jwt_add_header() argument
155 if (jwt_header_len > builder->len) { in jwt_add_header()
156 builder->overflowed = true; in jwt_add_header()
159 strcpy(builder->buf, jwt_header); in jwt_add_header()
160 builder->buf += jwt_header_len - 1; in jwt_add_header()
161 builder->len -= jwt_header_len - 1; in jwt_add_header()
165 int jwt_add_payload(struct jwt_builder *builder, in jwt_add_payload() argument
176 base64_outch(builder, '.'); in jwt_add_payload()
179 &payload, base64_append_bytes, builder); in jwt_add_payload()
181 base64_flush(builder); in jwt_add_payload()
185 int jwt_sign(struct jwt_builder *builder, in jwt_sign() argument
192 ret = jwt_sign_impl(builder, der_key, der_key_len, sig, sizeof(sig)); in jwt_sign()
197 base64_outch(builder, '.'); in jwt_sign()
198 base64_append_bytes(sig, sizeof(sig), builder); in jwt_sign()
199 base64_flush(builder); in jwt_sign()
201 return builder->overflowed ? -ENOMEM : 0; in jwt_sign()
204 int jwt_init_builder(struct jwt_builder *builder, in jwt_init_builder() argument
208 builder->base = buffer; in jwt_init_builder()
209 builder->buf = buffer; in jwt_init_builder()
210 builder->len = buffer_size; in jwt_init_builder()
211 builder->overflowed = false; in jwt_init_builder()
212 builder->pending = 0; in jwt_init_builder()
214 return jwt_add_header(builder); in jwt_init_builder()