Skip to content

Commit 4993761

Browse files
authored
Updates header files (#332)
Co-authored-by: bjornvolcker <bjornvolcker@users.noreply.github.com>
1 parent 034f684 commit 4993761

9 files changed

Lines changed: 324 additions & 301 deletions

lib/src/includes/signed_video_common.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ int
133133
signed_video_compare_versions(const char* version1, const char* version2);
134134

135135
/**
136-
* @brief Checks if a NALU/OBU is a golden SEI/OBU Metadata
136+
* @brief Checks if a Bitstream Unit is a golden SEI/OBU Metadata
137137
*
138138
* A golden SEI/OBU Metadata is a self-signed SEI/OBU Metadata that includes all information only
139139
* needed once such as the Public key. Usually a golden SEI/OBU Metadata is sent only once in the
@@ -143,7 +143,7 @@ signed_video_compare_versions(const char* version1, const char* version2);
143143
* For the signing side it can help out to verify that a pre-generated golden SEI/OBU Metadata
144144
* actually is a golden SEI/OBU Metadata before adding it to the stream.
145145
*
146-
* @param nalu A pointer to the NALU/OBU data
146+
* @param nalu A pointer to the Bitstream Unit data
147147
* @param nalu_size Size of the |nalu|
148148
*
149149
* @returns True if |nalu| is a golden SEI/OBU Metadata

lib/src/includes/signed_video_openssl.h

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,11 @@ typedef struct _pem_pkey_t {
9393
*
9494
* @param sign_data A pointer to the struct that holds all necessary information for signing.
9595
*
96-
* @returns SV_OK Successfully generated |signature|,
97-
* SV_INVALID_PARAMETER Errors in |sign_data|,
98-
* SV_NOT_SUPPORTED No private key present,
99-
* SV_MEMORY Not enough memory allocated for the |signature|,
100-
* SV_EXTERNAL_ERROR Failure in OpenSSL.
96+
* @return SV_OK Successfully generated |signature|,
97+
* SV_INVALID_PARAMETER Errors in |sign_data|,
98+
* SV_NOT_SUPPORTED No private key present,
99+
* SV_MEMORY Not enough memory allocated for the |signature|,
100+
* SV_EXTERNAL_ERROR Failure in OpenSSL.
101101
*/
102102
SignedVideoReturnCode
103103
openssl_sign_hash(sign_or_verify_data_t *sign_data);
@@ -114,10 +114,10 @@ openssl_sign_hash(sign_or_verify_data_t *sign_data);
114114
* @param private_key The content of the private key PEM file.
115115
* @param private_key_size The size of the |private_key|.
116116
*
117-
* @returns SV_OK Successfully generated |signature|,
118-
* SV_INVALID_PARAMETER Missing inputs,
119-
* SV_MEMORY Failed allocating memory for the |signature|,
120-
* SV_EXTERNAL_ERROR Failure in OpenSSL.
117+
* @return SV_OK Successfully generated |signature|,
118+
* SV_INVALID_PARAMETER Missing inputs,
119+
* SV_MEMORY Failed allocating memory for the |signature|,
120+
* SV_EXTERNAL_ERROR Failure in OpenSSL.
121121
*/
122122
SignedVideoReturnCode
123123
openssl_private_key_malloc(sign_or_verify_data_t *sign_data,
@@ -152,10 +152,10 @@ openssl_free_key(void *key);
152152
* Ownership is transferred.
153153
* @param private_key_size If not NULL outputs the size of the |private_key|.
154154
*
155-
* @returns SV_OK Valid algorithm and successfully written PEM-file,
156-
* SV_NOT_SUPPORTED Algorithm is not supported,
157-
* SV_INVALID_PARAMETER Invalid input parameter,
158-
* SV_EXTERNAL_ERROR PEM-file could not be written.
155+
* @return SV_OK Valid algorithm and successfully written PEM-file,
156+
* SV_NOT_SUPPORTED Algorithm is not supported,
157+
* SV_INVALID_PARAMETER Invalid input parameter,
158+
* SV_EXTERNAL_ERROR PEM-file could not be written.
159159
*/
160160
SignedVideoReturnCode
161161
signed_video_generate_ecdsa_private_key(const char *dir_to_key,
@@ -185,10 +185,10 @@ signed_video_generate_rsa_private_key(const char *dir_to_key,
185185
* Ownership is transferred.
186186
* @param private_key_size If not NULL outputs the size of the |private_key|.
187187
*
188-
* @returns SV_OK Valid algorithm and successfully written PEM-file,
189-
* SV_NOT_SUPPORTED Algorithm is not supported,
190-
* SV_INVALID_PARAMETER Invalid input parameter,
191-
* SV_EXTERNAL_ERROR PEM-file could not be written.
188+
* @return SV_OK Valid algorithm and successfully written PEM-file,
189+
* SV_NOT_SUPPORTED Algorithm is not supported,
190+
* SV_INVALID_PARAMETER Invalid input parameter,
191+
* SV_EXTERNAL_ERROR PEM-file could not be written.
192192
*/
193193
SignedVideoReturnCode
194194
signed_video_generate_private_key(sign_algo_t algo,

lib/src/includes/signed_video_sign.h

Lines changed: 208 additions & 188 deletions
Large diffs are not rendered by default.

lib/src/legacy_validation.h

Lines changed: 39 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -34,22 +34,23 @@ typedef struct _legacy_sv_t legacy_sv_t;
3434
/**
3535
* @brief Creates a legacy signed video session.
3636
*
37-
* Creates a legacy_sv_t object which the user should keep across the entire streaming session.
38-
* The returned struct can be used for validating the authenticity of a legacy video.
37+
* Creates a legacy_sv_t object which the user should keep across the entire streaming
38+
* session. The returned struct can be used for validating the authenticity of a legacy
39+
* video.
3940
*
4041
* @param parent The parent session, i.e., a signed_video_t object.
4142
*
42-
* @returns A pointer to legacy_sv_t struct, allocated and initialized. A null pointer is
43-
* returned if memory could not be allocated.
43+
* @return A pointer to legacy_sv_t struct, allocated and initialized. A null pointer is
44+
* returned if memory could not be allocated.
4445
*/
4546
legacy_sv_t *
4647
legacy_sv_create(signed_video_t *parent);
4748

4849
/**
4950
* @brief Frees the memory of the legacy_sv_t object.
5051
*
51-
* All memory allocated to and by the legacy_sv_t object will be freed. This will affectivly end
52-
* the signed video session.
52+
* All memory allocated to and by the legacy_sv_t object will be freed. This will
53+
* affectivly end the signed video session.
5354
*
5455
* @param self Pointer to the object which memory to free.
5556
*/
@@ -59,64 +60,66 @@ legacy_sv_free(legacy_sv_t *self);
5960
/**
6061
* @brief Resets the legacy session to allow for, e.g., scrubbing signed video
6162
*
62-
* Resets the session and puts it in a pre-stream state, that is, waiting for a new GOP. Once a new
63-
* GOP is found the operations start over.
63+
* Resets the session and puts it in a pre-stream state, that is, waiting for a new GOP.
64+
* Once a new GOP is found the operations start over.
6465
*
6566
* For the signing part, this means starting to produce the required SEIs needed for
66-
* authentication. For the authentication part, this should be used when scrubbing the video.
67-
* Otherwise the lib will fail authentication due to skipped NALUs.
67+
* authentication. For the authentication part, this should be used when scrubbing the
68+
* video. Otherwise the lib will fail authentication due to skipped Bitstream Units.
6869
*
6970
* @param self Signed Video session in use
7071
*
71-
* @returns A svrc_t
72+
* @return A svrc_t
7273
*/
7374
svrc_t
7475
legacy_sv_reset(legacy_sv_t *self);
7576

7677
/**
77-
* @brief Add NALU data to the session and get an authentication report
78+
* @brief Add Bitstream Unit data to the session and get an authentication report
7879
*
79-
* This function should be called for each H26x NALU the user receives. It is assumed that
80-
* |nalu_data| consists of one single NALU including Start Code and NALU, so that NALU type can be
81-
* parsed. That is, the format should look like this:
80+
* This function should be called for each Bitstream Unit the user receives. It is assumed
81+
* that |nalu_data| consists of one single Bitstream Unit including Start Code and
82+
* Bitstream Unit, so that Bitstream Unit type can be parsed. That is, the format should
83+
* look like this:
8284
*
8385
* |------------|------|
8486
* | Start Code | NALU |
8587
* |------------|------|
8688
* 3 or 4 bytes ^
8789
* Including stop bit
8890
*
89-
* NOTE: NALUs sent into the API cannot be in packetized format (access units)!
90-
* The access unit has to be split into NALUs if so.
91+
* @note: Bitstream Units sent into the API cannot be in packetized format (access units)!
92+
* The access unit has to be split into Bitstream Units if so.
9193
*
92-
* The input |nalu_data| is not changed by this call. Note that it is assumed that ALL H26x NALUs
93-
* are passed to this function. Otherwise, they will be treated as missing/lost packets which may
94-
* affect the validation.
94+
* The input |nalu_data| is not changed by this call. Note that it is assumed that ALL
95+
* Bitstream Units are passed to this function. Otherwise, they will be treated as
96+
* missing/lost packets which may affect the validation.
9597
*
96-
* Signatures are sent on regular basis. Currently this is done at the end of each GOP (Group Of
97-
* Pictures). For every input |nalu_data| with a signature, or when a signature is expected,
98-
* validation is performed and a copy of the |authenticity| result is provided. If a NALU does not
99-
* trigger a validation, |authenticity| is a NULL pointer. If one NALU is lost or tampered with
100-
* within a GOP, the whole GOP is marked as NOT OK, even if the other NALUs are correct.
98+
* Signatures are sent on regular basis. Currently this is done at the end of each GOP
99+
* (Group Of Pictures). For every input |nalu_data| with a signature, or when a signature
100+
* is expected, validation is performed and a copy of the |authenticity| result is
101+
* provided. If a Bitstream Unit does not trigger a validation, |authenticity| is a NULL
102+
* pointer. If one NALU is lost or tampered with within a GOP, the whole GOP is marked as
103+
* NOT OK, even if the other NALUs are correct.
101104
*
102105
* The user should continuously check the return value for errors and upon success check
103106
* |authenticity| for a new report.
104107
* Two typical use cases are; 1) live monitoring which could be screening the video until
105-
* authenticity can no longer be validated OK, and 2) screening a recording and get a full report at
106-
* the end. In the first case further operations can simply be aborted as soon as a validation
107-
* fails, whereas in the latter case all the NALUs need to be screened.
108-
* NOTE: Only the live monitoring use case is currently supported.
108+
* authenticity can no longer be validated OK, and 2) screening a recording and get a full
109+
* report at the end. In the first case further operations can simply be aborted as soon
110+
* as a validation fails, whereas in the latter case all the NALUs need to be screened.
111+
* @note: Only the live monitoring use case is currently supported.
109112
*
110113
* Example code of usage; See example code above.
111114
*
112115
* @param self Pointer to the legacy_sv_t object to update
113-
* @param nalu_data Pointer to the H26x NALU data to be added
116+
* @param nalu_data Pointer to the Bitstream Unit data to be added
114117
* @param nalu_data_size Size of the nalu_data
115-
* @param authenticity Pointer to the autenticity report. Passing in a NULL pointer will not provide
116-
* latest validation results. The user is then responsible to get a report using
117-
* signed_video_get_authenticity_report(...).
118+
* @param authenticity Pointer to the autenticity report. Passing in a NULL pointer will
119+
* not provide latest validation results. The user is then responsible to get a report
120+
* using signed_video_get_authenticity_report(...).
118121
*
119-
* @returns A svrc_t
122+
* @return A svrc_t
120123
*/
121124
svrc_t
122125
legacy_sv_add_nalu_and_authenticate(legacy_sv_t *self,
@@ -125,14 +128,14 @@ legacy_sv_add_nalu_and_authenticate(legacy_sv_t *self,
125128
signed_video_authenticity_t **authenticity);
126129

127130
/**
128-
* @brief Gets the size of the NAL Unit list
131+
* @brief Gets the size of the Bitstream Unit list
129132
*
130133
* This function is necessary to update the authenticity report from the parent Signed
131134
* Video session.
132135
*
133136
* @param self Pointer to the legacy_sv_t object
134137
*
135-
* @return Number of NAL Units (items) in the nalu_list
138+
* @return Number of Bitstream Units (items) in the nalu_list
136139
*/
137140
int
138141
legacy_get_nalu_list_items(legacy_sv_t *self);

lib/src/sv_authenticity.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
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-
#ifndef __SIGNED_VIDEO_AUTHENTICITY_H__
22-
#define __SIGNED_VIDEO_AUTHENTICITY_H__
21+
#ifndef __SV_AUTHENTICITY_H__
22+
#define __SV_AUTHENTICITY_H__
2323

2424
#include "includes/signed_video_auth.h" // signed_video_product_info_t
2525
#include "sv_defines.h" // svrc_t
@@ -31,7 +31,7 @@
3131
* @param dst The signed_video_product_info_t struct of which to write to
3232
* @param src The signed_video_product_info_t struct of which to read from
3333
*
34-
* @returns A Signed Video Return Code
34+
* @return A Signed Video Return Code
3535
*/
3636
svrc_t
3737
transfer_product_info(signed_video_product_info_t *dst, const signed_video_product_info_t *src);
@@ -64,7 +64,7 @@ accumulated_validation_init(signed_video_accumulated_validation_t *self);
6464
*
6565
* @param self The current Signed Video session
6666
*
67-
* @returns A Signed Video Return Code
67+
* @return A Signed Video Return Code
6868
*/
6969
svrc_t
7070
create_local_authenticity_report_if_needed(signed_video_t *self);
@@ -78,7 +78,7 @@ create_local_authenticity_report_if_needed(signed_video_t *self);
7878
* @param dst_str A pointer holding a pointer to the copied string. Memory is allocated if needed.
7979
* @param src_str The null-terminated string to copy. A NULL pointer copies "".
8080
*
81-
* @returns A Signed Video Return Code
81+
* @return A Signed Video Return Code
8282
*/
8383
svrc_t
8484
allocate_memory_and_copy_string(char **dst_str, const char *src_str);
@@ -98,4 +98,4 @@ void
9898
update_accumulated_validation(const signed_video_latest_validation_t *latest,
9999
signed_video_accumulated_validation_t *accumulated);
100100

101-
#endif // __SIGNED_VIDEO_AUTHENTICITY_H__
101+
#endif // __SV_AUTHENTICITY_H__

lib/src/sv_defines.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
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-
#ifndef __SIGNED_VIDEO_DEFINES__
22-
#define __SIGNED_VIDEO_DEFINES__
21+
#ifndef __SV_DEFINES__
22+
#define __SV_DEFINES__
2323

2424
#include <stdbool.h> // bool
2525

@@ -148,12 +148,12 @@ typedef SignedVideoReturnCode svrc_t;
148148
/**
149149
* Definition of available TLV tags.
150150
*
151-
* Vendor specific TLV tags start from UNDEFINED_VENDOR_TAG. Both sub-lists begin and end with
152-
* invalid tags (UNDEFINED_TAG and NUMBER_OF_TLV_TAGS) resp. (UNDEFINED_VENDOR_TAG and
153-
* NUMBER_OF_VENDOR_TLV_TAGS).
151+
* Vendor specific TLV tags start from UNDEFINED_VENDOR_TAG. Both sub-lists begin and end
152+
* with invalid tags (UNDEFINED_TAG and NUMBER_OF_TLV_TAGS) resp. (UNDEFINED_VENDOR_TAG
153+
* and NUMBER_OF_VENDOR_TLV_TAGS).
154154
*
155-
* NOTE: When a new tag is added simply append the sub-list of valid tags. Changing the number of
156-
* existing tags will break backwards compatibility!
155+
* @note: When a new tag is added simply append the sub-list of valid tags. Changing the
156+
* number of existing tags will break backwards compatibility!
157157
*/
158158
typedef enum {
159159
UNDEFINED_TAG = 0, // Should always be zero

lib/src/sv_internal.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
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-
#ifndef __SIGNED_VIDEO_INTERNAL_H__
22-
#define __SIGNED_VIDEO_INTERNAL_H__
21+
#ifndef __SV_INTERNAL_H__
22+
#define __SV_INTERNAL_H__
2323

2424
#include <stdbool.h> // bool
2525
#include <stdint.h> // uint8_t
@@ -274,4 +274,4 @@ void
274274
sv_print_hex_data(const uint8_t *data, size_t data_size, const char *fmt, ...);
275275
#endif
276276

277-
#endif // __SIGNED_VIDEO_INTERNAL_H__
277+
#endif // __SV_INTERNAL_H__

0 commit comments

Comments
 (0)