Print this page
4853 illumos-gate is not lint-clean when built with openssl 1.0


 348         if(!*p) return NULL;
 349         q = p + strlen(p) - 1;
 350         while((q != p) && isspace((unsigned char)*q)) q--;
 351         if(p != q) q[1] = 0;
 352         if(!*p) return NULL;
 353         return p;
 354 }
 355 
 356 /* hex string utilities */
 357 
 358 /* Given a buffer of length 'len' return a OPENSSL_malloc'ed string with its
 359  * hex representation
 360  * @@@ (Contents of buffer are always kept in ASCII, also on EBCDIC machines)
 361  */
 362 
 363 char *hex_to_string(const unsigned char *buffer, long len)
 364 {
 365         char *tmp, *q;
 366         const unsigned char *p;
 367         int i;
 368         const static char hexdig[] = "0123456789ABCDEF";
 369         if(!buffer || !len) return NULL;
 370         if(!(tmp = OPENSSL_malloc(len * 3 + 1))) {
 371                 X509V3err(X509V3_F_HEX_TO_STRING,ERR_R_MALLOC_FAILURE);
 372                 return NULL;
 373         }
 374         q = tmp;
 375         for(i = 0, p = buffer; i < len; i++,p++) {
 376                 *q++ = hexdig[(*p >> 4) & 0xf];
 377                 *q++ = hexdig[*p & 0xf];
 378                 *q++ = ':';
 379         }
 380         q[-1] = 0;
 381 #ifdef CHARSET_EBCDIC
 382         ebcdic2ascii(tmp, tmp, q - tmp - 1);
 383 #endif
 384 
 385         return tmp;
 386 }
 387 
 388 /* Give a string of hex digits convert to




 348         if(!*p) return NULL;
 349         q = p + strlen(p) - 1;
 350         while((q != p) && isspace((unsigned char)*q)) q--;
 351         if(p != q) q[1] = 0;
 352         if(!*p) return NULL;
 353         return p;
 354 }
 355 
 356 /* hex string utilities */
 357 
 358 /* Given a buffer of length 'len' return a OPENSSL_malloc'ed string with its
 359  * hex representation
 360  * @@@ (Contents of buffer are always kept in ASCII, also on EBCDIC machines)
 361  */
 362 
 363 char *hex_to_string(const unsigned char *buffer, long len)
 364 {
 365         char *tmp, *q;
 366         const unsigned char *p;
 367         int i;
 368         static const char hexdig[] = "0123456789ABCDEF";
 369         if(!buffer || !len) return NULL;
 370         if(!(tmp = OPENSSL_malloc(len * 3 + 1))) {
 371                 X509V3err(X509V3_F_HEX_TO_STRING,ERR_R_MALLOC_FAILURE);
 372                 return NULL;
 373         }
 374         q = tmp;
 375         for(i = 0, p = buffer; i < len; i++,p++) {
 376                 *q++ = hexdig[(*p >> 4) & 0xf];
 377                 *q++ = hexdig[*p & 0xf];
 378                 *q++ = ':';
 379         }
 380         q[-1] = 0;
 381 #ifdef CHARSET_EBCDIC
 382         ebcdic2ascii(tmp, tmp, q - tmp - 1);
 383 #endif
 384 
 385         return tmp;
 386 }
 387 
 388 /* Give a string of hex digits convert to