mppe.c (3285bb3c97fb88cd6e19ff479ac6f37d471c8bac) | mppe.c (057f1760a8171825b260dad27502f74ed5f69faf) |
---|---|
1/*- 2 * Copyright (c) 2000 Semen Ustimenko <semenu@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 84 unchanged lines hidden (view full) --- 93#define MPPE_HEADER_FLAGSHIFT 8 94#define MPPE_HEADER_STATEFUL_KEYCHANGES 16 95 96struct mppe_state { 97 unsigned stateless : 1; 98 unsigned flushnext : 1; 99 unsigned flushrequired : 1; 100 int cohnum; | 1/*- 2 * Copyright (c) 2000 Semen Ustimenko <semenu@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 84 unchanged lines hidden (view full) --- 93#define MPPE_HEADER_FLAGSHIFT 8 94#define MPPE_HEADER_STATEFUL_KEYCHANGES 16 95 96struct mppe_state { 97 unsigned stateless : 1; 98 unsigned flushnext : 1; 99 unsigned flushrequired : 1; 100 int cohnum; |
101 int keylen; /* 8 or 16 bytes */ | 101 unsigned keylen; /* 8 or 16 bytes */ |
102 int keybits; /* 40, 56 or 128 bits */ 103 char sesskey[MPPE_KEY_LEN]; 104 char mastkey[MPPE_KEY_LEN]; 105 RC4_KEY rc4key; 106}; 107 108int MPPE_MasterKeyValid = 0; 109int MPPE_IsServer = 0; --- 40 unchanged lines hidden (view full) --- 150 GetNewKeyFromSHA(mp->mastkey, mp->sesskey, mp->keylen, InterimKey); 151 RC4_set_key(&RC4Key, mp->keylen, InterimKey); 152 RC4(&RC4Key, mp->keylen, InterimKey, mp->sesskey); 153 154 MPPEReduceSessionKey(mp); 155} 156 157static struct mbuf * | 102 int keybits; /* 40, 56 or 128 bits */ 103 char sesskey[MPPE_KEY_LEN]; 104 char mastkey[MPPE_KEY_LEN]; 105 RC4_KEY rc4key; 106}; 107 108int MPPE_MasterKeyValid = 0; 109int MPPE_IsServer = 0; --- 40 unchanged lines hidden (view full) --- 150 GetNewKeyFromSHA(mp->mastkey, mp->sesskey, mp->keylen, InterimKey); 151 RC4_set_key(&RC4Key, mp->keylen, InterimKey); 152 RC4(&RC4Key, mp->keylen, InterimKey, mp->sesskey); 153 154 MPPEReduceSessionKey(mp); 155} 156 157static struct mbuf * |
158MPPEOutput(void *v, struct ccp *ccp, struct link *l, int pri, u_short *proto, 159 struct mbuf *mp) | 158MPPEOutput(void *v, struct ccp *ccp, struct link *l __unused, int pri __unused, 159 u_short *proto, struct mbuf *mp) |
160{ 161 struct mppe_state *mop = (struct mppe_state *)v; 162 struct mbuf *mo; 163 u_short nproto, prefix; 164 int dictinit, ilen, len; 165 char *rp; 166 167 ilen = m_length(mp); --- 59 unchanged lines hidden (view full) --- 227 228 log_Printf(LogDEBUG, "MPPE: Output: Encrypted: Proto %02x (%d bytes)\n", 229 *proto, len); 230 231 return mo; 232} 233 234static void | 160{ 161 struct mppe_state *mop = (struct mppe_state *)v; 162 struct mbuf *mo; 163 u_short nproto, prefix; 164 int dictinit, ilen, len; 165 char *rp; 166 167 ilen = m_length(mp); --- 59 unchanged lines hidden (view full) --- 227 228 log_Printf(LogDEBUG, "MPPE: Output: Encrypted: Proto %02x (%d bytes)\n", 229 *proto, len); 230 231 return mo; 232} 233 234static void |
235MPPEResetInput(void *v) | 235MPPEResetInput(void *v __unused) |
236{ 237 log_Printf(LogCCP, "MPPE: Unexpected input channel ack\n"); 238} 239 240static struct mbuf * 241MPPEInput(void *v, struct ccp *ccp, u_short *proto, struct mbuf *mp) 242{ 243 struct mppe_state *mip = (struct mppe_state *)v; --- 123 unchanged lines hidden (view full) --- 367 log_DumpBp(LogDEBUG, "MPPEInput: Decrypted: Packet:", mp); 368 369 ccp->uncompin += len; 370 371 return mp; 372} 373 374static void | 236{ 237 log_Printf(LogCCP, "MPPE: Unexpected input channel ack\n"); 238} 239 240static struct mbuf * 241MPPEInput(void *v, struct ccp *ccp, u_short *proto, struct mbuf *mp) 242{ 243 struct mppe_state *mip = (struct mppe_state *)v; --- 123 unchanged lines hidden (view full) --- 367 log_DumpBp(LogDEBUG, "MPPEInput: Decrypted: Packet:", mp); 368 369 ccp->uncompin += len; 370 371 return mp; 372} 373 374static void |
375MPPEDictSetup(void *v, struct ccp *ccp, u_short proto, struct mbuf *mi) | 375MPPEDictSetup(void *v __unused, struct ccp *ccp __unused, 376 u_short proto __unused, struct mbuf *mp __unused) |
376{ | 377{ |
378 /* Nothing to see here */ |
|
377} 378 379static const char * 380MPPEDispOpts(struct fsm_opt *o) 381{ 382 static char buf[70]; 383 u_int32_t val; 384 char ch; --- 430 unchanged lines hidden --- | 379} 380 381static const char * 382MPPEDispOpts(struct fsm_opt *o) 383{ 384 static char buf[70]; 385 u_int32_t val; 386 char ch; --- 430 unchanged lines hidden --- |