Skip to content

Commit

Permalink
Remove themis_version() API (#388)
Browse files Browse the repository at this point in the history
As discussed on GitHub and offline, remove themis_version() function
and all related API for querying Themis and Soter versions at run
time. There is no replacement and this is obviously a breaking change.

This API was not really widely used and it is a bit bothersome to
maintain. It is recommended to not depend on Themis version at run
time. Applications should link against a particular version of Themis
during build or development (whatever is applicable to the language
environment). The version should be selected by the package manager:
either the system one for Themis core, or language-specific for
language bindings.

themis_version() was used tests to print a version banner, that's not
really important. It was also used by Rust binding to verify that FFI
calls can be made, replace it with some other function. And it was also
exported for Ruby programs, drop the export.

Note that the code still contains hardcoded versions in Makefile
as well as in PHP and PHP7 bindings. These are going to stay for
technical reasons.
  • Loading branch information
ilammy committed Feb 22, 2019
1 parent 29ebf63 commit 6518d33
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 114 deletions.
31 changes: 0 additions & 31 deletions src/soter/boringssl/soter.c

This file was deleted.

31 changes: 0 additions & 31 deletions src/soter/openssl/soter.c

This file was deleted.

9 changes: 0 additions & 9 deletions src/soter/soter.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
* @{
*/

#define SOTER_VERSION_TEXT "soter 0.9: "

#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>
Expand All @@ -47,12 +45,5 @@
#include <soter/soter_asym_sign.h>
#include <soter/soter_kdf.h>

/**
* @brief get version string of soter
*
* @return version string
*
*/
const char* soter_version(void);
/**@}*/
#endif /* SOTER_H */
29 changes: 0 additions & 29 deletions src/themis/themis.c

This file was deleted.

4 changes: 0 additions & 4 deletions src/themis/themis.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,12 @@
* @{
*/

#define THEMIS_VERSION_TEXT "themis 0.9: "

#include <themis/themis_error.h>
#include <themis/secure_message.h>
#include <themis/secure_cell.h>
#include <themis/secure_session.h>
#include <themis/secure_comparator.h>

const char* themis_version(void);

/** @} */
#endif /* THEMIS_H */

Expand Down
1 change: 0 additions & 1 deletion src/wrappers/themis/ruby/lib/rubythemis.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ class CallbacksStruct < FFI::Struct
[:pointer, :pointer, :pointer, :pointer], :int
attach_function :themis_gen_ec_key_pair,
[:pointer, :pointer, :pointer, :pointer], :int
attach_function :themis_version, [], :string

attach_function :themis_secure_cell_encrypt_seal,
[:pointer, :int, :pointer, :int, :pointer, :int,
Expand Down
24 changes: 16 additions & 8 deletions src/wrappers/themis/rust/libthemis-sys/tests/sanity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,22 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use std::ffi::CStr;
use std::ptr;

#[test]
fn check_version() {
let version = unsafe { CStr::from_ptr(libthemis_sys::themis_version()) };
// Themis 0.10.0 is slightly buggy and identifies itself as 0.9.
assert!(version
.to_str()
.expect("valid UTF-8")
.contains("themis 0.9"));
fn check_ffi_call() {
let mut private_key_len = 0;
let mut public_key_len = 0;
let status = unsafe {
libthemis_sys::themis_gen_ec_key_pair(
ptr::null_mut(),
&mut private_key_len,
ptr::null_mut(),
&mut public_key_len,
)
};
assert_eq!(
status,
libthemis_sys::THEMIS_BUFFER_TOO_SMALL as libthemis_sys::themis_status_t
);
}
1 change: 0 additions & 1 deletion tests/themis/themis_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ int main(int argc, char* argv[])
{
UNUSED(argc);
UNUSED(argv);
printf("%s\n", themis_version());
testsuite_start_testing();

run_secure_message_test();
Expand Down

0 comments on commit 6518d33

Please sign in to comment.