Skip to content

Commit

Permalink
sam_seos, sam_picopass: switch from static allocation to BigBuf
Browse files Browse the repository at this point in the history
  • Loading branch information
jkramarz committed Jan 27, 2025
1 parent 15aea05 commit 2464cf6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
9 changes: 7 additions & 2 deletions armsrc/sam_picopass.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,12 @@ static int sam_send_request_iso15(const uint8_t *const request, const uint8_t re
if (g_dbglevel >= DBG_DEBUG)
DbpString("start sam_send_request_iso14a");

uint8_t buf1[ISO7816_MAX_FRAME] = {0};
uint8_t buf2[ISO7816_MAX_FRAME] = {0};
uint8_t * buf1 = BigBuf_malloc(ISO7816_MAX_FRAME);
uint8_t * buf2 = BigBuf_malloc(ISO7816_MAX_FRAME);
if(buf1 == NULL || buf2 == NULL){
res = PM3_EMALLOC;
goto out;
}

uint8_t *sam_tx_buf = buf1;
uint16_t sam_tx_len;
Expand Down Expand Up @@ -235,6 +239,7 @@ static int sam_send_request_iso15(const uint8_t *const request, const uint8_t re
goto out;

out:
BigBuf_free();
return res;
}

Expand Down
9 changes: 7 additions & 2 deletions armsrc/sam_seos.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,12 @@ static int sam_send_request_iso14a(const uint8_t *const request, const uint8_t r
if (g_dbglevel >= DBG_DEBUG)
DbpString("start sam_send_request_iso14a");

uint8_t buf1[ISO7816_MAX_FRAME] = {0};
uint8_t buf2[ISO7816_MAX_FRAME] = {0};
uint8_t * buf1 = BigBuf_malloc(ISO7816_MAX_FRAME);
uint8_t * buf2 = BigBuf_malloc(ISO7816_MAX_FRAME);
if(buf1 == NULL || buf2 == NULL){
res = PM3_EMALLOC;
goto out;
}

uint8_t *sam_tx_buf = buf1;
uint16_t sam_tx_len;
Expand Down Expand Up @@ -253,6 +257,7 @@ static int sam_send_request_iso14a(const uint8_t *const request, const uint8_t r
goto out;

out:
BigBuf_free();
return res;
}

Expand Down

0 comments on commit 2464cf6

Please sign in to comment.