From 81f21cd9450810a35e1f940ba6e7f5ef9584b2fe Mon Sep 17 00:00:00 2001 From: alivraghi Date: Sun, 9 Oct 2016 23:41:57 +0200 Subject: [PATCH] 1.11 Sun Oct 24 18:45:21 2010 - Added compatibility for deprecated functions removed from cryptlib starting from version 3.4.0 --- Changes | 6 ++++++ PerlCryptLib.pm | 11 +++++++---- PerlCryptLib.xs | 44 +++++++++++++++++++++++++------------------- README | 2 +- 4 files changed, 39 insertions(+), 24 deletions(-) diff --git a/Changes b/Changes index fa32593..5479b54 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,12 @@ Revision history for Perl extension PerlCryptLib ================================================ +1.11 Sun Oct 24 18:45:21 2010 + - Added compatibility for deprecated functions removed from cryptlib starting from version 3.4.0 + +1.10 Sun Apr 18 00:25:33 2010 + - Done some optimizations in XS code for gcc4 ISO C90 compatibility + 1.09 Sun Jul 26 04:47:10 2009 - Cryptlib header's translation has been reviewd diff --git a/PerlCryptLib.pm b/PerlCryptLib.pm index 535e1d5..e262c54 100644 --- a/PerlCryptLib.pm +++ b/PerlCryptLib.pm @@ -8,7 +8,7 @@ use Carp; require Exporter; use AutoLoader; -our $VERSION = '1.09'; +our $VERSION = '1.11'; ############################################################################# @@ -114,7 +114,7 @@ our $VERSION = '1.09'; cryptInit cryptEnd cryptQueryCapability cryptCreateContext cryptDestroyContext cryptDestroyObject - cryptGenerateKey cryptGenerateKeyAsync cryptAsyncQuery cryptAsyncCancel + cryptGenerateKey cryptEncrypt cryptDecrypt cryptSetAttribute cryptSetAttributeString cryptGetAttribute cryptGetAttributeString cryptDeleteAttribute cryptAddRandom @@ -130,7 +130,8 @@ our $VERSION = '1.09'; cryptDeviceOpen cryptDeviceClose cryptDeviceQueryCapability cryptDeviceCreateContext cryptLogin cryptLogout ); - + # Add deprecated functions when CRYPTLIB_VERSION prior 3.4.0 + push @FUNCTIONS, qw(cryptGenerateKeyAsync cryptAsyncQuery cryptAsyncCancel) if &CRYPTLIB_VERSION < 3400; # Esportazione costanti e funzioni our @ISA = qw(Exporter); @@ -168,6 +169,8 @@ sub AUTOLOAD { require XSLoader; XSLoader::load('PerlCryptLib', $VERSION); +## Add deprecated functions if CRYPTLIB_VERSION is less than 3.4.0 +#XSLoader::load('PerlCryptLib-deprecated-340', $VERSION) if &CRYPTLIB_VERSION < 3400; if ( __FILE__ eq "$0" ) { # TEST PACKAGE SPACE @@ -463,7 +466,7 @@ Alvaro Livraghi, =head1 COPYRIGHT AND LICENSE -Copyright (C) 2006-2009 Alvaro Livraghi. All Rights Reserved. +Copyright (C) 2006-2010 Alvaro Livraghi. All Rights Reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/PerlCryptLib.xs b/PerlCryptLib.xs index a426427..b6229b3 100644 --- a/PerlCryptLib.xs +++ b/PerlCryptLib.xs @@ -2,7 +2,7 @@ Perl extesione interface (XS) to 'cryptlib' library (PerlCryptLib) - Copyright (C) 2006-2009 Alvaro Livraghi. All Rights Reserved. + Copyright (C) 2006-2010 Alvaro Livraghi. All Rights Reserved. Alvaro Livraghi, *******************************************************************************/ @@ -20,8 +20,6 @@ MODULE = PerlCryptLib PACKAGE = PerlCryptLib -PROTOTYPES: DISABLE - INCLUDE: const-xs.inc ################################################################################ @@ -43,7 +41,8 @@ void * shift_buffer(buffer, length, offset) INIT: void * __buffer; CODE: - if ( __buffer = (void *)malloc(length) ) { + __buffer = (void *)malloc(length); + if ( __buffer != 0 ) { length -= offset; buffer += offset; memcpy(__buffer, buffer, length); @@ -336,14 +335,6 @@ int cryptAddRandom(randomData, randomDataLength) const int randomDataLength; -int cryptAsyncCancel(cryptObject) - const int cryptObject; - - -int cryptAsyncQuery(cryptObject) - const int cryptObject; - - int cryptCAAddItem(keyset, certificate) const int keyset; const int certificate; @@ -509,8 +500,9 @@ int cryptDeviceQueryCapability(cryptDevice, cryptAlgo, cryptQueryInfo) const int cryptDevice; const int cryptAlgo; HV * cryptQueryInfo; - CODE: + INIT: CRYPT_QUERY_INFO dummy; + CODE: RETVAL = cryptDeviceQueryCapability(cryptDevice, cryptAlgo, &dummy); if ( RETVAL == CRYPT_OK ) { hv_store(cryptQueryInfo, "algoName", 8, newSVpv(dummy.algoName, strlen(dummy.algoName)), 0); @@ -549,10 +541,6 @@ int cryptExportKeyEx(encryptedKey, encryptedKeyMaxLength, encryptedKeyLength, fo encryptedKeyLength -int cryptGenerateKeyAsync(cryptContext) - const int cryptContext; - - int cryptGetCertExtension(certificate, oid, criticalFlag, extension, extensionMaxLength, extensionLength) const int certificate; const char * oid; @@ -572,8 +560,9 @@ int cryptGetCertExtension(certificate, oid, criticalFlag, extension, extensionMa int cryptQueryCapability(cryptAlgo, cryptQueryInfo) const int cryptAlgo; HV * cryptQueryInfo; - CODE: + INIT: CRYPT_QUERY_INFO dummy; + CODE: RETVAL = cryptQueryCapability(cryptAlgo, &dummy); if ( RETVAL == CRYPT_OK ) { hv_store(cryptQueryInfo, "algoName", 8, newSVpv(dummy.algoName, strlen(dummy.algoName)), 0); @@ -590,8 +579,9 @@ int cryptQueryObject(objectData, objectDataLength, cryptObjectInfo) const void * objectData; const int objectDataLength; HV * cryptObjectInfo; - CODE: + INIT: CRYPT_OBJECT_INFO dummy; + CODE: RETVAL = cryptQueryObject(objectData, objectDataLength, &dummy); if ( RETVAL == CRYPT_OK ) { hv_store(cryptObjectInfo, "objectType", 10, newSVnv(dummy.objectType), 0); @@ -603,3 +593,19 @@ int cryptQueryObject(objectData, objectDataLength, cryptObjectInfo) } OUTPUT: RETVAL + +# Add deprecated functions when CRYPTLIB_VERSION prior 3.4.0 +#if CRYPTLIB_VERSION < 3400 + +int cryptAsyncCancel(cryptObject) + const int cryptObject; + + +int cryptAsyncQuery(cryptObject) + const int cryptObject; + + +int cryptGenerateKeyAsync(cryptContext) + const int cryptContext; + +#endif diff --git a/README b/README index d37f406..5f31647 100644 --- a/README +++ b/README @@ -1,5 +1,5 @@ ============================ -PerlCryptLib v.1.09 - README +PerlCryptLib v.1.11 - README ============================