More optimisations for EC P-256 "i15" (specialised squaring function, mixed coordinat...
[BearSSL] / src / codec / pemdec.c
index 1dbdf95..04999f2 100644 (file)
@@ -165,15 +165,16 @@ static const uint8_t t0_codeblock[] = {
        0x1A, 0x01, 0x80, 0x7A, 0x0B, 0x10, 0x06, 0x03, 0x01, 0x20, 0x08, 0x00,
        0x01, 0x14, 0x03, 0x00, 0x1A, 0x17, 0x05, 0x05, 0x1F, 0x2E, 0x01, 0x00,
        0x00, 0x2C, 0x14, 0x01, 0x0A, 0x0D, 0x06, 0x06, 0x1F, 0x02, 0x00, 0x1A,
-       0x08, 0x00, 0x2A, 0x17, 0x19, 0x1D, 0x1A, 0x1E, 0x1A, 0x04, 0x62, 0x00,
-       0x18, 0x14, 0x1C, 0x05, 0x01, 0x00, 0x13, 0x11, 0x04, 0x76, 0x00, 0x20,
-       0x19, 0x11, 0x00, 0x00, 0x2C, 0x01, 0x0A, 0x0C, 0x06, 0x02, 0x04, 0x78,
-       0x00, 0x01, 0x01, 0x7F, 0x03, 0x00, 0x2C, 0x14, 0x01, 0x0A, 0x0C, 0x06,
-       0x09, 0x31, 0x05, 0x04, 0x01, 0x00, 0x03, 0x00, 0x04, 0x70, 0x13, 0x02,
-       0x00, 0x00, 0x00, 0x14, 0x06, 0x14, 0x1E, 0x14, 0x21, 0x07, 0x16, 0x01,
-       0x2D, 0x0C, 0x06, 0x08, 0x21, 0x07, 0x1D, 0x01, 0x00, 0x1A, 0x19, 0x00,
-       0x04, 0x69, 0x21, 0x19, 0x00, 0x00, 0x14, 0x01, 0x0A, 0x0C, 0x1A, 0x01,
-       0x20, 0x0B, 0x10, 0x00
+       0x08, 0x00, 0x14, 0x01, 0x0D, 0x0D, 0x06, 0x03, 0x13, 0x04, 0x03, 0x2A,
+       0x17, 0x19, 0x1D, 0x1A, 0x1E, 0x1A, 0x04, 0x59, 0x00, 0x18, 0x14, 0x1C,
+       0x05, 0x01, 0x00, 0x13, 0x11, 0x04, 0x76, 0x00, 0x20, 0x19, 0x11, 0x00,
+       0x00, 0x2C, 0x01, 0x0A, 0x0C, 0x06, 0x02, 0x04, 0x78, 0x00, 0x01, 0x01,
+       0x7F, 0x03, 0x00, 0x2C, 0x14, 0x01, 0x0A, 0x0C, 0x06, 0x09, 0x31, 0x05,
+       0x04, 0x01, 0x00, 0x03, 0x00, 0x04, 0x70, 0x13, 0x02, 0x00, 0x00, 0x00,
+       0x14, 0x06, 0x14, 0x1E, 0x14, 0x21, 0x07, 0x16, 0x01, 0x2D, 0x0C, 0x06,
+       0x08, 0x21, 0x07, 0x1D, 0x01, 0x00, 0x1A, 0x19, 0x00, 0x04, 0x69, 0x21,
+       0x19, 0x00, 0x00, 0x14, 0x01, 0x0A, 0x0C, 0x1A, 0x01, 0x20, 0x0B, 0x10,
+       0x00
 };
 
 static const uint16_t t0_caddr[] = {
@@ -193,12 +194,12 @@ static const uint16_t t0_caddr[] = {
        530,
        540,
        559,
-       594,
-       605,
-       610,
-       620,
-       645,
-       672
+       603,
+       614,
+       619,
+       629,
+       654,
+       681
 };
 
 #define T0_INTERPRETED   28
@@ -224,6 +225,8 @@ name(void *ctx) \
 
 T0_DEFENTRY(br_pem_decoder_init_main, 38)
 
+#define T0_NEXT(t0ipp)   (*(*(t0ipp)) ++)
+
 void
 br_pem_decoder_run(void *t0ctx)
 {
@@ -271,15 +274,17 @@ br_pem_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;