mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-17 19:30:36 +00:00
Add JWT Bearer Authentication support and tutorial
This commit is contained in:
1 parent
af7eaaa9b1
commit
cdd957572e
21 files changed
+888
-81
No files matched your search
+2
-5
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "arch.h"
|
||||
#include "tls.h"
|
||||
#include "util.h"
|
||||
#if MG_TLS == MG_TLS_BUILTIN
|
||||
/******************************************************************************/
|
||||
#define AES_DECRYPTION 1 // whether AES decryption is supported
|
||||
@@ -1115,8 +1116,6 @@ int mg_aes_gcm_decrypt(unsigned char *output, const unsigned char *input,
|
||||
int ret = 0; // our return value
|
||||
gcm_context ctx; // includes the AES context structure
|
||||
unsigned char computed_tag[16];
|
||||
size_t i;
|
||||
int diff = 0;
|
||||
|
||||
if (tag_len > sizeof(computed_tag)) return -1;
|
||||
|
||||
@@ -1127,9 +1126,7 @@ int mg_aes_gcm_decrypt(unsigned char *output, const unsigned char *input,
|
||||
|
||||
gcm_zero_ctx(&ctx);
|
||||
|
||||
// compare tags
|
||||
for (i = 0; i < tag_len; i++) diff |= computed_tag[i] ^ tag[i];
|
||||
if (diff != 0) ret = -1;
|
||||
if (!mg_memeq(computed_tag, tag, tag_len)) ret = -1;
|
||||
|
||||
return (ret);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user