Mercurial > dropbear
diff libtomcrypt/src/pk/asn1/der/utf8/der_encode_utf8_string.c @ 1437:871b18fd7065 fuzz
merge from main (libtommath/libtomcrypt/curve25510-donna updates)
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sat, 24 Jun 2017 22:51:45 +0800 |
parents | f849a5ca2efc |
children | 6dba84798cd5 |
line wrap: on
line diff
--- a/libtomcrypt/src/pk/asn1/der/utf8/der_encode_utf8_string.c Sat Jun 24 10:34:58 2017 +0800 +++ b/libtomcrypt/src/pk/asn1/der/utf8/der_encode_utf8_string.c Sat Jun 24 22:51:45 2017 +0800 @@ -6,7 +6,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, [email protected], http://libtomcrypt.com + * Tom St Denis, [email protected], http://libtom.org */ #include "tomcrypt.h" @@ -65,19 +65,19 @@ x = 0; out[x++] = 0x0C; if (len < 128) { - out[x++] = len; + out[x++] = (unsigned char)len; } else if (len < 256) { out[x++] = 0x81; - out[x++] = len; + out[x++] = (unsigned char)len; } else if (len < 65536UL) { out[x++] = 0x82; - out[x++] = (len>>8)&255; - out[x++] = len&255; + out[x++] = (unsigned char)((len>>8)&255); + out[x++] = (unsigned char)(len&255); } else if (len < 16777216UL) { out[x++] = 0x83; - out[x++] = (len>>16)&255; - out[x++] = (len>>8)&255; - out[x++] = len&255; + out[x++] = (unsigned char)((len>>16)&255); + out[x++] = (unsigned char)((len>>8)&255); + out[x++] = (unsigned char)(len&255); } else { return CRYPT_INVALID_ARG; } @@ -85,7 +85,7 @@ /* store UTF8 */ for (y = 0; y < inlen; y++) { switch (der_utf8_charsize(in[y])) { - case 1: out[x++] = in[y]; break; + case 1: out[x++] = (unsigned char)in[y]; break; case 2: out[x++] = 0xC0 | ((in[y] >> 6) & 0x1F); out[x++] = 0x80 | (in[y] & 0x3F); break; case 3: out[x++] = 0xE0 | ((in[y] >> 12) & 0x0F); out[x++] = 0x80 | ((in[y] >> 6) & 0x3F); out[x++] = 0x80 | (in[y] & 0x3F); break; case 4: out[x++] = 0xF0 | ((in[y] >> 18) & 0x07); out[x++] = 0x80 | ((in[y] >> 12) & 0x3F); out[x++] = 0x80 | ((in[y] >> 6) & 0x3F); out[x++] = 0x80 | (in[y] & 0x3F); break; @@ -100,6 +100,6 @@ #endif -/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/utf8/der_encode_utf8_string.c,v $ */ -/* $Revision: 1.7 $ */ -/* $Date: 2006/12/16 17:41:21 $ */ +/* $Source$ */ +/* $Revision$ */ +/* $Date$ */