fix BN_to_integer to get rid of __UNCONST. Trick question:

How many BN_to_integer implementations does Heimdal contain (I only fixed 2).
This commit is contained in:
christos 2018-02-09 23:22:12 +00:00
parent f5725ffc1d
commit e155b97cb7
2 changed files with 9 additions and 9 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: pkinit.c,v 1.3 2018/02/05 16:00:52 christos Exp $ */ /* $NetBSD: pkinit.c,v 1.4 2018/02/09 23:22:12 christos Exp $ */
/* /*
* Copyright (c) 2003 - 2016 Kungliga Tekniska Högskolan * Copyright (c) 2003 - 2016 Kungliga Tekniska Högskolan
@ -813,7 +813,7 @@ out:
*/ */
static krb5_error_code static krb5_error_code
BN_to_integer(krb5_context context, BIGNUM *bn, heim_integer *integer) BN_to_integer(krb5_context context, const BIGNUM *bn, heim_integer *integer)
{ {
integer->length = BN_num_bytes(bn); integer->length = BN_num_bytes(bn);
integer->data = malloc(integer->length); integer->data = malloc(integer->length);
@ -1038,7 +1038,7 @@ pk_mk_pa_reply_dh(krb5_context context,
#else #else
DH_get0_key(kdc_dh, &pub_key, NULL); DH_get0_key(kdc_dh, &pub_key, NULL);
#endif #endif
ret = BN_to_integer(context, __UNCONST(pub_key), &i); ret = BN_to_integer(context, pub_key, &i);
if (ret) if (ret)
return ret; return ret;

View File

@ -1,4 +1,4 @@
/* $NetBSD: pkinit.c,v 1.3 2018/02/05 16:00:53 christos Exp $ */ /* $NetBSD: pkinit.c,v 1.4 2018/02/09 23:22:13 christos Exp $ */
/* /*
* Copyright (c) 2003 - 2016 Kungliga Tekniska Högskolan * Copyright (c) 2003 - 2016 Kungliga Tekniska Högskolan
@ -82,7 +82,7 @@ _krb5_pk_cert_free(struct krb5_pk_cert *cert)
} }
static krb5_error_code static krb5_error_code
BN_to_integer(krb5_context context, BIGNUM *bn, heim_integer *integer) BN_to_integer(krb5_context context, const BIGNUM *bn, heim_integer *integer)
{ {
integer->length = BN_num_bytes(bn); integer->length = BN_num_bytes(bn);
integer->data = malloc(integer->length); integer->data = malloc(integer->length);
@ -481,12 +481,12 @@ build_auth_pack(krb5_context context,
DH_get0_pqg(dh, &p, &q, &g); DH_get0_pqg(dh, &p, &q, &g);
#endif #endif
ret = BN_to_integer(context, __UNCONST(p), &dp.p); ret = BN_to_integer(context, p, &dp.p);
if (ret) { if (ret) {
free_DomainParameters(&dp); free_DomainParameters(&dp);
return ret; return ret;
} }
ret = BN_to_integer(context, __UNCONST(g), &dp.g); ret = BN_to_integer(context, g, &dp.g);
if (ret) { if (ret) {
free_DomainParameters(&dp); free_DomainParameters(&dp);
return ret; return ret;
@ -496,7 +496,7 @@ build_auth_pack(krb5_context context,
free_DomainParameters(&dp); free_DomainParameters(&dp);
return ENOMEM; return ENOMEM;
} }
ret = BN_to_integer(context, __UNCONST(q), dp.q); ret = BN_to_integer(context, q, dp.q);
if (ret) { if (ret) {
free_DomainParameters(&dp); free_DomainParameters(&dp);
return ret; return ret;
@ -527,7 +527,7 @@ build_auth_pack(krb5_context context,
#else #else
DH_get0_key(dh, &pub_key, NULL); DH_get0_key(dh, &pub_key, NULL);
#endif #endif
ret = BN_to_integer(context, __UNCONST(pub_key), &dh_pub_key); ret = BN_to_integer(context, pub_key, &dh_pub_key);
if (ret) if (ret)
return ret; return ret;