summaryrefslogtreecommitdiff
path: root/nacl/curvecp/portparse.c
diff options
context:
space:
mode:
Diffstat (limited to 'nacl/curvecp/portparse.c')
-rw-r--r--nacl/curvecp/portparse.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/nacl/curvecp/portparse.c b/nacl/curvecp/portparse.c
new file mode 100644
index 00000000..37e4caca
--- /dev/null
+++ b/nacl/curvecp/portparse.c
@@ -0,0 +1,14 @@
1#include "portparse.h"
2
3int portparse(unsigned char *y,const char *x)
4{
5 long long d = 0;
6 long long j;
7 for (j = 0;j < 5 && x[j] >= '0' && x[j] <= '9';++j)
8 d = d * 10 + (x[j] - '0');
9 if (j == 0) return 0;
10 if (x[j]) return 0;
11 y[0] = d >> 8;
12 y[1] = d;
13 return 1;
14}