Support PADDING_NONE for encryption too
This commit is contained in:
@@ -2487,12 +2487,17 @@ hx509_crypto_encrypt(hx509_crypto crypto,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EVP_CIPHER_block_size(crypto->c) == 1) {
|
assert(crypto->flags & PADDING_FLAGS);
|
||||||
|
if (crypto->flags & PADDING_NONE) {
|
||||||
padsize = 0;
|
padsize = 0;
|
||||||
|
} else if (crypto->flags & PADDING_PKCS7) {
|
||||||
|
if (EVP_CIPHER_block_size(crypto->c) == 1) {
|
||||||
} else {
|
} else {
|
||||||
int bsize = EVP_CIPHER_block_size(crypto->c);
|
int bsize = EVP_CIPHER_block_size(crypto->c);
|
||||||
padsize = bsize - (length % bsize);
|
padsize = bsize - (length % bsize);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
(*ciphertext)->length = length + padsize;
|
(*ciphertext)->length = length + padsize;
|
||||||
(*ciphertext)->data = malloc(length + padsize);
|
(*ciphertext)->data = malloc(length + padsize);
|
||||||
if ((*ciphertext)->data == NULL) {
|
if ((*ciphertext)->data == NULL) {
|
||||||
|
Reference in New Issue
Block a user