@@ -1144,15 +1144,11 @@ namespace jwt {
11441144 */
11451145 hmacsha (std::string key, const EVP_MD* (*md)(), std::string name)
11461146 : secret(helper::raw2bn(key).release()), md(md), alg_name(std::move(name)) {}
1147- hmacsha (const hmacsha& other)
1148- : secret(BN_dup(other.secret)), md(other.md), alg_name(other.alg_name) {}
1149- hmacsha (hmacsha&& other)
1150- : secret(nullptr ), md(std::move(other.md)), alg_name(std::move(other.alg_name)) {
1151- if (BN_copy (other.secret , secret) == nullptr ) throw std::runtime_error (" failed to copy BN" );
1152- }
1153- ~hmacsha (){
1154- BN_free (secret);
1147+ hmacsha (const hmacsha& other) : secret(BN_dup(other.secret)), md(other.md), alg_name(other.alg_name) {}
1148+ hmacsha (hmacsha&& other) : secret(nullptr ), md(std::move(other.md)), alg_name(std::move(other.alg_name)) {
1149+ if (BN_copy (other.secret , secret) == nullptr ) throw std::runtime_error (" failed to copy BN" );
11551150 }
1151+ ~hmacsha (){ BN_free (secret); }
11561152 hmacsha& operator =(const hmacsha& other) = delete ;
11571153 hmacsha& operator =(hmacsha&& other) = delete ;
11581154
@@ -1172,8 +1168,8 @@ namespace jwt {
11721168 const auto buffer_size = BN_bn2bin (secret, buffer.data ());
11731169 buffer.resize (buffer_size);
11741170
1175- if (HMAC (md (), buffer.data (), buffer_size,
1176- reinterpret_cast < const unsigned char *>(data. data ()), static_cast <int >(data.size ()),
1171+ if (HMAC (md (), buffer.data (), buffer_size, reinterpret_cast < const unsigned char *>(data. data ()),
1172+ static_cast <int >(data.size ()),
11771173 (unsigned char *)res.data (), // NOLINT(google-readability-casting) requires `const_cast`
11781174 &len) == nullptr ) {
11791175 ec = error::signature_generation_error::hmac_failed;
0 commit comments