8000 gh-87138: convert blake2b/2s types to heap types by picnixz · Pull Request #127669 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content
8000

gh-87138: convert blake2b/2s types to heap types #127669

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

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Reduce diff
  • Loading branch information
picnixz authored Dec 7, 2024
commit 9b4074286125775eb8182d7f2b12e08ddfa93b37
30 changes: 15 additions & 15 deletions Modules/blake2module.c
Original file line number Diff line number Diff line change
Expand Up @@ -897,40 +897,40 @@ static PyGetSetDef py_blake2b_getsetters[] = {
};

static int
py_blake2_clear(PyObject *self)
py_blake2_clear(PyObject *op)
{
Blake2Object *obj = (Blake2Object *)self;
Blake2Object *self = (Blake2Object *)op;
// The initialization function uses PyObject_New() but explicitly
// initializes the HACL* internal state to NULL before allocating
// it. If an error occurs in the constructor, we should only free
// states that were allocated (i.e. that are not NULL).
switch (obj->impl) {
switch (self->impl) {
#if HACL_CAN_COMPILE_SIMD256
case Blake2b_256:
if (obj->blake2b_256_state != NULL) {
Hacl_Hash_Blake2b_Simd256_free(obj->blake2b_256_state);
obj->blake2b_256_state = NULL;
if (self->blake2b_256_state != NULL) {
Hacl_Hash_Blake2b_Simd256_free(self->blake2b_256_state);
self->blake2b_256_state = NULL;
}
break;
#endif
#if HACL_CAN_COMPILE_SIMD128
case Blake2s_128:
if (obj->blake2s_128_state != NULL) {
Hacl_Hash_Blake2s_Simd128_free(obj->blake2s_128_state);
obj->blake2s_128_state = NULL;
if (self->blake2s_128_state != NULL) {
Hacl_Hash_Blake2s_Simd128_free(self->blake2s_128_state);
self->blake2s_128_state = NULL;
}
break;
#endif
case Blake2b:
if (obj->blake2b_state != NULL) {
Hacl_Hash_Blake2b_free(obj->blake2b_state);
obj->blake2b_state = NULL;
if (self->blake2b_state != NULL) {
Hacl_Hash_Blake2b_free(self->blake2b_state);
self->blake2b_state = NULL;
}
break;
case Blake2s:
if (obj->blake2s_state != NULL) {
Hacl_Hash_Blake2s_free(obj->blake2s_state);
obj->blake2s_state = NULL;
if (self->blake2s_state != NULL) {
Hacl_Hash_Blake2s_free(self->blake2s_state);
self->blake2s_state = NULL;
}
break;
default:
Expand Down
Loading
0