Skip to content

Commit d5aef9f

Browse files
authored
Moves vendors into src (#501)
Since this repository has become Axis vendor only there is no longer a need to separate it from the normal source code. This commit moves the two files into src/ and removes the meson option 'vendors'. Co-authored-by: bjornvolcker <[email protected]>
1 parent a7a16c4 commit d5aef9f

21 files changed

+29
-158
lines changed

README.md

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,30 +14,26 @@ signed-video-framework
1414
| | | └── plugin.c
1515
| | └── unthreaded-signing
1616
| | └── plugin.c
17-
| ├── src
18-
| | ├── includes
19-
| | | └── public header files
20-
| | └── source files
21-
| └── vendors
22-
| └── axis-communications
23-
| └── source files
17+
| └── src
18+
| ├── includes
19+
| | └── public header files
20+
| └── source files
2421
└── tests
2522
```
2623

2724
The repository is split into a library and tests. The library is further organized in
28-
[source code](./lib/src/), [plugins](./lib/plugins/) and [vendors](./lib/vendors/). The source code
29-
includes all necessary source files for both signing and validation, and there is no conceptual
30-
difference in building the library for signing or for validation.
25+
[source code](./lib/src/) and [plugins](./lib/plugins/). The source code includes all necessary
26+
source files for both signing and validation, and there is no conceptual difference in building the
27+
library for signing or for validation.
3128

3229
Signing is commonly device specific with separate calls for, e.g., reading and using private keys.
3330
Therefore, the framework uses the concept of signing plugins which implements a set of
3431
[interfaces](./lib/src/includes/signed_video_signing_plugin.h). The framework comes with both a
3532
threaded and an unthreaded signing plugin.
3633

37-
Further, the framework allows for vendor specific metadata. Adding that on the signing side, and
38-
interpreting it on the validation side is controlled through vendor specific code.
39-
40-
For instructions on how to use the APIs to integrate the Signed Video Framework in either a signing or a validation application, see [lib/](./lib/). Example applications are available in the [signed-video-framework-examples](https://github.com/AxisCommunications/signed-video-framework-examples) repository.
34+
For instructions on how to use the APIs to integrate the Signed Video Framework in either a signing
35+
or a validation application, see [lib/](./lib/). Example applications are available in the
36+
[signed-video-framework-examples](https://github.com/AxisCommunications/signed-video-framework-examples) repository.
4137

4238
# Releases
4339
There are no pre-built releases. The user is encouraged to build the library from a [release tag](https://github.com/AxisCommunications/signed-video-framework/tags).

lib/README.md

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,13 @@ lib
88
| | └── plugin.c
99
| └── unthreaded-signing
1010
| └── plugin.c
11-
├── src
12-
| ├── includes
13-
| | └── public header files
14-
| └── source files
15-
└── vendors
16-
└── axis-communications
17-
└── source files
11+
└── src
12+
├── includes
13+
| └── public header files
14+
└── source files
1815
```
1916

20-
The library is organized in [source code](./src/), [plugins](./plugins/) and [vendors](./vendors/).
17+
The library is organized in [source code](./src/) and [plugins](./plugins/).
2118
The source code includes all necessary source files for both signing and validation, and there is no
2219
conceptual difference in building the library for signing or for validation.
2320

@@ -26,9 +23,3 @@ plugin. The interfaces can be found in
2623
[signed_video_signing_plugin.h](./src/includes/signed_video_signing_plugin.h). The framework comes
2724
with both a threaded and an unthreaded signing plugin. When building the library with the meson
2825
structure in this repository, the library includes that plugin.
29-
30-
Vendor specific code and APIs are typically handling extra metadata added to the SEI/OBU Metadata,
31-
which needs to be interpreted correctly when validating authenticity. With the meson option `vendor`
32-
the user can select which vendor(s) to include in the build. Typically, when building for signing
33-
the vendor for that camera is selected, whereas when building for validation all vendors are
34-
included. By default, all vendors are added.

lib/meson.build

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
# Process plugins first to get the plugin sources used in src/
22
subdir('plugins')
3-
subdir('vendors')
43
subdir('src')

lib/src/legacy/legacy_auth.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,12 @@
2222
#include <stdbool.h>
2323
#include <string.h> // strcmp
2424

25-
#include "legacy_validation.h" // Has public declarations
26-
27-
#ifdef SV_VENDOR_AXIS_COMMUNICATIONS
28-
#include "axis-communications/sv_vendor_axis_communications_internal.h"
29-
#endif
3025
#include "legacy/legacy_bu_list.h"
3126
#include "legacy/legacy_internal.h"
3227
#include "legacy/legacy_tlv.h" // legacy_tlv_decode()
28+
#include "legacy_validation.h" // Has public declarations
3329
#include "sv_authenticity.h" // update_accumulated_validation()
30+
#include "sv_axis_communications_internal.h"
3431
#include "sv_openssl_internal.h" // sv_openssl_verify_hash()
3532
#include "sv_tlv.h" // sv_tlv_find_tag()
3633

@@ -754,7 +751,6 @@ legacy_prepare_for_validation(legacy_sv_t *self)
754751
SV_THROW_IF_WITH_MSG(validation_flags->signing_present && !self->has_public_key,
755752
SV_NOT_SUPPORTED, "No public key present");
756753

757-
#ifdef SV_VENDOR_AXIS_COMMUNICATIONS
758754
// If "Axis Communications AB" can be identified from the |product_info|, get
759755
// |supplemental_authenticity| from |vendor_handle|.
760756
if (sei && strcmp(self->product_info->manufacturer, "Axis Communications AB") == 0) {
@@ -780,7 +776,6 @@ legacy_prepare_for_validation(legacy_sv_t *self)
780776
}
781777
}
782778
}
783-
#endif
784779

