FreeRTOS-Plus/ThirdParty/WolfSSL-FIPS-Ready/wolfcrypt/src/asn.c
/* Der Decode ECC-DSA Signature, r & s stored as big ints */
Der Decode ECC-DSA Signature, r & s stored as big ints
Der Decode ECC - DSA Signature r & s stored as big ints
int DecodeECC_DSA_Sig(const byte* sig, word32 sigLen, mp_int* r, mp_int* s)
{
    word32 idx = 0;
    int    len = 0;
    if (GetSequence(sig, &idx, &len, sigLen) < 0) {
        return ASN_ECC_KEY_E;
    }
#ifndef NO_STRICT_ECDSA_LEN
    if (sigLen != idx + (word32)len) {
        return ASN_ECC_KEY_E;
    }
#else
    if ((word32)len > (sigLen - idx)) {
        return ASN_ECC_KEY_E;
    }
#endif
    if (GetInt(r, sig, &idx, sigLen) < 0) {
        return ASN_ECC_KEY_E;
    }
    if (GetInt(s, sig, &idx, sigLen) < 0) {
        mp_clear(r);
        return ASN_ECC_KEY_E;
    }
    return 0;
}
int DecodeECC_DSA_Sig ( const byte * sig , word32 sigLen , mp_int * r , mp_int * s ) { word32 idx = 0 ; int len = 0 ; if ( GetSequence ( sig , & idx , & len , sigLen ) < 0 ) { return ASN_ECC_KEY_E ; } #ifndef NO_STRICT_ECDSA_LEN if ( sigLen != idx + ( word32 ) len ) { return ASN_ECC_KEY_E ; } #else if ( ( word32 ) len > ( sigLen - idx ) ) { return ASN_ECC_KEY_E ; } #endif if ( GetInt ( r , sig , & idx , sigLen ) < 0 ) { return ASN_ECC_KEY_E ; } if ( GetInt ( s , sig , & idx , sigLen ) < 0 ) { mp_clear ( r ) ; return ASN_ECC_KEY_E ; } return 0 ; }
Der Decode ECC-DSA Signature, r & s stored as big ints
Der Decode ECC - DSA Signature r & s stored as big ints
/* enable strict length checking for signature */ /* allow extra signature bytes at end */