Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix bignum_from_string not works on odd nbytes issue #26

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions bn.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ There may well be room for performance-optimizations and improvements.

*/

#include <stdio.h>
#include <stdbool.h>
#include <assert.h>
#include "bn.h"


Expand Down Expand Up @@ -100,8 +97,6 @@ void bignum_from_string(struct bn* n, char* str, int nbytes)
require(n, "n is null");
require(str, "str is null");
require(nbytes > 0, "nbytes must be positive");
require((nbytes & 1) == 0, "string format must be in hex -> equal number of bytes");
require((nbytes % (sizeof(DTYPE) * 2)) == 0, "string length must be a multiple of (sizeof(DTYPE) * 2) characters");

bignum_init(n);

Expand All @@ -127,7 +122,6 @@ void bignum_to_string(struct bn* n, char* str, int nbytes)
require(n, "n is null");
require(str, "str is null");
require(nbytes > 0, "nbytes must be positive");
require((nbytes & 1) == 0, "string format must be in hex -> equal number of bytes");

int j = BN_ARRAY_SIZE - 1; /* index into array - reading "MSB" first -> big-endian */
int i = 0; /* index into string representation. */
Expand Down
2 changes: 2 additions & 0 deletions bn.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ There may well be room for performance-optimizations and improvements.

*/

#include <stdio.h>
#include <stdbool.h>
#include <stdint.h>
#include <assert.h>

Expand Down