A lightweight, secure, easy-to-use crypto library suitable for constrained environments.

Overview

Build status CodeQL scan Financial Contributors on Open Collective Coverity Scan Build Status TrustInSoft CI

libhydrogen

The Hydrogen library is a small, easy-to-use, hard-to-misuse cryptographic library.

Features:

  • Consistent high-level API, inspired by libsodium. Instead of low-level primitives, it exposes simple functions to solve common problems that cryptography can solve.
  • 100% built using just two cryptographic building blocks: the Curve25519 elliptic curve, and the Gimli permutation.
  • Small and easy to audit. Implemented as one tiny file for every set of operation, and adding a single .c file to your project is all it takes to use libhydrogen in your project.
  • The whole code is released under a single, very liberal license (ISC).
  • Zero dynamic memory allocations and low stack requirements (median: 32 bytes, max: 128 bytes). This makes it usable in constrained environments such as microcontrollers.
  • Portable: written in standard C99. Supports Linux, *BSD, MacOS, Windows, and the Arduino IDE out of the box.
  • Can generate cryptographically-secure random numbers, even on Arduino boards.
  • Attempts to mitigate the implications of accidental misuse, even on systems with an unreliable PRG and/or no clock.

Non-goals:

  • Having multiple primitives serving the same purpose, even to provide compatibility with other libraries.
  • Networking -- but a simple key exchange API based on the Noise protocol is available, and a STROBE-based transport API will be implemented.
  • Interoperability with other libraries.
  • Replacing libsodium. Libhydrogen tries to keep the number of APIs and the code size down to a minimum.

Libhydrogen documentation

The documentation is maintained in the libhydrogen wiki.

The legacy libhydrogen code (leveraging XChaCha20, SipHashX, BLAKE2SX, Curve25519) remains available in the v0 branch.

Contributors

Code Contributors

This project exists thanks to all the people who contribute. [Contribute].

