22
22
#include "_hashopenssl.h"
23
23
24
24
25
- #include <openssl/hmac.h>
26
25
27
26
typedef struct hmacopenssl_state {
28
27
PyTypeObject * HmacType ;
29
28
} hmacopenssl_state ;
30
29
30
+ #include <openssl/hmac.h>
31
31
32
32
typedef struct {
33
33
PyObject_HEAD
@@ -39,7 +39,7 @@ typedef struct {
39
39
#include "clinic/_hmacopenssl.c.h"
40
40
/*[clinic input]
41
41
module _hmacopenssl
42
- class _hmacopenssl.HMAC "HmacObject *" "PyModule_GetState(module)->HmacType"
42
+ class _hmacopenssl.HMAC "HmacObject *" "((hmacopenssl_state *) PyModule_GetState(module) )->HmacType"
43
43
[clinic start generated code]*/
44
44
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=204b7f45847f57b4]*/
45
45
@@ -71,7 +71,7 @@ _hmacopenssl_new_impl(PyObject *module, Py_buffer *key,
71
71
return NULL ;
72
72
}
73
73
74
- /* name mut be lowercase */
74
+ /* name must be lowercase */
75
75
for (int i = 0 ; digestmod [i ]; i ++ ) {
76
76
if (
77
77
((digestmod [i ] < 'a' ) || (digestmod [i ] > 'z' ))
@@ -383,7 +383,8 @@ hmacopenssl_exec(PyObject *m) {
383
383
* on what hashes are supported rather than listing many
384
384
* and having some unsupported. Only init appropriate
385
385
* constants. */
386
- PyObject * temp ;
386
+ PyObject * temp = NULL ;
387
+ hmacopenssl_state * state ;
387
388
388
389
temp = PyType_FromSpec (& HmacType_spec );
389
390
if (temp == NULL ) {
@@ -394,6 +395,9 @@ hmacopenssl_exec(PyObject *m) {
394
395
goto fail ;
395
396
}
396
397
398
+ state = PyModule_GetState (m );
399
+ state -> HmacType = (PyTypeObject * )temp ;
400
+
397
401
return 0 ;
398
402
399
403
fail :
0 commit comments