You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Ahh, ok, so you do call AES128_CBC_encrypt_buffer(buffer, in, 128, key, iv); on the data?

    Maybe just simplify to this:

    static void test_encrypt_cbc(void)
    {
      uint8_t in[128]  = { 0x7B, 0x22, 0x50, 0x48, 0x22, 0x3A, 0x5B, 0x22, 0x52, 0x65, 0x73, 0x75, 0x6C, 0x74, 0x22, 0x2C,
                           0x35, 0x2E, 0x35, 0x5D, 0x2C, 0x22, 0x45, 0x43, 0x22, 0x3A, 0x5B, 0x22, 0x52, 0x65, 0x73, 0x75,
                           0x6C, 0x74, 0x22, 0x2C, 0x37, 0x30, 0x30, 0x5D, 0x2C, 0x22, 0x52, 0x65, 0x73, 0x54, 0x65, 0x6D,
                           0x70, 0x22, 0x3A, 0x5B, 0x22, 0x52, 0x65, 0x73, 0x75, 0x6C, 0x74, 0x22, 0x2C, 0x31, 0x33, 0x37,
                           0x2E, 0x35, 0x5D, 0x7D, 0x30 };
      int i;
      
      jsiConsolePrint(in);
      jsiConsolePrint("\n int: ");
      for(i = 0; i < 128; ++i)
        jsiConsolePrintf("%d,", (int)in[i]);
      jsiConsolePrintf("\n");
      jsiConsolePrint("\n int as hex: ");
      for(i = 0; i < 128; ++i)
        jsiConsolePrintf("%x,", (int)in[i]);
      jsiConsolePrintf("\n");
    
      jsiConsolePrint("\n int as char: ");
      for(i = 0; i < 128; ++i)
        jsiConsolePrintf("%c,", (int)in[i]);
      jsiConsolePrintf("\n");
      int n = sizeof(in);
      jsiConsolePrint(n);
    }
    

    and make sure the correct data is output? My guess is AES128_CBC_encrypt_buffer might be fiddling with the data inside in

About

Avatar for Gordon @Gordon started