X-Git-Url: https://www.bearssl.org/gitweb//home/git/?p=BearSSL;a=blobdiff_plain;f=src%2Fx509%2Fx509_decoder.c;h=8dd970f13f71548327a1a70a97bc2db8be9e70ae;hp=d81bba2f1db47c32d24be4749fca00ef6230cba1;hb=6433cc2e9dff891a2e4669cf50cec36bcf0bae61;hpb=3210f38e0491b39aec1ef419cb4114e9483089fb diff --git a/src/x509/x509_decoder.c b/src/x509/x509_decoder.c index d81bba2..8dd970f 100644 --- a/src/x509/x509_decoder.c +++ b/src/x509/x509_decoder.c @@ -58,7 +58,7 @@ t0_parse7E_signed(const unsigned char **p) #define T0_INT4(x) T0_VBYTE(x, 21), T0_VBYTE(x, 14), T0_VBYTE(x, 7), T0_FBYTE(x, 0) #define T0_INT5(x) T0_SBYTE(x), T0_VBYTE(x, 21), T0_VBYTE(x, 14), T0_VBYTE(x, 7), T0_FBYTE(x, 0) -static const uint8_t t0_datablock[]; +/* static const unsigned char t0_datablock[]; */ void br_x509_decoder_init_main(void *t0ctx); @@ -75,7 +75,7 @@ void br_x509_decoder_run(void *t0ctx); #include "inner.h" -#define CTX ((br_x509_decoder_context *)((unsigned char *)t0ctx - offsetof(br_x509_decoder_context, cpu))) +#define CTX ((br_x509_decoder_context *)(void *)((unsigned char *)t0ctx - offsetof(br_x509_decoder_context, cpu))) #define CONTEXT_NAME br_x509_decoder_context /* see bearssl_x509.h */ @@ -110,7 +110,7 @@ br_x509_decoder_push(br_x509_decoder_context *ctx, -static const uint8_t t0_datablock[] = { +static const unsigned char t0_datablock[] = { 0x00, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x05, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0E, 0x09, 0x2A, 0x86, 0x48, 0x86, @@ -129,7 +129,7 @@ static const uint8_t t0_datablock[] = { 0x29, 0xFF, 0x03, 0x55, 0x1D, 0x13 }; -static const uint8_t t0_codeblock[] = { +static const unsigned char t0_codeblock[] = { 0x00, 0x01, 0x00, 0x10, 0x00, 0x00, 0x01, 0x00, 0x11, 0x00, 0x00, 0x01, 0x01, 0x09, 0x00, 0x00, 0x01, 0x01, 0x0A, 0x00, 0x00, 0x1A, 0x1A, 0x00, 0x00, 0x01, T0_INT1(BR_ERR_X509_BAD_BOOLEAN), 0x00, 0x00, 0x01, @@ -238,7 +238,7 @@ static const uint8_t t0_codeblock[] = { 0x1A, 0x02, 0x00, 0x02, 0x01, 0x0A, 0x00, 0x01, 0x72, 0x1B, 0x01, 0x81, 0x00, 0x0D, 0x06, 0x01, 0x00, 0x01, 0x81, 0x00, 0x0A, 0x1B, 0x05, 0x02, 0x31, 0x1D, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x12, 0x06, - 0x19, 0x02, 0x00, 0x2A, 0x03, 0x00, 0x1B, 0x01, 0x87, 0xFF, 0xFF, 0x7F, + 0x19, 0x02, 0x00, 0x2A, 0x03, 0x00, 0x1B, 0x01, 0x83, 0xFF, 0xFF, 0x7F, 0x12, 0x06, 0x02, 0x32, 0x1D, 0x01, 0x08, 0x0E, 0x26, 0x72, 0x23, 0x09, 0x04, 0x60, 0x00, 0x00, 0x6A, 0x5E, 0x00, 0x00, 0x6B, 0x7A, 0x00, 0x00, 0x70, 0x4E, 0x6B, 0x00, 0x01, 0x6B, 0x1B, 0x05, 0x02, 0x36, 0x1D, 0x72, @@ -372,6 +372,8 @@ name(void *ctx) \ T0_DEFENTRY(br_x509_decoder_init_main, 92) +#define T0_NEXT(t0ipp) (*(*(t0ipp)) ++) + void br_x509_decoder_run(void *t0ctx) { @@ -419,15 +421,17 @@ br_x509_decoder_run(void *t0ctx) #define T0_CO() do { \ goto t0_exit; \ } while (0) -#define T0_RET() break +#define T0_RET() goto t0_next dp = ((t0_context *)t0ctx)->dp; rp = ((t0_context *)t0ctx)->rp; ip = ((t0_context *)t0ctx)->ip; + goto t0_next; for (;;) { uint32_t t0x; - t0x = t0_parse7E_unsigned(&ip); + t0_next: + t0x = T0_NEXT(&ip); if (t0x < T0_INTERPRETED) { switch (t0x) { int32_t t0off; @@ -739,7 +743,7 @@ br_x509_decoder_run(void *t0ctx) /* set32 */ uint32_t addr = T0_POP(); - *(uint32_t *)((unsigned char *)CTX + addr) = T0_POP(); + *(uint32_t *)(void *)((unsigned char *)CTX + addr) = T0_POP(); } break;