Skip to content

Commit

Permalink
Implement PKCS7_encrypt and PKC7_decrypt
Browse files Browse the repository at this point in the history
  • Loading branch information
WillChilds-Klein committed Nov 18, 2024
1 parent ab8953b commit bdbaee1
Show file tree
Hide file tree
Showing 6 changed files with 510 additions and 19 deletions.
3 changes: 0 additions & 3 deletions crypto/pkcs7/bio/bio_cipher_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
// NOTE: need to keep this in sync with sizeof(ctx->buf) cipher.c
#define ENC_BLOCK_SIZE 1024 * 4

#define BIO_get_cipher_status(bio) \
BIO_ctrl(bio, BIO_C_GET_CIPHER_STATUS, 0, NULL)

struct CipherParams {
const char name[40];
const EVP_CIPHER *(*cipher)(void);
Expand Down
5 changes: 4 additions & 1 deletion crypto/pkcs7/bio/cipher.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ static int enc_write(BIO *b, const char *in, int inl) {
static long enc_ctrl(BIO *b, int cmd, long num, void *ptr) {
GUARD_PTR(b);
long ret = 1;

BIO_ENC_CTX *ctx = BIO_get_data(b);
EVP_CIPHER_CTX **cipher_ctx;
BIO *next = BIO_next(b);
Expand Down Expand Up @@ -326,3 +325,7 @@ const BIO_METHOD *BIO_f_cipher(void) { return &methods_enc; }
int BIO_get_cipher_ctx(BIO *b, EVP_CIPHER_CTX **ctx) {
return BIO_ctrl(b, BIO_C_GET_CIPHER_CTX, 0, ctx);
}

int BIO_get_cipher_status(BIO *b) {
return BIO_ctrl(b, BIO_C_GET_CIPHER_STATUS, 0, NULL);
}
Loading

0 comments on commit bdbaee1

Please sign in to comment.