~ubuntu-branches/ubuntu/trusty/openipmi/trusty-updates

« back to all changes in this revision

Viewing changes to lib/hmac.c

  • Committer: Bazaar Package Importer
  • Author(s): Noèl Köthe
  • Date: 2009-07-28 10:17:23 UTC
  • mto: (2.1.4 squeeze) (1.1.6 upstream)
  • mto: This revision was merged to the branch mainline in revision 16.
  • Revision ID: james.westby@ubuntu.com-20090728101723-t19vhrbss6yz5v8u
Import upstream version 2.0.16

Show diffs side-by-side

added added

removed removed

Lines of Context:
54
54
               ipmi_rmcpp_auth_t *ainfo,
55
55
               void             **integ_data)
56
56
{
57
 
    hmac_info_t          *info;
58
 
    static unsigned char *k;
59
 
    unsigned int         klen;
 
57
    hmac_info_t         *info;
 
58
    const unsigned char *k;
 
59
    unsigned int        klen;
60
60
 
61
61
    info = ipmi_mem_alloc(sizeof(*info));
62
62
    if (!info)
94
94
    if (!info)
95
95
        return ENOMEM;
96
96
 
97
 
    k = ipmi_rmcpp_auth_get_password(ainfo, &klen);
 
97
    if (ipmi_rmcpp_auth_get_sik_len(ainfo) < 16)
 
98
        return EINVAL;
 
99
 
 
100
    k = ipmi_rmcpp_auth_get_sik(ainfo, &klen);
98
101
    if (klen < 16)
99
102
        return EINVAL;
100
103
 
226
229
};
227
230
#endif /* HAVE_OPENSSL */
228
231
 
 
232
void
 
233
_ipmi_hmac_shutdown(void)
 
234
{
 
235
#ifdef HAVE_OPENSSL
 
236
    ipmi_rmcpp_register_integrity
 
237
        (IPMI_LANP_INTEGRITY_ALGORITHM_HMAC_SHA1_96, NULL);
 
238
    ipmi_rmcpp_register_integrity
 
239
        (IPMI_LANP_INTEGRITY_ALGORITHM_HMAC_MD5_128, NULL);
 
240
#endif
 
241
}
 
242
 
229
243
int
230
244
_ipmi_hmac_init(void)
231
245
{
239
253
 
240
254
    rv = ipmi_rmcpp_register_integrity
241
255
        (IPMI_LANP_INTEGRITY_ALGORITHM_HMAC_MD5_128, &hmac_md5_integ);
242
 
    if (rv)
 
256
    if (rv) {
 
257
        _ipmi_hmac_shutdown();
243
258
        return rv;
 
259
    }
244
260
#endif
245
261
 
246
262
    return 0;