13 size_t rpos, rlen, spos, slen;
16 unsigned char tmpsig[64] = {0};
23 if (pos == inputlen || input[pos] != 0x30) {
29 if (pos == inputlen) {
32 lenbyte = input[pos++];
35 if (lenbyte > inputlen - pos) {
42 if (pos == inputlen || input[pos] != 0x02) {
48 if (pos == inputlen) {
51 lenbyte = input[pos++];
54 if (lenbyte > inputlen - pos) {
57 while (lenbyte > 0 && input[pos] == 0) {
61 if (lenbyte >=
sizeof(
size_t)) {
66 rlen = (rlen << 8) + input[pos];
73 if (rlen > inputlen - pos) {
80 if (pos == inputlen || input[pos] != 0x02) {
86 if (pos == inputlen) {
89 lenbyte = input[pos++];
92 if (lenbyte > inputlen - pos) {
95 while (lenbyte > 0 && input[pos] == 0) {
99 if (lenbyte >=
sizeof(
size_t)) {
103 while (lenbyte > 0) {
104 slen = (slen << 8) + input[pos];
111 if (slen > inputlen - pos) {
117 while (rlen > 0 && input[rpos] == 0) {
125 memcpy(tmpsig + 32 - rlen, input + rpos, rlen);
129 while (slen > 0 && input[spos] == 0) {
137 memcpy(tmpsig + 64 - slen, input + spos, slen);
144 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 structured that holds a parsed ECDSA signature.