Skip to content

Commit

Permalink
Use wipe_spritz_ctx() in hash() and mac()
Browse files Browse the repository at this point in the history
  • Loading branch information
abderraouf-adjal committed Nov 5, 2015
1 parent 6e52c71 commit cdf2610
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions SpritzCipher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,9 @@ SpritzCipher::hash(uint8_t *digest, uint8_t digestLen,
absorbStop(&ctx);
absorb(&ctx, digestLen);
squeeze(&ctx, digest, digestLen);
#ifdef WIPE_AFTER_USAGE
wipe_spritz_ctx(&ctx);
#endif
}

/* Message Authentication Code (MAC) function */
Expand All @@ -250,4 +253,7 @@ SpritzCipher::mac(uint8_t *digest, uint8_t digestLen,
absorbStop(&ctx);
absorb(&ctx, digestLen);
squeeze(&ctx, digest, digestLen);
#ifdef WIPE_AFTER_USAGE
wipe_spritz_ctx(&ctx);
#endif
}
2 changes: 1 addition & 1 deletion SpritzCipher.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
/** \def WIPE_AFTER_USAGE
* wipe sensitive buffers and variables in functions when they are no longer needed
*/
// #define WIPE_AFTER_USAGE
#define WIPE_AFTER_USAGE

#define SPRITZ_N 256

Expand Down

0 comments on commit cdf2610

Please sign in to comment.