diff options
author | irungentoo <irungentoo@gmail.com> | 2013-07-02 09:53:34 -0400 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2013-07-02 09:53:34 -0400 |
commit | e2967396ac73cb7410787886cdaf072a184ffc49 (patch) | |
tree | 527a74d25a4a0705fc641994fd35bfab22662034 /nacl/curvecp/portparse.c | |
parent | 8928c817df345f29aa0b194743595aa11bd6a8ba (diff) |
Added NaCl crypto library.
Diffstat (limited to 'nacl/curvecp/portparse.c')
-rw-r--r-- | nacl/curvecp/portparse.c | 14 |
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 | |||
3 | int 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 | } | ||