Merge pull request #2 from NickolasLapp/STM32_CUBEmX

Fix DES3 on STM32 CUBEMX
This commit is contained in:
dgarske 2016-12-07 11:27:24 -08:00 committed by GitHub
commit 477ec3c3d1

View File

@ -151,6 +151,7 @@ void wc_Des3AsyncFree(Des3* des3)
int wc_Des3_SetKey(Des3* des, const byte* key, const byte* iv, int dir)
{
#ifndef WOLFSSL_STM32_CUBEMX
word32 *dkey1 = des->key[0];
word32 *dkey2 = des->key[1];
word32 *dkey3 = des->key[2];
@ -161,10 +162,12 @@ void wc_Des3AsyncFree(Des3* des3)
XMEMCPY(dkey2, key + 8, 8); /* set key 2 */
XMEMCPY(dkey3, key + 16, 8); /* set key 3 */
#ifndef WOLFSSL_STM32_CUBEMX
ByteReverseWords(dkey1, dkey1, 8);
ByteReverseWords(dkey2, dkey2, 8);
ByteReverseWords(dkey3, dkey3, 8);
#else
(void)dir;
XMEMCPY(des->key[0], key, DES3_KEYLEN); /* CUBEMX wants keys in sequential memory */
#endif
return wc_Des3_SetIV(des, iv);