A simple library to support serving https.
Dependents: oldheating gps motorhome heating
Diff: pki/pri-key.c
- Revision:
- 12:2c342345b3db
- Parent:
- 10:e269fd7b9500
- Child:
- 14:03a0b8fd6ddc
--- a/pki/pri-key.c Tue Sep 24 18:14:33 2019 +0000 +++ b/pki/pri-key.c Thu Sep 26 07:19:09 2019 +0000 @@ -125,17 +125,40 @@ //Convert message to big number (little endian) format prior to decryption uint8_t leMessage[128]; for (int i = 0; i < 128; i++) leMessage[127 - i] = message[i]; - return RsaSlowStart((uint32_t*)leMessage, (uint32_t*)d, (uint32_t*)n); + //return RsaSlowStart((uint32_t*)leMessage, (uint32_t*)d, (uint32_t*)n); + return RsaFastStart((uint32_t*)leMessage, (uint32_t*)p, (uint32_t*)q, (uint32_t*)dp, (uint32_t*)dq, (uint32_t*)invq); } bool PriKeyDecryptFinished(int slot) { - return RsaSlowFinished(slot); + //return RsaSlowFinished(slot); + return RsaFastFinished(slot); } uint8_t* PriKeyDecryptGetResult(int slot) { - return (uint8_t*) RsaSlowResult(slot); + //return (uint8_t*) RsaSlowResult(slot); + return (uint8_t*) RsaFastResult(slot); } void PriKeyDecryptClear(int slot) { - RsaSlowClear(slot); + //RsaSlowClear(slot); + RsaFastClear(slot); +} +int PriKeyFastStart(uint8_t* message) //return the slot number for the decryption +{ + //Convert message to big number (little endian) format prior to decryption + uint8_t leMessage[128]; + for (int i = 0; i < 128; i++) leMessage[127 - i] = message[i]; + return RsaFastStart((uint32_t*)leMessage, (uint32_t*)p, (uint32_t*)q, (uint32_t*)dp, (uint32_t*)dq, (uint32_t*)invq); +} +bool PriKeyFastFinished(int slot) +{ + return RsaFastFinished(slot); +} +uint8_t* PriKeyFastGetResult(int slot) +{ + return (uint8_t*) RsaFastResult(slot); +} +void PriKeyFastClear(int slot) +{ + RsaFastClear(slot); } \ No newline at end of file