From 8b7b6e03462a44b410f26d1d52b26bc149ffccc3 Mon Sep 17 00:00:00 2001 From: btclinux Date: Wed, 8 Jun 2022 00:43:32 +0300 Subject: [PATCH] os_mem* deprecation --- src/aes/aes-cbc.c | 20 ++++++++++---------- src/aes/aes-ccm.c | 6 +++--- src/aes/aes-ctr.c | 2 +- src/aes/aes-gcm.c | 14 +++++++------- src/aes/aes-internal-dec.c | 2 +- src/aes/aes-internal-enc.c | 2 +- src/aes/aes-unwrap.c | 12 ++++++------ src/aes/aes-wrap.c | 10 +++++----- src/authAndSignTxn.c | 24 ++++++++++++------------ src/burst.c | 22 +++++++++++----------- src/curve25519_i64.c | 8 ++++---- src/getPublicKey.c | 2 +- src/getVersion.c | 2 +- src/reedSolomon.c | 4 ++-- src/showAddress.c | 6 +++--- unused/curveConversion.c | 2 +- 16 files changed, 69 insertions(+), 69 deletions(-) diff --git a/src/aes/aes-cbc.c b/src/aes/aes-cbc.c index ed3ac98..5d63cb0 100644 --- a/src/aes/aes-cbc.c +++ b/src/aes/aes-cbc.c @@ -31,14 +31,14 @@ int aes_128_cbc_encrypt(const aes_uchar *key, const aes_uchar *iv, aes_uchar *da ctx = aes_encrypt_init(key, 16); if (ctx == NULL) return -1; - os_memcpy(cbc, iv, AES_BLOCK_SIZE); + memcpy(cbc, iv, AES_BLOCK_SIZE); blocks = data_len / AES_BLOCK_SIZE; for (i = 0; i < blocks; i++) { for (j = 0; j < AES_BLOCK_SIZE; j++) cbc[j] ^= pos[j]; aes_encrypt(ctx, cbc, cbc); - os_memcpy(pos, cbc, AES_BLOCK_SIZE); + memcpy(pos, cbc, AES_BLOCK_SIZE); pos += AES_BLOCK_SIZE; } aes_encrypt_deinit(ctx); @@ -56,14 +56,14 @@ int aes_256_cbc_encrypt(const aes_uchar *key, const aes_uchar *iv, aes_uchar *da ctx = aes_encrypt_init(key, 32); if (ctx == NULL) return -1; - os_memcpy(cbc, iv, AES_BLOCK_SIZE); + memcpy(cbc, iv, AES_BLOCK_SIZE); blocks = data_len / AES_BLOCK_SIZE; for (i = 0; i < blocks; i++) { for (j = 0; j < AES_BLOCK_SIZE; j++) cbc[j] ^= pos[j]; aes_encrypt(ctx, cbc, cbc); - os_memcpy(pos, cbc, AES_BLOCK_SIZE); + memcpy(pos, cbc, AES_BLOCK_SIZE); pos += AES_BLOCK_SIZE; } aes_encrypt_deinit(ctx); @@ -88,15 +88,15 @@ int aes_128_cbc_decrypt(const aes_uchar *key, const aes_uchar *iv, aes_uchar *da ctx = aes_decrypt_init(key, 16); if (ctx == NULL) return -1; - os_memcpy(cbc, iv, AES_BLOCK_SIZE); + memcpy(cbc, iv, AES_BLOCK_SIZE); blocks = data_len / AES_BLOCK_SIZE; for (i = 0; i < blocks; i++) { - os_memcpy(tmp, pos, AES_BLOCK_SIZE); + memcpy(tmp, pos, AES_BLOCK_SIZE); aes_decrypt(ctx, pos, pos); for (j = 0; j < AES_BLOCK_SIZE; j++) pos[j] ^= cbc[j]; - os_memcpy(cbc, tmp, AES_BLOCK_SIZE); + memcpy(cbc, tmp, AES_BLOCK_SIZE); pos += AES_BLOCK_SIZE; } aes_decrypt_deinit(ctx); @@ -113,15 +113,15 @@ int aes_256_cbc_decrypt(const aes_uchar *key, const aes_uchar *iv, aes_uchar *da ctx = aes_decrypt_init(key, 32); if (ctx == NULL) return -1; - os_memcpy(cbc, iv, AES_BLOCK_SIZE); + memcpy(cbc, iv, AES_BLOCK_SIZE); blocks = data_len / AES_BLOCK_SIZE; for (i = 0; i < blocks; i++) { - os_memcpy(tmp, pos, AES_BLOCK_SIZE); + memcpy(tmp, pos, AES_BLOCK_SIZE); aes_decrypt(ctx, pos, pos); for (j = 0; j < AES_BLOCK_SIZE; j++) pos[j] ^= cbc[j]; - os_memcpy(cbc, tmp, AES_BLOCK_SIZE); + memcpy(cbc, tmp, AES_BLOCK_SIZE); pos += AES_BLOCK_SIZE; } aes_decrypt_deinit(ctx); diff --git a/src/aes/aes-ccm.c b/src/aes/aes-ccm.c index dff35f3..99c4916 100644 --- a/src/aes/aes-ccm.c +++ b/src/aes/aes-ccm.c @@ -34,7 +34,7 @@ static void aes_ccm_auth_start(void *aes, size_t M, size_t L, const aes_uchar *n b[0] = aad_len ? 0x40 : 0 /* Adata */; b[0] |= (((M - 2) / 2) /* M' */ << 3); b[0] |= (L - 1) /* L' */; - os_memcpy(&b[1], nonce, 15 - L); + memcpy(&b[1], nonce, 15 - L); AES_PUT_BE16(&b[AES_BLOCK_SIZE - L], plain_len); aes_hexdump_key(MSG_EXCESSIVE, "CCM B_0", b, AES_BLOCK_SIZE); @@ -44,7 +44,7 @@ static void aes_ccm_auth_start(void *aes, size_t M, size_t L, const aes_uchar *n return; AES_PUT_BE16(aad_buf, aad_len); - os_memcpy(aad_buf + 2, aad, aad_len); + memcpy(aad_buf + 2, aad, aad_len); memset(aad_buf + 2 + aad_len, 0, sizeof(aad_buf) - 2 - aad_len); xor_aes_block(aad_buf, x); @@ -82,7 +82,7 @@ static void aes_ccm_encr_start(size_t L, const aes_uchar *nonce, aes_uchar *a) { /* A_i = Flags | Nonce N | Counter i */ a[0] = L - 1; /* Flags = L' */ - os_memcpy(&a[1], nonce, 15 - L); + memcpy(&a[1], nonce, 15 - L); } diff --git a/src/aes/aes-ctr.c b/src/aes/aes-ctr.c index fe24f7e..866ee34 100644 --- a/src/aes/aes-ctr.c +++ b/src/aes/aes-ctr.c @@ -30,7 +30,7 @@ int aes_128_ctr_encrypt(const aes_uchar *key, const aes_uchar *nonce, ctx = aes_encrypt_init(key, 16); if (ctx == NULL) return -1; - os_memcpy(counter, nonce, AES_BLOCK_SIZE); + memcpy(counter, nonce, AES_BLOCK_SIZE); while (left > 0) { aes_encrypt(ctx, counter, buf); diff --git a/src/aes/aes-gcm.c b/src/aes/aes-gcm.c index 7447c01..73f7b59 100644 --- a/src/aes/aes-gcm.c +++ b/src/aes/aes-gcm.c @@ -65,7 +65,7 @@ static void gf_mult(const aes_uchar *x, const aes_uchar *y, aes_uchar *z) int i, j; memset(z, 0, 16); /* Z_0 = 0^128 */ - os_memcpy(v, y, 16); /* V_0 = Y */ + memcpy(v, y, 16); /* V_0 = Y */ for (i = 0; i < 16; i++) { for (j = 0; j < 8; j++) { @@ -114,13 +114,13 @@ static void ghash(const aes_uchar *h, const aes_uchar *x, size_t xlen, aes_uchar * multiplication operation for binary Galois (finite) field of * 2^128 elements */ gf_mult(y, h, tmp); - os_memcpy(y, tmp, 16); + memcpy(y, tmp, 16); } if (x + xlen > xpos) { /* Add zero padded last block */ size_t last = x + xlen - xpos; - os_memcpy(tmp, xpos, last); + memcpy(tmp, xpos, last); memset(tmp + last, 0, sizeof(tmp) - last); /* Y_i = (Y^(i-1) XOR X_i) dot H */ @@ -130,7 +130,7 @@ static void ghash(const aes_uchar *h, const aes_uchar *x, size_t xlen, aes_uchar * multiplication operation for binary Galois (finite) field of * 2^128 elements */ gf_mult(y, h, tmp); - os_memcpy(y, tmp, 16); + memcpy(y, tmp, 16); } /* Return Y_m */ @@ -149,7 +149,7 @@ static void aes_gctr(void *aes, const aes_uchar *icb, const aes_uchar *x, size_t n = xlen / 16; - os_memcpy(cb, icb, AES_BLOCK_SIZE); + memcpy(cb, icb, AES_BLOCK_SIZE); /* Full blocks */ for (i = 0; i < n; i++) { aes_encrypt(aes, cb, ypos); @@ -191,7 +191,7 @@ static void aes_gcm_prepare_j0(const aes_uchar *iv, size_t iv_len, const aes_uch if (iv_len == 12) { /* Prepare block J_0 = IV || 0^31 || 1 [len(IV) = 96] */ - os_memcpy(J0, iv, iv_len); + memcpy(J0, iv, iv_len); memset(J0 + iv_len, 0, AES_BLOCK_SIZE - iv_len); J0[AES_BLOCK_SIZE - 1] = 0x01; } else { @@ -216,7 +216,7 @@ static void aes_gcm_gctr(void *aes, const aes_uchar *J0, const aes_uchar *in, si if (len == 0) return; - os_memcpy(J0inc, J0, AES_BLOCK_SIZE); + memcpy(J0inc, J0, AES_BLOCK_SIZE); inc32(J0inc); aes_gctr(aes, J0inc, in, len, out); } diff --git a/src/aes/aes-internal-dec.c b/src/aes/aes-internal-dec.c index 6153c58..1d5af1e 100644 --- a/src/aes/aes-internal-dec.c +++ b/src/aes/aes-internal-dec.c @@ -169,5 +169,5 @@ void aes_decrypt(void *ctx, const aes_uchar *crypt, aes_uchar *plain) void aes_decrypt_deinit(void *ctx) { - os_memset(ctx, 0, AES_PRIV_SIZE); + memset(ctx, 0, AES_PRIV_SIZE); } diff --git a/src/aes/aes-internal-enc.c b/src/aes/aes-internal-enc.c index 0701c03..76a44b0 100644 --- a/src/aes/aes-internal-enc.c +++ b/src/aes/aes-internal-enc.c @@ -209,6 +209,6 @@ void aes_encrypt(void *ctx, const aes_uchar *plain, aes_uchar *crypt) void aes_encrypt_deinit(void *ctx) { - os_memset(ctx, 0, AES_PRIV_SIZE); + memset(ctx, 0, AES_PRIV_SIZE); } diff --git a/src/aes/aes-unwrap.c b/src/aes/aes-unwrap.c index 95aeca8..3f0dc3d 100644 --- a/src/aes/aes-unwrap.c +++ b/src/aes/aes-unwrap.c @@ -26,9 +26,9 @@ int aes_unwrap(const aes_uchar *kek, int n, const aes_uchar *cipher, aes_uchar * void *ctx; /* 1) Initialize variables. */ - os_memcpy(a, cipher, 8); + memcpy(a, cipher, 8); r = plain; - os_memcpy(r, cipher + 8, 8 * n); + memcpy(r, cipher + 8, 8 * n); ctx = aes_decrypt_init(kek, 16); if (ctx == NULL) @@ -44,13 +44,13 @@ int aes_unwrap(const aes_uchar *kek, int n, const aes_uchar *cipher, aes_uchar * for (j = 5; j >= 0; j--) { r = plain + (n - 1) * 8; for (i = n; i >= 1; i--) { - os_memcpy(b, a, 8); + memcpy(b, a, 8); b[7] ^= n * j + i; - os_memcpy(b + 8, r, 8); + memcpy(b + 8, r, 8); aes_decrypt(ctx, b, b); - os_memcpy(a, b, 8); - os_memcpy(r, b + 8, 8); + memcpy(a, b, 8); + memcpy(r, b + 8, 8); r -= 8; } } diff --git a/src/aes/aes-wrap.c b/src/aes/aes-wrap.c index 80b32d9..4c5a98e 100644 --- a/src/aes/aes-wrap.c +++ b/src/aes/aes-wrap.c @@ -30,7 +30,7 @@ int aes_wrap(const aes_uchar *kek, int n, const aes_uchar *plain, aes_uchar *cip /* 1) Initialize variables. */ memset(a, 0xa6, 8); - os_memcpy(r, plain, 8 * n); + memcpy(r, plain, 8 * n); ctx = aes_encrypt_init(kek, 16); if (ctx == NULL) @@ -46,12 +46,12 @@ int aes_wrap(const aes_uchar *kek, int n, const aes_uchar *plain, aes_uchar *cip for (j = 0; j <= 5; j++) { r = cipher + 8; for (i = 1; i <= n; i++) { - os_memcpy(b, a, 8); - os_memcpy(b + 8, r, 8); + memcpy(b, a, 8); + memcpy(b + 8, r, 8); aes_encrypt(ctx, b, b); - os_memcpy(a, b, 8); + memcpy(a, b, 8); a[7] ^= n * j + i; - os_memcpy(r, b + 8, 8); + memcpy(r, b + 8, 8); r += 8; } } diff --git a/src/authAndSignTxn.c b/src/authAndSignTxn.c index d67b2e7..c245bf5 100644 --- a/src/authAndSignTxn.c +++ b/src/authAndSignTxn.c @@ -337,19 +337,19 @@ void addRecipientText() { // Reads a uint8_t from buffer void read_u8(uint8_t *val, uint8_t **ptr){ - os_memmove(val, *ptr, sizeof(uint8_t)); + memmove(val, *ptr, sizeof(uint8_t)); *ptr += sizeof(uint8_t); } // Reads a uint16_t from buffer void read_u16(uint16_t *val, uint8_t **ptr){ - os_memmove(val, *ptr, sizeof(uint16_t)); + memmove(val, *ptr, sizeof(uint16_t)); *ptr += sizeof(uint16_t); } // Reads a uint64_t from buffer and put the resulting value on val void read_u64(uint64_t *val, uint8_t **ptr){ - os_memmove(val, *ptr, sizeof(uint64_t)); + memmove(val, *ptr, sizeof(uint64_t)); *ptr += sizeof(uint64_t); } @@ -428,9 +428,9 @@ uint8_t parseTxnData() { if (ptr == 0) return R_TXN_SIZE_TOO_SMALL; ptr += 1; //version - os_memmove(&(state.txnAuth.attachmentTempInt64Num1), ptr, sizeof(state.txnAuth.attachmentTempInt64Num1)); // assetID + memmove(&(state.txnAuth.attachmentTempInt64Num1), ptr, sizeof(state.txnAuth.attachmentTempInt64Num1)); // assetID ptr += sizeof(state.txnAuth.attachmentTempInt64Num1); - os_memmove(&(state.txnAuth.attachmentTempInt64Num2), ptr, sizeof(state.txnAuth.attachmentTempInt64Num2)); // quantity + memmove(&(state.txnAuth.attachmentTempInt64Num2), ptr, sizeof(state.txnAuth.attachmentTempInt64Num2)); // quantity ptr += sizeof(state.txnAuth.attachmentTempInt64Num2); if(state.txnAuth.attachmentTempInt64Num1 == TRT_TOKEN){ @@ -459,11 +459,11 @@ uint8_t parseTxnData() { return R_TXN_SIZE_TOO_SMALL; ptr += 1; //version - os_memmove(&(state.txnAuth.attachmentTempInt64Num1), ptr, sizeof(state.txnAuth.attachmentTempInt64Num1)); // assetID + memmove(&(state.txnAuth.attachmentTempInt64Num1), ptr, sizeof(state.txnAuth.attachmentTempInt64Num1)); // assetID ptr += sizeof(state.txnAuth.attachmentTempInt64Num1); - os_memmove(&(state.txnAuth.attachmentTempInt64Num2), ptr, sizeof(state.txnAuth.attachmentTempInt64Num2)); // quantity + memmove(&(state.txnAuth.attachmentTempInt64Num2), ptr, sizeof(state.txnAuth.attachmentTempInt64Num2)); // quantity ptr += sizeof(state.txnAuth.attachmentTempInt64Num2); - os_memmove(&(state.txnAuth.attachmentTempInt64Num3), ptr, sizeof(state.txnAuth.attachmentTempInt64Num3)); // price + memmove(&(state.txnAuth.attachmentTempInt64Num3), ptr, sizeof(state.txnAuth.attachmentTempInt64Num3)); // price ptr += sizeof(state.txnAuth.attachmentTempInt64Num3); if(state.txnAuth.attachmentTempInt64Num1 == TRT_TOKEN){ @@ -499,7 +499,7 @@ uint8_t parseTxnData() { if (ptr == 0) return R_TXN_SIZE_TOO_SMALL; ptr += 1; //version - os_memmove(&(state.txnAuth.attachmentTempInt64Num1), ptr, sizeof(state.txnAuth.attachmentTempInt64Num1)); // assetID + memmove(&(state.txnAuth.attachmentTempInt64Num1), ptr, sizeof(state.txnAuth.attachmentTempInt64Num1)); // assetID ptr += sizeof(state.txnAuth.attachmentTempInt64Num1); // Window 1 is order ID @@ -548,7 +548,7 @@ uint8_t parseReferencedTxn() { void addToReadBuffer(const uint8_t * const newData, const uint8_t numBytes) { cx_hash(&state.txnAuth.hashstate.header, 0, newData, numBytes, 0, 0); - os_memcpy(state.txnAuth.readBuffer, newData, numBytes); + memcpy(state.txnAuth.readBuffer, newData, numBytes); state.txnAuth.readBufferReadOffset = 0; state.txnAuth.readBufferEndPos = numBytes; } @@ -561,7 +561,7 @@ void addToReadBuffer(const uint8_t * const newData, const uint8_t numBytes) { uint8_t signTxn(const uint8_t * const dataBuffer, const uint8_t dataLength, uint8_t * const destBuffer, uint16_t * const outException) { - uint8_t sharedKey[32]; os_memset(sharedKey, 0, sizeof(sharedKey)); + uint8_t sharedKey[32]; memset(sharedKey, 0, sizeof(sharedKey)); uint8_t ret = 0; if (R_SUCCESS != (ret = burst_keys(dataBuffer, dataLength, NULL, NULL, sharedKey, outException))) { @@ -574,7 +574,7 @@ uint8_t signTxn(const uint8_t * const dataBuffer, const uint8_t dataLength, uint cx_hash(&state.txnAuth.hashstate.header, CX_LAST, NULL, 0, messageSha256, sizeof(messageSha256)); sign_msg(sharedKey, messageSha256, destBuffer); //is a void function, no ret value to check against - //os_memcpy(destBuffer+32, messageSha256, 32); + //memcpy(destBuffer+32, messageSha256, 32); //clear explicit_bzero(messageSha256, sizeof(messageSha256)); diff --git a/src/burst.c b/src/burst.c index 7c92877..9a64e50 100644 --- a/src/burst.c +++ b/src/burst.c @@ -39,7 +39,7 @@ states_t state; void sha256TwoBuffers(const uint8_t * const bufferTohash1, const uint16_t sizeOfBuffer1, const uint8_t * const bufferTohash2, const uint16_t sizeOfBuffer2, uint8_t * const output) { cx_sha256_t shaContext; - os_memset(output, 0, 32); + memset(output, 0, 32); cx_sha256_init(&shaContext); //return value has no info cx_hash(&shaContext.header, 0, bufferTohash1, sizeOfBuffer1, output, 32); @@ -62,9 +62,9 @@ void sha256Buffer(const uint8_t * const bufferTohash, const uint16_t sizeOfBuffe //@param out: sig should point to 64 bytes allocated to hold the signiture of the message void sign_msg(uint8_t * const sharedKey, const uint8_t * const msgSha256, uint8_t * const sig) { - uint8_t x[32]; os_memset(x, 0, sizeof(x)); - uint8_t y[32]; os_memset(y, 0, sizeof(y)); - uint8_t h[32]; os_memset(h, 0, sizeof(h)); + uint8_t x[32]; memset(x, 0, sizeof(x)); + uint8_t y[32]; memset(y, 0, sizeof(y)); + uint8_t h[32]; memset(h, 0, sizeof(h)); // Get x = hash(m, s) cx_sha256_init(&state.txnAuth.hashstate); @@ -80,7 +80,7 @@ void sign_msg(uint8_t * const sharedKey, const uint8_t * const msgSha256, uint8_ cx_hash(&state.txnAuth.hashstate.header, CX_LAST, y, 32, h, 32); // copy h first because sign25519 screws with parameters - os_memcpy(sig+32, h, 32); + memcpy(sig+32, h, 32); sign25519(sig, h, x, sharedKey); // clear sensitive data @@ -107,15 +107,15 @@ uint8_t burst_keys(const uint8_t * const dataBuffer, const uint8_t dataLength, u uint32_t pathPrefix[] = PATH_PREFIX; //defined in Makefile - uint8_t publicKey[32]; os_memset(publicKey, 0, sizeof(publicKey)); - uint8_t privKey[32]; os_memset(privKey, 0, sizeof(privKey)); + uint8_t publicKey[32]; memset(publicKey, 0, sizeof(publicKey)); + uint8_t privKey[32]; memset(privKey, 0, sizeof(privKey)); if(dataLength < 3) return R_NOT_ENOUGH_DERIVATION_INDEXES; // BURST keypath of 44'/30'/account'/change'/index' - uint32_t derivationPath[5]; os_memset(derivationPath, 0, sizeof(derivationPath)); - os_memmove(derivationPath, pathPrefix, 2 * sizeof(uint32_t)); + uint32_t derivationPath[5]; memset(derivationPath, 0, sizeof(derivationPath)); + memmove(derivationPath, pathPrefix, 2 * sizeof(uint32_t)); derivationPath[2] = dataBuffer[0] | 0x80000000; // account derivationPath[3] = dataBuffer[1] | 0x80000000; // change derivationPath[4] = dataBuffer[2] | 0x80000000; // index @@ -129,10 +129,10 @@ uint8_t burst_keys(const uint8_t * const dataBuffer, const uint8_t dataLength, u } if (0 != publicKeyOut) { - os_memmove(publicKeyOut, publicKey, 32); + memmove(publicKeyOut, publicKey, 32); } if (0 != privKeyOut) { - os_memmove(privKeyOut, privKey, 32); + memmove(privKeyOut, privKey, 32); } } CATCH_OTHER(exception) { diff --git a/src/curve25519_i64.c b/src/curve25519_i64.c index d5005e7..bfdc1a3 100644 --- a/src/curve25519_i64.c +++ b/src/curve25519_i64.c @@ -655,18 +655,18 @@ int sign25519(k25519 v, const k25519 h, const priv25519 x, const spriv25519 s) { unsigned w; int i; - os_memset(tmp, 0, 32); + memset(tmp, 0, 32); divmod(tmp, h, 32, order25519, 32); - os_memset(tmp, 0, 32); + memset(tmp, 0, 32); divmod(tmp, x, 32, order25519, 32); - os_memset(v, 0, sizeof(v)); + memset(v, 0, sizeof(v)); i = mula_small(v, x, 0, h, 32, -1); mula_small(v, v, 0, order25519, 32, (15-(int8_t) v[31])/16); - os_memset(tmp, 0, sizeof(tmp)); + memset(tmp, 0, sizeof(tmp)); mula32(tmp, v, s, 32, 1); divmod(tmp+32, tmp, 64, order25519, 32); diff --git a/src/getPublicKey.c b/src/getPublicKey.c index 0b6e112..3225ae1 100644 --- a/src/getPublicKey.c +++ b/src/getPublicKey.c @@ -54,7 +54,7 @@ void getPublicKeyHandlerHelper(const uint8_t p1, const uint8_t p2, const uint8_t if (R_SUCCESS == ret) { - os_memmove(G_io_apdu_buffer + *tx, publicKey, sizeof(publicKey)); + memmove(G_io_apdu_buffer + *tx, publicKey, sizeof(publicKey)); *tx += sizeof(publicKey); } else if (R_KEY_DERIVATION_EX == ret) { diff --git a/src/getVersion.c b/src/getVersion.c index 2ee03ae..742ccbd 100644 --- a/src/getVersion.c +++ b/src/getVersion.c @@ -34,7 +34,7 @@ void getVersionHandler(const uint8_t p1, const uint8_t p2, const uint8_t * const G_io_apdu_buffer[(*tx)++] = APPVERSION_P; G_io_apdu_buffer[(*tx)++] = VERSION_FLAGS; - os_memmove(G_io_apdu_buffer + (*tx), BURST_SPECIAL_IDENTIFIER, BURST_SPECIAL_IDENTIFIER_LEN); + memmove(G_io_apdu_buffer + (*tx), BURST_SPECIAL_IDENTIFIER, BURST_SPECIAL_IDENTIFIER_LEN); *tx += BURST_SPECIAL_IDENTIFIER_LEN; G_io_apdu_buffer[(*tx)++] = 0x90; diff --git a/src/reedSolomon.c b/src/reedSolomon.c index c51719e..43b61a4 100644 --- a/src/reedSolomon.c +++ b/src/reedSolomon.c @@ -43,7 +43,7 @@ uint8_t gmult(const uint8_t a, const uint8_t b) { void reedSolomonEncode(uint64_t inp, char * const output) { uint8_t plain_string_32[sizeof(initial_codeword)]; - os_memset(plain_string_32, 0, sizeof(initial_codeword)); + memset(plain_string_32, 0, sizeof(initial_codeword)); uint8_t index = 0; @@ -64,7 +64,7 @@ void reedSolomonEncode(uint64_t inp, char * const output) { p[0] = gmult(17, fb); } - os_memcpy(plain_string_32 + BASE_32_LENGTH, p, sizeof(initial_codeword) - BASE_32_LENGTH); + memcpy(plain_string_32 + BASE_32_LENGTH, p, sizeof(initial_codeword) - BASE_32_LENGTH); uint8_t stringIndex = 0; diff --git a/src/showAddress.c b/src/showAddress.c index 2d317ed..a9f7c5a 100644 --- a/src/showAddress.c +++ b/src/showAddress.c @@ -78,12 +78,12 @@ void showAddressHandlerHelper(const uint8_t p1, const uint8_t p2, const uint8_t uint16_t exception = 0; - uint8_t publicKey[32]; os_memset(publicKey, 0, sizeof(publicKey)); + uint8_t publicKey[32]; memset(publicKey, 0, sizeof(publicKey)); uint8_t ret = burst_keys(dataBuffer, dataLength, 0, publicKey, 0, &exception); if (R_SUCCESS == ret) { - os_memset(screenContent, 0, sizeof(screenContent)); + memset(screenContent, 0, sizeof(screenContent)); snprintf(screenContent, sizeof(screenContent), APP_PREFIX); reedSolomonEncode(public_key_to_id(publicKey), screenContent + strlen(screenContent)); showScreen(); @@ -92,7 +92,7 @@ void showAddressHandlerHelper(const uint8_t p1, const uint8_t p2, const uint8_t if((p1&P1_SHOW_ADDRES_RETURN_KEY) == P1_SHOW_ADDRES_RETURN_KEY){ // Also return the public key if asked - os_memmove(G_io_apdu_buffer + *tx, publicKey, sizeof(publicKey)); + memmove(G_io_apdu_buffer + *tx, publicKey, sizeof(publicKey)); *tx += sizeof(publicKey); } } else { diff --git a/unused/curveConversion.c b/unused/curveConversion.c index c8ed8e1..27b03d3 100644 --- a/unused/curveConversion.c +++ b/unused/curveConversion.c @@ -17,7 +17,7 @@ extern const uint8_t f25519_one[F25519_SIZE]; /* Copy two points */ static inline void f25519_copy(uint8_t *x, const uint8_t *a) { - os_memcpy(x, a, F25519_SIZE); + memcpy(x, a, F25519_SIZE); }