Lines Matching +full:s +full:- +full:mode

1 /*-
94 #define typemask(x) ((x) > 0 ? 1 << ((x)-1) : 0)
147 while (ep->type && ep->type != type) in findencryption()
149 return(ep->type ? ep : 0); in findencryption()
159 while (ep->type && ep->type != type) in finddecryption()
161 return(ep->type ? ep : 0); in finddecryption()
196 while (ep->type) { in encrypt_init()
198 printf(">>>%s: I will support %s\r\n", in encrypt_init()
199 Name, ENCTYPE_NAME(ep->type)); in encrypt_init()
200 i_support_encrypt |= typemask(ep->type); in encrypt_init()
201 i_support_decrypt |= typemask(ep->type); in encrypt_init()
202 if ((i_wont_support_decrypt & typemask(ep->type)) == 0) in encrypt_init()
203 if ((str_send[str_suplen++] = ep->type) == IAC) in encrypt_init()
205 if (ep->init) in encrypt_init()
206 (*ep->init)(Server); in encrypt_init()
219 while (ep->type) { in encrypt_list_types()
220 printf("\t%s (%d)\r\n", ENCTYPE_NAME(ep->type), ep->type); in encrypt_list_types()
226 EncryptEnable(char *type, char *mode) in EncryptEnable() argument
233 if (EncryptType(type, mode)) in EncryptEnable()
234 return(EncryptStart(mode)); in EncryptEnable()
239 EncryptDisable(char *type, char *mode) in EncryptDisable() argument
249 printf("%s: invalid encryption type\n", type); in EncryptDisable()
251 printf("Ambiguous type '%s'\n", type); in EncryptDisable()
253 if ((mode == 0) || (isprefix(mode, "input") ? 1 : 0)) { in EncryptDisable()
254 if (decrypt_mode == ep->type) in EncryptDisable()
256 i_wont_support_decrypt |= typemask(ep->type); in EncryptDisable()
259 if ((mode == 0) || (isprefix(mode, "output"))) { in EncryptDisable()
260 if (encrypt_mode == ep->type) in EncryptDisable()
262 i_wont_support_encrypt |= typemask(ep->type); in EncryptDisable()
266 printf("%s: invalid encryption mode\n", mode); in EncryptDisable()
272 EncryptType(char *type, char *mode) in EncryptType() argument
282 printf("%s: invalid encryption type\n", type); in EncryptType()
284 printf("Ambiguous type '%s'\n", type); in EncryptType()
286 if ((mode == 0) || isprefix(mode, "input")) { in EncryptType()
287 decrypt_mode = ep->type; in EncryptType()
288 i_wont_support_decrypt &= ~typemask(ep->type); in EncryptType()
291 if ((mode == 0) || isprefix(mode, "output")) { in EncryptType()
292 encrypt_mode = ep->type; in EncryptType()
293 i_wont_support_encrypt &= ~typemask(ep->type); in EncryptType()
297 printf("%s: invalid encryption mode\n", mode); in EncryptType()
303 EncryptStart(char *mode) in EncryptStart() argument
306 if (mode) { in EncryptStart()
307 if (isprefix(mode, "input")) in EncryptStart()
309 if (isprefix(mode, "output")) in EncryptStart()
311 if (isprefix(mode, "help") || isprefix(mode, "?")) { in EncryptStart()
315 printf("%s: invalid encryption mode 'encrypt start ?' for help\n", mode); in EncryptStart()
330 printf("No previous decryption mode, decryption not enabled\r\n"); in EncryptStartInput()
341 printf("No previous encryption mode, encryption not enabled\r\n"); in EncryptStartOutput()
346 EncryptStop(char *mode) in EncryptStop() argument
349 if (mode) { in EncryptStop()
350 if (isprefix(mode, "input")) in EncryptStop()
352 if (isprefix(mode, "output")) in EncryptStop()
354 if (isprefix(mode, "help") || isprefix(mode, "?")) { in EncryptStop()
358 printf("%s: invalid encryption mode 'encrypt stop ?' for help\n", mode); in EncryptStop()
383 printf("Autoencrypt for output is %s. Autodecrypt for input is %s.\r\n", in encrypt_display()
387 printf("Currently encrypting output with %s\r\n", in encrypt_display()
393 printf("Currently decrypting input with %s\r\n", in encrypt_display()
402 printf("Autoencrypt for output is %s. Autodecrypt for input is %s.\r\n", in EncryptStatus()
406 printf("Currently encrypting output with %s\r\n", in EncryptStatus()
410 printf("Last encryption mode was %s\r\n", in EncryptStatus()
416 printf("Currently decrypting input with %s\r\n", in EncryptStatus()
420 printf("Last decryption mode was %s\r\n", in EncryptStatus()
440 printsub('>', &str_send[2], str_suplen - 2); in encrypt_send_support()
452 printf("Encryption debugging %s\r\n", in EncryptDebug()
471 printf("Encryption %s verbose\r\n", in EncryptVerbose()
480 printf("Automatic encryption of output is %s\r\n", in EncryptAutoEnc()
489 printf("Automatic decryption of input is %s\r\n", in EncryptAutoDec()
520 while (cnt-- > 0) { in encrypt_support()
523 printf(">>>%s: He is supporting %s (%d)\r\n", in encrypt_support()
537 type = ep->start ? (*ep->start)(DIR_ENCRYPT, Server) : 0; in encrypt_support()
539 printf(">>>%s: (*ep->start)() returned %d\r\n", in encrypt_support()
555 if (--cnt < 0) in encrypt_is()
562 printf(">>>%s: Can't find type %s (%d) for initial negotiation\r\n", in encrypt_is()
569 if (!ep->is) { in encrypt_is()
571 printf(">>>%s: No initial negotiation needed for type %s (%d)\r\n", in encrypt_is()
578 ret = (*ep->is)(data, cnt); in encrypt_is()
580 printf("(*ep->is)(%p, %d) returned %s(%d)\n", data, cnt, in encrypt_is()
599 if (--cnt < 0) in encrypt_reply()
604 printf(">>>%s: Can't find type %s (%d) for initial negotiation\r\n", in encrypt_reply()
611 if (!ep->reply) { in encrypt_reply()
613 printf(">>>%s: No initial negotiation needed for type %s (%d)\r\n", in encrypt_reply()
620 ret = (*ep->reply)(data, cnt); in encrypt_reply()
622 printf("(*ep->reply)(%p, %d) returned %s(%d)\n", in encrypt_reply()
628 printf(">>>%s: encrypt_reply returned %d\n", Name, ret); in encrypt_reply()
650 * decryption scheme. Send a REQUEST-END to in encrypt_start()
653 printf("%s: Warning, Cannot decrypt input stream!!!\r\n", Name); in encrypt_start()
659 decrypt_input = ep->input; in encrypt_start()
661 printf("[ Input is now decrypted with type %s ]\r\n", in encrypt_start()
664 printf(">>>%s: Start to decrypt input with type %s\r\n", in encrypt_start()
667 printf("%s: Warning, Cannot decrypt type %s (%d)!!!\r\n", in encrypt_start()
684 while (ep->type) { in encrypt_session_key()
685 if (ep->session) in encrypt_session_key()
686 (*ep->session)(key, server); in encrypt_session_key()
699 printf(">>>%s: Input is back to clear text\r\n", Name); in encrypt_end()
705 * Called when ENCRYPT REQUEST-END is received.
714 * Called when ENCRYPT REQUEST-START is received. If we receive
736 int dir = kp->dir; in encrypt_keyid()
742 if (!(ep = (*kp->getcrypt)(*kp->modep))) { in encrypt_keyid()
745 kp->keylen = 0; in encrypt_keyid()
750 if (kp->keylen == 0) in encrypt_keyid()
752 kp->keylen = 0; in encrypt_keyid()
753 if (ep->keyid) in encrypt_keyid()
754 (void)(*ep->keyid)(dir, kp->keyid, &kp->keylen); in encrypt_keyid()
756 } else if ((len != kp->keylen) || (memcmp(keyid,kp->keyid,len) != 0)) { in encrypt_keyid()
760 kp->keylen = len; in encrypt_keyid()
761 memcpy(kp->keyid,keyid, len); in encrypt_keyid()
762 if (ep->keyid) in encrypt_keyid()
763 (void)(*ep->keyid)(dir, kp->keyid, &kp->keylen); in encrypt_keyid()
765 if (ep->keyid) in encrypt_keyid()
766 ret = (*ep->keyid)(dir, kp->keyid, &kp->keylen); in encrypt_keyid()
768 encrypt_start_output(*kp->modep); in encrypt_keyid()
772 encrypt_send_keyid(dir, kp->keyid, kp->keylen, 0); in encrypt_keyid()
794 memcpy(kp->keyid,keyid, keylen); in encrypt_send_keyid()
795 kp->keylen = keylen; in encrypt_send_keyid()
798 for (strp = &str_keyid[4]; keylen > 0; --keylen) { in encrypt_send_keyid()
804 telnet_net_write(str_keyid, strp - str_keyid); in encrypt_send_keyid()
805 printsub('>', &str_keyid[2], strp - str_keyid - 2); in encrypt_send_keyid()
835 printf(">>>%s: Can't encrypt with type %s (%d)\r\n", in encrypt_start_output()
843 if (ep->start) { in encrypt_start_output()
844 i = (*ep->start)(DIR_ENCRYPT, Server); in encrypt_start_output()
846 printf(">>>%s: Encrypt start: %s (%d) %s\r\n", in encrypt_start_output()
863 telnet_net_write(str_start, p - str_start); in encrypt_start_output()
865 printsub('>', &str_start[2], p - &str_start[2]); in encrypt_start_output()
867 * If we are already encrypting in some mode, then in encrypt_start_output()
869 * the old mode, mark it all as "clear text" and then in encrypt_start_output()
870 * switch to the new mode. in encrypt_start_output()
872 encrypt_output = ep->output; in encrypt_start_output()
875 printf(">>>%s: Started to encrypt output with type %s\r\n", in encrypt_start_output()
878 printf("[ Output is now encrypted with type %s ]\r\n", in encrypt_start_output()
891 printsub('>', &str_end[2], sizeof(str_end) - 2); in encrypt_send_end()
898 printf(">>>%s: Output is back to clear text\r\n", Name); in encrypt_send_end()
917 telnet_net_write(str_start, p - str_start); in encrypt_send_request_start()
918 printsub('>', &str_start[2], p - &str_start[2]); in encrypt_send_request_start()
920 printf(">>>%s: Request input to be encrypted\r\n", Name); in encrypt_send_request_start()
928 printsub('>', &str_end[2], sizeof(str_end) - 2); in encrypt_send_request_end()
931 printf(">>>%s: Request input to be clear text\r\n", Name); in encrypt_send_request_end()
938 printf(">>>%s: in encrypt_wait\r\n", Name); in encrypt_wait()
966 encrypt_debug(int mode) in encrypt_debug() argument
968 encrypt_debug_mode = mode; in encrypt_debug()
976 cnt -= 2; in encrypt_gen_printsub()
978 buf[buflen-1] = '\0'; in encrypt_gen_printsub()
979 buf[buflen-2] = '*'; in encrypt_gen_printsub()
980 buflen -= 2;; in encrypt_gen_printsub()
981 for (; cnt > 0; cnt--, data++) { in encrypt_gen_printsub()
983 for (cp = tbuf; *cp && buflen > 0; --buflen) in encrypt_gen_printsub()
998 for (ep = encryptions; ep->type && ep->type != type; ep++) in encrypt_printsub()
1001 if (ep->printsub) in encrypt_printsub()
1002 (*ep->printsub)(data, cnt, buf, buflen); in encrypt_printsub()