|
|
|
@ -9,8 +9,6 @@
|
|
|
|
|
#include <linux/spi/spidev.h>
|
|
|
|
|
#include <android/log.h>
|
|
|
|
|
|
|
|
|
|
int testSpi();
|
|
|
|
|
int testVersion();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class NrsecSpiPort : public SpiPort {
|
|
|
|
@ -73,22 +71,31 @@ Java_com_xinyingpower_testcomm_MainActivity_testSpi(
|
|
|
|
|
jobject /* this */, jint port) {
|
|
|
|
|
//testSpi();
|
|
|
|
|
SpiLIb a;
|
|
|
|
|
const unsigned char newkey[64]={0xaf,0x0c,0xa9,0x40,0x1f,0xe6,0xee,0x0f,0x4c,
|
|
|
|
|
unsigned char newkey[64]={0xaf,0x0c,0xa9,0x40,0x1f,0xe6,0xee,0x0f,0x4c,
|
|
|
|
|
0xfb,0xf7,0x17,0x71,0xde,0x61,0x59
|
|
|
|
|
// ,0x0a,0x05,0x77,
|
|
|
|
|
// 0xfa,0xe7,0xd1,0x8d,0x10,0x3a,0x79,0x23,0xf2,0xb3,
|
|
|
|
|
// 0x6d,0xea,0x8e,0xe0,0x64,0xe7,0x5d,0x49,0x84,0xe4,
|
|
|
|
|
// 0x5f,0xc9,0x07,0x03,0x52,0x33,0x79,0x87,0xd4,0x62,
|
|
|
|
|
// 0x62,0xc0,0xcc,0xf0,0xd6,0x85,0x20,0x7f,0x7a,0xe8,
|
|
|
|
|
// 0xc8,0xed,0x12,0xdb,0xdc
|
|
|
|
|
,0x0a,0x05,0x77,
|
|
|
|
|
0xfa,0xe7,0xd1,0x8d,0x10,0x3a,0x79,0x23,0xf2,0xb3,
|
|
|
|
|
0x6d,0xea,0x8e,0xe0,0x64,0xe7,0x5d,0x49,0x84,0xe4,
|
|
|
|
|
0x5f,0xc9,0x07,0x03,0x52,0x33,0x79,0x87,0xd4,0x62,
|
|
|
|
|
0x62,0xc0,0xcc,0xf0,0xd6,0x85,0x20,0x7f,0x7a,0xe8,
|
|
|
|
|
0xc8,0xed,0x12,0xdb,0xdc
|
|
|
|
|
};
|
|
|
|
|
unsigned char outpub[32];
|
|
|
|
|
unsigned char outpub[32],outsign[64];
|
|
|
|
|
unsigned char pucid[16]={0x01,0x01,0x01,0x01,0x01,0x01,0x01,
|
|
|
|
|
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01};
|
|
|
|
|
//a.SM2keypair(0x00);
|
|
|
|
|
a.SM3Hash(newkey,16, outpub);
|
|
|
|
|
//a.SM3Hash(newkey,16, outpub);
|
|
|
|
|
a.sm3hash_tosm2(newkey,16,outpub,newkey,pucid,16);
|
|
|
|
|
a.SM2Sign(0x00,outpub,outsign);
|
|
|
|
|
a.SM2VerifySign(0x00,outpub,outsign);
|
|
|
|
|
for (int i = 0; i < 32; i++) {
|
|
|
|
|
//sprintf(output, " %02x ", rxbuf[i]);
|
|
|
|
|
__android_log_print(ANDROID_LOG_INFO, "SPi", "%02x", outpub[i]);
|
|
|
|
|
}
|
|
|
|
|
for (int i = 0; i < 64; i++) {
|
|
|
|
|
//sprintf(output, " %02x ", rxbuf[i]);
|
|
|
|
|
__android_log_print(ANDROID_LOG_INFO, "SPi", "%02x", outsign[i]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//a.SM3Hash(0x00,0x10,newkey);
|
|
|
|
|
//testVersion();
|
|
|
|
|