aboutsummaryrefslogtreecommitdiffstats
path: root/xcomp
diff options
context:
space:
mode:
authorPetr Gotthard <[email protected]>2016-07-30 10:51:47 -0700
committerPetr Gotthard <[email protected]>2016-07-30 10:51:47 -0700
commit1cdaf0a6fd8dbbf08fe88dd148424df4da683f48 (patch)
treed4adc04cde9958587a25311c8259315e8ff326d2 /xcomp
parent9c97ca598a1858d7b43799dee03a5c129b81220a (diff)
downloadotp-1cdaf0a6fd8dbbf08fe88dd148424df4da683f48.tar.gz
otp-1cdaf0a6fd8dbbf08fe88dd148424df4da683f48.tar.bz2
otp-1cdaf0a6fd8dbbf08fe88dd148424df4da683f48.zip
crypto:cmac calculating the Cipher-based Message Authentication Code
The ERL-82 issue requests a way to calculate a CMAC in Erlang. The AES128 CMAC is standartized in RFC 4493 and used e.g. for message authentication in the LoRaWAN networks. The CMAC is implemented by OpenSSL since v1.0.1, but as @IngelaAndin stated in response to the ERL-82, the current crypto implementation does not include functions that call those OpenSSL cryptolib functions. This commit introduces a new function `crypto:cmac` that calls the corresponding OpenSSL functions and calculates the CMAC. Only the cmac_nif is implemented. The incremental functions (init, update, final) are not provided because the current OpenSSL does not allow custom memory allocators like `enif_alloc_resource`. The Erlang user guide states that at least OpenSSL 0.9.8 is required, so I added few #ifdefs so the code is compatible with all versions. However, the OpenSSL pages say that the pre-1.0.1 versions (0.9.8 and 1.0.0) are no longer maintained. Even the 1.0.1 will be retired by Dec 2016. Hence I believe that adding a 1.0.1-only function like CMAC should be OK.
Diffstat (limited to 'xcomp')
0 files changed, 0 insertions, 0 deletions