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

RandomIdGenerator is not thread safe #18

Closed
serac opened this issue Mar 19, 2015 · 1 comment
Closed

RandomIdGenerator is not thread safe #18

serac opened this issue Mar 19, 2015 · 1 comment
Labels
bug

Comments

@serac
Copy link
Member

@serac serac commented Mar 19, 2015

IdGenerators are intended to be thread safe, yet this component is not due to the use of org.bouncycastle.crypto.prng.drbg.HashSP800DRBG, which is not thread safe. Errors like the following may arise under moderate concurrency:

Caused by: java.lang.ArrayIndexOutOfBoundsException: 4
    at org.bouncycastle.crypto.digests.GeneralDigest.update(Unknown Source)
    at org.bouncycastle.crypto.digests.GeneralDigest.update(Unknown Source)
    at org.bouncycastle.crypto.prng.drbg.HashSP800DRBG.doHash(Unknown Source)
    at org.bouncycastle.crypto.prng.drbg.HashSP800DRBG.hashgen(Unknown Source)
    at org.bouncycastle.crypto.prng.drbg.HashSP800DRBG.generate(Unknown Source)
    at org.cryptacular.generator.RandomIdGenerator.generate(RandomIdGenerator.java:69)
@serac serac added the bug label Mar 19, 2015
serac added a commit that referenced this issue Mar 19, 2015
Cannot use shared instance of HashSP800DRBG since it uses a shared instance
of Digest under the hood, making it not thread safe. Add concurrency test
coverage.
serac added a commit that referenced this issue Mar 19, 2015
Cannot use shared instance of HashSP800DRBG since it uses a shared instance
of Digest under the hood, making it not thread safe. Add concurrency test
coverage.
@serac
Copy link
Member Author

@serac serac commented Mar 19, 2015

Fixed in b112a9b.

@serac serac closed this Mar 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant