Sfoglia il codice sorgente

Merge pull request #326 from libtom/pr/ccm_process

fixes #323 ccm_process fails to process input buffer longer than 256
(cherry picked from commit 7c4c61d7ef3cbf8ff8ebaad9976224364a688b3c)
Steffen Jaeckel 8 anni fa
parent
commit
368dc60ff3
1 ha cambiato i file con 3 aggiunte e 3 eliminazioni
  1. 3 3
      src/encauth/ccm/ccm_process.c

+ 3 - 3
src/encauth/ccm/ccm_process.c

@@ -24,7 +24,8 @@ int ccm_process(ccm_state *ccm,
                 unsigned char *ct,
                 unsigned char *ct,
                 int direction)
                 int direction)
 {
 {
-   unsigned char  y, z, b;
+   unsigned char z, b;
+   unsigned long y;
    int err;
    int err;
 
 
    LTC_ARGCHK(ccm != NULL);
    LTC_ARGCHK(ccm != NULL);
@@ -44,9 +45,8 @@ int ccm_process(ccm_state *ccm,
    if (ptlen > 0) {
    if (ptlen > 0) {
       LTC_ARGCHK(pt != NULL);
       LTC_ARGCHK(pt != NULL);
       LTC_ARGCHK(ct != NULL);
       LTC_ARGCHK(ct != NULL);
-      y = 0;
 
 
-      for (; y < ptlen; y++) {
+      for (y = 0; y < ptlen; y++) {
          /* increment the ctr? */
          /* increment the ctr? */
          if (ccm->CTRlen == 16) {
          if (ccm->CTRlen == 16) {
             for (z = 15; z > 15-ccm->L; z--) {
             for (z = 15; z > 15-ccm->L; z--) {