diff options
Diffstat (limited to 'src/lib/libcrypto/crypto.h')
-rw-r--r-- | src/lib/libcrypto/crypto.h | 84 |
1 files changed, 76 insertions, 8 deletions
diff --git a/src/lib/libcrypto/crypto.h b/src/lib/libcrypto/crypto.h index fe2c1d6403..0e4fb0723c 100644 --- a/src/lib/libcrypto/crypto.h +++ b/src/lib/libcrypto/crypto.h | |||
@@ -219,7 +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 | ||
222 | #define CRYPTO_NUM_LOCKS 39 | 223 | #define CRYPTO_NUM_LOCKS 39 |
224 | #else | ||
225 | #define CRYPTO_LOCK_FIPS 39 | ||
226 | #define CRYPTO_LOCK_FIPS2 40 | ||
227 | #define CRYPTO_NUM_LOCKS 41 | ||
228 | #endif | ||
223 | 229 | ||
224 | #define CRYPTO_LOCK 1 | 230 | #define CRYPTO_LOCK 1 |
225 | #define CRYPTO_UNLOCK 2 | 231 | #define CRYPTO_UNLOCK 2 |
@@ -341,14 +347,7 @@ DECLARE_STACK_OF(CRYPTO_EX_DATA_FUNCS) | |||
341 | 347 | ||
342 | /* Set standard debugging functions (not done by default | 348 | /* Set standard debugging functions (not done by default |
343 | * unless CRYPTO_MDEBUG is defined) */ | 349 | * unless CRYPTO_MDEBUG is defined) */ |
344 | #define CRYPTO_malloc_debug_init() do {\ | 350 | void CRYPTO_malloc_debug_init(void); |
345 | CRYPTO_set_mem_debug_functions(\ | ||
346 | CRYPTO_dbg_malloc,\ | ||
347 | CRYPTO_dbg_realloc,\ | ||
348 | CRYPTO_dbg_free,\ | ||
349 | CRYPTO_dbg_set_options,\ | ||
350 | CRYPTO_dbg_get_options);\ | ||
351 | } while(0) | ||
352 | 351 | ||
353 | int CRYPTO_mem_ctrl(int mode); | 352 | int CRYPTO_mem_ctrl(int mode); |
354 | int CRYPTO_is_mem_check_on(void); | 353 | int CRYPTO_is_mem_check_on(void); |
@@ -363,6 +362,7 @@ int CRYPTO_is_mem_check_on(void); | |||
363 | #define is_MemCheck_on() CRYPTO_is_mem_check_on() | 362 | #define is_MemCheck_on() CRYPTO_is_mem_check_on() |
364 | 363 | ||
365 | #define OPENSSL_malloc(num) CRYPTO_malloc((int)num,__FILE__,__LINE__) | 364 | #define OPENSSL_malloc(num) CRYPTO_malloc((int)num,__FILE__,__LINE__) |
365 | #define OPENSSL_strdup(str) CRYPTO_strdup((str),__FILE__,__LINE__) | ||
366 | #define OPENSSL_realloc(addr,num) \ | 366 | #define OPENSSL_realloc(addr,num) \ |
367 | CRYPTO_realloc((char *)addr,(int)num,__FILE__,__LINE__) | 367 | CRYPTO_realloc((char *)addr,(int)num,__FILE__,__LINE__) |
368 | #define OPENSSL_realloc_clean(addr,old_num,num) \ | 368 | #define OPENSSL_realloc_clean(addr,old_num,num) \ |
@@ -427,6 +427,9 @@ const char *CRYPTO_get_lock_name(int type); | |||
427 | int CRYPTO_add_lock(int *pointer,int amount,int type, const char *file, | 427 | int CRYPTO_add_lock(int *pointer,int amount,int type, const char *file, |
428 | int line); | 428 | int line); |
429 | 429 | ||
430 | void int_CRYPTO_set_do_dynlock_callback( | ||
431 | void (*do_dynlock_cb)(int mode, int type, const char *file, int line)); | ||
432 | |||
430 | int CRYPTO_get_new_dynlockid(void); | 433 | int CRYPTO_get_new_dynlockid(void); |
431 | void CRYPTO_destroy_dynlockid(int i); | 434 | void CRYPTO_destroy_dynlockid(int i); |
432 | struct CRYPTO_dynlock_value *CRYPTO_get_dynlock_value(int i); | 435 | struct CRYPTO_dynlock_value *CRYPTO_get_dynlock_value(int i); |
@@ -451,6 +454,10 @@ int CRYPTO_set_mem_debug_functions(void (*m)(void *,int,const char *,int,int), | |||
451 | void (*f)(void *,int), | 454 | void (*f)(void *,int), |
452 | void (*so)(long), | 455 | void (*so)(long), |
453 | long (*go)(void)); | 456 | long (*go)(void)); |
457 | void 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)); | ||
454 | void CRYPTO_get_mem_functions(void *(**m)(size_t),void *(**r)(void *, size_t), void (**f)(void *)); | 461 | void CRYPTO_get_mem_functions(void *(**m)(size_t),void *(**r)(void *, size_t), void (**f)(void *)); |
455 | void CRYPTO_get_locked_mem_functions(void *(**m)(size_t), void (**f)(void *)); | 462 | void CRYPTO_get_locked_mem_functions(void *(**m)(size_t), void (**f)(void *)); |
456 | void CRYPTO_get_mem_ex_functions(void *(**m)(size_t,const char *,int), | 463 | void CRYPTO_get_mem_ex_functions(void *(**m)(size_t,const char *,int), |
@@ -467,6 +474,7 @@ void CRYPTO_get_mem_debug_functions(void (**m)(void *,int,const char *,int,int), | |||
467 | void *CRYPTO_malloc_locked(int num, const char *file, int line); | 474 | void *CRYPTO_malloc_locked(int num, const char *file, int line); |
468 | void CRYPTO_free_locked(void *); | 475 | void CRYPTO_free_locked(void *); |
469 | void *CRYPTO_malloc(int num, const char *file, int line); | 476 | void *CRYPTO_malloc(int num, const char *file, int line); |
477 | char *CRYPTO_strdup(const char *str, const char *file, int line); | ||
470 | void CRYPTO_free(void *); | 478 | void CRYPTO_free(void *); |
471 | void *CRYPTO_realloc(void *addr,int num, const char *file, int line); | 479 | void *CRYPTO_realloc(void *addr,int num, const char *file, int line); |
472 | void *CRYPTO_realloc_clean(void *addr,int old_num,int num,const char *file, | 480 | void *CRYPTO_realloc_clean(void *addr,int old_num,int num,const char *file, |
@@ -506,6 +514,9 @@ void CRYPTO_dbg_free(void *addr,int before_p); | |||
506 | void CRYPTO_dbg_set_options(long bits); | 514 | void CRYPTO_dbg_set_options(long bits); |
507 | long CRYPTO_dbg_get_options(void); | 515 | long CRYPTO_dbg_get_options(void); |
508 | 516 | ||
517 | int CRYPTO_dbg_push_info(const char *info, const char *file, int line); | ||
518 | int CRYPTO_dbg_pop_info(void); | ||
519 | int CRYPTO_dbg_remove_all_info(void); | ||
509 | 520 | ||
510 | #ifndef OPENSSL_NO_FP_API | 521 | #ifndef OPENSSL_NO_FP_API |
511 | void CRYPTO_mem_leaks_fp(FILE *); | 522 | void CRYPTO_mem_leaks_fp(FILE *); |
@@ -523,12 +534,69 @@ unsigned long *OPENSSL_ia32cap_loc(void); | |||
523 | #define OPENSSL_ia32cap (*(OPENSSL_ia32cap_loc())) | 534 | #define OPENSSL_ia32cap (*(OPENSSL_ia32cap_loc())) |
524 | int OPENSSL_isservice(void); | 535 | int OPENSSL_isservice(void); |
525 | 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 | |||
526 | /* BEGIN ERROR CODES */ | 591 | /* BEGIN ERROR CODES */ |
527 | /* 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 |
528 | * 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. |
529 | */ | 594 | */ |
530 | void ERR_load_CRYPTO_strings(void); | 595 | void ERR_load_CRYPTO_strings(void); |
531 | 596 | ||
597 | #define OPENSSL_HAVE_INIT 1 | ||
598 | void OPENSSL_init(void); | ||
599 | |||
532 | /* Error codes for the CRYPTO functions. */ | 600 | /* Error codes for the CRYPTO functions. */ |
533 | 601 | ||
534 | /* Function codes. */ | 602 | /* Function codes. */ |