Showing the changes to include (1 of 13 files). Show all
Unified · Split
| @@ -17,25 +17,27 @@ typedef struct AESstate AESstate; · 16 unmodified lines | ||
| 17 | 17 | struct AESstate |
| 18 | 18 | { |
| 19 | 19 | ulong setup; |
| 20 | + ulong offset; | |
| 20 | 21 | int rounds; |
| 21 | 22 | int keybytes; |
| 23 | + void *ekey; /* expanded encryption round key */ | |
| 24 | + void *dkey; /* expanded decryption round key */ | |
| 22 | 25 | uchar key[AESmaxkey]; /* unexpanded key */ |
| 23 | − ulong ekey[4*(AESmaxrounds + 1)]; /* encryption key */ | |
| 24 | − ulong dkey[4*(AESmaxrounds + 1)]; /* decryption key */ | |
| 25 | 26 | uchar ivec[AESbsize]; /* initialization vector */ |
| 26 | − uchar mackey[3 * AESbsize]; /* 3 XCBC mac 96 keys */ | |
| 27 | + uchar storage[512]; /* storage for expanded keys */ | |
| 27 | 28 | }; |
| 28 | 29 | |
| 29 | 30 | /* block ciphers */ |
| 30 | −void aes_encrypt(ulong rk[], int Nr, uchar pt[16], uchar ct[16]); | |
| 31 | −void aes_decrypt(ulong rk[], int Nr, uchar ct[16], uchar pt[16]); | |
| 31 | +extern void (*aes_encrypt)(ulong rk[], int Nr, uchar pt[16], uchar ct[16]); | |
| 32 | +extern void (*aes_decrypt)(ulong rk[], int Nr, uchar ct[16], uchar pt[16]); | |
| 33 | + | |
| 34 | +void setupAESstate(AESstate *s, uchar key[], int nkey, uchar *ivec); | |
| 32 | 35 | |
| 33 | −void setupAESstate(AESstate *s, uchar key[], int keybytes, uchar *ivec); | |
| 34 | 36 | void aesCBCencrypt(uchar *p, int len, AESstate *s); |
| 35 | 37 | void aesCBCdecrypt(uchar *p, int len, AESstate *s); |
| 36 | − | |
| 37 | −void setupAESXCBCstate(AESstate *s); | |
| 38 | −uchar* aesXCBCmac(uchar *p, int len, AESstate *s); | |
| 38 | +void aesCFBencrypt(uchar *p, int len, AESstate *s); | |
| 39 | +void aesCFBdecrypt(uchar *p, int len, AESstate *s); | |
| 40 | +void aesOFBencrypt(uchar *p, int len, AESstate *s); | |
| 39 | 41 | |
| 40 | 42 | typedef struct AESGCMstate AESGCMstate; |
| 41 | 43 | struct AESGCMstate |
| @@ -351,6 +353,7 @@ RSApriv* rsaprivalloc(void); · 309 unmodified lines | ||
| 351 | 353 | void rsaprivfree(RSApriv*); |
| 352 | 354 | RSApub* rsaprivtopub(RSApriv*); |
| 353 | 355 | RSApub* X509toRSApub(uchar*, int, char*, int); |
| 356 | +RSApub* asn1toRSApub(uchar*, int); | |
| 354 | 357 | RSApriv* asn1toRSApriv(uchar*, int); |
| 355 | 358 | void asn1dump(uchar *der, int len); |
| 356 | 359 | uchar* decodePEM(char *s, char *type, int *len, char **new_s); |
| @@ -362,6 +365,13 @@ char* X509rsaverifydigest(uchar *sig, int siglen, uchar *edigest, int edigestle · 5 unmodified lines | ||
| 362 | 365 | |
| 363 | 366 | void X509dump(uchar *cert, int ncert); |
| 364 | 367 | |
| 368 | +mpint* pkcs1padbuf(uchar *buf, int len, mpint *modulus, int blocktype); | |
| 369 | +int pkcs1unpadbuf(uchar *buf, int len, mpint *modulus, int blocktype); | |
| 370 | +int asn1encodeRSApub(RSApub *pk, uchar *buf, int len); | |
| 371 | +int asn1encodedigest(DigestState* (*fun)(uchar*, ulong, uchar*, DigestState*), | |
| 372 | + uchar *digest, uchar *buf, int len); | |
| 373 | + | |
| 374 | + | |
| 365 | 375 | /* |
| 366 | 376 | * elgamal |
| 367 | 377 | */ |
| @@ -486,8 +496,8 @@ uchar *readcert(char *filename, int *pcertlen); · 118 unmodified lines | ||
| 486 | 496 | PEMChain*readcertchain(char *filename); |
| 487 | 497 | |
| 488 | 498 | /* aes_xts.c */ |
| 489 | −int aes_xts_encrypt(ulong tweak[], ulong ecb[], vlong sectorNumber, uchar *input, uchar *output, ulong len) ; | |
| 490 | −int aes_xts_decrypt(ulong tweak[], ulong ecb[], vlong sectorNumber, uchar *input, uchar *output, ulong len); | |
| 499 | +void aes_xts_encrypt(AESstate *tweak, AESstate *ecb, uvlong sectorNumber, uchar *input, uchar *output, ulong len); | |
| 500 | +void aes_xts_decrypt(AESstate *tweak, AESstate *ecb, uvlong sectorNumber, uchar *input, uchar *output, ulong len); | |
| 491 | 501 | |
| 492 | 502 | typedef struct ECpoint{ |
| 493 | 503 | int inf; |