make rrc a modulus operation if its longer then the length of the message

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@13208 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2003-12-12 12:32:50 +00:00
parent 0b1873a53b
commit 98136e9e42
2 changed files with 16 additions and 18 deletions

View File

@@ -143,22 +143,21 @@ OM_uint32 _gssapi_wrap_size_cfx(OM_uint32 *minor_status,
/* /*
* Rotate "rrc" bytes to the front or back * Rotate "rrc" bytes to the front or back
*/ */
static krb5_error_code rrc_rotate(void *data,
size_t len, static krb5_error_code
u_int16_t rrc, rrc_rotate(void *data, size_t len, u_int16_t rrc, krb5_boolean unrotate)
krb5_boolean unrotate)
{ {
u_char *tmp; u_char *tmp;
size_t left; size_t left;
char buf[256]; char buf[256];
if (rrc == 0) { if (len == 0)
return 0; return 0;
}
if (len < rrc) { rrc %= len;
return ERANGE;
} if (rrc == 0)
return 0;
left = len - rrc; left = len - rrc;

View File

@@ -143,22 +143,21 @@ OM_uint32 _gssapi_wrap_size_cfx(OM_uint32 *minor_status,
/* /*
* Rotate "rrc" bytes to the front or back * Rotate "rrc" bytes to the front or back
*/ */
static krb5_error_code rrc_rotate(void *data,
size_t len, static krb5_error_code
u_int16_t rrc, rrc_rotate(void *data, size_t len, u_int16_t rrc, krb5_boolean unrotate)
krb5_boolean unrotate)
{ {
u_char *tmp; u_char *tmp;
size_t left; size_t left;
char buf[256]; char buf[256];
if (rrc == 0) { if (len == 0)
return 0; return 0;
}
if (len < rrc) { rrc %= len;
return ERANGE;
} if (rrc == 0)
return 0;
left = len - rrc; left = len - rrc;