RTRlib
|
#include "rtrlib/bgpsec/bgpsec.h"
#include "rtrlib/lib/alloc_utils_private.h"
#include "rtrlib/lib/log_private.h"
#include "rtrlib/rtrlib_export_private.h"
#include <arpa/inet.h>
#include <openssl/x509.h>
#include <string.h>
Go to the source code of this file.
Macros | |
#define | BGPSEC_DBG(fmt, ...) lrtr_dbg("BGPSEC: " fmt, ##__VA_ARGS__) |
#define | BGPSEC_DBG1(a) lrtr_dbg("BGPSEC: " a) |
#define | SECURE_PATH_SEG_SIZE 6 |
The length of a rtr_secure_path_seg without the next pointer: pcount(1) + flags(1) + asn(4) | |
#define | SKI_STR_LEN 61 |
The string length of a SKI, including spaces. | |
#define | PRIVATE_KEY_LENGTH 121L |
The total length of a private key in bytes. | |
Enumerations | |
enum | align_type { VALIDATION , SIGNING } |
Control flag, validation and signing procedures for aligning data differs. More... | |
Functions | |
struct stream * | init_stream (uint16_t size) |
struct stream * | copy_stream (struct stream *s) |
void | free_stream (struct stream *s) |
void | write_stream (struct stream *s, void *data, uint16_t len) |
uint8_t * | get_stream_start (struct stream *s) |
size_t | get_stream_size (struct stream *s) |
uint8_t | read_stream (struct stream *s) |
void | read_n_bytes_stream (uint8_t *buff, struct stream *s, uint16_t len) |
void | read_stream_at (uint8_t *buff, struct stream *s, uint16_t start, uint16_t len) |
size_t | req_stream_size (const struct rtr_bgpsec *data, enum align_type type) |
int | get_sig_seg_size (const struct rtr_signature_seg *sig_segs, enum align_type type) |
int | check_router_keys (const struct rtr_signature_seg *sig_segs, struct spki_table *table) |
int | bgpsec_segment_to_str (char *buffer, struct rtr_signature_seg *sig_seg, struct rtr_secure_path_seg *sec_path) |
int | byte_sequence_to_str (char *buffer, uint8_t *bytes, unsigned int bytes_len, unsigned int tabstops) |
void | ski_to_char (char *ski_str, uint8_t *ski) |
int | align_byte_sequence (const struct rtr_bgpsec *data, struct stream *s, enum align_type type) |
int | hash_byte_sequence (uint8_t *bytes, size_t bytes_len, uint8_t alg_suite_id, unsigned char **result_buffer) |
int | validate_signature (const unsigned char *hash, const struct rtr_signature_seg *sig, struct spki_record *record) |
int | load_private_key (EC_KEY **priv_key, uint8_t *bytes_key) |
int | load_public_key (EC_KEY **pub_key, uint8_t *spki) |
int | sign_byte_sequence (uint8_t *hash_result, EC_KEY *priv_key, uint8_t alg, struct rtr_signature_seg *new_signature) |
int | ski_is_empty (uint8_t *ski) |
#define BGPSEC_DBG | ( | fmt, | |
... | |||
) | lrtr_dbg("BGPSEC: " fmt, ##__VA_ARGS__) |
#define BGPSEC_DBG1 | ( | a | ) | lrtr_dbg("BGPSEC: " a) |
#define PRIVATE_KEY_LENGTH 121L |
The total length of a private key in bytes.
#define SECURE_PATH_SEG_SIZE 6 |
The length of a rtr_secure_path_seg without the next pointer: pcount(1) + flags(1) + asn(4)
#define SKI_STR_LEN 61 |
The string length of a SKI, including spaces.
enum align_type |
int align_byte_sequence | ( | const struct rtr_bgpsec * | data, |
struct stream * | s, | ||
enum align_type | type | ||
) |
int bgpsec_segment_to_str | ( | char * | buffer, |
struct rtr_signature_seg * | sig_seg, | ||
struct rtr_secure_path_seg * | sec_path | ||
) |
int byte_sequence_to_str | ( | char * | buffer, |
uint8_t * | bytes, | ||
unsigned int | bytes_len, | ||
unsigned int | tabstops | ||
) |
int check_router_keys | ( | const struct rtr_signature_seg * | sig_segs, |
struct spki_table * | table | ||
) |
struct stream * copy_stream | ( | struct stream * | s | ) |
void free_stream | ( | struct stream * | s | ) |
int get_sig_seg_size | ( | const struct rtr_signature_seg * | sig_segs, |
enum align_type | type | ||
) |
size_t get_stream_size | ( | struct stream * | s | ) |
uint8_t * get_stream_start | ( | struct stream * | s | ) |
int hash_byte_sequence | ( | uint8_t * | bytes, |
size_t | bytes_len, | ||
uint8_t | alg_suite_id, | ||
unsigned char ** | result_buffer | ||
) |
struct stream * init_stream | ( | uint16_t | size | ) |
int load_private_key | ( | EC_KEY ** | priv_key, |
uint8_t * | bytes_key | ||
) |
int load_public_key | ( | EC_KEY ** | pub_key, |
uint8_t * | spki | ||
) |
void read_n_bytes_stream | ( | uint8_t * | buff, |
struct stream * | s, | ||
uint16_t | len | ||
) |
uint8_t read_stream | ( | struct stream * | s | ) |
void read_stream_at | ( | uint8_t * | buff, |
struct stream * | s, | ||
uint16_t | start, | ||
uint16_t | len | ||
) |
size_t req_stream_size | ( | const struct rtr_bgpsec * | data, |
enum align_type | type | ||
) |
int sign_byte_sequence | ( | uint8_t * | hash_result, |
EC_KEY * | priv_key, | ||
uint8_t | alg, | ||
struct rtr_signature_seg * | new_signature | ||
) |
int ski_is_empty | ( | uint8_t * | ski | ) |
void ski_to_char | ( | char * | ski_str, |
uint8_t * | ski | ||
) |
int validate_signature | ( | const unsigned char * | hash, |
const struct rtr_signature_seg * | sig, | ||
struct spki_record * | record | ||
) |
void write_stream | ( | struct stream * | s, |
void * | data, | ||
uint16_t | len | ||
) |