diff options
author | rsc <devnull@localhost> | 2004-12-27 19:36:51 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2004-12-27 19:36:51 +0000 |
commit | a812ae4b4392cade3321da1a146a231ff88db3b7 (patch) | |
tree | 5ddcda3efed1d7cf7791faa5f93dc7b33a56a944 /src/cmd/secstore/SConn.h | |
parent | 73bfbacb2409b10f45fd080891a95de29cafe4a0 (diff) | |
download | plan9port-a812ae4b4392cade3321da1a146a231ff88db3b7.tar.gz plan9port-a812ae4b4392cade3321da1a146a231ff88db3b7.tar.bz2 plan9port-a812ae4b4392cade3321da1a146a231ff88db3b7.zip |
secstore from ehg
Diffstat (limited to 'src/cmd/secstore/SConn.h')
-rw-r--r-- | src/cmd/secstore/SConn.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/cmd/secstore/SConn.h b/src/cmd/secstore/SConn.h new file mode 100644 index 00000000..9a428d83 --- /dev/null +++ b/src/cmd/secstore/SConn.h @@ -0,0 +1,26 @@ +// delimited, authenticated, encrypted connection +enum{ Maxmsg=4096 }; // messages > Maxmsg bytes are truncated +typedef struct SConn SConn; + +extern SConn* newSConn(int); // arg is open file descriptor +struct SConn{ + void *chan; + int secretlen; + int (*secret)(SConn*, uchar*, int);// + int (*read)(SConn*, uchar*, int); // <0 if error; errmess in buffer + int (*write)(SConn*, uchar*, int); + void (*free)(SConn*); // also closes file descriptor +}; +// secret(s,b,dir) sets secret for digest, encrypt, using the secretlen +// bytes in b to form keys for the two directions; +// set dir=0 in client, dir=1 in server + +// error convention: write !message in-band +extern void writerr(SConn*, char*); +extern int readstr(SConn*, char*); // call with buf of size Maxmsg+1 + // returns -1 upon error, with error message in buf + +extern void *emalloc(ulong); /* dies on failure; clears memory */ +extern void *erealloc(void *, ulong); +extern char *estrdup(char *); + |