epoc32/include/stdapis/openssl/crypto.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
permissions -rw-r--r--
Final list of Symbian^2 public API header files
williamr@2
     1
/* crypto/crypto.h */
williamr@2
     2
/* ====================================================================
williamr@2
     3
 * Copyright (c) 1998-2003 The OpenSSL Project.  All rights reserved.
williamr@2
     4
 *
williamr@2
     5
 * Redistribution and use in source and binary forms, with or without
williamr@2
     6
 * modification, are permitted provided that the following conditions
williamr@2
     7
 * are met:
williamr@2
     8
 *
williamr@2
     9
 * 1. Redistributions of source code must retain the above copyright
williamr@2
    10
 *    notice, this list of conditions and the following disclaimer. 
williamr@2
    11
 *
williamr@2
    12
 * 2. Redistributions in binary form must reproduce the above copyright
williamr@2
    13
 *    notice, this list of conditions and the following disclaimer in
williamr@2
    14
 *    the documentation and/or other materials provided with the
williamr@2
    15
 *    distribution.
williamr@2
    16
 *
williamr@2
    17
 * 3. All advertising materials mentioning features or use of this
williamr@2
    18
 *    software must display the following acknowledgment:
williamr@2
    19
 *    "This product includes software developed by the OpenSSL Project
williamr@2
    20
 *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
williamr@2
    21
 *
williamr@2
    22
 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
williamr@2
    23
 *    endorse or promote products derived from this software without
williamr@2
    24
 *    prior written permission. For written permission, please contact
williamr@2
    25
 *    openssl-core@openssl.org.
williamr@2
    26
 *
williamr@2
    27
 * 5. Products derived from this software may not be called "OpenSSL"
williamr@2
    28
 *    nor may "OpenSSL" appear in their names without prior written
williamr@2
    29
 *    permission of the OpenSSL Project.
williamr@2
    30
 *
williamr@2
    31
 * 6. Redistributions of any form whatsoever must retain the following
williamr@2
    32
 *    acknowledgment:
williamr@2
    33
 *    "This product includes software developed by the OpenSSL Project
williamr@2
    34
 *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
williamr@2
    35
 *
williamr@2
    36
 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
williamr@2
    37
 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
williamr@2
    38
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
williamr@2
    39
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
williamr@2
    40
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
williamr@2
    41
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
williamr@2
    42
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
williamr@2
    43
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
williamr@2
    44
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
williamr@2
    45
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
williamr@2
    46
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
williamr@2
    47
 * OF THE POSSIBILITY OF SUCH DAMAGE.
williamr@2
    48
 * ====================================================================
williamr@2
    49
 *
williamr@2
    50
 * This product includes cryptographic software written by Eric Young
williamr@2
    51
 * (eay@cryptsoft.com).  This product includes software written by Tim
williamr@2
    52
 * Hudson (tjh@cryptsoft.com).
williamr@2
    53
 *
williamr@2
    54
 */
williamr@2
    55
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
williamr@2
    56
 * All rights reserved.
williamr@2
    57
 *
williamr@2
    58
 * This package is an SSL implementation written
williamr@2
    59
 * by Eric Young (eay@cryptsoft.com).
williamr@2
    60
 * The implementation was written so as to conform with Netscapes SSL.
williamr@2
    61
 * 
williamr@2
    62
 * This library is free for commercial and non-commercial use as long as
williamr@2
    63
 * the following conditions are aheared to.  The following conditions
williamr@2
    64
 * apply to all code found in this distribution, be it the RC4, RSA,
williamr@2
    65
 * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
williamr@2
    66
 * included with this distribution is covered by the same copyright terms
williamr@2
    67
 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
williamr@2
    68
 * 
williamr@2
    69
 * Copyright remains Eric Young's, and as such any Copyright notices in
williamr@2
    70
 * the code are not to be removed.
williamr@2
    71
 * If this package is used in a product, Eric Young should be given attribution
williamr@2
    72
 * as the author of the parts of the library used.
williamr@2
    73
 * This can be in the form of a textual message at program startup or
williamr@2
    74
 * in documentation (online or textual) provided with the package.
williamr@2
    75
 * 
williamr@2
    76
 * Redistribution and use in source and binary forms, with or without
williamr@2
    77
 * modification, are permitted provided that the following conditions
williamr@2
    78
 * are met:
williamr@2
    79
 * 1. Redistributions of source code must retain the copyright
williamr@2
    80
 *    notice, this list of conditions and the following disclaimer.
williamr@2
    81
 * 2. Redistributions in binary form must reproduce the above copyright
williamr@2
    82
 *    notice, this list of conditions and the following disclaimer in the
williamr@2
    83
 *    documentation and/or other materials provided with the distribution.
williamr@2
    84
 * 3. All advertising materials mentioning features or use of this software
