Merge pull request #2827 from kaleb-himes/ZD9976

Fix infinite loop with small sha1 inputs. Thanks to Peter W. on ZD997…
This commit is contained in:
toddouska
2020-03-05 08:32:14 -08:00
committed by GitHub

View File

@@ -427,6 +427,9 @@ static void start_engine(pic32mz_desc *desc)
bufferLen = desc->dbPtr;
if (bufferLen % 4)
bufferLen = (bufferLen + 4) - (bufferLen % 4);
/* initialize the MSGLEN on engine startup to avoid infinite loop when
* length is less than 257 (size of PIC32_BLOCK_SIZE) */
uc_desc->bd[desc->currBd].MSGLEN = desc->msgSize;
uc_desc->bd[desc->currBd].BD_CTRL.BUFLEN = bufferLen;
uc_desc->bd[desc->currBd].BD_CTRL.LAST_BD = 1;
uc_desc->bd[desc->currBd].BD_CTRL.LIFM = 1;