diff options
author | Pascal Bühler <pabuhler@cisco.com> | 2019-08-06 11:17:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-06 11:17:55 +0200 |
commit | 46755e2aa15b618854b1ab502b4787e584aa590d (patch) | |
tree | 4b9212ad45c703c837fa24304e3eed3c6dd14ded | |
parent | e8629b718d9efe1ccc254754ca33c88199e1bbf3 (diff) | |
parent | 670ed79cc90210011ffb18c6c43557490bd928e6 (diff) | |
download | libsrtp2-46755e2aa15b618854b1ab502b4787e584aa590d.tar.gz |
Merge pull request #459 from xhaakon/msvc-build
Add missing symbols to export into srtp.def
-rw-r--r-- | .travis.yml | 10 | ||||
-rw-r--r-- | CMakeLists.txt | 11 | ||||
-rw-r--r-- | crypto/include/datatypes.h | 6 | ||||
-rw-r--r-- | crypto/math/datatypes.c | 2 | ||||
-rw-r--r-- | srtp.def | 32 | ||||
-rw-r--r-- | srtp/srtp.c | 7 | ||||
-rw-r--r-- | test/srtp_driver.c | 28 |
7 files changed, 61 insertions, 35 deletions
diff --git a/.travis.yml b/.travis.yml index fe19c33..a7380f1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -52,6 +52,11 @@ matrix: - cmake -DENABLE_OPENSSL=ON .. - make - make test + - cd .. + - mkdir build_shared && cd build_shared + - cmake -DENABLE_OPENSSL=ON -DBUILD_SHARED_LIBS=ON .. + - make + - make test # linux build with openssl and clang - os: linux @@ -200,3 +205,8 @@ matrix: - cmake -G "Visual Studio 15 2017" .. - msbuild.exe libsrtp2.sln -p:Configuration=Release - msbuild.exe RUN_TESTS.vcxproj -p:Configuration=Release + - cd .. + - mkdir build_shared && cd build_shared + - cmake -G "Visual Studio 15 2017" -DBUILD_SHARED_LIBS=ON .. + - msbuild.exe libsrtp2.sln -p:Configuration=Release + - msbuild.exe RUN_TESTS.vcxproj -p:Configuration=Release diff --git a/CMakeLists.txt b/CMakeLists.txt index ed8c112..0293892 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,6 +49,7 @@ set(ERR_REPORTING_STDOUT OFF CACHE BOOL "Enable logging to stdout") set(ERR_REPORTING_FILE "" CACHE FILEPATH "Use file for logging") set(ENABLE_OPENSSL OFF CACHE BOOL "Enable OpenSSL crypto engine") set(TEST_APPS ON CACHE BOOL "Build test applications") +option(BUILD_SHARED_LIBS "Build shared library" OFF) if(ENABLE_OPENSSL) find_package(OpenSSL REQUIRED) @@ -145,6 +146,12 @@ set(SOURCES_H ${CONFIG_FILE_DIR}/config.h ) +if(BUILD_SHARED_LIBS AND WIN32) + list(APPEND SOURCES_C + srtp.def + ) +endif() + source_group("src" FILES ${SOURCES_C}) source_group("src\\Ciphers" FILES ${CIPHERS_SOURCES_C}) source_group("src\\Hashes" FILES ${HASHES_SOURCES_C}) @@ -153,7 +160,7 @@ source_group("src\\Math" FILES ${MATH_SOURCES_C}) source_group("src\\Replay" FILES ${REPLAY_SOURCES_C}) source_group("include" FILES ${SOURCES_H}) -add_library(srtp2 STATIC +add_library(srtp2 ${SOURCES_C} ${CIPHERS_SOURCES_C} ${HASHES_SOURCES_C} @@ -180,9 +187,11 @@ install(FILES include/srtp.h crypto/include/auth.h if(TEST_APPS) enable_testing() +if(NOT (BUILD_SHARED_LIBS AND WIN32)) add_executable(test_srtp test/test_srtp.c) target_link_libraries(test_srtp srtp2) add_test(test_srtp test_srtp) +endif() add_executable(srtp_driver test/srtp_driver.c test/util.c test/getopt_s.c) diff --git a/crypto/include/datatypes.h b/crypto/include/datatypes.h index 182cca2..6a588d0 100644 --- a/crypto/include/datatypes.h +++ b/crypto/include/datatypes.h @@ -241,13 +241,13 @@ void v128_set_bit_to(v128_t *x, int i, int y); #endif /* DATATYPES_USE_MACROS */ /* - * octet_string_is_eq(a, b, len) returns 1 if the length len strings a - * and b are not equal. It returns 0 otherwise. The running time of the + * srtp_octet_string_is_eq(a, b, len) returns 1 if the length len strings + * a and b are not equal. It returns 0 otherwise. The running time of the * comparison depends only on len, making this safe to use for (e.g.) * verifying authentication tags. */ -int octet_string_is_eq(uint8_t *a, uint8_t *b, int len); +int srtp_octet_string_is_eq(uint8_t *a, uint8_t *b, int len); /* * A portable way to zero out memory as recommended by diff --git a/crypto/math/datatypes.c b/crypto/math/datatypes.c index 85c1cbf..001584c 100644 --- a/crypto/math/datatypes.c +++ b/crypto/math/datatypes.c @@ -410,7 +410,7 @@ void bitvector_left_shift(bitvector_t *x, int shift) x->word[i] = 0; } -int octet_string_is_eq(uint8_t *a, uint8_t *b, int len) +int srtp_octet_string_is_eq(uint8_t *a, uint8_t *b, int len) { uint8_t *end = b + len; uint8_t accumulator = 0; @@ -2,12 +2,15 @@ EXPORTS srtp_init srtp_shutdown srtp_protect +srtp_protect_mki srtp_unprotect +srtp_unprotect_mki srtp_create srtp_add_stream srtp_remove_stream srtp_update srtp_update_stream +srtp_get_stream srtp_crypto_policy_set_rtp_default srtp_crypto_policy_set_rtcp_default srtp_crypto_policy_set_aes_cm_128_hmac_sha1_32 @@ -17,32 +20,36 @@ srtp_crypto_policy_set_null_cipher_hmac_null srtp_crypto_policy_set_aes_cm_256_hmac_sha1_80 srtp_crypto_policy_set_aes_cm_256_hmac_sha1_32 srtp_crypto_policy_set_aes_cm_256_null_auth -; TODO - GCM module not yet supported on Win32 -; srtp_crypto_policy_set_aes_gcm_128_8_auth -; srtp_crypto_policy_set_aes_gcm_256_8_auth -; srtp_crypto_policy_set_aes_gcm_128_8_only_auth -; srtp_crypto_policy_set_aes_gcm_256_8_only_auth -; srtp_crypto_policy_set_aes_gcm_128_16_auth -; srtp_crypto_policy_set_aes_gcm_256_16_auth +srtp_crypto_policy_set_aes_gcm_128_8_auth +srtp_crypto_policy_set_aes_gcm_256_8_auth +srtp_crypto_policy_set_aes_gcm_128_8_only_auth +srtp_crypto_policy_set_aes_gcm_256_8_only_auth +srtp_crypto_policy_set_aes_gcm_128_16_auth +srtp_crypto_policy_set_aes_gcm_256_16_auth srtp_dealloc srtp_crypto_policy_set_from_profile_for_rtp srtp_crypto_policy_set_from_profile_for_rtcp srtp_profile_get_master_key_length srtp_profile_get_master_salt_length srtp_append_salt_to_key +srtp_get_protect_trailer_length +srtp_get_protect_rtcp_trailer_length srtp_protect_rtcp +srtp_protect_rtcp_mki srtp_unprotect_rtcp +srtp_unprotect_rtcp_mki +srtp_set_stream_roc srtp_set_user_data +srtp_get_stream_roc srtp_get_user_data srtp_install_event_handler srtp_get_version_string srtp_get_version srtp_set_debug_module srtp_list_debug_modules -srtp_ekt_octets_after_base_tag -srtp_ekt_alloc -srtp_ekt_stream_init_from_policy -srtp_ekt_write_data +srtp_install_log_handler +srtp_err_report +srtp_crypto_kernel_load_debug_module srtp_cipher_get_key_length srtp_cipher_type_self_test srtp_cipher_type_test @@ -63,3 +70,6 @@ srtp_auth_get_prefix_length srtp_auth_type_self_test srtp_auth_type_test srtp_replace_auth_type +srtp_octet_string_hex_string +srtp_octet_string_is_eq +srtp_rdbx_get_window_size diff --git a/srtp/srtp.c b/srtp/srtp.c index 47ca6b1..bd33a4d 100644 --- a/srtp/srtp.c +++ b/srtp/srtp.c @@ -2618,7 +2618,7 @@ srtp_err_status_t srtp_unprotect_mki(srtp_ctx_t *ctx, if (status) return srtp_err_status_auth_fail; - if (octet_string_is_eq(tmp_tag, auth_tag, tag_len)) + if (srtp_octet_string_is_eq(tmp_tag, auth_tag, tag_len)) return srtp_err_status_auth_fail; } @@ -3289,7 +3289,6 @@ void srtp_crypto_policy_set_aes_cm_256_null_auth(srtp_crypto_policy_t *p) p->sec_serv = sec_serv_conf; } -#ifdef GCM void srtp_crypto_policy_set_aes_cm_192_hmac_sha1_80(srtp_crypto_policy_t *p) { /* @@ -3411,8 +3410,6 @@ void srtp_crypto_policy_set_aes_gcm_256_16_auth(srtp_crypto_policy_t *p) p->sec_serv = sec_serv_conf_and_auth; } -#endif - /* * secure rtcp functions */ @@ -4316,7 +4313,7 @@ srtp_err_status_t srtp_unprotect_rtcp_mki(srtp_t ctx, /* compare the tag just computed with the one in the packet */ debug_print(mod_srtp, "srtcp tag from packet: %s", srtp_octet_string_hex_string(auth_tag, tag_len)); - if (octet_string_is_eq(tmp_tag, auth_tag, tag_len)) + if (srtp_octet_string_is_eq(tmp_tag, auth_tag, tag_len)) return srtp_err_status_auth_fail; /* diff --git a/test/srtp_driver.c b/test/srtp_driver.c index a723453..1335540 100644 --- a/test/srtp_driver.c +++ b/test/srtp_driver.c @@ -1707,7 +1707,7 @@ srtp_err_status_t srtp_validate() debug_print(mod_driver, "ciphertext reference:\n %s", octet_string_hex_string(srtp_ciphertext, len)); - if (octet_string_is_eq(srtp_plaintext, srtp_ciphertext, len)) { + if (srtp_octet_string_is_eq(srtp_plaintext, srtp_ciphertext, len)) { return srtp_err_status_fail; } @@ -1725,7 +1725,7 @@ srtp_err_status_t srtp_validate() debug_print(mod_driver, "srtcp ciphertext reference:\n %s", octet_string_hex_string(srtcp_ciphertext, len)); - if (octet_string_is_eq(rtcp_plaintext, srtcp_ciphertext, len)) { + if (srtp_octet_string_is_eq(rtcp_plaintext, srtcp_ciphertext, len)) { return srtp_err_status_fail; } @@ -1747,7 +1747,7 @@ srtp_err_status_t srtp_validate() return status; } - if (octet_string_is_eq(srtp_ciphertext, srtp_plaintext_ref, len)) { + if (srtp_octet_string_is_eq(srtp_ciphertext, srtp_plaintext_ref, len)) { return srtp_err_status_fail; } @@ -1760,7 +1760,7 @@ srtp_err_status_t srtp_validate() return status; } - if (octet_string_is_eq(srtcp_ciphertext, rtcp_plaintext_ref, len)) { + if (srtp_octet_string_is_eq(srtcp_ciphertext, rtcp_plaintext_ref, len)) { return srtp_err_status_fail; } @@ -1875,7 +1875,7 @@ srtp_err_status_t srtp_validate_gcm() debug_print(mod_driver, "srtp ciphertext reference:\n %s", octet_string_hex_string(srtp_ciphertext, len)); - if (octet_string_is_eq(rtp_plaintext, srtp_ciphertext, len)) { + if (srtp_octet_string_is_eq(rtp_plaintext, srtp_ciphertext, len)) { return srtp_err_status_fail; } @@ -1893,7 +1893,7 @@ srtp_err_status_t srtp_validate_gcm() debug_print(mod_driver, "srtcp ciphertext reference:\n %s", octet_string_hex_string(srtcp_ciphertext, len)); - if (octet_string_is_eq(rtcp_plaintext, srtcp_ciphertext, len)) { + if (srtp_octet_string_is_eq(rtcp_plaintext, srtcp_ciphertext, len)) { return srtp_err_status_fail; } @@ -1916,7 +1916,7 @@ srtp_err_status_t srtp_validate_gcm() return status; } - if (octet_string_is_eq(srtp_ciphertext, rtp_plaintext_ref, len)) { + if (srtp_octet_string_is_eq(srtp_ciphertext, rtp_plaintext_ref, len)) { return srtp_err_status_fail; } @@ -1929,7 +1929,7 @@ srtp_err_status_t srtp_validate_gcm() return status; } - if (octet_string_is_eq(srtcp_ciphertext, rtcp_plaintext_ref, len)) { + if (srtp_octet_string_is_eq(srtcp_ciphertext, rtcp_plaintext_ref, len)) { return srtp_err_status_fail; } @@ -2032,7 +2032,7 @@ srtp_err_status_t srtp_validate_encrypted_extensions_headers() debug_print(mod_driver, "ciphertext reference:\n %s", srtp_octet_string_hex_string(srtp_ciphertext, len)); - if (octet_string_is_eq(srtp_plaintext, srtp_ciphertext, len)) + if (srtp_octet_string_is_eq(srtp_plaintext, srtp_ciphertext, len)) return srtp_err_status_fail; /* @@ -2054,7 +2054,7 @@ srtp_err_status_t srtp_validate_encrypted_extensions_headers() return srtp_err_status_fail; } - if (octet_string_is_eq(srtp_ciphertext, srtp_plaintext_ref, len)) + if (srtp_octet_string_is_eq(srtp_ciphertext, srtp_plaintext_ref, len)) return srtp_err_status_fail; status = srtp_dealloc(srtp_snd); @@ -2153,7 +2153,7 @@ srtp_err_status_t srtp_validate_encrypted_extensions_headers_gcm() debug_print(mod_driver, "ciphertext reference:\n %s", srtp_octet_string_hex_string(srtp_ciphertext, len)); - if (octet_string_is_eq(srtp_plaintext, srtp_ciphertext, len)) + if (srtp_octet_string_is_eq(srtp_plaintext, srtp_ciphertext, len)) return srtp_err_status_fail; /* @@ -2175,7 +2175,7 @@ srtp_err_status_t srtp_validate_encrypted_extensions_headers_gcm() return srtp_err_status_fail; } - if (octet_string_is_eq(srtp_ciphertext, srtp_plaintext_ref, len)) + if (srtp_octet_string_is_eq(srtp_ciphertext, srtp_plaintext_ref, len)) return srtp_err_status_fail; status = srtp_dealloc(srtp_snd); @@ -2269,7 +2269,7 @@ srtp_err_status_t srtp_validate_aes_256() debug_print(mod_driver, "ciphertext reference:\n %s", octet_string_hex_string(srtp_ciphertext, len)); - if (octet_string_is_eq(srtp_plaintext, srtp_ciphertext, len)) { + if (srtp_octet_string_is_eq(srtp_plaintext, srtp_ciphertext, len)) { return srtp_err_status_fail; } @@ -2291,7 +2291,7 @@ srtp_err_status_t srtp_validate_aes_256() return status; } - if (octet_string_is_eq(srtp_ciphertext, srtp_plaintext_ref, len)) { + if (srtp_octet_string_is_eq(srtp_ciphertext, srtp_plaintext_ref, len)) { return srtp_err_status_fail; } |