File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -1152,11 +1152,12 @@ namespace jwt {
11521152 std::string res (static_cast <size_t >(EVP_MAX_MD_SIZE), ' \0 ' );
11531153 auto len = static_cast <unsigned int >(res.size ());
11541154
1155- const int secret_size = BN_num_bytes (secret.get ());
1156- std::vector<unsigned char > buffer (size, ' \0 ' );
1157- BN_bn2bin (secret.get (), buffer.data ());
1155+ const BIGNUM* secret_bn = secret.get ();
1156+ std::vector<unsigned char > buffer (BN_num_bytes (secret_bn), ' \0 ' );
1157+ const auto buffer_size = BN_bn2bin (secret_bn, buffer.data ());
1158+ buffer.resize (buffer_size);
11581159
1159- if (HMAC (md (), secret .data (), secret_size ,
1160+ if (HMAC (md (), buffer .data (), buffer_size ,
11601161 reinterpret_cast <const unsigned char *>(data.data ()), static_cast <int >(data.size ()),
11611162 (unsigned char *)res.data (), // NOLINT(google-readability-casting) requires `const_cast`
11621163 &len) == nullptr ) {
You can’t perform that action at this time.
0 commit comments