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 lock around static ECC ecc_oid_cache #8051

Merged
merged 1 commit into from
Oct 11, 2024

Conversation

cconlon
Copy link
Member

@cconlon cconlon commented Oct 8, 2024

Description

This PR adds a lock around the static ecc_oid_cache that is used by wc_ecc_get_oid() in wolfcrypt/src/ecc.c when HAVE_OID_ENCODING is defined.

Threading issues around this were showing up in wolfSSL JNI testing, with exceptions/errors similar to the following:

    [junit] JNI Ecc Class
    [junit] 	threadedEccSharedSecretTest
    [junit] com.wolfssl.wolfcrypt.WolfCryptException: ASN oid error, unknown sum id
    [junit] 	eccCurveSizeFromName
    [junit] 	at com.wolfssl.wolfcrypt.Ecc.wc_EccPrivateKeyDecode(Native Method)
    [junit] 	threadedEccSignVerifyTest
    [junit] 	at com.wolfssl.wolfcrypt.Ecc.privateKeyDecode(Unknown Source)
    [junit] 	at com.wolfssl.wolfcrypt.test.EccTest$3.run(EccTest.java:463)
    [junit] 	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
    [junit] 	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
    [junit] 	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
    [junit] 	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
    [junit] 	at java.base/java.lang.Thread.run(Thread.java:1583)

Testing

Tested via existing unit tests, and wolfSSL JNI threaded ECC tests which exposed this issue.

Checklist

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

@cconlon cconlon self-assigned this Oct 8, 2024
@cconlon
Copy link
Member Author

cconlon commented Oct 9, 2024

Retest this please Jenkins

@cconlon cconlon force-pushed the eccOidCacheLock branch 2 times, most recently from da8f5b4 to 2762f23 Compare October 9, 2024 18:16
@cconlon
Copy link
Member Author

cconlon commented Oct 9, 2024

Retest this please Jenkins

1 similar comment
@cconlon
Copy link
Member Author

cconlon commented Oct 10, 2024

Retest this please Jenkins

@cconlon cconlon assigned wolfSSL-Bot and unassigned cconlon Oct 10, 2024
@douzzer douzzer merged commit caf9201 into wolfSSL:master Oct 11, 2024
140 checks passed
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.

3 participants