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, 74 insertions, 30 deletions
diff --git a/src/lib/libcrypto/crypto.h b/src/lib/libcrypto/crypto.h
index b0360cec51..0e4fb0723c 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-2006 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1998-2003 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,9 +219,13 @@ 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
222#define CRYPTO_LOCK_FIPS 39 225#define CRYPTO_LOCK_FIPS 39
223#define CRYPTO_LOCK_FIPS2 40 226#define CRYPTO_LOCK_FIPS2 40
224#define CRYPTO_NUM_LOCKS 41 227#define CRYPTO_NUM_LOCKS 41
228#endif
225 229
226#define CRYPTO_LOCK 1 230#define CRYPTO_LOCK 1
227#define CRYPTO_UNLOCK 2 231#define CRYPTO_UNLOCK 2
@@ -284,10 +288,9 @@ typedef struct bio_st BIO_dummy;
284 288
285struct crypto_ex_data_st 289struct crypto_ex_data_st
286 { 290 {
287 STACK_OF(void) *sk; 291 STACK *sk;
288 int dummy; /* gcc is screwing up this data structure :-( */ 292 int dummy; /* gcc is screwing up this data structure :-( */
289 }; 293 };
290DECLARE_STACK_OF(void)
291 294
292/* This stuff is basically class callback functions 295/* This stuff is basically class callback functions
293 * The current classes are SSL_CTX, SSL, SSL_SESSION, and a few more */ 296 * The current classes are SSL_CTX, SSL, SSL_SESSION, and a few more */
@@ -344,14 +347,7 @@ DECLARE_STACK_OF(CRYPTO_EX_DATA_FUNCS)
344 347
345/* Set standard debugging functions (not done by default 348/* Set standard debugging functions (not done by default
346 * unless CRYPTO_MDEBUG is defined) */ 349 * unless CRYPTO_MDEBUG is defined) */
347#define CRYPTO_malloc_debug_init() do {\ 350void CRYPTO_malloc_debug_init(void);
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)
355 351
356int CRYPTO_mem_ctrl(int mode); 352int CRYPTO_mem_ctrl(int mode);
357int CRYPTO_is_mem_check_on(void); 353int CRYPTO_is_mem_check_on(void);
@@ -424,32 +420,16 @@ void CRYPTO_set_add_lock_callback(int (*func)(int *num,int mount,int type,
424 const char *file, int line)); 420 const char *file, int line));
425int (*CRYPTO_get_add_lock_callback(void))(int *num,int mount,int type, 421int (*CRYPTO_get_add_lock_callback(void))(int *num,int mount,int type,
426 const char *file,int line); 422 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
444void CRYPTO_set_id_callback(unsigned long (*func)(void)); 423void CRYPTO_set_id_callback(unsigned long (*func)(void));
445unsigned long (*CRYPTO_get_id_callback(void))(void); 424unsigned long (*CRYPTO_get_id_callback(void))(void);
446unsigned long CRYPTO_thread_id(void); 425unsigned long CRYPTO_thread_id(void);
447#endif
448
449const char *CRYPTO_get_lock_name(int type); 426const char *CRYPTO_get_lock_name(int type);
450int CRYPTO_add_lock(int *pointer,int amount,int type, const char *file, 427int CRYPTO_add_lock(int *pointer,int amount,int type, const char *file,
451 int line); 428 int line);
452 429
430void int_CRYPTO_set_do_dynlock_callback(
431 void (*do_dynlock_cb)(int mode, int type, const char *file, int line));
432
453int CRYPTO_get_new_dynlockid(void); 433int CRYPTO_get_new_dynlockid(void);
454void CRYPTO_destroy_dynlockid(int i); 434void CRYPTO_destroy_dynlockid(int i);
455struct CRYPTO_dynlock_value *CRYPTO_get_dynlock_value(int i); 435struct CRYPTO_dynlock_value *CRYPTO_get_dynlock_value(int i);
@@ -474,6 +454,10 @@ int CRYPTO_set_mem_debug_functions(void (*m)(void *,int,const char *,int,int),
474 void (*f)(void *,int), 454 void (*f)(void *,int),
475 void (*so)(long), 455 void (*so)(long),
476 long (*go)(void)); 456 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));
477void CRYPTO_get_mem_functions(void *(**m)(size_t),void *(**r)(void *, size_t), void (**f)(void *)); 461void CRYPTO_get_mem_functions(void *(**m)(size_t),void *(**r)(void *, size_t), void (**f)(void *));
478void CRYPTO_get_locked_mem_functions(void *(**m)(size_t), void (**f)(void *)); 462void CRYPTO_get_locked_mem_functions(void *(**m)(size_t), void (**f)(void *));
479void CRYPTO_get_mem_ex_functions(void *(**m)(size_t,const char *,int), 463void CRYPTO_get_mem_ex_functions(void *(**m)(size_t,const char *,int),
@@ -530,6 +514,9 @@ void CRYPTO_dbg_free(void *addr,int before_p);
530void CRYPTO_dbg_set_options(long bits); 514void CRYPTO_dbg_set_options(long bits);
531long CRYPTO_dbg_get_options(void); 515long CRYPTO_dbg_get_options(void);
532 516
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);
533 520
534#ifndef OPENSSL_NO_FP_API 521#ifndef OPENSSL_NO_FP_API
535void CRYPTO_mem_leaks_fp(FILE *); 522void CRYPTO_mem_leaks_fp(FILE *);
@@ -547,12 +534,69 @@ unsigned long *OPENSSL_ia32cap_loc(void);
547#define OPENSSL_ia32cap (*(OPENSSL_ia32cap_loc())) 534#define OPENSSL_ia32cap (*(OPENSSL_ia32cap_loc()))
548int OPENSSL_isservice(void); 535int OPENSSL_isservice(void);
549 536
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
550/* BEGIN ERROR CODES */ 591/* BEGIN ERROR CODES */
551/* The following lines are auto generated by the script mkerr.pl. Any changes 592/* The following lines are auto generated by the script mkerr.pl. Any changes
552 * made after this point may be overwritten when the script is next run. 593 * made after this point may be overwritten when the script is next run.
553 */ 594 */
554void ERR_load_CRYPTO_strings(void); 595void ERR_load_CRYPTO_strings(void);
555 596
597#define OPENSSL_HAVE_INIT 1
598void OPENSSL_init(void);
599
556/* Error codes for the CRYPTO functions. */ 600/* Error codes for the CRYPTO functions. */
557 601
558/* Function codes. */ 602/* Function codes. */