williamr@2
    85
 *    must display the following acknowledgement:
williamr@2
    86
 *    "This product includes cryptographic software written by
williamr@2
    87
 *     Eric Young (eay@cryptsoft.com)"
williamr@2
    88
 *    The word 'cryptographic' can be left out if the rouines from the library
williamr@2
    89
 *    being used are not cryptographic related :-).
williamr@2
    90
 * 4. If you include any Windows specific code (or a derivative thereof) from 
williamr@2
    91
 *    the apps directory (application code) you must include an acknowledgement:
williamr@2
    92
 *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
williamr@2
    93
 * 
williamr@2
    94
 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
williamr@2
    95
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
williamr@2
    96
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
williamr@2
    97
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
williamr@2
    98
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
williamr@2
    99
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
williamr@2
   100
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
williamr@2
   101
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
williamr@2
   102
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
williamr@2
   103
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
williamr@2
   104
 * SUCH DAMAGE.
williamr@2
   105
 * 
williamr@2
   106
 * The licence and distribution terms for any publically available version or
williamr@2
   107
 * derivative of this code cannot be changed.  i.e. this code cannot simply be
williamr@2
   108
 * copied and put under another distribution licence
williamr@2
   109
 * [including the GNU Public Licence.]
williamr@2
   110
 */
williamr@2
   111
/* ====================================================================
williamr@2
   112
 * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
williamr@2
   113
 * ECDH support in OpenSSL originally developed by 
williamr@2
   114
 * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.
williamr@2
   115
 */
williamr@2
   116
/*
williamr@2
   117
 © Portions copyright (c) 2006 Nokia Corporation.  All rights reserved.
williamr@2
   118
 */
williamr@2
   119
williamr@2
   120
#ifndef HEADER_CRYPTO_H
williamr@2
   121
#define HEADER_CRYPTO_H
williamr@2
   122
#if (defined(__SYMBIAN32__) && !defined(SYMBIAN))
williamr@2
   123
#define SYMBIAN
williamr@2
   124
#endif
williamr@2
   125
williamr@2
   126
#ifdef SYMBIAN
williamr@2
   127
#include <e32def.h>
williamr@2
   128
#endif
williamr@2
   129
#include <stdlib.h>
williamr@2
   130
williamr@2
   131
#include <openssl/e_os2.h>
williamr@2
   132
williamr@2
   133
#ifndef OPENSSL_NO_FP_API
williamr@2
   134
#include <stdio.h>
williamr@2
   135
#endif
williamr@2
   136
williamr@2
   137
#include <openssl/stack.h>
williamr@2
   138
#include <openssl/safestack.h>
williamr@2
   139
#include <openssl/opensslv.h>
williamr@2
   140
#include <openssl/ossl_typ.h>
williamr@2
   141
williamr@2
   142
#ifdef CHARSET_EBCDIC
williamr@2
   143
#include <openssl/ebcdic.h>
williamr@2
   144
#endif
williamr@2
   145
williamr@2
   146
/* Resolve problems on some operating systems with symbol names that clash
williamr@2
   147
   one way or another */
williamr@2
   148
#include <openssl/symhacks.h>
williamr@2
   149
williamr@2
   150
#ifdef  __cplusplus
williamr@2
   151
