dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnet/engine lib_crypt.c,1.12,1.13


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnet/engine lib_crypt.c,1.12,1.13
Date: Wed, 27 Nov 2002 02:21:15 -0500

Update of /cvsroot/dotgnu-pnet/pnet/engine
In directory subversions:/tmp/cvs-serv11377/engine

Modified Files:
        lib_crypt.c 
Log Message:


Make the cryptographic routines a little more robust in the face of
NULL algorithm handles.


Index: lib_crypt.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/lib_crypt.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** lib_crypt.c 27 Nov 2002 00:59:17 -0000      1.12
--- lib_crypt.c 27 Nov 2002 07:21:12 -0000      1.13
***************
*** 300,304 ****
  void _IL_CryptoMethods_HashReset(ILExecThread *_thread, ILNativeInt state)
  {
!       (*(((HashContext *)state)->reset))(&(((MD5HashContext *)state)->md5));
  }
  
--- 300,307 ----
  void _IL_CryptoMethods_HashReset(ILExecThread *_thread, ILNativeInt state)
  {
!       if(state)
!       {
!               (*(((HashContext *)state)->reset))(&(((MD5HashContext 
*)state)->md5));
!       }
  }
  
***************
*** 311,318 ****
                                                                  ILInt32 count)
  {
!       (*(((HashContext *)state)->update))
                        (&(((MD5HashContext *)state)->md5),
                         ((unsigned char *)(ArrayToBuffer(buffer))) + offset,
                         (unsigned long)count);
  }
  
--- 314,324 ----
                                                                  ILInt32 count)
  {
!       if(state)
!       {
!               (*(((HashContext *)state)->update))
                        (&(((MD5HashContext *)state)->md5),
                         ((unsigned char *)(ArrayToBuffer(buffer))) + offset,
                         (unsigned long)count);
+       }
  }
  
***************
*** 323,328 ****
                                                                 System_Array 
*hash)
  {
!       (*(((HashContext *)state)->final))(&(((MD5HashContext *)state)->md5),
!                                                                          
(unsigned char *)(ArrayToBuffer(hash)));
  }
  
--- 329,338 ----
                                                                 System_Array 
*hash)
  {
!       if(state)
!       {
!               (*(((HashContext *)state)->final))
!                               (&(((MD5HashContext *)state)->md5),
!                                (unsigned char *)(ArrayToBuffer(hash)));
!       }
  }
  
***************
*** 332,337 ****
  void _IL_CryptoMethods_HashFree(ILExecThread *_thread, ILNativeInt state)
  {
!       (*(((HashContext *)state)->reset))(&(((MD5HashContext *)state)->md5));
!       ILFree((void *)state);
  }
  
--- 342,350 ----
  void _IL_CryptoMethods_HashFree(ILExecThread *_thread, ILNativeInt state)
  {
!       if(state)
!       {
!               (*(((HashContext *)state)->reset))(&(((MD5HashContext 
*)state)->md5));
!               ILFree((void *)state);
!       }
  }
  
***************
*** 651,658 ****
                                                           ILInt32 outOffset)
  {
!       (*(((SymContext *)state)->encrypt))
                        (&(((RC2Context *)state)->rc2),
                         ((unsigned char *)(ArrayToBuffer(inBuffer))) + 
inOffset,
                         ((unsigned char *)(ArrayToBuffer(outBuffer))) + 
outOffset);
  }
  
--- 664,674 ----
                                                           ILInt32 outOffset)
  {
!       if(state)
!       {
!               (*(((SymContext *)state)->encrypt))
                        (&(((RC2Context *)state)->rc2),
                         ((unsigned char *)(ArrayToBuffer(inBuffer))) + 
inOffset,
                         ((unsigned char *)(ArrayToBuffer(outBuffer))) + 
outOffset);
+       }
  }
  
***************
*** 666,673 ****
                                                           ILInt32 outOffset)
  {
!       (*(((SymContext *)state)->decrypt))
                        (&(((RC2Context *)state)->rc2),
                         ((unsigned char *)(ArrayToBuffer(inBuffer))) + 
inOffset,
                         ((unsigned char *)(ArrayToBuffer(outBuffer))) + 
outOffset);
  }
  
--- 682,692 ----
                                                           ILInt32 outOffset)
  {
!       if(state)
!       {
!               (*(((SymContext *)state)->decrypt))
                        (&(((RC2Context *)state)->rc2),
                         ((unsigned char *)(ArrayToBuffer(inBuffer))) + 
inOffset,
                         ((unsigned char *)(ArrayToBuffer(outBuffer))) + 
outOffset);
+       }
  }
  
***************
*** 677,682 ****
  void _IL_CryptoMethods_SymmetricFree(ILExecThread *_thread, ILNativeInt state)
  {
!       (*(((SymContext *)state)->reset))(&(((RC2Context *)state)->rc2));
!       ILFree((void *)state);
  }
  
--- 696,704 ----
  void _IL_CryptoMethods_SymmetricFree(ILExecThread *_thread, ILNativeInt state)
  {
!       if(state)
!       {
!               (*(((SymContext *)state)->reset))(&(((RC2Context 
*)state)->rc2));
!               ILFree((void *)state);
!       }
  }
  





reply via email to

[Prev in Thread] Current Thread [Next in Thread]