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

the library is not thread-safe #62

Closed
quhaige opened this issue Aug 29, 2017 · 2 comments
Closed

the library is not thread-safe #62

quhaige opened this issue Aug 29, 2017 · 2 comments

Comments

@quhaige
Copy link

quhaige commented Aug 29, 2017

We are using the lib inside a mulitply-threads context and found it is not thread-safe. There are global variables are using to optimized some internal parameters delivery.
For instance:
static state_t* state;
static uint8_t RoundKey[keyExpSize];
static const uint8_t* Key;
After remove them, lib are working propertly under mulitply-threads.

@kokke
Copy link
Owner

kokke commented Aug 29, 2017

Hi @quhaige thanks for your interest in the project :)

You are right that static variables do not work well with multithreading.
An easy fix is to move all variables inside a struct and pass it to the encryption/decryption functions.

Check out this pull request with the same goal:
#9

@quhaige
Copy link
Author

quhaige commented Aug 29, 2017

thanks, wish u have good day^^

@quhaige quhaige closed this as completed Aug 29, 2017
@kokke kokke mentioned this issue Dec 4, 2017
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

No branches or pull requests

2 participants