Add the performance test function of SVA mode of RSA, DH, ECC algorithms for HPRE module.
Signed-off-by: Longfang Liu liulongfang@huawei.com --- uadk_tool/benchmark/hpre_protocol_data.h | 1667 ++++++++++++++ uadk_tool/benchmark/hpre_uadk_benchmark.c | 2433 +++++++++++++++++++++ uadk_tool/benchmark/hpre_uadk_benchmark.h | 6 + 3 files changed, 4106 insertions(+) create mode 100644 uadk_tool/benchmark/hpre_protocol_data.h create mode 100644 uadk_tool/benchmark/hpre_uadk_benchmark.c create mode 100644 uadk_tool/benchmark/hpre_uadk_benchmark.h
diff --git a/uadk_tool/benchmark/hpre_protocol_data.h b/uadk_tool/benchmark/hpre_protocol_data.h new file mode 100644 index 0000000..2678a08 --- /dev/null +++ b/uadk_tool/benchmark/hpre_protocol_data.h @@ -0,0 +1,1667 @@ +/* SPDX-License-Identifier: Apache-2.0 */ +#ifndef HPRE_PROTOCOL_DATA_H +#define HPRE_PROTOCOL_DATA_H + +static unsigned char rsa_e_1024[] = { + 0x01, 0x00, 0x01, +}; + +static unsigned char rsa_p_1024[] = { + 0xf6, 0x49, 0xf2, 0xec, 0x89, 0xc8, 0xc2, 0x9b, 0x38, 0xd8, 0x74, 0x9b, 0x77, 0xed, 0x96, 0xc7, + 0x6d, 0xed, 0x15, 0x51, 0x2d, 0xfe, 0x67, 0x10, 0xa5, 0xdf, 0xd0, 0x59, 0x79, 0x75, 0x00, 0x60, + 0x3d, 0xd0, 0xf6, 0xe4, 0xda, 0x16, 0x5a, 0x24, 0x14, 0x01, 0xfa, 0x19, 0x07, 0x75, 0x21, 0x70, + 0x88, 0x40, 0xd9, 0x2f, 0xec, 0x83, 0x9e, 0x5f, 0xaa, 0xc0, 0xa3, 0x70, 0x18, 0xf5, 0x78, 0xdf, +}; + +static unsigned char rsa_q_1024[] = { + 0xcf, 0x53, 0x52, 0x09, 0x0d, 0xd7, 0x84, 0xdb, 0xa4, 0x4c, 0x79, 0x74, 0x0d, 0x94, 0xa0, 0x19, + 0x94, 0x33, 0xbf, 0x39, 0xe5, 0xef, 0xf5, 0xe9, 0x6c, 0xef, 0xd0, 0x9a, 0x4c, 0x00, 0x14, 0x68, + 0x66, 0xa7, 0x80, 0x32, 0x14, 0x84, 0xc9, 0x6f, 0x9a, 0x7d, 0x43, 0x0e, 0x9f, 0x85, 0x27, 0x6c, + 0x65, 0x50, 0x9b, 0x88, 0x54, 0x22, 0x72, 0x95, 0x90, 0x26, 0xc4, 0xa8, 0x19, 0x1c, 0x47, 0x03, +}; + +static unsigned char rsa_dp_1024[] = { + 0xd0, 0xb6, 0x66, 0x28, 0xd1, 0xb2, 0xd2, 0x48, 0x1c, 0x6a, 0x42, 0x97, 0x25, 0x90, 0xb0, 0x40, + 0x1d, 0x05, 0xd7, 0x14, 0xce, 0x77, 0x52, 0xfc, 0x26, 0xb5, 0x7e, 0xa8, 0xf4, 0x66, 0x94, 0x84, + 0xfa, 0x9d, 0xc5, 0x3c, 0xb7, 0x1c, 0x4e, 0x13, 0x58, 0xe9, 0x3b, 0xfa, 0x4d, 0xf9, 0x92, 0xf6, + 0xfc, 0x60, 0x88, 0x2d, 0x36, 0xaf, 0x6b, 0x5d, 0x03, 0x24, 0xf0, 0xdc, 0x24, 0x2a, 0x91, 0xdd, +}; + +static unsigned char rsa_dq_1024[] = { + 0x09, 0x4a, 0x89, 0x9d, 0xa0, 0x42, 0x2d, 0x51, 0x0e, 0x8e, 0xe2, 0xce, 0x81, 0xa1, 0x4c, 0x7f, + 0x78, 0xf5, 0xcc, 0xb7, 0x12, 0x87, 0xeb, 0x74, 0x57, 0x8e, 0x73, 0xc1, 0xc6, 0x70, 0x26, 0x79, + 0xfb, 0x47, 0xbc, 0x66, 0x02, 0x27, 0x65, 0x43, 0x9c, 0x1f, 0xca, 0xf6, 0x87, 0xcd, 0x96, 0xd3, + 0xb3, 0xc2, 0xa6, 0x05, 0xb9, 0x07, 0x86, 0x2d, 0x0f, 0xb5, 0xbd, 0x10, 0x6f, 0x77, 0xa5, 0xf3, +}; + +static unsigned char rsa_qinv_1024[] = { + 0x59, 0xf3, 0xaf, 0x75, 0xde, 0xdd, 0xcc, 0xc7, 0x62, 0xd7, 0xed, 0x4e, 0x81, 0x18, 0xca, 0x42, + 0xab, 0x36, 0x3b, 0x83, 0x5c, 0xd0, 0x55, 0x3f, 0x37, 0x3a, 0xa9, 0x64, 0x25, 0x65, 0x05, 0xde, + 0x87, 0xca, 0x54, 0xdb, 0x24, 0xdc, 0xe8, 0xf7, 0x4a, 0xfe, 0x2c, 0x59, 0xbf, 0x3d, 0x45, 0x43, + 0x91, 0x9e, 0x6b, 0x9c, 0xf6, 0xce, 0xb2, 0xf8, 0xc5, 0x2e, 0xef, 0x85, 0x58, 0xed, 0x4a, 0x0e, +}; + +static unsigned char rsa_d_1024[] = { + 0x13, 0xbe, 0x3a, 0x33, 0xf3, 0xad, 0x6f, 0xc7, 0x3a, 0x8c, 0x77, 0xe3, 0x73, 0xb8, 0x13, 0xf0, + 0x66, 0x50, 0xd7, 0x04, 0xe5, 0xeb, 0x11, 0x31, 0x97, 0x9b, 0xac, 0xd5, 0x72, 0x9f, 0xe4, 0xeb, + 0xd7, 0x27, 0x9b, 0x2d, 0xef, 0xca, 0xa3, 0x7c, 0xe7, 0x2f, 0x5e, 0xd7, 0xe9, 0x85, 0xbd, 0x88, + 0xce, 0xb6, 0x32, 0xe2, 0xf3, 0xe4, 0x28, 0x0f, 0xc7, 0x8e, 0xa5, 0xbb, 0xc4, 0xd4, 0xe8, 0xd9, + 0x23, 0x81, 0x4c, 0x71, 0x37, 0xc9, 0x78, 0xe2, 0xd8, 0x54, 0x01, 0x05, 0xb9, 0x5e, 0x48, 0xab, + 0x65, 0x76, 0x63, 0xe3, 0x90, 0xaf, 0x25, 0x00, 0xde, 0xe3, 0xb7, 0x6f, 0x91, 0xa1, 0x5e, 0x7a, + 0x84, 0xbf, 0x62, 0x08, 0x63, 0xe7, 0x0a, 0x23, 0x42, 0x50, 0xc8, 0x33, 0x29, 0xb9, 0x27, 0x27, + 0xe6, 0x34, 0x73, 0x69, 0x08, 0x76, 0xaf, 0x65, 0x1e, 0x3b, 0x51, 0xa5, 0x16, 0xad, 0x20, 0xe5, +}; + +static unsigned char rsa_n_1024[] = { + 0xc7, 0x75, 0xf4, 0x53, 0x6b, 0xd4, 0x69, 0x28, 0x39, 0xeb, 0xa7, 0x70, 0xcf, 0x8f, 0x47, 0x54, + 0x57, 0xf9, 0x43, 0xd3, 0xd6, 0x7b, 0xa4, 0xc9, 0x4b, 0xb3, 0x9d, 0xb3, 0x7f, 0x8f, 0x46, 0x31, + 0xf6, 0xbe, 0x62, 0xa4, 0x0c, 0x7e, 0x41, 0x41, 0x2e, 0x4d, 0x31, 0x1a, 0x92, 0xca, 0x69, 0x27, + 0x0a, 0x06, 0x23, 0xf5, 0x0f, 0x50, 0xf0, 0x17, 0xfa, 0x92, 0x25, 0x1c, 0xb6, 0x59, 0x2c, 0xcc, + 0xc9, 0x4d, 0x3c, 0x38, 0x04, 0xbb, 0x05, 0xc5, 0x20, 0xe5, 0xaf, 0x06, 0xd0, 0xc4, 0x14, 0x9c, + 0xa9, 0xa4, 0x7e, 0x97, 0x04, 0xb9, 0xe7, 0x60, 0x47, 0xa2, 0xed, 0xea, 0xda, 0xec, 0x4e, 0x0a, + 0x7a, 0x01, 0x00, 0x19, 0x19, 0x99, 0x49, 0x28, 0x70, 0x07, 0x21, 0xd8, 0x0d, 0x1f, 0x2d, 0xa2, + 0x9d, 0x78, 0x94, 0x26, 0xdd, 0x26, 0x65, 0x66, 0xf3, 0x04, 0xc3, 0x3b, 0x5e, 0xca, 0x43, 0x9d, +}; + +static unsigned char rsa_e_2048[] = { + 0x01, 0x00, 0x01, +}; + +static unsigned char rsa_p_2048[] = { + 0x01, 0xf8, 0x33, 0x75, 0x8c, 0x8d, 0x6b, 0xed, 0x4b, 0xf7, 0x0a, 0x3a, 0x67, 0xd5, 0x91, + 0x27, 0xe6, 0x62, 0x90, 0x67, 0xd2, 0xe3, 0x33, 0xdc, 0xba, 0x96, 0x81, 0xb7, 0xc9, 0xc8, + 0xa6, 0x64, 0x8b, 0xe9, 0x2f, 0x1d, 0x87, 0x3c, 0x9a, 0x95, 0x19, 0x8b, 0x04, 0x8c, 0x1a, + 0xc1, 0x6b, 0x76, 0x8d, 0xe3, 0x2a, 0x50, 0xec, 0xb8, 0xf7, 0x02, 0x38, 0x5d, 0xd0, 0xe6, + 0xc0, 0x9f, 0xb5, 0xc6, 0xf7, 0xd0, 0x34, 0xec, 0xd5, 0x4d, 0xf5, 0x26, 0x32, 0x8a, 0xe8, + 0x5f, 0xd5, 0x1d, 0x0e, 0xd8, 0xcd, 0x84, 0xe0, 0xd6, 0x09, 0x3a, 0xcd, 0x8b, 0x5c, 0x96, + 0x89, 0xf0, 0x2e, 0xb7, 0x87, 0x9c, 0x12, 0xeb, 0xd6, 0x84, 0x00, 0x3d, 0x1c, 0xff, 0xa0, + 0xaa, 0x82, 0x0a, 0x4d, 0x53, 0x06, 0xde, 0x5a, 0x0c, 0x4a, 0xd4, 0x94, 0x5b, 0x01, 0xac, + 0x9f, 0x9e, 0x7e, 0x90, 0xb0, 0xd7, 0x19 +}; + +static unsigned char rsa_q_2048[] = { + 0x01, 0xe1, 0xf1, 0x9b, 0xd6, 0xcf, 0x15, 0x49, 0x4c, 0xfa, 0x90, 0xf1, 0x27, 0xb1, 0xe2, + 0xc9, 0xf8, 0xec, 0x97, 0xc5, 0x10, 0x6c, 0xad, 0x62, 0xba, 0x1b, 0x23, 0x1e, 0x95, 0xb3, + 0x30, 0x89, 0x15, 0xc2, 0x19, 0x9e, 0xa8, 0x06, 0x30, 0xe1, 0xf0, 0x14, 0xfa, 0x99, 0x10, + 0x22, 0x13, 0x43, 0xb1, 0x97, 0xa4, 0x7d, 0x5d, 0x92, 0xa4, 0xf1, 0x28, 0x33, 0xbc, 0x9b, + 0x20, 0xba, 0x73, 0x66, 0x32, 0x96, 0x63, 0xb2, 0x1d, 0x49, 0xe8, 0xbc, 0x2e, 0x88, 0x2b, + 0x9f, 0x89, 0x14, 0xb6, 0x5e, 0xe1, 0xe9, 0x0f, 0x1c, 0xa8, 0xd5, 0xa4, 0xda, 0x61, 0xde, + 0x0c, 0x36, 0xce, 0xf2, 0x89, 0xeb, 0x59, 0xd5, 0xd0, 0xdf, 0x77, 0xb5, 0x14, 0xa6, 0xcf, + 0x35, 0x86, 0xf1, 0x78, 0x1a, 0x8a, 0x52, 0x6f, 0x06, 0x20, 0x17, 0xca, 0xa8, 0xae, 0x4a, + 0x60, 0xf9, 0x89, 0x05, 0xc6, 0x0d, 0x87 +}; + +static unsigned char rsa_dp_2048[] = { + 0x54, 0xd7, 0xb3, 0xec, 0x16, 0xd0, 0x16, 0x7a, 0x35, 0xf3, 0xce, 0xa8, 0x32, 0x53, 0xde, + 0xb6, 0xf1, 0xd7, 0x02, 0xe1, 0x85, 0xc1, 0xf0, 0x5e, 0xa5, 0x7c, 0xe6, 0x84, 0x59, 0xf3, + 0x45, 0xf0, 0x15, 0x29, 0x0c, 0x7a, 0xf9, 0x43, 0xb9, 0xdb, 0x36, 0x7d, 0x69, 0x66, 0x07, + 0x2e, 0x22, 0x20, 0xf6, 0x1c, 0xe4, 0xc9, 0x30, 0xc6, 0xbf, 0xe4, 0xe4, 0x44, 0x86, 0xcf, + 0xdb, 0x10, 0x27, 0x8f, 0x03, 0xc6, 0x24, 0x24, 0x30, 0x9e, 0x13, 0xf3, 0x65, 0x54, 0x7c, + 0xeb, 0xcb, 0x9b, 0xf7, 0xf7, 0x7d, 0x68, 0xa8, 0x1b, 0x9d, 0x7d, 0x80, 0xf9, 0xef, 0x8a, + 0xfe, 0x93, 0x9d, 0xe6, 0x7f, 0xe8, 0xdf, 0x2e, 0x95, 0xbf, 0xc4, 0x88, 0xe0, 0xab, 0x14, + 0x86, 0x15, 0x5d, 0xb5, 0x9e, 0xee, 0x43, 0x90, 0xd5, 0xf6, 0xb7, 0x90, 0x28, 0xd3, 0xf7, + 0x78, 0x20, 0x2c, 0x10, 0xd5, 0xe1 +}; + +static unsigned char rsa_dq_2048[] = { + 0x38, 0x83, 0x81, 0x77, 0xb5, 0xfe, 0xd4, 0x02, 0x9f, 0xdb, 0x41, 0x3c, 0x1b, 0x62, 0xf1, + 0xb6, 0x2b, 0xe0, 0x3c, 0x2e, 0x89, 0xdf, 0xe7, 0x14, 0xd5, 0xbb, 0xcf, 0x89, 0x54, 0x62, + 0xdb, 0xa0, 0x5e, 0x8b, 0x6c, 0x8c, 0x5d, 0x75, 0x7b, 0xf9, 0x10, 0x2c, 0xb6, 0xa8, 0x2a, + 0xa6, 0xc1, 0xa8, 0x60, 0x94, 0xdc, 0x52, 0x8d, 0xb0, 0xa3, 0xca, 0xc8, 0x0e, 0x54, 0xce, + 0x88, 0xae, 0xa1, 0x8c, 0x4b, 0x10, 0x53, 0xc1, 0x95, 0x7a, 0x22, 0x1e, 0xfe, 0xbe, 0xc6, + 0xcd, 0x67, 0x4d, 0x5f, 0x60, 0xf4, 0x58, 0x5e, 0x4e, 0xfa, 0x06, 0x83, 0xc9, 0x38, 0x25, + 0x8c, 0x83, 0xc5, 0xf3, 0x20, 0x52, 0xff, 0x7c, 0xa7, 0xc7, 0xbc, 0xc7, 0x38, 0x2c, 0x52, + 0x25, 0x89, 0xc9, 0x40, 0xab, 0x79, 0xb1, 0x25, 0x31, 0xbc, 0x38, 0x7a, 0x81, 0x3d, 0x9d, + 0x93, 0x85, 0x5a, 0xd4, 0xf7, 0x9f +}; + +static unsigned char rsa_qinv_2048[] = { + 0x01, 0x3d, 0x2b, 0xcc, 0x55, 0x34, 0x6f, 0x0b, 0x2d, 0x84, 0x57, 0x16, 0x50, 0x06, 0x38, + 0x3f, 0xcf, 0x61, 0x25, 0x6d, 0x16, 0xc4, 0x91, 0x0e, 0x28, 0xa4, 0xbe, 0x2e, 0x0a, 0x12, + 0x6a, 0x0b, 0xe7, 0xda, 0x94, 0x12, 0x36, 0x99, 0xbe, 0x3c, 0x51, 0x01, 0x98, 0x84, 0x77, + 0xc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, 0x03, 0xab, 0x54, 0x30, 0x3b, 0x29, 0x91, 0x0f, 0x1c, 0x77, + 0x3a, 0x00, 0xf4, 0xe3, 0xcf, 0xd8, 0x35, 0x3e, 0x0f, 0xd0, 0xd8, 0xf4, 0x50, 0x6e, 0x88, + 0x6a, 0x4f, 0xd0, 0xa8, 0x40, 0x5a, 0x2f, 0x3c, 0x11, 0x4f, 0x43, 0xb0, 0x43, 0x23, 0x20, + 0x36, 0xb7, 0xb2, 0x16, 0xed, 0xbc, 0xb5, 0xc8, 0xde, 0x7e, 0x4a, 0x03, 0x7a, 0xf6, 0xa2, + 0xa8, 0xb6, 0xc0, 0xd0, 0x98, 0x94, 0x7a, 0x81, 0x02, 0xc1, 0xce, 0x0b, 0xed, 0x6e, 0xf1, + 0x5d, 0xb7, 0xb3, 0x9c, 0xa9, 0x88, 0x52, 0xf9, 0xf9, 0xcf, 0xfd, 0x74, 0x6a, 0xa3, 0x3b, + 0x0c, 0xa0, 0x32, 0xd2, 0xb6, 0x31, 0x8b, 0x93, 0x3b, 0x8a, 0x04, 0x2e, 0xdd, 0x14, 0x60, + 0x35, 0xa0, 0xd4, 0xca, 0xdc, 0x9e, 0x96, 0x23, 0xac, 0x64, 0xd5, 0x29, 0xb2, 0x0d, 0x46, + 0x01, 0xe6, 0xf7, 0xa0, 0xe0, 0x9c, 0xfb, 0xde, 0x21, 0xff, 0xff, 0x4f, 0xc0, 0x04, 0x3e, + 0xc4, 0x4b, 0xaf, 0x20, 0x1c, 0x41, 0xce, 0x07, 0x3c, 0x79, 0xfc, 0x6d, 0x7c, 0xef, 0x1e, + 0x37, 0x14, 0x78, 0x9d, 0x26, 0x85, 0x2a, 0xcc, 0x72, 0x22, 0x83, 0xb3, 0x2f +}; + +static unsigned char rsa_n_2048[] = { + 0x03, 0xB5, 0x34, 0x8B, 0x3C, 0xFA, 0x14, 0xD1, 0x38, 0x44, 0xC0, 0xB5, 0xEE, 0x6F, 0xA6, 0x8B, + 0x46, 0x4A, 0x46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 0xCA, 0xDC, 0x9E, 0x96, 0x23, 0xAC, 0x64, 0xD5, 0x29, 0xB2, + 0x0D, 0x46, 0x01, 0xE6, 0xF7, 0xA0, 0xE0, 0x9C, 0xFB, 0xDE, 0x21, 0xFF, 0xFF, 0x4F, 0xC0, 0x04, + 0x3E, 0xC4, 0x4B, 0xAF, 0x20, 0x1C, 0x41, 0xCE, 0x07, 0x3C, 0x79, 0xFC, 0x6D, 0x7C, 0xEF, 0x1E, + 0x37, 0x14, 0x78, 0x9D, 0x26, 0x85, 0x2A, 0xCC, 0x72, 0x22, 0x83, 0xB3, 0x2F +}; + +static unsigned char rsa_e_3072[] = { + 0x01, 0x00, 0x01 +}; + +static unsigned char rsa_p_3072[] = { + 0xfe, 0x2d, 0x13, 0xf6, 0x82, 0xbd, 0xc9, 0x3f, 0xf2, 0x44, 0x87, 0xb0, 0x9c, 0xda, 0xca, 0xb5, + 0xfa, 0x01, 0x6f, 0xf0, 0x3d, 0xd0, 0xd2, 0x1c, 0x40, 0xef, 0xc6, 0x69, 0xe0, 0xe9, 0x66, 0x06, + 0x29, 0x00, 0x7e, 0xe6, 0x0b, 0x1a, 0x02, 0x50, 0x5e, 0x0e, 0x19, 0x5f, 0x6a, 0xf3, 0x0c, 0xa5, + 0x3f, 0xe9, 0xc4, 0x5d, 0x36, 0xc5, 0xbe, 0xc7, 0x77, 0xfc, 0x15, 0x05, 0xb3, 0xa4, 0xc7, 0xd1, + 0xab, 0x3f, 0xfc, 0x42, 0xc3, 0x9a, 0x0e, 0x5a, 0xd8, 0x51, 0xeb, 0x36, 0x2c, 0xf2, 0x07, 0xe3, + 0x5c, 0xcb, 0xe1, 0xf3, 0xd7, 0x67, 0x42, 0x2f, 0x3a, 0x31, 0x21, 0x0f, 0x4e, 0x4d, 0x03, 0x30, + 0xaf, 0xd9, 0x05, 0x03, 0x64, 0x79, 0x7d, 0x7b, 0x96, 0x48, 0xe5, 0x6f, 0x84, 0x44, 0x03, 0x36, + 0x08, 0xf6, 0xe8, 0xb4, 0xa8, 0x7d, 0xb4, 0x63, 0x73, 0x6f, 0x2b, 0x14, 0xb0, 0x6e, 0x0c, 0x96, + 0x3d, 0xe2, 0xda, 0x7f, 0x4f, 0x07, 0xc3, 0xb0, 0x89, 0x53, 0x9d, 0x14, 0x61, 0x17, 0xe6, 0xa4, + 0x52, 0x1a, 0xfb, 0xd4, 0xdd, 0xe0, 0x54, 0x2a, 0xf2, 0x86, 0x30, 0x8c, 0x1c, 0x68, 0x30, 0x72, + 0xcc, 0xa0, 0x3f, 0xe0, 0x14, 0x3d, 0xfc, 0xf2, 0xd9, 0x91, 0xea, 0xe8, 0xe8, 0x9a, 0x78, 0xfb, + 0xa8, 0x16, 0x50, 0x24, 0xfe, 0x54, 0xd4, 0x57, 0xf1, 0xd9, 0x8f, 0xcb, 0x6d, 0x38, 0x63, 0x21 +}; + +static unsigned char rsa_q_3072[] = { + 0xd4, 0x12, 0x12, 0xd1, 0x4e, 0x9e, 0xa8, 0xb4, 0xf3, 0x94, 0x4d, 0x03, 0x70, 0x83, 0x4f, 0x1c, + 0x16, 0x85, 0xd8, 0xa8, 0x8d, 0xcc, 0xfe, 0xde, 0x5d, 0x08, 0xc3, 0xdf, 0xc4, 0xd8, 0xf9, 0x60, + 0x50, 0x9a, 0x58, 0xd5, 0xf5, 0x96, 0xec, 0x95, 0x09, 0x7b, 0x5f, 0x96, 0xaf, 0xf5, 0xee, 0x79, + 0x46, 0x8b, 0x38, 0x2c, 0x9b, 0x17, 0x69, 0x07, 0x91, 0x74, 0x57, 0x73, 0x99, 0xd9, 0x89, 0xa4, + 0x20, 0x0b, 0xb5, 0x7f, 0x30, 0xd7, 0x13, 0xda, 0x0d, 0xc0, 0x3a, 0x96, 0x76, 0xf7, 0xac, 0x86, + 0x5e, 0x1f, 0x5d, 0xd4, 0x54, 0xa0, 0x30, 0xca, 0x36, 0x00, 0x7c, 0xc1, 0xd8, 0x05, 0x73, 0xde, + 0x75, 0x6c, 0xd0, 0x69, 0xe5, 0xfa, 0xd8, 0x24, 0xca, 0xb0, 0xee, 0x8a, 0x63, 0x83, 0x1b, 0x90, + 0xb8, 0x0d, 0x6d, 0xd5, 0x75, 0xe4, 0x5c, 0x73, 0xc7, 0xff, 0xe4, 0x57, 0x6a, 0x59, 0xc3, 0x17, + 0x05, 0xc4, 0xc4, 0x87, 0xc2, 0x11, 0x7a, 0x34, 0xbd, 0xb4, 0x7c, 0x7f, 0x3a, 0x60, 0xd7, 0x57, + 0xcb, 0x48, 0xb1, 0x14, 0xa6, 0x4f, 0x57, 0x35, 0xc7, 0x64, 0xf9, 0xb8, 0x11, 0xe8, 0x22, 0xfd, + 0x6c, 0x53, 0xdd, 0xef, 0x6a, 0x88, 0x56, 0xf7, 0x6d, 0x51, 0xa1, 0x5b, 0x26, 0x81, 0xa0, 0xd4, + 0x78, 0x10, 0x9f, 0x2d, 0x88, 0xdc, 0xa1, 0x09, 0xd0, 0x84, 0x7a, 0x3b, 0x38, 0x7c, 0x5f, 0x75 +}; + +static unsigned char rsa_dp_3072[] = { + 0xfd, 0x8d, 0x3a, 0x3c, 0xce, 0x6f, 0x44, 0x32, 0xe6, 0x1a, 0x36, 0xc1, 0x97, 0xb7, 0x2a, 0x40, + 0x1e, 0x05, 0x11, 0x05, 0x36, 0xa4, 0xf8, 0xf3, 0xf6, 0x53, 0x3a, 0x3a, 0xa4, 0x82, 0x2f, 0xa4, + 0x35, 0x82, 0xa9, 0x14, 0x12, 0x3e, 0xff, 0xcf, 0xec, 0x03, 0x64, 0x8c, 0x2a, 0xc4, 0x09, 0xf9, + 0x4e, 0xa8, 0x83, 0x99, 0xf8, 0xe9, 0x8a, 0x46, 0xb1, 0x0a, 0x66, 0x6e, 0x29, 0xa6, 0x57, 0x2e, + 0x71, 0x06, 0x83, 0x3e, 0x96, 0xa1, 0x37, 0x70, 0xa8, 0x1a, 0x0f, 0xe9, 0x1b, 0x2c, 0xd5, 0x71, + 0x99, 0x40, 0x49, 0x46, 0x55, 0xba, 0x4b, 0xeb, 0x90, 0xc1, 0x31, 0x99, 0x73, 0x22, 0x9f, 0xec, + 0x11, 0x7f, 0x0b, 0xe1, 0x36, 0x79, 0x7b, 0x13, 0xad, 0xf7, 0x49, 0xe8, 0xd4, 0xa8, 0x84, 0x0b, + 0x83, 0x25, 0xcb, 0x3d, 0x6c, 0x56, 0xf9, 0x7b, 0xbb, 0xcb, 0x49, 0xce, 0x79, 0xb1, 0x4e, 0x1d, + 0x11, 0xdf, 0x1a, 0xd7, 0xa4, 0x9e, 0xba, 0x37, 0x80, 0xc6, 0x48, 0x0b, 0xec, 0x4f, 0x4b, 0x64, + 0xe0, 0x02, 0xca, 0xf4, 0xad, 0xe0, 0xfa, 0x15, 0x5d, 0x99, 0x3f, 0x14, 0x85, 0xc1, 0xe9, 0x92, + 0x9b, 0x4d, 0xc0, 0x6a, 0x67, 0xc6, 0xee, 0x6d, 0xd3, 0x5c, 0x1c, 0x59, 0xfa, 0xaf, 0x1d, 0xc0, + 0xed, 0x0c, 0x55, 0x26, 0x92, 0x0f, 0x4d, 0x43, 0xed, 0x9e, 0x7a, 0x33, 0x13, 0xe1, 0x0c, 0x01 +}; + +static unsigned char rsa_dq_3072[] = { + 0x51, 0xfc, 0xde, 0xcb, 0x8e, 0xe2, 0xa6, 0x04, 0xb7, 0x3a, 0xf9, 0x7f, 0x3f, 0xeb, 0x74, 0x15, + 0x3e, 0xdb, 0xe6, 0x44, 0x5b, 0xf6, 0x09, 0xfe, 0xfb, 0xe6, 0xdc, 0x9b, 0x51, 0x66, 0x35, 0x1b, + 0x38, 0x6e, 0x43, 0xb4, 0x0c, 0x6b, 0x99, 0xf1, 0x90, 0xa5, 0xe2, 0xf1, 0xc5, 0xfb, 0x85, 0x83, + 0xdb, 0x73, 0x0d, 0x77, 0xa9, 0x4a, 0x26, 0xaf, 0xe7, 0x5b, 0x1c, 0x48, 0x34, 0x0d, 0xb7, 0x39, + 0xfd, 0xad, 0xa9, 0x30, 0x90, 0x38, 0x46, 0x93, 0x81, 0xc7, 0x74, 0x9f, 0x21, 0x45, 0x65, 0xac, + 0xd9, 0x0c, 0xb5, 0x60, 0xd6, 0x8a, 0xcb, 0xf2, 0x11, 0x68, 0xa4, 0xd2, 0xe8, 0x6a, 0x4b, 0x3e, + 0x91, 0x15, 0x4d, 0x89, 0xf3, 0x80, 0xc4, 0x39, 0x8d, 0x27, 0x54, 0x41, 0xaa, 0x71, 0x50, 0xa1, + 0xe5, 0x96, 0x43, 0x85, 0x48, 0x3b, 0xce, 0x46, 0x70, 0xe7, 0x0c, 0x67, 0x83, 0x55, 0x4a, 0xa8, + 0x46, 0xf1, 0xa8, 0xad, 0x77, 0xa8, 0xfc, 0x1f, 0x11, 0xcc, 0x8a, 0x69, 0x41, 0xaf, 0x98, 0xf1, + 0x77, 0x45, 0x16, 0x39, 0x0e, 0x87, 0x14, 0x07, 0x55, 0x9c, 0x43, 0x33, 0x17, 0xb1, 0x30, 0x7d, + 0xdb, 0x78, 0x9d, 0x0f, 0xe7, 0x96, 0xe8, 0x50, 0x66, 0x32, 0x2d, 0xf8, 0xa8, 0x6d, 0x6b, 0x39, + 0x59, 0x65, 0xcb, 0xb4, 0x75, 0xfa, 0x1e, 0x44, 0x46, 0x1a, 0x41, 0x8b, 0x4d, 0xae, 0x3f, 0xd5 +}; + +static unsigned char rsa_qinv_3072[] = { + 0xb2, 0xa1, 0x52, 0x54, 0xee, 0xcd, 0xb9, 0x07, 0xde, 0x26, 0x8a, 0x1b, 0x93, 0x91, 0xf7, 0x08, + 0xbe, 0x81, 0x23, 0x0c, 0xba, 0x24, 0x7a, 0x66, 0x57, 0x41, 0x09, 0xc6, 0x3a, 0x25, 0xa8, 0x56, + 0x03, 0x34, 0xcd, 0xcb, 0x97, 0xe8, 0x48, 0xdf, 0x64, 0xc8, 0xd3, 0xe2, 0xfd, 0xaa, 0xcb, 0xdc, + 0x9c, 0xfc, 0xab, 0x0d, 0x00, 0x57, 0x06, 0xb3, 0x71, 0x53, 0xe9, 0x2d, 0x7c, 0xcc, 0x68, 0xca, + 0x24, 0x94, 0x11, 0x48, 0x21, 0xb0, 0x55, 0xcb, 0xa9, 0x2b, 0x09, 0x99, 0x90, 0x9a, 0xaa, 0xea, + 0xa3, 0xbd, 0x4d, 0xf3, 0xba, 0x67, 0x55, 0x3c, 0x5c, 0xbf, 0xfa, 0x23, 0xbf, 0xfc, 0xcd, 0x7e, + 0x99, 0x60, 0xf1, 0x71, 0x78, 0x03, 0x15, 0xbb, 0xda, 0x54, 0xd9, 0x3d, 0x0d, 0x19, 0xad, 0xbf, + 0x3e, 0x35, 0xa9, 0x5d, 0xf7, 0xb1, 0x88, 0x78, 0x96, 0x59, 0xda, 0x0b, 0x54, 0xd9, 0x8a, 0x64, + 0x89, 0xf8, 0xea, 0x27, 0x78, 0x73, 0x58, 0x40, 0x1f, 0xec, 0xa3, 0xdd, 0xe3, 0xdb, 0x88, 0xdb, + 0x3f, 0x00, 0xc1, 0xdb, 0x95, 0x24, 0x7d, 0x55, 0x2f, 0xe1, 0xa1, 0xa5, 0x70, 0x13, 0xd5, 0xc7, + 0x26, 0x41, 0x9f, 0x79, 0xc7, 0x5b, 0x30, 0x58, 0x65, 0x16, 0xa0, 0x0d, 0xac, 0x1d, 0xc8, 0x8d, + 0xe1, 0xce, 0xc2, 0x61, 0x0f, 0xb0, 0x02, 0xc9, 0x80, 0x1e, 0xbd, 0x25, 0x83, 0xbc, 0x9d, 0xdc +}; + +static unsigned char rsa_d_3072[] = { + 0x33, 0x49, 0x58, 0xb0, 0x89, 0x3d, 0x96, 0x78, 0xb7, 0x2a, 0x99, 0x5e, 0x0c, 0x56, 0xae, 0x08, + 0x32, 0xe1, 0xb9, 0x1c, 0x17, 0xd7, 0x71, 0xaa, 0x57, 0x37, 0x58, 0xbf, 0x94, 0xf8, 0xa0, 0xdf, + 0xdb, 0x0a, 0xfd, 0x2f, 0xce, 0x8a, 0x82, 0x43, 0x11, 0x48, 0x6b, 0xec, 0x61, 0x72, 0x77, 0x98, + 0x53, 0x00, 0x32, 0x5e, 0xbe, 0x3d, 0x37, 0xaf, 0x53, 0x55, 0x13, 0xc7, 0x61, 0x03, 0x6a, 0x28, + 0xc8, 0xe6, 0xa8, 0xac, 0x5f, 0xcf, 0x15, 0x54, 0x36, 0xc4, 0x74, 0x60, 0x3b, 0xcc, 0xbc, 0x4f, + 0x05, 0x27, 0x0d, 0x9e, 0x3c, 0x0c, 0x74, 0x1d, 0x59, 0xb7, 0x28, 0x05, 0x94, 0x2d, 0x0d, 0x02, + 0x60, 0xaa, 0x82, 0x14, 0x29, 0xf9, 0x38, 0x6a, 0xcb, 0x3a, 0xc4, 0x14, 0x70, 0xa4, 0x6b, 0x34, + 0xb6, 0xad, 0x11, 0xca, 0x4b, 0x76, 0x59, 0xd7, 0x29, 0xf1, 0x2e, 0xef, 0xf9, 0xa9, 0xf4, 0xd5, + 0x50, 0x13, 0x60, 0xc9, 0xac, 0x96, 0x14, 0x23, 0xdd, 0x3a, 0x2d, 0x9a, 0x9f, 0x58, 0xa8, 0xcb, + 0x70, 0xe4, 0x19, 0x45, 0x5c, 0xec, 0x7c, 0x64, 0xab, 0x76, 0x63, 0x07, 0xe0, 0x98, 0x5a, 0xbc, + 0x91, 0xc0, 0xbc, 0x84, 0xd5, 0x06, 0xef, 0xc4, 0xa2, 0xe0, 0x8f, 0x5a, 0xc9, 0x0e, 0x74, 0x3a, + 0x64, 0x80, 0x72, 0x8f, 0x62, 0xe4, 0x23, 0xe2, 0x7c, 0x79, 0x60, 0x49, 0xd6, 0x24, 0xca, 0x3d, + 0x8f, 0xb5, 0xbf, 0xee, 0x31, 0x25, 0x7b, 0xf8, 0x36, 0xe3, 0x47, 0x4a, 0xc6, 0xd8, 0x6e, 0xfe, + 0x05, 0xf0, 0x42, 0x4b, 0x90, 0x59, 0xf4, 0x45, 0xb7, 0x89, 0xed, 0x20, 0x9e, 0x60, 0x36, 0xaf, + 0xd3, 0x07, 0x2f, 0x5a, 0x47, 0xdc, 0x00, 0xb7, 0x01, 0xc7, 0x5d, 0xa0, 0x1f, 0x03, 0x08, 0x57, + 0x2e, 0x1e, 0x95, 0x61, 0xf7, 0x6c, 0x62, 0x7a, 0x07, 0x6b, 0x27, 0x81, 0xb9, 0xe6, 0x49, 0x9d, + 0x15, 0x6d, 0x19, 0xba, 0xd3, 0x11, 0xd5, 0x2b, 0xd1, 0x24, 0x1e, 0x16, 0xd0, 0x78, 0xdc, 0xda, + 0x55, 0x4a, 0x8a, 0x46, 0x04, 0xda, 0x7a, 0xb2, 0xda, 0xe4, 0xc0, 0xc7, 0xb7, 0x2b, 0xd6, 0x22, + 0x5a, 0xe3, 0xf7, 0xe1, 0xa4, 0xed, 0x6a, 0xb5, 0xb4, 0x3c, 0x25, 0x1e, 0x41, 0x0f, 0xb1, 0x26, + 0x88, 0xfc, 0x10, 0x25, 0x52, 0x2d, 0x95, 0xac, 0xf8, 0x81, 0x29, 0xe0, 0x90, 0xc0, 0x10, 0xdf, + 0x83, 0xbd, 0xee, 0x9c, 0xb6, 0x79, 0x9c, 0xd2, 0x6f, 0x4a, 0xd9, 0x15, 0xd1, 0xdb, 0x23, 0x38, + 0x1e, 0xf5, 0x69, 0x81, 0xc3, 0xe4, 0x02, 0xa2, 0x1f, 0xe8, 0xa2, 0x95, 0xbe, 0x3e, 0x40, 0x3b, + 0xda, 0xa1, 0x96, 0x7d, 0x51, 0xae, 0x06, 0x84, 0x02, 0xe1, 0x99, 0xcb, 0x9e, 0xf0, 0xe8, 0x7d, + 0x9c, 0xa3, 0x00, 0xd0, 0x1d, 0xe1, 0x52, 0xc4, 0x71, 0x12, 0x5c, 0x53, 0xd6, 0x88, 0xfb, 0x81 +}; + +static unsigned char rsa_n_3072[] = { + 0xd2, 0x8f, 0x46, 0x62, 0x87, 0xde, 0x40, 0xdb, 0xdc, 0xd5, 0xf1, 0x7b, 0x14, 0x75, 0x7e, 0x5e, + 0xcb, 0x38, 0x7f, 0x9e, 0xc4, 0x30, 0xb6, 0x77, 0x6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b4, + 0xcf, 0xd2, 0xc6, 0x1d, 0xc4, 0xeb, 0xd8, 0xc4, 0x89, 0x78, 0x41, 0x12, 0x33, 0x06, 0xfa, 0xf5, + 0xec, 0x13, 0xe5, 0x90, 0xd9, 0xad, 0x6e, 0x26, 0x89, 0xf9, 0x7f, 0x7f, 0x0a, 0x3b, 0xe5, 0xf8, + 0x40, 0x88, 0x10, 0x08, 0x40, 0xc8, 0x31, 0x84, 0x8f, 0x18, 0x5c, 0xe6, 0x60, 0xa0, 0x3a, 0x94, + 0xc7, 0x45, 0xf8, 0xbc, 0x90, 0x2c, 0x2d, 0x92, 0x41, 0x6e, 0xe0, 0xb5, 0xe4, 0x85, 0x69, 0xfc, + 0xef, 0xd6, 0xdb, 0xe9, 0x73, 0x73, 0x42, 0x5f, 0x0f, 0x08, 0xec, 0xd6, 0xd7, 0x92, 0xa6, 0x7f, + 0xfb, 0xa1, 0x31, 0x7d, 0x57, 0x44, 0xdf, 0xfa, 0xf8, 0xaf, 0x2e, 0x5a, 0x00, 0xa2, 0x6a, 0x2b, + 0x9d, 0x05, 0xf5, 0xba, 0xd4, 0x19, 0x07, 0xd2, 0x1e, 0x85, 0x67, 0xf1, 0x51, 0x96, 0xe0, 0x44, + 0xba, 0x76, 0xf4, 0x4e, 0xa0, 0x2b, 0xb0, 0x6e, 0xe8, 0xd9, 0xb1, 0xd3, 0xcd, 0x85, 0xd0, 0x45, + 0x70, 0x70, 0x1c, 0x94, 0xcc, 0x7e, 0x6b, 0x81, 0x19, 0x07, 0xdd, 0x05, 0x91, 0xc2, 0x78, 0x32, + 0x72, 0x09, 0x62, 0x30, 0xf0, 0x73, 0x7b, 0xbc, 0x5e, 0x7d, 0x3d, 0xfe, 0x0d, 0x8b, 0xef, 0x31, + 0xdb, 0x8e, 0x28, 0x20, 0xae, 0x0e, 0xe0, 0x7d, 0x63, 0x79, 0x05, 0x1b, 0x13, 0x8a, 0x8d, 0x15 +}; + +static unsigned char rsa_e_4096[] = { + 0x01, 0x00, 0x01 +}; + +static unsigned char rsa_p_4096[] = { + 0xff, 0x0f, 0x4f, 0x6c, 0xdd, 0x59, 0xd8, 0x48, 0x87, 0xc3, 0x24, 0x04, 0x87, 0x63, 0xbe, 0xcd, + 0xa6, 0x51, 0xb6, 0xb8, 0xda, 0x31, 0x8f, 0xb0, 0xf7, 0x29, 0x08, 0x28, 0x60, 0xb0, 0xb1, 0x52, + 0xe4, 0x73, 0xf1, 0xdb, 0x10, 0xe3, 0xbc, 0xfc, 0x2d, 0x88, 0x43, 0xab, 0x2a, 0x2e, 0x41, 0x80, + 0x0f, 0x25, 0x62, 0x53, 0x8f, 0x09, 0x82, 0xd1, 0xe4, 0x12, 0xe3, 0x9f, 0xae, 0xe9, 0x5b, 0xe4, + 0x89, 0x97, 0xf7, 0x40, 0x0c, 0x78, 0x86, 0xd1, 0x23, 0xe7, 0xd3, 0x45, 0xc9, 0x15, 0xf8, 0xbf, + 0xe9, 0x3d, 0x44, 0x57, 0x21, 0x61, 0x62, 0xe1, 0xad, 0x9d, 0x28, 0x5c, 0x99, 0xfc, 0xec, 0xe1, + 0xcb, 0x93, 0x70, 0x28, 0x8d, 0xc2, 0x97, 0xc4, 0xc4, 0xaa, 0xb1, 0xe3, 0xb6, 0x61, 0x84, 0x0c, + 0x03, 0xc9, 0xf7, 0x96, 0xdf, 0x04, 0xdc, 0x15, 0x94, 0x35, 0x60, 0xfa, 0xe7, 0xc4, 0xc1, 0xc7, + 0x80, 0xfb, 0xa6, 0xa6, 0x3e, 0x00, 0x42, 0x4a, 0x51, 0x91, 0xd3, 0x32, 0xee, 0x60, 0x2a, 0xda, + 0x13, 0xa9, 0x5b, 0xf8, 0x8a, 0xcd, 0x4a, 0x80, 0x23, 0x3a, 0x77, 0xf7, 0x10, 0xdf, 0x4e, 0x13, + 0x6e, 0xb6, 0x24, 0xe5, 0xd6, 0x97, 0x0d, 0x6e, 0xe8, 0xb3, 0xfd, 0x8a, 0x3b, 0xdb, 0x66, 0x8b, + 0x8a, 0x49, 0x56, 0xfa, 0xff, 0x16, 0xb6, 0x6c, 0xea, 0xc1, 0xed, 0xbe, 0x54, 0x3c, 0x5f, 0x28, + 0x4a, 0x62, 0x15, 0x9c, 0x71, 0xc0, 0xce, 0xa5, 0x59, 0x0f, 0x53, 0xf3, 0xa1, 0xf5, 0x38, 0x04, + 0x90, 0xa8, 0x88, 0x6d, 0x90, 0xf4, 0x61, 0xdf, 0xb2, 0xd1, 0x8f, 0x8e, 0x48, 0x68, 0x19, 0xd0, + 0xd8, 0x3b, 0x9f, 0xbe, 0xbe, 0x56, 0x12, 0xf9, 0x6e, 0x1a, 0x6d, 0xbc, 0xac, 0xa5, 0xc3, 0xb6, + 0x53, 0x1e, 0xed, 0x57, 0xfd, 0x53, 0xe9, 0x9d, 0xf7, 0xe3, 0xac, 0xe6, 0xe8, 0x87, 0xc5, 0xa7 +}; + +static unsigned char rsa_q_4096[] = { + 0xe8, 0x98, 0x10, 0x31, 0x2a, 0xde, 0xbf, 0xa0, 0xec, 0xbf, 0x77, 0xfd, 0x5d, 0x8e, 0x0e, 0xf7, + 0xa2, 0x81, 0xc9, 0xc1, 0x98, 0xde, 0x5c, 0x22, 0x8b, 0x7d, 0x9f, 0xf3, 0x7a, 0x41, 0xc9, 0x2b, + 0xa7, 0xbc, 0x7f, 0xcf, 0x41, 0x6d, 0xf8, 0x88, 0xbd, 0x90, 0x17, 0x9e, 0xc9, 0xdc, 0x79, 0x85, + 0x20, 0x97, 0x87, 0x06, 0xf4, 0x39, 0xf6, 0x6e, 0x47, 0x0a, 0x74, 0xe0, 0x83, 0x74, 0x7c, 0xc8, + 0x62, 0xe9, 0x64, 0x1c, 0xde, 0x8a, 0x2f, 0x58, 0x1d, 0xe7, 0x11, 0xb1, 0xb0, 0xf1, 0x78, 0x58, + 0x4f, 0xa1, 0x17, 0x97, 0xfc, 0x81, 0x2c, 0x11, 0x53, 0x3d, 0x43, 0x32, 0xb7, 0xd9, 0xb9, 0x4e, + 0x5b, 0x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, 0xa9, 0x3a, 0xb2, 0xc3, 0x15, 0xfe, 0x97, 0xcd, 0x92, 0x56, 0x9d, + 0x63, 0x97, 0xad, 0x3e, 0x48, 0xcd, 0x05, 0x15, 0x31, 0x71, 0xfd, 0x8d, 0xb4, 0x5f, 0x32, 0x08, + 0xc3, 0x33, 0xf3, 0x69, 0x9e, 0xb7, 0xf6, 0x3a, 0x24, 0x4b, 0x34, 0xf3, 0x52, 0xac, 0xed, 0xdf, + 0x18, 0x79, 0xbb, 0x2f, 0x8f, 0xd6, 0xf4, 0xae, 0xe3, 0xae, 0x61, 0x9e, 0x32, 0x16, 0x08, 0x61 +}; + +static unsigned char rsa_dq_4096[] = { + 0xb8, 0x1a, 0x74, 0xe6, 0x96, 0x0a, 0x4e, 0x1f, 0xf0, 0x84, 0xf5, 0x52, 0xe4, 0xd4, 0x66, 0xe0, + 0x78, 0x0e, 0xc7, 0x45, 0xa7, 0xdc, 0x89, 0x8d, 0x06, 0x60, 0x5f, 0x54, 0xf7, 0x36, 0x4f, 0x27, + 0x70, 0xd3, 0x71, 0x4e, 0xf9, 0x79, 0x34, 0x39, 0xf7, 0xe1, 0xaf, 0xf0, 0x8d, 0xd3, 0x27, 0x94, + 0xca, 0x61, 0x66, 0x0d, 0x89, 0x0e, 0xc0, 0x12, 0x35, 0xc4, 0xff, 0x12, 0x1e, 0xba, 0xfb, 0x72, + 0x19, 0x68, 0xa7, 0x47, 0x7a, 0x96, 0x62, 0x37, 0x1b, 0x24, 0x25, 0x0b, 0x43, 0x05, 0x3e, 0xbe, + 0x97, 0xf8, 0xe8, 0x95, 0xf2, 0xd5, 0xc3, 0xad, 0xca, 0xf7, 0x38, 0xd3, 0x52, 0x56, 0xd1, 0xa8, + 0x45, 0xdd, 0xde, 0x54, 0x09, 0x8c, 0x18, 0x37, 0x4a, 0x6a, 0x17, 0x8a, 0x52, 0x13, 0xba, 0xcc, + 0x71, 0x38, 0xc1, 0x9d, 0x80, 0x91, 0x6a, 0x79, 0xd6, 0x08, 0xba, 0xe6, 0x38, 0x72, 0xed, 0xd7, + 0x0d, 0x15, 0x4c, 0x8f, 0x2b, 0x30, 0x4f, 0xd5, 0xb4, 0x80, 0x77, 0x7b, 0x1c, 0xde, 0x7f, 0x4f, + 0x8b, 0x44, 0xa2, 0x03, 0xe4, 0x4e, 0x7c, 0xb2, 0x50, 0xcc, 0xa3, 0xc7, 0x6c, 0x1f, 0x85, 0xeb, + 0x61, 0x7b, 0x7c, 0x46, 0x3c, 0x36, 0x8d, 0x8e, 0xa9, 0x98, 0xed, 0xd9, 0xd4, 0x26, 0x2a, 0xa0, + 0x1b, 0xa2, 0x09, 0x4d, 0xaa, 0xdf, 0x86, 0xf9, 0xe0, 0x9d, 0x8d, 0x28, 0x88, 0x7d, 0x5c, 0xa1, + 0xaf, 0x60, 0x54, 0x08, 0xd1, 0xa2, 0x80, 0xa2, 0xb9, 0x91, 0x6a, 0x24, 0x60, 0xbb, 0x69, 0x49, + 0x41, 0xfb, 0x70, 0x4a, 0x58, 0xdb, 0xf8, 0x9f, 0xe5, 0xfc, 0x38, 0x23, 0x88, 0xe4, 0x3d, 0xc1, + 0xac, 0x4b, 0x7a, 0x69, 0xcc, 0x19, 0xe8, 0x3f, 0xc1, 0x66, 0x52, 0x50, 0x2c, 0x2a, 0x2d, 0x0d, + 0x5a, 0x02, 0xdf, 0xaf, 0x02, 0xe0, 0x8f, 0xd9, 0xe5, 0x00, 0x70, 0x53, 0xea, 0xa0, 0xb1, 0x9d +}; + +static unsigned char rsa_qinv_4096[] = { + 0x11, 0xc1, 0x35, 0xf3, 0xe0, 0x74, 0x80, 0x68, 0x32, 0xdd, 0x15, 0xdb, 0x92, 0x72, 0xad, 0xd8, + 0xfd, 0xfe, 0x78, 0xee, 0xfd, 0x8a, 0xaa, 0xd4, 0x47, 0x07, 0xc3, 0xcf, 0x35, 0xbd, 0x23, 0x3d, + 0x2b, 0x09, 0xed, 0xbe, 0xb6, 0x3d, 0xc1, 0xb7, 0x25, 0x79, 0x5e, 0x0c, 0x7c, 0x25, 0x2c, 0x8f, + 0x98, 0x34, 0x19, 0xc7, 0xdf, 0x74, 0x67, 0x6a, 0x2e, 0x3b, 0x99, 0x3d, 0x41, 0xee, 0x44, 0xe8, + 0xc5, 0x75, 0xc2, 0x05, 0xdc, 0x85, 0x04, 0x59, 0x45, 0x14, 0x70, 0xc2, 0x9c, 0xa8, 0xa9, 0x2b, + 0x04, 0x65, 0xe1, 0xba, 0x83, 0x5e, 0x03, 0x04, 0x78, 0xe4, 0x16, 0x2d, 0x14, 0xfa, 0x10, 0xeb, + 0xe4, 0x3e, 0x6d, 0x75, 0xb1, 0xe5, 0xc5, 0xe7, 0x98, 0x69, 0x9a, 0x1b, 0xab, 0x87, 0x05, 0x51, + 0x84, 0x73, 0x31, 0xd5, 0x61, 0x67, 0xdc, 0x70, 0xce, 0x12, 0xdc, 0x53, 0xa5, 0xe6, 0x12, 0xb2, + 0x85, 0x00, 0x14, 0x6f, 0x56, 0x5c, 0x35, 0xc7, 0xd0, 0xea, 0x51, 0xf7, 0xba, 0xe4, 0x6b, 0x13, + 0x0c, 0x4d, 0x3d, 0x82, 0xe0, 0x7b, 0xac, 0x4b, 0x7e, 0xfb, 0x95, 0x47, 0xa3, 0x90, 0x84, 0xdc, + 0x9b, 0xf1, 0x4a, 0x36, 0x85, 0x7a, 0x5e, 0x9e, 0x74, 0x59, 0x1c, 0x59, 0xaa, 0x7e, 0x30, 0x5b, + 0x0c, 0x03, 0x3a, 0xb3, 0x80, 0xc5, 0x0b, 0xf4, 0x04, 0x41, 0x21, 0x77, 0xdc, 0x89, 0x10, 0x09, + 0x32, 0xa2, 0xd3, 0xa8, 0xb2, 0x3f, 0x9e, 0xc8, 0x62, 0x68, 0x59, 0x83, 0x68, 0xf3, 0xe4, 0x1f, + 0x20, 0x64, 0x0e, 0x2c, 0x18, 0x5a, 0xd1, 0x16, 0x02, 0x1c, 0x73, 0x4e, 0xc4, 0x92, 0x79, 0x56, + 0x9f, 0x66, 0x7c, 0xa6, 0xf2, 0x5e, 0xb5, 0x04, 0xf6, 0xa2, 0xf6, 0x59, 0xe2, 0x8c, 0x85, 0x95, + 0x62, 0xd6, 0x20, 0x8d, 0x3d, 0x87, 0x88, 0xa1, 0xa2, 0xea, 0x68, 0xe1, 0x29, 0x99, 0xd3, 0x7e +}; + +static unsigned char rsa_d_4096[] = { + 0x15, 0x49, 0x6c, 0x18, 0x59, 0x19, 0x8d, 0x47, 0xa9, 0xf4, 0x83, 0xd9, 0x13, 0xa8, 0x60, 0xb7, + 0xcf, 0x53, 0x9d, 0xe1, 0xe8, 0xb2, 0x90, 0x3b, 0x2e, 0x9a, 0xd4, 0xed, 0x7f, 0xce, 0x16, 0x92, + 0xcb, 0xa4, 0x89, 0x38, 0xe8, 0x88, 0x1d, 0x7c, 0x7f, 0x8a, 0xdf, 0xa2, 0x7f, 0xf5, 0xcd, 0x18, + 0xd4, 0x51, 0xf7, 0x31, 0x8b, 0x54, 0x19, 0x0d, 0xfc, 0xfe, 0x87, 0x8b, 0x62, 0x94, 0x0c, 0xe2, + 0x50, 0x23, 0xbe, 0x22, 0xda, 0x5c, 0xbf, 0x00, 0xc7, 0xce, 0x0b, 0x1d, 0x0d, 0x9b, 0x74, 0x2e, + 0xad, 0xcd, 0x80, 0x2b, 0x69, 0x1b, 0x92, 0x86, 0xe9, 0x5b, 0x9e, 0x3a, 0xf2, 0x66, 0xd1, 0x64, + 0x93, 0xcb, 0x72, 0xb7, 0x86, 0x7b, 0x32, 0x4a, 0xeb, 0x52, 0x75, 0x51, 0xb4, 0x5f, 0xb0, 0x23, + 0x53, 0xc8, 0x40, 0x60, 0xc8, 0x2a, 0x40, 0x98, 0xb2, 0x27, 0x9c, 0xea, 0x21, 0xb0, 0x71, 0x53, + 0xf8, 0x64, 0x3b, 0xd9, 0x6e, 0xba, 0xca, 0xeb, 0x77, 0xdf, 0xc9, 0x65, 0xaa, 0xdb, 0xd9, 0x92, + 0xda, 0x76, 0x3d, 0xf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static unsigned char rsa_n_4096[] = { + 0xe7, 0xbd, 0x61, 0x33, 0xc2, 0xd8, 0x4c, 0x41, 0xa0, 0x3d, 0xd2, 0xa6, 0xad, 0x39, 0x2b, 0x62, + 0x26, 0x3f, 0x7f, 0xa3, 0xbe, 0xdf, 0x35, 0xd3, 0x62, 0x67, 0x3b, 0x09, 0xe5, 0x9d, 0xf4, 0x21, + 0x6f, 0x0b, 0xf1, 0x9a, 0x5a, 0xe0, 0x72, 0x80, 0xcf, 0x27, 0x99, 0x25, 0xea, 0x3d, 0x73, 0x70, + 0x7f, 0x03, 0x61, 0x9d, 0xca, 0x25, 0xf2, 0xd2, 0x29, 0x04, 0x1a, 0xf5, 0x08, 0xa6, 0xac, 0xc0, + 0x6d, 0x1f, 0x0e, 0x0e, 0xfd, 0x6e, 0x73, 0xe7, 0x1d, 0x60, 0x92, 0x13, 0xc3, 0x20, 0x39, 0x95, + 0x9a, 0x1e, 0x31, 0x07, 0x07, 0x45, 0x62, 0x97, 0xe4, 0xe4, 0x41, 0x98, 0xf2, 0x4c, 0x06, 0x9b, + 0xb1, 0x13, 0x28, 0x70, 0xa8, 0x2c, 0x99, 0x59, 0x8a, 0x85, 0x0b, 0x92, 0xde, 0x35, 0x9a, 0x68, + 0x9b, 0x9f, 0x8f, 0x70, 0x1e, 0x68, 0x22, 0x25, 0x32, 0xdf, 0x78, 0xac, 0xc3, 0x0b, 0x2f, 0x4e, + 0x26, 0x1c, 0x6a, 0xb9, 0x2d, 0x98, 0xa6, 0x48, 0x94, 0xce, 0x37, 0x01, 0x08, 0x0f, 0x28, 0x42, + 0x2b, 0x97, 0x93, 0xae, 0x56, 0xf0, 0xa6, 0xb7, 0x41, 0x4d, 0x26, 0x33, 0x67, 0xc7, 0xc8, 0x2b, + 0xe9, 0xc0, 0xe2, 0x21, 0x77, 0xb1, 0xde, 0x0e, 0x68, 0x3b, 0x4b, 0x85, 0xb7, 0x92, 0x5d, 0x2b, + 0x21, 0xc6, 0x35, 0x72, 0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 0x30, 0x74, 0xac, 0x12, 0x41, 0x79, 0x47, + 0xac, 0x2c, 0x1e, 0x6d, 0x56, 0x9d, 0xdb, 0x0c, 0x27, 0x4a, 0xe9, 0x07, 0xa0, 0x34, 0xcf, 0xdd, + 0x42, 0x7e, 0x31, 0xe9, 0xed, 0xb4, 0x1d, 0x74, 0x24, 0x84, 0x80, 0x2d, 0xf9, 0x32, 0x6e, 0xd0, + 0x12, 0xf1, 0x75, 0xad, 0x1a, 0xed, 0x79, 0xe9, 0x80, 0xf8, 0x60, 0xf6, 0x73, 0x31, 0xad, 0x0d, + 0x23, 0xda, 0xad, 0x8a, 0x73, 0xab, 0x99, 0xc5, 0xe0, 0x52, 0x01, 0xf4, 0x88, 0x10, 0x69, 0x99, + 0xf3, 0x07, 0x2c, 0xb7, 0x67, 0x0c, 0xf3, 0xa6, 0x74, 0x4a, 0x73, 0x7d, 0xdb, 0x72, 0x22, 0xba, + 0xc1, 0xdd, 0xbc, 0x82, 0x2b, 0x6f, 0xaa, 0xcb, 0x7a, 0xfd, 0x50, 0x30, 0xb7, 0xf6, 0x72, 0x4b, + 0x71, 0xe0, 0xbd, 0xca, 0xf9, 0xd2, 0x4d, 0x42, 0x85, 0x40, 0x49, 0x9b, 0xba, 0x44, 0x7d, 0x98, + 0x16, 0x40, 0x32, 0xd0, 0x5f, 0x2a, 0xcf, 0x0d, 0x1a, 0x5b, 0x74, 0xd6, 0x4c, 0xb0, 0x0f, 0xe5, + 0x81, 0x01, 0x03, 0xfd, 0xd3, 0x14, 0xbc, 0xc5, 0x64, 0x4c, 0x29, 0xd4, 0x27, 0x08, 0xe3, 0x69 +}; + +static unsigned char dh_g_5[] = {0x05}; +static unsigned char dh_g_2[] = {0x02}; + +static unsigned char dh_p_768[] = { + 0xdd, 0xe8, 0xa1, 0x7d, 0xdd, 0x39, 0x87, 0x3c, 0xa1, 0x6a, 0xeb, 0x1b, 0x4f, 0x14, 0x72, 0x88, + 0x6c, 0x14, 0x6d, 0x24, 0xb7, 0xda, 0xf8, 0x97, 0xaa, 0xba, 0xb4, 0xdd, 0xc9, 0x5b, 0x28, 0x10, + 0x49, 0xfa, 0x93, 0xcc, 0x62, 0xc0, 0x70, 0xf8, 0xd6, 0xdc, 0xb2, 0x80, 0x35, 0x20, 0x84, 0xa4, + 0x99, 0xfc, 0x10, 0x7c, 0x9d, 0xc0, 0xc6, 0xd4, 0x8b, 0x0c, 0x57, 0xf1, 0x01, 0xf5, 0x1a, 0x4f, + 0x20, 0xfa, 0x8d, 0x66, 0x8b, 0x22, 0x3c, 0x96, 0xef, 0xd0, 0xde, 0xe5, 0x7e, 0x7f, 0x23, 0xdc, + 0x6d, 0x71, 0xdf, 0xc3, 0xe5, 0x1b, 0x39, 0xfe, 0xb7, 0x77, 0xe5, 0x72, 0x0d, 0x1c, 0x8d, 0xb7 +}; + +static unsigned char dh_xa_768[] = { + 0xe0, 0x80, 0x86, 0x24, 0xe2, 0x20, 0x35, 0x97, 0xda, 0x0e, 0x68, 0x39, 0x01, 0xdd, 0x01, 0x87, + 0xa2, 0x47, 0xd2, 0x0d, 0xee, 0xfe, 0xdc, 0x5a, 0x37, 0x23, 0xeb, 0x3d, 0xe8, 0x1e, 0x39, 0x2d, + 0xbf, 0xa6, 0xe9, 0x17, 0x48, 0xe2, 0xea, 0xef, 0x1d, 0x2f, 0xe2, 0xaf, 0x3c, 0xbc, 0xae, 0xa7, + 0x42, 0x9b, 0xa5, 0x7d, 0x47, 0x8a, 0x20, 0xc5, 0xae, 0xa1, 0xe4, 0xe8, 0x1c, 0x05, 0xc0, 0x0a, + 0x05, 0xdc, 0x01, 0x74, 0xde, 0xad, 0xad, 0x07, 0xec, 0x6e, 0x6a, 0xc7, 0xee, 0x0f, 0xb8, 0xbe, + 0xaa, 0x46, 0x61, 0x8c, 0x12, 0x5a, 0xaf, 0x05, 0xff, 0x1b, 0x35, 0x6b, 0xe2, 0x3d, 0x48, 0x4f +}; + +static unsigned char dh_except_a_pubkey_768[] = { + 0xba, 0xe7, 0x3, 0x5b, 0xe4, 0x70, 0x8b, 0xe0, 0xe1, 0x92, 0x13, 0x86, 0x74, 0x4, 0xdc, 0x6a, + 0x0a, 0x2a, 0x20, 0xec, 0x6d, 0xbf, 0xf0, 0x46, 0xf7, 0x9, 0x2, 0xdb, 0x2f, 0x70, 0x11, 0xdd, + 0xb0, 0x13, 0xa2, 0xc1, 0x58, 0x74, 0x29, 0x19, 0x8d, 0x4a, 0x94, 0x80, 0x0b, 0xd7, 0x25, 0x85, + 0x10, 0x35, 0x97, 0x48, 0x6e, 0x70, 0x28, 0xae, 0x58, 0x97, 0x7d, 0xf2, 0x19, 0x27, 0x13, 0xab, + 0x47, 0x9b, 0x54, 0xdf, 0xc3, 0x5b, 0x5f, 0x5e, 0xb4, 0x64, 0x47, 0xce, 0x40, 0x3b, 0x0c, 0x4a, + 0x62, 0x52, 0xba, 0xc7, 0xf0, 0x36, 0x87, 0x9c, 0x79, 0x9a, 0x83, 0x11, 0x61, 0x0c, 0x1b, 0x6b +}; + +static unsigned char dh_except_b_pubkey_768[] = { + 0x0d, 0xe8, 0xa1, 0x7d, 0xdd, 0x39, 0x87, 0x3c, 0xa1, 0x6a, 0xeb, 0x1b, 0x4f, 0x14, 0x72, 0x88, + 0x6c, 0x14, 0x6d, 0x24, 0xb7, 0xda, 0xf8, 0x97, 0xaa, 0xba, 0xb4, 0xdd, 0xc9, 0x5b, 0x28, 0x10, + 0x49, 0xfa, 0x93, 0xcc, 0x62, 0xc0, 0x70, 0xf8, 0xd6, 0xdc, 0xb2, 0x80, 0x35, 0x20, 0x84, 0xa4, + 0x99, 0xfc, 0x10, 0x7c, 0x9d, 0xc0, 0xc6, 0xd4, 0x8b, 0x0c, 0x57, 0xf1, 0x1, 0xf5, 0x1a, 0x4f, + 0x20, 0xfa, 0x8d, 0x66, 0x8b, 0x22, 0x3c, 0x96, 0xef, 0xd0, 0xde, 0xe5, 0x7e, 0x7f, 0x23, 0xdc, + 0x6d, 0x71, 0xdf, 0xc3, 0xe5, 0x1b, 0x39, 0xfe, 0xb7, 0x77, 0xe5, 0x72, 0x0d, 0x1c, 0x8d, 0xb7 +}; + +static unsigned char dh_share_key_768[] = { + 0x55, 0x9, 0x6b, 0x9c, 0xc6, 0x37, 0xa9, 0x9b, 0xdf, 0x67, 0x73, 0x7b, 0x46, 0xf9, 0x63, 0x47, + 0xcb, 0xa0, 0x57, 0x2a, 0xed, 0x97, 0x2f, 0xfe, 0x92, 0xf2, 0x20, 0x2c, 0x7e, 0xee, 0x7d, 0x11, + 0x78, 0xe6, 0xb9, 0x9, 0xd1, 0x94, 0xce, 0xd1, 0x5b, 0xf4, 0x44, 0xa9, 0xcb, 0x26, 0x2, 0x36, + 0x57, 0x2c, 0xa2, 0xbe, 0x37, 0xde, 0x86, 0x46, 0x20, 0x27, 0x9d, 0xa0, 0x2f, 0x4, 0xc1, 0xcd, + 0xff, 0x81, 0xe5, 0xe6, 0x2c, 0x9e, 0x39, 0x82, 0x31, 0x54, 0x33, 0xf8, 0xe7, 0xa0, 0xe5, 0x96, + 0xa4, 0x40, 0xc4, 0x44, 0xfe, 0x93, 0x66, 0xe2, 0xda, 0xaa, 0xb8, 0xfb, 0x2f, 0x3b, 0x8c, 0xce, +}; + +static unsigned char dh_p_1024[] = { + 0x6a, 0xf3, 0x2c, 0xd2, 0x2d, 0x55, 0xc1, 0x54, 0x40, 0x18, 0x71, 0x07, 0x96, 0xa9, 0x56, 0x6e, + 0x45, 0x58, 0x24, 0xce, 0x75, 0x80, 0x3, 0x68, 0x36, 0x96, 0x03, 0xb2, 0x9c, 0x25, 0xbc, 0x55, + 0x0d, 0xe8, 0xa1, 0x7d, 0xdd, 0x39, 0x87, 0x3c, 0xa1, 0x6a, 0xeb, 0x1b, 0x4f, 0x14, 0x72, 0x88, + 0x6c, 0x14, 0x6d, 0x24, 0xb7, 0xda, 0xf8, 0x97, 0xaa, 0xba, 0xb4, 0xdd, 0xc9, 0x5b, 0x28, 0x10, + 0x49, 0xfa, 0x93, 0xcc, 0x62, 0xc0, 0x70, 0xf8, 0xd6, 0xdc, 0xb2, 0x80, 0x35, 0x20, 0x84, 0xa4, + 0x99, 0xfc, 0x10, 0x7c, 0x9d, 0xc0, 0xc6, 0xd4, 0x8b, 0x0c, 0x57, 0xf1, 0x01, 0xf5, 0x1a, 0x4f, + 0x20, 0xfa, 0x8d, 0x66, 0x8b, 0x22, 0x3c, 0x96, 0xef, 0xd0, 0xde, 0xe5, 0x7e, 0x7f, 0x23, 0xdc, + 0x6d, 0x71, 0xdf, 0xc3, 0xe5, 0x1b, 0x39, 0xfe, 0xb7, 0x77, 0xe5, 0x72, 0x0d, 0x1c, 0x8d, 0xb7 +}; + +static unsigned char dh_xa_1024[] = { + 0x0f, 0x2a, 0x77, 0x25, 0x4b, 0xb3, 0xd3, 0x2d, 0xfd, 0x94, 0x8b, 0x53, 0x02, 0x21, 0x40, 0xd7, + 0x36, 0x76, 0xf3, 0xc8, 0xc0, 0x36, 0x3d, 0x23, 0xc9, 0xbd, 0x92, 0x51, 0xf2, 0x4b, 0x83, 0x15, + 0xe0, 0x80, 0x86, 0x24, 0xe2, 0x20, 0x35, 0x97, 0xda, 0x0e, 0x68, 0x39, 0x01, 0xdd, 0x01, 0x87, + 0xa2, 0x47, 0xd2, 0x0d, 0xee, 0xfe, 0xdc, 0x5a, 0x37, 0x23, 0xeb, 0x3d, 0xe8, 0x1e, 0x39, 0x2d, + 0xbf, 0xa6, 0xe9, 0x17, 0x48, 0xe2, 0xea, 0xef, 0x1d, 0x2f, 0xe2, 0xaf, 0x3c, 0xbc, 0xae, 0xa7, + 0x42, 0x9b, 0xa5, 0x7d, 0x47, 0x8a, 0x20, 0xc5, 0xae, 0xa1, 0xe4, 0xe8, 0x1c, 0x05, 0xc0, 0x0a, + 0x05, 0xdc, 0x01, 0x74, 0xde, 0xad, 0xad, 0x07, 0xec, 0x6e, 0x6a, 0xc7, 0xee, 0x0f, 0xb8, 0xbe, + 0xaa, 0x46, 0x61, 0x8c, 0x12, 0x5a, 0xaf, 0x05, 0xff, 0x1b, 0x35, 0x6b, 0xe2, 0x3d, 0x48, 0x4f +}; + +static unsigned char dh_except_a_pubkey_1024[] = { + 0x5d, 0xa6, 0x7, 0x56, 0x93, 0x89, 0xe5, 0x0f, 0x2a, 0xb5, 0x67, 0x3a, 0xcf, 0xc3, 0x82, 0x83, + 0xf6, 0x88, 0x52, 0x0b, 0xfc, 0x6a, 0x5b, 0x1a, 0x57, 0x87, 0x86, 0xef, 0xda, 0x47, 0xdb, 0x4d, + 0xba, 0xe7, 0x3, 0x5b, 0xe4, 0x70, 0x8b, 0xe0, 0xe1, 0x92, 0x13, 0x86, 0x74, 0x4, 0xdc, 0x6a, + 0x0a, 0x2a, 0x20, 0xec, 0x6d, 0xbf, 0xf0, 0x46, 0xf7, 0x9, 0x2, 0xdb, 0x2f, 0x70, 0x11, 0xdd, + 0xb0, 0x13, 0xa2, 0xc1, 0x58, 0x74, 0x29, 0x19, 0x8d, 0x4a, 0x94, 0x80, 0x0b, 0xd7, 0x25, 0x85, + 0x10, 0x35, 0x97, 0x48, 0x6e, 0x70, 0x28, 0xae, 0x58, 0x97, 0x7d, 0xf2, 0x19, 0x27, 0x13, 0xab, + 0x47, 0x9b, 0x54, 0xdf, 0xc3, 0x5b, 0x5f, 0x5e, 0xb4, 0x64, 0x47, 0xce, 0x40, 0x3b, 0x0c, 0x4a, + 0x62, 0x52, 0xba, 0xc7, 0xf0, 0x36, 0x87, 0x9c, 0x79, 0x9a, 0x83, 0x11, 0x61, 0x0c, 0x1b, 0x6b +}; + +static unsigned char dh_except_b_pubkey_1024[] = { + 0x4a, 0xf3, 0x2c, 0xd2, 0x2d, 0x55, 0xc1, 0x54, 0x40, 0x18, 0x71, 0x7, 0x96, 0xa9, 0x56, 0x6e, + 0x45, 0x58, 0x24, 0xce, 0x75, 0x80, 0x3, 0x68, 0x36, 0x96, 0x3, 0xb2, 0x9c, 0x25, 0xbc, 0x55, + 0x0d, 0xe8, 0xa1, 0x7d, 0xdd, 0x39, 0x87, 0x3c, 0xa1, 0x6a, 0xeb, 0x1b, 0x4f, 0x14, 0x72, 0x88, + 0x6c, 0x14, 0x6d, 0x24, 0xb7, 0xda, 0xf8, 0x97, 0xaa, 0xba, 0xb4, 0xdd, 0xc9, 0x5b, 0x28, 0x10, + 0x49, 0xfa, 0x93, 0xcc, 0x62, 0xc0, 0x70, 0xf8, 0xd6, 0xdc, 0xb2, 0x80, 0x35, 0x20, 0x84, 0xa4, + 0x99, 0xfc, 0x10, 0x7c, 0x9d, 0xc0, 0xc6, 0xd4, 0x8b, 0x0c, 0x57, 0xf1, 0x1, 0xf5, 0x1a, 0x4f, + 0x20, 0xfa, 0x8d, 0x66, 0x8b, 0x22, 0x3c, 0x96, 0xef, 0xd0, 0xde, 0xe5, 0x7e, 0x7f, 0x23, 0xdc, + 0x6d, 0x71, 0xdf, 0xc3, 0xe5, 0x1b, 0x39, 0xfe, 0xb7, 0x77, 0xe5, 0x72, 0x0d, 0x1c, 0x8d, 0xb7 +}; + +static unsigned char dh_share_key_1024[] = { + 0xcc, 0x48, 0x97, 0xe4, 0x21, 0x65, 0xa6, 0x55, 0xb8, 0xf3, 0xb2, 0x7b, 0x91, 0xd7, 0xca, 0xb9, + 0x17, 0x58, 0x31, 0x71, 0xc0, 0xc9, 0x69, 0x1e, 0xf0, 0x9e, 0x3f, 0xe2, 0x37, 0x4, 0x2d, 0xa8, + 0x55, 0x9, 0x6b, 0x9c, 0xc6, 0x37, 0xa9, 0x9b, 0xdf, 0x67, 0x73, 0x7b, 0x46, 0xf9, 0x63, 0x47, + 0xcb, 0xa0, 0x57, 0x2a, 0xed, 0x97, 0x2f, 0xfe, 0x92, 0xf2, 0x20, 0x2c, 0x7e, 0xee, 0x7d, 0x11, + 0x78, 0xe6, 0xb9, 0x9, 0xd1, 0x94, 0xce, 0xd1, 0x5b, 0xf4, 0x44, 0xa9, 0xcb, 0x26, 0x2, 0x36, + 0x57, 0x2c, 0xa2, 0xbe, 0x37, 0xde, 0x86, 0x46, 0x20, 0x27, 0x9d, 0xa0, 0x2f, 0x4, 0xc1, 0xcd, + 0xff, 0x81, 0xe5, 0xe6, 0x2c, 0x9e, 0x39, 0x82, 0x31, 0x54, 0x33, 0xf8, 0xe7, 0xa0, 0xe5, 0x96, + 0xa4, 0x40, 0xc4, 0x44, 0xfe, 0x93, 0x66, 0xe2, 0xda, 0xaa, 0xb8, 0xfb, 0x2f, 0x3b, 0x8c, 0xce, +}; + +static unsigned char dh_p_1536[] = { + 0xe3,0x7d,0xa7,0x4a,0xcc,0xef,0xce,0xa6,0xde,0x1d,0x3d,0xc5,0x2b,0xaa,0x6b,0x83, + 0xec,0x87,0x60,0xcd,0xc6,0xe4,0x16,0x0d,0xe7,0xb9,0x20,0x0e,0x10,0x50,0x35,0x22, + 0xd6,0xdb,0xbf,0x6,0xcc,0x7b,0x8e,0xe1,0x68,0x38,0x76,0x5f,0x0a,0x68,0xa8,0xfd, + 0x3f,0x40,0x51,0x46,0x45,0x64,0x53,0x22,0xcf,0x8,0xe2,0xef,0xd2,0x6f,0x28,0x84, + 0x14,0xb3,0xa6,0x24,0x49,0x6f,0x49,0x6c,0x0a,0x13,0xb6,0x78,0x4f,0xa4,0xd0,0xc4, + 0x20,0x6c,0x7,0x4c,0x6b,0xf7,0x8c,0x72,0x16,0x6c,0x99,0xd2,0x44,0x9e,0x63,0x5, + 0xfc,0x3a,0xa9,0x33,0x16,0x0b,0xc4,0x1a,0xf0,0xc7,0x25,0xcd,0xc6,0x3a,0x8e,0x66, + 0xa2,0xeb,0x70,0xb9,0x59,0xd9,0xb7,0xdd,0x68,0x45,0x26,0x20,0xfa,0x58,0x6f,0xd6, + 0x3f,0xd8,0xf2,0x52,0xd5,0x3a,0x16,0x7,0xdd,0xb4,0x63,0x0c,0xfe,0x8,0x67,0xd0, + 0x9f,0x8a,0xe0,0xe9,0x25,0xa0,0x0e,0x5,0x8e,0xe5,0x56,0xa6,0xc3,0x5b,0x0b,0xb5, + 0x41,0x33,0xd0,0xdb,0x89,0xbd,0x3b,0xaf,0x33,0x7e,0xae,0xff,0x20,0xef,0xa9,0x3c, + 0xd7,0xb5,0x45,0x61,0x50,0x76,0x60,0x89,0x6a,0xbb,0x9c,0x3e,0xcb,0xcb,0xdb,0x0b, +}; + +static unsigned char dh_xa_1536[] = { + 0x56,0x68,0x23,0x22,0x49,0x24,0xf2,0x21,0xee,0x5f,0x12,0x46,0xe2,0xea,0x69,0x93, + 0x0,0xf5,0x10,0x1d,0x4d,0x96,0x7b,0xa4,0x9d,0xab,0xbe,0xdf,0x8e,0xcc,0xa5,0x0e, + 0x84,0x12,0x4e,0x77,0xc0,0x46,0x6b,0x51,0x11,0x46,0x4f,0x73,0x1e,0x1c,0x1c,0xd1, + 0x3,0xea,0x0e,0x11,0xdb,0xa3,0xa6,0x14,0xdb,0xdc,0x3e,0xc5,0x7f,0x7d,0x7a,0x69, + 0xa1,0x38,0x70,0x95,0xa5,0x2d,0x47,0xa3,0x0f,0xcf,0xf9,0x7c,0x2,0x4e,0x52,0x4c, + 0xd6,0x5b,0x9e,0xf3,0x7f,0x64,0x70,0x13,0x59,0x8e,0x44,0x31,0x92,0x1b,0xb4,0xaa, + 0xf9,0x64,0xfd,0xb7,0x3c,0x81,0xc0,0xf9,0x66,0x5d,0xff,0x9,0x3e,0x26,0xaf,0x1a, + 0xc0,0xd2,0xd9,0x7c,0x0e,0x6f,0x81,0x12,0x82,0x90,0x1b,0x37,0xb7,0x1a,0x7e,0x36, + 0x79,0x15,0xb1,0xe1,0xd5,0x2d,0x72,0xd4,0x47,0xf7,0x30,0x3c,0x17,0xe1,0x76,0x15, + 0xbc,0x17,0xdc,0x9d,0xd9,0xfc,0xfd,0xb6,0xe6,0xbd,0x8e,0x47,0x8d,0xbb,0xa8,0x8a, + 0xe7,0xe7,0x57,0xf2,0xd8,0x80,0x4c,0xdd,0xe7,0xaf,0x29,0xee,0x40,0x4e,0x2,0xad, + 0xec,0xb3,0x18,0x8e,0x4b,0x2d,0xd2,0x28,0x4e,0x58,0x85,0x29,0xe3,0x93,0x1b,0xa7, +}; + +static unsigned char dh_except_a_pubkey_1536[] = { + 0x97,0x1e,0x6d,0xf7,0xb1,0x2f,0xa7,0x82,0x9e,0x99,0x22,0xfb,0xf3,0x4e,0x2a,0x73, + 0xcc,0xd9,0x2b,0x10,0x1,0xfb,0xac,0xf1,0x81,0xfe,0x78,0x3d,0x23,0xb0,0xcf,0x5c, + 0x95,0x69,0x36,0xc0,0x99,0x6a,0xd2,0x9c,0xf0,0x85,0x8d,0xda,0x5d,0xba,0x8e,0x0f, + 0xa3,0xce,0xbe,0x9b,0xe8,0x3b,0xad,0x71,0xfd,0xfd,0x53,0x25,0xee,0x61,0x26,0x15, + 0x0a,0x46,0x9e,0xce,0x85,0xb1,0x5c,0xf1,0xa0,0x8f,0xe7,0x89,0xe3,0x4f,0x7c,0xea, + 0x18,0xd3,0xa9,0x44,0xce,0x35,0x9,0x86,0x80,0x8c,0x30,0x1,0xbc,0x6d,0xf6,0x6a, + 0x3a,0xa6,0xad,0xbe,0xfa,0x73,0x6b,0xb0,0x35,0x8c,0x63,0x80,0xb6,0x58,0x51,0x6e, + 0x4c,0x5d,0x4a,0xe9,0xa9,0x72,0x6,0x9f,0xa2,0x3e,0x64,0xaf,0x70,0x63,0xee,0x2a, + 0x5d,0x73,0xf3,0xdc,0xa3,0x32,0x0f,0x8,0x48,0xcf,0x13,0x80,0x0d,0xdb,0x91,0xdf, + 0x87,0x99,0xa4,0x8a,0x50,0xe9,0x75,0x43,0xfb,0x56,0xd7,0x89,0xc3,0x10,0x7e,0xd0, + 0xb7,0x46,0xd8,0x41,0x91,0xdf,0xb1,0x91,0x8e,0xc1,0x58,0xd7,0x7c,0x33,0x1e,0xb3, + 0xa3,0xda,0xcb,0xf5,0x0,0x76,0xe4,0xee,0x20,0xd6,0x9d,0x8a,0x28,0xa4,0xdb,0xf9, +}; + +static unsigned char dh_except_b_pubkey_1536[] = { + 0x44, 0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x97, 0xaa, 0xba, 0xb4, 0xdd, 0xc9, 0x5b, 0x28, 0x10, +}; + +static unsigned char dh_share_key_1536[] = { + 0xaf, 0xd4, 0xf6, 0x45, 0x63, 0x21, 0x8d, 0x98, 0xc4, 0xab, 0x18, 0xd7, 0x2b, 0x3c, 0x1d, 0xde, + 0xe7, 0x1f, 0xe1, 0xc5, 0x79, 0x57, 0x60, 0x20, 0xfa, 0x99, 0xbd, 0x7b, 0xa2, 0x94, 0x0b, 0xa3, + 0xb4, 0xb3, 0x33, 0x4a, 0x2f, 0xd0, 0x17, 0x7, 0x2e, 0x70, 0x19, 0x84, 0x1f, 0x8e, 0xe9, 0x61, + 0xe5, 0x52, 0x3, 0x96, 0xea, 0xd8, 0xb6, 0x3, 0x9f, 0xc4, 0x3e, 0x23, 0x77, 0x17, 0x54, 0xfb, + 0x13, 0xf0, 0x3e, 0x9a, 0x27, 0x5d, 0x12, 0x99, 0x58, 0x8d, 0x41, 0x46, 0xd9, 0xc9, 0x29, 0xbd, + 0x40, 0xd1, 0x4f, 0xef, 0x63, 0x7b, 0x54, 0xe6, 0x59, 0x6d, 0xe2, 0x30, 0xe8, 0x2c, 0x2f, 0xf9, + 0x66, 0xa2, 0x12, 0xf5, 0x58, 0x61, 0xac, 0x43, 0xec, 0x7e, 0xf9, 0x2e, 0x27, 0x70, 0x35, 0x75, + 0xb4, 0x10, 0x29, 0xac, 0x0a, 0xab, 0x59, 0xb6, 0x68, 0x4c, 0x16, 0xaf, 0xf0, 0x4f, 0x21, 0xcd, + 0xcc, 0x48, 0x97, 0xe4, 0x21, 0x65, 0xa6, 0x55, 0xb8, 0xf3, 0xb2, 0x7b, 0x91, 0xd7, 0xca, 0xb9, + 0x17, 0x58, 0x31, 0x71, 0xc0, 0xc9, 0x69, 0x1e, 0xf0, 0x9e, 0x3f, 0xe2, 0x37, 0x4, 0x2d, 0xa8, + 0x55, 0x9, 0x6b, 0x9c, 0xc6, 0x37, 0xa9, 0x9b, 0xdf, 0x67, 0x73, 0x7b, 0x46, 0xf9, 0x63, 0x47, + 0xcb, 0xa0, 0x57, 0x2a, 0xed, 0x97, 0x2f, 0xfe, 0x92, 0xf2, 0x20, 0x2c, 0x7e, 0xee, 0x7d, 0x11, +}; + +static unsigned char dh_p_2048[] = { + 0xce, 0x58, 0xe8, 0x62, 0xc8, 0xd2, 0xb5, 0x45, 0x1f, 0xa5, 0xc3, 0xdb, 0x8e, 0x69, 0x42, 0xd2, + 0x21, 0x7e, 0x6b, 0x26, 0x69, 0x45, 0xf1, 0x33, 0xcf, 0xd7, 0xe6, 0x6e, 0x64, 0xc3, 0x29, 0xa5, + 0x68, 0x49, 0x3d, 0x13, 0x0b, 0x42, 0x36, 0xa6, 0xf4, 0xb1, 0xab, 0xa3, 0x8f, 0xe6, 0xcf, 0x46, + 0xe8, 0x85, 0xf3, 0xaa, 0xcb, 0x09, 0x84, 0x32, 0x34, 0xf7, 0x46, 0x0a, 0x65, 0xf9, 0xb5, 0x97, + 0xc2, 0x4a, 0x6f, 0x41, 0x40, 0xc9, 0x9e, 0x63, 0xe1, 0x0f, 0xd2, 0x12, 0x59, 0x35, 0xcc, 0x39, + 0x99, 0x04, 0xe8, 0x9a, 0xd2, 0x00, 0x7a, 0xce, 0x3c, 0x78, 0xfe, 0xea, 0x4b, 0x13, 0x53, 0xcd, + 0xc3, 0x60, 0x73, 0xa4, 0x3f, 0xbc, 0x8a, 0x8d, 0x61, 0x1c, 0xfa, 0xaf, 0xb7, 0xf8, 0x37, 0xa5, + 0xe2, 0x3a, 0xd2, 0x7a, 0xb6, 0x00, 0xf3, 0xd8, 0x3a, 0xa2, 0x46, 0xd2, 0x5c, 0x91, 0xc1, 0x05, + 0x6a, 0xf3, 0x2c, 0xd2, 0x2d, 0x55, 0xc1, 0x54, 0x40, 0x18, 0x71, 0x07, 0x96, 0xa9, 0x56, 0x6e, + 0x45, 0x58, 0x24, 0xce, 0x75, 0x80, 0x3, 0x68, 0x36, 0x96, 0x03, 0xb2, 0x9c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34, 0xdf, 0x23, + 0x15, 0xa2, 0x8b, 0xec, 0xf3, 0x3e, 0x20, 0x93, 0x63, 0x88, 0x17, 0x70, 0x75, 0xbb, 0x9d, 0xb8, + 0x32, 0xb0, 0xae, 0xb5, 0x24, 0x6a, 0x86, 0xf6, 0xc1, 0x60, 0x41, 0xc4, 0xf4, 0x95, 0x6e, 0x10, + 0x2f, 0xd8, 0x58, 0x56, 0x42, 0x82, 0x71, 0x85, 0x19, 0xde, 0x91, 0xf0, 0x2f, 0x30, 0x0c, 0x63, + 0x0f, 0x2a, 0x77, 0x25, 0x4b, 0xb3, 0xd3, 0x2d, 0xfd, 0x94, 0x8b, 0x53, 0x02, 0x21, 0x40, 0xd7, + 0x36, 0x76, 0xf3, 0xc8, 0xc0, 0x36, 0x3d, 0x23, 0xc9, 0xbd, 0x92, 0x51, 0xf2, 0x4b, 0x83, 0x15, + 0xe0, 0x80, 0x86, 0x24, 0xe2, 0x20, 0x35, 0x97, 0xda, 0x0e, 0x68, 0x39, 0x01, 0xdd, 0x01, 0x87, + 0xa2, 0x47, 0xd2, 0x0d, 0xee, 0xfe, 0xdc, 0x5a, 0x37, 0x23, 0xeb, 0x3d, 0xe8, 0x1e, 0x39, 0x2d, + 0xbf, 0xa6, 0xe9, 0x17, 0x48, 0xe2, 0xea, 0xef, 0x1d, 0x2f, 0xe2, 0xaf, 0x3c, 0xbc, 0xae, 0xa7, + 0x42, 0x9b, 0xa5, 0x7d, 0x47, 0x8a, 0x20, 0xc5, 0xae, 0xa1, 0xe4, 0xe8, 0x1c, 0x05, 0xc0, 0x0a, + 0x05, 0xdc, 0x01, 0x74, 0xde, 0xad, 0xad, 0x07, 0xec, 0x6e, 0x6a, 0xc7, 0xee, 0x0f, 0xb8, 0xbe, + 0xaa, 0x46, 0x61, 0x8c, 0x12, 0x5a, 0xaf, 0x05, 0xff, 0x1b, 0x35, 0x6b, 0xe2, 0x3d, 0x48, 0x4f +}; + +static unsigned char dh_except_a_pubkey_2048[] = { + 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0, 0x46, 0xf7, 0x9, 0x2, 0xdb, 0x2f, 0x70, 0x11, 0xdd, + 0xb0, 0x13, 0xa2, 0xc1, 0x58, 0x74, 0x29, 0x19, 0x8d, 0x4a, 0x94, 0x80, 0x0b, 0xd7, 0x25, 0x85, + 0x10, 0x35, 0x97, 0x48, 0x6e, 0x70, 0x28, 0xae, 0x58, 0x97, 0x7d, 0xf2, 0x19, 0x27, 0x13, 0xab, + 0x47, 0x9b, 0x54, 0xdf, 0xc3, 0x5b, 0x5f, 0x5e, 0xb4, 0x64, 0x47, 0xce, 0x40, 0x3b, 0x0c, 0x4a, + 0x62, 0x52, 0xba, 0xc7, 0xf0, 0x36, 0x87, 0x9c, 0x79, 0x9a, 0x83, 0x11, 0x61, 0x0c, 0x1b, 0x6b +}; + +static unsigned char dh_except_b_pubkey_2048[] = { + 0x44, 0x58, 0xe8, 0x62, 0xc8, 0xd2, 0xb5, 0x45, 0x1f, 0xa5, 0xc3, 0xdb, 0x8e, 0x69, 0x42, 0xd2, + 0x21, 0x7e, 0x6b, 0x26, 0x69, 0x45, 0xf1, 0x33, 0xcf, 0xd7, 0xe6, 0x6e, 0x64, 0xc3, 0x29, 0xa5, + 0x68, 0x49, 0x3d, 0x13, 0x0b, 0x42, 0x36, 0xa6, 0xf4, 0xb1, 0xab, 0xa3, 0x8f, 0xe6, 0xcf, 0x46, + 0xe8, 0x85, 0xf3, 0xaa, 0xcb, 0x9, 0x84, 0x32, 0x34, 0xf7, 0x46, 0x0a, 0x65, 0xf9, 0xb5, 0x97, + 0xc2, 0x4a, 0x6f, 0x41, 0x40, 0xc9, 0x9e, 0x63, 0xe1, 0x0f, 0xd2, 0x12, 0x59, 0x35, 0xcc, 0x39, + 0x99, 0x4, 0xe8, 0x9a, 0xd2, 0x0, 0x7a, 0xce, 0x3c, 0x78, 0xfe, 0xea, 0x4b, 0x13, 0x53, 0xcd, + 0xc3, 0x60, 0x73, 0xa4, 0x3f, 0xbc, 0x8a, 0x8d, 0x61, 0x1c, 0xfa, 0xaf, 0xb7, 0xf8, 0x37, 0xa5, + 0xe2, 0x3a, 0xd2, 0x7a, 0xb6, 0x0, 0xf3, 0xd8, 0x3a, 0xa2, 0x46, 0xd2, 0x5c, 0x91, 0xc1, 0x5, + 0x6a, 0xf3, 0x2c, 0xd2, 0x2d, 0x55, 0xc1, 0x54, 0x40, 0x18, 0x71, 0x7, 0x96, 0xa9, 0x56, 0x6e, + 0x45, 0x58, 0x24, 0xce, 0x75, 0x80, 0x3, 0x68, 0x36, 0x96, 0x3, 0xb2, 0x9c, 0x25, 0xbc, 0x55, + 0x0d, 0xe8, 0xa1, 0x7d, 0xdd, 0x39, 0x87, 0x3c, 0xa1, 0x6a, 0xeb, 0x1b, 0x4f, 0x14, 0x72, 0x88, + 0x6c, 0x14, 0x6d, 0x24, 0xb7, 0xda, 0xf8, 0x97, 0xaa, 0xba, 0xb4, 0xdd, 0xc9, 0x5b, 0x28, 0x10, + 0x49, 0xfa, 0x93, 0xcc, 0x62, 0xc0, 0x70, 0xf8, 0xd6, 0xdc, 0xb2, 0x80, 0x35, 0x20, 0x84, 0xa4, + 0x99, 0xfc, 0x10, 0x7c, 0x9d, 0xc0, 0xc6, 0xd4, 0x8b, 0x0c, 0x57, 0xf1, 0x1, 0xf5, 0x1a, 0x4f, + 0x20, 0xfa, 0x8d, 0x66, 0x8b, 0x22, 0x3c, 0x96, 0xef, 0xd0, 0xde, 0xe5, 0x7e, 0x7f, 0x23, 0xdc, + 0x6d, 0x71, 0xdf, 0xc3, 0xe5, 0x1b, 0x39, 0xfe, 0xb7, 0x77, 0xe5, 0x72, 0x0d, 0x1c, 0x8d, 0xb7 +}; + +static unsigned char dh_share_key_2048[] = { + 0xaf, 0xd4, 0xf6, 0x45, 0x63, 0x21, 0x8d, 0x98, 0xc4, 0xab, 0x18, 0xd7, 0x2b, 0x3c, 0x1d, 0xde, + 0xe7, 0x1f, 0xe1, 0xc5, 0x79, 0x57, 0x60, 0x20, 0xfa, 0x99, 0x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, 0xa2, 0xbe, 0x37, 0xde, 0x86, 0x46, 0x20, 0x27, 0x9d, 0xa0, 0x2f, 0x4, 0xc1, 0xcd, + 0xff, 0x81, 0xe5, 0xe6, 0x2c, 0x9e, 0x39, 0x82, 0x31, 0x54, 0x33, 0xf8, 0xe7, 0xa0, 0xe5, 0x96, + 0xa4, 0x40, 0xc4, 0x44, 0xfe, 0x93, 0x66, 0xe2, 0xda, 0xaa, 0xb8, 0xfb, 0x2f, 0x3b, 0x8c, 0xce, +}; + +static unsigned char dh_p_3072[] = { + 0xce, 0x58, 0xe8, 0x62, 0xc8, 0xd2, 0xb5, 0x45, 0x1f, 0xa5, 0xc3, 0xdb, 0x8e, 0x69, 0x42, 0xd2, + 0x21, 0x7e, 0x6b, 0x26, 0x69, 0x45, 0xf1, 0x33, 0xcf, 0xd7, 0xe6, 0x6e, 0x64, 0xc3, 0x29, 0xa5, + 0x68, 0x49, 0x3d, 0x13, 0x0b, 0x42, 0x36, 0xa6, 0xf4, 0xb1, 0xab, 0xa3, 0x8f, 0xe6, 0xcf, 0x46, + 0xe8, 0x85, 0xf3, 0xaa, 0xcb, 0x09, 0x84, 0x32, 0x34, 0xf7, 0x46, 0x0a, 0x65, 0xf9, 0xb5, 0x97, + 0xc2, 0x4a, 0x6f, 0x41, 0x40, 0xc9, 0x9e, 0x63, 0xe1, 0x0f, 0xd2, 0x12, 0x59, 0x35, 0xcc, 0x39, + 0x99, 0x04, 0xe8, 0x9a, 0xd2, 0x00, 0x7a, 0xce, 0x3c, 0x78, 0xfe, 0xea, 0x4b, 0x13, 0x53, 0xcd, + 0xc3, 0x60, 0x73, 0xa4, 0x3f, 0xbc, 0x8a, 0x8d, 0x61, 0x1c, 0xfa, 0xaf, 0xb7, 0xf8, 0x37, 0xa5, + 0xe2, 0x3a, 0xd2, 0x7a, 0xb6, 0x00, 0xf3, 0xd8, 0x3a, 0xa2, 0x46, 0xd2, 0x5c, 0x91, 0xc1, 0x05, + 0x6a, 0xf3, 0x2c,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xf7, 0x46, 0x0a, 0x65, 0xf9, 0xb5, 0x97, + 0xc2, 0x4a, 0x6f, 0x41, 0x40, 0xc9, 0x9e, 0x63, 0xe1, 0x0f, 0xd2, 0x12, 0x59, 0x35, 0xcc, 0x39, + 0x99, 0x04, 0xe8, 0x9a, 0xd2, 0x00, 0x7a, 0xce, 0x3c, 0x78, 0xfe, 0xea, 0x4b, 0x13, 0x53, 0xcd, + 0xc3, 0x60, 0x73, 0xa4, 0x3f, 0xbc, 0x8a, 0x8d, 0x61, 0x1c, 0xfa, 0xaf, 0xb7, 0xf8, 0x37, 0xa5, + 0xe2, 0x3a, 0xd2, 0x7a, 0xb6, 0x00, 0xf3, 0xd8, 0x3a, 0xa2, 0x46, 0xd2, 0x5c, 0x91, 0xc1, 0x05, +}; + +static unsigned char dh_xa_3072[] = { + 0x6b, 0x1f, 0xc4, 0x85, 0x98, 0xc3, 0x01, 0xda, 0x39, 0xf0, 0x1b, 0x76, 0x5d, 0x81, 0x1d, 0x1f, + 0xc9, 0x93, 0x95, 0xc1, 0xf8, 0xd1, 0x67, 0x2c, 0xd4, 0x0a, 0x67, 0xf0, 0x40, 0x86, 0x82, 0x7f, + 0x8f, 0x9d, 0x79, 0x04, 0xee, 0x4a, 0x54, 0xc9, 0x9c, 0x7f, 0xda, 0x15, 0x13, 0xc6, 0x95, 0xfb, + 0xfc, 0x7b, 0xe7, 0xd8, 0xde, 0x2a, 0xd8, 0xfd, 0xff, 0xdb, 0xa4, 0x7f, 0x4b, 0x37, 0x5d, 0x42, + 0xb6, 0x46, 0x4c, 0xbc, 0x34, 0x23, 0x99, 0x74, 0xf8, 0x80, 0x1b, 0xc1, 0x97, 0x34, 0xdf, 0x23, + 0x15, 0xa2, 0x8b, 0xec, 0xf3, 0x3e, 0x20, 0x93, 0x63, 0x88, 0x17, 0x70, 0x75, 0xbb, 0x9d, 0xb8, + 0x32, 0xb0, 0xae, 0xb5, 0x24, 0x6a, 0x86, 0xf6, 0xc1, 0x60, 0x41,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, 0x79, 0x04, 0xee, 0x4a, 0x54, 0xc9, 0x9c, 0x7f, 0xda, 0x15, 0x13, 0xc6, 0x95, 0xfb, + 0xfc, 0x7b, 0xe7, 0xd8, 0xde, 0x2a, 0xd8, 0xfd, 0xff, 0xdb, 0xa4, 0x7f, 0x4b, 0x37, 0x5d, 0x42, + 0xb6, 0x46, 0x4c, 0xbc, 0x34, 0x23, 0x99, 0x74, 0xf8, 0x80, 0x1b, 0xc1, 0x97, 0x34, 0xdf, 0x23, + 0x15, 0xa2, 0x8b, 0xec, 0xf3, 0x3e, 0x20, 0x93, 0x63, 0x88, 0x17, 0x70, 0x75, 0xbb, 0x9d, 0xb8, + 0x32, 0xb0, 0xae, 0xb5, 0x24, 0x6a, 0x86, 0xf6, 0xc1, 0x60, 0x41, 0xc4, 0xf4, 0x95, 0x6e, 0x10, + 0x2f, 0xd8, 0x58, 0x56, 0x42, 0x82, 0x71, 0x85, 0x19, 0xde, 0x91, 0xf0, 0x2f, 0x30, 0x0c, 0x63, +}; + +static unsigned char dh_except_a_pubkey_3072[] = { + 0xa5, 0x24, 0x63, 0x20, 0xb2, 0x56, 0x9a, 0x94, 0x97, 0xf7, 0x88, 0x41, 0x35, 0xeb, 0x52, 0x37, + 0xa4, 0xf2, 0x74, 0x1b, 0x38, 0xe4, 0x4c, 0x8b, 0x4b, 0xd2, 0xa5, 0xad, 0xb8, 0x2f, 0x7b, 0x5a, + 0xfd, 0xbc, 0x9c, 0xe0, 0xea, 0x9e, 0x82, 0x3, 0x62, 0xe2, 0xdc, 0x6c, 0x56, 0x9, 0x2, 0x28, + 0xb8, 0x2d, 0xb8, 0x46, 0xaf, 0x3a, 0xf4, 0x51, 0xf7, 0x4d, 0xc4, 0xd9, 0xa9, 0x1d, 0x67, 0x9d, + 0x2b, 0x18, 0x56, 0x86, 0x2a, 0x3, 0x19, 0xe9, 0x6, 0xeb, 0x4a, 0x6f, 0x2a, 0x40, 0x28, 0xbb, + 0x3e, 0x87, 0xc1, 0xce, 0x39, 0x6e, 0x3b, 0x1f, 0xb0, 0x9, 0x33, 0x67, 0x19, 0x0e, 0x1a, 0xb2, + 0xb3, 0x7d, 0xd3, 0xe6, 0x33, 0xf4, 0x7c, 0x82, 0x73, 0x7b, 0xb6, 0x16, 0x55, 0xff, 0x76, 0xaf, + 0x7f, 0xc2, 0x42, 0x51, 0xa9, 0xad, 0x1e, 0x72, 0xc9, 0x63, 0xab, 0x41, 0x5a, 0x26, 0x32, 0x39, + 0x5d, 0xa6, 0x7, 0x56, 0x93, 0x89, 0xe5, 0x0f, 0x2a, 0xb5, 0x67, 0x3a, 0xcf, 0xc3, 0x82, 0x83, + 0xf6, 0x88, 0x52, 0x0b, 0xfc, 0x6a, 0x5b, 0x1a, 0x57, 0x87, 0x86, 0xef, 0xda, 0x47, 0xdb, 0x4d, + 0xba, 0xe7, 0x3, 0x5b, 0xe4, 0x70, 0x8b, 0xe0, 0xe1, 0x92, 0x13, 0x86, 0x74, 0x4, 0xdc, 0x6a, + 0x0a, 0x2a, 0x20, 0xec, 0x6d, 0xbf, 0xf0, 0x46, 0xf7, 0x9, 0x2, 0xdb, 0x2f, 0x70, 0x11, 0xdd, + 0xb0, 0x13, 0xa2, 0xc1, 0x58, 0x74, 0x29, 0x19, 0x8d, 0x4a, 0x94, 0x80, 0x0b, 0xd7, 0x25, 0x85, + 0x10, 0x35, 0x97, 0x48, 0x6e, 0x70, 0x28, 0xae, 0x58, 0x97, 0x7d, 0xf2, 0x19, 0x27, 0x13, 0xab, + 0x47, 0x9b, 0x54, 0xdf, 0xc3, 0x5b, 0x5f, 0x5e, 0xb4, 0x64, 0x47, 0xce, 0x40, 0x3b, 0x0c, 0x4a, + 0x62, 0x52, 0xba, 0xc7, 0xf0, 0x36, 0x87, 0x9c, 0x79, 0x9a, 0x83, 0x11, 0x61, 0x0c, 0x1b, 0x6b, + 0xa5, 0x24, 0x63, 0x20, 0xb2, 0x56, 0x9a, 0x94, 0x97, 0xf7, 0x88, 0x41, 0x35, 0xeb, 0x52, 0x37, + 0xa4, 0xf2, 0x74, 0x1b, 0x38, 0xe4, 0x4c, 0x8b, 0x4b, 0xd2, 0xa5, 0xad, 0xb8, 0x2f, 0x7b, 0x5a, + 0xfd, 0xbc, 0x9c, 0xe0, 0xea, 0x9e, 0x82, 0x3, 0x62, 0xe2, 0xdc, 0x6c, 0x56, 0x9, 0x2, 0x28, + 0xb8, 0x2d, 0xb8, 0x46, 0xaf, 0x3a, 0xf4, 0x51, 0xf7, 0x4d, 0xc4, 0xd9, 0xa9, 0x1d, 0x67, 0x9d, + 0x2b, 0x18, 0x56, 0x86, 0x2a, 0x3, 0x19, 0xe9, 0x6, 0xeb, 0x4a, 0x6f, 0x2a, 0x40, 0x28, 0xbb, + 0x3e, 0x87, 0xc1, 0xce, 0x39, 0x6e, 0x3b, 0x1f, 0xb0, 0x9, 0x33, 0x67, 0x19, 0x0e, 0x1a, 0xb2, + 0xb3, 0x7d, 0xd3, 0xe6, 0x33, 0xf4, 0x7c, 0x82, 0x73, 0x7b, 0xb6, 0x16, 0x55, 0xff, 0x76, 0xaf, + 0x7f, 0xc2, 0x42, 0x51, 0xa9, 0xad, 0x1e, 0x72, 0xc9, 0x63, 0xab, 0x41, 0x5a, 0x26, 0x32, 0x39, +}; + +static unsigned char dh_except_b_pubkey_3072[] = { + 0x44, 0x58, 0xe8, 0x62, 0xc8, 0xd2, 0xb5, 0x45, 0x1f, 0xa5, 0xc3, 0xdb, 0x8e, 0x69, 0x42, 0xd2, + 0x21, 0x7e, 0x6b, 0x26, 0x69, 0x45, 0xf1, 0x33, 0xcf, 0xd7, 0xe6, 0x6e, 0x64, 0xc3, 0x29, 0xa5, + 0x68, 0x49, 0x3d, 0x13, 0x0b, 0x42, 0x36, 0xa6, 0xf4, 0xb1, 0xab, 0xa3, 0x8f, 0xe6, 0xcf, 0x46, + 0xe8, 0x85, 0xf3, 0xaa, 0xcb, 0x9, 0x84, 0x32, 0x34, 0xf7, 0x46, 0x0a, 0x65, 0x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xa0, 0x2f, 0x4, 0xc1, 0xcd, + 0xff, 0x81, 0xe5, 0xe6, 0x2c, 0x9e, 0x39, 0x82, 0x31, 0x54, 0x33, 0xf8, 0xe7, 0xa0, 0xe5, 0x96, + 0xa4, 0x40, 0xc4, 0x44, 0xfe, 0x93, 0x66, 0xe2, 0xda, 0xaa, 0xb8, 0xfb, 0x2f, 0x3b, 0x8c, 0xce, + 0xaf, 0xd4, 0xf6, 0x45, 0x63, 0x21, 0x8d, 0x98, 0xc4, 0xab, 0x18, 0xd7, 0x2b, 0x3c, 0x1d, 0xde, + 0xe7, 0x1f, 0xe1, 0xc5, 0x79, 0x57, 0x60, 0x20, 0xfa, 0x99, 0xbd, 0x7b, 0xa2, 0x94, 0x0b, 0xa3, + 0xb4, 0xb3, 0x33, 0x4a, 0x2f, 0xd0, 0x17, 0x7, 0x2e, 0x70, 0x19, 0x84, 0x1f, 0x8e, 0xe9, 0x61, + 0xe5, 0x52, 0x3, 0x96, 0xea, 0xd8, 0xb6, 0x3, 0x9f, 0xc4, 0x3e, 0x23, 0x77, 0x17, 0x54, 0xfb, + 0x13, 0xf0, 0x3e, 0x9a, 0x27, 0x5d, 0x12, 0x99, 0x58, 0x8d, 0x41, 0x46, 0xd9, 0xc9, 0x29, 0xbd, + 0x40, 0xd1, 0x4f, 0xef, 0x63, 0x7b, 0x54, 0xe6, 0x59, 0x6d, 0xe2, 0x30, 0xe8, 0x2c, 0x2f, 0xf9, + 0x66, 0xa2, 0x12, 0xf5, 0x58, 0x61, 0xac, 0x43, 0xec, 0x7e, 0xf9, 0x2e, 0x27, 0x70, 0x35, 0x75, + 0xb4, 0x10, 0x29, 0xac, 0x0a, 0xab, 0x59, 0xb6, 0x68, 0x4c, 0x16, 0xaf, 0xf0, 0x4f, 0x21, 0xcd, +}; + +static unsigned char dh_p_4096[] = { + 0xce, 0x58, 0xe8, 0x62, 0xc8, 0xd2, 0xb5, 0x45, 0x1f, 0xa5, 0xc3, 0xdb, 0x8e, 0x69, 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a, 0xa2, 0x46, 0xd2, 0x5c, 0x91, 0xc1, 0x05, + 0x6a, 0xf3, 0x2c, 0xd2, 0x2d, 0x55, 0xc1, 0x54, 0x40, 0x18, 0x71, 0x07, 0x96, 0xa9, 0x56, 0x6e, + 0x45, 0x58, 0x24, 0xce, 0x75, 0x80, 0x3, 0x68, 0x36, 0x96, 0x03, 0xb2, 0x9c, 0x25, 0xbc, 0x55, + 0x0d, 0xe8, 0xa1, 0x7d, 0xdd, 0x39, 0x87, 0x3c, 0xa1, 0x6a, 0xeb, 0x1b, 0x4f, 0x14, 0x72, 0x88, + 0x6c, 0x14, 0x6d, 0x24, 0xb7, 0xda, 0xf8, 0x97, 0xaa, 0xba, 0xb4, 0xdd, 0xc9, 0x5b, 0x28, 0x10, + 0x49, 0xfa, 0x93, 0xcc, 0x62, 0xc0, 0x70, 0xf8, 0xd6, 0xdc, 0xb2, 0x80, 0x35, 0x20, 0x84, 0xa4, + 0x99, 0xfc, 0x10, 0x7c, 0x9d, 0xc0, 0xc6, 0xd4, 0x8b, 0x0c, 0x57, 0xf1, 0x01, 0xf5, 0x1a, 0x4f, + 0x20, 0xfa, 0x8d, 0x66, 0x8b, 0x22, 0x3c, 0x96, 0xef, 0xd0, 0xde, 0xe5, 0x7e, 0x7f, 0x23, 0xdc, + 0x6d, 0x71, 0xdf, 0xc3, 0xe5, 0x1b, 0x39, 0xfe, 0xb7, 0x77, 0xe5, 0x72, 0x0d, 0x1c, 0x8d, 0xb7 +}; + +static unsigned char dh_xa_4096[] = { + 0x6b, 0x1f, 0xc4, 0x85, 0x98, 0xc3, 0x01, 0xda, 0x39, 0xf0, 0x1b, 0x76, 0x5d, 0x81, 0x1d, 0x1f, + 0xc9, 0x93, 0x95, 0xc1, 0xf8, 0xd1, 0x67, 0x2c, 0xd4, 0x0a, 0x67, 0xf0, 0x40, 0x86, 0x82, 0x7f, + 0x8f, 0x9d, 0x79, 0x04, 0xee, 0x4a, 0x54, 0xc9, 0x9c, 0x7f, 0x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bd, 0x92, 0x51, 0xf2, 0x4b, 0x83, 0x15, + 0xe0, 0x80, 0x86, 0x24, 0xe2, 0x20, 0x35, 0x97, 0xda, 0x0e, 0x68, 0x39, 0x01, 0xdd, 0x01, 0x87, + 0xa2, 0x47, 0xd2, 0x0d, 0xee, 0xfe, 0xdc, 0x5a, 0x37, 0x23, 0xeb, 0x3d, 0xe8, 0x1e, 0x39, 0x2d, + 0xbf, 0xa6, 0xe9, 0x17, 0x48, 0xe2, 0xea, 0xef, 0x1d, 0x2f, 0xe2, 0xaf, 0x3c, 0xbc, 0xae, 0xa7, + 0x42, 0x9b, 0xa5, 0x7d, 0x47, 0x8a, 0x20, 0xc5, 0xae, 0xa1, 0xe4, 0xe8, 0x1c, 0x05, 0xc0, 0x0a, + 0x05, 0xdc, 0x01, 0x74, 0xde, 0xad, 0xad, 0x07, 0xec, 0x6e, 0x6a, 0xc7, 0xee, 0x0f, 0xb8, 0xbe, + 0xaa, 0x46, 0x61, 0x8c, 0x12, 0x5a, 0xaf, 0x05, 0xff, 0x1b, 0x35, 0x6b, 0xe2, 0x3d, 0x48, 0x4f +}; + +static unsigned char dh_except_a_pubkey_4096[] = { + 0xa5, 0x24, 0x63, 0x20, 0xb2, 0x56, 0x9a, 0x94, 0x97, 0xf7, 0x88, 0x41, 0x35, 0xeb, 0x52, 0x37, + 0xa4, 0xf2, 0x74, 0x1b, 0x38, 0xe4, 0x4c, 0x8b, 0x4b, 0xd2, 0xa5, 0xad, 0xb8, 0x2f, 0x7b, 0x5a, + 0xfd, 0xbc, 0x9c, 0xe0, 0xea, 0x9e, 0x82, 0x3, 0x62, 0xe2, 0xdc, 0x6c, 0x56, 0x9, 0x2, 0x28, + 0xb8, 0x2d, 0xb8, 0x46, 0xaf, 0x3a, 0xf4, 0x51, 0xf7, 0x4d, 0xc4, 0xd9, 0xa9, 0x1d, 0x67, 0x9d, + 0x2b, 0x18, 0x56, 0x86, 0x2a, 0x3, 0x19, 0xe9, 0x6, 0xeb, 0x4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9, 0x2, 0xdb, 0x2f, 0x70, 0x11, 0xdd, + 0xb0, 0x13, 0xa2, 0xc1, 0x58, 0x74, 0x29, 0x19, 0x8d, 0x4a, 0x94, 0x80, 0x0b, 0xd7, 0x25, 0x85, + 0x10, 0x35, 0x97, 0x48, 0x6e, 0x70, 0x28, 0xae, 0x58, 0x97, 0x7d, 0xf2, 0x19, 0x27, 0x13, 0xab, + 0x47, 0x9b, 0x54, 0xdf, 0xc3, 0x5b, 0x5f, 0x5e, 0xb4, 0x64, 0x47, 0xce, 0x40, 0x3b, 0x0c, 0x4a, + 0x62, 0x52, 0xba, 0xc7, 0xf0, 0x36, 0x87, 0x9c, 0x79, 0x9a, 0x83, 0x11, 0x61, 0x0c, 0x1b, 0x6b +}; + +static unsigned char dh_except_b_pubkey_4096[] = { + 0x44, 0x58, 0xe8, 0x62, 0xc8, 0xd2, 0xb5, 0x45, 0x1f, 0xa5, 0xc3, 0xdb, 0x8e, 0x69, 0x42, 0xd2, + 0x21, 0x7e, 0x6b, 0x26, 0x69, 0x45, 0xf1, 0x33, 0xcf, 0xd7, 0xe6, 0x6e, 0x64, 0xc3, 0x29, 0xa5, + 0x68, 0x49, 0x3d, 0x13, 0x0b, 0x42, 0x36, 0xa6, 0xf4, 0xb1, 0xab, 0xa3, 0x8f, 0xe6, 0xcf, 0x46, + 0xe8, 0x85, 0xf3, 0xaa, 0xcb, 0x9, 0x84, 0x32, 0x34, 0xf7, 0x46, 0x0a, 0x65, 0xf9, 0xb5, 0x97, + 0xc2, 0x4a, 0x6f, 0x41, 0x40, 0xc9, 0x9e, 0x63, 0xe1, 0x0f, 0xd2, 0x12, 0x59, 0x35, 0xcc, 0x39, + 0x99, 0x4, 0xe8, 0x9a, 0xd2, 0x0, 0x7a, 0xce, 0x3c, 0x78, 0xfe, 0xea, 0x4b, 0x13, 0x53, 0xcd, + 0xc3, 0x60, 0x73, 0xa4, 0x3f, 0xbc, 0x8a, 0x8d, 0x61, 0x1c, 0xfa, 0xaf, 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d4, 0x8b, 0x0c, 0x57, 0xf1, 0x1, 0xf5, 0x1a, 0x4f, + 0x20, 0xfa, 0x8d, 0x66, 0x8b, 0x22, 0x3c, 0x96, 0xef, 0xd0, 0xde, 0xe5, 0x7e, 0x7f, 0x23, 0xdc, + 0x6d, 0x71, 0xdf, 0xc3, 0xe5, 0x1b, 0x39, 0xfe, 0xb7, 0x77, 0xe5, 0x72, 0x0d, 0x1c, 0x8d, 0xb7 +}; + +static unsigned char dh_share_key_4096[] = { + 0xaf, 0xd4, 0xf6, 0x45, 0x63, 0x21, 0x8d, 0x98, 0xc4, 0xab, 0x18, 0xd7, 0x2b, 0x3c, 0x1d, 0xde, + 0xe7, 0x1f, 0xe1, 0xc5, 0x79, 0x57, 0x60, 0x20, 0xfa, 0x99, 0xbd, 0x7b, 0xa2, 0x94, 0x0b, 0xa3, + 0xb4, 0xb3, 0x33, 0x4a, 0x2f, 0xd0, 0x17, 0x7, 0x2e, 0x70, 0x19, 0x84, 0x1f, 0x8e, 0xe9, 0x61, + 0xe5, 0x52, 0x3, 0x96, 0xea, 0xd8, 0xb6, 0x3, 0x9f, 0xc4, 0x3e, 0x23, 0x77, 0x17, 0x54, 0xfb, + 0x13, 0xf0, 0x3e, 0x9a, 0x27, 0x5d, 0x12, 0x99, 0x58, 0x8d, 0x41, 0x46, 0xd9, 0xc9, 0x29, 0xbd, + 0x40, 0xd1, 0x4f, 0xef, 0x63, 0x7b, 0x54, 0xe6, 0x59, 0x6d, 0xe2, 0x30, 0xe8, 0x2c, 0x2f, 0xf9, + 0x66, 0xa2, 0x12, 0xf5, 0x58, 0x61, 0xac, 0x43, 0xec, 0x7e, 0xf9, 0x2e, 0x27, 0x70, 0x35, 0x75, + 0xb4, 0x10, 0x29, 0xac, 0x0a, 0xab, 0x59, 0xb6, 0x68, 0x4c, 0x16, 0xaf, 0xf0, 0x4f, 0x21, 0xcd, + 0xcc, 0x48, 0x97, 0xe4, 0x21, 0x65, 0xa6, 0x55, 0xb8, 0xf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 0xda, 0xaa, 0xb8, 0xfb, 0x2f, 0x3b, 0x8c, 0xce, +}; + +/******************************************* ECDH ********************************************/ +static char ecdh_a_secp128r1[] = { + 0xff, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc +}; + +static char ecdh_b_secp128r1[] = { + 0xe8, 0x75, 0x79, 0xc1, 0x10, 0x79, 0xf4, 0x3d, 0xd8, 0x24, 0x99, 0x3c, 0x2c, 0xee, 0x5e, 0xd3 +}; + +static char ecdh_p_secp128r1[] = { + 0xff, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff +}; + +static char ecdh_n_secp128r1[] = { + 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x75, 0xa3, 0x0d, 0x1b, 0x90, 0x38, 0xa1, 0x15 +}; + +static char ecdh_g_secp128r1[] = { + 0x16, 0x1f, 0xf7, 0x52, 0x8b, 0x89, 0x9b, 0x2d, 0x0c, 0x28, 0x60, 0x7c, 0xa5, 0x2c, 0x5b, 0x86, + 0xcf, 0x5a, 0xc8, 0x39, 0x5b, 0xaf, 0xeb, 0x13, 0xc0, 0x2d, 0xa2, 0x92, 0xdd, 0xed, 0x7a, 0x83 +}; + +static char ecdh_da_secp128r1[] = { + 0xfe, 0x4e, 0xc2, 0x5e, 0x00, 0x00, 0x00, 0x00, 0x4d, 0x78, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +static char ecdh_cp_pubkey_secp128r1[] = { + 0x04, + 0xcc, 0x40, 0x99, 0x3b, 0xcd, 0x0b, 0xcf, 0xcb, 0x9a, 0x96, 0x08, 0x56, 0xc2, 0x96, 0x2c, 0xe1, + 0xdf, 0x69, 0x2a, 0x71, 0xaf, 0x96, 0xe2, 0xeb, 0x5a, 0x26, 0x7f, 0xd3, 0x7a, 0xe8, 0x70, 0xf3 +}; + +static char ecdh_except_b_pubkey_secp128r1[] = { + 0x04, + 0xcc, 0x40, 0x99, 0x3b, 0xcd, 0x0b, 0xcf, 0xcb, 0x9a, 0x96, 0x08, 0x56, 0xc2, 0x96, 0x2c, 0xe1, + 0xdf, 0x69, 0x2a, 0x71, 0xaf, 0x96, 0xe2, 0xeb, 0x5a, 0x26, 0x7f, 0xd3, 0x7a, 0xe8, 0x70, 0xf3 +}; + +static char ecdh_cp_sharekey_secp128r1[] = { + 0x68, 0x55, 0x71, 0xa4, 0xd7, 0x51, 0x49, 0xa8, 0x78, 0xa8, 0x3a, 0xc1, 0x3f, 0xb3, 0x8c, 0xcb +}; + +/* ecc sign or verf*/ +static char ecc_except_kinv_secp128r1[] = { + 0xfe, 0x4e, 0xc2, 0x5e, 0x00, 0x00, 0x00, 0x00, 0x4d, 0x78, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +static char ecc_except_e_secp128r1[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x4 +}; + +static char ecc_cp_sign_secp128r1[] = { + 0x2e, 0x69, 0xad, 0x4f, 0xd5, 0xd4, 0x62, 0xec, 0xf2, 0xde, 0x21, 0x4f, 0xbc, 0x1f, 0xe8, 0x19, + 0x7b, 0x98, 0x8d, 0xaf, 0xe4, 0x6c, 0x60, 0x73, 0x00, 0xb0, 0x8b, 0xef, 0x89, 0x65, 0x35, 0x84 +}; + +static char ecdh_a_secp192k1[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +static char ecdh_b_secp192k1[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03 +}; + +static char ecdh_p_secp192k1[] = { + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xee, 0x37 +}; + +static char ecdh_n_secp192k1[] = { + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x26, 0xf2, 0xfc, 0x17, + 0x0f, 0x69, 0x46, 0x6a, 0x74, 0xde, 0xfd, 0x8d +}; + +static char ecdh_g_secp192k1[] = { + 0xdb, 0x4f, 0xf1, 0x0e, 0xc0, 0x57, 0xe9, 0xae, 0x26, 0xb0, 0x7d, 0x02, 0x80, 0xb7, 0xf4, 0x34, + 0x1d, 0xa5, 0xd1, 0xb1, 0xea, 0xe0, 0x6c, 0x7d, + 0x9b, 0x2f, 0x2f, 0x6d, 0x9c, 0x56, 0x28, 0xa7, 0x84, 0x41, 0x63, 0xd0, 0x15, 0xbe, 0x86, 0x34, + 0x40, 0x82, 0xaa, 0x88, 0xd9, 0x5e, 0x2f, 0x9d +}; + +static char ecdh_da_secp192k1[] = { + 0x2b, 0x58, 0xc2, 0x5e, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x58, 0xc2, 0x5e, 0x00, 0x00, 0x00, 0x00, + 0x67, 0x6a, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +static char ecdh_cp_pubkey_secp192k1[] = { + 0x04, + 0xec, 0x0e, 0x64, 0xac, 0x04, 0x2a, 0x88, 0x86, 0xed, 0xc1, 0xf2, 0x50, 0x0f, 0xe1, 0x27, 0x63, + 0x86, 0x63, 0x9e, 0xb2, 0x82, 0x21, 0x6e, 0x3f, 0x48, 0x59, 0x76, 0xb9, 0x4e, 0xd9, 0xe2, 0x02, + 0xb4, 0xdb, 0xfc, 0x8f, 0x49, 0xe7, 0x24, 0x9b, 0xbe, 0x33, 0xee, 0xc8, 0xcc, 0x9e, 0x00, 0x9a +}; + +static char ecdh_cp_sharekey_secp192k1[] = { + 0x79, 0xd3, 0x1c, 0x98, 0xfb, 0xd2, 0xb6, 0x7c, 0x60, 0x4b, 0x6e, 0x4c, 0xa9, 0x95, 0xcb, 0xac, + 0xb0, 0xf9, 0x05, 0xed, 0x9a, 0xcb, 0x2e, 0x5b +}; + +static char ecdh_except_b_pubkey_secp192k1[] = { + 0x04, + 0xec, 0x0e, 0x64, 0xac, 0x04, 0x2a, 0x88, 0x86, 0xed, 0xc1, 0xf2, 0x50, 0x0f, 0xe1, 0x27, 0x63, + 0x86, 0x63, 0x9e, 0xb2, 0x82, 0x21, 0x6e, 0x3f, 0x48, 0x59, 0x76, 0xb9, 0x4e, 0xd9, 0xe2, 0x02, + 0xb4, 0xdb, 0xfc, 0x8f, 0x49, 0xe7, 0x24, 0x9b, 0xbe, 0x33, 0xee, 0xc8, 0xcc, 0x9e, 0x00, 0x9a +}; + +/* ecc sign or verf*/ +static unsigned char ecc_except_kinv_secp192k1[] = { + 0x71, 0x71, 0xb4, 0x5b, 0x79, 0x51, 0x94, 0x70, 0x53, 0xf9, 0x77, 0x02, 0x64, 0xef, 0xc4, 0xdb, + 0x64, 0xfc, 0xbe, 0x4e, 0x44, 0x4a, 0xc6, 0x54 +}; + +static unsigned char ecc_except_e_secp192k1[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04 +}; + +/* 224 */ +static char ecdh_a_secp224r1[] = { + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE +}; + +static char ecdh_b_secp224r1[] = { + 0xB4, 0x05, 0x0A, 0x85, 0x0C, 0x04, 0xB3, 0xAB, 0xF5, 0x41, 0x32, 0x56, 0x50, 0x44, + 0xB0, 0xB7, 0xD7, 0xBF, 0xD8, 0xBA, 0x27, 0x0B, 0x39, 0x43, 0x23, 0x55, 0xFF, 0xB4 +}; + +static char ecdh_p_secp224r1[] = { + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 +}; + +static char ecdh_n_secp224r1[] = { + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x16, 0xA2, 0xE0, 0xB8, 0xF0, 0x3E, 0x13, 0xDD, 0x29, 0x45, 0x5C, 0x5C, 0x2A, 0x3D +}; + +static char ecdh_g_secp224r1[] = { + 0xB7, 0x0E, 0x0C, 0xBD, 0x6B, 0xB4, 0xBF, 0x7F, 0x32, 0x13, 0x90, 0xB9, 0x4A, 0x03, + 0xC1, 0xD3, 0x56, 0xC2, 0x11, 0x22, 0x34, 0x32, 0x80, 0xD6, 0x11, 0x5C, 0x1D, 0x21, + 0xBD, 0x37, 0x63, 0x88, 0xB5, 0xF7, 0x23, 0xFB, 0x4C, 0x22, 0xDF, 0xE6, 0xCD, 0x43, + 0x75, 0xA0, 0x5A, 0x07, 0x47, 0x64, 0x44, 0xD5, 0x81, 0x99, 0x85, 0x00, 0x7E, 0x34 +}; + +static char ecdh_da_secp224r1[] = { + 0x41, 0x5c, 0x8c, 0x34, 0xfd, 0x70, 0x76, 0x3c, 0x6a, 0x81, 0x8e, 0x33, 0x7c, 0xa5, + 0x59, 0x6b, 0xfb, 0x58, 0x8e, 0x74, 0xb8, 0xc7, 0x3c, 0xcf, 0xde, 0xe3, 0x81, 0x60 +}; + +static char ecdh_cp_pubkey_secp224r1[] = { + 0x04, + 0x5b, 0x46, 0x50, 0x7c, 0x7a, 0x37, 0x82, 0x05, 0x5a, 0xc7, 0xd0, 0x29, 0xf8, 0xdd, + 0xe6, 0x3e, 0xb4, 0xc2, 0x31, 0x59, 0xfd, 0xa4, 0xb7, 0xee, 0x61, 0x83, 0x7c, 0x80, + 0xf1, 0x51, 0xf0, 0x5b, 0xfb, 0xc6, 0x63, 0x23, 0x9a, 0x13, 0xfa, 0x47, 0x68, 0x7b, + 0x3e, 0x47, 0xb3, 0x88, 0xca, 0x3e, 0x4b, 0x71, 0x24, 0x17, 0xc7, 0x4c, 0xd0, 0x06 +}; + +static char ecdh_except_b_pubkey_secp224r1[] = { + 0x04, + 0x5b, 0x46, 0x50, 0x7c, 0x7a, 0x37, 0x82, 0x05, 0x5a, 0xc7, 0xd0, 0x29, 0xf8, 0xdd, + 0xe6, 0x3e, 0xb4, 0xc2, 0x31, 0x59, 0xfd, 0xa4, 0xb7, 0xee, 0x61, 0x83, 0x7c, 0x80, + 0xf1, 0x51, 0xf0, 0x5b, 0xfb, 0xc6, 0x63, 0x23, 0x9a, 0x13, 0xfa, 0x47, 0x68, 0x7b, + 0x3e, 0x47, 0xb3, 0x88, 0xca, 0x3e, 0x4b, 0x71, 0x24, 0x17, 0xc7, 0x4c, 0xd0, 0x06 +}; + +static char ecdh_cp_sharekey_secp224r1[] = { + 0x2f, 0xc0, 0x04, 0x34, 0x0e, 0x03, 0xb0, 0xd2, 0x84, 0xe1, 0x4f, 0x4f, 0x7b, 0xac, + 0x53, 0xaa, 0x32, 0x5c, 0xbd, 0xe5, 0xbc, 0x2a, 0xe3, 0xda, 0x48, 0x38, 0x67, 0x16 +}; + + +/* 256 */ +static char ecdh_a_secp256k1[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +static char ecdh_b_secp256k1[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07 +}; + +static char ecdh_p_secp256k1[] = { + 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, 0xfe, 0xff, 0xff, 0xfc, 0x2f +}; + +static char ecdh_n_secp256k1[] = { + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, + 0xba, 0xae, 0xdc, 0xe6, 0xaf, 0x48, 0xa0, 0x3b, 0xbf, 0xd2, 0x5e, 0x8c, 0xd0, 0x36, 0x41, 0x41 +}; + +static char ecdh_g_secp256k1[] = { + 0x79, 0xBE, 0x66, 0x7E, 0xF9, 0xDC, 0xBB, 0xAC, 0x55, 0xA0, 0x62, 0x95, 0xCE, 0x87, 0x0B, 0x07, + 0x02, 0x9B, 0xFC, 0xDB, 0x2D, 0xCE, 0x28, 0xD9, 0x59, 0xF2, 0x81, 0x5B, 0x16, 0xF8, 0x17, 0x98, + 0x48, 0x3a, 0xda, 0x77, 0x26, 0xa3, 0xc4, 0x65, 0x5d, 0xa4, 0xfb, 0xfc, 0x0e, 0x11, 0x08, 0xa8, + 0xfd, 0x17, 0xb4, 0x48, 0xa6, 0x85, 0x54, 0x19, 0x9c, 0x47, 0xd0, 0x8f, 0xfb, 0x10, 0xd4, 0xb8 +}; + +static char ecdh_da_secp256k1[] = { + 0x71, 0x71, 0xb4, 0x5b, 0x79, 0x51, 0x94, 0x70, 0x53, 0xf9, 0x77, 0x02, 0x64, 0xef, 0xc4, 0xdb, + 0x64, 0xfc, 0xbe, 0x4e, 0x44, 0x4a, 0xc6, 0x54, 0x71, 0x69, 0x2e, 0x4a, 0x46, 0xa7, 0x2d, 0xa3 +}; + +#if 0 +static char ecdh_db_secp256k1[] = { + 0xe2, 0x74, 0x69, 0xc8, 0x17, 0x6c, 0x0d, 0xca, 0xdd, 0x9e, 0xf6, 0x2f, 0x30, 0x9f, 0xad, 0xf3, + 0xdd, 0x16, 0xcc, 0x0c, 0xb1, 0xd0, 0x7b, 0xf4, 0xde, 0x9d, 0xf2, 0x5d, 0x22, 0x03, 0xce, 0x41 +}; +#endif + +static char ecdh_cp_pubkey_secp256k1[] = { + 0x04, + 0x68, 0xae, 0x87, 0x7c, 0x45, 0xb3, 0x8b, 0xa8, 0xa8, 0x8e, 0x4b, 0xe5, 0x1f, 0x4e, 0xe6, 0x89, + 0x67, 0x73, 0x71, 0x96, 0x92, 0x2e, 0x57, 0x07, 0xc4, 0x30, 0xa5, 0xcf, 0x9f, 0x58, 0xb0, 0x6f, + 0x26, 0xd3, 0x58, 0xa4, 0xb6, 0xfc, 0xb6, 0x4b, 0x0f, 0x63, 0xd9, 0xa6, 0xa0, 0x1b, 0xba, 0x10, + 0x10, 0xa4, 0xab, 0x28, 0x6e, 0xab, 0x51, 0x34, 0xac, 0x3d, 0x2b, 0x39, 0xf1, 0xd7, 0x21, 0x48 +}; + +static char ecdh_except_b_pubkey_secp256k1[] = { + 0x04, + 0x90, 0x34, 0x99, 0xc8, 0x9e, 0x32, 0xdb, 0xcd, 0x24, 0x4e, 0x31, 0x51, 0x1c, 0x83, 0x4b, 0xf7, + 0x68, 0xf0, 0xbb, 0xa3, 0x91, 0x38, 0xa8, 0xf1, 0xab, 0x76, 0x36, 0xcd, 0x23, 0x3f, 0x57, 0x3b, + 0x22, 0x1a, 0x3f, 0x2e, 0x40, 0x8b, 0xe2, 0x7b, 0xd4, 0x91, 0xe4, 0xf2, 0x36, 0x00, 0xbe, 0xae, + 0x9c, 0xf2, 0xfc, 0xb4, 0xb9, 0x8b, 0x5b, 0xa7, 0x39, 0x88, 0xf2, 0x3b, 0xe2, 0xe5, 0xab, 0x1b +}; + +static char ecdh_cp_sharekey_secp256k1[] = { + 0xd8, 0x9d, 0x1e, 0x25, 0xa2, 0x5, 0xd8, 0xad, 0x0f, 0x1c, 0x7a, 0x44, 0xd4, 0xe6, 0x96, 0xc2, + 0xd3, 0xbc, 0x05, 0xa1, 0x8d, 0x4a, 0x2, 0x11, 0x0e, 0x93, 0xcd, 0xb9, 0x56, 0xd6, 0x44, 0x1c, +}; + +/* ecc sign or verf*/ +static unsigned char ecc_except_kinv_secp256k1[] = { + 0x71, 0x71, 0xb4, 0x5b, 0x79, 0x51, 0x94, 0x70, 0x53, 0xf9, 0x77, 0x02, 0x64, 0xef, 0xc4, 0xdb, + 0x64, 0xfc, 0xbe, 0x4e, 0x44, 0x4a, 0xc6, 0x54, 0x71, 0x69, 0x2e, 0x4a, 0x46, 0xa7, 0x2d, 0xa3 +}; + +static unsigned char ecc_except_e_secp256k1[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04 +}; + +static unsigned char ecc_cp_sign_secp256k1[] = { + 0x30,0x45,0x02,0x20,0x68,0xae,0x87,0x7c,0x45,0xb3,0x8b,0xa8,0xa8,0x8e,0x4b,0xe5, + 0x1f,0x4e,0xe6,0x89,0x67,0x73,0x71,0x96,0x92,0x2e,0x57,0x07,0xc4,0x30,0xa5,0xcf, + 0x9f,0x58,0xb0,0x6f,0x02,0x21,0x00,0xdb,0x14,0xac,0x48,0x0d,0x0a,0xe9,0xe4,0x1d, + 0x8d,0xca,0x47,0xb6,0x0e,0x44,0xf6,0xfb,0xde,0x86,0x9b,0x38,0x76,0x98,0x67,0x12, + 0x7f,0x1d,0x09,0x97,0xab,0xc2,0xcb +}; + +static char ecdh_a_secp320k1[] = { + 0x3e, 0xe3, 0x0b, 0x56, 0x8f, 0xba, 0xb0, 0xf8, 0x83, 0xcc, 0xeb, 0xd4, 0x6d, 0x3f, 0x3b, 0xb8, + 0xa2, 0xa7, 0x35, 0x13, 0xf5, 0xeb, 0x79, 0xda, 0x66, 0x19, 0x0e, 0xb0, 0x85, 0xff, 0xa9, 0xf4, + 0x92, 0xf3, 0x75, 0xa9, 0x7d, 0x86, 0x0e, 0xb4 +}; + +static char ecdh_b_secp320k1[] = { + 0x52, 0x08, 0x83, 0x94, 0x9d, 0xfd, 0xbc, 0x42, 0xd3, 0xad, 0x19, 0x86, 0x40, 0x68, 0x8a, 0x6f, + 0xe1, 0x3f, 0x41, 0x34, 0x95, 0x54, 0xb4, 0x9a, 0xcc, 0x31, 0xdc, 0xcd, 0x88, 0x45, 0x39, 0x81, + 0x6f, 0x5e, 0xb4, 0xac, 0x8f, 0xb1, 0xf1, 0xa6 +}; + +static char ecdh_p_secp320k1[] = { + 0xd3, 0x5e, 0x47, 0x20, 0x36, 0xbc, 0x4f, 0xb7, 0xe1, 0x3c, 0x78, 0x5e, 0xd2, 0x01, 0xe0, 0x65, + 0xf9, 0x8f, 0xcf, 0xa6, 0xf6, 0xf4, 0x0d, 0xef, 0x4f, 0x92, 0xb9, 0xec, 0x78, 0x93, 0xec, 0x28, + 0xfc, 0xd4, 0x12, 0xb1, 0xf1, 0xb3, 0x2e, 0x27 +}; + +static char ecdh_n_secp320k1[] = { + 0xd3, 0x5e, 0x47, 0x20, 0x36, 0xbc, 0x4f, 0xb7, 0xe1, 0x3c, 0x78, 0x5e, 0xd2, 0x01, 0xe0, 0x65, + 0xf9, 0x8f, 0xcf, 0xa5, 0xb6, 0x8f, 0x12, 0xa3, 0x2d, 0x48, 0x2e, 0xc7, 0xee, 0x86, 0x58, 0xe9, + 0x86, 0x91, 0x55, 0x5b, 0x44, 0xc5, 0x93, 0x11 +}; + +static char ecdh_g_secp320k1[] = { + 0x43, 0xbd, 0x7e, 0x9a, 0xfb, 0x53, 0xd8, 0xb8, 0x52, 0x89, 0xbc, 0xc4, 0x8e, 0xe5, 0xbf, 0xe6, + 0xf2, 0x01, 0x37, 0xd1, 0x0a, 0x08, 0x7e, 0xb6, 0xe7, 0x87, 0x1e, 0x2a, 0x10, 0xa5, 0x99, 0xc7, + 0x10, 0xaf, 0x8d, 0x0d, 0x39, 0xe2, 0x06, 0x11, + 0x14, 0xfd, 0xd0, 0x55, 0x45, 0xec, 0x1c, 0xc8, 0xab, 0x40, 0x93, 0x24, 0x7f, 0x77, 0x27, 0x5e, + 0x07, 0x43, 0xff, 0xed, 0x11, 0x71, 0x82, 0xea, 0xa9, 0xc7, 0x78, 0x77, 0xaa, 0xac, 0x6a, 0xc7, + 0xd3, 0x52, 0x45, 0xd1, 0x69, 0x2e, 0x8e, 0xe1, +}; + +static char ecdh_da_secp320k1[] = { + 0x6a, 0x5b, 0xc2, 0x5e, 0x00, 0x00, 0x00, 0x00, 0x21, 0x8e, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x31, 0x00, 0xa0, 0xff, 0xff, 0x00, 0x00, 0x6a, 0x5b, 0xc2, 0x5e, 0x00, 0x00, 0x00, 0x00, + 0x21, 0x8e, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +static char ecdh_cp_pubkey_secp320k1[] = { + 0x04, + 0x5f, 0x25, 0x77, 0xa9, 0xb5, 0x0a, 0x6f, 0xd3, 0xcb, 0x43, 0x93, 0xe0, 0xb7, 0x41, 0x3b, 0x56, + 0xc3, 0xfe, 0x1e, 0x5c, 0xb9, 0x32, 0x3a, 0x74, 0x68, 0xf8, 0x69, 0xea, 0xcf, 0x5b, 0x82, 0xd2, + 0x38, 0x8c, 0x96, 0x87, 0x97, 0xc3, 0x89, 0x9d, 0x13, 0x02, 0x40, 0xba, 0x88, 0xfa, 0x0c, 0x5a, + 0x64, 0x52, 0x7c, 0x36, 0xbd, 0xa6, 0x92, 0xb7, 0x6f, 0xb1, 0xd5, 0x81, 0xdb, 0xd5, 0x78, 0x96, + 0x50, 0x6a, 0x48, 0xec, 0x75, 0x04, 0x01, 0x3e, 0x86, 0x07, 0x74, 0x5b, 0xa7, 0x72, 0x44, 0x27 +}; + +static char ecdh_except_b_pubkey_secp320k1[] = { + 0x04, + 0x5f, 0x25, 0x77, 0xa9, 0xb5, 0x0a, 0x6f, 0xd3, 0xcb, 0x43, 0x93, 0xe0, 0xb7, 0x41, 0x3b, 0x56, + 0xc3, 0xfe, 0x1e, 0x5c, 0xb9, 0x32, 0x3a, 0x74, 0x68, 0xf8, 0x69, 0xea, 0xcf, 0x5b, 0x82, 0xd2, + 0x38, 0x8c, 0x96, 0x87, 0x97, 0xc3, 0x89, 0x9d, 0x13, 0x02, 0x40, 0xba, 0x88, 0xfa, 0x0c, 0x5a, + 0x64, 0x52, 0x7c, 0x36, 0xbd, 0xa6, 0x92, 0xb7, 0x6f, 0xb1, 0xd5, 0x81, 0xdb, 0xd5, 0x78, 0x96, + 0x50, 0x6a, 0x48, 0xec, 0x75, 0x04, 0x01, 0x3e, 0x86, 0x07, 0x74, 0x5b, 0xa7, 0x72, 0x44, 0x27 +}; + +static char ecdh_cp_sharekey_secp320k1[] = { + 0x69, 0x8a, 0x70, 0x4e, 0xf8, 0x4a, 0x9a, 0x80, 0xe8, 0x48, 0xc9, 0xb9, 0xac, 0x2a, 0x74, 0xf0, + 0xe5, 0x29, 0x60, 0x6d, 0xf3, 0x4e, 0x01, 0xa6, 0x20, 0x37, 0xc2, 0x0f, 0xba, 0x98, 0x91, 0x3b, + 0xc2, 0x75, 0xa3, 0xc6, 0x75, 0x90, 0x79, 0xb4 +}; + +/* ecc sign or verf*/ +static unsigned char ecc_except_kinv_secp320k1[] = { + 0x71, 0x71, 0xb4, 0x5b, 0x79, 0x51, 0x94, 0x70, 0x53, 0xf9, 0x77, 0x02, 0x64, 0xef, 0xc4, 0xdb, + 0x64, 0xfc, 0xbe, 0x4e, 0x44, 0x4a, 0xc6, 0x54, 0x71, 0x69, 0x2e, 0x4a, 0x46, 0xa7, 0x2d, 0xa3 +}; + +static unsigned char ecc_except_e_secp320k1[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04 +}; + +/* 384 */ +static char ecdh_a_secp384r1[] = { + 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, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFC +}; + +static char ecdh_b_secp384r1[] = { + 0xB3, 0x31, 0x2F, 0xA7, 0xE2, 0x3E, 0xE7, 0xE4, 0x98, 0x8E, 0x05, 0x6B, + 0xE3, 0xF8, 0x2D, 0x19, 0x18, 0x1D, 0x9C, 0x6E, 0xFE, 0x81, 0x41, 0x12, + 0x03, 0x14, 0x08, 0x8F, 0x50, 0x13, 0x87, 0x5A, 0xC6, 0x56, 0x39, 0x8D, + 0x8A, 0x2E, 0xD1, 0x9D, 0x2A, 0x85, 0xC8, 0xED, 0xD3, 0xEC, 0x2A, 0xEF +}; + +static char ecdh_p_secp384r1[] = { + 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, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF +}; + +static char ecdh_n_secp384r1[] = { + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xC7, 0x63, 0x4D, 0x81, 0xF4, 0x37, 0x2D, 0xDF, 0x58, 0x1A, 0x0D, 0xB2, + 0x48, 0xB0, 0xA7, 0x7A, 0xEC, 0xEC, 0x19, 0x6A, 0xCC, 0xC5, 0x29, 0x73 +}; + +static char ecdh_g_secp384r1[] = { + 0xAA, 0x87, 0xCA, 0x22, 0xBE, 0x8B, 0x05, 0x37, 0x8E, 0xB1, 0xC7, 0x1E, + 0xF3, 0x20, 0xAD, 0x74, 0x6E, 0x1D, 0x3B, 0x62, 0x8B, 0xA7, 0x9B, 0x98, + 0x59, 0xF7, 0x41, 0xE0, 0x82, 0x54, 0x2A, 0x38, 0x55, 0x02, 0xF2, 0x5D, + 0xBF, 0x55, 0x29, 0x6C, 0x3A, 0x54, 0x5E, 0x38, 0x72, 0x76, 0x0A, 0xB7, + 0x36, 0x17, 0xDE, 0x4A, 0x96, 0x26, 0x2C, 0x6F, 0x5D, 0x9E, 0x98, 0xBF, + 0x92, 0x92, 0xDC, 0x29, 0xF8, 0xF4, 0x1D, 0xBD, 0x28, 0x9A, 0x14, 0x7C, + 0xE9, 0xDA, 0x31, 0x13, 0xB5, 0xF0, 0xB8, 0xC0, 0x0A, 0x60, 0xB1, 0xCE, + 0x1D, 0x7E, 0x81, 0x9D, 0x7A, 0x43, 0x1D, 0x7C, 0x90, 0xEA, 0x0E, 0x5F +}; + +static char ecdh_da_secp384r1[] = { + 0xee, 0x57, 0xd7, 0xad, 0xbc, 0x8c, 0x5d, 0x82, 0x65, 0x7f, 0x03, 0xcb, 0x12, 0xc1, 0x38, 0x0d, + 0x02, 0x5c, 0xb7, 0x8f, 0xa4, 0x36, 0x56, 0x27, 0x25, 0x85, 0xaa, 0x3e, 0xdf, 0x22, 0x88, 0x7b, + 0xe3, 0xe7, 0xc5, 0xf1, 0xd7, 0x37, 0x8c, 0xc7, 0x56, 0xca, 0xa7, 0x93, 0x37, 0xbd, 0xf9, 0x37 +}; + +static char ecdh_cp_pubkey_secp384r1[] = { + 0x04, + 0x7d, 0x54, 0xd0, 0x72, 0x45, 0x4b, 0x5a, 0x48, 0xed, 0xc6, 0x19, 0xde, 0x8f, 0x1b, 0xa6, 0xfd, + 0xe5, 0x00, 0xbc, 0x74, 0xbb, 0xee, 0xdc, 0x6b, 0x1c, 0x6d, 0x36, 0xf1, 0x2a, 0x6a, 0x3c, 0xcd, + 0xd5, 0xb9, 0xf8, 0x3c, 0x57, 0xe8, 0xc2, 0xb2, 0xe6, 0x60, 0x58, 0x03, 0x3e, 0x48, 0xf4, 0xc4, + 0x4b, 0x80, 0x58, 0x8c, 0xc7, 0x65, 0x2e, 0xdd, 0x23, 0x31, 0xd2, 0xae, 0x62, 0x62, 0xc3, 0xb4, + 0x57, 0x88, 0xc6, 0x84, 0x51, 0xaf, 0x8c, 0x7b, 0x94, 0x2a, 0x43, 0x68, 0x31, 0xbd, 0x3d, 0x4f, + 0x43, 0xae, 0x79, 0x50, 0x80, 0x60, 0x09, 0xfa, 0x42, 0xfe, 0x9d, 0x18, 0xce, 0xbe, 0xfd, 0x64 +}; + +static char ecdh_except_b_pubkey_secp384r1[] = { + 0x04, + 0x7d, 0x54, 0xd0, 0x72, 0x45, 0x4b, 0x5a, 0x48, 0xed, 0xc6, 0x19, 0xde, 0x8f, 0x1b, 0xa6, 0xfd, + 0xe5, 0x00, 0xbc, 0x74, 0xbb, 0xee, 0xdc, 0x6b, 0x1c, 0x6d, 0x36, 0xf1, 0x2a, 0x6a, 0x3c, 0xcd, + 0xd5, 0xb9, 0xf8, 0x3c, 0x57, 0xe8, 0xc2, 0xb2, 0xe6, 0x60, 0x58, 0x03, 0x3e, 0x48, 0xf4, 0xc4, + 0x4b, 0x80, 0x58, 0x8c, 0xc7, 0x65, 0x2e, 0xdd, 0x23, 0x31, 0xd2, 0xae, 0x62, 0x62, 0xc3, 0xb4, + 0x57, 0x88, 0xc6, 0x84, 0x51, 0xaf, 0x8c, 0x7b, 0x94, 0x2a, 0x43, 0x68, 0x31, 0xbd, 0x3d, 0x4f, + 0x43, 0xae, 0x79, 0x50, 0x80, 0x60, 0x09, 0xfa, 0x42, 0xfe, 0x9d, 0x18, 0xce, 0xbe, 0xfd, 0x64 +}; + +static char ecdh_cp_sharekey_secp384r1[] = { + 0x82, 0x80, 0x4b, 0x00, 0x8c, 0x3c, 0x29, 0x51, 0xc8, 0x77, 0x1f, 0x72, 0xe2, 0x8c, 0x9d, 0x2a, + 0x3c, 0xf3, 0xe3, 0x7c, 0xc0, 0xc9, 0x80, 0x20, 0xe2, 0x1a, 0x45, 0xb6, 0x20, 0x13, 0x18, 0x91, + 0x61, 0xfa, 0xf1, 0x9d, 0x9f, 0xf2, 0x95, 0x78, 0xdd, 0xfe, 0x73, 0x9f, 0x09, 0x24, 0xa1, 0x4b +}; + +/* ecc sign or verf*/ +static unsigned char ecc_except_kinv_secp384r1[] = { + /* + 0x71, 0x71, 0xb4, 0x5b, 0x79, 0x51, 0x94, 0x70, 0x53, 0xf9, 0x77, 0x02, 0x64, 0xef, 0xc4, 0xdb, + 0x64, 0xfc, 0xbe, 0x4e, 0x44, 0x4a, 0xc6, 0x54, 0x71, 0x69, 0x2e, 0x4a, 0x46, 0xa7, 0x2d, 0xa3*/ +}; + +static unsigned char ecc_except_e_secp384r1[] = { + /* + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04*/ +}; + +/* 521 */ +static char ecdh_a_secp521r1[] = { + 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, 0xfc +}; + +static char ecdh_b_secp521r1[] = { + 0x00, 0xe6, 0x15, 0x1c, 0x79, 0x17, 0x8d, 0x1b, 0x5c, 0xfa, + 0xbc, 0x7e, 0x53, 0x82, 0xb9, 0x33, 0xbc, 0x16, 0x2c, 0x9f, 0x27, 0xed, 0x6d, 0x79, 0x34, 0xf2, + 0xba, 0x07, 0x92, 0x9e, 0x96, 0xea, 0xe9, 0xdd, 0xb5, 0xae, 0x57, 0x7a, 0x54, 0xe1, 0x3c, 0x71, + 0xa9, 0x6e, 0x3e, 0x3d, 0x88, 0xaf, 0x92, 0x77, 0xe8, 0xe6, 0x61, 0xfe, 0xed, 0x39, 0xbd, 0x11, + 0x19, 0x25, 0x3f, 0x09, 0x4e, 0x71, 0x25, 0xcc +}; + +static char ecdh_p_secp521r1[] = { + 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 +}; + +static char ecdh_n_secp521r1[] = { + 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, 0xfa, 0x51, 0x86, 0x87, 0x83, 0xbf, 0x2f, 0x96, 0x6b, + 0x7f, 0xcc, 0x01, 0x48, 0xf7, 0x09, 0xa5, 0xd0, 0x3b, 0xb5, 0xc9, 0xb8, 0x89, 0x9c, 0x47, 0xae, + 0xbb, 0x6f, 0xb7, 0x1e, 0x91, 0x38, 0x64, 0x09 +}; + +static char ecdh_g_secp521r1[] = { + 0x00, 0xc6, + 0x85, 0x8e, 0x06, 0xb7, 0x04, 0x04, 0xe9, 0xcd, 0x9e, 0x3e, 0xcb, 0x66, 0x23, 0x95, 0xb4, 0x42, + 0x9c, 0x64, 0x81, 0x39, 0x05, 0x3f, 0xb5, 0x21, 0xf8, 0x28, 0xaf, 0x60, 0x6b, 0x4d, 0x3d, 0xba, + 0xa1, 0x4b, 0x5e, 0x77, 0xef, 0xe7, 0x59, 0x28, 0xfe, 0x1d, 0xc1, 0x27, 0xa2, 0xff, 0xa8, 0xde, + 0x33, 0x48, 0xb3, 0xc1, 0x85, 0x6a, 0x42, 0x9b, 0xf9, 0x7e, 0x7e, 0x31, 0xc2, 0xe5, 0xbd, 0x66, + + 0x01, 0x18, 0x39, 0x29, 0x6a, 0x78, 0x9a, 0x3b, 0xc0, 0x04, + 0x5c, 0x8a, 0x5f, 0xb4, 0x2c, 0x7d, 0x1b, 0xd9, 0x98, 0xf5, 0x44, 0x49, 0x57, 0x9b, 0x44, 0x68, + 0x17, 0xaf, 0xbd, 0x17, 0x27, 0x3e, 0x66, 0x2c, 0x97, 0xee, 0x72, 0x99, 0x5e, 0xf4, 0x26, 0x40, + 0xc5, 0x50, 0xb9, 0x01, 0x3f, 0xad, 0x07, 0x61, 0x35, 0x3c, 0x70, 0x86, 0xa2, 0x72, 0xc2, 0x40, + 0x88, 0xbe, 0x94, 0x76, 0x9f, 0xd1, 0x66, 0x50 +}; + +static char ecdh_da_secp521r1[] = { + 0x00, 0xe6, 0x15, 0x1c, 0x79, 0x17, 0x8d, 0x1b, 0x5c, 0xfa, + 0xbc, 0x7e, 0x53, 0x82, 0xb9, 0x33, 0xbc, 0x16, 0x2c, 0x9f, 0x27, 0xed, 0x6d, 0x79, 0x34, 0xf2, + 0xba, 0x07, 0x92, 0x9e, 0x96, 0xea, 0xe9, 0xdd, 0xb5, 0xae, 0x57, 0x7a, 0x54, 0xe1, 0x3c, 0x71, + 0xa9, 0x6e, 0x3e, 0x3d, 0x88, 0xaf, 0x92, 0x77, 0xe8, 0xe6, 0x61, 0xfe, 0xed, 0x39, 0xbd, 0x11, + 0x19, 0x25, 0x3f, 0x09, 0x4e, 0x71, 0x25, 0xcc +}; + +static char ecdh_except_b_pubkey_secp521r1[] = { + 0x04, + 0x01, 0x16, 0x0a, 0x52, 0xaa, 0x18, 0x96, 0x56, 0xf6, 0x27, 0xd1, 0x59, 0xbd, 0x7d, 0x0f, 0x57, + 0xfd, 0x34, 0xfa, 0x52, 0x1b, 0x04, 0xbd, 0x9a, 0x90, 0xd5, 0x8d, 0xad, 0x41, 0x32, 0x80, 0x14, + 0x6e, 0x73, 0x58, 0x83, 0x98, 0xeb, 0xb0, 0x6b, 0xb5, 0x63, 0x8e, 0xa1, 0x06, 0x04, 0x86, 0x94, + 0x9e, 0x34, 0x53, 0xf4, 0x93, 0x37, 0x1c, 0xbc, 0xbb, 0x7b, 0x4c, 0x97, 0x87, 0x32, 0x92, 0xf2, + 0x36, 0xdd, 0x01, 0x30, 0xa1, 0xa7, 0x68, 0x5a, 0x3e, 0x40, 0xe9, 0xbf, 0x3d, 0x2a, 0x1b, 0xbf, + 0x09, 0xa0, 0x51, 0xe8, 0x1d, 0x23, 0x27, 0x9c, 0x70, 0xb2, 0x18, 0x42, 0x02, 0x09, 0x02, 0x66, + 0xc7, 0xdb, 0x1a, 0xec, 0xe5, 0x20, 0x68, 0x31, 0x31, 0x6e, 0x70, 0xbe, 0x09, 0x72, 0x79, 0x42, + 0xe2, 0x3b, 0x3b, 0xd3, 0x0a, 0xe4, 0x9c, 0x34, 0x4c, 0x61, 0x74, 0x7c, 0xed, 0xe1, 0x84, 0x89, + 0x4b, 0xf4, 0xd5, 0xc3 +}; + +static char ecdh_cp_pubkey_secp521r1[] = { + 0x04, + 0x01, 0x16, 0x0a, 0x52, 0xaa, 0x18, 0x96, 0x56, 0xf6, 0x27, 0xd1, 0x59, 0xbd, 0x7d, 0x0f, 0x57, + 0xfd, 0x34, 0xfa, 0x52, 0x1b, 0x04, 0xbd, 0x9a, 0x90, 0xd5, 0x8d, 0xad, 0x41, 0x32, 0x80, 0x14, + 0x6e, 0x73, 0x58, 0x83, 0x98, 0xeb, 0xb0, 0x6b, 0xb5, 0x63, 0x8e, 0xa1, 0x06, 0x04, 0x86, 0x94, + 0x9e, 0x34, 0x53, 0xf4, 0x93, 0x37, 0x1c, 0xbc, 0xbb, 0x7b, 0x4c, 0x97, 0x87, 0x32, 0x92, 0xf2, + 0x36, 0xdd, 0x01, 0x30, 0xa1, 0xa7, 0x68, 0x5a, 0x3e, 0x40, 0xe9, 0xbf, 0x3d, 0x2a, 0x1b, 0xbf, + 0x09, 0xa0, 0x51, 0xe8, 0x1d, 0x23, 0x27, 0x9c, 0x70, 0xb2, 0x18, 0x42, 0x02, 0x09, 0x02, 0x66, + 0xc7, 0xdb, 0x1a, 0xec, 0xe5, 0x20, 0x68, 0x31, 0x31, 0x6e, 0x70, 0xbe, 0x09, 0x72, 0x79, 0x42, + 0xe2, 0x3b, 0x3b, 0xd3, 0x0a, 0xe4, 0x9c, 0x34, 0x4c, 0x61, 0x74, 0x7c, 0xed, 0xe1, 0x84, 0x89, + 0x4b, 0xf4, 0xd5, 0xc3 +}; + +static char ecdh_cp_sharekey_secp521r1[] = { + 0x01, 0xaf, 0x53, 0x84, 0x60, 0x59, 0x79, 0x64, 0x09, 0x5f, 0x2b, 0x4e, 0x82, 0xc4, 0x79, 0x21, + 0x55, 0x9c, 0xb0, 0x2f, 0x7d, 0xd4, 0x2f, 0x5d, 0xca, 0xfc, 0x4f, 0x70, 0x28, 0x6e, 0x2b, 0x13, + 0x2e, 0x5f, 0xf0, 0x1f, 0x50, 0x87, 0xf5, 0x82, 0x2f, 0xa7, 0x31, 0x5b, 0xfd, 0x5c, 0x0e, 0xef, + 0xaf, 0x5c, 0x80, 0x53, 0x48, 0xed, 0xcf, 0x14, 0xdc, 0x91, 0xc5, 0xc9, 0x1b, 0xff, 0xa8, 0x16, + 0x42, 0xa8 +}; + +/* ecc sign or verf*/ +static unsigned char ecc_except_kinv_secp521r1[] = { + 0x71, 0x71, 0xb4, 0x5b, 0x79, 0x51, 0x94, 0x70, 0x53, 0xf9, 0x77, 0x02, 0x64, 0xef, 0xc4, 0xdb, + 0x64, 0xfc, 0xbe, 0x4e, 0x44, 0x4a, 0xc6, 0x54, 0x71, 0x69, 0x2e, 0x4a, 0x46, 0xa7, 0x2d, 0xa3 +}; + +static unsigned char ecc_except_e_secp521r1[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04 +}; + +static unsigned char sm2_k[] = { + 0x7c, 0x47, 0x81, 0x10, 0x54, 0xc6, 0xf9, 0x96, 0x13, 0xa5, 0x78, 0xeb, 0x84, 0x53, 0x70, 0x6c, + 0xcb, 0x96, 0x38, 0x4f, 0xe7, 0xdf, 0x5c, 0x17, 0x16, 0x71, 0xe7, 0x60, 0xbf, 0xa8, 0xbe, 0x3a +}; + +static unsigned char sm2_id[] = { + 0x41, 0x4c, 0x49, 0x43, 0x45, 0x31, 0x32, 0x33, 0x40, 0x59, 0x41, 0x48, 0x4f, 0x4f, 0x2e, 0x43, + 0x4f, 0x4d +}; + +static unsigned char sm2_plaintext[] = { + 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74 +}; + +static unsigned char sm2_plaintext_l[513] = { + 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74 +}; + +static unsigned char sm2_sign_data[] = { + /* r */ + 0xe6, 0xcd, 0x2d, 0xf9, 0x4f, 0x57, 0x40, 0x9e, 0x6b, 0xec, 0x8c, 0x0e, 0xf0, 0x44, 0x5c, 0xa4, + 0xfa, 0xea, 0x24, 0xe3, 0xf2, 0x28, 0x0e, 0xad, 0xc1, 0xa4, 0x1c, 0xf6, 0x24, 0x88, 0xaf, 0xd2, + + /* s */ + 0x98, 0x0e, 0x4f, 0xda, 0xbd, 0xe9, 0x9e, 0xc1, 0x6d, 0x59, 0x87, 0xd0, 0x23, 0x19, 0x84, 0xd1, + 0x94, 0x07, 0x7b, 0xb5, 0x43, 0xa8, 0x93, 0x00, 0xd4, 0xbb, 0xc7, 0xf8, 0x83, 0xb3, 0xf0, 0xc3, +}; + +static unsigned char sm2_ciphertext[] = { + /* c1 x */ + 0xe6, 0xcd, 0x2d, 0xf9, 0x4f, 0x57, 0x40, 0x9e, 0x6b, 0xec, 0x8c, 0x0e, 0xf0, 0x44, 0x5c, 0xa4, + 0xfa, 0xe9, 0xb7, 0x7e, 0x7e, 0xb4, 0xad, 0x46, 0x5c, 0x83, 0xb8, 0x8c, 0xbd, 0x23, 0x3c, 0x5e, + /* c1 y */ + 0x80, 0x89, 0xf0, 0xea, 0x2c, 0x84, 0x63, 0x45, 0xd8, 0x99, 0x7b, 0x5c, 0x2c, 0x75, 0x7d, 0x8e, + 0x5c, 0x99, 0x6e, 0x46, 0x85, 0x9f, 0x19, 0xd3, 0x7e, 0xb0, 0x3b, 0x24, 0xde, 0xab, 0xae, 0x30, + /* c3 */ + 0xfb, 0xcf, 0x24, 0x19, 0xf8, 0x61, 0x1c, 0xba, 0xb1, 0xd0, 0x6f, 0x4f, 0x84, 0xda, 0x9a, 0xe6, + 0x2d, 0x42, 0x27, 0xa1, 0x2b, 0x27, 0x26, 0x32, 0xc2, 0x6d, 0xda, 0x35, 0x54, 0xf9, 0xfc, 0xf8, + /* c2 */ + 0xdf, 0xe8, 0x59, 0xe8, 0x35, 0xb3, 0x98, 0x18, 0xca, 0x56, 0xaa, 0x29, 0x7b, 0x01, +}; + +static unsigned char sm2_ciphertext_l[609] = { + 0xe6, 0xcd, 0x2d, 0xf9, 0x4f, 0x57, 0x40, 0x9e, 0x6b, 0xec, 0x8c, 0x0e, 0xf0, 0x44, 0x5c, 0xa4, + 0xfa, 0xe9, 0xb7, 0x7e, 0x7e, 0xb4, 0xad, 0x46, 0x5c, 0x83, 0xb8, 0x8c, 0xbd, 0x23, 0x3c, 0x5e, + 0x80, 0x89, 0xf0, 0xea, 0x2c, 0x84, 0x63, 0x45, 0xd8, 0x99, 0x7b, 0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9f, 0xec, + 0x80, 0x56, 0x5c, 0x79, 0x78, 0x9d, 0xed, 0xe0, 0x0a, 0x68, 0xd9, 0xc1, 0x19, 0x93, 0x94, 0x2c, + 0x3d, +}; + +static unsigned char sm2_pubkey[] = { + 0x04, + 0x09, 0xf9, 0xdf, 0x31, 0x1e, 0x54, 0x21, 0xa1, 0x50, 0xdd, 0x7d, 0x16, 0x1e, 0x4b, 0xc5, 0xc6, + 0x72, 0x17, 0x9f, 0xad, 0x18, 0x33, 0xfc, 0x07, 0x6b, 0xb0, 0x8f, 0xf3, 0x56, 0xf3, 0x50, 0x20, + 0xcc, 0xea, 0x49, 0x0c, 0xe2, 0x67, 0x75, 0xa5, 0x2d, 0xc6, 0xea, 0x71, 0x8c, 0xc1, 0xaa, 0x60, + 0x0a, 0xed, 0x05, 0xfb, 0xf3, 0x5e, 0x08, 0x4a, 0x66, 0x32, 0xf6, 0x07, 0x2d, 0xa9, 0xad, 0x13 +}; + +static unsigned char sm2_priv[] = { + 0x39, 0x45, 0x20, 0x8f, 0x7b, 0x21, 0x44, 0xb1, 0x3f, 0x36, 0xe3, 0x8a, 0xc6, 0xd3, 0x9f, 0x95, + 0x88, 0x93, 0x93, 0x69, 0x28, 0x60, 0xb5, 0x1a, 0x42, 0xfb, 0x81, 0xef, 0x4d, 0xf7, 0xc5, 0xb8 +}; + +static unsigned char sm2_digest[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x20, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74 +}; +#endif diff --git a/uadk_tool/benchmark/hpre_uadk_benchmark.c b/uadk_tool/benchmark/hpre_uadk_benchmark.c new file mode 100644 index 0000000..e722c36 --- /dev/null +++ b/uadk_tool/benchmark/hpre_uadk_benchmark.c @@ -0,0 +1,2433 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +#include <numa.h> +#include "uadk_benchmark.h" + +#include "hpre_uadk_benchmark.h" +#include "hpre_protocol_data.h" +#include "include/wd.h" +#include "include/wd_rsa.h" +#include "include/wd_dh.h" +#include "include/wd_ecc.h" +#include "include/wd_sched.h" + +#define ECC_CURVE_ID 0x3 /* def set secp256k1 */ +#define HPRE_TST_PRT printf +#define ERR_OPTYPE 0xFF +#define SM2_DG_SZ 1024 + +struct hpre_rsa_key_in { + void *e; + void *p; + void *q; + u32 e_size; + u32 p_size; + u32 q_size; + void *data[]; +}; + +static __thread struct hpre_rsa_key_in *rsa_key_in = NULL; +static const char rsa_m[8] = {0x54, 0x85, 0x9b, 0x34, 0x2c, 0x49, 0xea, 0x2a}; + +struct rsa_async_tag { + handle_t sess; +}; + +//----------------------------------RSA param--------------------------------------// +struct hpre_dh_param { + const void *x; + const void *p; + const void *g; + const void *except_pub_key; + const void *pub_key; + const void *share_key; + u32 x_size; + u32 p_size; + u32 g_size; + u32 pub_key_size; + u32 share_key_size; + u32 except_pub_key_size; + u32 key_bits; + u32 optype; +}; + +//----------------------------------DH param-------------------------------------// +struct hpre_ecc_setup { + void *except_pub_key; // use in ecdh phase 2 + const void *pub_key; // use in ecdh phase 1 + const void *share_key; // use in ecdh phase 2 + const void *digest; //use in ecdsa sign + const void *k; // ecdsa sign in + const void *rp; // x coordinate of k*generator used in ecdsa + const void *sign; // ecdsa sign out or verf in + const void *priv_key; // use in ecdsa sign + void *msg; // sm2 plaintext,ciphertext or digest input + const void *userid; // sm2 user id + const void *ciphertext; // sm2 ciphertext + const void *plaintext; // sm2 plaintext + u32 key_size; + u32 share_key_size; + u32 except_pub_key_size; + u32 digest_size; + u32 k_size; + u32 rp_size; + u32 sign_size; + u32 priv_key_size; + u32 pub_key_size; + u32 msg_size; + u32 userid_size; + u32 ciphertext_size; + u32 plaintext_size; + u32 op_type; + u32 key_bits; + u32 nid; + u32 curve_id; // WD ecc curve_id +}; + +//----------------------------------ECC param-------------------------------------// + +typedef struct uadk_thread_res { + u32 subtype; + u32 keybits; + u32 kmode; + u32 optype; + u32 td_id; +} thread_data; + +static struct wd_ctx_config g_ctx_cfg; +static struct wd_sched *g_sched; +static unsigned int g_thread_num; +static unsigned int g_ctxnum; + +static const char* const alg_operations[] = { + "GenKey", "ShareKey", "Encrypt", "Decrypt", "Sign", "Verify", +}; + +static void get_dh_param(u32 algtype, u32 *keysize) +{ + switch(algtype) { + case DH_768: + *keysize = 768; + break; + case DH_1024: + *keysize = 1024; + break; + case DH_1536: + *keysize = 1536; + break; + case DH_2048: + *keysize = 2048; + break; + case DH_3072: + *keysize = 3072; + break; + case DH_4096: + *keysize = 4096; + break; + } +} + +static u32 get_dh_optype(u32 optype) +{ + u32 op_type = 0; + + switch(optype) { + case 0: //GENKEY1 + op_type = WD_DH_PHASE1; + break; + case 1: //GENKEY12 + op_type = WD_DH_PHASE2; + break; + default: + HPRE_TST_PRT("failed to set dh op_type\n"); + HPRE_TST_PRT("DH Gen1: 0\n"); + HPRE_TST_PRT("DH Gen2: 1\n"); + return ERR_OPTYPE; + } + + return op_type; +} + +static void get_rsa_param(u32 algtype, u32 *keysize, u32 *mode) +{ + switch(algtype) { + case RSA_1024: + *keysize = 1024; + *mode = 0; + break; + case RSA_2048: + *keysize = 2048; + *mode = 0; + break; + case RSA_3072: + *keysize = 3072; + *mode = 0; + break; + case RSA_4096: + *keysize = 4096; + *mode = 0; + break; + case RSA_1024_CRT: + *keysize = 1024; + *mode = 1; + break; + case RSA_2048_CRT: + *keysize = 2048; + *mode = 1; + break; + case RSA_3072_CRT: + *keysize = 3072; + *mode = 1; + break; + case RSA_4096_CRT: + *keysize = 4096; + *mode = 1; + break; + } +} + +static u32 get_rsa_optype(u32 optype) +{ + u32 op_type = 0; + + switch(optype) { + case 0: //GENKEY1 + op_type = WD_RSA_GENKEY; + break; + case 4: //Sign + op_type = WD_RSA_SIGN; + break; + case 5: //Verf + op_type = WD_RSA_VERIFY; + break; + default: + HPRE_TST_PRT("failed to set rsa op_type\n"); + HPRE_TST_PRT("RSA Gen: 0\n"); + HPRE_TST_PRT("RSA Sign: 4\n"); + HPRE_TST_PRT("RSA Verf: 5\n"); + return ERR_OPTYPE; + } + + return op_type; +} + +static void get_ecc_param(u32 algtype, u32 *keysize) +{ + switch(algtype) { + case ECDH_256: + *keysize = 256; + break; + case ECDH_384: + *keysize = 384; + break; + case ECDH_521: + *keysize = 521; + break; + case ECDSA_256: + *keysize = 256; + break; + case ECDSA_384: + *keysize = 384; + break; + case ECDSA_521: + *keysize = 521; + break; + case SM2_ALG: + *keysize = 256; + break; + case X25519_ALG: + *keysize = 256; + break; + case X448_ALG: + *keysize = 448; + break; + } +} + +static u32 get_ecc_optype(u32 subtype, u32 optype) +{ + u32 op_type = 0; + + if (subtype == SM2_TYPE) { + switch (optype) { + case 0: + op_type = WD_SM2_KG; + break; + case 2: + op_type = WD_SM2_ENCRYPT; + break; + case 3: + op_type = WD_SM2_DECRYPT; + break; + case 4: + op_type = WD_SM2_SIGN; + break; + case 5: + op_type = WD_SM2_VERIFY; + break; + default: + HPRE_TST_PRT("failed to set SM2 op_type\n"); + HPRE_TST_PRT("SM2 KeyGen: 0\n"); + HPRE_TST_PRT("SM2 Encrypt: 2\n"); + HPRE_TST_PRT("SM2 Decrypt: 3\n"); + HPRE_TST_PRT("SM2 Sign: 4\n"); + HPRE_TST_PRT("SM2 Verify: 5\n"); + return ERR_OPTYPE; + } + } else if (subtype == ECDH_TYPE || + subtype == X25519_TYPE || subtype == X448_TYPE) { + switch(optype) { + case 0: //GENKEY + op_type = WD_ECXDH_GEN_KEY; + break; + case 1: //COMPUTEKEY + op_type = WD_ECXDH_COMPUTE_KEY; + break; + default: + HPRE_TST_PRT("failed to set ECDH op_type\n"); + HPRE_TST_PRT("ECDH GenKey: 0\n"); + HPRE_TST_PRT("ECDH ShareKey: 1\n"); + return ERR_OPTYPE; + } + } else if (subtype == ECDSA_TYPE) { + switch(optype) { + case 4: //Sign + op_type = WD_ECDSA_SIGN; + break; + case 5: //Verf + op_type = WD_ECDSA_VERIFY; + break; + default: + HPRE_TST_PRT("failed to set ECDSA op_type\n"); + HPRE_TST_PRT("ECDSA Sign: 4\n"); + HPRE_TST_PRT("ECDSA Verf: 5\n"); + return ERR_OPTYPE; + } + } + + return op_type; +} + +static int hpre_uadk_param_parse(thread_data *tddata, struct acc_option *options) +{ + u32 algtype = options->algtype; + u32 optype = 0; + u32 keysize = 0; + u32 mode = 0; + + if (algtype >= RSA_1024 && algtype <= RSA_4096_CRT) { + get_rsa_param(algtype, &keysize, &mode); + optype = get_rsa_optype(options->optype); + } else if (algtype <= DH_4096) { + get_dh_param(algtype, &keysize); + optype = get_dh_optype(options->optype); + } else if (algtype <= X448_ALG) { + get_ecc_param(algtype, &keysize); + optype = get_ecc_optype(options->subtype, options->optype); + } else { + HPRE_TST_PRT("failed to set hpre alg!\n"); + return -EINVAL; + } + + if (optype == ERR_OPTYPE) + return -EINVAL; + + /* HPRE package length is keybits */ + options->pktlen = keysize >> 3; + tddata->keybits = keysize; + tddata->kmode = mode; + tddata->optype = optype; + + HPRE_TST_PRT("%s to run %s task!\n", options->algclass, + alg_operations[options->optype]); + + return 0; +} + +static int init_hpre_ctx_config(char *alg, int subtype, int mode) +{ + struct uacce_dev_list *list; + struct sched_params param; + int i, max_node; + int ret = 0; + + max_node = numa_max_node() + 1; + if (max_node <= 0) + return -EINVAL; + + list = wd_get_accel_list(alg); + if (!list) { + HPRE_TST_PRT("failed to get %s device\n", alg); + return -ENODEV; + } + memset(&g_ctx_cfg, 0, sizeof(struct wd_ctx_config)); + g_ctx_cfg.ctx_num = g_ctxnum; + g_ctx_cfg.ctxs = calloc(g_ctxnum, sizeof(struct wd_ctx)); + if (!g_ctx_cfg.ctxs) + return -ENOMEM; + + for (i = 0; i < g_ctxnum; i++) { + g_ctx_cfg.ctxs[i].ctx = wd_request_ctx(list->dev); + g_ctx_cfg.ctxs[i].op_type = 0; // default op_type + g_ctx_cfg.ctxs[i].ctx_mode = (__u8)mode; + } + + switch(subtype) { + case RSA_TYPE: + g_sched = wd_sched_rr_alloc(SCHED_POLICY_RR, 1, max_node, wd_rsa_poll_ctx); + break; + case DH_TYPE: + g_sched = wd_sched_rr_alloc(SCHED_POLICY_RR, 1, max_node, wd_dh_poll_ctx); + break; + case ECDH_TYPE: + case ECDSA_TYPE: + case SM2_TYPE: + case X25519_TYPE: + case X448_TYPE: + g_sched = wd_sched_rr_alloc(SCHED_POLICY_RR, 1, max_node, wd_ecc_poll_ctx); + break; + default: + HPRE_TST_PRT("failed to parse alg subtype!\n"); + g_sched = NULL; + } + if (!g_sched) { + HPRE_TST_PRT("failed to alloc sched!\n"); + goto out; + } + + /* If there is no numa, we defualt config to zero */ + if (list->dev->numa_id < 0) + list->dev->numa_id = 0; + + g_sched->name = SCHED_SINGLE; + param.numa_id = list->dev->numa_id; + param.type = 0; + param.mode = mode; + param.begin = 0; + param.end = g_ctxnum - 1; + ret = wd_sched_rr_instance(g_sched, ¶m); + if (ret) { + HPRE_TST_PRT("failed to fill hpre sched data!\n"); + goto out; + } + + /* init */ + switch(subtype) { + case RSA_TYPE: + ret = wd_rsa_init(&g_ctx_cfg, g_sched); + break; + case DH_TYPE: + ret = wd_dh_init(&g_ctx_cfg, g_sched); + break; + case ECDH_TYPE: + case ECDSA_TYPE: + case SM2_TYPE: + case X25519_TYPE: + case X448_TYPE: + ret = wd_ecc_init(&g_ctx_cfg, g_sched); + break; + default: + ret = -EINVAL; + } + if (ret) { + HPRE_TST_PRT("failed to get hpre ctx!\n"); + goto out; + } + + wd_free_list_accels(list); + + return 0; +out: + free(g_ctx_cfg.ctxs); + wd_sched_rr_release(g_sched); + + return ret; +} + +static void uninit_hpre_ctx_config(int subtype) +{ + int i; + + /* uninit */ + switch(subtype) { + case RSA_TYPE: + wd_rsa_uninit(); + break; + case DH_TYPE: + wd_dh_uninit(); + break; + case ECDH_TYPE: + case ECDSA_TYPE: + case SM2_TYPE: + case X25519_TYPE: + case X448_TYPE: + wd_ecc_uninit(); + break; + default: + HPRE_TST_PRT("failed to parse alg subtype on uninit!\n"); + return; + } + + for (i = 0; i < g_ctx_cfg.ctx_num; i++) + wd_release_ctx(g_ctx_cfg.ctxs[i].ctx); + free(g_ctx_cfg.ctxs); + wd_sched_rr_release(g_sched); +} + +/*-------------------------------uadk benchmark main code-------------------------------------*/ + +void *hpre_uadk_poll(void *data) +{ + typedef int (*poll_ctx)(__u32 idx, __u32 expt, __u32 *count); + poll_ctx uadk_poll_ctx = NULL; + thread_data *pdata = (thread_data *)data; + u32 expt = ACC_QUEUE_SIZE * g_thread_num; + u32 id = pdata->td_id; + u32 last_time = 2; // poll need one more recv time + u32 count = 0; + u32 recv = 0; + int ret; + + if (id > g_ctxnum) + return NULL; + + switch(pdata->subtype) { + case RSA_TYPE: + uadk_poll_ctx = wd_rsa_poll_ctx; + break; + case DH_TYPE: + uadk_poll_ctx = wd_dh_poll_ctx; + break; + case ECDH_TYPE: + case ECDSA_TYPE: + case SM2_TYPE: + case X25519_TYPE: + case X448_TYPE: + uadk_poll_ctx = wd_ecc_poll_ctx; + break; + default: + HPRE_TST_PRT("<<<<<<async poll interface is NULL!\n"); + return NULL; + } + + while (last_time) { + ret = uadk_poll_ctx(id, expt, &recv); + count += recv; + recv = 0; + if (unlikely(ret != -WD_EAGAIN && ret < 0)) { + HPRE_TST_PRT("poll ret: %u!\n", ret); + goto recv_error; + } + + if (get_run_state() == 0) + last_time--; + } + +recv_error: + add_recv_data(count, pdata->keybits >> 3); + + return NULL; +} + +static int get_rsa_key_from_sample(handle_t sess, char *privkey_file, + char *crt_privkey_file, u32 key_bits, u32 is_crt) +{ + struct wd_dtb wd_e, wd_d, wd_n, wd_dq, wd_dp, wd_qinv, wd_q, wd_p; + int e_bytes, d_bytes, n_bytes, q_bytes, p_bytes, qinv_bytes; + u8 *p, *q, *n, *e, *d, *dmp1, *dmq1, *iqmp; + int dq_bytes, dp_bytes, bits, wd_lenth; + u32 key_size = key_bits >> 3; + char *wd_mem; + int ret = 0; + + memset(&wd_e, 0, sizeof(wd_e)); + memset(&wd_d, 0, sizeof(wd_d)); + memset(&wd_n, 0, sizeof(wd_n)); + memset(&wd_dq, 0, sizeof(wd_dq)); + memset(&wd_dp, 0, sizeof(wd_dp)); + memset(&wd_qinv, 0, sizeof(wd_qinv)); + memset(&wd_q, 0, sizeof(wd_q)); + memset(&wd_p, 0, sizeof(wd_p)); + + bits = wd_rsa_get_key_bits(sess); + switch (bits) { + case 1024: + e = rsa_e_1024; + n = rsa_n_1024; + p = rsa_p_1024; + q = rsa_q_1024; + dmp1 = rsa_dp_1024; + dmq1 = rsa_dq_1024; + iqmp = rsa_qinv_1024; + d = rsa_d_1024; + e_bytes = ARRAY_SIZE(rsa_e_1024); + n_bytes = ARRAY_SIZE(rsa_n_1024); + q_bytes = ARRAY_SIZE(rsa_q_1024); + p_bytes = ARRAY_SIZE(rsa_p_1024); + dq_bytes = ARRAY_SIZE(rsa_dq_1024); + dp_bytes = ARRAY_SIZE(rsa_dp_1024); + qinv_bytes = ARRAY_SIZE(rsa_qinv_1024); + d_bytes = ARRAY_SIZE(rsa_d_1024); + break; + case 2048: + e = rsa_e_2048; + n = rsa_n_2048; + p = rsa_p_2048; + q = rsa_q_2048; + dmp1 = rsa_dp_2048; + dmq1 = rsa_dq_2048; + iqmp = rsa_qinv_2048; + d = rsa_d_2048; + e_bytes = ARRAY_SIZE(rsa_e_2048); + n_bytes = ARRAY_SIZE(rsa_n_2048); + q_bytes = ARRAY_SIZE(rsa_q_2048); + p_bytes = ARRAY_SIZE(rsa_p_2048); + dq_bytes = ARRAY_SIZE(rsa_dq_2048); + dp_bytes = ARRAY_SIZE(rsa_dp_2048); + qinv_bytes = ARRAY_SIZE(rsa_qinv_2048); + d_bytes = ARRAY_SIZE(rsa_d_2048); + break; + case 3072: + e = rsa_e_3072; + n = rsa_n_3072; + p = rsa_p_3072; + q = rsa_q_3072; + dmp1 = rsa_dp_3072; + dmq1 = rsa_dq_3072; + iqmp = rsa_qinv_3072; + d = rsa_d_3072; + e_bytes = ARRAY_SIZE(rsa_e_3072); + n_bytes = ARRAY_SIZE(rsa_n_3072); + q_bytes = ARRAY_SIZE(rsa_q_3072); + p_bytes = ARRAY_SIZE(rsa_p_3072); + dq_bytes = ARRAY_SIZE(rsa_dq_3072); + dp_bytes = ARRAY_SIZE(rsa_dp_3072); + qinv_bytes = ARRAY_SIZE(rsa_qinv_3072); + d_bytes = ARRAY_SIZE(rsa_d_3072); + break; + case 4096: + e = rsa_e_4096; + n = rsa_n_4096; + p = rsa_p_4096; + q = rsa_q_4096; + dmp1 = rsa_dp_4096; + dmq1 = rsa_dq_4096; + iqmp = rsa_qinv_4096; + d = rsa_d_4096; + e_bytes = ARRAY_SIZE(rsa_e_4096); + n_bytes = ARRAY_SIZE(rsa_n_4096); + q_bytes = ARRAY_SIZE(rsa_q_4096); + p_bytes = ARRAY_SIZE(rsa_p_4096); + dq_bytes = ARRAY_SIZE(rsa_dq_4096); + dp_bytes = ARRAY_SIZE(rsa_dp_4096); + qinv_bytes = ARRAY_SIZE(rsa_qinv_4096); + d_bytes = ARRAY_SIZE(rsa_d_4096); + break; + default: + HPRE_TST_PRT("invalid key bits = %d!\n", bits); + return -EINVAL; + } + + wd_lenth = e_bytes + n_bytes + q_bytes + p_bytes + dq_bytes + + dp_bytes + qinv_bytes + d_bytes; + wd_mem = malloc(wd_lenth); + if (!wd_mem) { + HPRE_TST_PRT("failed to alloc rsa key memory!\n"); + return -EINVAL; + } + + wd_e.data = wd_mem; + wd_n.data = wd_e.data + e_bytes; + + memcpy(wd_e.data, e, e_bytes); + wd_e.dsize = e_bytes; + memcpy(wd_n.data, n, n_bytes); + wd_n.dsize = n_bytes; + if (wd_rsa_set_pubkey_params(sess, &wd_e, &wd_n)) { + HPRE_TST_PRT("failed to set rsa pubkey!\n"); + ret = -EINVAL; + goto gen_fail; + } + + if (rsa_key_in) { + memcpy(rsa_key_in->e, e, e_bytes); + memcpy(rsa_key_in->p, p, p_bytes); + memcpy(rsa_key_in->q, q, q_bytes); + rsa_key_in->e_size = e_bytes; + rsa_key_in->p_size = p_bytes; + rsa_key_in->q_size = q_bytes; + } + + if (is_crt) { + wd_q.data = wd_n.data + n_bytes; + wd_p.data = wd_q.data + q_bytes; + wd_dq.data = wd_p.data + p_bytes; + wd_dp.data = wd_dq.data + dq_bytes; + wd_qinv.data = wd_dp.data + dp_bytes; + + /* CRT mode private key */ + wd_dq.dsize = dq_bytes; + memcpy(wd_dq.data, dmq1, dq_bytes); + + wd_dp.dsize = dp_bytes; + memcpy(wd_dp.data, dmp1, dp_bytes); + + wd_q.dsize = q_bytes; + memcpy(wd_q.data, q, q_bytes); + + wd_p.dsize = p_bytes; + memcpy(wd_p.data, p, p_bytes); + + wd_qinv.dsize = qinv_bytes; + memcpy(wd_qinv.data, iqmp, qinv_bytes); + + if (wd_rsa_set_crt_prikey_params(sess, &wd_dq, + &wd_dp, &wd_qinv, + &wd_q, &wd_p)) { + HPRE_TST_PRT("failed to set rsa crt prikey!\n"); + ret = -EINVAL; + goto gen_fail; + } + + if (crt_privkey_file) { + memcpy(crt_privkey_file, wd_dq.data, (key_bits >> 4) * 5); + memcpy(crt_privkey_file + (key_bits >> 4) * 5, + wd_e.data, (key_bits >> 2)); + } + + } else { + //wd_rsa_get_prikey_params(prikey, &wd_d, &wd_n); + wd_d.data = wd_mem + (wd_lenth - d_bytes); + + /* common mode private key */ + wd_d.dsize = d_bytes; + memcpy(wd_d.data, d, d_bytes); + + if (wd_rsa_set_prikey_params(sess, &wd_d, &wd_n)) { + HPRE_TST_PRT("failed to set rsa prikey!\n"); + ret = -EINVAL; + goto gen_fail; + } + + + if (privkey_file) { + memcpy(privkey_file, wd_d.data, key_size); + memcpy(privkey_file + key_size, wd_n.data, key_size); + memcpy(privkey_file + 2 * key_size, wd_e.data, key_size); + memcpy(privkey_file + 3 * key_size, wd_n.data, key_size); + } + } + +gen_fail: + free(wd_mem); + + return ret; +} + +static int get_hpre_keygen_opdata(handle_t sess, struct wd_rsa_req *req) +{ + struct wd_rsa_pubkey *pubkey; + struct wd_rsa_prikey *prikey; + struct wd_dtb t_e, t_p, t_q; + struct wd_dtb *e, *p, *q; + + wd_rsa_get_pubkey(sess, &pubkey); + wd_rsa_get_pubkey_params(pubkey, &e, NULL); + wd_rsa_get_prikey(sess, &prikey); + + if (wd_rsa_is_crt(sess)) { + wd_rsa_get_crt_prikey_params(prikey, NULL , NULL, NULL, &q, &p); + } else { + e = &t_e; + p = &t_p; + q = &t_q; + e->data = rsa_key_in->e; + e->dsize = rsa_key_in->e_size; + p->data = rsa_key_in->p; + p->dsize = rsa_key_in->p_size; + q->data = rsa_key_in->q; + q->dsize = rsa_key_in->q_size; + } + + req->src = wd_rsa_new_kg_in(sess, e, p, q); + if (!req->src) { + HPRE_TST_PRT("failed to create rsa kgen in!\n"); + return -ENOMEM; + } + req->dst = wd_rsa_new_kg_out(sess); + if (!req->dst) { + HPRE_TST_PRT("failed to create rsa kgen out!\n"); + wd_rsa_del_kg_in(sess, req->src); + return -ENOMEM; + } + + return 0; +} + +static int get_ecc_curve(struct hpre_ecc_setup *setup, u32 cid) +{ + switch (cid) { + case 0: // secp128R1 + setup->nid = 706; + setup->curve_id = WD_SECP128R1; + break; + case 1: // secp192K1 + setup->nid = 711; + setup->curve_id = WD_SECP192K1; + break; + case 2: // secp224R1 + setup->nid = 712; + setup->curve_id = WD_SECP224R1; + break; + case 3: // secp256K1 + setup->nid = 714; + setup->curve_id = WD_SECP256K1; + break; + case 4: // brainpoolP320R1 + setup->nid = 929; + setup->curve_id = WD_BRAINPOOLP320R1; + break; + case 5: // secp384R1 + setup->nid = 715; + setup->curve_id = WD_SECP384R1; + break; + case 6: // secp521R1 + setup->nid = 716; + setup->curve_id = WD_SECP521R1; + break; + default: + HPRE_TST_PRT("failed to get ecc curve id!\n"); + return -EINVAL; + } + + return 0; +} + +static int get_ecc_key_param(struct wd_ecc_curve *param, u32 key_bits) +{ + u32 key_size = (key_bits + 7) / 8; + + switch (key_bits) { + case 128: + param->a.data = ecdh_a_secp128r1; + param->b.data = ecdh_b_secp128r1; + param->p.data = ecdh_p_secp128r1; + param->n.data = ecdh_n_secp128r1; + param->g.x.data = ecdh_g_secp128r1; + param->g.y.data = ecdh_g_secp128r1 + key_size; + case 192: + param->a.data = ecdh_a_secp192k1; + param->b.data = ecdh_b_secp192k1; + param->p.data = ecdh_p_secp192k1; + param->n.data = ecdh_n_secp192k1; + param->g.x.data = ecdh_g_secp192k1; + param->g.y.data = ecdh_g_secp192k1 + key_size; + case 224: + param->a.data = ecdh_a_secp224r1; + param->b.data = ecdh_b_secp224r1; + param->p.data = ecdh_p_secp224r1; + param->n.data = ecdh_n_secp224r1; + param->g.x.data = ecdh_g_secp224r1; + param->g.y.data = ecdh_g_secp224r1 + key_size; + case 256: + param->a.data = ecdh_a_secp256k1; + param->b.data = ecdh_b_secp256k1; + param->p.data = ecdh_p_secp256k1; + param->n.data = ecdh_n_secp256k1; + param->g.x.data = ecdh_g_secp256k1; + param->g.y.data = ecdh_g_secp256k1 + key_size; + case 320: + param->a.data = ecdh_a_secp320k1; + param->b.data = ecdh_b_secp320k1; + param->p.data = ecdh_p_secp320k1; + param->n.data = ecdh_n_secp320k1; + param->g.x.data = ecdh_g_secp320k1; + param->g.y.data = ecdh_g_secp320k1 + key_size; + case 384: + param->a.data = ecdh_a_secp384r1; + param->b.data = ecdh_b_secp384r1; + param->p.data = ecdh_p_secp384r1; + param->n.data = ecdh_n_secp384r1; + param->g.x.data = ecdh_g_secp384r1; + param->g.y.data = ecdh_g_secp384r1 + key_size; + case 521: + param->a.data = ecdh_a_secp521r1; + param->b.data = ecdh_b_secp521r1; + param->p.data = ecdh_p_secp521r1; + param->n.data = ecdh_n_secp521r1; + param->g.x.data = ecdh_g_secp521r1; + param->g.y.data = ecdh_g_secp521r1 + key_size; + default: + HPRE_TST_PRT("key_bits %d not find\n", key_bits); + return -EINVAL; + } + + param->a.bsize = key_size; + param->a.dsize = key_size; + param->b.bsize = key_size; + param->b.dsize = key_size; + param->p.bsize = key_size; + param->p.dsize = key_size; + param->n.bsize = key_size; + param->n.dsize = key_size; + param->g.x.bsize = key_size; + param->g.x.dsize = key_size; + param->g.y.bsize = key_size; + param->g.y.dsize = key_size; + + return 0; +} + +static int ecc_get_rand(char *out, size_t out_len, void *usr) +{ + //int ret; + + get_rand_data((u8 *)out, out_len); + //ret = RAND_priv_bytes((void *)out, out_len); + //if (ret != 1) { + // HPRE_TST_PRT("failed to get ecc rand data:%d\n", ret); + // return -EINVAL; + //} + + return 0; +} + +static int get_ecc_param_from_sample(struct hpre_ecc_setup *setup, + u32 subtype, u32 key_bits) +{ + int key_size = (key_bits + 7) / 8; + u32 len; + + setup->key_bits = key_bits; + + if (setup->nid == 714 || key_bits == 256) { // NID_secp256k1 + /* sm2 */ + if (subtype == SM2_TYPE) { + setup->priv_key = sm2_priv; + setup->priv_key_size = sizeof(sm2_priv); + setup->pub_key = sm2_pubkey; + setup->pub_key_size = sizeof(sm2_pubkey); + + len = SM2_DG_SZ; + setup->msg = malloc(len); + if (!setup->msg) + return -1; + memset(setup->msg, 0xFF, len); + + if (true) { // for msg_sigest mode + memcpy(setup->msg, sm2_digest, sizeof(sm2_digest)); + setup->msg_size = sizeof(sm2_digest); + } else { + memcpy(setup->msg, sm2_plaintext, sizeof(sm2_plaintext)); + setup->msg_size = sizeof(sm2_plaintext); + } + + if (setup->msg_size > 512) { + setup->ciphertext = sm2_ciphertext_l; + setup->ciphertext_size = sizeof(sm2_ciphertext_l); + setup->plaintext = sm2_plaintext_l; + setup->plaintext_size = sizeof(sm2_plaintext_l); + } else { + setup->ciphertext = sm2_ciphertext; + setup->ciphertext_size = sizeof(sm2_ciphertext); + setup->plaintext = sm2_plaintext; + setup->plaintext_size = sizeof(sm2_plaintext); + } + + setup->k = sm2_k; + setup->k_size = sizeof(sm2_k); + setup->userid = sm2_id; + setup->userid_size = sizeof(sm2_id); + setup->sign = sm2_sign_data; + setup->sign_size = sizeof(sm2_sign_data); + + } else { + setup->priv_key = ecdh_da_secp256k1; + setup->except_pub_key = ecdh_except_b_pubkey_secp256k1; + setup->pub_key = ecdh_cp_pubkey_secp256k1; + setup->share_key = ecdh_cp_sharekey_secp256k1; + setup->priv_key_size = sizeof(ecdh_da_secp256k1); + setup->except_pub_key_size = sizeof(ecdh_except_b_pubkey_secp256k1); + setup->pub_key_size = sizeof(ecdh_cp_pubkey_secp256k1); + setup->share_key_size = sizeof(ecdh_cp_sharekey_secp256k1); + + /* ecc sign */ + setup->msg = ecc_except_e_secp256k1; + setup->msg_size = sizeof(ecc_except_e_secp256k1); + setup->k = ecc_except_kinv_secp256k1; + setup->k_size = sizeof(ecc_except_kinv_secp256k1); + setup->rp = ecdh_cp_pubkey_secp256k1 + 1; + setup->rp_size = key_size; + + /* ecc verf */ + setup->sign = ecc_cp_sign_secp256k1; + setup->sign_size = sizeof(ecc_cp_sign_secp256k1); + } + } else if (setup->nid == 706 || key_bits == 128) { + setup->priv_key = ecdh_da_secp128r1; + setup->except_pub_key = ecdh_except_b_pubkey_secp128r1; + setup->pub_key = ecdh_cp_pubkey_secp128r1; + setup->share_key = ecdh_cp_sharekey_secp128r1; + setup->priv_key_size = sizeof(ecdh_da_secp128r1); + setup->except_pub_key_size = sizeof(ecdh_except_b_pubkey_secp128r1); + setup->pub_key_size = sizeof(ecdh_cp_pubkey_secp128r1); + setup->share_key_size = sizeof(ecdh_cp_sharekey_secp128r1); + + /* ecc sign */ + setup->msg = ecc_except_e_secp128r1; + setup->msg_size = sizeof(ecc_except_e_secp128r1); + setup->k = ecc_except_kinv_secp128r1; + setup->k_size = sizeof(ecc_except_kinv_secp128r1); + setup->rp = ecdh_cp_pubkey_secp128r1 + 1; + setup->rp_size = key_size; + + /* ecc verf */ + setup->sign = ecc_cp_sign_secp128r1; + setup->sign_size = sizeof(ecc_cp_sign_secp128r1); + + } else if (setup->nid == 711 || key_bits == 192) { + setup->priv_key = ecdh_da_secp192k1; + setup->except_pub_key = ecdh_except_b_pubkey_secp192k1; + setup->pub_key = ecdh_cp_pubkey_secp192k1; + setup->share_key = ecdh_cp_sharekey_secp192k1; + setup->priv_key_size = sizeof(ecdh_da_secp192k1); + setup->except_pub_key_size = sizeof(ecdh_except_b_pubkey_secp192k1); + setup->pub_key_size = sizeof(ecdh_cp_pubkey_secp192k1); + setup->share_key_size = sizeof(ecdh_cp_sharekey_secp192k1); + + /* ecc sign */ + setup->msg = ecc_except_e_secp192k1; + setup->msg_size = sizeof(ecc_except_e_secp192k1); + setup->k = ecc_except_kinv_secp192k1; + setup->k_size = sizeof(ecc_except_kinv_secp192k1); + setup->rp = ecdh_cp_pubkey_secp192k1 + 1; + setup->rp_size = key_size; + + /* ecc verf */ + setup->sign = ecc_cp_sign_secp256k1; + setup->sign_size = sizeof(ecc_cp_sign_secp256k1); + } else if (setup->nid == 712 || key_bits == 224) { + setup->priv_key = ecdh_da_secp224r1; + setup->except_pub_key = ecdh_except_b_pubkey_secp224r1; + setup->pub_key = ecdh_cp_pubkey_secp224r1; + setup->share_key = ecdh_cp_sharekey_secp224r1; + setup->priv_key_size = sizeof(ecdh_da_secp224r1); + setup->except_pub_key_size = sizeof(ecdh_except_b_pubkey_secp224r1); + setup->pub_key_size = sizeof(ecdh_cp_pubkey_secp224r1); + setup->share_key_size = sizeof(ecdh_cp_sharekey_secp224r1); + } else if (setup->nid == 929 || key_bits == 320) { + setup->priv_key = ecdh_da_secp320k1; + setup->except_pub_key = ecdh_except_b_pubkey_secp320k1; + setup->pub_key = ecdh_cp_pubkey_secp320k1; + setup->share_key = ecdh_cp_sharekey_secp320k1; + setup->priv_key_size = sizeof(ecdh_da_secp320k1); + setup->except_pub_key_size = sizeof(ecdh_except_b_pubkey_secp320k1); + setup->pub_key_size = sizeof(ecdh_cp_pubkey_secp320k1); + setup->share_key_size = sizeof(ecdh_cp_sharekey_secp320k1); + + /* ecc sign */ + setup->msg = ecc_except_e_secp320k1; + setup->msg_size = sizeof(ecc_except_e_secp320k1); + setup->k = ecc_except_kinv_secp320k1; + setup->k_size = sizeof(ecc_except_kinv_secp320k1); + setup->rp = ecdh_cp_pubkey_secp192k1 + 1; + setup->rp_size = key_size; + + /* ecc verf */ + setup->sign = ecc_cp_sign_secp256k1; + setup->sign_size = sizeof(ecc_cp_sign_secp256k1); + + } else if (setup->nid == 931 || key_bits == 384) { + setup->priv_key = ecdh_da_secp384r1; + setup->except_pub_key = ecdh_except_b_pubkey_secp384r1; + setup->pub_key = ecdh_cp_pubkey_secp384r1; + setup->share_key = ecdh_cp_sharekey_secp384r1; + setup->priv_key_size = sizeof(ecdh_da_secp384r1); + setup->except_pub_key_size = sizeof(ecdh_except_b_pubkey_secp384r1); + setup->pub_key_size = sizeof(ecdh_cp_pubkey_secp384r1); + setup->share_key_size = sizeof(ecdh_cp_sharekey_secp384r1); + + /* ecc sign */ + setup->msg = ecc_except_e_secp384r1; + setup->msg_size = sizeof(ecc_except_e_secp384r1); + setup->k = ecc_except_kinv_secp384r1; + setup->k_size = sizeof(ecc_except_kinv_secp384r1); + setup->rp = ecdh_cp_pubkey_secp384r1 + 1; + setup->rp_size = key_size; + + /* ecc verf */ + setup->sign = ecc_cp_sign_secp256k1; + setup->sign_size = sizeof(ecc_cp_sign_secp256k1); + } else if (setup->nid == 716 || key_bits == 521) { + setup->priv_key = ecdh_da_secp521r1; + setup->except_pub_key = ecdh_except_b_pubkey_secp521r1; + setup->pub_key = ecdh_cp_pubkey_secp521r1; + setup->share_key = ecdh_cp_sharekey_secp521r1; + setup->priv_key_size = sizeof(ecdh_da_secp521r1); + setup->except_pub_key_size = sizeof(ecdh_except_b_pubkey_secp521r1); + setup->pub_key_size = sizeof(ecdh_cp_pubkey_secp521r1); + setup->share_key_size = sizeof(ecdh_cp_sharekey_secp521r1); + + /* ecc sign */ + setup->msg = ecc_except_e_secp521r1; + setup->msg_size = sizeof(ecc_except_e_secp521r1); + setup->k = ecc_except_kinv_secp521r1; + setup->k_size = sizeof(ecc_except_kinv_secp521r1); + setup->rp = ecdh_cp_pubkey_secp521r1 + 1; + setup->rp_size = key_size; + + /* ecc verf */ + setup->sign = ecc_cp_sign_secp256k1; + setup->sign_size = sizeof(ecc_cp_sign_secp256k1); + + } else { + HPRE_TST_PRT("init test sess setup not find this bits %d or nid %d\n", + key_bits, setup->nid); + return -EINVAL; + } + + return 0; +} + +static void *rsa_uadk_sync_run(void *arg) +{ + thread_data *pdata = (thread_data *)arg; + int key_size = pdata->keybits >> 3; + struct wd_rsa_sess_setup setup; + struct wd_rsa_req req; + void *key_info = NULL; + handle_t h_sess; + u32 count = 0; + int ret; + + memset(&setup, 0, sizeof(setup)); + memset(&req, 0, sizeof(req)); + setup.key_bits = pdata->keybits; + setup.is_crt = pdata->kmode; + + h_sess = wd_rsa_alloc_sess(&setup); + if (!h_sess) + return NULL; + + key_info = malloc(key_size * 16); + if (!key_info) { + HPRE_TST_PRT("failed to alloc RSA key info!\n"); + return NULL; + } + memset(key_info, 0, key_size * 16); + + rsa_key_in = malloc(2 * key_size + sizeof(struct hpre_rsa_key_in)); + if (!rsa_key_in) { + HPRE_TST_PRT("failed to alloc RSA key input param!\n"); + goto key_release; + } + rsa_key_in->e = rsa_key_in + 1; + rsa_key_in->p = rsa_key_in->e + key_size; + rsa_key_in->q = rsa_key_in->p + (key_size >> 1); + + ret = get_rsa_key_from_sample(h_sess, key_info, key_info, + pdata->keybits, pdata->kmode); + if (ret) { + HPRE_TST_PRT("failed to get sample key data!\n"); + goto sample_release; + } + + req.src_bytes = key_size; + req.dst_bytes = key_size; + req.op_type = pdata->optype; + if (req.op_type == WD_RSA_GENKEY) { + ret = get_hpre_keygen_opdata(h_sess, &req); + if (ret){ + HPRE_TST_PRT("failed to fill rsa key gen req!\n"); + goto sample_release; + } + } else { + req.src = malloc(key_size); + if (!req.src) { + HPRE_TST_PRT("failed to alloc rsa in buffer!\n"); + goto sample_release; + } + memset(req.src, 0, req.src_bytes); + memcpy(req.src + key_size - sizeof(rsa_m), rsa_m, sizeof(rsa_m)); + req.dst = malloc(key_size); + if (!req.dst) { + HPRE_TST_PRT("failed to alloc rsa out buffer!\n"); + goto src_release; + } + } + + do { + ret = wd_do_rsa_sync(h_sess, &req); + if (ret || req.status) { + HPRE_TST_PRT("failed to do rsa task, status: %d\n", req.status); + goto dst_release; + } + + count++; + if (get_run_state() == 0) + break; + } while(true); + + /* clean output buffer remainings in the last time operation */ + if (req.op_type == WD_RSA_GENKEY) { + char *data; + int len; + + len = wd_rsa_kg_out_data((void *)req.dst, &data); + if (len < 0) { + HPRE_TST_PRT("failed to wd rsa get key gen out data!\n"); + goto sample_release; + } + memset(data, 0, len); + + wd_rsa_del_kg_in(h_sess, req.src); + req.src = NULL; + wd_rsa_del_kg_out(h_sess, req.dst); + req.dst = NULL; + } + +dst_release: + if (req.dst) + free(req.dst); +src_release: + if (req.src) + free(req.src); +sample_release: + free(rsa_key_in); +key_release: + free(key_info); + + wd_rsa_free_sess(h_sess); + add_recv_data(count, key_size); + + return NULL; +} + +static void rsa_async_cb(void *req_t) +{ + //struct wd_rsa_req *req = req_t; + //struct rsa_async_tag *tag = req->cb_param; + //enum wd_rsa_op_type op_type = req->op_type; + //handle_t h_sess = tag->sess; + + return; +} + +static void *rsa_uadk_async_run(void *arg) +{ + thread_data *pdata = (thread_data *)arg; + int key_size = pdata->keybits >> 3; + struct rsa_async_tag *tag; + struct wd_rsa_sess_setup setup; + struct wd_rsa_req req; + void *key_info = NULL; + int try_cnt = 0; + handle_t h_sess; + u32 count = 0; + int i, ret; + + memset(&setup, 0, sizeof(setup)); + memset(&req, 0, sizeof(req)); + setup.key_bits = pdata->keybits; + setup.is_crt = pdata->kmode; + + h_sess = wd_rsa_alloc_sess(&setup); + if (!h_sess) + return NULL; + + key_info = malloc(key_size * 16); + if (!key_info) { + HPRE_TST_PRT("failed to alloc RSA key info!\n"); + return NULL; + } + memset(key_info, 0, key_size * 16); + + rsa_key_in = malloc(2 * key_size + sizeof(struct hpre_rsa_key_in)); + if (!rsa_key_in) { + HPRE_TST_PRT("failed to alloc RSA key input param!\n"); + goto key_release; + } + rsa_key_in->e = rsa_key_in + 1; + rsa_key_in->p = rsa_key_in->e + key_size; + rsa_key_in->q = rsa_key_in->p + (key_size >> 1); + + ret = get_rsa_key_from_sample(h_sess, key_info, key_info, + pdata->keybits, pdata->kmode); + if (ret) { + HPRE_TST_PRT("failed to get sample key data!\n"); + goto sample_release; + } + + req.src_bytes = key_size; + req.dst_bytes = key_size; + req.op_type = pdata->optype; + if (req.op_type == WD_RSA_GENKEY) { + ret = get_hpre_keygen_opdata(h_sess, &req); + if (ret){ + HPRE_TST_PRT("failed to fill rsa key gen req!\n"); + goto sample_release; + } + } else { + req.src = malloc(key_size); + if (!req.src) { + HPRE_TST_PRT("failed to alloc rsa in buffer!\n"); + goto sample_release; + } + memset(req.src, 0, req.src_bytes); + memcpy(req.src + key_size - sizeof(rsa_m), rsa_m, sizeof(rsa_m)); + req.dst = malloc(key_size); + if (!req.dst) { + HPRE_TST_PRT("failed to alloc rsa out buffer!\n"); + goto src_release; + } + } + + tag = malloc(sizeof(*tag) * MAX_POOL_LENTH); + if (!tag) { + HPRE_TST_PRT("failed to malloc rsa tag!\n"); + goto dst_release; + } + req.cb = rsa_async_cb; + + do { + if (get_run_state() == 0) + break; + + try_cnt = 0; + i = count % MAX_POOL_LENTH; + tag[i].sess = h_sess; + req.cb_param = &tag[i]; + + ret = wd_do_rsa_async(h_sess, &req); + if (ret == -WD_EBUSY) { + usleep(SEND_USLEEP * try_cnt); + try_cnt++; + if (try_cnt > MAX_TRY_CNT) { + HPRE_TST_PRT("Test RSA send fail %d times!\n", MAX_TRY_CNT); + try_cnt = 0; + } + continue; + } else if (ret) { + HPRE_TST_PRT("failed to do rsa async task!\n"); + goto tag_release; + } + count++; + } while(true); + + /* clean output buffer remainings in the last time operation */ + if (req.op_type == WD_RSA_GENKEY) { + char *data; + int len; + + len = wd_rsa_kg_out_data((void *)req.dst, &data); + if (len < 0) { + HPRE_TST_PRT("failed to wd rsa get key gen out data!\n"); + goto tag_release; + } + memset(data, 0, len); + + wd_rsa_del_kg_in(h_sess, req.src); + req.src = NULL; + wd_rsa_del_kg_out(h_sess, req.dst); + req.dst = NULL; + } + +tag_release: + free(tag); +dst_release: + if (req.dst) + free(req.dst); +src_release: + if (req.src) + free(req.src); +sample_release: + free(rsa_key_in); +key_release: + free(key_info); + + wd_rsa_free_sess(h_sess); + add_send_complete(); + + return NULL; +} + +static int get_dh_param_from_sample(struct hpre_dh_param *setup, + u32 key_bits, u8 is_g2) +{ + setup->key_bits = key_bits; + + switch (key_bits) { + case 768: + setup->x = dh_xa_768; + setup->p = dh_p_768; + setup->except_pub_key = dh_except_b_pubkey_768; + setup->pub_key = dh_except_a_pubkey_768; + setup->share_key = dh_share_key_768; + setup->x_size = sizeof(dh_xa_768); + setup->p_size = sizeof(dh_p_768); + setup->except_pub_key_size = sizeof(dh_except_b_pubkey_768); + setup->pub_key_size = sizeof(dh_except_a_pubkey_768); + setup->share_key_size = sizeof(dh_share_key_768); + break; + case 1024: + setup->x = dh_xa_1024; + setup->p = dh_p_1024; + setup->except_pub_key = dh_except_b_pubkey_1024; + setup->pub_key = dh_except_a_pubkey_1024; + setup->share_key = dh_share_key_1024; + setup->x_size = sizeof(dh_xa_1024); + setup->p_size = sizeof(dh_p_1024); + setup->except_pub_key_size = sizeof(dh_except_b_pubkey_1024); + setup->pub_key_size = sizeof(dh_except_a_pubkey_1024); + setup->share_key_size = sizeof(dh_share_key_1024); + break; + case 1536: + setup->x = dh_xa_1536; + setup->p = dh_p_1536; + setup->except_pub_key = dh_except_b_pubkey_1536; + setup->pub_key = dh_except_a_pubkey_1536; + setup->share_key = dh_share_key_1536; + setup->x_size = sizeof(dh_xa_1536); + setup->p_size = sizeof(dh_p_1536); + setup->except_pub_key_size = sizeof(dh_except_b_pubkey_1536); + setup->pub_key_size = sizeof(dh_except_a_pubkey_1536); + setup->share_key_size = sizeof(dh_share_key_1536); + break; + case 2048: + setup->x = dh_xa_2048; + setup->p = dh_p_2048; + setup->except_pub_key = dh_except_b_pubkey_2048; + setup->pub_key = dh_except_a_pubkey_2048; + setup->share_key = dh_share_key_2048; + setup->x_size = sizeof(dh_xa_2048); + setup->p_size = sizeof(dh_p_2048); + setup->except_pub_key_size = sizeof(dh_except_b_pubkey_2048); + setup->pub_key_size = sizeof(dh_except_a_pubkey_2048); + setup->share_key_size = sizeof(dh_share_key_2048); + break; + case 3072: + setup->x = dh_xa_3072; + setup->p = dh_p_3072; + setup->except_pub_key = dh_except_b_pubkey_3072; + setup->pub_key = dh_except_a_pubkey_3072; + setup->share_key = dh_share_key_3072; + setup->x_size = sizeof(dh_xa_3072); + setup->p_size = sizeof(dh_p_3072); + setup->except_pub_key_size = sizeof(dh_except_b_pubkey_3072); + setup->pub_key_size = sizeof(dh_except_a_pubkey_3072); + setup->share_key_size = sizeof(dh_share_key_3072); + break; + case 4096: + setup->x = dh_xa_4096; + setup->p = dh_p_4096; + setup->except_pub_key = dh_except_b_pubkey_4096; + setup->pub_key = dh_except_a_pubkey_4096; + setup->share_key = dh_share_key_4096; + setup->x_size = sizeof(dh_xa_4096); + setup->p_size = sizeof(dh_p_4096); + setup->except_pub_key_size = sizeof(dh_except_b_pubkey_4096); + setup->pub_key_size = sizeof(dh_except_a_pubkey_4096); + setup->share_key_size = sizeof(dh_share_key_4096); + break; + default: + HPRE_TST_PRT("failed to find dh keybits %u\n", key_bits); + return -EINVAL; + } + + if (is_g2) { + setup->g = dh_g_2; + } else { + setup->g = dh_g_5; + } + setup->g_size = 1; + + return 0; +} + +static int get_dh_opdata_param(handle_t h_sess, struct wd_dh_req *req, + struct hpre_dh_param *setup, int key_size) +{ + unsigned char *ag_bin = NULL; + struct wd_dtb ctx_g; + int ret; + + ag_bin = malloc(2 * key_size); + if (!ag_bin) + return -ENOMEM; + + memset(ag_bin, 0, 2 * key_size); + req->pv = ag_bin; + + req->x_p = malloc(2 * key_size); + if (!req->x_p) + goto ag_error; + + memset(req->x_p, 0, 2 * key_size); + + req->pri = malloc(2 * key_size); + if (!req->pri) + goto xp_error; + + memset(req->pri, 0, 2 * key_size); + req->pri_bytes = 2 * key_size; + + ctx_g.data = malloc(key_size); + if (!ctx_g.data) + goto ctx_release; + + if (setup->optype == WD_DH_PHASE1) { // GEN1 + memcpy(req->x_p, setup->x, setup->x_size); + memcpy(req->x_p + key_size, setup->p, setup->p_size); + memcpy(ctx_g.data, setup->g, setup->g_size); + req->pbytes = setup->p_size; + req->xbytes = setup->x_size; + ctx_g.dsize = setup->g_size; + ctx_g.bsize = key_size; + + ret = wd_dh_set_g(h_sess, &ctx_g); + if (ret) + HPRE_TST_PRT("wd_dh_set_g run failed\n"); + } else { // GEN1 + memcpy(req->x_p, setup->x, setup->x_size); + memcpy(req->x_p + key_size, setup->p, setup->p_size); + memcpy(req->pv, setup->except_pub_key, setup->except_pub_key_size); + req->pbytes = setup->p_size; + req->xbytes = setup->x_size; + req->pvbytes = setup->except_pub_key_size; + } + + free(ctx_g.data); + + return 0; + +ctx_release: + free(req->pri); +xp_error: + free(req->x_p); +ag_error: + free(req->pv); + + return -ENOMEM; +} + +static void dh_async_cb(void *req_t) +{ + //struct wd_dh_req *req = req_t; + //struct rsa_async_tag *tag = req->cb_param; + //enum wd_rsa_op_type op_type = req->op_type; + //handle_t h_sess = tag->sess; + + return; +} + +static void *dh_uadk_async_run(void *arg) +{ + thread_data *pdata = (thread_data *)arg; + int key_size = pdata->keybits >> 3; + struct wd_dh_sess_setup dh_setup; + struct rsa_async_tag *tag; + struct hpre_dh_param param; + struct wd_dh_req req; + handle_t h_sess; + int try_cnt = 0; + u32 count = 0; + int i, ret; + + memset(&dh_setup, 0, sizeof(dh_setup)); + memset(&req, 0, sizeof(req)); + dh_setup.key_bits = pdata->keybits; + if (pdata->optype == WD_DH_PHASE2) + dh_setup.is_g2 = true; // G1 is 0; G2 is 1; + + h_sess = wd_dh_alloc_sess(&dh_setup); + if (!h_sess) + return NULL; + + ret = get_dh_param_from_sample(¶m, pdata->keybits, pdata->kmode); + if (ret) + goto sess_release; + + param.optype = pdata->optype; + req.op_type = pdata->optype; + ret = get_dh_opdata_param(h_sess, &req, ¶m, key_size); + if (ret){ + HPRE_TST_PRT("failed to fill dh key gen req!\n"); + goto param_release; + } + + tag = malloc(sizeof(*tag) * MAX_POOL_LENTH); + if (!tag) { + HPRE_TST_PRT("failed to malloc rsa tag!\n"); + goto param_release; + } + req.cb = dh_async_cb; + + do { + if (get_run_state() == 0) + break; + + try_cnt = 0; + i = count % MAX_POOL_LENTH; + tag[i].sess = h_sess; + req.cb_param = &tag[i]; + + ret = wd_do_dh_async(h_sess, &req); + if (ret == -WD_EBUSY) { + usleep(SEND_USLEEP * try_cnt); + try_cnt++; + if (try_cnt > MAX_TRY_CNT) { + HPRE_TST_PRT("Test DH send fail %d times!\n", MAX_TRY_CNT); + try_cnt = 0; + } + continue; + } else if (ret) { + HPRE_TST_PRT("failed to do DH async task!\n"); + goto tag_release; + } + count++; + } while(true); + +tag_release: + free(tag); +param_release: + free(req.x_p); + free(req.pv); + free(req.pri); +sess_release: + wd_dh_free_sess(h_sess); + add_send_complete(); + + return NULL; +} + +static void *dh_uadk_sync_run(void *arg) +{ + thread_data *pdata = (thread_data *)arg; + int key_size = pdata->keybits >> 3; + struct wd_dh_sess_setup dh_setup; + struct hpre_dh_param setup; + struct wd_dh_req req; + handle_t h_sess; + u32 count = 0; + int ret; + + memset(&dh_setup, 0, sizeof(dh_setup)); + memset(&req, 0, sizeof(req)); + dh_setup.key_bits = pdata->keybits; + if (pdata->optype == WD_DH_PHASE2) + dh_setup.is_g2 = true; // G1 is 0; G2 is 1; + + h_sess = wd_dh_alloc_sess(&dh_setup); + if (!h_sess) + return NULL; + + ret = get_dh_param_from_sample(&setup, pdata->keybits, pdata->kmode); + if (ret) + goto sess_release; + + setup.optype = pdata->optype; + req.op_type = pdata->optype; + ret = get_dh_opdata_param(h_sess, &req, &setup, key_size); + if (ret){ + HPRE_TST_PRT("failed to fill dh key gen req!\n"); + goto param_release; + } + + do { + ret = wd_do_dh_sync(h_sess, &req); + if (ret || req.status) { + HPRE_TST_PRT("failed to do dh task, status: %d\n", req.status); + goto param_release; + } + + count++; + if (get_run_state() == 0) + break; + } while(true); + +param_release: + free(req.x_p); + free(req.pv); + free(req.pri); +sess_release: + wd_dh_free_sess(h_sess); + add_recv_data(count, key_size); + + return NULL; +} + +static int hpre_compute_hash(const char *in, size_t in_len, + char *out, size_t out_len, void *usr) +{ + /* perf test for none hash check */ + return 0; +} + +static int ecdsa_param_fill(handle_t h_sess, struct wd_ecc_req *req, + struct wd_ecc_key *ecc_key, struct hpre_ecc_setup *setup, + thread_data *pdata) +{ + int key_insize = (pdata->keybits + 7) / 8; + u32 optype = pdata->optype; + struct wd_ecc_out *ecc_out = NULL; + struct wd_ecc_in *ecc_in = NULL; + struct wd_ecc_point pub; + struct wd_dtb d, e, k; + int ret = 0; + + if (optype == WD_ECDSA_SIGN) {// Sign + ecc_out = wd_ecdsa_new_sign_out(h_sess); + if (!ecc_out) { + HPRE_TST_PRT("failed to get ecdsa out!\n"); + return -ENOMEM; + } + + d.data = (void *)setup->priv_key; + d.dsize = setup->priv_key_size; + d.bsize = setup->priv_key_size; + ret = wd_ecc_set_prikey(ecc_key, &d); + if (ret) { + HPRE_TST_PRT("failed to set ecdsa prikey!\n"); + goto del_ecc_out; + } + + pub.x.data = (void *)setup->pub_key + 1; + pub.x.dsize = key_insize; + pub.x.bsize = key_insize; + pub.y.data = pub.x.data + key_insize; + pub.y.dsize = key_insize; + pub.y.bsize = key_insize; + ret = wd_ecc_set_pubkey(ecc_key, &pub); + if (ret) { + HPRE_TST_PRT("failed to set ecdsa pubkey!\n"); + goto del_ecc_out; + } + + e.data = (void *)setup->msg; + e.dsize = setup->msg_size; + e.bsize = key_insize; + + k.data = (void *)setup->k; + k.dsize = setup->k_size; + k.bsize = key_insize; + ecc_in = wd_ecdsa_new_sign_in(h_sess, &e, &k); + if (!ecc_in) { + HPRE_TST_PRT("failed to get ecdsa sign in!\n"); + ret = -ENOMEM; + goto del_ecc_out; + } + + req->src = ecc_in; + req->dst = ecc_out; + } else { // Verf + pub.x.data = (void *)setup->pub_key + 1; + pub.x.dsize = key_insize; + pub.x.bsize = key_insize; + pub.y.data = pub.x.data + key_insize; + pub.y.dsize = key_insize; + pub.y.bsize = key_insize; + ret = wd_ecc_set_pubkey(ecc_key, &pub); + if (ret) { + HPRE_TST_PRT("failed to set ecdsa pubkey!\n"); + return -ENOMEM; + } + + e.data = (void *)setup->msg; + e.dsize = setup->msg_size; + e.bsize = key_insize; + + d.data = (void *)setup->sign; + d.dsize = key_insize; + d.bsize = key_insize; + k.data = d.data + key_insize; + k.dsize = key_insize; + k.bsize = key_insize; + ecc_in = wd_ecdsa_new_verf_in(h_sess, &e, &d, &k); + if (!ecc_in) { + HPRE_TST_PRT("failed to get ecdsa verf ecc in!\n"); + return -ENOMEM; + } + + req->src = ecc_in; + } + + return 0; +del_ecc_out: + if (ecc_out) + (void)wd_ecc_del_out(h_sess, ecc_out); + return ret; +} + +static int sm2_param_fill(handle_t h_sess, struct wd_ecc_req *req, + struct hpre_ecc_setup *setup, thread_data *pdata) +{ + int key_insize = (pdata->keybits + 7) / 8; + u32 optype = pdata->optype; + struct wd_ecc_out *ecc_out = NULL; + struct wd_ecc_in *ecc_in = NULL; + struct wd_ecc_point tmp; + struct wd_dtb d, e, k; + + switch (optype) { + case WD_SM2_SIGN:// Sign + ecc_out = wd_sm2_new_sign_out(h_sess); + if (!ecc_out) { + HPRE_TST_PRT("failed to alloc sm2 ecc out!\n"); + return -ENOMEM; + } + + e.data = (void *)setup->msg; + e.dsize = setup->msg_size; + e.bsize = setup->msg_size; + k.data = (void *)setup->k; + k.dsize = setup->k_size; + k.bsize = key_insize; + ecc_in = wd_sm2_new_sign_in(h_sess, &e, &k, NULL, 1); + if (!ecc_in) { + HPRE_TST_PRT("failed to alloc sm2 ecc in!\n"); + goto del_ecc_out; + } + req->src = ecc_in; + req->dst = ecc_out; + break; + case WD_SM2_VERIFY: // Verf + ecc_out = wd_sm2_new_sign_out(h_sess); + if (!ecc_out) { + HPRE_TST_PRT("failed to alloc sm2 ecc out!\n"); + return -ENOMEM; + } + + e.data = (void *)setup->msg; + e.dsize = setup->msg_size; + e.bsize = key_insize; + d.data = (void *)setup->sign; + d.dsize = key_insize; + d.bsize = key_insize; + k.data = d.data + key_insize; + k.dsize = key_insize; + k.bsize = key_insize; + ecc_in = wd_sm2_new_verf_in(h_sess, &e, &d, &k, NULL, 1); + if (!ecc_in) { + HPRE_TST_PRT("failed to alloc sm2 ecc in!\n"); + goto del_ecc_out; + } + + req->src = ecc_in; + req->dst = ecc_out; + break; + case WD_SM2_ENCRYPT: // Enc + ecc_out = wd_sm2_new_enc_out(h_sess, setup->msg_size); + if (!ecc_out) { + HPRE_TST_PRT("failed to alloc sm2 ecc out!\n"); + return -ENOMEM; + } + + e.data = (void *)setup->plaintext; + e.dsize = setup->plaintext_size; + e.bsize = setup->plaintext_size; + k.data = (void *)setup->k; + k.dsize = setup->k_size; + k.bsize = key_insize; + ecc_in = wd_sm2_new_enc_in(h_sess, &e, &k); + if (!ecc_in) { + HPRE_TST_PRT("failed to alloc sm2 ecc in!\n"); + goto del_ecc_out; + } + req->src = ecc_in; + req->dst = ecc_out; + break; + case WD_SM2_DECRYPT: // Dec + tmp.x.data = (void *)setup->ciphertext; + tmp.x.dsize = 32; + tmp.y.data = tmp.x.data + 32; + tmp.y.dsize = 32; + e.data = tmp.y.data + 32; + e.dsize = 32; + d.data = e.data + 32; + d.dsize = setup->ciphertext_size - 32 * 3; + ecc_in = wd_sm2_new_dec_in(h_sess, &tmp, &d, &e); + if (!ecc_in) { + HPRE_TST_PRT("failed to alloc sm2 ecc in!\n"); + return -ENOMEM; + } + + ecc_out = wd_sm2_new_dec_out(h_sess, d.dsize); + if (!ecc_out) { + HPRE_TST_PRT("failed to alloc sm2 ecc out!\n"); + goto del_ecc_in; + } + + req->src = ecc_in; + req->dst = ecc_out; + break; + case WD_SM2_KG: // KG + ecc_out = wd_sm2_new_kg_out(h_sess); + if (!ecc_out) { + HPRE_TST_PRT("failed to alloc sm2 ecc out!\n"); + return -ENOMEM; + } + + req->dst = ecc_out; + break; + default: + HPRE_TST_PRT("failed to match sm2 optype!\n"); + return -ENOMEM; + } + + return 0; + +del_ecc_in: + if (ecc_in) + (void)wd_ecc_del_in(h_sess, ecc_in); +del_ecc_out: + if (ecc_out) + (void)wd_ecc_del_out(h_sess, ecc_out); + + return -ENOMEM; +} + +static int ecc_param_fill(handle_t h_sess, struct wd_ecc_req *req, + struct wd_ecc_key *ecc_key, struct hpre_ecc_setup *setup, + thread_data *pdata) +{ + int key_insize = (pdata->keybits + 7) / 8; + u32 subtype = pdata->subtype; + u32 optype = pdata->optype; + struct wd_ecc_out *ecc_out = NULL; + struct wd_ecc_in *ecc_in = NULL; + struct wd_ecc_point tmp; + struct wd_dtb d; + int ret = 0; + + ecc_out = wd_ecxdh_new_out(h_sess); + if (!ecc_out) { + HPRE_TST_PRT("failed to alloc ecc out!\n"); + return -ENOMEM; + } + if (optype == WD_ECXDH_GEN_KEY) { // gen + d.data = (void *)setup->priv_key; + d.dsize = setup->priv_key_size; + d.bsize = setup->priv_key_size; + ret = wd_ecc_set_prikey(ecc_key, &d); + if (ret) { + HPRE_TST_PRT("failed to set ecxdh prikey!\n"); + goto del_ecc_out; + } + + req->dst = ecc_out; + } else { // compute + if (subtype == ECDH_TYPE) + tmp.x.data = setup->except_pub_key; + else + tmp.x.data = setup->except_pub_key + 1; + tmp.x.bsize = key_insize; + tmp.x.dsize = key_insize; + tmp.y.data = tmp.x.data + key_insize; + tmp.y.bsize = key_insize; + tmp.y.dsize = key_insize; + ecc_in = wd_ecxdh_new_in(h_sess, &tmp); + if (!ecc_in) { + HPRE_TST_PRT("failed to get ecxdh sign in!\n"); + goto del_ecc_out; + } + + d.data = (void *)setup->priv_key; + d.dsize = setup->priv_key_size; + d.bsize = setup->priv_key_size; + ret = wd_ecc_set_prikey(ecc_key, &d); + if (ret) { + HPRE_TST_PRT("failed to set ecc prikey!\n"); + goto del_ecc_out; + } + + req->src = ecc_in; + req->dst = ecc_out; + } + + return 0; + +del_ecc_out: + if (ecc_out) + (void)wd_ecc_del_out(h_sess, ecc_out); + + return ret; +} + +static void *ecc_uadk_sync_run(void *arg) +{ + thread_data *pdata = (thread_data *)arg; + int key_size = pdata->keybits >> 3; + u32 subtype = pdata->subtype; + struct wd_ecc_sess_setup sess_setup; + struct hpre_ecc_setup setup; + struct wd_ecc_curve param; + struct wd_ecc_key *ecc_key; + struct wd_ecc_point pbk; + struct wd_dtb prk; + struct wd_ecc_req req; + u32 cid = ECC_CURVE_ID; + handle_t h_sess; + u32 count = 0; + int ret; + + memset(&sess_setup, 0, sizeof(sess_setup)); + memset(¶m, 0, sizeof(param)); + memset(&req, 0, sizeof(req)); + + memset(&setup, 0, sizeof(setup)); + if (subtype != X448_TYPE || subtype != X25519_TYPE) { + ret = get_ecc_curve(&setup, cid); + if (ret) + return NULL; + } + + sess_setup.key_bits = pdata->keybits; + if (subtype == ECDH_TYPE || subtype == ECDSA_TYPE) { + if (cid > ECC_CURVE_ID) { + sess_setup.cv.type = WD_CV_CFG_PARAM; + get_ecc_key_param(¶m, pdata->keybits); + sess_setup.cv.cfg.pparam = ¶m; + } else { + sess_setup.cv.type = WD_CV_CFG_ID; + sess_setup.cv.cfg.id = setup.curve_id; + } + } + + sess_setup.rand.cb = ecc_get_rand; + switch (subtype) { + case SM2_TYPE: + sess_setup.alg = "sm2"; + break; + case ECDH_TYPE: + sess_setup.alg = "ecdh"; + break; + case ECDSA_TYPE: + sess_setup.alg = "ecdsa"; + break; + } + + // set def setting; + sess_setup.hash.cb = hpre_compute_hash; + sess_setup.hash.type = WD_HASH_SHA256; + + ret = get_ecc_param_from_sample(&setup, subtype, pdata->keybits); + if (ret) + return NULL; + + h_sess = wd_ecc_alloc_sess(&sess_setup); + if (!h_sess) + goto msg_release; + + prk.data = (void *)setup.priv_key; + prk.dsize = setup.priv_key_size; + prk.bsize = setup.priv_key_size; + pbk.x.data = (char *)setup.pub_key + 1; + pbk.x.dsize = key_size; + pbk.x.bsize = key_size; + pbk.y.data = pbk.x.data + key_size; + pbk.y.dsize = key_size; + pbk.y.bsize = key_size; + + ecc_key = wd_ecc_get_key(h_sess); + ret = wd_ecc_set_prikey(ecc_key, &prk); + if (ret) { + HPRE_TST_PRT("failed to pre set ecc prikey!\n"); + goto sess_release; + } + + ret = wd_ecc_set_pubkey(ecc_key, &pbk); + if (ret) { + HPRE_TST_PRT("failed to pre set ecc pubkey!\n"); + goto sess_release; + } + + req.op_type = pdata->optype; + switch (subtype) { + case ECDSA_TYPE: // ECC alg + ret = ecdsa_param_fill(h_sess, &req, ecc_key, &setup, pdata); + if (ret) + goto src_release; + break; + case SM2_TYPE: // SM2 alg + ret = sm2_param_fill(h_sess, &req, &setup, pdata); + if (ret) + goto src_release; + break; + default: // ECDH, X25519, X448 alg + ret = ecc_param_fill(h_sess, &req, ecc_key, &setup, pdata); + if (ret) + goto src_release; + break; + } + + do { + ret = wd_do_ecc_sync(h_sess, &req); + if (ret || req.status) { + HPRE_TST_PRT("failed to do ecc task, status: %d\n", req.status); + goto src_release; + } + + count++; + if (get_run_state() == 0) + break; + } while(true); + +src_release: + if (req.src) + (void)wd_ecc_del_in(h_sess, req.src); + if (req.dst) + (void)wd_ecc_del_out(h_sess, req.dst); +sess_release: + wd_ecc_free_sess(h_sess); +msg_release: + if (subtype == SM2_TYPE) + free(setup.msg); + + add_recv_data(count, key_size); + + return NULL; +} + +static void ecc_async_cb(void *req_t) +{ + //struct wd_ecc_req *req = req_t; + //struct rsa_async_tag *tag = req->cb_param; + //enum wd_rsa_op_type op_type = req->op_type; + //handle_t h_sess = tag->sess; + + return; +} + +static void *ecc_uadk_async_run(void *arg) +{ + thread_data *pdata = (thread_data *)arg; + int key_size = pdata->keybits >> 3; + u32 subtype = pdata->subtype; + struct wd_ecc_sess_setup sess_setup; + struct rsa_async_tag *tag; + struct hpre_ecc_setup setup; + struct wd_ecc_curve param; + struct wd_ecc_key *ecc_key; + struct wd_ecc_point pbk; + struct wd_ecc_req req; + struct wd_dtb prk; + u32 cid = ECC_CURVE_ID; + handle_t h_sess; + int try_cnt = 0; + u32 count = 0; + int i, ret; + + memset(&sess_setup, 0, sizeof(sess_setup)); + memset(¶m, 0, sizeof(param)); + memset(&req, 0, sizeof(req)); + + memset(&setup, 0, sizeof(setup)); + if (subtype != X448_TYPE || subtype != X25519_TYPE) { + ret = get_ecc_curve(&setup, cid); + if (ret) + return NULL; + } + + sess_setup.key_bits = pdata->keybits; + if (subtype == ECDH_TYPE || subtype == ECDSA_TYPE) { + if (cid > ECC_CURVE_ID) { + sess_setup.cv.type = WD_CV_CFG_PARAM; + get_ecc_key_param(¶m, pdata->keybits); + sess_setup.cv.cfg.pparam = ¶m; + } else { + sess_setup.cv.type = WD_CV_CFG_ID; + sess_setup.cv.cfg.id = setup.curve_id; + } + } + + sess_setup.rand.cb = ecc_get_rand; + switch (subtype) { + case SM2_TYPE: + sess_setup.alg = "sm2"; + break; + case ECDH_TYPE: + sess_setup.alg = "ecdh"; + break; + case ECDSA_TYPE: + sess_setup.alg = "ecdsa"; + break; + } + + // set def setting; + sess_setup.hash.cb = hpre_compute_hash; + sess_setup.hash.type = WD_HASH_SHA256; + + ret = get_ecc_param_from_sample(&setup, subtype, pdata->keybits); + if (ret) + return NULL; + + h_sess = wd_ecc_alloc_sess(&sess_setup); + if (!h_sess) + goto msg_release; + + prk.data = (void *)setup.priv_key; + prk.dsize = setup.priv_key_size; + prk.bsize = setup.priv_key_size; + pbk.x.data = (char *)setup.pub_key + 1; + pbk.x.dsize = key_size; + pbk.x.bsize = key_size; + pbk.y.data = pbk.x.data + key_size; + pbk.y.dsize = key_size; + pbk.y.bsize = key_size; + + ecc_key = wd_ecc_get_key(h_sess); + ret = wd_ecc_set_prikey(ecc_key, &prk); + if (ret) { + HPRE_TST_PRT("failed to pre set ecc prikey!\n"); + goto sess_release; + } + + ret = wd_ecc_set_pubkey(ecc_key, &pbk); + if (ret) { + HPRE_TST_PRT("failed to pre set ecc pubkey!\n"); + goto sess_release; + } + + req.op_type = pdata->optype; + switch (subtype) { + case ECDSA_TYPE: // ECC alg + ret = ecdsa_param_fill(h_sess, &req, ecc_key, &setup, pdata); + if (ret) + goto src_release; + break; + case SM2_TYPE: // SM2 alg + ret = sm2_param_fill(h_sess, &req, &setup, pdata); + if (ret) + goto src_release; + break; + default: // ECDH, X25519, X448 alg + ret = ecc_param_fill(h_sess, &req, ecc_key, &setup, pdata); + if (ret) + goto src_release; + break; + } + + tag = malloc(sizeof(*tag) * MAX_POOL_LENTH); + if (!tag) { + HPRE_TST_PRT("failed to malloc rsa tag!\n"); + goto src_release; + } + req.cb = ecc_async_cb; + + do { + if (get_run_state() == 0) + break; + + try_cnt = 0; + i = count % MAX_POOL_LENTH; + tag[i].sess = h_sess; + req.cb_param = &tag[i]; + + ret = wd_do_ecc_sync(h_sess, &req); + if (ret == -WD_EBUSY) { + usleep(SEND_USLEEP * try_cnt); + try_cnt++; + if (try_cnt > MAX_TRY_CNT) { + HPRE_TST_PRT("Test ECC send fail %d times!\n", MAX_TRY_CNT); + try_cnt = 0; + } + continue; + } else if (ret) { + HPRE_TST_PRT("failed to do ECC async task!\n"); + goto tag_release; + } + count++; + } while(true); + +tag_release: + free(tag); +src_release: + if (req.src) + (void)wd_ecc_del_in(h_sess, req.src); + if (req.dst) + (void)wd_ecc_del_out(h_sess, req.dst); +sess_release: + wd_ecc_free_sess(h_sess); +msg_release: + if (subtype == SM2_TYPE) + free(setup.msg); + + add_send_complete(); + + return NULL; +} + +static int hpre_uadk_sync_threads(struct acc_option *options) +{ + typedef void *(*hpre_sync_run)(void *arg); + hpre_sync_run uadk_hpre_sync_run = NULL; + thread_data threads_args[THREADS_NUM]; + thread_data threads_option; + pthread_t tdid[THREADS_NUM]; + int i, ret; + + /* alg param parse and set to thread data */ + threads_option.subtype = options->subtype; + threads_option.td_id = 0; + ret = hpre_uadk_param_parse(&threads_option, options); + if (ret) + return ret; + + switch (options->subtype) { + case RSA_TYPE: + uadk_hpre_sync_run = rsa_uadk_sync_run; + break; + case DH_TYPE: + uadk_hpre_sync_run = dh_uadk_sync_run; + break; + case ECDH_TYPE: + case ECDSA_TYPE: + case SM2_TYPE: + case X25519_TYPE: + case X448_TYPE: + uadk_hpre_sync_run = ecc_uadk_sync_run; + break; + default: + HPRE_TST_PRT("failed to parse alg subtype on uninit!\n"); + return -EINVAL; + } + + for (i = 0; i < g_thread_num; i++) { + threads_args[i].subtype = threads_option.subtype; + threads_args[i].kmode = threads_option.kmode; + threads_args[i].keybits = threads_option.keybits; + threads_args[i].optype = threads_option.optype; + threads_args[i].td_id = i; + ret = pthread_create(&tdid[i], NULL, uadk_hpre_sync_run, &threads_args[i]); + if (ret) { + HPRE_TST_PRT("Create sync thread fail!\n"); + goto sync_error; + } + } + + /* join thread */ + for (i = 0; i < g_thread_num; i++) { + ret = pthread_join(tdid[i], NULL); + if (ret) { + HPRE_TST_PRT("Join sync thread fail!\n"); + goto sync_error; + } + } + +sync_error: + return ret; +} + +static int hpre_uadk_async_threads(struct acc_option *options) +{ + typedef void *(*hpre_async_run)(void *arg); + hpre_async_run uadk_hpre_async_run = NULL; + thread_data threads_args[THREADS_NUM]; + thread_data threads_option; + pthread_t tdid[THREADS_NUM]; + pthread_t pollid[THREADS_NUM]; + int i, ret; + + /* alg param parse and set to thread data */ + threads_option.subtype = options->subtype; + threads_option.td_id = 0; + ret = hpre_uadk_param_parse(&threads_option, options); + if (ret) + return ret; + + switch (options->subtype) { + case RSA_TYPE: + uadk_hpre_async_run = rsa_uadk_async_run; + break; + case DH_TYPE: + uadk_hpre_async_run = dh_uadk_async_run; + break; + case ECDH_TYPE: + case ECDSA_TYPE: + case SM2_TYPE: + case X25519_TYPE: + case X448_TYPE: + uadk_hpre_async_run = ecc_uadk_async_run; + break; + default: + HPRE_TST_PRT("failed to parse alg subtype on uninit!\n"); + return -EINVAL; + } + + for (i = 0; i < g_ctxnum; i++) { + threads_args[i].subtype = threads_option.subtype; + threads_args[i].td_id = i; + /* poll thread */ + ret = pthread_create(&pollid[i], NULL, hpre_uadk_poll, &threads_args[i]); + if (ret) { + HPRE_TST_PRT("Create poll thread fail!\n"); + goto async_error; + } + } + + for (i = 0; i < g_thread_num; i++) { + threads_args[i].subtype = threads_option.subtype; + threads_args[i].kmode = threads_option.kmode; + threads_args[i].keybits = threads_option.keybits; + threads_args[i].optype = threads_option.optype; + threads_args[i].td_id = i; + ret = pthread_create(&tdid[i], NULL, uadk_hpre_async_run, &threads_args[i]); + if (ret) { + HPRE_TST_PRT("Create async thread fail!\n"); + goto async_error; + } + } + + /* join thread */ + for (i = 0; i < g_thread_num; i++) { + ret = pthread_join(tdid[i], NULL); + if (ret) { + HPRE_TST_PRT("Join async thread fail!\n"); + goto async_error; + } + } + + for (i = 0; i < g_ctxnum; i++) { + ret = pthread_join(pollid[i], NULL); + if (ret) { + HPRE_TST_PRT("Join poll thread fail!\n"); + goto async_error; + } + } + +async_error: + return ret; +} + +int hpre_uadk_benchmark(struct acc_option *options) +{ + u32 ptime; + int ret; + + g_thread_num = options->threads; + g_ctxnum = options->ctxnums; + + if (options->optype >= (WD_EC_OP_MAX - WD_ECDSA_VERIFY)) { + HPRE_TST_PRT("HPRE optype error: %u\n", options->optype); + return -EINVAL; + } + + ret = init_hpre_ctx_config(options->algclass, options->subtype, + options->syncmode); + if (ret) + return ret; + + get_pid_cpu_time(&ptime); + time_start(options->times); + if (options->syncmode) + ret = hpre_uadk_async_threads(options); + else + ret = hpre_uadk_sync_threads(options); + cal_perfermance_data(options, ptime); + if (ret) + return ret; + + uninit_hpre_ctx_config(options->subtype); + + return 0; +} diff --git a/uadk_tool/benchmark/hpre_uadk_benchmark.h b/uadk_tool/benchmark/hpre_uadk_benchmark.h new file mode 100644 index 0000000..7e3966d --- /dev/null +++ b/uadk_tool/benchmark/hpre_uadk_benchmark.h @@ -0,0 +1,6 @@ +/* SPDX-License-Identifier: Apache-2.0 */ +#ifndef HPRE_UADK_BENCHMARK_H +#define HPRE_UADK_BENCHMARK_H + +extern int hpre_uadk_benchmark(struct acc_option *options); +#endif /* HPRE_UADK_BENCHMARK_H */