Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
#include "asterisk/sorcery.h"
Go to the source code of this file.
Functions | |
int | ast_stir_shaken_add_result_to_channel (struct ast_stir_shaken_vs_ctx *ctx) |
Add a STIR/SHAKEN verification result to a channel. More... | |
enum ast_stir_shaken_as_response_code | ast_stir_shaken_as_ctx_add_fingerprint (struct ast_stir_shaken_as_ctx *ctx, const char *alg, const char *fingerprint) |
Add DTLS fingerprints to AS context. More... | |
enum ast_stir_shaken_as_response_code | ast_stir_shaken_as_ctx_create (const char *caller_id, const char *dest_tn, struct ast_channel *chan, const char *profile_name, const char *tag, struct ast_stir_shaken_as_ctx **ctxout) |
Create Attestation Service Context. More... | |
int | ast_stir_shaken_as_ctx_wants_fingerprints (struct ast_stir_shaken_as_ctx *ctx) |
Indicates if the AS context needs DTLS fingerprints. More... | |
enum ast_stir_shaken_as_response_code | ast_stir_shaken_attest (struct ast_stir_shaken_as_ctx *ctx, char **header) |
Attest and return Identity header value. More... | |
enum ast_stir_shaken_vs_response_code | ast_stir_shaken_vs_ctx_add_date_hdr (struct ast_stir_shaken_vs_ctx *ctx, const char *date_hdr) |
Add the received Date header value to the VS context. More... | |
enum ast_stir_shaken_vs_response_code | ast_stir_shaken_vs_ctx_add_identity_hdr (struct ast_stir_shaken_vs_ctx *ctx, const char *identity_hdr) |
Add the received Identity header value to the VS context. More... | |
enum ast_stir_shaken_vs_response_code | ast_stir_shaken_vs_ctx_create (const char *caller_id, struct ast_channel *chan, const char *profile_name, const char *tag, struct ast_stir_shaken_vs_ctx **ctxout) |
Create Verification Service context. More... | |
void | ast_stir_shaken_vs_ctx_set_response_code (struct ast_stir_shaken_vs_ctx *ctx, enum ast_stir_shaken_vs_response_code vs_rc) |
Sets response code on VS context. More... | |
enum stir_shaken_failure_action_enum | ast_stir_shaken_vs_get_failure_action (struct ast_stir_shaken_vs_ctx *ctx) |
Get failure_action from context. More... | |
int | ast_stir_shaken_vs_get_use_rfc9410_responses (struct ast_stir_shaken_vs_ctx *ctx) |
Get use_rfc9410_responses from context. More... | |
enum ast_stir_shaken_vs_response_code | ast_stir_shaken_vs_verify (struct ast_stir_shaken_vs_ctx *ctx) |
Perform incoming call verification. More... | |
Definition at line 61 of file res_stir_shaken.h.
Definition at line 23 of file res_stir_shaken.h.
Definition at line 78 of file res_stir_shaken.h.
int ast_stir_shaken_add_result_to_channel | ( | struct ast_stir_shaken_vs_ctx * | ctx | ) |
Add a STIR/SHAKEN verification result to a channel.
ctx | VS context |
-1 | on failure |
0 | on success |
Definition at line 89 of file res_stir_shaken.c.
References ast_calloc, ast_channel_datastore_add(), ast_channel_lock, ast_channel_name(), ast_channel_unlock, ast_datastore_alloc, ast_log, ast_strdup, stir_datastore::attestation, ast_stir_shaken_vs_ctx::attestation, ast_stir_shaken_vs_ctx::chan, ast_datastore::data, ast_stir_shaken_vs_ctx::failure_reason, stir_datastore::identity, ast_stir_shaken_vs_ctx::identity_hdr, LOG_ERROR, NULL, stir_datastore_free(), stir_shaken_datastore_info, and stir_datastore::verify_result.
Referenced by process_failure(), and stir_shaken_incoming_request().
enum ast_stir_shaken_as_response_code ast_stir_shaken_as_ctx_add_fingerprint | ( | struct ast_stir_shaken_as_ctx * | ctx, |
const char * | alg, | ||
const char * | fingerprint | ||
) |
Add DTLS fingerprints to AS context.
ctx | AS context |
alg | Fingerprint algorithm ("sha-1" or "sha-256") |
fingerprint | Fingerprint |
AST_STIR_SHAKEN_AS_SUCCESS | if successful |
Other | AST_STIR_SHAKEN_AS errors. |
Definition at line 206 of file attestation.c.
References tn_cfg::acfg_common, ast_alloca, ast_asprintf, AST_STIR_SHAKEN_AS_DISABLED, AST_STIR_SHAKEN_AS_INTERNAL_ERROR, AST_STIR_SHAKEN_AS_INVALID_ARGUMENTS, AST_STIR_SHAKEN_AS_SUCCESS, ast_strlen_zero(), AST_VECTOR_ADD_SORTED, ENUM_BOOL, ast_stir_shaken_as_ctx::etn, ast_stir_shaken_as_ctx::fingerprints, SCOPE_ENTER, SCOPE_EXIT_RTN_VALUE, attestation_cfg_common::send_mky, and ast_stir_shaken_as_ctx::tag.
Referenced by add_fingerprints_if_present().
enum ast_stir_shaken_as_response_code ast_stir_shaken_as_ctx_create | ( | const char * | caller_id, |
const char * | dest_tn, | ||
struct ast_channel * | chan, | ||
const char * | profile_name, | ||
const char * | tag, | ||
struct ast_stir_shaken_as_ctx ** | ctxout | ||
) |
Create Attestation Service Context.
caller_id | The caller_id for the outgoing call |
dest_tn | Canonicalized destination tn |
chan | The outgoing channel |
profile_name | The profile name on the endpoint May be NULL. |
tag | Identifying string to output in log and trace messages. |
ctxout | Receives a pointer to the newly created context The caller must release with ao2_ref or ao2_cleanup. |
AST_STIR_SHAKEN_AS_SUCCESS | if successful. |
AST_STIR_SHAKEN_AS_DISABLED | if attestation is disabled by the endpoint itself, the profile or globally. |
Other | AST_STIR_SHAKEN_AS errors. |
Definition at line 66 of file attestation.c.
References tn_cfg::acfg_common, AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_alloc_options, ao2_cleanup, as_get_cfg(), ast_channel_name(), ast_channel_ref, ast_free, AST_STIR_SHAKEN_AS_DISABLED, AST_STIR_SHAKEN_AS_INTERNAL_ERROR, AST_STIR_SHAKEN_AS_INVALID_ARGUMENTS, AST_STIR_SHAKEN_AS_MISSING_PARAMETERS, AST_STIR_SHAKEN_AS_NO_PRIVATE_KEY_AVAIL, AST_STIR_SHAKEN_AS_NO_PUBLIC_CERT_URL_AVAIL, AST_STIR_SHAKEN_AS_SUCCESS, ast_string_field_init, ast_string_field_set, ast_strlen_zero(), AST_VECTOR_INIT, attestation_cfg_common::attest_level, canonicalize_tn_alloc(), ast_stir_shaken_as_ctx::chan, ctx_destructor(), ast_stir_shaken_as_ctx::dest_tn, eprofile_get_cfg(), ast_stir_shaken_as_ctx::etn, LOG_ERROR, NULL, ast_stir_shaken_as_ctx::orig_tn, PROFILE_ALLOW_ATTEST, attestation_cfg_common::public_cert_url, RAII_VAR, attestation_cfg_common::raw_key_length, S_COR, S_OR, SCOPE_ENTER, SCOPE_EXIT_LOG_RTN_VALUE, SCOPE_EXIT_RTN_VALUE, ast_stir_shaken_as_ctx::tag, and tn_get_etn().
Referenced by stir_shaken_outgoing_request().
int ast_stir_shaken_as_ctx_wants_fingerprints | ( | struct ast_stir_shaken_as_ctx * | ctx | ) |
Indicates if the AS context needs DTLS fingerprints.
ctx | AS Context |
0 | Not needed |
1 | Needed |
Definition at line 200 of file attestation.c.
References tn_cfg::acfg_common, ENUM_BOOL, ast_stir_shaken_as_ctx::etn, and attestation_cfg_common::send_mky.
Referenced by add_fingerprints_if_present().
enum ast_stir_shaken_as_response_code ast_stir_shaken_attest | ( | struct ast_stir_shaken_as_ctx * | ctx, |
char ** | header | ||
) |
Attest and return Identity header value.
ctx | AS Context |
header | Pointer to buffer to receive the header value Must be freed with ast_free when done |
AST_STIR_SHAKEN_AS_SUCCESS | if successful |
Other | AST_STIR_SHAKEN_AS errors. |
Definition at line 364 of file attestation.c.
References tn_cfg::acfg_common, ast_asprintf, ast_std_free(), AST_STIR_SHAKEN_AS_INTERNAL_ERROR, AST_STIR_SHAKEN_AS_INVALID_ARGUMENTS, AST_STIR_SHAKEN_AS_SIGN_ENCODE_FAILURE, AST_STIR_SHAKEN_AS_SUCCESS, AST_STIR_SHAKEN_VS_INTERNAL_ERROR, ast_stir_shaken_as_ctx::dest_tn, ast_stir_shaken_as_ctx::etn, LOG_ERROR, NULL, ast_stir_shaken_as_ctx::orig_tn, pack_payload(), attestation_cfg_common::public_cert_url, RAII_VAR, attestation_cfg_common::raw_key, attestation_cfg_common::raw_key_length, SCOPE_ENTER, SCOPE_EXIT_LOG_RTN_VALUE, SCOPE_EXIT_RTN_VALUE, STIR_SHAKEN_ENCRYPTION_ALGORITHM, STIR_SHAKEN_PPT, STIR_SHAKEN_TYPE, and ast_stir_shaken_as_ctx::tag.
Referenced by stir_shaken_outgoing_request().
enum ast_stir_shaken_vs_response_code ast_stir_shaken_vs_ctx_add_date_hdr | ( | struct ast_stir_shaken_vs_ctx * | ctx, |
const char * | date_hdr | ||
) |
Add the received Date header value to the VS context.
ctx | VS context |
date_hdr | Date header value |
AST_STIR_SHAKEN_VS_SUCCESS | if successful |
Other | AST_STIR_SHAKEN_VS errors. |
Definition at line 612 of file verification.c.
References AST_STIR_SHAKEN_VS_INTERNAL_ERROR, AST_STIR_SHAKEN_VS_SUCCESS, and ast_string_field_set.
Referenced by stir_shaken_incoming_request().
enum ast_stir_shaken_vs_response_code ast_stir_shaken_vs_ctx_add_identity_hdr | ( | struct ast_stir_shaken_vs_ctx * | ctx, |
const char * | identity_hdr | ||
) |
Add the received Identity header value to the VS context.
ctx | VS context |
identity_hdr | Identity header value |
AST_STIR_SHAKEN_VS_SUCCESS | if successful |
Other | AST_STIR_SHAKEN_VS errors. |
Definition at line 604 of file verification.c.
References AST_STIR_SHAKEN_VS_INTERNAL_ERROR, AST_STIR_SHAKEN_VS_SUCCESS, and ast_string_field_set.
Referenced by stir_shaken_incoming_request().
enum ast_stir_shaken_vs_response_code ast_stir_shaken_vs_ctx_create | ( | const char * | caller_id, |
struct ast_channel * | chan, | ||
const char * | profile_name, | ||
const char * | tag, | ||
struct ast_stir_shaken_vs_ctx ** | ctxout | ||
) |
Create Verification Service context.
caller_id | Incoming caller id |
chan | Incoming channel |
profile_name | The profile name on the endpoint May be NULL. |
endpoint_behavior | Behavior associated to the specific endpoint |
tag | Identifying string to output in log and trace messages. |
ctxout | Receives a pointer to the newly created context The caller must release with ao2_ref or ao2_cleanup. |
AST_STIR_SHAKEN_VS_SUCCESS | if successful. |
AST_STIR_SHAKEN_VS_DISABLED | if verification is disabled by the endpoint itself, the profile or globally. |
Other | AST_STIR_SHAKEN_VS errors. |
Definition at line 650 of file verification.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_alloc_options, ao2_cleanup, ao2_ref, ast_channel_name(), ast_free, AST_STIR_SHAKEN_VS_DISABLED, AST_STIR_SHAKEN_VS_INTERNAL_ERROR, AST_STIR_SHAKEN_VS_INVALID_ARGUMENTS, AST_STIR_SHAKEN_VS_SUCCESS, ast_string_field_init, ast_string_field_set, ast_strlen_zero(), ast_stir_shaken_vs_ctx::caller_id, canonicalize_tn_alloc(), ast_stir_shaken_vs_ctx::chan, ctx_destructor(), eprofile_get_cfg(), LOG_ERROR, NULL, PROFILE_ALLOW_VERIFY, RAII_VAR, S_COR, S_OR, SCOPE_ENTER, SCOPE_EXIT_LOG_RTN_VALUE, SCOPE_EXIT_RTN_VALUE, ast_stir_shaken_vs_ctx::tag, and vs_get_cfg().
Referenced by stir_shaken_incoming_request().
void ast_stir_shaken_vs_ctx_set_response_code | ( | struct ast_stir_shaken_vs_ctx * | ctx, |
enum ast_stir_shaken_vs_response_code | vs_rc | ||
) |
Sets response code on VS context.
ctx | VS context |
vs_rc | ast_stir_shaken_vs_response_code to set |
Definition at line 632 of file verification.c.
References ast_stir_shaken_vs_ctx::failure_reason.
Referenced by process_failure().
enum stir_shaken_failure_action_enum ast_stir_shaken_vs_get_failure_action | ( | struct ast_stir_shaken_vs_ctx * | ctx | ) |
Get failure_action from context.
ctx | VS context |
ast_stir_shaken_failure_action |
Definition at line 620 of file verification.c.
References ast_stir_shaken_vs_ctx::eprofile, verification_cfg_common::stir_shaken_failure_action, and profile_cfg::vcfg_common.
Referenced by process_failure().
int ast_stir_shaken_vs_get_use_rfc9410_responses | ( | struct ast_stir_shaken_vs_ctx * | ctx | ) |
Get use_rfc9410_responses from context.
ctx | VS context |
1 | if true |
0 | if false |
Definition at line 626 of file verification.c.
References ast_stir_shaken_vs_ctx::eprofile, verification_cfg_common::use_rfc9410_responses, and profile_cfg::vcfg_common.
Referenced by process_failure().
enum ast_stir_shaken_vs_response_code ast_stir_shaken_vs_verify | ( | struct ast_stir_shaken_vs_ctx * | ctx | ) |
Perform incoming call verification.
ctx | VS context |
AST_STIR_SHAKEN_AS_SUCCESS | if successful |
Other | AST_STIR_SHAKEN_AS errors. |
Definition at line 882 of file verification.c.
References ast_free, ast_json_dump_string, ast_json_free(), ast_json_load_string(), ast_json_object_get(), ast_json_object_string_get, ast_json_unref(), ast_malloc, ast_std_free(), AST_STIR_SHAKEN_VS_CID_ORIG_TN_MISMATCH, AST_STIR_SHAKEN_VS_IAT_EXPIRED, AST_STIR_SHAKEN_VS_INTERNAL_ERROR, AST_STIR_SHAKEN_VS_INVALID_OR_NO_ALG, AST_STIR_SHAKEN_VS_INVALID_OR_NO_ATTEST, AST_STIR_SHAKEN_VS_INVALID_OR_NO_GRANTS, AST_STIR_SHAKEN_VS_INVALID_OR_NO_PPT, AST_STIR_SHAKEN_VS_INVALID_OR_NO_TYP, AST_STIR_SHAKEN_VS_INVALID_OR_NO_X5U, AST_STIR_SHAKEN_VS_NO_DEST_TN, AST_STIR_SHAKEN_VS_NO_IAT, AST_STIR_SHAKEN_VS_NO_ORIG_TN, AST_STIR_SHAKEN_VS_NO_ORIGID, AST_STIR_SHAKEN_VS_SIGNATURE_VALIDATION, AST_STIR_SHAKEN_VS_SUCCESS, ast_string_field_set, ast_strlen_zero(), ast_trace, ast_stir_shaken_vs_ctx::caller_id, check_date_header(), check_x5u_url(), ctx_populate(), ast_stir_shaken_vs_ctx::date_hdr_time, ast_stir_shaken_vs_ctx::eprofile, ast_stir_shaken_vs_ctx::identity_hdr, len(), LOG_ERROR, verification_cfg_common::max_iat_age, NULL, ast_stir_shaken_vs_ctx::orig_tn, ast_stir_shaken_vs_ctx::public_url, RAII_VAR, ast_stir_shaken_vs_ctx::raw_key, ast_stir_shaken_vs_ctx::raw_key_len, retrieve_verification_cert(), SCOPE_ENTER, SCOPE_EXIT_LOG_RTN_VALUE, SCOPE_EXIT_RTN_VALUE, STIR_SHAKEN_ENCRYPTION_ALGORITHM, STIR_SHAKEN_PPT, STIR_SHAKEN_TYPE, ast_stir_shaken_vs_ctx::tag, TRACE_ATLEAST, ast_stir_shaken_vs_ctx::validity_check_time, profile_cfg::vcfg_common, and vs_response_code_to_str().
Referenced by stir_shaken_incoming_request().