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

« back to all changes in this revision

Viewing changes to crypto/evp/evp.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:
75
75
#include <openssl/bio.h>
76
76
#endif
77
77
 
 
78
#ifdef OPENSSL_FIPS
 
79
#include <openssl/fips.h>
 
80
#endif
 
81
 
78
82
/*
79
83
#define EVP_RC2_KEY_SIZE                16
80
84
#define EVP_RC4_KEY_SIZE                16
250
254
                            unsigned int m_length,const unsigned char *sigbuf,
251
255
                            unsigned int siglen, void *key);
252
256
 
 
257
typedef struct
 
258
        {
 
259
        EVP_MD_CTX *mctx;
 
260
        void *key;
 
261
        } EVP_MD_SVCTX;
 
262
 
253
263
#define EVP_MD_FLAG_ONESHOT     0x0001 /* digest can only handle a single
254
264
                                        * block */
255
265
 
 
266
#define EVP_MD_FLAG_FIPS        0x0400 /* Note if suitable for use in FIPS mode */
 
267
 
 
268
#define EVP_MD_FLAG_SVCTX       0x0800 /* pass EVP_MD_SVCTX to sign/verify */
 
269
 
256
270
#define EVP_PKEY_NULL_method    NULL,NULL,{0,0,0,0}
257
271
 
258
272
#ifndef OPENSSL_NO_DSA
303
317
                                                * cleaned */
304
318
#define EVP_MD_CTX_FLAG_REUSE           0x0004 /* Don't free up ctx->md_data
305
319
                                                * in EVP_MD_CTX_cleanup */
 
320
#define EVP_MD_CTX_FLAG_NON_FIPS_ALLOW  0x0008  /* Allow use of non FIPS digest
 
321
                                                 * in FIPS mode */
 
322
 
 
323
#define EVP_MD_CTX_FLAG_PAD_MASK        0xF0    /* RSA mode to use */
 
324
#define EVP_MD_CTX_FLAG_PAD_PKCS1       0x00    /* PKCS#1 v1.5 mode */
 
325
#define EVP_MD_CTX_FLAG_PAD_X931        0x10    /* X9.31 mode */
 
326
#define EVP_MD_CTX_FLAG_PAD_PSS         0x20    /* PSS mode */
 
327
#define M_EVP_MD_CTX_FLAG_PSS_SALT(ctx) \
 
328
                ((ctx->flags>>16) &0xFFFF) /* seed length */
 
329
#define EVP_MD_CTX_FLAG_PSS_MDLEN       0xFFFF  /* salt len same as digest */
 
330
#define EVP_MD_CTX_FLAG_PSS_MREC        0xFFFE  /* salt max or auto recovered */
306
331
 
307
332
struct evp_cipher_st
308
333
        {
347
372
#define         EVP_CIPH_NO_PADDING             0x100
348
373
/* cipher handles random key generation */
349
374
#define         EVP_CIPH_RAND_KEY               0x200
 
375
/* Note if suitable for use in FIPS mode */
 
376
#define         EVP_CIPH_FLAG_FIPS              0x400
 
377
/* Allow non FIPS cipher in FIPS mode */
 
378
#define         EVP_CIPH_FLAG_NON_FIPS_ALLOW    0x800
 
379
/* Allow use default ASN1 get/set iv */
 
380
#define         EVP_CIPH_FLAG_DEFAULT_ASN1      0x1000
 
381
/* Buffer length in bits not bytes: CFB1 mode only */
 
382
#define         EVP_CIPH_FLAG_LENGTH_BITS       0x2000
350
383
 
351
384
/* ctrl() values */
352
385
 
429
462
#define EVP_get_cipherbynid(a) EVP_get_cipherbyname(OBJ_nid2sn(a))
430
463
#define EVP_get_cipherbyobj(a) EVP_get_cipherbynid(OBJ_obj2nid(a))
431
464
 
 
465
/* Macros to reduce FIPS dependencies: do NOT use in applications */
 
466
#define M_EVP_MD_size(e)                ((e)->md_size)
 
467
#define M_EVP_MD_block_size(e)          ((e)->block_size)
 
468
#define M_EVP_MD_CTX_set_flags(ctx,flgs) ((ctx)->flags|=(flgs))
 
469
#define M_EVP_MD_CTX_clear_flags(ctx,flgs) ((ctx)->flags&=~(flgs))
 
470
#define M_EVP_MD_CTX_test_flags(ctx,flgs) ((ctx)->flags&(flgs))
 
471
#define M_EVP_MD_type(e)                        ((e)->type)
 
472
#define M_EVP_MD_CTX_type(e)            M_EVP_MD_type(M_EVP_MD_CTX_md(e))
 
473
#define M_EVP_MD_CTX_md(e)                      ((e)->digest)
 
474
 
 
475
#define M_EVP_CIPHER_CTX_set_flags(ctx,flgs) ((ctx)->flags|=(flgs))
 
476
 
432
477
int EVP_MD_type(const EVP_MD *md);
433
478
#define EVP_MD_nid(e)                   EVP_MD_type(e)
434
479
#define EVP_MD_name(e)                  OBJ_nid2sn(EVP_MD_nid(e))
524
569
                const unsigned char *salt, const unsigned char *data,
525
570
                int datal, int count, unsigned char *key,unsigned char *iv);
526
571
 
 
572
void    EVP_CIPHER_CTX_set_flags(EVP_CIPHER_CTX *ctx, int flags);
 
573
void    EVP_CIPHER_CTX_clear_flags(EVP_CIPHER_CTX *ctx, int flags);
 
