Skip to content

Conversation

@dominicletz
Copy link
Contributor

@dominicletz dominicletz commented Mar 4, 2025

This fixes two issues:

  1. crypto.hash_equals can be present but unsupported (in which case it throws)

  2. When compiling beam files on an older otp revision than deploying , the compile time detection reports false positives. Instead we're using runtime detection now always.

@josevalim
Copy link
Member

When compiling beam files on a newer otp revision than deploying , the compile time detection reports false positives. Instead we're using runtime detection now always.

We can expand on this a bit? I don't believe Elixir nor the Erlang VM actually supports compiling on a newer OTP version. You should always compile on the lowest version that you plan to support.

@bcardarella
Copy link

@dominicletz is there feedback you can provide to Jose, as we're also in need of this PR for LVN

@dominicletz
Copy link
Contributor Author

Yes, sorry it's the other way around. E.g. compiling on an older version then the newer functions become not accessible even when running on a new OTP. I've fixed that comment. And yes OTP supports running older beam code on newer OTP releases. I think two major release steps are supported.

The one exception here is hash_equals as mentioned above, the function can be 'present' but non-functional e.g. always throwing. In that case too we want to use the legacy work-around.

@josevalim
Copy link
Member

Sorry, it is still unclear what is going on here. There are two possibilities:

  1. Some functions are not available in some OSes. That part I understand and we can better support it

  2. You moved the detection to runtime but:
    a) using the compile-time fallback should not be an issue in such places anyway
    b) if it happens for Erlang/OTP 24, then it is no longer an officially supported version anyway

I'd like to break this apart, perhaps as two separate PRs? The ones for number 1 above we can definitely merge. Thanks.

@dominicletz
Copy link
Contributor Author

I've created a new PR just with the hash_equals fallback https://github.com/elixir-plug/plug_crypto/pull/45/files

@josevalim
Copy link
Member

Thank you, it has been merged. Please let me know if this is enough to squash iOS issues.

@bcardarella
Copy link

We'll try this today on our end. Thank you

@carson-katri
Copy link

main is working for me on iOS

@josevalim
Copy link
Member

New package is out.

@josevalim josevalim closed this Apr 3, 2025
@josevalim
Copy link
Member

Thanks @dominicletz! If the other patch is ready, let me know, but given that it is about OTP 24, we should be fine. :)

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

Successfully merging this pull request may close these issues.

4 participants