Data stream validation.
More...
#include "streamvalidator.h"
#include "authutils.h"
#include <assert.h>
#include <gcrypt.h>
#include <glib.h>
◆ gvm_stream_validator_end()
Signal the end of data input into a validator and produce the result of the validation.
- Parameters
-
| [in] | validator | The validator to signal the end of data input of. |
- Returns
- The validation result.
◆ gvm_stream_validator_free()
Free a stream validator and all of its fields.
- Parameters
-
| [in] | validator | The validator to free. |
◆ gvm_stream_validator_new()
Allocate and initialize a new data stream validator.
- Parameters
-
| [in] | expected_hash_str | Expected hash / checksum string consisting of an algorithm name or OID as recognized by gcrypt, followed by a colon and the hex-encoded hash, e.g. "md5:70165459812a0d38851a4a4c3e4124c9". |
| [in] | expected_size | The number of bytes expected to be sent. |
| [out] | validator_out | Pointer to output location of the newly allocated validator. |
- Returns
- A validator return code, returning a failure if the expeced hash string is invalid or uses an unsupported algorithm.
◆ gvm_stream_validator_return_str()
Gets a string representation of a gvm_stream_validator_return_t.
- Parameters
-
| [in] | value | The value to get a string representation of. |
- Returns
- Static string describing the return value or NULL if value is GVM_STREAM_VALIDATOR_OK.
◆ gvm_stream_validator_rewind()
Rewind the validation state of a stream validator while keeping the expected hash and data size.
- Parameters
-
| [in] | validator | The validator to rewind. |
◆ gvm_stream_validator_write()
Write data to a validator, updating the hash state and current size.
Will fail if the total data size exceeds the expected size.
- Parameters
-
| [in] | validator | The validator to handle the data |
| [in] | data | The data to write. |
| [in] | length | Length of the data. |
- Returns
- Validator return code, either a "success" or "too long".