Răsfoiți Sursa

OTPCalculator: num_blocks should be size_t

ambrop7 14 ani în urmă
părinte
comite
c8c4bb72aa
2 a modificat fișierele cu 2 adăugiri și 2 ștergeri
  1. 1 1
      security/OTPCalculator.c
  2. 1 1
      security/OTPCalculator.h

+ 1 - 1
security/OTPCalculator.c

@@ -84,7 +84,7 @@ otp_t * OTPCalculator_Generate (OTPCalculator *calc, uint8_t *key, uint8_t *iv,
     BEncryption_Init(&encryptor, BENCRYPTION_MODE_ENCRYPT, calc->cipher, key);
     
     // encrypt zero blocks
-    for (int i = 0; i < calc->num_blocks; i++) {
+    for (size_t i = 0; i < calc->num_blocks; i++) {
         BEncryption_Encrypt(&encryptor, zero, (uint8_t *)calc->data + i * calc->block_size, calc->block_size, iv_work);
     }
     

+ 1 - 1
security/OTPCalculator.h

@@ -49,7 +49,7 @@ typedef struct {
     int num_otps;
     int cipher;
     int block_size;
-    int num_blocks;
+    size_t num_blocks;
     otp_t *data;
 } OTPCalculator;