Skip to content

Commit

Permalink
Move cipher BIO to pkcs7 directory
Browse files Browse the repository at this point in the history
  • Loading branch information
WillChilds-Klein committed Sep 27, 2024
1 parent 1a1c917 commit 31034f9
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 18 deletions.
4 changes: 2 additions & 2 deletions crypto/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,6 @@ add_library(
base64/base64.c
bio/bio.c
bio/bio_mem.c
bio/cipher.c
bio/connect.c
bio/errno.c
bio/fd.c
Expand Down Expand Up @@ -463,6 +462,7 @@ add_library(
pem/pem_pkey.c
pem/pem_x509.c
pem/pem_xaux.c
pkcs7/bio/cipher.c
pkcs7/pkcs7.c
pkcs7/pkcs7_asn1.c
pkcs7/pkcs7_x509.c
Expand Down Expand Up @@ -761,7 +761,6 @@ if(BUILD_TESTING)
abi_self_test.cc
asn1/asn1_test.cc
base64/base64_test.cc
bio/bio_deprecated_test.cc
bio/bio_test.cc
blake2/blake2_test.cc
buf/buf_test.cc
Expand Down Expand Up @@ -818,6 +817,7 @@ if(BUILD_TESTING)
obj/obj_test.cc
ocsp/ocsp_test.cc
pem/pem_test.cc
pkcs7/bio/bio_deprecated_test.cc
pkcs7/pkcs7_test.cc
pkcs8/pkcs8_test.cc
pkcs8/pkcs12_test.cc
Expand Down
10 changes: 0 additions & 10 deletions crypto/bio/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,16 +114,6 @@ int bio_socket_should_retry(int return_value);
int bio_errno_should_retry(int return_value);


// BIO_f_cipher is used internally by the pkcs7 module. It is not recommended
// for external use.
OPENSSL_EXPORT const BIO_METHOD *BIO_f_cipher(void);

// BIO_set_cipher is used internally for testing. It is not recommended for
// external use.
OPENSSL_EXPORT int BIO_set_cipher(BIO *b, const EVP_CIPHER *cipher,
const unsigned char *key, const unsigned char *iv, int enc);


#if defined(__cplusplus)
} // extern C
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
#include <openssl/rand.h>
#include <openssl/x509.h>

#include "./internal.h"
#include "../internal.h"
#include "../test/test_util.h"
#include "../../test/test_util.h"

// NOTE: need to keep these in sync with cipher BIO source file
#define ENC_MIN_CHUNK_SIZE 256
Expand All @@ -37,7 +36,7 @@ static const struct CipherParams Ciphers[] = {

class BIODeprecatedTest : public testing::TestWithParam<CipherParams> {};

INSTANTIATE_TEST_SUITE_P(ALL, BIODeprecatedTest, testing::ValuesIn(Ciphers),
INSTANTIATE_TEST_SUITE_P(PKCS7Test, BIODeprecatedTest, testing::ValuesIn(Ciphers),
[](const testing::TestParamInfo<CipherParams> &params)
-> std::string { return params.param.name; });

Expand Down
4 changes: 1 addition & 3 deletions crypto/bio/cipher.c → crypto/pkcs7/bio/cipher.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@
#include <openssl/mem.h>
#include <openssl/pkcs7.h>
#include <stdio.h>
#include "../crypto/bio/internal.h"
#include "../fipsmodule/cipher/internal.h"
#include "../../fipsmodule/cipher/internal.h"
#include "../internal.h"
#include "./internal.h"

static int enc_write(BIO *h, const char *buf, int num);
static int enc_read(BIO *h, char *buf, int size);
Expand Down
11 changes: 11 additions & 0 deletions crypto/pkcs7/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,17 @@ int pkcs7_add_signed_data(CBB *out,
int (*signer_infos_cb)(CBB *out, const void *arg),
const void *arg);


// BIO_f_cipher is used internally by the pkcs7 module. It is not recommended
// for external use.
OPENSSL_EXPORT const BIO_METHOD *BIO_f_cipher(void);

// BIO_set_cipher is used internally for testing. It is not recommended for
// external use.
OPENSSL_EXPORT int BIO_set_cipher(BIO *b, const EVP_CIPHER *cipher,
const unsigned char *key, const unsigned char *iv, int enc);


#if defined(__cplusplus)
} // extern C
#endif
Expand Down

0 comments on commit 31034f9

Please sign in to comment.