Config.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /**
  2. * %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  3. *
  4. * Copyright (c) 2012 - SCAPI (http://crypto.biu.ac.il/scapi)
  5. * This file is part of the SCAPI project.
  6. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  7. *
  8. * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
  9. * to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
  10. * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
  11. *
  12. * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  15. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  16. * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  17. *
  18. * We request that any publication and/or code referring to and/or based on SCAPI contain an appropriate citation to SCAPI, including a reference to
  19. * http://crypto.biu.ac.il/SCAPI.
  20. *
  21. * SCAPI uses Crypto++, Miracl, NTL and Bouncy Castle. Please see these projects for any further licensing issues.
  22. * %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  23. *
  24. */
  25. #include <emmintrin.h>
  26. /**
  27. * A configuration file that uses defines used by other files in the project.
  28. *
  29. * author: Cryptography and Computer Security Research Group Department of Computer Science Bar-Ilan University (Meital Levy)
  30. */
  31. typedef __m128i block;
  32. #define SIZE_OF_BLOCK 16//size in bytes
  33. #define XOR_GATE 6//the truth table is 0110
  34. #define XOR_NOT_GATE 9// the truth table is 1001, can also use the optimization of FreeXor
  35. #define ONE_GATE 15//the truth table is 1111
  36. #define ZERO_BLOCK _mm_setzero_si128()//a zero block used in many cases