Issues
  • Bindings

    Bindings

    Hi,

    I'm hoping to use libhydrogen for an ESP8266-based project. I have successfully integrated most methods on the ESP, and wrote a C++ utility to sign/encrypt payloads for testing. But now we're working on integration and the lack of php or python bindings is unfortunate. I can probably write a python module, but neither I nor my colleague have experience writing a php extension from scratch. I thought phosphine would be at least a start, but it appears to be just a skeleton with nothing actually implemented.

    Looking at your other repo libsodium-php it looks like there might be a good amount of overlap in a libhydrogen port. So, is there any effort or plans for a port for libhydrogen?

    opened by someburner 11
  • uint8_t is optional in stdint.h

    uint8_t is optional in stdint.h

    The standard doesn't require it to exist, and some microcontrollers that do support C99 and the other fixed-width types do not have uint8_t. I wanted to get feedback on eliminating the use of uint8_t in favor of unsigned char.

    I believe that with some minor changes libhydrogen can be made to work on platforms that don't have an 8-bit integer type, but this would be a prerequisite to that.

    opened by chrisnc 10
  • Add RT-Thread RTOS Support

    Add RT-Thread RTOS Support

    opened by wuhanstudio 8
  • How close to production is libhydrogen?

    How close to production is libhydrogen?

    Not looking for complete whitepaper set-in-stone blueprints in regard to this question, but merely the authors' opinion.

    How likely to change is the API? Do you want [complete] freedom to change the API at this stage? And/or could you speculate if it might need to change its API (purposefully or unpurposefully)?

    I see there are no formal github releases yet. Does that mean this is still mostly work-in-progress, wait for 0.1 for some kind of API stability?

    Are you working towards a 0.1 or 1.0 release at the moment, have any kind of projections for how close that is?

    TL;DR - looking for clarifications for what expectations outsiders should have for "when should I use libhydrogen for my [personal / prototype / production / library] project?"

    Thanks!

    opened by Ivoz 7
  • Added support for px4 nuttx

    Added support for px4 nuttx

    The goal of this pool request is to add support of libhydrogen for nuttx real-time os, which is used in the PX4 platform. I would like to add a security layer based on libhydrogen to Mavlink protocol which is used on the PX4 platform for telemetry. After this pool request it will be possible to generate secure seed on PX4 hardware.

    opened by rligocki 6
  • Gimli out of running in LWC competition

    Gimli out of running in LWC competition

    https://csrc.nist.gov/News/2021/lightweight-crypto-finalists-announced

    Gimli did not make it to the finals of the LWC competition. Are there any plans to switch to one of the other finalists, or perhaps wait for the overall winner to be announced?

    opened by woefulwabbit 5
  • Mbed compilator - error

    Mbed compilator - error

    I tried to compile libhydrogen on Mbed OS, but unfortunately I get this error:

    [Error] @,: ARMC6 does not support ARM architecture v7 targets
    [Warning] @,: Compiler version mismatch: Could not detect version; expected version >= 6.10 and < 7.0
    Building project mbed-os-empty (NUCLEO_F429ZI, ARMC6)
    Scan: mbed-os-empty
    Link: mbed-os-empty
    Warning: L3912W: Option 'legacyalign' is deprecated.
    Error: L6200E: Symbol hydro_sign_verify multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_kx_kk_3 multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_hash_init multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_secretbox_probe_create multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol __ARM_use_no_argv multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/tests/tests.o).
    Error: L6200E: Symbol hydro_kdf_derive_from_key multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_kx_n_1 multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_kdf_keygen multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_pwhash_verify multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_pwhash_deterministic multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_secretbox_encrypt multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_sign_keygen multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_pad multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_kx_xx_3 multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_hash_final multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_kx_n_2 multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_sign_final_create multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_secretbox_keygen multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_secretbox_decrypt multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_kx_xx_1 multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_random_buf_deterministic multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_kx_kk_2 multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_random_reseed multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_secretbox_probe_verify multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_pwhash_keygen multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_init multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_random_ratchet multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_pwhash_create multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_sign_keygen_deterministic multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_kx_xx_4 multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_kx_xx_2 multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_hex2bin multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_memzero multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_hash_hash multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_bin2hex multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_kx_keygen multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_sign_init multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_random_buf multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol main multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/tests/tests.o).
    Error: L6200E: Symbol hydro_unpad multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_increment multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_random_uniform multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_sign_update multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_hash_update multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_pwhash_upgrade multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_kx_kk_1 multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_equal multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_random_u32 multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_sign_final_verify multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_sign_create multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_pwhash_derive_static_key multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_compare multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_pwhash_reencrypt multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_kx_keygen_deterministic multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_hash_keygen multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Not enough information to list the image map.
    Finished: 1 information, 1 warning and 55 error messages.
    [ERROR] Warning: L3912W: Option 'legacyalign' is deprecated.
    Error: L6200E: Symbol hydro_sign_verify multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_kx_kk_3 multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_hash_init multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_secretbox_probe_create multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol __ARM_use_no_argv multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/tests/tests.o).
    Error: L6200E: Symbol hydro_kdf_derive_from_key multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_kx_n_1 multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_kdf_keygen multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_pwhash_verify multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_pwhash_deterministic multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_secretbox_encrypt multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_sign_keygen multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_pad multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_kx_xx_3 multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_hash_final multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_kx_n_2 multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_sign_final_create multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_secretbox_keygen multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_secretbox_decrypt multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_kx_xx_1 multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_random_buf_deterministic multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_kx_kk_2 multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_random_reseed multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_secretbox_probe_verify multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_pwhash_keygen multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_init multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_random_ratchet multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_pwhash_create multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_sign_keygen_deterministic multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_kx_xx_4 multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_kx_xx_2 multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_hex2bin multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_memzero multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_hash_hash multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_bin2hex multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_kx_keygen multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_sign_init multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_random_buf multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol main multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/tests/tests.o).
    Error: L6200E: Symbol hydro_unpad multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_increment multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_random_uniform multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_sign_update multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_hash_update multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_pwhash_upgrade multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_kx_kk_1 multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_equal multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_random_u32 multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_sign_final_verify multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_sign_create multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_pwhash_derive_static_key multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_compare multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_pwhash_reencrypt multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_kx_keygen_deterministic multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Error: L6200E: Symbol hydro_hash_keygen multiply defined (by BUILD/NUCLEO_F429ZI/ARMC6/main.o and BUILD/NUCLEO_F429ZI/ARMC6/libhydrogen/hydrogen.o).
    Not enough information to list the image map.
    Finished: 1 information, 1 warning and 55 error messages.
    

    Does anyone know what to do?

    This is my code:

    #include` "mbed.h"
    #include "./../x86_example/hydrogen.cpp"
    
    // main() runs in its own thread in the OS
    int main()
    {
        while (true) {
            //hydro_init();
        }
    }
    
    opened by rligocki 5
  • Unable to initialize on Android

    Unable to initialize on Android

    Hi, thank you for this library! I am trying to build it to run on android. The build process was successful, but the library wont initialize; I am building using android NDK. I made a poston stackoverflow where there is more specific detail to my problem.

    opened by buretto 5
  • hydro_pwhash_create without a master key

    hydro_pwhash_create without a master key

    I understand the password-hashing API is designed to prevent misuse in the most common cases. But I'm using it to create a hash on a network client which is then transmitted—encrypted, in a secretbox—to a server, which verifies the hash against a password it already holds in plaintext. None of this data is ever stored. Therefore, encrypting the password hash only to wrap it in the transport encryption feels excessive, and requires that I derive a second key just for the password hash.

    opened by spinda 5
  • error compiling with mingw

    error compiling with mingw

    Hello, I've been trying to compile with mingw (gcc version is 4.8.1) on Windows 7 64-bit. "make lib" works, but for "make all" I get the error "undefined reference to `[email protected]'". I get the same error if I try to compile libhydrogen.a into a program of my own. Can you tell me how to correct this? Thanks

    opened by clintr-at-kornak 5
  • Unable to compile random.h on a teensy chip

    Unable to compile random.h on a teensy chip

    Temp\arduino_build_987748\sketch\impl/random.h:35:5: error: 'MCUSR' undeclared (first use in this function)
    
         MCUSR = 0;
    
    
    

    I'm pretty new on Arduino, is there a library I'm missing or any inclusion?

    opened by edubois 5
  • random: rt-thread: log error rather than abort in the main thread

    random: rt-thread: log error rather than abort in the main thread

    Hi,

    This PR adds an error message if libhydrogen fails to initialize rather than abort the main thread, causing all other components unable to initialize.

    image

    opened by wuhanstudio 0
  • Init RNG seeding seemingly very predictable on Arduino Uno

    Init RNG seeding seemingly very predictable on Arduino Uno

    I wrote a test program which does hydro_init(), and then writes the random state over serial. In the first test, I did soft resets with the RESET pin, and in the second test I disconnected power manually for a few seconds to reset. As you can see, most repeats are close to each other, but in some cases the same state appears again several minutes of testing later. In the soft reset case, there are only 5 different states in total, the least common of which appears 3 times, and the most common one appears 35 times. In the hard reset case, there are 18 different states, of which 10 appear only once each, and the most common state appears 9 times.

    https://paste.sr.ht/~lonjil/a9f50c3e28beb4cf26f1632f3caef315e859974b

    Am I perhaps doing something wrong? Is there something I could do to mitigate this?

    opened by lonjil 7
  • Linking issue on Android

    Linking issue on Android

    Hi,

    I am not able to compile the libhydrogen source code in android as it is throwing error while liking with test sample (tests.c).

    Please check the given below linking errors.

    /home/Compiler/android_aarch64_clang_toolchain3.5/bin/../lib/gcc/aarch64-linux-android/4.9/../../../../aarch64-linux-android/bin/ld: /tmp/hydrogen-d0e9ef.o: unrecognized relocation (0x20c) in section `.text' /home/Compiler/android_aarch64_clang_toolchain3.5/bin/../lib/gcc/aarch64-linux-android/4.9/../../../../aarch64-linux-android/bin/ld: final link failed: Bad value

    How to Reproduce : I have added a entry of android toolchain in make file and then just run make.

    Please let me know what causing this issue.

    opened by AshishDurgapal 5
  • API Thoughts

    API Thoughts

    Seems like @jedisct1 has made this library, at least in part, as a bit of an experiment in API design. So maybe feedback/thoughts like this are just way too late, and there's no longer interest in making any changes. In any case here's some thoughts :)

    I used libsodium's crypto_aead_chacha20poly1305_ietf_encrypt AEAD to implement a secure protocol over UDP for an online game. The packet structure had some unencrypted data, followed by some encrypted data, with the authentication appended to the end.

    libsodium was replaced with libhydrogen just yesterday, and it was a little bit difficult due to minor API differences. We have access to hydro_secretbox_encrypt for encrypting, but for the unencrypted (but still authenticated) data hydro_sign_create was used. It just seems a little unfortunate as a couple hiccups popped up.

    • Both hydro functions compute an initialization vector and an authentication tag. This required a slight restructuring of my packets when switching from libsodium, and uses a little more packet memory than necessary.
    • hydro_secretbox_encrypt prepends data to a buffer, while crypto_aead_chacha20poly1305_ietf_encrypt (combined mode) appended data. And so the packet layout had to be adjusted. It's possible to just memcpy out the 20 bytes for the IV and 16 bytes for the tag to use my old packet layout... But this breaks the abstraction of hydro_secretbox_encrypt.

    Now I don't understand the underlying algorithms all too well, but from a cursory understanding it seems like a slight API redesign might be really good. I think libhydrogen's small size is absolutely wonderful, and that's why I switched despite the above headaches. Very simple to integrate! For my use case if another more advanced version of hydro_secretbox_encrypt existed that accepted additional data and let me specify a pointer to write the output IV + tag, it would overall have been a perfect library.

    opened by RandyGaul 0
Owner
Frank Denis
Parisian fashion photographer with a knack for cryptography, computer vision, opensource software and infosec. Get my public keys here: https://sk.tl/7CPRo8kn
Frank Denis
A modern, portable, easy to use crypto library.

Sodium is a new, easy-to-use software library for encryption, decryption, signatures, password hashing and more. It is a portable, cross-compilable, i

Frank Denis 10.2k Jun 25, 2022
A Powerful, Easy-to-Use, Compact, Cross-Platform and Installation-Free Crypto Tool. 一个强大,易用,小巧,跨平台且免安装的加密解密签名工具。

GpgFrontend GpgFrontend is a Powerful, Easy-to-Use, Compact, Cross-Platform, and Installation-Free OpenPGP Crypto Tool. By using GpgFrontend, you can

Saturn&Eric 142 Jun 28, 2022
Tink is a multi-language, cross-platform, open source library that provides cryptographic APIs that are secure, easy to use correctly, and hard(er) to misuse.

Tink A multi-language, cross-platform library that provides cryptographic APIs that are secure, easy to use correctly, and hard(er) to misuse. Ubuntu

Google 12.4k Jun 23, 2022
This repository aims to provide an easy-to-use implementation of the Secure Hash Standard as specified in FIPS 180-4

HashLibCpp This repository aims to provide an easy-to-use implementation of the Secure Hash Standard. (currently implemented are SHA224, SHA256 and SH

ADD1609 1 Feb 2, 2022
TLS/SSL and crypto library

Welcome to the OpenSSL Project OpenSSL is a robust, commercial-grade, full-featured Open Source Toolkit for the Transport Layer Security (TLS) protoco

OpenSSL 18.7k Jun 28, 2022
The UAPKI is crypto library for using in PKI with support of Ukrainian and internationlal cryptographic standards.

UAPKI The UAPKI is crypto library for using in PKI with support of Ukrainian and internationlal cryptographic standards. Fork from Cryptonite. Expert

null 23 May 27, 2022
DARKCAT Project - A Strong Prototype Crypto-Locker

Darkcat is an Open Source Crypto-locker directed at an audience with an interest in the field of Cyber Security. The locker is similar to how very obnoxious Ransomwares operate using 2-Layer Key Encryption with the intent of making it almost impossible to recover any key from memory even during the event of Encryption.

Alexander Töpfer 29 Apr 17, 2022
Malware that replaces copied crypto addresses with yours.

Crypto-Clipper Malware which replaces copied crypto addresses with yours. ?? Features Multiple cryptos supported (BTC, LTC, ETH, DOGE, DASH, NEO, BCH,

Voltic 5 Apr 25, 2022
LibSWIFFT - A fast C/C++ library for the SWIFFT secure homomorphic hash function

LibSWIFFT - A fast C/C++ library for the SWIFFT secure homomorphic hash function Official Repository LibSWIFFT is a production-ready C/C++ library pro

Gvili Tech Ltd 21 Jun 19, 2021
Monero: the secure, private, untraceable cryptocurrency

Monero: the secure, private, untraceable cryptocurrency

The Monero Project 7.1k Jul 3, 2022
An open source, portable, easy to use, readable and flexible SSL library

README for Mbed TLS Mbed TLS is a C library that implements cryptographic primitives, X.509 certificate manipulation and the SSL/TLS and DTLS protocol

Arm Mbed 3.6k Jun 30, 2022
Mbedcrypto - a portable, small, easy to use and fast c++14 library for cryptography.

mbedcrypto mbedcrypto is a portable, small, easy to use, feature rich and fast c++14 library for cryptography based on fantastic and clean mbedtlsnote

amir zamani 37 Jun 16, 2022
:lock: Don't use this repo, use the new monorepo instead:

trezor-crypto Heavily optimized cryptography algorithms for embedded devices. These include: AES/Rijndael encryption/decryption Big Number (256 bit) A

TREZOR 487 Jun 22, 2022
Nano is a digital payment protocol designed to be accessible and lightweight, with a focus on removing inefficiencies present in other cryptocurrencies.

Nano is a digital payment protocol designed to be accessible and lightweight, with a focus on removing inefficiencies present in other cryptocurrencies. With ultrafast transactions and zero fees on a secure, green and decentralized network, this makes Nano ideal for everyday transactions.

Nano 3.4k Jun 23, 2022
Finalists to the NIST lightweight cryptography competition

LWC Finalists This repository contains implementations of the 10 finalists in the NIST lightweight cryptography competition: ASCON, Elephant, GIFT-COF

null 30 Jun 3, 2022
Nano is a digital payment protocol designed to be accessible and lightweight, with a focus on removing inefficiencies present in other cryptocurrencies.

Nano is a digital payment protocol designed to be accessible and lightweight, with a focus on removing inefficiencies present in other cryptocurrencies. With ultrafast transactions and zero fees on a secure, green and decentralized network, this makes Nano ideal for everyday transactions.

Nano 3.1k May 5, 2021
A lightweight and simpling iOS binary decryptor

FlexDecrypt's source code is pretty FAT, bundling the whole swift runtime to just achieve a simple mremap_encrypted.

null 152 Jun 30, 2022
An easy way to decrypt UIKit app.

Decrypter An easy way to decrypt UIKit app and export non-encrypted installer ipa file. Working on arm mac, iOS version coming soon. Special Thanks ht

Lakr Aream 114 Jun 23, 2022
This repository contains commercially licensed wolfSSL products and example code for use on specified Renesas platforms.

wolfSSL Product for Renesas This repository contains commercially licensed wolfSSL product code for use on specified Renesas platforms. This code is o

wolfSSL 4 Jun 9, 2022