2016-05-18 02:24:46 +08:00
|
|
|
/*
|
2020-04-23 20:55:52 +08:00
|
|
|
* Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
|
1998-12-21 18:52:47 +08:00
|
|
|
*
|
2018-12-06 20:40:06 +08:00
|
|
|
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
2016-05-18 02:24:46 +08:00
|
|
|
* this file except in compliance with the License. You can obtain a copy
|
|
|
|
* in the file LICENSE in the source distribution or at
|
|
|
|
* https://www.openssl.org/source/license.html
|
1998-12-21 18:52:47 +08:00
|
|
|
*/
|
|
|
|
|
2020-01-02 22:25:27 +08:00
|
|
|
/*
|
|
|
|
* BF low level APIs are deprecated for public use, but still ok for internal
|
|
|
|
* use.
|
|
|
|
*/
|
|
|
|
#include "internal/deprecated.h"
|
|
|
|
|
1998-12-21 18:52:47 +08:00
|
|
|
#include <stdio.h>
|
2015-05-14 22:56:48 +08:00
|
|
|
#include "internal/cryptlib.h"
|
2003-03-21 07:28:16 +08:00
|
|
|
#ifndef OPENSSL_NO_BF
|
2015-01-22 11:40:55 +08:00
|
|
|
# include <openssl/evp.h>
|
2019-09-28 06:45:33 +08:00
|
|
|
# include "crypto/evp.h"
|
2015-01-22 11:40:55 +08:00
|
|
|
# include <openssl/objects.h>
|
|
|
|
# include <openssl/blowfish.h>
|
2020-07-03 05:12:33 +08:00
|
|
|
# include "evp_local.h"
|
1998-12-21 18:52:47 +08:00
|
|
|
|
2000-06-03 22:13:58 +08:00
|
|
|
static int bf_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
2015-01-22 11:40:55 +08:00
|
|
|
const unsigned char *iv, int enc);
|
1998-12-21 18:52:47 +08:00
|
|
|
|
2015-01-22 11:40:55 +08:00
|
|
|
typedef struct {
|
|
|
|
BF_KEY ks;
|
|
|
|
} EVP_BF_KEY;
|
2001-07-31 07:57:25 +08:00
|
|
|
|
2015-01-22 11:40:55 +08:00
|
|
|
# define data(ctx) EVP_C_DATA(EVP_BF_KEY,ctx)
|
2001-07-31 07:57:25 +08:00
|
|
|
|
2002-02-16 20:39:07 +08:00
|
|
|
IMPLEMENT_BLOCK_CIPHER(bf, ks, BF, EVP_BF_KEY, NID_bf, 8, 16, 8, 64,
|
2015-01-22 11:40:55 +08:00
|
|
|
EVP_CIPH_VARIABLE_LENGTH, bf_init_key, NULL,
|
|
|
|
EVP_CIPHER_set_asn1_iv, EVP_CIPHER_get_asn1_iv, NULL)
|
|
|
|
|
2000-06-03 22:13:58 +08:00
|
|
|
static int bf_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
2015-01-22 11:40:55 +08:00
|
|
|
const unsigned char *iv, int enc)
|
|
|
|
{
|
Rename all getters to use get/get0 in name
For functions that exist in 1.1.1 provide a simple aliases via #define.
Fixes #15236
Functions with OSSL_DECODER_, OSSL_ENCODER_, OSSL_STORE_LOADER_,
EVP_KEYEXCH_, EVP_KEM_, EVP_ASYM_CIPHER_, EVP_SIGNATURE_,
EVP_KEYMGMT_, EVP_RAND_, EVP_MAC_, EVP_KDF_, EVP_PKEY_,
EVP_MD_, and EVP_CIPHER_ prefixes are renamed.
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15405)
2021-05-21 22:58:08 +08:00
|
|
|
BF_set_key(&data(ctx)->ks, EVP_CIPHER_CTX_get_key_length(ctx), key);
|
2015-01-22 11:40:55 +08:00
|
|
|
return 1;
|
|
|
|
}
|
1998-12-21 18:52:47 +08:00
|
|
|
|
|
|
|
#endif
|