fix segfault in ccm_memory() with LTC_CLEAN_STACK

we shouldn't clean user-supplied variables
This commit is contained in:
Steffen Jaeckel 2017-11-10 16:55:45 +01:00
parent 7c4c61d7ef
commit e05097e413

View File

@ -333,6 +333,9 @@ int ccm_memory(int cipher,
if (skey != uskey) {
cipher_descriptor[cipher].done(skey);
#ifdef LTC_CLEAN_STACK
zeromem(skey, sizeof(*skey));
#endif
}
if (direction == CCM_ENCRYPT) {
@ -380,7 +383,6 @@ int ccm_memory(int cipher,
fastMask = 0;
#endif
mask = 0;
zeromem(skey, sizeof(*skey));
zeromem(PAD, sizeof(PAD));
zeromem(CTRPAD, sizeof(CTRPAD));
if (pt_work != NULL) {