Giter Club home page Giter Club logo

practical_cryptography_engineering's People

Contributors

tleonhardt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

practical_cryptography_engineering's Issues

crypto_secretbox_easy() memory limit

In the file nacl_encrypt_file.c you have the following code:

ret = crypto_secretbox_easy(ciphertext, message, message_len, nonce, key);
    if ( ret != 0)
    {   // The only way I can see for this function to fail is if the message length is too large (> 2^64 - 16)
        printf(" failed.  Message length = %lld\n", message_len);
    }

However, this only works to encrypt a file, if, and only if, it fits in the computer memory inside the variable messsage. Take a look at the explanation in the Quick start page of Libsodium. So, with crypto_secretbox_easy the limit is not 2^64 - 16, but the memory size of message.
The best way to encrypt a file, regardless of its size, is with crypto_secretstream* functions (see the file encryption code example on Libsodium docs).

Question in https://github.dev/tleonhardt/practical_cryptography_engineering/blob/master/aes_gcm.c

I'm getting the below error code
mbedtls_gcm_setkey failed to set the key for AES cipher - returned -0x61 (MBEDTLS_ERR_CIPHER_ALLOC_FAILED)

In my project, I'm calling mbedtls_gcm_setkey, passed initialized gcm context which calls "mbedtls_cipher_setup"

Inside the "mbedtls_cipher_setup " API...
if( NULL == ( ctx->cipher_ctx = cipher_info->base->ctx_alloc_func() ) )
return( MBEDTLS_ERR_CIPHER_ALLOC_FAILED );

It fails here, I don't see ctx_alloc_func references in the repo, am i missing something?

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.