mbed/COMPONENT_AWSIOT_PKCS11PSA/corePKCS11/core_pki_utils.c
/*
 * Convert a signature from an ASN.1 sequence of two integers
 * to a raw {r,s} buffer. Note: the provided sig buffer must be at least
 * twice as big as int_size.
 */
Convert a signature from an ASN.1 sequence of two integers
to a raw {r,s} buffer. Note: the provided sig buffer must be at least
twice as big as int_size.
Convert a signature from an ASN . 1 sequence of two integers to a raw { r s } buffer . Note : the provided sig buffer must be at least twice as big as int_size .
static int extract_ecdsa_sig( unsigned char **p, const unsigned char *end,
                              unsigned char *sig, size_t int_size )
{
    int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
    size_t tmp_size;
    if( ( ret = mbedtls_asn1_get_tag( p, end, &tmp_size,
                MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE ) ) != 0 )
        return( ret );
    if( ( ret = extract_ecdsa_sig_int( p, end, sig, int_size ) ) != 0 )
        return( ret );
    if( ( ret = extract_ecdsa_sig_int( p, end, sig + int_size, int_size ) ) != 0 )
        return( ret );
    return( 0 );
}
static int extract_ecdsa_sig ( unsigned char * * p , const unsigned char * end , unsigned char * sig , size_t int_size ) { int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED ; size_t tmp_size ; if ( ( ret = mbedtls_asn1_get_tag ( p , end , & tmp_size , MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE ) ) != 0 ) return ( ret ) ; if ( ( ret = extract_ecdsa_sig_int ( p , end , sig , int_size ) ) != 0 ) return ( ret ) ; if ( ( ret = extract_ecdsa_sig_int ( p , end , sig + int_size , int_size ) ) != 0 ) return ( ret ) ; return ( 0 ) ; }
Convert a signature from an ASN.1 sequence of two integers
 to a raw {r,s} buffer.
Convert a signature from an ASN . 1 sequence of two integers to a raw { r s } buffer .
/* Extract r */ /* Extract s */