extern "C" {
williamr@2
   152
#endif
williamr@2
   153
williamr@2
   154
/* Backward compatibility to SSLeay */
williamr@2
   155
/* This is more to be used to check the correct DLL is being used
williamr@2
   156
 * in the MS world. */
williamr@2
   157
#define SSLEAY_VERSION_NUMBER	OPENSSL_VERSION_NUMBER
williamr@2
   158
#define SSLEAY_VERSION		0
williamr@2
   159
/* #define SSLEAY_OPTIONS	1 no longer supported */
williamr@2
   160
#define SSLEAY_CFLAGS		2
williamr@2
   161
#define SSLEAY_BUILT_ON		3
williamr@2
   162
#define SSLEAY_PLATFORM		4
williamr@2
   163
#define SSLEAY_DIR		5
williamr@2
   164
williamr@2
   165
/* Already declared in ossl_typ.h */
williamr@2
   166
#if 0
williamr@2
   167
typedef struct crypto_ex_data_st CRYPTO_EX_DATA;
williamr@2
   168
/* Called when a new object is created */
williamr@2
   169
typedef int CRYPTO_EX_new(void *parent, void *ptr, CRYPTO_EX_DATA *ad,
williamr@2
   170
					int idx, long argl, void *argp);
williamr@2
   171
/* Called when an object is free()ed */
williamr@2
   172
typedef void CRYPTO_EX_free(void *parent, void *ptr, CRYPTO_EX_DATA *ad,
williamr@2
   173
					int idx, long argl, void *argp);
williamr@2
   174
/* Called when we need to dup an object */
williamr@2
   175
typedef int CRYPTO_EX_dup(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d, 
williamr@2
   176
					int idx, long argl, void *argp);
williamr@2
   177
#endif
williamr@2
   178
williamr@2
   179
/* A generic structure to pass assorted data in a expandable way */
williamr@2
   180
typedef struct openssl_item_st
williamr@2
   181
	{
williamr@2
   182
	int code;
williamr@2
   183
	void *value;		/* Not used for flag attributes */
williamr@2
   184
	size_t value_size;	/* Max size of value for output, length for input */
williamr@2
   185
	size_t *value_length;	/* Returned length of value for output */
williamr@2
   186
	} OPENSSL_ITEM;
williamr@2
   187
williamr@2
   188
williamr@2
   189
/* When changing the CRYPTO_LOCK_* list, be sure to maintin the text lock
williamr@2
   190
 * names in cryptlib.c
williamr@2
   191
 */
williamr@2
   192
williamr@2
   193
#define	CRYPTO_LOCK_ERR			1
williamr@2
   194
#define	CRYPTO_LOCK_EX_DATA		2
williamr@2
   195
#define	CRYPTO_LOCK_X509		3
williamr@2
   196
#define	CRYPTO_LOCK_X509_INFO		4
williamr@2
   197
#define	CRYPTO_LOCK_X509_PKEY		5
williamr@2
   198
#define CRYPTO_LOCK_X509_CRL		6
williamr@2
   199
#define CRYPTO_LOCK_X509_REQ		7
williamr@2
   200
#define CRYPTO_LOCK_DSA			8
williamr@2
   201
#define CRYPTO_LOCK_RSA			9
williamr@2
   202
#define CRYPTO_LOCK_EVP_PKEY		10
williamr@2
   203
#define CRYPTO_LOCK_X509_STORE		11
williamr@2
   204
#define CRYPTO_LOCK_SSL_CTX		12
williamr@2
   205
#define CRYPTO_LOCK_SSL_CERT		13
williamr@2
   206
#define CRYPTO_LOCK_SSL_SESSION		14
williamr@2
   207
#define CRYPTO_LOCK_SSL_SESS_CERT	15
williamr@2
   208
#define CRYPTO_LOCK_SSL			16
williamr@2
   209
#define CRYPTO_LOCK_SSL_METHOD		17
williamr@2
   210
#define CRYPTO_LOCK_RAND		18
williamr@2
   211
#define CRYPTO_LOCK_RAND2		19
williamr@2
   212
#define CRYPTO_LOCK_MALLOC		20
williamr@2
   213
#define CRYPTO_LOCK_BIO			21
williamr@2
   214
#define CRYPTO_LOCK_GETHOSTBYNAME	22
williamr@2
   215
#define CRYPTO_LOCK_GETSERVBYNAME	23
williamr@2
   216
#define CRYPTO_LOCK_READDIR		24
williamr@2
   217
#define CRYPTO_LOCK_RSA_BLINDING	25
williamr@2
   218
#define CRYPTO_LOCK_DH			26
williamr@2
   219
#define CRYPTO_LOCK_MALLOC2		27
williamr@2
   220
#define CRYPTO_LOCK_DSO			28
williamr@2
   221
#define CRYPTO_LOCK_DYNLOCK		29
williamr@2
   222
#define CRYPTO_LOCK_ENGINE		30
williamr@2
   223
#define CRYPTO_LOCK_UI			31
williamr@2
   224
#define CRYPTO_LOCK_ECDSA               32
williamr@2
   225
#define CRYPTO_LOCK_EC			33
williamr@2
   226
#define CRYPTO_LOCK_ECDH		34
williamr@2
   227
#define CRYPTO_LOCK_BN  		35
williamr@2
   228
#define CRYPTO_LOCK_EC_PRE_COMP		36
williamr@2
   229
#define CRYPTO_LOCK_STORE		37
williamr@2
   230
#define CRYPTO_LOCK_COMP		38
williamr@2
   231
#define CRYPTO_NUM_LOCKS		39
williamr@2
   232
williamr@2
   233
#define CRYPTO_LOCK		1
williamr@2
   234
#define CRYPTO_UNLOCK		2
williamr@2
   235
#define CRYPTO_READ		4
williamr@2
   236
#define CRYPTO_WRITE		8
williamr@2
   237
williamr@2
   238
#ifndef OPENSSL_NO_LOCKING
williamr@2
   239
#ifndef CRYPTO_w_lock
williamr@2
   240
#define CRYPTO_w_lock(type)	\
williamr@2
   241
	CRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,__FILE__,__LINE__)
williamr@2
   242
#define CRYPTO_w_unlock(type)	\
williamr@2
   243
	CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_WRITE,type,__FILE__,__LINE__)
