Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
c71ec8ae
Commit
c71ec8ae
authored
Sep 08, 2016
by
Christian Heimes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sha3: let's keep it simple and always allocate enough extra space for uint64_t[20].
parent
c49a516a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
3 deletions
+2
-3
Modules/_sha3/sha3module.c
Modules/_sha3/sha3module.c
+2
-3
No files found.
Modules/_sha3/sha3module.c
View file @
c71ec8ae
...
...
@@ -114,7 +114,7 @@
#endif
#define SHA3_MAX_DIGESTSIZE 64
/* 64 Bytes (512 Bits) for 224 to 512 */
#define SHA3_LANESIZE
96
/* ExtractLane needs an extra 96 bytes
*/
#define SHA3_LANESIZE
(20 * 8)
/* ExtractLane needs max uint64_t[20] extra.
*/
#define SHA3_state Keccak_HashInstance
#define SHA3_init Keccak_HashInitialize
#define SHA3_process Keccak_HashUpdate
...
...
@@ -605,8 +605,7 @@ _SHAKE_digest(SHA3object *self, unsigned long digestlen, int hex)
/* ExtractLane needs at least SHA3_MAX_DIGESTSIZE + SHA3_LANESIZE and
* SHA3_LANESIZE extra space.
*/
digest
=
(
unsigned
char
*
)
PyMem_Malloc
(
SHA3_LANESIZE
+
((
digestlen
>
SHA3_MAX_DIGESTSIZE
)
?
digestlen
:
SHA3_MAX_DIGESTSIZE
));
digest
=
(
unsigned
char
*
)
PyMem_Malloc
(
digestlen
+
SHA3_LANESIZE
);
if
(
digest
==
NULL
)
{
return
PyErr_NoMemory
();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment