X-Git-Url: https://git.saurik.com/apple/security.git/blobdiff_plain/d8f41ccd20de16f8ebe2ccc84d47bf1cb2b26bbb..bf028f67fd3bb2266df81b80fb6f25a77112e308:/sslViewer/sslServer.cpp diff --git a/sslViewer/sslServer.cpp b/sslViewer/sslServer.cpp index fca50f3e..fefc0898 100644 --- a/sslViewer/sslServer.cpp +++ b/sslViewer/sslServer.cpp @@ -45,10 +45,10 @@ #include #include -#include "SecurityTool/print_cert.h" +#include "SecurityTool/sharedTool/print_cert.h" #if NO_SERVER -#include +#include "keychain/securityd/spi.h" #endif /* Set true when PR-3074739 is merged to TOT */ @@ -226,7 +226,6 @@ static OSStatus sslServe( const char *acceptedProts, CFArrayRef serverCerts, // required char *password, // optional - CFArrayRef encryptServerCerts, // optional bool allowExpired, bool allowAnyRoot, bool allowExpiredRoot, @@ -260,7 +259,9 @@ static OSStatus sslServe( size_t length; uint8_t rcvBuf[RCV_BUF_SIZE]; const char *outMsg = SERVER_MESSAGE; - + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" *negVersion = kSSLProtocolUnknown; *negCipher = SSL_NULL_WITH_NULL_NULL; *peerCerts = NULL; @@ -288,7 +289,7 @@ static OSStatus sslServe( if(ortn) { printSslErrStr("SSLNewContext", ortn); goto cleanup; - } + } ortn = SSLSetIOFuncs(ctx, SocketRead, SocketWrite); if(ortn) { printSslErrStr("SSLSetIOFuncs", ortn); @@ -337,13 +338,6 @@ static OSStatus sslServe( goto cleanup; } } - if(encryptServerCerts) { - ortn = SSLSetEncryptionCertificate(ctx, encryptServerCerts); - if(ortn) { - printSslErrStr("SSLSetEncryptionCertificate", ortn); - goto cleanup; - } - } if(allowExpiredRoot) { ortn = SSLSetAllowsExpiredRoots(ctx, true); if(ortn) { @@ -481,8 +475,7 @@ static OSStatus sslServe( SSLGetNegotiatedCipher(ctx, negCipher); SSLGetNegotiatedProtocolVersion(ctx, negVersion); *sessionIDLength = MAX_SESSION_ID_LENGTH; - SSLGetResumableSessionInfo(ctx, sessionWasResumed, sessionID, - sessionIDLength); + ortn = SSLGetResumableSessionInfo(ctx, sessionWasResumed, sessionID, sessionIDLength); if(!silent) { printf("\n"); @@ -558,7 +551,10 @@ cleanup: } if(ctx) { SSLDisposeContext(ctx); - } + } + +#pragma clang diagnostic pop + /* FIXME - dispose of serverCerts */ return ortn; } @@ -599,7 +595,7 @@ static void writePeerCerts( for(i=0; i loop forever */ @@ -933,35 +900,7 @@ int main(int argc, char **argv) if(serverCerts == nil) { exit(1); } - } - else -#if 0 - if(doIdSearch) { - OSStatus ortn = sslIdentityPicker(NULL, anchorFile, true, NULL, &serverCerts); - if(ortn) { - printf("***IdentitySearch failure; aborting.\n"); - exit(1); - } - } - if(password) { - OSStatus ortn = SecKeychainUnlock(serverKc, strlen(password), password, true); - if(ortn) { - printf("SecKeychainUnlock returned %d\n", (int)ortn); - /* oh well */ - } - } - if(encryptKeyChainName) { - encryptCerts = getSslCerts(encryptKeyChainName, true, completeCertChain, - anchorFile, &encryptKc); - if(encryptCerts == nil) { - exit(1); - } - } -#else - (void) doIdSearch; - (void) encryptKeyChainName; -#endif - if(protXOnly) { + } else if(protXOnly) { switch(attemptProt) { case kTLSProtocol1: attemptProt = kTLSProtocol1Only; @@ -973,17 +912,8 @@ int main(int argc, char **argv) break; } } -#if 0 - if(dhParamsFile) { - int r = cspReadFile(dhParamsFile, &dhParams, &dhParamsLen); - if(r) { - printf("***Error reading diffie-hellman params from %s; aborting\n", - dhParamsFile); - } - } -#else - (void) dhParamsFile; -#endif + +#pragma clang diagnostic pop /* one-time only server port setup */ err = ListenForClients(portNum, nonBlocking, &listenSock); @@ -999,7 +929,6 @@ int main(int argc, char **argv) acceptedProts, serverCerts, password, - encryptCerts, allowExpired, allowAnyRoot, allowExpiredRoot, @@ -1055,9 +984,6 @@ int main(int argc, char **argv) if(serverKc) { CFRelease(serverKc); } - if(encryptKc) { - CFRelease(encryptKc); - } return errCount; }