]> git.saurik.com Git - apple/security.git/blobdiff - OSX/libsecurity_apple_csp/lib/RSA_DSA_utils.cpp
Security-59754.80.3.tar.gz
[apple/security.git] / OSX / libsecurity_apple_csp / lib / RSA_DSA_utils.cpp
index 8ae93c2e218321fceaa9ae30639226a6c113b283..7b8f894e43a79a5c47258f0431932971d6150136 100644 (file)
 #include <opensslUtils/opensslUtils.h>
 #include <security_utilities/logging.h>
 #include <security_utilities/debugging.h>
-#include <openssl/bn.h>
-#include <openssl/rsa.h>
-#include <openssl/dsa.h>
-#include <openssl/err.h>
+#include <openssl/bn_legacy.h>
+#include <openssl/rsa_legacy.h>
+#include <openssl/dsa_legacy.h>
+#include <openssl/opensslerr.h>
 #include <security_utilities/simpleprefs.h>
 #include <security_utilities/threading.h>
 #include <security_utilities/globalizer.h>
 #include <CoreFoundation/CFNumber.h>
 
-#define rsaMiscDebug(args...)  secdebug("rsaMisc", ## args)
+#define rsaMiscDebug(args...)  secinfo("rsaMisc", ## args)
 
 /*
  * Obtain and cache max key sizes. System preferences only consulted 
@@ -100,15 +100,21 @@ RSAKeySizes::RSAKeySizes()
        maxPubExponentSize = RSA_MAX_PUB_EXPONENT_SIZE;
        
        /* now see if there are prefs set for either of these */
-       Dictionary* d = Dictionary::CreateDictionary(kRSAKeySizePrefsDomain, Dictionary::US_System, true);
+    Dictionary* d = NULL;
+    try {
+        d = Dictionary::CreateDictionary(kRSAKeySizePrefsDomain, Dictionary::US_System, true);
+    } catch(...) {
+        return;
+    }
+
        if (!d)
        {
                return;
        }
-       
+
        if (d->dict())
        {
-               auto_ptr<Dictionary>apd(d);
+               unique_ptr<Dictionary>apd(d);
                rsaLookupVal(*apd, kRSAMaxKeySizePref, maxKeySize);
                rsaLookupVal(*apd, kRSAMaxPublicExponentPref, maxPubExponentSize);
        }
@@ -217,7 +223,7 @@ RSA *rawCssmKeyToRsa(
        bool isPub;
        bool isOaep = false;
        
-       assert(hdr->BlobType == CSSM_KEYBLOB_RAW); 
+       assert(hdr->BlobType == CSSM_KEYBLOB_RAW);
        
        switch(hdr->AlgorithmId) {
                case CSSM_ALGID_RSA:
@@ -498,7 +504,7 @@ DSA *rawCssmKeyToDsa(
        const CSSM_KEYHEADER *hdr = &cssmKey.KeyHeader;
        bool isPub;
        
-       assert(hdr->BlobType == CSSM_KEYBLOB_RAW); 
+       assert(hdr->BlobType == CSSM_KEYBLOB_RAW);
        
        if(hdr->AlgorithmId != CSSM_ALGID_DSA) {
                // someone else's key (should never happen)