Commit ea1b02db authored by Andy Polyakov's avatar Andy Polyakov
Browse files

OPENSSL_Applink update.

parent 2c4b354d
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -79,7 +79,6 @@
#include <openssl/x509v3.h>
#include <openssl/objects.h>
#include <openssl/pem.h>
#include "../crypto/cryptlib.h"

#define SECTION		"req"

+2 −2
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@

#include <stdio.h>
#include "cryptlib.h"
#include <openssl/bio.h>
#include "bio_lcl.h"

#define TRUNCATE
#define DUMP_WIDTH	16
@@ -160,7 +160,7 @@ int BIO_dump_indent_cb(int (*cb)(const void *data, size_t len, void *u),
#ifndef OPENSSL_NO_FP_API
static int write_fp(const void *data, size_t len, void *fp)
	{
	return fwrite(data, len, 1, (FILE *)fp);
	return UP_fwrite(data, len, 1, fp);
	}
int BIO_dump_fp(FILE *fp, const char *s, int len)
	{
+5 −0
Original line number Diff line number Diff line
@@ -169,6 +169,11 @@ extern "C" {
#define BIO_FLAGS_IO_SPECIAL	0x04
#define BIO_FLAGS_RWS (BIO_FLAGS_READ|BIO_FLAGS_WRITE|BIO_FLAGS_IO_SPECIAL)
#define BIO_FLAGS_SHOULD_RETRY	0x08
#ifndef	BIO_FLAGS_UPLINK
/* "UPLINK" flag denotes file descriptors provided by application.
   It defaults to 0, as most platforms don't require UPLINK interface. */
#define	BIO_FLAGS_UPLINK	0
#endif

/* Used in BIO_gethostbyname() */
#define BIO_GHBN_CTRL_HITS		1

crypto/bio/bio_lcl.h

0 → 100644
+28 −0
Original line number Diff line number Diff line
#include <openssl/bio.h>

#if BIO_FLAGS_UPLINK==0
/* Shortcut UPLINK calls on most platforms... */
#define	UP_stdin	stdin
#define	UP_stdout	stdout
#define	UP_stderr	stderr
#define	UP_fprintf	fprintf
#define	UP_fgets	fgets
#define	UP_fread	fread
#define	UP_fwrite	fwrite
#undef	UP_fsetmod
#define	UP_feof		feof
#define	UP_fclose	fclose

#define	UP_fopen	fopen
#define	UP_fseek	fseek
#define	UP_ftell	ftell
#define	UP_fflush	fflush
#define	UP_ferror	ferror
#define	UP_fileno	fileno

#define	UP_open		open
#define	UP_read		read
#define	UP_write	write
#define	UP_lseek	lseek
#define	UP_close	close
#endif
+21 −9
Original line number Diff line number Diff line
@@ -60,7 +60,19 @@
#include <errno.h>
#define USE_SOCKETS
#include "cryptlib.h"
#include <openssl/bio.h>
/*
 * As for unconditional usage of "UPLINK" interface in this module.
 * Trouble is that unlike Unix file descriptors [which are indexes
 * in kernel-side per-process table], corresponding descriptors on
 * platforms which require "UPLINK" interface seem to be indexes
 * in a user-land, non-global table. Well, in fact they are indexes
 * in stdio _iob[], and recall that _iob[] was the very reason why
 * "UPLINK" interface was introduced in first place. But one way on
 * another. Neither libcrypto or libssl use this BIO meaning that
 * file descriptors can only be provided by application. Therefore
 * "UPLINK" calls are due...
 */
#include "bio_lcl.h"

static int fd_write(BIO *h, const char *buf, int num);
static int fd_read(BIO *h, char *buf, int size);
@@ -100,9 +112,9 @@ BIO *BIO_new_fd(int fd,int close_flag)
static int fd_new(BIO *bi)
	{
	bi->init=0;
	bi->num=0;
	bi->num=-1;
	bi->ptr=NULL;
	bi->flags=0;
	bi->flags=BIO_FLAGS_UPLINK; /* essentially redundant */
	return(1);
	}

@@ -113,10 +125,10 @@ static int fd_free(BIO *a)
		{
		if (a->init)
			{
			close(a->num);
			UP_close(a->num);
			}
		a->init=0;
		a->flags=0;
		a->flags=BIO_FLAGS_UPLINK;
		}
	return(1);
	}
@@ -128,7 +140,7 @@ static int fd_read(BIO *b, char *out,int outl)
	if (out != NULL)
		{
		clear_sys_error();
		ret=read(b->num,out,outl);
		ret=UP_read(b->num,out,outl);
		BIO_clear_retry_flags(b);
		if (ret <= 0)
			{
@@ -143,7 +155,7 @@ static int fd_write(BIO *b, const char *in, int inl)
	{
	int ret;
	clear_sys_error();
	ret=write(b->num,in,inl);
	ret=UP_write(b->num,in,inl);
	BIO_clear_retry_flags(b);
	if (ret <= 0)
		{
@@ -163,11 +175,11 @@ static long fd_ctrl(BIO *b, int cmd, long num, void *ptr)
	case BIO_CTRL_RESET:
		num=0;
	case BIO_C_FILE_SEEK:
		ret=(long)lseek(b->num,num,0);
		ret=(long)UP_lseek(b->num,num,0);
		break;
	case BIO_C_FILE_TELL:
	case BIO_CTRL_INFO:
		ret=(long)lseek(b->num,0,1);
		ret=(long)UP_lseek(b->num,0,1);
		break;
	case BIO_C_SET_FD:
		fd_free(b);
Loading