Import upstream version 0.9+1474479173.6c180c60

parent d3819813
/** @file /** @file
TDES Wrapper Implementation over OpenSSL. TDES Wrapper Implementation over OpenSSL.
Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR> Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
...@@ -90,7 +90,7 @@ TdesInit ( ...@@ -90,7 +90,7 @@ TdesInit (
return TRUE; return TRUE;
} }
if (DES_is_weak_key ((const_DES_cblock *) Key + 8) == 1) { if (DES_is_weak_key ((const_DES_cblock *) (Key + 8)) == 1) {
return FALSE; return FALSE;
} }
...@@ -101,7 +101,7 @@ TdesInit ( ...@@ -101,7 +101,7 @@ TdesInit (
return TRUE; return TRUE;
} }
if (DES_is_weak_key ((const_DES_cblock *) Key + 16) == 1) { if (DES_is_weak_key ((const_DES_cblock *) (Key + 16)) == 1) {
return FALSE; return FALSE;
} }
......
...@@ -56,7 +56,7 @@ Md5Init ( ...@@ -56,7 +56,7 @@ Md5Init (
// //
// Check input parameters. // Check input parameters.
// //
if ((Md5Context == NULL)) { if (Md5Context == NULL) {
return FALSE; return FALSE;
} }
......
...@@ -25,6 +25,31 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. ...@@ -25,6 +25,31 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#define CONST const #define CONST const
//
// OpenSSL relies on explicit configuration for word size in crypto/bn,
// but we want it to be automatically inferred from the target. So we
// bypass what's in <openssl/opensslconf.h> for OPENSSL_SYS_UEFI, and
// define our own here.
//
#ifdef CONFIG_HEADER_BN_H
#error CONFIG_HEADER_BN_H already defined
#endif
#define CONFIG_HEADER_BN_H
#if defined(MDE_CPU_X64) || defined(MDE_CPU_AARCH64) || defined(MDE_CPU_IA64)
//
// With GCC we would normally use SIXTY_FOUR_BIT_LONG, but MSVC needs
// SIXTY_FOUR_BIT, because 'long' is 32-bit and only 'long long' is
// 64-bit. Since using 'long long' works fine on GCC too, just do that.
//
#define SIXTY_FOUR_BIT
#elif defined(MDE_CPU_IA32) || defined(MDE_CPU_ARM) || defined(MDE_CPU_EBC)
#define THIRTY_TWO_BIT
#else
#error Unknown target architecture
#endif
// //
// File operations are not required for building Open SSL, // File operations are not required for building Open SSL,
// so FILE is mapped to VOID * to pass build // so FILE is mapped to VOID * to pass build
...@@ -211,7 +236,7 @@ struct tm { ...@@ -211,7 +236,7 @@ struct tm {
struct timeval { struct timeval {
long tv_sec; /* time value, in seconds */ long tv_sec; /* time value, in seconds */
long tv_usec; /* time value, in microseconds */ long tv_usec; /* time value, in microseconds */
} timeval; };
struct dirent { struct dirent {
UINT32 d_fileno; /* file number of entry */ UINT32 d_fileno; /* file number of entry */
......
/* crypto/aes/aes.h -*- mode:C; c-file-style: "eay" -*- */ /* crypto/aes/aes.h */
/* ==================================================================== /* ====================================================================
* Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
* *
......
...@@ -70,7 +70,7 @@ extern "C" { ...@@ -70,7 +70,7 @@ extern "C" {
# endif # endif
# define ASN1_MAC_H_err(f,r,line) \ # define ASN1_MAC_H_err(f,r,line) \
ERR_PUT_error(ASN1_MAC_ERR_LIB,(f),(r),__FILE__,(line)) ERR_PUT_error(ASN1_MAC_ERR_LIB,(f),(r),OPENSSL_FILE,(line))
# define M_ASN1_D2I_vars(a,type,func) \ # define M_ASN1_D2I_vars(a,type,func) \
ASN1_const_CTX c; \ ASN1_const_CTX c; \
...@@ -81,7 +81,7 @@ extern "C" { ...@@ -81,7 +81,7 @@ extern "C" {
c.error=ERR_R_NESTED_ASN1_ERROR; \ c.error=ERR_R_NESTED_ASN1_ERROR; \
if ((a == NULL) || ((*a) == NULL)) \ if ((a == NULL) || ((*a) == NULL)) \
{ if ((ret=(type)func()) == NULL) \ { if ((ret=(type)func()) == NULL) \
{ c.line=__LINE__; goto err; } } \ { c.line=OPENSSL_LINE; goto err; } } \
else ret=(*a); else ret=(*a);
# define M_ASN1_D2I_Init() \ # define M_ASN1_D2I_Init() \
...@@ -90,7 +90,7 @@ extern "C" { ...@@ -90,7 +90,7 @@ extern "C" {
# define M_ASN1_D2I_Finish_2(a) \ # define M_ASN1_D2I_Finish_2(a) \
if (!asn1_const_Finish(&c)) \ if (!asn1_const_Finish(&c)) \
{ c.line=__LINE__; goto err; } \ { c.line=OPENSSL_LINE; goto err; } \
*(const unsigned char **)pp=c.p; \ *(const unsigned char **)pp=c.p; \
if (a != NULL) (*a)=ret; \ if (a != NULL) (*a)=ret; \
return(ret); return(ret);
...@@ -105,7 +105,7 @@ err:\ ...@@ -105,7 +105,7 @@ err:\
# define M_ASN1_D2I_start_sequence() \ # define M_ASN1_D2I_start_sequence() \
if (!asn1_GetSequence(&c,&length)) \ if (!asn1_GetSequence(&c,&length)) \
{ c.line=__LINE__; goto err; } { c.line=OPENSSL_LINE; goto err; }
/* Begin reading ASN1 without a surrounding sequence */ /* Begin reading ASN1 without a surrounding sequence */
# define M_ASN1_D2I_begin() \ # define M_ASN1_D2I_begin() \
c.slen = length; c.slen = length;
...@@ -129,21 +129,21 @@ err:\ ...@@ -129,21 +129,21 @@ err:\
# define M_ASN1_D2I_get(b, func) \ # define M_ASN1_D2I_get(b, func) \
c.q=c.p; \ c.q=c.p; \
if (func(&(b),&c.p,c.slen) == NULL) \ if (func(&(b),&c.p,c.slen) == NULL) \
{c.line=__LINE__; goto err; } \ {c.line=OPENSSL_LINE; goto err; } \
c.slen-=(c.p-c.q); c.slen-=(c.p-c.q);
/* Don't use this with d2i_ASN1_BOOLEAN() */ /* Don't use this with d2i_ASN1_BOOLEAN() */
# define M_ASN1_D2I_get_x(type,b,func) \ # define M_ASN1_D2I_get_x(type,b,func) \
c.q=c.p; \ c.q=c.p; \
if (((D2I_OF(type))func)(&(b),&c.p,c.slen) == NULL) \ if (((D2I_OF(type))func)(&(b),&c.p,c.slen) == NULL) \
{c.line=__LINE__; goto err; } \ {c.line=OPENSSL_LINE; goto err; } \
c.slen-=(c.p-c.q); c.slen-=(c.p-c.q);
/* use this instead () */ /* use this instead () */
# define M_ASN1_D2I_get_int(b,func) \ # define M_ASN1_D2I_get_int(b,func) \
c.q=c.p; \ c.q=c.p; \
if (func(&(b),&c.p,c.slen) < 0) \ if (func(&(b),&c.p,c.slen) < 0) \
{c.line=__LINE__; goto err; } \ {c.line=OPENSSL_LINE; goto err; } \
c.slen-=(c.p-c.q); c.slen-=(c.p-c.q);
# define M_ASN1_D2I_get_opt(b,func,type) \ # define M_ASN1_D2I_get_opt(b,func,type) \
...@@ -164,7 +164,7 @@ err:\ ...@@ -164,7 +164,7 @@ err:\
M_ASN1_next=(_tmp& V_ASN1_CONSTRUCTED)|type; \ M_ASN1_next=(_tmp& V_ASN1_CONSTRUCTED)|type; \
c.q=c.p; \ c.q=c.p; \
if (func(&(b),&c.p,c.slen) == NULL) \ if (func(&(b),&c.p,c.slen) == NULL) \
{c.line=__LINE__; M_ASN1_next_prev = _tmp; goto err; } \ {c.line=OPENSSL_LINE; M_ASN1_next_prev = _tmp; goto err; } \
c.slen-=(c.p-c.q);\ c.slen-=(c.p-c.q);\
M_ASN1_next_prev=_tmp; M_ASN1_next_prev=_tmp;
...@@ -258,20 +258,20 @@ err:\ ...@@ -258,20 +258,20 @@ err:\
c.q=c.p; \ c.q=c.p; \
if (d2i_ASN1_SET(&(r),&c.p,c.slen,(char *(*)())func,\ if (d2i_ASN1_SET(&(r),&c.p,c.slen,(char *(*)())func,\
(void (*)())free_func,a,b) == NULL) \ (void (*)())free_func,a,b) == NULL) \
{ c.line=__LINE__; goto err; } \ { c.line=OPENSSL_LINE; goto err; } \
c.slen-=(c.p-c.q); c.slen-=(c.p-c.q);
# define M_ASN1_D2I_get_imp_set_type(type,r,func,free_func,a,b) \ # define M_ASN1_D2I_get_imp_set_type(type,r,func,free_func,a,b) \
c.q=c.p; \ c.q=c.p; \
if (d2i_ASN1_SET_OF_##type(&(r),&c.p,c.slen,func,\ if (d2i_ASN1_SET_OF_##type(&(r),&c.p,c.slen,func,\
free_func,a,b) == NULL) \ free_func,a,b) == NULL) \
{ c.line=__LINE__; goto err; } \ { c.line=OPENSSL_LINE; goto err; } \
c.slen-=(c.p-c.q); c.slen-=(c.p-c.q);
# define M_ASN1_D2I_get_set_strings(r,func,a,b) \ # define M_ASN1_D2I_get_set_strings(r,func,a,b) \
c.q=c.p; \ c.q=c.p; \
if (d2i_ASN1_STRING_SET(&(r),&c.p,c.slen,a,b) == NULL) \ if (d2i_ASN1_STRING_SET(&(r),&c.p,c.slen,a,b) == NULL) \
{ c.line=__LINE__; goto err; } \ { c.line=OPENSSL_LINE; goto err; } \
c.slen-=(c.p-c.q); c.slen-=(c.p-c.q);
# define M_ASN1_D2I_get_EXP_opt(r,func,tag) \ # define M_ASN1_D2I_get_EXP_opt(r,func,tag) \
...@@ -285,16 +285,16 @@ err:\ ...@@ -285,16 +285,16 @@ err:\
Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \ Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \
if (Tinf & 0x80) \ if (Tinf & 0x80) \
{ c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \ { c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \
c.line=__LINE__; goto err; } \ c.line=OPENSSL_LINE; goto err; } \
if (Tinf == (V_ASN1_CONSTRUCTED+1)) \ if (Tinf == (V_ASN1_CONSTRUCTED+1)) \
Tlen = c.slen - (c.p - c.q) - 2; \ Tlen = c.slen - (c.p - c.q) - 2; \
if (func(&(r),&c.p,Tlen) == NULL) \ if (func(&(r),&c.p,Tlen) == NULL) \
{ c.line=__LINE__; goto err; } \ { c.line=OPENSSL_LINE; goto err; } \
if (Tinf == (V_ASN1_CONSTRUCTED+1)) { \ if (Tinf == (V_ASN1_CONSTRUCTED+1)) { \
Tlen = c.slen - (c.p - c.q); \ Tlen = c.slen - (c.p - c.q); \
if(!ASN1_const_check_infinite_end(&c.p, Tlen)) \ if(!ASN1_const_check_infinite_end(&c.p, Tlen)) \
{ c.error=ERR_R_MISSING_ASN1_EOS; \ { c.error=ERR_R_MISSING_ASN1_EOS; \
c.line=__LINE__; goto err; } \ c.line=OPENSSL_LINE; goto err; } \
}\ }\
c.slen-=(c.p-c.q); \ c.slen-=(c.p-c.q); \
} }
...@@ -310,18 +310,18 @@ err:\ ...@@ -310,18 +310,18 @@ err:\
Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \ Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \
if (Tinf & 0x80) \ if (Tinf & 0x80) \
{ c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \ { c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \
c.line=__LINE__; goto err; } \ c.line=OPENSSL_LINE; goto err; } \
if (Tinf == (V_ASN1_CONSTRUCTED+1)) \ if (Tinf == (V_ASN1_CONSTRUCTED+1)) \
Tlen = c.slen - (c.p - c.q) - 2; \ Tlen = c.slen - (c.p - c.q) - 2; \
if (d2i_ASN1_SET(&(r),&c.p,Tlen,(char *(*)())func, \ if (d2i_ASN1_SET(&(r),&c.p,Tlen,(char *(*)())func, \
(void (*)())free_func, \ (void (*)())free_func, \
b,V_ASN1_UNIVERSAL) == NULL) \ b,V_ASN1_UNIVERSAL) == NULL) \
{ c.line=__LINE__; goto err; } \ { c.line=OPENSSL_LINE; goto err; } \
if (Tinf == (V_ASN1_CONSTRUCTED+1)) { \ if (Tinf == (V_ASN1_CONSTRUCTED+1)) { \
Tlen = c.slen - (c.p - c.q); \ Tlen = c.slen - (c.p - c.q); \
if(!ASN1_check_infinite_end(&c.p, Tlen)) \ if(!ASN1_check_infinite_end(&c.p, Tlen)) \
{ c.error=ERR_R_MISSING_ASN1_EOS; \ { c.error=ERR_R_MISSING_ASN1_EOS; \
c.line=__LINE__; goto err; } \ c.line=OPENSSL_LINE; goto err; } \
}\ }\
c.slen-=(c.p-c.q); \ c.slen-=(c.p-c.q); \
} }
...@@ -337,17 +337,17 @@ err:\ ...@@ -337,17 +337,17 @@ err:\
Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \ Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \
if (Tinf & 0x80) \ if (Tinf & 0x80) \
{ c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \ { c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \
c.line=__LINE__; goto err; } \ c.line=OPENSSL_LINE; goto err; } \
if (Tinf == (V_ASN1_CONSTRUCTED+1)) \ if (Tinf == (V_ASN1_CONSTRUCTED+1)) \
Tlen = c.slen - (c.p - c.q) - 2; \ Tlen = c.slen - (c.p - c.q) - 2; \
if (d2i_ASN1_SET_OF_##type(&(r),&c.p,Tlen,func, \ if (d2i_ASN1_SET_OF_##type(&(r),&c.p,Tlen,func, \
free_func,b,V_ASN1_UNIVERSAL) == NULL) \ free_func,b,V_ASN1_UNIVERSAL) == NULL) \
{ c.line=__LINE__; goto err; } \ { c.line=OPENSSL_LINE; goto err; } \
if (Tinf == (V_ASN1_CONSTRUCTED+1)) { \ if (Tinf == (V_ASN1_CONSTRUCTED+1)) { \
Tlen = c.slen - (c.p - c.q); \ Tlen = c.slen - (c.p - c.q); \
if(!ASN1_check_infinite_end(&c.p, Tlen)) \ if(!ASN1_check_infinite_end(&c.p, Tlen)) \
{ c.error=ERR_R_MISSING_ASN1_EOS; \ { c.error=ERR_R_MISSING_ASN1_EOS; \
c.line=__LINE__; goto err; } \ c.line=OPENSSL_LINE; goto err; } \
}\ }\
c.slen-=(c.p-c.q); \ c.slen-=(c.p-c.q); \
} }
...@@ -355,7 +355,7 @@ err:\ ...@@ -355,7 +355,7 @@ err:\
/* New macros */ /* New macros */
# define M_ASN1_New_Malloc(ret,type) \ # define M_ASN1_New_Malloc(ret,type) \
if ((ret=(type *)OPENSSL_malloc(sizeof(type))) == NULL) \ if ((ret=(type *)OPENSSL_malloc(sizeof(type))) == NULL) \
{ c.line=__LINE__; goto err2; } { c.line=OPENSSL_LINE; goto err2; }
# define M_ASN1_New(arg,func) \ # define M_ASN1_New(arg,func) \
if (((arg)=func()) == NULL) return(NULL) if (((arg)=func()) == NULL) return(NULL)
......
...@@ -479,11 +479,11 @@ struct bio_dgram_sctp_prinfo { ...@@ -479,11 +479,11 @@ struct bio_dgram_sctp_prinfo {
# define BIO_get_conn_hostname(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,0) # define BIO_get_conn_hostname(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,0)
# define BIO_get_conn_port(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,1) # define BIO_get_conn_port(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,1)
# define BIO_get_conn_ip(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,2) # define BIO_get_conn_ip(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,2)
# define BIO_get_conn_int_port(b) BIO_int_ctrl(b,BIO_C_GET_CONNECT,3,0) # define BIO_get_conn_int_port(b) BIO_ctrl(b,BIO_C_GET_CONNECT,3,NULL)
# define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) # define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL)
/* BIO_s_accept_socket() */ /* BIO_s_accept() */
# define BIO_set_accept_port(b,name) BIO_ctrl(b,BIO_C_SET_ACCEPT,0,(char *)name) # define BIO_set_accept_port(b,name) BIO_ctrl(b,BIO_C_SET_ACCEPT,0,(char *)name)
# define BIO_get_accept_port(b) BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,0) # define BIO_get_accept_port(b) BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,0)
/* #define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) */ /* #define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) */
...@@ -496,6 +496,7 @@ struct bio_dgram_sctp_prinfo { ...@@ -496,6 +496,7 @@ struct bio_dgram_sctp_prinfo {
# define BIO_set_bind_mode(b,mode) BIO_ctrl(b,BIO_C_SET_BIND_MODE,mode,NULL) # define BIO_set_bind_mode(b,mode) BIO_ctrl(b,BIO_C_SET_BIND_MODE,mode,NULL)
# define BIO_get_bind_mode(b,mode) BIO_ctrl(b,BIO_C_GET_BIND_MODE,0,NULL) # define BIO_get_bind_mode(b,mode) BIO_ctrl(b,BIO_C_GET_BIND_MODE,0,NULL)
/* BIO_s_accept() and BIO_s_connect() */
# define BIO_do_connect(b) BIO_do_handshake(b) # define BIO_do_connect(b) BIO_do_handshake(b)
# define BIO_do_accept(b) BIO_do_handshake(b) # define BIO_do_accept(b) BIO_do_handshake(b)
# define BIO_do_handshake(b) BIO_ctrl(b,BIO_C_DO_STATE_MACHINE,0,NULL) # define BIO_do_handshake(b) BIO_ctrl(b,BIO_C_DO_STATE_MACHINE,0,NULL)
...@@ -515,12 +516,15 @@ struct bio_dgram_sctp_prinfo { ...@@ -515,12 +516,15 @@ struct bio_dgram_sctp_prinfo {
# define BIO_get_url(b,url) BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,2,(char *)(url)) # define BIO_get_url(b,url) BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,2,(char *)(url))
# define BIO_get_no_connect_return(b) BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,5,NULL) # define BIO_get_no_connect_return(b) BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,5,NULL)
/* BIO_s_datagram(), BIO_s_fd(), BIO_s_socket(), BIO_s_accept() and BIO_s_connect() */
# define BIO_set_fd(b,fd,c) BIO_int_ctrl(b,BIO_C_SET_FD,c,fd) # define BIO_set_fd(b,fd,c) BIO_int_ctrl(b,BIO_C_SET_FD,c,fd)
# define BIO_get_fd(b,c) BIO_ctrl(b,BIO_C_GET_FD,0,(char *)c) # define BIO_get_fd(b,c) BIO_ctrl(b,BIO_C_GET_FD,0,(char *)c)
/* BIO_s_file() */
# define BIO_set_fp(b,fp,c) BIO_ctrl(b,BIO_C_SET_FILE_PTR,c,(char *)fp) # define BIO_set_fp(b,fp,c) BIO_ctrl(b,BIO_C_SET_FILE_PTR,c,(char *)fp)
# define BIO_get_fp(b,fpp) BIO_ctrl(b,BIO_C_GET_FILE_PTR,0,(char *)fpp) # define BIO_get_fp(b,fpp) BIO_ctrl(b,BIO_C_GET_FILE_PTR,0,(char *)fpp)
/* BIO_s_fd() and BIO_s_file() */
# define BIO_seek(b,ofs) (int)BIO_ctrl(b,BIO_C_FILE_SEEK,ofs,NULL) # define BIO_seek(b,ofs) (int)BIO_ctrl(b,BIO_C_FILE_SEEK,ofs,NULL)
# define BIO_tell(b) (int)BIO_ctrl(b,BIO_C_FILE_TELL,0,NULL) # define BIO_tell(b) (int)BIO_ctrl(b,BIO_C_FILE_TELL,0,NULL)
...@@ -646,10 +650,10 @@ int BIO_asn1_set_suffix(BIO *b, asn1_ps_func *suffix, ...@@ -646,10 +650,10 @@ int BIO_asn1_set_suffix(BIO *b, asn1_ps_func *suffix,
int BIO_asn1_get_suffix(BIO *b, asn1_ps_func **psuffix, int BIO_asn1_get_suffix(BIO *b, asn1_ps_func **psuffix,
asn1_ps_func **psuffix_free); asn1_ps_func **psuffix_free);
# ifndef OPENSSL_NO_FP_API
BIO_METHOD *BIO_s_file(void); BIO_METHOD *BIO_s_file(void);
BIO *BIO_new_file(const char *filename, const char *mode); BIO *BIO_new_file(const char *filename, const char *mode);
BIO *BIO_new_fp(FILE *stream, int close_flag); BIO *BIO_new_fp(FILE *stream, int close_flag);
# ifndef OPENSSL_NO_FP_API
# define BIO_s_file_internal BIO_s_file # define BIO_s_file_internal BIO_s_file
# endif # endif
BIO *BIO_new(BIO_METHOD *type); BIO *BIO_new(BIO_METHOD *type);
...@@ -685,7 +689,7 @@ long BIO_debug_callback(BIO *bio, int cmd, const char *argp, int argi, ...@@ -685,7 +689,7 @@ long BIO_debug_callback(BIO *bio, int cmd, const char *argp, int argi,
long argl, long ret); long argl, long ret);
BIO_METHOD *BIO_s_mem(void); BIO_METHOD *BIO_s_mem(void);
BIO *BIO_new_mem_buf(void *buf, int len); BIO *BIO_new_mem_buf(const void *buf, int len);
BIO_METHOD *BIO_s_socket(void); BIO_METHOD *BIO_s_socket(void);
BIO_METHOD *BIO_s_connect(void); BIO_METHOD *BIO_s_connect(void);
BIO_METHOD *BIO_s_accept(void); BIO_METHOD *BIO_s_accept(void);
...@@ -787,19 +791,11 @@ void BIO_copy_next_retry(BIO *b); ...@@ -787,19 +791,11 @@ void BIO_copy_next_retry(BIO *b);
# else # else
# define __bio_h__attr__(x) # define __bio_h__attr__(x)
# endif # endif
# if defined(OPENSSL_SYS_UEFI)
int EFIAPI BIO_printf(BIO *bio, const char *format, ...)
# else
int BIO_printf(BIO *bio, const char *format, ...) int BIO_printf(BIO *bio, const char *format, ...)
# endif
__bio_h__attr__((__format__(__printf__, 2, 3))); __bio_h__attr__((__format__(__printf__, 2, 3)));
int BIO_vprintf(BIO *bio, const char *format, va_list args) int BIO_vprintf(BIO *bio, const char *format, va_list args)
__bio_h__attr__((__format__(__printf__, 2, 0))); __bio_h__attr__((__format__(__printf__, 2, 0)));
# if defined(OPENSSL_SYS_UEFI)
int EFIAPI BIO_snprintf(char *buf, size_t n, const char *format, ...)
# else
int BIO_snprintf(char *buf, size_t n, const char *format, ...) int BIO_snprintf(char *buf, size_t n, const char *format, ...)
# endif
__bio_h__attr__((__format__(__printf__, 3, 4))); __bio_h__attr__((__format__(__printf__, 3, 4)));
int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args) int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args)
__bio_h__attr__((__format__(__printf__, 3, 0))); __bio_h__attr__((__format__(__printf__, 3, 0)));
......
...@@ -125,6 +125,7 @@ ...@@ -125,6 +125,7 @@
#ifndef HEADER_BN_H #ifndef HEADER_BN_H
# define HEADER_BN_H # define HEADER_BN_H
# include <limits.h>
# include <openssl/e_os2.h> # include <openssl/e_os2.h>
# ifndef OPENSSL_NO_FP_API # ifndef OPENSSL_NO_FP_API
# include <stdio.h> /* FILE */ # include <stdio.h> /* FILE */
...@@ -721,8 +722,17 @@ const BIGNUM *BN_get0_nist_prime_521(void); ...@@ -721,8 +722,17 @@ const BIGNUM *BN_get0_nist_prime_521(void);
/* library internal functions */ /* library internal functions */
# define bn_expand(a,bits) ((((((bits+BN_BITS2-1))/BN_BITS2)) <= (a)->dmax)?\ # define bn_expand(a,bits) \
(a):bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2)) ( \
bits > (INT_MAX - BN_BITS2 + 1) ? \
NULL \
: \
(((bits+BN_BITS2-1)/BN_BITS2) <= (a)->dmax) ? \
(a) \
: \
bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2) \
)
# define bn_wexpand(a,words) (((words) <= (a)->dmax)?(a):bn_expand2((a),(words))) # define bn_wexpand(a,words) (((words) <= (a)->dmax)?(a):bn_expand2((a),(words)))
BIGNUM *bn_expand2(BIGNUM *a, int words); BIGNUM *bn_expand2(BIGNUM *a, int words);
# ifndef OPENSSL_NO_DEPRECATED # ifndef OPENSSL_NO_DEPRECATED
......
...@@ -86,7 +86,13 @@ int BUF_MEM_grow(BUF_MEM *str, size_t len); ...@@ -86,7 +86,13 @@ int BUF_MEM_grow(BUF_MEM *str, size_t len);
int BUF_MEM_grow_clean(BUF_MEM *str, size_t len); int BUF_MEM_grow_clean(BUF_MEM *str, size_t len);
size_t BUF_strnlen(const char *str, size_t maxlen); size_t BUF_strnlen(const char *str, size_t maxlen);
char *BUF_strdup(const char *str); char *BUF_strdup(const char *str);
/*
* Like strndup, but in addition, explicitly guarantees to never read past the
* first |siz| bytes of |str|.
*/
char *BUF_strndup(const char *str, size_t siz); char *BUF_strndup(const char *str, size_t siz);
void *BUF_memdup(const void *data, size_t siz); void *BUF_memdup(const void *data, size_t siz);
void BUF_reverse(unsigned char *out, const unsigned char *in, size_t siz); void BUF_reverse(unsigned char *out, const unsigned char *in, size_t siz);
......
/* crypto/camellia/camellia.h -*- mode:C; c-file-style: "eay" -*- */ /* crypto/camellia/camellia.h */
/* ==================================================================== /* ====================================================================
* Copyright (c) 2006 The OpenSSL Project. All rights reserved. * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
* *
......
...@@ -4,6 +4,10 @@ ...@@ -4,6 +4,10 @@
# include <openssl/crypto.h> # include <openssl/crypto.h>
# ifdef OPENSSL_NO_COMP
# error COMP is disabled.
# endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
......
...@@ -118,8 +118,10 @@ typedef void conf_finish_func (CONF_IMODULE *md); ...@@ -118,8 +118,10 @@ typedef void conf_finish_func (CONF_IMODULE *md);
int CONF_set_default_method(CONF_METHOD *meth); int CONF_set_default_method(CONF_METHOD *meth);
void CONF_set_nconf(CONF *conf, LHASH_OF(CONF_VALUE) *hash); void CONF_set_nconf(CONF *conf, LHASH_OF(CONF_VALUE) *hash);
# ifndef OPENSSL_NO_STDIO
LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *file, LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *file,
long *eline); long *eline);
# endif
# ifndef OPENSSL_NO_FP_API # ifndef OPENSSL_NO_FP_API
LHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp, LHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp,
long *eline); long *eline);
...@@ -133,7 +135,9 @@ char *CONF_get_string(LHASH_OF(CONF_VALUE) *conf, const char *group, ...@@ -133,7 +135,9 @@ char *CONF_get_string(LHASH_OF(CONF_VALUE) *conf, const char *group,
long CONF_get_number(LHASH_OF(CONF_VALUE) *conf, const char *group, long CONF_get_number(LHASH_OF(CONF_VALUE) *conf, const char *group,
const char *name); const char *name);
void CONF_free(LHASH_OF(CONF_VALUE) *conf); void CONF_free(LHASH_OF(CONF_VALUE) *conf);
# ifndef OPENSSL_NO_FP_API
int CONF_dump_fp(LHASH_OF(CONF_VALUE) *conf, FILE *out); int CONF_dump_fp(LHASH_OF(CONF_VALUE) *conf, FILE *out);
# endif
int CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out); int CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out);
void OPENSSL_config(const char *config_name); void OPENSSL_config(const char *config_name);
...@@ -160,7 +164,9 @@ CONF_METHOD *NCONF_XML(void); ...@@ -160,7 +164,9 @@ CONF_METHOD *NCONF_XML(void);
void NCONF_free(CONF *conf); void NCONF_free(CONF *conf);
void NCONF_free_data(CONF *conf); void NCONF_free_data(CONF *conf);
# ifndef OPENSSL_NO_STDIO
int NCONF_load(CONF *conf, const char *file, long *eline); int NCONF_load(CONF *conf, const char *file, long *eline);
# endif
# ifndef OPENSSL_NO_FP_API # ifndef OPENSSL_NO_FP_API
int NCONF_load_fp(CONF *conf, FILE *fp, long *eline); int NCONF_load_fp(CONF *conf, FILE *fp, long *eline);
# endif # endif
...@@ -170,7 +176,9 @@ STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf, ...@@ -170,7 +176,9 @@ STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf,
char *NCONF_get_string(const CONF *conf, const char *group, const char *name); char *NCONF_get_string(const CONF *conf, const char *group, const char *name);
int NCONF_get_number_e(const CONF *conf, const char *group, const char *name, int NCONF_get_number_e(const CONF *conf, const char *group, const char *name,
long *result); long *result);
# ifndef OPENSSL_NO_FP_API
int NCONF_dump_fp(const CONF *conf, FILE *out); int NCONF_dump_fp(const CONF *conf, FILE *out);
# endif
int NCONF_dump_bio(const CONF *conf, BIO *out); int NCONF_dump_bio(const CONF *conf, BIO *out);
# if 0 /* The following function has no error # if 0 /* The following function has no error
...@@ -184,8 +192,10 @@ long NCONF_get_number(CONF *conf, char *group, char *name); ...@@ -184,8 +192,10 @@ long NCONF_get_number(CONF *conf, char *group, char *name);
int CONF_modules_load(const CONF *cnf, const char *appname, int CONF_modules_load(const CONF *cnf, const char *appname,
unsigned long flags); unsigned long flags);
# ifndef OPENSSL_NO_STDIO
int CONF_modules_load_file(const char *filename, const char *appname, int CONF_modules_load_file(const char *filename, const char *appname,
unsigned long flags); unsigned long flags);
# endif
void CONF_modules_unload(int all); void CONF_modules_unload(int all);
void CONF_modules_finish(void); void CONF_modules_finish(void);
void CONF_modules_free(void); void CONF_modules_free(void);
......
...@@ -235,15 +235,15 @@ typedef struct openssl_item_st { ...@@ -235,15 +235,15 @@ typedef struct openssl_item_st {
# ifndef OPENSSL_NO_LOCKING # ifndef OPENSSL_NO_LOCKING
# ifndef CRYPTO_w_lock # ifndef CRYPTO_w_lock
# define CRYPTO_w_lock(type) \ # define CRYPTO_w_lock(type) \
CRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,NULL,0) CRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,OPENSSL_FILE,OPENSSL_LINE)
# define CRYPTO_w_unlock(type) \ # define CRYPTO_w_unlock(type) \
CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_WRITE,type,NULL,0) CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_WRITE,type,OPENSSL_FILE,OPENSSL_LINE)
# define CRYPTO_r_lock(type) \ # define CRYPTO_r_lock(type) \
CRYPTO_lock(CRYPTO_LOCK|CRYPTO_READ,type,NULL,0) CRYPTO_lock(CRYPTO_LOCK|CRYPTO_READ,type,OPENSSL_FILE,OPENSSL_LINE)
# define CRYPTO_r_unlock(type) \ # define CRYPTO_r_unlock(type) \
CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_READ,type,NULL,0)