summaryrefslogtreecommitdiff
path: root/libavutil/camellia.c
diff options
context:
space:
mode:
authorDerek Buitenhuis <derek.buitenhuis@gmail.com>2016-05-11 19:10:10 +0100
committerDerek Buitenhuis <derek.buitenhuis@gmail.com>2016-05-11 19:13:03 +0100
commit96d616052b3d39678e477fa10610ca688f46fff9 (patch)
tree8bd31d06318bc786ea8f1d84f92090c9c860bc11 /libavutil/camellia.c
parent27506aceda8115f82f89691a4441d62a8cf24a6e (diff)
parentd12b5b2f135aade4099f4b26b0fe678656158c13 (diff)
Merge commit 'd12b5b2f135aade4099f4b26b0fe678656158c13'
* commit 'd12b5b2f135aade4099f4b26b0fe678656158c13': build: Split test programs off into separate files Some conversions done by: James Almer <jamrial@gmail.com> Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Diffstat (limited to 'libavutil/camellia.c')
-rw-r--r--libavutil/camellia.c58
1 files changed, 0 insertions, 58 deletions
diff --git a/libavutil/camellia.c b/libavutil/camellia.c
index f21ca12604..f33ee9babc 100644
--- a/libavutil/camellia.c
+++ b/libavutil/camellia.c
@@ -410,61 +410,3 @@ void av_camellia_crypt(AVCAMELLIA *cs, uint8_t *dst, const uint8_t *src, int cou
dst = dst + 16;
}
}
-
-#ifdef TEST
-#include<stdio.h>
-#include<stdlib.h>
-#include"log.h"
-
-int main(int argc, char *argv[])
-{
- const uint8_t Key[3][32] = {
- {0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10},
- {0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77},
- {0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}
- };
- const uint8_t rct[3][16] = {
- {0x67, 0x67, 0x31, 0x38, 0x54, 0x96, 0x69, 0x73, 0x08, 0x57, 0x06, 0x56, 0x48, 0xea, 0xbe, 0x43},
- {0xb4, 0x99, 0x34, 0x01, 0xb3, 0xe9,0x96, 0xf8, 0x4e, 0xe5, 0xce, 0xe7, 0xd7, 0x9b, 0x09, 0xb9},
- {0x9a, 0xcc, 0x23, 0x7d, 0xff, 0x16, 0xd7, 0x6c, 0x20, 0xef, 0x7c, 0x91, 0x9e, 0x3a, 0x75, 0x09}
- };
- const uint8_t rpt[32] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10, 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10};
- const int kbits[3] = {128, 192, 256};
- int i, j, err = 0;
- uint8_t temp[32], iv[16];
- AVCAMELLIA *cs;
- cs = av_camellia_alloc();
- if (!cs)
- return 1;
- for (j = 0; j < 3; j++) {
- av_camellia_init(cs, Key[j], kbits[j]);
- av_camellia_crypt(cs, temp, rpt, 1, NULL, 0);
- for (i = 0; i < 16; i++) {
- if (rct[j][i] != temp[i]) {
- av_log(NULL, AV_LOG_ERROR, "%d %02x %02x\n", i, rct[j][i], temp[i]);
- err = 1;
- }
- }
- av_camellia_crypt(cs, temp, rct[j], 1, NULL, 1);
- for (i = 0; i < 16; i++) {
- if (rpt[i] != temp[i]) {
- av_log(NULL, AV_LOG_ERROR, "%d %02x %02x\n", i, rpt[i], temp[i]);
- err = 1;
- }
- }
- }
- av_camellia_init(cs, Key[0], 128);
- memcpy(iv, "HALLO123HALLO123", 16);
- av_camellia_crypt(cs, temp, rpt, 2, iv, 0);
- memcpy(iv, "HALLO123HALLO123", 16);
- av_camellia_crypt(cs, temp, temp, 2, iv, 1);
- for (i = 0; i < 32; i++) {
- if (rpt[i] != temp[i]) {
- av_log(NULL, AV_LOG_ERROR, "%d %02x %02x\n", i, rpt[i], temp[i]);
- err = 1;
- }
- }
- av_free(cs);
- return err;
-}
-#endif