History

merge

23hiro committed 10 years ago

Commit 7d2ec9b2 parents 08a8630 9bec8b112 files · +128 −95Browse files

Unified · Split

12 files
  1. 9ball.ico +0 −0
  2. 9ball.png +0 −0
  3. 9ball.rc +0 −1
  4. Make.win32 +3 −3
  5. drawterm.ico +0 −0
  6. drawterm.rc +1 −1
  7. glenda-t.ico +0 −0
  8. glenda-t.rc +1 −0
  9. gui-win32/screen.c +2 −3
  10. include/keyboard.h +44 −26
  11. kern/devssl.c +80 −64
  12. main.c +1 −1
9ball.ico+0−0

Binary file not shown.

9ball.png+0−0

Binary file not shown.

9ball.rc+0−1
@@ -1 +0,0 @@
1IDI_ICON1 ICON DISCARDABLE "9ball.ico"
Make.win32+3−3
@@ -19,7 +19,7 @@ GUI=win32 · 18 unmodified lines
19LDFLAGS=-mwindows19LDFLAGS=-mwindows
20LDADD=-lkernel32 -ladvapi32 -lgdi32 -lmpr -lwsock32 -lmsvcrt -lmingw3220LDADD=-lkernel32 -ladvapi32 -lgdi32 -lmpr -lwsock32 -lmsvcrt -lmingw32
21TARG=drawterm.exe21TARG=drawterm.exe
22XOFILES=9ball.$O22XOFILES=glenda-t.$O
23 23
24# Windows via MSVC24# Windows via MSVC
25#AR=???25#AR=???
@@ -37,6 +37,6 @@ all: default · 11 unmodified lines
37libmachdep.a:37libmachdep.a:
38 (cd win32-386; make)38 (cd win32-386; make)
39 39
409ball.$O: 9ball.rc 9ball.ico40glenda-t.$O: glenda-t.rc glenda-t.ico
41 $(WINDRES) -i 9ball.rc -o 9ball.o41 $(WINDRES) -i glenda-t.rc -o glenda-t.o
42 42
drawterm.ico+0−0

Binary file not shown.

drawterm.rc+1−1
@@ -28,7 +28,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US · 27 unmodified lines
28 28
29// Icon with lowest ID value placed first to ensure application icon29// Icon with lowest ID value placed first to ensure application icon
30// remains consistent on all systems.30// remains consistent on all systems.
31IDI_ICON1 ICON DISCARDABLE "drawterm.ico"31IDI_ICON1 ICON DISCARDABLE "glenda-t.ico"
32 32
33#ifdef APSTUDIO_INVOKED33#ifdef APSTUDIO_INVOKED
34/////////////////////////////////////////////////////////////////////////////34/////////////////////////////////////////////////////////////////////////////
glenda-t.ico+0−0

Binary file not shown.

