mirror of
https://git.openafs.org/openafs.git
synced 2025-01-18 15:00:12 +00:00
rxkad: rename ENCRYPT macro to FCRYPT_ENCRYPT
rxkad/fcrypt defines 2 macros: ENCRYPT and DECRYPT. The names are pretty generic and do not clearly associate with fcrypt. In addition, the name ENCRYPT collide with the Microsoft provided header 'ntddndis.h' that uses ENCRYPT as an ENUM (on newer versions of the Windows development kits): typedef enum _OFFLOAD_OPERATION_E { AUTHENTICATE = 1, ENCRYPT } This results in a build error on Windows when fcrypt.h is included with ntddndis.h: ... ntddndis.h(2212): error C2059: syntax error: 'constant' Rename the ENCRYPT/DECRYPT macros to FCRYPT_ENCRYPT/FCRYPT_DECRYPT in fcrypt.h to a name that relates the macros back to fcrypt. Note: The ENCRYPT/DECRYPT symbols are part of a public interface installed in fcrypt.h, but keeping the old names are impractical, so we are changing them anyway. Change-Id: I9c51c81fab7fcbf0dae01569852ca94c0e6a0439 Reviewed-on: https://gerrit.openafs.org/15868 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Michael Meffie <mmeffie@sinenomine.net> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
This commit is contained in:
parent
5b2b27e321
commit
03f9b08e90
@ -519,7 +519,7 @@ ka_Authenticate(char *name, char *instance, char *cell, struct ubik_client * con
|
||||
arequest.SeqLen = sizeof(request);
|
||||
arequest.SeqBody = (char *)&request;
|
||||
DES_pcbc_encrypt(arequest.SeqBody, arequest.SeqBody, arequest.SeqLen,
|
||||
&schedule, ktc_to_cblockptr(key), ENCRYPT);
|
||||
&schedule, ktc_to_cblockptr(key), FCRYPT_ENCRYPT);
|
||||
|
||||
oanswer.MaxSeqLen = sizeof(answer);
|
||||
oanswer.SeqLen = 0;
|
||||
@ -555,7 +555,7 @@ ka_Authenticate(char *name, char *instance, char *cell, struct ubik_client * con
|
||||
return KAUBIKCALL;
|
||||
}
|
||||
DES_pcbc_encrypt(oanswer.SeqBody, oanswer.SeqBody, oanswer.SeqLen,
|
||||
&schedule, ktc_to_cblockptr(key), DECRYPT);
|
||||
&schedule, ktc_to_cblockptr(key), FCRYPT_DECRYPT);
|
||||
|
||||
switch (version) {
|
||||
case 1:
|
||||
@ -640,7 +640,7 @@ ka_GetToken(char *name, char *instance, char *cell, char *cname, char *cinst, st
|
||||
times.start = htonl(start);
|
||||
times.end = htonl(end);
|
||||
DES_ecb_encrypt((DES_cblock *)×, (DES_cblock *)×, &schedule,
|
||||
ENCRYPT);
|
||||
FCRYPT_ENCRYPT);
|
||||
|
||||
atimes.SeqLen = sizeof(times);
|
||||
atimes.SeqBody = (char *)×
|
||||
@ -675,7 +675,7 @@ ka_GetToken(char *name, char *instance, char *cell, char *cname, char *cinst, st
|
||||
|
||||
DES_pcbc_encrypt(oanswer.SeqBody, oanswer.SeqBody, oanswer.SeqLen,
|
||||
&schedule, ktc_to_cblockptr(&auth_token->sessionKey),
|
||||
DECRYPT);
|
||||
FCRYPT_DECRYPT);
|
||||
|
||||
switch (version) {
|
||||
case 1:
|
||||
|
@ -701,7 +701,7 @@ ChangePassWord(struct rx_call *call, char *aname, char *ainstance,
|
||||
es_Report("In KAChangePassword: key_sched returned %d\n", code);
|
||||
DES_pcbc_encrypt(arequest->SeqBody, &request,
|
||||
opr_min(arequest->SeqLen, sizeof(request)), &user_schedule,
|
||||
ktc_to_cblockptr(&tentry.key), DECRYPT);
|
||||
ktc_to_cblockptr(&tentry.key), FCRYPT_DECRYPT);
|
||||
|
||||
/* validate the request */
|
||||
request_time = ntohl(request.time); /* reorder date */
|
||||
@ -735,7 +735,7 @@ ChangePassWord(struct rx_call *call, char *aname, char *ainstance,
|
||||
memcpy(answer, KA_CPW_ANS_LABEL, KA_LABELSIZE);
|
||||
|
||||
DES_pcbc_encrypt(oanswer->SeqBody, oanswer->SeqBody, answer_len,
|
||||
&user_schedule, ktc_to_cblockptr(&tentry.key), ENCRYPT);
|
||||
&user_schedule, ktc_to_cblockptr(&tentry.key), FCRYPT_ENCRYPT);
|
||||
|
||||
code = set_password(tt, aname, ainstance, &request.newpw, kvno, 0);
|
||||
if (code) {
|
||||
@ -1102,7 +1102,7 @@ Authenticate(int version, struct rx_call *call, char *aname, char *ainstance,
|
||||
es_Report("In KAAuthenticate: key_sched returned %d\n", code);
|
||||
DES_pcbc_encrypt(arequest->SeqBody, &request,
|
||||
opr_min(arequest->SeqLen, sizeof(request)), &user_schedule,
|
||||
ktc_to_cblockptr(&tentry.key), DECRYPT);
|
||||
ktc_to_cblockptr(&tentry.key), FCRYPT_DECRYPT);
|
||||
|
||||
request.time = ntohl(request.time); /* reorder date */
|
||||
tgt = !strncmp(request.label, KA_GETTGT_REQ_LABEL, sizeof(request.label));
|
||||
@ -1233,7 +1233,7 @@ Authenticate(int version, struct rx_call *call, char *aname, char *ainstance,
|
||||
goto abort;
|
||||
}
|
||||
DES_pcbc_encrypt(oanswer->SeqBody, oanswer->SeqBody, oanswer->SeqLen,
|
||||
&user_schedule, ktc_to_cblockptr(&tentry.key), ENCRYPT);
|
||||
&user_schedule, ktc_to_cblockptr(&tentry.key), FCRYPT_ENCRYPT);
|
||||
code = ubik_EndTrans(tt);
|
||||
KALOG(aname, ainstance, sname, sinst, NULL,
|
||||
rx_HostOf(rx_PeerOf(rx_ConnectionOf(call))), LOG_AUTHENTICATE);
|
||||
@ -1812,7 +1812,7 @@ GetTicket(int version,
|
||||
goto abort;
|
||||
}
|
||||
|
||||
DES_ecb_encrypt((DES_cblock *)atimes->SeqBody, (DES_cblock *)×, &schedule, DECRYPT);
|
||||
DES_ecb_encrypt((DES_cblock *)atimes->SeqBody, (DES_cblock *)×, &schedule, FCRYPT_DECRYPT);
|
||||
times.start = ntohl(times.start);
|
||||
times.end = ntohl(times.end);
|
||||
code = tkt_CheckTimes(times.start, times.end, now);
|
||||
@ -1923,7 +1923,7 @@ GetTicket(int version,
|
||||
goto abort;
|
||||
}
|
||||
DES_pcbc_encrypt(oanswer->SeqBody, oanswer->SeqBody, oanswer->SeqLen,
|
||||
&schedule, ktc_to_cblockptr(&authSessionKey), ENCRYPT);
|
||||
&schedule, ktc_to_cblockptr(&authSessionKey), FCRYPT_ENCRYPT);
|
||||
code = ubik_EndTrans(tt);
|
||||
KALOG(name, instance, sname, sinstance, (import ? authDomain : NULL),
|
||||
rx_HostOf(rx_PeerOf(rx_ConnectionOf(call))), LOG_GETTICKET);
|
||||
|
@ -145,7 +145,7 @@ ka_KeyCheckSum(char *key, afs_uint32 * cksumP)
|
||||
code = DES_key_sched(charptr_to_cblock(key), &s);
|
||||
if (code)
|
||||
return KABADKEY;
|
||||
DES_ecb_encrypt(&block, &block, &s, ENCRYPT);
|
||||
DES_ecb_encrypt(&block, &block, &s, FCRYPT_ENCRYPT);
|
||||
memcpy(&cksum, &block, sizeof(afs_int32));
|
||||
*cksumP = ntohl(cksum);
|
||||
return 0;
|
||||
|
@ -157,7 +157,7 @@ create_cipher(char *cipher, int *cipherLen,
|
||||
|
||||
if ((code = DES_key_sched(ktc_to_cblock(key), &schedule)))
|
||||
printf("In KAAuthenticate: key_sched returned %d\n", code);
|
||||
DES_pcbc_encrypt(cipher, cipher, len, &schedule, ktc_to_cblockptr(key), ENCRYPT);
|
||||
DES_pcbc_encrypt(cipher, cipher, len, &schedule, ktc_to_cblockptr(key), FCRYPT_ENCRYPT);
|
||||
*cipherLen = round_up_to_ebs(len);
|
||||
|
||||
if (krb_udp_debug) {
|
||||
@ -215,7 +215,7 @@ check_auth(struct packet *pkt, char *auth, int authLen,
|
||||
int byteOrder = pkt->byteOrder;
|
||||
|
||||
DES_key_sched(ktc_to_cblock(key), &schedule);
|
||||
DES_pcbc_encrypt(auth, auth, authLen, &schedule, ktc_to_cblockptr(key), DECRYPT);
|
||||
DES_pcbc_encrypt(auth, auth, authLen, &schedule, ktc_to_cblockptr(key), FCRYPT_DECRYPT);
|
||||
packet = auth;
|
||||
if (strcmp(packet, name) != 0)
|
||||
return KABADTICKET;
|
||||
|
@ -703,11 +703,11 @@ main()
|
||||
* Use key1 and key2 as iv */
|
||||
fc_keysched(key1, sched);
|
||||
memcpy(iv, key2, sizeof(iv));
|
||||
fc_cbc_encrypt(the_quick, ciph, sizeof(the_quick), sched, iv, ENCRYPT);
|
||||
fc_cbc_encrypt(the_quick, ciph, sizeof(the_quick), sched, iv, FCRYPT_ENCRYPT);
|
||||
if (memcmp(ciph1, ciph, sizeof(ciph1)) != 0)
|
||||
fprintf(stderr, "encrypt FAILED\n");
|
||||
memcpy(iv, key2, sizeof(iv));
|
||||
fc_cbc_encrypt(ciph, clear, sizeof(the_quick), sched, iv, DECRYPT);
|
||||
fc_cbc_encrypt(ciph, clear, sizeof(the_quick), sched, iv, FCRYPT_DECRYPT);
|
||||
if (strcmp(the_quick, clear) != 0)
|
||||
fprintf(stderr, "crypt decrypt FAILED\n");
|
||||
|
||||
@ -716,11 +716,11 @@ main()
|
||||
*/
|
||||
fc_keysched(key2, sched);
|
||||
memcpy(iv, key1, sizeof(iv));
|
||||
fc_cbc_encrypt(the_quick, ciph, sizeof(the_quick), sched, iv, ENCRYPT);
|
||||
fc_cbc_encrypt(the_quick, ciph, sizeof(the_quick), sched, iv, FCRYPT_ENCRYPT);
|
||||
if (memcmp(ciph2, ciph, sizeof(ciph2)) != 0)
|
||||
fprintf(stderr, "encrypt FAILED\n");
|
||||
memcpy(iv, key1, sizeof(iv));
|
||||
fc_cbc_encrypt(ciph, clear, sizeof(the_quick), sched, iv, DECRYPT);
|
||||
fc_cbc_encrypt(ciph, clear, sizeof(the_quick), sched, iv, FCRYPT_DECRYPT);
|
||||
if (strcmp(the_quick, clear) != 0)
|
||||
fprintf(stderr, "crypt decrypt FAILED\n");
|
||||
|
||||
@ -757,21 +757,21 @@ main()
|
||||
(stop.tv_sec - start.tv_sec +
|
||||
(stop.tv_usec - start.tv_usec) / 1e6) * 1);
|
||||
|
||||
fc_ecb_encrypt(data, data, sched, ENCRYPT);
|
||||
fc_ecb_encrypt(data, data, sched, FCRYPT_ENCRYPT);
|
||||
gettimeofday(&start, NULL);
|
||||
for (i = 0; i < 1000000; i++)
|
||||
fc_ecb_encrypt(data, data, sched, ENCRYPT);
|
||||
fc_ecb_encrypt(data, data, sched, FCRYPT_ENCRYPT);
|
||||
gettimeofday(&stop, 0);
|
||||
printf("fc_ecb_encrypt = %2.2f us\n",
|
||||
(stop.tv_sec - start.tv_sec +
|
||||
(stop.tv_usec - start.tv_usec) / 1e6) * 1);
|
||||
|
||||
fc_cbc_encrypt(the_quick, ciph, sizeof(the_quick), sched, iv,
|
||||
ENCRYPT);
|
||||
FCRYPT_ENCRYPT);
|
||||
gettimeofday(&start, NULL);
|
||||
for (i = 0; i < 100000; i++)
|
||||
fc_cbc_encrypt(the_quick, ciph, sizeof(the_quick), sched, iv,
|
||||
ENCRYPT);
|
||||
FCRYPT_ENCRYPT);
|
||||
gettimeofday(&stop, NULL);
|
||||
printf("fc_cbc_encrypt = %2.2f us\n",
|
||||
(stop.tv_sec - start.tv_sec +
|
||||
|
@ -59,7 +59,7 @@ rxkad_DecryptPacket(const struct rx_connection *conn,
|
||||
if (!data || !tlen)
|
||||
break;
|
||||
tlen = opr_min(len, tlen);
|
||||
fc_cbc_encrypt(data, data, tlen, *schedule, xor, DECRYPT);
|
||||
fc_cbc_encrypt(data, data, tlen, *schedule, xor, FCRYPT_DECRYPT);
|
||||
len -= tlen;
|
||||
}
|
||||
/* Do this if packet checksums are ever enabled (below), but
|
||||
@ -100,7 +100,7 @@ rxkad_EncryptPacket(const struct rx_connection * conn,
|
||||
if (!data || !tlen)
|
||||
break;
|
||||
tlen = opr_min(len, tlen);
|
||||
fc_cbc_encrypt(data, data, tlen, *schedule, xor, ENCRYPT);
|
||||
fc_cbc_encrypt(data, data, tlen, *schedule, xor, FCRYPT_ENCRYPT);
|
||||
len -= tlen;
|
||||
}
|
||||
return 0;
|
||||
|
@ -121,7 +121,7 @@ fc_ecb_encrypt(void * clear, void * cipher,
|
||||
R = ntohl(*((afs_uint32 *)clear + 1));
|
||||
|
||||
if (encrypt) {
|
||||
INC_RXKAD_STATS(fc_encrypts[ENCRYPT]);
|
||||
INC_RXKAD_STATS(fc_encrypts[FCRYPT_ENCRYPT]);
|
||||
for (i = 0; i < (ROUNDS / 2); i++) {
|
||||
S = *schedule++ ^ R; /* xor R with key bits from schedule */
|
||||
Pchar[Byte2] = sbox0[Schar[Byte0]]; /* do 8-bit S Box subst. */
|
||||
@ -139,7 +139,7 @@ fc_ecb_encrypt(void * clear, void * cipher,
|
||||
R ^= P;
|
||||
}
|
||||
} else {
|
||||
INC_RXKAD_STATS(fc_encrypts[DECRYPT]);
|
||||
INC_RXKAD_STATS(fc_encrypts[FCRYPT_DECRYPT]);
|
||||
schedule = &schedule[ROUNDS - 1]; /* start at end of key schedule */
|
||||
for (i = 0; i < (ROUNDS / 2); i++) {
|
||||
S = *schedule-- ^ L; /* xor R with key bits from schedule */
|
||||
|
@ -29,9 +29,9 @@ typedef afs_int32 fc_InitializationVector[ENCRYPTIONBLOCKSIZE / 4];
|
||||
#define MAXROUNDS 16
|
||||
typedef afs_int32 fc_KeySchedule[MAXROUNDS];
|
||||
|
||||
#ifndef ENCRYPT
|
||||
#define ENCRYPT 1
|
||||
#define DECRYPT 0
|
||||
#ifndef FCRYPT_ENCRYPT
|
||||
# define FCRYPT_ENCRYPT 1
|
||||
# define FCRYPT_DECRYPT 0
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -175,7 +175,7 @@ rxkad_GetResponse(struct rx_securityClass *aobj, struct rx_connection *aconn,
|
||||
r_v2.encrypted.endpoint.cksum = rxkad_CksumChallengeResponse(&r_v2);
|
||||
memcpy((void *)xor, (void *)tcp->ivec, 2 * sizeof(afs_int32));
|
||||
fc_cbc_encrypt(&r_v2.encrypted, &r_v2.encrypted,
|
||||
sizeof(r_v2.encrypted), tcp->keysched, xor, ENCRYPT);
|
||||
sizeof(r_v2.encrypted), tcp->keysched, xor, FCRYPT_ENCRYPT);
|
||||
response = (char *)&r_v2;
|
||||
responseSize = sizeof(r_v2);
|
||||
} else {
|
||||
@ -185,7 +185,7 @@ rxkad_GetResponse(struct rx_securityClass *aobj, struct rx_connection *aconn,
|
||||
r_old.kvno = htonl(tcp->kvno);
|
||||
r_old.ticketLen = htonl(tcp->ticketLen);
|
||||
fc_ecb_encrypt(&r_old.encrypted, &r_old.encrypted, tcp->keysched,
|
||||
ENCRYPT);
|
||||
FCRYPT_ENCRYPT);
|
||||
response = (char *)&r_old;
|
||||
responseSize = sizeof(r_old);
|
||||
}
|
||||
|
@ -235,7 +235,7 @@ rxkad_DeriveXORInfo(struct rx_connection *aconnp, fc_KeySchedule * aschedule,
|
||||
rxkad_SetupEndpoint(aconnp, &tendpoint);
|
||||
memcpy((void *)xor, aivec, 2 * sizeof(afs_int32));
|
||||
fc_cbc_encrypt(&tendpoint, &tendpoint, sizeof(tendpoint), *aschedule, xor,
|
||||
ENCRYPT);
|
||||
FCRYPT_ENCRYPT);
|
||||
memcpy(aresult,
|
||||
((char *)&tendpoint) + sizeof(tendpoint) - ENCRYPTIONBLOCKSIZE,
|
||||
ENCRYPTIONBLOCKSIZE);
|
||||
@ -299,7 +299,7 @@ ComputeSum(struct rx_packet *apacket, fc_KeySchedule * aschedule,
|
||||
word[0] ^= aivec[0];
|
||||
word[1] ^= aivec[1];
|
||||
/* encrypts word as if it were a character string */
|
||||
fc_ecb_encrypt(word, word, *aschedule, ENCRYPT);
|
||||
fc_ecb_encrypt(word, word, *aschedule, FCRYPT_ENCRYPT);
|
||||
t = ntohl(word[1]);
|
||||
t = (t >> 16) & 0xffff;
|
||||
if (t == 0)
|
||||
@ -480,7 +480,7 @@ rxkad_CheckPacket(struct rx_securityClass *aobj, struct rx_call *acall,
|
||||
case rxkad_auth:
|
||||
rx_Pullup(apacket, 8); /* the following encrypts 8 bytes only */
|
||||
fc_ecb_encrypt(rx_DataOf(apacket), rx_DataOf(apacket), *schedule,
|
||||
DECRYPT);
|
||||
FCRYPT_DECRYPT);
|
||||
break;
|
||||
case rxkad_crypt:
|
||||
code = rxkad_DecryptPacket(tconn, schedule, (const fc_InitializationVector *)ivec, len, apacket);
|
||||
@ -575,7 +575,7 @@ rxkad_PreparePacket(struct rx_securityClass *aobj, struct rx_call *acall,
|
||||
}
|
||||
rx_Pullup(apacket, 8); /* the following encrypts 8 bytes only */
|
||||
fc_ecb_encrypt(rx_DataOf(apacket), rx_DataOf(apacket), *schedule,
|
||||
ENCRYPT);
|
||||
FCRYPT_ENCRYPT);
|
||||
break;
|
||||
case rxkad_crypt:
|
||||
nlen = round_up_to_ebs(len + rx_GetSecurityHeaderSize(tconn));
|
||||
|
@ -103,7 +103,7 @@ get_random_int32(void)
|
||||
afs_int32 rc;
|
||||
|
||||
LOCK_RM;
|
||||
fc_ecb_encrypt(&seed, &seed, random_int32_schedule, ENCRYPT);
|
||||
fc_ecb_encrypt(&seed, &seed, random_int32_schedule, FCRYPT_ENCRYPT);
|
||||
rc = seed.tv_sec;
|
||||
UNLOCK_RM;
|
||||
return rc;
|
||||
@ -389,7 +389,7 @@ rxkad_CheckResponse(struct rx_securityClass *aobj,
|
||||
|
||||
memcpy(xor, sconn->ivec, 2 * sizeof(afs_int32));
|
||||
fc_cbc_encrypt(&v2r.encrypted, &v2r.encrypted, sizeof(v2r.encrypted),
|
||||
sconn->keysched, xor, DECRYPT);
|
||||
sconn->keysched, xor, FCRYPT_DECRYPT);
|
||||
cksum = rxkad_CksumChallengeResponse(&v2r);
|
||||
if (cksum != v2r.encrypted.endpoint.cksum)
|
||||
return RXKADSEALEDINCON;
|
||||
@ -410,7 +410,7 @@ rxkad_CheckResponse(struct rx_securityClass *aobj,
|
||||
} else {
|
||||
/* expect old format response */
|
||||
fc_ecb_encrypt(&oldr.encrypted, &oldr.encrypted, sconn->keysched,
|
||||
DECRYPT);
|
||||
FCRYPT_DECRYPT);
|
||||
incChallengeID = ntohl(oldr.encrypted.incChallengeID);
|
||||
level = ntohl(oldr.encrypted.level);
|
||||
}
|
||||
|
@ -39,9 +39,9 @@ struct rxkad_stats {
|
||||
afs_uint32 checkPackets[6];
|
||||
afs_uint32 bytesEncrypted[2]; /* index just by type */
|
||||
afs_uint32 bytesDecrypted[2];
|
||||
afs_uint32 fc_encrypts[2]; /* DECRYPT==0, ENCRYPT==1 */
|
||||
afs_uint32 fc_encrypts[2]; /* FCRYPT_DECRYPT==0, FCRYPT_ENCRYPT==1 */
|
||||
afs_uint32 fc_key_scheds; /* key schedule creations */
|
||||
afs_uint32 des_encrypts[2]; /* DECRYPT==0, ENCRYPT==1 */
|
||||
afs_uint32 des_encrypts[2]; /* FCRYPT_DECRYPT==0, FCRYPT_ENCRYPT==1 */
|
||||
afs_uint32 des_key_scheds; /* key schedule creations */
|
||||
afs_uint32 des_randoms; /* random blocks generated */
|
||||
afs_uint32 clientObjects;
|
||||
|
@ -115,9 +115,9 @@ main(argc, argv)
|
||||
fc_keysched(&key, schedule);
|
||||
print_msg("Starting msg is:", msg, sizeof(msg));
|
||||
memcpy(xor, &key, 2 * sizeof(afs_int32));
|
||||
fc_cbc_encrypt(msg, out, sizeof(msg), schedule, &key, ENCRYPT);
|
||||
fc_cbc_encrypt(msg, out, sizeof(msg), schedule, &key, FCRYPT_ENCRYPT);
|
||||
memcpy(xor, &key, 2 * sizeof(afs_int32));
|
||||
fc_cbc_encrypt(out, dec, sizeof(msg), schedule, &key, DECRYPT);
|
||||
fc_cbc_encrypt(out, dec, sizeof(msg), schedule, &key, FCRYPT_DECRYPT);
|
||||
if (memcmp(msg, dec, sizeof(msg)) != 0)
|
||||
printf("Encryption FAILED!\n");
|
||||
print_msg("Encrypted is:", out, sizeof(out));
|
||||
|
@ -42,8 +42,8 @@
|
||||
#include "private_data.h"
|
||||
|
||||
#define ROUNDS 16
|
||||
#define ENCRYPT 1
|
||||
#define DECRYPT 0
|
||||
#define FCRYPT_ENCRYPT 1
|
||||
#define FCRYPT_DECRYPT 0
|
||||
|
||||
typedef afs_int32 int32;
|
||||
typedef afs_uint32 u_int32;
|
||||
@ -118,13 +118,13 @@ main(void)
|
||||
* Use key1 and key2 as iv */
|
||||
fc_keysched((struct ktc_encryptionKey *)key1, sched);
|
||||
memcpy(iv, key2, sizeof(iv));
|
||||
fc_cbc_encrypt(the_quick, ciph, sizeof(the_quick), sched, iv, ENCRYPT);
|
||||
fc_cbc_encrypt(the_quick, ciph, sizeof(the_quick), sched, iv, FCRYPT_ENCRYPT);
|
||||
if (memcmp(ciph1, ciph, sizeof(ciph1)) != 0) {
|
||||
fprintf(stderr, "encrypt FAILED\n");
|
||||
fail++;
|
||||
}
|
||||
memcpy(iv, key2, sizeof(iv));
|
||||
fc_cbc_encrypt(ciph, clear, sizeof(the_quick), sched, iv, DECRYPT);
|
||||
fc_cbc_encrypt(ciph, clear, sizeof(the_quick), sched, iv, FCRYPT_DECRYPT);
|
||||
if (strcmp(the_quick, clear) != 0) {
|
||||
fprintf(stderr, "crypt decrypt FAILED\n");
|
||||
fail++;
|
||||
@ -135,13 +135,13 @@ main(void)
|
||||
*/
|
||||
fc_keysched((struct ktc_encryptionKey *)key2, sched);
|
||||
memcpy(iv, key1, sizeof(iv));
|
||||
fc_cbc_encrypt(the_quick, ciph, sizeof(the_quick), sched, iv, ENCRYPT);
|
||||
fc_cbc_encrypt(the_quick, ciph, sizeof(the_quick), sched, iv, FCRYPT_ENCRYPT);
|
||||
if (memcmp(ciph2, ciph, sizeof(ciph2)) != 0) {
|
||||
fprintf(stderr, "encrypt FAILED\n");
|
||||
fail++;
|
||||
}
|
||||
memcpy(iv, key1, sizeof(iv));
|
||||
fc_cbc_encrypt(ciph, clear, sizeof(the_quick), sched, iv, DECRYPT);
|
||||
fc_cbc_encrypt(ciph, clear, sizeof(the_quick), sched, iv, FCRYPT_DECRYPT);
|
||||
if (strcmp(the_quick, clear) != 0) {
|
||||
fprintf(stderr, "crypt decrypt FAILED\n");
|
||||
fail++;
|
||||
@ -180,21 +180,21 @@ main(void)
|
||||
(stop.tv_sec - start.tv_sec +
|
||||
(stop.tv_usec - start.tv_usec) / 1e6) * 1);
|
||||
|
||||
fc_ecb_encrypt(data, data, sched, ENCRYPT);
|
||||
fc_ecb_encrypt(data, data, sched, FCRYPT_ENCRYPT);
|
||||
gettimeofday(&start, NULL);
|
||||
for (i = 0; i < 1000000; i++)
|
||||
fc_ecb_encrypt(data, data, sched, ENCRYPT);
|
||||
fc_ecb_encrypt(data, data, sched, FCRYPT_ENCRYPT);
|
||||
gettimeofday(&stop, NULL);
|
||||
printf("fc_ecb_encrypt = %2.2f us\n",
|
||||
(stop.tv_sec - start.tv_sec +
|
||||
(stop.tv_usec - start.tv_usec) / 1e6) * 1);
|
||||
|
||||
fc_cbc_encrypt(the_quick, ciph, sizeof(the_quick), sched, iv,
|
||||
ENCRYPT);
|
||||
FCRYPT_ENCRYPT);
|
||||
gettimeofday(&start, NULL);
|
||||
for (i = 0; i < 100000; i++)
|
||||
fc_cbc_encrypt(the_quick, ciph, sizeof(the_quick), sched, iv,
|
||||
ENCRYPT);
|
||||
FCRYPT_ENCRYPT);
|
||||
gettimeofday(&stop, NULL);
|
||||
printf("fc_cbc_encrypt = %2.2f us\n",
|
||||
(stop.tv_sec - start.tv_sec +
|
||||
|
@ -114,7 +114,7 @@ tkt_DecodeTicket(char *asecret, afs_int32 ticketLen,
|
||||
return RXKADBADKEY;
|
||||
|
||||
ticket = clear_ticket;
|
||||
DES_pcbc_encrypt(asecret, ticket, ticketLen, &schedule.schedule, ktc_to_cblockptr(key), DECRYPT);
|
||||
DES_pcbc_encrypt(asecret, ticket, ticketLen, &schedule.schedule, ktc_to_cblockptr(key), FCRYPT_DECRYPT);
|
||||
|
||||
code =
|
||||
decode_athena_ticket(ticket, ticketLen, name, inst, cell, host,
|
||||
@ -213,7 +213,7 @@ tkt_MakeTicket(char *ticket, int *ticketLen, struct ktc_encryptionKey *key,
|
||||
return RXKADBADKEY;
|
||||
}
|
||||
DES_pcbc_encrypt(ticket, ticket, *ticketLen, &schedule.schedule,
|
||||
ktc_to_cblockptr(key), ENCRYPT);
|
||||
ktc_to_cblockptr(key), FCRYPT_ENCRYPT);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user