Attachment #807334: patch for bug #917571

View | Details | Raw Unified | Return to bug 917571
Collapse All | Expand All

(-)a/cmd/bltest/blapitest.c (-17 / +118 lines)
Line     Link Here 
 Lines 622-641    Link Here 
622
					 unsigned int inputLen);
622
					 unsigned int inputLen);
623
623
624
typedef SECStatus (* bltestPubKeyCipherFn)(void *key,
624
typedef SECStatus (* bltestPubKeyCipherFn)(void *key,
625
					   SECItem *output,
625
					   SECItem *output,
626
					   const SECItem *input);
626
					   const SECItem *input);
627
627
628
typedef SECStatus (* bltestHashCipherFn)(unsigned char *dest,
628
typedef SECStatus (* bltestHashCipherFn)(unsigned char *dest,
629
					 const unsigned char *src,
629
					 const unsigned char *src,
630
					 PRUint32 src_length);
630
					 PRUint32 src_length);
631
631
632
typedef SECStatus (* bltestAEADFn)(unsigned char *dest,
633
				   const unsigned char *ad, size_t adLen,
634
				   const unsigned char *src, size_t srcLen,
635
				   size_t tagLen,
636
				   const unsigned char key[32],
637
				   const unsigned char nonce[8]);
638
632
typedef enum {
639
typedef enum {
633
    bltestINVALID = -1,
640
    bltestINVALID = -1,
634
    bltestDES_ECB,	  /* Symmetric Key Ciphers */
641
    bltestDES_ECB,	  /* Symmetric Key Ciphers */
635
    bltestDES_CBC,	  /* .			   */
642
    bltestDES_CBC,	  /* .			   */
636
    bltestDES_EDE_ECB,	  /* .			   */
643
    bltestDES_EDE_ECB,	  /* .			   */
637
    bltestDES_EDE_CBC,	  /* .			   */
644
    bltestDES_EDE_CBC,	  /* .			   */
638
    bltestRC2_ECB,	  /* .			   */
645
    bltestRC2_ECB,	  /* .			   */
639
    bltestRC2_CBC,	  /* .			   */
646
    bltestRC2_CBC,	  /* .			   */
640
    bltestRC4,		  /* .			   */
647
    bltestRC4,		  /* .			   */
641
#ifdef NSS_SOFTOKEN_DOES_RC5
648
#ifdef NSS_SOFTOKEN_DOES_RC5
 Lines 644-663    Link Here 
644
#endif
651
#endif
645
    bltestAES_ECB,        /* .                     */
652
    bltestAES_ECB,        /* .                     */
646
    bltestAES_CBC,        /* .                     */
653
    bltestAES_CBC,        /* .                     */
647
    bltestAES_CTS,        /* .                     */
654
    bltestAES_CTS,        /* .                     */
648
    bltestAES_CTR,        /* .                     */
655
    bltestAES_CTR,        /* .                     */
649
    bltestAES_GCM,        /* .                     */
656
    bltestAES_GCM,        /* .                     */
650
    bltestCAMELLIA_ECB,   /* .                     */
657
    bltestCAMELLIA_ECB,   /* .                     */
651
    bltestCAMELLIA_CBC,   /* .                     */
658
    bltestCAMELLIA_CBC,   /* .                     */
652
    bltestSEED_ECB,       /* SEED algorithm	   */
659
    bltestSEED_ECB,       /* SEED algorithm	   */
653
    bltestSEED_CBC,       /* SEED algorithm	   */
660
    bltestSEED_CBC,       /* SEED algorithm	   */
661
    bltestCHACHA20,       /* ChaCha20 + Poly1305   */
654
    bltestRSA,		  /* Public Key Ciphers	   */
662
    bltestRSA,		  /* Public Key Ciphers	   */
655
#ifdef NSS_ENABLE_ECC
663
#ifdef NSS_ENABLE_ECC
656
    bltestECDSA,	  /* . (Public Key Sig.)   */
664
    bltestECDSA,	  /* . (Public Key Sig.)   */
657
#endif
665
#endif
658
    bltestDSA,		  /* .                     */
666
    bltestDSA,		  /* .                     */
659
    bltestMD2,		  /* Hash algorithms	   */
667
    bltestMD2,		  /* Hash algorithms	   */
660
    bltestMD5,		  /* .			   */
668
    bltestMD5,		  /* .			   */
661
    bltestSHA1,           /* .			   */
669
    bltestSHA1,           /* .			   */
662
    bltestSHA224,         /* .			   */
670
    bltestSHA224,         /* .			   */
663
    bltestSHA256,         /* .			   */
671
    bltestSHA256,         /* .			   */
 Lines 681-700    Link Here 
681
#endif
689
#endif
682
    "aes_ecb",
690
    "aes_ecb",
683
    "aes_cbc",
691
    "aes_cbc",
684
    "aes_cts",
692
    "aes_cts",
685
    "aes_ctr",
693
    "aes_ctr",
686
    "aes_gcm",
694
    "aes_gcm",
687
    "camellia_ecb",
695
    "camellia_ecb",
688
    "camellia_cbc",
696
    "camellia_cbc",
689
    "seed_ecb",
697
    "seed_ecb",
690
    "seed_cbc",
698
    "seed_cbc",
699
    "chacha20_poly1305",
691
    "rsa",
700
    "rsa",
692
#ifdef NSS_ENABLE_ECC
701
#ifdef NSS_ENABLE_ECC
693
    "ecdsa",
702
    "ecdsa",
694
#endif
703
#endif
695
    /*"pqg",*/
704
    /*"pqg",*/
696
    "dsa",
705
    "dsa",
697
    "md2",
706
    "md2",
698
    "md5",
707
    "md5",
699
    "sha1",
708
    "sha1",
700
    "sha224",
709
    "sha224",
 Lines 790-847    Link Here 
790
    bltestIO output;
799
    bltestIO output;
791
    /* Cipher-specific parameters */
800
    /* Cipher-specific parameters */
792
    bltestParams params;
801
    bltestParams params;
793
    /* Cipher mode */
802
    /* Cipher mode */
794
    bltestCipherMode  mode;
803
    bltestCipherMode  mode;
795
    /* Cipher function (encrypt/decrypt/sign/verify/hash) */
804
    /* Cipher function (encrypt/decrypt/sign/verify/hash) */
796
    union {
805
    union {
797
	bltestSymmCipherFn   symmkeyCipher;
806
	bltestSymmCipherFn   symmkeyCipher;
798
	bltestPubKeyCipherFn pubkeyCipher;
807
	bltestPubKeyCipherFn pubkeyCipher;
799
	bltestHashCipherFn   hashCipher;
808
	bltestHashCipherFn   hashCipher;
809
	bltestAEADFn         aeadCipher;
800
    } cipher;
810
    } cipher;
801
    /* performance testing */
811
    /* performance testing */
802
    int   repetitionsToPerfom;
812
    int   repetitionsToPerfom;
803
    int   seconds;
813
    int   seconds;
804
    int	  repetitions;
814
    int	  repetitions;
805
    int   cxreps;
815
    int   cxreps;
806
    double cxtime;
816
    double cxtime;
807
    double optime;
817
    double optime;
808
};
818
};
809
819
810
PRBool
820
PRBool
811
is_symmkeyCipher(bltestCipherMode mode)
821
is_symmkeyCipher(bltestCipherMode mode)
812
{
822
{
813
    /* change as needed! */
823
    /* change as needed! */
814
    if (mode >= bltestDES_ECB && mode <= bltestSEED_CBC)
824
    if (mode >= bltestDES_ECB && mode <= bltestSEED_CBC)
815
	return PR_TRUE;
825
	return PR_TRUE;
816
    return PR_FALSE;
826
    return PR_FALSE;
817
}
827
}
818
828
819
PRBool
829
PRBool
830
is_aeadCipher(bltestCipherMode mode)
831
{
832
    /* change as needed! */
833
    switch (mode) {
834
	case bltestCHACHA20:
835
	    return PR_TRUE;
836
	default:
837
	    return PR_FALSE;
838
    }
839
}
840
841
PRBool
820
is_authCipher(bltestCipherMode mode)
842
is_authCipher(bltestCipherMode mode)
821
{
843
{
822
    /* change as needed! */
844
    /* change as needed! */
823
    if (mode == bltestAES_GCM)
845
    switch (mode) {
824
	return PR_TRUE;
846
	case bltestAES_GCM:
825
    return PR_FALSE;
847
	case bltestCHACHA20:
848
	    return PR_TRUE;
849
	default:
850
	    return PR_FALSE;
851
    }
826
}
852
}
827
853
828
854
829
PRBool
855
PRBool
830
is_singleShotCipher(bltestCipherMode mode)
856
is_singleShotCipher(bltestCipherMode mode)
831
{
857
{
832
    /* change as needed! */
858
    /* change as needed! */
833
    if (mode == bltestAES_GCM)
859
    switch (mode) {
834
	return PR_TRUE;
860
	case bltestAES_GCM:
835
    if (mode == bltestAES_CTS)
861
	case bltestAES_CTS:
836
	return PR_TRUE;
862
	case bltestCHACHA20:
837
    return PR_FALSE;
863
	    return PR_TRUE;
864
	default:
865
	    return PR_FALSE;
866
    }
838
}
867
}
839
868
840
PRBool
869
PRBool
841
is_pubkeyCipher(bltestCipherMode mode)
870
is_pubkeyCipher(bltestCipherMode mode)
842
{
871
{
843
    /* change as needed! */
872
    /* change as needed! */
844
    if (mode >= bltestRSA && mode <= bltestDSA)
873
    if (mode >= bltestRSA && mode <= bltestDSA)
845
	return PR_TRUE;
874
	return PR_TRUE;
846
    return PR_FALSE;
875
    return PR_FALSE;
847
}
876
}
 Lines 865-894    Link Here 
865
    if (mode >= bltestDSA && mode <= bltestDSA)
894
    if (mode >= bltestDSA && mode <= bltestDSA)
866
#endif
895
#endif
867
	return PR_TRUE;
896
	return PR_TRUE;
868
    return PR_FALSE;
897
    return PR_FALSE;
869
}
898
}
870
899
871
PRBool
900
PRBool
872
cipher_requires_IV(bltestCipherMode mode)
901
cipher_requires_IV(bltestCipherMode mode)
873
{
902
{
874
    /* change as needed! */
903
    /* change as needed! */
875
    if (mode == bltestDES_CBC || mode == bltestDES_EDE_CBC ||
904
    switch (mode) {
876
	mode == bltestRC2_CBC || 
905
	case bltestDES_CBC:
906
	case bltestDES_EDE_CBC:
907
	case bltestRC2_CBC:
877
#ifdef NSS_SOFTOKEN_DOES_RC5
908
#ifdef NSS_SOFTOKEN_DOES_RC5
878
	mode == bltestRC5_CBC ||
909
	case bltestRC5_CBC:
879
#endif
910
#endif
880
	mode == bltestAES_CBC || mode == bltestAES_CTS || 
911
	case bltestAES_CBC:
881
	mode == bltestAES_CTR || mode == bltestAES_GCM ||
912
	case bltestAES_CTS:
882
	mode == bltestCAMELLIA_CBC || mode == bltestSEED_CBC)
913
	case bltestAES_CTR:
883
	return PR_TRUE;
914
	case bltestAES_GCM:
884
    return PR_FALSE;
915
	case bltestCAMELLIA_CBC:
916
	case bltestSEED_CBC:
917
	case bltestCHACHA20:
918
	    return PR_TRUE;
919
	default:
920
	    return PR_FALSE;
921
    }
885
}
922
}
886
923
887
SECStatus finishIO(bltestIO *output, PRFileDesc *file);
924
SECStatus finishIO(bltestIO *output, PRFileDesc *file);
888
925
889
SECStatus
926
SECStatus
890
setupIO(PLArenaPool *arena, bltestIO *input, PRFileDesc *file,
927
setupIO(PLArenaPool *arena, bltestIO *input, PRFileDesc *file,
891
	char *str, int numBytes)
928
	char *str, int numBytes)
892
{
929
{
893
    SECStatus rv = SECSuccess;
930
    SECStatus rv = SECSuccess;
894
    SECItem fileData;
931
    SECItem fileData;
 Lines 1480-1499    Link Here 
1480
    }
1517
    }
1481
    if (encrypt)
1518
    if (encrypt)
1482
	cipherInfo->cipher.symmkeyCipher = seed_Encrypt;
1519
	cipherInfo->cipher.symmkeyCipher = seed_Encrypt;
1483
    else
1520
    else
1484
	cipherInfo->cipher.symmkeyCipher = seed_Decrypt;
1521
	cipherInfo->cipher.symmkeyCipher = seed_Decrypt;
1485
	
1522
	
1486
	return SECSuccess;
1523
	return SECSuccess;
1487
}
1524
}
1488
1525
1489
SECStatus
1526
SECStatus
1527
bltest_chacha20_init(bltestCipherInfo *cipherInfo, PRBool encrypt)
1528
{
1529
    if (encrypt)
1530
	cipherInfo->cipher.aeadCipher = ChaCha20Poly1305_Seal;
1531
    else
1532
	cipherInfo->cipher.aeadCipher = ChaCha20Poly1305_Open;
1533
    return SECSuccess;
1534
}
1535
1536
SECStatus
1490
bltest_rsa_init(bltestCipherInfo *cipherInfo, PRBool encrypt)
1537
bltest_rsa_init(bltestCipherInfo *cipherInfo, PRBool encrypt)
1491
{
1538
{
1492
    int i;
1539
    int i;
1493
    RSAPrivateKey **dummyKey;
1540
    RSAPrivateKey **dummyKey;
1494
    PRIntervalTime time1, time2;
1541
    PRIntervalTime time1, time2;
1495
    bltestRSAParams *rsap = &cipherInfo->params.rsa;
1542
    bltestRSAParams *rsap = &cipherInfo->params.rsa;
1496
    /* RSA key gen was done during parameter setup */
1543
    /* RSA key gen was done during parameter setup */
1497
    cipherInfo->cx = cipherInfo->params.rsa.rsakey;
1544
    cipherInfo->cx = cipherInfo->params.rsa.rsakey;
1498
    /* For performance testing */
1545
    /* For performance testing */
1499
    if (cipherInfo->cxreps > 0) {
1546
    if (cipherInfo->cxreps > 0) {
 Lines 2102-2121    Link Here 
2102
	SECITEM_AllocItem(cipherInfo->arena, &cipherInfo->output.buf,
2149
	SECITEM_AllocItem(cipherInfo->arena, &cipherInfo->output.buf,
2103
			  cipherInfo->input.pBuf.len);
2150
			  cipherInfo->input.pBuf.len);
2104
	return bltest_camellia_init(cipherInfo, encrypt);
2151
	return bltest_camellia_init(cipherInfo, encrypt);
2105
	break;
2152
	break;
2106
    case bltestSEED_ECB:
2153
    case bltestSEED_ECB:
2107
    case bltestSEED_CBC:
2154
    case bltestSEED_CBC:
2108
	SECITEM_AllocItem(cipherInfo->arena, &cipherInfo->output.buf,
2155
	SECITEM_AllocItem(cipherInfo->arena, &cipherInfo->output.buf,
2109
			  cipherInfo->input.pBuf.len);
2156
			  cipherInfo->input.pBuf.len);
2110
	return bltest_seed_init(cipherInfo, encrypt);
2157
	return bltest_seed_init(cipherInfo, encrypt);
2111
	break;
2158
	break;
2159
    case bltestCHACHA20:
2160
	SECITEM_AllocItem(cipherInfo->arena, &cipherInfo->output.buf,
2161
			  cipherInfo->input.pBuf.len + 16);
2162
	return bltest_chacha20_init(cipherInfo, encrypt);
2163
	break;
2112
    case bltestRSA:
2164
    case bltestRSA:
2113
	SECITEM_AllocItem(cipherInfo->arena, &cipherInfo->output.buf,
2165
	SECITEM_AllocItem(cipherInfo->arena, &cipherInfo->output.buf,
2114
			  cipherInfo->input.pBuf.len);
2166
			  cipherInfo->input.pBuf.len);
2115
	return bltest_rsa_init(cipherInfo, encrypt);
2167
	return bltest_rsa_init(cipherInfo, encrypt);
2116
	break;
2168
	break;
2117
    case bltestDSA:
2169
    case bltestDSA:
2118
	SECITEM_AllocItem(cipherInfo->arena, &cipherInfo->output.buf,
2170
	SECITEM_AllocItem(cipherInfo->arena, &cipherInfo->output.buf,
2119
			  DSA_MAX_SIGNATURE_LEN);
2171
			  DSA_MAX_SIGNATURE_LEN);
2120
	return bltest_dsa_init(cipherInfo, encrypt);
2172
	return bltest_dsa_init(cipherInfo, encrypt);
2121
	break;
2173
	break;
 Lines 2490-2509    Link Here 
2490
                for (;j < opsBetweenChecks;j++) {
2542
                for (;j < opsBetweenChecks;j++) {
2491
                    (*cipherInfo->cipher.symmkeyCipher)(
2543
                    (*cipherInfo->cipher.symmkeyCipher)(
2492
                        cipherInfo->cx, dummyOut, &len, maxLen,
2544
                        cipherInfo->cx, dummyOut, &len, maxLen,
2493
                        cipherInfo->input.pBuf.data,
2545
                        cipherInfo->input.pBuf.data,
2494
                        cipherInfo->input.pBuf.len);
2546
                        cipherInfo->input.pBuf.len);
2495
                }
2547
                }
2496
                cipherInfo->repetitions += j;
2548
                cipherInfo->repetitions += j;
2497
            }
2549
            }
2498
        }
2550
        }
2499
        TIMEFINISH(cipherInfo->optime, 1.0);
2551
        TIMEFINISH(cipherInfo->optime, 1.0);
2552
    } else if (is_aeadCipher(cipherInfo->mode)) {
2553
        const unsigned char *input = cipherInfo->input.pBuf.data;
2554
        unsigned int inputLen = cipherInfo->input.pBuf.len;
2555
        unsigned char *output = cipherInfo->output.pBuf.data;
2556
        unsigned int outputLen = maxLen;
2557
        bltestSymmKeyParams *sk = &cipherInfo->params.sk;
2558
        const unsigned int tagLen = 16; /* same for all AEADs, so far. */
2559
2560
        TIMESTART();
2561
        rv = (*cipherInfo->cipher.aeadCipher)(
2562
                output, NULL /* no additional data */, 0,
2563
                input, inputLen,
2564
                tagLen,
2565
                sk->key.buf.data,
2566
                sk->iv.buf.data);
2567
        CHECKERROR(rv, __LINE__);
2568
        TIMEFINISH(cipherInfo->optime, 1.0);
2569
2570
        cipherInfo->repetitions = 0;
2571
        if (cipherInfo->repetitionsToPerfom != 0) {
2572
            TIMESTART();
2573
            for (i=0; i<cipherInfo->repetitionsToPerfom; i++,
2574
                     cipherInfo->repetitions++) {
2575
                rv = (*cipherInfo->cipher.aeadCipher)(
2576
                        output, NULL /* no additional data */, 0,
2577
                        input, inputLen,
2578
                        tagLen,
2579
                        sk->key.buf.data,
2580
                        sk->iv.buf.data);
2581
                CHECKERROR(rv, __LINE__);
2582
            }
2583
        } else {
2584
            int opsBetweenChecks = 0;
2585
            TIMEMARK(cipherInfo->seconds);
2586
            while (! (TIMETOFINISH())) {
2587
                int j = 0;
2588
                for (;j < opsBetweenChecks;j++) {
2589
                    (*cipherInfo->cipher.aeadCipher)(
2590
                            output, NULL /* no additional data */, 0,
2591
                            input, inputLen,
2592
                            tagLen,
2593
                            sk->key.buf.data,
2594
                            sk->iv.buf.data);
2595
                }
2596
                cipherInfo->repetitions += j;
2597
            }
2598
        }
2599
        TIMEFINISH(cipherInfo->optime, 1.0);
2500
    } else if (is_pubkeyCipher(cipherInfo->mode)) {
2600
    } else if (is_pubkeyCipher(cipherInfo->mode)) {
2501
        TIMESTART();
2601
        TIMESTART();
2502
        rv = (*cipherInfo->cipher.pubkeyCipher)(cipherInfo->cx,
2602
        rv = (*cipherInfo->cipher.pubkeyCipher)(cipherInfo->cx,
2503
                                                &cipherInfo->output.pBuf,
2603
                                                &cipherInfo->output.pBuf,
2504
                                                &cipherInfo->input.pBuf);
2604
                                                &cipherInfo->input.pBuf);
2505
        TIMEFINISH(cipherInfo->optime, 1.0);
2605
        TIMEFINISH(cipherInfo->optime, 1.0);
2506
        CHECKERROR(rv, __LINE__);
2606
        CHECKERROR(rv, __LINE__);
2507
        cipherInfo->repetitions = 0;
2607
        cipherInfo->repetitions = 0;
2508
        if (cipherInfo->repetitionsToPerfom != 0) {
2608
        if (cipherInfo->repetitionsToPerfom != 0) {
2509
            TIMESTART();
2609
            TIMESTART();
 Lines 3862-3882    Link Here 
3862
        if (!arena) {
3962
        if (!arena) {
3863
            fprintf(stderr, "%s: Can not allocate memory.\n", progName);
3963
            fprintf(stderr, "%s: Can not allocate memory.\n", progName);
3864
            goto exit_point;
3964
            goto exit_point;
3865
        }
3965
        }
3866
        cipherInfo->arena = arena;
3966
        cipherInfo->arena = arena;
3867
        params = &cipherInfo->params;
3967
        params = &cipherInfo->params;
3868
        
3968
        
3869
        /* Set up an encryption key. */
3969
        /* Set up an encryption key. */
3870
        keysize = 0;
3970
        keysize = 0;
3871
        file = NULL;
3971
        file = NULL;
3872
        if (is_symmkeyCipher(cipherInfo->mode)) {
3972
        if (is_symmkeyCipher(cipherInfo->mode) ||
3973
	    is_aeadCipher(cipherInfo->mode)) {
3873
            char *keystr = NULL;  /* if key is on command line */
3974
            char *keystr = NULL;  /* if key is on command line */
3874
            if (bltest.options[opt_Key].activated) {
3975
            if (bltest.options[opt_Key].activated) {
3875
                if (bltest.options[opt_CmdLine].activated) {
3976
                if (bltest.options[opt_CmdLine].activated) {
3876
                    keystr = bltest.options[opt_Key].arg;
3977
                    keystr = bltest.options[opt_Key].arg;
3877
                } else {
3978
                } else {
3878
                    file = PR_Open(bltest.options[opt_Key].arg,
3979
                    file = PR_Open(bltest.options[opt_Key].arg,
3879
                                   PR_RDONLY, 00660);
3980
                                   PR_RDONLY, 00660);
3880
                }
3981
                }
3881
            } else {
3982
            } else {
3882
                if (bltest.options[opt_KeySize].activated)
3983
                if (bltest.options[opt_KeySize].activated)
(-)a/cmd/pk11gcmtest/pk11gcmtest.c (-27 / +33 lines)
Line     Link Here 
 Lines 27-193    Link Here 
27
	    offset = c2[i] - 'A';
27
	    offset = c2[i] - 'A';
28
	    *byteval |= (offset + 10) << 4*(1-i);
28
	    *byteval |= (offset + 10) << 4*(1-i);
29
	} else {
29
	} else {
30
	    return SECFailure;
30
	    return SECFailure;
31
	}
31
	}
32
    }
32
    }
33
    return SECSuccess;
33
    return SECSuccess;
34
}
34
}
35
35
36
static SECStatus
36
static SECStatus
37
aes_encrypt_buf(
37
encrypt_buf(
38
    CK_MECHANISM_TYPE mechanism,
38
    const unsigned char *key, unsigned int keysize,
39
    const unsigned char *key, unsigned int keysize,
39
    const unsigned char *iv, unsigned int ivsize,
40
    const unsigned char *iv, unsigned int ivsize,
40
    unsigned char *output, unsigned int *outputlen, unsigned int maxoutputlen,
41
    unsigned char *output, unsigned int *outputlen, unsigned int maxoutputlen,
41
    const unsigned char *input, unsigned int inputlen,
42
    const unsigned char *input, unsigned int inputlen,
42
    const unsigned char *aad, unsigned int aadlen, unsigned int tagsize)
43
    const unsigned char *aad, unsigned int aadlen, unsigned int tagsize)
43
{
44
{
44
    SECStatus rv = SECFailure;
45
    SECStatus rv = SECFailure;
45
    SECItem key_item;
46
    SECItem key_item;
46
    PK11SlotInfo* slot = NULL;
47
    PK11SlotInfo* slot = NULL;
47
    PK11SymKey *symKey = NULL;
48
    PK11SymKey *symKey = NULL;
48
    CK_GCM_PARAMS gcm_params;
49
    CK_GCM_PARAMS gcm_params;
49
    SECItem param;
50
    SECItem param;
50
51
51
    /* Import key into NSS. */
52
    /* Import key into NSS. */
52
    key_item.type = siBuffer;
53
    key_item.type = siBuffer;
53
    key_item.data = (unsigned char *) key;  /* const cast */
54
    key_item.data = (unsigned char *) key;  /* const cast */
54
    key_item.len = keysize;
55
    key_item.len = keysize;
55
    slot = PK11_GetInternalSlot();
56
    slot = PK11_GetInternalSlot();
56
    symKey = PK11_ImportSymKey(slot, CKM_AES_GCM, PK11_OriginUnwrap,
57
    symKey = PK11_ImportSymKey(slot, mechanism, PK11_OriginUnwrap,
57
			       CKA_ENCRYPT, &key_item, NULL);
58
			       CKA_ENCRYPT, &key_item, NULL);
58
    PK11_FreeSlot(slot);
59
    PK11_FreeSlot(slot);
59
    slot = NULL;
60
    slot = NULL;
60
    if (!symKey) {
61
    if (!symKey) {
61
	fprintf(stderr, "PK11_ImportSymKey failed\n");
62
	fprintf(stderr, "PK11_ImportSymKey failed\n");
62
	goto loser;
63
	goto loser;
63
    }
64
    }
64
65
65
    gcm_params.pIv = (unsigned char *) iv;  /* const cast */
66
    gcm_params.pIv = (unsigned char *) iv;  /* const cast */
66
    gcm_params.ulIvLen = ivsize;
67
    gcm_params.ulIvLen = ivsize;
67
    gcm_params.pAAD = (unsigned char *) aad;  /* const cast */
68
    gcm_params.pAAD = (unsigned char *) aad;  /* const cast */
68
    gcm_params.ulAADLen = aadlen;
69
    gcm_params.ulAADLen = aadlen;
69
    gcm_params.ulTagBits = tagsize * 8;
70
    gcm_params.ulTagBits = tagsize * 8;
70
71
71
    param.type = siBuffer;
72
    param.type = siBuffer;
72
    param.data = (unsigned char *) &gcm_params;
73
    param.data = (unsigned char *) &gcm_params;
73
    param.len = sizeof(gcm_params);
74
    param.len = sizeof(gcm_params);
74
75
75
    if (PK11_Encrypt(symKey, CKM_AES_GCM, &param,
76
    if (PK11_Encrypt(symKey, mechanism, &param,
76
		     output, outputlen, maxoutputlen,
77
		     output, outputlen, maxoutputlen,
77
		     input, inputlen) != SECSuccess) {
78
		     input, inputlen) != SECSuccess) {
78
	fprintf(stderr, "PK11_Encrypt failed\n");
79
	fprintf(stderr, "PK11_Encrypt failed\n");
79
	goto loser;
80
	goto loser;
80
    }
81
    }
81
82
82
    rv = SECSuccess;
83
    rv = SECSuccess;
83
84
84
loser:
85
loser:
85
    if (symKey != NULL) {
86
    if (symKey != NULL) {
86
	PK11_FreeSymKey(symKey);
87
	PK11_FreeSymKey(symKey);
87
    }
88
    }
88
    return rv;
89
    return rv;
89
}
90
}
90
91
91
static SECStatus
92
static SECStatus
92
aes_decrypt_buf(
93
decrypt_buf(
94
    CK_MECHANISM_TYPE mechanism,
93
    const unsigned char *key, unsigned int keysize,
95
    const unsigned char *key, unsigned int keysize,
94
    const unsigned char *iv, unsigned int ivsize,
96
    const unsigned char *iv, unsigned int ivsize,
95
    unsigned char *output, unsigned int *outputlen, unsigned int maxoutputlen,
97
    unsigned char *output, unsigned int *outputlen, unsigned int maxoutputlen,
96
    const unsigned char *input, unsigned int inputlen,
98
    const unsigned char *input, unsigned int inputlen,
97
    const unsigned char *aad, unsigned int aadlen,
99
    const unsigned char *aad, unsigned int aadlen,
98
    const unsigned char *tag, unsigned int tagsize)
100
    const unsigned char *tag, unsigned int tagsize)
99
{
101
{
100
    SECStatus rv = SECFailure;
102
    SECStatus rv = SECFailure;
101
    unsigned char concatenated[11*16];     /* 1 to 11 blocks */
103
    unsigned char concatenated[11*16];     /* 1 to 11 blocks */
102
    SECItem key_item;
104
    SECItem key_item;
103
    PK11SlotInfo *slot = NULL;
105
    PK11SlotInfo *slot = NULL;
104
    PK11SymKey *symKey = NULL;
106
    PK11SymKey *symKey = NULL;
105
    CK_GCM_PARAMS gcm_params;
107
    CK_GCM_PARAMS gcm_params;
106
    SECItem param;
108
    SECItem param;
107
109
108
    if (inputlen + tagsize > sizeof(concatenated)) {
110
    if (inputlen + tagsize > sizeof(concatenated)) {
109
	fprintf(stderr, "aes_decrypt_buf: local buffer too small\n");
111
	fprintf(stderr, "decrypt_buf: local buffer too small\n");
110
	goto loser;
112
	goto loser;
111
    }
113
    }
112
    memcpy(concatenated, input, inputlen);
114
    memcpy(concatenated, input, inputlen);
113
    memcpy(concatenated + inputlen, tag, tagsize);
115
    memcpy(concatenated + inputlen, tag, tagsize);
114
116
115
    /* Import key into NSS. */
117
    /* Import key into NSS. */
116
    key_item.type = siBuffer;
118
    key_item.type = siBuffer;
117
    key_item.data = (unsigned char *) key;  /* const cast */
119
    key_item.data = (unsigned char *) key;  /* const cast */
118
    key_item.len = keysize;
120
    key_item.len = keysize;
119
    slot = PK11_GetInternalSlot();
121
    slot = PK11_GetInternalSlot();
120
    symKey = PK11_ImportSymKey(slot, CKM_AES_GCM, PK11_OriginUnwrap,
122
    symKey = PK11_ImportSymKey(slot, mechanism, PK11_OriginUnwrap,
121
			       CKA_DECRYPT, &key_item, NULL);
123
			       CKA_DECRYPT, &key_item, NULL);
122
    PK11_FreeSlot(slot);
124
    PK11_FreeSlot(slot);
123
    slot = NULL;
125
    slot = NULL;
124
    if (!symKey) {
126
    if (!symKey) {
125
	fprintf(stderr, "PK11_ImportSymKey failed\n");
127
	fprintf(stderr, "PK11_ImportSymKey failed\n");
126
	goto loser;
128
	goto loser;
127
    }
129
    }
128
130
129
    gcm_params.pIv = (unsigned char *) iv;
131
    gcm_params.pIv = (unsigned char *) iv;
130
    gcm_params.ulIvLen = ivsize;
132
    gcm_params.ulIvLen = ivsize;
131
    gcm_params.pAAD = (unsigned char *) aad;
133
    gcm_params.pAAD = (unsigned char *) aad;
132
    gcm_params.ulAADLen = aadlen;
134
    gcm_params.ulAADLen = aadlen;
133
    gcm_params.ulTagBits = tagsize * 8;
135
    gcm_params.ulTagBits = tagsize * 8;
134
136
135
    param.type = siBuffer;
137
    param.type = siBuffer;
136
    param.data = (unsigned char *) &gcm_params;
138
    param.data = (unsigned char *) &gcm_params;
137
    param.len = sizeof(gcm_params);
139
    param.len = sizeof(gcm_params);
138
140
139
    if (PK11_Decrypt(symKey, CKM_AES_GCM, &param,
141
    if (PK11_Decrypt(symKey, mechanism, &param,
140
		     output, outputlen, maxoutputlen,
142
		     output, outputlen, maxoutputlen,
141
		     concatenated, inputlen + tagsize) != SECSuccess) {
143
		     concatenated, inputlen + tagsize) != SECSuccess) {
142
	goto loser;
144
	goto loser;
143
    }
145
    }
144
146
145
    rv = SECSuccess;
147
    rv = SECSuccess;
146
148
147
loser:
149
loser:
148
    if (symKey != NULL) {
150
    if (symKey != NULL) {
149
	PK11_FreeSymKey(symKey);
151
	PK11_FreeSymKey(symKey);
150
    }
152
    }
151
    return rv;
153
    return rv;
152
}
154
}
153
155
154
/*
156
/*
155
 * Perform the AES Known Answer Test (KAT) in Galois Counter Mode (GCM).
157
 * Perform the AES Known Answer Test (KAT) in Galois Counter Mode (GCM).
156
 *
158
 *
157
 * respfn is the pathname of the RESPONSE file.
159
 * respfn is the pathname of the RESPONSE file.
158
 */
160
 */
159
static void
161
static void
160
aes_gcm_kat(const char *respfn)
162
kat(CK_MECHANISM_TYPE mechanism, const char *respfn)
161
{
163
{
162
    char buf[512];      /* holds one line from the input REQUEST file.
164
    char buf[600];      /* holds one line from the input REQUEST file.
163
                         * needs to be large enough to hold the longest
165
                         * needs to be large enough to hold the longest
164
                         * line "CIPHERTEXT = <320 hex digits>\n".
166
                         * line "AAD = <590 hex digits>\n".
165
                         */
167
                         */
166
    FILE *aesresp;      /* input stream from the RESPONSE file */
168
    FILE *aesresp;      /* input stream from the RESPONSE file */
167
    int i, j;
169
    int i, j;
168
    unsigned int test_group = 0;
170
    unsigned int test_group = 0;
169
    unsigned int num_tests;
171
    unsigned int num_tests;
170
    PRBool is_encrypt;
172
    PRBool is_encrypt;
171
    unsigned char key[32];              /* 128, 192, or 256 bits */
173
    unsigned char key[32];              /* 128, 192, or 256 bits */
172
    unsigned int keysize;
174
    unsigned int keysize;
173
    unsigned char iv[10*16];            /* 1 to 10 blocks */
175
    unsigned char iv[10*16];            /* 1 to 10 blocks */
174
    unsigned int ivsize;
176
    unsigned int ivsize;
175
    unsigned char plaintext[10*16];     /* 1 to 10 blocks */
177
    unsigned char plaintext[512];
176
    unsigned int plaintextlen = 0;
178
    unsigned int plaintextlen = 0;
177
    unsigned char aad[10*16];           /* 1 to 10 blocks */
179
    unsigned char aad[512];
178
    unsigned int aadlen = 0;
180
    unsigned int aadlen = 0;
179
    unsigned char ciphertext[10*16];    /* 1 to 10 blocks */
181
    unsigned char ciphertext[512];
180
    unsigned int ciphertextlen;
182
    unsigned int ciphertextlen;
181
    unsigned char tag[16];
183
    unsigned char tag[16];
182
    unsigned int tagsize;
184
    unsigned int tagsize;
183
    unsigned char output[10*16];         /* 1 to 10 blocks */
185
    unsigned char output[512];
184
    unsigned int outputlen;
186
    unsigned int outputlen;
185
187
186
    unsigned int expected_keylen = 0;
188
    unsigned int expected_keylen = 0;
187
    unsigned int expected_ivlen = 0;
189
    unsigned int expected_ivlen = 0;
188
    unsigned int expected_ptlen = 0;
190
    unsigned int expected_ptlen = 0;
189
    unsigned int expected_aadlen = 0;
191
    unsigned int expected_aadlen = 0;
190
    unsigned int expected_taglen = 0;
192
    unsigned int expected_taglen = 0;
191
    SECStatus rv;
193
    SECStatus rv;
192
194
193
    if (strstr(respfn, "Encrypt") != NULL) {
195
    if (strstr(respfn, "Encrypt") != NULL) {
 Lines 309-360    Link Here 
309
		hex_to_byteval(&buf[i], &plaintext[j]);
311
		hex_to_byteval(&buf[i], &plaintext[j]);
310
	    }
312
	    }
311
	    plaintextlen = j;
313
	    plaintextlen = j;
312
	    if (plaintextlen != expected_ptlen) {
314
	    if (plaintextlen != expected_ptlen) {
313
		fprintf(stderr, "Unexpected PT length: %u vs. %u\n",
315
		fprintf(stderr, "Unexpected PT length: %u vs. %u\n",
314
			plaintextlen, expected_ptlen);
316
			plaintextlen, expected_ptlen);
315
		exit(1);
317
		exit(1);
316
	    }
318
	    }
317
319
318
	    if (!is_encrypt) {
320
	    if (!is_encrypt) {
319
		rv = aes_decrypt_buf(key, keysize, iv, ivsize,
321
		rv = decrypt_buf(mechanism, key, keysize, iv, ivsize,
320
		    output, &outputlen, sizeof output,
322
		    output, &outputlen, sizeof output,
321
		    ciphertext, ciphertextlen, aad, aadlen, tag, tagsize);
323
		    ciphertext, ciphertextlen, aad, aadlen, tag, tagsize);
322
		if (rv != SECSuccess) {
324
		if (rv != SECSuccess) {
323
		    fprintf(stderr, "aes_decrypt_buf failed\n");
325
		    fprintf(stderr, "decrypt_buf failed\n");
324
		    goto loser;
326
		    goto loser;
325
		}
327
		}
326
		if (outputlen != plaintextlen) {
328
		if (outputlen != plaintextlen) {
327
		    fprintf(stderr, "aes_decrypt_buf: wrong output size\n");
329
		    fprintf(stderr, "decrypt_buf: wrong output size\n");
328
		    goto loser;
330
		    goto loser;
329
		}
331
		}
330
		if (memcmp(output, plaintext, plaintextlen) != 0) {
332
		if (memcmp(output, plaintext, plaintextlen) != 0) {
331
		    fprintf(stderr, "aes_decrypt_buf: wrong plaintext\n");
333
		    fprintf(stderr, "decrypt_buf: wrong plaintext\n");
332
		    goto loser;
334
		    goto loser;
333
		}
335
		}
334
	    }
336
	    }
335
	    continue;
337
	    continue;
336
	}
338
	}
337
	/* FAIL */
339
	/* FAIL */
338
	if (strncmp(buf, "FAIL", 4) == 0) {
340
	if (strncmp(buf, "FAIL", 4) == 0) {
339
	    plaintextlen = 0;
341
	    plaintextlen = 0;
340
342
341
	    PORT_Assert(!is_encrypt);
343
	    PORT_Assert(!is_encrypt);
342
	    rv = aes_decrypt_buf(key, keysize, iv, ivsize,
344
	    rv = decrypt_buf(mechanism, key, keysize, iv, ivsize,
343
		output, &outputlen, sizeof output,
345
		output, &outputlen, sizeof output,
344
		ciphertext, ciphertextlen, aad, aadlen, tag, tagsize);
346
		ciphertext, ciphertextlen, aad, aadlen, tag, tagsize);
345
	    if (rv != SECFailure) {
347
	    if (rv != SECFailure) {
346
		fprintf(stderr, "aes_decrypt_buf succeeded unexpectedly\n");
348
		fprintf(stderr, "decrypt_buf succeeded unexpectedly\n");
347
		goto loser;
349
		goto loser;
348
	    }
350
	    }
349
	    if (PORT_GetError() != SEC_ERROR_BAD_DATA) {
351
	    if (PORT_GetError() != SEC_ERROR_BAD_DATA) {
350
		fprintf(stderr, "aes_decrypt_buf failed with incorrect "
352
		fprintf(stderr, "decrypt_buf failed with incorrect "
351
			"error code\n");
353
			"error code\n");
352
		goto loser;
354
		goto loser;
353
	    }
355
	    }
354
	    continue;
356
	    continue;
355
	}
357
	}
356
	/* AAD = ... */
358
	/* AAD = ... */
357
	if (strncmp(buf, "AAD", 3) == 0) {
359
	if (strncmp(buf, "AAD", 3) == 0) {
358
	    i = 3;
360
	    i = 3;
359
	    while (isspace(buf[i]) || buf[i] == '=') {
361
	    while (isspace(buf[i]) || buf[i] == '=') {
360
		i++;
362
		i++;
 Lines 397-433    Link Here 
397
		hex_to_byteval(&buf[i], &tag[j]);
399
		hex_to_byteval(&buf[i], &tag[j]);
398
	    }
400
	    }
399
	    tagsize = j;
401
	    tagsize = j;
400
	    if (tagsize != expected_taglen) {
402
	    if (tagsize != expected_taglen) {
401
		fprintf(stderr, "Unexpected tag length: %u vs. %u\n",
403
		fprintf(stderr, "Unexpected tag length: %u vs. %u\n",
402
			tagsize, expected_taglen);
404
			tagsize, expected_taglen);
403
		exit(1);
405
		exit(1);
404
	    }
406
	    }
405
407
406
	    if (is_encrypt) {
408
	    if (is_encrypt) {
407
		rv = aes_encrypt_buf(key, keysize, iv, ivsize,
409
		rv = encrypt_buf(mechanism, key, keysize, iv, ivsize,
408
		    output, &outputlen, sizeof output,
410
		    output, &outputlen, sizeof output,
409
		    plaintext, plaintextlen, aad, aadlen, tagsize);
411
		    plaintext, plaintextlen, aad, aadlen, tagsize);
410
		if (rv != SECSuccess) {
412
		if (rv != SECSuccess) {
411
		    fprintf(stderr, "aes_encrypt_buf failed\n");
413
		    fprintf(stderr, "encrypt_buf failed\n");
412
		    goto loser;
414
		    goto loser;
413
		}
415
		}
414
		if (outputlen != plaintextlen + tagsize) {
416
		if (outputlen != plaintextlen + tagsize) {
415
		    fprintf(stderr, "aes_encrypt_buf: wrong output size\n");
417
		    fprintf(stderr, "encrypt_buf: wrong output size\n");
416
		    goto loser;
418
		    goto loser;
417
		}
419
		}
418
		if (memcmp(output, ciphertext, plaintextlen) != 0) {
420
		if (memcmp(output, ciphertext, plaintextlen) != 0) {
419
		    fprintf(stderr, "aes_encrypt_buf: wrong ciphertext\n");
421
		    fprintf(stderr, "encrypt_buf: wrong ciphertext\n");
420
		    goto loser;
422
		    goto loser;
421
		}
423
		}
422
		if (memcmp(output + plaintextlen, tag, tagsize) != 0) {
424
		if (memcmp(output + plaintextlen, tag, tagsize) != 0) {
423
		    fprintf(stderr, "aes_encrypt_buf: wrong tag\n");
425
		    fprintf(stderr, "encrypt_buf: wrong tag\n");
424
		    goto loser;
426
		    goto loser;
425
		}
427
		}
426
	    }
428
	    }
427
	    continue;
429
	    continue;
428
	}
430
	}
429
    }
431
    }
430
    /* Report num_tests for the last test group. */
432
    /* Report num_tests for the last test group. */
431
    printf("%u tests\n", num_tests);
433
    printf("%u tests\n", num_tests);
432
    printf("%u test groups\n", test_group);
434
    printf("%u test groups\n", test_group);
433
    printf("PASS\n");
435
    printf("PASS\n");
 Lines 441-457    Link Here 
441
443
442
    NSS_NoDB_Init(NULL);
444
    NSS_NoDB_Init(NULL);
443
445
444
    /*************/
446
    /*************/
445
    /*   AES     */
447
    /*   AES     */
446
    /*************/
448
    /*************/
447
    if (strcmp(argv[1], "aes") == 0) {
449
    if (strcmp(argv[1], "aes") == 0) {
448
	/* argv[2]=kat argv[3]=gcm argv[4]=<test name>.rsp */
450
	/* argv[2]=kat argv[3]=gcm argv[4]=<test name>.rsp */
449
	if (strcmp(argv[2], "kat") == 0) {
451
	if (strcmp(argv[2], "kat") == 0) {
450
	    /* Known Answer Test (KAT) */
452
	    /* Known Answer Test (KAT) */
451
	    aes_gcm_kat(argv[4]);
453
	    kat(CKM_AES_GCM, argv[4]);
452
	}
454
	}
455
    } else if (strcmp(argv[1], "chacha20") == 0 &&
456
	       strcmp(argv[2], "kat") == 0 &&
457
	       strcmp(argv[3], "poly1305") == 0) {
458
	kat(CKM_NSS_CHACHA20_POLY1305, argv[4]);
453
    }
459
    }
454
460
455
    NSS_Shutdown();
461
    NSS_Shutdown();
456
    return 0;
462
    return 0;
457
}
463
}
(-)b008c4b827be (+839 lines)
Added Link Here 
Added Link Here 
1
[Keylen = 256]
2
[IVlen = 64]
3
[PTlen = 0]
4
[AADlen = 0]
5
[Taglen = 128]
6
7
Count = 0
8
Key = acb9542c48f9440ba770fdb641fe265bb0923e6e802091fedf894fc211970acf
9
IV = 3f8ff04b06f7035b
10
PT = 
11
AAD = 
12
CT = 
13
Tag = 0f45ae49a614abb78964888a12c0516c
14
15
[Keylen = 256]
16
[IVlen = 64]
17
[PTlen = 40]
18
[AADlen = 40]
19
[Taglen = 128]
20
21
Count = 0
22
Key = 9aece8866d4f1f0535ef1aad1f2f26b4611df292926434ec96c75b6033f58c05
23
IV = debd9a9873df139b
24
PT = 9aca25acad
25
AAD = 65aa6d3a3a
26
CT = 0a89d44c30
27
Tag = c2d5a4cb2d45eed952134d29c42613a1
28
29
[Keylen = 256]
30
[IVlen = 64]
31
[PTlen = 80]
32
[AADlen = 80]
33
[Taglen = 128]
34
35
Count = 0
36
Key = c0331401b64665930ebeedbe37eeb33ac66bb14df46f32ccba0f59f6a32bab86
37
IV = b01d0327b191359e
38
PT = 1162b59c9c3dec3ee5e1
39
AAD = 1d02137be712e6f65854
40
CT = 9af52ef31e680054a9b5
41
Tag = c9484db4edc114b5ae9a9f3489079c61
42
43
[Keylen = 256]
44
[IVlen = 64]
45
[PTlen = 120]
46
[AADlen = 120]
47
[Taglen = 128]
48
49
Count = 0
50
Key = 013df6e8a6fdda219e43f3f662b573969fa85fa0a6c630ab5bba90211d5d3fa2
51
IV = 6feb239dbd75d66d
52
PT = 8175ac7aafb11edfd3bbfcc1b43c62
53
AAD = d719fcfb8c6bb133d528cc01185307
54
CT = d57e75ed7c866db4eccefe2e013e50
55
Tag = e981bd65b87c837e8dc39ed946f3669f
56
57
[Keylen = 256]
58
[IVlen = 64]
59
[PTlen = 160]
60
[AADlen = 160]
61
[Taglen = 128]
62
63
Count = 0
64
Key = 6e98722d1b799198ecf0458730d981e9ba480093ba903357bcdcface743f7c13
65
IV = 5cbe692211797302
66
PT = 6ad959852f1fcfb036fc4e3705c3ce8daf28e9b4
67
AAD = ff5c762db19d3d95a533e284aa7857d8610a4146
68
CT = a9987890b54f5afa41abc48a51d18e8731a3d96a
69
Tag = 5035eee605ed71f77511de78cd32034f
70
71
[Keylen = 256]
72
[IVlen = 64]
73
[PTlen = 200]
74
[AADlen = 200]
75
[Taglen = 128]
76
77
Count = 0
78
Key = b2168e518f7c677b0137e883d747dbc5bfe3ffef5abab58631cbb2825f29eac2
79
IV = f6309cd77a945cd0
80
PT = 189ed3b66982814efc4c7cb10d4b229ceca4deb0172b5f4281
81
AAD = b188fd19e7f2baa0416b48a99faa21c3ef4a2a7749700ad43b
82
CT = 6f6994ea9e95d1f300c7e887470bb87280bc4dcf92c7682be9
83
Tag = b9530a7ef1121a107a9edcfe1c12af8e
84
85
[Keylen = 256]
86
[IVlen = 64]
87
[PTlen = 240]
88
[AADlen = 240]
89
[Taglen = 128]
90
91
Count = 0
92
Key = 09d7812c8e0f5a8e4aadaef3e0e35d9c8d2f00ca29f43b33c133f5d989703dd4
93
IV = f6ff57275ae07a20
94
PT = 8479c01db1d9835717ca9adbf7fc1b97c9eaf889e4af6748df6261696cc1
95
AAD = 7ce2a78fb1ad61d9a2f37abac8b74d65bd6dddb00e10a5033e67247a9e5a
96
CT = d2ddfd7822cc4c2b3c9c4fceef9f5bea68d42327daf16d5d23e620465109
97
Tag = 321842d6ebd01c248a0399b55614a345
98
99
[Keylen = 256]
100
[IVlen = 64]
101
[PTlen = 280]
102
[AADlen = 280]
103
[Taglen = 128]
104
105
Count = 0
106
Key = b710a43cf01623b56efd33aca4ce3b8ff4cead3c49eca17b0afaabde3a3868c3
107
IV = 547a8f8be034245a
108
PT = 58f1f7965aa510fd3332b1b533d4cb5015db848091642f96a35a5536056b5a23749d23
109
AAD = b91e33144a8920fcb9a833d26026d9cbbc4772c1c03fc0a5a8d318cc6c6bb1ff4006f0
110
CT = 19cb4db09293dab283db25fdadbb45ea00115748168b581472c2e12c83571d4867d6ad
111
Tag = 7cc67a82533b2b554b3faf50f945d696
112
113
[Keylen = 256]
114
[IVlen = 64]
115
[PTlen = 320]
116
[AADlen = 320]
117
[Taglen = 128]
118
119
Count = 0
120
Key = ca1c0968e023d98f7ba26f851821b48805d9902879b84d294fe1499f3c8403f8
121
IV = d3d2ed44b783f0d3
122
PT = d76319600341e5f07605978300801368a3d01562553775a0277a1f94eeed9d3c2ee82ea747825d6c
123
AAD = 055ae645da59eda7416782bde3bb30fd9212a81f12f4c1052de9eefc9426800f294a44227ff7569b
124
CT = c4627d0111197da1da76d3141a8ca31950e2a25b3d91cdfaea519bc3693e639649da8fc3e2fb7939
125
Tag = ae4a0fd5f89ceb235178c654ada61dd2
126
127
[Keylen = 256]
128
[IVlen = 64]
129
[PTlen = 360]
130
[AADlen = 360]
131
[Taglen = 128]
132
133
Count = 0
134
Key = 019ad29afe77668800051ddfb358ad878116fe2f8175475274769777dd1bf396
135
IV = eaf5e46bd04b9194
136
PT = 601f07a2874c8c2a28e71f0a17af591730bb9dac4562964b01c0a7167ee94d3630be87faeb5196c55262d5e59a
137
AAD = 2b19efbc7431bce5f634547390ce7fd84798b3d8e84759a978d8dc7269b8842b0a22266b9bc9f600c1457caea1
138
CT = d933f2265532f40313b1d7304befc55708818070fc52ee2b4cfd4c7ee9106423b49c0df291712a21fb98e55b7f
139
Tag = d12c2abbc0c43ee4d1abe497dbf00d4e
140
141
[Keylen = 256]
142
[IVlen = 64]
143
[PTlen = 400]
144
[AADlen = 400]
145
[Taglen = 128]
146
147
Count = 0
148
Key = 858bd461c8151e95b9e4830c68b7d90d4360258e5aa471aef380c4ccacf28dbb
149
IV = 01d9069175ef947c
150
PT = 6700697e1fd1201f0eb825a1b5454ab8d8fd5beb61a7210acaf00b6c9c71e5c08fc69ff9db0cef9bbe0b9f2253a4856ab03b
151
AAD = a15f6e9aacb999410ad202126f9f72590019ad7a5f9997d9b9c649e2ccc8f9b2714796e6feff82da32973fb8202c4ff41953
152
CT = 5206888704bbd6c6787fb31245df2c9e7f1e5c0543ac029218bde43d23cca264662473a92840f242ec94c1355be1d47f2986
153
Tag = a03d57a5ebf948cdae32c1641225b186
154
155
[Keylen = 256]
156
[IVlen = 64]
157
[PTlen = 440]
158
[AADlen = 440]
159
[Taglen = 128]
160
161
Count = 0
162
Key = d096115d4a3902728aef3f1bcfb2eca46af7621f6a922b60c1039789ac35e55f
163
IV = e18888104b3fceb8
164
PT = 617a6c6cca378f2768031a0b4ad9d1c1be60557e8f90564a57867862d5f5310005eeb4fe3536d21aa5979173861afce8f49d58a4c3527b
165
AAD = 31ce84fe8ed80c65b10664b3deda81b0720e8e47de6591e08f7ddc03bf9b191a2dd5c59cd6a4a82f1da9da6df02ba023dbcc816c531616
166
CT = 296458e52dcd29634b1972112772e7df5457ebfdda7c8d29b895be832cc16941373a4e59344bac287059a940d43f41ae283306eeeb016b
167
Tag = 5009566bc722d0115d8c6b46bdd85604
168
169
[Keylen = 256]
170
[IVlen = 64]
171
[PTlen = 480]
172
[AADlen = 480]
173
[Taglen = 128]
174
175
Count = 0
176
Key = 17202821a27c9e182fa529252b7b3ea124b5f1cc5a6a461cf4379a0d810038c6
177
IV = dc617c1c7b102efa
178
PT = bddeb18c5efc3ce468ec6901ae47327ba9e831cf97f80cd7722659176801659250f10d300be9fda257cbddfdc0c9572f90561e178460dba635b91724
179
AAD = fb6f98fa491ca5738f88306ccf2599575cb8bd0b06f0e824735a1d462b8aef0cc75217d1ac750fabdf60fe039a9141e6e545ed7bbc8b44d4468cd616
180
CT = 402ab648b865f8dbf30ad42fd33a5deb2f28fc35e772b2699449517d9a1b3a69816748a67d38bbabce5279c8427712c622a514c2121325dca3c07169
181
Tag = 91cb8960f15941cae9090dae1f6958e2
182
183
[Keylen = 256]
184
[IVlen = 64]
185
[PTlen = 520]
186
[AADlen = 520]
187
[Taglen = 128]
188
189
Count = 0
190
Key = 72f2073a96682a5b0baf348476f91ced0b64f0bfba918a6324cddb05bd42576c
191
IV = 5fd0e4ab8a8588b8
192
PT = eee959bbc560d7faac7fe0ee242ef6c2a3605eebd71488dad0d534f18e7c292bb32315e2fe303a06fde7e19a675d5faff2e0b1dbd37cb7111aec66c02914d83a5b
193
AAD = 3fe677a6ff11384995087ee1ffed662102fc2810299ad9729baba4d5c21233ecab59e4e78c5c1d4e333a161fb362341f4a943623973271ffc50b3d25cff69f7484
194
CT = 1b603c686cdbc9e0609ea09b96bf4bc66bf8a17530e9a0fdfe7f5807d8c8e5e197b1d2572fe3b86e284933de0435bfe1ae9c9f0e437a110c44d7dc668988efc371
195
Tag = 8e6ea351b795d8aac1cf1aeabf8064f0
196
197
[Keylen = 256]
198
[IVlen = 64]
199
[PTlen = 560]
200
[AADlen = 560]
201
[Taglen = 128]
202
203
Count = 0
204
Key = 55e39f388bae28387975a062ba81b44d0a2f2045a22ddc174f4c01fca6660c27
205
IV = 8d4af671bf17674e
206
PT = 55c1f88069f3e26f4a0e276960847ea24613670ab506bc2eec35589d5f98d399aa9ab8edd63876e2eaef4554bbaff8487ec0db47910667f45f25a5847f78132b65e0597725f8
207
AAD = 97becc866e58ed0aa35bae0e80337fe8e4b2ced199f09e0b4032c7ee12116ab279cc5b3cb8f4907de15725f3636e27b80b21dc50ef7f7a245d9dbe3a7264c1d71f8535d2e34a
208
CT = 1b1145ca1188b3443c822d094b168a68382ea84d3fcf2d65c3d40bd3b66b37791aa20cf311615c23aa5c73fe6bea25ec5b2310cb103005e7fa792a55f3462b971e979ee312ce
209
Tag = 96c7cef81ce0b897a0dd63e1e13d6eec
210
211
[Keylen = 256]
212
[IVlen = 64]
213
[PTlen = 600]
214
[AADlen = 600]
215
[Taglen = 128]
216
217
Count = 0
218
Key = 881ecd1007638703eeed79253aa9d71d4afd941bebcdadf63cc91c2ff4616113
219
IV = a01eef6ab2cf916f
220
PT = 454029b615c3233afd73fd0304ee7a090dddbee78b0cb0b32b866712debe205e23c373d83bef12ca94a45ff9168242602429813d3cdb8bbe7d2ff1d4f26d98dff33376c175d9eee0044c59
221
AAD = 7f3965d1468caddd921651a79985b125a978dd8558d3a6375e25bdebac0f71d3a62082bde2aeb0c55c6a46399297f055f7c44d49b0127db914bffb7b7f43545e1779134739880fdde894f7
222
CT = b1509848adfb148180d69ad8e073c8797f8de2937324390e2127124c22b4e81e10a8caf09a77a42cde9d75866fc228ff5df856fb4d35db023beed5f8e39233bb5b15bd5ed17e38eccb53df
223
Tag = 655a5a2169bc9f9e2a8fb6c6d46ba4b9
224
225
[Keylen = 256]
226
[IVlen = 64]
227
[PTlen = 640]
228
[AADlen = 640]
229
[Taglen = 128]
230
231
Count = 0
232
Key = 29df456181f0a8e87dd268ba90f8ff6077e735d04aab82b7c3febdf0449d534d
233
IV = 3580a85237899b4e
234
PT = 979f78d41981cc98a42a6e64786fc701f26eac72b941ce657d61eeff95260f4b08e08c07179f0be49f7ec5ffaf8d2d43475174436996ab43120480f71659a1132640fcfa8c893670d04bc384c07d0603
235
AAD = 736a7ac39054ceb09dda0f5cee75cdf4889804e1e78d77ab9d9aaef7a0a1a7dfb8c24022641521ad50303458ba47ad10030bc59438ef1c713bc6085b274e1a0aed55e36e537c54f55897d56d698595a0
236
CT = 285461e9e74df697b33fc48f45f080c5877331539eb844a8e5f1d5bf61209f8dbc4d8c009b237e73fe71708bf11fd36058101dc327093714e80e46217f6fdf68342a9fb01051e37fd464da3d8dabc140
237
Tag = 7bd8f6f4cbe873a35cb1a4cbf3b9fcfe
238
239
[Keylen = 256]
240
[IVlen = 64]
241
[PTlen = 680]
242
[AADlen = 680]
243
[Taglen = 128]
244
245
Count = 0
246
Key = ad020c7f3041afeaa243715a86ef0af97ab5c791c28396d7b0b9c611f1514d05
247
IV = d9f1571cfda97d48
248
PT = e491580cc3c51bf8da83b57aec10cca94ed346e5a3a0809ea700c8f66adc4f6a9f8cc6ff4f1b6a2d2b61475322aff77838c66ee3a67eeedfa208a69fc5c5bca2305047b3c83dcfbf1a3d8ae721d2c30750cce8b463
249
AAD = 0753b4bb11d64a593f78fde2f5124224e44cd8d77c33bc79e155dd2b6c7bd732a32e2c9e14de83590d86cc92f3a1e75e537b620fc358f6d8c6e82102c410b566466c5abd4354f21412ee873baad438e2b4e632c652
250
CT = df70d9f65c530cfbbd0e13bb739a4f67db0879b3914009b60198b5b74bf81cf953a0841c8ad10c0fb6afdb704b92a34d99201b7a2cc1cc2cf3a22bd7e71e1207e730bdaeb09f186a766a806c998235f57686676012
251
Tag = 0f2ff8ea5b2757da65229d9ba0c73d87
252
253
[Keylen = 256]
254
[IVlen = 64]
255
[PTlen = 720]
256
[AADlen = 720]
257
[Taglen = 128]
258
259
Count = 0
260
Key = 92239a4d8ace355bf209d773ff7887bcad3dbfd0499b750ebab82c326de82e6d
261
IV = 1f651c9aa0d45fbd
262
PT = 53e949b8d51a9235192af1c9ee4bb108bf67caf6a0caf7a1a38d34b2695a3a4c1f1fcdc8ce309145bceda7b0cfdb5cbc47a52e57d3d48f96af93f3865bb5912b581d79ac80fe4b5bdbecf7ce3a557d44f6bde52036fdf2f3219b
263
AAD = 9c83e5b6b7ba667492dc365c0a338ee65b7985236053c9ea26f2d1abb5484dde771d3bb6f99fff831a46efe3583cd5ac8823134217cfea02b73ec4739652bdbd73487990853377d319724befdefa2c06fef7fdb0c1d71937f6bd
264
CT = bc4f0327af71cacb27cad3a5136b70c7e2b6e43d33809331a314c77caeff0edb8a65d84c7506862568530c348b8e489f3276eb1d9f41d983255897cb2abef26b161efa6f32907beef22af8b45a6eeb736d67f23b26610a911cb1
265
Tag = 78378314f64019caddeb72bf12d5ce40
266
267
[Keylen = 256]
268
[IVlen = 64]
269
[PTlen = 760]
270
[AADlen = 760]
271
[Taglen = 128]
272
273
Count = 0
274
Key = 3c3fd6917c2824ca1929ad5955e40192e4e7f2bb008c32eba0e54b5035a8b5b7
275
IV = 47675c24217bf49e
276
PT = 487d60257b53d284ee77a1b0c967cf8218aa858f5061e0229e5d856d15c70f08895cf9d235f7afcac68667a2644553844ea15ca9866957c6f36fdd896be7026a22f9b7d03f6b904f144932b625e246dea76abf2175778a5cede7c8a340e75c
277
AAD = 28a00e27dd38b73fd57f51a33a8f191ff7bfe8157050911326ad6f1274ca3132a3cc55fecf37bb62158dcff53f48a1737d57a4e4c4e22492901f9e07c0535f9a5634b1d35c0524ee0dd23a1427da18ed32b5061c7e02cf66846fac90686c3f
278
CT = ea7f9fcffc9932dc1fec9313edc0b61a52090f831a06214ac00930d082c92ac66bd49c9a34d673134bf522cfdbc183a4e1f4b3bd2c9af54e2db67f1c94728173f651da5f94b9f5fe1e480af1802e6b9432ba2224f74978b5e974c9a3ba141d
279
Tag = cd0dce76bc2c80e324fb39b50632f3dd
280
281
[Keylen = 256]
282
[IVlen = 64]
283
[PTlen = 800]
284
[AADlen = 800]
285
[Taglen = 128]
286
287
Count = 0
288
Key = fed7d6aad4b925fb0ccb697e63467227814789f7679990eec217bec5b556248f
289
IV = 8a27945c42eecdbe
290
PT = 397e1de526056f2991819b99918713056914650ec36e85ea10098ad8ce65303f2d1544102170cc874208b98c017c58e80d502485a39c1d57811732c1484d2abf5f2d503fb3de3747225a3c964569d7dcaea74c5eeb213d3ebea704995eb5f9e2d47955ac
291
AAD = 8f53f98812bea4219788195ccb750f99800096de7bc3c3ffc37ea3a716c39635aa3aa2a195a4184d376fdec7b60ae392f633d147fb9b148ccdd116b49171ebb072423b361a710590de1c68bc86cbf61a25f1e1a593828815530da7d3ff95faab8b9a815b
292
CT = 4b183ffacd59f991fd1691d19c8aa668302d05a4b89f9932184ccd9c4fd1efc82815f5dcef0bf3a0341bb36bd8712cc31841a7c1a63eb312df67fb5967b5fa5740b3850ad5cbe83137446b7810fee3c921f8f31d394949f769941b97cac71bddb3ff95a5
293
Tag = 05cd716a84c260c02f8ec9b94225e080
294
295
[Keylen = 256]
296
[IVlen = 64]
297
[PTlen = 840]
298
[AADlen = 840]
299
[Taglen = 128]
300
301
Count = 0
302
Key = 3c38b3efc2edfafe68b92dcb8ce176b41527d5bf6abce78c90e979013c5efdc7
303
IV = 4ba30308966a6b76
304
PT = d767456148f01f1b916c440b0c60d93a4282d6d72e31b1cca928e1dd7a0c267d0b6dd4c66a98fa32d41653c1ed371cb67ba64b0a400651ef866185aa925c895a9123f70842831154987012e83b0dafd84d22330c3806dde28ead9cdcac3000cc965e8a04f413e5f8d2
305
AAD = 95a1cfb7eefc03594c2f36e66b568d3101dee1e25dec606bd9a039b447cc592cfff50e10f42dad4bc5187fad601ccee2474d27b94daceec353352dd14bf5b035b2f5ba1e8ba9153974a53d3d34f72a3420fa8998e2172679449e9af90f6c1ab4bef87d3695ff28cf44
306
CT = 2e97da3a5c6799a3397fcb78851be05680d11f03c3dfbb284cd9364beadbf1fa23674b701df5504f994eee7d908c239d737bb31da1646097b20a5814c4a50187f11160f496b8391e1984c64e28fae9246fbf12e38ceec6f793fee50ba4f3dfb6113d8ec2e998310331
307
Tag = 29ba7c760057452ef91dc6b886c5a9e4
308
309
[Keylen = 256]
310
[IVlen = 64]
311
[PTlen = 880]
312
[AADlen = 880]
313
[Taglen = 128]
314
315
Count = 0
316
Key = 5906fed532a234eff911786b5a0d7ff8a2129fa3eccfb00036a8e29398f46659
317
IV = ea9f7dc7fb934672
318
PT = 4a2ca4ee5d2f424738549f1b5298a84abd068a3b5117f715294e94ceb41b4dd3335024f634a9161a66251fdbf11d25dd023edbd0766c93f9aa4c782d996d2f68b6e52504a199fcae0e0813f397e8b9bf5dad1d91033c040ab08388b54c636f9f8ba0146f742b5a6a3c8102699469
319
AAD = b8b158c189b4914b19aa6321f3b7ed726d38f49cd0535069176c18f9681a9c0640cc83e407de158c887437f91ca276c138f8a161da35ddcc5faf2a00ef14dcf343379b0410c7b28e0f03a33e6aba25db433937db98bd003f57e26b2c6f9b35e74f1bddf0e536318e4b3dc2c4eec7
320
CT = db494f3532769e78940acbdb363b9c0eb9698eb95538acb279b8acee6ae6238f09b67da51ba5b97a450a3f05661b572f84be59b8dbeb22a0199c1aef791c14b825b3251877a0263f57fc098dd383c0976f3a855f3c7eabafcbca4a67455d0839fc0831daf52c6ada3df0c5438961
321
Tag = de066b22403fc8d29a017102027e43ce
322
323
[Keylen = 256]
324
[IVlen = 64]
325
[PTlen = 920]
326
[AADlen = 920]
327
[Taglen = 128]
328
329
Count = 0
330
Key = 68f75db286d982c0c9e2696c60596cb45efccee30b0138d516194f88c81526c2
331
IV = df4811090add6ca9
332
PT = 91f27214d856627ddbe1c3b6876395ba99c92d8995d58aa071bd2c47310263e5afd3f2fd542847bc46f630b0f6da50c67eed94a89078b3e278245a00c8d96ab50b97feff7ec6ee57e6c93b5e74c116b0ad603deb5ae964c4c8d8d57dbe24576feb5e9e7702a56efc5a04c8dd5f478934c608f6
333
AAD = 831724f060e99e57a8eb955101dd0aa097a0529da5ad831e99ce15f292d1b16c28dd340df55c9533e035ce1227faa26c027ef0c036db57f8f9e06850805a84609dcac9377e3e176d7e85484c18b5971346640fa545bb8499b82129d03f176c304e9aa0107a32b157456a64b8523bb00a84a2e1
334
CT = b6256ee0349b884663690f2c32a38fa4bc9dd17d80a09c123eadd7abe7b188ca657711b84799e4cf11902f512120d61b1c06a73283c6204187dc704f7b8a930f8d60d9e33794e5ef6abbcef5a2bf25dc0dd42f3b9f372260446732fb905a2a0947100c250c5cb157a22ca7064eecc92d9188e6
335
Tag = eb748092ef84511d55383aed71d578ec
336
337
[Keylen = 256]
338
[IVlen = 64]
339
[PTlen = 960]
340
[AADlen = 960]
341
[Taglen = 128]
342
343
Count = 0
344
Key = 196e79092eed77ad2ebf33a2aa1be46b902a714012122eab7e3b3d1effc74995
345
IV = fa9fa5afb142d2e6
346
PT = e23e4a6fc452830f591bbc81134aca40de9209c096049de5350381b9d2edcc8e570aa7a159aaac001c94a09cfcd3b064a17f21565e6f21f99e090a1941d4d06d84c8bdec3b860536960e4e3f24d0379a5dd9b789beffcbd7dcb4d11a6e52ea59060b3e5d8c00bd686e8b9b201189998668a1d4368569d4f8
347
AAD = 55ab7de715d313583e19e7fd5c21c9835c071ed1077574f0ed1773e2a87af8b7271e4e4a0e8322886e0d65e493a96bbcfd1a021443497499d4a61e5b105849b53f9830d854f5abab85dacc8e1849e51f8705c587cd0c3793d451b3fd1a193a470866e06bdef658e198c4f554abfaace2aaea90e8eed7abd8
348
CT = 462e85a8330d6072081e5ed8c481ab5a9cee171eadbb8efff92dbe58707ef3f2ce1fa10197f18799aa982b4a445a89f4133e0c1349c7f446238cf6df0619e8acc3ddd89c471e2285ef549757f8626aff7a589788a5acaaf209b9a82699428975cd2600d44501c101dcc0d19059d8678cabf9034b05bb5734
349
Tag = 3064e2dedcb9b80c1f5e45009fa24b3c
350
351
[Keylen = 256]
352
[IVlen = 64]
353
[PTlen = 1000]
354
[AADlen = 1000]
355
[Taglen = 128]
356
357
Count = 0
358
Key = 8af439b58da1c018d5357243c9d6732b1c94d021b15ac6db3c5e13ccb3861f1f
359
IV = 58eea71c01b49572
360
PT = 2c80268be4f4658d4e64e982b1ad1e6614b79f0108256d30b1d2a1cc054012db44d34f778cc07ef2632689167e7715bdef74e962a79fece9cacda2c34b48609d685f93ad05ed84e491e7d704e6432d16aea5c0776f93ad79cddf4248041a7acdad4bb65ba21051e3fb677964289d81f5c40712b120b3784cb142134969
361
AAD = 2360d791f021a4a41701399c95e503a82cfb1f971bce1508da3654bb4dee300b59d87d7e4869eef5813141e2eec37dc5fc9ddf95137151decb4db7732f7ae938cac5b68fb62ac4e6b0d71ef616c42280e33c453038f5244cc4d5778dc0e5033380a77dd3ecfa5bde749af88543b9ec6059a9e1f724c0e10e507d6e5233
362
CT = e914a05de4a32ef2a08fe3471af287edf99aac1db92d4199a3f8a4ec2b5ac079a176076dd408d4ff6fda7dc3ac39535d2238bc6886252c6b59c01f5085b6a6afbbc10f15ae55813d7d5a5673c235f281cdf92e2da0b8a2a0d3c8f782a36b4724be62196f8a4482b08e49db33250ad4cf83756a9a807f374e3cad11470f
363
Tag = 57b049c0ccb71ce03b7ff5c1dfcfdd1b
364
365
[Keylen = 256]
366
[IVlen = 64]
367
[PTlen = 1040]
368
[AADlen = 1040]
369
[Taglen = 128]
370
371
Count = 0
372
Key = 063aed0038aa81407f76a6e385005ec8faf1c6880c298ef5ed907265dde7b342
373
IV = 8b665989856e53f5
374
PT = 7ee15935f87ecb0c949342e82f7c0582d830e126a2bb2bf764d964cf4ceec91e4cf78f3253ccacb9c32e7c35d616d41db2a9862f634c9046df0ccab7b65ecb02ded5e20a288c66b204c48baba30f2e400fd2e36a6d259497b0b6aeddc61b55e26931e9e34ba7d35d7c8c94ed461ca6013d6b23d8b1bd59a0ee8aac3b08b31dce94de
375
AAD = d4588cca06e04d9a5843153f8a849fab51136332436804016af15f40da0d501c17d9da04dbf8530538f19210e7bc1ebb12f0ee4b660e0f2c96cb11e817c1590ea9f5f7cc06d6329530c0fd978bf894c4100a0fe1b8b96cfe2513057614e476ceae80f76c05160aa822e10a85659be6841c498b8ac9900a0d321455adcf533e691941
376
CT = ebc0f14a3e5e259c95c3e697b5b6e043309cc94c66734d4b899e4a97375c0403597f6fbe11cc62ef62303dc39ffea86c54ff32be0d9e6b3054e6b32c799e604565bd2921b59e4fd4ecc89e242df1e3be158db474efedceb0ab9829e6914ac4d65743600d5cfb0c82c339039e5b1fc28243f2f8872f9bd332657204aa7bf2a6fb77d6
377
Tag = 34f2d2df05a69c5baf949115a27fa39c
378
379
[Keylen = 256]
380
[IVlen = 64]
381
[PTlen = 1080]
382
[AADlen = 1080]
383
[Taglen = 128]
384
385
Count = 0
386
Key = 8d4a9863e4640fc20adf8ef259d81003f3b635101f83f701cb2115b343f8abd2
387
IV = 636b537f53d8e775
388
PT = f26506e161e1ea70e56e7cdf36e468c2617df39200ed32a927b1bf71d964bb5e7c90ef3db77df3ef413b9de6ac2a71f3cde8ef177c607652ab9b196b8c424857ad89e20ceb858b033d92b7dd56313ba0bf2a222a10f4b757ae6ad8ea49f558c3f8a707a0fe92fb8aaa5a9f89340077285a84e477266d8aaf9f66ba6926d66d3d61a81398a2a2f9
389
AAD = 65c867f69dba8d91caa0327302379781e38ccdf4c31b70f6534b399d4e1d29b548931aa930dd452653e9cb8a43cb117d4b4bb038a72592e6710a505d520d8ad4c7171b574b6915b10cc4c1b4edec34b21a8e7beeceff80aa161c664c05f0c52ece2118636383761432c9ac7faa136ceff378c93c9f74a4e7cfae6db6dc047a528607ae058f87c4
390
CT = f4c0843bb0df9680a279be71123871e57d4e4cf0f4c558a09e44cac7a26d864ee48431d9ccff6bb65a5a98158392192de2bec0fbc3eb154d175a8ed012c054294988cf04aaec48a3072f9ff0b59587da6b26572002e582993aaeec8bb945993cf2363cb3b2d8a805985604e8b06376e070ad58a48f2482ef82758f1d74376aee35da2b00fe4797
391
Tag = a9aa76d5828adb71d769ba9c8a3208ce
392
393
[Keylen = 256]
394
[IVlen = 64]
395
[PTlen = 1120]
396
[AADlen = 1120]
397
[Taglen = 128]
398
399
Count = 0
400
Key = 48ea5147dd2a79e6a22d0226f44ba4c38d7748d518dc01413517c86565438fea
401
IV = 10adabe0403988da
402
PT = 3f3bd35e13fdc221f4638cfc4c5d6d0de773b489aef70a4e6548fc158f11c5d14ec6d23ab7b2ae586830733addafc08c2146401491b11abf32e0ed229b97a216a8540a6b3cbd7241ccda647c1246bf3a4199126835bb5d76fb54d9daa18747c477816d414a1c98d15bfe4ac36aab2a0a09a33a47d4c9a026032c09fabeb749d10b713238ec7abc55f0afa4e5
403
AAD = b7c65431dc00cbff4ea96b72824b9b39159f79ffbeb3d1922b6f84f52c9b9ddc544cced74832fc668cd8353bbe2de96e6362145ef2404f625ed271918c24cb25f937337378d6fefef9815d251b66746a695c4266ee8cb5d17ed7a90e69a4feb9452cde62ccdea704b7d8fc118339c2c1e3c2a95f0f1be2203f3fc1838bab205cf2c5d185ef0eb87a56b4cd7d
404
CT = 47c123e5c0c5a1773adc022f9aab02c0b34ebd246fd40f472ecb6f7519985ba56fdccdc8fa1fbb4f40011dad83614973fce75c23bb674b1e37fb709567b0938d3adde4304b1b17650954b54614ddb1de4766385277dea693552a6f1b9fdfab004818a581bc7eb6a4447a16a3b6b9438242ea839e479ff44268efd0b87245f4553fdd838289e8ac5b3e63bc1a
405
Tag = d092b09d05947d20328709b5957ec3a5
406
407
[Keylen = 256]
408
[IVlen = 64]
409
[PTlen = 1160]
410
[AADlen = 1160]
411
[Taglen = 128]
412
413
Count = 0
414
Key = 11632bdeb0542adb1a83d76c56f53d4b4402f7273f6b5083061219b971e98a71
415
IV = 3993f59d18c47670
416
PT = a71c6e7d8388f5933a8b1ff9d97a99b3f48e664b57af4812d7e90e5f3aa5b83265d2ca8cc1b7509d7e76ae4585367d420f24d51616307317c62b060a9c9d965d6045f5079e0ad33421922da20b5224581f119b438190a0677cea32ed519052cdc0ab58af36c793ab9c9a4faac1f5f7fa63ac166d412ebdabb538b15b1b4b45d7421d71484fed52284f8e77027a5afeea2b
417
AAD = cf9493bd953aef5d3cd4a16c1bb6cc8214e009d4b134412c59032bcef50c919c4aba296f1eb5a972ed615499d349d3e4491636a611bca7d1a42c3e5f2f6e9783aaa41e1286ac9be8292d5578a8cde61279b9f0a1bc8471f175afd4fe81a65385dc8801976cadcdcb263bb751d8893953df0d345e7f548fb0a7dafdcde60e3708ffe7cd29be89d723a2f8c465c31a6bea63
418
CT = 2767d209e675ca161100705eadfef0b97d26ec68f4a03980610c06d2055e37fd12c738a63628f15245db56c5294ca3a43d233be7c761b9e4839d24e3d92769432e81279d53d43b4dde9f3b26dd5c0ccf2c3733755129f3a62b7abffd34fc29041c641d3b6ccb5a103f6d67f2ba0604c2bcce9524b55c794214e8f6d3fbe3995fab1dee9ccfe8415599d3ca96c0a9b8af87
419
Tag = 99a2f803e5f57bc8ed17666330340a5f
420
421
[Keylen = 256]
422
[IVlen = 64]
423
[PTlen = 1200]
424
[AADlen = 1200]
425
[Taglen = 128]
426
427
Count = 0
428
Key = 77f342c1f48ae42c6cae530271e1feb371b66b67d207ded136236243a14b918d
429
IV = e3876e770d036332
430
PT = e9a2a7eaa627573811112d887c6bb4748cab23d1a105537bdf053ccd865b3465c6eea2a824921527a4f3ab71582d95d259261131cf9a9ec9c7130d8e17620a3315ae3258dd49d0c8033eed61e9798a68202abe7fa3f86edc25f49461d71684acccbb17c2e40620b4551c6d5ad2b8b66f29be8af7d882d6bf79fac64d9cefeb8c3832cc1a9cccaff94c209e7c4e3219f19aa8b66f9610
431
AAD = a6bf94e0d7530642fcf6802001fde153220e86bc56aaad3c21e5d5d64521471bbae27d962f1b4b752aa31ddc4f7c9bf87215e70eb6561372024a821fcff03f9290e6e7876c15de4ee17b610b740216b32fa75680904e22c914edde6d3d705bcc0429a3f0ce6d6c29732fa3b29cd1d810d413b2d78667c083509b6871d5b89b3176b6d720f819915344f00272343cd01f96686ed2e200
432
CT = 8ff6c259ff25c75aed4529bf9c8b04c7e80f8caf337f3be45839212c9d690e7ab4cb475acb8690ac98590da21b95195708d05e31b0481e0991902c94a068739f2d039421d626320672adabb081f33c4b7c7137924d47485eb8cb5f7d400b57f5600d4772a1afd8cafdb4ecf959ef031ec30bbdc1b0c223f02fe7d306321f1ce2a6988c4414a34656429b42c9f4727f309a9c91d95abf
433
Tag = b9e175906e6f0abbe2b9ba060bc3e792
434
435
[Keylen = 256]
436
[IVlen = 64]
437
[PTlen = 1240]
438
[AADlen = 1240]
439
[Taglen = 128]
440
441
Count = 0
442
Key = 92918664a6d08fac85a120a34effb424ff69a2d46551bc41fff4235263d0d9c7
443
IV = 9ea836f003b450f2
444
PT = f729f86c5c4f3a0184ddef2b51b0443f944240c7bd36e04c5d9d30a75a5ec09e2a91d80816cfdc63376b86a274cd015d11d8934b0ebb0d93a128da48e0de0e8a6c8f893623630f26fa212fef6b18bd1150fe409c56a4e139e7c11f76ff25c76e33b2d2e5407d89c78ec305039fb9472b863e598bf58675d34829c6bd38c01cb46bbc85bd4189da485d8d7d2401a61eb2eeb512f22b9e613a00d78e
445
AAD = e84c2a017a8be7455288383d713a8c6405c785d7e2b2040237029d1adbe7fbbdb0dd0909e6c9bff60053d59c6a996d9fac5f2be7ab1461310f21552134713909eda9dd630fa05c6cadcde1c9d88418259a895944090afb6c1bb0222f614eab073be07f7e4ecf2b2647b63a71e47561874f4f3ec447f2d815f456ecc921505d7428980b39ea533a7f5dee8ac6cfbb0c432c63cbb897cad82809bfce
446
CT = 4c4ce164f7717c32761641cbdf26a73410f15c77eaced3156382a612f3858ced93fcf977fcba2248249c70d8fd1647f66c49ed740d9d776bce8e7abbed173c44d9b60925fe462cb2421484b837a863157b1c317d8ac96eb3b78e09084a1d43522b892afd2017b70cde0a4bbc8871236073306324cfa9c5da3b9c2c9b2a6a5e606434fc7c58892336d603f82fe48b4dc5dc78b13965c3349522eae1
447
Tag = b9479044553068eebe04f3352fd10990
448
449
[Keylen = 256]
450
[IVlen = 64]
451
[PTlen = 1280]
452
[AADlen = 1280]
453
[Taglen = 128]
454
455
Count = 0
456
Key = 84a7deced81e822674d4635f7b70dc422bf3bb00c8ec4a28819365efcd3c763f
457
IV = b36e408585d89f30
458
PT = b841d8b5d125387ddcab2ba279d551bcb5f606343067b3450cf4fa8b0669b67fb5d7712916e6e4f51c68525ed91a760902e0cabda1fdc6f656b0d3318561c68d163e998513f92d07a7daf8d145196369fbcd31882e258c2d6685024bca87f6d238af02940f1686cff28400b672e55014dd0f2a4b067a9d36380a134757bf0badabf8d7370f8f775218f73adfd813e9878970ecaa3f70b36f3f558f243c25a210
459
AAD = 7638d8c95d5c2a0ee9d86cc6a484650fc98afc616b52a5d7aefb9c3d7cf4aa32538a2144eac57cf5032be27e44efe0b97788a98a4c052573dd3a83a2e7a8d10303cb2c662b96e02d5d576c2abc7a35c747eb66b27aaa1f0edc893328ab9f0b1224daea3f8e49ce5086de4cc2ba12ee6acd30ce5ec2ba3517b875b2bb4af5dad9e76e0de6c6c8e4cf838c2c6d069b77b71fb88bac91babeba24f3e7caa93e8c55
460
CT = 5bb76eee0fe2c8f08cc47d73d4e59661bb259698c694eb182903c481b82cf923db2e167259c4335fdca380902c2bc95c860fcbe32c0059c68f7368f747dc5862f97d157717cbd21e10d92189c507d8b6eb422fe3276369a35529a58c44ce63c4e0bbceee047e69336b18f47b85192baaacce3631d18242c2cdeadddedcd8b9ecc75fd27878e1fa92731dd778d8fa903dcb1c226b85c0e090bd5fbc97c041e8b6
461
Tag = 3c72cf2155c67d5b9184fd48d43c730c
462
463
[Keylen = 256]
464
[IVlen = 64]
465
[PTlen = 1320]
466
[AADlen = 1320]
467
[Taglen = 128]
468
469
Count = 0
470
Key = b7595beb31b0410a3327a9bfff8966ac87eea69fb164782361636e7444bbe30c
471
IV = 7e371328efebca54
472
PT = ee7a8a425551c2069a9e40bb0922fc6f0183d5035461b0eddfa552c4dbb9b6e5bde4e0f87796f14069bc7603e4cfa379fc1d0d93bb1101ce2e2cb3efd9a652cc022104f653e816ea3089b9d0ba69c67d91040aab40b1d156a3d8b8e92855a2df662f159696f237106ae9ca354dd8199485964b125ddf3ef89159e61944a11b9dcadea849f2916c7c7fb84a3266f620422f4bd3d5718f4c5ce5327e1e0f002ec358c492febd
473
AAD = fb9fc17421bb85f2c4bdfe2fe86a4b4d5b770b17a384cef0d8cf616f84a090b3879c6983337c4123c2953587f08938b3aa2865d477a0a134e208620cba660abb7e1a659f21c58b24902e67edb2fc8b58af3de8abf1514ae4a4640b77323338e94b6fde78c910f70939992dd0b09bf67964fc2248c138b6b4fd6070dd4a1a3624dc556a71c80b704601c16fe18153fce59432f2c28b02b7a91516e8cb5647be8b51a4587d69
474
CT = eda454eecf7407ce4328fb3da39a90b20308f066908f2b444406d5dbb48efa63b6ef1a615efcc625922c8732c946858d3865843e8988e2acbcfcdf3bfed125078552d6f88dc604f0950544e5aa21538d2144238459aa01f68229aa93f8ad071525d9a27dbd30fa66cb3189eac10676db7e2c82df4b90cd2e052afadc06c9e9b87001f6b895dd3319fe6bb1a976e68cc2843014fbb8f75d73fdedca07fb45a7cd391dee458b
475
Tag = e3004480be77556d391611d723cfa950
476
477
[Keylen = 256]
478
[IVlen = 64]
479
[PTlen = 1360]
480
[AADlen = 1360]
481
[Taglen = 128]
482
483
Count = 0
484
Key = 0502ad3c9e5d36f3e5f417d16b0ec9d5b5d6dede0ac6ddcae86f952c24d24e4c
485
IV = 49a4c1c702c0fc1e
486
PT = b5eff0529ef723542bb9b38db9c1eb7c0c65e57afeb42a7d6d508918182f21ae0ddb73238c6bc2c71ab7ea2a754f1bb80e612be2854e21bdce58750497cfab178e90d36e79c579581f81c36624b098e2fd6cdd337ed70439a89e82db2cae10c725858452aac5d6c08b8cbbbd7c5bc4044c965e515bc069861309038939199828a93cad55d54ece49aede27413856a3603f66539e10021ae88a6ae6e9f041b7dac3a95dbd4caaf2b93161
487
AAD = 3dcd362f3337766d9a3369c8ff2e92b1dc39d33047dfbf51f9485031a45251b3e595798a798e549bfc106df40fd6bed4bd1f74f20bbce137a965b22b28c4b0b047314555fddd8b4fdb12646b7c5113adf6e76ecb0d3e5955bc2ecafd823deb9e1501dfa138519240f7225a1b01d645fdb1995ffad6abfdd428a09e678c681dc3bd46d4f121e2bbb3d161c11574008da56aedd88b930de3d2805e593b76947a67580fbffabf1394ea13d9
488
CT = 00ee81c39270b2e7590dc01251b6b970788d209828a779bf047a4d87b2a98c2980a4194bb7c233be841e73dfef074633942ef0c8016a50437aebd9cf14e053272ab155d12581b16c0843acdfda00f83f82cbc569207eb9d532238da3d328923badc0e8a888ba460ee4243c8bccd7a12bd56338c57200ff93d716ab1ceba552a4253b28261ddd150475577b2e05abe70e9be4021f8d3ede0daa863a0fa9702154756860f785b3964f4f11
489
Tag = 5e451d987df461459829a63e8e7c4e45
490
491
[Keylen = 256]
492
[IVlen = 64]
493
[PTlen = 1400]
494
[AADlen = 1400]
495
[Taglen = 128]
496
497
Count = 0
498
Key = 80fdf5321e46c5994d354c57a7beae92afe72f8f111467a22eacdaa83584df31
499
IV = 1a4ad1f67e9eb51b
500
PT = a3ee446e26f4bafb37273809aed8463bd9bb688ae60a267c60ed648fb1742c54c9e5832f25a81fafe4049e5a6f9d45d2373d2d33bb7a3c7d1436c672da114f622f758e800dcf9b6cdb2607cd050d5c93ff7eb51c80d4791da1de354cfb7be84d9f4efbfe416d78eabba59cfae9c648ff4a8708df69270ecc6c4b210d8d3627fe5adb38ebda1735a802e22bed80c79811c71b933f740bb6312adb28e60f5580649cbd61e9a964c4c9c3950615629598
501
AAD = 967ecf29d2d6e1bd5d504379b92a357cf994ed29108d2c932218cabf783b19941248b5b2c3f5e629fc237b0ab477efbc8d72f5ff90217e9c88a15b707a1af410f4c892934c4c880497fef780f43b4c30d9cd00c189ba3486ec9d86f453454ea846b58e81da65c2d54338b58e2ecbdf6cbf0cf60a7075213b7ec45fd12789baa3c6eaf98d3d2e9ac6a8d1c3df6aa603c8b12d01ad2568d9ee5b76912a3cf8ca0fd69fb407b5d2ae35eb5afa12de33b4
502
CT = 2953bf6b7e5667e1cb863377717dd93968a549fa5316c360004c759821c82b8281db50b2cb830cf538125976fe65908ef03d58f254f7178e178d44c6c0f11e30266f860ab21ad81041719a338c074872eb3cbd02e4e6dc207c53f3d8c5e1fbf4c49fb3ccb97888c99c7a3af40015a8935123ef6be62f8cc1461c989589671ee18b0bd9e61bb27170d1568c0a25838c9eade1c12e310c25515c6a113157b8730df6a08cbd18b876735548fd2f9dc5a9
503
Tag = 8c9db940a999f0f3179ff54709894cb0
504
505
[Keylen = 256]
506
[IVlen = 64]
507
[PTlen = 1440]
508
[AADlen = 1440]
509
[Taglen = 128]
510
511
Count = 0
512
Key = eeacb258c978a914a59702d59542352a3d162843951fa166f0131728d9e0d997
513
IV = 5e099e960cc82293
514
PT = 00067b4e3ef4240744e9a056ab9972607c1bba021310ef37cf40fb1b717e259ce74830efe62e578abe27b8983f841c97e08f3a296780ebd514e0316cafd55199ef92fcca4c60796e6c96a7872ceacfcbdaaf7080e51ced94aec1f72371885f53ca7f2e61bf5034b1ac99188017d478c6fbfcad2a7af666d9b4e4d56960cdbb1c1dbb881835a0fc4229a3b75577ee6bb4c9e6ffbb8c0c93f4a7e42df2e11d1b09a7687d567119a6618f20948357a8c71ee47a297d
515
AAD = cda5e6ea55a75f0667cd821035bac9ba9eb8c5aadf263945f46d1f1e8f91fadb09bc45ae361d1aab954452d04652a9b68c32f29cc872f4f3d503f2da8094e10e54d3de9a8f5ca0d870574fc1f1ea6cc702c1c69d321eccc3e3b2a1fab68006bd33bca5e9484715e42319e26659c2aae119666812aa6f7b4af501bcf944c3b3dba9c5c990f72e135940689581ac6881862f48161800f26c0c161cf462c219fd4dda294f2ceb65cf1b9bc1ba55d2e8e60a64bcb2dd
516
CT = 889d17dae16c768ebec22678a5353eee3dff9bb65539a73fb595ad19ba9eb7c8bef7a5cb363f94dc81dd618b3c43763491b117595012944c67e023b86f0ee9c5ac13bf0827ca6756e5eeef02237b50f8d367c2ec9611511cde4d6eefb586072cecb7140d6e6f7be7cb3818180e95ee2c360c30c056eac9bb994713082cfc513c63a8f9abe633f468f30e94440e7df454437bf246557b75706f7d53171fbc13e0b608e8916afc70a309c94320ec6e8c376f4bf5fa
517
Tag = 6a8d14d8d843110d58819b1e7a7328bd
518
519
[Keylen = 256]
520
[IVlen = 64]
521
[PTlen = 1480]
522
[AADlen = 1480]
523
[Taglen = 128]
524
525
Count = 0
526
Key = 8436589b2b65e9930492025608978258c5ea334abe6d48621d956d5065bdc5b1
527
IV = e093a1c75a4c5b24
528
PT = f3a6fddc2bd13090e6dbcce56c7d20e8359d324964cafa1b5fcceae0924fdd674764e4b36c8ff1f34a2473f5be0666f90e97c43a890aafe8196350ea71aa9d2eef6cc240e06e7bd38d960ebec43227b3f87ce4dcfbd34efd812ea000f36dc724364756c55a2d38faf84b0ce2f1338d90559b76644449f16beacd2729036277a49e09afb3c38261e61c9fb01198c68776fb3f68c91f088970eca3f8ab8711693339d0dbbf1222faa3d577c229e6ade14d77b0fddde6c554223e
529
AAD = 6b719c80f4b249800e27f87ca12fad80cec5fca5c88007ffbfc1f31720c091ee0501f2816d3864b50385743a6bb0f1ddd08ef4ea4abf29003796ead8d684f0126c7b1339a9a9e8acd681d24060fc048269769ec8108f334de13ce49b029477ed421a5c2eb5ed1754c08237191ac6175e445e1a7f484eb58fc89fcdff894e2b90f67e5868913afd3543ba615c8ea0e79f3d3e9ac49342bf1e0ab86fc892e885e36e454ff84c6110610aa059e86ec090fb6ae8174fda067bb629
530
CT = a43fa3d4645a4d86ada353d8d7f65e4d7269e257585ff0d1a547139a08a71b697780727abbb4e169bcabb4571bb2a2880d4af531520e4de1d6b6a57bbd124bb435fe519524f327dd3d4dc77effdbf477f89cd62c9d2a206e16e4cb45621cd5cc2068560840306aede54c27ac3a09b07b527a268d091268f8d6e7a8422c200289c26321de7cc6fa70d49b17719f61dbf6c48a08378a6898d2ed0c1e1a3a6432c3b0dbb3ab79436db28a98331029a44a263b40e684e6fff9d45e
531
Tag = b9f924316c2ffb87ff7f89304af4cf20
532
533
[Keylen = 256]
534
[IVlen = 64]
535
[PTlen = 1520]
536
[AADlen = 1520]
537
[Taglen = 128]
538
539
Count = 0
540
Key = a90b3928dc5399ea14dfc9df57e0031f3fa9457da065380bc33bd85127ec2970
541
IV = e49def15365e8aa6
542
PT = 9a3283884261ffe63d4e879a76ff7aed549b38f9b35c7240cfa6c24ffd01d9068e1d95fe0fccb8d06933629aed2fb31144b7ce39a977851760ea6c1be17726846e2a3a4782ef29ff478b77327be70ff0b5f87ff3b175d3dd561ef057a8ab3a7c401bc3efd80403fd9811093ab09e0068ccb1b73ba28c65692476e8497858fabebb9f00a24c2615b89db11199a6b12cc9805f70abea85cb8a9db7064d30613f497c4fe5a9691c6cd3bdea0b7a3d5e9664c4ef21af877fd8211462c0633a10
543
AAD = 87296d957ed44e81495c62d67f4e8536af5adac233e14ee7f00f13f0819b9d62a6cff84a10603de810c8f948a3e93b25c641167e72fe97c9d48ffd5fc5efda38babc20c0bec7066919a477b7527695125432a8933b1e7ef29ff5b8036d6181090f54d451b338ffe7bfdccc7fe80401006a3df68e3207e4a3a052add3a41f9b09bf0af125003d5da42823a90773706d175d4abc6add4482e6de379d8baca80e9281ddd3fc18afc783941ab844ddb6515a754ef286427438c344170fac62d7
544
CT = bc6c391e451097c03ceafbc5759ea77fe466eadb6b837dde51aced9e85ffb8bdf56e7754ec9e2b38b5a9bc341147da970b4c68462ef1c1baa7999c4e825a0eb2f770638ea2db8f0c4e4473e47e244a227eac1aa064eedc15739b9a4ffcedfcc2c59e3aed1bbf2d60d9bba50ee56ac862a88bfd0c11cb3481c67c0d8ad48c2c4f597d271263d2cb1046d590be1de50204919ddb185665f3355e659f864e05fce6b718d14f2a5d9e2724406a6dba31c5e3c53b6f39040b55e927dab800121b
545
Tag = 437602cda5ce1e4e0ae372f6899cf6ac
546
547
[Keylen = 256]
548
[IVlen = 64]
549
[PTlen = 1560]
550
[AADlen = 1560]
551
[Taglen = 128]
552
553
Count = 0
554
Key = 5ccf00ba06a0c91f9c7d72eb10c8023c6947a11de573953152cabe7c9f66b5c9
555
IV = 7018289d58f6019e
556
PT = a69a14fd1d1e4309fd9f671321776d8fe538d6e4e552b2589b4e31f7d191aa38271d8458c3e4b0e27330fd8d6392eaab3dce2b9bd1daee25179ad9b10451e4d5e45b13702cdc1eee9edd8626bbca8a11e4033759a3d67c3a3b1459c4c2349d2d17f06c19da043113c15c84a44cdee9c2bb0191af02bc35c61787e2aab82e74b5d559edb391383d015b4531d8c2fe8d6545565d87fa10d887e42429e01c4ba05bb79362c5a148e13e033b6a1702fc4d95d737c8dfb18a82a227308f53048f97966e5f04
557
AAD = 589ea0e8ab76ebe95bcd5d4c1ee4594ce58879c2cc51d2242b0f81e06f8bac33eed346bfee6d928844cd785eb27d8f69f044abd8ec34fbb12faaa6d64d13ad16d533a8b318e12acf3eaea4e10c74aff8502aa8a8790e6535965bb3e3c89ff58653a7100135cf8ca5094c1f4e67c00774ffc83eb89a9b5ecd209ea30159038679203b9fe61428eb30226b10bed4e9a9fc84972108e2aa90dca3c8873669a6b6206250b39842a46058cc7326895079f90064dec7329f3a52890ee1724a072278c12ea492
558
CT = 87eae3220aacea4f583eceef1d8388d76b081f21d4672a4eb49671499091d8c2f5c278157a63538a2826f1c110663f10147703bd9f7bd8939b3b7a3c1977d3acd23682a9de618e8f5d2d2fc7f602b2ebecc7c26e06e2bd3414e0f42e775eba564130e2bf65694c87469f27be90477a207e99bbd6b0c767fbebd1ffb54e123119edd5219e41f8652059c52627263b7aa718fc5b7d4f4083c49dd32d69c5e4230d4867bb21dcf8c2c297d9df0998df59ccc0e2919c906524057f611a41d2797b49358ea8
559
Tag = 51c065dcf4b0ca22ee8edb6012c69eba
560
561
[Keylen = 256]
562
[IVlen = 64]
563
[PTlen = 1600]
564
[AADlen = 1600]
565
[Taglen = 128]
566
567
Count = 0
568
Key = 588c683d77cf144d564a5db3d6bde3bddac330a3461d3a73c3fc91d65304d118
569
IV = 031cd3c18b1f3862
570
PT = d2953ee77279a02b73e6819ebd0bad4fe5873ee934b94f9e833df67004ddb332d86d7d6c63c6801fa31a99732ac5e0cf0d21f9f52bb405944e42b47ff89ee9222cac34321e17d0593f0c73542a6a9209e9fec56976f0e1ac4f63581c65a678a400c19ac4a80e1a34c93069a3554c3557762076826c99ac9dc7e32f0eb3a6261d91daed5921dd8ea566013785f1063c8a1bc3b0f562b0523bf818bff692d358543cb66fee596c544f5de246c48bc4dbb52974cf900019f1b375b5fb6a2fe8fc898c8794c0e35ffc64
571
AAD = b3e1d414c76d0d49dcceae876c8970b5927a3aa08df56d3cbeb6541e4dc6b7369f0965b9cb8ec18bafb655e217767377c56c0bf68fce4206fcd81e6b6d0496c1f8a59a64de9a2264e92b0944587839cce92587fe0d7bf97d253d0637e28332a6f88ee602fce6ac38350823fe4304a329e1706f75f798f65e9adb429937b5516e04e65affc53ed32bf87e0b1efdd696ebdf4c63b0f6231ae757ac0787a408cd7a6562b56cb1c4a28400454c00422b7538ccdfd7b5b9ba20102bad1d810e12c17c6bbdab41d9076767
572
CT = 8d18e859977faad466665b5323060a86f54048b3a6b40a5fa676c0561c27a059d45152c99dd01f482f7ef9075439cb5705e3c572caee26fad4e1b1a2a96ebec34f39b96ab6244657fbedba45d7310cc77481326f628e9e0172fd1dea2bb9734e90a947edc4d361b1f3401dd6b7278a023ce6ab44555a06dbbb0ee24a31433e2d04c3d36691c847035a5cbe7857753d242a79e77933613ab60e3782edecb826eaa3bfd1f462bef33e89a347699d5ee704c7c2b37501b7e1d9dc90ddd607137202b9f9795f507ff4d4
573
Tag = 976da3b323533f8b57afe9416ec0ca1e
574
575
[Keylen = 256]
576
[IVlen = 64]
577
[PTlen = 1640]
578
[AADlen = 1640]
579
[Taglen = 128]
580
581
Count = 0
582
Key = 642603232bb2bfb68cddf3a93f07097ce65dbb63d36d170b1f24e74547fbf1be
583
IV = d4ecc1a6073f3983
584
PT = 932b7f75bc3ce09bcfc3ef29d27a99c927bbc0e395a4bb3cc982371ff7ec8e04113b52b91c7db3b0a3970d5f3ca6b1806d7c4285ee45d8c1da1bde87fea9dde6db182623f98860d8b09775cb928a19a5e286fead5f72ee5e4b2a931359cacff3707f6d81332cf2b4c22f1ab05bcc8db160456e13971c8cc87bec523ac09c4ee828471731aec8e6b781fd40baf0bc735cc59bb779468a00162ba03caa572faea40f47090da82b51b5aca62dc20215dab847dea5a9ed23344f34f1efae08fa8848f5fe7377dcd0c3bcf41fe15bf6
585
AAD = 1f9f4c63f384b443260b796c6b9f0d5ebcca37c71e07cab265368f16bb9f5d6540006c0404fde563b1682c9e79e348230d5d6ced913d3d9e77b5e5a2f146871e11aa0f4e3f0e0579b03f7cb802fe34b90b854308d4652ca3b69082cc1bcea0a9e4aba8024674274f290fd9fbf4db41c850f6fe25881287a8a8d696e7bfaf1ec8fb062bcb7b96b7832f5ce64182e6a243d1fac7c42618ccadfcbabb7a2b3debc3a701b9dd912a72239143786f00661e2fba673a40980c7cd6329b386307cca48ba0e678400d7a924f8708dbc105
586
CT = 346e737f81679ee8ffe91b814a31e688840722464e825bdfafc65fbc9ec1786909a89b019a8e05b1e38bac2f1796eaaf99752acae7abd39e9c97684963d37aac5be4a1b306fafe0e6d2af0a33403bbd6938d7a5cc13dbb09750beabc0ba148777442b21375d5a12c5aeb10f8917ffcb7733a0b9e63637f1c8bcb7ad45b0523945bbf9d22a74c3162c6b993103f9344ba290994f09b8913a3a76bdfc07280e52ba1dd61b070b448f9c867f38d9730ffeba3a4ce91752f4437a990904e3bd6bdb43530f9ff907bacd0348af6c2a0
587
Tag = dea034b6694eacccd5af9aaf242ef5fd
588
589
[Keylen = 256]
590
[IVlen = 64]
591
[PTlen = 1680]
592
[AADlen = 1680]
593
[Taglen = 128]
594
595
Count = 0
596
Key = b968c06538a07e747e43a3615f558d0932db9d599294cea4f143a3848c0ed051
597
IV = a0a1aa452063fe09
598
PT = 0cd92cf2ba7e5cc0e64f896bfc7ea702bfcc97eb930e3643725035db33f61a6610c9ef7b241629886b2641f93a1d626e9ff6685107507c37bd5e0578bc9a70dc808a0b3e231655a2cc6a54afa211d81ea4473fb16768426edb1d960e7b92a695a016b500a9f37d280942ac85c33566345353d47081209288e449b75328b03c543bf74d2dad812ba0e33750f535c2b78308fe4d0a84ded50f7ffaa7abd50de30adc0cff9c05fbc5483d5e7f7408ea8d16cf92b50daf75a36c763d737dd25e7c71f46950248291c49b6186d0f65267291be750
599
AAD = 34524d311dee96b1ca17678952fe130ce1e1f52a7246c3ec7094edb38493f9258366de1a16165da65ac8324117ab50ba81b6f4dbfd335e14a6c09d31bfb84a63918a8ab1bb6b3021a0c2115532a0b37c7944ccc335cca28cec0788051df428d6112e2b812419bd9dbd86b3d41c62ade56739a502ee7f1a744bf8e8df77b4c7239436742c26d141438db030f6c0217c166d32bb014b928da3ea394352fa085f2a9d794aad02c176f65e380c7e756348114512b15c59dbacd7983f69105095731b1243c752f0b7424cf3977633297d24e4819e
600
CT = 01ec19e470cc6f273fa74f2098dda65cc1d169b599cab9c6e65059b0d6f3d1735a5b742bcb9ba87016b117d4339473ee50b69fff191b3c55454215373d69a466dbc835671ebddff26e487287d886dd9be12ddcf0efb9a727d3caa7087b97e156299622345e1dd2851d8692bffc987574190a60e25323afdaccb9adb25a966fe248966d6c8a4d22b321724c2af6a2f8dff50108a0c817ed43a7777de06212ab24e0c6e757489f24a1ced2921e2358fd5f28a5fc3d3b049b73869509b1a7dcaf18b4c61973bd4268e34d1b6a724b1a070820b5
601
Tag = 4eaea6244cf697c8143e3ad58139fb48
602
603
[Keylen = 256]
604
[IVlen = 64]
605
[PTlen = 1720]
606
[AADlen = 1720]
607
[Taglen = 128]
608
609
Count = 0
610
Key = 2f0b94fcc95c98d788494cf14ec3edf3fc02d91f357d1aa2260007b29442a9c7
611
IV = d71703771cec7c3a
612
PT = 49159438356b44899ba959d5c70f2b99ae7823c06057d883710aebfce18df04bfa5650792af630c4bc39db86d489b15566dafcd599a0c65ae96d431e0b10514a0e342842f86251490728c2a5807c3bdfce63bc71c06a9c3ae8943c897de5360d91b53cd7f094f594b4895017e6993ce161fe2a321cfa07bedfaf45728b7068eb52ec527e64534d6a5c1c1848cf49628fc5e1b358a5ef92255ba6935372049c7fb2e4be2609d77c68c801c4f22c834152bf9439c77a79dab5b89692b9c73e26aa9afec8a419601ae00179dddd6f7ec413915915a3d472ec
613
AAD = 1bdb4944ddd59286e776f8f6ca1ec21bac35adc0d90f28b76298d166e2d9f2c1655bc3b7727e2ba1751456ff76084f2c3c5ee527a00e360ae060993493d80ed8de7baad8c8c75b11b8e6a81aa787dd4bc7d9bd984125c4057a8ab0f8cf4434207e66c3dd807eaa3c81f2eb798cbf75cc445de5c46ccb4a3bb9a8b83b812df39dd03ee23a66e36924627aabb030260df22358e874de1bcfb641fa9026bdaab6304eac6a208259f9297b220da7a3444dbaf5ed75b98d87906e4181c990e4a42c44e1bbac22620960a377f9040e4387e1e254b29738b596a4
614
CT = aa63c0cbd034d39cd3498f1b8391fbd5887f07e8c8fabc6b67006ceb5d10eb374ae35739e31251abefad0423ae555cc5f3e25d764aae2ca40228bb1514fad320432406dcdc407f4e50e9f4a11d57115cf0d5af6e5aa9884f4befcb61e44eca0554e88a010a5db17e70d796997c28eadf24b01a61ec50954681348d729a370053f65ccb62caf1df8f219b346736214d178719baa7e4c99ba7ec350ea351f0f1d9bc3e5effbb5fdf951a6e66eaa13bfa40b16e3c91d7059add4947e28cdf4ccbc8cff439a37fb02475922201f36d853cc49ef782774dfe20
615
Tag = 807e3dca3c745cfd0d3868bb000742bb
616
617
[Keylen = 256]
618
[IVlen = 64]
619
[PTlen = 1760]
620
[AADlen = 1760]
621
[Taglen = 128]
622
623
Count = 0
624
Key = be480ca21763de5487f622c1e3061d4c08fe941af0f36303089ab3633a3ae744
625
IV = c47ee8317eb2b62b
626
PT = e4a65a978981a9da63f3c5e3ddc58d24e141056d58fcb3f7dbde0ced6317325797ee9c00784cf204fea4e9fc284cddb288c07b58fc468601a7b4b0918efcce16b8cfc894ca464a5a773dc61e4e1ae533bd0a0841fc1683c6437fa4f75581d42a16adeb43cff8ce148d9503462e9d95ff9a504a594bfb9adcf1b4337a02d494e2b53aea83aa6d002a6f4ea47439c021b6b93b9a71b715676c4f87f1f5c1449562febfb05a861ee2c8f49ad64c0ffd1d5e63881770ea6cc759ff93640d9d92a042526f8ace19afb70c429d34643724b8eafbeb929e6b025e9558f614f5
627
AAD = fa736361959a7a7c34f9d7a7c9c6d72c331f4717c0f911a85cdc02e234009e2901402b5d49d9d86c01a777e64f298e900829035497d885347cc31d4d9d95e1691e364d04c15106fa3457965358b628cd4c9679c567239e548b10ab076587d623d7b611888c32cc92596589eff25c80f53122d0b107cf1733df0fe9c2d70401fd24a22020b1433acc7a0ff88cad5f23c6546a8bc668a3fef0b600c4459fae525232dad184e785e47ed964bbde9b499b4c3bf1225b9aad15788e891c61e2d1e58aa858637a9cae2faa911db5360943259a25ec14e3bf8d74082c63be08
628
CT = ca88c7cb402ceed3a4b5c0cf5ac69c30876756ade17f10c1aa8e0cdf3d8bd468f1de8e12f05aac1b1e0413cbf202fc5a71642faea41609ad28251e64d5f0033cb44dc15bfafc9b5b8555e7e23b018d75a2df7500be2ef75b6ad42b455eab9b8bda5cc0232d34f7d605854ea360ca8b194a52fe1cd1fefd0a1e520015068c93275be9b401377014f71979ca963b315a4d2511ca1b6967c7d5410e579c8ba4c8199ef05ff9fd3c0b805974ece2a26852c10136e2ea695c677544b1349b389447286ac0886b80afe11e56f561d51d6a248a0191141a1723449e0aa491e8
629
Tag = 4fa94b519b21c1f31bf0b02c3a2f82aa
630
631
[Keylen = 256]
632
[IVlen = 64]
633
[PTlen = 1800]
634
[AADlen = 1800]
635
[Taglen = 128]
636
637
Count = 0
638
Key = 25eccf340ed47ec149e8d81f461be9121423f48d0d825d090d7cf82a4a698f12
639
IV = 9d468ac312becd10
640
PT = 624291d64399703672650169325b5f8633672677a2511a88f75d9b02e2b492842ef06eeefe1d99ccb870c0e4875a7d4feb0f59d2bff57548a4004a84bbcf4e508157ccd67c19233a8d200bbdf805521f07a83cd301c783d8e440d1bffb1a953c7b54687a4321c049d60dc88ffed3d3aa7fa4f6d8636cd85dbc71a5fd41e98ed9d191cf51f8028c81c9d1f8fe8db93a0c889b03b8eb0944ebf7b15c1ed6bcc76c99562c42cde52f8b18fc4bfb1fada027f12aefbee9d7b858e0cb94f9d6d13aae9b4fc1c65c2fc2d1c26b0daf47b73bfbed7bb4774df618a0235bfe77f3c939677f
641
AAD = 82d1e304e564d4b699a946a99b4af35095d3d46503b93820b244e1e429d986be7796e1b91956b8654d1b21f85a31ef7ef352d731424f0f0d245e731d713d51046e40dd92784dc7a35cc0fe0c750dd30414f7255c490688d1c54ffe3bc9abcddb4f7f4052afd384f6ee83d2c2f56f45e1964f5a6c285dd4c75312b3bb7fe9787abd5a331cd2c878f81799fef7d340b5946c6733e6bc3e79770fac1176a2c354c8a277dfd54eaeca462adc16d5f9711336c7f9a59212380f57ccea003b25584d1c88f0df5008bde7e341190d36c98f4a56967e75968cf2c698c204b3edaef495492a
642
CT = 22c745adeb7ed0de377de8f0b31a51436820d3b3f8a34db18ee4292f8316f90065007bc1a7bedbc8dcf5b23f5777ade58a12f320bc632a144c5768353f6577bac4b718edca244763054bb33f7d23a519acecaed0d31562dd0e4db215d3e32c4060a40502159253f7e79e0d50f98de317c0419bd4133a03dbc104f4ab2bc7eef3a23e4c9cb9b08f97647085295f9073e5ff6c7fdada021704716eeb12c3a0582141e1a1f20f8fac639eb4b513b5eb66738885b537171919e7adbf37a235b92c58e52be1c9acafb54e97099bd51342650c2f1e595be36d25e7cdc92996b3e9595e17
643
Tag = 1ee3254758750099c6f08c877904136f
644
645
[Keylen = 256]
646
[IVlen = 64]
647
[PTlen = 1840]
648
[AADlen = 1840]
649
[Taglen = 128]
650
651
Count = 0
652
Key = a4808dde82ed8cec58d3efa8fc4d20624618f984e61d3dd799a020c62927126f
653
IV = fc3c87d629ef9c53
654
PT = 01b59bb55083371c1c6356bcaa69ca9929ace25a4d4152dfe488ed917835f50b3931bcdfae7d2468cb500883bd8521f15f0114a17d66008531e1f6bfbeb189dee34b24654b281fa8d7f1c667b0ca8456f14e523d5dccb379353f99b9d2c1b85b9264eeeef77a0640d4ee878a0b04135e1b1a97aa7fa4e8f3158a7d278c8781bfb2c6d962ab21aa5a898cd792dc07749acbeca65ccfdf2e306c57b81701f031e1e9f2b3f1cd39b5f2f977a83c12eea28654b600c21f1955594cf5120777a2a43012f470fef617b7df9e0f468fadb4f0f844bdd1b46525d9a92334de8ed8eec217fe9e67f9bbfd
655
AAD = f68bc6e008ad80a96de94fa8d3d6915752251f3060ae4329ddc68308c4ca3aa72d21b7dabb6790707b8296cdc46cf5c18a61013305b519dcc2cc654c29b426a9b985f665365a7419a6edb240ccc5877f48c9f22ba9d1e6ce3cd1dcc3ec01e0b5d19edabe900a478ebeaaa85848e675eab3c7c64566a0f71f57f7545381469f2a20b77e0527673c3973113545af14540204bb9e77589854925b54072b342a9592e374f91d872aadefcf00e2e896682b156dddadb8c3a38eb87ddad78e78d543bee2f2a2450179faf1991c1fab33d094d4bc6a2b49ba27eb40e7a785306acff88aa2b0813ce29f
656
CT = 92dc167715ec0f1c6285f11ffc5eceb23c8a85c101224b19b93a7c2fa448e0bd8ae362cecfb3349c0bf31eb0005306566e6ce89487abb286b48b04f456479e431d6710bb6bd9ad72b6e886f140b3b4e0d3acf7bf54b310ead637e4e475a179c035a831a68838d54993a4223615389a5d986013d64054501ad8ee74047d33969dd7a202ee3107621d6303a5e24243cc5fbac5e8570ec7cb9c7d3394aabae5ca554ad3767bcb13cbbffc1e9e0c076b1fb09d6e171ef6aa5fa61c7cadd9fcf6f7e38bb062c1e6c1b10d3353c3096b64c6870d50e0da3133333c4b6baa81a0049f7bc7a602f8e611
657
Tag = 12c1cf240c9f1099244ab4fcc8e155ab
658
659
[Keylen = 256]
660
[IVlen = 64]
661
[PTlen = 1880]
662
[AADlen = 1880]
663
[Taglen = 128]
664
665
Count = 0
666
Key = 15f7db2aff739b70ecfae196019995585912586a54f9dc600b12d541dc0b84cc
667
IV = 88371b281cc8f954
668
PT = 86d4de986f725357f0f9e8ff10ca11306a4573d250b71ce1a6a410167385eadd82aa5291d6471ee9583eb14be5682044c228b0a47965fdda7221a0d770dc705d1a83fa54004d3f310f73881baacfbcee6d3106f11f74ca31e01644c70bc31a87d72272bb3e56e2b76fe5bbe5c863ad303cd70d68cbe0cf47c297a3025d16bfa1af7c08a1f4607226e3ba997b361683b3b9d930f1611e6fe4964653ccfdd0c4bff9ca584c8c079e4a65b21d3ea745417895a478865f103b0d85cb15d4021f8389250e0d76dc7e509b5e419ea52ee6c45f9b2de25acec227dce42408aa98f71da98b4e5ebe89babd3f13c29e
669
AAD = 10ae3a20752be26d823b5a69a2e85d7186a5125a29f9e3ddd5d805bec1f3e982e78cd31ae4764fd2da9bf8cef303735f72728f6174ca4aa8e5dec1646ca9ba60f90ef44c2df93acd645473786ad67a285690efff836cb60850129924d7372b739316da9cc0758d9d4242ce83aec98f48fd97529575d758aea261cdc6f00d197f140517dba07d64649c6028bce0b3cb782e7c0e562026b02a1b66329b093fc22b50bcaadd20edc79eede3a246dec9e98b37aca16b80b1c3f9f27871dffd0d8ee426e0aa630ef2e3d4d8d6209d44930b2e7568308deeabdfa6ad420f3887715502cb91e04294a4d42286155c
670
CT = c583c6e5ccf6645301dfc711e4f8d3408f52a65a0324fda699fc4e4cc96a782c824f6ebd9b6471114c4b8524470cfa6a73d3454a5ce27ceac6ed541f4254db3e8d80135c78996307c10fb8cbdca8b92b04e1d749243a9fa77b45e84fb2e23e61a59f78609e6a0e0e85b01f70fddf45490fff040b460f6ad2a018d78d303f8b1fa9b445ea41da8cf99d8ff359d28ad17ce424dafd8e9a35d60a9c717c47d32710d0f50240755bac827353dc1b95ff3ebc95495b20e6905293c3be26928d08f0caa6263f251ae7e7a923f78a2e1e22e672bbeecc1dabbd3f32b7787e7bf30f2db5640bc61067d2e8d3137324
671
Tag = 7f6eb4d23c7e8454732e85eb67677866
672
673
[Keylen = 256]
674
[IVlen = 64]
675
[PTlen = 1920]
676
[AADlen = 1920]
677
[Taglen = 128]
678
679
Count = 0
680
Key = ea30a719a649ea235f34620d4118b7c6bc09ac09e66f9cb15757591a3aa4c265
681
IV = 0e28a7a60e4c734a
682
PT = 7c68bd93ce2864717e7dd2920bca980ba371797f2b0c4ad3e1ec582604ee07c58ca0e9b221c9e53645202ab41815712e72819528ae299307d141f9294a0240ea05ddc787706c54edf47ffa8e40d7f011f70f0a68b0d8ee2bd982b7f38c95c2439d91b8502b27f779bba078493345a55dd00860d2b4e5266b62ad3be9db3436d85e06162c5501ba16a269b9ebaa64aaf3b7e8bbe105305fea0e5e21561dac76306b1986e3d294e78ad66614ddec0197f7ad4e4d74e5efc197235b0aa4ca21c1adfb98f3ba479d34157ab806a8dfec1877ebec7d720a78a294e4033de3b38d23d351609cbf3db641888c8f5c6788a97640
683
AAD = a7c9f242f1ddc51b57e2e36cc098c0887a192c20939ab3aead166b6959c0c8a026592e092302f94adac49093f48b5808d734a694639cb4f2d3d559cb9183eb97291f83398f1721384955e0e092b7821f69d3773a851682e739dd977a75441203baaed70b340cb102b35ac426ca14ba750c10ac4cba9068ea0d60b6cf7ea15edfc737c50405d0bed3a013b8dbe663da1a5bf740d321ae7bd5112176ae5e0345fe2d224499a6de4cfa320f6e06a0870cb429b47a6458d6ac8af31ce3d315113c575288a96b982da3b318b3c1294e6a2e04940924114944bc0fd3baa9d902e6e167273c2644ae678186beebf6cd877bbfea
684
CT = 104a31d12e03be0b4f04e10cf22c4659c3967dd925dbe5279f6445646ec6b109d20572c3c6e748f412ec4c4bb48db539c54217ad81f48e863caf436f44d1f576eed2d27abc5ff0ac506aa31a5136b3edf60950f2e83fa634208d717798003b6ed3897b919e89d1dbf00b26afb41dd05b8f547f83bfd45e923a5ef461729f1af4af6034c78244276c23356ffd1300d3a0e976533b678e39b098d7d8ff741d77bb139e9182e94f5cf1c4f0d7e9ac24e9d8016012216e57b56f64012c3f94ca986dba4fe6126f148efc46e851bf64dd8e72d46b739852c5d7d42205cabbb8a86495d9ff69b4db1777e7584c664d8e662bcd
685
Tag = f602111fb518f3df114ea8d7c3a7264d
686
687
[Keylen = 256]
688
[IVlen = 64]
689
[PTlen = 1960]
690
[AADlen = 1960]
691
[Taglen = 128]
692
693
Count = 0
694
Key = cbf60711fcf730fff0a6ff27bd8532604257853af47bdd83b176a267c82991c7
695
IV = e41013b662f14f82
696
PT = 5887d627b13284bdd11193636b08fd4c3e77086a4fe0ffbc14e1659e8bd708d247c2dfaacfd11442abb0f3d24b57866a34857a17a2b2b23d1e3c2ba1bef7085eac7cb8c8ed05fe7e24f608052b74d20513b28af8cd98751d25189a403e7663f15c84e68f767dc6371bb8ab367e5d06c5d052fafb0f77b762dd076b6a2c2482de4877f6afe8f268bea0af8942fd41f60befd9cd93b42fff3728ce0765f14228ebaea1b98c3655e931317668efbba77ced0afa3cb72dbc2526a440cec7156ce0eb755b3cd2717d4422ce9b6fac87c559caa4fb75dda15508ff564a6e77a29bd4f0382e0a006c623acd025a77f81d64a84a283cfc5335
697
AAD = e4d401862817e3620ab05dfe0fef4744fb3f218a8e50ae2b400e2f198e33bb8db79cb7656d3e7be536c0767030b6a41b4776b473bf7d9b632cd23e36336055f01592d2fbb047147fd311e60d66ba2dd6c09ef00146991d6d29d70f1edcc3e75dacd6f69b2ac8ad43e7dd296c925f99e29b71ef37bff096445c3c048f21ab6b8664495a1f4946e2ce44cbf3acdf49c486e4298b5563c7721fd23b342ec9070fe77066aa62fc184217c31187ceb76a10522dd335fce556538b4bcfacefab265b3893ed9e690d82dc3f21934815abbc4923ff5bf7272edb3a9b6177a13a0df6f51851bb7962462ea3b8693bf28b108e9cdeba4425a6f4
698
CT = 2d694d9633844f1db70d17884af7dd6ff07b8ca191a861598263af55193afa5709996e4caaf3c76597f092311fd91cd574844c3ec769198aee6efbb4a75d27c374fed8351e03cc6452f6d0df70dbfc61b6a4d19e8e642cbf4e54bbfa302a7bce3a9ea5c8ae25a49eadfbc3caffc2a97ffeec6adc991ec6a8408fdab391febf32156a390ba08f36bf580c8cb7f154ad63624911a08a74c93d76caf37b9acb2ff3cf63a289ab4330313df1644e0325f1748ed9e729192ed097c34ca79db9ed524759abc8ce86b3fedc2dfaffd3616fff19b2919823afd69a9ef6a236680efb58dff3122080bfc652ba26556afba9aa319b545bb32099
699
Tag = 2a82623980188907a21401646366852d
700
701
[Keylen = 256]
702
[IVlen = 64]
703
[PTlen = 2000]
704
[AADlen = 2000]
705
[Taglen = 128]
706
707
Count = 0
708
Key = aae3c4ba69469762149939fc53cf05e2914796f6d1d1dc2ad9f76887343a67e4
709
IV = fcce99fa94123c89
710
PT = 0a5aaa90a6004cd6428fab09f85e404d139973cb3f7b4aed314f3627a066c6ca667276af9cdd16d35fbe1c32a649f181e15019d45a42eeac2532e8d9e2b76cb507386f82215e07258e42ed6b3157816855ad9d1f13098973537bd0a732f92bf8de4df4b17737089b5e1bd7dc8c9f9645c2e81502b39c9d3c0a07021dd73eee2bf35fe28519b8bd6acc32451d1a7d72cd6eb7ac927de5ab55024ed827f06ae3458a5a9636a66afb4312ed85b0ca4142e59c692e2299c46849aab3ca167736e4e26e1fd21777a1e4ca88454feb8ecfe69c617650bae64f27ccbbae94637401a9bb7f0f4b707037c68ce15c121b729a8a06d0b8b6dbd74ae0eca4dd
711
AAD = 6708e2f52ad2c1ad24facee289eed3a343f5a68d52f155f46daedd343129fd39c4e7598e2e63a04a0a251c579759eb3ee6f1f4a39f8a2c059c592573039c602b73d756e6f57d2c9ebd9f1507b55f528ca54f0b95a467771bbfccd2d35dbfb8dc490ea1bfb2c62aec9f4f5efc6d608d26d25e7469c6bd47f36feeba450c211e2efa3266f18b8c0a21a9bd32742939701a12debdb92ee49448ae7ad362f0c3b42103e26843a73d54c626cc19da078547a328bba750be7cb0881b268b58059ab4e70673be63dd6626e0e9d1b881214a7d0c8513b353f23fa380d828fb04355d365c3a9efa98afd3c96bdeb5d02787aeb63eda439da086990d51394f
712
CT = c2295634bf63bf3a28b018d2d809f8c01423ed4217933005a0204be572e9f28f49f636dd10e1466444e271e1bf0bb9a3c874a2d5535cbdc77ed178fd398b25d753fd01b1f0b224d50614d88fce5887f4b17c9f3119b06eae0ca000a63f907a5a6cd328e962f07b213794d13a3ed303275ca0ec622fdeb76d08d83c981d6c178189e246f355ced2a46596c5d09c81cac4c5a2a2244758e3d8bf95bafcfc07e546db12b293487418599e5e615943f6afa648551d0ab45e81d2b565067681977e3435c5d034f973f4db9f4eace95ee630b6421f37a5590bfd2a9d9380c9da793ee441aa1edbe65824683e15b6b217012d50d937ba84055b7c61d148
713
Tag = 9fb68bc132294a8cf6dc5830e04f1061
714
715
[Keylen = 256]
716
[IVlen = 64]
717
[PTlen = 2040]
718
[AADlen = 2040]
719
[Taglen = 128]
720
721
Count = 0
722
Key = 736e1f8f96035aed0e8624a510c606c7a5b9a20b906c23a9fa971e14eb7362a5
723
IV = 19d4577a77b663af
724
PT = 0979a923dae45f2e1013c9e13a672838ea90b4b7083b4ff44e727b94b0a72311986beb28ba1b2f070e084ff0618dbfe41c077e5ce1d7ff7053b09b98d974d3b3f689fa3894313a2534dcf4defb8b5c4d5cd4e0225e6867deca785b886492a185b9f8fc95ccce1e26c0d6e4eddfd6696fe17e147e56ba788da3d14aff73bc34d2e54057fc8db662c69654d2d26ced608049fd43f6ee7abbb2a4f7c3b7f97493ed9a39649818124e7de294798f1f1692ccea0c2e6d0e382589582abc72408831e89a9ece4536b07772210e0e539b6df23ad14b1d7f08c9a4fd9c50887f824eb575e04bfa16055855d8a77c43721cab680d8dac4b734b8f43e5f1e53343adcd0f
725
AAD = b5309e5f760d867478a51f31ee3705d5a0c97156e7849472d5dcbc4aeab8175d352a6df223fae34c5ea615ce85af43c099ee5caaf1b3aee003fc64ed3cae58887b056f0a93f9b6e3f7fba31ad59311db84b6257a2a89be875bb085040ead911406837a77836be92ed56c7e4e2662ccd8609e78d5c55f195fec8e26b0e1738c2433ee9011487ada619aad469f58fbd4767f919823f4eac99d6255a32f2da9e572cafdb6af53a0b3585e67bf5271074f89a01f6edcf061130468692d76c0e48144ac638bf836cd48bb7e06388f9b76f4e52a497215e66eb60ae493e4de6c2619a8e589f4fdce60b7df1d72f1e2efa62ef4ce491610a82635d562d7a5e091055f
726
CT = 5a2eaec9aa17c89dcfa115e39a464b9302e7f1099d15e9efdac5159a647512c4078cb8de307f2ea44586c4db04db4a7646c67bbdf177a9ba971060a47780604c733bd3815a457d9f812699515be5ef958edcb13951be047fce51266747b65079f0fe6fcf59b5636d1885a94160319c74fa35eeff7bc6c6e62279a785a8caa30ef8f269f0ced3a2df72a22af8718c56de41eba7a6ef46fad56c09050e3a737afcb465a1f05d82a2e0c41dc493dfc070c7fa54ea8a54e8cefa1e7a536b611100b2b4903c064d18f9e9f2235ca7c7be3be260a5c97e2641e5e1f5b2f096a0cfd712a2f2c0ac22bb8e891f4c089e9e023d1045efa39355a819306dc424af3d1bd3
727
Tag = 26efafa0c682e056b1e91c8566dfa00b
728
729
[Keylen = 256]
730
[IVlen = 64]
731
[PTlen = 2080]
732
[AADlen = 2080]
733
[Taglen = 128]
734
735
Count = 0
736
Key = 6064e5b50a7990875a0584b678cb0e0f6c3079d15b34a42ff89cea53abbb76e2
737
IV = 124a2b16b4ca93ca
738
PT = 8f3b7821c368e4d5a20dd438bee99c3336daa8401c75144a4ddb17f027a3032fd9501ef6362179575c9c17b83911b34c28057a8becdebe1c20dbfa6908135ef0c92d3c8be717035129bbb71d10845abb08b4eb256fe8f0ce459c0f0fdec43d77078e53fc5c23c664b68e3a00d3f94eb3ab008943e235a5cbea3c4698fee058082a934b5a811bfc08cba8003461a62907daba4320f6de1b30c8b696cf552f524e935261dbd9b60cbefad3467276a925446b224c4ed4a40bbfd0814b6b6c843f4c1404d42df0edefdeac3a773f32c21f97e4a94af0cb7855d0d589968e5c452b6c8c7a61fa18a343a61045a64fbc0c3bad0d448e9d5f166ffffe55cd9d460d3751b4b857c5
739
AAD = 72174da3464bf0484bfccd3c2457b388feb71f985e223a20147354435b8b4819f25b6df2ec5153f878fbb6ebfdb08f162885238632c5ac6ed312e50bf98efe3bfaa1d069c929a9fddcda76be321de8cb3621d0f00470cb04956f421d23e5e36025f3ac0ff4a0b0680f9ab47f0fa3320bed0e5e221b1f4b3a024ec7763d2ed76c42b8ee77ed52f8f308e8256fc3de09edda31dbdc03da12978fb017ab4f7064e3026b7115b24f405695ecf54efa26680f0076c37cfae2572171b42eb933bd405f61b0bf9db5ff1cfb0d9486538c51b7d3c2375fc5674658fd953b063b1a468ec7325e8a0df7d82b22e5754c81229783960d9866edc3ef0d3259d1932d767a234949f81664
740
CT = 451b1dfd6863fb67b4d9c2bca7bb018159516b93b15c78a0b6f7119fe7691ea7016964592587225b8fe60f1ee349148204e629e1784301a659a82712528661f63e1677daad544d544c7f5055a9bc7da5b52746cdee52acdc37e4373a196cb53782255e4598897a94ff24afba690a7dedfc2c9e7bd903ee131ad3cc8cc61575202b0a85bd1d3fa701af2c63b18be7e6e9dc5a7dfe61757a82a4c7064c4b78f4e6c5f3c89a731b886581f4822be510d5699b097f52fd839d4f0df49cbd81a623e1291a4254c85e1ce7cb2742cad0a07ddd30d08efa4119190f0f64b65ab189fce9a6dc907bfde29877a70f1aa6cd68665d7c0675b934cfd5c37297d4ee1e0274b1f7a72f61
741
Tag = 9c68fe1709bb42fe2d78f703812995e6
742
743
[Keylen = 256]
744
[IVlen = 64]
745
[PTlen = 2120]
746
[AADlen = 2120]
747
[Taglen = 128]
748
749
Count = 0
750
Key = 99e1a9639b3626e5f8f5f62653634289c5af5db5be09b0ecf4a4a64f26923b06
751
IV = e3437d4ed2bd88eb
752
PT = f069442e6419c6bdd9d9f8dce7c8720ac7103f5c03007dab4d72869828199a704040381406ad88d0ef5b8bba7fed1835f79484fe9ec74be893b5be82a6fa82aa674f0f6974e1859294eaed815e035683064d5e69b4bbbe59ec5a241bf38b5bb87a63d9e17183bae6da95978298b6e8d5072b7ed42d899f7f78b9f94907b72535f9ed870ff70972a830ae0023088e8b914c1d14916b9fef8beeba9d35ec1933a51522a9d0f51ce159ab0b24b1239659499ea418eada5d94becb44dcc3f87a6ce6a31bda01850f693381aab4ddb5a74ff6a1e3b59e71ce4367a56e55ad1e9f47aeeb4c31b073e2f36e4fa3a1bc29e74d15fff9a4c919af174e8c9fad2fe6fc1b8574a4715e2f23928b75
753
AAD = 1470acbb2a3ee86c7059b4ffcd4fe8f30b762f2f213de0c0acf85635641b2aeef82b959a76f5afc5c026d7d3fb46a213c715717db626cd042f3fdc832c6dfe5dfddce7b60f2e3cf23491508ab1a93fdd69b377a86cd84d5f8d4ad6a1f4f0b25b3fc1b4496388dd577075878e197b97bcb2bd3a9663a56d6dcf64700d6f14b99a2b4f79a3d968445daea348f1c7b487b3c09d6db0907c93dd3776b60b24a9c29b2b5bc780c76e407b41c616bd6e81ddee81d2b7c973ca88c817a8c6d090a51055f89de55648a0aca99823142ca704cd651812efdef01b1ab1960c1e315d237e5817b66b0bf3d1c8de481c50fe181462a0435d128e7393ee054173b8f95566874ccd69811319e035f566
754
CT = 6e039109bf9628798bcf0a8af125f0a14ed3e674aede2f9c6bb87ed0de4ff27c0e80dc79ef34c46e8bc80543de84b4a15a06d44f74a8633c13d3c86efdf6acfc90461754a0a8379aa943390b1fd3716ea8366da8b55e5c5711ba1cf81cb3e98c70983fc3f118157b6c7152b19c5eda175497fbc0a82baafd97377825a87a645794e68c256d97072e92e087252c8c3c00970bbe2299d1fa151ce655fabed48ab321293f29347d02b55de6fb8de3b19df52dca95f26dc32afd8a892e559be0999fcc4a04c2dcb314423289808ac4d29880951295d334ede505cd2a541337a38012924b77fe08dbc59d2bf7513d656663ffb91a1f21681181094342d50029924bb2deac2bc91638a287cd
755
Tag = 6d3267c36f51f1d7a9f423856e634fd5
756
757
[Keylen = 256]
758
[IVlen = 64]
759
[PTlen = 2160]
760
[AADlen = 2160]
761
[Taglen = 128]
762
763
Count = 0
764
Key = 4bd065e24e18e751e842d317e3d334cab0ca51adafd936925e669b1457731a4d
765
IV = 8e2ca638f2749e1a
766
PT = 56a78816003a1bdf6850234eab5f5f015cd6a37f9fe241af3ffb657190bbdfefd1d3c988332b9b6fa649d0635b2a0a0353302d34400ae23ff0f5bad322d4cdf9e974ce6b491478edd87beb3cb632272f2a9ca10827b6a751c43a789edab22e8d786d5da76bcaf607a0760ba98ae4a599dcea7b1ebd9944920d6c6a399b0904aef9c7e1e47580e4a2c66002763cbe9fbde1cb9e6dc951021d80d9629cea62a370c3a23a6b2fd532cb6e81acfe34a3392ffc77c53c9e35761fae4ecec0c5f99a0a2e315662b965a8a91829b4eb7c251600d2744cfdeb9b20900f686f9e4a781a81b2377a0752b49f0dfe629381bcde74699e00b93ce966cc437a8e88ab726866f90c53dbd6d277035fbd613fd90c60
767
AAD = 6bbe4c575420c00c9cbdc4c19e109388407813fbb085c6cc861483bbb2f27c2582099fc7bc4af9b3049e224a3b3ff90035f4e0d877f8964826efa6ff24f3d8a4bb4f2434049c2806c221a90a40fb081b40721aee37e299c8b0b2ac129ebd2c5faea4af413054fbb792bfd66a3f43827c6bcd0463bff2d6c10cb4049d7dca6fcf79a7d943bec0d67d47059a0ad914325c55c117fa458a68f276516f145a9732d373501a9a7b63e9eb2357538c7437ff2cee829230ae080d6fa78b34fdc9c1ec10cb07cc14aa46bb6a221647533d4276693cc4a2706f3b9d97bc3100bfb8b69f4f1181942159ee6afa81f1c48675cc10a55898f9c0d13a6f1578b1a7bae2c30050e63b221c8fc649a6e6e5abe3f821
768
CT = ef208bea34340d70dd07ed99e99cbf954161776209c0c4fb8e8926cac4e151c22c1ba656c653dcbacd599b467c07d497a475cc1dcadab3e33f9d3e97f6c081352f1ff48855b0c5b6a689ec7cc311e1557647962e49626fe37c89944148cfcb0d2241e0103a456732a6a93f8db661ae985deb5594551389461557e0694929537a4e0bcc15683005cb5e1fb4fb0bdabd3d5b026b3e993d37d330b407a5f87596f1ce040cfea233383401e62cd39a0efda5261988e89dead8bb6fd39a9a2c13133f0c419bad3714ea8c024a5e8b96baea7ef10a068832329c614c02014d85f174bc2ddcaa74ee6b4fad59e9f64f445e100a0f9e99dd8aa003741466ce4a57ca9408557e5deacf9cc69653160e6714f8
769
Tag = 678295fb59c8fad6b870a9aabba786e8
770
771
[Keylen = 256]
772
[IVlen = 64]
773
[PTlen = 2200]
774
[AADlen = 2200]
775
[Taglen = 128]
776
777
Count = 0
778
Key = 22c030ebadfb16204b4e2532cb66d9e0662b209332c4c2f1204508c91aac6b69
779
IV = b986e30379be9dcc
780
PT = 6423e080e33fbe81ea3178487616946540680daa26fa51b75cf7be6fdd0bdf975233955a2542d66760cec4550ba8d8263ccbf84cab43fd05a72c4b5b3e4766ad9a257a78c96ce36cbfe7a15952822ebc842b22ee2d90ed99c86d6dcfd8ec78269fadceb82a07034bc56a959277116712c69f6d40da560d908252c72042e4d54f7f059981e2ceabdc9a13edd017744d0e0622ed5361d1832346b729e80bcc97c40d07267cb894aa74e1c14778c6f7684b328a0cd2eb877134db4083bd1f504a6f095cd0b8341a81bfa38b55179aaf118e2958e402ef3a607cca0b4e20b31c99cb671a17fa24b3173284c0aa8cbe3a417e2d5fe812348852eb14bd4c5b7fe512cf58ec85b930ad7f299dad89b3962384d462fdcc
781
AAD = 538821f4530e83d66c6e53d07313720ffae47e8320c79db2a24b2851ba856410e70fa074cb93d86a6a8989e09429bb6045b151a19022cf54091f62bed8a7850e3a6a401aa471a70cde7cbd69c88056e15ba277e0b95d53c6cf37bef594170f3a426cb54de3823582eca80a4758718664b85a299bfaf3d839872231ddb82c13da5e0aea13e46b5c8da9eb7760765d0821e8f1d33abfb3b00799f0acaa388b0be0d00ec4bdd5edb1dfb1ee3ec155444ed1322078d71f7fb9b1acb6867080dfcd8eefeb4abb6b62874647e615207a78892c5b890d721f7fd925564c5a84dbcb284a9cd1b8f47c08d5cb6943d9c7d61b17df81c22bb4502ea51199aa12428826acc29c5a20415c958b759414f51cc9615e84fd363b
782
CT = 6375c8c3d3321e65b1fc5e5bfef7d2974e741c6a7e6910f50a431b941c399694ae5cad89cae96d6b7665854de4cc21f223acd4d48f99b9b06fdecb602a7d544a2dc9f77398634ef7cd6a7dfd12e9f387121bd28b327adf8a2b11446873ff8dc8af016ce41cf1fcd7bca10c7d85f8659b2a574d110b7e376b9574f64a1c228375f6918e22c9aef5d6448b2837a8b34b37dd60e0b87b085f753499bcb9772dec971c2d521bc43b1b63dda5aca10208f5ae98856ab4912baefdb1efef9979365b86c84619c603fff9eac35cd3b9e5c93df248fb72d6a011c38e7e8ffdfa47860cfaa618596fee31b3992dd3c0acae5d5ed872deab4ced96b9e2597fbacb6b1f28278151e639279109a1bd78008fea7ed5454d5f74
783
Tag = 3f1a03b0f58eb4c32cbee3edce18c21a
784
785
[Keylen = 256]
786
[IVlen = 64]
787
[PTlen = 2240]
788
[AADlen = 2240]
789
[Taglen = 128]
790
791
Count = 0
792
Key = 8876199cd5c7707901a79287194e7860e47f81e515e5ec1c8a76201e027c9ea5
793
IV = 14e3cf7a591aa2bf
794
PT = 900fab6ddd06a4195c4205bcebd8b39686d625e67f42cc5097885eca3b2d32508566d876f49e17d42b6f6cc7d7e3fba84c89a32751d776ddc8a00ad8c3386d2cb3c0f6240a1d1fb56041c69e04ff93c1c0c69c788d2239a6bce4ab881d0fceaec13c004d944d0ee80174e584ffbb4484ab0c721c1eb4ce7eae6bac72fcebb70b229ef294ac954792f376321d2a8657ccb525905fa12fc5654316a7a02d99dec314157231a5768ab5c748c380bf05ff664a0d7880f45932a5287a514cc331bf65aff612fa7379aa2e653c0871c336589485fca04d0575ec80ea52967da8dc71b52ab9ea35d474fe5d62e1c1ce37b2aa39bfb88ffa28150c2c905d88e1056057866b0f00130826a5d90d954068299537c5bde62e88dc341615
795
AAD = 1a273764d5fbb3441a632f80feb498e9f2d0c63c63a28b30be48bbb968f390981d20e7d5e88988a2c31564668da51c9c4d30d67cbce334a1fc911a2ebb767a08f8f6eade76666b7618f115bd8b4441b38e2b827b5b098624abbe0eda8e78a93400e2d50fc73d38fff4149636168b67772f09c9d483ba5b945efa431e48d12b8dc5b8410558873be274e9016f36a4f3361bef08e5f360d194e2f38b5baa388274df0efe196606d41d8f3751b9d3c386a2ed760d08bcf02f8c0afafbd1854f9f14a173929ad20dd584a04c43b8510f5f54fb6414635efdcffe8d6c331396dffc7f90f112b03978288affc51839d802902c0a2e4b29393c5959a7395a0f9570e502d1daf3a91ad3124ba988426a5cca61930e3d312d70258148
796
CT = 734f9985909ed850d02891c92368c176647bcf0a2da714d277961d903d979a19e15557ddf8726ee1ba7ee26bb7877661dd9b970420776c473d6c9e6bf9aca4256a3a2da9b589d50900c9fdd09002a97e8c75fa00e7adc73de7f9da10da4f95cd791e690420ab5487c880ca7d3f7b1a25e73ac517e60a3265d1121ab264745bb02e24c1f525682071cffe984a154413357132f579289550a37c6ed813ad7ceca0060fbc48b16d0cd0c7fdfb0fc51d9c6732713303601507ba035472e23e8b624eeb2d4e5fcafe635fec6e5ae72febd8c8bb762e0bcf2623ae7b1739a7f2c736e4af5a15af48e0b09617b44d1449472fcf8462ba123437eefef0c774de8286338932b5b46217c41faa9ac3d483b2246ed503b403b5d210fef8
797
Tag = 5a02f4adba7e95acf0b333ec12691401
798
799
[Keylen = 256]
800
[IVlen = 64]
801
[PTlen = 2280]
802
[AADlen = 2280]
803
[Taglen = 128]
804
805
Count = 0
806
Key = d53f1524214176ada62d1458b6ec6d4a8b2becc0508c85a1d34661ed57f7365f
807
IV = d7b59117d5b2a330
808
PT = 21ab914ef645305b01495feed5e1718f5eebfc8b7f2b91b45e610255a7285bf0b215c543661bb34ef22b33cc05b2e5b8e5304cb29bebb294fd65f3be9422b0fb8a0198f50f32fdaf0445a1ce727b65c7479252bb47672cdb020205bc1769eaa3f475f14d73952f554de3a1ad15ce23a7fb6f690a814318a9e692cfeea8b92d0e05f694939b3346fd2dc961d56787a75a4eedddb4940d9ad5efcc1ef7e2438bb34ee71dc1cc97abbb338a0eb83a96fd2cfc26217cbd31348d6d3974b71223009050b79ffee93bedd6d203d3aed918d9eb2aca1ea9265e9f746f55823ac5595ac398e7108cda0da8051a0a54efdb48a267038ce12147d345b15de766e373f01f304fab4f9d9d69a1f9a55026daca6d45ae29724c6c26ab4871abd6797c69
809
AAD = 3f659d9c4da694c597dcd810b67ee5389f3db6e82fb1896f6933d0431ed5bf0f53113ae09db96322d088b8da4636bfddef591884bc6ccb8bc450a8c1f691169b54591fe4c7d704b3678b2c497c2383887aa323e642af61eafd6f018ebc6b4f1963a2d074f3a1232e531feb453903dd66346ca8f6566b50243a19130bc4038a30a22a80460a085eed1cba10e844a18875fa65f356f1fe28565b886c8fd4305dfc8478953e6fabc2f3fb1b89acbb936c26083bdb02849e5d31b09d858fc1d0f7a4b62d987349a159666f9eca0ff48668da16ae688e7045b8b3fc08cd41f1fff250f1734df2062221aa213c09c6dd91dd3d188f58befcf1682882e64b150debd9fd2a91a02d6e919e980e5dfec2c19a41cd4fd646144ad2952fdddb7b246b
810
CT = 76bd3e37b32eabbb03e9b97b3864be2f2d7fc0b4543e6a304f6724f6430655b0256593b885a0bd123139aa3f226727141707d2ceeb805fe6f67c34864e6516a20b4a0803e18201bd08e97f8079cc90a430264f3e656929e9e71fc94e43643efa67bec81fbcfb0b073906095f952202b4c85c8ff396a2d718a71bb1845f080c67bdfca084128416d57785a2cb015c3e5a0320c2396cd4fd6744ef77488bdbfef340c067a0308360c90a8fbcd1a01f747c03b5091e979e3defbcf19bf3e6213b51c87dd6361b175abe18f24588b8d1d431739910d5bd0b260fc1252034a079ace76074e564167f2b3b08d7844ffc5b7fb63b3f559c21e33f9b2e6c8b7c50f5cdaa847018045b6492a08ee948edbf406f59777d47fb9c3073f881bc9e64b9
811
Tag = 7a97892913581838dd6e6393a3eaeca5
812
813
[Keylen = 256]
814
[IVlen = 64]
815
[PTlen = 2320]
816
[AADlen = 2320]
817
[Taglen = 128]
818
819
Count = 0
820
Key = f40e58ee410baa009e648055e6a37ce198656a6f3b82d3f75af06696c5cd2f92
821
IV = 1b5c4cab3624fb45
822
PT = 5aa6c5de58eb1fd8701aca01dcb0590126de91e64febd75ce05f689dd3f6e96be6e5f313d4e4655f1fd8aff1ef587f001e010d53929fd3d379b1fd69d8be8c3d26b241962ea8cef18d15e71d01ab56a652d82861892e3ccb7d67c57cd118bde39381539690c9cf37406d4b2e2977296a3f87b221a38dc57afeb8dfb19d0dbeb16b5e0dff00c17132384bd80e26e2bc91d76653146f14e30139fd0a7c0746082578b5bbe9c1945bca4b5f377a7a48d9bdde3b5ae81c2dcc0ce9fc5e5c2feaff550c72f9c9b880dffc72dd6c0daab92e01edd9cc20d2d17db8104151073799f3502e65dd1fa81e56382a05ed18d64bfa642e93e981274ed605f5b2e902089ac1c90bc168e0b9a1e128c01e08372dcdad2c502ee079dde8a6c30850dd926955f7b797e4
823
AAD = d3d4b2caef984621b8579304526c97e14822a790badd513129b4143e625abfa5a1c72d0a814d9b1a7a519fc58e2d068cb22c7db6c2d62989b6198c8bb117a6323d4b061d548a026e2932da40a3ce115b9d146cfe7f2f405c2aca7610ff685c493ad7abdfb50e2a111786080524ba6306aab24acd8e0f6f624d72d8a44b5f21a7676cd29381267987e54b46d9c660180348588691e3fc9fd01ef43ed05b57dad3189c17b10595a413a4259b3dde4dc20051be455e65a1cfc69c063c2f2f54d822c2d7cd05c5faa57b814d15a0228aa694e8e104e0d83be85e8bd9c206cc372354f1562d002f24c042027a113278e1c91e1ac4833d654fe5a9e376967ac7135e2e55300bc2814bc706799645f7a283540d31421448653444eb3423f43d6e5b3521a99d
824
CT = 99a5557f85430c60f372cb252205adb1101dd8225447284833fcbf7e6e8320c81a74f29cbacde17a9c67888b9ee639711227854e2e1943cc835f83b35590adcee9119d654e77ff76affd7bee5b456ac50989c2fb33cfbe06074fa4396859b241e4ceabb5bdce9344920d61a64516f93dcb2224359829e8d9801f4a0d844f062683476bf244178136a1b5c929e38bfcff0556b1678850c64a7f667f3df739b16dd81118707ff5418c85b3bcfa15d71c9d9e9c2e9072f131d3eaed376180537310b0324548cb0ed1da7c0bc6413bb091ac493ced521133359061731bb0df35771b426fef5e85193692321b25b4ad86d5fed601437aa04f783648e27ab8f45e4d23449678eed27ac0d6b8675fa8cded156d023682798a9bb136ac7d102cb1f18874e827
825
Tag = 4b2d05d49f2f876cc1ec2da3fa60a8c9
826
827
[Keylen = 256]
828
[IVlen = 64]
829
[PTlen = 2360]
830
[AADlen = 2360]
831
[Taglen = 128]
832
833
Count = 0
834
Key = ceb97d728c570400f716d337de694844acd7ff3aa0f5e94266af2b2ee10b53c9
835
IV = f61499b314005833
836
PT = 7f1ae738a51397b632e3ddcd06fe1cabfda4a1781472d1c53894f4f30b889c316d8c4c665935b329d2eb59092f75f9714be9d9fbb1f3f561f16be07c9614e7846781e868a42e5760d41435e292b8e3459b6f986618b86d330881a5077570fef39d4a5fed405edb99cde3ca70bede5d72728a385f671c82251b753d2dcde19ff8bb52ebfbe9c87e7b27a1585cbd96e529d4515c7a936654c45c90881d648a514f4a3fcad098c1d5e54b7b8007d0bea6ed33cc2fee4822cc271608b2ec2ff0ccc4a62ad9504d9ce2610191e296d763764b8fcb6777bd9a73b8d7595a7fedcb6a06d7fc3415b733b6b4f1e56ea1561e139f234673eea615e9c182b9d2611246a006b2a316a3db5bb6fbaad5debd2792696fc682eb15d55e2ad067ef165ec3028401c6205363abb96f
837
AAD = 538c61a50eab770a8a4dc86896039f1b7ee0b2e10b8057132a836dae5fbd54c1c812596cf746ad326a2bb3bf21c7cd04c9bb636777ea2a6e9712f9660fe5b7551a88c07f1825e9ecdaff840d591f7c0084bb1a8cce9f13e4b04fb0e92bfa391498430fa0f72e2c3ac15531543a5acb769ee203879721a54109fbff37dba6f4156a78b7a395015f3f9f75aa27d9d122a17330116e4c3fe46f595319aaf74a075feca0008aa0b6365349a1a7e2297a4ada98b37992727dc056adc54e4947b2c24c41708a4a759dca3bf863b2f0f46221f8497ed578e55a15a9282e92c753ebbc64706497af1e0211b84edcd15ce8368b4c1fc38f76606aba821ac7c3b307e3ff2ea53651356ebc5fa153971fe1a8e0bb84f60d6c4c3051647ac3645dd28ae5d5699153feb6c46211
838
CT = e442147ebfdf91e8b08c2ff3185ed10f352de4c5b2e59ed89a7d5413312da2ba29d1f0784424eea08be4203443af8802f540bcf0b7891400fc695511042a68000eae0cb8e637b1763d2fd913d77e0c88b32be1dbf8bbadbbac4f6f28bc3b37f416af4a55c683321077bbc3ae30c303b47486a46b20225697726fa0e98d842c2ee07389144d11c2f3bc4b2964e3825954ecd440a6b4a659577277e6ea0505867f1b9d78d0d298a7ed30f8bf3a013379ee9b6d650a292166e3d31b35b0d86a83bf183112f658ce1867a985cdccd4d938a016c5e4e35d365d64b6d28188f15608f9e51471d219693104642c60fe7d75f62b01a2b5ff7a3d2dcf9f9448510bada82dc4a3109cf66aca0cc4941d9838b117c8d8c9381faf31a092149b66bff9aca7afd22755688523e5
839
Tag = 128c73fb9e8ee5d4a5269a9d23b177f1
(-)a/lib/freebl/Makefile (+8 lines)
Line     Link Here 
 Lines 451-470    Link Here 
451
451
452
ifdef NSS_ENABLE_ECC
452
ifdef NSS_ENABLE_ECC
453
    ifdef ECL_USE_FP
453
    ifdef ECL_USE_FP
454
	#enable floating point ECC code	
454
	#enable floating point ECC code	
455
	DEFINES  += -DECL_USE_FP
455
	DEFINES  += -DECL_USE_FP
456
	ECL_SRCS += ecp_fp160.c ecp_fp192.c ecp_fp224.c ecp_fp.c
456
	ECL_SRCS += ecp_fp160.c ecp_fp192.c ecp_fp224.c ecp_fp.c
457
	ECL_HDRS += ecp_fp.h
457
	ECL_HDRS += ecp_fp.h
458
    endif
458
    endif
459
endif # NSS_ENABLE_ECC
459
endif # NSS_ENABLE_ECC
460
460
461
ifeq ($(CPU_ARCH),x86_64)
462
    EXTRA_SRCS += poly1305/poly1305-donna-x64-sse2-incremental-source.c
463
    EXTRA_SRCS += chacha20/chacha20_vec.c
464
else
465
    EXTRA_SRCS += poly1305/poly1305.c
466
    EXTRA_SRCS += chacha20/chacha20.c
467
endif # x86_64
468
461
#######################################################################
469
#######################################################################
462
# (5) Execute "global" rules. (OPTIONAL)                              #
470
# (5) Execute "global" rules. (OPTIONAL)                              #
463
#######################################################################
471
#######################################################################
464
472
465
include $(CORE_DEPTH)/coreconf/rules.mk
473
include $(CORE_DEPTH)/coreconf/rules.mk
466
474
467
#######################################################################
475
#######################################################################
468
# (6) Execute "component" rules. (OPTIONAL)                           #
476
# (6) Execute "component" rules. (OPTIONAL)                           #
469
#######################################################################
477
#######################################################################
470
478
(-)a/lib/freebl/blapi.h (+20 lines)
Line     Link Here 
 Lines 811-830    Link Here 
811
**	"maxOutputLen" the maximum amount of data that can ever be
811
**	"maxOutputLen" the maximum amount of data that can ever be
812
**	   stored in "output"
812
**	   stored in "output"
813
**	"input" the input data
813
**	"input" the input data
814
**	"inputLen" the amount of input data
814
**	"inputLen" the amount of input data
815
*/
815
*/
816
extern SECStatus 
816
extern SECStatus 
817
Camellia_Decrypt(CamelliaContext *cx, unsigned char *output,
817
Camellia_Decrypt(CamelliaContext *cx, unsigned char *output,
818
		 unsigned int *outputLen, unsigned int maxOutputLen,
818
		 unsigned int *outputLen, unsigned int maxOutputLen,
819
		 const unsigned char *input, unsigned int inputLen);
819
		 const unsigned char *input, unsigned int inputLen);
820
820
821
/******************************************/
822
/*
823
** ChaCha20+Poly1305 AEAD
824
*/
825
826
extern SECStatus ChaCha20Poly1305_Seal(
827
	unsigned char *out,
828
	const unsigned char *ad, size_t adLen,
829
	const unsigned char *plaintext, size_t plaintextLen,
830
	size_t tagLen,
831
	const unsigned char key[32],
832
	const unsigned char nonce[8]);
833
834
extern SECStatus ChaCha20Poly1305_Open(
835
	unsigned char *out,
836
	const unsigned char *ad, size_t adLen,
837
	const unsigned char *ciphertext, size_t ciphertextLen,
838
	size_t tagLen,
839
	const unsigned char key[32],
840
	const unsigned char nonce[8]);
821
841
822
/******************************************/
842
/******************************************/
823
/*
843
/*
824
** MD5 secure hash function
844
** MD5 secure hash function
825
*/
845
*/
826
846
827
/*
847
/*
828
** Hash a null terminated string "src" into "dest" using MD5
848
** Hash a null terminated string "src" into "dest" using MD5
829
*/
849
*/
830
extern SECStatus MD5_Hash(unsigned char *dest, const char *src);
850
extern SECStatus MD5_Hash(unsigned char *dest, const char *src);
(-)b008c4b827be (+108 lines)
Added Link Here 
Added Link Here 
1
/* This Source Code Form is subject to the terms of the Mozilla Public
2
 * License, v. 2.0. If a copy of the MPL was not distributed with this
3
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5
/* Adopted from the public domain code in NaCl by djb. */
6
7
#include <prtypes.h>
8
#include <string.h>
9
10
#include <stdio.h>
11
12
#define ROTL32(v, n) (((v) << (n)) | ((v) >> (32 - (n))))
13
#define ROTATE(v, c) (ROTL32(v, c))
14
#define XOR(v, w) ((v) ^ (w))
15
#define PLUS(x, y) ((x) + (y))
16
#define PLUSONE(v) (PLUS((v), 1))
17
18
#define U32TO8_LITTLE(p, v) \
19
	{ (p)[0] = (v >>  0) & 0xff; (p)[1] = (v >>  8) & 0xff; \
20
	  (p)[2] = (v >> 16) & 0xff; (p)[3] = (v >> 24) & 0xff; }
21
#define U8TO32_LITTLE(p)   \
22
	(((PRUint32)((p)[0])      ) | ((PRUint32)((p)[1]) <<  8) | \
23
	 ((PRUint32)((p)[2]) << 16) | ((PRUint32)((p)[3]) << 24)   )
24
25
#define QUARTERROUND(a,b,c,d) \
26
  x[a] = PLUS(x[a],x[b]); x[d] = ROTATE(XOR(x[d],x[a]),16); \
27
  x[c] = PLUS(x[c],x[d]); x[b] = ROTATE(XOR(x[b],x[c]),12); \
28
  x[a] = PLUS(x[a],x[b]); x[d] = ROTATE(XOR(x[d],x[a]), 8); \
29
  x[c] = PLUS(x[c],x[d]); x[b] = ROTATE(XOR(x[b],x[c]), 7);
30
31
static void ChaChaCore(unsigned char output[64], const PRUint32 input[16],
32
		       int num_rounds) {
33
    PRUint32 x[16];
34
    int i;
35
36
    memcpy(x, input, sizeof(PRUint32) * 16);
37
    for (i = 20; i > 0; i -= 2) {
38
	QUARTERROUND( 0, 4, 8,12)
39
	QUARTERROUND( 1, 5, 9,13)
40
	QUARTERROUND( 2, 6,10,14)
41
	QUARTERROUND( 3, 7,11,15)
42
	QUARTERROUND( 0, 5,10,15)
43
	QUARTERROUND( 1, 6,11,12)
44
	QUARTERROUND( 2, 7, 8,13)
45
	QUARTERROUND( 3, 4, 9,14)
46
    }
47
48
    for (i = 0; i < 16; ++i) {
49
	x[i] = PLUS(x[i], input[i]);
50
    }
51
    for (i = 0; i < 16; ++i) {
52
	U32TO8_LITTLE(output + 4 * i, x[i]);
53
    }
54
}
55
56
static const unsigned char sigma[16] = "expand 32-byte k";
57
58
void ChaCha20XOR(unsigned char *out, const unsigned char *in, size_t inLen,
59
		 const unsigned char key[32], const unsigned char nonce[8],
60
		 size_t counter) {
61
    unsigned char block[64];
62
    PRUint32 input[16];
63
    unsigned int u;
64
    size_t i;
65
66
    input[4] = U8TO32_LITTLE(key + 0);
67
    input[5] = U8TO32_LITTLE(key + 4);
68
    input[6] = U8TO32_LITTLE(key + 8);
69
    input[7] = U8TO32_LITTLE(key + 12);
70
71
    input[8] = U8TO32_LITTLE(key + 16);
72
    input[9] = U8TO32_LITTLE(key + 20);
73
    input[10] = U8TO32_LITTLE(key + 24);
74
    input[11] = U8TO32_LITTLE(key + 28);
75
76
    input[0] = U8TO32_LITTLE(sigma + 0);
77
    input[1] = U8TO32_LITTLE(sigma + 4);
78
    input[2] = U8TO32_LITTLE(sigma + 8);
79
    input[3] = U8TO32_LITTLE(sigma + 12);
80
81
    input[12] = counter;
82
    input[13] = counter >> 32;
83
    input[14] = U8TO32_LITTLE(nonce);
84
    input[15] = U8TO32_LITTLE(nonce + 4);
85
86
    while (inLen >= 64) {
87
	ChaChaCore(block, input, 20);
88
	for (i = 0; i < 64; i++) {
89
	    out[i] = in[i] ^ block[i];
90
	}
91
92
	input[12]++;
93
	if (input[12] == 0) {
94
	    input[13]++;
95
	}
96
97
	inLen -= 64;
98
	in += 64;
99
	out += 64;
100
    }
101
102
    if (inLen > 0) {
103
	ChaChaCore(block, input, 20);
104
	for (i = 0; i < inLen; i++) {
105
	    out[i] = in[i] ^ block[i];
106
	}
107
    }
108
}
(-)b008c4b827be (+20 lines)
Added Link Here 
Added Link Here 
1
/*
2
 * chacha20.h - header file for ChaCha20 implementation.
3
 *
4
 * This Source Code Form is subject to the terms of the Mozilla Public
5
 * License, v. 2.0. If a copy of the MPL was not distributed with this
6
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7
8
#ifndef FREEBL_CHACHA20_H_
9
#define FREEBL_CHACHA20_H_
10
11
/* ChaCha20XOR encrypts |inLen| bytes from |in| with the given key and
12
 * nonce and writes the result to |out|, which may be equal to |in|. The
13
 * initial block counter is specified by |counter|. */
14
extern void ChaCha20XOR(unsigned char *out,
15
			const unsigned char *in, size_t inLen,
16
			const unsigned char key[8],
17
			const unsigned char nonce[32],
18
			size_t counter);
19
20
#endif  /* FREEBL_POLY1305_H_ */
(-)b008c4b827be (+285 lines)
Added Link Here 
Added Link Here 
1
/* This Source Code Form is subject to the terms of the Mozilla Public
2
 * License, v. 2.0. If a copy of the MPL was not distributed with this
3
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5
/* This implementation is by Ted Krovetz and was submitted to SUPERCOP and
6
 * marked as public domain. It was been altered to allow for non-aligned inputs
7
 * and to allow the block counter to be passed in specifically. */
8
9
#include <string.h>
10
#include <stdint.h>
11
12
#include "chacha20.h"
13
14
#ifndef CHACHA_RNDS
15
#define CHACHA_RNDS 20    /* 8 (high speed), 20 (conservative), 12 (middle) */
16
#endif
17
18
/* Architecture-neutral way to specify 16-byte vector of ints	      */
19
typedef unsigned vec __attribute__ ((vector_size (16)));
20
21
/* This implementation is designed for Neon, SSE and AltiVec machines. The
22
 * following specify how to do certain vector operations efficiently on
23
 * each architecture, using intrinsics.
24
 * This implementation supports parallel processing of multiple blocks,
25
 * including potentially using general-purpose registers.
26
 */
27
#if __ARM_NEON__
28
#include <arm_neon.h>
29
#define GPR_TOO   1
30
#define VBPI      2
31
#define ONE       (vec)vsetq_lane_u32(1,vdupq_n_u32(0),0)
32
#define LOAD(m)   (vec)(*((vec*)(m)))
33
#define STORE(m,r) (*((vec*)(m))) = (r)
34
#define ROTV1(x)  (vec)vextq_u32((uint32x4_t)x,(uint32x4_t)x,1)
35
#define ROTV2(x)  (vec)vextq_u32((uint32x4_t)x,(uint32x4_t)x,2)
36
#define ROTV3(x)  (vec)vextq_u32((uint32x4_t)x,(uint32x4_t)x,3)
37
#define ROTW16(x) (vec)vrev32q_u16((uint16x8_t)x)
38
#if __clang__
39
#define ROTW7(x)  (x << ((vec){ 7, 7, 7, 7})) ^ (x >> ((vec){25,25,25,25}))
40
#define ROTW8(x)  (x << ((vec){ 8, 8, 8, 8})) ^ (x >> ((vec){24,24,24,24}))
41
#define ROTW12(x) (x << ((vec){12,12,12,12})) ^ (x >> ((vec){20,20,20,20}))
42
#else
43
#define ROTW7(x)  (vec)vsriq_n_u32(vshlq_n_u32((uint32x4_t)x,7),(uint32x4_t)x,25)
44
#define ROTW8(x)  (vec)vsriq_n_u32(vshlq_n_u32((uint32x4_t)x,8),(uint32x4_t)x,24)
45
#define ROTW12(x) (vec)vsriq_n_u32(vshlq_n_u32((uint32x4_t)x,12),(uint32x4_t)x,20)
46
#endif
47
#elif __SSE2__
48
#include <emmintrin.h>
49
#define GPR_TOO   0
50
#if __clang__
51
#define VBPI      4
52
#else
53
#define VBPI      3
54
#endif
55
#define ONE       (vec)_mm_set_epi32(0,0,0,1)
56
#define LOAD(m)   (vec)_mm_loadu_si128((__m128i*)(m))
57
#define STORE(m,r) _mm_storeu_si128((__m128i*)(m), (__m128i) (r))
58
#define ROTV1(x)  (vec)_mm_shuffle_epi32((__m128i)x,_MM_SHUFFLE(0,3,2,1))
59
#define ROTV2(x)  (vec)_mm_shuffle_epi32((__m128i)x,_MM_SHUFFLE(1,0,3,2))
60
#define ROTV3(x)  (vec)_mm_shuffle_epi32((__m128i)x,_MM_SHUFFLE(2,1,0,3))
61
#define ROTW7(x)  (vec)(_mm_slli_epi32((__m128i)x, 7) ^ _mm_srli_epi32((__m128i)x,25))
62
#define ROTW12(x) (vec)(_mm_slli_epi32((__m128i)x,12) ^ _mm_srli_epi32((__m128i)x,20))
63
#if __SSSE3__
64
#include <tmmintrin.h>
65
#define ROTW8(x)  (vec)_mm_shuffle_epi8((__m128i)x,_mm_set_epi8(14,13,12,15,10,9,8,11,6,5,4,7,2,1,0,3))
66
#define ROTW16(x) (vec)_mm_shuffle_epi8((__m128i)x,_mm_set_epi8(13,12,15,14,9,8,11,10,5,4,7,6,1,0,3,2))
67
#else
68
#define ROTW8(x)  (vec)(_mm_slli_epi32((__m128i)x, 8) ^ _mm_srli_epi32((__m128i)x,24))
69
#define ROTW16(x) (vec)(_mm_slli_epi32((__m128i)x,16) ^ _mm_srli_epi32((__m128i)x,16))
70
#endif
71
#else
72
#error -- Implementation supports only machines with neon or SSE2
73
#endif
74
75
#ifndef REVV_BE
76
#define REVV_BE(x)  (x)
77
#endif
78
79
#ifndef REVW_BE
80
#define REVW_BE(x)  (x)
81
#endif
82
83
#define BPI      (VBPI + GPR_TOO)  /* Blocks computed per loop iteration   */
84
85
#define DQROUND_VECTORS(a,b,c,d)		\
86
    a += b; d ^= a; d = ROTW16(d);	      \
87
    c += d; b ^= c; b = ROTW12(b);	      \
88
    a += b; d ^= a; d = ROTW8(d);	       \
89
    c += d; b ^= c; b = ROTW7(b);	       \
90
    b = ROTV1(b); c = ROTV2(c);  d = ROTV3(d);  \
91
    a += b; d ^= a; d = ROTW16(d);	      \
92
    c += d; b ^= c; b = ROTW12(b);	      \
93
    a += b; d ^= a; d = ROTW8(d);	       \
94
    c += d; b ^= c; b = ROTW7(b);	       \
95
    b = ROTV3(b); c = ROTV2(c); d = ROTV1(d);
96
97
#define QROUND_WORDS(a,b,c,d) \
98
  a = a+b; d ^= a; d = d<<16 | d>>16; \
99
  c = c+d; b ^= c; b = b<<12 | b>>20; \
100
  a = a+b; d ^= a; d = d<< 8 | d>>24; \
101
  c = c+d; b ^= c; b = b<< 7 | b>>25;
102
103
#define WRITE_XOR(in, op, d, v0, v1, v2, v3)		   \
104
    STORE(op + d + 0, LOAD(in + d + 0) ^ REVV_BE(v0));      \
105
    STORE(op + d + 4, LOAD(in + d + 4) ^ REVV_BE(v1));      \
106
    STORE(op + d + 8, LOAD(in + d + 8) ^ REVV_BE(v2));      \
107
    STORE(op + d +12, LOAD(in + d +12) ^ REVV_BE(v3));
108
109
void ChaCha20XOR(
110
    unsigned char *out,
111
    const unsigned char *in,
112
    size_t inlen,
113
    const unsigned char key[32],
114
    const unsigned char nonce[8],
115
    size_t counter)
116
{
117
    unsigned iters, i, *op=(unsigned *)out, *ip=(unsigned *)in, *kp;
118
#if defined(__ARM_NEON__)
119
    unsigned *np;
120
#endif
121
    vec s0, s1, s2, s3;
122
#if !defined(__ARM_NEON__) && !defined(__SSE2__)
123
    __attribute__ ((aligned (16))) unsigned key[8], nonce[4];
124
#endif
125
    __attribute__ ((aligned (16))) unsigned chacha_const[] =
126
	{0x61707865,0x3320646E,0x79622D32,0x6B206574};
127
#if defined(__ARM_NEON__) || defined(__SSE2__)
128
    kp = (unsigned *)key;
129
#else
130
    ((vec *)key)[0] = REVV_BE(((vec *)key)[0]);
131
    ((vec *)key)[1] = REVV_BE(((vec *)key)[1]);
132
    nonce[0] = REVW_BE(((unsigned *)nonce)[0]);
133
    nonce[1] = REVW_BE(((unsigned *)nonce)[1]);
134
    nonce[2] = REVW_BE(((unsigned *)nonce)[2]);
135
    nonce[3] = REVW_BE(((unsigned *)nonce)[3]);
136
    kp = (unsigned *)key;
137
    np = (unsigned *)nonce;
138
#endif
139
#if defined(__ARM_NEON__)
140
    np = (unsigned*) nonce;
141
#endif
142
    s0 = LOAD(chacha_const);
143
    s1 = LOAD(&((vec*)kp)[0]);
144
    s2 = LOAD(&((vec*)kp)[1]);
145
    s3 = (vec) {
146
	counter & 0xffffffff,
147
#if __ARM_NEON__
148
	0,  /* can't right-shift 32 bits on a 32-bit system. */
149
#else
150
	counter >> 32,
151
#endif
152
	((uint32_t*)nonce)[0],
153
	((uint32_t*)nonce)[1]
154
    };
155
156
    for (iters = 0; iters < inlen/(BPI*64); iters++) {
157
#if GPR_TOO
158
	register unsigned x0, x1, x2, x3, x4, x5, x6, x7, x8,
159
		  x9, x10, x11, x12, x13, x14, x15;
160
#endif
161
#if VBPI > 2
162
	vec v8,v9,v10,v11;
163
#endif
164
#if VBPI > 3
165
	vec v12,v13,v14,v15;
166
#endif
167
168
	vec v0,v1,v2,v3,v4,v5,v6,v7;
169
	v4 = v0 = s0; v5 = v1 = s1; v6 = v2 = s2; v3 = s3;
170
	v7 = v3 + ONE;
171
#if VBPI > 2
172
	v8 = v4; v9 = v5; v10 = v6;
173
	v11 =  v7 + ONE;
174
#endif
175
#if VBPI > 3
176
	v12 = v8; v13 = v9; v14 = v10;
177
	v15 = v11 + ONE;
178
#endif
179
#if GPR_TOO
180
	x0 = chacha_const[0]; x1 = chacha_const[1];
181
	x2 = chacha_const[2]; x3 = chacha_const[3];
182
	x4 = kp[0]; x5 = kp[1]; x6  = kp[2]; x7  = kp[3];
183
	x8 = kp[4]; x9 = kp[5]; x10 = kp[6]; x11 = kp[7];
184
	x12 = counter+BPI*iters+(BPI-1); x13 = 0; x14 = np[0]; x15 = np[1];
185
#endif
186
	for (i = CHACHA_RNDS/2; i; i--) {
187
	    DQROUND_VECTORS(v0,v1,v2,v3)
188
	    DQROUND_VECTORS(v4,v5,v6,v7)
189
#if VBPI > 2
190
	    DQROUND_VECTORS(v8,v9,v10,v11)
191
#endif
192
#if VBPI > 3
193
	    DQROUND_VECTORS(v12,v13,v14,v15)
194
#endif
195
#if GPR_TOO
196
	    QROUND_WORDS( x0, x4, x8,x12)
197
	    QROUND_WORDS( x1, x5, x9,x13)
198
	    QROUND_WORDS( x2, x6,x10,x14)
199
	    QROUND_WORDS( x3, x7,x11,x15)
200
	    QROUND_WORDS( x0, x5,x10,x15)
201
	    QROUND_WORDS( x1, x6,x11,x12)
202
	    QROUND_WORDS( x2, x7, x8,x13)
203
	    QROUND_WORDS( x3, x4, x9,x14)
204
#endif
205
	}
206
207
	WRITE_XOR(ip, op, 0, v0+s0, v1+s1, v2+s2, v3+s3)
208
	s3 += ONE;
209
	WRITE_XOR(ip, op, 16, v4+s0, v5+s1, v6+s2, v7+s3)
210
	s3 += ONE;
211
#if VBPI > 2
212
	WRITE_XOR(ip, op, 32, v8+s0, v9+s1, v10+s2, v11+s3)
213
	s3 += ONE;
214
#endif
215
#if VBPI > 3
216
	WRITE_XOR(ip, op, 48, v12+s0, v13+s1, v14+s2, v15+s3)
217
	s3 += ONE;
218
#endif
219
	ip += VBPI*16;
220
	op += VBPI*16;
221
#if GPR_TOO
222
	op[0]  = REVW_BE(REVW_BE(ip[0])  ^ (x0  + chacha_const[0]));
223
	op[1]  = REVW_BE(REVW_BE(ip[1])  ^ (x1  + chacha_const[1]));
224
	op[2]  = REVW_BE(REVW_BE(ip[2])  ^ (x2  + chacha_const[2]));
225
	op[3]  = REVW_BE(REVW_BE(ip[3])  ^ (x3  + chacha_const[3]));
226
	op[4]  = REVW_BE(REVW_BE(ip[4])  ^ (x4  + kp[0]));
227
	op[5]  = REVW_BE(REVW_BE(ip[5])  ^ (x5  + kp[1]));
228
	op[6]  = REVW_BE(REVW_BE(ip[6])  ^ (x6  + kp[2]));
229
	op[7]  = REVW_BE(REVW_BE(ip[7])  ^ (x7  + kp[3]));
230
	op[8]  = REVW_BE(REVW_BE(ip[8])  ^ (x8  + kp[4]));
231
	op[9]  = REVW_BE(REVW_BE(ip[9])  ^ (x9  + kp[5]));
232
	op[10] = REVW_BE(REVW_BE(ip[10]) ^ (x10 + kp[6]));
233
	op[11] = REVW_BE(REVW_BE(ip[11]) ^ (x11 + kp[7]));
234
	op[12] = REVW_BE(REVW_BE(ip[12]) ^ (x12 + BPI*iters+(BPI-1)));
235
	op[13] = REVW_BE(REVW_BE(ip[13]) ^ (x13));
236
	op[14] = REVW_BE(REVW_BE(ip[14]) ^ (x14 + np[0]));
237
	op[15] = REVW_BE(REVW_BE(ip[15]) ^ (x15 + np[1]));
238
	s3 += ONE;
239
	ip += 16;
240
	op += 16;
241
#endif
242
    }
243
244
    for (iters = inlen%(BPI*64)/64; iters != 0; iters--) {
245
	vec v0 = s0, v1 = s1, v2 = s2, v3 = s3;
246
	for (i = CHACHA_RNDS/2; i; i--) {
247
	    DQROUND_VECTORS(v0,v1,v2,v3);
248
	}
249
	WRITE_XOR(ip, op, 0, v0+s0, v1+s1, v2+s2, v3+s3)
250
	s3 += ONE;
251
	ip += 16;
252
	op += 16;
253
    }
254
255
    inlen = inlen % 64;
256
    if (inlen) {
257
	__attribute__ ((aligned (16))) vec buf[4];
258
	vec v0,v1,v2,v3;
259
	v0 = s0; v1 = s1; v2 = s2; v3 = s3;
260
	for (i = CHACHA_RNDS/2; i; i--) {
261
	    DQROUND_VECTORS(v0,v1,v2,v3);
262
	}
263
264
	if (inlen >= 16) {
265
	    STORE(op + 0, LOAD(ip + 0) ^ REVV_BE(v0 + s0));
266
	    if (inlen >= 32) {
267
		STORE(op + 4, LOAD(ip + 4) ^ REVV_BE(v1 + s1));
268
		if (inlen >= 48) {
269
		    STORE(op + 8, LOAD(ip + 8) ^ REVV_BE(v2 + s2));
270
		    buf[3] = REVV_BE(v3 + s3);
271
		} else {
272
		    buf[2] = REVV_BE(v2 + s2);
273
		}
274
	    } else {
275
		buf[1] = REVV_BE(v1 + s1);
276
	    }
277
	} else {
278
	    buf[0] = REVV_BE(v0 + s0);
279
	}
280
281
	for (i=inlen & ~15; i<inlen; i++) {
282
	    ((char *)op)[i] = ((char *)ip)[i] ^ ((char *)buf)[i];
283
	}
284
    }
285
}
(-)b008c4b827be (+102 lines)
Added Link Here 
Added Link Here 
1
#include <string.h>
2
#include <stdio.h>
3
4
#include "seccomon.h"
5
#include "poly1305/poly1305.h"
6
#include "chacha20/chacha20.h"
7
8
/* Poly1305Do writes the Poly1305 authenticator of the given additional data
9
 * and ciphertext to |out|. */
10
static void Poly1305Do(unsigned char *out,
11
		       const unsigned char *ad, size_t adLen,
12
		       const unsigned char *ciphertext, size_t ciphertextLen,
13
		       const unsigned char key[32])
14
{
15
    poly1305_state state;
16
    size_t j;
17
    unsigned char lengthBytes[8];
18
    unsigned int i;
19
20
    Poly1305Init(&state, key);
21
    j = adLen;
22
    for (i = 0; i < sizeof(lengthBytes); i++) {
23
	lengthBytes[i] = j;
24
	j >>= 8;
25
    }
26
    Poly1305Update(&state, lengthBytes, sizeof(lengthBytes));
27
    Poly1305Update(&state, ad, adLen);
28
    j = ciphertextLen;
29
    for (i = 0; i < sizeof(lengthBytes); i++) {
30
	lengthBytes[i] = j;
31
	j >>= 8;
32
    }
33
    Poly1305Update(&state, lengthBytes, sizeof(lengthBytes));
34
    Poly1305Update(&state, ciphertext, ciphertextLen);
35
    Poly1305Finish(&state, out);
36
}
37
38
SECStatus ChaCha20Poly1305_Seal(
39
	unsigned char *out,
40
	const unsigned char *ad, size_t adLen,
41
	const unsigned char *plaintext, size_t plaintextLen,
42
	size_t tagLen,
43
	const unsigned char key[32],
44
	const unsigned char nonce[8])
45
{
46
    unsigned char block[64];
47
    unsigned char tag[16];
48
49
    if (tagLen == 0 || tagLen > 16) {
50
	return SECFailure;
51
    }
52
53
    memset(block, 0, 64);
54
    // Generate a block of keystream. The first 32 bytes will be the poly1305
55
    // key. The remainder of the block is discarded.
56
    ChaCha20XOR(block, block, sizeof(block), key, nonce, 0);
57
    ChaCha20XOR(out, plaintext, plaintextLen, key, nonce, 1);
58
59
    Poly1305Do(tag, ad, adLen, out, plaintextLen, block);
60
    memcpy(out + plaintextLen, tag, tagLen);
61
62
    return SECSuccess;
63
}
64
65
SECStatus ChaCha20Poly1305_Open(
66
	unsigned char *out,
67
	const unsigned char *ad, size_t adLen,
68
	const unsigned char *ciphertext, size_t ciphertextLen,
69
	size_t tagLen,
70
	const unsigned char key[32],
71
	const unsigned char nonce[8])
72
{
73
    unsigned char block[64];
74
    unsigned int i;
75
    unsigned char macBad;
76
    unsigned char mac[16];
77
78
    if (tagLen == 0 || tagLen > 16) {
79
	return SECFailure;
80
    }
81
82
    if (ciphertextLen < tagLen) {
83
	return SECFailure;
84
    }
85
86
    memset(block, 0, 64);
87
    // Generate a block of keystream. The first 32 bytes will be the poly1305
88
    // key. The remainder is used to decrypt the first 32 bytes of plaintext.
89
    ChaCha20XOR(block, block, sizeof(block), key, nonce, 0);
90
    Poly1305Do(mac, ad, adLen, ciphertext, ciphertextLen - tagLen, block);
91
    macBad = 0;
92
    for (i = 0; i < tagLen; i++) {
93
	macBad |= mac[i] ^ ciphertext[ciphertextLen - tagLen + i];
94
    }
95
    if (macBad) {
96
	return SECFailure;
97
    }
98
99
    ChaCha20XOR(out, ciphertext, ciphertextLen, key, nonce, 1);
100
101
    return SECSuccess;
102
}
(-)a/lib/freebl/ldvector.c (-1 / +4 lines)
Line     Link Here 
 Lines 256-278    Link Here 
256
    BLAPI_SHVerifyFile,
256
    BLAPI_SHVerifyFile,
257
257
258
    /* End of Version 3.013 */
258
    /* End of Version 3.013 */
259
259
260
    PQG_ParamGenV2,
260
    PQG_ParamGenV2,
261
    PRNGTEST_RunHealthTests,
261
    PRNGTEST_RunHealthTests,
262
262
263
    /* End of Version 3.014 */
263
    /* End of Version 3.014 */
264
264
265
    HMAC_ConstantTime,
265
    HMAC_ConstantTime,
266
    SSLv3_MAC_ConstantTime
266
    SSLv3_MAC_ConstantTime,
267
267
268
    /* End of Version 3.015 */
268
    /* End of Version 3.015 */
269
270
    ChaCha20Poly1305_Seal,
271
    ChaCha20Poly1305_Open
269
};
272
};
270
273
271
const FREEBLVector * 
274
const FREEBLVector * 
272
FREEBL_GetVector(void)
275
FREEBL_GetVector(void)
273
{
276
{
274
    extern const char __nss_freebl_rcsid[];
277
    extern const char __nss_freebl_rcsid[];
275
    extern const char __nss_freebl_sccsid[];
278
    extern const char __nss_freebl_sccsid[];
276
279
277
    /* force a reference that won't get optimized away */
280
    /* force a reference that won't get optimized away */
278
    volatile char c;
281
    volatile char c;
(-)a/lib/freebl/loader.c (+24 lines)
Line     Link Here 
 Lines 1899-1908    Link Here 
1899
{
1899
{
1900
  if (!vector && PR_SUCCESS != freebl_RunLoaderOnce())
1900
  if (!vector && PR_SUCCESS != freebl_RunLoaderOnce())
1901
      return SECFailure;
1901
      return SECFailure;
1902
  return (vector->p_HMAC_ConstantTime)(
1902
  return (vector->p_HMAC_ConstantTime)(
1903
      result, resultLen, maxResultLen,
1903
      result, resultLen, maxResultLen,
1904
      hashObj,
1904
      hashObj,
1905
      secret, secretLen,
1905
      secret, secretLen,
1906
      header, headerLen,
1906
      header, headerLen,
1907
      body, bodyLen, bodyTotalLen);
1907
      body, bodyLen, bodyTotalLen);
1908
}
1908
}
1909
1910
SECStatus ChaCha20Poly1305_Seal(unsigned char *out,
1911
				const unsigned char *ad, size_t adLen,
1912
				const unsigned char *plaintext, size_t plaintextLen,
1913
				size_t tagLen,
1914
				const unsigned char key[32],
1915
				const unsigned char nonce[8]) {
1916
  if (!vector && PR_SUCCESS != freebl_RunLoaderOnce())
1917
	return SECFailure;
1918
  return (vector->p_ChaCha20Poly1305_Seal)(
1919
	  out, ad, adLen, plaintext, plaintextLen, tagLen, key, nonce);
1920
}
1921
1922
SECStatus ChaCha20Poly1305_Open(unsigned char *out,
1923
				const unsigned char *ad, size_t adLen,
1924
				const unsigned char *ciphertext, size_t ciphertextLen,
1925
				size_t tagLen,
1926
				const unsigned char key[32],
1927
				const unsigned char nonce[8]) {
1928
  if (!vector && PR_SUCCESS != freebl_RunLoaderOnce())
1929
	return SECFailure;
1930
  return (vector->p_ChaCha20Poly1305_Open)(
1931
	  out, ad, adLen, ciphertext, ciphertextLen, tagLen, key, nonce);
1932
}
(-)a/lib/freebl/loader.h (+17 lines)
Line     Link Here 
 Lines 589-608    Link Here 
589
     const SECHashObject *hashObj,
589
     const SECHashObject *hashObj,
590
     const unsigned char *secret,
590
     const unsigned char *secret,
591
     unsigned int secretLen,
591
     unsigned int secretLen,
592
     const unsigned char *header,
592
     const unsigned char *header,
593
     unsigned int headerLen,
593
     unsigned int headerLen,
594
     const unsigned char *body,
594
     const unsigned char *body,
595
     unsigned int bodyLen,
595
     unsigned int bodyLen,
596
     unsigned int bodyTotalLen);
596
     unsigned int bodyTotalLen);
597
597
598
  /* Version 3.015 came to here */
598
  /* Version 3.015 came to here */
599
600
  SECStatus (* p_ChaCha20Poly1305_Seal)(
601
	  unsigned char *out,
602
	  const unsigned char *ad, size_t adLen,
603
	  const unsigned char *plaintext, size_t plaintextLen,
604
	  size_t tagLen,
605
	  const unsigned char key[32],
606
	  const unsigned char nonce[8]);
607
608
  SECStatus (* p_ChaCha20Poly1305_Open)(
609
	  unsigned char *out,
610
	  const unsigned char *ad, size_t adLen,
611
	  const unsigned char *plaintext, size_t plaintextLen,
612
	  size_t tagLen,
613
	  const unsigned char key[32],
614
	  const unsigned char nonce[8]);
615
599
 };
616
 };
600
617
601
typedef struct FREEBLVectorStr FREEBLVector;
618
typedef struct FREEBLVectorStr FREEBLVector;
602
619
603
SEC_BEGIN_PROTOS
620
SEC_BEGIN_PROTOS
604
621
605
typedef const FREEBLVector * FREEBLGetVectorFn(void);
622
typedef const FREEBLVector * FREEBLGetVectorFn(void);
606
623
607
extern FREEBLGetVectorFn FREEBL_GetVector;
624
extern FREEBLGetVectorFn FREEBL_GetVector;
608
625
(-)a/lib/freebl/manifest.mn (+1 lines)
Line     Link Here 
 Lines 110-129    Link Here 
110
	camellia.c \
110
	camellia.c \
111
	dh.c \
111
	dh.c \
112
	ec.c \
112
	ec.c \
113
	pqg.c \
113
	pqg.c \
114
	dsa.c \
114
	dsa.c \
115
	rsa.c \
115
	rsa.c \
116
	shvfy.c \
116
	shvfy.c \
117
	tlsprfalg.c \
117
	tlsprfalg.c \
118
	seed.c \
118
	seed.c \
119
	jpake.c \
119
	jpake.c \
120
	chacha20poly1305.c \
120
	$(MPI_SRCS) \
121
	$(MPI_SRCS) \
121
	$(MPCPU_SRCS) \
122
	$(MPCPU_SRCS) \
122
	$(ECL_SRCS) \
123
	$(ECL_SRCS) \
123
	$(STUBS_SRCS) \
124
	$(STUBS_SRCS) \
124
	$(LOWHASH_SRCS) \
125
	$(LOWHASH_SRCS) \
125
	$(EXTRA_SRCS) \
126
	$(EXTRA_SRCS) \
126
	$(NULL)
127
	$(NULL)
127
128
128
ALL_CSRCS := $(CSRCS)
129
ALL_CSRCS := $(CSRCS)
129
130
(-)b008c4b827be (+623 lines)
Added Link Here 
Added Link Here 
1
/* This Source Code Form is subject to the terms of the Mozilla Public
2
 * License, v. 2.0. If a copy of the MPL was not distributed with this
3
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5
/* This implementation of poly1305 is by Andrew Moon
6
 * (https://github.com/floodyberry/poly1305-donna) and released as public
7
 * domain. It implements SIMD vectorization based on the algorithm described in
8
 * http://cr.yp.to/papers.html#neoncrypto. Unrolled to 2 powers, i.e. 64 byte
9
 * block size. */
10
11
#include <emmintrin.h>
12
#include <stdint.h>
13
14
#include "poly1305.h"
15
16
#define ALIGN(x) __attribute__((aligned(x)))
17
#define INLINE inline
18
#define U8TO64_LE(m) (*(uint64_t*)(m))
19
#define U8TO32_LE(m) (*(uint32_t*)(m))
20
#define U64TO8_LE(m,v) (*(uint64_t*)(m)) = v
21
22
typedef __m128i xmmi;
23
typedef unsigned __int128 uint128_t;
24
25
static const uint32_t ALIGN(16) poly1305_x64_sse2_message_mask[4] = {(1 << 26) - 1, 0, (1 << 26) - 1, 0};
26
static const uint32_t ALIGN(16) poly1305_x64_sse2_5[4] = {5, 0, 5, 0};
27
static const uint32_t ALIGN(16) poly1305_x64_sse2_1shl128[4] = {(1 << 24), 0, (1 << 24), 0};
28
29
static uint128_t INLINE
30
add128(uint128_t a, uint128_t b) {
31
	return a + b;
32
}
33
34
static uint128_t INLINE
35
add128_64(uint128_t a, uint64_t b) {
36
	return a + b;
37
}
38
39
static uint128_t INLINE
40
mul64x64_128(uint64_t a, uint64_t b) {
41
	return (uint128_t)a * b;
42
}
43
44
static uint64_t INLINE
45
lo128(uint128_t a) {
46
	return (uint64_t)a;
47
}
48
49
static uint64_t INLINE
50
shr128(uint128_t v, const int shift) {
51
	return (uint64_t)(v >> shift);
52
}
53
54
static uint64_t INLINE
55
shr128_pair(uint64_t hi, uint64_t lo, const int shift) {
56
	return (uint64_t)((((uint128_t)hi << 64) | lo) >> shift);
57
}
58
59
typedef struct poly1305_power_t {
60
	union {
61
		xmmi v;
62
		uint64_t u[2];
63
		uint32_t d[4];
64
	} R20,R21,R22,R23,R24,S21,S22,S23,S24;
65
} poly1305_power;
66
67
typedef struct poly1305_state_internal_t {
68
	poly1305_power P[2];     /* 288 bytes, top 32 bit halves unused = 144 bytes of free storage */
69
	union {
70
		xmmi H[5];           /*  80 bytes  */
71
		uint64_t HH[10];
72
	};
73
	/* uint64_t r0,r1,r2;       [24 bytes] */
74
	/* uint64_t pad0,pad1;      [16 bytes] */
75
	uint64_t started;        /*   8 bytes  */
76
	uint64_t leftover;       /*   8 bytes  */
77
	uint8_t buffer[64];      /*  64 bytes  */
78
} poly1305_state_internal;   /* 448 bytes total + 63 bytes for alignment = 511 bytes raw */
79
80
static poly1305_state_internal INLINE
81
*poly1305_aligned_state(poly1305_state *state) {
82
	return (poly1305_state_internal *)(((uint64_t)state + 63) & ~63);
83
}
84
85
/* copy 0-63 bytes */
86
static void INLINE
87
poly1305_block_copy(uint8_t *dst, const uint8_t *src, size_t bytes) {
88
	size_t offset = src - dst;
89
	if (bytes & 32) {
90
		_mm_storeu_si128((xmmi *)(dst + 0), _mm_loadu_si128((xmmi *)(dst + offset + 0)));
91
		_mm_storeu_si128((xmmi *)(dst + 16), _mm_loadu_si128((xmmi *)(dst + offset + 16)));
92
		dst += 32;
93
	}
94
	if (bytes & 16) { _mm_storeu_si128((xmmi *)dst, _mm_loadu_si128((xmmi *)(dst + offset))); dst += 16; }
95
	if (bytes &  8) { *(uint64_t *)dst = *(uint64_t *)(dst + offset); dst += 8; }
96
	if (bytes &  4) { *(uint32_t *)dst = *(uint32_t *)(dst + offset); dst += 4; }
97
	if (bytes &  2) { *(uint16_t *)dst = *(uint16_t *)(dst + offset); dst += 2; }
98
	if (bytes &  1) { *( uint8_t *)dst = *( uint8_t *)(dst + offset);           }
99
}
100
101
/* zero 0-15 bytes */
102
static void INLINE
103
poly1305_block_zero(uint8_t *dst, size_t bytes) {
104
	if (bytes &  8) { *(uint64_t *)dst = 0; dst += 8; }
105
	if (bytes &  4) { *(uint32_t *)dst = 0; dst += 4; }
106
	if (bytes &  2) { *(uint16_t *)dst = 0; dst += 2; }
107
	if (bytes &  1) { *( uint8_t *)dst = 0; }
108
}
109
110
static size_t INLINE
111
poly1305_min(size_t a, size_t b) {
112
	return (a < b) ? a : b;
113
}
114
115
void
116
Poly1305Init(poly1305_state *state, const unsigned char key[32]) {
117
	poly1305_state_internal *st = poly1305_aligned_state(state);
118
	poly1305_power *p;
119
	uint64_t r0,r1,r2;
120
	uint64_t t0,t1;
121
122
	/* clamp key */
123
	t0 = U8TO64_LE(key + 0);
124
	t1 = U8TO64_LE(key + 8);
125
	r0 = t0 & 0xffc0fffffff; t0 >>= 44; t0 |= t1 << 20;
126
	r1 = t0 & 0xfffffc0ffff; t1 >>= 24;
127
	r2 = t1 & 0x00ffffffc0f;
128
129
	/* store r in un-used space of st->P[1] */
130
	p = &st->P[1];
131
	p->R20.d[1] = (uint32_t)(r0      );
132
	p->R20.d[3] = (uint32_t)(r0 >> 32);
133
	p->R21.d[1] = (uint32_t)(r1      );
134
	p->R21.d[3] = (uint32_t)(r1 >> 32);
135
	p->R22.d[1] = (uint32_t)(r2      );
136
	p->R22.d[3] = (uint32_t)(r2 >> 32);
137
138
	/* store pad */
139
	p->R23.d[1] = U8TO32_LE(key + 16);
140
	p->R23.d[3] = U8TO32_LE(key + 20);
141
	p->R24.d[1] = U8TO32_LE(key + 24);
142
	p->R24.d[3] = U8TO32_LE(key + 28);
143
144
	/* H = 0 */
145
	st->H[0] = _mm_setzero_si128();
146
	st->H[1] = _mm_setzero_si128();
147
	st->H[2] = _mm_setzero_si128();
148
	st->H[3] = _mm_setzero_si128();
149
	st->H[4] = _mm_setzero_si128();
150
151
	st->started = 0;
152
	st->leftover = 0;
153
}
154
155
static void
156
poly1305_first_block(poly1305_state_internal *st, const uint8_t *m) {
157
	const xmmi MMASK = _mm_load_si128((xmmi *)poly1305_x64_sse2_message_mask);
158
	const xmmi FIVE = _mm_load_si128((xmmi*)poly1305_x64_sse2_5);
159
	const xmmi HIBIT = _mm_load_si128((xmmi*)poly1305_x64_sse2_1shl128);
160
	xmmi T5,T6;
161
	poly1305_power *p;
162
	uint128_t d[3];
163
	uint64_t r0,r1,r2;
164
	uint64_t r20,r21,r22,s22;
165
	uint64_t pad0,pad1;
166
	uint64_t c;
167
	uint64_t i;
168
169
	/* pull out stored info */
170
	p = &st->P[1];
171
172
	r0   = ((uint64_t)p->R20.d[3] << 32) | (uint64_t)p->R20.d[1];
173
	r1   = ((uint64_t)p->R21.d[3] << 32) | (uint64_t)p->R21.d[1];
174
	r2   = ((uint64_t)p->R22.d[3] << 32) | (uint64_t)p->R22.d[1];
175
	pad0 = ((uint64_t)p->R23.d[3] << 32) | (uint64_t)p->R23.d[1];
176
	pad1 = ((uint64_t)p->R24.d[3] << 32) | (uint64_t)p->R24.d[1];
177
178
	/* compute powers r^2,r^4 */
179
	r20 = r0;
180
	r21 = r1;
181
	r22 = r2;
182
	for (i = 0; i < 2; i++) {
183
		s22 = r22 * (5 << 2);
184
185
		d[0] = add128(mul64x64_128(r20, r20), mul64x64_128(r21 * 2, s22));
186
		d[1] = add128(mul64x64_128(r22, s22), mul64x64_128(r20 * 2, r21));
187
		d[2] = add128(mul64x64_128(r21, r21), mul64x64_128(r22 * 2, r20));
188
189
		                           r20 = lo128(d[0]) & 0xfffffffffff; c = shr128(d[0], 44);
190
		d[1] = add128_64(d[1], c); r21 = lo128(d[1]) & 0xfffffffffff; c = shr128(d[1], 44);
191
		d[2] = add128_64(d[2], c); r22 = lo128(d[2]) & 0x3ffffffffff; c = shr128(d[2], 42);
192
		r20 += c * 5; c = (r20 >> 44); r20 = r20 & 0xfffffffffff;
193
		r21 += c;
194
195
		p->R20.v = _mm_shuffle_epi32(_mm_cvtsi32_si128((uint32_t)( r20                     ) & 0x3ffffff), _MM_SHUFFLE(1,0,1,0));
196
		p->R21.v = _mm_shuffle_epi32(_mm_cvtsi32_si128((uint32_t)((r20 >> 26) | (r21 << 18)) & 0x3ffffff), _MM_SHUFFLE(1,0,1,0));
197
		p->R22.v = _mm_shuffle_epi32(_mm_cvtsi32_si128((uint32_t)((r21 >> 8)               ) & 0x3ffffff), _MM_SHUFFLE(1,0,1,0));
198
		p->R23.v = _mm_shuffle_epi32(_mm_cvtsi32_si128((uint32_t)((r21 >> 34) | (r22 << 10)) & 0x3ffffff), _MM_SHUFFLE(1,0,1,0));
199
		p->R24.v = _mm_shuffle_epi32(_mm_cvtsi32_si128((uint32_t)((r22 >> 16)              )            ), _MM_SHUFFLE(1,0,1,0));
200
		p->S21.v = _mm_mul_epu32(p->R21.v, FIVE);
201
		p->S22.v = _mm_mul_epu32(p->R22.v, FIVE);
202
		p->S23.v = _mm_mul_epu32(p->R23.v, FIVE);
203
		p->S24.v = _mm_mul_epu32(p->R24.v, FIVE);
204
		p--;
205
	}
206
207
	/* put saved info back */
208
	p = &st->P[1];
209
	p->R20.d[1] = (uint32_t)(r0        );
210
	p->R20.d[3] = (uint32_t)(r0   >> 32);
211
	p->R21.d[1] = (uint32_t)(r1        );
212
	p->R21.d[3] = (uint32_t)(r1   >> 32);
213
	p->R22.d[1] = (uint32_t)(r2        );
214
	p->R22.d[3] = (uint32_t)(r2   >> 32);
215
	p->R23.d[1] = (uint32_t)(pad0      );
216
	p->R23.d[3] = (uint32_t)(pad0 >> 32);
217
	p->R24.d[1] = (uint32_t)(pad1      );
218
	p->R24.d[3] = (uint32_t)(pad1 >> 32);
219
220
	/* H = [Mx,My] */
221
	T5 = _mm_unpacklo_epi64(_mm_loadl_epi64((xmmi *)(m + 0)), _mm_loadl_epi64((xmmi *)(m + 16)));
222
	T6 = _mm_unpacklo_epi64(_mm_loadl_epi64((xmmi *)(m + 8)), _mm_loadl_epi64((xmmi *)(m + 24)));
223
	st->H[0] = _mm_and_si128(MMASK, T5);
224
	st->H[1] = _mm_and_si128(MMASK, _mm_srli_epi64(T5, 26));
225
	T5 = _mm_or_si128(_mm_srli_epi64(T5, 52), _mm_slli_epi64(T6, 12));
226
	st->H[2] = _mm_and_si128(MMASK, T5);
227
	st->H[3] = _mm_and_si128(MMASK, _mm_srli_epi64(T5, 26));
228
	st->H[4] = _mm_or_si128(_mm_srli_epi64(T6, 40), HIBIT);
229
}
230
231
static void
232
poly1305_blocks(poly1305_state_internal *st, const uint8_t *m, size_t bytes) {
233
	const xmmi MMASK = _mm_load_si128((xmmi *)poly1305_x64_sse2_message_mask);
234
	const xmmi FIVE = _mm_load_si128((xmmi*)poly1305_x64_sse2_5);
235
	const xmmi HIBIT = _mm_load_si128((xmmi*)poly1305_x64_sse2_1shl128);
236
237
	poly1305_power *p;
238
	xmmi H0,H1,H2,H3,H4;
239
	xmmi T0,T1,T2,T3,T4,T5,T6;
240
	xmmi M0,M1,M2,M3,M4;
241
	xmmi C1,C2;
242
243
	H0 = st->H[0];
244
	H1 = st->H[1];
245
	H2 = st->H[2];
246
	H3 = st->H[3];
247
	H4 = st->H[4];
248
249
	while (bytes >= 64) {
250
		/* H *= [r^4,r^4] */
251
		p = &st->P[0];
252
		T0 = _mm_mul_epu32(H0, p->R20.v);
253
		T1 = _mm_mul_epu32(H0, p->R21.v);
254
		T2 = _mm_mul_epu32(H0, p->R22.v);
255
		T3 = _mm_mul_epu32(H0, p->R23.v);
256
		T4 = _mm_mul_epu32(H0, p->R24.v);
257
		T5 = _mm_mul_epu32(H1, p->S24.v); T6 = _mm_mul_epu32(H1, p->R20.v); T0 = _mm_add_epi64(T0, T5); T1 = _mm_add_epi64(T1, T6);
258
		T5 = _mm_mul_epu32(H2, p->S23.v); T6 = _mm_mul_epu32(H2, p->S24.v); T0 = _mm_add_epi64(T0, T5); T1 = _mm_add_epi64(T1, T6);
259
		T5 = _mm_mul_epu32(H3, p->S22.v); T6 = _mm_mul_epu32(H3, p->S23.v); T0 = _mm_add_epi64(T0, T5); T1 = _mm_add_epi64(T1, T6);
260
		T5 = _mm_mul_epu32(H4, p->S21.v); T6 = _mm_mul_epu32(H4, p->S22.v); T0 = _mm_add_epi64(T0, T5); T1 = _mm_add_epi64(T1, T6);
261
		T5 = _mm_mul_epu32(H1, p->R21.v); T6 = _mm_mul_epu32(H1, p->R22.v); T2 = _mm_add_epi64(T2, T5); T3 = _mm_add_epi64(T3, T6);
262
		T5 = _mm_mul_epu32(H2, p->R20.v); T6 = _mm_mul_epu32(H2, p->R21.v); T2 = _mm_add_epi64(T2, T5); T3 = _mm_add_epi64(T3, T6);
263
		T5 = _mm_mul_epu32(H3, p->S24.v); T6 = _mm_mul_epu32(H3, p->R20.v); T2 = _mm_add_epi64(T2, T5); T3 = _mm_add_epi64(T3, T6);
264
		T5 = _mm_mul_epu32(H4, p->S23.v); T6 = _mm_mul_epu32(H4, p->S24.v); T2 = _mm_add_epi64(T2, T5); T3 = _mm_add_epi64(T3, T6);
265
		T5 = _mm_mul_epu32(H1, p->R23.v);                                   T4 = _mm_add_epi64(T4, T5);
266
		T5 = _mm_mul_epu32(H2, p->R22.v);                                   T4 = _mm_add_epi64(T4, T5);
267
		T5 = _mm_mul_epu32(H3, p->R21.v);                                   T4 = _mm_add_epi64(T4, T5);
268
		T5 = _mm_mul_epu32(H4, p->R20.v);                                   T4 = _mm_add_epi64(T4, T5);
269
270
		/* H += [Mx,My]*[r^2,r^2] */
271
		T5 = _mm_unpacklo_epi64(_mm_loadl_epi64((xmmi *)(m + 0)), _mm_loadl_epi64((xmmi *)(m + 16)));
272
		T6 = _mm_unpacklo_epi64(_mm_loadl_epi64((xmmi *)(m + 8)), _mm_loadl_epi64((xmmi *)(m + 24)));
273
		M0 = _mm_and_si128(MMASK, T5);
274
		M1 = _mm_and_si128(MMASK, _mm_srli_epi64(T5, 26));
275
		T5 = _mm_or_si128(_mm_srli_epi64(T5, 52), _mm_slli_epi64(T6, 12));
276
		M2 = _mm_and_si128(MMASK, T5);
277
		M3 = _mm_and_si128(MMASK, _mm_srli_epi64(T5, 26));
278
		M4 = _mm_or_si128(_mm_srli_epi64(T6, 40), HIBIT);
279
280
		p = &st->P[1];
281
		T5 = _mm_mul_epu32(M0, p->R20.v); T6 = _mm_mul_epu32(M0, p->R21.v); T0 = _mm_add_epi64(T0, T5); T1 = _mm_add_epi64(T1, T6);
282
		T5 = _mm_mul_epu32(M1, p->S24.v); T6 = _mm_mul_epu32(M1, p->R20.v); T0 = _mm_add_epi64(T0, T5); T1 = _mm_add_epi64(T1, T6);
283
		T5 = _mm_mul_epu32(M2, p->S23.v); T6 = _mm_mul_epu32(M2, p->S24.v); T0 = _mm_add_epi64(T0, T5); T1 = _mm_add_epi64(T1, T6);
284
		T5 = _mm_mul_epu32(M3, p->S22.v); T6 = _mm_mul_epu32(M3, p->S23.v); T0 = _mm_add_epi64(T0, T5); T1 = _mm_add_epi64(T1, T6);
285
		T5 = _mm_mul_epu32(M4, p->S21.v); T6 = _mm_mul_epu32(M4, p->S22.v); T0 = _mm_add_epi64(T0, T5); T1 = _mm_add_epi64(T1, T6);
286
		T5 = _mm_mul_epu32(M0, p->R22.v); T6 = _mm_mul_epu32(M0, p->R23.v); T2 = _mm_add_epi64(T2, T5); T3 = _mm_add_epi64(T3, T6);
287
		T5 = _mm_mul_epu32(M1, p->R21.v); T6 = _mm_mul_epu32(M1, p->R22.v); T2 = _mm_add_epi64(T2, T5); T3 = _mm_add_epi64(T3, T6);
288
		T5 = _mm_mul_epu32(M2, p->R20.v); T6 = _mm_mul_epu32(M2, p->R21.v); T2 = _mm_add_epi64(T2, T5); T3 = _mm_add_epi64(T3, T6);
289
		T5 = _mm_mul_epu32(M3, p->S24.v); T6 = _mm_mul_epu32(M3, p->R20.v); T2 = _mm_add_epi64(T2, T5); T3 = _mm_add_epi64(T3, T6);
290
		T5 = _mm_mul_epu32(M4, p->S23.v); T6 = _mm_mul_epu32(M4, p->S24.v); T2 = _mm_add_epi64(T2, T5); T3 = _mm_add_epi64(T3, T6);
291
		T5 = _mm_mul_epu32(M0, p->R24.v);                                   T4 = _mm_add_epi64(T4, T5);
292
		T5 = _mm_mul_epu32(M1, p->R23.v);                                   T4 = _mm_add_epi64(T4, T5);
293
		T5 = _mm_mul_epu32(M2, p->R22.v);                                   T4 = _mm_add_epi64(T4, T5);
294
		T5 = _mm_mul_epu32(M3, p->R21.v);                                   T4 = _mm_add_epi64(T4, T5);
295
		T5 = _mm_mul_epu32(M4, p->R20.v);                                   T4 = _mm_add_epi64(T4, T5);
296
297
		/* H += [Mx,My] */
298
		T5 = _mm_unpacklo_epi64(_mm_loadl_epi64((xmmi *)(m + 32)), _mm_loadl_epi64((xmmi *)(m + 48)));
299
		T6 = _mm_unpacklo_epi64(_mm_loadl_epi64((xmmi *)(m + 40)), _mm_loadl_epi64((xmmi *)(m + 56)));
300
		M0 = _mm_and_si128(MMASK, T5);
301
		M1 = _mm_and_si128(MMASK, _mm_srli_epi64(T5, 26));
302
		T5 = _mm_or_si128(_mm_srli_epi64(T5, 52), _mm_slli_epi64(T6, 12));
303
		M2 = _mm_and_si128(MMASK, T5);
304
		M3 = _mm_and_si128(MMASK, _mm_srli_epi64(T5, 26));
305
		M4 = _mm_or_si128(_mm_srli_epi64(T6, 40), HIBIT);
306
307
		T0 = _mm_add_epi64(T0, M0);
308
		T1 = _mm_add_epi64(T1, M1);
309
		T2 = _mm_add_epi64(T2, M2);
310
		T3 = _mm_add_epi64(T3, M3);
311
		T4 = _mm_add_epi64(T4, M4);
312
313
		/* reduce */
314
		C1 = _mm_srli_epi64(T0, 26); C2 = _mm_srli_epi64(T3, 26); T0 = _mm_and_si128(T0, MMASK); T3 = _mm_and_si128(T3, MMASK); T1 = _mm_add_epi64(T1, C1); T4 = _mm_add_epi64(T4, C2);
315
		C1 = _mm_srli_epi64(T1, 26); C2 = _mm_srli_epi64(T4, 26); T1 = _mm_and_si128(T1, MMASK); T4 = _mm_and_si128(T4, MMASK); T2 = _mm_add_epi64(T2, C1); T0 = _mm_add_epi64(T0, _mm_mul_epu32(C2, FIVE));
316
		C1 = _mm_srli_epi64(T2, 26); C2 = _mm_srli_epi64(T0, 26); T2 = _mm_and_si128(T2, MMASK); T0 = _mm_and_si128(T0, MMASK); T3 = _mm_add_epi64(T3, C1); T1 = _mm_add_epi64(T1, C2);
317
		C1 = _mm_srli_epi64(T3, 26);                              T3 = _mm_and_si128(T3, MMASK);                                T4 = _mm_add_epi64(T4, C1);
318
319
		/* H = (H*[r^4,r^4] + [Mx,My]*[r^2,r^2] + [Mx,My]) */
320
		H0 = T0;
321
		H1 = T1;
322
		H2 = T2;
323
		H3 = T3;
324
		H4 = T4;
325
326
		m += 64;
327
		bytes -= 64;
328
	}
329
330
	st->H[0] = H0;
331
	st->H[1] = H1;
332
	st->H[2] = H2;
333
	st->H[3] = H3;
334
	st->H[4] = H4;
335
}
336
337
static size_t
338
poly1305_combine(poly1305_state_internal *st, const uint8_t *m, size_t bytes) {
339
	const xmmi MMASK = _mm_load_si128((xmmi *)poly1305_x64_sse2_message_mask);
340
	const xmmi HIBIT = _mm_load_si128((xmmi*)poly1305_x64_sse2_1shl128);
341
	const xmmi FIVE = _mm_load_si128((xmmi*)poly1305_x64_sse2_5);
342
343
	poly1305_power *p;
344
	xmmi H0,H1,H2,H3,H4;
345
	xmmi M0,M1,M2,M3,M4;
346
	xmmi T0,T1,T2,T3,T4,T5,T6;
347
	xmmi C1,C2;
348
349
	uint64_t r0,r1,r2;
350
	uint64_t t0,t1,t2,t3,t4;
351
	uint64_t c;
352
	size_t consumed = 0;
353
354
	H0 = st->H[0];
355
	H1 = st->H[1];
356
	H2 = st->H[2];
357
	H3 = st->H[3];
358
	H4 = st->H[4];
359
360
	/* p = [r^2,r^2] */
361
	p = &st->P[1];
362
363
	if (bytes >= 32) {
364
		/* H *= [r^2,r^2] */
365
		T0 = _mm_mul_epu32(H0, p->R20.v);
366
		T1 = _mm_mul_epu32(H0, p->R21.v);
367
		T2 = _mm_mul_epu32(H0, p->R22.v);
368
		T3 = _mm_mul_epu32(H0, p->R23.v);
369
		T4 = _mm_mul_epu32(H0, p->R24.v);
370
		T5 = _mm_mul_epu32(H1, p->S24.v); T6 = _mm_mul_epu32(H1, p->R20.v); T0 = _mm_add_epi64(T0, T5); T1 = _mm_add_epi64(T1, T6);
371
		T5 = _mm_mul_epu32(H2, p->S23.v); T6 = _mm_mul_epu32(H2, p->S24.v); T0 = _mm_add_epi64(T0, T5); T1 = _mm_add_epi64(T1, T6);
372
		T5 = _mm_mul_epu32(H3, p->S22.v); T6 = _mm_mul_epu32(H3, p->S23.v); T0 = _mm_add_epi64(T0, T5); T1 = _mm_add_epi64(T1, T6);
373
		T5 = _mm_mul_epu32(H4, p->S21.v); T6 = _mm_mul_epu32(H4, p->S22.v); T0 = _mm_add_epi64(T0, T5); T1 = _mm_add_epi64(T1, T6);
374
		T5 = _mm_mul_epu32(H1, p->R21.v); T6 = _mm_mul_epu32(H1, p->R22.v); T2 = _mm_add_epi64(T2, T5); T3 = _mm_add_epi64(T3, T6);
375
		T5 = _mm_mul_epu32(H2, p->R20.v); T6 = _mm_mul_epu32(H2, p->R21.v); T2 = _mm_add_epi64(T2, T5); T3 = _mm_add_epi64(T3, T6);
376
		T5 = _mm_mul_epu32(H3, p->S24.v); T6 = _mm_mul_epu32(H3, p->R20.v); T2 = _mm_add_epi64(T2, T5); T3 = _mm_add_epi64(T3, T6);
377
		T5 = _mm_mul_epu32(H4, p->S23.v); T6 = _mm_mul_epu32(H4, p->S24.v); T2 = _mm_add_epi64(T2, T5); T3 = _mm_add_epi64(T3, T6);
378
		T5 = _mm_mul_epu32(H1, p->R23.v);                                   T4 = _mm_add_epi64(T4, T5);
379
		T5 = _mm_mul_epu32(H2, p->R22.v);                                   T4 = _mm_add_epi64(T4, T5);
380
		T5 = _mm_mul_epu32(H3, p->R21.v);                                   T4 = _mm_add_epi64(T4, T5);
381
		T5 = _mm_mul_epu32(H4, p->R20.v);                                   T4 = _mm_add_epi64(T4, T5);
382
383
		/* H += [Mx,My] */
384
		T5 = _mm_unpacklo_epi64(_mm_loadl_epi64((xmmi *)(m + 0)), _mm_loadl_epi64((xmmi *)(m + 16)));
385
		T6 = _mm_unpacklo_epi64(_mm_loadl_epi64((xmmi *)(m + 8)), _mm_loadl_epi64((xmmi *)(m + 24)));
386
		M0 = _mm_and_si128(MMASK, T5);
387
		M1 = _mm_and_si128(MMASK, _mm_srli_epi64(T5, 26));
388
		T5 = _mm_or_si128(_mm_srli_epi64(T5, 52), _mm_slli_epi64(T6, 12));
389
		M2 = _mm_and_si128(MMASK, T5);
390
		M3 = _mm_and_si128(MMASK, _mm_srli_epi64(T5, 26));
391
		M4 = _mm_or_si128(_mm_srli_epi64(T6, 40), HIBIT);
392
393
		T0 = _mm_add_epi64(T0, M0);
394
		T1 = _mm_add_epi64(T1, M1);
395
		T2 = _mm_add_epi64(T2, M2);
396
		T3 = _mm_add_epi64(T3, M3);
397
		T4 = _mm_add_epi64(T4, M4);
398
399
		/* reduce */
400
		C1 = _mm_srli_epi64(T0, 26); C2 = _mm_srli_epi64(T3, 26); T0 = _mm_and_si128(T0, MMASK); T3 = _mm_and_si128(T3, MMASK); T1 = _mm_add_epi64(T1, C1); T4 = _mm_add_epi64(T4, C2);
401
		C1 = _mm_srli_epi64(T1, 26); C2 = _mm_srli_epi64(T4, 26); T1 = _mm_and_si128(T1, MMASK); T4 = _mm_and_si128(T4, MMASK); T2 = _mm_add_epi64(T2, C1); T0 = _mm_add_epi64(T0, _mm_mul_epu32(C2, FIVE));
402
		C1 = _mm_srli_epi64(T2, 26); C2 = _mm_srli_epi64(T0, 26); T2 = _mm_and_si128(T2, MMASK); T0 = _mm_and_si128(T0, MMASK); T3 = _mm_add_epi64(T3, C1); T1 = _mm_add_epi64(T1, C2);
403
		C1 = _mm_srli_epi64(T3, 26);                              T3 = _mm_and_si128(T3, MMASK);                                T4 = _mm_add_epi64(T4, C1);
404
405
		/* H = (H*[r^2,r^2] + [Mx,My]) */
406
		H0 = T0;
407
		H1 = T1;
408
		H2 = T2;
409
		H3 = T3;
410
		H4 = T4;
411
412
		consumed = 32;
413
	}
414
415
	/* finalize, H *= [r^2,r] */
416
	r0 = ((uint64_t)p->R20.d[3] << 32) | (uint64_t)p->R20.d[1];
417
	r1 = ((uint64_t)p->R21.d[3] << 32) | (uint64_t)p->R21.d[1];
418
	r2 = ((uint64_t)p->R22.d[3] << 32) | (uint64_t)p->R22.d[1];
419
420
	p->R20.d[2] = (uint32_t)( r0                    ) & 0x3ffffff;
421
	p->R21.d[2] = (uint32_t)((r0 >> 26) | (r1 << 18)) & 0x3ffffff;
422
	p->R22.d[2] = (uint32_t)((r1 >> 8)              ) & 0x3ffffff;
423
	p->R23.d[2] = (uint32_t)((r1 >> 34) | (r2 << 10)) & 0x3ffffff;
424
	p->R24.d[2] = (uint32_t)((r2 >> 16)             )            ;
425
	p->S21.d[2] = p->R21.d[2] * 5;
426
	p->S22.d[2] = p->R22.d[2] * 5;
427
	p->S23.d[2] = p->R23.d[2] * 5;
428
	p->S24.d[2] = p->R24.d[2] * 5;
429
430
	/* H *= [r^2,r] */
431
	T0 = _mm_mul_epu32(H0, p->R20.v);
432
	T1 = _mm_mul_epu32(H0, p->R21.v);
433
	T2 = _mm_mul_epu32(H0, p->R22.v);
434
	T3 = _mm_mul_epu32(H0, p->R23.v);
435
	T4 = _mm_mul_epu32(H0, p->R24.v);
436
	T5 = _mm_mul_epu32(H1, p->S24.v); T6 = _mm_mul_epu32(H1, p->R20.v); T0 = _mm_add_epi64(T0, T5); T1 = _mm_add_epi64(T1, T6);
437
	T5 = _mm_mul_epu32(H2, p->S23.v); T6 = _mm_mul_epu32(H2, p->S24.v); T0 = _mm_add_epi64(T0, T5); T1 = _mm_add_epi64(T1, T6);
438
	T5 = _mm_mul_epu32(H3, p->S22.v); T6 = _mm_mul_epu32(H3, p->S23.v); T0 = _mm_add_epi64(T0, T5); T1 = _mm_add_epi64(T1, T6);
439
	T5 = _mm_mul_epu32(H4, p->S21.v); T6 = _mm_mul_epu32(H4, p->S22.v); T0 = _mm_add_epi64(T0, T5); T1 = _mm_add_epi64(T1, T6);
440
	T5 = _mm_mul_epu32(H1, p->R21.v); T6 = _mm_mul_epu32(H1, p->R22.v); T2 = _mm_add_epi64(T2, T5); T3 = _mm_add_epi64(T3, T6);
441
	T5 = _mm_mul_epu32(H2, p->R20.v); T6 = _mm_mul_epu32(H2, p->R21.v); T2 = _mm_add_epi64(T2, T5); T3 = _mm_add_epi64(T3, T6);
442
	T5 = _mm_mul_epu32(H3, p->S24.v); T6 = _mm_mul_epu32(H3, p->R20.v); T2 = _mm_add_epi64(T2, T5); T3 = _mm_add_epi64(T3, T6);
443
	T5 = _mm_mul_epu32(H4, p->S23.v); T6 = _mm_mul_epu32(H4, p->S24.v); T2 = _mm_add_epi64(T2, T5); T3 = _mm_add_epi64(T3, T6);
444
	T5 = _mm_mul_epu32(H1, p->R23.v);                                   T4 = _mm_add_epi64(T4, T5);
445
	T5 = _mm_mul_epu32(H2, p->R22.v);                                   T4 = _mm_add_epi64(T4, T5);
446
	T5 = _mm_mul_epu32(H3, p->R21.v);                                   T4 = _mm_add_epi64(T4, T5);
447
	T5 = _mm_mul_epu32(H4, p->R20.v);                                   T4 = _mm_add_epi64(T4, T5);
448
449
	C1 = _mm_srli_epi64(T0, 26); C2 = _mm_srli_epi64(T3, 26); T0 = _mm_and_si128(T0, MMASK); T3 = _mm_and_si128(T3, MMASK); T1 = _mm_add_epi64(T1, C1); T4 = _mm_add_epi64(T4, C2);
450
	C1 = _mm_srli_epi64(T1, 26); C2 = _mm_srli_epi64(T4, 26); T1 = _mm_and_si128(T1, MMASK); T4 = _mm_and_si128(T4, MMASK); T2 = _mm_add_epi64(T2, C1); T0 = _mm_add_epi64(T0, _mm_mul_epu32(C2, FIVE));
451
	C1 = _mm_srli_epi64(T2, 26); C2 = _mm_srli_epi64(T0, 26); T2 = _mm_and_si128(T2, MMASK); T0 = _mm_and_si128(T0, MMASK); T3 = _mm_add_epi64(T3, C1); T1 = _mm_add_epi64(T1, C2);
452
	C1 = _mm_srli_epi64(T3, 26);                              T3 = _mm_and_si128(T3, MMASK);                                T4 = _mm_add_epi64(T4, C1);
453
454
	/* H = H[0]+H[1] */
455
	H0 = _mm_add_epi64(T0, _mm_srli_si128(T0, 8));
456
	H1 = _mm_add_epi64(T1, _mm_srli_si128(T1, 8));
457
	H2 = _mm_add_epi64(T2, _mm_srli_si128(T2, 8));
458
	H3 = _mm_add_epi64(T3, _mm_srli_si128(T3, 8));
459
	H4 = _mm_add_epi64(T4, _mm_srli_si128(T4, 8));
460
461
	t0 = _mm_cvtsi128_si32(H0)    ; c = (t0 >> 26); t0 &= 0x3ffffff;
462
	t1 = _mm_cvtsi128_si32(H1) + c; c = (t1 >> 26); t1 &= 0x3ffffff;
463
	t2 = _mm_cvtsi128_si32(H2) + c; c = (t2 >> 26); t2 &= 0x3ffffff;
464
	t3 = _mm_cvtsi128_si32(H3) + c; c = (t3 >> 26); t3 &= 0x3ffffff;
465
	t4 = _mm_cvtsi128_si32(H4) + c; c = (t4 >> 26); t4 &= 0x3ffffff;
466
	t0 =              t0 + (c * 5); c = (t0 >> 26); t0 &= 0x3ffffff;
467
	t1 =              t1 + c;
468
469
	st->HH[0] =  ((t0      ) | (t1 << 26)             ) & 0xfffffffffffull;
470
	st->HH[1] =  ((t1 >> 18) | (t2 <<  8) | (t3 << 34)) & 0xfffffffffffull;
471
	st->HH[2] =  ((t3 >> 10) | (t4 << 16)             ) & 0x3ffffffffffull;
472
473
	return consumed;
474
}
475
476
void
477
Poly1305Update(poly1305_state *state, const unsigned char *m, size_t bytes) {
478
	poly1305_state_internal *st = poly1305_aligned_state(state);
479
	size_t want;
480
481
	/* need at least 32 initial bytes to start the accelerated branch */
482
	if (!st->started) {
483
		if ((st->leftover == 0) && (bytes > 32)) {
484
			poly1305_first_block(st, m);
485
			m += 32;
486
			bytes -= 32;
487
		} else {
488
			want = poly1305_min(32 - st->leftover, bytes);
489
			poly1305_block_copy(st->buffer + st->leftover, m, want);
490
			bytes -= want;
491
			m += want;
492
			st->leftover += want;
493
			if ((st->leftover < 32) || (bytes == 0))
494
				return;
495
			poly1305_first_block(st, st->buffer);
496
			st->leftover = 0;
497
		}
498
		st->started = 1;
499
	}
500
501
	/* handle leftover */
502
	if (st->leftover) {
503
		want = poly1305_min(64 - st->leftover, bytes);
504
		poly1305_block_copy(st->buffer + st->leftover, m, want);
505
		bytes -= want;
506
		m += want;
507
		st->leftover += want;
508
		if (st->leftover < 64)
509
			return;
510
		poly1305_blocks(st, st->buffer, 64);
511
		st->leftover = 0;
512
	}
513
514
	/* process 64 byte blocks */
515
	if (bytes >= 64) {
516
		want = (bytes & ~63);
517
		poly1305_blocks(st, m, want);
518
		m += want;
519
		bytes -= want;
520
	}
521
522
	if (bytes) {
523
		poly1305_block_copy(st->buffer + st->leftover, m, bytes);
524
		st->leftover += bytes;
525
	}
526
}
527
528
void
529
Poly1305Finish(poly1305_state *state, unsigned char mac[16]) {
530
	poly1305_state_internal *st = poly1305_aligned_state(state);
531
	size_t leftover = st->leftover;
532
	uint8_t *m = st->buffer;
533
	uint128_t d[3];
534
	uint64_t h0,h1,h2;
535
	uint64_t t0,t1;
536
	uint64_t g0,g1,g2,c,nc;
537
	uint64_t r0,r1,r2,s1,s2;
538
	poly1305_power *p;
539
540
	if (st->started) {
541
		size_t consumed = poly1305_combine(st, m, leftover);
542
		leftover -= consumed;
543
		m += consumed;
544
	}
545
546
	/* st->HH will either be 0 or have the combined result */
547
	h0 = st->HH[0];
548
	h1 = st->HH[1];
549
	h2 = st->HH[2];
550
551
	p = &st->P[1];
552
	r0 = ((uint64_t)p->R20.d[3] << 32) | (uint64_t)p->R20.d[1];
553
	r1 = ((uint64_t)p->R21.d[3] << 32) | (uint64_t)p->R21.d[1];
554
	r2 = ((uint64_t)p->R22.d[3] << 32) | (uint64_t)p->R22.d[1];
555
	s1 = r1 * (5 << 2);
556
	s2 = r2 * (5 << 2);
557
558
	if (leftover < 16)
559
		goto poly1305_donna_atmost15bytes;
560
561
poly1305_donna_atleast16bytes:
562
	t0 = U8TO64_LE(m + 0);
563
	t1 = U8TO64_LE(m + 8);
564
	h0 += t0 & 0xfffffffffff;
565
	t0 = shr128_pair(t1, t0, 44);
566
	h1 += t0 & 0xfffffffffff;
567
	h2 += (t1 >> 24) | ((uint64_t)1 << 40);
568
569
poly1305_donna_mul:
570
	d[0] = add128(add128(mul64x64_128(h0, r0), mul64x64_128(h1, s2)), mul64x64_128(h2, s1));
571
	d[1] = add128(add128(mul64x64_128(h0, r1), mul64x64_128(h1, r0)), mul64x64_128(h2, s2));
572
	d[2] = add128(add128(mul64x64_128(h0, r2), mul64x64_128(h1, r1)), mul64x64_128(h2, r0));
573
	                           h0 = lo128(d[0]) & 0xfffffffffff; c = shr128(d[0], 44);
574
	d[1] = add128_64(d[1], c); h1 = lo128(d[1]) & 0xfffffffffff; c = shr128(d[1], 44);
575
	d[2] = add128_64(d[2], c); h2 = lo128(d[2]) & 0x3ffffffffff; c = shr128(d[2], 42);
576
	h0   += c * 5;
577
578
	m += 16;
579
	leftover -= 16;
580
	if (leftover >= 16) goto poly1305_donna_atleast16bytes;
581
582
	/* final bytes */
583
poly1305_donna_atmost15bytes:
584
	if (!leftover) goto poly1305_donna_finish;
585
586
	m[leftover++] = 1;
587
	poly1305_block_zero(m + leftover, 16 - leftover);
588
	leftover = 16;
589
590
	t0 = U8TO64_LE(m+0);
591
	t1 = U8TO64_LE(m+8);
592
	h0 += t0 & 0xfffffffffff; t0 = shr128_pair(t1, t0, 44);
593
	h1 += t0 & 0xfffffffffff;
594
	h2 += (t1 >> 24);
595
596
	goto poly1305_donna_mul;
597
598
poly1305_donna_finish:
599
	             c = (h0 >> 44); h0 &= 0xfffffffffff;
600
	h1 += c;     c = (h1 >> 44); h1 &= 0xfffffffffff;
601
	h2 += c;     c = (h2 >> 42); h2 &= 0x3ffffffffff;
602
	h0 += c * 5;
603
604
	g0 = h0 + 5; c = (g0 >> 44); g0 &= 0xfffffffffff;
605
	g1 = h1 + c; c = (g1 >> 44); g1 &= 0xfffffffffff;
606
	g2 = h2 + c - ((uint64_t)1 << 42);
607
608
	c = (g2 >> 63) - 1;
609
	nc = ~c;
610
	h0 = (h0 & nc) | (g0 & c);
611
	h1 = (h1 & nc) | (g1 & c);
612
	h2 = (h2 & nc) | (g2 & c);
613
614
	/* pad */
615
	t0 = ((uint64_t)p->R23.d[3] << 32) | (uint64_t)p->R23.d[1];
616
	t1 = ((uint64_t)p->R24.d[3] << 32) | (uint64_t)p->R24.d[1];
617
	h0 += (t0 & 0xfffffffffff)    ; c = (h0 >> 44); h0 &= 0xfffffffffff; t0 = shr128_pair(t1, t0, 44);
618
	h1 += (t0 & 0xfffffffffff) + c; c = (h1 >> 44); h1 &= 0xfffffffffff; t1 = (t1 >> 24);
619
	h2 += (t1                ) + c;
620
621
	U64TO8_LE(mac + 0, ((h0      ) | (h1 << 44)));
622
	U64TO8_LE(mac + 8, ((h1 >> 20) | (h2 << 24)));
623
}
(-)b008c4b827be (+254 lines)
Added Link Here 
Added Link Here 
1
/* This Source Code Form is subject to the terms of the Mozilla Public
2
 * License, v. 2.0. If a copy of the MPL was not distributed with this
3
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5
/* This implementation of poly1305 is by Andrew Moon
6
 * (https://github.com/floodyberry/poly1305-donna) and released as public
7
 * domain. */
8
9
#include <string.h>
10
#include <stdint.h>
11
12
#include "poly1305.h"
13
14
#if defined(__i386) || defined(__i386__) || defined(__x86_64) || defined(__x86_64__)
15
/* We can assume little-endian. */
16
static uint32_t U8TO32_LE(const unsigned char *m) {
17
	uint32_t r;
18
	memcpy(&r, m, sizeof(r));
19
	return r;
20
}
21
22
static void U32TO8_LE(unsigned char *m, uint32_t v) {
23
	memcpy(m, &v, sizeof(v));
24
}
25
#else
26
static void U8TO32_LE(const unsigned char *m) {
27
	return (uint32_t)m[0] |
28
	       (uint32_t)m[1] << 8 |
29
	       (uint32_t)m[2] << 16 |
30
	       (uint32_t)m[3] << 24;
31
}
32
33
static void U32TO8_LE(unsigned char *m, uint32_t v) {
34
	m[0] = v;
35
	m[1] = v >> 8;
36
	m[2] = v >> 16;
37
	m[3] = v >> 24;
38
}
39
#endif
40
41
static uint64_t
42
mul32x32_64(uint32_t a, uint32_t b) {
43
	return (uint64_t)a * b;
44
}
45
46
struct poly1305_state_st {
47
	uint32_t r0,r1,r2,r3,r4;
48
	uint32_t s1,s2,s3,s4;
49
	uint32_t h0,h1,h2,h3,h4;
50
	unsigned char buf[16];
51
	unsigned int buf_used;
52
	unsigned char key[16];
53
};
54
55
/* update updates |state| given some amount of input data. This function may
56
 * only be called with a |len| that is not a multiple of 16 at the end of the
57
 * data. Otherwise the input must be buffered into 16 byte blocks. */
58
static void update(struct poly1305_state_st *state, const unsigned char *in,
59
		   size_t len) {
60
	uint32_t t0,t1,t2,t3;
61
	uint64_t t[5];
62
	uint32_t b;
63
	uint64_t c;
64
	size_t j;
65
	unsigned char mp[16];
66
67
	if (len < 16)
68
		goto poly1305_donna_atmost15bytes;
69
70
poly1305_donna_16bytes:
71
	t0 = U8TO32_LE(in);
72
	t1 = U8TO32_LE(in+4);
73
	t2 = U8TO32_LE(in+8);
74
	t3 = U8TO32_LE(in+12);
75
76
	in += 16;
77
	len -= 16;
78
79
	state->h0 += t0 & 0x3ffffff;
80
	state->h1 += ((((uint64_t)t1 << 32) | t0) >> 26) & 0x3ffffff;
81
	state->h2 += ((((uint64_t)t2 << 32) | t1) >> 20) & 0x3ffffff;
82
	state->h3 += ((((uint64_t)t3 << 32) | t2) >> 14) & 0x3ffffff;
83
	state->h4 += (t3 >> 8) | (1 << 24);
84
85
poly1305_donna_mul:
86
	t[0] = mul32x32_64(state->h0,state->r0) +
87
	       mul32x32_64(state->h1,state->s4) +
88
	       mul32x32_64(state->h2,state->s3) +
89
	       mul32x32_64(state->h3,state->s2) +
90
	       mul32x32_64(state->h4,state->s1);
91
	t[1] = mul32x32_64(state->h0,state->r1) +
92
	       mul32x32_64(state->h1,state->r0) +
93
	       mul32x32_64(state->h2,state->s4) +
94
	       mul32x32_64(state->h3,state->s3) +
95
	       mul32x32_64(state->h4,state->s2);
96
	t[2] = mul32x32_64(state->h0,state->r2) +
97
	       mul32x32_64(state->h1,state->r1) +
98
	       mul32x32_64(state->h2,state->r0) +
99
	       mul32x32_64(state->h3,state->s4) +
100
	       mul32x32_64(state->h4,state->s3);
101
	t[3] = mul32x32_64(state->h0,state->r3) +
102
	       mul32x32_64(state->h1,state->r2) +
103
	       mul32x32_64(state->h2,state->r1) +
104
	       mul32x32_64(state->h3,state->r0) +
105
	       mul32x32_64(state->h4,state->s4);
106
	t[4] = mul32x32_64(state->h0,state->r4) +
107
	       mul32x32_64(state->h1,state->r3) +
108
	       mul32x32_64(state->h2,state->r2) +
109
	       mul32x32_64(state->h3,state->r1) +
110
	       mul32x32_64(state->h4,state->r0);
111
112
	           state->h0 = (uint32_t)t[0] & 0x3ffffff; c =           (t[0] >> 26);
113
	t[1] += c; state->h1 = (uint32_t)t[1] & 0x3ffffff; b = (uint32_t)(t[1] >> 26);
114
	t[2] += b; state->h2 = (uint32_t)t[2] & 0x3ffffff; b = (uint32_t)(t[2] >> 26);
115
	t[3] += b; state->h3 = (uint32_t)t[3] & 0x3ffffff; b = (uint32_t)(t[3] >> 26);
116
	t[4] += b; state->h4 = (uint32_t)t[4] & 0x3ffffff; b = (uint32_t)(t[4] >> 26);
117
	state->h0 += b * 5;
118
119
	if (len >= 16)
120
		goto poly1305_donna_16bytes;
121
122
	/* final bytes */
123
poly1305_donna_atmost15bytes:
124
	if (!len)
125
		return;
126
127
	for (j = 0; j < len; j++)
128
		mp[j] = in[j];
129
	mp[j++] = 1;
130
	for (; j < 16; j++)
131
		mp[j] = 0;
132
	len = 0;
133
134
	t0 = U8TO32_LE(mp+0);
135
	t1 = U8TO32_LE(mp+4);
136
	t2 = U8TO32_LE(mp+8);
137
	t3 = U8TO32_LE(mp+12);
138
139
	state->h0 += t0 & 0x3ffffff;
140
	state->h1 += ((((uint64_t)t1 << 32) | t0) >> 26) & 0x3ffffff;
141
	state->h2 += ((((uint64_t)t2 << 32) | t1) >> 20) & 0x3ffffff;
142
	state->h3 += ((((uint64_t)t3 << 32) | t2) >> 14) & 0x3ffffff;
143
	state->h4 += (t3 >> 8);
144
145
	goto poly1305_donna_mul;
146
}
147
148
void Poly1305Init(poly1305_state *statep, const unsigned char key[32]) {
149
	struct poly1305_state_st *state = (struct poly1305_state_st*) statep;
150
	uint32_t t0,t1,t2,t3;
151
152
	t0 = U8TO32_LE(key+0);
153
	t1 = U8TO32_LE(key+4);
154
	t2 = U8TO32_LE(key+8);
155
	t3 = U8TO32_LE(key+12);
156
157
	/* precompute multipliers */
158
	state->r0 = t0 & 0x3ffffff; t0 >>= 26; t0 |= t1 << 6;
159
	state->r1 = t0 & 0x3ffff03; t1 >>= 20; t1 |= t2 << 12;
160
	state->r2 = t1 & 0x3ffc0ff; t2 >>= 14; t2 |= t3 << 18;
161
	state->r3 = t2 & 0x3f03fff; t3 >>= 8;
162
	state->r4 = t3 & 0x00fffff;
163
164
	state->s1 = state->r1 * 5;
165
	state->s2 = state->r2 * 5;
166
	state->s3 = state->r3 * 5;
167
	state->s4 = state->r4 * 5;
168
169
	/* init state */
170
	state->h0 = 0;
171
	state->h1 = 0;
172
	state->h2 = 0;
173
	state->h3 = 0;
174
	state->h4 = 0;
175
176
	state->buf_used = 0;
177
	memcpy(state->key, key + 16, sizeof(state->key));
178
}
179
180
void Poly1305Update(poly1305_state *statep, const unsigned char *in,
181
		     size_t in_len) {
182
	unsigned int i;
183
	struct poly1305_state_st *state = (struct poly1305_state_st*) statep;
184
185
	if (state->buf_used) {
186
		unsigned int todo = 16 - state->buf_used;
187
		if (todo > in_len)
188
			todo = in_len;
189
		for (i = 0; i < todo; i++)
190
			state->buf[state->buf_used + i] = in[i];
191
		state->buf_used += todo;
192
		in_len -= todo;
193
		in += todo;
194
195
		if (state->buf_used == 16) {
196
			update(state, state->buf, 16);
197
			state->buf_used = 0;
198
		}
199
	}
200
201
	if (in_len >= 16) {
202
		size_t todo = in_len & ~0xf;
203
		update(state, in, todo);
204
		in += todo;
205
		in_len &= 0xf;
206
	}
207
208
	if (in_len) {
209
		for (i = 0; i < in_len; i++)
210
			state->buf[i] = in[i];
211
		state->buf_used = in_len;
212
	}
213
}
214
215
void Poly1305Finish(poly1305_state *statep, unsigned char mac[16]) {
216
	struct poly1305_state_st *state = (struct poly1305_state_st*) statep;
217
	uint64_t f0,f1,f2,f3;
218
	uint32_t g0,g1,g2,g3,g4;
219
	uint32_t b, nb;
220
221
	if (state->buf_used)
222
		update(state, state->buf, state->buf_used);
223
224
	                    b = state->h0 >> 26; state->h0 = state->h0 & 0x3ffffff;
225
	state->h1 +=     b; b = state->h1 >> 26; state->h1 = state->h1 & 0x3ffffff;
226
	state->h2 +=     b; b = state->h2 >> 26; state->h2 = state->h2 & 0x3ffffff;
227
	state->h3 +=     b; b = state->h3 >> 26; state->h3 = state->h3 & 0x3ffffff;
228
	state->h4 +=     b; b = state->h4 >> 26; state->h4 = state->h4 & 0x3ffffff;
229
	state->h0 += b * 5;
230
231
	g0 = state->h0 + 5; b = g0 >> 26; g0 &= 0x3ffffff;
232
	g1 = state->h1 + b; b = g1 >> 26; g1 &= 0x3ffffff;
233
	g2 = state->h2 + b; b = g2 >> 26; g2 &= 0x3ffffff;
234
	g3 = state->h3 + b; b = g3 >> 26; g3 &= 0x3ffffff;
235
	g4 = state->h4 + b - (1 << 26);
236
237
	b = (g4 >> 31) - 1;
238
	nb = ~b;
239
	state->h0 = (state->h0 & nb) | (g0 & b);
240
	state->h1 = (state->h1 & nb) | (g1 & b);
241
	state->h2 = (state->h2 & nb) | (g2 & b);
242
	state->h3 = (state->h3 & nb) | (g3 & b);
243
	state->h4 = (state->h4 & nb) | (g4 & b);
244
245
	f0 = ((state->h0      ) | (state->h1 << 26)) + (uint64_t)U8TO32_LE(&state->key[0]);
246
	f1 = ((state->h1 >>  6) | (state->h2 << 20)) + (uint64_t)U8TO32_LE(&state->key[4]);
247
	f2 = ((state->h2 >> 12) | (state->h3 << 14)) + (uint64_t)U8TO32_LE(&state->key[8]);
248
	f3 = ((state->h3 >> 18) | (state->h4 <<  8)) + (uint64_t)U8TO32_LE(&state->key[12]);
249
250
	U32TO8_LE(&mac[ 0], f0); f1 += (f0 >> 32);
251
	U32TO8_LE(&mac[ 4], f1); f2 += (f1 >> 32);
252
	U32TO8_LE(&mac[ 8], f2); f3 += (f2 >> 32);
253
	U32TO8_LE(&mac[12], f3);
254
}
(-)b008c4b827be (+31 lines)
Added Link Here 
Added Link Here 
1
/*
2
 * poly1305.h - header file for Poly1305 implementation.
3
 *
4
 * This Source Code Form is subject to the terms of the Mozilla Public
5
 * License, v. 2.0. If a copy of the MPL was not distributed with this
6
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7
8
#ifndef FREEBL_POLY1305_H_
9
#define FREEBL_POLY1305_H_
10
11
typedef unsigned char poly1305_state[512];
12
13
/* Poly1305Init sets up |state| so that it can be used to calculate an
14
 * authentication tag with the one-time key |key|. Note that |key| is a
15
 * one-time key and therefore there is no `reset' method because that would
16
 * enable several messages to be authenticated with the same key. */
17
extern void Poly1305Init(poly1305_state* state,
18
			 const unsigned char key[32]);
19
20
/* Poly1305Update processes |in_len| bytes from |in|. It can be called zero or
21
 * more times after poly1305_init. */
22
extern void Poly1305Update(poly1305_state* state,
23
			   const unsigned char *in,
24
			   size_t inLen);
25
26
/* Poly1305Finish completes the poly1305 calculation and writes a 16 byte
27
 * authentication tag to |mac|. */
28
extern void Poly1305Finish(poly1305_state* state,
29
			   unsigned char mac[16]);
30
31
#endif  /* FREEBL_POLY1305_H_ */
(-)a/lib/pk11wrap/pk11mech.c (+4 lines)
Line     Link Here 
 Lines 389-408    Link Here 
389
    case CKM_SHA384_HMAC_GENERAL:
389
    case CKM_SHA384_HMAC_GENERAL:
390
    case CKM_SHA512_HMAC:
390
    case CKM_SHA512_HMAC:
391
    case CKM_SHA512_HMAC_GENERAL:
391
    case CKM_SHA512_HMAC_GENERAL:
392
    case CKM_MD2_HMAC:
392
    case CKM_MD2_HMAC:
393
    case CKM_MD2_HMAC_GENERAL:
393
    case CKM_MD2_HMAC_GENERAL:
394
    case CKM_MD5_HMAC:
394
    case CKM_MD5_HMAC:
395
    case CKM_MD5_HMAC_GENERAL:
395
    case CKM_MD5_HMAC_GENERAL:
396
    case CKM_TLS_PRF_GENERAL:
396
    case CKM_TLS_PRF_GENERAL:
397
    case CKM_NSS_TLS_PRF_GENERAL_SHA256:
397
    case CKM_NSS_TLS_PRF_GENERAL_SHA256:
398
	return CKK_GENERIC_SECRET;
398
	return CKK_GENERIC_SECRET;
399
    case CKM_NSS_CHACHA20_POLY1305:
400
	return CKK_NSS_CHACHA20;
399
    default:
401
    default:
400
	return pk11_lookup(type)->keyType;
402
	return pk11_lookup(type)->keyType;
401
    }
403
    }
402
}
404
}
403
405
404
/*
406
/*
405
 * Get the Key Gen Mechanism needed for the given 
407
 * Get the Key Gen Mechanism needed for the given 
406
 * crypto mechanism
408
 * crypto mechanism
407
 */
409
 */
408
CK_MECHANISM_TYPE
410
CK_MECHANISM_TYPE
 Lines 606-625    Link Here 
606
    case CKM_NETSCAPE_PBE_SHA1_TRIPLE_DES_CBC:
608
    case CKM_NETSCAPE_PBE_SHA1_TRIPLE_DES_CBC:
607
    case CKM_NETSCAPE_PBE_SHA1_FAULTY_3DES_CBC:
609
    case CKM_NETSCAPE_PBE_SHA1_FAULTY_3DES_CBC:
608
    case CKM_PBE_SHA1_RC2_40_CBC:
610
    case CKM_PBE_SHA1_RC2_40_CBC:
609
    case CKM_PBE_SHA1_RC2_128_CBC:
611
    case CKM_PBE_SHA1_RC2_128_CBC:
610
    case CKM_PBE_SHA1_RC4_40:
612
    case CKM_PBE_SHA1_RC4_40:
611
    case CKM_PBE_SHA1_RC4_128:
613
    case CKM_PBE_SHA1_RC4_128:
612
    case CKM_PBE_SHA1_DES3_EDE_CBC:
614
    case CKM_PBE_SHA1_DES3_EDE_CBC:
613
    case CKM_PBE_SHA1_DES2_EDE_CBC:
615
    case CKM_PBE_SHA1_DES2_EDE_CBC:
614
    case CKM_PKCS5_PBKD2:
616
    case CKM_PKCS5_PBKD2:
615
    	return type;
617
    	return type;
618
    case CKM_NSS_CHACHA20_POLY1305:
619
	return CKM_NSS_CHACHA20_KEY_GEN;
616
    default:
620
    default:
617
	return pk11_lookup(type)->keyGen;
621
	return pk11_lookup(type)->keyGen;
618
    }
622
    }
619
}
623
}
620
624
621
/*
625
/*
622
 * get the mechanism block size
626
 * get the mechanism block size
623
 */
627
 */
624
int
628
int
625
PK11_GetBlockSize(CK_MECHANISM_TYPE type,SECItem *params)
629
PK11_GetBlockSize(CK_MECHANISM_TYPE type,SECItem *params)
(-)a/lib/softoken/pkcs11.c (-1 / +3 lines)
Line     Link Here 
 Lines 496-516    Link Here 
496
     {CKM_NSS_JPAKE_ROUND2_SHA1,        {0, 0, CKF_DERIVE}, PR_TRUE},
496
     {CKM_NSS_JPAKE_ROUND2_SHA1,        {0, 0, CKF_DERIVE}, PR_TRUE},
497
     {CKM_NSS_JPAKE_ROUND2_SHA256,      {0, 0, CKF_DERIVE}, PR_TRUE},
497
     {CKM_NSS_JPAKE_ROUND2_SHA256,      {0, 0, CKF_DERIVE}, PR_TRUE},
498
     {CKM_NSS_JPAKE_ROUND2_SHA384,      {0, 0, CKF_DERIVE}, PR_TRUE},
498
     {CKM_NSS_JPAKE_ROUND2_SHA384,      {0, 0, CKF_DERIVE}, PR_TRUE},
499
     {CKM_NSS_JPAKE_ROUND2_SHA512,      {0, 0, CKF_DERIVE}, PR_TRUE},
499
     {CKM_NSS_JPAKE_ROUND2_SHA512,      {0, 0, CKF_DERIVE}, PR_TRUE},
500
     {CKM_NSS_JPAKE_FINAL_SHA1,         {0, 0, CKF_DERIVE}, PR_TRUE},
500
     {CKM_NSS_JPAKE_FINAL_SHA1,         {0, 0, CKF_DERIVE}, PR_TRUE},
501
     {CKM_NSS_JPAKE_FINAL_SHA256,       {0, 0, CKF_DERIVE}, PR_TRUE},
501
     {CKM_NSS_JPAKE_FINAL_SHA256,       {0, 0, CKF_DERIVE}, PR_TRUE},
502
     {CKM_NSS_JPAKE_FINAL_SHA384,       {0, 0, CKF_DERIVE}, PR_TRUE},
502
     {CKM_NSS_JPAKE_FINAL_SHA384,       {0, 0, CKF_DERIVE}, PR_TRUE},
503
     {CKM_NSS_JPAKE_FINAL_SHA512,       {0, 0, CKF_DERIVE}, PR_TRUE},
503
     {CKM_NSS_JPAKE_FINAL_SHA512,       {0, 0, CKF_DERIVE}, PR_TRUE},
504
     /* -------------------- Constant Time TLS MACs ----------------------- */
504
     /* -------------------- Constant Time TLS MACs ----------------------- */
505
     {CKM_NSS_HMAC_CONSTANT_TIME,       {0, 0, CKF_DIGEST}, PR_TRUE},
505
     {CKM_NSS_HMAC_CONSTANT_TIME,       {0, 0, CKF_DIGEST}, PR_TRUE},
506
     {CKM_NSS_SSL3_MAC_CONSTANT_TIME,   {0, 0, CKF_DIGEST}, PR_TRUE}
506
     {CKM_NSS_SSL3_MAC_CONSTANT_TIME,   {0, 0, CKF_DIGEST}, PR_TRUE},
507
     /* -------------------- ChaCha20+Poly1305 AEAD ----------------------- */
508
     {CKM_NSS_CHACHA20_POLY1305,	{32, 32, CKF_EN_DE},	PR_TRUE}
507
};
509
};
508
static const CK_ULONG mechanismCount = sizeof(mechanisms)/sizeof(mechanisms[0]);
510
static const CK_ULONG mechanismCount = sizeof(mechanisms)/sizeof(mechanisms[0]);
509
511
510
/* sigh global so fipstokn can read it */
512
/* sigh global so fipstokn can read it */
511
PRBool nsc_init = PR_FALSE;
513
PRBool nsc_init = PR_FALSE;
512
514
513
#if defined(CHECK_FORK_PTHREAD) || defined(CHECK_FORK_MIXED)
515
#if defined(CHECK_FORK_PTHREAD) || defined(CHECK_FORK_MIXED)
514
516
515
#include <pthread.h>
517
#include <pthread.h>
516
518
(-)a/lib/softoken/pkcs11c.c (+133 lines)
Line     Link Here 
 Lines 468-487    Link Here 
468
468
469
static SECStatus
469
static SECStatus
470
sftk_DecryptOAEP(SFTKOAEPDecryptInfo *info, unsigned char *output,
470
sftk_DecryptOAEP(SFTKOAEPDecryptInfo *info, unsigned char *output,
471
                 unsigned int *outputLen, unsigned int maxLen,
471
                 unsigned int *outputLen, unsigned int maxLen,
472
                 unsigned char *input, unsigned int inputLen)
472
                 unsigned char *input, unsigned int inputLen)
473
{
473
{
474
    return RSA_DecryptOAEP(info->params, info->key, output, outputLen,
474
    return RSA_DecryptOAEP(info->params, info->key, output, outputLen,
475
                           maxLen, input, inputLen);
475
                           maxLen, input, inputLen);
476
}
476
}
477
477
478
/* sftk_ChaCha20Poly1305_Context saves the key and additional data for a
479
 * ChaCha20+Poly1305 AEAD operation. */
480
struct sftk_ChaCha20Poly1305_Context {
481
    unsigned char key[32];
482
    unsigned char nonce[8];
483
    unsigned char ad[16];
484
    unsigned char *adOverflow;
485
    unsigned int adLen;
486
    unsigned char tagLen;
487
};
488
489
static struct sftk_ChaCha20Poly1305_Context* sftk_ChaCha20Poly1305_New(
490
	const unsigned char *key,
491
	const CK_AEAD_PARAMS* params) {
492
    struct sftk_ChaCha20Poly1305_Context* ctx;
493
494
    if (params->ulIvLen != sizeof(ctx->nonce))
495
	return NULL;
496
497
    if (params->ulTagBits == 0 ||
498
	params->ulTagBits > 128 ||
499
	(params->ulTagBits & 3) != 0) {
500
	return NULL;
501
    }
502
503
    ctx = PORT_Alloc(sizeof(struct sftk_ChaCha20Poly1305_Context));
504
    if (ctx == NULL)
505
	return NULL;
506
507
    memcpy(ctx->nonce, params->pIv, sizeof(ctx->nonce));
508
    memcpy(ctx->key, key, sizeof(ctx->key));
509
    ctx->tagLen = params->ulTagBits >> 3;
510
511
    if (params->ulAADLen > sizeof(ctx->ad)) {
512
	/* Need to allocate an overflow buffer for the additional data. */
513
	ctx->adOverflow = PORT_Alloc(params->ulAADLen);
514
	if (!ctx->adOverflow) {
515
	    PORT_Free(ctx);
516
	    return NULL;
517
	}
518
	memcpy(ctx->adOverflow, params->pAAD, params->ulAADLen);
519
    } else {
520
	ctx->adOverflow = NULL;
521
	memcpy(ctx->ad, params->pAAD, params->ulAADLen);
522
    }
523
    ctx->adLen = params->ulAADLen;
524
525
    return ctx;
526
}
527
528
static void sftk_ChaCha20Poly1305_Free(
529
	struct sftk_ChaCha20Poly1305_Context *ctx) {
530
    if (ctx->adOverflow != NULL) {
531
	PORT_Free(ctx->adOverflow);
532
    }
533
    PORT_Free(ctx);
534
}
535
536
static SECStatus sftk_ChaCha20Poly1305_Seal(
537
	const struct sftk_ChaCha20Poly1305_Context *ctx,
538
	unsigned char *output,
539
	unsigned int *outputLen,
540
	unsigned int maxOutputLen,
541
	const unsigned char *input,
542
	unsigned int inputLen) {
543
    const unsigned char* ad = ctx->adOverflow;
544
545
    if (maxOutputLen < inputLen + 16) {
546
	return SECFailure;
547
    }
548
549
    if (ad == NULL) {
550
	ad = ctx->ad;
551
    }
552
553
    *outputLen = inputLen + 16;
554
555
    return ChaCha20Poly1305_Seal(output, ad, ctx->adLen, input, inputLen,
556
				 ctx->tagLen, ctx->key, ctx->nonce);
557
}
558
559
static SECStatus sftk_ChaCha20Poly1305_Open(
560
	const struct sftk_ChaCha20Poly1305_Context *ctx,
561
	unsigned char *output,
562
	unsigned int *outputLen,
563
	unsigned int maxOutputLen,
564
	const unsigned char *input,
565
	unsigned int inputLen) {
566
    const unsigned char* ad = ctx->adOverflow;
567
568
    if (maxOutputLen < inputLen || inputLen < 16) {
569
	return SECFailure;
570
    }
571
572
    if (ad == NULL) {
573
	ad = ctx->ad;
574
    }
575
576
    *outputLen = inputLen - 16;
577
578
    return ChaCha20Poly1305_Open(output, ad, ctx->adLen, input, inputLen,
579
				 ctx->tagLen, ctx->key, ctx->nonce);
580
}
581
478
/** NSC_CryptInit initializes an encryption/Decryption operation.
582
/** NSC_CryptInit initializes an encryption/Decryption operation.
479
 *
583
 *
480
 * Always called by NSC_EncryptInit, NSC_DecryptInit, NSC_WrapKey,NSC_UnwrapKey.
584
 * Always called by NSC_EncryptInit, NSC_DecryptInit, NSC_WrapKey,NSC_UnwrapKey.
481
 * Called by NSC_SignInit, NSC_VerifyInit (via sftk_InitCBCMac) only for block
585
 * Called by NSC_SignInit, NSC_VerifyInit (via sftk_InitCBCMac) only for block
482
 *  ciphers MAC'ing.
586
 *  ciphers MAC'ing.
483
 */
587
 */
484
static CK_RV
588
static CK_RV
485
sftk_CryptInit(CK_SESSION_HANDLE hSession, CK_MECHANISM_PTR pMechanism,
589
sftk_CryptInit(CK_SESSION_HANDLE hSession, CK_MECHANISM_PTR pMechanism,
486
     CK_OBJECT_HANDLE hKey,
590
     CK_OBJECT_HANDLE hKey,
487
     CK_ATTRIBUTE_TYPE mechUsage, CK_ATTRIBUTE_TYPE keyUsage,
591
     CK_ATTRIBUTE_TYPE mechUsage, CK_ATTRIBUTE_TYPE keyUsage,
 Lines 863-882    Link Here 
863
	    isEncrypt, att->attrib.ulValueLen, 16);
967
	    isEncrypt, att->attrib.ulValueLen, 16);
864
	sftk_FreeAttribute(att);
968
	sftk_FreeAttribute(att);
865
	if (context->cipherInfo == NULL) {
969
	if (context->cipherInfo == NULL) {
866
	    crv = CKR_HOST_MEMORY;
970
	    crv = CKR_HOST_MEMORY;
867
	    break;
971
	    break;
868
	}
972
	}
869
	context->update = (SFTKCipher) (isEncrypt ? AES_Encrypt : AES_Decrypt);
973
	context->update = (SFTKCipher) (isEncrypt ? AES_Encrypt : AES_Decrypt);
870
	context->destroy = (SFTKDestroy) AES_DestroyContext;
974
	context->destroy = (SFTKDestroy) AES_DestroyContext;
871
	break;
975
	break;
872
976
977
    case CKM_NSS_CHACHA20_POLY1305:
978
	context->multi = PR_FALSE;
979
	if (key_type != CKK_NSS_CHACHA20) {
980
	    crv = CKR_KEY_TYPE_INCONSISTENT;
981
	    break;
982
	}
983
	att = sftk_FindAttribute(key,CKA_VALUE);
984
	if (att == NULL) {
985
	    crv = CKR_KEY_HANDLE_INVALID;
986
	    break;
987
	}
988
	context->cipherInfo = sftk_ChaCha20Poly1305_New(
989
		(unsigned char*) att->attrib.pValue,
990
		(CK_AEAD_PARAMS*) pMechanism->pParameter);
991
	sftk_FreeAttribute(att);
992
	if (context->cipherInfo == NULL) {
993
	    crv = CKR_HOST_MEMORY;
994
	    break;
995
	}
996
	context->update = (SFTKCipher) (isEncrypt ? sftk_ChaCha20Poly1305_Seal :
997
					sftk_ChaCha20Poly1305_Open);
998
	context->destroy = (SFTKDestroy) sftk_ChaCha20Poly1305_Free;
999
	break;
1000
873
    case CKM_NETSCAPE_AES_KEY_WRAP_PAD:
1001
    case CKM_NETSCAPE_AES_KEY_WRAP_PAD:
874
    	context->doPad = PR_TRUE;
1002
    	context->doPad = PR_TRUE;
875
	/* fall thru */
1003
	/* fall thru */
876
    case CKM_NETSCAPE_AES_KEY_WRAP:
1004
    case CKM_NETSCAPE_AES_KEY_WRAP:
877
	context->multi = PR_FALSE;
1005
	context->multi = PR_FALSE;
878
	context->blockSize = 8;
1006
	context->blockSize = 8;
879
	if (key_type != CKK_AES) {
1007
	if (key_type != CKK_AES) {
880
	    crv = CKR_KEY_TYPE_INCONSISTENT;
1008
	    crv = CKR_KEY_TYPE_INCONSISTENT;
881
	    break;
1009
	    break;
882
	}
1010
	}
 Lines 3265-3284    Link Here 
3265
	*key_length = 16;
3393
	*key_length = 16;
3266
	break;
3394
	break;
3267
    case CKM_CAMELLIA_KEY_GEN:
3395
    case CKM_CAMELLIA_KEY_GEN:
3268
	*key_type = CKK_CAMELLIA;
3396
	*key_type = CKK_CAMELLIA;
3269
	if (*key_length == 0) crv = CKR_TEMPLATE_INCOMPLETE;
3397
	if (*key_length == 0) crv = CKR_TEMPLATE_INCOMPLETE;
3270
	break;
3398
	break;
3271
    case CKM_AES_KEY_GEN:
3399
    case CKM_AES_KEY_GEN:
3272
	*key_type = CKK_AES;
3400
	*key_type = CKK_AES;
3273
	if (*key_length == 0) crv = CKR_TEMPLATE_INCOMPLETE;
3401
	if (*key_length == 0) crv = CKR_TEMPLATE_INCOMPLETE;
3274
	break;
3402
	break;
3403
    case CKM_NSS_CHACHA20_KEY_GEN:
3404
	*key_type = CKK_NSS_CHACHA20;
3405
	if (*key_length == 0) crv = CKR_TEMPLATE_INCOMPLETE;
3406
	break;
3275
    default:
3407
    default:
3276
	PORT_Assert(0);
3408
	PORT_Assert(0);
3277
	crv = CKR_MECHANISM_INVALID;
3409
	crv = CKR_MECHANISM_INVALID;
3278
	break;
3410
	break;
3279
    }
3411
    }
3280
3412
3281
    return crv;
3413
    return crv;
3282
}
3414
}
3283
3415
3284
CK_RV
3416
CK_RV
 Lines 3510-3529    Link Here 
3510
    case CKM_DES2_KEY_GEN:
3642
    case CKM_DES2_KEY_GEN:
3511
    case CKM_DES3_KEY_GEN:
3643
    case CKM_DES3_KEY_GEN:
3512
	checkWeak = PR_TRUE;
3644
	checkWeak = PR_TRUE;
3513
        /* fall through */
3645
        /* fall through */
3514
    case CKM_RC2_KEY_GEN:
3646
    case CKM_RC2_KEY_GEN:
3515
    case CKM_RC4_KEY_GEN:
3647
    case CKM_RC4_KEY_GEN:
3516
    case CKM_GENERIC_SECRET_KEY_GEN:
3648
    case CKM_GENERIC_SECRET_KEY_GEN:
3517
    case CKM_SEED_KEY_GEN:
3649
    case CKM_SEED_KEY_GEN:
3518
    case CKM_CAMELLIA_KEY_GEN:
3650
    case CKM_CAMELLIA_KEY_GEN:
3519
    case CKM_AES_KEY_GEN:
3651
    case CKM_AES_KEY_GEN:
3652
    case CKM_NSS_CHACHA20_KEY_GEN:
3520
#if NSS_SOFTOKEN_DOES_RC5
3653
#if NSS_SOFTOKEN_DOES_RC5
3521
    case CKM_RC5_KEY_GEN:
3654
    case CKM_RC5_KEY_GEN:
3522
#endif
3655
#endif
3523
	crv = nsc_SetupBulkKeyGen(pMechanism->mechanism,&key_type,&key_length);
3656
	crv = nsc_SetupBulkKeyGen(pMechanism->mechanism,&key_type,&key_length);
3524
	break;
3657
	break;
3525
    case CKM_SSL3_PRE_MASTER_KEY_GEN:
3658
    case CKM_SSL3_PRE_MASTER_KEY_GEN:
3526
	key_type = CKK_GENERIC_SECRET;
3659
	key_type = CKK_GENERIC_SECRET;
3527
	key_length = 48;
3660
	key_length = 48;
3528
	key_gen_type = nsc_ssl;
3661
	key_gen_type = nsc_ssl;
3529
	break;
3662
	break;
(-)a/lib/ssl/ssl3con.c (-2 / +52 lines)
Line     Link Here 
 Lines 79-98    Link Here 
79
#define MIN_SEND_BUF_LENGTH  4000
79
#define MIN_SEND_BUF_LENGTH  4000
80
80
81
/* This list of SSL3 cipher suites is sorted in descending order of
81
/* This list of SSL3 cipher suites is sorted in descending order of
82
 * precedence (desirability).  It only includes cipher suites we implement.
82
 * precedence (desirability).  It only includes cipher suites we implement.
83
 * This table is modified by SSL3_SetPolicy(). The ordering of cipher suites
83
 * This table is modified by SSL3_SetPolicy(). The ordering of cipher suites
84
 * in this table must match the ordering in SSL_ImplementedCiphers (sslenum.c)
84
 * in this table must match the ordering in SSL_ImplementedCiphers (sslenum.c)
85
 */
85
 */
86
static ssl3CipherSuiteCfg cipherSuites[ssl_V3_SUITES_IMPLEMENTED] = {
86
static ssl3CipherSuiteCfg cipherSuites[ssl_V3_SUITES_IMPLEMENTED] = {
87
   /*      cipher_suite                     policy       enabled   isPresent */
87
   /*      cipher_suite                     policy       enabled   isPresent */
88
#ifdef NSS_ENABLE_ECC
88
#ifdef NSS_ENABLE_ECC
89
 { TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,  SSL_ALLOWED, PR_FALSE, PR_FALSE},
90
 { TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,    SSL_ALLOWED, PR_FALSE, PR_FALSE},
89
 { TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, SSL_ALLOWED, PR_FALSE, PR_FALSE},
91
 { TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, SSL_ALLOWED, PR_FALSE, PR_FALSE},
90
 { TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,   SSL_ALLOWED, PR_FALSE, PR_FALSE},
92
 { TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,   SSL_ALLOWED, PR_FALSE, PR_FALSE},
91
#endif /* NSS_ENABLE_ECC */
93
#endif /* NSS_ENABLE_ECC */
92
 { TLS_DHE_RSA_WITH_AES_128_GCM_SHA256,     SSL_ALLOWED, PR_TRUE,  PR_FALSE},
94
 { TLS_DHE_RSA_WITH_AES_128_GCM_SHA256,     SSL_ALLOWED, PR_TRUE,  PR_FALSE},
93
 { TLS_RSA_WITH_AES_128_GCM_SHA256,         SSL_ALLOWED, PR_TRUE,  PR_FALSE},
95
 { TLS_RSA_WITH_AES_128_GCM_SHA256,         SSL_ALLOWED, PR_TRUE,  PR_FALSE},
94
96
95
#ifdef NSS_ENABLE_ECC
97
#ifdef NSS_ENABLE_ECC
96
 { TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,    SSL_ALLOWED, PR_FALSE, PR_FALSE},
98
 { TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,    SSL_ALLOWED, PR_FALSE, PR_FALSE},
97
 { TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,      SSL_ALLOWED, PR_FALSE, PR_FALSE},
99
 { TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,      SSL_ALLOWED, PR_FALSE, PR_FALSE},
98
#endif /* NSS_ENABLE_ECC */
100
#endif /* NSS_ENABLE_ECC */
 Lines 251-270    Link Here 
251
    {cipher_des,          calg_des,          8, 8, type_block,  8, 8, 0, 0},
253
    {cipher_des,          calg_des,          8, 8, type_block,  8, 8, 0, 0},
252
    {cipher_3des,         calg_3des,        24,24, type_block,  8, 8, 0, 0},
254
    {cipher_3des,         calg_3des,        24,24, type_block,  8, 8, 0, 0},
253
    {cipher_des40,        calg_des,          8, 5, type_block,  8, 8, 0, 0},
255
    {cipher_des40,        calg_des,          8, 5, type_block,  8, 8, 0, 0},
254
    {cipher_idea,         calg_idea,        16,16, type_block,  8, 8, 0, 0},
256
    {cipher_idea,         calg_idea,        16,16, type_block,  8, 8, 0, 0},
255
    {cipher_aes_128,      calg_aes,         16,16, type_block, 16,16, 0, 0},
257
    {cipher_aes_128,      calg_aes,         16,16, type_block, 16,16, 0, 0},
256
    {cipher_aes_256,      calg_aes,         32,32, type_block, 16,16, 0, 0},
258
    {cipher_aes_256,      calg_aes,         32,32, type_block, 16,16, 0, 0},
257
    {cipher_camellia_128, calg_camellia,    16,16, type_block, 16,16, 0, 0},
259
    {cipher_camellia_128, calg_camellia,    16,16, type_block, 16,16, 0, 0},
258
    {cipher_camellia_256, calg_camellia,    32,32, type_block, 16,16, 0, 0},
260
    {cipher_camellia_256, calg_camellia,    32,32, type_block, 16,16, 0, 0},
259
    {cipher_seed,         calg_seed,        16,16, type_block, 16,16, 0, 0},
261
    {cipher_seed,         calg_seed,        16,16, type_block, 16,16, 0, 0},
260
    {cipher_aes_128_gcm,  calg_aes_gcm,     16,16, type_aead,   4, 0,16, 8},
262
    {cipher_aes_128_gcm,  calg_aes_gcm,     16,16, type_aead,   4, 0,16, 8},
263
    {cipher_chacha20,     calg_chacha20,    32,32, type_aead,   0, 0,16, 0},
261
    {cipher_missing,      calg_null,         0, 0, type_stream, 0, 0, 0, 0},
264
    {cipher_missing,      calg_null,         0, 0, type_stream, 0, 0, 0, 0},
262
};
265
};
263
266
264
static const ssl3KEADef kea_defs[] = 
267
static const ssl3KEADef kea_defs[] = 
265
{ /* indexed by SSL3KeyExchangeAlgorithm */
268
{ /* indexed by SSL3KeyExchangeAlgorithm */
266
    /* kea              exchKeyType signKeyType is_limited limit  tls_keygen */
269
    /* kea              exchKeyType signKeyType is_limited limit  tls_keygen */
267
    {kea_null,           kt_null,     sign_null, PR_FALSE,   0, PR_FALSE},
270
    {kea_null,           kt_null,     sign_null, PR_FALSE,   0, PR_FALSE},
268
    {kea_rsa,            kt_rsa,      sign_rsa,  PR_FALSE,   0, PR_FALSE},
271
    {kea_rsa,            kt_rsa,      sign_rsa,  PR_FALSE,   0, PR_FALSE},
269
    {kea_rsa_export,     kt_rsa,      sign_rsa,  PR_TRUE,  512, PR_FALSE},
272
    {kea_rsa_export,     kt_rsa,      sign_rsa,  PR_TRUE,  512, PR_FALSE},
270
    {kea_rsa_export_1024,kt_rsa,      sign_rsa,  PR_TRUE, 1024, PR_FALSE},
273
    {kea_rsa_export_1024,kt_rsa,      sign_rsa,  PR_TRUE, 1024, PR_FALSE},
 Lines 377-396    Link Here 
377
    {TLS_RSA_EXPORT1024_WITH_RC4_56_SHA,
380
    {TLS_RSA_EXPORT1024_WITH_RC4_56_SHA,
378
                                    cipher_rc4_56, mac_sha,kea_rsa_export_1024},
381
                                    cipher_rc4_56, mac_sha,kea_rsa_export_1024},
379
382
380
    {SSL_RSA_FIPS_WITH_3DES_EDE_CBC_SHA, cipher_3des, mac_sha, kea_rsa_fips},
383
    {SSL_RSA_FIPS_WITH_3DES_EDE_CBC_SHA, cipher_3des, mac_sha, kea_rsa_fips},
381
    {SSL_RSA_FIPS_WITH_DES_CBC_SHA, cipher_des,    mac_sha, kea_rsa_fips},
384
    {SSL_RSA_FIPS_WITH_DES_CBC_SHA, cipher_des,    mac_sha, kea_rsa_fips},
382
385
383
    {TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, cipher_aes_128_gcm, mac_aead, kea_dhe_rsa},
386
    {TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, cipher_aes_128_gcm, mac_aead, kea_dhe_rsa},
384
    {TLS_RSA_WITH_AES_128_GCM_SHA256, cipher_aes_128_gcm, mac_aead, kea_rsa},
387
    {TLS_RSA_WITH_AES_128_GCM_SHA256, cipher_aes_128_gcm, mac_aead, kea_rsa},
385
    {TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, cipher_aes_128_gcm, mac_aead, kea_ecdhe_rsa},
388
    {TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, cipher_aes_128_gcm, mac_aead, kea_ecdhe_rsa},
386
    {TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, cipher_aes_128_gcm, mac_aead, kea_ecdhe_ecdsa},
389
    {TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, cipher_aes_128_gcm, mac_aead, kea_ecdhe_ecdsa},
390
    {TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305, cipher_chacha20, mac_aead, kea_ecdhe_rsa},
391
    {TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305, cipher_chacha20, mac_aead, kea_ecdhe_ecdsa},
387
392
388
#ifdef NSS_ENABLE_ECC
393
#ifdef NSS_ENABLE_ECC
389
    {TLS_ECDH_ECDSA_WITH_NULL_SHA,        cipher_null, mac_sha, kea_ecdh_ecdsa},
394
    {TLS_ECDH_ECDSA_WITH_NULL_SHA,        cipher_null, mac_sha, kea_ecdh_ecdsa},
390
    {TLS_ECDH_ECDSA_WITH_RC4_128_SHA,      cipher_rc4, mac_sha, kea_ecdh_ecdsa},
395
    {TLS_ECDH_ECDSA_WITH_RC4_128_SHA,      cipher_rc4, mac_sha, kea_ecdh_ecdsa},
391
    {TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA, cipher_3des, mac_sha, kea_ecdh_ecdsa},
396
    {TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA, cipher_3des, mac_sha, kea_ecdh_ecdsa},
392
    {TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA, cipher_aes_128, mac_sha, kea_ecdh_ecdsa},
397
    {TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA, cipher_aes_128, mac_sha, kea_ecdh_ecdsa},
393
    {TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA, cipher_aes_256, mac_sha, kea_ecdh_ecdsa},
398
    {TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA, cipher_aes_256, mac_sha, kea_ecdh_ecdsa},
394
399
395
    {TLS_ECDHE_ECDSA_WITH_NULL_SHA,        cipher_null, mac_sha, kea_ecdhe_ecdsa},
400
    {TLS_ECDHE_ECDSA_WITH_NULL_SHA,        cipher_null, mac_sha, kea_ecdhe_ecdsa},
396
    {TLS_ECDHE_ECDSA_WITH_RC4_128_SHA,      cipher_rc4, mac_sha, kea_ecdhe_ecdsa},
401
    {TLS_ECDHE_ECDSA_WITH_RC4_128_SHA,      cipher_rc4, mac_sha, kea_ecdhe_ecdsa},
 Lines 442-461    Link Here 
442
    { calg_rc4      , CKM_RC4				},
447
    { calg_rc4      , CKM_RC4				},
443
    { calg_rc2      , CKM_RC2_CBC			},
448
    { calg_rc2      , CKM_RC2_CBC			},
444
    { calg_des      , CKM_DES_CBC			},
449
    { calg_des      , CKM_DES_CBC			},
445
    { calg_3des     , CKM_DES3_CBC			},
450
    { calg_3des     , CKM_DES3_CBC			},
446
    { calg_idea     , CKM_IDEA_CBC			},
451
    { calg_idea     , CKM_IDEA_CBC			},
447
    { calg_fortezza , CKM_SKIPJACK_CBC64                },
452
    { calg_fortezza , CKM_SKIPJACK_CBC64                },
448
    { calg_aes      , CKM_AES_CBC			},
453
    { calg_aes      , CKM_AES_CBC			},
449
    { calg_camellia , CKM_CAMELLIA_CBC			},
454
    { calg_camellia , CKM_CAMELLIA_CBC			},
450
    { calg_seed     , CKM_SEED_CBC			},
455
    { calg_seed     , CKM_SEED_CBC			},
451
    { calg_aes_gcm  , CKM_AES_GCM			},
456
    { calg_aes_gcm  , CKM_AES_GCM			},
457
    { calg_chacha20 , CKM_NSS_CHACHA20_POLY1305		},
452
/*  { calg_init     , (CK_MECHANISM_TYPE)0x7fffffffL    }  */
458
/*  { calg_init     , (CK_MECHANISM_TYPE)0x7fffffffL    }  */
453
};
459
};
454
460
455
#define mmech_invalid  (CK_MECHANISM_TYPE)0x80000000L
461
#define mmech_invalid  (CK_MECHANISM_TYPE)0x80000000L
456
#define mmech_md5      CKM_SSL3_MD5_MAC
462
#define mmech_md5      CKM_SSL3_MD5_MAC
457
#define mmech_sha      CKM_SSL3_SHA1_MAC
463
#define mmech_sha      CKM_SSL3_SHA1_MAC
458
#define mmech_md5_hmac CKM_MD5_HMAC
464
#define mmech_md5_hmac CKM_MD5_HMAC
459
#define mmech_sha_hmac CKM_SHA_1_HMAC
465
#define mmech_sha_hmac CKM_SHA_1_HMAC
460
#define mmech_sha256_hmac CKM_SHA256_HMAC
466
#define mmech_sha256_hmac CKM_SHA256_HMAC
461
467
 Lines 1933-1952    Link Here 
1933
    } else {
1939
    } else {
1934
	rv = AES_Encrypt(cx, out, &uOutLen, maxout, in, inlen);
1940
	rv = AES_Encrypt(cx, out, &uOutLen, maxout, in, inlen);
1935
    }
1941
    }
1936
    AES_DestroyContext(cx, PR_FALSE);
1942
    AES_DestroyContext(cx, PR_FALSE);
1937
    *outlen += (int) uOutLen;
1943
    *outlen += (int) uOutLen;
1938
1944
1939
    return rv;
1945
    return rv;
1940
}
1946
}
1941
#endif
1947
#endif
1942
1948
1949
static SECStatus
1950
ssl3_ChaCha20Poly1305(
1951
	ssl3KeyMaterial *keys,
1952
	PRBool doDecrypt,
1953
	unsigned char *out,
1954
	int *outlen,
1955
	int maxout,
1956
	const unsigned char *in,
1957
	int inlen,
1958
	const unsigned char *additionalData,
1959
	int additionalDataLen)
1960
{
1961
    SECItem            param;
1962
    SECStatus          rv = SECFailure;
1963
    unsigned int       uOutLen;
1964
    CK_AEAD_PARAMS     aeadParams;
1965
    static const int   tagSize = 16;
1966
1967
    param.type = siBuffer;
1968
    param.len = sizeof(aeadParams);
1969
    param.data = (unsigned char *) &aeadParams;
1970
    memset(&aeadParams, 0, sizeof(CK_AEAD_PARAMS));
1971
    aeadParams.pIv = (unsigned char *) additionalData;
1972
    aeadParams.ulIvLen = 8;
1973
    aeadParams.pAAD = (unsigned char *) additionalData;
1974
    aeadParams.ulAADLen = additionalDataLen;
1975
    aeadParams.ulTagBits = tagSize * 8;
1976
1977
    if (doDecrypt) {
1978
	rv = PK11_Decrypt(keys->write_key, CKM_NSS_CHACHA20_POLY1305, &param,
1979
			  out, &uOutLen, maxout, in, inlen);
1980
    } else {
1981
	rv = PK11_Encrypt(keys->write_key, CKM_NSS_CHACHA20_POLY1305, &param,
1982
			  out, &uOutLen, maxout, in, inlen);
1983
    }
1984
    *outlen = (int) uOutLen;
1985
1986
    return rv;
1987
}
1988
1943
/* Initialize encryption and MAC contexts for pending spec.
1989
/* Initialize encryption and MAC contexts for pending spec.
1944
 * Master Secret already is derived.
1990
 * Master Secret already is derived.
1945
 * Caller holds Spec write lock.
1991
 * Caller holds Spec write lock.
1946
 */
1992
 */
1947
static SECStatus
1993
static SECStatus
1948
ssl3_InitPendingContextsPKCS11(sslSocket *ss)
1994
ssl3_InitPendingContextsPKCS11(sslSocket *ss)
1949
{
1995
{
1950
      ssl3CipherSpec  *  pwSpec;
1996
      ssl3CipherSpec  *  pwSpec;
1951
      const ssl3BulkCipherDef *cipher_def;
1997
      const ssl3BulkCipherDef *cipher_def;
1952
      PK11Context *      serverContext = NULL;
1998
      PK11Context *      serverContext = NULL;
 Lines 1966-1992    Link Here 
1966
2012
1967
    pwSpec        = ss->ssl3.pwSpec;
2013
    pwSpec        = ss->ssl3.pwSpec;
1968
    cipher_def    = pwSpec->cipher_def;
2014
    cipher_def    = pwSpec->cipher_def;
1969
    macLength     = pwSpec->mac_size;
2015
    macLength     = pwSpec->mac_size;
1970
    calg          = cipher_def->calg;
2016
    calg          = cipher_def->calg;
1971
    PORT_Assert(alg2Mech[calg].calg == calg);
2017
    PORT_Assert(alg2Mech[calg].calg == calg);
1972
2018
1973
    pwSpec->client.write_mac_context = NULL;
2019
    pwSpec->client.write_mac_context = NULL;
1974
    pwSpec->server.write_mac_context = NULL;
2020
    pwSpec->server.write_mac_context = NULL;
1975
2021
1976
    if (calg == calg_aes_gcm) {
2022
    if (calg == calg_aes_gcm || calg == calg_chacha20) {
1977
	pwSpec->encode = NULL;
2023
	pwSpec->encode = NULL;
1978
	pwSpec->decode = NULL;
2024
	pwSpec->decode = NULL;
1979
	pwSpec->destroy = NULL;
2025
	pwSpec->destroy = NULL;
1980
	pwSpec->encodeContext = NULL;
2026
	pwSpec->encodeContext = NULL;
1981
	pwSpec->decodeContext = NULL;
2027
	pwSpec->decodeContext = NULL;
1982
	pwSpec->aead = ssl3_AESGCM;
2028
	if (calg == calg_aes_gcm) {
2029
	    pwSpec->aead = ssl3_AESGCM;
2030
	} else {
2031
	    pwSpec->aead = ssl3_ChaCha20Poly1305;
2032
	}
1983
	return SECSuccess;
2033
	return SECSuccess;
1984
    }
2034
    }
1985
2035
1986
    /* 
2036
    /* 
1987
    ** Now setup the MAC contexts, 
2037
    ** Now setup the MAC contexts, 
1988
    **   crypto contexts are setup below.
2038
    **   crypto contexts are setup below.
1989
    */
2039
    */
1990
2040
1991
    mac_mech       = pwSpec->mac_def->mmech;
2041
    mac_mech       = pwSpec->mac_def->mmech;
1992
    mac_param.data = (unsigned char *)&macLength;
2042
    mac_param.data = (unsigned char *)&macLength;
(-)a/lib/ssl/ssl3ecc.c (+4 lines)
Line     Link Here 
 Lines 891-940    Link Here 
891
    TLS_ECDH_RSA_WITH_RC4_128_SHA,
891
    TLS_ECDH_RSA_WITH_RC4_128_SHA,
892
    0 /* end of list marker */
892
    0 /* end of list marker */
893
};
893
};
894
894
895
static const ssl3CipherSuite ecdhe_ecdsa_suites[] = {
895
static const ssl3CipherSuite ecdhe_ecdsa_suites[] = {
896
    TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA,
896
    TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA,
897
    TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,
897
    TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,
898
    TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,
898
    TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,
899
    TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
899
    TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
900
    TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
900
    TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
901
    TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,
901
    TLS_ECDHE_ECDSA_WITH_NULL_SHA,
902
    TLS_ECDHE_ECDSA_WITH_NULL_SHA,
902
    TLS_ECDHE_ECDSA_WITH_RC4_128_SHA,
903
    TLS_ECDHE_ECDSA_WITH_RC4_128_SHA,
903
    0 /* end of list marker */
904
    0 /* end of list marker */
904
};
905
};
905
906
906
static const ssl3CipherSuite ecdhe_rsa_suites[] = {
907
static const ssl3CipherSuite ecdhe_rsa_suites[] = {
907
    TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA,
908
    TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA,
908
    TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,
909
    TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,
909
    TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,
910
    TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,
910
    TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
911
    TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
911
    TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,
912
    TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,
913
    TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,
912
    TLS_ECDHE_RSA_WITH_NULL_SHA,
914
    TLS_ECDHE_RSA_WITH_NULL_SHA,
913
    TLS_ECDHE_RSA_WITH_RC4_128_SHA,
915
    TLS_ECDHE_RSA_WITH_RC4_128_SHA,
914
    0 /* end of list marker */
916
    0 /* end of list marker */
915
};
917
};
916
918
917
/* List of all ECC cipher suites */
919
/* List of all ECC cipher suites */
918
static const ssl3CipherSuite ecSuites[] = {
920
static const ssl3CipherSuite ecSuites[] = {
919
    TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA,
921
    TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA,
920
    TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,
922
    TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,
921
    TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,
923
    TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,
922
    TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
924
    TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
923
    TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
925
    TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
926
    TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,
924
    TLS_ECDHE_ECDSA_WITH_NULL_SHA,
927
    TLS_ECDHE_ECDSA_WITH_NULL_SHA,
925
    TLS_ECDHE_ECDSA_WITH_RC4_128_SHA,
928
    TLS_ECDHE_ECDSA_WITH_RC4_128_SHA,
926
    TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA,
929
    TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA,
927
    TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,
930
    TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,
928
    TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,
931
    TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,
929
    TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
932
    TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
930
    TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,
933
    TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,
934
    TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,
931
    TLS_ECDHE_RSA_WITH_NULL_SHA,
935
    TLS_ECDHE_RSA_WITH_NULL_SHA,
932
    TLS_ECDHE_RSA_WITH_RC4_128_SHA,
936
    TLS_ECDHE_RSA_WITH_RC4_128_SHA,
933
    TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA,
937
    TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA,
934
    TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA,
938
    TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA,
935
    TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA,
939
    TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA,
936
    TLS_ECDH_ECDSA_WITH_NULL_SHA,
940
    TLS_ECDH_ECDSA_WITH_NULL_SHA,
937
    TLS_ECDH_ECDSA_WITH_RC4_128_SHA,
941
    TLS_ECDH_ECDSA_WITH_RC4_128_SHA,
938
    TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA,
942
    TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA,
939
    TLS_ECDH_RSA_WITH_AES_128_CBC_SHA,
943
    TLS_ECDH_RSA_WITH_AES_128_CBC_SHA,
940
    TLS_ECDH_RSA_WITH_AES_256_CBC_SHA,
944
    TLS_ECDH_RSA_WITH_AES_256_CBC_SHA,
(-)a/lib/ssl/sslenum.c (+2 lines)
Line     Link Here 
 Lines 24-43    Link Here 
24
 * the cipherSuites table in ssl3con.c.
24
 * the cipherSuites table in ssl3con.c.
25
 *
25
 *
26
 * If new ECC cipher suites are added, also update the ssl3CipherSuite arrays
26
 * If new ECC cipher suites are added, also update the ssl3CipherSuite arrays
27
 * in ssl3ecc.c.
27
 * in ssl3ecc.c.
28
 *
28
 *
29
 * Finally, update the ssl_V3_SUITES_IMPLEMENTED macro in sslimpl.h.
29
 * Finally, update the ssl_V3_SUITES_IMPLEMENTED macro in sslimpl.h.
30
 */
30
 */
31
const PRUint16 SSL_ImplementedCiphers[] = {
31
const PRUint16 SSL_ImplementedCiphers[] = {
32
    /* AES-GCM */
32
    /* AES-GCM */
33
#ifdef NSS_ENABLE_ECC
33
#ifdef NSS_ENABLE_ECC
34
    TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,
35
    TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,
34
    TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
36
    TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
35
    TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
37
    TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
36
#endif /* NSS_ENABLE_ECC */
38
#endif /* NSS_ENABLE_ECC */
37
    TLS_DHE_RSA_WITH_AES_128_GCM_SHA256,
39
    TLS_DHE_RSA_WITH_AES_128_GCM_SHA256,
38
    TLS_RSA_WITH_AES_128_GCM_SHA256,
40
    TLS_RSA_WITH_AES_128_GCM_SHA256,
39
41
40
    /* 256-bit */
42
    /* 256-bit */
41
#ifdef NSS_ENABLE_ECC
43
#ifdef NSS_ENABLE_ECC
42
    TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
44
    TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
43
    TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,
45
    TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,
(-)a/lib/ssl/sslimpl.h (-1 / +3 lines)
Line     Link Here 
 Lines 48-67    Link Here 
48
#define calg_rc4	ssl_calg_rc4
48
#define calg_rc4	ssl_calg_rc4
49
#define calg_rc2	ssl_calg_rc2
49
#define calg_rc2	ssl_calg_rc2
50
#define calg_des	ssl_calg_des
50
#define calg_des	ssl_calg_des
51
#define calg_3des	ssl_calg_3des
51
#define calg_3des	ssl_calg_3des
52
#define calg_idea	ssl_calg_idea
52
#define calg_idea	ssl_calg_idea
53
#define calg_fortezza	ssl_calg_fortezza /* deprecated, must preserve */
53
#define calg_fortezza	ssl_calg_fortezza /* deprecated, must preserve */
54
#define calg_aes	ssl_calg_aes
54
#define calg_aes	ssl_calg_aes
55
#define calg_camellia	ssl_calg_camellia
55
#define calg_camellia	ssl_calg_camellia
56
#define calg_seed	ssl_calg_seed
56
#define calg_seed	ssl_calg_seed
57
#define calg_aes_gcm    ssl_calg_aes_gcm
57
#define calg_aes_gcm    ssl_calg_aes_gcm
58
#define calg_chacha20	ssl_calg_chacha20
58
59
59
#define mac_null	ssl_mac_null
60
#define mac_null	ssl_mac_null
60
#define mac_md5 	ssl_mac_md5
61
#define mac_md5 	ssl_mac_md5
61
#define mac_sha 	ssl_mac_sha
62
#define mac_sha 	ssl_mac_sha
62
#define hmac_md5	ssl_hmac_md5
63
#define hmac_md5	ssl_hmac_md5
63
#define hmac_sha	ssl_hmac_sha
64
#define hmac_sha	ssl_hmac_sha
64
#define hmac_sha256	ssl_hmac_sha256
65
#define hmac_sha256	ssl_hmac_sha256
65
#define mac_aead	ssl_mac_aead
66
#define mac_aead	ssl_mac_aead
66
67
67
#define SET_ERROR_CODE		/* reminder */
68
#define SET_ERROR_CODE		/* reminder */
 Lines 275-295    Link Here 
275
    unsigned int    isPresent    :  1;
276
    unsigned int    isPresent    :  1;
276
#else
277
#else
277
    ssl3CipherSuite cipher_suite;
278
    ssl3CipherSuite cipher_suite;
278
    PRUint8         policy;
279
    PRUint8         policy;
279
    unsigned char   enabled   : 1;
280
    unsigned char   enabled   : 1;
280
    unsigned char   isPresent : 1;
281
    unsigned char   isPresent : 1;
281
#endif
282
#endif
282
} ssl3CipherSuiteCfg;
283
} ssl3CipherSuiteCfg;
283
284
284
#ifdef NSS_ENABLE_ECC
285
#ifdef NSS_ENABLE_ECC
285
#define ssl_V3_SUITES_IMPLEMENTED 61
286
#define ssl_V3_SUITES_IMPLEMENTED 63
286
#else
287
#else
287
#define ssl_V3_SUITES_IMPLEMENTED 37
288
#define ssl_V3_SUITES_IMPLEMENTED 37
288
#endif /* NSS_ENABLE_ECC */
289
#endif /* NSS_ENABLE_ECC */
289
290
290
#define MAX_DTLS_SRTP_CIPHER_SUITES 4
291
#define MAX_DTLS_SRTP_CIPHER_SUITES 4
291
292
292
typedef struct sslOptionsStr {
293
typedef struct sslOptionsStr {
293
    /* If SSL_SetNextProtoNego has been called, then this contains the
294
    /* If SSL_SetNextProtoNego has been called, then this contains the
294
     * list of supported protocols. */
295
     * list of supported protocols. */
295
    SECItem nextProtoNego;
296
    SECItem nextProtoNego;
 Lines 449-468    Link Here 
449
    cipher_des, 
450
    cipher_des, 
450
    cipher_3des, 
451
    cipher_3des, 
451
    cipher_des40,
452
    cipher_des40,
452
    cipher_idea, 
453
    cipher_idea, 
453
    cipher_aes_128,
454
    cipher_aes_128,
454
    cipher_aes_256,
455
    cipher_aes_256,
455
    cipher_camellia_128,
456
    cipher_camellia_128,
456
    cipher_camellia_256,
457
    cipher_camellia_256,
457
    cipher_seed,
458
    cipher_seed,
458
    cipher_aes_128_gcm,
459
    cipher_aes_128_gcm,
460
    cipher_chacha20,
459
    cipher_missing              /* reserved for no such supported cipher */
461
    cipher_missing              /* reserved for no such supported cipher */
460
    /* This enum must match ssl3_cipherName[] in ssl3con.c.  */
462
    /* This enum must match ssl3_cipherName[] in ssl3con.c.  */
461
} SSL3BulkCipher;
463
} SSL3BulkCipher;
462
464
463
typedef enum { type_stream, type_block, type_aead } CipherType;
465
typedef enum { type_stream, type_block, type_aead } CipherType;
464
466
465
#define MAX_IV_LENGTH 24
467
#define MAX_IV_LENGTH 24
466
468
467
/*
469
/*
468
 * Do not depend upon 64 bit arithmetic in the underlying machine. 
470
 * Do not depend upon 64 bit arithmetic in the underlying machine. 
(-)a/lib/ssl/sslinfo.c (+3 lines)
Line     Link Here 
 Lines 111-130    Link Here 
111
#define C_SEED 	"SEED", calg_seed
111
#define C_SEED 	"SEED", calg_seed
112
#define C_CAMELLIA "CAMELLIA", calg_camellia
112
#define C_CAMELLIA "CAMELLIA", calg_camellia
113
#define C_AES	"AES", calg_aes
113
#define C_AES	"AES", calg_aes
114
#define C_RC4	"RC4", calg_rc4
114
#define C_RC4	"RC4", calg_rc4
115
#define C_RC2	"RC2", calg_rc2
115
#define C_RC2	"RC2", calg_rc2
116
#define C_DES	"DES", calg_des
116
#define C_DES	"DES", calg_des
117
#define C_3DES	"3DES", calg_3des
117
#define C_3DES	"3DES", calg_3des
118
#define C_NULL  "NULL", calg_null
118
#define C_NULL  "NULL", calg_null
119
#define C_SJ 	"SKIPJACK", calg_sj
119
#define C_SJ 	"SKIPJACK", calg_sj
120
#define C_AESGCM "AES-GCM", calg_aes_gcm
120
#define C_AESGCM "AES-GCM", calg_aes_gcm
121
#define C_CHACHA20 "CHACHA20POLY1305", calg_chacha20
121
122
122
#define B_256	256, 256, 256
123
#define B_256	256, 256, 256
123
#define B_128	128, 128, 128
124
#define B_128	128, 128, 128
124
#define B_3DES  192, 156, 112
125
#define B_3DES  192, 156, 112
125
#define B_SJ     96,  80,  80
126
#define B_SJ     96,  80,  80
126
#define B_DES    64,  56,  56
127
#define B_DES    64,  56,  56
127
#define B_56    128,  56,  56
128
#define B_56    128,  56,  56
128
#define B_40    128,  40,  40
129
#define B_40    128,  40,  40
129
#define B_0  	  0,   0,   0
130
#define B_0  	  0,   0,   0
130
131
 Lines 189-214    Link Here 
189
{0,CS(TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA),  S_ECDSA, K_ECDH, C_3DES, B_3DES, M_SHA, 1, 0, 0, },
190
{0,CS(TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA),  S_ECDSA, K_ECDH, C_3DES, B_3DES, M_SHA, 1, 0, 0, },
190
{0,CS(TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA),   S_ECDSA, K_ECDH, C_AES, B_128, M_SHA, 1, 0, 0, },
191
{0,CS(TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA),   S_ECDSA, K_ECDH, C_AES, B_128, M_SHA, 1, 0, 0, },
191
{0,CS(TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA),   S_ECDSA, K_ECDH, C_AES, B_256, M_SHA, 1, 0, 0, },
192
{0,CS(TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA),   S_ECDSA, K_ECDH, C_AES, B_256, M_SHA, 1, 0, 0, },
192
193
193
{0,CS(TLS_ECDHE_ECDSA_WITH_NULL_SHA),         S_ECDSA, K_ECDHE, C_NULL, B_0, M_SHA, 0, 0, 0, },
194
{0,CS(TLS_ECDHE_ECDSA_WITH_NULL_SHA),         S_ECDSA, K_ECDHE, C_NULL, B_0, M_SHA, 0, 0, 0, },
194
{0,CS(TLS_ECDHE_ECDSA_WITH_RC4_128_SHA),      S_ECDSA, K_ECDHE, C_RC4, B_128, M_SHA, 0, 0, 0, },
195
{0,CS(TLS_ECDHE_ECDSA_WITH_RC4_128_SHA),      S_ECDSA, K_ECDHE, C_RC4, B_128, M_SHA, 0, 0, 0, },
195
{0,CS(TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA), S_ECDSA, K_ECDHE, C_3DES, B_3DES, M_SHA, 1, 0, 0, },
196
{0,CS(TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA), S_ECDSA, K_ECDHE, C_3DES, B_3DES, M_SHA, 1, 0, 0, },
196
{0,CS(TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA),  S_ECDSA, K_ECDHE, C_AES, B_128, M_SHA, 1, 0, 0, },
197
{0,CS(TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA),  S_ECDSA, K_ECDHE, C_AES, B_128, M_SHA, 1, 0, 0, },
197
{0,CS(TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256), S_ECDSA, K_ECDHE, C_AES, B_128, M_SHA256, 1, 0, 0, },
198
{0,CS(TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256), S_ECDSA, K_ECDHE, C_AES, B_128, M_SHA256, 1, 0, 0, },
198
{0,CS(TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA),  S_ECDSA, K_ECDHE, C_AES, B_256, M_SHA, 1, 0, 0, },
199
{0,CS(TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA),  S_ECDSA, K_ECDHE, C_AES, B_256, M_SHA, 1, 0, 0, },
200
{0,CS(TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305),S_ECDSA,K_ECDHE,C_CHACHA20,B_256,M_AEAD_128,0, 0, 0, },
199
201
200
{0,CS(TLS_ECDH_RSA_WITH_NULL_SHA),            S_RSA, K_ECDH, C_NULL, B_0, M_SHA, 0, 0, 0, },
202
{0,CS(TLS_ECDH_RSA_WITH_NULL_SHA),            S_RSA, K_ECDH, C_NULL, B_0, M_SHA, 0, 0, 0, },
201
{0,CS(TLS_ECDH_RSA_WITH_RC4_128_SHA),         S_RSA, K_ECDH, C_RC4, B_128, M_SHA, 0, 0, 0, },
203
{0,CS(TLS_ECDH_RSA_WITH_RC4_128_SHA),         S_RSA, K_ECDH, C_RC4, B_128, M_SHA, 0, 0, 0, },
202
{0,CS(TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA),    S_RSA, K_ECDH, C_3DES, B_3DES, M_SHA, 1, 0, 0, },
204
{0,CS(TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA),    S_RSA, K_ECDH, C_3DES, B_3DES, M_SHA, 1, 0, 0, },
203
{0,CS(TLS_ECDH_RSA_WITH_AES_128_CBC_SHA),     S_RSA, K_ECDH, C_AES, B_128, M_SHA, 1, 0, 0, },
205
{0,CS(TLS_ECDH_RSA_WITH_AES_128_CBC_SHA),     S_RSA, K_ECDH, C_AES, B_128, M_SHA, 1, 0, 0, },
204
{0,CS(TLS_ECDH_RSA_WITH_AES_256_CBC_SHA),     S_RSA, K_ECDH, C_AES, B_256, M_SHA, 1, 0, 0, },
206
{0,CS(TLS_ECDH_RSA_WITH_AES_256_CBC_SHA),     S_RSA, K_ECDH, C_AES, B_256, M_SHA, 1, 0, 0, },
207
{0,CS(TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305),  S_RSA,K_ECDHE,C_CHACHA20,B_256,M_AEAD_128, 0, 0, 0, },
205
208
206
{0,CS(TLS_ECDHE_RSA_WITH_NULL_SHA),           S_RSA, K_ECDHE, C_NULL, B_0, M_SHA, 0, 0, 0, },
209
{0,CS(TLS_ECDHE_RSA_WITH_NULL_SHA),           S_RSA, K_ECDHE, C_NULL, B_0, M_SHA, 0, 0, 0, },
207
{0,CS(TLS_ECDHE_RSA_WITH_RC4_128_SHA),        S_RSA, K_ECDHE, C_RC4, B_128, M_SHA, 0, 0, 0, },
210
{0,CS(TLS_ECDHE_RSA_WITH_RC4_128_SHA),        S_RSA, K_ECDHE, C_RC4, B_128, M_SHA, 0, 0, 0, },
208
{0,CS(TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA),   S_RSA, K_ECDHE, C_3DES, B_3DES, M_SHA, 1, 0, 0, },
211
{0,CS(TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA),   S_RSA, K_ECDHE, C_3DES, B_3DES, M_SHA, 1, 0, 0, },
209
{0,CS(TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA),    S_RSA, K_ECDHE, C_AES, B_128, M_SHA, 1, 0, 0, },
212
{0,CS(TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA),    S_RSA, K_ECDHE, C_AES, B_128, M_SHA, 1, 0, 0, },
210
{0,CS(TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256), S_RSA, K_ECDHE, C_AES, B_128, M_SHA256, 1, 0, 0, },
213
{0,CS(TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256), S_RSA, K_ECDHE, C_AES, B_128, M_SHA256, 1, 0, 0, },
211
{0,CS(TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA),    S_RSA, K_ECDHE, C_AES, B_256, M_SHA, 1, 0, 0, },
214
{0,CS(TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA),    S_RSA, K_ECDHE, C_AES, B_256, M_SHA, 1, 0, 0, },
212
#endif /* NSS_ENABLE_ECC */
215
#endif /* NSS_ENABLE_ECC */
213
216
214
/* SSL 2 table */
217
/* SSL 2 table */
(-)a/lib/ssl/sslproto.h (+3 lines)
Line     Link Here 
 Lines 206-225    Link Here 
206
#define TLS_ECDH_anon_WITH_AES_256_CBC_SHA      0xC019
206
#define TLS_ECDH_anon_WITH_AES_256_CBC_SHA      0xC019
207
207
208
#define TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 0xC023
208
#define TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 0xC023
209
#define TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256   0xC027
209
#define TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256   0xC027
210
210
211
#define TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 0xC02B
211
#define TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 0xC02B
212
#define TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256  0xC02D
212
#define TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256  0xC02D
213
#define TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256   0xC02F
213
#define TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256   0xC02F
214
#define TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256    0xC031
214
#define TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256    0xC031
215
215
216
#define TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305	0xCC13
217
#define TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305	0xCC14
218
216
/* Netscape "experimental" cipher suites. */
219
/* Netscape "experimental" cipher suites. */
217
#define SSL_RSA_OLDFIPS_WITH_3DES_EDE_CBC_SHA	0xffe0
220
#define SSL_RSA_OLDFIPS_WITH_3DES_EDE_CBC_SHA	0xffe0
218
#define SSL_RSA_OLDFIPS_WITH_DES_CBC_SHA	0xffe1
221
#define SSL_RSA_OLDFIPS_WITH_DES_CBC_SHA	0xffe1
219
222
220
/* New non-experimental openly spec'ed versions of those cipher suites. */
223
/* New non-experimental openly spec'ed versions of those cipher suites. */
221
#define SSL_RSA_FIPS_WITH_3DES_EDE_CBC_SHA 	0xfeff
224
#define SSL_RSA_FIPS_WITH_3DES_EDE_CBC_SHA 	0xfeff
222
#define SSL_RSA_FIPS_WITH_DES_CBC_SHA      	0xfefe
225
#define SSL_RSA_FIPS_WITH_DES_CBC_SHA      	0xfefe
223
226
224
/* DTLS-SRTP cipher suites from RFC 5764 */
227
/* DTLS-SRTP cipher suites from RFC 5764 */
225
/* If you modify this, also modify MAX_DTLS_SRTP_CIPHER_SUITES in sslimpl.h */
228
/* If you modify this, also modify MAX_DTLS_SRTP_CIPHER_SUITES in sslimpl.h */
(-)a/lib/ssl/sslt.h (-1 / +2 lines)
Line     Link Here 
 Lines 74-94    Link Here 
74
    ssl_calg_null     = 0,
74
    ssl_calg_null     = 0,
75
    ssl_calg_rc4      = 1,
75
    ssl_calg_rc4      = 1,
76
    ssl_calg_rc2      = 2,
76
    ssl_calg_rc2      = 2,
77
    ssl_calg_des      = 3,
77
    ssl_calg_des      = 3,
78
    ssl_calg_3des     = 4,
78
    ssl_calg_3des     = 4,
79
    ssl_calg_idea     = 5,
79
    ssl_calg_idea     = 5,
80
    ssl_calg_fortezza = 6,      /* deprecated, now unused */
80
    ssl_calg_fortezza = 6,      /* deprecated, now unused */
81
    ssl_calg_aes      = 7,
81
    ssl_calg_aes      = 7,
82
    ssl_calg_camellia = 8,
82
    ssl_calg_camellia = 8,
83
    ssl_calg_seed     = 9,
83
    ssl_calg_seed     = 9,
84
    ssl_calg_aes_gcm  = 10
84
    ssl_calg_aes_gcm  = 10,
85
    ssl_calg_chacha20 = 11
85
} SSLCipherAlgorithm;
86
} SSLCipherAlgorithm;
86
87
87
typedef enum { 
88
typedef enum { 
88
    ssl_mac_null      = 0, 
89
    ssl_mac_null      = 0, 
89
    ssl_mac_md5       = 1, 
90
    ssl_mac_md5       = 1, 
90
    ssl_mac_sha       = 2, 
91
    ssl_mac_sha       = 2, 
91
    ssl_hmac_md5      = 3, 	/* TLS HMAC version of mac_md5 */
92
    ssl_hmac_md5      = 3, 	/* TLS HMAC version of mac_md5 */
92
    ssl_hmac_sha      = 4, 	/* TLS HMAC version of mac_sha */
93
    ssl_hmac_sha      = 4, 	/* TLS HMAC version of mac_sha */
93
    ssl_hmac_sha256   = 5,
94
    ssl_hmac_sha256   = 5,
94
    ssl_mac_aead      = 6
95
    ssl_mac_aead      = 6
(-)a/lib/util/pkcs11n.h (+13 lines)
Line     Link Here 
 Lines 44-63    Link Here 
44
 * NSS-defined key types
44
 * NSS-defined key types
45
 *
45
 *
46
 */
46
 */
47
#define CKK_NSS (CKK_VENDOR_DEFINED|NSSCK_VENDOR_NSS)
47
#define CKK_NSS (CKK_VENDOR_DEFINED|NSSCK_VENDOR_NSS)
48
48
49
#define CKK_NSS_PKCS8              (CKK_NSS + 1)
49
#define CKK_NSS_PKCS8              (CKK_NSS + 1)
50
50
51
#define CKK_NSS_JPAKE_ROUND1       (CKK_NSS + 2)
51
#define CKK_NSS_JPAKE_ROUND1       (CKK_NSS + 2)
52
#define CKK_NSS_JPAKE_ROUND2       (CKK_NSS + 3)
52
#define CKK_NSS_JPAKE_ROUND2       (CKK_NSS + 3)
53
53
54
#define CKK_NSS_CHACHA20           (CKK_NSS + 4)
55
54
/*
56
/*
55
 * NSS-defined certificate types
57
 * NSS-defined certificate types
56
 *
58
 *
57
 */
59
 */
58
#define CKC_NSS (CKC_VENDOR_DEFINED|NSSCK_VENDOR_NSS)
60
#define CKC_NSS (CKC_VENDOR_DEFINED|NSSCK_VENDOR_NSS)
59
61
60
/* FAKE PKCS #11 defines */
62
/* FAKE PKCS #11 defines */
61
#define CKA_DIGEST            0x81000000L
63
#define CKA_DIGEST            0x81000000L
62
#define CKA_FLAGS_ONLY        0 /* CKA_CLASS */
64
#define CKA_FLAGS_ONLY        0 /* CKA_CLASS */
63
65
 Lines 207-226    Link Here 
207
 */
209
 */
208
#define CKM_NSS_HMAC_CONSTANT_TIME      (CKM_NSS + 19)
210
#define CKM_NSS_HMAC_CONSTANT_TIME      (CKM_NSS + 19)
209
#define CKM_NSS_SSL3_MAC_CONSTANT_TIME  (CKM_NSS + 20)
211
#define CKM_NSS_SSL3_MAC_CONSTANT_TIME  (CKM_NSS + 20)
210
212
211
/* TLS 1.2 mechanisms */
213
/* TLS 1.2 mechanisms */
212
#define CKM_NSS_TLS_PRF_GENERAL_SHA256          (CKM_NSS + 21)
214
#define CKM_NSS_TLS_PRF_GENERAL_SHA256          (CKM_NSS + 21)
213
#define CKM_NSS_TLS_MASTER_KEY_DERIVE_SHA256    (CKM_NSS + 22)
215
#define CKM_NSS_TLS_MASTER_KEY_DERIVE_SHA256    (CKM_NSS + 22)
214
#define CKM_NSS_TLS_KEY_AND_MAC_DERIVE_SHA256   (CKM_NSS + 23)
216
#define CKM_NSS_TLS_KEY_AND_MAC_DERIVE_SHA256   (CKM_NSS + 23)
215
#define CKM_NSS_TLS_MASTER_KEY_DERIVE_DH_SHA256 (CKM_NSS + 24)
217
#define CKM_NSS_TLS_MASTER_KEY_DERIVE_DH_SHA256 (CKM_NSS + 24)
216
218
219
#define CKM_NSS_CHACHA20_POLY1305               (CKM_NSS + 25)
220
#define CKM_NSS_CHACHA20_KEY_GEN                (CKM_NSS + 26)
221
222
typedef struct CK_AEAD_PARAMS {
223
  CK_BYTE_PTR  pIv;  /* This is the nonce. */
224
  CK_ULONG     ulIvLen;
225
  CK_BYTE_PTR  pAAD;
226
  CK_ULONG     ulAADLen;
227
  CK_ULONG     ulTagBits;
228
} CK_AEAD_PARAMS;
229
217
/*
230
/*
218
 * HISTORICAL:
231
 * HISTORICAL:
219
 * Do not attempt to use these. They are only used by NETSCAPE's internal
232
 * Do not attempt to use these. They are only used by NETSCAPE's internal
220
 * PKCS #11 interface. Most of these are place holders for other mechanism
233
 * PKCS #11 interface. Most of these are place holders for other mechanism
221
 * and will change in the future.
234
 * and will change in the future.
222
 */
235
 */
223
#define CKM_NETSCAPE_PBE_SHA1_DES_CBC           0x80000002UL
236
#define CKM_NETSCAPE_PBE_SHA1_DES_CBC           0x80000002UL
224
#define CKM_NETSCAPE_PBE_SHA1_TRIPLE_DES_CBC    0x80000003UL
237
#define CKM_NETSCAPE_PBE_SHA1_TRIPLE_DES_CBC    0x80000003UL
225
#define CKM_NETSCAPE_PBE_SHA1_40_BIT_RC2_CBC    0x80000004UL
238
#define CKM_NETSCAPE_PBE_SHA1_40_BIT_RC2_CBC    0x80000004UL
226
#define CKM_NETSCAPE_PBE_SHA1_128_BIT_RC2_CBC   0x80000005UL
239
#define CKM_NETSCAPE_PBE_SHA1_128_BIT_RC2_CBC   0x80000005UL
(-)a/tests/cipher/cipher.sh (+11 lines)
Line     Link Here 
 Lines 100-119    Link Here 
100
      if [ -n "$EXP_RET" -a "$EXP_RET" != "#" ] ; then
100
      if [ -n "$EXP_RET" -a "$EXP_RET" != "#" ] ; then
101
          TESTNAME=`echo $TESTNAME | sed -e "s/_/ /g"`
101
          TESTNAME=`echo $TESTNAME | sed -e "s/_/ /g"`
102
          echo "$SCRIPTNAME: $TESTNAME --------------------------------"
102
          echo "$SCRIPTNAME: $TESTNAME --------------------------------"
103
          echo "pk11gcmtest aes kat gcm $GCMTESTDIR/tests/$INPUT_FILE"
103
          echo "pk11gcmtest aes kat gcm $GCMTESTDIR/tests/$INPUT_FILE"
104
          ${PROFTOOL} ${BINDIR}/pk11gcmtest aes kat gcm $GCMTESTDIR/tests/$INPUT_FILE
104
          ${PROFTOOL} ${BINDIR}/pk11gcmtest aes kat gcm $GCMTESTDIR/tests/$INPUT_FILE
105
          html_msg $? $EXP_RET "$TESTNAME"
105
          html_msg $? $EXP_RET "$TESTNAME"
106
      fi
106
      fi
107
  done < ${GCM_TXT}
107
  done < ${GCM_TXT}
108
}
108
}
109
109
110
######################## cipher_chacha20_poly1305 ######################
111
# local shell function to test ChaCha20+Poly1305
112
########################################################################
113
cipher_chacha20_poly1305()
114
{
115
    INPUT_FILE=ChaCha20Poly1305Encrypt.rsp
116
    echo "pk11gcmtest chacha20 kat poly1305 $GCMTESTDIR/tests/$INPUT_FILE"
117
    ${PROFTOOL} ${BINDIR}/pk11gcmtest chacha20 kat poly1305 $GCMTESTDIR/tests/$INPUT_FILE
118
}
119
110
############################## cipher_cleanup ############################
120
############################## cipher_cleanup ############################
111
# local shell function to finish this script (no exit since it might be
121
# local shell function to finish this script (no exit since it might be
112
# sourced)
122
# sourced)
113
########################################################################
123
########################################################################
114
cipher_cleanup()
124
cipher_cleanup()
115
{
125
{
116
  html "</TABLE><BR>"
126
  html "</TABLE><BR>"
117
  cd ${QADIR}
127
  cd ${QADIR}
118
  . common/cleanup.sh
128
  . common/cleanup.sh
119
}
129
}
 Lines 124-134    Link Here 
124
# built and the cipher suite run as part of an nss-softoken build. 
134
# built and the cipher suite run as part of an nss-softoken build. 
125
if [ ! -x ${DIST}/${OBJDIR}/bin/bltest${PROG_SUFFIX} ]; then
135
if [ ! -x ${DIST}/${OBJDIR}/bin/bltest${PROG_SUFFIX} ]; then
126
    echo "bltest not built, skipping this test." >> ${LOGFILE}
136
    echo "bltest not built, skipping this test." >> ${LOGFILE}
127
    res = 0
137
    res = 0
128
    html_msg $res $EXP_RET "$TESTNAME"
138
    html_msg $res $EXP_RET "$TESTNAME"
129
    return 0
139
    return 0
130
fi
140
fi
131
cipher_init
141
cipher_init
132
cipher_main
142
cipher_main
133
cipher_gcm
143
cipher_gcm
144
cipher_chacha20_poly1305
134
cipher_cleanup
145
cipher_cleanup

Return to bug 917571