Giter Club home page Giter Club logo

libascon's Introduction

The collection of my tiny, but useful projects.

Code I'm proud of

About me

  • โ“ How is my name pronounced?
  • ๐Ÿ’ป I'm a software engineer
  • ๐Ÿ“š I enjoy writing optimised cross-platform ISO C and Python libraries.
  • ๐Ÿš€ Clean code and good project organisation!
  • ๐Ÿ˜„ I love security and databases.
  • ๐ŸŒฑ I'm trying to explore Rust.
  • ๐Ÿ’ฌ Contact me: Email, LinkedIn

libascon's People

Contributors

cdobraunig avatar mschlaeffer avatar thematjaz avatar

Stargazers

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

Watchers

 avatar  avatar

libascon's Issues

fix Testing Ascon-128 encryption FAIL | File: D:\LibAscon-master\tst\test_aead128_dec.c:343 | Test case: test_decrypt_offline | Ctr: 1024

EDITED by TheMatjaz on 2023-07-26 for formatting clarity.

When I execute offline testing cases of test_encrypt_offline in the test_aead128_encryption, the 1024th test case fails every time. I discovered that once the length of the _CT field is greater than 46, this problem will occur. I located this problem and found vecs_aead_next in the test_encrypt_offline, after executing fscan_ciphertext, the first two bytes of testcase.key will be overwritten to 0, causing the key to be modified, resulting in an error in the generated ciphertext. This issue is due to vecs_aead_t. The length of the ciphertext field in the structure vecs_aead_t is 48. Once it overflows, it will overwrite the next field (key), causing this error.

To address this issue from the root cause, this modification method is to fix fsca_variable_hexbytes, so the bytes are modified by not immediately filling the read ciphertext into bytes after fscanf, but by first caching the read 1-byte ciphertext and ensuring that the last byte of the ciphertext is read before writing the data to bytes.

Source original is:

static vecs_err_t fscan_variable_hexbytes(FILE* const handle,
                                          uint8_t* bytes,
                                          size_t* amount)
{
    size_t i = 0;
    while (1)
    {
        if (i >= VECS_MAX_HEXBYTES_LEN)
        {
            return VECS_FORMAT_TOO_LARGE_HEXBYTES;
        }
        const int bytes_read = fscanf(handle, " %2hhx ", bytes++);		
		
        if (bytes_read != 1)
        {
            break;
        }
        i++;
    }
    *amount = i;
    return VECS_OK;
}

Source after fix is:

static vecs_err_t fscan_variable_hexbytes(FILE* const handle,
                                          uint8_t* bytes,
                                          size_t* amount)
{
    size_t i = 0;
    uint8_t bytes_t;
    while (1)
    {
        if (i >= VECS_MAX_HEXBYTES_LEN)
        {
            return VECS_FORMAT_TOO_LARGE_HEXBYTES;
        }
        const int bytes_read = fscanf(handle, " %2hhx ", &bytes_t);		
		
        if (bytes_read != 1)
        {
            break;
        }
	*bytes++ = bytes_t;
        i++;
    }
    *amount = i;
    return VECS_OK;
}

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.