diff options
author | Jack Lloyd <[email protected]> | 2018-08-10 15:18:44 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-08-10 15:18:44 -0400 |
commit | f868b8d31e91a0ae4fbc065621c2136ba898b538 (patch) | |
tree | 8e60fdd96f1c3ed31e75b6bb22a38e0b434fac3e /src/lib/ffi/ffi_pk_op.cpp | |
parent | 36a7ec51b23b5d30e42480ef8a8a16468804065f (diff) |
Add a function to query output length of symmetric cipher
Diffstat (limited to 'src/lib/ffi/ffi_pk_op.cpp')
-rw-r--r-- | src/lib/ffi/ffi_pk_op.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/lib/ffi/ffi_pk_op.cpp b/src/lib/ffi/ffi_pk_op.cpp index 0f18fca3e..5f2437a10 100644 --- a/src/lib/ffi/ffi_pk_op.cpp +++ b/src/lib/ffi/ffi_pk_op.cpp @@ -46,6 +46,8 @@ int botan_pk_op_encrypt_destroy(botan_pk_op_encrypt_t op) int botan_pk_op_encrypt_output_length(botan_pk_op_encrypt_t op, size_t ptext_len, size_t* ctext_len) { + if(ctext_len == nullptr) + return BOTAN_FFI_ERROR_NULL_POINTER; return BOTAN_FFI_DO(Botan::PK_Encryptor, op, o, { *ctext_len = o.ciphertext_length(ptext_len); }); } @@ -88,6 +90,8 @@ int botan_pk_op_decrypt_destroy(botan_pk_op_decrypt_t op) int botan_pk_op_decrypt_output_length(botan_pk_op_decrypt_t op, size_t ctext_len, size_t* ptext_len) { + if(ptext_len == nullptr) + return BOTAN_FFI_ERROR_NULL_POINTER; return BOTAN_FFI_DO(Botan::PK_Decryptor, op, o, { *ptext_len = o.plaintext_length(ctext_len); }); } |