crypto/rsa_extra/rsa_asn1.c
static int detect_stripped_jca_private_key(RSA *key) {
  if (!BN_is_zero(key->d) && !BN_is_zero(key->n) &&
       BN_is_zero(key->e) && BN_is_zero(key->iqmp) &&
       BN_is_zero(key->p) && BN_is_zero(key->q) &&
       BN_is_zero(key->dmp1) && BN_is_zero(key->dmq1)) {
    BN_free(key->e);
    BN_free(key->p);
    BN_free(key->q);
    BN_free(key->dmp1);
    BN_free(key->dmq1);
    BN_free(key->iqmp);
    key->e = NULL;
    key->p = NULL;
    key->q = NULL;
    key->dmp1 = NULL;
    key->dmq1 = NULL;
    key->iqmp = NULL;
    return 1;
  }
  return 0;
}
// Distinguisher for stripped JCA RSA private keys, sets zeroed values to NULL
// because ASN.1 treats absent values as 0, but post-parsing validation logic
// expects absent values to be NULL. Returns 1 if JCA stripped private key, 0
// otherwise.
Distinguisher for stripped JCA RSA private keys, sets zeroed values to NULL
because ASN.1 treats absent values as 0, but post-parsing validation logic
expects absent values to be NULL. Returns 1 if JCA stripped private key, 0
otherwise.
Distinguisher for stripped JCA RSA private keys sets zeroed values to NULL because ASN . 1 treats absent values as 0 but post - parsing validation logic expects absent values to be NULL . Returns 1 if JCA stripped private key 0 otherwise .
static int detect_stripped_jca_private_key(RSA *key) {
  if (!BN_is_zero(key->d) && !BN_is_zero(key->n) &&
       BN_is_zero(key->e) && BN_is_zero(key->iqmp) &&
       BN_is_zero(key->p) && BN_is_zero(key->q) &&
       BN_is_zero(key->dmp1) && BN_is_zero(key->dmq1)) {
    BN_free(key->e);
    BN_free(key->p);
    BN_free(key->q);
    BN_free(key->dmp1);
    BN_free(key->dmq1);
    BN_free(key->iqmp);
    key->e = NULL;
    key->p = NULL;
    key->q = NULL;
    key->dmp1 = NULL;
    key->dmq1 = NULL;
    key->iqmp = NULL;
    return 1;
  }
  return 0;
}
static int detect_stripped_jca_private_key ( RSA * key ) { if ( ! BN_is_zero ( key -> d ) && ! BN_is_zero ( key -> n ) && BN_is_zero ( key -> e ) && BN_is_zero ( key -> iqmp ) && BN_is_zero ( key -> p ) && BN_is_zero ( key -> q ) && BN_is_zero ( key -> dmp1 ) && BN_is_zero ( key -> dmq1 ) ) { BN_free ( key -> e ) ; BN_free ( key -> p ) ; BN_free ( key -> q ) ; BN_free ( key -> dmp1 ) ; BN_free ( key -> dmq1 ) ; BN_free ( key -> iqmp ) ; key -> e = NULL ; key -> p = NULL ; key -> q = NULL ; key -> dmp1 = NULL ; key -> dmq1 = NULL ; key -> iqmp = NULL ; return 1 ; } return 0 ; }
Distinguisher for stripped JCA RSA private keys, sets zeroed values to NULL
because ASN.1 treats absent values as 0, but post-parsing validation logic
expects absent values to be NULL.
Distinguisher for stripped JCA RSA private keys sets zeroed values to NULL because ASN . 1 treats absent values as 0 but post - parsing validation logic expects absent values to be NULL .