2021-07-29 18:58:23 +01:00
|
|
|
/********************************************************************
|
|
|
|
* Berry module `webserver`
|
|
|
|
*
|
|
|
|
* To use: `import webserver`
|
|
|
|
*
|
|
|
|
* Allows to respond to HTTP request
|
|
|
|
*******************************************************************/
|
|
|
|
#include "be_constobj.h"
|
|
|
|
|
|
|
|
#ifdef USE_ALEXA_AVS
|
|
|
|
|
|
|
|
extern int m_aes_gcm_init(bvm *vm);
|
|
|
|
extern int m_aes_gcm_encryt(bvm *vm);
|
|
|
|
extern int m_aes_gcm_decryt(bvm *vm);
|
|
|
|
extern int m_aes_gcm_tag(bvm *vm);
|
|
|
|
|
2021-08-30 20:01:06 +01:00
|
|
|
extern int m_ec_c25519_pubkey(bvm *vm);
|
|
|
|
extern int m_ec_c25519_sharedkey(bvm *vm);
|
|
|
|
|
2021-07-29 18:58:23 +01:00
|
|
|
#include "../generate/be_fixed_be_class_aes_gcm.h"
|
2021-08-30 20:01:06 +01:00
|
|
|
#include "../generate/be_fixed_be_class_ec_c25519.h"
|
2021-07-29 18:58:23 +01:00
|
|
|
|
2021-08-30 20:01:06 +01:00
|
|
|
void be_load_crypto_lib(bvm *vm) {
|
2021-07-29 18:58:23 +01:00
|
|
|
// insert the class GCM in module AES
|
|
|
|
be_newmodule(vm);
|
2021-08-30 20:01:06 +01:00
|
|
|
be_setname(vm, -1, "crypto");
|
|
|
|
be_setglobal(vm, "crypto");
|
2021-07-29 18:58:23 +01:00
|
|
|
|
|
|
|
be_pushntvclass(vm, &be_class_aes_gcm);
|
2021-08-30 20:01:06 +01:00
|
|
|
be_setmember(vm, -2, "AES_GCM");
|
|
|
|
be_pop(vm, 1);
|
|
|
|
|
|
|
|
be_pushntvclass(vm, &be_class_ec_c25519);
|
|
|
|
be_setmember(vm, -2, "EC_C25519");
|
2021-07-29 18:58:23 +01:00
|
|
|
be_pop(vm, 2);
|
|
|
|
}
|
|
|
|
/* @const_object_info_begin
|
|
|
|
|
2021-08-30 20:01:06 +01:00
|
|
|
class be_class_aes_gcm (scope: global, name: AES_GCM) {
|
2021-07-29 18:58:23 +01:00
|
|
|
.p1, var
|
|
|
|
.p2, var
|
|
|
|
|
|
|
|
init, func(m_aes_gcm_init)
|
|
|
|
encrypt, func(m_aes_gcm_encryt)
|
|
|
|
decrypt, func(m_aes_gcm_decryt)
|
|
|
|
tag, func(m_aes_gcm_tag)
|
|
|
|
}
|
2021-08-30 20:01:06 +01:00
|
|
|
|
|
|
|
class be_class_ec_c25519 (scope: global, name: EC_C25519) {
|
|
|
|
public_key, func(m_ec_c25519_pubkey)
|
|
|
|
shared_key, func(m_ec_c25519_sharedkey)
|
|
|
|
}
|
|
|
|
|
2021-07-29 18:58:23 +01:00
|
|
|
@const_object_info_end */
|
|
|
|
|
|
|
|
#endif // USE_ALEXA_AVS
|