williamr@2
   244
#define CRYPTO_r_lock(type)	\
williamr@2
   245
	CRYPTO_lock(CRYPTO_LOCK|CRYPTO_READ,type,__FILE__,__LINE__)
williamr@2
   246
#define CRYPTO_r_unlock(type)	\
williamr@2
   247
	CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_READ,type,__FILE__,__LINE__)
williamr@2
   248
#define CRYPTO_add(addr,amount,type)	\
williamr@2
   249
	CRYPTO_add_lock(addr,amount,type,__FILE__,__LINE__)
williamr@2
   250
#endif
williamr@2
   251
#else
williamr@2
   252
#define CRYPTO_w_lock(a)
williamr@2
   253
#define CRYPTO_w_unlock(a)
williamr@2
   254
#define CRYPTO_r_lock(a)
williamr@2
   255
#define CRYPTO_r_unlock(a)
williamr@2
   256
#define CRYPTO_add(a,b,c)	((*(a))+=(b))
williamr@2
   257
#endif
williamr@2
   258
williamr@2
   259
/* Some applications as well as some parts of OpenSSL need to allocate
williamr@2
   260
   and deallocate locks in a dynamic fashion.  The following typedef
williamr@2
   261
   makes this possible in a type-safe manner.  */
williamr@2
   262
/* struct CRYPTO_dynlock_value has to be defined by the application. */
williamr@2
   263
typedef struct
williamr@2
   264
	{
williamr@2
   265
	int references;
williamr@2
   266
	struct CRYPTO_dynlock_value *data;
williamr@2
   267
	} CRYPTO_dynlock;
williamr@2
   268
williamr@2
   269
williamr@2
   270
/* The following can be used to detect memory leaks in the SSLeay library.
williamr@2
   271
 * It used, it turns on malloc checking */
williamr@2
   272
williamr@2
   273
#define CRYPTO_MEM_CHECK_OFF	0x0	/* an enume */
williamr@2
   274
#define CRYPTO_MEM_CHECK_ON	0x1	/* a bit */
williamr@2
   275
#define CRYPTO_MEM_CHECK_ENABLE	0x2	/* a bit */
williamr@2
   276
#define CRYPTO_MEM_CHECK_DISABLE 0x3	/* an enume */
williamr@2
   277
williamr@2
   278
/* The following are bit values to turn on or off options connected to the
williamr@2
   279
 * malloc checking functionality */
williamr@2
   280
williamr@2
   281
/* Adds time to the memory checking information */
williamr@2
   282
#define V_CRYPTO_MDEBUG_TIME	0x1 /* a bit */
williamr@2
   283
/* Adds thread number to the memory checking information */
williamr@2
   284
#define V_CRYPTO_MDEBUG_THREAD	0x2 /* a bit */
williamr@2
   285
williamr@2
   286
#define V_CRYPTO_MDEBUG_ALL (V_CRYPTO_MDEBUG_TIME | V_CRYPTO_MDEBUG_THREAD)
williamr@2
   287
williamr@2
   288
williamr@2
   289
/* predec of the BIO type */
williamr@2
   290
typedef struct bio_st BIO_dummy;
williamr@2
   291
williamr@2
   292
struct crypto_ex_data_st
williamr@2
   293
	{
williamr@2
   294
	STACK *sk;
williamr@2
   295
	int dummy; /* gcc is screwing up this data structure :-( */
williamr@2
   296
	};
williamr@2
   297
williamr@2
   298
/* This stuff is basically class callback functions
williamr@2
   299
 * The current classes are SSL_CTX, SSL, SSL_SESSION, and a few more */
williamr@2
   300
williamr@2
   301
typedef struct crypto_ex_data_func_st
williamr@2
   302
	{
williamr@2
   303
	long argl;	/* Arbitary long */
williamr@2
   304
	void *argp;	/* Arbitary void * */
williamr@2
   305
	CRYPTO_EX_new *new_func;
williamr@2
   306
	CRYPTO_EX_free *free_func;
williamr@2
   307
	CRYPTO_EX_dup *dup_func;
williamr@2
   308
	} CRYPTO_EX_DATA_FUNCS;
williamr@2
   309
williamr@2
   310
DECLARE_STACK_OF(CRYPTO_EX_DATA_FUNCS)
williamr@2
   311
williamr@2
   312
/* Per class, we have a STACK of CRYPTO_EX_DATA_FUNCS for each CRYPTO_EX_DATA
williamr@2
   313
 * entry.
williamr@2
   314
 */
williamr@2
   315
williamr@2
   316
#define CRYPTO_EX_INDEX_BIO		0
williamr@2
   317
#define CRYPTO_EX_INDEX_SSL		1
williamr@2
   318
#define CRYPTO_EX_INDEX_SSL_CTX		2
williamr@2
   319
