Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GCM block cipher mode #16

Open
yorickdewid opened this issue Mar 12, 2015 · 16 comments
Open

Add GCM block cipher mode #16

yorickdewid opened this issue Mar 12, 2015 · 16 comments

Comments

@yorickdewid
Copy link

Both modes work indeed as stated by the NIST. Adding a counter mode would be awesome since CBC can stil be used in BEAST and ECB is vulnerable to plaintext attacks.

@DamonHD
Copy link

DamonHD commented Jun 14, 2015

Yes, that would be great! I have been able only to get down to 14kB code so far for an Arduino UNO / ATmega328P...

http://www.earth.org.uk/note-on-IoT-security.html#app4

Rgds

Damon

@yorickdewid
Copy link
Author

Cool, so we might be expecting a GCM? 😄

@DamonHD
Copy link

DamonHD commented Jun 14, 2015

So I have hacked someone else's code to get a working GCM impl for my purposes but need to get size down to ~4kB code I think to be widely usable, and your base looks v promising to get there. Completely unclear of how to get from yours to full GCM though!

@DamonHD
Copy link

DamonHD commented Jun 14, 2015

Sorry 'this' not 'your'!

@DamonHD
Copy link

DamonHD commented Aug 28, 2015

We (OpenTRV) may be taking a look at this very soon to see if we can cobble together a good small AES-GCM impl from this and the other rubble we have lying around. We'd be happy to fold back stuff into your lib and/or run a stand-alone one derived from yours and with attributions. Note quite sure what the best route is here in terms of code and/or licence!

@yorickdewid
Copy link
Author

I found a pretty useful implementation here that I've used in a few projects. That said it would be nice to have a project that bundles all the block operation modes into one. Also still looking for a XEX tweaked-codebook mode with ciphertext stealing, but I believe there are some patterns to those implementations.

@DamonHD
Copy link

DamonHD commented Aug 28, 2015

Thanks for that heads-up!

I can't see any licensing on that one so I don't think that I can use it directly.

Rgds

Damon

@kokke
Copy link
Owner

kokke commented Nov 30, 2017

Hi @DamonHD and @yorickdewid

Driven by the fact that Google's Chrome now considers AES-CBC to be an obsolete mode of operation - I'm guessing because of vulnerabilities against padding-oracle attacks if used incorrectly - I'm starting to take an interest in GCM mode too.

What's the status on this, did any of you find / write a good implementation?

As far as I can tell, it works mostly like CTR (counter-mode) with an added Galois-Field multiplication.
I'll take a look at it and see how difficult it would be to implement.

@yorickdewid
Copy link
Author

Would be cool to have a standalone implementation of GCM

@kokke
Copy link
Owner

kokke commented Dec 1, 2017

I just finished adding plain-old CTR-mode...

I need to think some more about GCM and GHASH

@DamonHD
Copy link

DamonHD commented Dec 1, 2017

Maybe we can share a/our GCM impl with you somehow?

Rgds

Damon

@kokke
Copy link
Owner

kokke commented Dec 1, 2017

Hi @DamonHD , I'd love some inspiration or some other implementation to validate against :)

I will have a look at OTAESGCM - Or were you thinking of an implementation that is not on github?

Authenticated Encryption is still a bit new to me. I've been using HMACs for separate authenticity check.

@DamonHD
Copy link

DamonHD commented Dec 1, 2017

I'm suggesting OTAESGCM.

We do have unit tests including some NIST vectors. But also what has proved important to us for our small MCU is the memory management stuff.

Anyhow, happy to help where we can, maybe even break out a common sub-library that we can both use.

Please note that there are definitely some limitations in what we have done, which we can discuss.

Rgds

Damon

@cmcqueen
Copy link

cmcqueen commented May 28, 2018

In my small AES implementation, cmcqueen/aes-min, I've been adding some code for the Galois 128-bit multiply used in the GHASH for AES-GCM. I've got:

  • a bit-by-bit implementation (slow but requiring minimal RAM)
  • a table implementation using an 8-bit table look-up (fast, but requiring 4,080 bytes of calculated table data per key)
  • a 4-bit table look-up implementation (moderately fast, requiring 480 bytes of calculated table data per key)

@cmcqueen
Copy link

cmcqueen commented May 28, 2018

You can validate an AES-GCM implementation against these AES-GCM test vectors from NIST.

@kokke
Copy link
Owner

kokke commented May 29, 2018

Hi @cmcqueen - thanks for the test vectors :) they'll come in handy when I (or someone else) get around to implementing GCM in this project as well.

Thanks a lot 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants