Skip to content

Commit

Permalink
Fix for cffi warning (continue)
Browse files Browse the repository at this point in the history
  • Loading branch information
Legrandin committed Oct 17, 2016
1 parent 696d164 commit 9b12b8d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions lib/Crypto/Cipher/_mode_gcm.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,8 @@ def __init__(self, subkey):
self._exp_key = SmartPointer(self._exp_key.get(),
_raw_galois_lib.ghash_destroy)

# create_string_buffer always returns a string of zeroes
self._last_y = create_string_buffer(16)
for i in xrange(16):
self._last_y[i] = bchr(0)

def update(self, block_data):
assert len(block_data) % 16 == 0
Expand Down
4 changes: 2 additions & 2 deletions lib/Crypto/Util/_raw_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def c_size_t(x):
return x

def create_string_buffer(size):
"""Allocate the given amount of bytes"""
"""Allocate the given amount of bytes (initially set to 0)"""
return ffi.new("uint8_t[]", size)

def get_c_string(c_string):
Expand All @@ -86,7 +86,7 @@ def get(self):
def address_of(self):
return self._pp

Array = ffi.new("char[1]").__class__.__bases__
Array = ffi.new("uint8_t[1]").__class__.__bases__

backend = "cffi"

Expand Down

0 comments on commit 9b12b8d

Please sign in to comment.