lic: clean license issue [1/1]
PD#SWPL-113034
Problem:
license problems
Solution:
fixed license problems
Verify:
Local
Change-Id: I7bc5fd7217fa1a67fbbca7ce758db338ae4d1af5
Signed-off-by: Zhiqiang Han <zhiqiang.han@amlogic.com>
diff --git a/Android.bp b/Android.bp
index 03b2eaa..d5644c5 100644
--- a/Android.bp
+++ b/Android.bp
@@ -13,8 +13,7 @@
name: "vendor_amlogic_libdvr_license",
visibility: [":__subpackages__"],
license_kinds: [
- "SPDX-license-identifier-GPL-2.0",
- "SPDX-license-identifier-LGPL-2.1",
+ "SPDX-license-identifier-Apache-2.0",
],
}
@@ -51,7 +50,6 @@
"src/record_device.c",
"src/segment.c",
"src/am_crypt.c",
- "src/des.c",
"src/dvr_mutex.c",
],
shared_libs: [
@@ -118,7 +116,6 @@
"src/record_device.c",
"src/segment.c",
"src/am_crypt.c",
- "src/des.c",
"src/dvr_mutex.c",
],
shared_libs: [
diff --git a/Android.mk b/Android.mk
index e9b9947..26bad7f 100644
--- a/Android.mk
+++ b/Android.mk
@@ -15,7 +15,7 @@
include $(CLEAR_VARS)
LOCAL_MODULE := libamdvr
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-GPL-2.0+ SPDX-license-identifier-LGPL-2.0+
+LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
LOCAL_LICENSE_CONDITIONS := notice
LOCAL_VENDOR_MODULE := true
LOCAL_MODULE_TAGS := optional
@@ -31,7 +31,7 @@
include $(CLEAR_VARS)
LOCAL_MODULE := libamdvr.product
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-GPL-2.0+ SPDX-license-identifier-LGPL-2.0+
+LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
LOCAL_LICENSE_CONDITIONS := notice
LOCAL_PRODUCT_MODULE := true
LOCAL_MODULE_TAGS := optional
@@ -47,7 +47,7 @@
include $(CLEAR_VARS)
LOCAL_MODULE := libamdvr.system
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-GPL-2.0+ SPDX-license-identifier-LGPL-2.0+
+LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
LOCAL_LICENSE_CONDITIONS := notice
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 30 && echo OK),OK)
LOCAL_SYSTEM_EXT_MODULE := true
diff --git a/Makefile b/Makefile
index ff4a5af..f35bbed 100644
--- a/Makefile
+++ b/Makefile
@@ -17,8 +17,7 @@
src/list_file.c\
src/segment.c\
src/am_crypt.c\
- src/dvr_mutex.c\
- src/des.c
+ src/dvr_mutex.c
LIBAMDVR_OBJS := $(patsubst %.c,%.o,$(LIBAMDVR_SRCS))
AM_FEND_TEST_SRCS := \
diff --git a/include/amci.h b/include/amci.h
index cf7ceab..c4eb4b5 100644
--- a/include/amci.h
+++ b/include/amci.h
@@ -1,7 +1,10 @@
-/* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */
/*
- * Copyright (c) 2019 Amlogic, Inc. All rights reserved.
- */
+* Copyright (c) 2014 Amlogic, Inc. All rights reserved.
+*
+* This source code is subject to the terms and conditions defined in the
+* file 'LICENSE' which is part of this source code package.
+*
+* Description: */
#ifndef _AMCI_H
#define _AMCI_H
@@ -32,4 +35,4 @@
#define AMCI_IOC_SET_POWER _IOW(AMCI_IOC_MAGIC, 0x03, int)
-#endif
\ No newline at end of file
+#endif
diff --git a/include/des.h b/include/des.h
deleted file mode 100644
index 5bba03b..0000000
--- a/include/des.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * DES encryption/decryption
- * Copyright (c) 2007 Reimar Doeffinger
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVUTIL_DES_H
-#define AVUTIL_DES_H
-
-#include <stdint.h>
-
-typedef struct AVDES {
- uint64_t round_keys[3][16];
- int triple_des;
-} AVDES;
-
-/**
- * Allocate an AVDES context.
- */
-AVDES *av_des_alloc(void);
-
-/**
- * @brief Initializes an AVDES context.
- *
- * @param key_bits must be 64 or 192
- * @param decrypt 0 for encryption/CBC-MAC, 1 for decryption
- * @return zero on success, negative value otherwise
- */
-int av_des_init(struct AVDES *d, const uint8_t *key, int key_bits);
-
-/**
- * @brief Encrypts / decrypts using the DES algorithm.
- *
- * @param count number of 8 byte blocks
- * @param dst destination array, can be equal to src, must be 8-byte aligned
- * @param src source array, can be equal to dst, must be 8-byte aligned, may be NULL
- * @param iv initialization vector for CBC mode, if NULL then ECB will be used,
- * must be 8-byte aligned
- * @param decrypt 0 for encryption, 1 for decryption
- */
-void av_des_crypt(struct AVDES *d, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt);
-
-/**
- * @brief Calculates CBC-MAC using the DES algorithm.
- *
- * @param count number of 8 byte blocks
- * @param dst destination array, can be equal to src, must be 8-byte aligned
- * @param src source array, can be equal to dst, must be 8-byte aligned, may be NULL
- */
-void av_des_mac(struct AVDES *d, uint8_t *dst, const uint8_t *src, int count);
-
-/**
- * @}
- */
-
-#endif /* AVUTIL_DES_H */
diff --git a/include/dmx.h b/include/dmx.h
index c443978..4a09625 100644
--- a/include/dmx.h
+++ b/include/dmx.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */
/*
* dmx.h
*
diff --git a/include/frontend.h b/include/frontend.h
index 457133b..3235157 100644
--- a/include/frontend.h
+++ b/include/frontend.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */
/*
* frontend.h
*
diff --git a/src/am_crypt.c b/src/am_crypt.c
index 91d8dcf..eb56e6c 100644
--- a/src/am_crypt.c
+++ b/src/am_crypt.c
@@ -1,67 +1,30 @@
#include <string.h>
#include <stdlib.h>
-#include "des.h"
+#include <inttypes.h>
#include "am_crypt.h"
#define printf(a...) ((void)0)
+/*
+ Place your crypt logic in the TODO sections to complete the process
+*/
+
+
typedef struct {
- AVDES des_cryptor;
+ void *des_cryptor;
uint8_t cache[188];
int cache_len;
} am_cryptor_t;
-static int av_des_crypt_ts_packet(AVDES* d, uint8_t* dst, const uint8_t *src, int decrypt)
-{
- int afc;
- int afc_len = 0;
- int crypt_len = 188;
- const uint8_t *p_in = src;
- uint8_t *p_out = dst;
-
- afc = (p_in[3] >> 4) & 0x3;
- if (afc == 0x0 || afc == 0x2) {
- /* No payload */
- return 0;
- }
-
- p_in += 4;
- p_out += 4;
- crypt_len -= 4;
- if (afc == 0x3) {
- /* Adaption field followed by payload */
- afc_len = p_in[0];
- p_in++;
- p_out++;
- crypt_len--;
- p_in += afc_len;
- p_out += afc_len;
- crypt_len -= afc_len;
- if (crypt_len < 0) {
- printf("%s illegal adaption filed len %d\n", __func__, afc_len);
- return -1;
- }
- }
-
- crypt_len = (crypt_len & 0xfffffff8);
- if (crypt_len < 8) {
- printf("%s payload crypt eln too short!!!\n", __func__);
- return -1;
- }
- av_des_crypt(d, p_out, p_in, crypt_len/8, NULL, decrypt);
-
- return 0;
-}
-
void *am_crypt_des_open(const uint8_t *key, const uint8_t *iv, int key_bits)
{
am_cryptor_t *cryptor = (am_cryptor_t *)malloc(sizeof(am_cryptor_t));
if (cryptor) {
memset(cryptor, 0, sizeof(am_cryptor_t));
- if (av_des_init(&cryptor->des_cryptor, key, key_bits)) {
- free(cryptor);
- return NULL;
+
+ {
+ /*TODO:init your cryptor here*/
}
}
return cryptor;
@@ -116,9 +79,11 @@
/* Process cache data */
memcpy(p_cache + *p_cache_len, p_in, 188 - ((am_cryptor_t *)cryptor)->cache_len);
memcpy(p_out, p_cache, 188);
- av_des_crypt_ts_packet(
- (AVDES *)&(((am_cryptor_t *)cryptor)->des_cryptor),
- p_out, p_cache, decrypt);
+
+ {
+ /*TODO:process your crypt on the pkt*/
+ }
+
left -= (188 - *p_cache_len);
p_in += (188 - *p_cache_len);
p_out += 188;
@@ -136,9 +101,11 @@
break;
}
- av_des_crypt_ts_packet(
- (AVDES *)&(((am_cryptor_t *)cryptor)->des_cryptor),
- p_out, p_in, decrypt);
+ memcpy(p_out, p_in, 188);
+ {
+ /*TODO:process your crypt on the pkt*/
+ }
+
p_in += 188;
p_out += 188;
left -= 188;
diff --git a/src/des.c b/src/des.c
deleted file mode 100644
index b0aac78..0000000
--- a/src/des.c
+++ /dev/null
@@ -1,352 +0,0 @@
-/*
- * DES encryption/decryption
- * Copyright (c) 2007 Reimar Doeffinger
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdint.h>
-
-/*#include "avutil.h"
-#include "common.h"
-#include "mem.h"*/
-#include "des.h"
-
-#ifndef AV_RB64
-#define AV_RB64(x) \
- (((uint64_t)((const uint8_t*)(x))[0] << 56) | \
- ((uint64_t)((const uint8_t*)(x))[1] << 48) | \
- ((uint64_t)((const uint8_t*)(x))[2] << 40) | \
- ((uint64_t)((const uint8_t*)(x))[3] << 32) | \
- ((uint64_t)((const uint8_t*)(x))[4] << 24) | \
- ((uint64_t)((const uint8_t*)(x))[5] << 16) | \
- ((uint64_t)((const uint8_t*)(x))[6] << 8) | \
- (uint64_t)((const uint8_t*)(x))[7])
-#endif
-
-#ifndef AV_WB64
-#define AV_WB64(p, val) do { \
- uint64_t _d = val; \
- ((uint8_t*)(p))[7] = (_d); \
- ((uint8_t*)(p))[6] = (_d)>>8; \
- ((uint8_t*)(p))[5] = (_d)>>16; \
- ((uint8_t*)(p))[4] = (_d)>>24; \
- ((uint8_t*)(p))[3] = (_d)>>32; \
- ((uint8_t*)(p))[2] = (_d)>>40; \
- ((uint8_t*)(p))[1] = (_d)>>48; \
- ((uint8_t*)(p))[0] = (_d)>>56; \
- } while(0)
-#endif
-
-#define T(a, b, c, d, e, f, g, h) 64 - a, 64 - b, 64 - c, 64 - d, 64 - e, 64 - f, 64 - g, 64 - h
-static const uint8_t IP_shuffle[] = {
- T(58, 50, 42, 34, 26, 18, 10, 2),
- T(60, 52, 44, 36, 28, 20, 12, 4),
- T(62, 54, 46, 38, 30, 22, 14, 6),
- T(64, 56, 48, 40, 32, 24, 16, 8),
- T(57, 49, 41, 33, 25, 17, 9, 1),
- T(59, 51, 43, 35, 27, 19, 11, 3),
- T(61, 53, 45, 37, 29, 21, 13, 5),
- T(63, 55, 47, 39, 31, 23, 15, 7)
-};
-#undef T
-
-#if CONFIG_SMALL || defined(GENTABLES)
-#define T(a, b, c, d) 32 - a, 32 - b, 32 - c, 32 - d
-static const uint8_t P_shuffle[] = {
- T(16, 7, 20, 21),
- T(29, 12, 28, 17),
- T( 1, 15, 23, 26),
- T( 5, 18, 31, 10),
- T( 2, 8, 24, 14),
- T(32, 27, 3, 9),
- T(19, 13, 30, 6),
- T(22, 11, 4, 25)
-};
-#undef T
-#endif
-
-#define T(a, b, c, d, e, f, g) 64 - a, 64 - b, 64 - c, 64 - d, 64 - e, 64 - f, 64 - g
-static const uint8_t PC1_shuffle[] = {
- T(57, 49, 41, 33, 25, 17, 9),
- T( 1, 58, 50, 42, 34, 26, 18),
- T(10, 2, 59, 51, 43, 35, 27),
- T(19, 11, 3, 60, 52, 44, 36),
- T(63, 55, 47, 39, 31, 23, 15),
- T( 7, 62, 54, 46, 38, 30, 22),
- T(14, 6, 61, 53, 45, 37, 29),
- T(21, 13, 5, 28, 20, 12, 4)
-};
-#undef T
-
-#define T(a, b, c, d, e, f) 56 - a, 56 - b, 56 - c, 56 - d, 56 - e, 56 - f
-static const uint8_t PC2_shuffle[] = {
- T(14, 17, 11, 24, 1, 5),
- T( 3, 28, 15, 6, 21, 10),
- T(23, 19, 12, 4, 26, 8),
- T(16, 7, 27, 20, 13, 2),
- T(41, 52, 31, 37, 47, 55),
- T(30, 40, 51, 45, 33, 48),
- T(44, 49, 39, 56, 34, 53),
- T(46, 42, 50, 36, 29, 32)
-};
-#undef T
-
-#if CONFIG_SMALL
-static const uint8_t S_boxes[8][32] = {
- { 0x0e, 0xf4, 0x7d, 0x41, 0xe2, 0x2f, 0xdb, 0x18, 0xa3, 0x6a, 0xc6, 0xbc, 0x95, 0x59, 0x30, 0x87,
- 0xf4, 0xc1, 0x8e, 0x28, 0x4d, 0x96, 0x12, 0x7b, 0x5f, 0xbc, 0x39, 0xe7, 0xa3, 0x0a, 0x65, 0xd0, },
- { 0x3f, 0xd1, 0x48, 0x7e, 0xf6, 0x2b, 0x83, 0xe4, 0xc9, 0x07, 0x12, 0xad, 0x6c, 0x90, 0xb5, 0x5a,
- 0xd0, 0x8e, 0xa7, 0x1b, 0x3a, 0xf4, 0x4d, 0x21, 0xb5, 0x68, 0x7c, 0xc6, 0x09, 0x53, 0xe2, 0x9f, },
- { 0xda, 0x70, 0x09, 0x9e, 0x36, 0x43, 0x6f, 0xa5, 0x21, 0x8d, 0x5c, 0xe7, 0xcb, 0xb4, 0xf2, 0x18,
- 0x1d, 0xa6, 0xd4, 0x09, 0x68, 0x9f, 0x83, 0x70, 0x4b, 0xf1, 0xe2, 0x3c, 0xb5, 0x5a, 0x2e, 0xc7, },
- { 0xd7, 0x8d, 0xbe, 0x53, 0x60, 0xf6, 0x09, 0x3a, 0x41, 0x72, 0x28, 0xc5, 0x1b, 0xac, 0xe4, 0x9f,
- 0x3a, 0xf6, 0x09, 0x60, 0xac, 0x1b, 0xd7, 0x8d, 0x9f, 0x41, 0x53, 0xbe, 0xc5, 0x72, 0x28, 0xe4, },
- { 0xe2, 0xbc, 0x24, 0xc1, 0x47, 0x7a, 0xdb, 0x16, 0x58, 0x05, 0xf3, 0xaf, 0x3d, 0x90, 0x8e, 0x69,
- 0xb4, 0x82, 0xc1, 0x7b, 0x1a, 0xed, 0x27, 0xd8, 0x6f, 0xf9, 0x0c, 0x95, 0xa6, 0x43, 0x50, 0x3e, },
- { 0xac, 0xf1, 0x4a, 0x2f, 0x79, 0xc2, 0x96, 0x58, 0x60, 0x1d, 0xd3, 0xe4, 0x0e, 0xb7, 0x35, 0x8b,
- 0x49, 0x3e, 0x2f, 0xc5, 0x92, 0x58, 0xfc, 0xa3, 0xb7, 0xe0, 0x14, 0x7a, 0x61, 0x0d, 0x8b, 0xd6, },
- { 0xd4, 0x0b, 0xb2, 0x7e, 0x4f, 0x90, 0x18, 0xad, 0xe3, 0x3c, 0x59, 0xc7, 0x25, 0xfa, 0x86, 0x61,
- 0x61, 0xb4, 0xdb, 0x8d, 0x1c, 0x43, 0xa7, 0x7e, 0x9a, 0x5f, 0x06, 0xf8, 0xe0, 0x25, 0x39, 0xc2, },
- { 0x1d, 0xf2, 0xd8, 0x84, 0xa6, 0x3f, 0x7b, 0x41, 0xca, 0x59, 0x63, 0xbe, 0x05, 0xe0, 0x9c, 0x27,
- 0x27, 0x1b, 0xe4, 0x71, 0x49, 0xac, 0x8e, 0xd2, 0xf0, 0xc6, 0x9a, 0x0d, 0x3f, 0x53, 0x65, 0xb8,
- }
-};
-#else
-/**
- * This table contains the results of applying both the S-box and P-shuffle.
- * It can be regenerated by compiling tests/des.c with "-DCONFIG_SMALL -DGENTABLES".
- */
-static const uint32_t S_boxes_P_shuffle[8][64] = {
- { 0x00808200, 0x00000000, 0x00008000, 0x00808202, 0x00808002, 0x00008202, 0x00000002, 0x00008000,
- 0x00000200, 0x00808200, 0x00808202, 0x00000200, 0x00800202, 0x00808002, 0x00800000, 0x00000002,
- 0x00000202, 0x00800200, 0x00800200, 0x00008200, 0x00008200, 0x00808000, 0x00808000, 0x00800202,
- 0x00008002, 0x00800002, 0x00800002, 0x00008002, 0x00000000, 0x00000202, 0x00008202, 0x00800000,
- 0x00008000, 0x00808202, 0x00000002, 0x00808000, 0x00808200, 0x00800000, 0x00800000, 0x00000200,
- 0x00808002, 0x00008000, 0x00008200, 0x00800002, 0x00000200, 0x00000002, 0x00800202, 0x00008202,
- 0x00808202, 0x00008002, 0x00808000, 0x00800202, 0x00800002, 0x00000202, 0x00008202, 0x00808200,
- 0x00000202, 0x00800200, 0x00800200, 0x00000000, 0x00008002, 0x00008200, 0x00000000, 0x00808002, },
- { 0x40084010, 0x40004000, 0x00004000, 0x00084010, 0x00080000, 0x00000010, 0x40080010, 0x40004010,
- 0x40000010, 0x40084010, 0x40084000, 0x40000000, 0x40004000, 0x00080000, 0x00000010, 0x40080010,
- 0x00084000, 0x00080010, 0x40004010, 0x00000000, 0x40000000, 0x00004000, 0x00084010, 0x40080000,
- 0x00080010, 0x40000010, 0x00000000, 0x00084000, 0x00004010, 0x40084000, 0x40080000, 0x00004010,
- 0x00000000, 0x00084010, 0x40080010, 0x00080000, 0x40004010, 0x40080000, 0x40084000, 0x00004000,
- 0x40080000, 0x40004000, 0x00000010, 0x40084010, 0x00084010, 0x00000010, 0x00004000, 0x40000000,
- 0x00004010, 0x40084000, 0x00080000, 0x40000010, 0x00080010, 0x40004010, 0x40000010, 0x00080010,
- 0x00084000, 0x00000000, 0x40004000, 0x00004010, 0x40000000, 0x40080010, 0x40084010, 0x00084000, },
- { 0x00000104, 0x04010100, 0x00000000, 0x04010004, 0x04000100, 0x00000000, 0x00010104, 0x04000100,
- 0x00010004, 0x04000004, 0x04000004, 0x00010000, 0x04010104, 0x00010004, 0x04010000, 0x00000104,
- 0x04000000, 0x00000004, 0x04010100, 0x00000100, 0x00010100, 0x04010000, 0x04010004, 0x00010104,
- 0x04000104, 0x00010100, 0x00010000, 0x04000104, 0x00000004, 0x04010104, 0x00000100, 0x04000000,
- 0x04010100, 0x04000000, 0x00010004, 0x00000104, 0x00010000, 0x04010100, 0x04000100, 0x00000000,
- 0x00000100, 0x00010004, 0x04010104, 0x04000100, 0x04000004, 0x00000100, 0x00000000, 0x04010004,
- 0x04000104, 0x00010000, 0x04000000, 0x04010104, 0x00000004, 0x00010104, 0x00010100, 0x04000004,
- 0x04010000, 0x04000104, 0x00000104, 0x04010000, 0x00010104, 0x00000004, 0x04010004, 0x00010100, },
- { 0x80401000, 0x80001040, 0x80001040, 0x00000040, 0x00401040, 0x80400040, 0x80400000, 0x80001000,
- 0x00000000, 0x00401000, 0x00401000, 0x80401040, 0x80000040, 0x00000000, 0x00400040, 0x80400000,
- 0x80000000, 0x00001000, 0x00400000, 0x80401000, 0x00000040, 0x00400000, 0x80001000, 0x00001040,
- 0x80400040, 0x80000000, 0x00001040, 0x00400040, 0x00001000, 0x00401040, 0x80401040, 0x80000040,
- 0x00400040, 0x80400000, 0x00401000, 0x80401040, 0x80000040, 0x00000000, 0x00000000, 0x00401000,
- 0x00001040, 0x00400040, 0x80400040, 0x80000000, 0x80401000, 0x80001040, 0x80001040, 0x00000040,
- 0x80401040, 0x80000040, 0x80000000, 0x00001000, 0x80400000, 0x80001000, 0x00401040, 0x80400040,
- 0x80001000, 0x00001040, 0x00400000, 0x80401000, 0x00000040, 0x00400000, 0x00001000, 0x00401040, },
- { 0x00000080, 0x01040080, 0x01040000, 0x21000080, 0x00040000, 0x00000080, 0x20000000, 0x01040000,
- 0x20040080, 0x00040000, 0x01000080, 0x20040080, 0x21000080, 0x21040000, 0x00040080, 0x20000000,
- 0x01000000, 0x20040000, 0x20040000, 0x00000000, 0x20000080, 0x21040080, 0x21040080, 0x01000080,
- 0x21040000, 0x20000080, 0x00000000, 0x21000000, 0x01040080, 0x01000000, 0x21000000, 0x00040080,
- 0x00040000, 0x21000080, 0x00000080, 0x01000000, 0x20000000, 0x01040000, 0x21000080, 0x20040080,
- 0x01000080, 0x20000000, 0x21040000, 0x01040080, 0x20040080, 0x00000080, 0x01000000, 0x21040000,
- 0x21040080, 0x00040080, 0x21000000, 0x21040080, 0x01040000, 0x00000000, 0x20040000, 0x21000000,
- 0x00040080, 0x01000080, 0x20000080, 0x00040000, 0x00000000, 0x20040000, 0x01040080, 0x20000080, },
- { 0x10000008, 0x10200000, 0x00002000, 0x10202008, 0x10200000, 0x00000008, 0x10202008, 0x00200000,
- 0x10002000, 0x00202008, 0x00200000, 0x10000008, 0x00200008, 0x10002000, 0x10000000, 0x00002008,
- 0x00000000, 0x00200008, 0x10002008, 0x00002000, 0x00202000, 0x10002008, 0x00000008, 0x10200008,
- 0x10200008, 0x00000000, 0x00202008, 0x10202000, 0x00002008, 0x00202000, 0x10202000, 0x10000000,
- 0x10002000, 0x00000008, 0x10200008, 0x00202000, 0x10202008, 0x00200000, 0x00002008, 0x10000008,
- 0x00200000, 0x10002000, 0x10000000, 0x00002008, 0x10000008, 0x10202008, 0x00202000, 0x10200000,
- 0x00202008, 0x10202000, 0x00000000, 0x10200008, 0x00000008, 0x00002000, 0x10200000, 0x00202008,
- 0x00002000, 0x00200008, 0x10002008, 0x00000000, 0x10202000, 0x10000000, 0x00200008, 0x10002008, },
- { 0x00100000, 0x02100001, 0x02000401, 0x00000000, 0x00000400, 0x02000401, 0x00100401, 0x02100400,
- 0x02100401, 0x00100000, 0x00000000, 0x02000001, 0x00000001, 0x02000000, 0x02100001, 0x00000401,
- 0x02000400, 0x00100401, 0x00100001, 0x02000400, 0x02000001, 0x02100000, 0x02100400, 0x00100001,
- 0x02100000, 0x00000400, 0x00000401, 0x02100401, 0x00100400, 0x00000001, 0x02000000, 0x00100400,
- 0x02000000, 0x00100400, 0x00100000, 0x02000401, 0x02000401, 0x02100001, 0x02100001, 0x00000001,
- 0x00100001, 0x02000000, 0x02000400, 0x00100000, 0x02100400, 0x00000401, 0x00100401, 0x02100400,
- 0x00000401, 0x02000001, 0x02100401, 0x02100000, 0x00100400, 0x00000000, 0x00000001, 0x02100401,
- 0x00000000, 0x00100401, 0x02100000, 0x00000400, 0x02000001, 0x02000400, 0x00000400, 0x00100001, },
- { 0x08000820, 0x00000800, 0x00020000, 0x08020820, 0x08000000, 0x08000820, 0x00000020, 0x08000000,
- 0x00020020, 0x08020000, 0x08020820, 0x00020800, 0x08020800, 0x00020820, 0x00000800, 0x00000020,
- 0x08020000, 0x08000020, 0x08000800, 0x00000820, 0x00020800, 0x00020020, 0x08020020, 0x08020800,
- 0x00000820, 0x00000000, 0x00000000, 0x08020020, 0x08000020, 0x08000800, 0x00020820, 0x00020000,
- 0x00020820, 0x00020000, 0x08020800, 0x00000800, 0x00000020, 0x08020020, 0x00000800, 0x00020820,
- 0x08000800, 0x00000020, 0x08000020, 0x08020000, 0x08020020, 0x08000000, 0x00020000, 0x08000820,
- 0x00000000, 0x08020820, 0x00020020, 0x08000020, 0x08020000, 0x08000800, 0x08000820, 0x00000000,
- 0x08020820, 0x00020800, 0x00020800, 0x00000820, 0x00000820, 0x00020020, 0x08000000, 0x08020800, },
-};
-#endif
-
-static uint64_t shuffle(uint64_t in, const uint8_t *shuffle, int shuffle_len)
-{
- int i;
- uint64_t res = 0;
- for (i = 0; i < shuffle_len; i++)
- res += res + ((in >> *shuffle++) & 1);
- return res;
-}
-
-static uint64_t shuffle_inv(uint64_t in, const uint8_t *shuffle, int shuffle_len)
-{
- int i;
- uint64_t res = 0;
- shuffle += shuffle_len - 1;
- for (i = 0; i < shuffle_len; i++) {
- res |= (in & 1) << *shuffle--;
- in >>= 1;
- }
- return res;
-}
-
-static uint32_t f_func(uint32_t r, uint64_t k)
-{
- int i;
- uint32_t out = 0;
- // rotate to get first part of E-shuffle in the lowest 6 bits
- r = (r << 1) | (r >> 31);
- // apply S-boxes, those compress the data again from 8 * 6 to 8 * 4 bits
- for (i = 7; i >= 0; i--) {
- uint8_t tmp = (r ^ k) & 0x3f;
-#if CONFIG_SMALL
- uint8_t v = S_boxes[i][tmp >> 1];
- if (tmp & 1)
- v >>= 4;
- out = (out >> 4) | (v << 28);
-#else
- out |= S_boxes_P_shuffle[i][tmp];
-#endif
- // get next 6 bits of E-shuffle and round key k into the lowest bits
- r = (r >> 4) | (r << 28);
- k >>= 6;
- }
-#if CONFIG_SMALL
- out = shuffle(out, P_shuffle, sizeof(P_shuffle));
-#endif
- return out;
-}
-
-/**
- * @brief rotate the two halves of the expanded 56 bit key each 1 bit left
- *
- * Note: the specification calls this "shift", so I kept it although
- * it is confusing.
- */
-static uint64_t key_shift_left(uint64_t CDn)
-{
- uint64_t carries = (CDn >> 27) & 0x10000001;
- CDn <<= 1;
- CDn &= ~0x10000001;
- CDn |= carries;
- return CDn;
-}
-
-static void gen_roundkeys(uint64_t K[16], uint64_t key)
-{
- int i;
- // discard parity bits from key and shuffle it into C and D parts
- uint64_t CDn = shuffle(key, PC1_shuffle, sizeof(PC1_shuffle));
- // generate round keys
- for (i = 0; i < 16; i++) {
- CDn = key_shift_left(CDn);
- if (i > 1 && i != 8 && i != 15)
- CDn = key_shift_left(CDn);
- K[i] = shuffle(CDn, PC2_shuffle, sizeof(PC2_shuffle));
- }
-}
-
-static uint64_t des_encdec(uint64_t in, uint64_t K[16], int decrypt)
-{
- int i;
- // used to apply round keys in reverse order for decryption
- decrypt = decrypt ? 15 : 0;
- // shuffle irrelevant to security but to ease hardware implementations
- in = shuffle(in, IP_shuffle, sizeof(IP_shuffle));
- for (i = 0; i < 16; i++) {
- uint32_t f_res;
- f_res = f_func(in, K[decrypt ^ i]);
- in = (in << 32) | (in >> 32);
- in ^= f_res;
- }
- in = (in << 32) | (in >> 32);
- // reverse shuffle used to ease hardware implementations
- in = shuffle_inv(in, IP_shuffle, sizeof(IP_shuffle));
- return in;
-}
-
-int av_des_init(AVDES *d, const uint8_t *key, int key_bits) {
- if (key_bits != 64 && key_bits != 192)
- return -1;//AVERROR(EINVAL);
- d->triple_des = key_bits > 64;
- gen_roundkeys(d->round_keys[0], AV_RB64(key));
- if (d->triple_des) {
- gen_roundkeys(d->round_keys[1], AV_RB64(key + 8));
- gen_roundkeys(d->round_keys[2], AV_RB64(key + 16));
- }
- return 0;
-}
-
-static void av_des_crypt_mac(AVDES *d, uint8_t *dst, const uint8_t *src,
- int count, uint8_t *iv, int decrypt, int mac)
-{
- uint64_t iv_val = iv ? AV_RB64(iv) : 0;
- while (count-- > 0) {
- uint64_t dst_val;
- uint64_t src_val = src ? AV_RB64(src) : 0;
- if (decrypt) {
- uint64_t tmp = src_val;
- if (d->triple_des) {
- src_val = des_encdec(src_val, d->round_keys[2], 1);
- src_val = des_encdec(src_val, d->round_keys[1], 0);
- }
- dst_val = des_encdec(src_val, d->round_keys[0], 1) ^ iv_val;
- iv_val = iv ? tmp : 0;
- } else {
- dst_val = des_encdec(src_val ^ iv_val, d->round_keys[0], 0);
- if (d->triple_des) {
- dst_val = des_encdec(dst_val, d->round_keys[1], 1);
- dst_val = des_encdec(dst_val, d->round_keys[2], 0);
- }
- iv_val = iv ? dst_val : 0;
- }
- AV_WB64(dst, dst_val);
- src += 8;
- if (!mac)
- dst += 8;
- }
- if (iv)
- AV_WB64(iv, iv_val);
-}
-
-void av_des_crypt(AVDES *d, uint8_t *dst, const uint8_t *src,
- int count, uint8_t *iv, int decrypt)
-{
- av_des_crypt_mac(d, dst, src, count, iv, decrypt, 0);
-}
-
-void av_des_mac(AVDES *d, uint8_t *dst, const uint8_t *src, int count)
-{
- av_des_crypt_mac(d, dst, src, count, (uint8_t[8]) { 0 }, 0, 1);
-}
-
diff --git a/test/am_ca_test/Android.mk b/test/am_ca_test/Android.mk
index 541439e..b91f242 100644
--- a/test/am_ca_test/Android.mk
+++ b/test/am_ca_test/Android.mk
@@ -6,7 +6,7 @@
LOCAL_SRC_FILES:= am_ca_test.c am_inject.c am_dmx.c linux_dvb.c am_ca.c am_key.c
LOCAL_MODULE:= am_ca_test
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-GPL-2.0+ SPDX-license-identifier-LGPL-2.0+
+LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
LOCAL_LICENSE_CONDITIONS := notice
LOCAL_MODULE_TAGS := optional
diff --git a/test/am_ca_test/am_dmx.h b/test/am_ca_test/am_dmx.h
index 4a4605a..6991a6c 100644
--- a/test/am_ca_test/am_dmx.h
+++ b/test/am_ca_test/am_dmx.h
@@ -1,23 +1,13 @@
-/***************************************************************************
- * Copyright (C) 2017 Amlogic, Inc. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * Description:
- */
+/*
+* Copyright (c) 2014 Amlogic, Inc. All rights reserved.
+*
+* This source code is subject to the terms and conditions defined in the
+* file 'LICENSE' which is part of this source code package.
+*
+* Description: */
/**\file
* \brief Demux module
*
- * Basic data strucutres definition in "linux/dvb/dmx.h"
- *
* \author Gong Ke <ke.gong@amlogic.com>
* \date 2010-05-21: create the document
***************************************************************************/
diff --git a/test/am_ca_test/am_key.h b/test/am_ca_test/am_key.h
index bc127ce..22247b8 100644
--- a/test/am_ca_test/am_key.h
+++ b/test/am_ca_test/am_key.h
@@ -1,3 +1,10 @@
+/*
+* Copyright (c) 2014 Amlogic, Inc. All rights reserved.
+*
+* This source code is subject to the terms and conditions defined in the
+* file 'LICENSE' which is part of this source code package.
+*
+* Description: */
#ifndef AM_KEY_H
#define AM_KEY_H
diff --git a/test/am_ca_test/aml_key.h b/test/am_ca_test/aml_key.h
index 6451739..4588b66 100644
--- a/test/am_ca_test/aml_key.h
+++ b/test/am_ca_test/aml_key.h
@@ -1,19 +1,10 @@
/*
- * include/linux/amlogic/aml_key.h
- *
- * Copyright (C) 2017 Amlogic, Inc. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- */
+* Copyright (c) 2014 Amlogic, Inc. All rights reserved.
+*
+* This source code is subject to the terms and conditions defined in the
+* file 'LICENSE' which is part of this source code package.
+*
+* Description: */
#ifndef _AML_KEY_H_
#define _AML_KEY_H_
diff --git a/test/am_dmx_test/Android.mk b/test/am_dmx_test/Android.mk
index b08a164..583d88d 100644
--- a/test/am_dmx_test/Android.mk
+++ b/test/am_dmx_test/Android.mk
@@ -5,7 +5,7 @@
LOCAL_SRC_FILES:= am_dmx_test.c
LOCAL_MODULE:= aml_dmx_test
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-GPL-2.0+ SPDX-license-identifier-LGPL-2.0+
+LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
LOCAL_LICENSE_CONDITIONS := notice
LOCAL_MODULE_TAGS := optional
diff --git a/test/am_es_test/Android.mk b/test/am_es_test/Android.mk
index 18e5cab..583b3ee 100644
--- a/test/am_es_test/Android.mk
+++ b/test/am_es_test/Android.mk
@@ -12,7 +12,7 @@
LOCAL_SRC_FILES:= am_es_test.c
LOCAL_MODULE:= am_es_test
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-GPL-2.0+ SPDX-license-identifier-LGPL-2.0+
+LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
LOCAL_LICENSE_CONDITIONS := notice
LOCAL_MODULE_TAGS := optional
@@ -41,7 +41,7 @@
LOCAL_SRC_FILES:= am_es_test.c
LOCAL_MODULE:= am_es_test_product
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-GPL-2.0+ SPDX-license-identifier-LGPL-2.0+
+LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
LOCAL_LICENSE_CONDITIONS := notice
LOCAL_MODULE_TAGS := optional
diff --git a/test/am_fend_test/Android.mk b/test/am_fend_test/Android.mk
index d6aff40..c855f6f 100644
--- a/test/am_fend_test/Android.mk
+++ b/test/am_fend_test/Android.mk
@@ -5,7 +5,7 @@
LOCAL_SRC_FILES:= am_fend_test.c
LOCAL_MODULE:= aml_fend_test
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-GPL-2.0+ SPDX-license-identifier-LGPL-2.0+
+LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
LOCAL_LICENSE_CONDITIONS := notice
LOCAL_MODULE_TAGS := optional
diff --git a/test/am_smc_test/amsmc.h b/test/am_smc_test/amsmc.h
index 15dd5ec..cc060e5 100644
--- a/test/am_smc_test/amsmc.h
+++ b/test/am_smc_test/amsmc.h
@@ -1,20 +1,10 @@
/*
- * AMLOGIC Smart card driver.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the named License,
- * or any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
- */
+* Copyright (c) 2014 Amlogic, Inc. All rights reserved.
+*
+* This source code is subject to the terms and conditions defined in the
+* file 'LICENSE' which is part of this source code package.
+*
+* Description: */
#ifndef _AMSMC_H
#define _AMSMC_H
diff --git a/test/dvr_chunk_test/Android.mk b/test/dvr_chunk_test/Android.mk
index 30114ba..1bb34b7 100644
--- a/test/dvr_chunk_test/Android.mk
+++ b/test/dvr_chunk_test/Android.mk
@@ -12,7 +12,7 @@
LOCAL_SRC_FILES:= dvr_chunk_test.c
LOCAL_MODULE:= dvr_chunk_test
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-GPL-2.0+ SPDX-license-identifier-LGPL-2.0+
+LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
LOCAL_LICENSE_CONDITIONS := notice
LOCAL_MODULE_TAGS := optional
diff --git a/test/dvr_play_test/Android.mk b/test/dvr_play_test/Android.mk
index 2789187..9414faa 100644
--- a/test/dvr_play_test/Android.mk
+++ b/test/dvr_play_test/Android.mk
@@ -12,7 +12,7 @@
LOCAL_SRC_FILES:= dvr_play_test.c
LOCAL_MODULE:= dvr_play_test
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-GPL-2.0+ SPDX-license-identifier-LGPL-2.0+
+LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
LOCAL_LICENSE_CONDITIONS := notice
LOCAL_MODULE_TAGS := optional
diff --git a/test/dvr_rec_test/Android.mk b/test/dvr_rec_test/Android.mk
index 81f0fa2..d088cd4 100644
--- a/test/dvr_rec_test/Android.mk
+++ b/test/dvr_rec_test/Android.mk
@@ -12,7 +12,7 @@
LOCAL_SRC_FILES:= dvr_rec_test.c
LOCAL_MODULE:= dvr_rec_test
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-GPL-2.0+ SPDX-license-identifier-LGPL-2.0+
+LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
LOCAL_LICENSE_CONDITIONS := notice
LOCAL_MODULE_TAGS := optional
diff --git a/test/dvr_segment_test/Android.mk b/test/dvr_segment_test/Android.mk
index e9b17c6..7c66efd 100644
--- a/test/dvr_segment_test/Android.mk
+++ b/test/dvr_segment_test/Android.mk
@@ -12,7 +12,7 @@
LOCAL_SRC_FILES:= dvr_segment_test.c
LOCAL_MODULE:= dvr_segment_test
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-GPL-2.0+ SPDX-license-identifier-LGPL-2.0+
+LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
LOCAL_LICENSE_CONDITIONS := notice
LOCAL_MODULE_TAGS := optional