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

Update to Elixir v1.12 with OTP 24 #82

Closed
nelsonic opened this issue May 24, 2021 · 5 comments · Fixed by #83
Closed

Update to Elixir v1.12 with OTP 24 #82

nelsonic opened this issue May 24, 2021 · 5 comments · Fixed by #83
Assignees

Comments

@nelsonic
Copy link
Member

When compiling an App that depends on fields I get the following warning:

==> fields
warning: the dependency :fields requires Elixir "~> 1.10.4" but you are running on v1.11.2

Need to update supported version to v1.12.0 and release updated package.
Read: https://elixir-lang.org/blog/2021/05/19/elixir-v1-12-0-released

@kgautreaux
Copy link
Collaborator

I took a crack at part of this to replace the removed :crypto.block_encrypt/5 in OTP 24. If I'm reading the Erlang docs correctly the new crypto api should allow replacing with a call to {ciphertext, tag} = :crypto.crypto_one_time_aead(:aes_256_gcm, key, iv, to_string(plaintext), @aad, true).

However, when I replace this and run the tests on the project I get a ** (ErlangError) Erlang error: {:badarg, {'aead.c', 90}, 'Unknown cipher'} error from Erlang which locates the problem to the aead.c nif in the Erlang crypto module.

I tried to debug that c code but my c is very limited and the best I could tell is that it is looking up the :aes_256_gcm term/atom in a c struct but failing to find it. For GCM ciphers it does appear to look up the cipher by Erlang term and key size so perhaps the key size isn't getting set correctly and aead.c thinks that it is NULL. I really doubt I've found a bug in the OTP crypto module but I need help from someone who can dump the c symbols or step through the c code to determine where the problems lies.

I did check openssl ciphers on my machine and it included some GCM ciphers so I don't think it is a problem with openssl. Thanks for any help or guidance you can provide.

@nelsonic
Copy link
Member Author

nelsonic commented Jun 2, 2021

@kgautreaux thank you so much for proactively investigating this. 🎉
I've made you a contributor on this project: https://github.com/dwyl/fields/invitations ✉️
so if you don't mind, please push your Spike up on a branch so we can build on your work. 👍
Thanks! Hope your day is going well.

@kgautreaux kgautreaux linked a pull request Jun 10, 2021 that will close this issue
@cruisemaniac
Copy link

Hi Gentlemen!

Thanks, @nelsonic for the PR.

@kgautreaux Do you have an ETA on merging this into master?

I am on 1.12 on Elixir and the compile for this package fails with the specific error above.

@kgautreaux
Copy link
Collaborator

I intended to fix the remaining failing tests but then a few weeks of life got in the way. I would still like to fix the failing hash tests and then I can push the fix. I don't want to give an ETA because life happens but I'll try to work on it this weekend.

@cruisemaniac
Copy link

@kgautreaux That is a perfectly valid explanation!

I am able to use the git branch and get it working for now. So we're cool :-)

Thanks once again! 👍

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

Successfully merging a pull request may close this issue.

3 participants