chibipub

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 1e03f93c8732849b6926e61f656273788977816c
parent 47166a2b14176d09ea27a8758db9c6321f5db35a
Author: William Casarin <jb55@jb55.com>
Date:   Sun, 17 Jan 2021 11:26:31 -0800

sigcheck: remove old stuff

Diffstat:
Msrc/sigcheck.c | 53+----------------------------------------------------
1 file changed, 1 insertion(+), 52 deletions(-)

diff --git a/src/sigcheck.c b/src/sigcheck.c @@ -15,56 +15,6 @@ #include <ctype.h> -static int push_header(struct ubjson *ubjson, struct cursor *arena, - unsigned char *header, int header_len) -{ - char tmp[32]={0}; - const char *path[2]; - struct json val; - - if (header_len >= sizeof(tmp)-1) { - note_error(&ubjson->errs, "header name (len %d) %.*s overflows tmp buf", - header_len, header_len, header); - return 0; - } - - path[0] = "@wsheaders"; - path[1] = tmp; - - strncpy(tmp, (char*)header, header_len); - - if (!ubjson_lookup(ubjson, path, 2, &val)) { - note_error(&ubjson->errs, "header %s not found", path[1]); - return 0; - } - - return push_data(arena, (unsigned char*)val.string, val.len); -} - -static int build_sigbuf(struct sig_header *sig, struct ubjson *ubjson, - struct cursor *arena, unsigned char **sigbuf, int *sigbuf_len) -{ - unsigned char *p, *pstart; - - *sigbuf = arena->p; - pstart = p = (unsigned char*)sig->headers; - for (;; p++) { - if (*p == ' ' || *p == 0) { - if (!push_header(ubjson, arena, pstart, p-pstart)) { - return 0; - } - pstart = p+1; - } - - if (*p == 0) - break; - } - - *sigbuf_len = arena->p - *sigbuf; - - return 1; -} - static int verify_signature(struct cursor cur, struct cursor *arena) { struct ubjson ubjson; @@ -101,8 +51,7 @@ int sigcheck(struct sigcheck *check) init_json_parser(&jsonp, p, flen, &handlers); while (parse_json(&jsonp)) { - printf("success! %d\n", ++count); - + printf("success #%d\n", ++count); if (!verify_signature(out_cur, &out_cur)) { printf("bad signature\n"); }