ndn-lite
Functions
ndn-lite-sec-utils.h File Reference
#include <inttypes.h>
#include <stdbool.h>

Go to the source code of this file.

Functions

int ndn_const_time_memcmp (const uint8_t *a, const uint8_t *b, uint32_t size)
 
int ndn_asn1_encode_ecdsa_signature (uint8_t *raw_ecdsa_sig, uint32_t raw_ecdsa_sig_len, uint32_t raw_ecdsa_sig_buf_len)
 Encode a signature in the format used by the micro-ecc format; final encoding will be in ASN.1, DER format. More...
 
int ndn_asn1_probe_ecdsa_signature_encoding_size (const uint8_t *raw_ecdsa_sig, uint32_t raw_ecdsa_sig_len, uint32_t *encoded_ecdsa_sig_len)
 Probe the size that an ecdsa signature in the same format used by the micro-ecc library will have if it is encoded in ASN.1 DER format. More...
 
int ndn_asn1_decode_ecdsa_signature (const uint8_t *encoded_ecdsa_sig, uint32_t encoded_ecdsa_sig_len, uint8_t *decoded_ecdsa_sig, uint32_t decoded_ecdsa_sig_buf_len, uint32_t *raw_ecdsa_sig_len)
 Decode a signature in ASN.1, DER format into the format used by the micro-ecc library. More...
 

Function Documentation

◆ ndn_asn1_decode_ecdsa_signature()

int ndn_asn1_decode_ecdsa_signature ( const uint8_t *  encoded_ecdsa_sig,
uint32_t  encoded_ecdsa_sig_len,
uint8_t *  decoded_ecdsa_sig,
uint32_t  decoded_ecdsa_sig_buf_len,
uint32_t *  raw_ecdsa_sig_len 
)

Decode a signature in ASN.1, DER format into the format used by the micro-ecc library.

The curve type of signature will be inferred from the length of the signature passed in.

Parameters
encoded_ecdsa_sig.Input. Signature to be decoded, in ASN.1 DER format.
encoded_ecdsa_sig_len.Input. Length of the encoded signature.
decoded_ecdsa_sig.Output. Length of the buffer to store decoded signature. Should be long enough to hold final decoding.
decoded_ecdsa_sig_buf_len.Input. Length of buffer to hold decoded signature.
raw_ecdsa_sig_len.Output. Length of the decoded signature, in the same format used by the micro-ecc library.
Returns
NDN_SUCCESS if there is no error.

◆ ndn_asn1_encode_ecdsa_signature()

int ndn_asn1_encode_ecdsa_signature ( uint8_t *  raw_ecdsa_sig,
uint32_t  raw_ecdsa_sig_len,
uint32_t  raw_ecdsa_sig_buf_len 
)

Encode a signature in the format used by the micro-ecc format; final encoding will be in ASN.1, DER format.

The curve type of signature will be inferred from the length of the signature passed in.

Parameters
raw_ecdsa_sig.Input. Signature to be encoded, in the format used by the micro-ecc library.
raw_ecdsa_sig_len.Input. Length of the signature. Should be even.
raw_ecdsa_sig_buf_len.Input. Length of the buffer containing the signature. Should be long enough to hold final encoding.
Returns
NDN_SUCCESS if there is no error.

◆ ndn_asn1_probe_ecdsa_signature_encoding_size()

int ndn_asn1_probe_ecdsa_signature_encoding_size ( const uint8_t *  raw_ecdsa_sig,
uint32_t  raw_ecdsa_sig_len,
uint32_t *  encoded_ecdsa_sig_len 
)

Probe the size that an ecdsa signature in the same format used by the micro-ecc library will have if it is encoded in ASN.1 DER format.

The curve type of signature will be inferred from the length of the signature passed in.

Parameters
raw_ecdsa_sig.Input. Signature to check the ASN.1 encoded length of, in the format used by the micro-ecc library.
raw_ecdsa_sig_len.Input. Length of the signature. Should be even.
encoded_ecdsa_sig_len.Output. Length that signature will be if ASN.1 encoded. Will only be populated if there is no error.
Returns
NDN_SUCCESS if there is no error.

◆ ndn_const_time_memcmp()

int ndn_const_time_memcmp ( const uint8_t *  a,
const uint8_t *  b,
uint32_t  size 
)