History

libsec: sync with 9front

cinap_lenrek committed 8 years ago

Commit eb4ce561 parent df8c7d813 files · +1318 −1463Browse files

Showing the changes to include (1 of 13 files). Show all

Unified · Split

include/libsec.h+21−11
@@ -17,25 +17,27 @@ typedef struct AESstate AESstate; · 16 unmodified lines
1717 struct AESstate
1818 {
1919 ulong setup;
20+ ulong offset;
2021 int rounds;
2122 int keybytes;
23+ void *ekey; /* expanded encryption round key */
24+ void *dkey; /* expanded decryption round key */
2225 uchar key[AESmaxkey]; /* unexpanded key */
23− ulong ekey[4*(AESmaxrounds + 1)]; /* encryption key */
24− ulong dkey[4*(AESmaxrounds + 1)]; /* decryption key */
2526 uchar ivec[AESbsize]; /* initialization vector */
26− uchar mackey[3 * AESbsize]; /* 3 XCBC mac 96 keys */
27+ uchar storage[512]; /* storage for expanded keys */
2728 };
2829
2930 /* 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);
3235
33−void setupAESstate(AESstate *s, uchar key[], int keybytes, uchar *ivec);
3436 void aesCBCencrypt(uchar *p, int len, AESstate *s);
3537 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);
3941
4042 typedef struct AESGCMstate AESGCMstate;
4143 struct AESGCMstate
@@ -351,6 +353,7 @@ RSApriv* rsaprivalloc(void); · 309 unmodified lines
351353 void rsaprivfree(RSApriv*);
352354 RSApub* rsaprivtopub(RSApriv*);
353355 RSApub* X509toRSApub(uchar*, int, char*, int);
356+RSApub* asn1toRSApub(uchar*, int);
354357 RSApriv* asn1toRSApriv(uchar*, int);
355358 void asn1dump(uchar *der, int len);
356359 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
362365
363366 void X509dump(uchar *cert, int ncert);
364367
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+
365375 /*
366376 * elgamal
367377 */
@@ -486,8 +496,8 @@ uchar *readcert(char *filename, int *pcertlen); · 118 unmodified lines
486496 PEMChain*readcertchain(char *filename);
487497
488498 /* 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);
491501
492502 typedef struct ECpoint{
493503 int inf;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t