diff options
-rw-r--r-- | lib/libcrypto/arm_arch.h | 2 | ||||
-rw-r--r-- | lib/libcrypto/buildinf.h | 8 | ||||
-rw-r--r-- | lib/libcrypto/crypto.h | 126 | ||||
-rw-r--r-- | lib/libcrypto/md32_common.h | 105 | ||||
-rw-r--r-- | lib/libcrypto/o_str.h | 1 | ||||
-rw-r--r-- | lib/libcrypto/ossl_typ.h | 10 |
6 files changed, 120 insertions, 132 deletions
diff --git a/lib/libcrypto/arm_arch.h b/lib/libcrypto/arm_arch.h index 5a831076800..0ccafb2215a 100644 --- a/lib/libcrypto/arm_arch.h +++ b/lib/libcrypto/arm_arch.h @@ -43,7 +43,7 @@ #if !__ASSEMBLER__ extern unsigned int OPENSSL_armcap_P; - + #define ARMV7_NEON (1<<0) #define ARMV7_TICK (1<<1) #endif diff --git a/lib/libcrypto/buildinf.h b/lib/libcrypto/buildinf.h index 957f09d5fdc..8fdb24cb33a 100644 --- a/lib/libcrypto/buildinf.h +++ b/lib/libcrypto/buildinf.h @@ -1,6 +1,6 @@ #ifndef MK1MF_BUILD - /* auto-generated by crypto/Makefile for crypto/cversion.c */ - #define CFLAGS "cc -O" - #define PLATFORM "dist" - #define DATE "Sat Aug 21 10:52:09 EST 2010" +/* auto-generated by crypto/Makefile for crypto/cversion.c */ +#define CFLAGS "cc -O" +#define PLATFORM "dist" +#define DATE "Sat Aug 21 10:52:09 EST 2010" #endif diff --git a/lib/libcrypto/crypto.h b/lib/libcrypto/crypto.h index 76bc5958c0b..baeba25b996 100644 --- a/lib/libcrypto/crypto.h +++ b/lib/libcrypto/crypto.h @@ -154,23 +154,22 @@ extern "C" { typedef struct crypto_ex_data_st CRYPTO_EX_DATA; /* Called when a new object is created */ typedef int CRYPTO_EX_new(void *parent, void *ptr, CRYPTO_EX_DATA *ad, - int idx, long argl, void *argp); + int idx, long argl, void *argp); /* Called when an object is free()ed */ typedef void CRYPTO_EX_free(void *parent, void *ptr, CRYPTO_EX_DATA *ad, - int idx, long argl, void *argp); + int idx, long argl, void *argp); /* Called when we need to dup an object */ -typedef int CRYPTO_EX_dup(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d, - int idx, long argl, void *argp); +typedef int CRYPTO_EX_dup(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, + void *from_d, int idx, long argl, void *argp); #endif /* A generic structure to pass assorted data in a expandable way */ -typedef struct openssl_item_st - { +typedef struct openssl_item_st { int code; void *value; /* Not used for flag attributes */ size_t value_size; /* Max size of value for output, length for input */ size_t *value_length; /* Returned length of value for output */ - } OPENSSL_ITEM; +} OPENSSL_ITEM; /* When changing the CRYPTO_LOCK_* list, be sure to maintin the text lock @@ -249,11 +248,10 @@ typedef struct openssl_item_st and deallocate locks in a dynamic fashion. The following typedef makes this possible in a type-safe manner. */ /* struct CRYPTO_dynlock_value has to be defined by the application. */ -typedef struct - { +typedef struct { int references; struct CRYPTO_dynlock_value *data; - } CRYPTO_dynlock; +} CRYPTO_dynlock; /* The following can be used to detect memory leaks in the SSLeay library. @@ -278,24 +276,22 @@ typedef struct /* predec of the BIO type */ typedef struct bio_st BIO_dummy; -struct crypto_ex_data_st - { +struct crypto_ex_data_st { STACK_OF(void) *sk; int dummy; /* gcc is screwing up this data structure :-( */ - }; +}; DECLARE_STACK_OF(void) /* This stuff is basically class callback functions * The current classes are SSL_CTX, SSL, SSL_SESSION, and a few more */ -typedef struct crypto_ex_data_func_st - { +typedef struct crypto_ex_data_func_st { long argl; /* Arbitary long */ void *argp; /* Arbitary void * */ CRYPTO_EX_new *new_func; CRYPTO_EX_free *free_func; CRYPTO_EX_dup *dup_func; - } CRYPTO_EX_DATA_FUNCS; +} CRYPTO_EX_DATA_FUNCS; DECLARE_STACK_OF(CRYPTO_EX_DATA_FUNCS) @@ -392,18 +388,18 @@ int CRYPTO_set_ex_data_implementation(const CRYPTO_EX_DATA_IMPL *i); int CRYPTO_ex_data_new_class(void); /* Within a given class, get/register a new index */ int CRYPTO_get_ex_new_index(int class_index, long argl, void *argp, - CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, - CRYPTO_EX_free *free_func); + CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, + CRYPTO_EX_free *free_func); /* Initialise/duplicate/free CRYPTO_EX_DATA variables corresponding to a given * class (invokes whatever per-class callbacks are applicable) */ int CRYPTO_new_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad); int CRYPTO_dup_ex_data(int class_index, CRYPTO_EX_DATA *to, - CRYPTO_EX_DATA *from); + CRYPTO_EX_DATA *from); void CRYPTO_free_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad); /* Get/set data in a CRYPTO_EX_DATA variable corresponding to a particular index * (relative to the class type involved) */ int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int idx, void *val); -void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad,int idx); +void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx); /* This function cleans up all "ex_data" state. It mustn't be called under * potential race-conditions. */ void CRYPTO_cleanup_all_ex_data(void); @@ -411,22 +407,21 @@ void CRYPTO_cleanup_all_ex_data(void); int CRYPTO_get_new_lockid(char *name); int CRYPTO_num_locks(void); /* return CRYPTO_NUM_LOCKS (shared libs!) */ -void CRYPTO_lock(int mode, int type,const char *file,int line); -void CRYPTO_set_locking_callback(void (*func)(int mode,int type, - const char *file,int line)); -void (*CRYPTO_get_locking_callback(void))(int mode,int type,const char *file, - int line); -void CRYPTO_set_add_lock_callback(int (*func)(int *num,int mount,int type, - const char *file, int line)); -int (*CRYPTO_get_add_lock_callback(void))(int *num,int mount,int type, - const char *file,int line); +void CRYPTO_lock(int mode, int type, const char *file, int line); +void CRYPTO_set_locking_callback(void (*func)(int mode, int type, + const char *file, int line)); +void (*CRYPTO_get_locking_callback(void))(int mode, int type, + const char *file, int line); +void CRYPTO_set_add_lock_callback(int (*func)(int *num, int mount, int type, + const char *file, int line)); +int (*CRYPTO_get_add_lock_callback(void))(int *num, int mount, int type, + const char *file, int line); /* Don't use this structure directly. */ -typedef struct crypto_threadid_st - { +typedef struct crypto_threadid_st { void *ptr; unsigned long val; - } CRYPTO_THREADID; +} CRYPTO_THREADID; /* Only use CRYPTO_THREADID_set_[numeric|pointer]() within callbacks */ void CRYPTO_THREADID_set_numeric(CRYPTO_THREADID *id, unsigned long val); void CRYPTO_THREADID_set_pointer(CRYPTO_THREADID *id, void *ptr); @@ -443,8 +438,8 @@ unsigned long CRYPTO_thread_id(void); #endif const char *CRYPTO_get_lock_name(int type); -int CRYPTO_add_lock(int *pointer,int amount,int type, const char *file, - int line); +int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file, + int line); int CRYPTO_get_new_dynlockid(void); void CRYPTO_destroy_dynlockid(int i); @@ -452,46 +447,43 @@ struct CRYPTO_dynlock_value *CRYPTO_get_dynlock_value(int i); void CRYPTO_set_dynlock_create_callback(struct CRYPTO_dynlock_value *(*dyn_create_function)(const char *file, int line)); void CRYPTO_set_dynlock_lock_callback(void (*dyn_lock_function)(int mode, struct CRYPTO_dynlock_value *l, const char *file, int line)); void CRYPTO_set_dynlock_destroy_callback(void (*dyn_destroy_function)(struct CRYPTO_dynlock_value *l, const char *file, int line)); -struct CRYPTO_dynlock_value *(*CRYPTO_get_dynlock_create_callback(void))(const char *file,int line); -void (*CRYPTO_get_dynlock_lock_callback(void))(int mode, struct CRYPTO_dynlock_value *l, const char *file,int line); -void (*CRYPTO_get_dynlock_destroy_callback(void))(struct CRYPTO_dynlock_value *l, const char *file,int line); +struct CRYPTO_dynlock_value *(*CRYPTO_get_dynlock_create_callback(void))(const char *file, int line); +void (*CRYPTO_get_dynlock_lock_callback(void))(int mode, struct CRYPTO_dynlock_value *l, const char *file, int line); +void (*CRYPTO_get_dynlock_destroy_callback(void))(struct CRYPTO_dynlock_value *l, const char *file, int line); /* CRYPTO_set_mem_functions includes CRYPTO_set_locked_mem_functions -- * call the latter last if you need different functions */ -int CRYPTO_set_mem_functions(void *(*m)(size_t),void *(*r)(void *,size_t), void (*f)(void *)); +int CRYPTO_set_mem_functions(void *(*m)(size_t), void *(*r)(void *, size_t), void (*f)(void *)); int CRYPTO_set_locked_mem_functions(void *(*m)(size_t), void (*free_func)(void *)); -int CRYPTO_set_mem_ex_functions(void *(*m)(size_t,const char *,int), - void *(*r)(void *,size_t,const char *,int), - void (*f)(void *)); -int CRYPTO_set_locked_mem_ex_functions(void *(*m)(size_t,const char *,int), - void (*free_func)(void *)); -int CRYPTO_set_mem_debug_functions(void (*m)(void *,int,const char *,int,int), - void (*r)(void *,void *,int,const char *,int,int), - void (*f)(void *,int), - void (*so)(long), - long (*go)(void)); -void CRYPTO_get_mem_functions(void *(**m)(size_t),void *(**r)(void *, size_t), void (**f)(void *)); +int CRYPTO_set_mem_ex_functions(void *(*m)(size_t, const char *, int), + void *(*r)(void *, size_t, const char *, int), void (*f)(void *)); +int CRYPTO_set_locked_mem_ex_functions(void *(*m)(size_t, const char *, int), + void (*free_func)(void *)); +int CRYPTO_set_mem_debug_functions( + void (*m)(void *, int, const char *, int, int), + void (*r)(void *, void *, int, const char *, int, int), + void (*f)(void *, int), void (*so)(long), long (*go)(void)); +void CRYPTO_get_mem_functions(void *(**m)(size_t), void *(**r)(void *, size_t), + void (**f)(void *)); void CRYPTO_get_locked_mem_functions(void *(**m)(size_t), void (**f)(void *)); -void CRYPTO_get_mem_ex_functions(void *(**m)(size_t,const char *,int), - void *(**r)(void *, size_t,const char *,int), - void (**f)(void *)); -void CRYPTO_get_locked_mem_ex_functions(void *(**m)(size_t,const char *,int), - void (**f)(void *)); -void CRYPTO_get_mem_debug_functions(void (**m)(void *,int,const char *,int,int), - void (**r)(void *,void *,int,const char *,int,int), - void (**f)(void *,int), - void (**so)(long), - long (**go)(void)); +void CRYPTO_get_mem_ex_functions(void *(**m)(size_t, const char *, int), + void *(**r)(void *, size_t, const char *, int), void (**f)(void *)); +void CRYPTO_get_locked_mem_ex_functions(void *(**m)(size_t, const char *, int), + void (**f)(void *)); +void CRYPTO_get_mem_debug_functions( + void (**m)(void *, int, const char *, int, int), + void (**r)(void *, void *, int, const char *, int, int), + void (**f)(void *, int), void (**so)(long), long (**go)(void)); void *CRYPTO_malloc_locked(int num, const char *file, int line); void CRYPTO_free_locked(void *ptr); void *CRYPTO_malloc(int num, const char *file, int line); char *CRYPTO_strdup(const char *str, const char *file, int line); void CRYPTO_free(void *ptr); -void *CRYPTO_realloc(void *addr,int num, const char *file, int line); -void *CRYPTO_realloc_clean(void *addr,int old_num,int num,const char *file, - int line); -void *CRYPTO_remalloc(void *addr,int num, const char *file, int line); +void *CRYPTO_realloc(void *addr, int num, const char *file, int line); +void *CRYPTO_realloc_clean(void *addr, int old_num, int num, + const char *file, int line); +void *CRYPTO_remalloc(void *addr, int num, const char *file, int line); void OPENSSL_cleanse(void *ptr, size_t len); @@ -512,9 +504,9 @@ int CRYPTO_remove_all_info(void); * 0: called before the actual memory allocation has taken place * 1: called after the actual memory allocation has taken place */ -void CRYPTO_dbg_malloc(void *addr,int num,const char *file,int line,int before_p); -void CRYPTO_dbg_realloc(void *addr1,void *addr2,int num,const char *file,int line,int before_p); -void CRYPTO_dbg_free(void *addr,int before_p); +void CRYPTO_dbg_malloc(void *addr, int num, const char *file, int line, int before_p); +void CRYPTO_dbg_realloc(void *addr1, void *addr2, int num, const char *file, int line, int before_p); +void CRYPTO_dbg_free(void *addr, int before_p); /* Tell the debugging code about options. By default, the following values * apply: * @@ -536,7 +528,7 @@ typedef void *CRYPTO_MEM_LEAK_CB(unsigned long, const char *, int, int, void *); void CRYPTO_mem_leaks_cb(CRYPTO_MEM_LEAK_CB *cb); /* die if we have to */ -void OpenSSLDie(const char *file,int line,const char *assertion); +void OpenSSLDie(const char *file, int line, const char *assertion); #define OPENSSL_assert(e) (void)((e) ? 0 : (OpenSSLDie(__FILE__, __LINE__, #e),1)) unsigned long *OPENSSL_ia32cap_loc(void); diff --git a/lib/libcrypto/md32_common.h b/lib/libcrypto/md32_common.h index bb7381952a2..bfb610e8022 100644 --- a/lib/libcrypto/md32_common.h +++ b/lib/libcrypto/md32_common.h @@ -148,7 +148,7 @@ # if defined(__POWERPC__) # define ROTATE(a,n) __rlwinm(a,n,0,31) # elif defined(__MC68K__) - /* Motorola specific tweak. <appro@fy.chalmers.se> */ +/* Motorola specific tweak. <appro@fy.chalmers.se> */ # define ROTATE(a,n) ( n<24 ? __rol(a,n) : __ror(a,32-n) ) # else # define ROTATE(a,n) __rol(a,n) @@ -252,7 +252,7 @@ #endif #if defined(__i386) || defined(__i386__) || defined(__x86_64) || defined(__x86_64__) # ifndef B_ENDIAN - /* See comment in DATA_ORDER_IS_BIG_ENDIAN section. */ +/* See comment in DATA_ORDER_IS_BIG_ENDIAN section. */ # define HOST_c2l(c,l) ((l)=*((const unsigned int *)(c)), (c)+=4, l) # define HOST_l2c(l,c) (*((unsigned int *)(c))=(l), (c)+=4, l) # endif @@ -279,108 +279,103 @@ * Time for some action:-) */ -int HASH_UPDATE (HASH_CTX *c, const void *data_, size_t len) - { - const unsigned char *data=data_; +int +HASH_UPDATE(HASH_CTX *c, const void *data_, size_t len) +{ + const unsigned char *data = data_; unsigned char *p; HASH_LONG l; size_t n; - if (len==0) return 1; + if (len == 0) + return 1; - l=(c->Nl+(((HASH_LONG)len)<<3))&0xffffffffUL; + l = (c->Nl + (((HASH_LONG)len) << 3))&0xffffffffUL; /* 95-05-24 eay Fixed a bug with the overflow handling, thanks to * Wei Dai <weidai@eskimo.com> for pointing it out. */ if (l < c->Nl) /* overflow */ c->Nh++; c->Nh+=(HASH_LONG)(len>>29); /* might cause compiler warning on 16-bit */ - c->Nl=l; + c->Nl = l; n = c->num; - if (n != 0) - { - p=(unsigned char *)c->data; - - if (len >= HASH_CBLOCK || len+n >= HASH_CBLOCK) - { - memcpy (p+n,data,HASH_CBLOCK-n); - HASH_BLOCK_DATA_ORDER (c,p,1); - n = HASH_CBLOCK-n; - data += n; - len -= n; + if (n != 0) { + p = (unsigned char *)c->data; + + if (len >= HASH_CBLOCK || len + n >= HASH_CBLOCK) { + memcpy (p + n, data, HASH_CBLOCK - n); + HASH_BLOCK_DATA_ORDER (c, p, 1); + n = HASH_CBLOCK - n; + data += n; + len -= n; c->num = 0; memset (p,0,HASH_CBLOCK); /* keep it zeroed */ - } - else - { - memcpy (p+n,data,len); + } else { + memcpy (p + n, data, len); c->num += (unsigned int)len; return 1; - } } + } n = len/HASH_CBLOCK; - if (n > 0) - { - HASH_BLOCK_DATA_ORDER (c,data,n); + if (n > 0) { + HASH_BLOCK_DATA_ORDER (c, data, n); n *= HASH_CBLOCK; data += n; - len -= n; - } + len -= n; + } - if (len != 0) - { + if (len != 0) { p = (unsigned char *)c->data; c->num = (unsigned int)len; - memcpy (p,data,len); - } - return 1; + memcpy (p, data, len); } + return 1; +} void HASH_TRANSFORM (HASH_CTX *c, const unsigned char *data) - { - HASH_BLOCK_DATA_ORDER (c,data,1); - } +{ + HASH_BLOCK_DATA_ORDER (c, data, 1); +} int HASH_FINAL (unsigned char *md, HASH_CTX *c) - { +{ unsigned char *p = (unsigned char *)c->data; size_t n = c->num; p[n] = 0x80; /* there is always room for one */ n++; - if (n > (HASH_CBLOCK-8)) - { - memset (p+n,0,HASH_CBLOCK-n); - n=0; - HASH_BLOCK_DATA_ORDER (c,p,1); - } - memset (p+n,0,HASH_CBLOCK-8-n); + if (n > (HASH_CBLOCK - 8)) { + memset (p + n, 0, HASH_CBLOCK - n); + n = 0; + HASH_BLOCK_DATA_ORDER (c, p, 1); + } + memset (p + n, 0, HASH_CBLOCK - 8 - n); - p += HASH_CBLOCK-8; + p += HASH_CBLOCK - 8; #if defined(DATA_ORDER_IS_BIG_ENDIAN) - (void)HOST_l2c(c->Nh,p); - (void)HOST_l2c(c->Nl,p); + (void)HOST_l2c(c->Nh, p); + (void)HOST_l2c(c->Nl, p); #elif defined(DATA_ORDER_IS_LITTLE_ENDIAN) - (void)HOST_l2c(c->Nl,p); - (void)HOST_l2c(c->Nh,p); + (void)HOST_l2c(c->Nl, p); + (void)HOST_l2c(c->Nh, p); #endif p -= HASH_CBLOCK; - HASH_BLOCK_DATA_ORDER (c,p,1); - c->num=0; - memset (p,0,HASH_CBLOCK); + HASH_BLOCK_DATA_ORDER (c, p, 1); + c->num = 0; + memset (p, 0, HASH_CBLOCK); #ifndef HASH_MAKE_STRING #error "HASH_MAKE_STRING must be defined!" #else - HASH_MAKE_STRING(c,md); + HASH_MAKE_STRING(c, md); #endif return 1; - } +} #ifndef MD32_REG_T #if defined(__alpha) || defined(__sparcv9) || defined(__mips) diff --git a/lib/libcrypto/o_str.h b/lib/libcrypto/o_str.h index 4a70a9e00ba..e2a3fde299b 100644 --- a/lib/libcrypto/o_str.h +++ b/lib/libcrypto/o_str.h @@ -63,5 +63,6 @@ int OPENSSL_strcasecmp(const char *str1, const char *str2); int OPENSSL_strncasecmp(const char *str1, const char *str2, size_t n); +int OPENSSL_memcmp(const void *p1, const void *p2, size_t n); #endif diff --git a/lib/libcrypto/ossl_typ.h b/lib/libcrypto/ossl_typ.h index ea9227f6f95..ae79bf8ae48 100644 --- a/lib/libcrypto/ossl_typ.h +++ b/lib/libcrypto/ossl_typ.h @@ -182,18 +182,18 @@ typedef struct DIST_POINT_st DIST_POINT; typedef struct ISSUING_DIST_POINT_st ISSUING_DIST_POINT; typedef struct NAME_CONSTRAINTS_st NAME_CONSTRAINTS; - /* If placed in pkcs12.h, we end up with a circular depency with pkcs7.h */ +/* If placed in pkcs12.h, we end up with a circular depency with pkcs7.h */ #define DECLARE_PKCS12_STACK_OF(type) /* Nothing */ #define IMPLEMENT_PKCS12_STACK_OF(type) /* Nothing */ typedef struct crypto_ex_data_st CRYPTO_EX_DATA; /* Callback types for crypto.h */ typedef int CRYPTO_EX_new(void *parent, void *ptr, CRYPTO_EX_DATA *ad, - int idx, long argl, void *argp); + int idx, long argl, void *argp); typedef void CRYPTO_EX_free(void *parent, void *ptr, CRYPTO_EX_DATA *ad, - int idx, long argl, void *argp); -typedef int CRYPTO_EX_dup(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d, - int idx, long argl, void *argp); + int idx, long argl, void *argp); +typedef int CRYPTO_EX_dup(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, + void *from_d, int idx, long argl, void *argp); typedef struct ocsp_req_ctx_st OCSP_REQ_CTX; typedef struct ocsp_response_st OCSP_RESPONSE; |