785780
// If we have received a SEI there is a signature to use for verification.
786781
if (self->gop_state.has_sei || self->bu_list->first_item->bu->is_golden_sei) {

lib/src/legacy/legacy_common.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -979,10 +979,8 @@ legacy_sv_create(signed_video_t *parent)
979979
SV_THROW_WITH_MSG(legacy_reset_gop_hash(self), "Could not reset gop_hash");
980980

981981
// Borrow vendor handle from |parent|.
982-
#ifdef SV_VENDOR_AXIS_COMMUNICATIONS
983982
self->vendor_handle = parent->vendor_handle;
984983
SV_THROW_IF(!self->vendor_handle, SV_MEMORY);
985-
#endif
986984

987985
// Initialize validation members
988986
self->bu_list = legacy_bu_list_create();

lib/src/legacy/legacy_tlv.c

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,10 @@
2525
#endif
2626
#include <string.h>
2727

28-
#ifdef SV_VENDOR_AXIS_COMMUNICATIONS
29-
#include "axis-communications/sv_vendor_axis_communications_internal.h"
30-
#endif
3128
#include "includes/signed_video_common.h" // Return codes
3229
#include "includes/signed_video_openssl.h" // sign_or_verify_data_t
3330
#include "sv_authenticity.h" // allocate_memory_and_copy_string, transfer_product_info()
31+
#include "sv_axis_communications_internal.h"
3432
#include "sv_openssl_internal.h" // openssl_public_key_malloc()
3533
#include "sv_tlv.h" // sv_read_8bits, sv_read_16bits, sv_read_32bits, sv_read_64bits_signed
3634

@@ -382,15 +380,13 @@ legacy_decode_public_key(legacy_sv_t *self, const uint8_t *data, size_t data_siz
382380
// Convert to EVP_PKEY_CTX
383381
SV_THROW(openssl_public_key_malloc(self->verify_data, &self->pem_public_key));
384382

385-
#ifdef SV_VENDOR_AXIS_COMMUNICATIONS
386383
// If "Axis Communications AB" can be identified from the |product_info|, set |public_key| to
387384
// |vendor_handle|.
388385
if (strcmp(self->product_info->manufacturer, "Axis Communications AB") == 0) {
389386
// Set public key.
390387
SV_THROW(set_axis_communications_public_key(self->vendor_handle, self->verify_data->key,
391388
self->latest_validation->public_key_has_changed));
392389
}
393-
#endif
394390

395391
SV_THROW_IF(data_ptr != data + data_size, SV_AUTHENTICATION_ERROR);
396392
#ifdef PRINT_DECODED_SEI
@@ -549,18 +545,9 @@ legacy_decode_crypto_info(legacy_sv_t *self, const uint8_t *data, size_t data_si
549545
*
550546
*/
551547
static svrc_t
552-
#ifdef SV_VENDOR_AXIS_COMMUNICATIONS
553548
legacy_decode_axis_communications(legacy_sv_t *self, const uint8_t *data, size_t data_size)
554549
{
555550
return decode_axis_communications_handle(self->vendor_handle, data, data_size);
556-
#else
557-
legacy_decode_axis_communications(legacy_sv_t ATTR_UNUSED *self,
558-
const uint8_t ATTR_UNUSED *data,
559-
size_t ATTR_UNUSED data_size)
560-
{
561-
// Vendor Axis Communications not selected.
562-
return SV_NOT_SUPPORTED;
563-
#endif
564551
}
565552

566553
static svrc_t

lib/src/meson.build

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@ signedvideoframework_public_headers = files(
55
'includes/signed_video_openssl.h',
66
'includes/signed_video_sign.h',
77
'includes/signed_video_signing_plugin.h',
8+
'includes/sv_vendor_axis_communications.h'
89
)
910

1011
signedvideoframework_sources = files(
1112
'legacy_validation.h',
1213
'sv_auth.c',
1314
'sv_authenticity.c',
1415
'sv_authenticity.h',
16+
'sv_axis_communications.c',
17+
'sv_axis_communications_internal.h',
1518
'sv_bu_list.c',
1619
'sv_bu_list.h',
1720
'sv_codec_av1.c',
@@ -41,13 +44,8 @@ legacy_sources = files(
4144

4245
# Add source files from plugins, vendors, legacy code
4346
signedvideoframework_sources += plugin_sources
44-
signedvideoframework_sources += vendor_sources
4547
signedvideoframework_sources += legacy_sources
4648

47-
# Add vendor specific public headers
48-
if build_with_axis
49-
signedvideoframework_public_headers += files('includes/sv_vendor_axis_communications.h')
50-
endif
5149
# Add ONVIF Media Signing source files and public headers
5250
if populated_media_signing_submodule
5351
signedvideoframework_sources += mediasigningframework_sources

lib/src/sv_auth.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,11 @@
2121
#include <assert.h> // assert
2222
#include <stdlib.h> // free
2323

24-
#ifdef SV_VENDOR_AXIS_COMMUNICATIONS
25-
#include "axis-communications/sv_vendor_axis_communications_internal.h"
26-
#endif
2724
#include "includes/signed_video_auth.h"
2825
#include "includes/signed_video_openssl.h" // pem_pkey_t, sign_or_verify_data_t
2926
#include "legacy_validation.h"
3027
#include "sv_authenticity.h" // sv_create_local_authenticity_report_if_needed()
28+
#include "sv_axis_communications_internal.h"
3129
#include "sv_bu_list.h" // bu_list_append()
3230
#include "sv_defines.h" // svrc_t
3331
#include "sv_internal.h" // gop_info_t, validation_flags_t
@@ -987,7 +985,6 @@ prepare_for_validation(signed_video_t *self, bu_list_item_t **sei)
987985
}
988986
validation_flags->waiting_for_signature = !(*sei)->bu->is_signed;
989987

990-
#ifdef SV_VENDOR_AXIS_COMMUNICATIONS
991988
// If "Axis Communications AB" can be identified from the |product_info|, get
992989
// |supplemental_authenticity| from |vendor_handle|.
993990
if (strcmp(self->product_info.manufacturer, "Axis Communications AB") == 0) {
@@ -1013,7 +1010,6 @@ prepare_for_validation(signed_video_t *self, bu_list_item_t **sei)
10131010
}
10141011
}
10151012
}
1016-
#endif
10171013

10181014
SV_CATCH()
10191015
SV_DONE(status)
@@ -1410,11 +1406,9 @@ detect_onvif_media_signing(signed_video_t *self, const bu_info_t *bu)
14101406
SV_TRY()
14111407
self->onvif = onvif_media_signing_create(codec);
14121408
SV_THROW_IF(!self->onvif, SV_EXTERNAL_ERROR);
1413-
#ifdef SV_VENDOR_AXIS_COMMUNICATIONS
14141409
// Get the root CA certificate from Axis code.
14151410
trusted_certificate = get_axis_communications_trusted_certificate();
14161411
trusted_certificate_size = strlen(trusted_certificate);
1417-
#endif
14181412
SV_THROW(msrc_to_svrc(onvif_media_signing_set_trusted_certificate(
14191413
self->onvif, trusted_certificate, trusted_certificate_size, false)));
14201414
// If the ONVIF Media Signing session has successfully been set up, register all

lib/vendors/axis-communications/sv_vendor_axis_communications.c renamed to lib/src/sv_axis_communications.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1919
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2020
*/
21-
#include "includes/sv_vendor_axis_communications.h"
22-
2321
#include <assert.h>
2422
#include <openssl/bio.h> // BIO_*
2523
#include <openssl/evp.h> // EVP_*
@@ -29,9 +27,10 @@
2927
#include <stdbool.h>
3028
#include <stdlib.h> // malloc, memcpy, calloc, free
3129

30+
#include "includes/sv_vendor_axis_communications.h"
31+
#include "sv_axis_communications_internal.h"
3232
#include "sv_internal.h" // signed_video_t
3333
#include "sv_tlv.h"
34-
#include "sv_vendor_axis_communications_internal.h"
3534

3635
#define NUM_UNTRUSTED_CERTIFICATES 2 // |certificate_chain| has 2 untrusted certificates.
3736
#define CHIP_ID_SIZE 18

lib/vendors/axis-communications/sv_vendor_axis_communications_internal.h renamed to lib/src/sv_axis_communications_internal.h

File renamed without changes.

0 commit comments

Comments
 (0)