Temporarily disable 1.2isms

This commit is contained in:
BTChip
2016-06-02 02:04:57 +02:00
parent c429674234
commit f6e6286c4d
4 changed files with 38 additions and 10 deletions

View File

@@ -340,6 +340,17 @@ static const bagl_element_t const bagl_ui_idle[] = {
};
// TODO : replace with 1.2 SDK
int app_cx_ecfp_init_private_key(cx_curve_t curve, unsigned char WIDE *rawkey,
int key_len, cx_ecfp_private_key_t *key) {
key->curve = curve;
key->d_len = key_len;
if (rawkey != NULL) {
os_memmove(key->d, rawkey, key_len);
}
return key_len;
}
unsigned int io_seproxyhal_touch_exit(bagl_element_t *e) {
// Go back to the dashboard
os_sched_exit(0);
@@ -383,7 +394,8 @@ unsigned int io_seproxyhal_touch_tx_ok(bagl_element_t *e) {
os_perso_derive_seed_bip32(tmpCtx.transactionContext.bip32Path,
tmpCtx.transactionContext.pathLength,
privateKeyData, NULL);
cx_ecfp_init_private_key(CX_CURVE_256K1, privateKeyData, 32, &privateKey);
app_cx_ecfp_init_private_key(CX_CURVE_256K1, privateKeyData, 32,
&privateKey);
os_memset(privateKeyData, 0, sizeof(privateKeyData));
signatureLength =
cx_ecdsa_sign(&privateKey, CX_RND_RFC6979 | CX_LAST, CX_SHA256,
@@ -557,8 +569,8 @@ void sample_main(void) {
}
os_perso_derive_seed_bip32(bip32Path, bip32PathLength,
privateKeyData, NULL);
cx_ecfp_init_private_key(CX_CURVE_256K1, privateKeyData, 32,
&privateKey);
app_cx_ecfp_init_private_key(CX_CURVE_256K1, privateKeyData,
32, &privateKey);
cx_ecfp_generate_pair(CX_CURVE_256K1,
&tmpCtx.publicKeyContext.publicKey,
&privateKey, 1);
@@ -633,8 +645,8 @@ void sample_main(void) {
}
os_perso_derive_seed_bip32(bip32Path, bip32PathLength,
privateKeyData, NULL);
cx_ecfp_init_private_key(CX_CURVE_256K1, privateKeyData, 32,
&privateKey);
app_cx_ecfp_init_private_key(CX_CURVE_256K1, privateKeyData,
32, &privateKey);
cx_ecfp_generate_pair(CX_CURVE_256K1,
&tmpCtx.publicKeyContext.publicKey,
&privateKey, 1);

View File

@@ -355,6 +355,17 @@ static const bagl_element_t const bagl_ui_idle[] = {
};
// TODO : replace with 1.2 SDK
int app_cx_ecfp_init_private_key(cx_curve_t curve, unsigned char WIDE *rawkey,
int key_len, cx_ecfp_private_key_t *key) {
key->curve = curve;
key->d_len = key_len;
if (rawkey != NULL) {
os_memmove(key->d, rawkey, key_len);
}
return key_len;
}
unsigned int io_seproxyhal_touch_exit(bagl_element_t *e) {
// Go back to the dashboard
os_sched_exit(0);
@@ -398,7 +409,8 @@ unsigned int io_seproxyhal_touch_tx_ok(bagl_element_t *e) {
os_perso_derive_seed_bip32(tmpCtx.transactionContext.bip32Path,
tmpCtx.transactionContext.pathLength,
privateKeyData, NULL);
cx_ecfp_init_private_key(CX_CURVE_256K1, privateKeyData, 32, &privateKey);
app_cx_ecfp_init_private_key(CX_CURVE_256K1, privateKeyData, 32,
&privateKey);
os_memset(privateKeyData, 0, sizeof(privateKeyData));
signatureLength =
cx_ecdsa_sign(&privateKey, CX_RND_RFC6979 | CX_LAST, CX_SHA256,
@@ -556,8 +568,8 @@ void sample_main(void) {
}
os_perso_derive_seed_bip32(bip32Path, bip32PathLength,
privateKeyData, NULL);
cx_ecfp_init_private_key(CX_CURVE_256K1, privateKeyData, 32,
&privateKey);
app_cx_ecfp_init_private_key(CX_CURVE_256K1, privateKeyData,
32, &privateKey);
cx_ecfp_generate_pair(CX_CURVE_256K1,
&tmpCtx.publicKeyContext.publicKey,
&privateKey, 1);

View File

@@ -284,11 +284,11 @@ int app_cx_hash(cx_hash_t *hash, int mode, unsigned char WIDE *in, int len,
// --- last block ---
if (mode & CX_LAST) {
os_memset(block + blen, 0, (200 - blen));
block[blen] |= (hash->algo == CX_SHA3 ? 0x06 : 0x01);
block[blen] |= 0x01;
block[block_size - 1] |= 0x80;
app_cx_sha3_block((app_cx_sha3_t *)hash);
// provide result
len = ((cx_sha3_t *)hash)->output_size;
len = ((app_cx_sha3_t *)hash)->output_size;
if (out) {
os_memmove(out, acc, len);
}

View File

@@ -20,6 +20,10 @@
#pragma once
#ifndef uint64bits_t
typedef unsigned long long uint64bits_t;
#endif
struct app_cx_sha3_s {
struct cx_hash_header_s header;