Commit Graph

16 Commits

Author SHA1 Message Date
608a925497 WIP
Change-Id: Ida8ec7bf672316652ccfae8a7c7157dc3001cd72
2019-04-20 00:23:55 +01:00
88a9e70768 WIP
Change-Id: I96d25ebebaaf226bfd2d45fb5b605f2dfd32a50d
2019-04-20 00:21:11 +01:00
929a29ed0c WIP
Change-Id: Ibe1eaf5ec006d270d8f08bd2bd1a877a340793fc
2019-04-20 00:18:27 +01:00
77f0c0b35d WIP
Change-Id: I874b1becf3b4334efe95742fec441fe555f61bf2
2019-04-19 18:49:38 +01:00
1bb081fd8e WIP
Change-Id: Ic362ed30d5338ae4fca34290b7d7c0b48f5a5fa3
2019-04-19 18:48:24 +01:00
d46eed92fd WIP
Change-Id: I5147c06a5dafd0a46d61394650905393762d2116
2019-04-19 14:34:51 +01:00
9dd4b1568e WIP
Change-Id: I0736df54239e9ccbf61d463ea1fb19d03a955bf5
2019-04-19 14:33:49 +01:00
8cc902f4a8 WIP
Change-Id: I5bd962f76a12b4253ba136c4da416d58f363512b
2019-04-19 14:29:07 +01:00
4733dd1c4f WIP
Change-Id: I52b47feff8748f717da9837b989b6831301385c2
2019-04-19 13:24:51 +01:00
29e9ce00cb WIP
Change-Id: Ib4714d94fbda9f604683ad4c64dcb222714f4a85
2019-04-19 12:58:50 +01:00
4d03fe12e5 WIP
Change-Id: Iefa0bfc1317f19c8bf2a42a652d35a85319459a3
2019-04-19 11:28:56 +01:00
70c0f56b3b WIP
Change-Id: I30e8140fadaeaad071cd5ce2fb2017b0fb454210
2019-04-19 01:08:08 +01:00
7f9c1fafc4 WIP
Change-Id: I94e84093316a908782178505a0094b27e21e7f67
2019-04-18 21:38:44 +01:00
87571d41b1 WIP
Change-Id: I153c653fd9d33ae89ef71f035f23b253f412e7eb
2019-04-18 17:37:27 +01:00
9b1cfd9893 PerlASM
Change-Id: I8be2c37eafb68d84b09852eb50aff2c356d77e39
2019-04-18 17:35:07 +01:00
eb43eca5a8 Add support for SIKE/p503 post-quantum KEM
Based on Microsoft's implementation available on github:
Source: https://github.com/Microsoft/PQCrypto-SIDH
Commit: 77044b76181eb61c744ac8eb7ddc7a8fe72f6919

Following changes has been applied

* In intel assembly, use MOV instead of MOVQ:
  Intel instruction reference in the Intel Software Developer's Manual
  volume 2A, the MOVQ has 4 forms. None of them mentions moving
  literal to GPR, hence "movq $rax, 0x0" is wrong. Instead, on 64bit
  system, MOV can be used.

* Some variables were wrongly zero-initialized (as per C99 spec)

* Move constant values to .RODATA segment, as keeping them in .TEXT
  segment is not compatible with XOM.

* Fixes issue in arm64 code related to the fact that compiler doesn't
  reserve enough space for the linker to relocate address of a global
  variable when used by 'ldr' instructions. Solution is to use 'adrp'
  followed by 'add' instruction. Relocations for 'adrp' and 'add'
  instructions is generated by prefixing the label with :pg_hi21:
  and :lo12: respectively.

* Enable MULX and ADX. Code from MS doesn't support PIC. MULX can't
  reference global variable directly. Instead RIP-relative addressing
  can be used. This improves performance around 10%-13% on SkyLake

* Check if CPU supports BMI2 and ADOX instruction at runtime. On AMD64
  optimized implementation of montgomery multiplication and reduction
  have 2 implementations - faster one takes advantage of BMI2
  instruction set introduced in Haswell and ADOX introduced in
  Broadwell. Thanks to OPENSSL_ia32cap_P it can be decided at runtime
  which implementation to choose. As CPU configuration is static by
  nature, branch predictor will be correct most of the time and hence
  this check very often has no cost.

* Reuse some utilities from boringssl instead of reimplementing them.
  This includes things like:
  * definition of a limb size (use crypto_word_t instead of digit_t)
  * use functions for checking in constant time if value is 0 and/or
    less then
  * #define's used for conditional compilation

* Use SSE2 for conditional swap on vector registers. Improves
  performance a little bit.

* Fix f2elm_t definition. Code imported from MSR defines f2elm_t type as
  a array of arrays. This decays to a pointer to an array (when passing
  as an argument). In C, one can't assign const pointer to an array with
  non-const pointer to an array. Seems it violates 6.7.3/8 from C99
  (same for C11). This problem occures in GCC 6, only when -pedantic
  flag is specified and it occures always in GCC 4.9 (debian jessie).

* Fix definition of eval_3_isog. Second argument in eval_3_isog mustn't be
  const. Similar reason as above.

* Use HMAC-SHA256 instead of cSHAKE-256 to avoid upstreaming cSHAKE
  and SHA3 code.

* Add speed and unit tests for SIKE.

Change-Id: I22f0bb1f9edff314a35cd74b48e8c4962568e330
2019-04-12 11:26:23 -07:00