]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - cups/tls-darwin.c
Changes to eliminate warnings from new Clang.
[thirdparty/cups.git] / cups / tls-darwin.c
index 3da44f301a7a82b0b8fb33fc8dabc73d0ecb99a6..a14b843aa68dcf572f9493709c7925be6228605f 100644 (file)
@@ -1,9 +1,7 @@
 /*
- * "$Id$"
- *
  * TLS support code for CUPS on OS X.
  *
- * Copyright 2007-2015 by Apple Inc.
+ * Copyright 2007-2016 by Apple Inc.
  * Copyright 1997-2007 by Easy Software Products, all rights reserved.
  *
  * These coded instructions, statements, and computer programs are the
@@ -41,8 +39,8 @@ static char           *tls_keypath = NULL;
                                        /* Server cert keychain path */
 static _cups_mutex_t   tls_mutex = _CUPS_MUTEX_INITIALIZER;
                                        /* Mutex for keychain/certs */
-static int             tls_options = -1;/* Options for TLS connections */
 #endif /* HAVE_SECKEYCHAINOPEN */
+static int             tls_options = -1;/* Options for TLS connections */
 
 
 /*
@@ -109,7 +107,7 @@ cupsMakeServerCredentials(
   if (!keyParams)
     goto cleanup;
 
-  CFDictionaryAddValue(keyParams, kSecAttrKeyType, kSecAttrKeyTypeRSA);
+  CFDictionaryAddValue(keyParams, kSecAttrKeyType, kSecAttrKeyTypeECDSA);
   CFDictionaryAddValue(keyParams, kSecAttrKeySizeInBits, CFSTR("2048"));
   CFDictionaryAddValue(keyParams, kSecAttrLabel, CFSTR("CUPS Self-Signed Certificate"));
 
@@ -180,7 +178,7 @@ cleanup:
                status,                 /* Status of command */
                i;                      /* Looping var */
   char         command[1024],          /* Command */
-               *argv[4],               /* Command-line arguments */
+               *argv[5],               /* Command-line arguments */
                *envp[1000],            /* Environment variables */
                days[32],               /* CERTTOOL_EXPIRATION_DAYS env var */
                keychain[1024],         /* Keychain argument */
@@ -189,7 +187,7 @@ cleanup:
   cups_file_t  *fp;                    /* Seed/info file */
 
 
-  DEBUG_printf(("cupsMakeServerCredentials(path=\"%s\", common_name=\"%s\", num_alt_names=%d, alt_names=%p, expiration_date=%d)", path, common_name, num_alt_names, alt_names, (int)expiration_date));
+  DEBUG_printf(("cupsMakeServerCredentials(path=\"%s\", common_name=\"%s\", num_alt_names=%d, alt_names=%p, expiration_date=%d)", path, common_name, num_alt_names, (void *)alt_names, (int)expiration_date));
 
   (void)num_alt_names;
   (void)alt_names;
@@ -218,10 +216,10 @@ cleanup:
                  "CUPS Self-Signed Certificate\n"
                                        /* Enter key and certificate label */
                  "r\n"                 /* Generate RSA key pair */
-                 "2048\n"              /* Key size in bits */
+                 "2048\n"              /* 2048 bit encryption key */
                  "y\n"                 /* OK (y = yes) */
                  "b\n"                 /* Usage (b=signing/encryption) */
-                 "s\n"                 /* Sign with SHA1 */
+                 "2\n"                 /* Sign with SHA256 */
                  "y\n"                 /* OK (y = yes) */
                  "%s\n"                        /* Common name */
                  "\n"                  /* Country (default) */
