Add support for V10 protocol with BulletProofV2 and short amount.
This commit is contained in:
parent
e1b8e3d7b4
commit
356ea85da7
|
@ -1288,7 +1288,10 @@ namespace hw {
|
||||||
this->controle_device->ecdhEncode(unmasked_x, AKout_x, short_amount);
|
this->controle_device->ecdhEncode(unmasked_x, AKout_x, short_amount);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int offset = set_command_header_noopt(INS_BLIND);
|
int offset = set_command_header(INS_BLIND);
|
||||||
|
//options
|
||||||
|
this->buffer_send[offset] = short_amount?0x02:0x00;
|
||||||
|
offset += 1;
|
||||||
// AKout
|
// AKout
|
||||||
memmove(this->buffer_send+offset, AKout.bytes, 32);
|
memmove(this->buffer_send+offset, AKout.bytes, 32);
|
||||||
offset += 32;
|
offset += 32;
|
||||||
|
@ -1325,8 +1328,10 @@ namespace hw {
|
||||||
this->controle_device->ecdhDecode(masked_x, AKout_x, short_amount);
|
this->controle_device->ecdhDecode(masked_x, AKout_x, short_amount);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int offset = set_command_header_noopt(INS_UNBLIND);
|
int offset = set_command_header(INS_UNBLIND);
|
||||||
|
//options
|
||||||
|
this->buffer_send[offset] = short_amount?0x02:0x00;
|
||||||
|
offset += 1;
|
||||||
// AKout
|
// AKout
|
||||||
memmove(this->buffer_send+offset, AKout.bytes, 32);
|
memmove(this->buffer_send+offset, AKout.bytes, 32);
|
||||||
offset += 32;
|
offset += 32;
|
||||||
|
@ -1421,7 +1426,11 @@ namespace hw {
|
||||||
|
|
||||||
// ====== Aout, Bout, AKout, C, v, k ======
|
// ====== Aout, Bout, AKout, C, v, k ======
|
||||||
kv_offset = data_offset;
|
kv_offset = data_offset;
|
||||||
C_offset = kv_offset+ (32*2)*outputs_size;
|
if (type==rct::RCTTypeBulletproof2) {
|
||||||
|
C_offset = kv_offset+ (8)*outputs_size;
|
||||||
|
} else {
|
||||||
|
C_offset = kv_offset+ (32+32)*outputs_size;
|
||||||
|
}
|
||||||
for ( i = 0; i < outputs_size; i++) {
|
for ( i = 0; i < outputs_size; i++) {
|
||||||
ABPkeys outKeys;
|
ABPkeys outKeys;
|
||||||
bool found;
|
bool found;
|
||||||
|
@ -1434,6 +1443,7 @@ namespace hw {
|
||||||
offset = set_command_header(INS_VALIDATE, 0x02, i+1);
|
offset = set_command_header(INS_VALIDATE, 0x02, i+1);
|
||||||
//options
|
//options
|
||||||
this->buffer_send[offset] = (i==outputs_size-1)? 0x00:0x80 ;
|
this->buffer_send[offset] = (i==outputs_size-1)? 0x00:0x80 ;
|
||||||
|
this->buffer_send[offset] |= (type==rct::RCTTypeBulletproof2)?0x02:0x00;
|
||||||
offset += 1;
|
offset += 1;
|
||||||
if (found) {
|
if (found) {
|
||||||
//is_subaddress
|
//is_subaddress
|
||||||
|
@ -1453,20 +1463,31 @@ namespace hw {
|
||||||
offset+=32;
|
offset+=32;
|
||||||
} else {
|
} else {
|
||||||
// dummy: is_subaddress Aout Bout AKout
|
// dummy: is_subaddress Aout Bout AKout
|
||||||
offset += 1+32*3;
|
offset += 2+32*3;
|
||||||
}
|
}
|
||||||
//C
|
//C
|
||||||
memmove(this->buffer_send+offset, data+C_offset,32);
|
memmove(this->buffer_send+offset, data+C_offset,32);
|
||||||
offset += 32;
|
offset += 32;
|
||||||
C_offset += 32;
|
C_offset += 32;
|
||||||
//k
|
if (type==rct::RCTTypeBulletproof2) {
|
||||||
memmove(this->buffer_send+offset, data+kv_offset,32);
|
//k
|
||||||
offset += 32;
|
memset(this->buffer_send+offset, 0, 32);
|
||||||
kv_offset += 32;
|
offset += 32;
|
||||||
//v
|
//v
|
||||||
memmove(this->buffer_send+offset, data+kv_offset,32);
|
memset(this->buffer_send+offset, 0, 32);
|
||||||
offset += 32;
|
memmove(this->buffer_send+offset, data+kv_offset,8);
|
||||||
kv_offset += 32;
|
offset += 32;
|
||||||
|
kv_offset += 8;
|
||||||
|
} else {
|
||||||
|
//k
|
||||||
|
memmove(this->buffer_send+offset, data+kv_offset,32);
|
||||||
|
offset += 32;
|
||||||
|
kv_offset += 32;
|
||||||
|
//v
|
||||||
|
memmove(this->buffer_send+offset, data+kv_offset,32);
|
||||||
|
offset += 32;
|
||||||
|
kv_offset += 32;
|
||||||
|
}
|
||||||
|
|
||||||
this->buffer_send[4] = offset-5;
|
this->buffer_send[4] = offset-5;
|
||||||
this->length_send = offset;
|
this->length_send = offset;
|
||||||
|
|
Loading…
Reference in New Issue