~ubuntu-branches/ubuntu/lucid/openssl/lucid-proposed

« back to all changes in this revision

Viewing changes to crypto/crypto.h

  • Committer: Bazaar Package Importer
  • Author(s): Kurt Roeckx
  • Date: 2009-06-13 18:15:46 UTC
  • mto: (11.1.5 squeeze)
  • mto: This revision was merged to the branch mainline in revision 34.
  • Revision ID: james.westby@ubuntu.com-20090613181546-vbfntai3b009dl1u
Tags: upstream-0.9.8k
ImportĀ upstreamĀ versionĀ 0.9.8k

Show diffs side-by-side

added added

removed removed

Lines of Context:
219
219
#define CRYPTO_LOCK_EC_PRE_COMP         36
220
220
#define CRYPTO_LOCK_STORE               37
221
221
#define CRYPTO_LOCK_COMP                38
 
222
#ifndef OPENSSL_FIPS
222
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
230
#define CRYPTO_LOCK             1
225
231
#define CRYPTO_UNLOCK           2
341
347
 
342
348
/* Set standard debugging functions (not done by default
343
349
 * unless CRYPTO_MDEBUG is defined) */
344
 
#define CRYPTO_malloc_debug_init()      do {\
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)
 
350
void CRYPTO_malloc_debug_init(void);
352
351
 
353
352
int CRYPTO_mem_ctrl(int mode);
354
353
int CRYPTO_is_mem_check_on(void);
363
362
#define is_MemCheck_on() CRYPTO_is_mem_check_on()
364
363
 
365
364
#define OPENSSL_malloc(num)     CRYPTO_malloc((int)num,__FILE__,__LINE__)
 
365
#define OPENSSL_strdup(str)     CRYPTO_strdup((str),__FILE__,__LINE__)
366
366
#define OPENSSL_realloc(addr,num) \
367
367
        CRYPTO_realloc((char *)addr,(int)num,__FILE__,__LINE__)
368
368
#define OPENSSL_realloc_clean(addr,old_num,num) \
427
427
int CRYPTO_add_lock(int *pointer,int amount,int type, const char *file,
428
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
433
int CRYPTO_get_new_dynlockid(void);
431
434
void CRYPTO_destroy_dynlockid(int i);
432
435
struct CRYPTO_dynlock_value *CRYPTO_get_dynlock_value(int i);
451
454
                                   void (*f)(void *,int),
452
455
                                   void (*so)(long),
453
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
461
void CRYPTO_get_mem_functions(void *(**m)(size_t),void *(**r)(void *, size_t), void (**f)(void *));
455
462
void CRYPTO_get_locked_mem_functions(void *(**m)(size_t), void (**f)(void *));
456
463
void CRYPTO_get_mem_ex_functions(void *(**m)(size_t,const char *,int),
467
474
void *CRYPTO_malloc_locked(int num, const char *file, int line);
468
475
void CRYPTO_free_locked(void *);
469
476
void *CRYPTO_malloc(int num, const char *file, int line);
 
477
char *CRYPTO_strdup(const char *str, const char *file, int line);
470
478
void CRYPTO_free(void *);
471
479
void *CRYPTO_realloc(void *addr,int num, const char *file, int line);
472
480
void *CRYPTO_realloc_clean(void *addr,int old_num,int num,const char *file,
506
514
void CRYPTO_dbg_set_options(long bits);
507
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
521
#ifndef OPENSSL_NO_FP_API
511
522
void CRYPTO_mem_leaks_fp(FILE *);
521
532
 
522
533
unsigned long *OPENSSL_ia32cap_loc(void);
523
534
#define OPENSSL_ia32cap (*(OPENSSL_ia32cap_loc()))
 
535
int OPENSSL_isservice(void);
 
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 */
524
590
 
525
591
/* BEGIN ERROR CODES */
526
592
/* The following lines are auto generated by the script mkerr.pl. Any changes
528
594
 */
529
595
void ERR_load_CRYPTO_strings(void);
530
596
 
 
597
#define OPENSSL_HAVE_INIT       1
 
598
void OPENSSL_init(void);
 
599
 
531
600
/* Error codes for the CRYPTO functions. */
532
601
 
533
602
/* Function codes. */