Fix signedness mistakes in secp256k1_num_set_hex #56

pull sipa wants to merge 1 commits into bitcoin-core:master from sipa:fixsign changing 1 files +1 −1
  1. sipa commented at 1:43 pm on August 26, 2014: contributor
    Closes #51 as well.
  2. sipa renamed this:
    Fix some signedness mistakes in secp256k1_num_set_hex
    Fix signedness mistakes in secp256k1_num_set_hex
    on Aug 26, 2014
  3. sipa cross-referenced this on Aug 26, 2014 from issue fix unsigned warning in num_gmp_impl.h by caktux
  4. caktux commented at 5:09 pm on August 26, 2014: contributor

    This does not fix the warning, casting to unsigned later or declaring as unsigned while assigning to signed is the same mistake. Here the type passed to mpn_set_str is unsigned char*.

    0.../secp256k1/impl/num_gmp.h:286:37: warning: passing 'char [257]' to parameter of type 'const unsigned char *' converts between pointers to integer types with different sign [-Wpointer-sign]
    1    r->limbs = mpn_set_str(r->data, num, alen, 16);
    2                                    ^~~
    3/usr/local/include/gmp.h:1585:68: note: passing argument to parameter here
    4__GMP_DECLSPEC mp_size_t mpn_set_str (mp_ptr, const unsigned char *, size_t, int);
    5                                                                   ^
    
  5. sipa commented at 11:16 pm on August 26, 2014: contributor
    You’re right. I found some online documentation that declared it as const char_, but it seems my version here also uses const unsigned char_.
  6. Fix a signedness mistake in secp256k1_num_set_hex
    We were using a potentially signed char as index in an array.
    fa492f059d
  7. sipa force-pushed on Aug 26, 2014
  8. sipa commented at 11:54 pm on August 26, 2014: contributor
    Merged #51, and rebased this to only fix the array indexing.
  9. sipa merged this on Aug 28, 2014
  10. sipa closed this on Aug 28, 2014

  11. sipa referenced this in commit d531b04ea9 on Aug 28, 2014
  12. real-or-random referenced this in commit acc62885b5 on May 31, 2019


sipa caktux


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/secp256k1. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-22 20:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me