@@ -366,7 +364,7 @@ httpCopyCredentials(
   int                  i;              /* Looping var */
 
 
-  DEBUG_printf(("httpCopyCredentials(http=%p, credentials=%p)", http, credentials));
+  DEBUG_printf(("httpCopyCredentials(http=%p, credentials=%p)", (void *)http, (void *)credentials));
 
   if (credentials)
     *credentials = NULL;
@@ -641,7 +639,7 @@ httpCredentialsString(
   SecCertificateRef    secCert;        /* Certificate reference */
 
 
-  DEBUG_printf(("httpCredentialsString(credentials=%p, buffer=%p, bufsize=" CUPS_LLFMT ")", credentials, buffer, CUPS_LLCAST bufsize));
+  DEBUG_printf(("httpCredentialsString(credentials=%p, buffer=%p, bufsize=" CUPS_LLFMT ")", (void *)credentials, (void *)buffer, CUPS_LLCAST bufsize));
 
   if (!buffer)
     return (0);
@@ -724,7 +722,7 @@ httpLoadCredentials(
   CFArrayRef           list = NULL;    /* Keychain list */
 
 
-  DEBUG_printf(("httpLoadCredentials(path=\"%s\", credentials=%p, common_name=\"%s\")", path, credentials, common_name));
+  DEBUG_printf(("httpLoadCredentials(path=\"%s\", credentials=%p, common_name=\"%s\")", path, (void *)credentials, common_name));
 
   if (!credentials)
     return (-1);
@@ -827,7 +825,7 @@ httpSaveCredentials(
   CFArrayRef           list = NULL;    /* Keychain list */
 
 
-  DEBUG_printf(("httpSaveCredentials(path=\"%s\", credentials=%p, common_name=\"%s\")", path, credentials, common_name));
+  DEBUG_printf(("httpSaveCredentials(path=\"%s\", credentials=%p, common_name=\"%s\")", path, (void *)credentials, common_name));
   if (!credentials)
     goto cleanup;
 
@@ -1009,7 +1007,7 @@ _httpTLSStart(http_t *http)               /* I - HTTP connection */
   http_credential_t    *credential;    /* Credential data */
 
 
-  DEBUG_printf(("3_httpTLSStart(http=%p)", http));
+  DEBUG_printf(("3_httpTLSStart(http=%p)", (void *)http));
 
   if (tls_options < 0)
   {
@@ -1061,7 +1059,7 @@ _httpTLSStart(http_t *http)               /* I - HTTP connection */
   if (!error)
   {
     SSLProtocol minProtocol;
-    
+
     if (tls_options & _HTTP_TLS_DENY_TLS10)
       minProtocol = kTLSProtocol11;
     else if (tls_options & _HTTP_TLS_ALLOW_SSL3)
@@ -1312,7 +1310,7 @@ _httpTLSStart(http_t *http)               /* I - HTTP connection */
     DEBUG_printf(("4_httpTLSStart: SSLSetCertificate, error=%d", (int)error));
   }
 
-  DEBUG_printf(("4_httpTLSStart: tls_credentials=%p", http->tls_credentials));
+  DEBUG_printf(("4_httpTLSStart: tls_credentials=%p", (void *)http->tls_credentials));
 
  /*
   * Let the server know which hostname/domain we are trying to connect to
@@ -1534,7 +1532,7 @@ _httpTLSWrite(http_t     *http,           /* I - HTTP connection */
   size_t       processed;              /* Number of bytes processed */
 
 
-  DEBUG_printf(("2_httpTLSWrite(http=%p, buf=%p, len=%d)", http, buf, len));
+  DEBUG_printf(("2_httpTLSWrite(http=%p, buf=%p, len=%d)", (void *)http, (void *)buf, len));
 
   error = SSLWrite(http->tls, buf, (size_t)len, &processed);
 
@@ -1766,7 +1764,7 @@ http_cdsa_set_credentials(http_t *http)   /* I - HTTP connection */
                                        /* TLS credentials */
 
 
-  DEBUG_printf(("7http_tls_set_credentials(%p)", http));
+  DEBUG_printf(("7http_tls_set_credentials(%p)", (void *)http));
 
  /*
   * Prefer connection specific credentials...
@@ -1832,8 +1830,3 @@ http_cdsa_write(
 
   return (result);
 }
-
-
-/*
- * End of "$Id$".
- */