XRootD
XrdTlsContext.cc File Reference
#include <cstdio>
#include <openssl/bio.h>
#include <openssl/crypto.h>
#include <openssl/err.h>
#include <openssl/ssl.h>
#include <openssl/opensslv.h>
#include <sys/stat.h>
#include "XrdOuc/XrdOucUtils.hh"
#include "XrdSys/XrdSysRAtomic.hh"
#include "XrdSys/XrdSysError.hh"
#include "XrdSys/XrdSysPthread.hh"
#include "XrdSys/XrdSysTimer.hh"
#include "XrdTls/XrdTls.hh"
#include "XrdTls/XrdTlsContext.hh"
#include "XrdTls/XrdTlsTrace.hh"
+ Include dependency graph for XrdTlsContext.cc:

Go to the source code of this file.

Classes

struct  tlsmix< false >
 
struct  tlsmix< true >
 
struct  XrdTlsContextImpl
 

Namespaces

 XrdTlsCrl
 
 XrdTlsFlush
 
 XrdTlsGlobal
 

Macros

#define FATAL(msg)   {Fatal(eMsg, msg); KILL_CTX(pImpl->ctx); return;}
 
#define FATAL_SSL(msg)   {Fatal(eMsg, msg, true); KILL_CTX(pImpl->ctx); return;}
 
#define KILL_CTX(x)   if (x) {SSL_CTX_free(x); x = 0;}
 

Functions

void * XrdTlsFlush::Flusher (void *parg)
 
void * XrdTlsCrl::Refresh (void *parg)
 
bool XrdTlsFlush::Setup_Flusher (XrdTlsContextImpl *pImpl, int flushT)
 
unsigned long sslTLS_id_callback (void)
 
void sslTLS_lock (int mode, int n, const char *file, int line)
 

Variables

XrdSysMutex * MutexVector = 0
 

Macro Definition Documentation

◆ FATAL

#define FATAL (   msg)    {Fatal(eMsg, msg); KILL_CTX(pImpl->ctx); return;}

Definition at line 554 of file XrdTlsContext.cc.

◆ FATAL_SSL

#define FATAL_SSL (   msg)    {Fatal(eMsg, msg, true); KILL_CTX(pImpl->ctx); return;}

Definition at line 556 of file XrdTlsContext.cc.

◆ KILL_CTX

#define KILL_CTX (   x)    if (x) {SSL_CTX_free(x); x = 0;}

Definition at line 552 of file XrdTlsContext.cc.

Function Documentation

◆ sslTLS_id_callback()

unsigned long sslTLS_id_callback ( void  )

Definition at line 341 of file XrdTlsContext.cc.

342 {
343  // base thread-id on the id given by XrdSysThread;
344  // but openssl 1.0 uses thread-id as a key for looking
345  // up per thread crypto ERR structures in a hash-table.
346  // So mix bits so that the table's hash function gives
347  // better distribution.
348 
349  unsigned long x = (unsigned long)XrdSysThread::ID();
350  return tlsmix<sizeof(unsigned long)==4>::mixer(x);
351 }
static pthread_t ID(void)

References XrdSysThread::ID().

+ Here is the call graph for this function:

◆ sslTLS_lock()

void sslTLS_lock ( int  mode,
int  n,
const char *  file,
int  line 
)

Definition at line 355 of file XrdTlsContext.cc.

356 {
357 // Use exclusive locks. At some point, SSL categorizes these as read and
358 // write locks but it's not clear when this actually occurs, sigh.
359 //
360  if (mode & CRYPTO_LOCK) MutexVector[n].Lock();
361  else MutexVector[n].UnLock();
362 }
XrdSysMutex * MutexVector

References XrdSysMutex::Lock(), MutexVector, and XrdSysMutex::UnLock().

+ Here is the call graph for this function:

Variable Documentation

◆ MutexVector

XrdSysMutex* MutexVector = 0

Definition at line 353 of file XrdTlsContext.cc.

Referenced by sslTLS_lock().