Kaynağa Gözat

* merged with mainline

Michael Vogt 20 yıl önce
ebeveyn
işleme
67fefcfec1
4 değiştirilmiş dosya ile 43 ekleme ve 27 silme
  1. 4 4
      apt-pkg/contrib/sha256.cc
  2. 26 16
      debian/changelog
  3. 6 7
      ftparchive/cachedb.cc
  4. 7 0
      test/hash.cc

+ 4 - 4
apt-pkg/contrib/sha256.cc

@@ -61,10 +61,10 @@ static inline u32 Maj(u32 x, u32 y, u32 z)
 
 static inline void LOAD_OP(int I, u32 *W, const u8 *input)
 {
-	W[I] = (  ((u32) input[I + 0] << 24)
-		| ((u32) input[I + 1] << 16)
-		| ((u32) input[I + 2] << 8)
-		| ((u32) input[I + 3]));
+	W[I] = (  ((u32) input[I * 4 + 0] << 24)
+		| ((u32) input[I * 4 + 1] << 16)
+		| ((u32) input[I * 4 + 2] << 8)
+		| ((u32) input[I * 4 + 3]));
 }
 
 static inline void BLEND_OP(int I, u32 *W)

+ 26 - 16
debian/changelog

@@ -1,20 +1,30 @@
-apt (0.6.44.2) unstable; urgency=low
+apt (0.6.45) unstable; urgency=low
 
-  * apt-pkg/depcache.cc:
-    - added Debug::pkgDepCache::AutoInstall (thanks to infinity)
-  * apt-pkg/acquire-item.cc:
-    - fix missing chmod() in the new aquire code 
-      (thanks to Bastian Blank, Closes: #367425)
-  * merged from 
-    http://www.perrier.eu.org/debian/packages/d-i/level4/apt-main:
-    * sk.po: Completed to 512t
-    * eu.po: Completed to 512t
-    * fr.po: Completed to 512t
-    * sv.po: Completed to 512t
-    * Update all PO and the POT. Gives 506t6f for formerly
-      complete translations
-
- -- Michael Vogt <mvo@debian.org>  Wed, 14 Jun 2006 12:00:57 +0200
+  * apt-pkg/contrib/sha256.cc:
+    - fixed the sha256 generation (closes: #378183)
+  * ftparchive/cachedb.cc:
+    - applied patch from ajt to fix Clean() function
+      (closes: #379576)
+
+ --
+
+apt  (0.6.44.2) unstable; urgency=low 
+  
+   * apt-pkg/depcache.cc:
+     - added Debug::pkgDepCache::AutoInstall (thanks to infinity)
+   * apt-pkg/acquire-item.cc:
+     - fix missing chmod() in the new aquire code
+       (thanks to Bastian Blank, Closes: #367425)
+   * merged from
+     http://www.perrier.eu.org/debian/packages/d-i/level4/apt-main:
+     * sk.po: Completed to 512t
+     * eu.po: Completed to 512t
+     * fr.po: Completed to 512t
+     * sv.po: Completed to 512t
+     * Update all PO and the POT. Gives 506t6f for formerly
+       complete translations
+
+ -- Michael Vogt <mvo@debian.org>  Wed, 14 Jun 2006 12:00:57 +0200 
 
 apt (0.6.44.1-0.1) unstable; urgency=low
 

+ 6 - 7
ftparchive/cachedb.cc

@@ -453,15 +453,14 @@ bool CacheDB::Clean()
    memset(&Data,0,sizeof(Data));
    while ((errno = Cursor->c_get(Cursor,&Key,&Data,DB_NEXT)) == 0)
    {
-      const char *Colon = (char *)Key.data;
-      for (; Colon != (char *)Key.data+Key.size && *Colon != ':'; Colon++);
-      if ((char *)Key.data+Key.size - Colon > 2)
+      const char *Colon = (char*)memrchr(Key.data, ':', Key.size);
+      if (Colon)
       {
-	 if (stringcmp((char *)Key.data,Colon,"st") == 0 ||
-	     stringcmp((char *)Key.data,Colon,"cn") == 0 ||
-	     stringcmp((char *)Key.data,Colon,"cl") == 0)
+         if (stringcmp(Colon + 1, (char *)Key.data+Key.size,"st") == 0 ||
+             stringcmp(Colon + 1, (char *)Key.data+Key.size,"cl") == 0 ||
+             stringcmp(Colon + 1, (char *)Key.data+Key.size,"cn") == 0)
 	 {
-	    if (FileExists(string(Colon+1,(const char *)Key.data+Key.size)) == true)
+            if (FileExists(string((const char *)Key.data,Colon)) == true)
 		continue;	     
 	 }
       }

+ 7 - 0
test/hash.cc

@@ -1,5 +1,6 @@
 #include <apt-pkg/md5.h>
 #include <apt-pkg/sha1.h>
+#include <apt-pkg/sha256.h>
 #include <apt-pkg/strutl.h>
 #include <iostream>
 
@@ -57,6 +58,12 @@ int main()
 		      "d174ab98d277d9f5a5611c2c9f419d9f");
    Test<MD5Summation>("12345678901234567890123456789012345678901234567890123456789012345678901234567890",
 		      "57edf4a22be3c955ac49da2e2107b67a");
+
+   // SHA-256, From FIPS 180-2
+   Test<SHA256Summation>("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", 
+			 "248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1");
+   
+
    return 0; 
 }