glenda-t.rc+1−0
@@ -0,0 +1 @@
1101 ICON DISCARDABLE "glenda-t.ico"
gui-win32/screen.c+2−3
@@ -186,7 +186,7 @@ winproc(void *a) · 185 unmodified lines
186 wc.cbClsExtra = 0;186 wc.cbClsExtra = 0;
187 wc.cbWndExtra = 0;187 wc.cbWndExtra = 0;
188 wc.hInstance = inst;188 wc.hInstance = inst;
189 wc.hIcon = LoadIcon(inst, NULL);189 wc.hIcon = LoadIcon(inst, MAKEINTRESOURCE(101));
190 wc.hCursor = LoadCursor(NULL, IDC_ARROW);190 wc.hCursor = LoadCursor(NULL, IDC_ARROW);
191 wc.hbrBackground = GetStockObject(WHITE_BRUSH);191 wc.hbrBackground = GetStockObject(WHITE_BRUSH);
192 wc.lpszMenuName = 0;192 wc.lpszMenuName = 0;
@@ -416,8 +416,7 @@ WindowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) · 223 unmodified lines
416 kbdputc(kbdq, Kins);416 kbdputc(kbdq, Kins);
417 break;417 break;
418 case VK_DELETE:418 case VK_DELETE:
419// kbdputc(kbdq, Kdel);419 kbdputc(kbdq, Kdel);
420 kbdputc(kbdq, 0x7f); // should have Kdel in keyboard.h
421 break;420 break;
422 case VK_UP:421 case VK_UP:
423 kbdputc(kbdq, Kup);422 kbdputc(kbdq, Kup);
include/keyboard.h+44−26
@@ -1,8 +1,3 @@
1#ifdef PLAN9
2#pragma src "/sys/src/libdraw"
3#pragma lib "libdraw.a"
4#endif
5
6typedef struct Keyboardctl Keyboardctl;1typedef struct Keyboardctl Keyboardctl;
7typedef struct Channel Channel;2typedef struct Channel Channel;
8 3
@@ -18,27 +13,50 @@ struct Keyboardctl · 9 unmodified lines
18 13
19 14
20extern Keyboardctl* initkeyboard(char*);15extern Keyboardctl* initkeyboard(char*);
21extern int ctlkeyboard(Keyboardctl*, char*);16extern int ctlkeyboard(Keyboardctl*, char*);
22extern void closekeyboard(Keyboardctl*);17extern void closekeyboard(Keyboardctl*);
23 18
24enum {19enum {
25 KF= 0xF000, /* Rune: beginning of private Unicode space */20 KF= 0xF000, /* Rune: beginning of private Unicode space */
26 Spec= 0xF800,21 Spec= 0xF800,
27 /* KF|1, KF|2, ..., KF|0xC is F1, F2, ..., F12 */22 PF= Spec|0x20, /* num pad function key */
28 Khome= KF|0x0D,23 Kview= Spec|0x00, /* view (shift window up) */
29 Kup= KF|0x0E,24 /* KF|1, KF|2, ..., KF|0xC is F1, F2, ..., F12 */
30 Kpgup= KF|0x0F,25 Khome= KF|0x0D,
31 Kprint= KF|0x10,26 Kup= KF|0x0E,
32 Kleft= KF|0x11,27 Kdown= Kview,
33 Kright= KF|0x12,28 Kpgup= KF|0x0F,
34 Kdown= Spec|0x00,29 Kprint= KF|0x10,
35 Kview= Spec|0x00, 30 Kleft= KF|0x11,
36 Kpgdown= KF|0x13,31 Kright= KF|0x12,
37 Kins= KF|0x14,32 Kpgdown= KF|0x13,
38 Kend= KF|0x18,33 Kins= KF|0x14,
39 34
40 Kalt= KF|0x15,35 Kalt= KF|0x15,
41 Kshift= KF|0x16, 36 Kshift= KF|0x16,
42 Kctl= KF|0x17,37 Kctl= KF|0x17,
38
39 Kend= KF|0x18,
40 Kscroll= KF|0x19,
41 Kscrolloneup= KF|0x20,
42 Kscrollonedown= KF|0x21,
43
44 Ksoh= 0x01,
45 Kstx= 0x02,
46 Ketx= 0x03,
47 Keof= 0x04,
48 Kenq= 0x05,
49 Kack= 0x06,
50 Kbs= 0x08,
51 Knack= 0x15,
52 Ketb= 0x17,
53 Kdel= 0x7f,
54 Kesc= 0x1b,
55
56 Kbreak= Spec|0x61,
57 Kcaps= Spec|0x64,
58 Knum= Spec|0x65,
59 Kmiddle= Spec|0x66,
60 Kaltgr= Spec|0x67,
61 Kmouse= Spec|0x100,
43};62};
44
kern/devssl.c+80−64
@@ -7,7 +7,7 @@ · 6 unmodified lines
7#include "fns.h"7#include "fns.h"
8#include "error.h"8#include "error.h"
9 9
10#include "libsec.h"10#include <libsec.h>
11 11
12#define NOSPOOKS 112#define NOSPOOKS 1
13 13
@@ -72,15 +72,15 @@ struct Dstate · 58 unmodified lines
72enum72enum
73{73{
74 Maxdmsg= 1<<16,74 Maxdmsg= 1<<16,
75 Maxdstate= 128, /* must be a power of 2 */75 Maxdstate= 512, /* max. open ssl conn's; must be a power of 2 */
76};76};
77 77
78Lock dslock;78static Lock dslock;
79int dshiwat;79static int dshiwat;
80char *dsname[Maxdstate];80static char *dsname[Maxdstate];
81Dstate *dstate[Maxdstate];81static Dstate *dstate[Maxdstate];
82char *encalgs;82static char *encalgs;
83char *hashalgs;83static char *hashalgs;
84 84
85enum{85enum{
86 Qtopdir = 1, /* top level directory */86 Qtopdir = 1, /* top level directory */
@@ -113,17 +113,13 @@ static void dsnew(Chan *c, Dstate **); · 26 unmodified lines
113static long sslput(Dstate *s, Block * volatile b);113static long sslput(Dstate *s, Block * volatile b);
114 114
115char *sslnames[] = {115char *sslnames[] = {
116 /* unused */ 0,116[Qclonus] "clone",
117 /* topdir */ 0,117[Qdata] "data",
118 /* protodir */ 0,118[Qctl] "ctl",
119 "clone",119[Qsecretin] "secretin",
120 /* convdir */ 0,120[Qsecretout] "secretout",
121 "data",121[Qencalgs] "encalgs",
122 "ctl",122[Qhashalgs] "hashalgs",
123 "secretin",
124 "secretout",
125 "encalgs",
126 "hashalgs",
127};123};
128 124
129static int125static int
@@ -237,7 +233,6 @@ sslgen(Chan *c, char *n, Dirtab *d, int nd, int s, Dir *dp) · 107 unmodified lines
237 devdir(c, c->qid, sslnames[TYPE(c->qid)], 0, nm, 0660, dp);233 devdir(c, c->qid, sslnames[TYPE(c->qid)], 0, nm, 0660, dp);
238 return 1;234 return 1;
239 }235 }
240 return -1;
241}236}
242 237
243static Chan*238static Chan*
@@ -358,7 +353,7 @@ sslwstat(Chan *c, uchar *db, int n) · 114 unmodified lines
358 353
359 if(!emptystr(dir->uid))354 if(!emptystr(dir->uid))
360 kstrdup(&s->user, dir->uid);355 kstrdup(&s->user, dir->uid);
361 if(dir->mode != ~0)356 if(dir->mode != ~0UL)
362 s->perm = dir->mode;357 s->perm = dir->mode;
363 358
364 free(dir);359 free(dir);
@@ -766,9 +761,8 @@ sslput(Dstate *s, Block * volatile b) · 401 unmodified lines
766 int offset;761 int offset;
767 762
768 if(waserror()){763 if(waserror()){
769iprint("error: %s\n", up->errstr);
770 if(b != nil)764 if(b != nil)
771 free(b);765 freeb(b);
772 nexterror();766 nexterror();
773 }767 }
774 768
@@ -900,7 +894,7 @@ initDESkey_40(OneWay *w) · 125 unmodified lines
900 key[6] &= 0x0f;894 key[6] &= 0x0f;
901 }895 }
902 896
903 w->state = malloc(sizeof(DESstate));897 w->state = smalloc(sizeof(DESstate));
904 if(w->slen >= 16)898 if(w->slen >= 16)
905 setupDESstate(w->state, key, w->secret+8);899 setupDESstate(w->state, key, w->secret+8);
906 else if(w->slen >= 8)900 else if(w->slen >= 8)
@@ -936,7 +930,7 @@ initRC4key_40(OneWay *w) · 29 unmodified lines
936 if(w->slen > 5)930 if(w->slen > 5)
937 w->slen = 5;931 w->slen = 5;
938 932
939 w->state = malloc(sizeof(RC4state));933 w->state = smalloc(sizeof(RC4state));
940 setupRC4state(w->state, w->secret, w->slen);934 setupRC4state(w->state, w->secret, w->slen);
941}935}
942 936
@@ -955,7 +949,7 @@ initRC4key_128(OneWay *w) · 12 unmodified lines
955 if(w->slen > 16)949 if(w->slen > 16)
956 w->slen = 16;950 w->slen = 16;
957 951
958 w->state = malloc(sizeof(RC4state));952 w->state = smalloc(sizeof(RC4state));
959 setupRC4state(w->state, w->secret, w->slen);953 setupRC4state(w->state, w->secret, w->slen);
960}954}
961 955
@@ -1004,6 +998,7 @@ struct Encalg · 42 unmodified lines
1004};998};
1005 999
1006#ifdef NOSPOOKS1000#ifdef NOSPOOKS
1001static
1007Encalg encrypttab[] =1002Encalg encrypttab[] =
1008{1003{
1009 { "descbc", 8, DESCBC, initDESkey, }, /* DEPRECATED -- use des_56_cbc */1004 { "descbc", 8, DESCBC, initDESkey, }, /* DEPRECATED -- use des_56_cbc */
@@ -1019,6 +1014,7 @@ Encalg encrypttab[] = · 9 unmodified lines
1019 { 0 }1014 { 0 }
1020};1015};
1021#else1016#else
1017static
1022Encalg encrypttab[] =1018Encalg encrypttab[] =
1023{1019{
1024 { "des_40_cbc", 8, DESCBC, initDESkey_40, },1020 { "des_40_cbc", 8, DESCBC, initDESkey_40, },
@@ -1048,14 +1044,31 @@ parseencryptalg(char *p, Dstate *s) · 23 unmodified lines
1048 return -1;1044 return -1;
1049}1045}
1050 1046
1047enum {
1048 Cfd,
1049 Calg,
1050 Csin,
1051 Csout,
1052};
1053
1054static
1055Cmdtab sslcmds[] = {
1056 {Cfd, "fd", 2 },
1057 {Calg, "alg", 0 },
1058 {Csin, "secretin", 2 },
1059 {Csout, "secretout", 2 },
1060};
1061
1051static long1062static long
1052sslwrite(Chan *c, void *a, long n, vlong o)1063sslwrite(Chan *c, void *a, long n, vlong o)
1053{1064{
1054 Dstate * volatile s;1065 Dstate * volatile s;
1055 Block * volatile b;1066 Block * volatile b;
1056 int m, t;1067 int m, t, i;
1057 char *p, *np, *e, buf[128];1068 char *p, *e;
1058 uchar *x;1069 uchar *x;
1070 Cmdbuf *cb;
1071 Cmdtab *ct;
1059 1072
1060 USED(o);1073 USED(o);
1061 s = dstate[CONV(c->qid)];1074 s = dstate[CONV(c->qid)];
@@ -1073,9 +1086,8 @@ sslwrite(Chan *c, void *a, long n, vlong o) · 11 unmodified lines
1073 nexterror();1086 nexterror();
1074 }1087 }
1075 qlock(&s->out.q);1088 qlock(&s->out.q);
1089
1076 p = a;1090 p = a;
1077if(0) iprint("write %d %.2ux %.2ux %.2ux %.2ux %.2ux %.2ux %.2ux %.2ux\n",
1078 n, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]);
1079 e = p + n;1091 e = p + n;
1080 do {1092 do {
1081 m = e - p;1093 m = e - p;
@@ -1095,9 +1107,7 @@ if(0) iprint("write %d %.2ux %.2ux %.2ux %.2ux %.2ux %.2ux %.2ux %.2ux\n", · 13 unmodified lines
1095 1107
1096 p += m;1108 p += m;
1097 } while(p < e);1109 } while(p < e);
1098 p = a;1110
1099if(0) iprint("wrote %d %.2ux %.2ux %.2ux %.2ux %.2ux %.2ux %.2ux %.2ux\n",
1100 n, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]);
1101 poperror();1111 poperror();
1102 qunlock(&s->out.q);1112 qunlock(&s->out.q);
1103 return n;1113 return n;
@@ -1125,19 +1135,15 @@ if(0) iprint("wrote %d %.2ux %.2ux %.2ux %.2ux %.2ux %.2ux %.2ux %.2ux\n", · 21 unmodified lines
1125 break;1135 break;
1126 }1136 }
1127 1137
1128 if(n >= sizeof(buf))1138 cb = parsecmd(a, n);
1129 error("arg too long");1139 if(waserror()){
1130 strncpy(buf, a, n);1140 free(cb);
1131 buf[n] = 0;1141 nexterror();
1132 p = strchr(buf, '\n');1142 }
1133 if(p)1143 ct = lookupcmd(cb, sslcmds, nelem(sslcmds));
1134 *p = 0;1144 switch(ct->index){
1135 p = strchr(buf, ' ');1145 case Cfd:
1136 if(p)1146 s->c = buftochan(cb->f[1]);
1137 *p++ = 0;
1138
1139 if(strcmp(buf, "fd") == 0){
1140 s->c = buftochan(p);
1141 1147
1142 /* default is clear (msg delimiters only) */1148 /* default is clear (msg delimiters only) */
1143 s->state = Sclear;1149 s->state = Sclear;
@@ -1146,7 +1152,11 @@ if(0) iprint("wrote %d %.2ux %.2ux %.2ux %.2ux %.2ux %.2ux %.2ux %.2ux\n", · 2 unmodified lines
1146 s->maxpad = s->max = (1<<15) - s->diglen - 1;1152 s->maxpad = s->max = (1<<15) - s->diglen - 1;
1147 s->in.mid = 0;1153 s->in.mid = 0;
1148 s->out.mid = 0;1154 s->out.mid = 0;
1149 } else if(strcmp(buf, "alg") == 0 && p != 0){1155 break;
1156 case Calg:
1157 if(cb->nf < 2)
1158 cmderror(cb, "no algorithms");
1159
1150 s->blocklen = 1;1160 s->blocklen = 1;
1151 s->diglen = 0;1161 s->diglen = 0;
1152 1162
@@ -1155,9 +1165,8 @@ if(0) iprint("wrote %d %.2ux %.2ux %.2ux %.2ux %.2ux %.2ux %.2ux %.2ux\n", · 2 unmodified lines
1155 1165
1156 s->state = Sclear;1166 s->state = Sclear;
1157 s->maxpad = s->max = (1<<15) - s->diglen - 1;1167 s->maxpad = s->max = (1<<15) - s->diglen - 1;
1158 if(strcmp(p, "clear") == 0){1168 if(strcmp(cb->f[1], "clear") == 0)
1159 goto out;1169 break;
1160 }
1161 1170
1162 if(s->in.secret && s->out.secret == 0)1171 if(s->in.secret && s->out.secret == 0)
1163 setsecret(&s->out, s->in.secret, s->in.slen);1172 setsecret(&s->out, s->in.secret, s->in.slen);
@@ -1170,18 +1179,11 @@ if(0) iprint("wrote %d %.2ux %.2ux %.2ux %.2ux %.2ux %.2ux %.2ux %.2ux\n", · 6 unmodified lines
1170 s->encryptalg = Noencryption;1179 s->encryptalg = Noencryption;
1171 s->blocklen = 1;1180 s->blocklen = 1;
1172 1181
1173 for(;;){1182 for(i=1; i<cb->nf; i++){
1174 np = strchr(p, ' ');1183 p = cb->f[i];
1175 if(np)
1176 *np++ = 0;
1177
1178 if(parsehashalg(p, s) < 0)1184 if(parsehashalg(p, s) < 0)
1179 if(parseencryptalg(p, s) < 0)1185 if(parseencryptalg(p, s) < 0)
1180 error("bad algorithm");1186 error("bad algorithm");
1181
1182 if(np == 0)
1183 break;
1184 p = np;
1185 }1187 }
1186 1188
1187 if(s->hf == 0 && s->encryptalg == Noencryption)1189 if(s->hf == 0 && s->encryptalg == Noencryption)
@@ -1194,20 +1196,34 @@ if(0) iprint("wrote %d %.2ux %.2ux %.2ux %.2ux %.2ux %.2ux %.2ux %.2ux\n", · 6 unmodified lines
1194 s->maxpad -= s->maxpad % s->blocklen;1196 s->maxpad -= s->maxpad % s->blocklen;
1195 } else1197 } else
1196 s->maxpad = s->max = (1<<15) - s->diglen - 1;1198 s->maxpad = s->max = (1<<15) - s->diglen - 1;
1197 } else if(strcmp(buf, "secretin") == 0 && p != 0) {1199 break;
1200 case Csin:
1201 p = cb->f[1];
1198 m = (strlen(p)*3)/2;1202 m = (strlen(p)*3)/2;
1199 x = smalloc(m);1203 x = smalloc(m);
1200 t = dec64(x, m, p, strlen(p));1204 t = dec64(x, m, p, strlen(p));
1205 if(t <= 0){
1206 free(x);
1207 error(Ebadarg);
1208 }
1201 setsecret(&s->in, x, t);1209 setsecret(&s->in, x, t);
1202 free(x);1210 free(x);
1203 } else if(strcmp(buf, "secretout") == 0 && p != 0) {1211 break;
1212 case Csout:
1213 p = cb->f[1];
1204 m = (strlen(p)*3)/2 + 1;1214 m = (strlen(p)*3)/2 + 1;
1205 x = smalloc(m);1215 x = smalloc(m);
1206 t = dec64(x, m, p, strlen(p));1216 t = dec64(x, m, p, strlen(p));
1217 if(t <= 0){
1218 free(x);
1219 error(Ebadarg);
1220 }
1207 setsecret(&s->out, x, t);1221 setsecret(&s->out, x, t);
1208 free(x);1222 free(x);
1209 } else1223 break;
1210 error(Ebadarg);1224 }
1225 poperror();
1226 free(cb);
1211 1227
1212out:1228out:
1213 qunlock(&s->in.ctlq);1229 qunlock(&s->in.ctlq);
@@ -1426,7 +1442,7 @@ checkdigestb(Dstate *s, Block *bin) · 212 unmodified lines
1426 *p = n;1442 *p = n;
1427 (*s->hf)(msgid, 4, digest, &ss);1443 (*s->hf)(msgid, 4, digest, &ss);
1428 1444
1429 if(memcmp(digest, bin->rp, s->diglen) != 0)1445 if(tsmemcmp(digest, bin->rp, s->diglen) != 0)
1430 error("bad digest");1446 error("bad digest");
1431}1447}
1432 1448
main.c+1−1
@@ -111,7 +111,7 @@ findkey(char **puser, char *dom) · 110 unmodified lines
111 pass = f[i]+10;111 pass = f[i]+10;
112 if(strncmp(f[i], "dom=", 4) == 0 && strcmp(f[i]+4, dom) == 0)112 if(strncmp(f[i], "dom=", 4) == 0 && strcmp(f[i]+4, dom) == 0)
113 havedom = 1;113 havedom = 1;
114 if(strcmp(f[i], "proto=p9sk1") == 0)114 if(strcmp(f[i], "proto=p9sk1") == 0 || strcmp(f[i], "proto=dp9ik") == 0)
115 haveproto = 1;115 haveproto = 1;
116 }116 }
117 if(!haveproto || !havedom || !pass || !user)117 if(!haveproto || !havedom || !pass || !user)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t