From 47a2783cf17208c076f20e6858891be227648a6c Mon Sep 17 00:00:00 2001 From: Jacob Barthelmeh Date: Mon, 8 May 2017 10:10:52 -0600 Subject: [PATCH] size of buffer with DES ecb encrypt --- src/ssl.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/ssl.c b/src/ssl.c index e976d0c3a..8a3882f61 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -20160,9 +20160,16 @@ void wolfSSL_DES_ecb_encrypt(WOLFSSL_DES_cblock* desa, WOLFSSL_MSG("wc_Des_SetKey return error."); return; } - if (wc_Des_EcbEncrypt(&myDes, (byte*) desb, - (const byte*)desa, sizeof(WOLFSSL_DES_cblock)) != 0){ - WOLFSSL_MSG("wc_Des_EcbEncrypt return error."); + if (enc){ + if (wc_Des_EcbEncrypt(&myDes, (byte*) desb, (const byte*) desa, + sizeof(WOLFSSL_DES_cblock)) != 0){ + WOLFSSL_MSG("wc_Des_EcbEncrpyt return error."); + } + } else { + if (wc_Des_EcbDecrypt(&myDes, (byte*) desb, (const byte*) desa, + sizeof(WOLFSSL_DES_cblock)) != 0){ + WOLFSSL_MSG("wc_Des_EcbDecrpyt return error."); + } } } }