Code Monkey home page Code Monkey logo

cc2538-hal's People

Contributors

thvdveld avatar

Watchers

 avatar

cc2538-hal's Issues

AES engine failing for plaintext shorter than 16 bytes

Branch: crypto

I am getting all-zero ciphertext when invoking the CCM routine on a plaintext that is less than 16 bytes. Looking at the CCM specification, it seems that padding needs to take place to round the lenght of the plaintext to 16-byte blocks. However, this seems to be working for plaintext sizes larger than 16 bytes. I couldn't find the place in the code where this is being done (possibly hardware is handling it?) so am opening this issue for reference.

Here is my minimal code snippet, excluding the boilerplate code:


    const P_3_TV:[u8; 10] = [0x2b, 0x48, 0x4c, 0xd5, 0x3d, 0x74, 0xf0, 0xa6, 0xed, 0x8b];
    let nonce = [
        0x00, 0x00, 0xf0, 0xe0, 0xd0, 0xc0, 0xb0, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x05,
    ];
    let mut data_out = [0; 10];
    let mut tag = [0; 16];

    let ccm_info = AesCcmInfo::new(0, 2, 0).with_added_auth_data(&[]);
    aes_crypto.ccm_encrypt(
        &ccm_info,
        &IV_3_TV,
        &P_3_TV,
        &mut data_out[..],
        &mut tag[..],
    );

    rprintln!("data out: {:0x?}", data_out);

which gives the following output

data out: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

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.