aboutsummaryrefslogblamecommitdiff
path: root/sw/test-modexp-for-pavel.h
blob: 79889ee73e9489a1669a08698119bcb57f933f98 (plain) (tree)











































































































































                                                                            
/*
 * Test vectors.  First should be same as in test-rsa.h, for check.
 */

/*
 * Message #0
 * Plaintext: "You can hack anything you want with TECO and DDT."
 * SHA-256: 8e36fc9aa31724c32416263c0366a175fabbb92b741ca6496107074d0343b597
 */

static const uint8_t m_1024_0[] = { /* message to be signed, 128 bytes */
  0x00, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0xff, 0xff, 0xff, 0x00, 0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60,
  0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x04, 0x20,
  0x8e, 0x36, 0xfc, 0x9a, 0xa3, 0x17, 0x24, 0xc3, 0x24, 0x16, 0x26, 0x3c,
  0x03, 0x66, 0xa1, 0x75, 0xfa, 0xbb, 0xb9, 0x2b, 0x74, 0x1c, 0xa6, 0x49,
  0x61, 0x07, 0x07, 0x4d, 0x03, 0x43, 0xb5, 0x97
};

static const uint8_t s_1024_0[] = { /* signed message, 128 bytes */
  0x3b, 0x09, 0xcc, 0x3d, 0x2f, 0xa1, 0x68, 0x1c, 0xa9, 0x29, 0x1b, 0xb7,
  0xcf, 0xc9, 0xe7, 0xb4, 0xfd, 0x3e, 0x5a, 0x22, 0x1c, 0x29, 0xdf, 0x4a,
  0x32, 0xcf, 0xa5, 0xae, 0x30, 0xd4, 0xee, 0x8f, 0x3a, 0xc8, 0xc1, 0xee,
  0x79, 0x40, 0xb2, 0xbf, 0xc7, 0x12, 0x82, 0x73, 0x3c, 0x6b, 0x8a, 0xd1,
  0xa4, 0x4a, 0x6d, 0x60, 0x9f, 0x00, 0xb4, 0x51, 0x8b, 0x6c, 0xcd, 0xae,
  0xad, 0xf4, 0x0a, 0x48, 0xd5, 0xb9, 0x4b, 0x9e, 0xca, 0x77, 0x10, 0xc2,
  0x9b, 0x26, 0x8c, 0x65, 0x17, 0x96, 0xd0, 0xc7, 0x5e, 0x55, 0x20, 0x17,
  0x06, 0x74, 0x2d, 0x94, 0xe0, 0xfc, 0x09, 0xa2, 0xb1, 0x94, 0xe4, 0x83,
  0x0d, 0x8d, 0x9e, 0x26, 0x0a, 0x25, 0x93, 0xfb, 0xef, 0x4f, 0xb3, 0x0e,
  0x7a, 0x9b, 0x2f, 0x17, 0x94, 0xd8, 0xca, 0x64, 0x1e, 0xa6, 0x2e, 0xc9,
  0xf3, 0x54, 0x87, 0x34, 0xed, 0xf7, 0xa5, 0x00
};

/*
 * Message #1
 * Plaintext: "$U in and begin to hack."
 * SHA-256: 6592ba987edef196b98beed2f618198b109ad93d9a32939e2134863f4f7aff4a
 */

static const uint8_t m_1024_1[] = { /* message to be signed, 128 bytes */
  0x00, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0xff, 0xff, 0xff, 0x00, 0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60,
  0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x04, 0x20,
  0x65, 0x92, 0xba, 0x98, 0x7e, 0xde, 0xf1, 0x96, 0xb9, 0x8b, 0xee, 0xd2,
  0xf6, 0x18, 0x19, 0x8b, 0x10, 0x9a, 0xd9, 0x3d, 0x9a, 0x32, 0x93, 0x9e,
  0x21, 0x34, 0x86, 0x3f, 0x4f, 0x7a, 0xff, 0x4a
};

static const uint8_t s_1024_1[] = { /* signed message, 128 bytes */
  0x30, 0x23, 0x3d, 0x81, 0xa0, 0xa5, 0xc3, 0xcc, 0x48, 0xb2, 0x69, 0xe6,
  0xe8, 0xb1, 0xc7, 0x34, 0xed, 0x56, 0xc6, 0x3b, 0xfb, 0xfe, 0x2f, 0xba,
  0x1d, 0xa5, 0x3f, 0x18, 0xa8, 0xb9, 0xd6, 0x80, 0x2f, 0x30, 0x39, 0x54,
  0x00, 0xed, 0x1b, 0x54, 0x4e, 0x28, 0x90, 0xc6, 0xe6, 0x58, 0x43, 0x1b,
  0x84, 0x94, 0x59, 0x46, 0xc2, 0xb3, 0x22, 0x38, 0x49, 0xf9, 0x2a, 0x7f,
  0xfc, 0xef, 0xe7, 0xb4, 0x6e, 0x77, 0xf9, 0x9c, 0x41, 0x79, 0x65, 0x72,
  0x18, 0xa4, 0xb6, 0x98, 0x28, 0x98, 0xba, 0xfe, 0xdc, 0x71, 0x8f, 0x58,
  0x2f, 0x6d, 0x25, 0x67, 0x35, 0x23, 0x6a, 0x98, 0xbb, 0xfa, 0x3b, 0x13,
  0x3b, 0x6f, 0x4b, 0x2a, 0x1e, 0x59, 0x7b, 0x0b, 0x62, 0x45, 0xe2, 0x4e,
  0xc1, 0x9d, 0x66, 0x38, 0x71, 0xca, 0xcf, 0x91, 0x66, 0x7d, 0x81, 0xf4,
  0x78, 0x68, 0x41, 0x08, 0xd1, 0xad, 0xda, 0xf0
};

