diff options
Diffstat (limited to 'src/lib/libcrypto/evp/e_bf.c')
| -rw-r--r-- | src/lib/libcrypto/evp/e_bf.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/lib/libcrypto/evp/e_bf.c b/src/lib/libcrypto/evp/e_bf.c index 72047f64da..e74337567b 100644 --- a/src/lib/libcrypto/evp/e_bf.c +++ b/src/lib/libcrypto/evp/e_bf.c | |||
| @@ -56,24 +56,32 @@ | |||
| 56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | #ifndef NO_BF | 59 | #ifndef OPENSSL_NO_BF |
| 60 | #include <stdio.h> | 60 | #include <stdio.h> |
| 61 | #include "cryptlib.h" | 61 | #include "cryptlib.h" |
| 62 | #include <openssl/evp.h> | 62 | #include <openssl/evp.h> |
| 63 | #include "evp_locl.h" | 63 | #include "evp_locl.h" |
| 64 | #include <openssl/objects.h> | 64 | #include <openssl/objects.h> |
| 65 | #include <openssl/blowfish.h> | ||
| 65 | 66 | ||
| 66 | static int bf_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | 67 | static int bf_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, |
| 67 | const unsigned char *iv, int enc); | 68 | const unsigned char *iv, int enc); |
| 68 | 69 | ||
| 69 | IMPLEMENT_BLOCK_CIPHER(bf, bf_ks, BF, bf_ks, NID_bf, 8, 16, 8, | 70 | typedef struct |
| 70 | 0, bf_init_key, NULL, | 71 | { |
| 72 | BF_KEY ks; | ||
| 73 | } EVP_BF_KEY; | ||
| 74 | |||
| 75 | #define data(ctx) EVP_C_DATA(EVP_BF_KEY,ctx) | ||
| 76 | |||
| 77 | IMPLEMENT_BLOCK_CIPHER(bf, ks, BF, EVP_BF_KEY, NID_bf, 8, 16, 8, 64, | ||
| 78 | EVP_CIPH_VARIABLE_LENGTH, bf_init_key, NULL, | ||
| 71 | EVP_CIPHER_set_asn1_iv, EVP_CIPHER_get_asn1_iv, NULL) | 79 | EVP_CIPHER_set_asn1_iv, EVP_CIPHER_get_asn1_iv, NULL) |
| 72 | 80 | ||
| 73 | static int bf_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | 81 | static int bf_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, |
| 74 | const unsigned char *iv, int enc) | 82 | const unsigned char *iv, int enc) |
| 75 | { | 83 | { |
| 76 | BF_set_key(&(ctx->c.bf_ks),EVP_CIPHER_CTX_key_length(ctx),key); | 84 | BF_set_key(&data(ctx)->ks,EVP_CIPHER_CTX_key_length(ctx),key); |
| 77 | return 1; | 85 | return 1; |
| 78 | } | 86 | } |
| 79 | 87 | ||
