Fix ccm_memory() cleaning user-supplied key #327

Merged
sjaeckel merged 2 commits from fix/ccm_segfault into develop 2017-11-20 07:25:46 -06:00
sjaeckel commented 2017-11-10 10:04:10 -06:00 (Migrated from github.com)
  • tests are added or updated

This fixes a segfault caused by ccm_memory() with LTC_CLEAN_STACK enabled.

* [x] tests are added or updated This fixes a segfault caused by `ccm_memory()` with `LTC_CLEAN_STACK` enabled.
karel-m (Migrated from github.com) reviewed 2017-11-20 02:29:56 -06:00
karel-m (Migrated from github.com) commented 2017-11-20 02:29:56 -06:00

There is already if (skey != uskey) couple of lines above (line 334).

Should not it be better to move zeromem(skey, sizeof(*skey)) there?

There is already `if (skey != uskey)` couple of lines above (line 334). Should not it be better to move `zeromem(skey, sizeof(*skey))` there?
sjaeckel (Migrated from github.com) reviewed 2017-11-20 04:29:49 -06:00
sjaeckel (Migrated from github.com) commented 2017-11-20 04:29:49 -06:00

so you mean like this?

    cipher_descriptor[cipher].done(skey);
#ifdef LTC_CLEAN_STACK
    zeromem(skey,   sizeof(*skey));
#endif

would be fine for me

so you mean like this? ``` cipher_descriptor[cipher].done(skey); #ifdef LTC_CLEAN_STACK zeromem(skey, sizeof(*skey)); #endif ``` would be fine for me
karel-m (Migrated from github.com) reviewed 2017-11-20 05:00:00 -06:00
karel-m (Migrated from github.com) commented 2017-11-20 05:00:00 -06:00

Yes, that's it.

Yes, that's it.
karel-m (Migrated from github.com) approved these changes 2017-11-20 07:21:41 -06:00
karel-m (Migrated from github.com) left a comment

👍

👍
Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-libtom/libtomcrypt!327
No description provided.