Artifact 36f9bc1a62796123e9a5e341f8b81a4b9336d39e:
- File nacl.fs — part of check-in [5dd56873c6] at 2012-07-02 22:38:35 on branch trunk — 32 bit compiles - but don't expect it to work (user: bernd size: 1778)
- File testing/nacl.fs — part of check-in [560fb86b36] at 2012-10-22 22:04:40 on branch trunk — Move unnecessary stuff to testing/ (user: bernd size: 1778)
0000: 5c 20 49 6e 74 65 72 66 61 63 65 20 74 6f 20 74 \ Interface to t 0010: 68 65 20 4e 61 43 4c 20 6c 69 62 72 61 72 79 0a he NaCL library. 0020: 0a 63 2d 6c 69 62 72 61 72 79 20 6e 61 63 6c 0a .c-library nacl. 0030: 20 20 20 20 73 22 20 6e 61 63 6c 22 20 61 64 64 s" nacl" add 0040: 2d 6c 69 62 0a 20 20 20 20 63 65 6c 6c 20 38 20 -lib. cell 8 0050: 3d 20 5b 49 46 5d 0a 09 5c 63 20 23 69 6e 63 6c = [IF]..\c #incl 0060: 75 64 65 20 3c 61 6d 64 36 34 2f 63 72 79 70 74 ude <amd64/crypt 0070: 6f 5f 62 6f 78 2e 68 3e 0a 09 5c 63 20 23 69 6e o_box.h>..\c #in 0080: 63 6c 75 64 65 20 3c 61 6d 64 36 34 2f 63 72 79 clude <amd64/cry 0090: 70 74 6f 5f 73 63 61 6c 61 72 6d 75 6c 74 5f 63 pto_scalarmult_c 00a0: 75 72 76 65 32 35 35 31 39 2e 68 3e 0a 09 5c 63 urve25519.h>..\c 00b0: 20 23 69 6e 63 6c 75 64 65 20 3c 61 6d 64 36 34 #include <amd64 00c0: 2f 63 72 79 70 74 6f 5f 73 65 63 72 65 74 62 6f /crypto_secretbo 00d0: 78 2e 68 3e 0a 09 5c 63 20 23 69 6e 63 6c 75 64 x.h>..\c #includ 00e0: 65 20 3c 61 6d 64 36 34 2f 63 72 79 70 74 6f 5f e <amd64/crypto_ 00f0: 73 74 72 65 61 6d 2e 68 3e 0a 09 5c 63 20 23 69 stream.h>..\c #i 0100: 6e 63 6c 75 64 65 20 3c 61 6d 64 36 34 2f 63 72 nclude <amd64/cr 0110: 79 70 74 6f 5f 68 61 73 68 2e 68 3e 0a 09 5c 63 ypto_hash.h>..\c 0120: 20 23 69 6e 63 6c 75 64 65 20 3c 61 6d 64 36 34 #include <amd64 0130: 2f 72 61 6e 64 6f 6d 62 79 74 65 73 2e 68 3e 0a /randombytes.h>. 0140: 20 20 20 20 5b 45 4c 53 45 5d 0a 09 5c 63 20 23 [ELSE]..\c # 0150: 69 6e 63 6c 75 64 65 20 3c 78 38 36 2f 63 72 79 include <x86/cry 0160: 70 74 6f 5f 62 6f 78 2e 68 3e 0a 09 5c 63 20 23 pto_box.h>..\c # 0170: 69 6e 63 6c 75 64 65 20 3c 78 38 36 2f 63 72 79 include <x86/cry 0180: 70 74 6f 5f 73 63 61 6c 61 72 6d 75 6c 74 5f 63 pto_scalarmult_c 0190: 75 72 76 65 32 35 35 31 39 2e 68 3e 0a 09 5c 63 urve25519.h>..\c 01a0: 20 23 69 6e 63 6c 75 64 65 20 3c 78 38 36 2f 63 #include <x86/c 01b0: 72 79 70 74 6f 5f 73 65 63 72 65 74 62 6f 78 2e rypto_secretbox. 01c0: 68 3e 0a 09 5c 63 20 23 69 6e 63 6c 75 64 65 20 h>..\c #include 01d0: 3c 78 38 36 2f 63 72 79 70 74 6f 5f 73 74 72 65 <x86/crypto_stre 01e0: 61 6d 2e 68 3e 0a 09 5c 63 20 23 69 6e 63 6c 75 am.h>..\c #inclu 01f0: 64 65 20 3c 78 38 36 2f 63 72 79 70 74 6f 5f 68 de <x86/crypto_h 0200: 61 73 68 2e 68 3e 0a 09 5c 63 20 23 69 6e 63 6c ash.h>..\c #incl 0210: 75 64 65 20 3c 78 38 36 2f 72 61 6e 64 6f 6d 62 ude <x86/randomb 0220: 79 74 65 73 2e 68 3e 0a 20 20 20 20 5b 54 48 45 ytes.h>. [THE 0230: 4e 5d 0a 20 20 20 20 63 2d 66 75 6e 63 74 69 6f N]. c-functio 0240: 6e 20 63 72 79 70 74 6f 5f 62 6f 78 5f 6b 65 79 n crypto_box_key 0250: 70 61 69 72 20 63 72 79 70 74 6f 5f 62 6f 78 5f pair crypto_box_ 0260: 6b 65 79 70 61 69 72 20 61 20 61 20 2d 2d 20 76 keypair a a -- v 0270: 6f 69 64 20 28 20 70 6b 20 73 6b 20 2d 2d 20 29 oid ( pk sk -- ) 0280: 0a 20 20 20 20 63 2d 66 75 6e 63 74 69 6f 6e 20 . c-function 0290: 63 72 79 70 74 6f 5f 62 6f 78 20 63 72 79 70 74 crypto_box crypt 02a0: 6f 5f 62 6f 78 20 61 20 61 20 6e 20 61 20 61 20 o_box a a n a a 02b0: 61 20 2d 2d 20 76 6f 69 64 20 28 20 63 20 6d 20 a -- void ( c m 02c0: 6d 6c 65 6e 20 6e 20 70 6b 20 73 6b 20 2d 2d 20 mlen n pk sk -- 02d0: 29 0a 20 20 20 20 63 2d 66 75 6e 63 74 69 6f 6e ). c-function 02e0: 20 63 72 79 70 74 6f 5f 62 6f 78 5f 62 65 66 6f crypto_box_befo 02f0: 72 65 6e 6d 20 63 72 79 70 74 6f 5f 62 6f 78 5f renm crypto_box_ 0300: 62 65 66 6f 72 65 6e 6d 20 61 20 61 20 61 20 2d beforenm a a a - 0310: 2d 20 76 6f 69 64 20 28 20 6b 20 70 6b 20 73 6b - void ( k pk sk 0320: 20 2d 2d 20 29 0a 20 20 20 20 63 2d 66 75 6e 63 -- ). c-func 0330: 74 69 6f 6e 20 63 72 79 70 74 6f 5f 62 6f 78 5f tion crypto_box_ 0340: 6f 70 65 6e 20 63 72 79 70 74 6f 5f 62 6f 78 5f open crypto_box_ 0350: 6f 70 65 6e 20 61 20 61 20 6e 20 61 20 61 20 61 open a a n a a a 0360: 20 2d 2d 20 76 6f 69 64 20 28 20 6d 20 63 20 63 -- void ( m c c 0370: 6c 65 6e 20 6e 20 70 6b 20 73 6b 20 2d 2d 20 29 len n pk sk -- ) 0380: 0a 20 20 20 20 63 2d 66 75 6e 63 74 69 6f 6e 20 . c-function 0390: 63 72 79 70 74 6f 5f 73 63 61 6c 61 72 6d 75 6c crypto_scalarmul 03a0: 74 5f 63 75 72 76 65 32 35 35 31 39 20 63 72 79 t_curve25519 cry 03b0: 70 74 6f 5f 73 63 61 6c 61 72 6d 75 6c 74 5f 63 pto_scalarmult_c 03c0: 75 72 76 65 32 35 35 31 39 20 61 20 61 20 61 20 urve25519 a a a 03d0: 2d 2d 20 76 6f 69 64 20 28 20 73 20 70 6b 20 73 -- void ( s pk s 03e0: 6b 20 2d 2d 20 29 0a 20 20 20 20 63 2d 66 75 6e k -- ). c-fun 03f0: 63 74 69 6f 6e 20 63 72 79 70 74 6f 5f 73 63 61 ction crypto_sca 0400: 6c 61 72 6d 75 6c 74 5f 63 75 72 76 65 32 35 35 larmult_curve255 0410: 31 39 5f 62 61 73 65 20 63 72 79 70 74 6f 5f 73 19_base crypto_s 0420: 63 61 6c 61 72 6d 75 6c 74 5f 63 75 72 76 65 32 calarmult_curve2 0430: 35 35 31 39 5f 62 61 73 65 20 61 20 61 20 2d 2d 5519_base a a -- 0440: 20 76 6f 69 64 20 28 20 70 6b 20 73 6b 20 2d 2d void ( pk sk -- 0450: 20 29 0a 20 20 20 20 63 2d 66 75 6e 63 74 69 6f ). c-functio 0460: 6e 20 63 72 79 70 74 6f 5f 73 65 63 72 65 74 62 n crypto_secretb 0470: 6f 78 20 63 72 79 70 74 6f 5f 73 65 63 72 65 74 ox crypto_secret 0480: 62 6f 78 20 61 20 61 20 6e 20 61 20 61 20 2d 2d box a a n a a -- 0490: 20 76 6f 69 64 20 28 20 63 20 6d 20 6d 6c 65 6e void ( c m mlen 04a0: 20 6e 20 6b 20 2d 2d 20 29 0a 20 20 20 20 63 2d n k -- ). c- 04b0: 66 75 6e 63 74 69 6f 6e 20 63 72 79 70 74 6f 5f function crypto_ 04c0: 73 65 63 72 65 74 62 6f 78 5f 6f 70 65 6e 20 63 secretbox_open c 04d0: 72 79 70 74 6f 5f 73 65 63 72 65 74 62 6f 78 5f rypto_secretbox_ 04e0: 6f 70 65 6e 20 61 20 61 20 6e 20 61 20 61 20 2d open a a n a a - 04f0: 2d 20 76 6f 69 64 20 28 20 6d 20 63 20 63 6c 65 - void ( m c cle 0500: 6e 20 6e 20 6b 20 2d 2d 20 29 0a 20 20 20 20 63 n n k -- ). c 0510: 2d 66 75 6e 63 74 69 6f 6e 20 63 72 79 70 74 6f -function crypto 0520: 5f 73 74 72 65 61 6d 20 63 72 79 70 74 6f 5f 73 _stream crypto_s 0530: 74 72 65 61 6d 20 61 20 6e 20 61 20 61 20 2d 2d tream a n a a -- 0540: 20 76 6f 69 64 20 28 20 63 20 63 6c 65 6e 20 6e void ( c clen n 0550: 20 6b 20 2d 2d 20 29 0a 20 20 20 20 63 2d 66 75 k -- ). c-fu 0560: 6e 63 74 69 6f 6e 20 63 72 79 70 74 6f 5f 73 74 nction crypto_st 0570: 72 65 61 6d 5f 78 6f 72 20 63 72 79 70 74 6f 5f ream_xor crypto_ 0580: 73 74 72 65 61 6d 5f 78 6f 72 20 61 20 61 20 6e stream_xor a a n 0590: 20 61 20 61 20 2d 2d 20 76 6f 69 64 20 28 20 63 a a -- void ( c 05a0: 20 6d 20 6d 6c 65 6e 20 6e 20 6b 20 2d 2d 20 29 m mlen n k -- ) 05b0: 0a 20 20 20 20 63 2d 66 75 6e 63 74 69 6f 6e 20 . c-function 05c0: 63 72 79 70 74 6f 5f 68 61 73 68 20 63 72 79 70 crypto_hash cryp 05d0: 74 6f 5f 68 61 73 68 20 61 20 61 20 6e 20 2d 2d to_hash a a n -- 05e0: 20 76 6f 69 64 20 28 20 68 20 6d 20 6d 6c 65 6e void ( h m mlen 05f0: 20 2d 2d 20 29 0a 20 20 20 20 63 2d 66 75 6e 63 -- ). c-func 0600: 74 69 6f 6e 20 72 61 6e 64 6f 6d 62 79 74 65 73 tion randombytes 0610: 20 72 61 6e 64 6f 6d 62 79 74 65 73 20 61 20 6e randombytes a n 0620: 20 2d 2d 20 76 6f 69 64 20 28 20 61 64 64 72 20 -- void ( addr 0630: 6e 20 2d 2d 20 29 0a 65 6e 64 2d 63 2d 6c 69 62 n -- ).end-c-lib 0640: 72 61 72 79 0a 0a 33 32 20 43 6f 6e 73 74 61 6e rary..32 Constan 0650: 74 20 50 55 42 4c 49 43 4b 45 59 42 59 54 45 53 t PUBLICKEYBYTES 0660: 0a 33 32 20 43 6f 6e 73 74 61 6e 74 20 53 45 43 .32 Constant SEC 0670: 52 45 54 4b 45 59 42 59 54 45 53 0a 33 32 20 43 RETKEYBYTES.32 C 0680: 6f 6e 73 74 61 6e 74 20 4b 45 59 42 59 54 45 53 onstant KEYBYTES 0690: 0a 33 32 20 43 6f 6e 73 74 61 6e 74 20 42 45 46 .32 Constant BEF 06a0: 4f 52 45 4e 4d 42 59 54 45 53 0a 32 34 20 43 6f ORENMBYTES.24 Co 06b0: 6e 73 74 61 6e 74 20 4e 4f 4e 43 45 42 59 54 45 nstant NONCEBYTE 06c0: 53 0a 33 32 20 43 6f 6e 73 74 61 6e 74 20 5a 45 S.32 Constant ZE 06d0: 52 4f 42 59 54 45 53 0a 31 36 20 43 6f 6e 73 74 ROBYTES.16 Const 06e0: 61 6e 74 20 42 4f 58 5a 45 52 4f 42 59 54 45 53 ant BOXZEROBYTES 06f0: 0a 0a ..