#define CRYPTO_EX_INDEX_SSL_SESSION	3
williamr@2
   320
#define CRYPTO_EX_INDEX_X509_STORE	4
williamr@2
   321
#define CRYPTO_EX_INDEX_X509_STORE_CTX	5
williamr@2
   322
#define CRYPTO_EX_INDEX_RSA		6
williamr@2
   323
#define CRYPTO_EX_INDEX_DSA		7
williamr@2
   324
#define CRYPTO_EX_INDEX_DH		8
williamr@2
   325
#define CRYPTO_EX_INDEX_ENGINE		9
williamr@2
   326
#define CRYPTO_EX_INDEX_X509		10
williamr@2
   327
#define CRYPTO_EX_INDEX_UI		11
williamr@2
   328
#define CRYPTO_EX_INDEX_ECDSA		12
williamr@2
   329
#define CRYPTO_EX_INDEX_ECDH		13
williamr@2
   330
#define CRYPTO_EX_INDEX_COMP		14
williamr@2
   331
#define CRYPTO_EX_INDEX_STORE		15
williamr@2
   332
williamr@2
   333
/* Dynamically assigned indexes start from this value (don't use directly, use
williamr@2
   334
 * via CRYPTO_ex_data_new_class). */
williamr@2
   335
#define CRYPTO_EX_INDEX_USER		100
williamr@2
   336
williamr@2
   337
williamr@2
   338
/* This is the default callbacks, but we can have others as well:
williamr@2
   339
 * this is needed in Win32 where the application malloc and the
williamr@2
   340
 * library malloc may not be the same.
williamr@2
   341
 */
williamr@2
   342
#define CRYPTO_malloc_init()	CRYPTO_set_mem_functions(\
williamr@2
   343
	malloc, realloc, free)
williamr@2
   344
williamr@2
   345
#if defined CRYPTO_MDEBUG_ALL || defined CRYPTO_MDEBUG_TIME || defined CRYPTO_MDEBUG_THREAD
williamr@2
   346
# ifndef CRYPTO_MDEBUG /* avoid duplicate #define */
williamr@2
   347
#  define CRYPTO_MDEBUG
williamr@2
   348
# endif
williamr@2
   349
#endif
williamr@2
   350
williamr@2
   351
/* Set standard debugging functions (not done by default
williamr@2
   352
 * unless CRYPTO_MDEBUG is defined) */
williamr@2
   353
#define CRYPTO_malloc_debug_init()	do {\
williamr@2
   354
	CRYPTO_set_mem_debug_functions(\
williamr@2
   355
		CRYPTO_dbg_malloc,\
williamr@2
   356
		CRYPTO_dbg_realloc,\
williamr@2
   357
		CRYPTO_dbg_free,\
williamr@2
   358
		CRYPTO_dbg_set_options,\
williamr@2
   359
		CRYPTO_dbg_get_options);\
williamr@2
   360
	} while(0)
williamr@2
   361
williamr@2
   362
IMPORT_C int CRYPTO_mem_ctrl(int mode);
williamr@2
   363
IMPORT_C int CRYPTO_is_mem_check_on(void);
williamr@2
   364
williamr@2
   365
/* for applications */
williamr@2
   366
#define MemCheck_start() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON)
williamr@2
   367
#define MemCheck_stop()	CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_OFF)
williamr@2
   368
williamr@2
   369
/* for library-internal use */
williamr@2
   370
#define MemCheck_on()	CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE)
williamr@2
   371
#define MemCheck_off()	CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE)
williamr@2
   372
#define is_MemCheck_on() CRYPTO_is_mem_check_on()
williamr@2
   373
williamr@2
   374
#define OPENSSL_malloc(num)	CRYPTO_malloc((int)num,__FILE__,__LINE__)
williamr@2
   375
#define OPENSSL_realloc(addr,num) \
williamr@2
   376
	CRYPTO_realloc((char *)addr,(int)num,__FILE__,__LINE__)
williamr@2
   377
#define OPENSSL_realloc_clean(addr,old_num,num) \
williamr@2
   378
	CRYPTO_realloc_clean(addr,old_num,num,__FILE__,__LINE__)
williamr@2
   379
#define OPENSSL_remalloc(addr,num) \
williamr@2
   380
	CRYPTO_remalloc((char **)addr,(int)num,__FILE__,__LINE__)
williamr@2
   381
#define OPENSSL_freeFunc	CRYPTO_free
williamr@2
   382
#define OPENSSL_free(addr)	CRYPTO_free(addr)
williamr@2
   383
williamr@2
   384
#define OPENSSL_malloc_locked(num) \
williamr@2
   385
	CRYPTO_malloc_locked((int)num,__FILE__,__LINE__)
williamr@2
   386
