Commit 720f2cc
authored
Fix Python attributes (#103)
* Fix typo error message
Signed-off-by: Iyán Méndez Veiga <[email protected]>
* Populate attributes in Signature and KeyEncapsulation
ctypes.Structure.__init__() initializes attributes using the
list _fields_. However, these are empty because this happens before
native().OQS_SIG_new() or native().OQS_KEM_new() are called.
The dict self.details was showing correct values by reading and
decoding directly from self._sig/self._kem. However, all the other
public attributes like self.method_name, self.alg_version or the keys
and signature lengths were incorrect. Either None or 0 depending on the
ctype defined in _fields_.
Instead, let's manually populate all relevant attributes from _fields_
after OQS_SIG_new() or OQS_KEM_new() are called, and let's use those
values to create the dict self.details.
Signed-off-by: Iyán Méndez Veiga <[email protected]>
* Add unit test to check python attributes
Signed-off-by: Iyán Méndez Veiga <[email protected]>
---------
Signed-off-by: Iyán Méndez Veiga <[email protected]>1 parent dc1f0a9 commit 720f2cc
3 files changed
+73
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
249 | 258 | | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
258 | 267 | | |
259 | 268 | | |
260 | 269 | | |
| |||
412 | 421 | | |
413 | 422 | | |
414 | 423 | | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
415 | 434 | | |
416 | | - | |
417 | | - | |
418 | | - | |
419 | | - | |
420 | | - | |
421 | | - | |
422 | | - | |
423 | | - | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
424 | 443 | | |
425 | 444 | | |
426 | 445 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
71 | 90 | | |
72 | 91 | | |
73 | 92 | | |
74 | 93 | | |
75 | 94 | | |
76 | 95 | | |
77 | 96 | | |
78 | | - | |
| 97 | + | |
79 | 98 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
118 | 135 | | |
119 | 136 | | |
120 | 137 | | |
121 | 138 | | |
122 | 139 | | |
123 | 140 | | |
124 | 141 | | |
125 | | - | |
| 142 | + | |
126 | 143 | | |
0 commit comments