Loading crypto/asn1/a_strex.c +5 −2 Original line number Diff line number Diff line Loading @@ -194,6 +194,8 @@ static int do_buf(unsigned char *buf, int buflen, if(i < 0) return -1; /* Invalid UTF8String */ p += i; break; default: return -1; /* invalid width */ } if (p == q) orflags = CHARTYPE_LAST_ESC_2253; if(type & BUF_TYPE_CONVUTF8) { Loading Loading @@ -356,12 +358,13 @@ static int do_print_ex(char_io *io_ch, void *arg, unsigned long lflags, ASN1_STR } len = do_buf(str->data, str->length, type, flags, "es, io_ch, NULL); if(outlen < 0) return -1; if(len < 0) return -1; outlen += len; if(quotes) outlen += 2; if(!arg) return outlen; if(quotes && !io_ch(arg, "\"", 1)) return -1; do_buf(str->data, str->length, type, flags, NULL, io_ch, arg); if(do_buf(str->data, str->length, type, flags, NULL, io_ch, arg) < 0) return -1; if(quotes && !io_ch(arg, "\"", 1)) return -1; return outlen; } Loading crypto/asn1/t_pkey.c +22 −12 Original line number Diff line number Diff line Loading @@ -109,7 +109,7 @@ int RSA_print(BIO *bp, const RSA *x, int off) char str[128]; const char *s; unsigned char *m=NULL; int ret=0; int ret=0, mod_len = 0; size_t buf_len=0, i; if (x->n) Loading Loading @@ -143,27 +143,37 @@ int RSA_print(BIO *bp, const RSA *x, int off) goto err; } if (x->n != NULL) mod_len = BN_num_bits(x->n); if (x->d != NULL) { if(!BIO_indent(bp,off,128)) goto err; if (BIO_printf(bp,"Private-Key: (%d bit)\n",BN_num_bits(x->n)) if (BIO_printf(bp,"Private-Key: (%d bit)\n", mod_len) <= 0) goto err; } if (x->d == NULL) BIO_snprintf(str,sizeof str,"Modulus (%d bit):",BN_num_bits(x->n)); BIO_snprintf(str,sizeof str,"Modulus (%d bit):", mod_len); else BUF_strlcpy(str,"modulus:",sizeof str); if (!print(bp,str,x->n,m,off)) goto err; s=(x->d == NULL)?"Exponent:":"publicExponent:"; if (!print(bp,s,x->e,m,off)) goto err; if (!print(bp,"privateExponent:",x->d,m,off)) goto err; if (!print(bp,"prime1:",x->p,m,off)) goto err; if (!print(bp,"prime2:",x->q,m,off)) goto err; if (!print(bp,"exponent1:",x->dmp1,m,off)) goto err; if (!print(bp,"exponent2:",x->dmq1,m,off)) goto err; if (!print(bp,"coefficient:",x->iqmp,m,off)) goto err; if ((x->e != NULL) && !print(bp,s,x->e,m,off)) goto err; if ((x->d != NULL) && !print(bp,"privateExponent:",x->d,m,off)) goto err; if ((x->p != NULL) && !print(bp,"prime1:",x->p,m,off)) goto err; if ((x->q != NULL) && !print(bp,"prime2:",x->q,m,off)) goto err; if ((x->dmp1 != NULL) && !print(bp,"exponent1:",x->dmp1,m,off)) goto err; if ((x->dmq1 != NULL) && !print(bp,"exponent2:",x->dmq1,m,off)) goto err; if ((x->iqmp != NULL) && !print(bp,"coefficient:",x->iqmp,m,off)) goto err; ret=1; err: if (m != NULL) OPENSSL_free(m); Loading Loading @@ -760,8 +770,8 @@ int DSAparams_print(BIO *bp, const DSA *x) BN_num_bits(x->p)) <= 0) goto err; if (!print(bp,"p:",x->p,m,4)) goto err; if (!print(bp,"q:",x->q,m,4)) goto err; if (!print(bp,"g:",x->g,m,4)) goto err; if ((x->q != NULL) && !print(bp,"q:",x->q,m,4)) goto err; if ((x->g != NULL) && !print(bp,"g:",x->g,m,4)) goto err; ret=1; err: if (m != NULL) OPENSSL_free(m); Loading crypto/asn1/tasn_dec.c +2 −0 Original line number Diff line number Diff line Loading @@ -924,6 +924,8 @@ int asn1_ex_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, if (!*pval) { typ = ASN1_TYPE_new(); if (typ == NULL) goto err; *pval = (ASN1_VALUE *)typ; } else Loading crypto/bio/bss_file.c +3 −0 Original line number Diff line number Diff line Loading @@ -128,7 +128,10 @@ BIO *BIO_new_file(const char *filename, const char *mode) return(NULL); } if ((ret=BIO_new(BIO_s_file())) == NULL) { fclose(file); return(NULL); } BIO_clear_flags(ret,BIO_FLAGS_UPLINK); /* we did fopen -> we disengage UPLINK */ BIO_set_fp(ret,file,BIO_CLOSE); Loading crypto/bn/bn_gf2m.c +2 −1 Original line number Diff line number Diff line Loading @@ -1018,7 +1018,8 @@ int BN_GF2m_arr2poly(const unsigned int p[], BIGNUM *a) BN_zero(a); for (i = 0; p[i] != 0; i++) { BN_set_bit(a, p[i]); if (BN_set_bit(a, p[i]) == 0) return 0; } BN_set_bit(a, 0); bn_check_top(a); Loading Loading
crypto/asn1/a_strex.c +5 −2 Original line number Diff line number Diff line Loading @@ -194,6 +194,8 @@ static int do_buf(unsigned char *buf, int buflen, if(i < 0) return -1; /* Invalid UTF8String */ p += i; break; default: return -1; /* invalid width */ } if (p == q) orflags = CHARTYPE_LAST_ESC_2253; if(type & BUF_TYPE_CONVUTF8) { Loading Loading @@ -356,12 +358,13 @@ static int do_print_ex(char_io *io_ch, void *arg, unsigned long lflags, ASN1_STR } len = do_buf(str->data, str->length, type, flags, "es, io_ch, NULL); if(outlen < 0) return -1; if(len < 0) return -1; outlen += len; if(quotes) outlen += 2; if(!arg) return outlen; if(quotes && !io_ch(arg, "\"", 1)) return -1; do_buf(str->data, str->length, type, flags, NULL, io_ch, arg); if(do_buf(str->data, str->length, type, flags, NULL, io_ch, arg) < 0) return -1; if(quotes && !io_ch(arg, "\"", 1)) return -1; return outlen; } Loading
crypto/asn1/t_pkey.c +22 −12 Original line number Diff line number Diff line Loading @@ -109,7 +109,7 @@ int RSA_print(BIO *bp, const RSA *x, int off) char str[128]; const char *s; unsigned char *m=NULL; int ret=0; int ret=0, mod_len = 0; size_t buf_len=0, i; if (x->n) Loading Loading @@ -143,27 +143,37 @@ int RSA_print(BIO *bp, const RSA *x, int off) goto err; } if (x->n != NULL) mod_len = BN_num_bits(x->n); if (x->d != NULL) { if(!BIO_indent(bp,off,128)) goto err; if (BIO_printf(bp,"Private-Key: (%d bit)\n",BN_num_bits(x->n)) if (BIO_printf(bp,"Private-Key: (%d bit)\n", mod_len) <= 0) goto err; } if (x->d == NULL) BIO_snprintf(str,sizeof str,"Modulus (%d bit):",BN_num_bits(x->n)); BIO_snprintf(str,sizeof str,"Modulus (%d bit):", mod_len); else BUF_strlcpy(str,"modulus:",sizeof str); if (!print(bp,str,x->n,m,off)) goto err; s=(x->d == NULL)?"Exponent:":"publicExponent:"; if (!print(bp,s,x->e,m,off)) goto err; if (!print(bp,"privateExponent:",x->d,m,off)) goto err; if (!print(bp,"prime1:",x->p,m,off)) goto err; if (!print(bp,"prime2:",x->q,m,off)) goto err; if (!print(bp,"exponent1:",x->dmp1,m,off)) goto err; if (!print(bp,"exponent2:",x->dmq1,m,off)) goto err; if (!print(bp,"coefficient:",x->iqmp,m,off)) goto err; if ((x->e != NULL) && !print(bp,s,x->e,m,off)) goto err; if ((x->d != NULL) && !print(bp,"privateExponent:",x->d,m,off)) goto err; if ((x->p != NULL) && !print(bp,"prime1:",x->p,m,off)) goto err; if ((x->q != NULL) && !print(bp,"prime2:",x->q,m,off)) goto err; if ((x->dmp1 != NULL) && !print(bp,"exponent1:",x->dmp1,m,off)) goto err; if ((x->dmq1 != NULL) && !print(bp,"exponent2:",x->dmq1,m,off)) goto err; if ((x->iqmp != NULL) && !print(bp,"coefficient:",x->iqmp,m,off)) goto err; ret=1; err: if (m != NULL) OPENSSL_free(m); Loading Loading @@ -760,8 +770,8 @@ int DSAparams_print(BIO *bp, const DSA *x) BN_num_bits(x->p)) <= 0) goto err; if (!print(bp,"p:",x->p,m,4)) goto err; if (!print(bp,"q:",x->q,m,4)) goto err; if (!print(bp,"g:",x->g,m,4)) goto err; if ((x->q != NULL) && !print(bp,"q:",x->q,m,4)) goto err; if ((x->g != NULL) && !print(bp,"g:",x->g,m,4)) goto err; ret=1; err: if (m != NULL) OPENSSL_free(m); Loading
crypto/asn1/tasn_dec.c +2 −0 Original line number Diff line number Diff line Loading @@ -924,6 +924,8 @@ int asn1_ex_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, if (!*pval) { typ = ASN1_TYPE_new(); if (typ == NULL) goto err; *pval = (ASN1_VALUE *)typ; } else Loading
crypto/bio/bss_file.c +3 −0 Original line number Diff line number Diff line Loading @@ -128,7 +128,10 @@ BIO *BIO_new_file(const char *filename, const char *mode) return(NULL); } if ((ret=BIO_new(BIO_s_file())) == NULL) { fclose(file); return(NULL); } BIO_clear_flags(ret,BIO_FLAGS_UPLINK); /* we did fopen -> we disengage UPLINK */ BIO_set_fp(ret,file,BIO_CLOSE); Loading
crypto/bn/bn_gf2m.c +2 −1 Original line number Diff line number Diff line Loading @@ -1018,7 +1018,8 @@ int BN_GF2m_arr2poly(const unsigned int p[], BIGNUM *a) BN_zero(a); for (i = 0; p[i] != 0; i++) { BN_set_bit(a, p[i]); if (BN_set_bit(a, p[i]) == 0) return 0; } BN_set_bit(a, 0); bn_check_top(a); Loading