#define OPENSSL_free_locked(addr) CRYPTO_free_locked(addr)
williamr@2
   387
williamr@2
   388
williamr@2
   389
IMPORT_C const char *SSLeay_version(int type);
williamr@2
   390
IMPORT_C unsigned long SSLeay(void);
williamr@2
   391
williamr@2
   392
IMPORT_C int OPENSSL_issetugid(void);
williamr@2
   393
williamr@2
   394
/* An opaque type representing an implementation of "ex_data" support */
williamr@2
   395
typedef struct st_CRYPTO_EX_DATA_IMPL	CRYPTO_EX_DATA_IMPL;
williamr@2
   396
/* Return an opaque pointer to the current "ex_data" implementation */
williamr@2
   397
IMPORT_C const CRYPTO_EX_DATA_IMPL *CRYPTO_get_ex_data_implementation(void);
williamr@2
   398
/* Sets the "ex_data" implementation to be used (if it's not too late) */
williamr@2
   399
IMPORT_C int CRYPTO_set_ex_data_implementation(CRYPTO_EX_DATA_IMPL *i);
williamr@2
   400
/* Get a new "ex_data" class, and return the corresponding "class_index" */
williamr@2
   401
IMPORT_C int CRYPTO_ex_data_new_class(void);
williamr@2
   402
/* Within a given class, get/register a new index */
williamr@2
   403
IMPORT_C int CRYPTO_get_ex_new_index(int class_index, long argl, void *argp,
williamr@2
   404
		CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func,
williamr@2
   405
		CRYPTO_EX_free *free_func);
williamr@2
   406
/* Initialise/duplicate/free CRYPTO_EX_DATA variables corresponding to a given
williamr@2
   407
 * class (invokes whatever per-class callbacks are applicable) */
williamr@2
   408
IMPORT_C int CRYPTO_new_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad);
williamr@2
   409
IMPORT_C int CRYPTO_dup_ex_data(int class_index, CRYPTO_EX_DATA *to,
williamr@2
   410
		CRYPTO_EX_DATA *from);
williamr@2
   411
IMPORT_C void CRYPTO_free_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad);
williamr@2
   412
/* Get/set data in a CRYPTO_EX_DATA variable corresponding to a particular index
williamr@2
   413
 * (relative to the class type involved) */
williamr@2
   414
IMPORT_C int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int idx, void *val);
williamr@2
   415
IMPORT_C void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad,int idx);
williamr@2
   416
/* This function cleans up all "ex_data" state. It mustn't be called under
williamr@2
   417
 * potential race-conditions. */
williamr@2
   418
IMPORT_C void CRYPTO_cleanup_all_ex_data(void);
williamr@2
   419
williamr@2
   420
IMPORT_C int CRYPTO_get_new_lockid(char *name);
williamr@2
   421
williamr@2
   422
IMPORT_C int CRYPTO_num_locks(void); /* return CRYPTO_NUM_LOCKS (shared libs!) */
williamr@2
   423
IMPORT_C void CRYPTO_lock(int mode, int type,const char *file,int line);
williamr@2
   424
IMPORT_C void CRYPTO_set_locking_callback(void (*func)(int mode,int type,
williamr@2
   425
					      const char *file,int line));
williamr@2
   426
IMPORT_C void (*CRYPTO_get_locking_callback(void))(int mode,int type,const char *file,
williamr@2
   427
		int line);
williamr@2
   428
IMPORT_C void CRYPTO_set_add_lock_callback(int (*func)(int *num,int mount,int type,
williamr@2
   429
					      const char *file, int line));
williamr@2
   430
IMPORT_C int (*CRYPTO_get_add_lock_callback(void))(int *num,int mount,int type,
williamr@2
   431
					  const char *file,int line);
williamr@2
   432
IMPORT_C void CRYPTO_set_id_callback(unsigned long (*func)(void));
williamr@2
   433
IMPORT_C unsigned long (*CRYPTO_get_id_callback(void))(void);
williamr@2
   434
IMPORT_C unsigned long CRYPTO_thread_id(void);
williamr@2
   435
IMPORT_C const char *CRYPTO_get_lock_name(int type);
williamr@2
   436
IMPORT_C int CRYPTO_add_lock(int *pointer,int amount,int type, const char *file,
williamr@2
   437
		    int line);
williamr@2
   438
williamr@2
   439
IMPORT_C int CRYPTO_get_new_dynlockid(void);
williamr@2
   440
IMPORT_C void CRYPTO_destroy_dynlockid(int i);
williamr@2
   441
IMPORT_C struct CRYPTO_dynlock_value *CRYPTO_get_dynlock_value(int i);
williamr@2
   442
IMPORT_C void CRYPTO_set_dynlock_create_callback(struct CRYPTO_dynlock_value *(*dyn_create_function)(const char *file, int line));
williamr@2
   443
