This commit is contained in:
Zhi Guan
2016-06-06 22:04:44 +02:00
parent 2bf25bd29f
commit 2cb43b7f80
142 changed files with 7768 additions and 1678 deletions

View File

@@ -61,6 +61,8 @@ tests:
lint:
lint -DLINT $(INCLUDES) $(SRC)>fluff
update: depend
depend:
@[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
$(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)

22
crypto/sms4/README.md Normal file
View File

@@ -0,0 +1,22 @@
## SMS4 Sub-Library of GMSSL
Encryption modes:
* ECB: encrypt or decrypt a block, process only one block per call.
* CBC: process variable length input with zero padding, IV works as both input and output.
* CFB: same as CBC
* OFB: same as CBC
Optimization for specific architecture:
* AVX2: support ECB, CTR and CBC-decrypt (todo)
* KNC-NI: support ECB, CTR and CBC-decrypt (todo)
Some future plans:
* more operation modes, GCM, XTS, FFX, OFB ...
* more optimiazations: ARM/NEON, X86 ASM, GPU, ...
* secure implementation: Bit Slicing, Timing attack ...
* formally verified.

View File

@@ -48,10 +48,10 @@ int main(int argc, char **argv)
goto end;
}
printf("sms4 key scheduling passed!\n");
/* test encrypt once */
sms4_encrypt(&key, plaintext, buf);
if (memcmp(buf, ciphertext1, sizeof(ciphertext1)) != 0) {
printf("sms4 encrypt not pass!\n");
goto end;
@@ -70,7 +70,7 @@ int main(int argc, char **argv)
}
printf("sms4 encrypt 1000000 times pass!\n");
printf("sms4 all test vectors pass!\n");
return 0;
end:
printf("some test vector failed\n");