c++ - BAD_ACCESS (code=EXC_I386_GPFLT) when signing with ECDSA -
i trying use crypto++ on ios. downloaded prebuilt version of library marek kotewicz's github.
i struggling hard run this sample code crypto++ wiki.
ecdsa<ecp, cryptopp::sha256>::privatekey privatekey; ecdsa<ecp, cryptopp::sha256>::publickey publickey; autoseededrandompool prng, rrng; privatekey.initialize(prng, cryptopp::asn1::secp256k1()); privatekey.makepublickey(publickey); string signature; string message = "do or not. there no try."; stringsource s(message, true, new signerfilter(rrng, ecdsa<ecp, cryptopp::sha256>::signer(privatekey), new stringsink(signature)));
its crashing following. showing in xcode output window:
bad_access (code=exc_i386_gpflt)
this code snippet memory.h of c++ file pointing bad_access
_libcpp_inline_visibility ~auto_ptr() throw() {delete __ptr_;}
i getting bad_access(code=1 , address=0x0) error pointing line of code of library
-> 0x1065dfa8d <+85>: movq -0x58(%rbp), %rdi
its crashing following. showing in xcode output window:
bad_access(code=exc_i386_gpflt)
the code looks ok me.
i trying use crypto++ on ios. downloaded prebuilt version of library marek kotewicz's github.
i'm taking stab in dark. presumes code showed above really doing in, say, test viewcontroller
.
the precompiled library appears using gnu's standard c++ library. switch llvm's standard c++ library building crypto++ -stdlib=c++
(and not gnu's -stdlib=stdc++
). apple switched years ago, , xcode uses default.
you can find github fat library using llvm standard c++ @ noloader/cryptopp-5.6.2-ios.
or, can build fat library yourself. that, see ios (command line) on crypto++ wiki. prebuilt library @ cryptopp-5.6.2-ios uses instructions.
autoseededrandompool prng, rrng;
you need 1 of these.
stringsource s(message, true, new signerfilter(rrng, ecdsa<ecp, cryptopp::sha256>::signer(privatekey), new stringsink(signature)));
over years, i've come wonder temporary signer created pipeline. i've changed crypto++ wiki stop using them. use code instead:
ecdsa<ecp, cryptopp::sha256>::privatekey privatekey; ... ecdsa<ecp, cryptopp::sha256>::signer signer(privatekey); ... stringsource s(message, true, new signerfilter(prng, signer, new stringsink(signature)));
Comments
Post a Comment