浏览代码

cosmetic: move some lines

Thomas Waldmann 8 年之前
父节点
当前提交
e7228fa3a4
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 3 3
      src/borg/crypto/low_level.pyx

+ 3 - 3
src/borg/crypto/low_level.pyx

@@ -373,9 +373,9 @@ cdef class AES256_CTR_BASE:
         if isinstance(iv, int):
         if isinstance(iv, int):
             iv = iv.to_bytes(self.iv_len, byteorder='big')
             iv = iv.to_bytes(self.iv_len, byteorder='big')
         assert isinstance(iv, bytes) and len(iv) == self.iv_len
         assert isinstance(iv, bytes) and len(iv) == self.iv_len
-        self.blocks = 0  # how many AES blocks got encrypted with this IV?
         for i in range(self.iv_len):
         for i in range(self.iv_len):
             self.iv[i] = iv[i]
             self.iv[i] = iv[i]
+        self.blocks = 0  # how many AES blocks got encrypted with this IV?
 
 
     def next_iv(self):
     def next_iv(self):
         # call this after encrypt() to get the next iv (int) for the next encrypt() call
         # call this after encrypt() to get the next iv (int) for the next encrypt() call
@@ -645,9 +645,9 @@ cdef class _AEAD_BASE:
         if isinstance(iv, int):
         if isinstance(iv, int):
             iv = iv.to_bytes(self.iv_len, byteorder='big')
             iv = iv.to_bytes(self.iv_len, byteorder='big')
         assert isinstance(iv, bytes) and len(iv) == self.iv_len
         assert isinstance(iv, bytes) and len(iv) == self.iv_len
-        self.blocks = 0  # number of cipher blocks encrypted with this IV
         for i in range(self.iv_len):
         for i in range(self.iv_len):
             self.iv[i] = iv[i]
             self.iv[i] = iv[i]
+        self.blocks = 0  # number of cipher blocks encrypted with this IV
 
 
     def next_iv(self):
     def next_iv(self):
         # call this after encrypt() to get the next iv (int) for the next encrypt() call
         # call this after encrypt() to get the next iv (int) for the next encrypt() call
@@ -809,9 +809,9 @@ cdef class AES:
         if isinstance(iv, int):
         if isinstance(iv, int):
             iv = iv.to_bytes(self.iv_len, byteorder='big')
             iv = iv.to_bytes(self.iv_len, byteorder='big')
         assert isinstance(iv, bytes) and len(iv) == self.iv_len
         assert isinstance(iv, bytes) and len(iv) == self.iv_len
-        self.blocks = 0  # number of cipher blocks encrypted with this IV
         for i in range(self.iv_len):
         for i in range(self.iv_len):
             self.iv[i] = iv[i]
             self.iv[i] = iv[i]
+        self.blocks = 0  # number of cipher blocks encrypted with this IV
 
 
     def next_iv(self):
     def next_iv(self):
         # call this after encrypt() to get the next iv (int) for the next encrypt() call
         # call this after encrypt() to get the next iv (int) for the next encrypt() call