密码库LibTomCrypt学习记录——(2.16)分组密码算法的工作模式——GCM代码示例

本文详细解析了基于LibTomCrypt库的GCM(Galois/Counter Mode)测试代码,包括函数gcm_memory2、gcm_mult_h2和gcm_add_aad2的定义与使用。通过具体的测试案例,展示了不同密钥长度下GCM加密过程中的初始化向量(IV)、明文(PT)、附加认证数据(AAD)、密文(CT)和认证标签(TAG)的构造与验证。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

以下代码根据LibTomCrypt的对应测试代码,做相应的调整和注释。

include <Windows.h>
#include "tomcrypt.h"

int gcm_memory2(      int           cipher,
                const unsigned char *key,    unsigned long keylen,
                const unsigned char *IV,     unsigned long IVlen,
                const unsigned char *adata,  unsigned long adatalen,
                unsigned char *pt,     unsigned long ptlen,
                unsigned char *ct, 
                unsigned char *tag,    unsigned long *taglen,
                               int direction);
void gcm_mult_h2(gcm_state *gcm, unsigned char *I);
int gcm_add_aad2(gcm_state *gcm,
               const unsigned char *adata,  unsigned long adatalen);
#if 1

int gcm_test(void)
{
#ifndef LTC_TEST
    return CRYPT_NOP;
#else
    static const struct {
        char *p_name;
        unsigned char K[32];
        int           keylen;
        unsigned char P[128];
        unsigned long ptlen;
        unsigned char A[128];
        unsigned long alen;
        unsigned char IV[128];
        unsigned long IVlen;
        unsigned char C[128];
        unsigned char T[16];
    } gcm_tests[] = {
// 
//         /* 测试AMI中发现的一个问题 */
//         {
//             /*p_name*/
//             "test AMI error vector ", 
// 
//                 /* key */
//             {    0xda, 0x48, 0x3a, 0x02, 0x76, 0x94, 0x02, 0x17, 0xc8, 0x10, 0x7c, 0x8c, 0xbd, 0x39, 0x0f, 0x44 },
//             16,
// 
//             /* PT */
//             {    0x5a, 0xc6, 0x35, 0xd8, 0xaa, 0x3a, 0x93, 0xe7, 0xb3, 0xeb, 0xbd, 0x55, 0x76, 0x98, 0x86, 0xbc,
//                 0x65, 0x1d, 0x06, 0xb0, 0xcc, 0x53, 0xb0, 0xf6, 0x3b, 0xce, 0x3c, 0x3e, 0x27, 0xd2, 0x60, 0x4b, 
//                 0xec, 0xfd, 0xcd, 0x77, 0xcc, 0x86, 0x13, 0xef, 0xbf, 0xf1, 0xfc, 0x5e, 0x99, 0x4b, 0x19, 0xa4, 
//                 0x43, 0x52, 0xd0, 0x83, 0x2c, 0x84, 0x04, 0x1b, 0xa4, 0x5e, 0x76, 0x1f, 0xe5, 0x8a, 0x02, 0xc8, 
//                 0xb0, 0xbd, 0xed, 0x71, 0xe4, 0x64, 0xfe, 0x55, 0x77, 0x4d, 0xb1, 0x0a, 0x03, 0x71, 0x25, 0x31, 
//                 0x3d, 0xf1, 0x43, 0xe7, 0x27, 0x6e, 0x7e, 0x5a, 0x54, 0x37, 0x6f, 0x88, 0x2b, 0x5a, 0xf0, 0xea},
//             96,
// 
//             /* ADATA */
//             {    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
//             16,   
// 
//             /* IV */
//             {    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
//             16,
// 
//             /* CT */
//             {    0xaa, 0x1c, 0x3c, 0x13, 0x05, 0x08, 0xbc, 0x5a, 0xc5, 0x42, 0x6a, 0x93, 0x8e, 0x27, 0x28, 0xbc,
//                 0xaa, 0x67, 0x2f, 0x1f, 0xcb, 0x62, 0xd7, 0x16, 0xe3, 0x0e, 0x9d, 0x6d, 0xc2, 0xe4, 0x4e, 0xff,
//                 0x97, 0x6d, 0x19, 0x35, 0x30, 0x21, 0x56, 0xf6, 0xa1, 0x4c, 0xe5, 0x00, 0xbc, 0x16, 0x84, 0x05,
//                 0x11, 0xbc, 0x48, 0x9e, 0xf0, 0x65, 0x7c, 0x9e, 0x6f, 0x04, 0x8d, 0x56, 0xdb, 0x48, 0xbd, 0x13,
//                 0xc5, 0x71, 0xf7, 0xd2, 0x1e, 0x69, 0xbd, 0xe2, 0x08, 0xd5, 0x0d, 0xe4, 0xa0, 0xd2, 0x67, 0xfa,
//                 0x97, 0x33, 0xef, 0x7f, 0xc7, 0xcb, 0x2d, 0x00, 0xbc, 0xb1, 0x2e, 0x57, 0x0c, 0x89, 0x31, 0x80},
// 
//             /* TAG */
//             {    0x96, 0x2e, 0x99, 0xed, 0x6a, 0xf7, 0x34, 0x84, 0xa9, 0x22, 0x87, 0xe3, 0x0f, 0xf1, 0x66, 0xe4 }
//         },
        /* test case #46 from BG (catches the LTC bug of v1.15) */
        {
            /*p_name*/
            "test case #46 from v1.15 ", 

            /* key */
            { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
                16,
                
                /* PT */
            { 0xa2, 0xaa, 0xb3, 0xad, 0x8b, 0x17, 0xac, 0xdd, 
            0xa2, 0x88, 0x42, 0x6c, 0xd7, 0xc4, 0x29, 0xb7, 
            0xca, 0x86, 0xb7, 0xac, 0xa0, 0x58, 0x09, 0xc7, 
            0x0c, 0xe8, 0x2d, 0xb2, 0x57, 0x11, 0xcb, 0x53,
            0x02, 0xeb, 0x27, 0x43, 0xb0, 0x36, 0xf3, 0xd7, 
            0x50, 0xd6, 0xcf, 0x0d, 0xc0, 0xac, 0xb9, 0x29, 
            0x50, 0xd5, 0x46, 0xdb, 0x30, 0x8f, 0x93, 0xb4, 
            0xff, 0x24, 0x4a, 0xfa, 0x9d, 0xc7, 0x2b, 0xcd,
            0x75, 0x8d, 0x2c },
            67,
            
            /* ADATA */
            { 0x68, 0x8e, 0x1a, 0xa9, 0x84, 0xde, 0x92, 0x6d, 
            0xc7, 0xb4, 0xc4, 0x7f, 0x44 },
            13,   
            
            /* IV */
            { 0xb7, 0x21, 0x38, 0xb5, 0xa0, 0x5f, 0xf5, 0x07, 
            0x0e, 0x8c, 0xd9, 0x41, 0x83, 0xf7, 0x61, 0xd8 },
            16,
            
            /* CT */
            { 0xcb, 0xc8, 0xd2, 0xf1, 0x54, 0x81, 0xa4, 0xcc, 
            0x7d, 0xd1, 0xe1, 0x9a, 0xaa, 0x83, 0xde, 0x56, 
            0x78, 0x48, 0x3e, 0xc3, 0x59, 0xae, 0x7d, 0xec, 
            0x2a, 0xb8, 0xd5, 0x34, 0xe0, 0x90, 0x6f, 0x4b,
            0x46, 0x63, 0xfa, 0xff, 0x58, 0xa8, 0xb2, 0xd7, 
            0x33, 0xb8, 0x45, 0xee, 0xf7, 0xc9, 0xb3, 0x31, 
            0xe9, 0xe1, 0x0e, 0xb2, 0x61, 0x2c, 0x99, 0x5f, 
            0xeb, 0x1a, 0xc1, 0x5a, 0x62, 0x86, 0xcc, 0xe8,
            0xb2, 0x97, 0xa8 },
            
            /* TAG */
            { 0x8d, 0x2d, 0x2a, 0x93, 0x72, 0x62, 0x6f, 0x6b, 
            0xee, 0x85, 0x80, 0x27, 0x6a, 0x63, 0x66, 0xbf }
        },

//////////////////////////////////////////////////////////////////////////
//     第1组:test case #1  - #6  128 bit key    
//     第2组:test case #7  - #12 192 bit key
//     第3组:test case #13 - #18 256 bit key    
//    这三组除key长度不一样外,其余参数均相同

//////////////////////////////////////////////////////////////////////////
//     第1组:test case #1  - #6  128 bit key    

        /* test case #1 */
        {
            /*p_name*/
            "test case #01 128 bit key", 

            /* key */
            { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
            16,
                
                /* plaintext */
            { 0 },
            0,
            
            /* AAD data */
            { 0 },
            0,
            
            /* IV */
            { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00 },
            12,
            
            /* ciphertext  */
            { 0 },
            
            /* tag */
            { 0x58, 0xe2, 0xfc, 0xce, 0xfa, 0x7e, 0x30, 0x61,
            0x36, 0x7f, 0x1d, 0x57, 0xa4, 0xe7, 0x45, 0x5a }
        },
            
            /* test case #2 */
        {
            /*p_name*/
            "test case #02 128 bit key", 

            /* key */
            { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
            16,
                
                /* PT */
            { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
            16,
            
            /* ADATA */
            { 0 },
            0,
            
            /* IV */
            { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00 },
            12,
            
            /* CT */
            { 0x03, 0x88, 0xda, 0xce, 0x60, 0xb6, 0xa3, 0x92,
            0xf3, 0x28, 0xc2, 0xb9, 0x71, 0xb2, 0xfe, 0x78 },
            
            /* TAG */
            { 0xab, 0x6e, 0x47, 0xd4, 0x2c, 0xec, 0x13, 0xbd,
            0xf5, 0x3a, 0x67, 0xb2, 0x12, 0x57, 0xbd, 0xdf }
        },
            
            /* test case #3 */
        {
            /*p_name*/
            "test case #03 128 bit key", 
                
            /* key */
            { 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, 
            0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08, },
            16,
                
            /* PT */
            { 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5, 
            0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a, 
            0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda, 
            0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72, 
            0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53, 
            0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25, 
            0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57, 
            0xba, 0x63, 0x7b, 0x39, 0x1a, 0xaf, 0xd2, 0x55, },
            64,
            
            /* ADATA */
            { 0 },
            0,
            
            /* IV */
            { 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad, 
            0xde, 0xca, 0xf8, 0x88,  },
            12,
            
            /* CT */
            { 0x42, 0x83, 0x1e, 0xc2, 0x21, 0x77, 0x74, 0x24, 
            0x4b, 0x72, 0x21, 0xb7, 0x84, 0xd0, 0xd4, 0x9c, 
            0xe3, 0xaa, 0x21, 0x2f, 0x2c, 0x02, 0xa4, 0xe0, 
            0x35, 0xc1, 0x7e, 0x23, 0x29, 0xac, 0xa1, 0x2e, 
            0x21, 0xd5, 0x14, 0xb2, 0x54, 0x66, 0x93, 0x1c, 
            0x7d, 0x8f, 0x6a, 0x5a, 0xac, 0x84, 0xaa, 0x05, 
            0x1b, 0xa3, 0x0b, 0x39, 0x6a, 0x0a, 0xac, 0x97, 
            0x3d, 0x58, 0xe0, 0x91, 0x47, 0x3f, 0x59, 0x85, },
            
            /* TAG */
            { 0x4d, 0x5c, 0x2a, 0xf3, 0x27, 0xcd, 0x64, 0xa6, 
            0x2c, 0xf3, 0x5a, 0xbd, 0x2b, 0xa6, 0xfa, 0xb4, }
        },
            
        /* test case #4 */
        {
            /*p_name*/
            "test case #04 128 bit key", 
                
            /* key */
            { 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, 
            0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08, },
            16,
                
            /* PT */
            { 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5, 
            0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a, 
            0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda, 
            0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72, 
            0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53, 
            0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25, 
            0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57, 
            0xba, 0x63, 0x7b, 0x39,  },
            60,
            
            /* ADATA */
            { 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 
            0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 
            0xab, 0xad, 0xda, 0xd2,  },
            20,
            
            /* IV */
            { 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad, 
            0xde, 0xca, 0xf8, 0x88,  },
            12,
            
            /* CT */
            { 0x42, 0x83, 0x1e, 0xc2, 0x21, 0x77, 0x74, 0x24, 
            0x4b, 0x72, 0x21, 0xb7, 0x84, 0xd0, 0xd4, 0x9c, 
            0xe3, 0xaa, 0x21, 0x2f, 0x2c, 0x02, 0xa4, 0xe0, 
            0x35, 0xc1, 0x7e, 0x23, 0x29, 0xac, 0xa1, 0x2e, 
            0x21, 0xd5, 0x14, 0xb2, 0x54, 0x66, 0x93, 0x1c, 
            0x7d, 0x8f, 0x6a, 0x5a, 0xac, 0x84, 0xaa, 0x05, 
            0x1b, 0xa3, 0x0b, 0x39, 0x6a, 0x0a, 0xac, 0x97, 
            0x3d, 0x58, 0xe0, 0x91,  },
            
            /* TAG */
            { 0x5b, 0xc9, 0x4f, 0xbc, 0x32, 0x21, 0xa5, 0xdb, 
            0x94, 0xfa, 0xe9, 0x5a, 0xe7, 0x12, 0x1a, 0x47, }    
        },
            
        /* test case #5 */
        {
            /*p_name*/
            "test case #05 128 bit key", 
                
            /* key */
            { 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, 
            0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08, },
            16,
                
            /* PT */
            { 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5, 
            0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a, 
            0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda, 
            0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72, 
            0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53, 
            0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25, 
            0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57, 
            0xba, 0x63, 0x7b, 0x39,  },
            60,
            
            /* ADATA */
            { 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 
            0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 
            0xab, 0xad, 0xda, 0xd2,  },
            20,
            
            /* IV */
            { 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad, },
            8,
            
            /* CT */
            { 0x61, 0x35, 0x3b, 0x4c, 0x28, 0x06, 0x93, 0x4a, 
            0x77, 0x7f, 0xf5, 0x1f, 0xa2, 0x2a, 0x47, 0x55, 
            0x69, 0x9b, 0x2a, 0x71, 0x4f, 0xcd, 0xc6, 0xf8, 
            0x37, 0x66, 0xe5, 0xf9, 0x7b, 0x6c, 0x74, 0x23, 
            0x73, 0x80, 0x69, 0x00, 0xe4, 0x9f, 0x24, 0xb2, 
            0x2b, 0x09, 0x75, 0x44, 0xd4, 0x89, 0x6b, 0x42, 
            0x49, 0x89, 0xb5, 0xe1, 0xeb, 0xac, 0x0f, 0x07, 
            0xc2, 0x3f, 0x45, 0x98,  },
            
            /* TAG */
            { 0x36, 0x12, 0xd2, 0xe7, 0x9e, 0x3b, 0x07, 0x85, 
            0x56, 0x1b, 0xe1, 0x4a, 0xac, 0xa2, 0xfc, 0xcb, }
        },
        
        /* test case #6 */
        {
            /*p_name*/
            "test case #06 128 bit key", 
                
            /* key */
            { 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, 
            0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08, },
            16,
                
            /* PT */
            { 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5, 
            0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a, 
            0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda, 
            0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72, 
            0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53, 
            0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25, 
            0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57, 
            0xba, 0x63, 0x7b, 0x39,  },
            60,
            
            /* ADATA */
            { 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 
            0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 
            0xab, 0xad, 0xda, 0xd2,  },
            20,
            
            /* IV */
            { 0x93, 0x13, 0x22, 0x5d, 0xf8, 0x84, 0x06, 0xe5, 
            0x55, 0x90, 0x9c, 0x5a, 0xff, 0x52, 0x69, 0xaa, 
            0x6a, 0x7a, 0x95, 0x38, 0x53, 0x4f, 0x7d, 0xa1, 
            0xe4, 0xc3, 0x03, 0xd2, 0xa3, 0x18, 0xa7, 0x28, 
            0xc3, 0xc0, 0xc9, 0x51, 0x56, 0x80, 0x95, 0x39, 
            0xfc, 0xf0, 0xe2, 0x42, 0x9a, 0x6b, 0x52, 0x54, 
            0x16, 0xae, 0xdb, 0xf5, 0xa0, 0xde, 0x6a, 0x57, 
            0xa6, 0x37, 0xb3, 0x9b,  },
            60,
            
            /* CT */
            {0x8c, 0xe2, 0x49, 0x98, 0x62, 0x56, 0x15, 0xb6, 
            0x03, 0xa0, 0x33, 0xac, 0xa1, 0x3f, 0xb8, 0x94, 
            0xbe, 0x91, 0x12, 0xa5, 0xc3, 0xa2, 0x11, 0xa8, 
            0xba, 0x26, 0x2a, 0x3c, 0xca, 0x7e, 0x2c, 0xa7, 
            0x01, 0xe4, 0xa9, 0xa4, 0xfb, 0xa4, 0x3c, 0x90, 
            0xcc, 0xdc, 0xb2, 0x81, 0xd4, 0x8c, 0x7c, 0x6f, 
            0xd6, 0x28, 0x75, 0xd2, 0xac, 0xa4, 0x17, 0x03, 
            0x4c, 0x34, 0xae, 0xe5,  },
            
            /* TAG */
            { 0x61, 0x9c, 0xc5, 0xae, 0xff, 0xfe, 0x0b, 0xfa, 
            0x46, 0x2a, 0xf4, 0x3c, 0x16, 0x99, 0xd0, 0x50, }
        },
            
//////////////////////////////////////////////////////////////////////////
//    第2组     test case #7 - #12    192 bit key        

        /* test case #7 */
        {
            /*p_name*/
            "test case #07 192 bit key", 
                
            /* key */
            { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
            0x00, 0x00, 0x00, 0x00,  },
            24,
                
                /* plaintext */
            { 0 },
            0,
            
            /* AAD data */
            { 0 },
            0,
            
            /* IV */
            { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00 },
            12,
            
            /* ciphertext  */
            { 0 },
            
            /* tag */
            {0xcd, 0x33, 0xb2, 0x8a, 0xc7, 0x73, 0xf7, 0x4b,
            0xa0, 0x0e, 0xd1, 0xf3, 0x12, 0x57, 0x24, 0x35}
        },
            
        /* test case #8 */
        {
            /*p_name*/
            "test case #08 192 bit key", 
                
            /* key */
            { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
            0x00, 0x00, 0x00, 0x00,  },
            24,
                
                /* PT */
            { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
            16,
            
            /* ADATA */
            { 0 },
            0,
            
            /* IV */
            { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00 },
            12,
            
            /* CT */
            { 0x98, 0xe7, 0x24, 0x7c, 0x07, 0xf0, 0xfe, 0x41, 
            0x1c, 0x26, 0x7e, 0x43, 0x84, 0xb0, 0xf6, 0x00 },

            /* TAG */
            { 0x2f, 0xf5, 0x8d, 0x80, 0x03, 0x39, 0x27, 0xab, 
            0x8e, 0xf4, 0xd4, 0x58, 0x75, 0x14, 0xf0, 0xfb}
        },
            
        /* test case #9 */
        {
            /*p_name*/
            "test case #09 192 bit key", 
                
            /* key */
            { 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, 
             0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08,
             0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, },
            24,
                
            /* PT */
            { 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5, 
            0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a, 
            0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda, 
            0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72, 
            0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53, 
            0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25, 
            0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57, 
            0xba, 0x63, 0x7b, 0x39, 0x1a, 0xaf, 0xd2, 0x55, },
            64,
            
            /* ADATA */
            { 0 },
            0,
            
            /* IV */
            { 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad, 
            0xde, 0xca, 0xf8, 0x88,  },
            12,
    
            /* CT */
            {0x39, 0x80, 0xca, 0x0b, 0x3c, 0x00, 0xe8, 0x41, 
            0xeb, 0x06, 0xfa, 0xc4, 0x87, 0x2a, 0x27, 0x57,
            0x85, 0x9e, 0x1c, 0xea, 0xa6, 0xef, 0xd9, 0x84, 
            0x62, 0x85, 0x93, 0xb4, 0x0c, 0xa1, 0xe1, 0x9c,
            0x7d, 0x77, 0x3d, 0x00, 0xc1, 0x44, 0xc5, 0x25, 
            0xac, 0x61, 0x9d, 0x18, 0xc8, 0x4a, 0x3f, 0x47,
            0x18, 0xe2, 0x44, 0x8b, 0x2f, 0xe3, 0x24, 0xd9, 
            0xcc, 0xda, 0x27, 0x10, 0xac, 0xad, 0xe2, 0x56,},
            
            /* TAG */
            { 0x99, 0x24, 0xa7, 0xc8, 0x58, 0x73, 0x36, 0xbf,
            0xb1, 0x18, 0x02, 0x4d, 0xb8, 0x67, 0x4a, 0x14}
        },
            
        /* test case #10 */
        {
            /*p_name*/
            "test case #10 192 bit key", 
                
            /* key */
            { 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, 
            0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08, 
             0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, },
            24,
                
            /* PT */
            { 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5, 
            0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a, 
            0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda, 
            0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72, 
            0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53, 
            0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25, 
            0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57, 
            0xba, 0x63, 0x7b, 0x39,  },
            60,
            
            /* ADATA */
            { 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 
            0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 
            0xab, 0xad, 0xda, 0xd2,  },
            20,
            
            /* IV */
            { 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad, 
            0xde, 0xca, 0xf8, 0x88,  },
            12, 
            
            /* CT */
            {0x39, 0x80, 0xca, 0x0b, 0x3c, 0x00, 0xe8, 0x41, 
            0xeb, 0x06, 0xfa, 0xc4, 0x87, 0x2a, 0x27, 0x57,
            0x85, 0x9e, 0x1c, 0xea, 0xa6, 0xef, 0xd9, 0x84, 
            0x62, 0x85, 0x93, 0xb4, 0x0c, 0xa1, 0xe1, 0x9c,
            0x7d, 0x77, 0x3d, 0x00, 0xc1, 0x44, 0xc5, 0x25,
            0xac, 0x61, 0x9d, 0x18, 0xc8, 0x4a, 0x3f, 0x47,
            0x18, 0xe2, 0x44, 0x8b, 0x2f, 0xe3, 0x24, 0xd9, 
            0xcc, 0xda, 0x27, 0x10 },
            
            /* TAG */
            { 0x25, 0x19, 0x49, 0x8e, 0x80, 0xf1, 0x47, 0x8f, 
            0x37, 0xba, 0x55, 0xbd, 0x6d, 0x27, 0x61, 0x8c}    
        },
            
        /* test case #11 */
        {
            /*p_name*/
            "test case #11 192 bit key", 
                
            /* key */
            { 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, 
            0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08,
            0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, },
            24,
                
            /* PT */
            { 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5, 
            0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a, 
            0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda, 
            0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72, 
            0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53, 
            0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25, 
            0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57, 
            0xba, 0x63, 0x7b, 0x39,  },
            60,
            
            /* ADATA */
            { 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 
            0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 
            0xab, 0xad, 0xda, 0xd2,  },
            20,
            
            /* IV */
            { 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad, },
            8,

            /* CT */
            {0x0f, 0x10, 0xf5, 0x99, 0xae, 0x14, 0xa1, 0x54, 
            0xed, 0x24, 0xb3, 0x6e, 0x25, 0x32, 0x4d, 0xb8,
            0xc5, 0x66, 0x63, 0x2e, 0xf2, 0xbb, 0xb3, 0x4f, 
            0x83, 0x47, 0x28, 0x0f, 0xc4, 0x50, 0x70, 0x57,
            0xfd, 0xdc, 0x29, 0xdf, 0x9a, 0x47, 0x1f, 0x75, 
            0xc6, 0x65, 0x41, 0xd4, 0xd4, 0xda, 0xd1, 0xc9,
            0xe9, 0x3a, 0x19, 0xa5, 0x8e, 0x8b, 0x47, 0x3f, 
            0xa0, 0xf0, 0x62, 0xf7,},
            
            /* TAG */
            {0x65, 0xdc, 0xc5, 0x7f, 0xcf, 0x62, 0x3a, 0x24,
            0x09, 0x4f, 0xcc, 0xa4, 0x0d, 0x35, 0x33, 0xf8,  }
        },
        
        /* test case #12 */
        {
            /*p_name*/
            "test case #12 192 bit key", 
                
            /* key */
            { 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, 
            0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08,
            0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, },
            24,
                
            /* PT */
            { 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5, 
            0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a, 
            0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda, 
            0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72, 
            0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53, 
            0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25, 
            0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57, 
            0xba, 0x63, 0x7b, 0x39,  },
            60,
            
            /* ADATA */
            { 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 
            0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 
            0xab, 0xad, 0xda, 0xd2,  },
            20,
            
            /* IV */
            { 0x93, 0x13, 0x22, 0x5d, 0xf8, 0x84, 0x06, 0xe5, 
            0x55, 0x90, 0x9c, 0x5a, 0xff, 0x52, 0x69, 0xaa, 
            0x6a, 0x7a, 0x95, 0x38, 0x53, 0x4f, 0x7d, 0xa1, 
            0xe4, 0xc3, 0x03, 0xd2, 0xa3, 0x18, 0xa7, 0x28, 
            0xc3, 0xc0, 0xc9, 0x51, 0x56, 0x80, 0x95, 0x39, 
            0xfc, 0xf0, 0xe2, 0x42, 0x9a, 0x6b, 0x52, 0x54, 
            0x16, 0xae, 0xdb, 0xf5, 0xa0, 0xde, 0x6a, 0x57, 
            0xa6, 0x37, 0xb3, 0x9b,  },
            60,
            
            /* CT */
            {0xd2, 0x7e, 0x88, 0x68, 0x1c, 0xe3, 0x24, 0x3c,
            0x48, 0x30, 0x16, 0x5a, 0x8f, 0xdc, 0xf9, 0xff,
            0x1d, 0xe9, 0xa1, 0xd8, 0xe6, 0xb4, 0x47, 0xef,
            0x6e, 0xf7, 0xb7, 0x98, 0x28, 0x66, 0x6e, 0x45,
            0x81, 0xe7, 0x90, 0x12, 0xaf, 0x34, 0xdd, 0xd9,
            0xe2, 0xf0, 0x37, 0x58, 0x9b, 0x29, 0x2d, 0xb3,
            0xe6, 0x7c, 0x03, 0x67, 0x45, 0xfa, 0x22, 0xe7,
            0xe9, 0xb7, 0x37, 0x3b,  },
            
            /* TAG */
            {0xdc, 0xf5, 0x66, 0xff, 0x29, 0x1c, 0x25, 0xbb,
            0xb8, 0x56, 0x8f, 0xc3, 0xd3, 0x76, 0xa6, 0xd9  }
        },

//////////////////////////////////////////////////////////////////////////
//     第3组:test case #13  - #18  256 bit key    

        /* test case #13 */
        {
            /*p_name*/
            "test case #13 256 bit key", 
                
            /* key */
            { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
            32,
                
                /* plaintext */
            { 0 },
            0,
            
            /* AAD data */
            { 0 },
            0,
            
            /* IV */
            { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00 },
            12,
            
            /* ciphertext  */
            { 0 },
            
            /* tag */
            { 0x53, 0x0f, 0x8a, 0xfb, 0xc7, 0x45, 0x36, 0xb9,
            0xa9, 0x63, 0xb4, 0xf1, 0xc4, 0xcb, 0x73, 0x8b }
        },
            
            /* test case #14 */
        {
            /*p_name*/
            "test case #14 256 bit key", 
                
            /* key */
            { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
            32,
                
                /* PT */
            { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
            16,
            
            /* ADATA */
            { 0 },
            0,
            
            /* IV */
            { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00 },
            12,
            
            /* CT */
            {0xce, 0xa7, 0x40, 0x3d, 0x4d, 0x60, 0x6b, 0x6e,
            0x07, 0x4e, 0xc5, 0xd3, 0xba, 0xf3, 0x9d, 0x18, },
            
            /* TAG */
            {0xd0, 0xd1, 0xc8, 0xa7, 0x99, 0x99, 0x6b, 0xf0,
            0x26, 0x5b, 0x98, 0xb5, 0xd4, 0x8a, 0xb9, 0x19 }
        },
            
            /* test case #15 */
        {
            /*p_name*/
            "test case #15 256 bit key", 
                
            /* key */
            { 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, 
            0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08, 
            0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, 
            0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08,},
            32,
                
            /* PT */
            { 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5, 
            0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a, 
            0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda, 
            0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72, 
            0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53, 
            0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25, 
            0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57, 
            0xba, 0x63, 0x7b, 0x39, 0x1a, 0xaf, 0xd2, 0x55, },
            64,
            
            /* ADATA */
            { 0 },
            0,
            
            /* IV */
            { 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad, 
            0xde, 0xca, 0xf8, 0x88,  },
            12,
            
            /* CT */
            {0x52, 0x2d, 0xc1, 0xf0, 0x99, 0x56, 0x7d, 0x07,
            0xf4, 0x7f, 0x37, 0xa3, 0x2a, 0x84, 0x42, 0x7d,
            0x64, 0x3a, 0x8c, 0xdc, 0xbf, 0xe5, 0xc0, 0xc9,
            0x75, 0x98, 0xa2, 0xbd, 0x25, 0x55, 0xd1, 0xaa,
            0x8c, 0xb0, 0x8e, 0x48, 0x59, 0x0d, 0xbb, 0x3d,
            0xa7, 0xb0, 0x8b, 0x10, 0x56, 0x82, 0x88, 0x38,
            0xc5, 0xf6, 0x1e, 0x63, 0x93, 0xba, 0x7a, 0x0a,
            0xbc, 0xc9, 0xf6, 0x62, 0x89, 0x80, 0x15, 0xad  },
            
            /* TAG */
            { 0xb0, 0x94, 0xda, 0xc5, 0xd9, 0x34, 0x71, 0xbd,
            0xec, 0x1a, 0x50, 0x22, 0x70, 0xe3, 0xcc, 0x6c,  }
        },
            
        /* test case #16 */
        {
            /*p_name*/
            "test case #16 256 bit key", 
                
            /* key */
            { 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, 
            0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08, 
            0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, 
            0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08, },
            32,
                
            /* PT */
            { 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5, 
            0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a, 
            0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda, 
            0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72, 
            0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53, 
            0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25, 
            0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57, 
            0xba, 0x63, 0x7b, 0x39,  },
            60,
            
            /* ADATA */
            { 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 
            0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 
            0xab, 0xad, 0xda, 0xd2,  },
            20,
            
            /* IV */
            { 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad, 
            0xde, 0xca, 0xf8, 0x88,  },
            12,
            
            /* CT */
            {0x52, 0x2d, 0xc1, 0xf0, 0x99, 0x56, 0x7d, 0x07,
            0xf4, 0x7f, 0x37, 0xa3, 0x2a, 0x84, 0x42, 0x7d,
            0x64, 0x3a, 0x8c, 0xdc, 0xbf, 0xe5, 0xc0, 0xc9,
            0x75, 0x98, 0xa2, 0xbd, 0x25, 0x55, 0xd1, 0xaa,
            0x8c, 0xb0, 0x8e, 0x48, 0x59, 0x0d, 0xbb, 0x3d,
            0xa7, 0xb0, 0x8b, 0x10, 0x56, 0x82, 0x88, 0x38,
            0xc5, 0xf6, 0x1e, 0x63, 0x93, 0xba, 0x7a, 0x0a,
            0xbc, 0xc9, 0xf6, 0x62,  },
            
            /* TAG */
            { 0x76, 0xfc, 0x6e, 0xce, 0x0f, 0x4e, 0x17, 0x68,
            0xcd, 0xdf, 0x88, 0x53, 0xbb, 0x2d, 0x55, 0x1b }    
        },
            
        /* test case #17 */
        {
            /*p_name*/
            "test case #17 256 bit key", 
                
            /* key */
            { 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, 
            0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08, 
            0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, 
            0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08,},
            32,
                
            /* PT */
            { 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5, 
            0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a, 
            0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda, 
            0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72, 
            0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53, 
            0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25, 
            0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57, 
            0xba, 0x63, 0x7b, 0x39,  },
            60,
            
            /* ADATA */
            { 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 
            0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 
            0xab, 0xad, 0xda, 0xd2,  },
            20,
            
            /* IV */
            { 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad, },
            8,
            
            /* CT */
            { 0xc3, 0x76, 0x2d, 0xf1, 0xca, 0x78, 0x7d, 0x32,
            0xae, 0x47, 0xc1, 0x3b, 0xf1, 0x98, 0x44, 0xcb,
            0xaf, 0x1a, 0xe1, 0x4d, 0x0b, 0x97, 0x6a, 0xfa,
            0xc5, 0x2f, 0xf7, 0xd7, 0x9b, 0xba, 0x9d, 0xe0,
            0xfe, 0xb5, 0x82, 0xd3, 0x39, 0x34, 0xa4, 0xf0,
            0x95, 0x4c, 0xc2, 0x36, 0x3b, 0xc7, 0x3f, 0x78,
            0x62, 0xac, 0x43, 0x0e, 0x64, 0xab, 0xe4, 0x99,
            0xf4, 0x7c, 0x9b, 0x1f,  },
            
            /* TAG */
            {0x3a, 0x33, 0x7d, 0xbf, 0x46, 0xa7, 0x92, 0xc4,
            0x5e, 0x45, 0x49, 0x13, 0xfe, 0x2e, 0xa8, 0xf2, }
        },
        
        /* test case #18 */
        {
            /*p_name*/
            "test case #18 256 bit key", 
                
            /* key */
            { 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, 
            0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08, 
            0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, 
            0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08,},
            32,
                
            /* PT */
            { 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5, 
            0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a, 
            0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda, 
            0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72, 
            0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53, 
            0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25, 
            0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57, 
            0xba, 0x63, 0x7b, 0x39,  },
            60,
            
            /* ADATA */
            { 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 
            0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 
            0xab, 0xad, 0xda, 0xd2,  },
            20,
            
            /* IV */
            { 0x93, 0x13, 0x22, 0x5d, 0xf8, 0x84, 0x06, 0xe5, 
            0x55, 0x90, 0x9c, 0x5a, 0xff, 0x52, 0x69, 0xaa, 
            0x6a, 0x7a, 0x95, 0x38, 0x53, 0x4f, 0x7d, 0xa1, 
            0xe4, 0xc3, 0x03, 0xd2, 0xa3, 0x18, 0xa7, 0x28, 
            0xc3, 0xc0, 0xc9, 0x51, 0x56, 0x80, 0x95, 0x39, 
            0xfc, 0xf0, 0xe2, 0x42, 0x9a, 0x6b, 0x52, 0x54, 
            0x16, 0xae, 0xdb, 0xf5, 0xa0, 0xde, 0x6a, 0x57, 
            0xa6, 0x37, 0xb3, 0x9b,  },
            60,
            
            /* CT */
            {0x5a, 0x8d, 0xef, 0x2f, 0x0c, 0x9e, 0x53, 0xf1,
            0xf7, 0x5d, 0x78, 0x53, 0x65, 0x9e, 0x2a, 0x20,
            0xee, 0xb2, 0xb2, 0x2a, 0xaf, 0xde, 0x64, 0x19,
            0xa0, 0x58, 0xab, 0x4f, 0x6f, 0x74, 0x6b, 0xf4,
            0x0f, 0xc0, 0xc3, 0xb7, 0x80, 0xf2, 0x44, 0x45,
            0x2d, 0xa3, 0xeb, 0xf1, 0xc5, 0xd8, 0x2c, 0xde,
            0xa2, 0x41, 0x89, 0x97, 0x20, 0x0e, 0xf8, 0x2e,
            0x44, 0xae, 0x7e, 0x3f,  },
            
            /* TAG */
            { 0xa4, 0x4a, 0x82, 0x66, 0xee, 0x1c, 0x8e, 0xb0,
            0xc8, 0xb5, 0xd4, 0xcf, 0x5a, 0xe9, 0xf1, 0x9a,  }
        } 
    };
    int           idx, err;
    unsigned long x, y, num;
    unsigned char out[2][128], T[2][16];
    int enc_ct_cmp, enc_tag_cmp, dec_pt_cmp, dec_tag_cmp; 

    if ( register_cipher (&aes_desc) != CRYPT_OK )
    {
        return CRYPT_INVALID_CIPHER;
    }

    /* find aes */
    idx = find_cipher("aes");
    if (idx == -1) {
        idx = find_cipher("rijndael");
        if (idx == -1) {
            return CRYPT_NOP;
        }
    }

    num = sizeof(gcm_tests)/sizeof(gcm_tests[0]);
    for (x = 0; x < num; x++) {
        y = sizeof(T[0]);
        if ((err = gcm_memory(idx, gcm_tests[x].K, gcm_tests[x].keylen,
            gcm_tests[x].IV, gcm_tests[x].IVlen,
            gcm_tests[x].A, gcm_tests[x].alen,
            (unsigned char*)gcm_tests[x].P, gcm_tests[x].ptlen,
            out[0], T[0], &y, GCM_ENCRYPT)) != CRYPT_OK) {
//            return err;
        }
        
        enc_ct_cmp = XMEMCMP(out[0], gcm_tests[x].C, gcm_tests[x].ptlen);
        if (enc_ct_cmp) {
    #if 0
            printf("\nCiphertext wrong %lu\n", x);
            for (y = 0; y < tests[x].ptlen; y++) {
                printf("%02x", out[0][y] & 255);
            }
            printf("\n");
    #endif
//            return CRYPT_FAIL_TESTVECTOR;
        }

        enc_tag_cmp = XMEMCMP(T[0], gcm_tests[x].T, 16);
        if (enc_tag_cmp) {
    #if 0
            printf("\nTag on plaintext wrong %lu\n", x);
            for (y = 0; y < 16; y++) {
                printf("%02x", T[0][y] & 255);
            }
            printf("\n");
    #endif
//            return CRYPT_FAIL_TESTVECTOR;
        }
        
        y = sizeof(T[1]);
        if ((err = gcm_memory(idx, gcm_tests[x].K, gcm_tests[x].keylen,
            gcm_tests[x].IV, gcm_tests[x].IVlen,
            gcm_tests[x].A, gcm_tests[x].alen,
            out[1], gcm_tests[x].ptlen,
            out[0], T[1], &y, GCM_DECRYPT)) != CRYPT_OK) {
            return err;
        }
        
        dec_pt_cmp = XMEMCMP(out[1], gcm_tests[x].P, gcm_tests[x].ptlen);
        if ( dec_pt_cmp ) {
    #if 0
            printf("\nplaintext wrong %lu\n", x);
            for (y = 0; y < tests[x].ptlen; y++) {
                printf("%02x", out[0][y] & 255);
            }
            printf("\n");
    #endif
//            return CRYPT_FAIL_TESTVECTOR;
        }
        
        dec_tag_cmp = XMEMCMP(T[1], gcm_tests[x].T, 16);
        if (dec_tag_cmp) {
    #if 0
            printf("\nTag on ciphertext wrong %lu\n", x);
            for (y = 0; y < 16; y++) {
                printf("%02x", T[1][y] & 255);
            }
            printf("\n");
    #endif
//            return CRYPT_FAIL_TESTVECTOR;
        }
    
        printf("%s [enc] ct? %s  tag? %s  [dec] pt? %s  tag? %s\n", 
            gcm_tests[x].p_name, 
            (enc_ct_cmp  == 0) ? "Y":"N",
            (enc_tag_cmp == 0) ? "Y":"N",
            (dec_pt_cmp  == 0) ? "Y":"N",
            (dec_tag_cmp == 0) ? "Y":"N");

    }
    return CRYPT_OK;
    #endif
}
#else
int gcm_test(void)

    /*static const*/ struct {
        char *p_name;
        unsigned char K[32];
        int           keylen;
        unsigned char P[128];
        unsigned long ptlen;
//        unsigned char A[128];
        unsigned char *A;
        unsigned long alen;
        unsigned char IV[128];
        unsigned long IVlen;
        unsigned char C[128];
        unsigned char T[16];
    } gcm_tests[] = {
        
      
        /* test case #6 */
        {
            /*p_name*/
            "test case #06 128 bit key", 
                
            /* key */
            { 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, 
            0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08, },
            16,
                
            /* PT */
            { 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5, 
            0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a, 
            0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda, 
            0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72, 
            0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53, 
            0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25, 
            0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57, 
            0xba, 0x63, 0x7b, 0x39,  },
            60,
            
            /* ADATA */
            NULL,
//             { 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 
//             0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 
//             0xab, 0xad, 0xda, 0xd2,  },
            0,
            
            /* IV */
            { 0x93, 0x13, 0x22, 0x5d, 0xf8, 0x84, 0x06, 0xe5, 
            0x55, 0x90, 0x9c, 0x5a, 0xff, 0x52, 0x69, 0xaa, 
            0x6a, 0x7a, 0x95, 0x38, 0x53, 0x4f, 0x7d, 0xa1, 
            0xe4, 0xc3, 0x03, 0xd2, 0xa3, 0x18, 0xa7, 0x28, 
            0xc3, 0xc0, 0xc9, 0x51, 0x56, 0x80, 0x95, 0x39, 
            0xfc, 0xf0, 0xe2, 0x42, 0x9a, 0x6b, 0x52, 0x54, 
            0x16, 0xae, 0xdb, 0xf5, 0xa0, 0xde, 0x6a, 0x57, 
            0xa6, 0x37, 0xb3, 0x9b,  },
            60,
            
            /* CT */
            {0x8c, 0xe2, 0x49, 0x98, 0x62, 0x56, 0x15, 0xb6, 
            0x03, 0xa0, 0x33, 0xac, 0xa1, 0x3f, 0xb8, 0x94, 
            0xbe, 0x91, 0x12, 0xa5, 0xc3, 0xa2, 0x11, 0xa8, 
            0xba, 0x26, 0x2a, 0x3c, 0xca, 0x7e, 0x2c, 0xa7, 
            0x01, 0xe4, 0xa9, 0xa4, 0xfb, 0xa4, 0x3c, 0x90, 
            0xcc, 0xdc, 0xb2, 0x81, 0xd4, 0x8c, 0x7c, 0x6f, 
            0xd6, 0x28, 0x75, 0xd2, 0xac, 0xa4, 0x17, 0x03, 
            0x4c, 0x34, 0xae, 0xe5,  },
            
            /* TAG */
            { 0x61, 0x9c, 0xc5, 0xae, 0xff, 0xfe, 0x0b, 0xfa, 
            0x46, 0x2a, 0xf4, 0x3c, 0x16, 0x99, 0xd0, 0x50, }
        }
             
    };
    int           idx, err, a_new_size = 1024*1024*160;
    unsigned long x, y, z, num;
    unsigned char out[2][128], T[2][16];
    int enc_ct_cmp = 0, enc_tag_cmp = 0, dec_pt_cmp = 0, dec_tag_cmp = 0; 

    if ( register_cipher (&aes_desc) != CRYPT_OK )
    {
        return CRYPT_INVALID_CIPHER;
    }

    /* find aes */
    idx = find_cipher("aes");
    if (idx == -1) {
        idx = find_cipher("rijndael");
        if (idx == -1) {
            return CRYPT_NOP;
        }
    }

    num = sizeof(gcm_tests)/sizeof(gcm_tests[0]);
    for (x = 0; x < num; x++) 
    {
        y = sizeof(T[0]);
        gcm_tests[x].A = (unsigned char*)malloc(a_new_size);
        gcm_tests[x].alen = a_new_size;

        for (z = 0; z < (unsigned int)a_new_size; z++) 
        {
            gcm_tests[x].A[z] = (unsigned char)(3*z + 1);
        }
        gcm_tests[x].ptlen = 0;


        err = gcm_memory2(idx, gcm_tests[x].K, gcm_tests[x].keylen,
            gcm_tests[x].IV, gcm_tests[x].IVlen,
            gcm_tests[x].A, gcm_tests[x].alen,
            (unsigned char*)gcm_tests[x].P, gcm_tests[x].ptlen,
            out[0], T[0], &y, GCM_ENCRYPT);//
//        }
 
//        printf("%s [enc] ct? %s  tag? %s  [dec] pt? %s  tag? %s\n", 
//            gcm_tests[x].p_name, );

    }
    return 0; 
}
#endif


/* $Source: /cvs/libtom/libtomcrypt/src/encauth/gcm/gcm_test.c,v $ */
/* $Revision: 1.22 $ */
/* $Date: 2007/05/12 14:32:35 $ */

int gcm_memory2(      int           cipher,
               const unsigned char *key,    unsigned long keylen,
               const unsigned char *IV,     unsigned long IVlen,
               const unsigned char *adata,  unsigned long adatalen,
                     unsigned char *pt,     unsigned long ptlen,
                     unsigned char *ct, 
                     unsigned char *tag,    unsigned long *taglen,
                               int direction)
{
    void      *orig;
    gcm_state *gcm;
    int        err;
    LARGE_INTEGER frequence;
    LARGE_INTEGER start_time, end_time, cost_time;
    double db_cost_time, speed;
    QueryPerformanceFrequency( &frequence);

    if ((err = cipher_is_valid(cipher)) != CRYPT_OK) {
       return err;
    }
 
    if (cipher_descriptor[cipher].accel_gcm_memory != NULL) {
       return 
         cipher_descriptor[cipher].accel_gcm_memory
                                          (key,   keylen,
                                           IV,    IVlen,
                                           adata, adatalen,
                                           pt,    ptlen,
                                           ct,
                                           tag,   taglen,
                                           direction);
    }

#ifndef LTC_GCM_TABLES_SSE2
    orig = gcm = XMALLOC(sizeof(*gcm));
#else
    orig = gcm = XMALLOC(sizeof(*gcm) + 16);
#endif
    if (gcm == NULL) {
        return CRYPT_MEM;
    }

   /* Force GCM to be on a multiple of 16 so we can use 128-bit aligned operations
    * note that we only modify gcm and keep orig intact.  This code is not portable
    * but again it's only for SSE2 anyways, so who cares?
    */
#ifdef LTC_GCM_TABLES_SSE2
   if ((unsigned long)gcm & 15) {
      gcm = (gcm_state *)((unsigned long)gcm + (16 - ((unsigned long)gcm & 15)));
   }
#endif

    if ((err = gcm_init(gcm, cipher, key, keylen)) != CRYPT_OK) {
       goto LTC_ERR;
    }
    if ((err = gcm_add_iv(gcm, IV, IVlen)) != CRYPT_OK) {
       goto LTC_ERR;
    }
    
    QueryPerformanceCounter(&start_time); 

    gcm_add_aad2(gcm, adata, adatalen);

    QueryPerformanceCounter(&end_time); 

    gcm_process(gcm, pt, ptlen, ct, direction);
    gcm_done(gcm, tag, taglen);

//    QueryPerformanceCounter(&end_time);
    cost_time.QuadPart = end_time.QuadPart - start_time.QuadPart;
    db_cost_time = cost_time.QuadPart / (double)frequence.QuadPart;
    speed = ( adatalen * 8 ) / db_cost_time / 1000000.0;
    printf("%d bytes aad cost time %.3f second, speed %.3f Mbps\n",adatalen, db_cost_time, speed );

//    system("Pause");
LTC_ERR:
    XFREE(orig);
    return err;
}
 
/**
  Add AAD to the GCM state
  @param gcm       The GCM state
  @param adata     The additional authentication data to add to the GCM state
  @param adatalen  The length of the AAD data.
  @return CRYPT_OK on success
 */
// 添加 AAD ( 0 bit <= AAD bit len <= 2^64 - 1 bit )
// 由于IV长度可以很长,所以允许将较长的IV分多次添加
// 在添加AAD时就开始做与AAD相关的GHASH了
int gcm_add_aad2(gcm_state *gcm,
               const unsigned char *adata,  unsigned long adatalen)
{
   unsigned long x;
   int           err;
#ifdef LTC_FAST
   unsigned long y;
#endif
   unsigned char *adata2 = (unsigned char *)adata;
   LARGE_INTEGER frequence;
   LARGE_INTEGER start_time, end_time, cost_time[10];
   double db_cost_time[10], speed[10];
   int t = 0;
   unsigned char T[16]; 
   unsigned char *I;
   int x1, y1; 

    QueryPerformanceFrequency( &frequence);

   LTC_ARGCHK(gcm    != NULL);
   if (adatalen > 0) {
      LTC_ARGCHK(adata  != NULL);
   }

   if (gcm->buflen > 16 || gcm->buflen < 0) {
      return CRYPT_INVALID_ARG;
   }

   if ((err = cipher_is_valid(gcm->cipher)) != CRYPT_OK) {
      return err;
   }

   /* in IV mode? */
   // 第一次添加aad时,mode 还停留在添加IV时的状态 LTC_GCM_MODE_IV,第一次aad添加后mode调整为LTC_GCM_MODE_AAD
   if (gcm->mode == LTC_GCM_MODE_IV) {
      /* let's process the IV */    //因为只有在第一次添加aad时才知道IV添加完毕,所以在这里处理完IV,即生成J0
      if (gcm->ivmode || gcm->buflen != 12) {//IV不是96bit,需要填充IV,再GHASH
         for (x = 0; x < (unsigned long)gcm->buflen; x++) {
             gcm->X[x] ^= gcm->buf[x];
         }
         if (gcm->buflen) {
            gcm->totlen += gcm->buflen * CONST64(8);
            gcm_mult_h2(gcm, gcm->X);
         }

         /* mix in the length */
         zeromem(gcm->buf, 8);
         STORE64H(gcm->totlen, gcm->buf+8);
         for (x = 0; x < 16; x++) {
             gcm->X[x] ^= gcm->buf[x];
         }
         gcm_mult_h2(gcm, gcm->X);

         /* copy counter out */ 
         XMEMCPY(gcm->Y, gcm->X, 16);
         zeromem(gcm->X, 16);
      } else {//IV是96bit, 只需要填充至128bit, 即 IV || 000…1
         XMEMCPY(gcm->Y, gcm->buf, 12);
         gcm->Y[12] = 0;
         gcm->Y[13] = 0;
         gcm->Y[14] = 0;
         gcm->Y[15] = 1;
      }
      XMEMCPY(gcm->Y_0, gcm->Y, 16);
      zeromem(gcm->buf, 16);
      gcm->buflen = 0;
      gcm->totlen = 0;
      gcm->mode   = LTC_GCM_MODE_AAD;//第一次aad添加时,处理完IV后mode调整为LTC_GCM_MODE_AAD
   }

   if (gcm->mode != LTC_GCM_MODE_AAD || gcm->buflen >= 16) {
      return CRYPT_INVALID_ARG;
   }


   
   x = 0;

   // 一旦有了AAD就可以开始做GHASH
#ifdef LTC_FAST
#if 0
   QueryPerformanceCounter(&start_time); 

   if (gcm->buflen == 0) {
      for (x = 0; x < (adatalen & ~15); x += 16) {
          for (y = 0; y < 16; y += sizeof(LTC_FAST_TYPE)) {
              *((LTC_FAST_TYPE*)(&gcm->X[y])) ^= *((LTC_FAST_TYPE*)(&adata[x + y]));
          }
          gcm_mult_h2(gcm, gcm->X);
          gcm->totlen += 128;
      }
      adata += x;
   }
   QueryPerformanceCounter(&end_time);
   cost_time[t].QuadPart = end_time.QuadPart - start_time.QuadPart;
   db_cost_time[t] = cost_time[t].QuadPart / (double)frequence.QuadPart;
   speed[t] = ( adatalen * 8 ) / db_cost_time[t] / 1000000.0;
   printf("%d bytes aad core cost time %.3f second, speed %.3f Mbps\n",adatalen, db_cost_time[t], speed[t] );
   t++;
#else
   QueryPerformanceCounter(&start_time); 
   adata = adata2;
   if (gcm->buflen == 0) {
       for (x = 0; x < (adatalen & ~15); x += 16) {
           for (y = 0; y < 16; y += sizeof(LTC_FAST_TYPE)) {
               *((LTC_FAST_TYPE*)(&gcm->X[y])) ^= *((LTC_FAST_TYPE*)(&adata[x + y]));
           }
//           gcm_mult_h2(gcm, gcm->X);
//////////////////////////////////////////////////////////////////////////

            I = gcm->X;
//           void gcm_mult_h2(gcm_state *gcm, unsigned char *I)
//           {
//               unsigned char T[16]; 
//               int x, y; 
               XMEMCPY(T, &gcm->PC[0][I[0]][0], 16);
               for (x1 = 1; x1 < 16; x1++) {
 
                   for (y1 = 0; y1 < 16; y1 += sizeof(LTC_FAST_TYPE)) {//查 8bit 表法计算 I * H,最多需要16次查表 和 16次 XOR
                       *((LTC_FAST_TYPE *)(T + y1)) ^= *((LTC_FAST_TYPE *)(&gcm->PC[x1][I[x1]][y1]));
                   }
               }
               XMEMCPY(I, T, 16);
//            } 

//////////////////////////////////////////////////////////////////////////
           gcm->totlen += 128;
       }
       adata += x;
   }
   QueryPerformanceCounter(&end_time);
   cost_time[t].QuadPart = end_time.QuadPart - start_time.QuadPart;
   db_cost_time[t] = cost_time[t].QuadPart / (double)frequence.QuadPart;
   speed[t] = ( adatalen * 8 ) / db_cost_time[t] / 1000000.0;
   printf("%d bytes aad core cost time %.3f second, speed %.3f Mbps\n",adatalen, db_cost_time[t], speed[t] );
   t++;
#endif
#endif


   /* start adding AAD data to the state */
   for (; x < adatalen; x++) {
       gcm->X[gcm->buflen++] ^= *adata++;

       if (gcm->buflen == 16) {
         /* GF mult it */
         gcm_mult_h2(gcm, gcm->X);
         gcm->buflen = 0;
         gcm->totlen += 128;
      }
   } 
   


   return CRYPT_OK;

 
//与H的乘法,可以查8bit表加速运算
// I = I * H
void gcm_mult_h2(gcm_state *gcm, unsigned char *I)
{
   unsigned char T[16];
#ifdef LTC_GCM_TABLES
   int x, y;
#ifdef LTC_GCM_TABLES_SSE2
   asm("movdqa (%0),%%xmm0"::"r"(&gcm->PC[0][I[0]][0]));
   for (x = 1; x < 16; x++) {
      asm("pxor (%0),%%xmm0"::"r"(&gcm->PC[x][I[x]][0]));
   }
   asm("movdqa %%xmm0,(%0)"::"r"(&T));
#else
   XMEMCPY(T, &gcm->PC[0][I[0]][0], 16);
   for (x = 1; x < 16; x++) {
#ifdef LTC_FAST
       for (y = 0; y < 16; y += sizeof(LTC_FAST_TYPE)) {//查 8bit 表法计算 I * H,最多需要16次查表 和 16次 XOR
           *((LTC_FAST_TYPE *)(T + y)) ^= *((LTC_FAST_TYPE *)(&gcm->PC[x][I[x]][y]));
       }
#else
       for (y = 0; y < 16; y++) {
           T[y] ^= gcm->PC[x][I[x]][y];
       }
#endif /* LTC_FAST */
   }
#endif /* LTC_GCM_TABLES_SSE2 */
#else     
   gcm_gf_mult(gcm->H, I, T); //在不查表的情况下只有老老实实做普通乘法
#endif
   XMEMCPY(I, T, 16);

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值