Coder Social home page Coder Social logo

AEAD interface improvements about mirage-crypto HOT 6 CLOSED

mirage avatar mirage commented on August 26, 2024 1
AEAD interface improvements

from mirage-crypto.

Comments (6)

hannesm avatar hannesm commented on August 26, 2024 1

JOSE transmits the ciphertext and tag separately, thus an interface such as:

val decrypt_raw : key -> nonce -> adata -> ciphertext -> tag -> plaintext option

val encrypt_raw : key -> nonce -> adata -> plaintext -> ciphertext * tag

could be useful (NB: the names _raw should be revised). the encrypt_aead / decrypt_aead can be implemented in terms of the functions above.

from mirage-crypto.

hannesm avatar hannesm commented on August 26, 2024

on a separate note, there could be (measurable) speedup of AEAD encryption if the allocated cipher-stream is extended by tag-size (i.e. Cstruct.len msg + tag_size) -- thus a Cstruct.append can be avoided (which is costly since it allocates and memmoves).

from mirage-crypto.

hannesm avatar hannesm commented on August 26, 2024

similarly, the Chacha20 implementation -- where djb does 64 bit nonce and 64 bit counter -- while IETF does 96 bit nonce and 32 bit counter -- could be functorised to allow more static checkng (and fewer conditional branches at runtime in the hot loop [incrementing the counter]).

from mirage-crypto.

anmonteiro avatar anmonteiro commented on August 26, 2024

Came here to ask for tag_size in the AEAD interface, and remebered about this issue again.

from mirage-crypto.

hannesm avatar hannesm commented on August 26, 2024

@anmonteiro currently, GCM.tag_size, and Poly1305.mac_size are provided. For CCM it is what you passed as ~maclen into CCM.of_secret ~maclen.

from mirage-crypto.

hannesm avatar hannesm commented on August 26, 2024

See #171 which integrates "of_secret", "tag_size" and also "authenticate_encrypt_tag" and "authenticate_decrypt_tag". Any feedback on the PR is welcome.

from mirage-crypto.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.