aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2017-04-08 12:13:58 -0400
committerJack Lloyd <[email protected]>2017-04-08 12:13:58 -0400
commit5aa2e329926b2bec9abba0b69fbbe290f39f202a (patch)
treea9326ee44f0da1466d73f566f65f148f8b32ba61 /src
parentcb3561e358930b2d661fb0e2570e89d9725471d9 (diff)
Small ffi fixes
Constify arg to botan_pk_op_decrypt, and correct comment on botan_mp_is_positive, which returns true even for zero. Considered changing botan_mp_is_positive to match the comment, and return false for zero, but we already test that botan_mp_is_positive(0) == 1, so I left it as is and fixed the comment.
Diffstat (limited to 'src')
-rw-r--r--src/lib/ffi/ffi.cpp2
-rw-r--r--src/lib/ffi/ffi.h8
2 files changed, 6 insertions, 4 deletions
diff --git a/src/lib/ffi/ffi.cpp b/src/lib/ffi/ffi.cpp
index b4f0412d6..7cf69efb3 100644
--- a/src/lib/ffi/ffi.cpp
+++ b/src/lib/ffi/ffi.cpp
@@ -1888,7 +1888,7 @@ int botan_pk_op_decrypt_destroy(botan_pk_op_decrypt_t op)
int botan_pk_op_decrypt(botan_pk_op_decrypt_t op,
uint8_t out[], size_t* out_len,
- uint8_t ciphertext[], size_t ciphertext_len)
+ const uint8_t ciphertext[], size_t ciphertext_len)
{
return BOTAN_FFI_DO(Botan::PK_Decryptor, op, o, {
return write_vec_output(out, out_len, o.decrypt(ciphertext, ciphertext_len));
diff --git a/src/lib/ffi/ffi.h b/src/lib/ffi/ffi.h
index 76cdaa145..59e767385 100644
--- a/src/lib/ffi/ffi.h
+++ b/src/lib/ffi/ffi.h
@@ -529,12 +529,14 @@ BOTAN_DLL int botan_mp_from_bin(const botan_mp_t mp, const uint8_t vec[], size_t
BOTAN_DLL int botan_mp_to_uint32(const botan_mp_t mp, uint32_t* val);
/**
-* Return true iff mp is greater than 0
+* This function is not well named. Returns 1 iff mp is greater than
+* *or equal to* zero. Use botan_mp_is_negative to detect negative
+* numbers, botan_mp_is_zero to check for zero.
*/
BOTAN_DLL int botan_mp_is_positive(const botan_mp_t mp);
/**
-* Return true iff mp is less than 0
+* Return 1 iff mp is less than 0
*/
BOTAN_DLL int botan_mp_is_negative(const botan_mp_t mp);
@@ -812,7 +814,7 @@ BOTAN_DLL int botan_pk_op_decrypt_destroy(botan_pk_op_decrypt_t op);
BOTAN_DLL int botan_pk_op_decrypt(botan_pk_op_decrypt_t op,
uint8_t out[], size_t* out_len,
- uint8_t ciphertext[], size_t ciphertext_len);
+ const uint8_t ciphertext[], size_t ciphertext_len);
/*
* Signature Generation