Smart-Home am Beispiel der Präsenzerkennung im Raum Projektarbeit Lennart Heimbs, Johannes Krug, Sebastian Dohle und Kevin Holzschuh bei Prof. Oliver Hofmann SS2019
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

MyCryptoGeneric.h 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * The MySensors Arduino library handles the wireless radio link and protocol
  3. * between your home built sensors/actuators and HA controller of choice.
  4. * The sensors forms a self healing radio network with optional repeaters. Each
  5. * repeater and gateway builds a routing tables in EEPROM which keeps track of the
  6. * network topology allowing messages to be routed to nodes.
  7. *
  8. * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
  9. * Copyright (C) 2013-2018 Sensnology AB
  10. * Full contributor list: https://github.com/mysensors/MySensors/graphs/contributors
  11. *
  12. * Documentation: http://www.mysensors.org
  13. * Support Forum: http://forum.mysensors.org
  14. *
  15. * This program is free software; you can redistribute it and/or
  16. * modify it under the terms of the GNU General Public License
  17. * version 2 as published by the Free Software Foundation.
  18. */
  19. // This code is taken from https://github.com/Cathedrow/Cryptosuite (Peter Knight) and is lightly modified for MySensors use
  20. #ifndef MyCryptoESP32_h
  21. #define MyCryptoESP32_h
  22. #include "hal/crypto/MyCryptoHAL.h"
  23. #define HASH_LENGTH 32 //!< HASH_LENGTH
  24. #define BLOCK_LENGTH 64 //!< BLOCK_LENGTH
  25. /**
  26. * @brief buffer for SHA256 calculator
  27. */
  28. union _SHA256buffer_t {
  29. uint8_t b[BLOCK_LENGTH]; //!< SHA256 b
  30. uint32_t w[BLOCK_LENGTH / 4]; //!< SHA256 w
  31. };
  32. /**
  33. * @brief state variables for SHA256 calculator
  34. */
  35. union _SHA256state_t {
  36. uint8_t b[HASH_LENGTH]; //!< SHA256 b
  37. uint32_t w[HASH_LENGTH / 4]; //!< SHA256 w
  38. };
  39. // SHA256 HMAC padding bytes
  40. #define HMAC_IPAD 0x36 //!< HMAC_IPAD
  41. #define HMAC_OPAD 0x5c //!< HMAC_OPAD
  42. #endif