/external/boringssl/src/crypto/fipsmodule/aes/ |
aes_test.cc | 31 std::vector<uint8_t> key, plaintext, ciphertext; local 34 ASSERT_TRUE(t->GetBytes(&ciphertext, "Ciphertext")); 37 ASSERT_EQ(static_cast<unsigned>(AES_BLOCK_SIZE), ciphertext.size()); 45 EXPECT_EQ(Bytes(ciphertext), Bytes(block)); 50 EXPECT_EQ(Bytes(ciphertext), Bytes(block)); 55 AES_decrypt(ciphertext.data(), block, &aes_key); 59 OPENSSL_memcpy(block, ciphertext.data(), AES_BLOCK_SIZE); 73 std::vector<uint8_t> key, plaintext, ciphertext; local 76 ASSERT_TRUE(t->GetBytes(&ciphertext, "Ciphertext")) [all...] |
/prebuilts/go/darwin-x86/src/vendor/golang_org/x/crypto/chacha20poly1305/ |
chacha20poly1305_generic.go | 42 func (c *chacha20poly1305) openGeneric(dst, nonce, ciphertext, additionalData []byte) ([]byte, error) { 44 copy(tag[:], ciphertext[len(ciphertext)-16:]) 45 ciphertext = ciphertext[:len(ciphertext)-16] 53 polyInput := make([]byte, roundTo16(len(additionalData))+roundTo16(len(ciphertext))+8+8) 55 copy(polyInput[roundTo16(len(additionalData)):], ciphertext) 57 binary.LittleEndian.PutUint64(polyInput[len(polyInput)-8:], uint64(len(ciphertext))) 59 ret, out := sliceForAppend(dst, len(ciphertext)) [all...] |
chacha20poly1305_noasm.go | 13 func (c *chacha20poly1305) open(dst, nonce, ciphertext, additionalData []byte) ([]byte, error) { 14 return c.openGeneric(dst, nonce, ciphertext, additionalData)
|
chacha20poly1305_amd64.go | 62 func (c *chacha20poly1305) open(dst, nonce, ciphertext, additionalData []byte) ([]byte, error) { 64 return c.openGeneric(dst, nonce, ciphertext, additionalData) 70 ciphertext = ciphertext[:len(ciphertext)-16] 71 ret, out := sliceForAppend(dst, len(ciphertext)) 72 if !chacha20Poly1305Open(out, state[:], ciphertext, additionalData) {
|
/prebuilts/go/linux-x86/src/vendor/golang_org/x/crypto/chacha20poly1305/ |
chacha20poly1305_generic.go | 42 func (c *chacha20poly1305) openGeneric(dst, nonce, ciphertext, additionalData []byte) ([]byte, error) { 44 copy(tag[:], ciphertext[len(ciphertext)-16:]) 45 ciphertext = ciphertext[:len(ciphertext)-16] 53 polyInput := make([]byte, roundTo16(len(additionalData))+roundTo16(len(ciphertext))+8+8) 55 copy(polyInput[roundTo16(len(additionalData)):], ciphertext) 57 binary.LittleEndian.PutUint64(polyInput[len(polyInput)-8:], uint64(len(ciphertext))) 59 ret, out := sliceForAppend(dst, len(ciphertext)) [all...] |
chacha20poly1305_noasm.go | 13 func (c *chacha20poly1305) open(dst, nonce, ciphertext, additionalData []byte) ([]byte, error) { 14 return c.openGeneric(dst, nonce, ciphertext, additionalData)
|
chacha20poly1305_amd64.go | 62 func (c *chacha20poly1305) open(dst, nonce, ciphertext, additionalData []byte) ([]byte, error) { 64 return c.openGeneric(dst, nonce, ciphertext, additionalData) 70 ciphertext = ciphertext[:len(ciphertext)-16] 71 ret, out := sliceForAppend(dst, len(ciphertext)) 72 if !chacha20Poly1305Open(out, state[:], ciphertext, additionalData) {
|
/prebuilts/go/darwin-x86/src/crypto/cipher/ |
cfb_test.go | 20 key, iv, plaintext, ciphertext string 62 expected, err := hex.DecodeString(test.ciphertext) 72 ciphertext := make([]byte, len(plaintext)) 74 cfb.XORKeyStream(ciphertext, plaintext) 76 if !bytes.Equal(ciphertext, expected) { 77 t.Errorf("#%d: wrong output: got %x, expected %x", i, ciphertext, expected) 81 plaintextCopy := make([]byte, len(ciphertext)) 82 cfbdec.XORKeyStream(plaintextCopy, ciphertext) 101 ciphertext := make([]byte, len(plaintext)) 102 copy(ciphertext, plaintext [all...] |
example_test.go | 39 ciphertext := aesgcm.Seal(nil, nonce, plaintext, nil) 40 fmt.Printf("%x\n", ciphertext) 47 ciphertext, _ := hex.DecodeString("1019aa66cd7c024f9efd0038899dae1973ee69427f5a6579eba292ffe1b5a260") 61 plaintext, err := aesgcm.Open(nil, nonce, ciphertext, nil) 72 ciphertext, _ := hex.DecodeString("f363f3ccdcb12bb883abf484ba77d9cd7d32b5baecb3d4b1b3e0e4beffdb3ded") 80 // include it at the beginning of the ciphertext. 81 if len(ciphertext) < aes.BlockSize { 82 panic("ciphertext too short") 84 iv := ciphertext[:aes.BlockSize] 85 ciphertext = ciphertext[aes.BlockSize: [all...] |
ofb_test.go | 81 ciphertext := make([]byte, len(plaintext)) 82 ofb.XORKeyStream(ciphertext, plaintext) 83 if !bytes.Equal(ciphertext, tt.out[:len(plaintext)]) { 84 t.Errorf("%s/%d: encrypting\ninput % x\nhave % x\nwant % x", test, len(plaintext), plaintext, ciphertext, tt.out) 89 ciphertext := tt.out[0 : len(tt.in)-j] 91 plaintext := make([]byte, len(ciphertext)) 92 ofb.XORKeyStream(plaintext, ciphertext) 93 if !bytes.Equal(plaintext, tt.in[:len(ciphertext)]) { 94 t.Errorf("%s/%d: decrypting\nhave % x\nwant % x", test, len(ciphertext), plaintext, tt.in)
|
/prebuilts/go/linux-x86/src/crypto/cipher/ |
cfb_test.go | 20 key, iv, plaintext, ciphertext string 62 expected, err := hex.DecodeString(test.ciphertext) 72 ciphertext := make([]byte, len(plaintext)) 74 cfb.XORKeyStream(ciphertext, plaintext) 76 if !bytes.Equal(ciphertext, expected) { 77 t.Errorf("#%d: wrong output: got %x, expected %x", i, ciphertext, expected) 81 plaintextCopy := make([]byte, len(ciphertext)) 82 cfbdec.XORKeyStream(plaintextCopy, ciphertext) 101 ciphertext := make([]byte, len(plaintext)) 102 copy(ciphertext, plaintext [all...] |
example_test.go | 39 ciphertext := aesgcm.Seal(nil, nonce, plaintext, nil) 40 fmt.Printf("%x\n", ciphertext) 47 ciphertext, _ := hex.DecodeString("1019aa66cd7c024f9efd0038899dae1973ee69427f5a6579eba292ffe1b5a260") 61 plaintext, err := aesgcm.Open(nil, nonce, ciphertext, nil) 72 ciphertext, _ := hex.DecodeString("f363f3ccdcb12bb883abf484ba77d9cd7d32b5baecb3d4b1b3e0e4beffdb3ded") 80 // include it at the beginning of the ciphertext. 81 if len(ciphertext) < aes.BlockSize { 82 panic("ciphertext too short") 84 iv := ciphertext[:aes.BlockSize] 85 ciphertext = ciphertext[aes.BlockSize: [all...] |
ofb_test.go | 81 ciphertext := make([]byte, len(plaintext)) 82 ofb.XORKeyStream(ciphertext, plaintext) 83 if !bytes.Equal(ciphertext, tt.out[:len(plaintext)]) { 84 t.Errorf("%s/%d: encrypting\ninput % x\nhave % x\nwant % x", test, len(plaintext), plaintext, ciphertext, tt.out) 89 ciphertext := tt.out[0 : len(tt.in)-j] 91 plaintext := make([]byte, len(ciphertext)) 92 ofb.XORKeyStream(plaintext, ciphertext) 93 if !bytes.Equal(plaintext, tt.in[:len(ciphertext)]) { 94 t.Errorf("%s/%d: decrypting\nhave % x\nwant % x", test, len(ciphertext), plaintext, tt.in)
|
/external/wycheproof/java/com/google/security/wycheproof/testcases/ |
DhiesTest.java | 95 byte[] ciphertext = dhies.doFinal(message); 96 System.out.println("testDhiesBasic:" + TestUtil.bytesToHex(ciphertext)); 98 byte[] decrypted = dhies.doFinal(ciphertext); 104 * ciphertexts. Checks that a modification of the ciphertext is dectected. 123 byte[] ciphertext = dhies.doFinal(message); 124 for (int i = 0; i < ciphertext.length; i++) { 125 byte[] corrupt = Arrays.copyOf(ciphertext, ciphertext.length); 130 fail("Corrupt ciphertext accepted:" + i); 159 byte[] ciphertext = dhies.doFinal(message) [all...] |
EciesTest.java | 43 // padding and MAC failures allowing adaptive chosen-ciphertext attacks. The implementation 58 // 0x04 || coordinate x || coordinate y || PKCS5 padded ciphertext || 20-byte HMAC-digest. 83 byte[] ciphertext = ecies.doFinal(message); 84 System.out.println("testEciesBasic:" + TestUtil.bytesToHex(ciphertext)); 86 byte[] decrypted = ecies.doFinal(ciphertext); 174 byte[] ciphertext = ecies.doFinal(message); 175 System.out.println(TestUtil.bytesToHex(ciphertext)); 178 for (int byteNr = kemSize; byteNr < ciphertext.length; byteNr++) { 180 byte[] corrupt = Arrays.copyOf(ciphertext, ciphertext.length) [all...] |
RsaEncryptionTest.java | 35 // - ciphertext too long 37 // - ciphertext 0 38 // - ciphertext == modulus timing attacks 67 * <li>Bleichenbacher, "Chosen ciphertext attacks against protocols based on the RSA encryption 69 * <li>Manger, "A chosen ciphertext attack on RSA optimal asymmetric encryption padding (OAEP) 71 * to a chosen ciphertext attack if error messages distinguish between different failure 77 * <li>Smart, "Errors matter: Breaking RSA-based PIN encryption with thirty ciphertext validity 105 byte[] ciphertext = new byte[1024 / 8]; 109 rand.nextBytes(ciphertext); 110 ciphertext[0] &= (byte) 0x7f [all...] |
/system/keymaster/ |
ocb_utils.h | 38 KeymasterKeyBlob* ciphertext, Buffer* tag); 43 const KeymasterKeyBlob& ciphertext, const Buffer& nonce,
|
ocb_utils.cpp | 122 KeymasterKeyBlob* ciphertext, Buffer* tag) { 123 assert(ciphertext && tag); 137 if (!ciphertext->Reset(plaintext.key_material_size)) 142 0 /* additional data length */, ciphertext->writable_data(), 157 const KeymasterKeyBlob& ciphertext, const Buffer& nonce, 173 if (!plaintext->Reset(ciphertext.key_material_size)) 176 int ae_err = ae_decrypt(ctx.get(), nonce.peek_read(), ciphertext.key_material, 177 ciphertext.key_material_size, NULL /* additional data */, 190 assert(ae_err == static_cast<int>(ciphertext.key_material_size));
|
/external/boringssl/src/crypto/fipsmodule/modes/ |
gcm_test.cc | 72 std::vector<uint8_t> key, plaintext, additional_data, nonce, ciphertext, 78 ASSERT_TRUE(t->GetBytes(&ciphertext, "Ciphertext")); 81 ASSERT_EQ(plaintext.size(), ciphertext.size()); 100 EXPECT_EQ(Bytes(ciphertext), Bytes(out)); 107 if (!ciphertext.empty()) { 108 CRYPTO_gcm128_decrypt(&ctx, &aes_key, ciphertext.data(), out.data(), 109 ciphertext.size());
|
/cts/tests/tests/keystore/src/android/keystore/cts/ |
RSACipherTest.java | 91 byte[] ciphertext = cipher.doFinal(plaintext); 93 MoreAsserts.assertEquals(plaintext, cipher.doFinal(ciphertext)); 118 byte[] ciphertext = cipher.doFinal(plaintext); 119 fail("Unexpectedly produced ciphertext (" + ciphertext.length + " bytes): " 120 + HexEncoding.encode(ciphertext)); 147 byte[] ciphertext = cipher.doFinal(plaintext); 148 fail("Unexpectedly produced ciphertext (" + ciphertext.length + " bytes): " 149 + HexEncoding.encode(ciphertext)); [all...] |
AESGCMCipherTestBase.java | 182 byte[] ciphertext = getKatCiphertext(); 183 ciphertext[ciphertext.length / 2] ^= 0x40; 186 doFinal(ciphertext); 194 byte[] ciphertext = getKatCiphertextWhenKatAadPresent(); 200 doFinal(ciphertext);
|
/prebuilts/go/darwin-x86/src/crypto/aes/ |
aes_gcm.go | 133 // Open authenticates and decrypts ciphertext. See the cipher.AEAD interface 135 func (g *gcmAsm) Open(dst, nonce, ciphertext, data []byte) ([]byte, error) { 140 if len(ciphertext) < gcmTagSize { 143 if uint64(len(ciphertext)) > ((1<<32)-2)*BlockSize+gcmTagSize { 147 tag := ciphertext[len(ciphertext)-gcmTagSize:] 148 ciphertext = ciphertext[:len(ciphertext)-gcmTagSize] 168 ret, out := sliceForAppend(dst, len(ciphertext)) [all...] |
/prebuilts/go/linux-x86/src/crypto/aes/ |
aes_gcm.go | 133 // Open authenticates and decrypts ciphertext. See the cipher.AEAD interface 135 func (g *gcmAsm) Open(dst, nonce, ciphertext, data []byte) ([]byte, error) { 140 if len(ciphertext) < gcmTagSize { 143 if uint64(len(ciphertext)) > ((1<<32)-2)*BlockSize+gcmTagSize { 147 tag := ciphertext[len(ciphertext)-gcmTagSize:] 148 ciphertext = ciphertext[:len(ciphertext)-gcmTagSize] 168 ret, out := sliceForAppend(dst, len(ciphertext)) [all...] |
/libcore/luni/src/test/java/libcore/javax/crypto/ |
CipherBasicsTest.java | 95 byte[] ciphertext = toBytes(line[CIPHERTEXT_INDEX]); 111 Arrays.equals(ciphertext, cipher.doFinal(plaintext))); 117 Arrays.equals(plaintext, cipher.doFinal(ciphertext))); 145 byte[] ciphertext = toBytes(line[CIPHERTEXT_INDEX]); 156 byte[] combinedOutput = new byte[ciphertext.length + tag.length]; 157 System.arraycopy(ciphertext, 0, combinedOutput, 0, ciphertext.length); 158 System.arraycopy(tag, 0, combinedOutput, ciphertext.length, tag.length);
|
/external/boringssl/src/ssl/test/runner/ |
chacha20_poly1305.go | 139 func (c *chaCha20Poly1305) poly1305(tag *[16]byte, nonce, ciphertext, additionalData []byte) { 140 input := make([]byte, 0, len(additionalData)+15+len(ciphertext)+15+8+8) 146 input = append(input, ciphertext...) 153 binary.LittleEndian.PutUint64(out, uint64(len(ciphertext))) 176 func (c *chaCha20Poly1305) Open(dst, nonce, ciphertext, additionalData []byte) ([]byte, error) { 180 if len(ciphertext) < 16 { 183 plaintextLen := len(ciphertext) - 16 186 c.poly1305(&tag, nonce, ciphertext[:plaintextLen], additionalData) 187 if subtle.ConstantTimeCompare(tag[:], ciphertext[plaintextLen:]) != 1 { 192 chaCha20(out, ciphertext[:plaintextLen], c.key[:], nonce, 1 [all...] |