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
17struct AESstate17struct 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 */
30void aes_encrypt(ulong rk[], int Nr, uchar pt[16], uchar ct[16]);31extern void (*aes_encrypt)(ulong rk[], int Nr, uchar pt[16], uchar ct[16]);
31void aes_decrypt(ulong rk[], int Nr, uchar ct[16], uchar pt[16]);32extern void (*aes_decrypt)(ulong rk[], int Nr, uchar ct[16], uchar pt[16]);
33
34void setupAESstate(AESstate *s, uchar key[], int nkey, uchar *ivec);
32 35
33void setupAESstate(AESstate *s, uchar key[], int keybytes, uchar *ivec);
34void aesCBCencrypt(uchar *p, int len, AESstate *s);36void aesCBCencrypt(uchar *p, int len, AESstate *s);
35void aesCBCdecrypt(uchar *p, int len, AESstate *s);37void aesCBCdecrypt(uchar *p, int len, AESstate *s);
36 38void aesCFBencrypt(uchar *p, int len, AESstate *s);
37void setupAESXCBCstate(AESstate *s);39void aesCFBdecrypt(uchar *p, int len, AESstate *s);
38uchar* aesXCBCmac(uchar *p, int len, AESstate *s);40void aesOFBencrypt(uchar *p, int len, AESstate *s);
39 41
40typedef struct AESGCMstate AESGCMstate;42typedef struct AESGCMstate AESGCMstate;
41struct AESGCMstate43struct AESGCMstate
@@ -351,6 +353,7 @@ RSApriv* rsaprivalloc(void); · 309 unmodified lines
351void rsaprivfree(RSApriv*);353void rsaprivfree(RSApriv*);
352RSApub* rsaprivtopub(RSApriv*);354RSApub* rsaprivtopub(RSApriv*);
353RSApub* X509toRSApub(uchar*, int, char*, int);355RSApub* X509toRSApub(uchar*, int, char*, int);
356RSApub* asn1toRSApub(uchar*, int);
354RSApriv* asn1toRSApriv(uchar*, int);357RSApriv* asn1toRSApriv(uchar*, int);
355void asn1dump(uchar *der, int len);358void asn1dump(uchar *der, int len);
356uchar* decodePEM(char *s, char *type, int *len, char **new_s);359uchar* 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
363void X509dump(uchar *cert, int ncert);366void X509dump(uchar *cert, int ncert);
364 367
368mpint* pkcs1padbuf(uchar *buf, int len, mpint *modulus, int blocktype);
369int pkcs1unpadbuf(uchar *buf, int len, mpint *modulus, int blocktype);
370int asn1encodeRSApub(RSApub *pk, uchar *buf, int len);
371int asn1encodedigest(DigestState* (*fun)(uchar*, ulong, uchar*, DigestState*),
372 uchar *digest, uchar *buf, int len);
373
374
365/*375/*
366 * elgamal376 * elgamal
367 */377 */
@@ -486,8 +496,8 @@ uchar *readcert(char *filename, int *pcertlen); · 118 unmodified lines
486PEMChain*readcertchain(char *filename);496PEMChain*readcertchain(char *filename);
487 497
488/* aes_xts.c */498/* aes_xts.c */
489int aes_xts_encrypt(ulong tweak[], ulong ecb[], vlong sectorNumber, uchar *input, uchar *output, ulong len) ;499void aes_xts_encrypt(AESstate *tweak, AESstate *ecb, uvlong sectorNumber, uchar *input, uchar *output, ulong len);
490int aes_xts_decrypt(ulong tweak[], ulong ecb[], vlong sectorNumber, uchar *input, uchar *output, ulong len);500void aes_xts_decrypt(AESstate *tweak, AESstate *ecb, uvlong sectorNumber, uchar *input, uchar *output, ulong len);
491 501
492typedef struct ECpoint{502typedef struct ECpoint{
493 int inf;503 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