mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-27 13:53:31 +01:00
removing more unused files
svn:r141
This commit is contained in:
parent
b097aa3288
commit
147879ab17
@ -3,7 +3,7 @@ noinst_LIBRARIES = libor.a
|
||||
|
||||
#CFLAGS = -Wall -Wpointer-arith -O2
|
||||
|
||||
libor_a_SOURCES = log.c utils.c crypto.c fakepoll.c
|
||||
libor_a_SOURCES = log.c crypto.c fakepoll.c
|
||||
|
||||
noinst_HEADERS = log.h policies.h utils.h ss.h version.h crypto.h fakepoll.h
|
||||
noinst_HEADERS = log.h ss.h version.h crypto.h fakepoll.h
|
||||
|
||||
|
@ -1,89 +0,0 @@
|
||||
/**
|
||||
* key.c
|
||||
* Key management.
|
||||
*
|
||||
* Matej Pfajfar <mp292@cam.ac.uk>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Changes :
|
||||
* $Log$
|
||||
* Revision 1.1 2002/06/26 22:45:50 arma
|
||||
* Initial revision
|
||||
*
|
||||
* Revision 1.5 2002/03/12 23:28:26 mp292
|
||||
* Removed calls to ERR_load_crypto_strings() (libcrypt).
|
||||
*
|
||||
* Revision 1.4 2002/01/27 19:23:03 mp292
|
||||
* Fixed a bug in parameter checking.
|
||||
*
|
||||
* Revision 1.3 2002/01/26 18:50:11 mp292
|
||||
* Reviewed according to Secure-Programs-HOWTO.
|
||||
*
|
||||
* Revision 1.2 2002/01/04 07:19:03 badbytes
|
||||
* Key generation moved to a separate utility (orkeygen).
|
||||
*
|
||||
* Revision 1.1 2001/12/14 12:16:33 badbytes
|
||||
* Added routine for reading a private key from a file.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/pem.h>
|
||||
|
||||
#include "key.h"
|
||||
#include "log.h"
|
||||
#include "config.h"
|
||||
|
||||
RSA *load_prkey(unsigned char *keyfile)
|
||||
{
|
||||
RSA *rsa_private=NULL;
|
||||
FILE *f_pr;
|
||||
int retval = 0;
|
||||
|
||||
if (keyfile) /* non-NULL filename */
|
||||
{
|
||||
if (strspn(keyfile,CONFIG_LEGAL_FILENAME_CHARACTERS) == strlen(keyfile)) /* filename contains legal characters only */
|
||||
{
|
||||
/* open the keyfile */
|
||||
f_pr=fopen(keyfile,"r");
|
||||
if (!f_pr)
|
||||
{
|
||||
log(LOG_ERR,"Failed to open keyfile %s.",keyfile);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* read the private key */
|
||||
rsa_private = PEM_read_RSAPrivateKey(f_pr,&rsa_private,NULL,NULL);
|
||||
fclose(f_pr);
|
||||
if (!rsa_private)
|
||||
{
|
||||
log(LOG_ERR,"Error reading private key : %s",ERR_reason_error_string(ERR_get_error()));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* check the private key */
|
||||
retval = RSA_check_key(rsa_private);
|
||||
if (retval == 0)
|
||||
{
|
||||
log(LOG_ERR,"Private key read but is invalid : %s.", ERR_reason_error_string(ERR_get_error()));
|
||||
RSA_free(rsa_private);
|
||||
return NULL;
|
||||
}
|
||||
else if (retval == -1)
|
||||
{
|
||||
log(LOG_ERR,"Private key read but validity checking failed : %s",ERR_reason_error_string(ERR_get_error()));
|
||||
RSA_free(rsa_private);
|
||||
return NULL;
|
||||
}
|
||||
else if (retval == 1)
|
||||
{
|
||||
return rsa_private;
|
||||
}
|
||||
} /* filename contains legal characters only */
|
||||
}
|
||||
|
||||
return NULL; /* report error */
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
/**
|
||||
* key.h
|
||||
* Routines for generating key pairs and loading private keys.
|
||||
*
|
||||
* Matej Pfajfar <mp292@cam.ac.uk>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Changes :
|
||||
* $Log$
|
||||
* Revision 1.1 2002/06/26 22:45:50 arma
|
||||
* Initial revision
|
||||
*
|
||||
* Revision 1.3 2002/01/26 18:50:11 mp292
|
||||
* Reviewed according to Secure-Programs-HOWTO.
|
||||
*
|
||||
* Revision 1.2 2001/12/18 10:37:47 badbytes
|
||||
* Header files now only apply if they were not previously included from somewhere else.
|
||||
*
|
||||
* Revision 1.1 2001/12/14 12:16:33 badbytes
|
||||
* Added routine for reading a private key from a file.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __KEY_H
|
||||
#include <openssl/rsa.h>
|
||||
|
||||
/* read the private key in keyfile into memory */
|
||||
RSA *load_prkey(unsigned char *keyfile);
|
||||
|
||||
#define __KEY_H
|
||||
#endif
|
@ -1,39 +0,0 @@
|
||||
/**
|
||||
* policies.h
|
||||
* Traffic shaping policies for the network funnel.
|
||||
*
|
||||
* Matej Pfajfar <mp292@cam.ac.uk>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Changes :
|
||||
* $Log$
|
||||
* Revision 1.1 2002/06/26 22:45:50 arma
|
||||
* Initial revision
|
||||
*
|
||||
* Revision 1.2 2002/03/12 23:42:37 mp292
|
||||
* Various bugfixes.
|
||||
*
|
||||
* Revision 1.1 2002/03/03 00:03:49 mp292
|
||||
* Moved from or/network (merged core and network funnel into a single thread).
|
||||
*
|
||||
* Revision 1.3 2002/02/09 17:00:42 mp292
|
||||
* Added core_sock to list of parameters for comms with the router core.
|
||||
*
|
||||
* Revision 1.2 2002/02/03 22:40:44 mp292
|
||||
* Changes to cell size.
|
||||
*
|
||||
* Revision 1.1 2002/02/03 20:34:38 mp292
|
||||
* Traffic shaping policies for the network funnel.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/* traffic shaping policies */
|
||||
#define POLICY_DROP_CONNECTIONS 0 /* buffer data and drop the connections that cannot be allocated resources */
|
||||
#define POLICY_DROP_CELLS 1 /* buffer data and drop cells, which can't be bufered, do re-transmission */
|
||||
|
||||
#define DEFAULT_POLICY POLICY_DROP_CONNECTIONS
|
||||
|
||||
#define DEFAULT_ACK_TIMEOUT 3000 /* ms */
|
||||
#define DEFAULT_WINDOW_SIZE 5 /* cells */
|
@ -1,154 +0,0 @@
|
||||
/*
|
||||
* utils.c
|
||||
* Miscellaneous utils.
|
||||
*
|
||||
* Matej Pfajfar <mp292@cam.ac.uk>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Changes :
|
||||
* $Log$
|
||||
* Revision 1.2 2002/09/03 18:44:23 nickm
|
||||
* Port to MacOS X
|
||||
*
|
||||
* Revision 1.1.1.1 2002/06/26 22:45:50 arma
|
||||
* initial commit: current code
|
||||
*
|
||||
* Revision 1.6 2002/03/03 00:06:45 mp292
|
||||
* Modifications to support re-transmission.
|
||||
*
|
||||
* Revision 1.5 2002/01/29 02:22:41 mp292
|
||||
* Bugfix.
|
||||
*
|
||||
* Revision 1.4 2002/01/29 00:58:23 mp292
|
||||
* Timeout parametes to read_tout() and write_tout() are now pointers.
|
||||
*
|
||||
* Revision 1.3 2002/01/27 19:24:16 mp292
|
||||
* Added read_tout(), write_tout() which read/write from a blocking socket but
|
||||
* impose a timeout on the I/O operation.
|
||||
*
|
||||
* Revision 1.2 2002/01/26 19:30:09 mp292
|
||||
* Reviewed according to Secure-Programs-HOWTO.
|
||||
*
|
||||
* Revision 1.1 2001/12/14 09:18:00 badbytes
|
||||
* *** empty log message ***
|
||||
*
|
||||
*/
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/socket.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "utils.h"
|
||||
#include "log.h"
|
||||
|
||||
/* converts string to lower case */
|
||||
unsigned char *stolower(unsigned char *str)
|
||||
{
|
||||
int i=0;
|
||||
|
||||
if (str) /* valid parameters */
|
||||
{
|
||||
for (i=0; str[i] != 0; i++)
|
||||
str[i] = tolower(str[i]);
|
||||
|
||||
return str;
|
||||
}
|
||||
else return NULL;
|
||||
}
|
||||
|
||||
/* reads data from a descriptor, just like read(), but imposes a timeout */
|
||||
/* the timeout refers to the connection being idle, not to a time limit in which the data
|
||||
* should be received*/
|
||||
int read_tout(int s, unsigned char *buf, size_t buflen, int flags, struct timeval *conn_tout)
|
||||
{
|
||||
int retval=0;
|
||||
int received = 0;
|
||||
struct timeval tout;
|
||||
|
||||
fd_set mask,rmask;
|
||||
|
||||
FD_ZERO(&mask);
|
||||
FD_SET(s,&mask);
|
||||
|
||||
while(1)
|
||||
{
|
||||
rmask=mask;
|
||||
tout = *conn_tout;
|
||||
retval = select(s+1,&rmask,NULL,NULL,&tout);
|
||||
if (retval == -1)
|
||||
{
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (FD_ISSET(s,&rmask))
|
||||
{
|
||||
retval = read(s,buf+received,buflen-received);
|
||||
if (retval <= 0)
|
||||
return -1;
|
||||
else
|
||||
{
|
||||
received += retval;
|
||||
if ((received < buflen) && (flags == MSG_WAITALL))
|
||||
continue;
|
||||
else
|
||||
return received;
|
||||
}
|
||||
}
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* writes data to a file descriptor, just like write(), but imposes a timeout */
|
||||
/* again this refers to the connection being idle, not a time limit in which the data should
|
||||
* be sent */
|
||||
int write_tout(int s, unsigned char *buf, size_t buflen, struct timeval *conn_tout)
|
||||
{
|
||||
int retval = 0;
|
||||
int sent = 0;
|
||||
fd_set mask,wmask;
|
||||
struct timeval tout;
|
||||
|
||||
FD_ZERO(&mask);
|
||||
FD_SET(s,&mask);
|
||||
|
||||
while(1)
|
||||
{
|
||||
wmask = mask;
|
||||
tout = *conn_tout;
|
||||
retval = select(s+1,NULL,&wmask,NULL, &tout);
|
||||
if (retval == -1)
|
||||
{
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (FD_ISSET(s,&wmask))
|
||||
{
|
||||
retval = write(s,buf+sent,buflen-sent);
|
||||
if (retval < 0)
|
||||
return -1;
|
||||
else
|
||||
{
|
||||
sent += retval;
|
||||
if (sent < buflen)
|
||||
continue;
|
||||
else
|
||||
return sent;
|
||||
}
|
||||
}
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -1,53 +0,0 @@
|
||||
/*
|
||||
* utils.h
|
||||
* Miscellaneous utils.
|
||||
*
|
||||
* Matej Pfajfar <mp292@cam.ac.uk>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Changes :
|
||||
* $Log$
|
||||
* Revision 1.1 2002/06/26 22:45:50 arma
|
||||
* Initial revision
|
||||
*
|
||||
* Revision 1.8 2002/03/21 07:20:59 badbytes
|
||||
* Added a dependency to <sys/time.h>.
|
||||
*
|
||||
* Revision 1.7 2002/03/03 00:06:45 mp292
|
||||
* Modifications to support re-transmission.
|
||||
*
|
||||
* Revision 1.6 2002/01/29 02:22:41 mp292
|
||||
* Bugfix.
|
||||
*
|
||||
* Revision 1.5 2002/01/29 00:58:23 mp292
|
||||
* Timeout parametes to read_tout() and write_tout() are now pointers.
|
||||
*
|
||||
* Revision 1.4 2002/01/27 19:24:16 mp292
|
||||
* Added read_tout(), write_tout() which read/write from a blocking socket but
|
||||
* impose a timeout on the I/O operation.
|
||||
*
|
||||
* Revision 1.3 2002/01/26 19:30:09 mp292
|
||||
* Reviewed according to Secure-Programs-HOWTO.
|
||||
*
|
||||
* Revision 1.2 2001/12/18 10:37:47 badbytes
|
||||
* Header files now only apply if they were not previously included from somewhere else.
|
||||
*
|
||||
* Revision 1.1 2001/12/14 09:18:00 badbytes
|
||||
* *** empty log message ***
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __UTILS_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/un.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
unsigned char *stolower(unsigned char *str);
|
||||
int read_tout(int s, unsigned char *buf, size_t buflen, int flags, struct timeval *conn_tout);
|
||||
int write_tout(int s, unsigned char *buf, size_t buflen, struct timeval *conn_tout);
|
||||
|
||||
#define __UTILS_H
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user