#include <stdio.h>
#include "cryptlib.h"
-#include "bio_lcl.h"
+#include <openssl/bio.h>
#define TRUNCATE
#define DUMP_WIDTH 16
static int
write_fp(const void *data, size_t len, void *fp)
{
- return UP_fwrite(data, len, 1, fp);
+ return fwrite(data, len, 1, fp);
}
int
#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
+++ /dev/null
-#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
* BIO_s_fd here...
*/
#else
-/*
- * 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"
+#include <openssl/bio.h>
static int fd_write(BIO *h, const char *buf, int num);
static int fd_read(BIO *h, char *buf, int size);
bi->init = 0;
bi->num = -1;
bi->ptr = NULL;
- bi->flags=BIO_FLAGS_UPLINK; /* essentially redundant */
+ bi->flags=0;
return (1);
}
return (0);
if (a->shutdown) {
if (a->init) {
- UP_close(a->num);
+ close(a->num);
}
a->init = 0;
- a->flags = BIO_FLAGS_UPLINK;
+ a->flags = 0;
}
return (1);
}
if (out != NULL) {
errno = 0;
- ret = UP_read(b->num, out, outl);
+ ret = read(b->num, out, outl);
BIO_clear_retry_flags(b);
if (ret <= 0) {
if (BIO_fd_should_retry(ret))
{
int ret;
errno = 0;
- ret = UP_write(b->num, in, inl);
+ ret = write(b->num, in, inl);
BIO_clear_retry_flags(b);
if (ret <= 0) {
if (BIO_fd_should_retry(ret))
case BIO_CTRL_RESET:
num = 0;
case BIO_C_FILE_SEEK:
- ret = (long)UP_lseek(b->num, num, 0);
+ ret = (long)lseek(b->num, num, 0);
break;
case BIO_C_FILE_TELL:
case BIO_CTRL_INFO:
- ret = (long)UP_lseek(b->num, 0, 1);
+ ret = (long)lseek(b->num, 0, 1);
break;
case BIO_C_SET_FD:
fd_free(b);
#include <stdio.h>
#include <errno.h>
#include "cryptlib.h"
-#include "bio_lcl.h"
+#include <openssl/bio.h>
#include <openssl/err.h>
#if !defined(OPENSSL_NO_STDIO)
return (NULL);
}
- BIO_clear_flags(ret, BIO_FLAGS_UPLINK); /* we did fopen -> we disengage UPLINK */
BIO_set_fp(ret, file, BIO_CLOSE);
return (ret);
}
if ((ret = BIO_new(BIO_s_file())) == NULL)
return (NULL);
- BIO_set_flags(ret, BIO_FLAGS_UPLINK); /* redundant, left for documentation puposes */
BIO_set_fp(ret, stream, close_flag);
return (ret);
}
bi->init = 0;
bi->num = 0;
bi->ptr = NULL;
- bi->flags=BIO_FLAGS_UPLINK; /* default to UPLINK */
+ bi->flags=0;
return (1);
}
return (0);
if (a->shutdown) {
if ((a->init) && (a->ptr != NULL)) {
- if (a->flags&BIO_FLAGS_UPLINK)
- UP_fclose (a->ptr);
- else
- fclose (a->ptr);
+ fclose (a->ptr);
a->ptr = NULL;
- a->flags = BIO_FLAGS_UPLINK;
+ a->flags = 0;
}
a->init = 0;
}
int ret = 0;
if (b->init && (out != NULL)) {
- if (b->flags&BIO_FLAGS_UPLINK)
- ret = UP_fread(out, 1,(int)outl, b->ptr);
- else
- ret = fread(out, 1,(int)outl,(FILE *)b->ptr);
- if (ret == 0 && (b->flags & BIO_FLAGS_UPLINK) ?
- UP_ferror((FILE *)b->ptr) : ferror((FILE *)b->ptr)) {
+ ret = fread(out, 1,(int)outl,(FILE *)b->ptr);
+ if (ret == 0 && ferror((FILE *)b->ptr)) {
SYSerr(SYS_F_FREAD, errno);
BIOerr(BIO_F_FILE_READ, ERR_R_SYS_LIB);
ret = -1;
int ret = 0;
if (b->init && (in != NULL)) {
- if (b->flags&BIO_FLAGS_UPLINK)
- ret = UP_fwrite(in,(int)inl, 1, b->ptr);
- else
- ret = fwrite(in,(int)inl, 1,(FILE *)b->ptr);
+ ret = fwrite(in,(int)inl, 1,(FILE *)b->ptr);
if (ret)
ret = inl;
/* ret=fwrite(in,1,(int)inl,(FILE *)b->ptr); */
switch (cmd) {
case BIO_C_FILE_SEEK:
case BIO_CTRL_RESET:
- if (b->flags&BIO_FLAGS_UPLINK)
- ret = (long)UP_fseek(b->ptr, num, 0);
- else
- ret = (long)fseek(fp, num, 0);
+ ret = (long)fseek(fp, num, 0);
break;
case BIO_CTRL_EOF:
- if (b->flags&BIO_FLAGS_UPLINK)
- ret = (long)UP_feof(fp);
- else
- ret = (long)feof(fp);
+ ret = (long)feof(fp);
break;
case BIO_C_FILE_TELL:
case BIO_CTRL_INFO:
- if (b->flags&BIO_FLAGS_UPLINK)
- ret = UP_ftell(b->ptr);
- else
- ret = ftell(fp);
+ ret = ftell(fp);
break;
case BIO_C_SET_FILE_PTR:
file_free(b);
b->shutdown = (int)num&BIO_CLOSE;
b->ptr = ptr;
b->init = 1;
-#if BIO_FLAGS_UPLINK!=0
-#if defined(_IOB_ENTRIES)
- /* Safety net to catch purely internal BIO_set_fp calls */
- if ((size_t)ptr >= (size_t)stdin &&
- (size_t)ptr < (size_t)(stdin + _IOB_ENTRIES))
- BIO_clear_flags(b, BIO_FLAGS_UPLINK);
-#endif
-#endif
-#ifdef UP_fsetmod
- if (b->flags&BIO_FLAGS_UPLINK)
- UP_fsetmod(b->ptr,(char)((num&BIO_FP_TEXT)?'t':'b'));
-#endif
break;
case BIO_C_SET_FILENAME:
file_free(b);
}
b->ptr = fp;
b->init = 1;
- BIO_clear_flags(b, BIO_FLAGS_UPLINK); /* we did fopen -> we disengage UPLINK */
break;
case BIO_C_GET_FILE_PTR:
/* the ptr parameter is actually a FILE ** in this case. */
b->shutdown = (int)num;
break;
case BIO_CTRL_FLUSH:
- if (b->flags&BIO_FLAGS_UPLINK)
- UP_fflush(b->ptr);
- else
- fflush((FILE *)b->ptr);
+ fflush((FILE *)b->ptr);
break;
case BIO_CTRL_DUP:
ret = 1;
int ret = 0;
buf[0] = '\0';
- if (bp->flags&BIO_FLAGS_UPLINK) {
- if (!UP_fgets(buf, size, bp->ptr))
- goto err;
- } else {
- if (!fgets(buf, size,(FILE *)bp->ptr))
- goto err;
- }
+ if (!fgets(buf, size,(FILE *)bp->ptr))
+ goto err;
if (buf[0] != '\0')
ret = strlen(buf);
err:
#include "e_os.h"
-#ifdef OPENSSL_USE_APPLINK
-#define BIO_FLAGS_UPLINK 0x8000
-#include "ms/uplink.h"
-#endif
-
#include <openssl/crypto.h>
#include <openssl/buffer.h>
#include <openssl/bio.h>
#include <stdio.h>
#include "cryptlib.h"
-#include "bio_lcl.h"
+#include <openssl/bio.h>
#define TRUNCATE
#define DUMP_WIDTH 16
static int
write_fp(const void *data, size_t len, void *fp)
{
- return UP_fwrite(data, len, 1, fp);
+ return fwrite(data, len, 1, fp);
}
int
#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
+++ /dev/null
-#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
* BIO_s_fd here...
*/
#else
-/*
- * 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"
+#include <openssl/bio.h>
static int fd_write(BIO *h, const char *buf, int num);
static int fd_read(BIO *h, char *buf, int size);
bi->init = 0;
bi->num = -1;
bi->ptr = NULL;
- bi->flags=BIO_FLAGS_UPLINK; /* essentially redundant */
+ bi->flags=0;
return (1);
}
return (0);
if (a->shutdown) {
if (a->init) {
- UP_close(a->num);
+ close(a->num);
}
a->init = 0;
- a->flags = BIO_FLAGS_UPLINK;
+ a->flags = 0;
}
return (1);
}
if (out != NULL) {
errno = 0;
- ret = UP_read(b->num, out, outl);
+ ret = read(b->num, out, outl);
BIO_clear_retry_flags(b);
if (ret <= 0) {
if (BIO_fd_should_retry(ret))
{
int ret;
errno = 0;
- ret = UP_write(b->num, in, inl);
+ ret = write(b->num, in, inl);
BIO_clear_retry_flags(b);
if (ret <= 0) {
if (BIO_fd_should_retry(ret))
case BIO_CTRL_RESET:
num = 0;
case BIO_C_FILE_SEEK:
- ret = (long)UP_lseek(b->num, num, 0);
+ ret = (long)lseek(b->num, num, 0);
break;
case BIO_C_FILE_TELL:
case BIO_CTRL_INFO:
- ret = (long)UP_lseek(b->num, 0, 1);
+ ret = (long)lseek(b->num, 0, 1);
break;
case BIO_C_SET_FD:
fd_free(b);
#include <stdio.h>
#include <errno.h>
#include "cryptlib.h"
-#include "bio_lcl.h"
+#include <openssl/bio.h>
#include <openssl/err.h>
#if !defined(OPENSSL_NO_STDIO)
return (NULL);
}
- BIO_clear_flags(ret, BIO_FLAGS_UPLINK); /* we did fopen -> we disengage UPLINK */
BIO_set_fp(ret, file, BIO_CLOSE);
return (ret);
}
if ((ret = BIO_new(BIO_s_file())) == NULL)
return (NULL);
- BIO_set_flags(ret, BIO_FLAGS_UPLINK); /* redundant, left for documentation puposes */
BIO_set_fp(ret, stream, close_flag);
return (ret);
}
bi->init = 0;
bi->num = 0;
bi->ptr = NULL;
- bi->flags=BIO_FLAGS_UPLINK; /* default to UPLINK */
+ bi->flags=0;
return (1);
}
return (0);
if (a->shutdown) {
if ((a->init) && (a->ptr != NULL)) {
- if (a->flags&BIO_FLAGS_UPLINK)
- UP_fclose (a->ptr);
- else
- fclose (a->ptr);
+ fclose (a->ptr);
a->ptr = NULL;
- a->flags = BIO_FLAGS_UPLINK;
+ a->flags = 0;
}
a->init = 0;
}
int ret = 0;
if (b->init && (out != NULL)) {
- if (b->flags&BIO_FLAGS_UPLINK)
- ret = UP_fread(out, 1,(int)outl, b->ptr);
- else
- ret = fread(out, 1,(int)outl,(FILE *)b->ptr);
- if (ret == 0 && (b->flags & BIO_FLAGS_UPLINK) ?
- UP_ferror((FILE *)b->ptr) : ferror((FILE *)b->ptr)) {
+ ret = fread(out, 1,(int)outl,(FILE *)b->ptr);
+ if (ret == 0 && ferror((FILE *)b->ptr)) {
SYSerr(SYS_F_FREAD, errno);
BIOerr(BIO_F_FILE_READ, ERR_R_SYS_LIB);
ret = -1;
int ret = 0;
if (b->init && (in != NULL)) {
- if (b->flags&BIO_FLAGS_UPLINK)
- ret = UP_fwrite(in,(int)inl, 1, b->ptr);
- else
- ret = fwrite(in,(int)inl, 1,(FILE *)b->ptr);
+ ret = fwrite(in,(int)inl, 1,(FILE *)b->ptr);
if (ret)
ret = inl;
/* ret=fwrite(in,1,(int)inl,(FILE *)b->ptr); */
switch (cmd) {
case BIO_C_FILE_SEEK:
case BIO_CTRL_RESET:
- if (b->flags&BIO_FLAGS_UPLINK)
- ret = (long)UP_fseek(b->ptr, num, 0);
- else
- ret = (long)fseek(fp, num, 0);
+ ret = (long)fseek(fp, num, 0);
break;
case BIO_CTRL_EOF:
- if (b->flags&BIO_FLAGS_UPLINK)
- ret = (long)UP_feof(fp);
- else
- ret = (long)feof(fp);
+ ret = (long)feof(fp);
break;
case BIO_C_FILE_TELL:
case BIO_CTRL_INFO:
- if (b->flags&BIO_FLAGS_UPLINK)
- ret = UP_ftell(b->ptr);
- else
- ret = ftell(fp);
+ ret = ftell(fp);
break;
case BIO_C_SET_FILE_PTR:
file_free(b);
b->shutdown = (int)num&BIO_CLOSE;
b->ptr = ptr;
b->init = 1;
-#if BIO_FLAGS_UPLINK!=0
-#if defined(_IOB_ENTRIES)
- /* Safety net to catch purely internal BIO_set_fp calls */
- if ((size_t)ptr >= (size_t)stdin &&
- (size_t)ptr < (size_t)(stdin + _IOB_ENTRIES))
- BIO_clear_flags(b, BIO_FLAGS_UPLINK);
-#endif
-#endif
-#ifdef UP_fsetmod
- if (b->flags&BIO_FLAGS_UPLINK)
- UP_fsetmod(b->ptr,(char)((num&BIO_FP_TEXT)?'t':'b'));
-#endif
break;
case BIO_C_SET_FILENAME:
file_free(b);
}
b->ptr = fp;
b->init = 1;
- BIO_clear_flags(b, BIO_FLAGS_UPLINK); /* we did fopen -> we disengage UPLINK */
break;
case BIO_C_GET_FILE_PTR:
/* the ptr parameter is actually a FILE ** in this case. */
b->shutdown = (int)num;
break;
case BIO_CTRL_FLUSH:
- if (b->flags&BIO_FLAGS_UPLINK)
- UP_fflush(b->ptr);
- else
- fflush((FILE *)b->ptr);
+ fflush((FILE *)b->ptr);
break;
case BIO_CTRL_DUP:
ret = 1;
int ret = 0;
buf[0] = '\0';
- if (bp->flags&BIO_FLAGS_UPLINK) {
- if (!UP_fgets(buf, size, bp->ptr))
- goto err;
- } else {
- if (!fgets(buf, size,(FILE *)bp->ptr))
- goto err;
- }
+ if (!fgets(buf, size,(FILE *)bp->ptr))
+ goto err;
if (buf[0] != '\0')
ret = strlen(buf);
err:
#include "e_os.h"
-#ifdef OPENSSL_USE_APPLINK
-#define BIO_FLAGS_UPLINK 0x8000
-#include "ms/uplink.h"
-#endif
-
#include <openssl/crypto.h>
#include <openssl/buffer.h>
#include <openssl/bio.h>