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

verify_fun/3 receive cert as binary instead of OTPCertificate record #8832

Open
benbro opened this issue Sep 20, 2024 · 1 comment
Open

verify_fun/3 receive cert as binary instead of OTPCertificate record #8832

benbro opened this issue Sep 20, 2024 · 1 comment
Assignees
Labels
bug Issue is reported as a bug team:PS Assigned to OTP team PS

Comments

@benbro
Copy link
Contributor

benbro commented Sep 20, 2024

Describe the bug
public_key.erl calls pubkey_cert:apply_fun/5 in two places.
Line 1713:

try pubkey_cert:apply_fun(VerifyFun, Cert#cert.otp, Cert#cert.der, Reason, Userstat0) of

Line 2422:

try pubkey_cert:apply_fun(VerifyFun, OtpCert, DerCert, Reason, UserState0) of

pubkey_cert:apply_fun/5 reverses the order of OtpCert and DerCert and calls the user supplied verify_fun with DerCert instead of OtpCert:

apply_fun(Fun, DerCert, OtpCert, Result, UserState) ->
    if is_function(Fun, 4) ->
            Fun(OtpCert, DerCert, Result, UserState);
       is_function(Fun, 3) ->
            Fun(OtpCert, Result, UserState)
    end.

Affected versions
27.1

@benbro benbro added the bug Issue is reported as a bug label Sep 20, 2024
@IngelaAndin IngelaAndin added the team:PS Assigned to OTP team PS label Sep 20, 2024
@IngelaAndin IngelaAndin self-assigned this Sep 20, 2024
@IngelaAndin
Copy link
Contributor

Well actual it called forma third place most of the time where the order is correct, but good catch we will fix.

IngelaAndin added a commit to IngelaAndin/otp that referenced this issue Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is reported as a bug team:PS Assigned to OTP team PS
Projects
None yet
Development

No branches or pull requests

2 participants