12 size_t rpos, rlen, spos, slen;
15 unsigned char tmpsig[64] = {0};
22 if (pos == inputlen || input[pos] != 0x30) {
28 if (pos == inputlen) {
31 lenbyte = input[pos++];
34 if (lenbyte > inputlen - pos) {
41 if (pos == inputlen || input[pos] != 0x02) {
47 if (pos == inputlen) {
50 lenbyte = input[pos++];
53 if (lenbyte > inputlen - pos) {
56 while (lenbyte > 0 && input[pos] == 0) {
60 if (lenbyte >=
sizeof(
size_t)) {
65 rlen = (rlen << 8) + input[pos];
72 if (rlen > inputlen - pos) {
79 if (pos == inputlen || input[pos] != 0x02) {
85 if (pos == inputlen) {
88 lenbyte = input[pos++];
91 if (lenbyte > inputlen - pos) {
94 while (lenbyte > 0 && input[pos] == 0) {
98 if (lenbyte >=
sizeof(
size_t)) {
102 while (lenbyte > 0) {
103 slen = (slen << 8) + input[pos];
110 if (slen > inputlen - pos) {
116 while (rlen > 0 && input[rpos] == 0) {
124 memcpy(tmpsig + 32 - rlen, input + rpos, rlen);
128 while (slen > 0 && input[spos] == 0) {
136 memcpy(tmpsig + 64 - slen, input + spos, slen);
143 memset(tmpsig, 0, 64);
int ecdsa_signature_parse_der_lax(const secp256k1_context *ctx, secp256k1_ecdsa_signature *sig, const unsigned char *input, size_t inputlen)
Parse a signature in "lax DER" format.
SECP256K1_API int secp256k1_ecdsa_signature_parse_compact(const secp256k1_context *ctx, secp256k1_ecdsa_signature *sig, const unsigned char *input64) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3)
Parse an ECDSA signature in compact (64 bytes) format.
Opaque data structure that holds a parsed ECDSA signature.