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 | struct AESstate | 17 | struct AESstate |
| 18 | { | 18 | { |
| 19 | ulong setup; | 19 | ulong setup; |
| 20 | ulong offset; | ||
| 20 | int rounds; | 21 | int rounds; |
| 21 | int keybytes; | 22 | int keybytes; |
| 23 | void *ekey; /* expanded encryption round key */ | ||
| 24 | void *dkey; /* expanded decryption round key */ | ||
| 22 | uchar key[AESmaxkey]; /* unexpanded key */ | 25 | uchar key[AESmaxkey]; /* unexpanded key */ |
| 23 | ulong ekey[4*(AESmaxrounds + 1)]; /* encryption key */ | ||
| 24 | ulong dkey[4*(AESmaxrounds + 1)]; /* decryption key */ | ||
| 25 | uchar ivec[AESbsize]; /* initialization vector */ | 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 | /* block ciphers */ | 30 | /* block ciphers */ |
| 30 | void aes_encrypt(ulong rk[], int Nr, uchar pt[16], uchar ct[16]); | 31 | extern 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]); | 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 | void aesCBCencrypt(uchar *p, int len, AESstate *s); | 36 | void aesCBCencrypt(uchar *p, int len, AESstate *s); |
| 35 | void aesCBCdecrypt(uchar *p, int len, AESstate *s); | 37 | void aesCBCdecrypt(uchar *p, int len, AESstate *s); |
| 36 | 38 | void aesCFBencrypt(uchar *p, int len, AESstate *s); | |
| 37 | void setupAESXCBCstate(AESstate *s); | 39 | void aesCFBdecrypt(uchar *p, int len, AESstate *s); |
| 38 | uchar* aesXCBCmac(uchar *p, int len, AESstate *s); | 40 | void aesOFBencrypt(uchar *p, int len, AESstate *s); |
| 39 | 41 | ||
| 40 | typedef struct AESGCMstate AESGCMstate; | 42 | typedef struct AESGCMstate AESGCMstate; |
| 41 | struct AESGCMstate | 43 | struct AESGCMstate |
| @@ -351,6 +353,7 @@ RSApriv* rsaprivalloc(void); · 309 unmodified lines | |||
| 351 | void rsaprivfree(RSApriv*); | 353 | void rsaprivfree(RSApriv*); |
| 352 | RSApub* rsaprivtopub(RSApriv*); | 354 | RSApub* rsaprivtopub(RSApriv*); |
| 353 | RSApub* X509toRSApub(uchar*, int, char*, int); | 355 | RSApub* X509toRSApub(uchar*, int, char*, int); |
| 356 | RSApub* asn1toRSApub(uchar*, int); | ||
| 354 | RSApriv* asn1toRSApriv(uchar*, int); | 357 | RSApriv* asn1toRSApriv(uchar*, int); |
| 355 | void asn1dump(uchar *der, int len); | 358 | void asn1dump(uchar *der, int len); |
| 356 | uchar* decodePEM(char *s, char *type, int *len, char **new_s); | 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 | void X509dump(uchar *cert, int ncert); | 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 | * elgamal | 376 | * elgamal |
| 367 | */ | 377 | */ |
| @@ -486,8 +496,8 @@ uchar *readcert(char *filename, int *pcertlen); · 118 unmodified lines | |||
| 486 | PEMChain*readcertchain(char *filename); | 496 | PEMChain*readcertchain(char *filename); |
| 487 | 497 | ||
| 488 | /* aes_xts.c */ | 498 | /* aes_xts.c */ |
| 489 | int aes_xts_encrypt(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); |
| 490 | int aes_xts_decrypt(ulong tweak[], ulong ecb[], vlong 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 | typedef struct ECpoint{ | 502 | typedef struct ECpoint{ |
| 493 | int inf; | 503 | int inf; |