574
int     EVP_CIPHER_CTX_test_flags(const EVP_CIPHER_CTX *ctx,int flags);
 
575
 
527
576
int     EVP_EncryptInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher,
528
577
                const unsigned char *key, const unsigned char *iv);
529
578
int     EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, ENGINE *impl,
879
928
                    EVP_PBE_KEYGEN *keygen);
880
929
void EVP_PBE_cleanup(void);
881
930
 
 
931
#ifdef OPENSSL_FIPS
 
932
#ifndef OPENSSL_NO_ENGINE
 
933
void int_EVP_MD_set_engine_callbacks(
 
934
        int (*eng_md_init)(ENGINE *impl),
 
935
        int (*eng_md_fin)(ENGINE *impl),
 
936
        int (*eng_md_evp)
 
937
                (EVP_MD_CTX *ctx, const EVP_MD **ptype, ENGINE *impl));
 
938
void int_EVP_MD_init_engine_callbacks(void);
 
939
void int_EVP_CIPHER_set_engine_callbacks(
 
940
        int (*eng_ciph_fin)(ENGINE *impl),
 
941
        int (*eng_ciph_evp)
 
942
                (EVP_CIPHER_CTX *ctx, const EVP_CIPHER **pciph, ENGINE *impl));
 
943
void int_EVP_CIPHER_init_engine_callbacks(void);
 
944
#endif
 
945
#endif
 
946
 
 
947
void EVP_add_alg_module(void);
 
948
 
882
949
/* BEGIN ERROR CODES */
883
950
/* The following lines are auto generated by the script mkerr.pl. Any changes
884
951
 * made after this point may be overwritten when the script is next run.
889
956
 
890
957
/* Function codes. */
891
958
#define EVP_F_AES_INIT_KEY                               133
 
959
#define EVP_F_ALG_MODULE_INIT                            138
892
960
#define EVP_F_CAMELLIA_INIT_KEY                          159
893
961
#define EVP_F_D2I_PKEY                                   100
 
962
#define EVP_F_DO_EVP_ENC_ENGINE                          140
 
963
#define EVP_F_DO_EVP_ENC_ENGINE_FULL                     141
 
964
#define EVP_F_DO_EVP_MD_ENGINE                           139
 
965
#define EVP_F_DO_EVP_MD_ENGINE_FULL                      142
894
966
#define EVP_F_DSAPKEY2PKCS8                              134
895
967
#define EVP_F_DSA_PKEY2PKCS8                             135
896
968
#define EVP_F_ECDSA_PKEY2PKCS8                           129
897
969
#define EVP_F_ECKEY_PKEY2PKCS8                           132
 
970
#define EVP_F_EVP_CIPHERINIT                             137
898
971
#define EVP_F_EVP_CIPHERINIT_EX                          123
899
972
#define EVP_F_EVP_CIPHER_CTX_CTRL                        124
900
973
#define EVP_F_EVP_CIPHER_CTX_SET_KEY_LENGTH              122
901
974
#define EVP_F_EVP_DECRYPTFINAL_EX                        101
 
975
#define EVP_F_EVP_DIGESTINIT                             136
902
976
#define EVP_F_EVP_DIGESTINIT_EX                          128
903
977
#define EVP_F_EVP_ENCRYPTFINAL_EX                        127
904
978
#define EVP_F_EVP_MD_CTX_COPY_EX                         110
940
1014
#define EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH          138
941
1015
#define EVP_R_DECODE_ERROR                               114
942
1016
#define EVP_R_DIFFERENT_KEY_TYPES                        101
 
1017
#define EVP_R_DISABLED_FOR_FIPS                          144
943
1018
#define EVP_R_ENCODE_ERROR                               115
 
1019
#define EVP_R_ERROR_LOADING_SECTION                      145
 
1020
#define EVP_R_ERROR_SETTING_FIPS_MODE                    146
944
1021
#define EVP_R_EVP_PBE_CIPHERINIT_ERROR                   119
945
1022
#define EVP_R_EXPECTING_AN_RSA_KEY                       127
946
1023
#define EVP_R_EXPECTING_A_DH_KEY                         128
947
1024
#define EVP_R_EXPECTING_A_DSA_KEY                        129
948
1025
#define EVP_R_EXPECTING_A_ECDSA_KEY                      141
949
1026
#define EVP_R_EXPECTING_A_EC_KEY                         142
 
1027
#define EVP_R_FIPS_MODE_NOT_SUPPORTED                    147
950
1028
#define EVP_R_INITIALIZATION_ERROR                       134
951
1029
#define EVP_R_INPUT_NOT_INITIALIZED                      111
 
1030
#define EVP_R_INVALID_FIPS_MODE                          148
952
1031
#define EVP_R_INVALID_KEY_LENGTH                         130
953
1032
#define EVP_R_IV_TOO_LARGE                               102
954
1033
#define EVP_R_KEYGEN_FAILURE                             120
960
1039
#define EVP_R_NO_VERIFY_FUNCTION_CONFIGURED              105
961
1040
#define EVP_R_PKCS8_UNKNOWN_BROKEN_TYPE                  117
962
1041
#define EVP_R_PUBLIC_KEY_NOT_RSA                         106
 
1042
#define EVP_R_UNKNOWN_OPTION                             149
963
1043
#define EVP_R_UNKNOWN_PBE_ALGORITHM                      121
964
1044
#define EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS                135
965
1045
#define EVP_R_UNSUPPORTED_CIPHER                         107