]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Mon, 11 Jun 2012 11:08:33 +0000 (11:08 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Mon, 11 Jun 2012 11:08:33 +0000 (11:08 +0000)
MagickCore/cipher.c

index ca8086b860b8577e87baeef13edadd299e6ddf47..314e83ae13206a80436a7cea1f3f692b9c5a6ebb 100644 (file)
@@ -613,9 +613,7 @@ MagickExport MagickBooleanType PasskeyDecipherImage(Image *image,
       ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
         image->filename);
     }
-  SetAESKey(aes_info,key);
-  key=DestroyStringInfo(key);
-  nonce=AcquireStringInfo(0);
+  nonce=SplitStringInfo(key,GetStringInfoLength(key)/2);
   if (nonce == (StringInfo *) NULL)
     {
       key=DestroyStringInfo(key);
@@ -624,7 +622,10 @@ MagickExport MagickBooleanType PasskeyDecipherImage(Image *image,
       ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
         image->filename);
     }
+  SetAESKey(aes_info,key);
+  key=DestroyStringInfo(key);
   signature_info=AcquireSignatureInfo();
+  UpdateSignature(signature_info,nonce);
   SetStringInfoLength(nonce,sizeof(quantum_info->extent));
   SetStringInfoDatum(nonce,(const unsigned char *) &quantum_info->extent);
   UpdateSignature(signature_info,nonce);
@@ -813,9 +814,7 @@ MagickExport MagickBooleanType PasskeyEncipherImage(Image *image,
       ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
         image->filename);
     }
-  SetAESKey(aes_info,key);
-  key=DestroyStringInfo(key);
-  nonce=AcquireStringInfo(0);
+  nonce=SplitStringInfo(key,GetStringInfoLength(key)/2);
   if (nonce == (StringInfo *) NULL)
     {
       key=DestroyStringInfo(key);
@@ -824,7 +823,10 @@ MagickExport MagickBooleanType PasskeyEncipherImage(Image *image,
       ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
         image->filename);
     }
+  SetAESKey(aes_info,key);
+  key=DestroyStringInfo(key);
   signature_info=AcquireSignatureInfo();
+  UpdateSignature(signature_info,nonce);
   SetStringInfoLength(nonce,sizeof(quantum_info->extent));
   SetStringInfoDatum(nonce,(const unsigned char *) &quantum_info->extent);
   UpdateSignature(signature_info,nonce);