Diff of /pwsafe/pwsafe/corelib/PWSrand.cpp [b8af7d] .. [d6386d]  Maximize  Restore

  Switch to side-by-side view

--- a/pwsafe/pwsafe/corelib/PWSrand.cpp
+++ b/pwsafe/pwsafe/corelib/PWSrand.cpp
@@ -80,8 +80,10 @@
   SHA256 s;
   s.Update(K, sizeof(K));
   s.Final(R);
-  unsigned int *Kp = (unsigned int *)K;
-  unsigned int *Rp = (unsigned int *)R;
+  /// problem: Kp is a 32 bit pointer to K, which is declared as unsigned char.
+  /// this in turn is 1 byte long and does not start aligned. Hence, Kp[0] is an access to unaliged data
+  unsigned __unaligned int *Kp = (unsigned int *)K;
+  unsigned __unaligned int *Rp = (unsigned int *)R;
   const int N = SHA256::HASHLEN/sizeof(unsigned int);
   
   Kp[0]++;

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks