strftime(tbuf, sizeof (tbuf), "%Y%m%d", tp);
strftime(tbuf, sizeof (tbuf), "%Y%m%d", tp);
- PPP_DigestInit(ctxt, PPP_sha1());
- PPP_DigestUpdate(ctxt, pn_secret, strlen(pn_secret));
- PPP_DigestUpdate(ctxt, tbuf, strlen(tbuf));
- PPP_DigestFinal(ctxt, dig, &diglen);
+ PPP_DigestInit(ctxt, PPP_sha1());
+ PPP_DigestUpdate(ctxt, pn_secret, strlen(pn_secret));
+ PPP_DigestUpdate(ctxt, tbuf, strlen(tbuf));
+ PPP_DigestFinal(ctxt, key, &keylen);
- unsigned char secbuf[MAXWORDLEN], clear[8], *sp, *dp;
+ unsigned char secbuf[MAXWORDLEN], clear[8], *sp, *dp, key[SHA_DIGEST_LENGTH];
- int id, i, plen, toffs;
+ int id, i, plen, clen, toffs, keylen;
+
+ cctx = PPP_CIPHER_CTX_new();
+ if (!cctx) {
+ dbglog("no DES here; cannot decode "
+ "pseudonym");
+ break;
+ }
+
+ if (!PPP_CipherInit(cctx, PPP_des_ecb(), NULL, NULL, 0)) {
+ dbglog("no DES here; cannot decode "
+ "pseudonym");
+ break;
+ }
+
- if (!DesDecrypt(secbuf, clear)) {
+
+ PPP_CIPHER_CTX_set_cipher_data(cctx, key);
+
+ if (!PPP_CipherUpdate(cctx, clear, &clen, secbuf, 8)) {
esp->es_server.ea_peer[
esp->es_server.ea_peerlen] = '\0';
dbglog("decoded pseudonym to \"%.*q\"",
esp->es_server.ea_peer[
esp->es_server.ea_peerlen] = '\0';
dbglog("decoded pseudonym to \"%.*q\"",
- u_char clear[8], cipher[8], dig[SHA_DIGESTSIZE], *optr, *cp;
- int i, j, diglen;
+ u_char clear[8], cipher[8], dig[SHA_DIGESTSIZE], *optr, *cp, key[SHA_DIGEST_LENGTH];
+ int i, j, diglen, clen, keylen = sizeof(key);
PUTLONG(SRPVAL_EBIT, outp);
ts = (struct t_server *)esp->es_server.ea_session;
assert(ts != NULL);
PUTLONG(SRPVAL_EBIT, outp);
ts = (struct t_server *)esp->es_server.ea_session;
assert(ts != NULL);
- BCOPY(t_serverresponse(ts), outp, SHA_DIGESTSIZE);
- INCPTR(SHA_DIGESTSIZE, outp);
+ BCOPY(t_serverresponse(ts), outp, SHA_DIGEST_LENGTH);
+ INCPTR(SHA_DIGEST_LENGTH, outp);
+ PPP_CipherInit(cctx, PPP_des_ecb(), key, NULL, 1);
+
+ PPP_CipherUpdate(cctx, cipher, &clen, clear, sizeof(clear));
+
BZERO(&b64, sizeof (b64));
outp++; /* space for pseudonym length */
outp += b64enc(&b64, cipher, 8, outp);
while (i >= 8) {
BZERO(&b64, sizeof (b64));
outp++; /* space for pseudonym length */
outp += b64enc(&b64, cipher, 8, outp);
while (i >= 8) {
outp += b64enc(&b64, cipher, 8, outp);
cp += 8;
i -= 8;
outp += b64enc(&b64, cipher, 8, outp);
cp += 8;
i -= 8;
outp += b64enc(&b64, cipher, 8, outp);
}
outp += b64flush(&b64, outp);
outp += b64enc(&b64, cipher, 8, outp);
}
outp += b64flush(&b64, outp);
PUTCHAR(EAP_RESPONSE, outp);
PUTCHAR(id, outp);
esp->es_client.ea_id = id;
PUTCHAR(EAP_RESPONSE, outp);
PUTCHAR(id, outp);
esp->es_client.ea_id = id;
- PUTCHAR(MD5_SIGNATURE_SIZE, outp);
- BCOPY(hash, outp, MD5_SIGNATURE_SIZE);
- INCPTR(MD5_SIGNATURE_SIZE, outp);
+ PUTCHAR(MD5_DIGEST_LENGTH, outp);
+ BCOPY(hash, outp, MD5_DIGEST_LENGTH);
+ INCPTR(MD5_DIGEST_LENGTH, outp);
int dsize, fd, olen = len, diglen = sizeof(dig);
/*
int dsize, fd, olen = len, diglen = sizeof(dig);
/*