Created
November 17, 2014 22:47
-
-
Save 46bit/a226addf737fd80994af to your computer and use it in GitHub Desktop.
An extract from OpenSSL crypto/bn/bn_lib.c. BN_bn2bin is used to extract binary data from bignums. I think?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| int BN_bn2bin(const BIGNUM *a, unsigned char *to) | |
| { | |
| int n,i; | |
| BN_ULONG l; | |
| bn_check_top(a); | |
| n=i=BN_num_bytes(a); | |
| while (i--) | |
| { | |
| l=a->d[i/BN_BYTES]; | |
| *(to++)=(unsigned char)(l>>(8*(i%BN_BYTES)))&0xff; | |
| } | |
| return(n); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment