summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/crypto.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/crypto.h')
-rw-r--r--src/lib/libcrypto/crypto.h104
1 files changed, 30 insertions, 74 deletions
diff --git a/src/lib/libcrypto/crypto.h b/src/lib/libcrypto/crypto.h
index 0e4fb0723c..b0360cec51 100644
--- a/src/lib/libcrypto/crypto.h
+++ b/src/lib/libcrypto/crypto.h
@@ -1,6 +1,6 @@
1/* crypto/crypto.h */ 1/* crypto/crypto.h */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1998-2003 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
@@ -219,13 +219,9 @@ typedef struct openssl_item_st
219#define CRYPTO_LOCK_EC_PRE_COMP 36 219#define CRYPTO_LOCK_EC_PRE_COMP 36
220#define CRYPTO_LOCK_STORE 37 220#define CRYPTO_LOCK_STORE 37
221#define CRYPTO_LOCK_COMP 38 221#define CRYPTO_LOCK_COMP 38
222#ifndef OPENSSL_FIPS
223#define CRYPTO_NUM_LOCKS 39
224#else
225#define CRYPTO_LOCK_FIPS 39 222#define CRYPTO_LOCK_FIPS 39
226#define CRYPTO_LOCK_FIPS2 40 223#define CRYPTO_LOCK_FIPS2 40
227#define CRYPTO_NUM_LOCKS 41 224#define CRYPTO_NUM_LOCKS 41
228#endif
229 225
230#define CRYPTO_LOCK 1 226#define CRYPTO_LOCK 1
231#define CRYPTO_UNLOCK 2 227#define CRYPTO_UNLOCK 2
@@ -288,9 +284,10 @@ typedef struct bio_st BIO_dummy;
288 284
289struct crypto_ex_data_st 285struct crypto_ex_data_st
290 { 286 {
291 STACK *sk; 287 STACK_OF(void) *sk;
292 int dummy; /* gcc is screwing up this data structure :-( */ 288 int dummy; /* gcc is screwing up this data structure :-( */
293 }; 289 };
290DECLARE_STACK_OF(void)
294 291
295/* This stuff is basically class callback functions 292/* This stuff is basically class callback functions
296 * The current classes are SSL_CTX, SSL, SSL_SESSION, and a few more */ 293 * The current classes are SSL_CTX, SSL, SSL_SESSION, and a few more */
@@ -347,7 +344,14 @@ DECLARE_STACK_OF(CRYPTO_EX_DATA_FUNCS)
347 344
348/* Set standard debugging functions (not done by default 345/* Set standard debugging functions (not done by default
349 * unless CRYPTO_MDEBUG is defined) */ 346 * unless CRYPTO_MDEBUG is defined) */
350void CRYPTO_malloc_debug_init(void); 347#define CRYPTO_malloc_debug_init() do {\
348 CRYPTO_set_mem_debug_functions(\
349 CRYPTO_dbg_malloc,\
350 CRYPTO_dbg_realloc,\
351 CRYPTO_dbg_free,\
352 CRYPTO_dbg_set_options,\
353 CRYPTO_dbg_get_options);\
354 } while(0)
351 355
352int CRYPTO_mem_ctrl(int mode); 356int CRYPTO_mem_ctrl(int mode);
353int CRYPTO_is_mem_check_on(void); 357int CRYPTO_is_mem_check_on(void);
@@ -420,16 +424,32 @@ void CRYPTO_set_add_lock_callback(int (*func)(int *num,int mount,int type,
420 const char *file, int line)); 424 const char *file, int line));
421int (*CRYPTO_get_add_lock_callback(void))(int *num,int mount,int type, 425int (*CRYPTO_get_add_lock_callback(void))(int *num,int mount,int type,
422 const char *file,int line); 426 const char *file,int line);
427
428/* Don't use this structure directly. */
429typedef struct crypto_threadid_st
430 {
431 void *ptr;
432 unsigned long val;
433 } CRYPTO_THREADID;
434/* Only use CRYPTO_THREADID_set_[numeric|pointer]() within callbacks */
435void CRYPTO_THREADID_set_numeric(CRYPTO_THREADID *id, unsigned long val);
436void CRYPTO_THREADID_set_pointer(CRYPTO_THREADID *id, void *ptr);
437int CRYPTO_THREADID_set_callback(void (*threadid_func)(CRYPTO_THREADID *));
438void (*CRYPTO_THREADID_get_callback(void))(CRYPTO_THREADID *);
439void CRYPTO_THREADID_current(CRYPTO_THREADID *id);
440int CRYPTO_THREADID_cmp(const CRYPTO_THREADID *a, const CRYPTO_THREADID *b);
441void CRYPTO_THREADID_cpy(CRYPTO_THREADID *dest, const CRYPTO_THREADID *src);
442unsigned long CRYPTO_THREADID_hash(const CRYPTO_THREADID *id);
443#ifndef OPENSSL_NO_DEPRECATED
423void CRYPTO_set_id_callback(unsigned long (*func)(void)); 444void CRYPTO_set_id_callback(unsigned long (*func)(void));
424unsigned long (*CRYPTO_get_id_callback(void))(void); 445unsigned long (*CRYPTO_get_id_callback(void))(void);
425unsigned long CRYPTO_thread_id(void); 446unsigned long CRYPTO_thread_id(void);
447#endif
448
426const char *CRYPTO_get_lock_name(int type); 449const char *CRYPTO_get_lock_name(int type);
427int CRYPTO_add_lock(int *pointer,int amount,int type, const char *file, 450int CRYPTO_add_lock(int *pointer,int amount,int type, const char *file,
428 int line); 451 int line);
429 452
430void int_CRYPTO_set_do_dynlock_callback(
431 void (*do_dynlock_cb)(int mode, int type, const char *file, int line));
432
433int CRYPTO_get_new_dynlockid(void); 453int CRYPTO_get_new_dynlockid(void);
434void CRYPTO_destroy_dynlockid(int i); 454void CRYPTO_destroy_dynlockid(int i);
435struct CRYPTO_dynlock_value *CRYPTO_get_dynlock_value(int i); 455struct CRYPTO_dynlock_value *CRYPTO_get_dynlock_value(int i);
@@ -454,10 +474,6 @@ int CRYPTO_set_mem_debug_functions(void (*m)(void *,int,const char *,int,int),
454 void (*f)(void *,int), 474 void (*f)(void *,int),
455 void (*so)(long), 475 void (*so)(long),
456 long (*go)(void)); 476 long (*go)(void));
457void CRYPTO_set_mem_info_functions(
458 int (*push_info_fn)(const char *info, const char *file, int line),
459 int (*pop_info_fn)(void),
460 int (*remove_all_info_fn)(void));
461void CRYPTO_get_mem_functions(void *(**m)(size_t),void *(**r)(void *, size_t), void (**f)(void *)); 477void CRYPTO_get_mem_functions(void *(**m)(size_t),void *(**r)(void *, size_t), void (**f)(void *));
462void CRYPTO_get_locked_mem_functions(void *(**m)(size_t), void (**f)(void *)); 478void CRYPTO_get_locked_mem_functions(void *(**m)(size_t), void (**f)(void *));
463void CRYPTO_get_mem_ex_functions(void *(**m)(size_t,const char *,int), 479void CRYPTO_get_mem_ex_functions(void *(**m)(size_t,const char *,int),
@@ -514,9 +530,6 @@ void CRYPTO_dbg_free(void *addr,int before_p);
514void CRYPTO_dbg_set_options(long bits); 530void CRYPTO_dbg_set_options(long bits);
515long CRYPTO_dbg_get_options(void); 531long CRYPTO_dbg_get_options(void);
516 532
517int CRYPTO_dbg_push_info(const char *info, const char *file, int line);
518int CRYPTO_dbg_pop_info(void);
519int CRYPTO_dbg_remove_all_info(void);
520 533
521#ifndef OPENSSL_NO_FP_API 534#ifndef OPENSSL_NO_FP_API
522void CRYPTO_mem_leaks_fp(FILE *); 535void CRYPTO_mem_leaks_fp(FILE *);
@@ -534,69 +547,12 @@ unsigned long *OPENSSL_ia32cap_loc(void);
534#define OPENSSL_ia32cap (*(OPENSSL_ia32cap_loc())) 547#define OPENSSL_ia32cap (*(OPENSSL_ia32cap_loc()))
535int OPENSSL_isservice(void); 548int OPENSSL_isservice(void);
536 549
537#ifdef OPENSSL_FIPS
538#define FIPS_ERROR_IGNORED(alg) OpenSSLDie(__FILE__, __LINE__, \
539 alg " previous FIPS forbidden algorithm error ignored");
540
541#define FIPS_BAD_ABORT(alg) OpenSSLDie(__FILE__, __LINE__, \
542 #alg " Algorithm forbidden in FIPS mode");
543
544#ifdef OPENSSL_FIPS_STRICT
545#define FIPS_BAD_ALGORITHM(alg) FIPS_BAD_ABORT(alg)
546#else
547#define FIPS_BAD_ALGORITHM(alg) \
548 { \
549 FIPSerr(FIPS_F_HASH_FINAL,FIPS_R_NON_FIPS_METHOD); \
550 ERR_add_error_data(2, "Algorithm=", #alg); \
551 return 0; \
552 }
553#endif
554
555/* Low level digest API blocking macro */
556
557#define FIPS_NON_FIPS_MD_Init(alg) \
558 int alg##_Init(alg##_CTX *c) \
559 { \
560 if (FIPS_mode()) \
561 FIPS_BAD_ALGORITHM(alg) \
562 return private_##alg##_Init(c); \
563 } \
564 int private_##alg##_Init(alg##_CTX *c)
565
566/* For ciphers the API often varies from cipher to cipher and each needs to
567 * be treated as a special case. Variable key length ciphers (Blowfish, RC4,
568 * CAST) however are very similar and can use a blocking macro.
569 */
570
571#define FIPS_NON_FIPS_VCIPHER_Init(alg) \
572 void alg##_set_key(alg##_KEY *key, int len, const unsigned char *data) \
573 { \
574 if (FIPS_mode()) \
575 FIPS_BAD_ABORT(alg) \
576 private_##alg##_set_key(key, len, data); \
577 } \
578 void private_##alg##_set_key(alg##_KEY *key, int len, \
579 const unsigned char *data)
580
581#else
582
583#define FIPS_NON_FIPS_VCIPHER_Init(alg) \
584 void alg##_set_key(alg##_KEY *key, int len, const unsigned char *data)
585
586#define FIPS_NON_FIPS_MD_Init(alg) \
587 int alg##_Init(alg##_CTX *c)
588
589#endif /* def OPENSSL_FIPS */
590
591/* BEGIN ERROR CODES */ 550/* BEGIN ERROR CODES */
592/* The following lines are auto generated by the script mkerr.pl. Any changes 551/* The following lines are auto generated by the script mkerr.pl. Any changes
593 * made after this point may be overwritten when the script is next run. 552 * made after this point may be overwritten when the script is next run.
594 */ 553 */
595void ERR_load_CRYPTO_strings(void); 554void ERR_load_CRYPTO_strings(void);
596 555
597#define OPENSSL_HAVE_INIT 1
598void OPENSSL_init(void);
599
600/* Error codes for the CRYPTO functions. */ 556/* Error codes for the CRYPTO functions. */
601 557
602/* Function codes. */ 558/* Function codes. */