aboutsummaryrefslogtreecommitdiffstats
path: root/lib/crypto/src/crypto.erl
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2016-04-18 15:16:04 +0200
committerSverker Eriksson <[email protected]>2016-04-18 15:16:04 +0200
commit77c3110b00d7f5e80ca1da77df79650e2fa66efe (patch)
tree3d2adb583f71535749b7aadfe9f62074ab3c4a34 /lib/crypto/src/crypto.erl
parent6aa696eb58127f3da12ad1640347fd5c285954a6 (diff)
parentb3d2334d78fe23502b81ae095617fb585d0ba3c3 (diff)
downloadotp-77c3110b00d7f5e80ca1da77df79650e2fa66efe.tar.gz
otp-77c3110b00d7f5e80ca1da77df79650e2fa66efe.tar.bz2
otp-77c3110b00d7f5e80ca1da77df79650e2fa66efe.zip
Merge branch 'mururu/crypto/aes-gcm-tag-len.PR-998.OTP-13483'
Diffstat (limited to 'lib/crypto/src/crypto.erl')
-rw-r--r--lib/crypto/src/crypto.erl7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/crypto/src/crypto.erl b/lib/crypto/src/crypto.erl
index fb252118a3..a154476560 100644
--- a/lib/crypto/src/crypto.erl
+++ b/lib/crypto/src/crypto.erl
@@ -302,6 +302,8 @@ block_encrypt(aes_ige256, Key, Ivec, Data) ->
aes_ige_crypt_nif(Key, Ivec, Data, true);
block_encrypt(aes_gcm, Key, Ivec, {AAD, Data}) ->
aes_gcm_encrypt(Key, Ivec, AAD, Data);
+block_encrypt(aes_gcm, Key, Ivec, {AAD, Data, TagLength}) ->
+ aes_gcm_encrypt(Key, Ivec, AAD, Data, TagLength);
block_encrypt(chacha20_poly1305, Key, Ivec, {AAD, Data}) ->
chacha20_poly1305_encrypt(Key, Ivec, AAD, Data).
@@ -917,7 +919,10 @@ aes_cfb_128_decrypt(Key, IVec, Data) ->
%%
%% AES - in Galois/Counter Mode (GCM)
%%
-aes_gcm_encrypt(_Key, _Ivec, _AAD, _In) -> ?nif_stub.
+%% The default tag length is EVP_GCM_TLS_TAG_LEN(16),
+aes_gcm_encrypt(Key, Ivec, AAD, In) ->
+ aes_gcm_encrypt(Key, Ivec, AAD, In, 16).
+aes_gcm_encrypt(_Key, _Ivec, _AAD, _In, _TagLength) -> ?nif_stub.
aes_gcm_decrypt(_Key, _Ivec, _AAD, _In, _Tag) -> ?nif_stub.
%%