@@ -32,6 +32,9 @@ extern int m_aes_ctr_tag(bvm *vm);
32
32
extern int m_aes_cbc_encrypt1 (bvm * vm );
33
33
extern int m_aes_cbc_decrypt1 (bvm * vm );
34
34
35
+ extern int m_chacha20_run (bvm * vm );
36
+ extern int m_poly1305_run (bvm * vm );
37
+
35
38
extern int m_ec_p256_pubkey (bvm * vm );
36
39
extern int m_ec_p256_sharedkey (bvm * vm );
37
40
extern int m_ec_p256_ecdsa_sign_sha256 (bvm * vm );
@@ -46,6 +49,10 @@ extern int m_ec_p256_mul(bvm *vm);
46
49
extern int m_ec_c25519_pubkey (bvm * vm );
47
50
extern int m_ec_c25519_sharedkey (bvm * vm );
48
51
52
+ extern int m_ed25519_sign (bvm * vm );
53
+ extern int m_ed25519_verify (bvm * vm );
54
+ extern int m_ed25519_secret_key (bvm * vm );
55
+
49
56
extern int m_hash_sha256_init (bvm * vm );
50
57
extern int m_hash_sha256_update (bvm * vm );
51
58
extern int m_hash_sha256_out (bvm * vm );
@@ -68,8 +75,10 @@ extern const bclass be_class_md5;
68
75
#include "be_fixed_be_class_aes_gcm.h"
69
76
#include "be_fixed_be_class_aes_ctr.h"
70
77
#include "be_fixed_be_class_aes_cbc.h"
78
+ #include "be_fixed_be_class_chacha_poly.h"
71
79
#include "be_fixed_be_class_ec_p256.h"
72
80
#include "be_fixed_be_class_ec_c25519.h"
81
+ #include "be_fixed_be_class_ed25519.h"
73
82
#include "be_fixed_be_class_sha256.h"
74
83
#include "be_fixed_be_class_hmac_sha256.h"
75
84
#include "be_fixed_be_class_pbkdf2_hmac_sha256.h"
@@ -95,6 +104,10 @@ const be_const_member_t be_crypto_members[] = {
95
104
{ "/AES_GCM" , (intptr_t ) & be_class_aes_gcm },
96
105
#endif // USE_BERRY_CRYPTO_AES_GCM
97
106
107
+ #ifdef USE_BERRY_CRYPTO_CHACHA_POLY
108
+ { "/CHACHA20_POLY1305" , (intptr_t ) & be_class_chacha_poly },
109
+ #endif // USE_BERRY_CRYPTO_CHACHA_POLY
110
+
98
111
#ifdef USE_BERRY_CRYPTO_EC_C25519
99
112
{ "/EC_C25519" , (intptr_t ) & be_class_ec_c25519 },
100
113
#endif // USE_BERRY_CRYPTO_EC_C25519
@@ -103,6 +116,10 @@ const be_const_member_t be_crypto_members[] = {
103
116
{ "/EC_P256" , (intptr_t ) & be_class_ec_p256 },
104
117
#endif // USE_BERRY_CRYPTO_EC_P256
105
118
119
+ #ifdef USE_BERRY_CRYPTO_ED25519
120
+ { "/ED25519" , (intptr_t ) & be_class_ed25519 },
121
+ #endif // USE_BERRY_CRYPTO_ED25519
122
+
106
123
#ifdef USE_BERRY_CRYPTO_HKDF_SHA256
107
124
{ "/HKDF_SHA256" , (intptr_t ) & be_class_hkdf_sha256 },
108
125
#endif // USE_BERRY_CRYPTO_HKDF_SHA256
@@ -175,6 +192,11 @@ class be_class_aes_cbc (scope: global, name: AES_CBC) {
175
192
encrypt1, static_func(m_aes_cbc_encrypt1)
176
193
}
177
194
195
+ class be_class_chacha_poly (scope: global, name: CHACHA20_POLY1305) {
196
+ chacha_run, static_func(m_chacha20_run)
197
+ poly_run, static_func(m_poly1305_run)
198
+ }
199
+
178
200
class be_class_ec_p256 (scope: global, name: EC_P256) {
179
201
public_key, static_func(m_ec_p256_pubkey)
180
202
shared_key, static_func(m_ec_p256_sharedkey)
@@ -193,6 +215,12 @@ class be_class_ec_c25519 (scope: global, name: EC_C25519) {
193
215
shared_key, func(m_ec_c25519_sharedkey)
194
216
}
195
217
218
+ class be_class_ed25519 (scope: global, name: ED25519) {
219
+ sign, func(m_ed25519_sign)
220
+ verify, func(m_ed25519_verify)
221
+ secret_key, func(m_ed25519_secret_key)
222
+ }
223
+
196
224
class be_class_sha256 (scope: global, name: SHA256) {
197
225
.p, var
198
226
0 commit comments