IMPORT_C void CRYPTO_set_dynlock_lock_callback(void (*dyn_lock_function)(int mode, struct CRYPTO_dynlock_value *l, const char *file, int line));
williamr@2
   444
IMPORT_C void CRYPTO_set_dynlock_destroy_callback(void (*dyn_destroy_function)(struct CRYPTO_dynlock_value *l, const char *file, int line));
williamr@2
   445
IMPORT_C struct CRYPTO_dynlock_value *(*CRYPTO_get_dynlock_create_callback(void))(const char *file,int line);
williamr@2
   446
IMPORT_C void (*CRYPTO_get_dynlock_lock_callback(void))(int mode, struct CRYPTO_dynlock_value *l, const char *file,int line);
williamr@2
   447
IMPORT_C void (*CRYPTO_get_dynlock_destroy_callback(void))(struct CRYPTO_dynlock_value *l, const char *file,int line);
williamr@2
   448
williamr@2
   449
/* CRYPTO_set_mem_functions includes CRYPTO_set_locked_mem_functions --
williamr@2
   450
 * call the latter last if you need different functions */
williamr@2
   451
IMPORT_C int CRYPTO_set_mem_functions(void *(*m)(size_t),void *(*r)(void *,size_t), void (*f)(void *));
williamr@2
   452
IMPORT_C int CRYPTO_set_locked_mem_functions(void *(*m)(size_t), void (*free_func)(void *));
williamr@2
   453
IMPORT_C int CRYPTO_set_mem_ex_functions(void *(*m)(size_t,const char *,int),
williamr@2
   454
                                void *(*r)(void *,size_t,const char *,int),
williamr@2
   455
                                void (*f)(void *));
williamr@2
   456
IMPORT_C int CRYPTO_set_locked_mem_ex_functions(void *(*m)(size_t,const char *,int),
williamr@2
   457
                                       void (*free_func)(void *));
williamr@2
   458
IMPORT_C int CRYPTO_set_mem_debug_functions(void (*m)(void *,int,const char *,int,int),
williamr@2
   459
				   void (*r)(void *,void *,int,const char *,int,int),
williamr@2
   460
				   void (*f)(void *,int),
williamr@2
   461
				   void (*so)(long),
williamr@2
   462
				   long (*go)(void));
williamr@2
   463
IMPORT_C void CRYPTO_get_mem_functions(void *(**m)(size_t),void *(**r)(void *, size_t), void (**f)(void *));
williamr@2
   464
IMPORT_C void CRYPTO_get_locked_mem_functions(void *(**m)(size_t), void (**f)(void *));
williamr@2
   465
IMPORT_C void CRYPTO_get_mem_ex_functions(void *(**m)(size_t,const char *,int),
williamr@2
   466
                                 void *(**r)(void *, size_t,const char *,int),
williamr@2
   467
                                 void (**f)(void *));
williamr@2
   468
IMPORT_C void CRYPTO_get_locked_mem_ex_functions(void *(**m)(size_t,const char *,int),
williamr@2
   469
                                        void (**f)(void *));
williamr@2
   470
IMPORT_C void CRYPTO_get_mem_debug_functions(void (**m)(void *,int,const char *,int,int),
williamr@2
   471
				    void (**r)(void *,void *,int,const char *,int,int),
williamr@2
   472
				    void (**f)(void *,int),
williamr@2
   473
				    void (**so)(long),
williamr@2
   474
				    long (**go)(void));
williamr@2
   475
williamr@2
   476
IMPORT_C void *CRYPTO_malloc_locked(int num, const char *file, int line);
williamr@2
   477
IMPORT_C void CRYPTO_free_locked(void *);
williamr@2
   478
IMPORT_C void *CRYPTO_malloc(int num, const char *file, int line);
williamr@2
   479
IMPORT_C void CRYPTO_free(void *);
williamr@2
   480
IMPORT_C void *CRYPTO_realloc(void *addr,int num, const char *file, int line);
williamr@2
   481
IMPORT_C void *CRYPTO_realloc_clean(void *addr,int old_num,int num,const char *file,
williamr@2
   482
			   int line);
williamr@2
   483
IMPORT_C void *CRYPTO_remalloc(void *addr,int num, const char *file, int line);
williamr@2
   484
williamr@2
   485
IMPORT_C void OPENSSL_cleanse(void *ptr, size_t len);
williamr@2
   486
williamr@2
   487
IMPORT_C void CRYPTO_set_mem_debug_options(long bits);
williamr@2
   488
long CRYPTO_get_mem_debug_options(void);
williamr@2
   489
williamr@2
   490
#define CRYPTO_push_info(info) \
williamr@2
   491
        CRYPTO_push_info_(info, __FILE__, __LINE__);
williamr@2
   492
