chiark
/
gitweb
/
~mdw
/
catacomb
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b1182cd
)
math/ec-exp.h: Fix segfault when base point is at infinity.
author
Mark Wooding
<mdw@distorted.org.uk>
Fri, 18 Oct 2019 21:45:01 +0000
(22:45 +0100)
committer
Mark Wooding
<mdw@distorted.org.uk>
Mon, 16 Dec 2019 16:25:25 +0000
(16:25 +0000)
math/ec-exp.h
patch
|
blob
|
blame
|
history
diff --git
a/math/ec-exp.h
b/math/ec-exp.h
index 6cad7537c5bd328693d819cce1e34d11c8415683..b393d7ececaccb74d556f6d33cf92404520d5a19 100644
(file)
--- a/
math/ec-exp.h
+++ b/
math/ec-exp.h
@@
-37,9
+37,13
@@
#define EXP_TYPE ec
#define EXP_COPY(d, p) do { \
- (d).x = MP_COPY((p).x); \
- (d).y = MP_COPY((p).y); \
- (d).z = (p).z ? MP_COPY((p).z) : MP_NEW; \
+ if (EC_ATINF(&(p))) \
+ (d).x = (d).y = (d).z = MP_NEW; \
+ else { \
+ (d).x = MP_COPY((p).x); \
+ (d).y = MP_COPY((p).y); \
+ (d).z = (p).z ? MP_COPY((p).z) : MP_NEW; \
+ } \
} while (0)
#define EXP_DROP(x) EC_DESTROY(&(x))