|
JABBERWERX_API bool | jw_sha1 (const uint8_t *input, size_t input_len, uint8_t **output, size_t *output_len, jw_err *err) |
|
JABBERWERX_API bool | jw_sha1_create (jw_sha1_ctx **ctx, jw_err *err) |
|
JABBERWERX_API void | jw_sha1_destroy (jw_sha1_ctx *ctx) |
|
JABBERWERX_API jw_sha1_ctx * | jw_sha1_reset (jw_sha1_ctx *ctx) |
|
JABBERWERX_API bool | jw_sha1_input (jw_sha1_ctx *ctx, const uint8_t *input, size_t len, jw_err *err) |
|
JABBERWERX_API bool | jw_sha1_result (jw_sha1_ctx *ctx, uint8_t **output, size_t *output_len, jw_err *err) |
|
JABBERWERX_API bool | jw_hmac_sha1 (const uint8_t *input, size_t input_len, const uint8_t *key, size_t key_len, uint8_t **output, size_t *output_len, jw_err *err) |
|
JABBERWERX_API bool | jw_hmac_sha1_create (const uint8_t *key, size_t key_len, jw_hmac_sha1_ctx **ctx, jw_err *err) |
|
JABBERWERX_API void | jw_hmac_sha1_destroy (jw_hmac_sha1_ctx *ctx) |
|
JABBERWERX_API bool | jw_hmac_sha1_reset (jw_hmac_sha1_ctx *ctx, const uint8_t *key, size_t key_len, jw_err *err) |
|
JABBERWERX_API bool | jw_hmac_sha1_input (jw_hmac_sha1_ctx *ctx, const uint8_t *input, size_t len, jw_err *err) |
|
JABBERWERX_API bool | jw_hmac_sha1_result (jw_hmac_sha1_ctx *ctx, uint8_t **output, size_t *output_len, jw_err *err) |
|
Datatypes and functions for computing SHA1 message digests.
Copyrights
Portions created or assigned to Cisco Systems, Inc. are Copyright (c) 2010-2015 Cisco Systems, Inc. All Rights Reserved. See LICENSE for details.
JABBERWERX_API bool jw_hmac_sha1 |
( |
const uint8_t * |
input, |
|
|
size_t |
input_len, |
|
|
const uint8_t * |
key, |
|
|
size_t |
key_len, |
|
|
uint8_t ** |
output, |
|
|
size_t * |
output_len, |
|
|
jw_err * |
err |
|
) |
| |
Calculates a HMAC-SHA1 message authentication code with the given input, placing the result into the given output buffer. This function is a convenience for the following:
3 jw_hmac_sha1_create(&ctx, key, key_len, &err);
6 jw_hmac_sha1_input(ctx, input, input_len, &err);
8 jw_hmac_sha1_result(ctx, output, output_len, &err);
9 jw_hmac_sha1_destroy(ctx);
NOTE: This function will allocate the memory needed to store the computed hash, and MUST be released using jw_data_free.
This function can generate the following errors (set when returning false):
JW_ERR_NO_MEMORY
if the context could not be allocated; or the output buffer could not be allocated
JW_ERR_INVALID_STATE
If ctx is corrupted
- Invariant
- output != NULL
-
output_len != NULL
- Parameters
-
[in] | input | The buffer of data to compute a digest for |
[in] | input_len | The length of input in octets |
[in] | key | The key for the authentication |
[in] | key_len | The length of the key in octets |
[out] | output | The buffer to hold the computed hash |
[out] | output_len | The length of the output buffer in octets |
[out] | err | The error information (provide NULL to ignore) |
- Return values
-
bool | true if the hash was computed, false otherwise |
JABBERWERX_API bool jw_sha1 |
( |
const uint8_t * |
input, |
|
|
size_t |
input_len, |
|
|
uint8_t ** |
output, |
|
|
size_t * |
output_len, |
|
|
jw_err * |
err |
|
) |
| |
Calculates a SHA1 digest with the given input, placing the result into the given output buffer. This function is a convenience for the following:
3 jw_sha1_create(&ctx, &err);
6 jw_sha1_input(ctx, input, input_len, &err);
8 jw_sha1_result(ctx, output, output_len, &err);
NOTE: This function will allocate the memory needed to store the computed hash, and MUST be released using jw_data_free.
This function can generate the following errors (set when returning false):
JW_ERR_NO_MEMORY
if the context could not be allocated; or the output buffer could not be allocated
JW_ERR_INVALID_STATE
If ctx is corrupted
JW_ERR_INVALID_ARG
If the total input is too large (2^64 - 1 bits)
- Invariant
- output != NULL
-
output_len != NULL
- Parameters
-
[in] | input | The buffer of data to compute a digest for |
[in] | input_len | The length of input |
[out] | output | The buffer to hold the computed hash |
[out] | output_len | The length of the output buffer |
[out] | err | The error information (provide NULL to ignore) |
- Return values
-
bool | true if the hash was computed, false otherwise |
Finalizes the given SHA1 context, placing the computed digest into the given output buffer.
NOTE: This function will allocate the memory needed to store the computed hash, and MUST be released using jw_data_free.
This function can generate the following errors (set when returning false):
JW_ERR_NO_MEMORY
if the output buffer could not be allocated
JW_ERR_INVALID_STATE
If ctx is corrupted
- Invariant
- ctx != NULL
-
output != NULL
-
output_len != NULL
- Parameters
-
[in] | ctx | The SHA1 context to finalize |
[out] | output | The buffer to hold the computed hash. |
[out] | output_len | The length of the output buffe |
[out] | err | The error information (provide NULL to ignore) |
- Return values
-
bool | true if successful, false otherwise |