Implement a secure ICS protocol targeting LoRa Node151 microcontroller for controlling irrigation.
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.
 
 
 
 
 
 

67 lines
2.0 KiB

  1. .PHONY: all test shavs shamont shakat clean
  2. SHELL := /bin/bash
  3. PYTHON ?= python
  4. all:
  5. @echo "Not making test because that takes for fricken ever"
  6. @false
  7. define def_monte
  8. SHAMONT += test-sha3vs-$(1)-Monte
  9. test-sha3vs-$(1)-Monte: kat/$(1)Monte.rsp Strobe/Test/Sha3vs.py Strobe/Keccak.py
  10. $(PYTHON) -B -m Strobe.Test.Sha3vs \
  11. --test=Monte \
  12. --hash=$(1) \
  13. --seed=$(shell perl -ne 'print $$1 if /(?:Seed|Msg) = ([a-f0-9]+)/i' kat/$(1)Monte.rsp) \
  14. --min-len=$(shell perl -ne 'print $$1 if /.Minimum Output Length .bits. = ([0-9]+)/i' kat/$(1)Monte.rsp) \
  15. --max-len=$(shell perl -ne 'print $$1 if /.Maximum Output Length .bits. = ([0-9]+)/i' kat/$(1)Monte.rsp) \
  16. | diff -u --strip-trailing-cr <(egrep -v '^\#' $$<) -
  17. endef
  18. define def_kat
  19. SHAKAT += test-sha3vs-$(1)-$(2)
  20. test-sha3vs-$(1)-$(2): kat/$(1)$(2).rsp Strobe/Test/Sha3vs.py Strobe/Keccak.py
  21. $(PYTHON) -B -m Strobe.Test.Sha3vs \
  22. --test=Kat \
  23. --hash=$(1) \
  24. --file=$$< \
  25. | diff -u --strip-trailing-cr <(egrep -v '^\#' $$<) -
  26. endef
  27. define def_common
  28. $(eval $(call def_monte,$(1)))
  29. $(eval $(call def_kat,$(1),ShortMsg))
  30. $(eval $(call def_kat,$(1),LongMsg))
  31. endef
  32. ifneq ("$(wildcard kat)","")
  33. $(eval $(call def_common,SHA3_224))
  34. $(eval $(call def_common,SHA3_256))
  35. $(eval $(call def_common,SHA3_384))
  36. $(eval $(call def_common,SHA3_512))
  37. $(eval $(call def_common,SHAKE128))
  38. $(eval $(call def_common,SHAKE256))
  39. $(eval $(call def_kat,SHAKE128,VariableOut))
  40. $(eval $(call def_kat,SHAKE256,VariableOut))
  41. endif
  42. KAT1 = 'http://csrc.nist.gov/groups/STM/cavp/documents/sha3/sha-3bytetestvectors.zip'
  43. KAT2 = 'http://csrc.nist.gov/groups/STM/cavp/documents/sha3/shakebytetestvectors.zip'
  44. fetchkat:
  45. mkdir -p kat
  46. (cd kat && wget $(KAT1) && unzip `basename $(KAT1)`)
  47. (cd kat && wget $(KAT2) && unzip `basename $(KAT2)`)
  48. shamont: $(SHAMONT)
  49. shakat: $(SHAKAT)
  50. shavs: shakat shamont
  51. @echo "All known-answer tests passed"
  52. test-python:
  53. python -m unittest Strobe.Test.copy
  54. test: shavs
  55. clean:
  56. find . -name '*.pyc' -delete