/*
 * Message #2
 * Plaintext: "Twiddle bits in a core dump and write 'em back."
 * SHA-256: 0633b9805544473dd4169773ff708f3868eb7f0ecbda0349012ea6ff7798b7b4
 */

static const uint8_t m_1024_2[] = { /* message to be signed, 128 bytes */
  0x00, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0xff, 0xff, 0xff, 0x00, 0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60,
  0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x04, 0x20,
  0x06, 0x33, 0xb9, 0x80, 0x55, 0x44, 0x47, 0x3d, 0xd4, 0x16, 0x97, 0x73,
  0xff, 0x70, 0x8f, 0x38, 0x68, 0xeb, 0x7f, 0x0e, 0xcb, 0xda, 0x03, 0x49,
  0x01, 0x2e, 0xa6, 0xff, 0x77, 0x98, 0xb7, 0xb4
};

static const uint8_t s_1024_2[] = { /* signed message, 128 bytes */
  0x6b, 0x29, 0x54, 0xa3, 0x05, 0x5a, 0x92, 0xa5, 0x65, 0x00, 0x72, 0x3a,
  0xdf, 0x85, 0x11, 0x47, 0x96, 0x7f, 0x67, 0x38, 0xf0, 0xae, 0x06, 0xe4,
  0x7e, 0x99, 0xc3, 0x17, 0x85, 0x7d, 0x03, 0xbe, 0xf8, 0xae, 0x1e, 0x89,
  0x99, 0x9e, 0x03, 0xb3, 0xe0, 0xfb, 0x15, 0xce, 0xed, 0x11, 0x21, 0xc4,
  0x20, 0x0d, 0x35, 0x84, 0xcc, 0xba, 0x53, 0xe0, 0x88, 0x5b, 0xa6, 0x25,
  0xdb, 0xa5, 0x6e, 0x4f, 0x06, 0xce, 0x81, 0xf7, 0x15, 0x15, 0x54, 0x15,
  0x11, 0x0d, 0x67, 0x73, 0x08, 0xd0, 0x15, 0x22, 0x8d, 0xef, 0x46, 0xda,
  0x61, 0x29, 0xc6, 0xe7, 0x37, 0x63, 0x2d, 0x0a, 0x82, 0x79, 0x17, 0xed,
  0xf4, 0x07, 0x79, 0xa2, 0x56, 0xb2, 0xbb, 0xf5, 0x4a, 0x40, 0x34, 0xec,
  0x9a, 0x92, 0x8f, 0xd4, 0x66, 0xc1, 0x83, 0xe0, 0x45, 0xa8, 0xe6, 0x4e,
  0x52, 0xb1, 0x11, 0xe9, 0x17, 0xc0, 0xcb, 0x5c
};

/*
 * Message #3
 * Plaintext: "(But be careful typing <RET>)"
 * SHA-256: 524bb716e35f7ca6e54fa59c75e395d4e6a9a567e2c928aa34c7ef7b09ed7b45
 */

static const uint8_t m_1024_3[] = { /* message to be signed, 128 bytes */
  0x00, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0xff, 0xff, 0xff, 0x00, 0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60,
  0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x04, 0x20,
  0x52, 0x4b, 0xb7, 0x16, 0xe3, 0x5f, 0x7c, 0xa6, 0xe5, 0x4f, 0xa5, 0x9c,
  0x75, 0xe3, 0x95, 0xd4, 0xe6, 0xa9, 0xa5, 0x67, 0xe2, 0xc9, 0x28, 0xaa,
  0x34, 0xc7, 0xef, 0x7b, 0x09, 0xed, 0x7b, 0x45
};

static const uint8_t s_1024_3[] = { /* signed message, 128 bytes */
  0x56, 0x20, 0xa9, 0xd5, 0x0e, 0x61, 0xa4, 0xb6, 0xfc, 0x8a, 0xf6, 0x27,
  0x40, 0x3c, 0x8c, 0x7a, 0x3f, 0x27, 0xdb, 0x1e, 0xb8, 0xf7, 0xf1, 0x35,
  0x21, 0xbc, 0xcd, 0x0d, 0xd9, 0x39, 0x98, 0x40, 0x1c, 0x48, 0x19, 0x85,
  0x57, 0xed, 0xa2, 0x59, 0x9d, 0xef, 0x13, 0x4c, 0xe7, 0x9e, 0x8b, 0x15,
  0x66, 0xce, 0xbf, 0x57, 0xcf, 0x43, 0x00, 0xf4, 0xb3, 0xf4, 0x6b, 0xcd,
  0x77, 0x34, 0xdd, 0xbd, 0x13, 0xdf, 0xe7, 0xf5, 0xb1, 0xe7, 0xa0, 0x2c,
  0xfc, 0x03, 0x00, 0x33, 0x78, 0x51, 0x28, 0x0c, 0x7c, 0x8a, 0x8b, 0xaa,
  0x8d, 0xb2, 0x72, 0x43, 0x54, 0x19, 0xf2, 0xf2, 0x53, 0xba, 0x16, 0x64,
  0x65, 0x69, 0xbd, 0xc4, 0x26, 0x08, 0xa2, 0x12, 0x4d, 0xbd, 0x6f, 0x9d,
  0x2f, 0x9d, 0x34, 0x41, 0xa8, 0x5f, 0x92, 0xa1, 0xc8, 0xa4, 0x27, 0xa8,
  0x34, 0x26, 0x3d, 0x4e, 0x6d, 0xc4, 0x0e, 0x66
};