Skip to content

Commit 63bc38c

Browse files
committed
no need to actually change py_hashentry_t
1 parent 4f8d6f1 commit 63bc38c

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

Modules/_hashopenssl.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ typedef struct {
9494
const char *ossl_name;
9595
int ossl_nid;
9696
int refcnt;
97-
PY_EVP_MD *evp_md;
98-
PY_EVP_MD *evp_md_nosecurity;
97+
PY_EVP_MD *evp;
98+
PY_EVP_MD *evp_nosecurity;
9999
} py_hashentry_t;
100100

101101
// Fundamental to TLS, assumed always present in any libcrypto:
@@ -202,13 +202,13 @@ static void
202202
py_hashentry_t_destroy_value(void *entry) {
203203
py_hashentry_t *h = (py_hashentry_t *)entry;
204204
if (--(h->refcnt) == 0) {
205-
if (h->evp_md != NULL) {
206-
PY_EVP_MD_free(h->evp_md);
207-
h->evp_md = NULL;
205+
if (h->evp != NULL) {
206+
PY_EVP_MD_free(h->evp);
207+
h->evp = NULL;
208208
}
209-
if (h->evp_md_nosecurity != NULL) {
210-
PY_EVP_MD_free(h->evp_md_nosecurity);
211-
h->evp_md_nosecurity = NULL;
209+
if (h->evp_nosecurity != NULL) {
210+
PY_EVP_MD_free(h->evp_nosecurity);
211+
h->evp_nosecurity = NULL;
212212
}
213213
PyMem_Free(entry);
214214
}
@@ -419,26 +419,26 @@ get_openssl_evp_md_by_utf8name(PyObject *module, const char *name,
419419
case Py_ht_evp:
420420
case Py_ht_mac:
421421
case Py_ht_pbkdf2:
422-
digest = FT_ATOMIC_LOAD_PTR_RELAXED(entry->evp_md);
422+
digest = FT_ATOMIC_LOAD_PTR_RELAXED(entry->evp);
423423
if (digest == NULL) {
424424
digest = PY_EVP_MD_fetch(entry->ossl_name, NULL);
425425
#ifdef Py_GIL_DISABLED
426426
// exchange just in case another thread did same thing at same time
427-
other_digest = _Py_atomic_exchange_ptr(&entry->evp_md, (void *)digest);
427+
other_digest = _Py_atomic_exchange_ptr(&entry->evp, (void *)digest);
428428
#else
429-
entry->evp_md = digest;
429+
entry->evp = digest;
430430
#endif
431431
}
432432
break;
433433
case Py_ht_evp_nosecurity:
434-
digest = FT_ATOMIC_LOAD_PTR_RELAXED(entry->evp_md_nosecurity);
434+
digest = FT_ATOMIC_LOAD_PTR_RELAXED(entry->evp_nosecurity);
435435
if (digest == NULL) {
436436
digest = PY_EVP_MD_fetch(entry->ossl_name, "-fips");
437437
#ifdef Py_GIL_DISABLED
438438
// exchange just in case another thread did same thing at same time
439-
other_digest = _Py_atomic_exchange_ptr(&entry->evp_md_nosecurity, (void *)digest);
439+
other_digest = _Py_atomic_exchange_ptr(&entry->evp_nosecurity, (void *)digest);
440440
#else
441-
entry->evp_md_nosecurity = digest;
441+
entry->evp_nosecurity = digest;
442442
#endif
443443
}
444444
break;

0 commit comments

Comments
 (0)