Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
d502861
WIP: generate and compute key using PSA API
bettio Jan 16, 2026
5e8270a
fixup! WIP: generate and compute key using PSA API
bettio Mar 9, 2026
8380762
fixup! WIP: generate and compute key using PSA API
bettio Mar 9, 2026
06277d7
WIP: Add support to crypto:mac
bettio Jan 22, 2026
bb66fc3
Sign and verify function
bettio Jan 25, 2026
a235547
fixup! Sign and verify function
bettio Mar 9, 2026
89094ff
WIP HASH
bettio Feb 21, 2026
67d426f
fixup! WIP HASH
bettio Mar 9, 2026
d79b2ba
fixup! WIP HASH
bettio Mar 9, 2026
2684aa7
fixup! WIP HASH
bettio Mar 9, 2026
56b6d3e
fixup! WIP HASH
bettio Mar 9, 2026
624e94a
fixup! WIP HASH
bettio Mar 9, 2026
d3513ac
WIP crypto funcs
bettio Feb 22, 2026
36029b2
fixup! WIP crypto funcs
bettio Mar 9, 2026
d45e57e
fixup! WIP crypto funcs
bettio Mar 9, 2026
a9c9180
fixup! WIP crypto funcs
bettio Mar 9, 2026
2331f26
WIP test_crypto_aead tests
bettio Mar 4, 2026
1eae519
fixup! WIP test_crypto_aead tests
bettio Mar 9, 2026
2ec7fcf
pbkdf2_hmac tests
bettio Mar 6, 2026
b55c7dd
add hash_equals
bettio Mar 6, 2026
0bddc3a
mac_update
bettio Mar 6, 2026
b9d398e
fixup! mac_update
bettio Mar 9, 2026
38ea463
fixup! mac_update
bettio Mar 9, 2026
7f5e751
fixup! WIP crypto funcs
bettio Mar 9, 2026
00282ff
fixup! WIP: Add support to crypto:mac
bettio Mar 9, 2026
5edc614
fixup! WIP test_crypto_aead tests
bettio Mar 9, 2026
337c776
fixup! pbkdf2_hmac tests
bettio Mar 9, 2026
23c5e31
fixup! WIP HASH
bettio Mar 9, 2026
4d70014
increase test partitions
bettio Mar 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
497 changes: 495 additions & 2 deletions libs/estdlib/src/crypto.erl

Large diffs are not rendered by default.

43 changes: 43 additions & 0 deletions src/libAtomVM/globalcontext.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "interop.h"
#include "list.h"
#include "mailbox.h"
#include "otp_crypto.h"
#include "posix_nifs.h"
#include "refc_binary.h"
#include "resources.h"
Expand Down Expand Up @@ -161,6 +162,48 @@ GlobalContext *globalcontext_new(void)
}
#endif

#ifdef MBEDTLS_PSA_CRYPTO_C
glb->psa_hash_op_resource_type = enif_init_resource_type(&env, "psa_hash_op", &psa_hash_op_resource_type_init, ERL_NIF_RT_CREATE, NULL);
if (IS_NULL_PTR(glb->psa_hash_op_resource_type)) {
#if HAVE_OPEN && HAVE_CLOSE
resource_type_destroy(glb->posix_fd_resource_type);
#endif
#ifndef AVM_NO_SMP
smp_rwlock_destroy(glb->modules_lock);
#endif
free(glb->modules_table);
atom_table_destroy(glb->atom_table);
free(glb);
return NULL;
}
glb->psa_cipher_op_resource_type = enif_init_resource_type(&env, "psa_cipher_op", &psa_cipher_op_resource_type_init, ERL_NIF_RT_CREATE, NULL);
if (IS_NULL_PTR(glb->psa_cipher_op_resource_type)) {
#if HAVE_OPEN && HAVE_CLOSE
resource_type_destroy(glb->posix_fd_resource_type);
#endif
#ifndef AVM_NO_SMP
smp_rwlock_destroy(glb->modules_lock);
#endif
free(glb->modules_table);
atom_table_destroy(glb->atom_table);
free(glb);
return NULL;
}
glb->psa_mac_op_resource_type = enif_init_resource_type(&env, "psa_mac_op", &psa_mac_op_resource_type_init, ERL_NIF_RT_CREATE, NULL);
if (IS_NULL_PTR(glb->psa_mac_op_resource_type)) {
#if HAVE_OPEN && HAVE_CLOSE
resource_type_destroy(glb->posix_fd_resource_type);
#endif
#ifndef AVM_NO_SMP
smp_rwlock_destroy(glb->modules_lock);
#endif
free(glb->modules_table);
atom_table_destroy(glb->atom_table);
free(glb);
return NULL;
}
#endif

sys_init_platform(glb);

#ifndef AVM_NO_SMP
Expand Down
15 changes: 15 additions & 0 deletions src/libAtomVM/globalcontext.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@
#include "timer_list.h"
#include "valueshashtable.h"

#ifdef ATOMVM_HAS_MBEDTLS
#include <mbedtls/version.h>
#if defined(MBEDTLS_VERSION_NUMBER) && (MBEDTLS_VERSION_NUMBER >= 0x03000000)
#include <mbedtls/build_info.h>
#else
#include <mbedtls/config.h>
#endif
#endif

#ifdef __cplusplus
extern "C" {
#endif
Expand Down Expand Up @@ -179,6 +188,12 @@ struct GlobalContext
ErlNifResourceType *posix_dir_resource_type;
#endif

#ifdef MBEDTLS_PSA_CRYPTO_C
ErlNifResourceType *psa_hash_op_resource_type;
ErlNifResourceType *psa_cipher_op_resource_type;
ErlNifResourceType *psa_mac_op_resource_type;
#endif

void *platform_data;
};

Expand Down
Loading
Loading