IMPORT_C int CRYPTO_push_info_(const char *info, const char *file, int line);
williamr@2
   493
IMPORT_C int CRYPTO_pop_info(void);
williamr@2
   494
IMPORT_C int CRYPTO_remove_all_info(void);
williamr@2
   495
williamr@2
   496
williamr@2
   497
/* Default debugging functions (enabled by CRYPTO_malloc_debug_init() macro;
williamr@2
   498
 * used as default in CRYPTO_MDEBUG compilations): */
williamr@2
   499
/* The last argument has the following significance:
williamr@2
   500
 *
williamr@2
   501
 * 0:	called before the actual memory allocation has taken place
williamr@2
   502
 * 1:	called after the actual memory allocation has taken place
williamr@2
   503
 */
williamr@2
   504
IMPORT_C void CRYPTO_dbg_malloc(void *addr,int num,const char *file,int line,int before_p);
williamr@2
   505
IMPORT_C void CRYPTO_dbg_realloc(void *addr1,void *addr2,int num,const char *file,int line,int before_p);
williamr@2
   506
IMPORT_C void CRYPTO_dbg_free(void *addr,int before_p);
williamr@2
   507
/* Tell the debugging code about options.  By default, the following values
williamr@2
   508
 * apply:
williamr@2
   509
 *
williamr@2
   510
 * 0:                           Clear all options.
williamr@2
   511
 * V_CRYPTO_MDEBUG_TIME (1):    Set the "Show Time" option.
williamr@2
   512
 * V_CRYPTO_MDEBUG_THREAD (2):  Set the "Show Thread Number" option.
williamr@2
   513
 * V_CRYPTO_MDEBUG_ALL (3):     1 + 2
williamr@2
   514
 */
williamr@2
   515
IMPORT_C void CRYPTO_dbg_set_options(long bits);
williamr@2
   516
IMPORT_C long CRYPTO_dbg_get_options(void);
williamr@2
   517
williamr@2
   518
williamr@2
   519
#ifndef OPENSSL_NO_FP_API
williamr@2
   520
IMPORT_C void CRYPTO_mem_leaks_fp(FILE *);
williamr@2
   521
#endif
williamr@2
   522
IMPORT_C void CRYPTO_mem_leaks(struct bio_st *bio);
williamr@2
   523
/* unsigned long order, char *file, int line, int num_bytes, char *addr */
williamr@2
   524
typedef void *CRYPTO_MEM_LEAK_CB(unsigned long, const char *, int, int, void *);
williamr@2
   525
IMPORT_C void CRYPTO_mem_leaks_cb(CRYPTO_MEM_LEAK_CB *cb);
williamr@2
   526
williamr@2
   527
/* die if we have to */
williamr@2
   528
IMPORT_C void OpenSSLDie(const char *file,int line,const char *assertion);
williamr@2
   529
#define OPENSSL_assert(e)       (void)((e) ? 0 : (OpenSSLDie(__FILE__, __LINE__, #e),1))
williamr@2
   530
williamr@2
   531
unsigned long *OPENSSL_ia32cap_loc(void);
williamr@2
   532
#define OPENSSL_ia32cap (*(OPENSSL_ia32cap_loc()))
williamr@2
   533
williamr@2
   534
/* BEGIN ERROR CODES */
williamr@2
   535
/* The following lines are auto generated by the script mkerr.pl. Any changes
williamr@2
   536
 * made after this point may be overwritten when the script is next run.
williamr@2
   537
 */
williamr@2
   538
IMPORT_C void ERR_load_crypto_strings(void);
williamr@2
   539
williamr@2
   540
/* Error codes for the CRYPTO functions. */
williamr@2
   541
williamr@2
   542
/* Function codes. */
williamr@2
   543
#define CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX		 100
williamr@2
   544
#define CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID		 103
williamr@2
   545
#define CRYPTO_F_CRYPTO_GET_NEW_LOCKID			 101
williamr@2
   546
#define CRYPTO_F_CRYPTO_SET_EX_DATA			 102
williamr@2
   547
#define CRYPTO_F_DEF_ADD_INDEX				 104
williamr@2
   548
#define CRYPTO_F_DEF_GET_CLASS				 105
williamr@2
   549
#define CRYPTO_F_INT_DUP_EX_DATA			 106
williamr@2
   550
#define CRYPTO_F_INT_FREE_EX_DATA			 107
williamr@2
   551
#define CRYPTO_F_INT_NEW_EX_DATA			 108
williamr@2
   552
williamr@2
   553
/* Reason codes. */
williamr@2
   554
#define CRYPTO_R_NO_DYNLOCK_CREATE_CALLBACK		 100
williamr@2
   555
williamr@2
   556
#ifdef  __cplusplus
williamr@2
   557
}
williamr@2
   558
#endif
williamr@2
   559
#endif