We need to call symcrypt_init() each time we enter the API, since we do not know where the API will enter we must call it at every public entry point possible.
This can be avoided by using a crate like ctor that will call before any other function is called, doing this adds the complexity and maintenance of another crate.
Another approach is to refactor the code so that you must init a symcrypt object before calling other method, and all methods would extend from the symcrypt object. This would require refactoring of all of the code.
We need to call
symcrypt_init()each time we enter the API, since we do not know where the API will enter we must call it at every public entry point possible.This can be avoided by using a crate like ctor that will call before any other function is called, doing this adds the complexity and maintenance of another crate.
Another approach is to refactor the code so that you must init a symcrypt object before calling other method, and all methods would extend from the symcrypt object. This would require refactoring of all of the code.