This file is indexed.

/usr/include/dclib-0.3/dclib/core/cssl.h is in libdc-dev 0.3.24~svn3121-1.1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/***************************************************************************
                          cssl.h  -  description
                             -------------------
    begin                : Sat Dec 7 2002
    copyright            : (C) 2002-2003 by Mathias Küster
    email                : mathen@users.berlios.de
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef CSSL_H
#define CSSL_H

/**
  *@author Mathias Küster
  *
  * This has some SSL utility functions and does some
  * cryptography for the "secure" private chat.
  */

#include <dclib/dcos.h>
#include <dclib/core/cstring.h>

#include <dclib/dclib-ssl-use.h>

#if DCLIB_USES_OPENSSL == 1

#include <openssl/opensslv.h>
#include <openssl/rsa.h>
#include <openssl/rand.h>
#include <openssl/evp.h>
#include <openssl/ssl.h>
#include <openssl/err.h>

#else

/* this may also work for SSL builds */
typedef struct rsa_st RSA;
typedef struct ssl_ctx_st SSL_CTX;

#endif

class CMutex;

class CSSLObject {
public:
	/** */
	CSSLObject() {
		m_bHandshakeState = 0;
		m_pRSA            = 0;
	};
	/** */
	~CSSLObject();

	/** */
	int m_bHandshakeState;
	/* */
	RSA * m_pRSA;
	/** */
	unsigned char m_localkey[16];
	/** */
	unsigned char m_localiv[8];
	/** */
	unsigned char m_remotekey[16];
	/** */
	unsigned char m_remoteiv[8];
};

class CSSL {
public:
	/** */
	CSSL();
	/** */
	virtual ~CSSL();

	/** */
	static SSL_CTX * InitClientCTX();
	/** */
	static SSL_CTX * InitServerCTX();
	/**
	 * As the name suggests it creates a new client SSL_CTX
	 * that only supports >= TLSv1, required for
	 * *DC++ compatibility.
	 */
	static SSL_CTX * NewTLSv1ClientCTX();
	/**
	 * As the name suggests it creates a new server SSL_CTX
	 * that only supports >= TLSv1, required for
	 * *DC++ compatibility.
	 */
	static SSL_CTX * NewTLSv1ServerCTX();
	/** */
	static bool LoadCertificates( SSL_CTX * ctx, char * CertFile, char * KeyFile );
	/** Get SSL library version string */
	static CString GetSSLVersionString();
	/** Perform library initialisation functions */
	static void InitSSLLibrary();
	/** Perform library deinitialisation functions */
	static void DeInitSSLLibrary();

protected:
	/** */
	void InitRand();
	/** */
	void InitRandArray( unsigned char * a, int len );
	/** */
	bool GenerateRsaKey();
	/** */
	CString GetPublicRsaKey();
	/** */
	bool SetPublicKey( CSSLObject * SSLObject, CString s );
	/** */
	void InitSessionKey( CSSLObject * SSLObject );
	/** */
	CString GetSessionKey( CSSLObject * SSLObject );
	/** */
	bool SetSessionKey( CSSLObject * SSLObject, CString s );
	/** */
	CString EncryptData( CSSLObject * SSLObject, CString s );
	/** */
	CString DecryptData( CSSLObject * SSLObject, CString s );

	/* */
	RSA * m_pRSA;
	/** */
	int * m_pRandBuffer;

private:
	/** some mutexes for OpenSSL to use */
	static CMutex * mutexes;
	/**
	 * a function to give to OpenSSL for it to use the mutexes
	 * FIXME that const will have been added in some version...
	 * breaking things with older versions
	 */
	static void locking_callback( int mode, int type, const char * file, int line );
#ifndef WIN32
	/** a thread id function, not required on Windows */
	static unsigned long thread_id();
#endif /* WIN32 */
};

#endif