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

core: Fix using magic return codes from encryption code #2203

Open
de-nordic opened this issue Feb 12, 2025 · 0 comments
Open

core: Fix using magic return codes from encryption code #2203

de-nordic opened this issue Feb 12, 2025 · 0 comments

Comments

@de-nordic
Copy link
Collaborator

de-nordic commented Feb 12, 2025

The issue

Currently there are many instances in encryption code and ASN processing where literal hardcoded errors are used, like -1, -2, etc.
This usually happens when negative value is considered an error, recoverable or not, returned from operation.

The problem is that this is a little bit messy, because there is no information on meaning of -1 vs -2, nor reason why some functions only return -1 on any error. Callers just usually check ret to be >=0 for success, and that seems to be enough, so maybe having so many codes is not useful at all?

Solution
Proposed solution would be to define either full range of error identifiers for negative values used, or cut down returned values to SUCCESS and FAIL values and process only these.

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

1 participant