Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diffie-Hellman Key Agreement Primitives - Validated #180

Closed
wants to merge 3 commits into from

Conversation

c19x
Copy link
Contributor

@c19x c19x commented May 13, 2021

Diffie-Hellman primitives - Validated

  • UIntBig implements unsigned arbitrary-precision integer modular exponentiation (ModPow)
    • ModPow is core function for anonymous Diffie-Hellman key agreement
    • Function computes (b ^ e) % m where b=base, e=exponent, m=modulo
    • Pure Java implementation without relying on Java BigInteger, native code, or 3rd party libraries
    • Developed for 32-bit architecture for cross-platform code and data compatibility with older and limited capability devices
    • Designed and implemented from ground up using bespoke algorithms optimised for unsigned multiplication, subtraction, modulo (without quotient), bit shifting, and comparison, using only primitive operators that are common across all target platforms
    • Validated against Java BigInteger for unsigned integers up to maximum long value
    • Performance tests showed this software implementation is slower than native hardware but acceptable for intended purpose
      • Tested using 64-bit exponent and modulo values
      • Software : 3000-4000ns/call
      • Hardware : 400-1500ns/call
  • Investigation into existing libraries showed the following issues which resulted in new Herald specific implementation
    • 32-bit vs 64-bit : All cross-platform libraries are 64-bit only and rely on native code (usually OpenSSL)
    • License : Most libraries are MIT license
    • Abstraction : The most promising cross-platform libraries (e.g. Themis) implements additional functions (e.g. Secure Session) over Diffie-Hellman which adds complexity that are not required in Herald
    • Compatibility : Native functions and data formats on iOS and Android for key agreement are not compatible
    • Efficiency : Java BigInteger is immutable, thus using significant memory that is not desirable for wearables; Pure Swift libraries (e.g. Swift BigInt) are unacceptably slow (10+ minutes/call for 2048-bit ModPow test); new implementation has been optimised for ModPow function
  • Validated with iOS implementation for data format and function compatibility
  • Shall be raising new issue for DH over BLE

Signed-off-by: c19x support@c19x.org

closes #173

c19x added 3 commits May 11, 2021 17:27
- UIntBig implements unsigned arbitrary-precision integer modular exponentiation (ModPow)
  - ModPow is core function for anonymous Diffie-Hellman key agreement
  - Function computes (b ^ e) % m where b=base, e=exponent, m=modulo
  - Pure Java implementation without relying on Java BigInteger, native code, or 3rd party libraries
  - Developed for 32-bit architecture for cross-platform code and data compatibility with older and limited capability devices
  - Designed and implemented from ground up using bespoke algorithms optimised for unsigned multiplication, subtraction, modulo (without quotient), bit shifting, and comparison, using only primitive operators that are common across all target platforms
  - Validated against Java BigInteger for unsigned integers up to maximum long value
  - Performance tests showed this software implementation is slower than native hardware but acceptable for intended purpose
    - Tested using 2048-bit exponent and modulo values
    - Software : 3000-4000ns/call
    - Hardware : 400-1500ns/call
- Investigation into existing libraries showed the following issues which resulted in new Herald specific implementation
  - 32-bit vs 64-bit : All cross-platform libraries are 64-bit only and rely on native code (usually OpenSSL)
  - License : Most libraries are MIT license
  - Abstraction : The most promising cross-platform libraries (e.g. Themis) implements additional functions (e.g. Secure Session) over Diffie-Hellman which adds complexity that are not required in Herald
  - Compatibility : Native functions and data formats on iOS and Android for key agreement are not compatible
  - Efficiency : Java BigInteger is immutable, thus using significant memory that is not desirable for wearables; Pure Swift libraries (e.g. Swift BigInt) are unacceptably slow (10+ minutes/call for 2048-bit ModPow test); new implementation has been optimised for ModPow function

Signed-off-by: c19x <support@c19x.org>
- Validated with iOS implementation for data format and function compatibility

Signed-off-by: c19x <support@c19x.org>
- Optional code to test DH on phone hardware on SensorArray start

Signed-off-by: c19x <support@c19x.org>
@c19x
Copy link
Contributor Author

c19x commented May 25, 2021

Resubmitting after #190 is approved

@c19x c19x closed this May 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Diffie-Hellman one time exchange
1 participant