burn_stack.c 720 B

123456789101112131415161718192021222324252627282930313233
  1. /* LibTomCrypt, modular cryptographic library -- Tom St Denis
  2. *
  3. * LibTomCrypt is a library that provides various cryptographic
  4. * algorithms in a highly modular and flexible manner.
  5. *
  6. * The library is free for all purposes without any express
  7. * guarantee it works.
  8. */
  9. #include "tomcrypt_private.h"
  10. /**
  11. @file burn_stack.c
  12. Burn stack, Tom St Denis
  13. */
  14. /**
  15. Burn some stack memory
  16. @param len amount of stack to burn in bytes
  17. */
  18. void burn_stack(unsigned long len)
  19. {
  20. unsigned char buf[32];
  21. zeromem(buf, sizeof(buf));
  22. if (len > (unsigned long)sizeof(buf)) {
  23. burn_stack(len - sizeof(buf));
  24. }
  25. }
  26. /* ref: $Format:%D$ */
  27. /* git commit: $Format:%H$ */
  28. /* commit time: $Format:%ai$ */