Skip to content

Instantly share code, notes, and snippets.

@brunoerg
Created October 23, 2025 07:21
Show Gist options
  • Select an option

  • Save brunoerg/459c8a2f5e0f6a18265bc4ba1abefadd to your computer and use it in GitHub Desktop.

Select an option

Save brunoerg/459c8a2f5e0f6a18265bc4ba1abefadd to your computer and use it in GitHub Desktop.
Mutation testing report for libsecp's `ecdsa_impl.h`

src/ecdsa_impl.h

  • Date: 2025-10-22 18:42:50
  • Diff groups: 19
  • Entries: 35
  • Mutation score: 74%

Hunk ID: 41

  • commit: 7a2fff8 id: 1 status: alive
@@ -38,7 +38,7 @@ static int secp256k1_der_read_len(size_t *len, const unsigned char **sigp, const
     unsigned char b1;
     VERIFY_CHECK(len != NULL);
     *len = 0;
-    if (*sigp >= sigend) {
+    if (1==0) {
         return 0;
     }
     b1 = *((*sigp)++);
@@ -301,4 +301,4 @@ static int secp256k1_ecdsa_sig_sign(const secp256k1_ecmult_gen_context *ctx, sec
     return (int)(!secp256k1_scalar_is_zero(sigr)) & (int)(!secp256k1_scalar_is_zero(sigs));
 }
 


\n
  • commit: 7a2fff8 id: 2 status: alive
@@ -38,7 +38,7 @@ static int secp256k1_der_read_len(size_t *len, const unsigned char **sigp, const
     unsigned char b1;
     VERIFY_CHECK(len != NULL);
     *len = 0;
-    if (*sigp >= sigend) {
+    if (*sigp > sigend) {
         return 0;
     }
     b1 = *((*sigp)++);
@@ -301,4 +301,4 @@ static int secp256k1_ecdsa_sig_sign(const secp256k1_ecmult_gen_context *ctx, sec
     return (int)(!secp256k1_scalar_is_zero(sigr)) & (int)(!secp256k1_scalar_is_zero(sigs));
 }
 


\n

Hunk ID: 45

  • commit: 7a2fff8 id: 1 status: alive
@@ -42,7 +42,7 @@ static int secp256k1_der_read_len(size_t *len, const unsigned char **sigp, const
         return 0;
     }
     b1 = *((*sigp)++);
-    if (b1 == 0xFF) {
+    if (1==0) {
         /* X.690-0207 8.1.3.5.c the value 0xFF shall not be used. */
         return 0;
     }
@@ -301,4 +301,4 @@ static int secp256k1_ecdsa_sig_sign(const secp256k1_ecmult_gen_context *ctx, sec
     return (int)(!secp256k1_scalar_is_zero(sigr)) & (int)(!secp256k1_scalar_is_zero(sigs));
 }
 


\n

Hunk ID: 54

  • commit: 7a2fff8 id: 1 status: alive
@@ -51,7 +51,7 @@ static int secp256k1_der_read_len(size_t *len, const unsigned char **sigp, const
         *len = b1;
         return 1;
     }
-    if (b1 == 0x80) {
+    if (b1 != 0x80) {
         /* Indefinite length is not allowed in DER. */
         return 0;
     }
@@ -301,4 +301,4 @@ static int secp256k1_ecdsa_sig_sign(const secp256k1_ecmult_gen_context *ctx, sec
     return (int)(!secp256k1_scalar_is_zero(sigr)) & (int)(!secp256k1_scalar_is_zero(sigs));
 }
 


\n
  • commit: 7a2fff8 id: 2 status: alive
@@ -51,7 +51,7 @@ static int secp256k1_der_read_len(size_t *len, const unsigned char **sigp, const
         *len = b1;
         return 1;
     }
-    if (b1 == 0x80) {
+    if (1==0) {
         /* Indefinite length is not allowed in DER. */
         return 0;
     }
@@ -301,4 +301,4 @@ static int secp256k1_ecdsa_sig_sign(const secp256k1_ecmult_gen_context *ctx, sec
     return (int)(!secp256k1_scalar_is_zero(sigr)) & (int)(!secp256k1_scalar_is_zero(sigs));
 }
 


\n
  • commit: 7a2fff8 id: 3 status: alive
@@ -51,7 +51,7 @@ static int secp256k1_der_read_len(size_t *len, const unsigned char **sigp, const
         *len = b1;
         return 1;
     }
-    if (b1 == 0x80) {
+    if (1==1) {
         /* Indefinite length is not allowed in DER. */
         return 0;
     }
@@ -301,4 +301,4 @@ static int secp256k1_ecdsa_sig_sign(const secp256k1_ecmult_gen_context *ctx, sec
     return (int)(!secp256k1_scalar_is_zero(sigr)) & (int)(!secp256k1_scalar_is_zero(sigs));
 }
 


\n

Hunk ID: 60

  • commit: 7a2fff8 id: 1 status: alive
@@ -57,7 +57,7 @@ static int secp256k1_der_read_len(size_t *len, const unsigned char **sigp, const
     }
     /* X.690-207 8.1.3.5 long form length octets */
     lenleft = b1 & 0x7F; /* lenleft is at least 1 */
-    if (lenleft > (size_t)(sigend - *sigp)) {
+    if (lenleft >= (size_t)(sigend - *sigp)) {
         return 0;
     }
     if (**sigp == 0) {
@@ -301,4 +301,4 @@ static int secp256k1_ecdsa_sig_sign(const secp256k1_ecmult_gen_context *ctx, sec
     return (int)(!secp256k1_scalar_is_zero(sigr)) & (int)(!secp256k1_scalar_is_zero(sigs));
 }
 


\n
  • commit: 7a2fff8 id: 2 status: alive
@@ -57,7 +57,7 @@ static int secp256k1_der_read_len(size_t *len, const unsigned char **sigp, const
     }
     /* X.690-207 8.1.3.5 long form length octets */
     lenleft = b1 & 0x7F; /* lenleft is at least 1 */
-    if (lenleft > (size_t)(sigend - *sigp)) {
+    if (lenleft <= (size_t)(sigend - *sigp)) {
         return 0;
     }
     if (**sigp == 0) {
@@ -301,4 +301,4 @@ static int secp256k1_ecdsa_sig_sign(const secp256k1_ecmult_gen_context *ctx, sec
     return (int)(!secp256k1_scalar_is_zero(sigr)) & (int)(!secp256k1_scalar_is_zero(sigs));
 }
 


\n
  • commit: 7a2fff8 id: 3 status: alive
@@ -57,7 +57,7 @@ static int secp256k1_der_read_len(size_t *len, const unsigned char **sigp, const
     }
     /* X.690-207 8.1.3.5 long form length octets */
     lenleft = b1 & 0x7F; /* lenleft is at least 1 */
-    if (lenleft > (size_t)(sigend - *sigp)) {
+    if (lenleft < (size_t)(sigend - *sigp)) {
         return 0;
     }
     if (**sigp == 0) {
@@ -301,4 +301,4 @@ static int secp256k1_ecdsa_sig_sign(const secp256k1_ecmult_gen_context *ctx, sec
     return (int)(!secp256k1_scalar_is_zero(sigr)) & (int)(!secp256k1_scalar_is_zero(sigs));
 }
 


\n

Hunk ID: 63

  • commit: 7a2fff8 id: 1 status: alive
@@ -60,7 +60,7 @@ static int secp256k1_der_read_len(size_t *len, const unsigned char **sigp, const
     if (lenleft > (size_t)(sigend - *sigp)) {
         return 0;
     }
-    if (**sigp == 0) {
+    if (1==0) {
         /* Not the shortest possible length encoding. */
         return 0;
     }
@@ -301,4 +301,4 @@ static int secp256k1_ecdsa_sig_sign(const secp256k1_ecmult_gen_context *ctx, sec
     return (int)(!secp256k1_scalar_is_zero(sigr)) & (int)(!secp256k1_scalar_is_zero(sigs));
 }
 


\n
  • commit: 7a2fff8 id: 2 status: alive
@@ -60,7 +60,7 @@ static int secp256k1_der_read_len(size_t *len, const unsigned char **sigp, const
     if (lenleft > (size_t)(sigend - *sigp)) {
         return 0;
     }
-    if (**sigp == 0) {
+    if (1==1) {
         /* Not the shortest possible length encoding. */
         return 0;
     }
@@ -301,4 +301,4 @@ static int secp256k1_ecdsa_sig_sign(const secp256k1_ecmult_gen_context *ctx, sec
     return (int)(!secp256k1_scalar_is_zero(sigr)) & (int)(!secp256k1_scalar_is_zero(sigs));
 }
 


\n
  • commit: 7a2fff8 id: 3 status: alive
@@ -60,7 +60,7 @@ static int secp256k1_der_read_len(size_t *len, const unsigned char **sigp, const
     if (lenleft > (size_t)(sigend - *sigp)) {
         return 0;
     }
-    if (**sigp == 0) {
+    if (**sigp != 0) {
         /* Not the shortest possible length encoding. */
         return 0;
     }
@@ -301,4 +301,4 @@ static int secp256k1_ecdsa_sig_sign(const secp256k1_ecmult_gen_context *ctx, sec
     return (int)(!secp256k1_scalar_is_zero(sigr)) & (int)(!secp256k1_scalar_is_zero(sigs));
 }
 


\n

Hunk ID: 67

  • commit: 7a2fff8 id: 1 status: alive
@@ -64,7 +64,7 @@ static int secp256k1_der_read_len(size_t *len, const unsigned char **sigp, const
         /* Not the shortest possible length encoding. */
         return 0;
     }
-    if (lenleft > sizeof(size_t)) {
+    if (lenleft < sizeof(size_t)) {
         /* The resulting length would exceed the range of a size_t, so
          * it is certainly longer than the passed array size. */
         return 0;
@@ -301,4 +301,4 @@ static int secp256k1_ecdsa_sig_sign(const secp256k1_ecmult_gen_context *ctx, sec
     return (int)(!secp256k1_scalar_is_zero(sigr)) & (int)(!secp256k1_scalar_is_zero(sigs));
 }
 


\n
  • commit: 7a2fff8 id: 2 status: alive
@@ -64,7 +64,7 @@ static int secp256k1_der_read_len(size_t *len, const unsigned char **sigp, const
         /* Not the shortest possible length encoding. */
         return 0;
     }
-    if (lenleft > sizeof(size_t)) {
+    if (lenleft <= sizeof(size_t)) {
         /* The resulting length would exceed the range of a size_t, so
          * it is certainly longer than the passed array size. */
         return 0;
@@ -301,4 +301,4 @@ static int secp256k1_ecdsa_sig_sign(const secp256k1_ecmult_gen_context *ctx, sec
     return (int)(!secp256k1_scalar_is_zero(sigr)) & (int)(!secp256k1_scalar_is_zero(sigs));
 }
 


\n
  • commit: 7a2fff8 id: 3 status: alive
@@ -64,7 +64,7 @@ static int secp256k1_der_read_len(size_t *len, const unsigned char **sigp, const
         /* Not the shortest possible length encoding. */
         return 0;
     }
-    if (lenleft > sizeof(size_t)) {
+    if (lenleft >= sizeof(size_t)) {
         /* The resulting length would exceed the range of a size_t, so
          * it is certainly longer than the passed array size. */
         return 0;
@@ -301,4 +301,4 @@ static int secp256k1_ecdsa_sig_sign(const secp256k1_ecmult_gen_context *ctx, sec
     return (int)(!secp256k1_scalar_is_zero(sigr)) & (int)(!secp256k1_scalar_is_zero(sigs));
 }
 


\n

Hunk ID: 72

  • commit: 7a2fff8 id: 1 status: alive
@@ -69,7 +69,7 @@ static int secp256k1_der_read_len(size_t *len, const unsigned char **sigp, const
          * it is certainly longer than the passed array size. */
         return 0;
     }
-    while (lenleft > 0) {
+    while (lenleft < 0) {
         *len = (*len << 8) | **sigp;
         (*sigp)++;
         lenleft--;
@@ -301,4 +301,4 @@ static int secp256k1_ecdsa_sig_sign(const secp256k1_ecmult_gen_context *ctx, sec
     return (int)(!secp256k1_scalar_is_zero(sigr)) & (int)(!secp256k1_scalar_is_zero(sigs));
 }
 


\n
  • commit: 7a2fff8 id: 2 status: alive
@@ -69,7 +69,7 @@ static int secp256k1_der_read_len(size_t *len, const unsigned char **sigp, const
          * it is certainly longer than the passed array size. */
         return 0;
     }
-    while (lenleft > 0) {
+    while (lenleft <= 0) {
         *len = (*len << 8) | **sigp;
         (*sigp)++;
         lenleft--;
@@ -301,4 +301,4 @@ static int secp256k1_ecdsa_sig_sign(const secp256k1_ecmult_gen_context *ctx, sec
     return (int)(!secp256k1_scalar_is_zero(sigr)) & (int)(!secp256k1_scalar_is_zero(sigs));
 }
 


\n
  • commit: 7a2fff8 id: 3 status: alive
@@ -69,7 +69,7 @@ static int secp256k1_der_read_len(size_t *len, const unsigned char **sigp, const
          * it is certainly longer than the passed array size. */
         return 0;
     }
-    while (lenleft > 0) {
+    while (1==0) {
         *len = (*len << 8) | **sigp;
         (*sigp)++;
         lenleft--;
@@ -301,4 +301,4 @@ static int secp256k1_ecdsa_sig_sign(const secp256k1_ecmult_gen_context *ctx, sec
     return (int)(!secp256k1_scalar_is_zero(sigr)) & (int)(!secp256k1_scalar_is_zero(sigs));
 }
 


\n

Hunk ID: 77

  • commit: 7a2fff8 id: 1 status: alive
@@ -74,7 +74,7 @@ static int secp256k1_der_read_len(size_t *len, const unsigned char **sigp, const
         (*sigp)++;
         lenleft--;
     }
-    if (*len > (size_t)(sigend - *sigp)) {
+    if (*len < (size_t)(sigend - *sigp)) {
         /* Result exceeds the length of the passed array.
            (Checking this is the responsibility of the caller but it
            can't hurt do it here, too.) */
@@ -301,4 +301,4 @@ static int secp256k1_ecdsa_sig_sign(const secp256k1_ecmult_gen_context *ctx, sec
     return (int)(!secp256k1_scalar_is_zero(sigr)) & (int)(!secp256k1_scalar_is_zero(sigs));
 }
 


\n
  • commit: 7a2fff8 id: 2 status: alive
@@ -74,7 +74,7 @@ static int secp256k1_der_read_len(size_t *len, const unsigned char **sigp, const
         (*sigp)++;
         lenleft--;
     }
-    if (*len > (size_t)(sigend - *sigp)) {
+    if (*len >= (size_t)(sigend - *sigp)) {
         /* Result exceeds the length of the passed array.
            (Checking this is the responsibility of the caller but it
            can't hurt do it here, too.) */
@@ -301,4 +301,4 @@ static int secp256k1_ecdsa_sig_sign(const secp256k1_ecmult_gen_context *ctx, sec
     return (int)(!secp256k1_scalar_is_zero(sigr)) & (int)(!secp256k1_scalar_is_zero(sigs));
 }
 


\n
  • commit: 7a2fff8 id: 3 status: alive
@@ -74,7 +74,7 @@ static int secp256k1_der_read_len(size_t *len, const unsigned char **sigp, const
         (*sigp)++;
         lenleft--;
     }
-    if (*len > (size_t)(sigend - *sigp)) {
+    if (*len <= (size_t)(sigend - *sigp)) {
         /* Result exceeds the length of the passed array.
            (Checking this is the responsibility of the caller but it
            can't hurt do it here, too.) */
@@ -301,4 +301,4 @@ static int secp256k1_ecdsa_sig_sign(const secp256k1_ecmult_gen_context *ctx, sec
     return (int)(!secp256k1_scalar_is_zero(sigr)) & (int)(!secp256k1_scalar_is_zero(sigs));
 }
 


\n

Hunk ID: 83

  • commit: 7a2fff8 id: 1 status: alive
@@ -80,7 +80,7 @@ static int secp256k1_der_read_len(size_t *len, const unsigned char **sigp, const
            can't hurt do it here, too.) */
         return 0;
     }
-    if (*len < 128) {
+    if (1==1) {
         /* Not the shortest possible length encoding. */
         return 0;
     }
@@ -301,4 +301,4 @@ static int secp256k1_ecdsa_sig_sign(const secp256k1_ecmult_gen_context *ctx, sec
     return (int)(!secp256k1_scalar_is_zero(sigr)) & (int)(!secp256k1_scalar_is_zero(sigs));
 }
 


\n
  • commit: 7a2fff8 id: 2 status: alive
@@ -80,7 +80,7 @@ static int secp256k1_der_read_len(size_t *len, const unsigned char **sigp, const
            can't hurt do it here, too.) */
         return 0;
     }
-    if (*len < 128) {
+    if (*len <= 128) {
         /* Not the shortest possible length encoding. */
         return 0;
     }
@@ -301,4 +301,4 @@ static int secp256k1_ecdsa_sig_sign(const secp256k1_ecmult_gen_context *ctx, sec
     return (int)(!secp256k1_scalar_is_zero(sigr)) & (int)(!secp256k1_scalar_is_zero(sigs));
 }
 


\n

Hunk ID: 103

  • commit: 7a2fff8 id: 1 status: alive
@@ -100,7 +100,7 @@ static int secp256k1_der_parse_integer(secp256k1_scalar *r, const unsigned char
     if (secp256k1_der_read_len(&rlen, sig, sigend) == 0) {
         return 0;
     }
-    if (rlen == 0 || rlen > (size_t)(sigend - *sig)) {
+    if (rlen == 0 && rlen > (size_t)(sigend - *sig)) {
         /* Exceeds bounds or not at least length 1 (X.690-0207 8.3.1).  */
         return 0;
     }
@@ -301,4 +301,4 @@ static int secp256k1_ecdsa_sig_sign(const secp256k1_ecmult_gen_context *ctx, sec
     return (int)(!secp256k1_scalar_is_zero(sigr)) & (int)(!secp256k1_scalar_is_zero(sigs));
 }
 


\n

Hunk ID: 111

  • commit: 7a2fff8 id: 1 status: alive
@@ -108,7 +108,7 @@ static int secp256k1_der_parse_integer(secp256k1_scalar *r, const unsigned char
         /* Excessive 0x00 padding. */
         return 0;
     }
-    if (**sig == 0xFF && rlen > 1 && (((*sig)[1]) & 0x80) == 0x80) {
+    if (**sig == 0xFF && rlen < 1 && (((*sig)[1]) & 0x80) == 0x80) {
         /* Excessive 0xFF padding. */
         return 0;
     }
@@ -301,4 +301,4 @@ static int secp256k1_ecdsa_sig_sign(const secp256k1_ecmult_gen_context *ctx, sec
     return (int)(!secp256k1_scalar_is_zero(sigr)) & (int)(!secp256k1_scalar_is_zero(sigs));
 }
 


\n
  • commit: 7a2fff8 id: 2 status: alive
@@ -108,7 +108,7 @@ static int secp256k1_der_parse_integer(secp256k1_scalar *r, const unsigned char
         /* Excessive 0x00 padding. */
         return 0;
     }
-    if (**sig == 0xFF && rlen > 1 && (((*sig)[1]) & 0x80) == 0x80) {
+    if (**sig == 0xFF && rlen <= 1 && (((*sig)[1]) & 0x80) == 0x80) {
         /* Excessive 0xFF padding. */
         return 0;
     }
@@ -301,4 +301,4 @@ static int secp256k1_ecdsa_sig_sign(const secp256k1_ecmult_gen_context *ctx, sec
     return (int)(!secp256k1_scalar_is_zero(sigr)) & (int)(!secp256k1_scalar_is_zero(sigs));
 }
 


\n
  • commit: 7a2fff8 id: 3 status: alive
@@ -108,7 +108,7 @@ static int secp256k1_der_parse_integer(secp256k1_scalar *r, const unsigned char
         /* Excessive 0x00 padding. */
         return 0;
     }
-    if (**sig == 0xFF && rlen > 1 && (((*sig)[1]) & 0x80) == 0x80) {
+    if (**sig == 0xFF && rlen >= 1 && (((*sig)[1]) & 0x80) == 0x80) {
         /* Excessive 0xFF padding. */
         return 0;
     }
@@ -301,4 +301,4 @@ static int secp256k1_ecdsa_sig_sign(const secp256k1_ecmult_gen_context *ctx, sec
     return (int)(!secp256k1_scalar_is_zero(sigr)) & (int)(!secp256k1_scalar_is_zero(sigs));
 }
 


\n

Hunk ID: 122

  • commit: 7a2fff8 id: 1 status: alive
@@ -119,7 +119,7 @@ static int secp256k1_der_parse_integer(secp256k1_scalar *r, const unsigned char
     /* There is at most one leading zero byte:
      * if there were two leading zero bytes, we would have failed and returned 0
      * because of excessive 0x00 padding already. */
-    if (rlen > 0 && **sig == 0) {
+    if (rlen >= 0 && **sig == 0) {
         /* Skip leading zero byte */
         rlen--;
         (*sig)++;
@@ -301,4 +301,4 @@ static int secp256k1_ecdsa_sig_sign(const secp256k1_ecmult_gen_context *ctx, sec
     return (int)(!secp256k1_scalar_is_zero(sigr)) & (int)(!secp256k1_scalar_is_zero(sigs));
 }
 


\n

Hunk ID: 131

  • commit: 7a2fff8 id: 1 status: alive
@@ -128,7 +128,7 @@ static int secp256k1_der_parse_integer(secp256k1_scalar *r, const unsigned char
         overflow = 1;
     }
     if (!overflow) {
-        if (rlen) memcpy(ra + 32 - rlen, *sig, rlen);
+        if (1==1) memcpy(ra + 32 - rlen, *sig, rlen);
         secp256k1_scalar_set_b32(r, ra, &overflow);
     }
     if (overflow) {
@@ -301,4 +301,4 @@ static int secp256k1_ecdsa_sig_sign(const secp256k1_ecmult_gen_context *ctx, sec
     return (int)(!secp256k1_scalar_is_zero(sigr)) & (int)(!secp256k1_scalar_is_zero(sigs));
 }
 


\n

Hunk ID: 177

  • commit: 7a2fff8 id: 1 status: alive
@@ -174,7 +174,7 @@ static int secp256k1_ecdsa_sig_serialize(unsigned char *sig, size_t *size, const
     size_t lenR = 33, lenS = 33;
     secp256k1_scalar_get_b32(&r[1], ar);
     secp256k1_scalar_get_b32(&s[1], as);
-    while (lenR > 1 && rp[0] == 0 && rp[1] < 0x80) { lenR--; rp++; }
+    while (lenR >= 1 && rp[0] == 0 && rp[1] < 0x80) { lenR--; rp++; }
     while (lenS > 1 && sp[0] == 0 && sp[1] < 0x80) { lenS--; sp++; }
     if (*size < 6+lenS+lenR) {
         *size = 6 + lenS + lenR;
@@ -301,4 +301,4 @@ static int secp256k1_ecdsa_sig_sign(const secp256k1_ecmult_gen_context *ctx, sec
     return (int)(!secp256k1_scalar_is_zero(sigr)) & (int)(!secp256k1_scalar_is_zero(sigs));
 }
 


\n

Hunk ID: 178

  • commit: 7a2fff8 id: 1 status: alive
@@ -175,7 +175,7 @@ static int secp256k1_ecdsa_sig_serialize(unsigned char *sig, size_t *size, const
     secp256k1_scalar_get_b32(&r[1], ar);
     secp256k1_scalar_get_b32(&s[1], as);
     while (lenR > 1 && rp[0] == 0 && rp[1] < 0x80) { lenR--; rp++; }
-    while (lenS > 1 && sp[0] == 0 && sp[1] < 0x80) { lenS--; sp++; }
+    while (lenS >= 1 && sp[0] == 0 && sp[1] < 0x80) { lenS--; sp++; }
     if (*size < 6+lenS+lenR) {
         *size = 6 + lenS + lenR;
         return 0;
@@ -301,4 +301,4 @@ static int secp256k1_ecdsa_sig_sign(const secp256k1_ecmult_gen_context *ctx, sec
     return (int)(!secp256k1_scalar_is_zero(sigr)) & (int)(!secp256k1_scalar_is_zero(sigs));
 }
 


\n

Hunk ID: 179

  • commit: 7a2fff8 id: 1 status: alive
@@ -176,7 +176,7 @@ static int secp256k1_ecdsa_sig_serialize(unsigned char *sig, size_t *size, const
     secp256k1_scalar_get_b32(&s[1], as);
     while (lenR > 1 && rp[0] == 0 && rp[1] < 0x80) { lenR--; rp++; }
     while (lenS > 1 && sp[0] == 0 && sp[1] < 0x80) { lenS--; sp++; }
-    if (*size < 6+lenS+lenR) {
+    if (*size <= 6+lenS+lenR) {
         *size = 6 + lenS + lenR;
         return 0;
     }
@@ -301,4 +301,4 @@ static int secp256k1_ecdsa_sig_sign(const secp256k1_ecmult_gen_context *ctx, sec
     return (int)(!secp256k1_scalar_is_zero(sigr)) & (int)(!secp256k1_scalar_is_zero(sigs));
 }
 


\n

Hunk ID: 204

  • commit: 7a2fff8 id: 1 status: alive
@@ -201,7 +201,7 @@ static int secp256k1_ecdsa_sig_verify(const secp256k1_scalar *sigr, const secp25
     secp256k1_gej pubkeyj;
     secp256k1_gej pr;
 
-    if (secp256k1_scalar_is_zero(sigr) || secp256k1_scalar_is_zero(sigs)) {
+    if (secp256k1_scalar_is_zero(sigr) && secp256k1_scalar_is_zero(sigs)) {
         return 0;
     }
 
@@ -301,4 +301,4 @@ static int secp256k1_ecdsa_sig_sign(const secp256k1_ecmult_gen_context *ctx, sec
     return (int)(!secp256k1_scalar_is_zero(sigr)) & (int)(!secp256k1_scalar_is_zero(sigs));
 }
 


\n

Hunk ID: 253

  • commit: 7a2fff8 id: 1 status: alive
@@ -250,7 +250,7 @@ static int secp256k1_ecdsa_sig_verify(const secp256k1_scalar *sigr, const secp25
         /* xr * pr.z^2 mod p == pr.x, so the signature is valid. */
         return 1;
     }
-    if (secp256k1_fe_cmp_var(&xr, &secp256k1_ecdsa_const_p_minus_order) >= 0) {
+    if (secp256k1_fe_cmp_var(&xr, &secp256k1_ecdsa_const_p_minus_order) > 0) {
         /* xr + n >= p, so we can skip testing the second case. */
         return 0;
     }
@@ -301,4 +301,4 @@ static int secp256k1_ecdsa_sig_sign(const secp256k1_ecmult_gen_context *ctx, sec
     return (int)(!secp256k1_scalar_is_zero(sigr)) & (int)(!secp256k1_scalar_is_zero(sigs));
 }
 


\n

Hunk ID: 295

  • commit: 7a2fff8 id: 1 status: alive
@@ -292,7 +292,7 @@ static int secp256k1_ecdsa_sig_sign(const secp256k1_ecmult_gen_context *ctx, sec
     secp256k1_ge_clear(&r);
     high = secp256k1_scalar_is_high(sigs);
     secp256k1_scalar_cond_negate(sigs, high);
-    if (recid) {
+    if (1==0) {
         *recid ^= high;
     }
     /* P.x = order is on the curve, so technically sig->r could end up being zero, which would be an invalid signature.
@@ -301,4 +301,4 @@ static int secp256k1_ecdsa_sig_sign(const secp256k1_ecmult_gen_context *ctx, sec
     return (int)(!secp256k1_scalar_is_zero(sigr)) & (int)(!secp256k1_scalar_is_zero(sigs));
 }
 


\n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment