Skip to content
This repository has been archived by the owner on Mar 12, 2020. It is now read-only.

mam_parse crashing on esp32 at sig digest #1451

Open
thingswizard opened this issue Oct 23, 2019 · 0 comments
Open

mam_parse crashing on esp32 at sig digest #1451

thingswizard opened this issue Oct 23, 2019 · 0 comments

Comments

@thingswizard
Copy link

thingswizard commented Oct 23, 2019

I'm reproducing the fetch function of the mam.js on an esp32 using the mam v1 features.

After getting the transaction object and passing it to the mam_parse, the last one crashes when getting to theiss_curl_sig_digest(hash, hash, 0, payload + offset, *security * ISS_KEY_LENGTH, enc_curl) function.

Here's the part of the code that may be related to the issue.

size_t size_trytes = 2187 * count;
size_t transaction_bundle_trits_len = size_trytes * 3;
flex_trit_t *transaction_bundle_trits = (flex_trit_t *)malloc(sizeof(flex_trit_t) * FLEX_TRIT_SIZE_8019 * count);
  
if (iota_client_get_transaction_objects(&g_cclient, (get_trytes_req_t *)transactions_res, out_tx_objs) == RC_OK) {
      TX_OBJS_FOREACH(out_tx_objs, tx_obj) {
        memcpy(transaction_bundle_trits + (tx_obj->essence.current_index) * trits_len,
               tx_obj->data.signature_or_message, trits_len);
      }
      char *const side_key = "";
      size_t side_key_len = strlen(side_key) * 3;
      flex_len = NUM_FLEX_TRITS_FOR_TRITS(side_key_len);
      flex_trit_t side_key_trits[flex_len];
      flex_trits_from_trytes(side_key_trits, side_key_len, (const tryte_t *)side_key, side_key_len, side_key_len);

      size_t index = -1;
      size_t security = 2;
      size_t message_trits_length = -1;
      trit_t *const message_trits = malloc(trits_len);
      trit_t next_root_trits[HASH_LENGTH_TRIT];
      Curl enc_curl;
      enc_curl.type = CURL_P_27;
      curl_init(&enc_curl);
      mam_parse(transaction_bundle_trits, transaction_bundle_trits_len, message_trits, &message_trits_length,
                side_key_trits, strlen(side_key) * 3, root_trits, &index, next_root_trits, &security, &enc_curl);

Don't hesitate to ask for more details that may help or which I forgot

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant