Martin Prikryl 15 years ago
parent
commit
1c587e0855
80 changed files with 387 additions and 3250 deletions
  1. 4 4
      Console.rc
  2. 4 4
      DragExt.rc
  3. 4 4
      DragExt64.rc
  4. 4 4
      WinSCP.rc
  5. 19 6
      core/Common.cpp
  6. 19 2
      core/HierarchicalStorage.cpp
  7. 2 0
      core/HierarchicalStorage.h
  8. 0 2
      core/SessionInfo.cpp
  9. 15 15
      core/Terminal.cpp
  10. 40 46
      forms/Login.cpp
  11. 4 8
      forms/Login.h
  12. 6 1
      forms/ScpCommander.cpp
  13. 25 0
      openssl/ACKNOWLEDGMENTS
  14. 6 6
      openssl/crypto/aes/aes_wrap.c
  15. 1 2
      openssl/crypto/asn1/a_int.c
  16. 1 2
      openssl/crypto/asn1/n_pkey.c
  17. 1 2
      openssl/crypto/asn1/t_crl.c
  18. 1 2
      openssl/crypto/asn1/tasn_dec.c
  19. 2 2
      openssl/crypto/asn1/x_x509.c
  20. 0 2
      openssl/crypto/bio/bf_nbio.c
  21. 2 2
      openssl/crypto/bio/bio_lib.c
  22. 2 3
      openssl/crypto/bio/bss_acpt.c
  23. 2 1
      openssl/crypto/bn/bn_exp2.c
  24. 2 7
      openssl/crypto/bn/bn_mul.c
  25. 2 2
      openssl/crypto/buildinf.h
  26. 1 1
      openssl/crypto/conf/conf_api.c
  27. 1 12
      openssl/crypto/conf/conf_def.c
  28. 11 9
      openssl/crypto/cryptlib.c
  29. 1 2
      openssl/crypto/dsa/dsa_gen.c
  30. 1 1
      openssl/crypto/dsa/dsa_ossl.c
  31. 1 2
      openssl/crypto/evp/encode.c
  32. 1 0
      openssl/crypto/evp/evp_enc.c
  33. 2 2
      openssl/crypto/evp/m_sigver.c
  34. 3 0
      openssl/crypto/evp/p_lib.c
  35. 1 1
      openssl/crypto/evp/p_sign.c
  36. 1 1
      openssl/crypto/evp/p_verify.c
  37. 2 0
      openssl/crypto/evp/pmeth_lib.c
  38. 0 3
      openssl/crypto/hmac/hmac.c
  39. 11 4
      openssl/crypto/md32_common.h
  40. 9 3
      openssl/crypto/ocsp/ocsp_ht.c
  41. 0 2
      openssl/crypto/ocsp/ocsp_prn.c
  42. 3 3
      openssl/crypto/opensslv.h
  43. 0 2
      openssl/crypto/pem/pem_lib.c
  44. 3 7
      openssl/crypto/pem/pvkfmt.c
  45. 22 16
      openssl/crypto/pkcs12/p12_key.c
  46. 0 3
      openssl/crypto/pkcs7/pk7_doit.c
  47. 0 2
      openssl/crypto/pkcs7/pk7_lib.c
  48. 2 3
      openssl/crypto/pqueue/pqueue.c
  49. 7 4
      openssl/crypto/rand/md_rand.c
  50. 0 1969
      openssl/crypto/ripemd/asm/rm_win32
  51. 1 1
      openssl/crypto/rsa/rsa_eay.c
  52. 27 26
      openssl/crypto/stack/safestack.h
  53. 0 38
      openssl/crypto/whrlpool/whrlpool.h
  54. 0 655
      openssl/crypto/whrlpool/wp_block.c
  55. 0 264
      openssl/crypto/whrlpool/wp_dgst.c
  56. 0 3
      openssl/crypto/whrlpool/wp_locl.h
  57. 1 0
      openssl/crypto/x509/x509.h
  58. 1 1
      openssl/crypto/x509/x509_vfy.c
  59. 1 0
      openssl/crypto/x509/x_all.c
  60. 1 2
      openssl/crypto/x509v3/pcy_tree.c
  61. 0 1
      openssl/crypto/x509v3/v3_ncons.c
  62. 0 5
      openssl/ssl/d1_pkt.c
  63. 0 7
      openssl/ssl/s23_lib.c
  64. 0 2
      openssl/ssl/s2_srvr.c
  65. 4 0
      openssl/ssl/s3_clnt.c
  66. 1 2
      openssl/ssl/s3_enc.c
  67. 15 3
      openssl/ssl/s3_srvr.c
  68. 1 2
      openssl/ssl/ssl_asn1.c
  69. 2 4
      openssl/ssl/ssl_ciph.c
  70. 2 13
      openssl/ssl/ssl_lib.c
  71. 4 10
      openssl/ssl/t1_enc.c
  72. 53 27
      openssl/ssl/t1_lib.c
  73. 6 0
      packages/filemng/CustomDirView.pas
  74. 0 1
      packages/filemng/DirImg.rc
  75. 2 0
      packages/my/NortonLikeListView.hpp
  76. 8 0
      packages/my/NortonLikeListView.pas
  77. 1 1
      release/winscp.u3i
  78. 1 1
      resource/TextsCore1.rc
  79. 1 0
      windows/ConsoleRunner.cpp
  80. 3 0
      windows/GUITools.cpp

+ 4 - 4
Console.rc

@@ -1,6 +1,6 @@
 1 VERSIONINFO
-FILEVERSION 3,0,0,125
-PRODUCTVERSION 3,0,0,125
+FILEVERSION 3,0,0,126
+PRODUCTVERSION 3,0,0,126
 FILEOS 0x4
 FILETYPE 0x1
 {
@@ -10,13 +10,13 @@ FILETYPE 0x1
         {
             VALUE "CompanyName", "Martin Prikryl\0"
             VALUE "FileDescription", "Console interface for WinSCP\0"
-            VALUE "FileVersion", "3.0.0.125\0"
+            VALUE "FileVersion", "3.0.0.126\0"
             VALUE "InternalName", "console\0"
             VALUE "LegalCopyright", "(c) 2000-2010 Martin Prikryl\0"
             VALUE "LegalTrademarks", "\0"
             VALUE "OriginalFilename", "winscp.com\0"
             VALUE "ProductName", "WinSCP\0"
-            VALUE "ProductVersion", "4.3.0.0\0"
+            VALUE "ProductVersion", "4.3.1.0\0"
             VALUE "ReleaseType", "beta\0"
             VALUE "WWW", "http://winscp.net/\0"
         }

+ 4 - 4
DragExt.rc

@@ -1,6 +1,6 @@
 1 VERSIONINFO
-FILEVERSION 1,1,9,117
-PRODUCTVERSION 1,1,9,117
+FILEVERSION 1,1,9,118
+PRODUCTVERSION 1,1,9,118
 FILEOS 0x4
 FILETYPE 0x2
 {
@@ -10,13 +10,13 @@ FILETYPE 0x2
         {
             VALUE "CompanyName", "Martin Prikryl\0"
             VALUE "FileDescription", "Drag&Drop shell extension for WinSCP (32-bit)\0"
-            VALUE "FileVersion", "1.1.9.117\0"
+            VALUE "FileVersion", "1.1.9.118\0"
             VALUE "InternalName", "dragext32\0"
             VALUE "LegalCopyright", "(c) 2000-2010 Martin Prikryl\0"
             VALUE "LegalTrademarks", "\0"
             VALUE "OriginalFilename", "dragext.dll\0"
             VALUE "ProductName", "WinSCP\0"
-            VALUE "ProductVersion", "4.3.0.0\0"
+            VALUE "ProductVersion", "4.3.1.0\0"
             VALUE "ReleaseType", "beta\0"
             VALUE "WWW", "http://winscp.net/\0"
         }

+ 4 - 4
DragExt64.rc

@@ -1,6 +1,6 @@
 1 VERSIONINFO
-FILEVERSION 1,1,9,117
-PRODUCTVERSION 1,1,9,117
+FILEVERSION 1,1,9,118
+PRODUCTVERSION 1,1,9,118
 FILEOS 0x4
 FILETYPE 0x2
 {
@@ -10,13 +10,13 @@ FILETYPE 0x2
         {
             VALUE "CompanyName", "Martin Prikryl\0"
             VALUE "FileDescription", "Drag&Drop shell extension for WinSCP (64-bit)\0"
-            VALUE "FileVersion", "1.1.9.117\0"
+            VALUE "FileVersion", "1.1.9.118\0"
             VALUE "InternalName", "dragext64\0"
             VALUE "LegalCopyright", "(c) 2000-2010 Martin Prikryl\0"
             VALUE "LegalTrademarks", "\0"
             VALUE "OriginalFilename", "dragext64.dll\0"
             VALUE "ProductName", "WinSCP\0"
-            VALUE "ProductVersion", "4.3.0.0\0"
+            VALUE "ProductVersion", "4.3.1.0\0"
             VALUE "ReleaseType", "beta\0"
             VALUE "WWW", "http://winscp.net/\0"
         }

+ 4 - 4
WinSCP.rc

@@ -1,6 +1,6 @@
 1 VERSIONINFO
-FILEVERSION 4,3,0,1029
-PRODUCTVERSION 4,3,0,1029
+FILEVERSION 4,3,1,1099
+PRODUCTVERSION 4,3,1,1099
 FILEOS 0x4
 FILETYPE 0x1
 {
@@ -10,13 +10,13 @@ FILETYPE 0x1
         {
             VALUE "CompanyName", "Martin Prikryl\0"
             VALUE "FileDescription", "WinSCP: SFTP, FTP and SCP client\0"
-            VALUE "FileVersion", "4.3.0.1029\0"
+            VALUE "FileVersion", "4.3.1.1099\0"
             VALUE "InternalName", "winscp\0"
             VALUE "LegalCopyright", "(c) 2000-2010 Martin Prikryl\0"
             VALUE "LegalTrademarks", "\0"
             VALUE "OriginalFilename", "winscp.exe\0"
             VALUE "ProductName", "WinSCP\0"
-            VALUE "ProductVersion", "4.3.0.0\0"
+            VALUE "ProductVersion", "4.3.1.0\0"
             VALUE "ReleaseType", "beta\0"
             VALUE "WWW", "http://winscp.net/\0"
         }

+ 19 - 6
core/Common.cpp

@@ -814,6 +814,7 @@ static bool __fastcall IsDateInDST(const TDateTime & DateTime)
     unsigned short Year;
     TDateTime StandardDate;
     TDateTime DaylightDate;
+    bool SummerDST;
   };
   static TDSTCache DSTCache[10];
   static int DSTCacheCount = 0;
@@ -846,19 +847,18 @@ static bool __fastcall IsDateInDST(const TDateTime & DateTime)
       CurrentCache++;
     }
 
+    TDSTCache NewCache;
     if ((CacheIndex < DSTCacheCount) && (CacheIndex < LENOF(DSTCache)) &&
         CurrentCache->Filled)
     {
       assert(CurrentCache->Year == Year);
-      Result = (DateTime >= CurrentCache->DaylightDate) &&
-        (DateTime < CurrentCache->StandardDate);
     }
     else
     {
-      TDSTCache NewCache;
 
       EncodeDSTMargin(Params->StandardDate, Year, NewCache.StandardDate);
       EncodeDSTMargin(Params->DaylightDate, Year, NewCache.DaylightDate);
+      NewCache.SummerDST = (NewCache.DaylightDate < NewCache.StandardDate);
       if (DSTCacheCount < LENOF(DSTCache))
       {
         TGuard Guard(&Section);
@@ -870,8 +870,20 @@ static bool __fastcall IsDateInDST(const TDateTime & DateTime)
           DSTCacheCount++;
         }
       }
-      Result = (DateTime >= NewCache.DaylightDate) &&
-        (DateTime < NewCache.StandardDate);
+      CurrentCache = &NewCache;
+    }
+
+    if (CurrentCache->SummerDST)
+    {
+      Result =
+        (DateTime >= CurrentCache->DaylightDate) &&
+        (DateTime < CurrentCache->StandardDate);
+    }
+    else
+    {
+      Result =
+        (DateTime < CurrentCache->StandardDate) ||
+        (DateTime >= CurrentCache->DaylightDate);
     }
   }
   return Result;
@@ -970,7 +982,8 @@ TDateTime __fastcall FileTimeToDateTime(const FILETIME & FileTime)
     FileTimeToLocalFileTime(&FileTime, &LocalFileTime);
     FileTimeToSystemTime(&LocalFileTime, &SysTime);
   }
-  return SystemTimeToDateTime(SysTime);
+  TDateTime Result = SystemTimeToDateTime(SysTime);
+  return Result;
 }
 //---------------------------------------------------------------------------
 __int64 __fastcall ConvertTimestampToUnix(const FILETIME & FileTime,

+ 19 - 2
core/HierarchicalStorage.cpp

@@ -75,6 +75,7 @@ __fastcall THierarchicalStorage::THierarchicalStorage(const AnsiString AStorage)
   FKeyHistory = new TStringList();
   AccessMode = smRead;
   Explicit = false;
+  MungeStringValues = true;
 }
 //---------------------------------------------------------------------------
 __fastcall THierarchicalStorage::~THierarchicalStorage()
@@ -257,7 +258,16 @@ void __fastcall THierarchicalStorage::WriteValues(Classes::TStrings * Strings,
 //---------------------------------------------------------------------------
 AnsiString __fastcall THierarchicalStorage::ReadString(const AnsiString Name, const AnsiString Default)
 {
-  return UnMungeStr(ReadStringRaw(Name, MungeStr(Default)));
+  AnsiString Result;
+  if (MungeStringValues)
+  {
+    Result = UnMungeStr(ReadStringRaw(Name, MungeStr(Default)));
+  }
+  else
+  {
+    Result = ReadStringRaw(Name, Default);
+  }
+  return Result;
 }
 //---------------------------------------------------------------------------
 AnsiString __fastcall THierarchicalStorage::ReadBinaryData(const AnsiString Name)
@@ -271,7 +281,14 @@ AnsiString __fastcall THierarchicalStorage::ReadBinaryData(const AnsiString Name
 //---------------------------------------------------------------------------
 void __fastcall THierarchicalStorage::WriteString(const AnsiString Name, const AnsiString Value)
 {
-  WriteStringRaw(Name, MungeStr(Value));
+  if (MungeStringValues)
+  {
+    WriteStringRaw(Name, MungeStr(Value));
+  }
+  else
+  {
+    WriteStringRaw(Name, Value);
+  }
 }
 //---------------------------------------------------------------------------
 void __fastcall THierarchicalStorage::WriteBinaryData(const AnsiString Name,

+ 2 - 0
core/HierarchicalStorage.h

@@ -57,12 +57,14 @@ public:
   __property AnsiString CurrentSubKey  = { read=GetCurrentSubKey };
   __property TStorageAccessMode AccessMode  = { read=FAccessMode, write=SetAccessMode };
   __property bool Explicit = { read = FExplicit, write = FExplicit };
+  __property bool MungeStringValues = { read = FMungeStringValues, write = FMungeStringValues };
 
 protected:
   AnsiString FStorage;
   TStrings * FKeyHistory;
   TStorageAccessMode FAccessMode;
   bool FExplicit;
+  bool FMungeStringValues;
 
   AnsiString __fastcall GetCurrentSubKey();
   AnsiString __fastcall GetCurrentSubKeyMunged();

+ 0 - 2
core/SessionInfo.cpp

@@ -891,8 +891,6 @@ void __fastcall TSessionLog::AddStartupInfo()
 //---------------------------------------------------------------------------
 void __fastcall TSessionLog::DoAddStartupInfo(TSessionData * Data)
 {
-  assert(Logging);
-
   TGuard Guard(FCriticalSection);
 
   BeginUpdate();

+ 15 - 15
core/Terminal.cpp

@@ -3642,25 +3642,25 @@ void __fastcall TTerminal::OpenLocalFile(const AnsiString FileName,
     {
       if (AATime || AMTime || ACTime)
       {
+        FILETIME ATime;
+        FILETIME MTime;
+        FILETIME CTime;
         // Get last file access and modification time
         FILE_OPERATION_LOOP (FMTLOAD(CANT_GET_ATTRS, (FileName)),
-          FILETIME ATime;
-          FILETIME MTime;
-          FILETIME CTime;
           if (!GetFileTime(Handle, &CTime, &ATime, &MTime)) RaiseLastOSError();
-          if (ACTime)
-          {
-            *ACTime = ConvertTimestampToUnixSafe(CTime, SessionData->DSTMode);
-          }
-          if (AATime)
-          {
-            *AATime = ConvertTimestampToUnixSafe(ATime, SessionData->DSTMode);
-          }
-          if (AMTime)
-          {
-            *AMTime = ConvertTimestampToUnix(MTime, SessionData->DSTMode);
-          }
         );
+        if (ACTime)
+        {
+          *ACTime = ConvertTimestampToUnixSafe(CTime, SessionData->DSTMode);
+        }
+        if (AATime)
+        {
+          *AATime = ConvertTimestampToUnixSafe(ATime, SessionData->DSTMode);
+        }
+        if (AMTime)
+        {
+          *AMTime = ConvertTimestampToUnix(MTime, SessionData->DSTMode);
+        }
       }
 
       if (ASize)

+ 40 - 46
forms/Login.cpp

@@ -39,14 +39,9 @@ bool __fastcall DoLoginDialog(TStoredSessionList *SessionList,
   bool Result;
   try
   {
-    LoginDialog->StoredSessions = SessionList;
-    LoginDialog->SessionData = Data;
-    LoginDialog->Options = Options;
-    Result = LoginDialog->Execute();
-    if (Result)
-    {
-      Data2 = LoginDialog->SessionData;
-    }
+    LoginDialog->Init(SessionList, Options);
+    Data2 = Data;
+    Result = LoginDialog->Execute(Data2);
   }
   __finally
   {
@@ -100,6 +95,15 @@ __fastcall TLoginDialog::~TLoginDialog()
   delete FLanguagesPopupMenu;
 }
 //---------------------------------------------------------------------
+void __fastcall TLoginDialog::Init(TStoredSessionList *SessionList,
+  int Options)
+{
+  FStoredSessions = SessionList;
+  LoadSessions();
+  FOptions = Options;
+  UpdateControls();
+}
+//---------------------------------------------------------------------
 void __fastcall TLoginDialog::InitControls()
 {
   LoggingFrame->Init();
@@ -185,7 +189,7 @@ void __fastcall TLoginDialog::Init()
 
   UpdateNavigationTree();
 
-  if ((Options & loLocalDirectory) == 0)
+  if ((FOptions & loLocalDirectory) == 0)
   {
     LocalDirectoryLabel->Visible = false;
     LocalDirectoryEdit->Visible = false;
@@ -1155,7 +1159,7 @@ void __fastcall TLoginDialog::UpdateControls()
       EnableControl(TunnelOptionsGroup, TunnelSessionGroup->Enabled);
 
       // preferences sheet
-      GeneralSheet->Enabled = FLAGSET(Options, loPreferences);
+      GeneralSheet->Enabled = FLAGSET(FOptions, loPreferences);
 
       // this methods saves us from calling GetSessionData,
       // which breaks changing locale (session data are not preserved,
@@ -1170,12 +1174,12 @@ void __fastcall TLoginDialog::UpdateControls()
       }
       LoadButton->Default = !LoginButton->Default;
 
-      AboutButton->Visible = (Options & loAbout);
-      LanguagesButton->Visible = (Options & loLanguage);
-      ShellIconsButton->Visible = (Options & loTools);
-      ToolsMenuButton->Visible = (Options & loTools);
-      LoggingFrame->EnableLogWindow = (Options & loLogWindow);
-      ColorButton->Visible = (Options & loColor);
+      AboutButton->Visible = (FOptions & loAbout);
+      LanguagesButton->Visible = (FOptions & loLanguage);
+      ShellIconsButton->Visible = (FOptions & loTools);
+      ToolsMenuButton->Visible = (FOptions & loTools);
+      LoggingFrame->EnableLogWindow = (FOptions & loLogWindow);
+      ColorButton->Visible = (FOptions & loColor);
 
       UpdateNavigationTree();
     }
@@ -1247,15 +1251,6 @@ TSessionData * __fastcall TLoginDialog::GetSessionData()
   }
 }
 //---------------------------------------------------------------------------
-void __fastcall TLoginDialog::SetStoredSessions(TStoredSessionList * value)
-{
-  if (FStoredSessions != value)
-  {
-    FStoredSessions = value;
-    LoadSessions();
-  }
-}
-//---------------------------------------------------------------------------
 void __fastcall TLoginDialog::SessionTreeDblClick(TObject * /*Sender*/)
 {
   TPoint P = SessionTree->ScreenToClient(Mouse->CursorPos);
@@ -1267,7 +1262,7 @@ void __fastcall TLoginDialog::SessionTreeDblClick(TObject * /*Sender*/)
     }
     else
     {
-      SessionData = SelectedSession;
+      SetSessionData(SelectedSession);
       EditSession();
     }
   }
@@ -1313,7 +1308,7 @@ void __fastcall TLoginDialog::EditSessionActionExecute(TObject * /*Sender*/)
 {
   if (SelectedSession)
   {
-    SessionData = SelectedSession;
+    SetSessionData(SelectedSession);
     EditSession();
   }
 }
@@ -1365,7 +1360,7 @@ void __fastcall TLoginDialog::SaveSessionActionExecute(TObject * /*Sender*/)
     }
 
     SessionTree->Selected = Node;
-    SessionData = NewSession;
+    SetSessionData(NewSession);
 
     ChangePage(SessionListSheet);
     SessionTree->SetFocus();
@@ -1483,14 +1478,14 @@ void __fastcall TLoginDialog::ActionListUpdate(TBasicAction *Action,
   }
   else if (Action == DeleteSessionAction)
   {
-    TSessionData * Data = SessionData;
+    TSessionData * Data = GetSessionData();
     DeleteSessionAction->Enabled =
       (SessionSelected && !Data->Special) ||
       ((SessionTree->Selected != NULL) && (SessionTree->Selected->Data == NULL));
   }
   else if (Action == RenameSessionAction)
   {
-    TSessionData * Data = SessionData;
+    TSessionData * Data = GetSessionData();
     RenameSessionAction->Enabled =
       (SessionSelected && !Data->Special) ||
       ((SessionTree->Selected != NULL) && (SessionTree->Selected->Data == NULL));
@@ -1505,7 +1500,7 @@ void __fastcall TLoginDialog::ActionListUpdate(TBasicAction *Action,
   }
   else if (Action == LoginAction)
   {
-    TSessionData * Data = SessionData;
+    TSessionData * Data = GetSessionData();
     LoginAction->Enabled = Data && Data->CanLogin;
   }
   else if (Action == SaveSessionAction)
@@ -1533,13 +1528,21 @@ void __fastcall TLoginDialog::ActionListUpdate(TBasicAction *Action,
   }
 }
 //---------------------------------------------------------------------------
-bool __fastcall TLoginDialog::Execute()
+bool __fastcall TLoginDialog::Execute(TSessionData *& Data)
 {
+  SetSessionData(Data);
   LoadConfiguration();
   bool Result = (ShowModal() == mrOk);
   if (Result)
   {
     SaveConfiguration();
+    Data = GetSessionData();
+    // FSessionData ceases to exist with the dialog
+    if (Data == FSessionData)
+    {
+      Data = new TSessionData("");
+      Data->Assign(FSessionData);
+    }
   }
   return Result;
 }
@@ -1892,15 +1895,6 @@ void __fastcall TLoginDialog::CheckForUpdatesActionExecute(TObject * /*Sender*/)
   CheckForUpdates(false);
 }
 //---------------------------------------------------------------------------
-void __fastcall TLoginDialog::SetOptions(int value)
-{
-  if (Options != value)
-  {
-    FOptions = value;
-    UpdateControls();
-  }
-}
-//---------------------------------------------------------------------------
 void __fastcall TLoginDialog::LanguagesButtonClick(TObject * /*Sender*/)
 {
   delete FLanguagesPopupMenu;
@@ -1983,7 +1977,7 @@ void __fastcall TLoginDialog::VerifyKey(AnsiString FileName, bool TypeOnly)
         // intend to change it only after he/she selects key file
         if (!TypeOnly)
         {
-          TSessionData * Data = SessionData;
+          TSessionData * Data = GetSessionData();
           if ((Type == ktSSH1) !=
                 ((Data->SshProt == ssh1only) || (Data->SshProt == ssh1)))
           {
@@ -2033,9 +2027,9 @@ void __fastcall TLoginDialog::FormCloseQuery(TObject * /*Sender*/,
 {
   if (ModalResult != mrCancel)
   {
-    VerifyKey(SessionData->PublicKeyFile, false);
+    VerifyKey(GetSessionData()->PublicKeyFile, false);
     // for tunnel key do not check SSH version as it is not configurable
-    VerifyKey(SessionData->TunnelPublicKeyFile, true);
+    VerifyKey(GetSessionData()->TunnelPublicKeyFile, true);
   }
 }
 //---------------------------------------------------------------------------
@@ -2155,7 +2149,7 @@ void __fastcall TLoginDialog::SessionTreeEdited(TObject * /*Sender*/,
         DestroySession(Session);
       }
 
-      SessionData = NewSession;
+      SetSessionData(NewSession);
     }
     else
     {
@@ -2602,7 +2596,7 @@ void __fastcall TLoginDialog::SessionTreeDragDrop(TObject * Sender,
       assert(false);
     }
 
-    SessionData = NewSession;
+    SetSessionData(NewSession);
   }
   else
   {

+ 4 - 8
forms/Login.h

@@ -389,7 +389,6 @@ private:
   void __fastcall SetSessionData(TSessionData * value);
   TSessionData * __fastcall GetSessionData();
   void __fastcall SaveSession(TSessionData * aStoredSession);
-  void __fastcall SetStoredSessions(TStoredSessionList * value);
   void __fastcall LoadSessions();
   TSessionData * __fastcall GetSelectedSession();
   void __fastcall CMDialogKey(TWMKeyDown & Message);
@@ -427,22 +426,19 @@ protected:
   virtual void __fastcall Dispatch(void * Message);
   bool __fastcall AllowAlgDrag(TListBox * AlgListBox, int X, int Y);
   void __fastcall AlgMove(TListBox * AlgListBox, int Source, int Dest);
-  void __fastcall SetOptions(int value);
   void __fastcall LocaleClick(TObject * Sender);
   void __fastcall LocaleGetClick(TObject * Sender);
   void __fastcall Init();
   void __fastcall InitControls();
   void __fastcall VerifyKey(AnsiString FileName, bool TypeOnly);
   void __fastcall EditSession();
+  __property TSessionData * SelectedSession  = { read=GetSelectedSession };
+
 public:
   virtual __fastcall TLoginDialog(TComponent* AOwner);
   __fastcall ~TLoginDialog();
-  bool __fastcall Execute();
-
-  __property TSessionData * SessionData  = { read=GetSessionData, write=SetSessionData };
-  __property TStoredSessionList * StoredSessions  = { read=FStoredSessions, write=SetStoredSessions };
-  __property TSessionData * SelectedSession  = { read=GetSelectedSession };
-  __property int Options = { read=FOptions, write=SetOptions };
+  void __fastcall Init(TStoredSessionList *SessionList, int Options);
+  bool __fastcall Execute(TSessionData *& Data);
 };
 //----------------------------------------------------------------------------
 #endif

+ 6 - 1
forms/ScpCommander.cpp

@@ -451,13 +451,18 @@ void __fastcall TScpCommanderForm::TerminalChanged()
       {
         LocalDirView->RestoreState(ManagedTerminal->LocalExplorerState);
         NonVisualDataModule->SynchronizeBrowsingAction->Checked = ManagedTerminal->SynchronizeBrowsing;
+        // do not try to detect synchronized browsing again below
+        WasSynchronisingBrowsing = false;
       }
       else
       {
         LocalDirView->ClearState();
+        // this may be program startup among other,
+        // so in this case we want to try to detect synchronized browsing below
       }
     }
-    else if (WasSynchronisingBrowsing &&
+
+    if (WasSynchronisingBrowsing &&
         SameText(ExtractFileName(LocalDirView->PathName),
           UnixExtractFileName(RemoteDirView->PathName)))
     {

+ 25 - 0
openssl/ACKNOWLEDGMENTS

@@ -0,0 +1,25 @@
+The OpenSSL project depends on volunteer efforts and financial support from
+the end user community. That support comes in the form of donations and paid
+sponsorships, software support contracts, paid consulting services
+and commissioned software development.
+
+Since all these activities support the continued development and improvement
+of OpenSSL we consider all these clients and customers as sponsors of the
+OpenSSL project.
+
+We would like to identify and thank the following such sponsors for their past
+or current significant support of the OpenSSL project:
+
+Very significant support:
+
+	OpenGear: www.opengear.com
+
+Significant support:
+
+	PSW Group: www.psw.net
+
+Please note that we ask permission to identify sponsors and that some sponsors
+we consider eligible for inclusion here have requested to remain anonymous.
+
+Additional sponsorship or financial support is always welcome: for more
+information please contact the OpenSSL Software Foundation.

+ 6 - 6
openssl/crypto/aes/aes_wrap.c

@@ -85,9 +85,9 @@ int AES_wrap_key(AES_KEY *key, const unsigned char *iv,
 			A[7] ^= (unsigned char)(t & 0xff);
 			if (t > 0xff)	
 				{
-				A[6] ^= (unsigned char)((t & 0xff) >> 8);
-				A[5] ^= (unsigned char)((t & 0xff) >> 16);
-				A[4] ^= (unsigned char)((t & 0xff) >> 24);
+				A[6] ^= (unsigned char)((t >> 8) & 0xff);
+				A[5] ^= (unsigned char)((t >> 16) & 0xff);
+				A[4] ^= (unsigned char)((t >> 24) & 0xff);
 				}
 			memcpy(R, B + 8, 8);
 			}
@@ -119,9 +119,9 @@ int AES_unwrap_key(AES_KEY *key, const unsigned char *iv,
 			A[7] ^= (unsigned char)(t & 0xff);
 			if (t > 0xff)	
 				{
-				A[6] ^= (unsigned char)((t & 0xff) >> 8);
-				A[5] ^= (unsigned char)((t & 0xff) >> 16);
-				A[4] ^= (unsigned char)((t & 0xff) >> 24);
+				A[6] ^= (unsigned char)((t >> 8) & 0xff);
+				A[5] ^= (unsigned char)((t >> 16) & 0xff);
+				A[4] ^= (unsigned char)((t >> 24) & 0xff);
 				}
 			memcpy(B + 8, R, 8);
 			AES_decrypt(B, B, key);

+ 1 - 2
openssl/crypto/asn1/a_int.c

@@ -273,7 +273,7 @@ ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, const unsigned char **pp,
 	{
 	ASN1_INTEGER *ret=NULL;
 	const unsigned char *p;
-	unsigned char *to,*s;
+	unsigned char *s;
 	long len;
 	int inf,tag,xclass;
 	int i;
@@ -308,7 +308,6 @@ ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, const unsigned char **pp,
 		i=ERR_R_MALLOC_FAILURE;
 		goto err;
 		}
-	to=s;
 	ret->type=V_ASN1_INTEGER;
 	if(len) {
 		if ((*p == 0) && (len != 1))

+ 1 - 2
openssl/crypto/asn1/n_pkey.c

@@ -242,7 +242,7 @@ RSA *d2i_RSA_NET(RSA **a, const unsigned char **pp, long length,
 		 int sgckey)
 	{
 	RSA *ret=NULL;
-	const unsigned char *p, *kp;
+	const unsigned char *p;
 	NETSCAPE_ENCRYPTED_PKEY *enckey = NULL;
 
 	p = *pp;
@@ -265,7 +265,6 @@ RSA *d2i_RSA_NET(RSA **a, const unsigned char **pp, long length,
 		ASN1err(ASN1_F_D2I_RSA_NET,ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM);
 		goto err;
 	}
-	kp = enckey->enckey->digest->data;
 	if (cb == NULL)
 		cb=EVP_read_pw_string;
 	if ((ret=d2i_RSA_NET_2(a, enckey->enckey->digest,cb, sgckey)) == NULL) goto err;

+ 1 - 2
openssl/crypto/asn1/t_crl.c

@@ -87,7 +87,7 @@ int X509_CRL_print(BIO *out, X509_CRL *x)
 	STACK_OF(X509_REVOKED) *rev;
 	X509_REVOKED *r;
 	long l;
-	int i, n;
+	int i;
 	char *p;
 
 	BIO_printf(out, "Certificate Revocation List (CRL):\n");
@@ -107,7 +107,6 @@ int X509_CRL_print(BIO *out, X509_CRL *x)
 	else BIO_printf(out,"NONE");
 	BIO_printf(out,"\n");
 
-	n=X509_CRL_get_ext_count(x);
 	X509V3_extensions_print(out, "CRL extensions",
 						x->crl->extensions, 0, 8);
 

+ 1 - 2
openssl/crypto/asn1/tasn_dec.c

@@ -168,7 +168,7 @@ int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len,
 	int i;
 	int otag;
 	int ret = 0;
-	ASN1_VALUE *pchval, **pchptr, *ptmpval;
+	ASN1_VALUE **pchptr, *ptmpval;
 	if (!pval)
 		return 0;
 	if (aux && aux->asn1_cb)
@@ -319,7 +319,6 @@ int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len,
 			goto err;
 			}
 		/* CHOICE type, try each possibility in turn */
-		pchval = NULL;
 		p = *in;
 		for (i = 0, tt=it->templates; i < it->tcount; i++, tt++)
 			{

+ 2 - 2
openssl/crypto/asn1/x_x509.c

@@ -63,7 +63,7 @@
 #include <openssl/x509.h>
 #include <openssl/x509v3.h>
 
-ASN1_SEQUENCE(X509_CINF) = {
+ASN1_SEQUENCE_enc(X509_CINF, enc, 0) = {
 	ASN1_EXP_OPT(X509_CINF, version, ASN1_INTEGER, 0),
 	ASN1_SIMPLE(X509_CINF, serialNumber, ASN1_INTEGER),
 	ASN1_SIMPLE(X509_CINF, signature, X509_ALGOR),
@@ -74,7 +74,7 @@ ASN1_SEQUENCE(X509_CINF) = {
 	ASN1_IMP_OPT(X509_CINF, issuerUID, ASN1_BIT_STRING, 1),
 	ASN1_IMP_OPT(X509_CINF, subjectUID, ASN1_BIT_STRING, 2),
 	ASN1_EXP_SEQUENCE_OF_OPT(X509_CINF, extensions, X509_EXTENSION, 3)
-} ASN1_SEQUENCE_END(X509_CINF)
+} ASN1_SEQUENCE_END_enc(X509_CINF, X509_CINF)
 
 IMPLEMENT_ASN1_FUNCTIONS(X509_CINF)
 /* X509 top level structure needs a bit of customisation */

+ 0 - 2
openssl/crypto/bio/bf_nbio.c

@@ -125,7 +125,6 @@ static int nbiof_free(BIO *a)
 	
 static int nbiof_read(BIO *b, char *out, int outl)
 	{
-	NBIO_TEST *nt;
 	int ret=0;
 #if 1
 	int num;
@@ -134,7 +133,6 @@ static int nbiof_read(BIO *b, char *out, int outl)
 
 	if (out == NULL) return(0);
 	if (b->next_bio == NULL) return(0);
-	nt=(NBIO_TEST *)b->ptr;
 
 	BIO_clear_retry_flags(b);
 #if 1

+ 2 - 2
openssl/crypto/bio/bio_lib.c

@@ -110,7 +110,7 @@ int BIO_set(BIO *bio, BIO_METHOD *method)
 
 int BIO_free(BIO *a)
 	{
-	int ret=0,i;
+	int i;
 
 	if (a == NULL) return(0);
 
@@ -133,7 +133,7 @@ int BIO_free(BIO *a)
 	CRYPTO_free_ex_data(CRYPTO_EX_INDEX_BIO, a, &a->ex_data);
 
 	if ((a->method == NULL) || (a->method->destroy == NULL)) return(1);
-	ret=a->method->destroy(a);
+	a->method->destroy(a);
 	OPENSSL_free(a);
 	return(1);
 	}

+ 2 - 3
openssl/crypto/bio/bss_acpt.c

@@ -340,7 +340,6 @@ static int acpt_write(BIO *b, const char *in, int inl)
 
 static long acpt_ctrl(BIO *b, int cmd, long num, void *ptr)
 	{
-	BIO *dbio;
 	int *ip;
 	long ret=1;
 	BIO_ACCEPT *data;
@@ -437,8 +436,8 @@ static long acpt_ctrl(BIO *b, int cmd, long num, void *ptr)
 		ret=(long)data->bind_mode;
 		break;
 	case BIO_CTRL_DUP:
-		dbio=(BIO *)ptr;
-/*		if (data->param_port) EAY EAY
+/*		dbio=(BIO *)ptr;
+		if (data->param_port) EAY EAY
 			BIO_set_port(dbio,data->param_port);
 		if (data->param_hostname)
 			BIO_set_hostname(dbio,data->param_hostname);

+ 2 - 1
openssl/crypto/bn/bn_exp2.c

@@ -301,7 +301,8 @@ int BN_mod_exp2_mont(BIGNUM *rr, const BIGNUM *a1, const BIGNUM *p1,
 			r_is_one = 0;
 			}
 		}
-	BN_from_montgomery(rr,r,mont,ctx);
+	if (!BN_from_montgomery(rr,r,mont,ctx))
+		goto err;
 	ret=1;
 err:
 	if ((in_mont == NULL) && (mont != NULL)) BN_MONT_CTX_free(mont);

+ 2 - 7
openssl/crypto/bn/bn_mul.c

@@ -551,7 +551,7 @@ void bn_mul_part_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n,
 	     int tna, int tnb, BN_ULONG *t)
 	{
 	int i,j,n2=n*2;
-	int c1,c2,neg,zero;
+	int c1,c2,neg;
 	BN_ULONG ln,lo,*p;
 
 # ifdef BN_COUNT
@@ -567,7 +567,7 @@ void bn_mul_part_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n,
 	/* r=(a[0]-a[1])*(b[1]-b[0]) */
 	c1=bn_cmp_part_words(a,&(a[n]),tna,n-tna);
 	c2=bn_cmp_part_words(&(b[n]),b,tnb,tnb-n);
-	zero=neg=0;
+	neg=0;
 	switch (c1*3+c2)
 		{
 	case -4:
@@ -575,7 +575,6 @@ void bn_mul_part_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n,
 		bn_sub_part_words(&(t[n]),b,      &(b[n]),tnb,n-tnb); /* - */
 		break;
 	case -3:
-		zero=1;
 		/* break; */
 	case -2:
 		bn_sub_part_words(t,      &(a[n]),a,      tna,tna-n); /* - */
@@ -585,7 +584,6 @@ void bn_mul_part_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n,
 	case -1:
 	case 0:
 	case 1:
-		zero=1;
 		/* break; */
 	case 2:
 		bn_sub_part_words(t,      a,      &(a[n]),tna,n-tna); /* + */
@@ -593,7 +591,6 @@ void bn_mul_part_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n,
 		neg=1;
 		break;
 	case 3:
-		zero=1;
 		/* break; */
 	case 4:
 		bn_sub_part_words(t,      a,      &(a[n]),tna,n-tna);
@@ -1012,7 +1009,6 @@ int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
 		{
 		if (i >= -1 && i <= 1)
 			{
-			int sav_j =0;
 			/* Find out the power of two lower or equal
 			   to the longest of the two numbers */
 			if (i >= 0)
@@ -1023,7 +1019,6 @@ int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
 				{
 				j = BN_num_bits_word((BN_ULONG)bl);
 				}
-			sav_j = j;
 			j = 1<<(j-1);
 			assert(j <= al || j <= bl);
 			k = j+j;

+ 2 - 2
openssl/crypto/buildinf.h

@@ -9,11 +9,11 @@
   /* auto-generated/updated by util/mk1mf.pl for crypto/cversion.c */
   #define CFLAGS "cl  /MD /Ox /O2 /Ob2 -DOPENSSL_THREADS  -DDSO_WIN32  -DOPENSSL_USE_APPLINK -I. -DOPENSSL_NO_RC5 -DOPENSSL_NO_MD2 -DOPENSSL_NO_KRB5 -DOPENSSL_NO_JPAKE -DOPENSSL_NO_STATIC_ENGINE    "
   #define PLATFORM "VC-WIN32"
-  #define DATE "Sat Oct 23 12:16:47 2010"
+  #define DATE "Sun Dec  5 15:27:45 2010"
 #endif
 #ifdef MK1MF_PLATFORM_BC_NT
   /* auto-generated/updated by util/mk1mf.pl for crypto/cversion.c */
   #define CFLAGS "bcc32 -DWIN32_LEAN_AND_MEAN -q -w-ccc -w-rch -w-pia -w-aus -w-par -w-inl  -c -tWC -tWM -DOPENSSL_SYSNAME_WIN32 -DL_ENDIAN -DDSO_WIN32 -D_stricmp=stricmp -D_strnicmp=strnicmp -O2 -ff -fp -DBN_ASM -DMD5_ASM -DSHA1_ASM -DRMD160_ASM -DOPENSSL_NO_RC5 -DOPENSSL_NO_MD2 -DOPENSSL_NO_KRB5 -DOPENSSL_NO_JPAKE -DOPENSSL_NO_DYNAMIC_ENGINE    "
   #define PLATFORM "BC-NT"
-  #define DATE "Sat Oct 23 12:16:48 2010"
+  #define DATE "Sun Dec  5 15:27:46 2010"
 #endif

+ 1 - 1
openssl/crypto/conf/conf_api.c

@@ -285,7 +285,7 @@ CONF_VALUE *_CONF_new_section(CONF *conf, const char *section)
 	v->value=(char *)sk;
 	
 	vv=lh_CONF_VALUE_insert(conf->data,v);
-	assert(vv == NULL);
+	OPENSSL_assert(vv == NULL);
 	ok=1;
 err:
 	if (!ok)

+ 1 - 12
openssl/crypto/conf/conf_def.c

@@ -213,13 +213,12 @@ static int def_load_bio(CONF *conf, BIO *in, long *line)
 	int bufnum=0,i,ii;
 	BUF_MEM *buff=NULL;
 	char *s,*p,*end;
-	int again,n;
+	int again;
 	long eline=0;
 	char btmp[DECIMAL_SIZE(eline)+1];
 	CONF_VALUE *v=NULL,*tv;
 	CONF_VALUE *sv=NULL;
 	char *section=NULL,*buf;
-	STACK_OF(CONF_VALUE) *section_sk=NULL,*ts;
 	char *start,*psection,*pname;
 	void *h = (void *)(conf->data);
 
@@ -250,7 +249,6 @@ static int def_load_bio(CONF *conf, BIO *in, long *line)
 					CONF_R_UNABLE_TO_CREATE_NEW_SECTION);
 		goto err;
 		}
-	section_sk=(STACK_OF(CONF_VALUE) *)sv->value;
 
 	bufnum=0;
 	again=0;
@@ -309,7 +307,6 @@ static int def_load_bio(CONF *conf, BIO *in, long *line)
 		buf=buff->data;
 
 		clear_comments(conf, buf);
-		n=strlen(buf);
 		s=eat_ws(conf, buf);
 		if (IS_EOF(conf,*s)) continue; /* blank line */
 		if (*s == '[')
@@ -343,7 +340,6 @@ again:
 					CONF_R_UNABLE_TO_CREATE_NEW_SECTION);
 				goto err;
 				}
-			section_sk=(STACK_OF(CONF_VALUE) *)sv->value;
 			continue;
 			}
 		else
@@ -406,13 +402,9 @@ again:
 					   CONF_R_UNABLE_TO_CREATE_NEW_SECTION);
 					goto err;
 					}
-				ts=(STACK_OF(CONF_VALUE) *)tv->value;
 				}
 			else
-				{
 				tv=sv;
-				ts=section_sk;
-				}
 #if 1
 			if (_CONF_add_string(conf, tv, v) == 0)
 				{
@@ -465,9 +457,6 @@ err:
 
 static void clear_comments(CONF *conf, char *p)
 	{
-	char *to;
-
-	to=p;
 	for (;;)
 		{
 		if (IS_FCOMMENT(conf,*p))

+ 11 - 9
openssl/crypto/cryptlib.c

@@ -743,6 +743,16 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason,
 #if defined(_WIN32) && !defined(__CYGWIN__)
 #include <tchar.h>
 #include <signal.h>
+#ifdef __WATCOMC__
+#if defined(_UNICODE) || defined(__UNICODE__)
+#define _vsntprintf _vsnwprintf
+#else
+#define _vsntprintf _vsnprintf
+#endif
+#endif
+#ifdef _MSC_VER
+#define alloca _alloca
+#endif
 
 #if defined(_WIN32_WINNT) && _WIN32_WINNT>=0x0333
 int OPENSSL_isservice(void)
@@ -773,11 +783,7 @@ int OPENSSL_isservice(void)
 
     if (len>512) return -1;		/* paranoia */
     len++,len&=~1;			/* paranoia */
-#ifdef _MSC_VER
-    name=(WCHAR *)_alloca(len+sizeof(WCHAR));
-#else
     name=(WCHAR *)alloca(len+sizeof(WCHAR));
-#endif
     if (!GetUserObjectInformationW (h,UOI_NAME,name,len,&len))
 	return -1;
 
@@ -822,11 +828,7 @@ void OPENSSL_showfatal (const char *fmta,...)
       size_t len_0=strlen(fmta)+1,i;
       WCHAR *fmtw;
 
-#ifdef _MSC_VER
-	fmtw = (WCHAR *)_alloca (len_0*sizeof(WCHAR));
-#else
-	fmtw = (WCHAR *)alloca (len_0*sizeof(WCHAR));
-#endif
+	fmtw = (WCHAR *)alloca(len_0*sizeof(WCHAR));
 	if (fmtw == NULL) { fmt=(const TCHAR *)L"no stack?"; break; }
 
 #ifndef OPENSSL_NO_MULTIBYTE

+ 1 - 2
openssl/crypto/dsa/dsa_gen.c

@@ -120,7 +120,7 @@ int dsa_builtin_paramgen(DSA *ret, size_t bits, size_t qbits,
 	BIGNUM *r0,*W,*X,*c,*test;
 	BIGNUM *g=NULL,*q=NULL,*p=NULL;
 	BN_MONT_CTX *mont=NULL;
-	int i, k,n=0,b,m=0, qsize = qbits >> 3;
+	int i, k, n=0, m=0, qsize = qbits >> 3;
 	int counter=0;
 	int r=0;
 	BN_CTX *ctx=NULL;
@@ -232,7 +232,6 @@ int dsa_builtin_paramgen(DSA *ret, size_t bits, size_t qbits,
 		/* "offset = 2" */
 
 		n=(bits-1)/160;
-		b=(bits-1)-n*160;
 
 		for (;;)
 			{

+ 1 - 1
openssl/crypto/dsa/dsa_ossl.c

@@ -185,7 +185,7 @@ static DSA_SIG *dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa)
 	if (!BN_mod_mul(&xr,dsa->priv_key,r,dsa->q,ctx)) goto err;/* s = xr */
 	if (!BN_add(s, &xr, &m)) goto err;		/* s = m + xr */
 	if (BN_cmp(s,dsa->q) > 0)
-		BN_sub(s,s,dsa->q);
+		if (!BN_sub(s,s,dsa->q)) goto err;
 	if (!BN_mod_mul(s,s,kinv,dsa->q,ctx)) goto err;
 
 	ret=DSA_SIG_new();

+ 1 - 2
openssl/crypto/evp/encode.c

@@ -235,7 +235,7 @@ void EVP_DecodeInit(EVP_ENCODE_CTX *ctx)
 int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl,
 	     const unsigned char *in, int inl)
 	{
-	int seof= -1,eof=0,rv= -1,ret=0,i,v,tmp,n,ln,tmp2,exp_nl;
+	int seof= -1,eof=0,rv= -1,ret=0,i,v,tmp,n,ln,exp_nl;
 	unsigned char *d;
 
 	n=ctx->num;
@@ -319,7 +319,6 @@ int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl,
 			 * lines.  We process the line and then need to
 			 * accept the '\n' */
 			if ((v != B64_EOF) && (n >= 64)) exp_nl=1;
-			tmp2=v;
 			if (n > 0)
 				{
 				v=EVP_DecodeBlock(out,d,n);

+ 1 - 0
openssl/crypto/evp/evp_enc.c

@@ -204,6 +204,7 @@ skip_to_init:
 			case EVP_CIPH_OFB_MODE:
 
 			ctx->num = 0;
+			/* fall-through */
 
 			case EVP_CIPH_CBC_MODE:
 

+ 2 - 2
openssl/crypto/evp/m_sigver.c

@@ -137,7 +137,7 @@ int EVP_DigestSignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, size_t *siglen)
 		sctx = 0;
 	if (sigret)
 		{
-		MS_STATIC EVP_MD_CTX tmp_ctx;
+		EVP_MD_CTX tmp_ctx;
 		unsigned char md[EVP_MAX_MD_SIZE];
 		unsigned int mdlen;
 		EVP_MD_CTX_init(&tmp_ctx);
@@ -173,7 +173,7 @@ int EVP_DigestSignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, size_t *siglen)
 
 int EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, unsigned char *sig, size_t siglen)
 	{
-	MS_STATIC EVP_MD_CTX tmp_ctx;
+	EVP_MD_CTX tmp_ctx;
 	unsigned char md[EVP_MAX_MD_SIZE];
 	int r;
 	unsigned int mdlen;

+ 3 - 0
openssl/crypto/evp/p_lib.c

@@ -411,7 +411,10 @@ void EVP_PKEY_free(EVP_PKEY *x)
 static void EVP_PKEY_free_it(EVP_PKEY *x)
 	{
 	if (x->ameth && x->ameth->pkey_free)
+		{
 		x->ameth->pkey_free(x);
+		x->pkey.ptr = NULL;
+		}
 #ifndef OPENSSL_NO_ENGINE
 	if (x->engine)
 		{

+ 1 - 1
openssl/crypto/evp/p_sign.c

@@ -81,7 +81,7 @@ int EVP_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, unsigned int *siglen,
 	unsigned char m[EVP_MAX_MD_SIZE];
 	unsigned int m_len;
 	int i,ok=0,v;
-	MS_STATIC EVP_MD_CTX tmp_ctx;
+	EVP_MD_CTX tmp_ctx;
 
 	*siglen=0;
 	EVP_MD_CTX_init(&tmp_ctx);

+ 1 - 1
openssl/crypto/evp/p_verify.c

@@ -68,7 +68,7 @@ int EVP_VerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sigbuf,
 	unsigned char m[EVP_MAX_MD_SIZE];
 	unsigned int m_len;
 	int i,ok=0,v;
-	MS_STATIC EVP_MD_CTX tmp_ctx;
+	EVP_MD_CTX tmp_ctx;
 
 	EVP_MD_CTX_init(&tmp_ctx);
 	EVP_MD_CTX_copy_ex(&tmp_ctx,ctx);     

+ 2 - 0
openssl/crypto/evp/pmeth_lib.c

@@ -134,6 +134,8 @@ static EVP_PKEY_CTX *int_ctx_new(EVP_PKEY *pkey, ENGINE *e, int id)
 		id = pkey->ameth->pkey_id;
 		}
 #ifndef OPENSSL_NO_ENGINE
+	if (pkey && pkey->engine)
+		e = pkey->engine;
 	/* Try to find an ENGINE which implements this method */
 	if (e)
 		{

+ 0 - 3
openssl/crypto/hmac/hmac.c

@@ -138,12 +138,9 @@ int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len)
 
 int HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len)
 	{
-	int j;
 	unsigned int i;
 	unsigned char buf[EVP_MAX_MD_SIZE];
 
-	j=EVP_MD_block_size(ctx->md);
-
 	if (!EVP_DigestFinal_ex(&ctx->md_ctx,buf,&i))
 		goto err;
 	if (!EVP_MD_CTX_copy_ex(&ctx->md_ctx,&ctx->o_ctx))

+ 11 - 4
openssl/crypto/md32_common.h

@@ -165,7 +165,7 @@
 				asm (			\
 				"roll %1,%0"		\
 				: "=r"(ret)		\
-				: "I"(n), "0"(a)	\
+				: "I"(n), "0"((unsigned int)(a))	\
 				: "cc");		\
 			   ret;				\
 			})
@@ -383,6 +383,7 @@ int HASH_FINAL (unsigned char *md, HASH_CTX *c)
 	}
 
 #ifndef MD32_REG_T
+#if defined(__alpha) || defined(__sparcv9) || defined(__mips)
 #define MD32_REG_T long
 /*
  * This comment was originaly written for MD5, which is why it
@@ -400,9 +401,15 @@ int HASH_FINAL (unsigned char *md, HASH_CTX *c)
  * Well, to be honest it should say that this *prevents* 
  * performance degradation.
  *				<[email protected]>
- * Apparently there're LP64 compilers that generate better
- * code if A-D are declared int. Most notably GCC-x86_64
- * generates better code.
+ */
+#else
+/*
+ * Above is not absolute and there are LP64 compilers that
+ * generate better code if MD32_REG_T is defined int. The above
+ * pre-processor condition reflects the circumstances under which
+ * the conclusion was made and is subject to further extension.
  *				<[email protected]>
  */
+#define MD32_REG_T int
+#endif
 #endif

+ 9 - 3
openssl/crypto/ocsp/ocsp_ht.c

@@ -397,11 +397,12 @@ int OCSP_sendreq_nbio(OCSP_RESPONSE **presp, OCSP_REQ_CTX *rctx)
 
 
 		case OHS_ASN1_HEADER:
-		/* Now reading ASN1 header: can read at least 6 bytes which
-		 * is more than enough for any valid ASN1 SEQUENCE header
+		/* Now reading ASN1 header: can read at least 2 bytes which
+		 * is enough for ASN1 SEQUENCE header and either length field
+		 * or at least the length of the length field.
 		 */
 		n = BIO_get_mem_data(rctx->mem, &p);
-		if (n < 6)
+		if (n < 2)
 			goto next_io;
 
 		/* Check it is an ASN1 SEQUENCE */
@@ -414,6 +415,11 @@ int OCSP_sendreq_nbio(OCSP_RESPONSE **presp, OCSP_REQ_CTX *rctx)
 		/* Check out length field */
 		if (*p & 0x80)
 			{
+			/* If MSB set on initial length octet we can now
+			 * always read 6 octets: make sure we have them.
+			 */
+			if (n < 6)
+				goto next_io;
 			n = *p & 0x7F;
 			/* Not NDEF or excessive length */
 			if (!n || (n > 4))

+ 0 - 2
openssl/crypto/ocsp/ocsp_prn.c

@@ -182,7 +182,6 @@ int OCSP_RESPONSE_print(BIO *bp, OCSP_RESPONSE* o, unsigned long flags)
         {
 	int i, ret = 0;
 	long l;
-	unsigned char *p;
 	OCSP_CERTID *cid = NULL;
 	OCSP_BASICRESP *br = NULL;
 	OCSP_RESPID *rid = NULL;
@@ -207,7 +206,6 @@ int OCSP_RESPONSE_print(BIO *bp, OCSP_RESPONSE* o, unsigned long flags)
 		return 1;
 		}
 
-	p = ASN1_STRING_data(rb->response);
 	i = ASN1_STRING_length(rb->response);
 	if (!(br = OCSP_response_get1_basic(o))) goto err;
 	rd = br->tbsResponseData;

+ 3 - 3
openssl/crypto/opensslv.h

@@ -25,11 +25,11 @@
  * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for
  *  major minor fix final patch/beta)
  */
-#define OPENSSL_VERSION_NUMBER	0x1000001fL
+#define OPENSSL_VERSION_NUMBER	0x1000003f
 #ifdef OPENSSL_FIPS
-#define OPENSSL_VERSION_TEXT	"OpenSSL 1.0.0a-fips 1 Jun 2010"
+#define OPENSSL_VERSION_TEXT	"OpenSSL 1.0.0c-fips 2 Dec 2010"
 #else
-#define OPENSSL_VERSION_TEXT	"OpenSSL 1.0.0a 1 Jun 2010"
+#define OPENSSL_VERSION_TEXT	"OpenSSL 1.0.0c 2 Dec 2010"
 #endif
 #define OPENSSL_VERSION_PTEXT	" part of " OPENSSL_VERSION_TEXT
 

+ 0 - 2
openssl/crypto/pem/pem_lib.c

@@ -482,7 +482,6 @@ int PEM_do_header(EVP_CIPHER_INFO *cipher, unsigned char *data, long *plen,
 
 int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher)
 	{
-	int o;
 	const EVP_CIPHER *enc=NULL;
 	char *p,c;
 	char **header_pp = &header;
@@ -522,7 +521,6 @@ int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher)
 		header++;
 		}
 	*header='\0';
-	o=OBJ_sn2nid(p);
 	cipher->cipher=enc=EVP_get_cipherbyname(p);
 	*header=c;
 	header++;

+ 3 - 7
openssl/crypto/pem/pvkfmt.c

@@ -662,7 +662,7 @@ static int do_PVK_header(const unsigned char **in, unsigned int length,
 		
 	{
 	const unsigned char *p = *in;
-	unsigned int pvk_magic, keytype, is_encrypted;
+	unsigned int pvk_magic, is_encrypted;
 	if (skip_magic)
 		{
 		if (length < 20)
@@ -689,7 +689,7 @@ static int do_PVK_header(const unsigned char **in, unsigned int length,
 		}
 	/* Skip reserved */
 	p += 4;
-	keytype = read_ledword(&p);
+	/*keytype = */read_ledword(&p);
 	is_encrypted = read_ledword(&p);
 	*psaltlen = read_ledword(&p);
 	*pkeylen = read_ledword(&p);
@@ -839,7 +839,7 @@ EVP_PKEY *b2i_PVK_bio(BIO *in, pem_password_cb *cb, void *u)
 static int i2b_PVK(unsigned char **out, EVP_PKEY*pk, int enclevel,
 		pem_password_cb *cb, void *u)
 	{
-	int outlen = 24, noinc, pklen;
+	int outlen = 24, pklen;
 	unsigned char *p, *salt = NULL;
 	if (enclevel)
 		outlen += PVK_SALTLEN;
@@ -850,10 +850,7 @@ static int i2b_PVK(unsigned char **out, EVP_PKEY*pk, int enclevel,
 	if (!out)
 		return outlen;
 	if (*out)
-		{
 		p = *out;
-		noinc = 0;
-		}
 	else
 		{
 		p = OPENSSL_malloc(outlen);
@@ -863,7 +860,6 @@ static int i2b_PVK(unsigned char **out, EVP_PKEY*pk, int enclevel,
 			return -1;
 			}
 		*out = p;
-		noinc = 1;
 		}
 
 	write_ledword(&p, MS_PVKMAGIC);

+ 22 - 16
openssl/crypto/pkcs12/p12_key.c

@@ -107,6 +107,7 @@ int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt,
 	unsigned char *B, *D, *I, *p, *Ai;
 	int Slen, Plen, Ilen, Ijlen;
 	int i, j, u, v;
+	int ret = 0;
 	BIGNUM *Ij, *Bpl1;	/* These hold Ij and B + 1 */
 	EVP_MD_CTX ctx;
 #ifdef  DEBUG_KEYGEN
@@ -144,10 +145,8 @@ int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt,
 	I = OPENSSL_malloc (Ilen);
 	Ij = BN_new();
 	Bpl1 = BN_new();
-	if (!D || !Ai || !B || !I || !Ij || !Bpl1) {
-		PKCS12err(PKCS12_F_PKCS12_KEY_GEN_UNI,ERR_R_MALLOC_FAILURE);
-		return 0;
-	}
+	if (!D || !Ai || !B || !I || !Ij || !Bpl1)
+		goto err;
 	for (i = 0; i < v; i++) D[i] = id;
 	p = I;
 	for (i = 0; i < Slen; i++) *p++ = salt[i % saltlen];
@@ -164,28 +163,22 @@ int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt,
 		}
 		memcpy (out, Ai, min (n, u));
 		if (u >= n) {
-			OPENSSL_free (Ai);
-			OPENSSL_free (B);
-			OPENSSL_free (D);
-			OPENSSL_free (I);
-			BN_free (Ij);
-			BN_free (Bpl1);
-			EVP_MD_CTX_cleanup(&ctx);
 #ifdef DEBUG_KEYGEN
 			fprintf(stderr, "Output KEY (length %d)\n", tmpn);
 			h__dump(tmpout, tmpn);
 #endif
-			return 1;	
+			ret = 1;
+			goto end;
 		}
 		n -= u;
 		out += u;
 		for (j = 0; j < v; j++) B[j] = Ai[j % u];
 		/* Work out B + 1 first then can use B as tmp space */
-		BN_bin2bn (B, v, Bpl1);
-		BN_add_word (Bpl1, 1);
+		if (!BN_bin2bn (B, v, Bpl1)) goto err;
+		if (!BN_add_word (Bpl1, 1)) goto err;
 		for (j = 0; j < Ilen ; j+=v) {
-			BN_bin2bn (I + j, v, Ij);
-			BN_add (Ij, Ij, Bpl1);
+			if (!BN_bin2bn (I + j, v, Ij)) goto err;
+			if (!BN_add (Ij, Ij, Bpl1)) goto err;
 			BN_bn2bin (Ij, B);
 			Ijlen = BN_num_bytes (Ij);
 			/* If more than 2^(v*8) - 1 cut off MSB */
@@ -201,6 +194,19 @@ int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt,
 			} else BN_bn2bin (Ij, I + j);
 		}
 	}
+
+err:
+	PKCS12err(PKCS12_F_PKCS12_KEY_GEN_UNI,ERR_R_MALLOC_FAILURE);
+
+end:
+	OPENSSL_free (Ai);
+	OPENSSL_free (B);
+	OPENSSL_free (D);
+	OPENSSL_free (I);
+	BN_free (Ij);
+	BN_free (Bpl1);
+	EVP_MD_CTX_cleanup(&ctx);
+	return ret;
 }
 #ifdef DEBUG_KEYGEN
 void h__dump (unsigned char *p, int len)

+ 0 - 3
openssl/crypto/pkcs7/pk7_doit.c

@@ -422,7 +422,6 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert)
 	X509_ALGOR *enc_alg=NULL;
 	STACK_OF(X509_ALGOR) *md_sk=NULL;
 	STACK_OF(PKCS7_RECIP_INFO) *rsk=NULL;
-	X509_ALGOR *xalg=NULL;
 	PKCS7_RECIP_INFO *ri=NULL;
 
 	i=OBJ_obj2nid(p7->type);
@@ -445,7 +444,6 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert)
 			PKCS7err(PKCS7_F_PKCS7_DATADECODE,PKCS7_R_UNSUPPORTED_CIPHER_TYPE);
 			goto err;
 			}
-		xalg=p7->d.signed_and_enveloped->enc_data->algorithm;
 		break;
 	case NID_pkcs7_enveloped:
 		rsk=p7->d.enveloped->recipientinfo;
@@ -457,7 +455,6 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert)
 			PKCS7err(PKCS7_F_PKCS7_DATADECODE,PKCS7_R_UNSUPPORTED_CIPHER_TYPE);
 			goto err;
 			}
-		xalg=p7->d.enveloped->enc_data->algorithm;
 		break;
 	default:
 		PKCS7err(PKCS7_F_PKCS7_DATADECODE,PKCS7_R_UNSUPPORTED_CONTENT_TYPE);

+ 0 - 2
openssl/crypto/pkcs7/pk7_lib.c

@@ -591,7 +591,6 @@ X509 *PKCS7_cert_from_signer_info(PKCS7 *p7, PKCS7_SIGNER_INFO *si)
 int PKCS7_set_cipher(PKCS7 *p7, const EVP_CIPHER *cipher)
 	{
 	int i;
-	ASN1_OBJECT *objtmp;
 	PKCS7_ENC_CONTENT *ec;
 
 	i=OBJ_obj2nid(p7->type);
@@ -614,7 +613,6 @@ int PKCS7_set_cipher(PKCS7 *p7, const EVP_CIPHER *cipher)
 		PKCS7err(PKCS7_F_PKCS7_SET_CIPHER,PKCS7_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER);
 		return(0);
 	}
-	objtmp = OBJ_nid2obj(i);
 
 	ec->cipher = cipher;
 	return 1;

+ 2 - 3
openssl/crypto/pqueue/pqueue.c

@@ -167,14 +167,13 @@ pqueue_pop(pqueue_s *pq)
 pitem *
 pqueue_find(pqueue_s *pq, unsigned char *prio64be)
 	{
-	pitem *next, *prev = NULL;
+	pitem *next;
 	pitem *found = NULL;
 
 	if ( pq->items == NULL)
 		return NULL;
 
-	for ( next = pq->items; next->next != NULL; 
-		  prev = next, next = next->next)
+	for ( next = pq->items; next->next != NULL; next = next->next)
 		{
 		if ( memcmp(next->priority, prio64be,8) == 0)
 			{

+ 7 - 4
openssl/crypto/rand/md_rand.c

@@ -476,11 +476,14 @@ static int ssleay_rand_bytes(unsigned char *buf, int num)
 		MD_Update(&m,(unsigned char *)&(md_c[0]),sizeof(md_c));
 
 #ifndef PURIFY /* purify complains */
-		/* DO NOT REMOVE THE FOLLOWING CALL TO MD_Update()! */
+		/* The following line uses the supplied buffer as a small
+		 * source of entropy: since this buffer is often uninitialised
+		 * it may cause programs such as purify or valgrind to
+		 * complain. So for those builds it is not used: the removal
+		 * of such a small source of entropy has negligible impact on
+		 * security.
+		 */
 		MD_Update(&m,buf,j);
-		/* We know that line may cause programs such as
-		   purify and valgrind to complain about use of
-		   uninitialized data.  */
 #endif
 
 		k=(st_idx+MD_DIGEST_LENGTH/2)-st_num;

+ 0 - 1969
openssl/crypto/ripemd/asm/rm_win32

@@ -1,1969 +0,0 @@
-%ifidn __OUTPUT_FORMAT__,obj
-section	code	use32 class=code align=64
-%elifidn __OUTPUT_FORMAT__,win32
[email protected] equ 1
-section	.text	code align=64
-%else
-section	.text	code
-%endif
-global	_ripemd160_block_asm_data_order
-align	16
-_ripemd160_block_asm_data_order:
-L$_ripemd160_block_asm_data_order_begin:
-	mov	edx,DWORD [4+esp]
-	mov	eax,DWORD [8+esp]
-	push	esi
-	mov	ecx,DWORD [edx]
-	push	edi
-	mov	esi,DWORD [4+edx]
-	push	ebp
-	mov	edi,DWORD [8+edx]
-	push	ebx
-	sub	esp,108
-L$000start:
-	; 
-	mov	ebx,DWORD [eax]
-	mov	ebp,DWORD [4+eax]
-	mov	DWORD [esp],ebx
-	mov	DWORD [4+esp],ebp
-	mov	ebx,DWORD [8+eax]
-	mov	ebp,DWORD [12+eax]
-	mov	DWORD [8+esp],ebx
-	mov	DWORD [12+esp],ebp
-	mov	ebx,DWORD [16+eax]
-	mov	ebp,DWORD [20+eax]
-	mov	DWORD [16+esp],ebx
-	mov	DWORD [20+esp],ebp
-	mov	ebx,DWORD [24+eax]
-	mov	ebp,DWORD [28+eax]
-	mov	DWORD [24+esp],ebx
-	mov	DWORD [28+esp],ebp
-	mov	ebx,DWORD [32+eax]
-	mov	ebp,DWORD [36+eax]
-	mov	DWORD [32+esp],ebx
-	mov	DWORD [36+esp],ebp
-	mov	ebx,DWORD [40+eax]
-	mov	ebp,DWORD [44+eax]
-	mov	DWORD [40+esp],ebx
-	mov	DWORD [44+esp],ebp
-	mov	ebx,DWORD [48+eax]
-	mov	ebp,DWORD [52+eax]
-	mov	DWORD [48+esp],ebx
-	mov	DWORD [52+esp],ebp
-	mov	ebx,DWORD [56+eax]
-	mov	ebp,DWORD [60+eax]
-	mov	DWORD [56+esp],ebx
-	mov	DWORD [60+esp],ebp
-	mov	eax,edi
-	mov	ebx,DWORD [12+edx]
-	mov	ebp,DWORD [16+edx]
-	; 0
-	xor	eax,ebx
-	mov	edx,DWORD [esp]
-	xor	eax,esi
-	add	ecx,edx
-	rol	edi,10
-	add	ecx,eax
-	mov	eax,esi
-	rol	ecx,11
-	add	ecx,ebp
-	; 1
-	xor	eax,edi
-	mov	edx,DWORD [4+esp]
-	xor	eax,ecx
-	add	ebp,eax
-	mov	eax,ecx
-	rol	esi,10
-	add	ebp,edx
-	xor	eax,esi
-	rol	ebp,14
-	add	ebp,ebx
-	; 2
-	mov	edx,DWORD [8+esp]
-	xor	eax,ebp
-	add	ebx,edx
-	rol	ecx,10
-	add	ebx,eax
-	mov	eax,ebp
-	rol	ebx,15
-	add	ebx,edi
-	; 3
-	xor	eax,ecx
-	mov	edx,DWORD [12+esp]
-	xor	eax,ebx
-	add	edi,eax
-	mov	eax,ebx
-	rol	ebp,10
-	add	edi,edx
-	xor	eax,ebp
-	rol	edi,12
-	add	edi,esi
-	; 4
-	mov	edx,DWORD [16+esp]
-	xor	eax,edi
-	add	esi,edx
-	rol	ebx,10
-	add	esi,eax
-	mov	eax,edi
-	rol	esi,5
-	add	esi,ecx
-	; 5
-	xor	eax,ebx
-	mov	edx,DWORD [20+esp]
-	xor	eax,esi
-	add	ecx,eax
-	mov	eax,esi
-	rol	edi,10
-	add	ecx,edx
-	xor	eax,edi
-	rol	ecx,8
-	add	ecx,ebp
-	; 6
-	mov	edx,DWORD [24+esp]
-	xor	eax,ecx
-	add	ebp,edx
-	rol	esi,10
-	add	ebp,eax
-	mov	eax,ecx
-	rol	ebp,7
-	add	ebp,ebx
-	; 7
-	xor	eax,esi
-	mov	edx,DWORD [28+esp]
-	xor	eax,ebp
-	add	ebx,eax
-	mov	eax,ebp
-	rol	ecx,10
-	add	ebx,edx
-	xor	eax,ecx
-	rol	ebx,9
-	add	ebx,edi
-	; 8
-	mov	edx,DWORD [32+esp]
-	xor	eax,ebx
-	add	edi,edx
-	rol	ebp,10
-	add	edi,eax
-	mov	eax,ebx
-	rol	edi,11
-	add	edi,esi
-	; 9
-	xor	eax,ebp
-	mov	edx,DWORD [36+esp]
-	xor	eax,edi
-	add	esi,eax
-	mov	eax,edi
-	rol	ebx,10
-	add	esi,edx
-	xor	eax,ebx
-	rol	esi,13
-	add	esi,ecx
-	; 10
-	mov	edx,DWORD [40+esp]
-	xor	eax,esi
-	add	ecx,edx
-	rol	edi,10
-	add	ecx,eax
-	mov	eax,esi
-	rol	ecx,14
-	add	ecx,ebp
-	; 11
-	xor	eax,edi
-	mov	edx,DWORD [44+esp]
-	xor	eax,ecx
-	add	ebp,eax
-	mov	eax,ecx
-	rol	esi,10
-	add	ebp,edx
-	xor	eax,esi
-	rol	ebp,15
-	add	ebp,ebx
-	; 12
-	mov	edx,DWORD [48+esp]
-	xor	eax,ebp
-	add	ebx,edx
-	rol	ecx,10
-	add	ebx,eax
-	mov	eax,ebp
-	rol	ebx,6
-	add	ebx,edi
-	; 13
-	xor	eax,ecx
-	mov	edx,DWORD [52+esp]
-	xor	eax,ebx
-	add	edi,eax
-	mov	eax,ebx
-	rol	ebp,10
-	add	edi,edx
-	xor	eax,ebp
-	rol	edi,7
-	add	edi,esi
-	; 14
-	mov	edx,DWORD [56+esp]
-	xor	eax,edi
-	add	esi,edx
-	rol	ebx,10
-	add	esi,eax
-	mov	eax,edi
-	rol	esi,9
-	add	esi,ecx
-	; 15
-	xor	eax,ebx
-	mov	edx,DWORD [60+esp]
-	xor	eax,esi
-	add	ecx,eax
-	mov	eax,-1
-	rol	edi,10
-	add	ecx,edx
-	mov	edx,DWORD [28+esp]
-	rol	ecx,8
-	add	ecx,ebp
-	; 16
-	add	ebp,edx
-	mov	edx,esi
-	sub	eax,ecx
-	and	edx,ecx
-	and	eax,edi
-	or	edx,eax
-	mov	eax,DWORD [16+esp]
-	rol	esi,10
-	lea	ebp,[1518500249+edx*1+ebp]
-	mov	edx,-1
-	rol	ebp,7
-	add	ebp,ebx
-	; 17
-	add	ebx,eax
-	mov	eax,ecx
-	sub	edx,ebp
-	and	eax,ebp
-	and	edx,esi
-	or	eax,edx
-	mov	edx,DWORD [52+esp]
-	rol	ecx,10
-	lea	ebx,[1518500249+eax*1+ebx]
-	mov	eax,-1
-	rol	ebx,6
-	add	ebx,edi
-	; 18
-	add	edi,edx
-	mov	edx,ebp
-	sub	eax,ebx
-	and	edx,ebx
-	and	eax,ecx
-	or	edx,eax
-	mov	eax,DWORD [4+esp]
-	rol	ebp,10
-	lea	edi,[1518500249+edx*1+edi]
-	mov	edx,-1
-	rol	edi,8
-	add	edi,esi
-	; 19
-	add	esi,eax
-	mov	eax,ebx
-	sub	edx,edi
-	and	eax,edi
-	and	edx,ebp
-	or	eax,edx
-	mov	edx,DWORD [40+esp]
-	rol	ebx,10
-	lea	esi,[1518500249+eax*1+esi]
-	mov	eax,-1
-	rol	esi,13
-	add	esi,ecx
-	; 20
-	add	ecx,edx
-	mov	edx,edi
-	sub	eax,esi
-	and	edx,esi
-	and	eax,ebx
-	or	edx,eax
-	mov	eax,DWORD [24+esp]
-	rol	edi,10
-	lea	ecx,[1518500249+edx*1+ecx]
-	mov	edx,-1
-	rol	ecx,11
-	add	ecx,ebp
-	; 21
-	add	ebp,eax
-	mov	eax,esi
-	sub	edx,ecx
-	and	eax,ecx
-	and	edx,edi
-	or	eax,edx
-	mov	edx,DWORD [60+esp]
-	rol	esi,10
-	lea	ebp,[1518500249+eax*1+ebp]
-	mov	eax,-1
-	rol	ebp,9
-	add	ebp,ebx
-	; 22
-	add	ebx,edx
-	mov	edx,ecx
-	sub	eax,ebp
-	and	edx,ebp
-	and	eax,esi
-	or	edx,eax
-	mov	eax,DWORD [12+esp]
-	rol	ecx,10
-	lea	ebx,[1518500249+edx*1+ebx]
-	mov	edx,-1
-	rol	ebx,7
-	add	ebx,edi
-	; 23
-	add	edi,eax
-	mov	eax,ebp
-	sub	edx,ebx
-	and	eax,ebx
-	and	edx,ecx
-	or	eax,edx
-	mov	edx,DWORD [48+esp]
-	rol	ebp,10
-	lea	edi,[1518500249+eax*1+edi]
-	mov	eax,-1
-	rol	edi,15
-	add	edi,esi
-	; 24
-	add	esi,edx
-	mov	edx,ebx
-	sub	eax,edi
-	and	edx,edi
-	and	eax,ebp
-	or	edx,eax
-	mov	eax,DWORD [esp]
-	rol	ebx,10
-	lea	esi,[1518500249+edx*1+esi]
-	mov	edx,-1
-	rol	esi,7
-	add	esi,ecx
-	; 25
-	add	ecx,eax
-	mov	eax,edi
-	sub	edx,esi
-	and	eax,esi
-	and	edx,ebx
-	or	eax,edx
-	mov	edx,DWORD [36+esp]
-	rol	edi,10
-	lea	ecx,[1518500249+eax*1+ecx]
-	mov	eax,-1
-	rol	ecx,12
-	add	ecx,ebp
-	; 26
-	add	ebp,edx
-	mov	edx,esi
-	sub	eax,ecx
-	and	edx,ecx
-	and	eax,edi
-	or	edx,eax
-	mov	eax,DWORD [20+esp]
-	rol	esi,10
-	lea	ebp,[1518500249+edx*1+ebp]
-	mov	edx,-1
-	rol	ebp,15
-	add	ebp,ebx
-	; 27
-	add	ebx,eax
-	mov	eax,ecx
-	sub	edx,ebp
-	and	eax,ebp
-	and	edx,esi
-	or	eax,edx
-	mov	edx,DWORD [8+esp]
-	rol	ecx,10
-	lea	ebx,[1518500249+eax*1+ebx]
-	mov	eax,-1
-	rol	ebx,9
-	add	ebx,edi
-	; 28
-	add	edi,edx
-	mov	edx,ebp
-	sub	eax,ebx
-	and	edx,ebx
-	and	eax,ecx
-	or	edx,eax
-	mov	eax,DWORD [56+esp]
-	rol	ebp,10
-	lea	edi,[1518500249+edx*1+edi]
-	mov	edx,-1
-	rol	edi,11
-	add	edi,esi
-	; 29
-	add	esi,eax
-	mov	eax,ebx
-	sub	edx,edi
-	and	eax,edi
-	and	edx,ebp
-	or	eax,edx
-	mov	edx,DWORD [44+esp]
-	rol	ebx,10
-	lea	esi,[1518500249+eax*1+esi]
-	mov	eax,-1
-	rol	esi,7
-	add	esi,ecx
-	; 30
-	add	ecx,edx
-	mov	edx,edi
-	sub	eax,esi
-	and	edx,esi
-	and	eax,ebx
-	or	edx,eax
-	mov	eax,DWORD [32+esp]
-	rol	edi,10
-	lea	ecx,[1518500249+edx*1+ecx]
-	mov	edx,-1
-	rol	ecx,13
-	add	ecx,ebp
-	; 31
-	add	ebp,eax
-	mov	eax,esi
-	sub	edx,ecx
-	and	eax,ecx
-	and	edx,edi
-	or	eax,edx
-	mov	edx,-1
-	rol	esi,10
-	lea	ebp,[1518500249+eax*1+ebp]
-	sub	edx,ecx
-	rol	ebp,12
-	add	ebp,ebx
-	; 32
-	mov	eax,DWORD [12+esp]
-	or	edx,ebp
-	add	ebx,eax
-	xor	edx,esi
-	mov	eax,-1
-	rol	ecx,10
-	lea	ebx,[1859775393+edx*1+ebx]
-	sub	eax,ebp
-	rol	ebx,11
-	add	ebx,edi
-	; 33
-	mov	edx,DWORD [40+esp]
-	or	eax,ebx
-	add	edi,edx
-	xor	eax,ecx
-	mov	edx,-1
-	rol	ebp,10
-	lea	edi,[1859775393+eax*1+edi]
-	sub	edx,ebx
-	rol	edi,13
-	add	edi,esi
-	; 34
-	mov	eax,DWORD [56+esp]
-	or	edx,edi
-	add	esi,eax
-	xor	edx,ebp
-	mov	eax,-1
-	rol	ebx,10
-	lea	esi,[1859775393+edx*1+esi]
-	sub	eax,edi
-	rol	esi,6
-	add	esi,ecx
-	; 35
-	mov	edx,DWORD [16+esp]
-	or	eax,esi
-	add	ecx,edx
-	xor	eax,ebx
-	mov	edx,-1
-	rol	edi,10
-	lea	ecx,[1859775393+eax*1+ecx]
-	sub	edx,esi
-	rol	ecx,7
-	add	ecx,ebp
-	; 36
-	mov	eax,DWORD [36+esp]
-	or	edx,ecx
-	add	ebp,eax
-	xor	edx,edi
-	mov	eax,-1
-	rol	esi,10
-	lea	ebp,[1859775393+edx*1+ebp]
-	sub	eax,ecx
-	rol	ebp,14
-	add	ebp,ebx
-	; 37
-	mov	edx,DWORD [60+esp]
-	or	eax,ebp
-	add	ebx,edx
-	xor	eax,esi
-	mov	edx,-1
-	rol	ecx,10
-	lea	ebx,[1859775393+eax*1+ebx]
-	sub	edx,ebp
-	rol	ebx,9
-	add	ebx,edi
-	; 38
-	mov	eax,DWORD [32+esp]
-	or	edx,ebx
-	add	edi,eax
-	xor	edx,ecx
-	mov	eax,-1
-	rol	ebp,10
-	lea	edi,[1859775393+edx*1+edi]
-	sub	eax,ebx
-	rol	edi,13
-	add	edi,esi
-	; 39
-	mov	edx,DWORD [4+esp]
-	or	eax,edi
-	add	esi,edx
-	xor	eax,ebp
-	mov	edx,-1
-	rol	ebx,10
-	lea	esi,[1859775393+eax*1+esi]
-	sub	edx,edi
-	rol	esi,15
-	add	esi,ecx
-	; 40
-	mov	eax,DWORD [8+esp]
-	or	edx,esi
-	add	ecx,eax
-	xor	edx,ebx
-	mov	eax,-1
-	rol	edi,10
-	lea	ecx,[1859775393+edx*1+ecx]
-	sub	eax,esi
-	rol	ecx,14
-	add	ecx,ebp
-	; 41
-	mov	edx,DWORD [28+esp]
-	or	eax,ecx
-	add	ebp,edx
-	xor	eax,edi
-	mov	edx,-1
-	rol	esi,10
-	lea	ebp,[1859775393+eax*1+ebp]
-	sub	edx,ecx
-	rol	ebp,8
-	add	ebp,ebx
-	; 42
-	mov	eax,DWORD [esp]
-	or	edx,ebp
-	add	ebx,eax
-	xor	edx,esi
-	mov	eax,-1
-	rol	ecx,10
-	lea	ebx,[1859775393+edx*1+ebx]
-	sub	eax,ebp
-	rol	ebx,13
-	add	ebx,edi
-	; 43
-	mov	edx,DWORD [24+esp]
-	or	eax,ebx
-	add	edi,edx
-	xor	eax,ecx
-	mov	edx,-1
-	rol	ebp,10
-	lea	edi,[1859775393+eax*1+edi]
-	sub	edx,ebx
-	rol	edi,6
-	add	edi,esi
-	; 44
-	mov	eax,DWORD [52+esp]
-	or	edx,edi
-	add	esi,eax
-	xor	edx,ebp
-	mov	eax,-1
-	rol	ebx,10
-	lea	esi,[1859775393+edx*1+esi]
-	sub	eax,edi
-	rol	esi,5
-	add	esi,ecx
-	; 45
-	mov	edx,DWORD [44+esp]
-	or	eax,esi
-	add	ecx,edx
-	xor	eax,ebx
-	mov	edx,-1
-	rol	edi,10
-	lea	ecx,[1859775393+eax*1+ecx]
-	sub	edx,esi
-	rol	ecx,12
-	add	ecx,ebp
-	; 46
-	mov	eax,DWORD [20+esp]
-	or	edx,ecx
-	add	ebp,eax
-	xor	edx,edi
-	mov	eax,-1
-	rol	esi,10
-	lea	ebp,[1859775393+edx*1+ebp]
-	sub	eax,ecx
-	rol	ebp,7
-	add	ebp,ebx
-	; 47
-	mov	edx,DWORD [48+esp]
-	or	eax,ebp
-	add	ebx,edx
-	xor	eax,esi
-	mov	edx,-1
-	rol	ecx,10
-	lea	ebx,[1859775393+eax*1+ebx]
-	mov	eax,ecx
-	rol	ebx,5
-	add	ebx,edi
-	; 48
-	sub	edx,ecx
-	and	eax,ebx
-	and	edx,ebp
-	or	edx,eax
-	mov	eax,DWORD [4+esp]
-	rol	ebp,10
-	lea	edi,[2400959708+edx*1+edi]
-	mov	edx,-1
-	add	edi,eax
-	mov	eax,ebp
-	rol	edi,11
-	add	edi,esi
-	; 49
-	sub	edx,ebp
-	and	eax,edi
-	and	edx,ebx
-	or	edx,eax
-	mov	eax,DWORD [36+esp]
-	rol	ebx,10
-	lea	esi,[2400959708+edx*1+esi]
-	mov	edx,-1
-	add	esi,eax
-	mov	eax,ebx
-	rol	esi,12
-	add	esi,ecx
-	; 50
-	sub	edx,ebx
-	and	eax,esi
-	and	edx,edi
-	or	edx,eax
-	mov	eax,DWORD [44+esp]
-	rol	edi,10
-	lea	ecx,[2400959708+edx*1+ecx]
-	mov	edx,-1
-	add	ecx,eax
-	mov	eax,edi
-	rol	ecx,14
-	add	ecx,ebp
-	; 51
-	sub	edx,edi
-	and	eax,ecx
-	and	edx,esi
-	or	edx,eax
-	mov	eax,DWORD [40+esp]
-	rol	esi,10
-	lea	ebp,[2400959708+edx*1+ebp]
-	mov	edx,-1
-	add	ebp,eax
-	mov	eax,esi
-	rol	ebp,15
-	add	ebp,ebx
-	; 52
-	sub	edx,esi
-	and	eax,ebp
-	and	edx,ecx
-	or	edx,eax
-	mov	eax,DWORD [esp]
-	rol	ecx,10
-	lea	ebx,[2400959708+edx*1+ebx]
-	mov	edx,-1
-	add	ebx,eax
-	mov	eax,ecx
-	rol	ebx,14
-	add	ebx,edi
-	; 53
-	sub	edx,ecx
-	and	eax,ebx
-	and	edx,ebp
-	or	edx,eax
-	mov	eax,DWORD [32+esp]
-	rol	ebp,10
-	lea	edi,[2400959708+edx*1+edi]
-	mov	edx,-1
-	add	edi,eax
-	mov	eax,ebp
-	rol	edi,15
-	add	edi,esi
-	; 54
-	sub	edx,ebp
-	and	eax,edi
-	and	edx,ebx
-	or	edx,eax
-	mov	eax,DWORD [48+esp]
-	rol	ebx,10
-	lea	esi,[2400959708+edx*1+esi]
-	mov	edx,-1
-	add	esi,eax
-	mov	eax,ebx
-	rol	esi,9
-	add	esi,ecx
-	; 55
-	sub	edx,ebx
-	and	eax,esi
-	and	edx,edi
-	or	edx,eax
-	mov	eax,DWORD [16+esp]
-	rol	edi,10
-	lea	ecx,[2400959708+edx*1+ecx]
-	mov	edx,-1
-	add	ecx,eax
-	mov	eax,edi
-	rol	ecx,8
-	add	ecx,ebp
-	; 56
-	sub	edx,edi
-	and	eax,ecx
-	and	edx,esi
-	or	edx,eax
-	mov	eax,DWORD [52+esp]
-	rol	esi,10
-	lea	ebp,[2400959708+edx*1+ebp]
-	mov	edx,-1
-	add	ebp,eax
-	mov	eax,esi
-	rol	ebp,9
-	add	ebp,ebx
-	; 57
-	sub	edx,esi
-	and	eax,ebp
-	and	edx,ecx
-	or	edx,eax
-	mov	eax,DWORD [12+esp]
-	rol	ecx,10
-	lea	ebx,[2400959708+edx*1+ebx]
-	mov	edx,-1
-	add	ebx,eax
-	mov	eax,ecx
-	rol	ebx,14
-	add	ebx,edi
-	; 58
-	sub	edx,ecx
-	and	eax,ebx
-	and	edx,ebp
-	or	edx,eax
-	mov	eax,DWORD [28+esp]
-	rol	ebp,10
-	lea	edi,[2400959708+edx*1+edi]
-	mov	edx,-1
-	add	edi,eax
-	mov	eax,ebp
-	rol	edi,5
-	add	edi,esi
-	; 59
-	sub	edx,ebp
-	and	eax,edi
-	and	edx,ebx
-	or	edx,eax
-	mov	eax,DWORD [60+esp]
-	rol	ebx,10
-	lea	esi,[2400959708+edx*1+esi]
-	mov	edx,-1
-	add	esi,eax
-	mov	eax,ebx
-	rol	esi,6
-	add	esi,ecx
-	; 60
-	sub	edx,ebx
-	and	eax,esi
-	and	edx,edi
-	or	edx,eax
-	mov	eax,DWORD [56+esp]
-	rol	edi,10
-	lea	ecx,[2400959708+edx*1+ecx]
-	mov	edx,-1
-	add	ecx,eax
-	mov	eax,edi
-	rol	ecx,8
-	add	ecx,ebp
-	; 61
-	sub	edx,edi
-	and	eax,ecx
-	and	edx,esi
-	or	edx,eax
-	mov	eax,DWORD [20+esp]
-	rol	esi,10
-	lea	ebp,[2400959708+edx*1+ebp]
-	mov	edx,-1
-	add	ebp,eax
-	mov	eax,esi
-	rol	ebp,6
-	add	ebp,ebx
-	; 62
-	sub	edx,esi
-	and	eax,ebp
-	and	edx,ecx
-	or	edx,eax
-	mov	eax,DWORD [24+esp]
-	rol	ecx,10
-	lea	ebx,[2400959708+edx*1+ebx]
-	mov	edx,-1
-	add	ebx,eax
-	mov	eax,ecx
-	rol	ebx,5
-	add	ebx,edi
-	; 63
-	sub	edx,ecx
-	and	eax,ebx
-	and	edx,ebp
-	or	edx,eax
-	mov	eax,DWORD [8+esp]
-	rol	ebp,10
-	lea	edi,[2400959708+edx*1+edi]
-	mov	edx,-1
-	add	edi,eax
-	sub	edx,ebp
-	rol	edi,12
-	add	edi,esi
-	; 64
-	mov	eax,DWORD [16+esp]
-	or	edx,ebx
-	add	esi,eax
-	xor	edx,edi
-	mov	eax,-1
-	rol	ebx,10
-	lea	esi,[2840853838+edx*1+esi]
-	sub	eax,ebx
-	rol	esi,9
-	add	esi,ecx
-	; 65
-	mov	edx,DWORD [esp]
-	or	eax,edi
-	add	ecx,edx
-	xor	eax,esi
-	mov	edx,-1
-	rol	edi,10
-	lea	ecx,[2840853838+eax*1+ecx]
-	sub	edx,edi
-	rol	ecx,15
-	add	ecx,ebp
-	; 66
-	mov	eax,DWORD [20+esp]
-	or	edx,esi
-	add	ebp,eax
-	xor	edx,ecx
-	mov	eax,-1
-	rol	esi,10
-	lea	ebp,[2840853838+edx*1+ebp]
-	sub	eax,esi
-	rol	ebp,5
-	add	ebp,ebx
-	; 67
-	mov	edx,DWORD [36+esp]
-	or	eax,ecx
-	add	ebx,edx
-	xor	eax,ebp
-	mov	edx,-1
-	rol	ecx,10
-	lea	ebx,[2840853838+eax*1+ebx]
-	sub	edx,ecx
-	rol	ebx,11
-	add	ebx,edi
-	; 68
-	mov	eax,DWORD [28+esp]
-	or	edx,ebp
-	add	edi,eax
-	xor	edx,ebx
-	mov	eax,-1
-	rol	ebp,10
-	lea	edi,[2840853838+edx*1+edi]
-	sub	eax,ebp
-	rol	edi,6
-	add	edi,esi
-	; 69
-	mov	edx,DWORD [48+esp]
-	or	eax,ebx
-	add	esi,edx
-	xor	eax,edi
-	mov	edx,-1
-	rol	ebx,10
-	lea	esi,[2840853838+eax*1+esi]
-	sub	edx,ebx
-	rol	esi,8
-	add	esi,ecx
-	; 70
-	mov	eax,DWORD [8+esp]
-	or	edx,edi
-	add	ecx,eax
-	xor	edx,esi
-	mov	eax,-1
-	rol	edi,10
-	lea	ecx,[2840853838+edx*1+ecx]
-	sub	eax,edi
-	rol	ecx,13
-	add	ecx,ebp
-	; 71
-	mov	edx,DWORD [40+esp]
-	or	eax,esi
-	add	ebp,edx
-	xor	eax,ecx
-	mov	edx,-1
-	rol	esi,10
-	lea	ebp,[2840853838+eax*1+ebp]
-	sub	edx,esi
-	rol	ebp,12
-	add	ebp,ebx
-	; 72
-	mov	eax,DWORD [56+esp]
-	or	edx,ecx
-	add	ebx,eax
-	xor	edx,ebp
-	mov	eax,-1
-	rol	ecx,10
-	lea	ebx,[2840853838+edx*1+ebx]
-	sub	eax,ecx
-	rol	ebx,5
-	add	ebx,edi
-	; 73
-	mov	edx,DWORD [4+esp]
-	or	eax,ebp
-	add	edi,edx
-	xor	eax,ebx
-	mov	edx,-1
-	rol	ebp,10
-	lea	edi,[2840853838+eax*1+edi]
-	sub	edx,ebp
-	rol	edi,12
-	add	edi,esi
-	; 74
-	mov	eax,DWORD [12+esp]
-	or	edx,ebx
-	add	esi,eax
-	xor	edx,edi
-	mov	eax,-1
-	rol	ebx,10
-	lea	esi,[2840853838+edx*1+esi]
-	sub	eax,ebx
-	rol	esi,13
-	add	esi,ecx
-	; 75
-	mov	edx,DWORD [32+esp]
-	or	eax,edi
-	add	ecx,edx
-	xor	eax,esi
-	mov	edx,-1
-	rol	edi,10
-	lea	ecx,[2840853838+eax*1+ecx]
-	sub	edx,edi
-	rol	ecx,14
-	add	ecx,ebp
-	; 76
-	mov	eax,DWORD [44+esp]
-	or	edx,esi
-	add	ebp,eax
-	xor	edx,ecx
-	mov	eax,-1
-	rol	esi,10
-	lea	ebp,[2840853838+edx*1+ebp]
-	sub	eax,esi
-	rol	ebp,11
-	add	ebp,ebx
-	; 77
-	mov	edx,DWORD [24+esp]
-	or	eax,ecx
-	add	ebx,edx
-	xor	eax,ebp
-	mov	edx,-1
-	rol	ecx,10
-	lea	ebx,[2840853838+eax*1+ebx]
-	sub	edx,ecx
-	rol	ebx,8
-	add	ebx,edi
-	; 78
-	mov	eax,DWORD [60+esp]
-	or	edx,ebp
-	add	edi,eax
-	xor	edx,ebx
-	mov	eax,-1
-	rol	ebp,10
-	lea	edi,[2840853838+edx*1+edi]
-	sub	eax,ebp
-	rol	edi,5
-	add	edi,esi
-	; 79
-	mov	edx,DWORD [52+esp]
-	or	eax,ebx
-	add	esi,edx
-	xor	eax,edi
-	mov	edx,DWORD [128+esp]
-	rol	ebx,10
-	lea	esi,[2840853838+eax*1+esi]
-	mov	DWORD [64+esp],ecx
-	rol	esi,6
-	add	esi,ecx
-	mov	ecx,DWORD [edx]
-	mov	DWORD [68+esp],esi
-	mov	DWORD [72+esp],edi
-	mov	esi,DWORD [4+edx]
-	mov	DWORD [76+esp],ebx
-	mov	edi,DWORD [8+edx]
-	mov	DWORD [80+esp],ebp
-	mov	ebx,DWORD [12+edx]
-	mov	ebp,DWORD [16+edx]
-	; 80
-	mov	edx,-1
-	sub	edx,ebx
-	mov	eax,DWORD [20+esp]
-	or	edx,edi
-	add	ecx,eax
-	xor	edx,esi
-	mov	eax,-1
-	rol	edi,10
-	lea	ecx,[1352829926+edx*1+ecx]
-	sub	eax,edi
-	rol	ecx,8
-	add	ecx,ebp
-	; 81
-	mov	edx,DWORD [56+esp]
-	or	eax,esi
-	add	ebp,edx
-	xor	eax,ecx
-	mov	edx,-1
-	rol	esi,10
-	lea	ebp,[1352829926+eax*1+ebp]
-	sub	edx,esi
-	rol	ebp,9
-	add	ebp,ebx
-	; 82
-	mov	eax,DWORD [28+esp]
-	or	edx,ecx
-	add	ebx,eax
-	xor	edx,ebp
-	mov	eax,-1
-	rol	ecx,10
-	lea	ebx,[1352829926+edx*1+ebx]
-	sub	eax,ecx
-	rol	ebx,9
-	add	ebx,edi
-	; 83
-	mov	edx,DWORD [esp]
-	or	eax,ebp
-	add	edi,edx
-	xor	eax,ebx
-	mov	edx,-1
-	rol	ebp,10
-	lea	edi,[1352829926+eax*1+edi]
-	sub	edx,ebp
-	rol	edi,11
-	add	edi,esi
-	; 84
-	mov	eax,DWORD [36+esp]
-	or	edx,ebx
-	add	esi,eax
-	xor	edx,edi
-	mov	eax,-1
-	rol	ebx,10
-	lea	esi,[1352829926+edx*1+esi]
-	sub	eax,ebx
-	rol	esi,13
-	add	esi,ecx
-	; 85
-	mov	edx,DWORD [8+esp]
-	or	eax,edi
-	add	ecx,edx
-	xor	eax,esi
-	mov	edx,-1
-	rol	edi,10
-	lea	ecx,[1352829926+eax*1+ecx]
-	sub	edx,edi
-	rol	ecx,15
-	add	ecx,ebp
-	; 86
-	mov	eax,DWORD [44+esp]
-	or	edx,esi
-	add	ebp,eax
-	xor	edx,ecx
-	mov	eax,-1
-	rol	esi,10
-	lea	ebp,[1352829926+edx*1+ebp]
-	sub	eax,esi
-	rol	ebp,15
-	add	ebp,ebx
-	; 87
-	mov	edx,DWORD [16+esp]
-	or	eax,ecx
-	add	ebx,edx
-	xor	eax,ebp
-	mov	edx,-1
-	rol	ecx,10
-	lea	ebx,[1352829926+eax*1+ebx]
-	sub	edx,ecx
-	rol	ebx,5
-	add	ebx,edi
-	; 88
-	mov	eax,DWORD [52+esp]
-	or	edx,ebp
-	add	edi,eax
-	xor	edx,ebx
-	mov	eax,-1
-	rol	ebp,10
-	lea	edi,[1352829926+edx*1+edi]
-	sub	eax,ebp
-	rol	edi,7
-	add	edi,esi
-	; 89
-	mov	edx,DWORD [24+esp]
-	or	eax,ebx
-	add	esi,edx
-	xor	eax,edi
-	mov	edx,-1
-	rol	ebx,10
-	lea	esi,[1352829926+eax*1+esi]
-	sub	edx,ebx
-	rol	esi,7
-	add	esi,ecx
-	; 90
-	mov	eax,DWORD [60+esp]
-	or	edx,edi
-	add	ecx,eax
-	xor	edx,esi
-	mov	eax,-1
-	rol	edi,10
-	lea	ecx,[1352829926+edx*1+ecx]
-	sub	eax,edi
-	rol	ecx,8
-	add	ecx,ebp
-	; 91
-	mov	edx,DWORD [32+esp]
-	or	eax,esi
-	add	ebp,edx
-	xor	eax,ecx
-	mov	edx,-1
-	rol	esi,10
-	lea	ebp,[1352829926+eax*1+ebp]
-	sub	edx,esi
-	rol	ebp,11
-	add	ebp,ebx
-	; 92
-	mov	eax,DWORD [4+esp]
-	or	edx,ecx
-	add	ebx,eax
-	xor	edx,ebp
-	mov	eax,-1
-	rol	ecx,10
-	lea	ebx,[1352829926+edx*1+ebx]
-	sub	eax,ecx
-	rol	ebx,14
-	add	ebx,edi
-	; 93
-	mov	edx,DWORD [40+esp]
-	or	eax,ebp
-	add	edi,edx
-	xor	eax,ebx
-	mov	edx,-1
-	rol	ebp,10
-	lea	edi,[1352829926+eax*1+edi]
-	sub	edx,ebp
-	rol	edi,14
-	add	edi,esi
-	; 94
-	mov	eax,DWORD [12+esp]
-	or	edx,ebx
-	add	esi,eax
-	xor	edx,edi
-	mov	eax,-1
-	rol	ebx,10
-	lea	esi,[1352829926+edx*1+esi]
-	sub	eax,ebx
-	rol	esi,12
-	add	esi,ecx
-	; 95
-	mov	edx,DWORD [48+esp]
-	or	eax,edi
-	add	ecx,edx
-	xor	eax,esi
-	mov	edx,-1
-	rol	edi,10
-	lea	ecx,[1352829926+eax*1+ecx]
-	mov	eax,edi
-	rol	ecx,6
-	add	ecx,ebp
-	; 96
-	sub	edx,edi
-	and	eax,ecx
-	and	edx,esi
-	or	edx,eax
-	mov	eax,DWORD [24+esp]
-	rol	esi,10
-	lea	ebp,[1548603684+edx*1+ebp]
-	mov	edx,-1
-	add	ebp,eax
-	mov	eax,esi
-	rol	ebp,9
-	add	ebp,ebx
-	; 97
-	sub	edx,esi
-	and	eax,ebp
-	and	edx,ecx
-	or	edx,eax
-	mov	eax,DWORD [44+esp]
-	rol	ecx,10
-	lea	ebx,[1548603684+edx*1+ebx]
-	mov	edx,-1
-	add	ebx,eax
-	mov	eax,ecx
-	rol	ebx,13
-	add	ebx,edi
-	; 98
-	sub	edx,ecx
-	and	eax,ebx
-	and	edx,ebp
-	or	edx,eax
-	mov	eax,DWORD [12+esp]
-	rol	ebp,10
-	lea	edi,[1548603684+edx*1+edi]
-	mov	edx,-1
-	add	edi,eax
-	mov	eax,ebp
-	rol	edi,15
-	add	edi,esi
-	; 99
-	sub	edx,ebp
-	and	eax,edi
-	and	edx,ebx
-	or	edx,eax
-	mov	eax,DWORD [28+esp]
-	rol	ebx,10
-	lea	esi,[1548603684+edx*1+esi]
-	mov	edx,-1
-	add	esi,eax
-	mov	eax,ebx
-	rol	esi,7
-	add	esi,ecx
-	; 100
-	sub	edx,ebx
-	and	eax,esi
-	and	edx,edi
-	or	edx,eax
-	mov	eax,DWORD [esp]
-	rol	edi,10
-	lea	ecx,[1548603684+edx*1+ecx]
-	mov	edx,-1
-	add	ecx,eax
-	mov	eax,edi
-	rol	ecx,12
-	add	ecx,ebp
-	; 101
-	sub	edx,edi
-	and	eax,ecx
-	and	edx,esi
-	or	edx,eax
-	mov	eax,DWORD [52+esp]
-	rol	esi,10
-	lea	ebp,[1548603684+edx*1+ebp]
-	mov	edx,-1
-	add	ebp,eax
-	mov	eax,esi
-	rol	ebp,8
-	add	ebp,ebx
-	; 102
-	sub	edx,esi
-	and	eax,ebp
-	and	edx,ecx
-	or	edx,eax
-	mov	eax,DWORD [20+esp]
-	rol	ecx,10
-	lea	ebx,[1548603684+edx*1+ebx]
-	mov	edx,-1
-	add	ebx,eax
-	mov	eax,ecx
-	rol	ebx,9
-	add	ebx,edi
-	; 103
-	sub	edx,ecx
-	and	eax,ebx
-	and	edx,ebp
-	or	edx,eax
-	mov	eax,DWORD [40+esp]
-	rol	ebp,10
-	lea	edi,[1548603684+edx*1+edi]
-	mov	edx,-1
-	add	edi,eax
-	mov	eax,ebp
-	rol	edi,11
-	add	edi,esi
-	; 104
-	sub	edx,ebp
-	and	eax,edi
-	and	edx,ebx
-	or	edx,eax
-	mov	eax,DWORD [56+esp]
-	rol	ebx,10
-	lea	esi,[1548603684+edx*1+esi]
-	mov	edx,-1
-	add	esi,eax
-	mov	eax,ebx
-	rol	esi,7
-	add	esi,ecx
-	; 105
-	sub	edx,ebx
-	and	eax,esi
-	and	edx,edi
-	or	edx,eax
-	mov	eax,DWORD [60+esp]
-	rol	edi,10
-	lea	ecx,[1548603684+edx*1+ecx]
-	mov	edx,-1
-	add	ecx,eax
-	mov	eax,edi
-	rol	ecx,7
-	add	ecx,ebp
-	; 106
-	sub	edx,edi
-	and	eax,ecx
-	and	edx,esi
-	or	edx,eax
-	mov	eax,DWORD [32+esp]
-	rol	esi,10
-	lea	ebp,[1548603684+edx*1+ebp]
-	mov	edx,-1
-	add	ebp,eax
-	mov	eax,esi
-	rol	ebp,12
-	add	ebp,ebx
-	; 107
-	sub	edx,esi
-	and	eax,ebp
-	and	edx,ecx
-	or	edx,eax
-	mov	eax,DWORD [48+esp]
-	rol	ecx,10
-	lea	ebx,[1548603684+edx*1+ebx]
-	mov	edx,-1
-	add	ebx,eax
-	mov	eax,ecx
-	rol	ebx,7
-	add	ebx,edi
-	; 108
-	sub	edx,ecx
-	and	eax,ebx
-	and	edx,ebp
-	or	edx,eax
-	mov	eax,DWORD [16+esp]
-	rol	ebp,10
-	lea	edi,[1548603684+edx*1+edi]
-	mov	edx,-1
-	add	edi,eax
-	mov	eax,ebp
-	rol	edi,6
-	add	edi,esi
-	; 109
-	sub	edx,ebp
-	and	eax,edi
-	and	edx,ebx
-	or	edx,eax
-	mov	eax,DWORD [36+esp]
-	rol	ebx,10
-	lea	esi,[1548603684+edx*1+esi]
-	mov	edx,-1
-	add	esi,eax
-	mov	eax,ebx
-	rol	esi,15
-	add	esi,ecx
-	; 110
-	sub	edx,ebx
-	and	eax,esi
-	and	edx,edi
-	or	edx,eax
-	mov	eax,DWORD [4+esp]
-	rol	edi,10
-	lea	ecx,[1548603684+edx*1+ecx]
-	mov	edx,-1
-	add	ecx,eax
-	mov	eax,edi
-	rol	ecx,13
-	add	ecx,ebp
-	; 111
-	sub	edx,edi
-	and	eax,ecx
-	and	edx,esi
-	or	edx,eax
-	mov	eax,DWORD [8+esp]
-	rol	esi,10
-	lea	ebp,[1548603684+edx*1+ebp]
-	mov	edx,-1
-	add	ebp,eax
-	sub	edx,ecx
-	rol	ebp,11
-	add	ebp,ebx
-	; 112
-	mov	eax,DWORD [60+esp]
-	or	edx,ebp
-	add	ebx,eax
-	xor	edx,esi
-	mov	eax,-1
-	rol	ecx,10
-	lea	ebx,[1836072691+edx*1+ebx]
-	sub	eax,ebp
-	rol	ebx,9
-	add	ebx,edi
-	; 113
-	mov	edx,DWORD [20+esp]
-	or	eax,ebx
-	add	edi,edx
-	xor	eax,ecx
-	mov	edx,-1
-	rol	ebp,10
-	lea	edi,[1836072691+eax*1+edi]
-	sub	edx,ebx
-	rol	edi,7
-	add	edi,esi
-	; 114
-	mov	eax,DWORD [4+esp]
-	or	edx,edi
-	add	esi,eax
-	xor	edx,ebp
-	mov	eax,-1
-	rol	ebx,10
-	lea	esi,[1836072691+edx*1+esi]
-	sub	eax,edi
-	rol	esi,15
-	add	esi,ecx
-	; 115
-	mov	edx,DWORD [12+esp]
-	or	eax,esi
-	add	ecx,edx
-	xor	eax,ebx
-	mov	edx,-1
-	rol	edi,10
-	lea	ecx,[1836072691+eax*1+ecx]
-	sub	edx,esi
-	rol	ecx,11
-	add	ecx,ebp
-	; 116
-	mov	eax,DWORD [28+esp]
-	or	edx,ecx
-	add	ebp,eax
-	xor	edx,edi
-	mov	eax,-1
-	rol	esi,10
-	lea	ebp,[1836072691+edx*1+ebp]
-	sub	eax,ecx
-	rol	ebp,8
-	add	ebp,ebx
-	; 117
-	mov	edx,DWORD [56+esp]
-	or	eax,ebp
-	add	ebx,edx
-	xor	eax,esi
-	mov	edx,-1
-	rol	ecx,10
-	lea	ebx,[1836072691+eax*1+ebx]
-	sub	edx,ebp
-	rol	ebx,6
-	add	ebx,edi
-	; 118
-	mov	eax,DWORD [24+esp]
-	or	edx,ebx
-	add	edi,eax
-	xor	edx,ecx
-	mov	eax,-1
-	rol	ebp,10
-	lea	edi,[1836072691+edx*1+edi]
-	sub	eax,ebx
-	rol	edi,6
-	add	edi,esi
-	; 119
-	mov	edx,DWORD [36+esp]
-	or	eax,edi
-	add	esi,edx
-	xor	eax,ebp
-	mov	edx,-1
-	rol	ebx,10
-	lea	esi,[1836072691+eax*1+esi]
-	sub	edx,edi
-	rol	esi,14
-	add	esi,ecx
-	; 120
-	mov	eax,DWORD [44+esp]
-	or	edx,esi
-	add	ecx,eax
-	xor	edx,ebx
-	mov	eax,-1
-	rol	edi,10
-	lea	ecx,[1836072691+edx*1+ecx]
-	sub	eax,esi
-	rol	ecx,12
-	add	ecx,ebp
-	; 121
-	mov	edx,DWORD [32+esp]
-	or	eax,ecx
-	add	ebp,edx
-	xor	eax,edi
-	mov	edx,-1
-	rol	esi,10
-	lea	ebp,[1836072691+eax*1+ebp]
-	sub	edx,ecx
-	rol	ebp,13
-	add	ebp,ebx
-	; 122
-	mov	eax,DWORD [48+esp]
-	or	edx,ebp
-	add	ebx,eax
-	xor	edx,esi
-	mov	eax,-1
-	rol	ecx,10
-	lea	ebx,[1836072691+edx*1+ebx]
-	sub	eax,ebp
-	rol	ebx,5
-	add	ebx,edi
-	; 123
-	mov	edx,DWORD [8+esp]
-	or	eax,ebx
-	add	edi,edx
-	xor	eax,ecx
-	mov	edx,-1
-	rol	ebp,10
-	lea	edi,[1836072691+eax*1+edi]
-	sub	edx,ebx
-	rol	edi,14
-	add	edi,esi
-	; 124
-	mov	eax,DWORD [40+esp]
-	or	edx,edi
-	add	esi,eax
-	xor	edx,ebp
-	mov	eax,-1
-	rol	ebx,10
-	lea	esi,[1836072691+edx*1+esi]
-	sub	eax,edi
-	rol	esi,13
-	add	esi,ecx
-	; 125
-	mov	edx,DWORD [esp]
-	or	eax,esi
-	add	ecx,edx
-	xor	eax,ebx
-	mov	edx,-1
-	rol	edi,10
-	lea	ecx,[1836072691+eax*1+ecx]
-	sub	edx,esi
-	rol	ecx,13
-	add	ecx,ebp
-	; 126
-	mov	eax,DWORD [16+esp]
-	or	edx,ecx
-	add	ebp,eax
-	xor	edx,edi
-	mov	eax,-1
-	rol	esi,10
-	lea	ebp,[1836072691+edx*1+ebp]
-	sub	eax,ecx
-	rol	ebp,7
-	add	ebp,ebx
-	; 127
-	mov	edx,DWORD [52+esp]
-	or	eax,ebp
-	add	ebx,edx
-	xor	eax,esi
-	mov	edx,DWORD [32+esp]
-	rol	ecx,10
-	lea	ebx,[1836072691+eax*1+ebx]
-	mov	eax,-1
-	rol	ebx,5
-	add	ebx,edi
-	; 128
-	add	edi,edx
-	mov	edx,ebp
-	sub	eax,ebx
-	and	edx,ebx
-	and	eax,ecx
-	or	edx,eax
-	mov	eax,DWORD [24+esp]
-	rol	ebp,10
-	lea	edi,[2053994217+edx*1+edi]
-	mov	edx,-1
-	rol	edi,15
-	add	edi,esi
-	; 129
-	add	esi,eax
-	mov	eax,ebx
-	sub	edx,edi
-	and	eax,edi
-	and	edx,ebp
-	or	eax,edx
-	mov	edx,DWORD [16+esp]
-	rol	ebx,10
-	lea	esi,[2053994217+eax*1+esi]
-	mov	eax,-1
-	rol	esi,5
-	add	esi,ecx
-	; 130
-	add	ecx,edx
-	mov	edx,edi
-	sub	eax,esi
-	and	edx,esi
-	and	eax,ebx
-	or	edx,eax
-	mov	eax,DWORD [4+esp]
-	rol	edi,10
-	lea	ecx,[2053994217+edx*1+ecx]
-	mov	edx,-1
-	rol	ecx,8
-	add	ecx,ebp
-	; 131
-	add	ebp,eax
-	mov	eax,esi
-	sub	edx,ecx
-	and	eax,ecx
-	and	edx,edi
-	or	eax,edx
-	mov	edx,DWORD [12+esp]
-	rol	esi,10
-	lea	ebp,[2053994217+eax*1+ebp]
-	mov	eax,-1
-	rol	ebp,11
-	add	ebp,ebx
-	; 132
-	add	ebx,edx
-	mov	edx,ecx
-	sub	eax,ebp
-	and	edx,ebp
-	and	eax,esi
-	or	edx,eax
-	mov	eax,DWORD [44+esp]
-	rol	ecx,10
-	lea	ebx,[2053994217+edx*1+ebx]
-	mov	edx,-1
-	rol	ebx,14
-	add	ebx,edi
-	; 133
-	add	edi,eax
-	mov	eax,ebp
-	sub	edx,ebx
-	and	eax,ebx
-	and	edx,ecx
-	or	eax,edx
-	mov	edx,DWORD [60+esp]
-	rol	ebp,10
-	lea	edi,[2053994217+eax*1+edi]
-	mov	eax,-1
-	rol	edi,14
-	add	edi,esi
-	; 134
-	add	esi,edx
-	mov	edx,ebx
-	sub	eax,edi
-	and	edx,edi
-	and	eax,ebp
-	or	edx,eax
-	mov	eax,DWORD [esp]
-	rol	ebx,10
-	lea	esi,[2053994217+edx*1+esi]
-	mov	edx,-1
-	rol	esi,6
-	add	esi,ecx
-	; 135
-	add	ecx,eax
-	mov	eax,edi
-	sub	edx,esi
-	and	eax,esi
-	and	edx,ebx
-	or	eax,edx
-	mov	edx,DWORD [20+esp]
-	rol	edi,10
-	lea	ecx,[2053994217+eax*1+ecx]
-	mov	eax,-1
-	rol	ecx,14
-	add	ecx,ebp
-	; 136
-	add	ebp,edx
-	mov	edx,esi
-	sub	eax,ecx
-	and	edx,ecx
-	and	eax,edi
-	or	edx,eax
-	mov	eax,DWORD [48+esp]
-	rol	esi,10
-	lea	ebp,[2053994217+edx*1+ebp]
-	mov	edx,-1
-	rol	ebp,6
-	add	ebp,ebx
-	; 137
-	add	ebx,eax
-	mov	eax,ecx
-	sub	edx,ebp
-	and	eax,ebp
-	and	edx,esi
-	or	eax,edx
-	mov	edx,DWORD [8+esp]
-	rol	ecx,10
-	lea	ebx,[2053994217+eax*1+ebx]
-	mov	eax,-1
-	rol	ebx,9
-	add	ebx,edi
-	; 138
-	add	edi,edx
-	mov	edx,ebp
-	sub	eax,ebx
-	and	edx,ebx
-	and	eax,ecx
-	or	edx,eax
-	mov	eax,DWORD [52+esp]
-	rol	ebp,10
-	lea	edi,[2053994217+edx*1+edi]
-	mov	edx,-1
-	rol	edi,12
-	add	edi,esi
-	; 139
-	add	esi,eax
-	mov	eax,ebx
-	sub	edx,edi
-	and	eax,edi
-	and	edx,ebp
-	or	eax,edx
-	mov	edx,DWORD [36+esp]
-	rol	ebx,10
-	lea	esi,[2053994217+eax*1+esi]
-	mov	eax,-1
-	rol	esi,9
-	add	esi,ecx
-	; 140
-	add	ecx,edx
-	mov	edx,edi
-	sub	eax,esi
-	and	edx,esi
-	and	eax,ebx
-	or	edx,eax
-	mov	eax,DWORD [28+esp]
-	rol	edi,10
-	lea	ecx,[2053994217+edx*1+ecx]
-	mov	edx,-1
-	rol	ecx,12
-	add	ecx,ebp
-	; 141
-	add	ebp,eax
-	mov	eax,esi
-	sub	edx,ecx
-	and	eax,ecx
-	and	edx,edi
-	or	eax,edx
-	mov	edx,DWORD [40+esp]
-	rol	esi,10
-	lea	ebp,[2053994217+eax*1+ebp]
-	mov	eax,-1
-	rol	ebp,5
-	add	ebp,ebx
-	; 142
-	add	ebx,edx
-	mov	edx,ecx
-	sub	eax,ebp
-	and	edx,ebp
-	and	eax,esi
-	or	edx,eax
-	mov	eax,DWORD [56+esp]
-	rol	ecx,10
-	lea	ebx,[2053994217+edx*1+ebx]
-	mov	edx,-1
-	rol	ebx,15
-	add	ebx,edi
-	; 143
-	add	edi,eax
-	mov	eax,ebp
-	sub	edx,ebx
-	and	eax,ebx
-	and	edx,ecx
-	or	edx,eax
-	mov	eax,ebx
-	rol	ebp,10
-	lea	edi,[2053994217+edx*1+edi]
-	xor	eax,ebp
-	rol	edi,8
-	add	edi,esi
-	; 144
-	mov	edx,DWORD [48+esp]
-	xor	eax,edi
-	add	esi,edx
-	rol	ebx,10
-	add	esi,eax
-	mov	eax,edi
-	rol	esi,8
-	add	esi,ecx
-	; 145
-	xor	eax,ebx
-	mov	edx,DWORD [60+esp]
-	xor	eax,esi
-	add	ecx,eax
-	mov	eax,esi
-	rol	edi,10
-	add	ecx,edx
-	xor	eax,edi
-	rol	ecx,5
-	add	ecx,ebp
-	; 146
-	mov	edx,DWORD [40+esp]
-	xor	eax,ecx
-	add	ebp,edx
-	rol	esi,10
-	add	ebp,eax
-	mov	eax,ecx
-	rol	ebp,12
-	add	ebp,ebx
-	; 147
-	xor	eax,esi
-	mov	edx,DWORD [16+esp]
-	xor	eax,ebp
-	add	ebx,eax
-	mov	eax,ebp
-	rol	ecx,10
-	add	ebx,edx
-	xor	eax,ecx
-	rol	ebx,9
-	add	ebx,edi
-	; 148
-	mov	edx,DWORD [4+esp]
-	xor	eax,ebx
-	add	edi,edx
-	rol	ebp,10
-	add	edi,eax
-	mov	eax,ebx
-	rol	edi,12
-	add	edi,esi
-	; 149
-	xor	eax,ebp
-	mov	edx,DWORD [20+esp]
-	xor	eax,edi
-	add	esi,eax
-	mov	eax,edi
-	rol	ebx,10
-	add	esi,edx
-	xor	eax,ebx
-	rol	esi,5
-	add	esi,ecx
-	; 150
-	mov	edx,DWORD [32+esp]
-	xor	eax,esi
-	add	ecx,edx
-	rol	edi,10
-	add	ecx,eax
-	mov	eax,esi
-	rol	ecx,14
-	add	ecx,ebp
-	; 151
-	xor	eax,edi
-	mov	edx,DWORD [28+esp]
-	xor	eax,ecx
-	add	ebp,eax
-	mov	eax,ecx
-	rol	esi,10
-	add	ebp,edx
-	xor	eax,esi
-	rol	ebp,6
-	add	ebp,ebx
-	; 152
-	mov	edx,DWORD [24+esp]
-	xor	eax,ebp
-	add	ebx,edx
-	rol	ecx,10
-	add	ebx,eax
-	mov	eax,ebp
-	rol	ebx,8
-	add	ebx,edi
-	; 153
-	xor	eax,ecx
-	mov	edx,DWORD [8+esp]
-	xor	eax,ebx
-	add	edi,eax
-	mov	eax,ebx
-	rol	ebp,10
-	add	edi,edx
-	xor	eax,ebp
-	rol	edi,13
-	add	edi,esi
-	; 154
-	mov	edx,DWORD [52+esp]
-	xor	eax,edi
-	add	esi,edx
-	rol	ebx,10
-	add	esi,eax
-	mov	eax,edi
-	rol	esi,6
-	add	esi,ecx
-	; 155
-	xor	eax,ebx
-	mov	edx,DWORD [56+esp]
-	xor	eax,esi
-	add	ecx,eax
-	mov	eax,esi
-	rol	edi,10
-	add	ecx,edx
-	xor	eax,edi
-	rol	ecx,5
-	add	ecx,ebp
-	; 156
-	mov	edx,DWORD [esp]
-	xor	eax,ecx
-	add	ebp,edx
-	rol	esi,10
-	add	ebp,eax
-	mov	eax,ecx
-	rol	ebp,15
-	add	ebp,ebx
-	; 157
-	xor	eax,esi
-	mov	edx,DWORD [12+esp]
-	xor	eax,ebp
-	add	ebx,eax
-	mov	eax,ebp
-	rol	ecx,10
-	add	ebx,edx
-	xor	eax,ecx
-	rol	ebx,13
-	add	ebx,edi
-	; 158
-	mov	edx,DWORD [36+esp]
-	xor	eax,ebx
-	add	edi,edx
-	rol	ebp,10
-	add	edi,eax
-	mov	eax,ebx
-	rol	edi,11
-	add	edi,esi
-	; 159
-	xor	eax,ebp
-	mov	edx,DWORD [44+esp]
-	xor	eax,edi
-	add	esi,eax
-	rol	ebx,10
-	add	esi,edx
-	mov	edx,DWORD [128+esp]
-	rol	esi,11
-	add	esi,ecx
-	mov	eax,DWORD [4+edx]
-	add	ebx,eax
-	mov	eax,DWORD [72+esp]
-	add	ebx,eax
-	mov	eax,DWORD [8+edx]
-	add	ebp,eax
-	mov	eax,DWORD [76+esp]
-	add	ebp,eax
-	mov	eax,DWORD [12+edx]
-	add	ecx,eax
-	mov	eax,DWORD [80+esp]
-	add	ecx,eax
-	mov	eax,DWORD [16+edx]
-	add	esi,eax
-	mov	eax,DWORD [64+esp]
-	add	esi,eax
-	mov	eax,DWORD [edx]
-	add	edi,eax
-	mov	eax,DWORD [68+esp]
-	add	edi,eax
-	mov	eax,DWORD [136+esp]
-	mov	DWORD [edx],ebx
-	mov	DWORD [4+edx],ebp
-	mov	DWORD [8+edx],ecx
-	sub	eax,1
-	mov	DWORD [12+edx],esi
-	mov	DWORD [16+edx],edi
-	jle	NEAR L$001get_out
-	mov	DWORD [136+esp],eax
-	mov	edi,ecx
-	mov	eax,DWORD [132+esp]
-	mov	ecx,ebx
-	add	eax,64
-	mov	esi,ebp
-	mov	DWORD [132+esp],eax
-	jmp	NEAR L$000start
-L$001get_out:
-	add	esp,108
-	pop	ebx
-	pop	ebp
-	pop	edi
-	pop	esi
-	ret

+ 1 - 1
openssl/crypto/rsa/rsa_eay.c

@@ -675,7 +675,7 @@ static int RSA_eay_public_decrypt(int flen, const unsigned char *from,
 		rsa->_method_mod_n)) goto err;
 
 	if ((padding == RSA_X931_PADDING) && ((ret->d[0] & 0xf) != 12))
-		BN_sub(ret, rsa->n, ret);
+		if (!BN_sub(ret, rsa->n, ret)) goto err;
 
 	p=buf;
 	i=BN_bn2bin(ret,p);

+ 27 - 26
openssl/crypto/stack/safestack.h

@@ -179,7 +179,8 @@ DECLARE_SPECIAL_STACK_OF(OPENSSL_BLOCK, void)
 	sk_is_sorted(CHECKED_STACK_OF(type, st))
 
 #define	SKM_ASN1_SET_OF_d2i(type, st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
-  (STACK_OF(type) *)d2i_ASN1_SET((STACK_OF(OPENSSL_BLOCK) **)CHECKED_STACK_OF(type, st), \
+  (STACK_OF(type) *)d2i_ASN1_SET( \
+				(STACK_OF(OPENSSL_BLOCK) **)CHECKED_PTR_OF(STACK_OF(type)*, st), \
 				pp, length, \
 				CHECKED_D2I_OF(type, d2i_func), \
 				CHECKED_SK_FREE_FUNC(type, free_func), \
@@ -2030,6 +2031,31 @@ DECLARE_SPECIAL_STACK_OF(OPENSSL_BLOCK, void)
 #define sk_void_sort(st) SKM_sk_sort(void, (st))
 #define sk_void_is_sorted(st) SKM_sk_is_sorted(void, (st))
 
+#define sk_OPENSSL_STRING_new(cmp) ((STACK_OF(OPENSSL_STRING) *)sk_new(CHECKED_SK_CMP_FUNC(char, cmp)))
+#define sk_OPENSSL_STRING_new_null() ((STACK_OF(OPENSSL_STRING) *)sk_new_null())
+#define sk_OPENSSL_STRING_push(st, val) sk_push(CHECKED_PTR_OF(STACK_OF(OPENSSL_STRING), st), CHECKED_PTR_OF(char, val))
+#define sk_OPENSSL_STRING_find(st, val) sk_find(CHECKED_PTR_OF(STACK_OF(OPENSSL_STRING), st), CHECKED_PTR_OF(char, val))
+#define sk_OPENSSL_STRING_value(st, i) ((OPENSSL_STRING)sk_value(CHECKED_PTR_OF(STACK_OF(OPENSSL_STRING), st), i))
+#define sk_OPENSSL_STRING_num(st) SKM_sk_num(OPENSSL_STRING, st)
+#define sk_OPENSSL_STRING_pop_free(st, free_func) sk_pop_free(CHECKED_PTR_OF(STACK_OF(OPENSSL_STRING), st), CHECKED_SK_FREE_FUNC2(OPENSSL_STRING, free_func))
+#define sk_OPENSSL_STRING_insert(st, val, i) sk_insert(CHECKED_PTR_OF(STACK_OF(OPENSSL_STRING), st), CHECKED_PTR_OF(char, val), i)
+#define sk_OPENSSL_STRING_free(st) SKM_sk_free(OPENSSL_STRING, st)
+#define sk_OPENSSL_STRING_set(st, i, val) sk_set((_STACK *)CHECKED_PTR_OF(STACK_OF(OPENSSL_STRING), st), i, CHECKED_PTR_OF(char, val))
+#define sk_OPENSSL_STRING_zero(st) SKM_sk_zero(OPENSSL_STRING, (st))
+#define sk_OPENSSL_STRING_unshift(st, val) sk_unshift((_STACK *)CHECKED_PTR_OF(STACK_OF(OPENSSL_STRING), st), CHECKED_PTR_OF(char, val))
+#define sk_OPENSSL_STRING_find_ex(st, val) sk_find_ex((_STACK *)CHECKED_CONST_PTR_OF(STACK_OF(OPENSSL_STRING), st), CHECKED_CONST_PTR_OF(char, val))
+#define sk_OPENSSL_STRING_delete(st, i) SKM_sk_delete(OPENSSL_STRING, (st), (i))
+#define sk_OPENSSL_STRING_delete_ptr(st, ptr) (OPENSSL_STRING *)sk_delete_ptr((_STACK *)CHECKED_PTR_OF(STACK_OF(OPENSSL_STRING), st), CHECKED_PTR_OF(char, ptr))
+#define sk_OPENSSL_STRING_set_cmp_func(st, cmp)  \
+	((int (*)(const char * const *,const char * const *)) \
+	sk_set_cmp_func((_STACK *)CHECKED_PTR_OF(STACK_OF(OPENSSL_STRING), st), CHECKED_SK_CMP_FUNC(char, cmp)))
+#define sk_OPENSSL_STRING_dup(st) SKM_sk_dup(OPENSSL_STRING, st)
+#define sk_OPENSSL_STRING_shift(st) SKM_sk_shift(OPENSSL_STRING, (st))
+#define sk_OPENSSL_STRING_pop(st) (char *)sk_pop((_STACK *)CHECKED_PTR_OF(STACK_OF(OPENSSL_STRING), st))
+#define sk_OPENSSL_STRING_sort(st) SKM_sk_sort(OPENSSL_STRING, (st))
+#define sk_OPENSSL_STRING_is_sorted(st) SKM_sk_is_sorted(OPENSSL_STRING, (st))
+
+
 #define sk_OPENSSL_BLOCK_new(cmp) ((STACK_OF(OPENSSL_BLOCK) *)sk_new(CHECKED_SK_CMP_FUNC(void, cmp)))
 #define sk_OPENSSL_BLOCK_new_null() ((STACK_OF(OPENSSL_BLOCK) *)sk_new_null())
 #define sk_OPENSSL_BLOCK_push(st, val) sk_push(CHECKED_PTR_OF(STACK_OF(OPENSSL_BLOCK), st), CHECKED_PTR_OF(void, val))
@@ -2080,31 +2106,6 @@ DECLARE_SPECIAL_STACK_OF(OPENSSL_BLOCK, void)
 #define sk_OPENSSL_PSTRING_is_sorted(st) SKM_sk_is_sorted(OPENSSL_PSTRING, (st))
 
 
-#define sk_OPENSSL_STRING_new(cmp) ((STACK_OF(OPENSSL_STRING) *)sk_new(CHECKED_SK_CMP_FUNC(char, cmp)))
-#define sk_OPENSSL_STRING_new_null() ((STACK_OF(OPENSSL_STRING) *)sk_new_null())
-#define sk_OPENSSL_STRING_push(st, val) sk_push(CHECKED_PTR_OF(STACK_OF(OPENSSL_STRING), st), CHECKED_PTR_OF(char, val))
-#define sk_OPENSSL_STRING_find(st, val) sk_find(CHECKED_PTR_OF(STACK_OF(OPENSSL_STRING), st), CHECKED_PTR_OF(char, val))
-#define sk_OPENSSL_STRING_value(st, i) ((OPENSSL_STRING)sk_value(CHECKED_PTR_OF(STACK_OF(OPENSSL_STRING), st), i))
-#define sk_OPENSSL_STRING_num(st) SKM_sk_num(OPENSSL_STRING, st)
-#define sk_OPENSSL_STRING_pop_free(st, free_func) sk_pop_free(CHECKED_PTR_OF(STACK_OF(OPENSSL_STRING), st), CHECKED_SK_FREE_FUNC2(OPENSSL_STRING, free_func))
-#define sk_OPENSSL_STRING_insert(st, val, i) sk_insert(CHECKED_PTR_OF(STACK_OF(OPENSSL_STRING), st), CHECKED_PTR_OF(char, val), i)
-#define sk_OPENSSL_STRING_free(st) SKM_sk_free(OPENSSL_STRING, st)
-#define sk_OPENSSL_STRING_set(st, i, val) sk_set((_STACK *)CHECKED_PTR_OF(STACK_OF(OPENSSL_STRING), st), i, CHECKED_PTR_OF(char, val))
-#define sk_OPENSSL_STRING_zero(st) SKM_sk_zero(OPENSSL_STRING, (st))
-#define sk_OPENSSL_STRING_unshift(st, val) sk_unshift((_STACK *)CHECKED_PTR_OF(STACK_OF(OPENSSL_STRING), st), CHECKED_PTR_OF(char, val))
-#define sk_OPENSSL_STRING_find_ex(st, val) sk_find_ex((_STACK *)CHECKED_CONST_PTR_OF(STACK_OF(OPENSSL_STRING), st), CHECKED_CONST_PTR_OF(char, val))
-#define sk_OPENSSL_STRING_delete(st, i) SKM_sk_delete(OPENSSL_STRING, (st), (i))
-#define sk_OPENSSL_STRING_delete_ptr(st, ptr) (OPENSSL_STRING *)sk_delete_ptr((_STACK *)CHECKED_PTR_OF(STACK_OF(OPENSSL_STRING), st), CHECKED_PTR_OF(char, ptr))
-#define sk_OPENSSL_STRING_set_cmp_func(st, cmp)  \
-	((int (*)(const char * const *,const char * const *)) \
-	sk_set_cmp_func((_STACK *)CHECKED_PTR_OF(STACK_OF(OPENSSL_STRING), st), CHECKED_SK_CMP_FUNC(char, cmp)))
-#define sk_OPENSSL_STRING_dup(st) SKM_sk_dup(OPENSSL_STRING, st)
-#define sk_OPENSSL_STRING_shift(st) SKM_sk_shift(OPENSSL_STRING, (st))
-#define sk_OPENSSL_STRING_pop(st) (char *)sk_pop((_STACK *)CHECKED_PTR_OF(STACK_OF(OPENSSL_STRING), st))
-#define sk_OPENSSL_STRING_sort(st) SKM_sk_sort(OPENSSL_STRING, (st))
-#define sk_OPENSSL_STRING_is_sorted(st) SKM_sk_is_sorted(OPENSSL_STRING, (st))
-
-
 #define d2i_ASN1_SET_OF_ACCESS_DESCRIPTION(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
 	SKM_ASN1_SET_OF_d2i(ACCESS_DESCRIPTION, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) 
 #define i2d_ASN1_SET_OF_ACCESS_DESCRIPTION(st, pp, i2d_func, ex_tag, ex_class, is_set) \

+ 0 - 38
openssl/crypto/whrlpool/whrlpool.h

@@ -1,38 +0,0 @@
-#ifndef HEADER_WHRLPOOL_H
-#define HEADER_WHRLPOOL_H
-
-#include <openssl/e_os2.h>
-#include <stddef.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define WHIRLPOOL_DIGEST_LENGTH	(512/8)
-#define WHIRLPOOL_BBLOCK	512
-#define WHIRLPOOL_COUNTER	(256/8)
-
-typedef struct	{
-	union	{
-		unsigned char	c[WHIRLPOOL_DIGEST_LENGTH];
-		/* double q is here to ensure 64-bit alignment */
-		double		q[WHIRLPOOL_DIGEST_LENGTH/sizeof(double)];
-		}	H;
-	unsigned char	data[WHIRLPOOL_BBLOCK/8];
-	unsigned int	bitoff;
-	size_t		bitlen[WHIRLPOOL_COUNTER/sizeof(size_t)];
-	} WHIRLPOOL_CTX;
-
-#ifndef OPENSSL_NO_WHIRLPOOL
-int WHIRLPOOL_Init	(WHIRLPOOL_CTX *c);
-int WHIRLPOOL_Update	(WHIRLPOOL_CTX *c,const void *inp,size_t bytes);
-void WHIRLPOOL_BitUpdate(WHIRLPOOL_CTX *c,const void *inp,size_t bits);
-int WHIRLPOOL_Final	(unsigned char *md,WHIRLPOOL_CTX *c);
-unsigned char *WHIRLPOOL(const void *inp,size_t bytes,unsigned char *md);
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif

+ 0 - 655
openssl/crypto/whrlpool/wp_block.c

@@ -1,655 +0,0 @@
-/**
- * The Whirlpool hashing function.
- *
- * <P>
- * <b>References</b>
- *
- * <P>
- * The Whirlpool algorithm was developed by
- * <a href="mailto:[email protected]">Paulo S. L. M. Barreto</a> and
- * <a href="mailto:[email protected]">Vincent Rijmen</a>.
- *
- * See
- *      P.S.L.M. Barreto, V. Rijmen,
- *      ``The Whirlpool hashing function,''
- *      NESSIE submission, 2000 (tweaked version, 2001),
- *      <https://www.cosic.esat.kuleuven.ac.be/nessie/workshop/submissions/whirlpool.zip>
- *
- * Based on "@version 3.0 (2003.03.12)" by Paulo S.L.M. Barreto and
- * Vincent Rijmen. Lookup "reference implementations" on
- * <http://planeta.terra.com.br/informatica/paulobarreto/>
- *
- * =============================================================================
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#include "wp_locl.h"
-#include <string.h>
-
-typedef unsigned char		u8;
-#if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32)
-typedef unsigned __int64	u64;
-#elif defined(__arch64__)
-typedef unsigned long		u64;
-#else
-typedef unsigned long long	u64;
-#endif
-
-#define ROUNDS	10
-
-#define STRICT_ALIGNMENT
-#if defined(__i386) || defined(__i386__) || \
-    defined(__x86_64) || defined(__x86_64__) || \
-    defined(_M_IX86) || defined(_M_AMD64) || defined(_M_X64)
-/* Well, formally there're couple of other architectures, which permit
- * unaligned loads, specifically those not crossing cache lines, IA-64
- * and PowerPC... */
-#  undef STRICT_ALIGNMENT
-#endif
-
-#undef SMALL_REGISTER_BANK
-#if defined(__i386) || defined(__i386__) || defined(_M_IX86)
-#  define SMALL_REGISTER_BANK
-#  if defined(WHIRLPOOL_ASM)
-#    ifndef OPENSSL_SMALL_FOOTPRINT
-#      define OPENSSL_SMALL_FOOTPRINT	/* it appears that for elder non-MMX
-					   CPUs this is actually faster! */
-#    endif
-#    define GO_FOR_MMX(ctx,inp,num)	do {			\
-	extern unsigned long OPENSSL_ia32cap_P;			\
-	void whirlpool_block_mmx(void *,const void *,size_t);	\
-	if (!(OPENSSL_ia32cap_P & (1<<23)))	break;		\
-        whirlpool_block_mmx(ctx->H.c,inp,num);	return;		\
-					} while (0)
-#  endif
-#endif
-
-#undef ROTATE
-#if defined(_MSC_VER)
-#  if defined(_WIN64)	/* applies to both IA-64 and AMD64 */
-#    pragma intrinsic(_rotl64)
-#    define ROTATE(a,n)	_rotl64((a),n)
-#  endif
-#elif defined(__GNUC__) && __GNUC__>=2
-#  if defined(__x86_64) || defined(__x86_64__)
-#    if defined(L_ENDIAN)
-#      define ROTATE(a,n)	({ u64 ret; asm ("rolq %1,%0"	\
-				   : "=r"(ret) : "J"(n),"0"(a) : "cc"); ret; })
-#    elif defined(B_ENDIAN)
-       /* Most will argue that x86_64 is always little-endian. Well,
-        * yes, but then we have stratus.com who has modified gcc to
-	* "emulate" big-endian on x86. Is there evidence that they
-	* [or somebody else] won't do same for x86_64? Naturally no.
-	* And this line is waiting ready for that brave soul:-) */
-#      define ROTATE(a,n)	({ u64 ret; asm ("rorq %1,%0"	\
-				   : "=r"(ret) : "J"(n),"0"(a) : "cc"); ret; })
-#    endif
-#  elif defined(__ia64) || defined(__ia64__)
-#    if defined(L_ENDIAN)
-#      define ROTATE(a,n)	({ u64 ret; asm ("shrp %0=%1,%1,%2"	\
-				   : "=r"(ret) : "r"(a),"M"(64-(n))); ret; })
-#    elif defined(B_ENDIAN)
-#      define ROTATE(a,n)	({ u64 ret; asm ("shrp %0=%1,%1,%2"	\
-				   : "=r"(ret) : "r"(a),"M"(n)); ret; })
-#    endif
-#  endif
-#endif
-
-#if defined(OPENSSL_SMALL_FOOTPRINT)
-#  if !defined(ROTATE)
-#    if defined(L_ENDIAN)	/* little-endians have to rotate left */
-#      define ROTATE(i,n)	((i)<<(n) ^ (i)>>(64-n))
-#    elif defined(B_ENDIAN)	/* big-endians have to rotate right */
-#      define ROTATE(i,n)	((i)>>(n) ^ (i)<<(64-n))
-#    endif
-#  endif
-#  if defined(ROTATE) && !defined(STRICT_ALIGNMENT)
-#    define STRICT_ALIGNMENT	/* ensure smallest table size */
-#  endif
-#endif
-
-/*
- * Table size depends on STRICT_ALIGNMENT and whether or not endian-
- * specific ROTATE macro is defined. If STRICT_ALIGNMENT is not
- * defined, which is normally the case on x86[_64] CPUs, the table is
- * 4KB large unconditionally. Otherwise if ROTATE is defined, the
- * table is 2KB large, and otherwise - 16KB. 2KB table requires a
- * whole bunch of additional rotations, but I'm willing to "trade,"
- * because 16KB table certainly trashes L1 cache. I wish all CPUs
- * could handle unaligned load as 4KB table doesn't trash the cache,
- * nor does it require additional rotations.
- */
-/*
- * Note that every Cn macro expands as two loads: one byte load and
- * one quadword load. One can argue that that many single-byte loads
- * is too excessive, as one could load a quadword and "milk" it for
- * eight 8-bit values instead. Well, yes, but in order to do so *and*
- * avoid excessive loads you have to accomodate a handful of 64-bit
- * values in the register bank and issue a bunch of shifts and mask.
- * It's a tradeoff: loads vs. shift and mask in big register bank[!].
- * On most CPUs eight single-byte loads are faster and I let other
- * ones to depend on smart compiler to fold byte loads if beneficial.
- * Hand-coded assembler would be another alternative:-)
- */
-#ifdef STRICT_ALIGNMENT
-#  if defined(ROTATE)
-#    define N	1
-#    define LL(c0,c1,c2,c3,c4,c5,c6,c7)	c0,c1,c2,c3,c4,c5,c6,c7
-#    define C0(K,i)	(Cx.q[K.c[(i)*8+0]])
-#    define C1(K,i)	ROTATE(Cx.q[K.c[(i)*8+1]],8)
-#    define C2(K,i)	ROTATE(Cx.q[K.c[(i)*8+2]],16)
-#    define C3(K,i)	ROTATE(Cx.q[K.c[(i)*8+3]],24)
-#    define C4(K,i)	ROTATE(Cx.q[K.c[(i)*8+4]],32)
-#    define C5(K,i)	ROTATE(Cx.q[K.c[(i)*8+5]],40)
-#    define C6(K,i)	ROTATE(Cx.q[K.c[(i)*8+6]],48)
-#    define C7(K,i)	ROTATE(Cx.q[K.c[(i)*8+7]],56)
-#  else
-#    define N	8
-#    define LL(c0,c1,c2,c3,c4,c5,c6,c7)	c0,c1,c2,c3,c4,c5,c6,c7, \
-					c7,c0,c1,c2,c3,c4,c5,c6, \
-					c6,c7,c0,c1,c2,c3,c4,c5, \
-					c5,c6,c7,c0,c1,c2,c3,c4, \
-					c4,c5,c6,c7,c0,c1,c2,c3, \
-					c3,c4,c5,c6,c7,c0,c1,c2, \
-					c2,c3,c4,c5,c6,c7,c0,c1, \
-					c1,c2,c3,c4,c5,c6,c7,c0
-#    define C0(K,i)	(Cx.q[0+8*K.c[(i)*8+0]])
-#    define C1(K,i)	(Cx.q[1+8*K.c[(i)*8+1]])
-#    define C2(K,i)	(Cx.q[2+8*K.c[(i)*8+2]])
-#    define C3(K,i)	(Cx.q[3+8*K.c[(i)*8+3]])
-#    define C4(K,i)	(Cx.q[4+8*K.c[(i)*8+4]])
-#    define C5(K,i)	(Cx.q[5+8*K.c[(i)*8+5]])
-#    define C6(K,i)	(Cx.q[6+8*K.c[(i)*8+6]])
-#    define C7(K,i)	(Cx.q[7+8*K.c[(i)*8+7]])
-#  endif
-#else
-#  define N	2
-#  define LL(c0,c1,c2,c3,c4,c5,c6,c7)	c0,c1,c2,c3,c4,c5,c6,c7, \
-					c0,c1,c2,c3,c4,c5,c6,c7
-#  define C0(K,i)	(((u64*)(Cx.c+0))[2*K.c[(i)*8+0]])
-#  define C1(K,i)	(((u64*)(Cx.c+7))[2*K.c[(i)*8+1]])
-#  define C2(K,i)	(((u64*)(Cx.c+6))[2*K.c[(i)*8+2]])
-#  define C3(K,i)	(((u64*)(Cx.c+5))[2*K.c[(i)*8+3]])
-#  define C4(K,i)	(((u64*)(Cx.c+4))[2*K.c[(i)*8+4]])
-#  define C5(K,i)	(((u64*)(Cx.c+3))[2*K.c[(i)*8+5]])
-#  define C6(K,i)	(((u64*)(Cx.c+2))[2*K.c[(i)*8+6]])
-#  define C7(K,i)	(((u64*)(Cx.c+1))[2*K.c[(i)*8+7]])
-#endif
-
-static const
-union	{
-	u8	c[(256*N+ROUNDS)*sizeof(u64)];
-	u64	q[(256*N+ROUNDS)];
-	} Cx = { {
-	/* Note endian-neutral representation:-) */
-	LL(0x18,0x18,0x60,0x18,0xc0,0x78,0x30,0xd8),
-	LL(0x23,0x23,0x8c,0x23,0x05,0xaf,0x46,0x26),
-	LL(0xc6,0xc6,0x3f,0xc6,0x7e,0xf9,0x91,0xb8),
-	LL(0xe8,0xe8,0x87,0xe8,0x13,0x6f,0xcd,0xfb),
-	LL(0x87,0x87,0x26,0x87,0x4c,0xa1,0x13,0xcb),
-	LL(0xb8,0xb8,0xda,0xb8,0xa9,0x62,0x6d,0x11),
-	LL(0x01,0x01,0x04,0x01,0x08,0x05,0x02,0x09),
-	LL(0x4f,0x4f,0x21,0x4f,0x42,0x6e,0x9e,0x0d),
-	LL(0x36,0x36,0xd8,0x36,0xad,0xee,0x6c,0x9b),
-	LL(0xa6,0xa6,0xa2,0xa6,0x59,0x04,0x51,0xff),
-	LL(0xd2,0xd2,0x6f,0xd2,0xde,0xbd,0xb9,0x0c),
-	LL(0xf5,0xf5,0xf3,0xf5,0xfb,0x06,0xf7,0x0e),
-	LL(0x79,0x79,0xf9,0x79,0xef,0x80,0xf2,0x96),
-	LL(0x6f,0x6f,0xa1,0x6f,0x5f,0xce,0xde,0x30),
-	LL(0x91,0x91,0x7e,0x91,0xfc,0xef,0x3f,0x6d),
-	LL(0x52,0x52,0x55,0x52,0xaa,0x07,0xa4,0xf8),
-	LL(0x60,0x60,0x9d,0x60,0x27,0xfd,0xc0,0x47),
-	LL(0xbc,0xbc,0xca,0xbc,0x89,0x76,0x65,0x35),
-	LL(0x9b,0x9b,0x56,0x9b,0xac,0xcd,0x2b,0x37),
-	LL(0x8e,0x8e,0x02,0x8e,0x04,0x8c,0x01,0x8a),
-	LL(0xa3,0xa3,0xb6,0xa3,0x71,0x15,0x5b,0xd2),
-	LL(0x0c,0x0c,0x30,0x0c,0x60,0x3c,0x18,0x6c),
-	LL(0x7b,0x7b,0xf1,0x7b,0xff,0x8a,0xf6,0x84),
-	LL(0x35,0x35,0xd4,0x35,0xb5,0xe1,0x6a,0x80),
-	LL(0x1d,0x1d,0x74,0x1d,0xe8,0x69,0x3a,0xf5),
-	LL(0xe0,0xe0,0xa7,0xe0,0x53,0x47,0xdd,0xb3),
-	LL(0xd7,0xd7,0x7b,0xd7,0xf6,0xac,0xb3,0x21),
-	LL(0xc2,0xc2,0x2f,0xc2,0x5e,0xed,0x99,0x9c),
-	LL(0x2e,0x2e,0xb8,0x2e,0x6d,0x96,0x5c,0x43),
-	LL(0x4b,0x4b,0x31,0x4b,0x62,0x7a,0x96,0x29),
-	LL(0xfe,0xfe,0xdf,0xfe,0xa3,0x21,0xe1,0x5d),
-	LL(0x57,0x57,0x41,0x57,0x82,0x16,0xae,0xd5),
-	LL(0x15,0x15,0x54,0x15,0xa8,0x41,0x2a,0xbd),
-	LL(0x77,0x77,0xc1,0x77,0x9f,0xb6,0xee,0xe8),
-	LL(0x37,0x37,0xdc,0x37,0xa5,0xeb,0x6e,0x92),
-	LL(0xe5,0xe5,0xb3,0xe5,0x7b,0x56,0xd7,0x9e),
-	LL(0x9f,0x9f,0x46,0x9f,0x8c,0xd9,0x23,0x13),
-	LL(0xf0,0xf0,0xe7,0xf0,0xd3,0x17,0xfd,0x23),
-	LL(0x4a,0x4a,0x35,0x4a,0x6a,0x7f,0x94,0x20),
-	LL(0xda,0xda,0x4f,0xda,0x9e,0x95,0xa9,0x44),
-	LL(0x58,0x58,0x7d,0x58,0xfa,0x25,0xb0,0xa2),
-	LL(0xc9,0xc9,0x03,0xc9,0x06,0xca,0x8f,0xcf),
-	LL(0x29,0x29,0xa4,0x29,0x55,0x8d,0x52,0x7c),
-	LL(0x0a,0x0a,0x28,0x0a,0x50,0x22,0x14,0x5a),
-	LL(0xb1,0xb1,0xfe,0xb1,0xe1,0x4f,0x7f,0x50),
-	LL(0xa0,0xa0,0xba,0xa0,0x69,0x1a,0x5d,0xc9),
-	LL(0x6b,0x6b,0xb1,0x6b,0x7f,0xda,0xd6,0x14),
-	LL(0x85,0x85,0x2e,0x85,0x5c,0xab,0x17,0xd9),
-	LL(0xbd,0xbd,0xce,0xbd,0x81,0x73,0x67,0x3c),
-	LL(0x5d,0x5d,0x69,0x5d,0xd2,0x34,0xba,0x8f),
-	LL(0x10,0x10,0x40,0x10,0x80,0x50,0x20,0x90),
-	LL(0xf4,0xf4,0xf7,0xf4,0xf3,0x03,0xf5,0x07),
-	LL(0xcb,0xcb,0x0b,0xcb,0x16,0xc0,0x8b,0xdd),
-	LL(0x3e,0x3e,0xf8,0x3e,0xed,0xc6,0x7c,0xd3),
-	LL(0x05,0x05,0x14,0x05,0x28,0x11,0x0a,0x2d),
-	LL(0x67,0x67,0x81,0x67,0x1f,0xe6,0xce,0x78),
-	LL(0xe4,0xe4,0xb7,0xe4,0x73,0x53,0xd5,0x97),
-	LL(0x27,0x27,0x9c,0x27,0x25,0xbb,0x4e,0x02),
-	LL(0x41,0x41,0x19,0x41,0x32,0x58,0x82,0x73),
-	LL(0x8b,0x8b,0x16,0x8b,0x2c,0x9d,0x0b,0xa7),
-	LL(0xa7,0xa7,0xa6,0xa7,0x51,0x01,0x53,0xf6),
-	LL(0x7d,0x7d,0xe9,0x7d,0xcf,0x94,0xfa,0xb2),
-	LL(0x95,0x95,0x6e,0x95,0xdc,0xfb,0x37,0x49),
-	LL(0xd8,0xd8,0x47,0xd8,0x8e,0x9f,0xad,0x56),
-	LL(0xfb,0xfb,0xcb,0xfb,0x8b,0x30,0xeb,0x70),
-	LL(0xee,0xee,0x9f,0xee,0x23,0x71,0xc1,0xcd),
-	LL(0x7c,0x7c,0xed,0x7c,0xc7,0x91,0xf8,0xbb),
-	LL(0x66,0x66,0x85,0x66,0x17,0xe3,0xcc,0x71),
-	LL(0xdd,0xdd,0x53,0xdd,0xa6,0x8e,0xa7,0x7b),
-	LL(0x17,0x17,0x5c,0x17,0xb8,0x4b,0x2e,0xaf),
-	LL(0x47,0x47,0x01,0x47,0x02,0x46,0x8e,0x45),
-	LL(0x9e,0x9e,0x42,0x9e,0x84,0xdc,0x21,0x1a),
-	LL(0xca,0xca,0x0f,0xca,0x1e,0xc5,0x89,0xd4),
-	LL(0x2d,0x2d,0xb4,0x2d,0x75,0x99,0x5a,0x58),
-	LL(0xbf,0xbf,0xc6,0xbf,0x91,0x79,0x63,0x2e),
-	LL(0x07,0x07,0x1c,0x07,0x38,0x1b,0x0e,0x3f),
-	LL(0xad,0xad,0x8e,0xad,0x01,0x23,0x47,0xac),
-	LL(0x5a,0x5a,0x75,0x5a,0xea,0x2f,0xb4,0xb0),
-	LL(0x83,0x83,0x36,0x83,0x6c,0xb5,0x1b,0xef),
-	LL(0x33,0x33,0xcc,0x33,0x85,0xff,0x66,0xb6),
-	LL(0x63,0x63,0x91,0x63,0x3f,0xf2,0xc6,0x5c),
-	LL(0x02,0x02,0x08,0x02,0x10,0x0a,0x04,0x12),
-	LL(0xaa,0xaa,0x92,0xaa,0x39,0x38,0x49,0x93),
-	LL(0x71,0x71,0xd9,0x71,0xaf,0xa8,0xe2,0xde),
-	LL(0xc8,0xc8,0x07,0xc8,0x0e,0xcf,0x8d,0xc6),
-	LL(0x19,0x19,0x64,0x19,0xc8,0x7d,0x32,0xd1),
-	LL(0x49,0x49,0x39,0x49,0x72,0x70,0x92,0x3b),
-	LL(0xd9,0xd9,0x43,0xd9,0x86,0x9a,0xaf,0x5f),
-	LL(0xf2,0xf2,0xef,0xf2,0xc3,0x1d,0xf9,0x31),
-	LL(0xe3,0xe3,0xab,0xe3,0x4b,0x48,0xdb,0xa8),
-	LL(0x5b,0x5b,0x71,0x5b,0xe2,0x2a,0xb6,0xb9),
-	LL(0x88,0x88,0x1a,0x88,0x34,0x92,0x0d,0xbc),
-	LL(0x9a,0x9a,0x52,0x9a,0xa4,0xc8,0x29,0x3e),
-	LL(0x26,0x26,0x98,0x26,0x2d,0xbe,0x4c,0x0b),
-	LL(0x32,0x32,0xc8,0x32,0x8d,0xfa,0x64,0xbf),
-	LL(0xb0,0xb0,0xfa,0xb0,0xe9,0x4a,0x7d,0x59),
-	LL(0xe9,0xe9,0x83,0xe9,0x1b,0x6a,0xcf,0xf2),
-	LL(0x0f,0x0f,0x3c,0x0f,0x78,0x33,0x1e,0x77),
-	LL(0xd5,0xd5,0x73,0xd5,0xe6,0xa6,0xb7,0x33),
-	LL(0x80,0x80,0x3a,0x80,0x74,0xba,0x1d,0xf4),
-	LL(0xbe,0xbe,0xc2,0xbe,0x99,0x7c,0x61,0x27),
-	LL(0xcd,0xcd,0x13,0xcd,0x26,0xde,0x87,0xeb),
-	LL(0x34,0x34,0xd0,0x34,0xbd,0xe4,0x68,0x89),
-	LL(0x48,0x48,0x3d,0x48,0x7a,0x75,0x90,0x32),
-	LL(0xff,0xff,0xdb,0xff,0xab,0x24,0xe3,0x54),
-	LL(0x7a,0x7a,0xf5,0x7a,0xf7,0x8f,0xf4,0x8d),
-	LL(0x90,0x90,0x7a,0x90,0xf4,0xea,0x3d,0x64),
-	LL(0x5f,0x5f,0x61,0x5f,0xc2,0x3e,0xbe,0x9d),
-	LL(0x20,0x20,0x80,0x20,0x1d,0xa0,0x40,0x3d),
-	LL(0x68,0x68,0xbd,0x68,0x67,0xd5,0xd0,0x0f),
-	LL(0x1a,0x1a,0x68,0x1a,0xd0,0x72,0x34,0xca),
-	LL(0xae,0xae,0x82,0xae,0x19,0x2c,0x41,0xb7),
-	LL(0xb4,0xb4,0xea,0xb4,0xc9,0x5e,0x75,0x7d),
-	LL(0x54,0x54,0x4d,0x54,0x9a,0x19,0xa8,0xce),
-	LL(0x93,0x93,0x76,0x93,0xec,0xe5,0x3b,0x7f),
-	LL(0x22,0x22,0x88,0x22,0x0d,0xaa,0x44,0x2f),
-	LL(0x64,0x64,0x8d,0x64,0x07,0xe9,0xc8,0x63),
-	LL(0xf1,0xf1,0xe3,0xf1,0xdb,0x12,0xff,0x2a),
-	LL(0x73,0x73,0xd1,0x73,0xbf,0xa2,0xe6,0xcc),
-	LL(0x12,0x12,0x48,0x12,0x90,0x5a,0x24,0x82),
-	LL(0x40,0x40,0x1d,0x40,0x3a,0x5d,0x80,0x7a),
-	LL(0x08,0x08,0x20,0x08,0x40,0x28,0x10,0x48),
-	LL(0xc3,0xc3,0x2b,0xc3,0x56,0xe8,0x9b,0x95),
-	LL(0xec,0xec,0x97,0xec,0x33,0x7b,0xc5,0xdf),
-	LL(0xdb,0xdb,0x4b,0xdb,0x96,0x90,0xab,0x4d),
-	LL(0xa1,0xa1,0xbe,0xa1,0x61,0x1f,0x5f,0xc0),
-	LL(0x8d,0x8d,0x0e,0x8d,0x1c,0x83,0x07,0x91),
-	LL(0x3d,0x3d,0xf4,0x3d,0xf5,0xc9,0x7a,0xc8),
-	LL(0x97,0x97,0x66,0x97,0xcc,0xf1,0x33,0x5b),
-	LL(0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00),
-	LL(0xcf,0xcf,0x1b,0xcf,0x36,0xd4,0x83,0xf9),
-	LL(0x2b,0x2b,0xac,0x2b,0x45,0x87,0x56,0x6e),
-	LL(0x76,0x76,0xc5,0x76,0x97,0xb3,0xec,0xe1),
-	LL(0x82,0x82,0x32,0x82,0x64,0xb0,0x19,0xe6),
-	LL(0xd6,0xd6,0x7f,0xd6,0xfe,0xa9,0xb1,0x28),
-	LL(0x1b,0x1b,0x6c,0x1b,0xd8,0x77,0x36,0xc3),
-	LL(0xb5,0xb5,0xee,0xb5,0xc1,0x5b,0x77,0x74),
-	LL(0xaf,0xaf,0x86,0xaf,0x11,0x29,0x43,0xbe),
-	LL(0x6a,0x6a,0xb5,0x6a,0x77,0xdf,0xd4,0x1d),
-	LL(0x50,0x50,0x5d,0x50,0xba,0x0d,0xa0,0xea),
-	LL(0x45,0x45,0x09,0x45,0x12,0x4c,0x8a,0x57),
-	LL(0xf3,0xf3,0xeb,0xf3,0xcb,0x18,0xfb,0x38),
-	LL(0x30,0x30,0xc0,0x30,0x9d,0xf0,0x60,0xad),
-	LL(0xef,0xef,0x9b,0xef,0x2b,0x74,0xc3,0xc4),
-	LL(0x3f,0x3f,0xfc,0x3f,0xe5,0xc3,0x7e,0xda),
-	LL(0x55,0x55,0x49,0x55,0x92,0x1c,0xaa,0xc7),
-	LL(0xa2,0xa2,0xb2,0xa2,0x79,0x10,0x59,0xdb),
-	LL(0xea,0xea,0x8f,0xea,0x03,0x65,0xc9,0xe9),
-	LL(0x65,0x65,0x89,0x65,0x0f,0xec,0xca,0x6a),
-	LL(0xba,0xba,0xd2,0xba,0xb9,0x68,0x69,0x03),
-	LL(0x2f,0x2f,0xbc,0x2f,0x65,0x93,0x5e,0x4a),
-	LL(0xc0,0xc0,0x27,0xc0,0x4e,0xe7,0x9d,0x8e),
-	LL(0xde,0xde,0x5f,0xde,0xbe,0x81,0xa1,0x60),
-	LL(0x1c,0x1c,0x70,0x1c,0xe0,0x6c,0x38,0xfc),
-	LL(0xfd,0xfd,0xd3,0xfd,0xbb,0x2e,0xe7,0x46),
-	LL(0x4d,0x4d,0x29,0x4d,0x52,0x64,0x9a,0x1f),
-	LL(0x92,0x92,0x72,0x92,0xe4,0xe0,0x39,0x76),
-	LL(0x75,0x75,0xc9,0x75,0x8f,0xbc,0xea,0xfa),
-	LL(0x06,0x06,0x18,0x06,0x30,0x1e,0x0c,0x36),
-	LL(0x8a,0x8a,0x12,0x8a,0x24,0x98,0x09,0xae),
-	LL(0xb2,0xb2,0xf2,0xb2,0xf9,0x40,0x79,0x4b),
-	LL(0xe6,0xe6,0xbf,0xe6,0x63,0x59,0xd1,0x85),
-	LL(0x0e,0x0e,0x38,0x0e,0x70,0x36,0x1c,0x7e),
-	LL(0x1f,0x1f,0x7c,0x1f,0xf8,0x63,0x3e,0xe7),
-	LL(0x62,0x62,0x95,0x62,0x37,0xf7,0xc4,0x55),
-	LL(0xd4,0xd4,0x77,0xd4,0xee,0xa3,0xb5,0x3a),
-	LL(0xa8,0xa8,0x9a,0xa8,0x29,0x32,0x4d,0x81),
-	LL(0x96,0x96,0x62,0x96,0xc4,0xf4,0x31,0x52),
-	LL(0xf9,0xf9,0xc3,0xf9,0x9b,0x3a,0xef,0x62),
-	LL(0xc5,0xc5,0x33,0xc5,0x66,0xf6,0x97,0xa3),
-	LL(0x25,0x25,0x94,0x25,0x35,0xb1,0x4a,0x10),
-	LL(0x59,0x59,0x79,0x59,0xf2,0x20,0xb2,0xab),
-	LL(0x84,0x84,0x2a,0x84,0x54,0xae,0x15,0xd0),
-	LL(0x72,0x72,0xd5,0x72,0xb7,0xa7,0xe4,0xc5),
-	LL(0x39,0x39,0xe4,0x39,0xd5,0xdd,0x72,0xec),
-	LL(0x4c,0x4c,0x2d,0x4c,0x5a,0x61,0x98,0x16),
-	LL(0x5e,0x5e,0x65,0x5e,0xca,0x3b,0xbc,0x94),
-	LL(0x78,0x78,0xfd,0x78,0xe7,0x85,0xf0,0x9f),
-	LL(0x38,0x38,0xe0,0x38,0xdd,0xd8,0x70,0xe5),
-	LL(0x8c,0x8c,0x0a,0x8c,0x14,0x86,0x05,0x98),
-	LL(0xd1,0xd1,0x63,0xd1,0xc6,0xb2,0xbf,0x17),
-	LL(0xa5,0xa5,0xae,0xa5,0x41,0x0b,0x57,0xe4),
-	LL(0xe2,0xe2,0xaf,0xe2,0x43,0x4d,0xd9,0xa1),
-	LL(0x61,0x61,0x99,0x61,0x2f,0xf8,0xc2,0x4e),
-	LL(0xb3,0xb3,0xf6,0xb3,0xf1,0x45,0x7b,0x42),
-	LL(0x21,0x21,0x84,0x21,0x15,0xa5,0x42,0x34),
-	LL(0x9c,0x9c,0x4a,0x9c,0x94,0xd6,0x25,0x08),
-	LL(0x1e,0x1e,0x78,0x1e,0xf0,0x66,0x3c,0xee),
-	LL(0x43,0x43,0x11,0x43,0x22,0x52,0x86,0x61),
-	LL(0xc7,0xc7,0x3b,0xc7,0x76,0xfc,0x93,0xb1),
-	LL(0xfc,0xfc,0xd7,0xfc,0xb3,0x2b,0xe5,0x4f),
-	LL(0x04,0x04,0x10,0x04,0x20,0x14,0x08,0x24),
-	LL(0x51,0x51,0x59,0x51,0xb2,0x08,0xa2,0xe3),
-	LL(0x99,0x99,0x5e,0x99,0xbc,0xc7,0x2f,0x25),
-	LL(0x6d,0x6d,0xa9,0x6d,0x4f,0xc4,0xda,0x22),
-	LL(0x0d,0x0d,0x34,0x0d,0x68,0x39,0x1a,0x65),
-	LL(0xfa,0xfa,0xcf,0xfa,0x83,0x35,0xe9,0x79),
-	LL(0xdf,0xdf,0x5b,0xdf,0xb6,0x84,0xa3,0x69),
-	LL(0x7e,0x7e,0xe5,0x7e,0xd7,0x9b,0xfc,0xa9),
-	LL(0x24,0x24,0x90,0x24,0x3d,0xb4,0x48,0x19),
-	LL(0x3b,0x3b,0xec,0x3b,0xc5,0xd7,0x76,0xfe),
-	LL(0xab,0xab,0x96,0xab,0x31,0x3d,0x4b,0x9a),
-	LL(0xce,0xce,0x1f,0xce,0x3e,0xd1,0x81,0xf0),
-	LL(0x11,0x11,0x44,0x11,0x88,0x55,0x22,0x99),
-	LL(0x8f,0x8f,0x06,0x8f,0x0c,0x89,0x03,0x83),
-	LL(0x4e,0x4e,0x25,0x4e,0x4a,0x6b,0x9c,0x04),
-	LL(0xb7,0xb7,0xe6,0xb7,0xd1,0x51,0x73,0x66),
-	LL(0xeb,0xeb,0x8b,0xeb,0x0b,0x60,0xcb,0xe0),
-	LL(0x3c,0x3c,0xf0,0x3c,0xfd,0xcc,0x78,0xc1),
-	LL(0x81,0x81,0x3e,0x81,0x7c,0xbf,0x1f,0xfd),
-	LL(0x94,0x94,0x6a,0x94,0xd4,0xfe,0x35,0x40),
-	LL(0xf7,0xf7,0xfb,0xf7,0xeb,0x0c,0xf3,0x1c),
-	LL(0xb9,0xb9,0xde,0xb9,0xa1,0x67,0x6f,0x18),
-	LL(0x13,0x13,0x4c,0x13,0x98,0x5f,0x26,0x8b),
-	LL(0x2c,0x2c,0xb0,0x2c,0x7d,0x9c,0x58,0x51),
-	LL(0xd3,0xd3,0x6b,0xd3,0xd6,0xb8,0xbb,0x05),
-	LL(0xe7,0xe7,0xbb,0xe7,0x6b,0x5c,0xd3,0x8c),
-	LL(0x6e,0x6e,0xa5,0x6e,0x57,0xcb,0xdc,0x39),
-	LL(0xc4,0xc4,0x37,0xc4,0x6e,0xf3,0x95,0xaa),
-	LL(0x03,0x03,0x0c,0x03,0x18,0x0f,0x06,0x1b),
-	LL(0x56,0x56,0x45,0x56,0x8a,0x13,0xac,0xdc),
-	LL(0x44,0x44,0x0d,0x44,0x1a,0x49,0x88,0x5e),
-	LL(0x7f,0x7f,0xe1,0x7f,0xdf,0x9e,0xfe,0xa0),
-	LL(0xa9,0xa9,0x9e,0xa9,0x21,0x37,0x4f,0x88),
-	LL(0x2a,0x2a,0xa8,0x2a,0x4d,0x82,0x54,0x67),
-	LL(0xbb,0xbb,0xd6,0xbb,0xb1,0x6d,0x6b,0x0a),
-	LL(0xc1,0xc1,0x23,0xc1,0x46,0xe2,0x9f,0x87),
-	LL(0x53,0x53,0x51,0x53,0xa2,0x02,0xa6,0xf1),
-	LL(0xdc,0xdc,0x57,0xdc,0xae,0x8b,0xa5,0x72),
-	LL(0x0b,0x0b,0x2c,0x0b,0x58,0x27,0x16,0x53),
-	LL(0x9d,0x9d,0x4e,0x9d,0x9c,0xd3,0x27,0x01),
-	LL(0x6c,0x6c,0xad,0x6c,0x47,0xc1,0xd8,0x2b),
-	LL(0x31,0x31,0xc4,0x31,0x95,0xf5,0x62,0xa4),
-	LL(0x74,0x74,0xcd,0x74,0x87,0xb9,0xe8,0xf3),
-	LL(0xf6,0xf6,0xff,0xf6,0xe3,0x09,0xf1,0x15),
-	LL(0x46,0x46,0x05,0x46,0x0a,0x43,0x8c,0x4c),
-	LL(0xac,0xac,0x8a,0xac,0x09,0x26,0x45,0xa5),
-	LL(0x89,0x89,0x1e,0x89,0x3c,0x97,0x0f,0xb5),
-	LL(0x14,0x14,0x50,0x14,0xa0,0x44,0x28,0xb4),
-	LL(0xe1,0xe1,0xa3,0xe1,0x5b,0x42,0xdf,0xba),
-	LL(0x16,0x16,0x58,0x16,0xb0,0x4e,0x2c,0xa6),
-	LL(0x3a,0x3a,0xe8,0x3a,0xcd,0xd2,0x74,0xf7),
-	LL(0x69,0x69,0xb9,0x69,0x6f,0xd0,0xd2,0x06),
-	LL(0x09,0x09,0x24,0x09,0x48,0x2d,0x12,0x41),
-	LL(0x70,0x70,0xdd,0x70,0xa7,0xad,0xe0,0xd7),
-	LL(0xb6,0xb6,0xe2,0xb6,0xd9,0x54,0x71,0x6f),
-	LL(0xd0,0xd0,0x67,0xd0,0xce,0xb7,0xbd,0x1e),
-	LL(0xed,0xed,0x93,0xed,0x3b,0x7e,0xc7,0xd6),
-	LL(0xcc,0xcc,0x17,0xcc,0x2e,0xdb,0x85,0xe2),
-	LL(0x42,0x42,0x15,0x42,0x2a,0x57,0x84,0x68),
-	LL(0x98,0x98,0x5a,0x98,0xb4,0xc2,0x2d,0x2c),
-	LL(0xa4,0xa4,0xaa,0xa4,0x49,0x0e,0x55,0xed),
-	LL(0x28,0x28,0xa0,0x28,0x5d,0x88,0x50,0x75),
-	LL(0x5c,0x5c,0x6d,0x5c,0xda,0x31,0xb8,0x86),
-	LL(0xf8,0xf8,0xc7,0xf8,0x93,0x3f,0xed,0x6b),
-	LL(0x86,0x86,0x22,0x86,0x44,0xa4,0x11,0xc2),
-#define RC	(&(Cx.q[256*N]))
-	0x18,0x23,0xc6,0xe8,0x87,0xb8,0x01,0x4f,	/* rc[ROUNDS] */
-	0x36,0xa6,0xd2,0xf5,0x79,0x6f,0x91,0x52,
-	0x60,0xbc,0x9b,0x8e,0xa3,0x0c,0x7b,0x35,
-	0x1d,0xe0,0xd7,0xc2,0x2e,0x4b,0xfe,0x57,
-	0x15,0x77,0x37,0xe5,0x9f,0xf0,0x4a,0xda,
-	0x58,0xc9,0x29,0x0a,0xb1,0xa0,0x6b,0x85,
-	0xbd,0x5d,0x10,0xf4,0xcb,0x3e,0x05,0x67,
-	0xe4,0x27,0x41,0x8b,0xa7,0x7d,0x95,0xd8,
-	0xfb,0xee,0x7c,0x66,0xdd,0x17,0x47,0x9e,
-	0xca,0x2d,0xbf,0x07,0xad,0x5a,0x83,0x33
-	}
-};
-
-void whirlpool_block(WHIRLPOOL_CTX *ctx,const void *inp,size_t n)
-	{
-	int	r;
-	const u8 *p=inp;
-	union	{ u64 q[8]; u8 c[64]; } S,K,*H=(void *)ctx->H.q;
-
-#ifdef GO_FOR_MMX
-	GO_FOR_MMX(ctx,inp,n);
-#endif
-							do {
-#ifdef OPENSSL_SMALL_FOOTPRINT
-	u64	L[8];
-	int	i;
-
-	for (i=0;i<64;i++)	S.c[i] = (K.c[i] = H->c[i]) ^ p[i];
-	for (r=0;r<ROUNDS;r++)
-		{
-		for (i=0;i<8;i++)
-			{
-			L[i]  = i ? 0 : RC[r];
-			L[i] ^=	C0(K,i)       ^ C1(K,(i-1)&7) ^
-				C2(K,(i-2)&7) ^ C3(K,(i-3)&7) ^
-				C4(K,(i-4)&7) ^ C5(K,(i-5)&7) ^
-				C6(K,(i-6)&7) ^ C7(K,(i-7)&7);
-			}
-		memcpy (K.q,L,64);
-		for (i=0;i<8;i++)
-			{
-			L[i] ^= C0(S,i)       ^ C1(S,(i-1)&7) ^
-				C2(S,(i-2)&7) ^ C3(S,(i-3)&7) ^
-				C4(S,(i-4)&7) ^ C5(S,(i-5)&7) ^
-				C6(S,(i-6)&7) ^ C7(S,(i-7)&7);
-			}
-		memcpy (S.q,L,64);
-		}
-	for (i=0;i<64;i++)	H->c[i] ^= S.c[i] ^ p[i];
-#else
-	u64	L0,L1,L2,L3,L4,L5,L6,L7;
-
-#ifdef STRICT_ALIGNMENT
-	if ((size_t)p & 7)
-		{
-		memcpy (S.c,p,64);
-		S.q[0] ^= (K.q[0] = H->q[0]);
-		S.q[1] ^= (K.q[1] = H->q[1]);
-		S.q[2] ^= (K.q[2] = H->q[2]);
-		S.q[3] ^= (K.q[3] = H->q[3]);
-		S.q[4] ^= (K.q[4] = H->q[4]);
-		S.q[5] ^= (K.q[5] = H->q[5]);
-		S.q[6] ^= (K.q[6] = H->q[6]);
-		S.q[7] ^= (K.q[7] = H->q[7]);
-		}
-	else
-#endif
-		{
-		const u64 *pa = (const u64*)p;
-		S.q[0] = (K.q[0] = H->q[0]) ^ pa[0];
-		S.q[1] = (K.q[1] = H->q[1]) ^ pa[1];
-		S.q[2] = (K.q[2] = H->q[2]) ^ pa[2];
-		S.q[3] = (K.q[3] = H->q[3]) ^ pa[3];
-		S.q[4] = (K.q[4] = H->q[4]) ^ pa[4];
-		S.q[5] = (K.q[5] = H->q[5]) ^ pa[5];
-		S.q[6] = (K.q[6] = H->q[6]) ^ pa[6];
-		S.q[7] = (K.q[7] = H->q[7]) ^ pa[7];
-		}
-
-	for(r=0;r<ROUNDS;r++)
-		{
-#ifdef SMALL_REGISTER_BANK
-		L0 =	C0(K,0) ^ C1(K,7) ^ C2(K,6) ^ C3(K,5) ^
-			C4(K,4) ^ C5(K,3) ^ C6(K,2) ^ C7(K,1) ^ RC[r];
-		L1 =	C0(K,1) ^ C1(K,0) ^ C2(K,7) ^ C3(K,6) ^
-			C4(K,5) ^ C5(K,4) ^ C6(K,3) ^ C7(K,2);
-		L2 =	C0(K,2) ^ C1(K,1) ^ C2(K,0) ^ C3(K,7) ^
-			C4(K,6) ^ C5(K,5) ^ C6(K,4) ^ C7(K,3);
-		L3 =	C0(K,3) ^ C1(K,2) ^ C2(K,1) ^ C3(K,0) ^
-			C4(K,7) ^ C5(K,6) ^ C6(K,5) ^ C7(K,4);
-		L4 =	C0(K,4) ^ C1(K,3) ^ C2(K,2) ^ C3(K,1) ^
-			C4(K,0) ^ C5(K,7) ^ C6(K,6) ^ C7(K,5);
-		L5 =	C0(K,5) ^ C1(K,4) ^ C2(K,3) ^ C3(K,2) ^
-			C4(K,1) ^ C5(K,0) ^ C6(K,7) ^ C7(K,6);
-		L6 =	C0(K,6) ^ C1(K,5) ^ C2(K,4) ^ C3(K,3) ^
-			C4(K,2) ^ C5(K,1) ^ C6(K,0) ^ C7(K,7);
-		L7 =	C0(K,7) ^ C1(K,6) ^ C2(K,5) ^ C3(K,4) ^
-			C4(K,3) ^ C5(K,2) ^ C6(K,1) ^ C7(K,0);
-
-		K.q[0] = L0; K.q[1] = L1; K.q[2] = L2; K.q[3] = L3;
-		K.q[4] = L4; K.q[5] = L5; K.q[6] = L6; K.q[7] = L7;
-
-		L0 ^=	C0(S,0) ^ C1(S,7) ^ C2(S,6) ^ C3(S,5) ^
-			C4(S,4) ^ C5(S,3) ^ C6(S,2) ^ C7(S,1);
-		L1 ^=	C0(S,1) ^ C1(S,0) ^ C2(S,7) ^ C3(S,6) ^
-			C4(S,5) ^ C5(S,4) ^ C6(S,3) ^ C7(S,2);
-		L2 ^=	C0(S,2) ^ C1(S,1) ^ C2(S,0) ^ C3(S,7) ^
-			C4(S,6) ^ C5(S,5) ^ C6(S,4) ^ C7(S,3);
-		L3 ^=	C0(S,3) ^ C1(S,2) ^ C2(S,1) ^ C3(S,0) ^
-			C4(S,7) ^ C5(S,6) ^ C6(S,5) ^ C7(S,4);
-		L4 ^=	C0(S,4) ^ C1(S,3) ^ C2(S,2) ^ C3(S,1) ^
-			C4(S,0) ^ C5(S,7) ^ C6(S,6) ^ C7(S,5);
-		L5 ^=	C0(S,5) ^ C1(S,4) ^ C2(S,3) ^ C3(S,2) ^
-			C4(S,1) ^ C5(S,0) ^ C6(S,7) ^ C7(S,6);
-		L6 ^=	C0(S,6) ^ C1(S,5) ^ C2(S,4) ^ C3(S,3) ^
-			C4(S,2) ^ C5(S,1) ^ C6(S,0) ^ C7(S,7);
-		L7 ^=	C0(S,7) ^ C1(S,6) ^ C2(S,5) ^ C3(S,4) ^
-			C4(S,3) ^ C5(S,2) ^ C6(S,1) ^ C7(S,0);
-
-		S.q[0] = L0; S.q[1] = L1; S.q[2] = L2; S.q[3] = L3;
-		S.q[4] = L4; S.q[5] = L5; S.q[6] = L6; S.q[7] = L7;
-#else
-		L0  = C0(K,0); L1  = C1(K,0); L2  = C2(K,0); L3  = C3(K,0);
-		L4  = C4(K,0); L5  = C5(K,0); L6  = C6(K,0); L7  = C7(K,0);
-		L0 ^= RC[r];
-
-		L1 ^= C0(K,1); L2 ^= C1(K,1); L3 ^= C2(K,1); L4 ^= C3(K,1);
-		L5 ^= C4(K,1); L6 ^= C5(K,1); L7 ^= C6(K,1); L0 ^= C7(K,1);
-
-		L2 ^= C0(K,2); L3 ^= C1(K,2); L4 ^= C2(K,2); L5 ^= C3(K,2);
-		L6 ^= C4(K,2); L7 ^= C5(K,2); L0 ^= C6(K,2); L1 ^= C7(K,2);
-
-		L3 ^= C0(K,3); L4 ^= C1(K,3); L5 ^= C2(K,3); L6 ^= C3(K,3);
-		L7 ^= C4(K,3); L0 ^= C5(K,3); L1 ^= C6(K,3); L2 ^= C7(K,3);
-
-		L4 ^= C0(K,4); L5 ^= C1(K,4); L6 ^= C2(K,4); L7 ^= C3(K,4);
-		L0 ^= C4(K,4); L1 ^= C5(K,4); L2 ^= C6(K,4); L3 ^= C7(K,4);
-
-		L5 ^= C0(K,5); L6 ^= C1(K,5); L7 ^= C2(K,5); L0 ^= C3(K,5);
-		L1 ^= C4(K,5); L2 ^= C5(K,5); L3 ^= C6(K,5); L4 ^= C7(K,5);
-
-		L6 ^= C0(K,6); L7 ^= C1(K,6); L0 ^= C2(K,6); L1 ^= C3(K,6);
-		L2 ^= C4(K,6); L3 ^= C5(K,6); L4 ^= C6(K,6); L5 ^= C7(K,6);
-
-		L7 ^= C0(K,7); L0 ^= C1(K,7); L1 ^= C2(K,7); L2 ^= C3(K,7);
-		L3 ^= C4(K,7); L4 ^= C5(K,7); L5 ^= C6(K,7); L6 ^= C7(K,7);
-
-		K.q[0] = L0; K.q[1] = L1; K.q[2] = L2; K.q[3] = L3;
-		K.q[4] = L4; K.q[5] = L5; K.q[6] = L6; K.q[7] = L7;
-
-		L0 ^= C0(S,0); L1 ^= C1(S,0); L2 ^= C2(S,0); L3 ^= C3(S,0);
-		L4 ^= C4(S,0); L5 ^= C5(S,0); L6 ^= C6(S,0); L7 ^= C7(S,0);
-
-		L1 ^= C0(S,1); L2 ^= C1(S,1); L3 ^= C2(S,1); L4 ^= C3(S,1);
-		L5 ^= C4(S,1); L6 ^= C5(S,1); L7 ^= C6(S,1); L0 ^= C7(S,1);
-
-		L2 ^= C0(S,2); L3 ^= C1(S,2); L4 ^= C2(S,2); L5 ^= C3(S,2);
-		L6 ^= C4(S,2); L7 ^= C5(S,2); L0 ^= C6(S,2); L1 ^= C7(S,2);
-
-		L3 ^= C0(S,3); L4 ^= C1(S,3); L5 ^= C2(S,3); L6 ^= C3(S,3);
-		L7 ^= C4(S,3); L0 ^= C5(S,3); L1 ^= C6(S,3); L2 ^= C7(S,3);
-
-		L4 ^= C0(S,4); L5 ^= C1(S,4); L6 ^= C2(S,4); L7 ^= C3(S,4);
-		L0 ^= C4(S,4); L1 ^= C5(S,4); L2 ^= C6(S,4); L3 ^= C7(S,4);
-
-		L5 ^= C0(S,5); L6 ^= C1(S,5); L7 ^= C2(S,5); L0 ^= C3(S,5);
-		L1 ^= C4(S,5); L2 ^= C5(S,5); L3 ^= C6(S,5); L4 ^= C7(S,5);
-
-		L6 ^= C0(S,6); L7 ^= C1(S,6); L0 ^= C2(S,6); L1 ^= C3(S,6);
-		L2 ^= C4(S,6); L3 ^= C5(S,6); L4 ^= C6(S,6); L5 ^= C7(S,6);
-
-		L7 ^= C0(S,7); L0 ^= C1(S,7); L1 ^= C2(S,7); L2 ^= C3(S,7);
-		L3 ^= C4(S,7); L4 ^= C5(S,7); L5 ^= C6(S,7); L6 ^= C7(S,7);
-
-		S.q[0] = L0; S.q[1] = L1; S.q[2] = L2; S.q[3] = L3;
-		S.q[4] = L4; S.q[5] = L5; S.q[6] = L6; S.q[7] = L7;
-#endif
-		}
-
-#ifdef STRICT_ALIGNMENT
-	if ((size_t)p & 7)
-		{
-		int i;
-		for(i=0;i<64;i++)	H->c[i] ^= S.c[i] ^ p[i];
-		}
-	else
-#endif
-		{
-		const u64 *pa=(const u64 *)p;
-		H->q[0] ^= S.q[0] ^ pa[0];
-		H->q[1] ^= S.q[1] ^ pa[1];
-		H->q[2] ^= S.q[2] ^ pa[2];
-		H->q[3] ^= S.q[3] ^ pa[3];
-		H->q[4] ^= S.q[4] ^ pa[4];
-		H->q[5] ^= S.q[5] ^ pa[5];
-		H->q[6] ^= S.q[6] ^ pa[6];
-		H->q[7] ^= S.q[7] ^ pa[7];
-		}
-#endif
-							p += 64;
-							} while(--n);
-	}

+ 0 - 264
openssl/crypto/whrlpool/wp_dgst.c

@@ -1,264 +0,0 @@
-/**
- * The Whirlpool hashing function.
- *
- * <P>
- * <b>References</b>
- *
- * <P>
- * The Whirlpool algorithm was developed by
- * <a href="mailto:[email protected]">Paulo S. L. M. Barreto</a> and
- * <a href="mailto:[email protected]">Vincent Rijmen</a>.
- *
- * See
- *      P.S.L.M. Barreto, V. Rijmen,
- *      ``The Whirlpool hashing function,''
- *      NESSIE submission, 2000 (tweaked version, 2001),
- *      <https://www.cosic.esat.kuleuven.ac.be/nessie/workshop/submissions/whirlpool.zip>
- *
- * Based on "@version 3.0 (2003.03.12)" by Paulo S.L.M. Barreto and
- * Vincent Rijmen. Lookup "reference implementations" on
- * <http://planeta.terra.com.br/informatica/paulobarreto/>
- *
- * =============================================================================
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-/*
- * OpenSSL-specific implementation notes.
- *
- * WHIRLPOOL_Update as well as one-stroke WHIRLPOOL both expect
- * number of *bytes* as input length argument. Bit-oriented routine
- * as specified by authors is called WHIRLPOOL_BitUpdate[!] and
- * does not have one-stroke counterpart.
- *
- * WHIRLPOOL_BitUpdate implements byte-oriented loop, essentially
- * to serve WHIRLPOOL_Update. This is done for performance.
- *
- * Unlike authors' reference implementation, block processing
- * routine whirlpool_block is designed to operate on multi-block
- * input. This is done for perfomance.
- */
-
-#include "wp_locl.h"
-#include <string.h>
-
-int WHIRLPOOL_Init	(WHIRLPOOL_CTX *c)
-	{
-	memset (c,0,sizeof(*c));
-	return(1);
-	}
-
-int WHIRLPOOL_Update	(WHIRLPOOL_CTX *c,const void *_inp,size_t bytes)
-	{
-	/* Well, largest suitable chunk size actually is
-	 * (1<<(sizeof(size_t)*8-3))-64, but below number
-	 * is large enough for not to care about excessive
-	 * calls to WHIRLPOOL_BitUpdate... */
-	size_t chunk = ((size_t)1)<<(sizeof(size_t)*8-4);
-	const unsigned char *inp = _inp;
-
-	while (bytes>=chunk)
-		{
-		WHIRLPOOL_BitUpdate(c,inp,chunk*8);
-		bytes -= chunk;
-		inp   += chunk;
-		}
-	if (bytes)
-		WHIRLPOOL_BitUpdate(c,inp,bytes*8);
-
-	return(1);
-	}
-
-void WHIRLPOOL_BitUpdate(WHIRLPOOL_CTX *c,const void *_inp,size_t bits)
-	{
-	size_t		n;
-	unsigned int	bitoff = c->bitoff,
-			bitrem = bitoff%8,
-			inpgap = (8-(unsigned int)bits%8)&7;
-	const unsigned char *inp=_inp;
-
-	/* This 256-bit increment procedure relies on the size_t
-	 * being natural size of CPU register, so that we don't
-	 * have to mask the value in order to detect overflows. */
-	c->bitlen[0] += bits;
-	if (c->bitlen[0] < bits)	/* overflow */
-		{
-		n = 1;
-		do  { 	c->bitlen[n]++;
-		    } while(c->bitlen[n]==0
-		   	    && ++n<(WHIRLPOOL_COUNTER/sizeof(size_t)));
-		}
-
-#ifndef OPENSSL_SMALL_FOOTPRINT
-	reconsider:
-	if (inpgap==0 && bitrem==0)	/* byte-oriented loop */
-		{
-		while (bits)
-			{
-			if (bitoff==0 && (n=bits/WHIRLPOOL_BBLOCK))
-				{
-				whirlpool_block(c,inp,n);
-				inp  += n*WHIRLPOOL_BBLOCK/8;
-				bits %= WHIRLPOOL_BBLOCK;
-				}
-			else
-				{
-				unsigned int byteoff = bitoff/8;
-
-				bitrem = WHIRLPOOL_BBLOCK - bitoff;/* re-use bitrem */
-				if (bits >= bitrem)
-					{
-					bits -= bitrem;
-					bitrem /= 8;
-					memcpy(c->data+byteoff,inp,bitrem);
-					inp  += bitrem;
-					whirlpool_block(c,c->data,1);
-					bitoff = 0;
-					}
-				else
-					{
-					memcpy(c->data+byteoff,inp,bits/8);
-					bitoff += (unsigned int)bits;
-					bits = 0;
-					}
-				c->bitoff = bitoff;
-				}
-			}
-		}
-	else				/* bit-oriented loop */
-#endif
-		{
-		/*
-			   inp
-			   |
-			   +-------+-------+-------
-			      |||||||||||||||||||||
-			   +-------+-------+-------
-		+-------+-------+-------+-------+-------
-		||||||||||||||				c->data
-		+-------+-------+-------+-------+-------
-			|
-			c->bitoff/8
-		*/
-		while (bits)
-			{
-			unsigned int	byteoff	= bitoff/8;
-			unsigned char	b;
-
-#ifndef OPENSSL_SMALL_FOOTPRINT
-			if (bitrem==inpgap)
-				{
-				c->data[byteoff++] |= inp[0] & (0xff>>inpgap);
-				inpgap = 8-inpgap;
-				bitoff += inpgap;  bitrem = 0;	/* bitoff%8 */
-				bits   -= inpgap;  inpgap = 0;	/* bits%8   */
-				inp++;
-				if (bitoff==WHIRLPOOL_BBLOCK)
-					{
-					whirlpool_block(c,c->data,1);
-					bitoff = 0;
-					}
-				c->bitoff = bitoff;
-				goto reconsider;
-				}
-			else
-#endif
-			if (bits>=8)
-				{
-				b  = ((inp[0]<<inpgap) | (inp[1]>>(8-inpgap)));
-				b &= 0xff;
-				if (bitrem)	c->data[byteoff++] |= b>>bitrem;
-				else		c->data[byteoff++]  = b;
-				bitoff += 8;
-				bits   -= 8;
-				inp++;
-				if (bitoff>=WHIRLPOOL_BBLOCK)
-					{
-					whirlpool_block(c,c->data,1);
-					byteoff  = 0;
-					bitoff  %= WHIRLPOOL_BBLOCK;
-					}
-				if (bitrem)	c->data[byteoff] = b<<(8-bitrem);
-				}
-			else	/* remaining less than 8 bits */
-				{
-				b = (inp[0]<<inpgap)&0xff;
-				if (bitrem)	c->data[byteoff++] |= b>>bitrem;
-				else		c->data[byteoff++]  = b;
-				bitoff += (unsigned int)bits;
-				if (bitoff==WHIRLPOOL_BBLOCK)
-					{
-					whirlpool_block(c,c->data,1);
-					byteoff  = 0;
-			        	bitoff  %= WHIRLPOOL_BBLOCK;
-					}
-				if (bitrem)	c->data[byteoff] = b<<(8-bitrem);
-				bits = 0;
-				}
-			c->bitoff = bitoff;
-			}
-		}
-	}
-
-int WHIRLPOOL_Final	(unsigned char *md,WHIRLPOOL_CTX *c)
-	{
-	unsigned int	bitoff  = c->bitoff,
-			byteoff = bitoff/8;
-	size_t		i,j,v;
-	unsigned char  *p;
-
-	bitoff %= 8;
-	if (bitoff)	c->data[byteoff] |= 0x80>>bitoff;
-	else		c->data[byteoff]  = 0x80;
-	byteoff++;
-
-	/* pad with zeros */
-	if (byteoff > (WHIRLPOOL_BBLOCK/8-WHIRLPOOL_COUNTER))
-		{
-		if (byteoff<WHIRLPOOL_BBLOCK/8)
-			memset(&c->data[byteoff],0,WHIRLPOOL_BBLOCK/8-byteoff);
-		whirlpool_block(c,c->data,1);
-		byteoff = 0;
-		}
-	if (byteoff < (WHIRLPOOL_BBLOCK/8-WHIRLPOOL_COUNTER))
-		memset(&c->data[byteoff],0,
-			(WHIRLPOOL_BBLOCK/8-WHIRLPOOL_COUNTER)-byteoff);
-	/* smash 256-bit c->bitlen in big-endian order */
-	p = &c->data[WHIRLPOOL_BBLOCK/8-1];	/* last byte in c->data */
-	for(i=0;i<WHIRLPOOL_COUNTER/sizeof(size_t);i++)
-		for(v=c->bitlen[i],j=0;j<sizeof(size_t);j++,v>>=8)
-			*p-- = (unsigned char)(v&0xff);
-
-	whirlpool_block(c,c->data,1);
-
-	if (md)	{
-		memcpy(md,c->H.c,WHIRLPOOL_DIGEST_LENGTH);
-		memset(c,0,sizeof(*c));
-		return(1);
-		}
-	return(0);
-	}
-
-unsigned char *WHIRLPOOL(const void *inp, size_t bytes,unsigned char *md)
-	{
-	WHIRLPOOL_CTX ctx;
-	static unsigned char m[WHIRLPOOL_DIGEST_LENGTH];
-
-	if (md == NULL) md=m;
-	WHIRLPOOL_Init(&ctx);
-	WHIRLPOOL_Update(&ctx,inp,bytes);
-	WHIRLPOOL_Final(md,&ctx);
-	return(md);
-	}

+ 0 - 3
openssl/crypto/whrlpool/wp_locl.h

@@ -1,3 +0,0 @@
-#include <openssl/whrlpool.h>
-
-void whirlpool_block(WHIRLPOOL_CTX *,const void *,size_t);

+ 1 - 0
openssl/crypto/x509/x509.h

@@ -258,6 +258,7 @@ typedef struct x509_cinf_st
 	ASN1_BIT_STRING *issuerUID;		/* [ 1 ] optional in v2 */
 	ASN1_BIT_STRING *subjectUID;		/* [ 2 ] optional in v2 */
 	STACK_OF(X509_EXTENSION) *extensions;	/* [ 3 ] optional in v3 */
+	ASN1_ENCODING enc;
 	} X509_CINF;
 
 /* This stuff is certificate "auxiliary info"

+ 1 - 1
openssl/crypto/x509/x509_vfy.c

@@ -2034,7 +2034,7 @@ int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, X509 *x509,
 	if (store)
 		ret = X509_VERIFY_PARAM_inherit(ctx->param, store->param);
 	else
-		ctx->param->flags |= X509_VP_FLAG_DEFAULT|X509_VP_FLAG_ONCE;
+		ctx->param->inh_flags |= X509_VP_FLAG_DEFAULT|X509_VP_FLAG_ONCE;
 
 	if (store)
 		{

+ 1 - 0
openssl/crypto/x509/x_all.c

@@ -90,6 +90,7 @@ int NETSCAPE_SPKI_verify(NETSCAPE_SPKI *a, EVP_PKEY *r)
 
 int X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md)
 	{
+	x->cert_info->enc.modified = 1;
 	return(ASN1_item_sign(ASN1_ITEM_rptr(X509_CINF), x->cert_info->signature,
 		x->sig_alg, x->signature, x->cert_info,pkey,md));
 	}

+ 1 - 2
openssl/crypto/x509v3/pcy_tree.c

@@ -341,9 +341,8 @@ static int tree_link_nodes(X509_POLICY_LEVEL *curr,
 				const X509_POLICY_CACHE *cache)
 	{
 	int i;
-	X509_POLICY_LEVEL *last;
 	X509_POLICY_DATA *data;
-	last = curr - 1;
+
 	for (i = 0; i < sk_X509_POLICY_DATA_num(cache->data); i++)
 		{
 		data = sk_X509_POLICY_DATA_value(cache->data, i);

+ 0 - 1
openssl/crypto/x509v3/v3_ncons.c

@@ -189,7 +189,6 @@ static int do_i2r_name_constraints(const X509V3_EXT_METHOD *method,
 			print_nc_ipadd(bp, tree->base->d.ip);
 		else
 			GENERAL_NAME_print(bp, tree->base);
-		tree = sk_GENERAL_SUBTREE_value(trees, i);
 		BIO_puts(bp, "\n");
 		}
 	return 1;

+ 0 - 5
openssl/ssl/d1_pkt.c

@@ -296,9 +296,6 @@ dtls1_process_buffered_records(SSL *s)
     item = pqueue_peek(s->d1->unprocessed_rcds.q);
     if (item)
         {
-        DTLS1_RECORD_DATA *rdata;
-        rdata = (DTLS1_RECORD_DATA *)item->data;
-        
         /* Check if epoch is current. */
         if (s->d1->unprocessed_rcds.epoch != s->d1->r_epoch)
             return(1);  /* Nothing to do. */
@@ -528,14 +525,12 @@ int dtls1_get_record(SSL *s)
 	int ssl_major,ssl_minor;
 	int i,n;
 	SSL3_RECORD *rr;
-	SSL_SESSION *sess;
 	unsigned char *p = NULL;
 	unsigned short version;
 	DTLS1_BITMAP *bitmap;
 	unsigned int is_next_epoch;
 
 	rr= &(s->s3->rrec);
-	sess=s->session;
 
 	/* The epoch may have changed.  If so, process all the
 	 * pending records.  This is a non-blocking operation. */

+ 0 - 7
openssl/ssl/s23_lib.c

@@ -92,15 +92,8 @@ const SSL_CIPHER *ssl23_get_cipher(unsigned int u)
  * available */
 const SSL_CIPHER *ssl23_get_cipher_by_char(const unsigned char *p)
 	{
-	SSL_CIPHER c;
 	const SSL_CIPHER *cp;
-	unsigned long id;
-	int n;
 
-	n=ssl3_num_ciphers();
-	id=0x03000000|((unsigned long)p[0]<<16L)|
-		((unsigned long)p[1]<<8L)|(unsigned long)p[2];
-	c.id=id;
 	cp=ssl3_get_cipher_by_char(p);
 #ifndef OPENSSL_NO_SSL2
 	if (cp == NULL)

+ 0 - 2
openssl/ssl/s2_srvr.c

@@ -697,7 +697,6 @@ static int server_hello(SSL *s)
 	{
 	unsigned char *p,*d;
 	int n,hit;
-	STACK_OF(SSL_CIPHER) *sk;
 
 	p=(unsigned char *)s->init_buf->data;
 	if (s->state == SSL2_ST_SEND_SERVER_HELLO_A)
@@ -778,7 +777,6 @@ static int server_hello(SSL *s)
 			
 			/* lets send out the ciphers we like in the
 			 * prefered order */
-			sk= s->session->ciphers;
 			n=ssl_cipher_list_to_bytes(s,s->session->ciphers,d,0);
 			d+=n;
 			s2n(n,p);		/* add cipher length */

+ 4 - 0
openssl/ssl/s3_clnt.c

@@ -866,8 +866,11 @@ int ssl3_get_server_hello(SSL *s)
 		s->session->cipher_id = s->session->cipher->id;
 	if (s->hit && (s->session->cipher_id != c->id))
 		{
+/* Workaround is now obsolete */
+#if 0
 		if (!(s->options &
 			SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG))
+#endif
 			{
 			al=SSL_AD_ILLEGAL_PARAMETER;
 			SSLerr(SSL_F_SSL3_GET_SERVER_HELLO,SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED);
@@ -1508,6 +1511,7 @@ int ssl3_get_key_exchange(SSL *s)
 		s->session->sess_cert->peer_ecdh_tmp=ecdh;
 		ecdh=NULL;
 		BN_CTX_free(bn_ctx);
+		bn_ctx = NULL;
 		EC_POINT_free(srvr_ecpoint);
 		srvr_ecpoint = NULL;
 		}

+ 1 - 2
openssl/ssl/s3_enc.c

@@ -214,7 +214,7 @@ static int ssl3_generate_key_block(SSL *s, unsigned char *km, int num)
 
 int ssl3_change_cipher_state(SSL *s, int which)
 	{
-	unsigned char *p,*key_block,*mac_secret;
+	unsigned char *p,*mac_secret;
 	unsigned char exp_key[EVP_MAX_KEY_LENGTH];
 	unsigned char exp_iv[EVP_MAX_IV_LENGTH];
 	unsigned char *ms,*key,*iv,*er1,*er2;
@@ -239,7 +239,6 @@ int ssl3_change_cipher_state(SSL *s, int which)
 	else
 		comp=s->s3->tmp.new_compression->method;
 #endif
-	key_block=s->s3->tmp.key_block;
 
 	if (which & SSL3_CC_READ)
 		{

+ 15 - 3
openssl/ssl/s3_srvr.c

@@ -985,6 +985,10 @@ int ssl3_get_client_hello(SSL *s)
 				break;
 				}
 			}
+/* Disabled because it can be used in a ciphersuite downgrade
+ * attack: CVE-2010-4180.
+ */
+#if 0
 		if (j == 0 && (s->options & SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG) && (sk_SSL_CIPHER_num(ciphers) == 1))
 			{
 			/* Special case as client bug workaround: the previously used cipher may
@@ -999,6 +1003,7 @@ int ssl3_get_client_hello(SSL *s)
 				j = 1;
 				}
 			}
+#endif
 		if (j == 0)
 			{
 			/* we need to have the cipher in the cipher
@@ -2579,12 +2584,19 @@ int ssl3_get_client_key_exchange(SSL *s)
 			{
 			int ret = 0;
 			EVP_PKEY_CTX *pkey_ctx;
-			EVP_PKEY *client_pub_pkey = NULL;
+			EVP_PKEY *client_pub_pkey = NULL, *pk = NULL;
 			unsigned char premaster_secret[32], *start;
-			size_t outlen=32, inlen;			
+			size_t outlen=32, inlen;
+			unsigned long alg_a;
 
 			/* Get our certificate private key*/
-			pkey_ctx = EVP_PKEY_CTX_new(s->cert->key->privatekey,NULL);	
+			alg_a = s->s3->tmp.new_cipher->algorithm_auth;
+			if (alg_a & SSL_aGOST94)
+				pk = s->cert->pkeys[SSL_PKEY_GOST94].privatekey;
+			else if (alg_a & SSL_aGOST01)
+				pk = s->cert->pkeys[SSL_PKEY_GOST01].privatekey;
+
+			pkey_ctx = EVP_PKEY_CTX_new(pk,NULL);
 			EVP_PKEY_decrypt_init(pkey_ctx);
 			/* If client certificate is present and is of the same type, maybe
 			 * use it for key exchange.  Don't mind errors from

+ 1 - 2
openssl/ssl/ssl_asn1.c

@@ -357,7 +357,7 @@ int i2d_SSL_SESSION(SSL_SESSION *in, unsigned char **pp)
 SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp,
 			     long length)
 	{
-	int version,ssl_version=0,i;
+	int ssl_version=0,i;
 	long id;
 	ASN1_INTEGER ai,*aip;
 	ASN1_OCTET_STRING os,*osp;
@@ -371,7 +371,6 @@ SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp,
 
 	ai.data=NULL; ai.length=0;
 	M_ASN1_D2I_get_x(ASN1_INTEGER,aip,d2i_ASN1_INTEGER);
-	version=(int)ASN1_INTEGER_get(aip);
 	if (ai.data != NULL) { OPENSSL_free(ai.data); ai.data=NULL; ai.length=0; }
 
 	/* we don't care about the version right now :-) */

+ 2 - 4
openssl/ssl/ssl_ciph.c

@@ -1027,7 +1027,7 @@ static int ssl_cipher_process_rulestr(const char *rule_str,
                 const SSL_CIPHER **ca_list)
 	{
 	unsigned long alg_mkey, alg_auth, alg_enc, alg_mac, alg_ssl, algo_strength;
-	const char *l, *start, *buf;
+	const char *l, *buf;
 	int j, multi, found, rule, retval, ok, buflen;
 	unsigned long cipher_id = 0;
 	char ch;
@@ -1064,7 +1064,6 @@ static int ssl_cipher_process_rulestr(const char *rule_str,
 		alg_ssl = 0;
 		algo_strength = 0;
 
-		start=l;
 		for (;;)
 			{
 			ch = *l;
@@ -1456,7 +1455,7 @@ char *SSL_CIPHER_description(const SSL_CIPHER *cipher, char *buf, int len)
 	int is_export,pkl,kl;
 	const char *ver,*exp_str;
 	const char *kx,*au,*enc,*mac;
-	unsigned long alg_mkey,alg_auth,alg_enc,alg_mac,alg_ssl,alg2,alg_s;
+	unsigned long alg_mkey,alg_auth,alg_enc,alg_mac,alg_ssl,alg2;
 #ifdef KSSL_DEBUG
 	static const char *format="%-23s %s Kx=%-8s Au=%-4s Enc=%-9s Mac=%-4s%s AL=%lx/%lx/%lx/%lx/%lx\n";
 #else
@@ -1469,7 +1468,6 @@ char *SSL_CIPHER_description(const SSL_CIPHER *cipher, char *buf, int len)
 	alg_mac = cipher->algorithm_mac;
 	alg_ssl = cipher->algorithm_ssl;
 
-	alg_s=cipher->algo_strength;
 	alg2=cipher->algorithm2;
 
 	is_export=SSL_C_IS_EXPORT(cipher);

+ 2 - 13
openssl/ssl/ssl_lib.c

@@ -2110,23 +2110,12 @@ int ssl_check_srvr_ecc_cert_and_alg(X509 *x, const SSL_CIPHER *cs)
 /* THIS NEEDS CLEANING UP */
 X509 *ssl_get_server_send_cert(SSL *s)
 	{
-	unsigned long alg_k,alg_a,mask_k,mask_a;
+	unsigned long alg_k,alg_a;
 	CERT *c;
-	int i,is_export;
+	int i;
 
 	c=s->cert;
 	ssl_set_cert_masks(c, s->s3->tmp.new_cipher);
-	is_export=SSL_C_IS_EXPORT(s->s3->tmp.new_cipher);
-	if (is_export)
-		{
-		mask_k = c->export_mask_k;
-		mask_a = c->export_mask_a;
-		}
-	else
-		{
-		mask_k = c->mask_k;
-		mask_a = c->mask_a;
-		}
 	
 	alg_k = s->s3->tmp.new_cipher->algorithm_mkey;
 	alg_a = s->s3->tmp.new_cipher->algorithm_auth;

+ 4 - 10
openssl/ssl/t1_enc.c

@@ -157,7 +157,7 @@ static int tls1_P_hash(const EVP_MD *md, const unsigned char *sec,
 			const void *seed5, int seed5_len,
 			unsigned char *out, int olen)
 	{
-	int chunk,n;
+	int chunk;
 	unsigned int j;
 	HMAC_CTX ctx;
 	HMAC_CTX ctx_tmp;
@@ -187,7 +187,6 @@ static int tls1_P_hash(const EVP_MD *md, const unsigned char *sec,
 	if (!HMAC_Final(&ctx,A1,&A1_len))
 		goto err;
 
-	n=0;
 	for (;;)
 		{
 		if (!HMAC_Init_ex(&ctx,NULL,0,NULL,NULL)) /* re-init */
@@ -309,13 +308,13 @@ static int tls1_generate_key_block(SSL *s, unsigned char *km,
 int tls1_change_cipher_state(SSL *s, int which)
 	{
 	static const unsigned char empty[]="";
-	unsigned char *p,*key_block,*mac_secret;
+	unsigned char *p,*mac_secret;
 	unsigned char *exp_label;
 	unsigned char tmp1[EVP_MAX_KEY_LENGTH];
 	unsigned char tmp2[EVP_MAX_KEY_LENGTH];
 	unsigned char iv1[EVP_MAX_IV_LENGTH*2];
 	unsigned char iv2[EVP_MAX_IV_LENGTH*2];
-	unsigned char *ms,*key,*iv,*er1,*er2;
+	unsigned char *ms,*key,*iv;
 	int client_write;
 	EVP_CIPHER_CTX *dd;
 	const EVP_CIPHER *c;
@@ -337,7 +336,6 @@ int tls1_change_cipher_state(SSL *s, int which)
 #ifndef OPENSSL_NO_COMP
 	comp=s->s3->tmp.new_compression;
 #endif
-	key_block=s->s3->tmp.key_block;
 
 #ifdef KSSL_DEBUG
 	printf("tls1_change_cipher_state(which= %d) w/\n", which);
@@ -448,8 +446,6 @@ int tls1_change_cipher_state(SSL *s, int which)
 	               cl : SSL_C_EXPORT_KEYLENGTH(s->s3->tmp.new_cipher)) : cl;
 	/* Was j=(exp)?5:EVP_CIPHER_key_length(c); */
 	k=EVP_CIPHER_iv_length(c);
-	er1= &(s->s3->client_random[0]);
-	er2= &(s->s3->server_random[0]);
 	if (	(which == SSL3_CHANGE_CIPHER_CLIENT_WRITE) ||
 		(which == SSL3_CHANGE_CIPHER_SERVER_READ))
 		{
@@ -880,7 +876,7 @@ int tls1_final_finish_mac(SSL *s,
 int tls1_mac(SSL *ssl, unsigned char *md, int send)
 	{
 	SSL3_RECORD *rec;
-	unsigned char *mac_sec,*seq;
+	unsigned char *seq;
 	EVP_MD_CTX *hash;
 	size_t md_size;
 	int i;
@@ -892,14 +888,12 @@ int tls1_mac(SSL *ssl, unsigned char *md, int send)
 	if (send)
 		{
 		rec= &(ssl->s3->wrec);
-		mac_sec= &(ssl->s3->write_mac_secret[0]);
 		seq= &(ssl->s3->write_sequence[0]);
 		hash=ssl->write_hash;
 		}
 	else
 		{
 		rec= &(ssl->s3->rrec);
-		mac_sec= &(ssl->s3->read_mac_secret[0]);
 		seq= &(ssl->s3->read_sequence[0]);
 		hash=ssl->read_hash;
 		}

+ 53 - 27
openssl/ssl/t1_lib.c

@@ -714,14 +714,23 @@ int ssl_parse_clienthello_tlsext(SSL *s, unsigned char **p, unsigned char *d, in
 				switch (servname_type)
 					{
 				case TLSEXT_NAMETYPE_host_name:
-					if (s->session->tlsext_hostname == NULL)
+					if (!s->hit)
 						{
-						if (len > TLSEXT_MAXLEN_host_name || 
-							((s->session->tlsext_hostname = OPENSSL_malloc(len+1)) == NULL))
+						if(s->session->tlsext_hostname)
+							{
+							*al = SSL_AD_DECODE_ERROR;
+							return 0;
+							}
+						if (len > TLSEXT_MAXLEN_host_name)
 							{
 							*al = TLS1_AD_UNRECOGNIZED_NAME;
 							return 0;
 							}
+						if ((s->session->tlsext_hostname = OPENSSL_malloc(len+1)) == NULL)
+							{
+							*al = TLS1_AD_INTERNAL_ERROR;
+							return 0;
+							}
 						memcpy(s->session->tlsext_hostname, sdata, len);
 						s->session->tlsext_hostname[len]='\0';
 						if (strlen(s->session->tlsext_hostname) != len) {
@@ -734,7 +743,8 @@ int ssl_parse_clienthello_tlsext(SSL *s, unsigned char **p, unsigned char *d, in
 
 						}
 					else 
-						s->servername_done = strlen(s->session->tlsext_hostname) == len 
+						s->servername_done = s->session->tlsext_hostname
+							&& strlen(s->session->tlsext_hostname) == len 
 							&& strncmp(s->session->tlsext_hostname, (char *)sdata, len) == 0;
 					
 					break;
@@ -765,15 +775,22 @@ int ssl_parse_clienthello_tlsext(SSL *s, unsigned char **p, unsigned char *d, in
 				*al = TLS1_AD_DECODE_ERROR;
 				return 0;
 				}
-			s->session->tlsext_ecpointformatlist_length = 0;
-			if (s->session->tlsext_ecpointformatlist != NULL) OPENSSL_free(s->session->tlsext_ecpointformatlist);
-			if ((s->session->tlsext_ecpointformatlist = OPENSSL_malloc(ecpointformatlist_length)) == NULL)
+			if (!s->hit)
 				{
-				*al = TLS1_AD_INTERNAL_ERROR;
-				return 0;
+				if(s->session->tlsext_ecpointformatlist)
+					{
+					OPENSSL_free(s->session->tlsext_ecpointformatlist);
+					s->session->tlsext_ecpointformatlist = NULL;
+					}
+				s->session->tlsext_ecpointformatlist_length = 0;
+				if ((s->session->tlsext_ecpointformatlist = OPENSSL_malloc(ecpointformatlist_length)) == NULL)
+					{
+					*al = TLS1_AD_INTERNAL_ERROR;
+					return 0;
+					}
+				s->session->tlsext_ecpointformatlist_length = ecpointformatlist_length;
+				memcpy(s->session->tlsext_ecpointformatlist, sdata, ecpointformatlist_length);
 				}
-			s->session->tlsext_ecpointformatlist_length = ecpointformatlist_length;
-			memcpy(s->session->tlsext_ecpointformatlist, sdata, ecpointformatlist_length);
 #if 0
 			fprintf(stderr,"ssl_parse_clienthello_tlsext s->session->tlsext_ecpointformatlist (length=%i) ", s->session->tlsext_ecpointformatlist_length);
 			sdata = s->session->tlsext_ecpointformatlist;
@@ -794,15 +811,22 @@ int ssl_parse_clienthello_tlsext(SSL *s, unsigned char **p, unsigned char *d, in
 				*al = TLS1_AD_DECODE_ERROR;
 				return 0;
 				}
-			s->session->tlsext_ellipticcurvelist_length = 0;
-			if (s->session->tlsext_ellipticcurvelist != NULL) OPENSSL_free(s->session->tlsext_ellipticcurvelist);
-			if ((s->session->tlsext_ellipticcurvelist = OPENSSL_malloc(ellipticcurvelist_length)) == NULL)
+			if (!s->hit)
 				{
-				*al = TLS1_AD_INTERNAL_ERROR;
-				return 0;
+				if(s->session->tlsext_ellipticcurvelist)
+					{
+					*al = TLS1_AD_DECODE_ERROR;
+					return 0;
+					}
+				s->session->tlsext_ellipticcurvelist_length = 0;
+				if ((s->session->tlsext_ellipticcurvelist = OPENSSL_malloc(ellipticcurvelist_length)) == NULL)
+					{
+					*al = TLS1_AD_INTERNAL_ERROR;
+					return 0;
+					}
+				s->session->tlsext_ellipticcurvelist_length = ellipticcurvelist_length;
+				memcpy(s->session->tlsext_ellipticcurvelist, sdata, ellipticcurvelist_length);
 				}
-			s->session->tlsext_ellipticcurvelist_length = ellipticcurvelist_length;
-			memcpy(s->session->tlsext_ellipticcurvelist, sdata, ellipticcurvelist_length);
 #if 0
 			fprintf(stderr,"ssl_parse_clienthello_tlsext s->session->tlsext_ellipticcurvelist (length=%i) ", s->session->tlsext_ellipticcurvelist_length);
 			sdata = s->session->tlsext_ellipticcurvelist;
@@ -983,9 +1007,9 @@ int ssl_parse_clienthello_tlsext(SSL *s, unsigned char **p, unsigned char *d, in
 
 int ssl_parse_serverhello_tlsext(SSL *s, unsigned char **p, unsigned char *d, int n, int *al)
 	{
+	unsigned short length;
 	unsigned short type;
 	unsigned short size;
-	unsigned short len;  
 	unsigned char *data = *p;
 	int tlsext_servername = 0;
 	int renegotiate_seen = 0;
@@ -993,7 +1017,12 @@ int ssl_parse_serverhello_tlsext(SSL *s, unsigned char **p, unsigned char *d, in
 	if (data >= (d+n-2))
 		goto ri_check;
 
-	n2s(data,len);
+	n2s(data,length);
+	if (data+length != d+n)
+		{
+		*al = SSL_AD_DECODE_ERROR;
+		return 0;
+		}
 
 	while(data <= (d+n-4))
 		{
@@ -1423,23 +1452,20 @@ int ssl_check_serverhello_tlsext(SSL *s)
 	int al = SSL_AD_UNRECOGNIZED_NAME;
 
 #ifndef OPENSSL_NO_EC
-	/* If we are client and using an elliptic curve cryptography cipher suite, then server
-	 * must return a an EC point formats lists containing uncompressed.
+	/* If we are client and using an elliptic curve cryptography cipher
+	 * suite, then if server returns an EC point formats lists extension
+	 * it must contain uncompressed.
 	 */
 	unsigned long alg_k = s->s3->tmp.new_cipher->algorithm_mkey;
 	unsigned long alg_a = s->s3->tmp.new_cipher->algorithm_auth;
 	if ((s->tlsext_ecpointformatlist != NULL) && (s->tlsext_ecpointformatlist_length > 0) && 
+	    (s->session->tlsext_ecpointformatlist != NULL) && (s->session->tlsext_ecpointformatlist_length > 0) && 
 	    ((alg_k & (SSL_kEECDH|SSL_kECDHr|SSL_kECDHe)) || (alg_a & SSL_aECDSA)))
 		{
 		/* we are using an ECC cipher */
 		size_t i;
 		unsigned char *list;
 		int found_uncompressed = 0;
-		if ((s->session->tlsext_ecpointformatlist == NULL) || (s->session->tlsext_ecpointformatlist_length == 0))
-			{
-			SSLerr(SSL_F_SSL_CHECK_SERVERHELLO_TLSEXT,SSL_R_TLS_INVALID_ECPOINTFORMAT_LIST);
-			return -1;
-			}
 		list = s->session->tlsext_ecpointformatlist;
 		for (i = 0; i < s->session->tlsext_ecpointformatlist_length; i++)
 			{

+ 6 - 0
packages/filemng/CustomDirView.pas

@@ -1657,6 +1657,12 @@ var
 begin
   if Path <> '' then
   begin
+    // if editing, it has to be focused item
+    if IsEditing and Assigned(ItemFocused) then
+    begin
+      ItemFocused.CancelEdit;
+      FLoadEnabled := True;
+    end;
     OldSelection := nil;
     IconCache := nil;
     Items.BeginUpdate;

+ 0 - 1
packages/filemng/DirImg.rc

@@ -1,5 +1,4 @@
 /*********************************************
-File: D:\DOKUMENTY\MARTIN\KNIHOVNY\KOMPONENTY\MOJE KOMPONENTY\FILEMANAGER TOOLSET\ICONS.RC
 Generated by Resource Builder 1.0.
 *********************************************/
 // Below are important 3 lines, don't change them!

+ 2 - 0
packages/my/NortonLikeListView.hpp

@@ -58,6 +58,7 @@ private:
 	bool FManageSelection;
 	int FFirstSelected;
 	int FLastSelected;
+	bool FFocusedWhenClicked;
 	HIDESBASE MESSAGE void __fastcall WMLButtonDown(Messages::TWMMouse &Message);
 	HIDESBASE MESSAGE void __fastcall WMRButtonDown(Messages::TWMMouse &Message);
 	HIDESBASE MESSAGE void __fastcall WMKeyDown(Messages::TWMKey &Message);
@@ -91,6 +92,7 @@ protected:
 	virtual bool __fastcall GetValid(void);
 	virtual int __fastcall GetSelCount(void);
 	void __fastcall DDBeforeDrag(void);
+	DYNAMIC bool __fastcall CanEdit(Comctrls::TListItem* Item);
 	
 public:
 	__fastcall virtual TCustomNortonLikeListView(Classes::TComponent* AOwner);

+ 8 - 0
packages/my/NortonLikeListView.pas

@@ -26,6 +26,7 @@ type
     FManageSelection: Boolean;
     FFirstSelected: Integer;
     FLastSelected: Integer;
+    FFocusedWhenClicked: Boolean;
     procedure WMLButtonDown(var Message: TWMLButtonDown); message WM_LBUTTONDOWN;
     procedure WMRButtonDown(var Message: TWMRButtonDown); message WM_RBUTTONDOWN;
     procedure WMKeyDown(var Message: TWMKeyDown); message WM_KEYDOWN;
@@ -60,6 +61,7 @@ type
     function GetValid: Boolean; virtual;
     function GetSelCount: Integer; override;
     procedure DDBeforeDrag;
+    function CanEdit(Item: TListItem): Boolean; override;
   public
     { Public declarations }
     constructor Create(AOwner: TComponent); override;
@@ -621,6 +623,7 @@ begin
   PDontUnSelectItem := FDontUnSelectItem;
   FDontSelectItem := FDontSelectItem or ((NortonLike = nlOn) and ((Shift * [ssCtrl, ssShift]) = []));
   FDontUnSelectItem := FDontUnSelectItem or ((NortonLike = nlOn) and ((Shift * [ssCtrl]) = []));
+  FFocusedWhenClicked := Focused;
   try
     inherited;
   finally
@@ -803,4 +806,9 @@ begin
   ColProperties.ListViewWndCreated;
 end;
 
+function TCustomNortonLikeListView.CanEdit(Item: TListItem): Boolean;
+begin
+  Result := inherited CanEdit(Item) and FFocusedWhenClicked;
+end;
+
 end.

+ 1 - 1
release/winscp.u3i

@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <u3manifest version="1.0">
-  <application uuid="48b341d1-d411-4b5a-a82c-f3b5d65602fc" version="4.3">
+  <application uuid="48b341d1-d411-4b5a-a82c-f3b5d65602fc" version="4.3.1">
     <icon>winscp.ico</icon>
     <name>WinSCP</name>
     <description>Freeware SFTP (SSH File Transfer Protocol), FTP (File Transfer Protocol) and SCP (Secure CoPy) client for Windows using SSH (Secure SHell). Its main function is safe copying of files between a local and a remote computer.</description>

+ 1 - 1
resource/TextsCore1.rc

@@ -345,6 +345,6 @@ BEGIN
   FILEZILLA_URL, "http://filezilla.sourceforge.net/"
   OPENSSL_BASED_ON, "This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit %s."
   OPENSSL_COPYRIGHT, "Copyright © 1998-2010 The OpenSSL Project"
-  OPENSSL_VERSION, "1.0.0a"
+  OPENSSL_VERSION, "1.0.0c"
   OPENSSL_URL, "http://www.openssl.org/"
 END

+ 1 - 0
windows/ConsoleRunner.cpp

@@ -1662,6 +1662,7 @@ int __fastcall TConsoleRunner::Run(const AnsiString Session, TOptions * Options,
   }
   catch(Exception & E)
   {
+    FScript->Log(llMessage, "Failed");
     ShowException(&E);
     AnyError = true;
   }

+ 3 - 0
windows/GUITools.cpp

@@ -58,6 +58,8 @@ void __fastcall OpenSessionInPutty(const AnsiString PuttyPath,
     {
       Storage = new TRegistryStorage(Configuration->PuttySessionsKey);
       Storage->AccessMode = smReadWrite;
+      // make it compatible with putty
+      Storage->MungeStringValues = false;
       if (Storage->OpenRootKey(true))
       {
         if (Storage->KeyExists(SessionData->StorageKey))
@@ -67,6 +69,7 @@ void __fastcall OpenSessionInPutty(const AnsiString PuttyPath,
         else
         {
           SourceStorage = new TRegistryStorage(Configuration->PuttySessionsKey);
+          SourceStorage->MungeStringValues = false;
           if (SourceStorage->OpenSubKey(StoredSessions->DefaultSettings->Name, false) &&
               Storage->OpenSubKey(GUIConfiguration->PuttySession, true))
           {