From 678ede7e54bf508991380c0f896fed6005b87ce9 Mon Sep 17 00:00:00 2001 From: rsc Date: Mon, 27 Dec 2004 00:14:43 +0000 Subject: various changes from plan 9 --- include/httpd.h | 1 + include/ip.h | 3 +++ include/libc.h | 4 ++-- include/libsec.h | 13 ++++++++++++- include/thread.h | 2 ++ 5 files changed, 20 insertions(+), 3 deletions(-) diff --git a/include/httpd.h b/include/httpd.h index 03b48adc..7f332519 100644 --- a/include/httpd.h +++ b/include/httpd.h @@ -235,6 +235,7 @@ ulong hdate2sec(char*); int hdatefmt(Fmt*); int hfail(HConnect*, int, ...); int hflush(Hio*); +int hlflush(Hio*); int hgetc(Hio*); int hgethead(HConnect *c, int many); int hinit(Hio*, int, int); diff --git a/include/ip.h b/include/ip.h index da1a1ed4..36b36351 100644 --- a/include/ip.h +++ b/include/ip.h @@ -3,6 +3,7 @@ #if defined(__cplusplus) extern "C" { #endif + /* #pragma src "/sys/src/libip" #pragma lib "libip.a" @@ -106,9 +107,11 @@ long udpwrite(int, Udphdr*, void*, long); Ipifc* readipifc(char*, Ipifc*, int); +void hnputv(void*, uvlong); void hnputl(void*, uint); void hnputs(void*, ushort); uint nhgetl(void*); +uvlong nhgetv(void*); ushort nhgets(void*); ushort ptclbsum(uchar*, int); diff --git a/include/libc.h b/include/libc.h index ff6fd4bc..d91d8906 100644 --- a/include/libc.h +++ b/include/libc.h @@ -715,8 +715,8 @@ extern int unmount(char*, char*); */ extern int noted(int); extern int notify(void(*)(void*, char*)); -extern void notifyenable(char*); -extern void notifydisable(char*); +extern void noteenable(char*); +extern void notedisable(char*); extern void notifyon(char*); extern void notifyoff(char*); extern int p9open(char*, int); diff --git a/include/libsec.h b/include/libsec.h index e65b7f97..e598a780 100644 --- a/include/libsec.h +++ b/include/libsec.h @@ -199,6 +199,7 @@ void rc4back(RC4state*, int); ///////////////////////////////////////////////////////// typedef struct RSApub RSApub; typedef struct RSApriv RSApriv; +typedef struct PEMChain PEMChain; // public/encryption key struct RSApub @@ -222,6 +223,13 @@ struct RSApriv mpint *c2; // (inv p) mod q }; +struct PEMChain +{ + PEMChain *next; + uchar *pem; + int pemlen; +}; + RSApriv* rsagen(int nlen, int elen, int rounds); mpint* rsaencrypt(RSApub *k, mpint *in, mpint *out); mpint* rsadecrypt(RSApriv *k, mpint *in, mpint *out); @@ -232,7 +240,8 @@ void rsaprivfree(RSApriv*); RSApub* rsaprivtopub(RSApriv*); RSApub* X509toRSApub(uchar*, int, char*, int); RSApriv* asn1toRSApriv(uchar*, int); -uchar* decodepem(char *s, char *type, int *len); +uchar* decodepem(char *s, char *type, int *len, char**); +PEMChain* decodepemchain(char *s, char *type); uchar* X509gen(RSApriv *priv, char *subj, ulong valid[2], int *certlen); ///////////////////////////////////////////////////////// @@ -330,6 +339,7 @@ typedef struct TLSconn{ uchar *sessionID; int certlen, sessionIDlen; int (*trace)(char*fmt, ...); + PEMChain *chain; } TLSconn; // tlshand.c @@ -343,6 +353,7 @@ extern int okThumbprint(uchar *sha1, Thumbprint *ok); // readcert.c extern uchar *readcert(char *filename, int *pcertlen); +PEMChain *readcertchain(char *filename); #if defined(__cplusplus) } diff --git a/include/thread.h b/include/thread.h index 8dbabe61..c8f00340 100644 --- a/include/thread.h +++ b/include/thread.h @@ -13,11 +13,13 @@ void threadexits(char *); void threadexitsall(char *); void threadsetname(char*, ...); void threadsetstate(char*, ...); +void threadyield(void); void _threadready(_Thread*); void _threadswitch(void); void _threadsetsysproc(void); void _threadsleep(Rendez*); _Thread *_threadwakeup(Rendez*); +#define yield threadyield /* * per proc and thread data -- cgit v1.2.3