Пример #1
0
static SECAlgorithmID *
crmf_get_encvalue_algid(SECAlgorithmID *srcAlg)
{
    SECStatus rv;
    SECAlgorithmID *newAlgID;

    if (srcAlg == NULL) {
        return NULL;
    }
    rv = crmf_copy_encryptedvalue_secalg(NULL, srcAlg, &newAlgID);
    if (rv != SECSuccess) {
        return NULL;
    }
    return newAlgID;
}
Пример #2
0
SECStatus
crmf_copy_encryptedvalue(PLArenaPool *poolp,
                         CRMFEncryptedValue *srcValue,
                         CRMFEncryptedValue *destValue)
{
    SECStatus rv;

    if (srcValue->intendedAlg != NULL) {
        rv = crmf_copy_encryptedvalue_secalg(poolp,
                                             srcValue->intendedAlg,
                                             &destValue->intendedAlg);
        if (rv != SECSuccess) {
            goto loser;
        }
    }
    if (srcValue->symmAlg != NULL) {
        rv = crmf_copy_encryptedvalue_secalg(poolp,
                                             srcValue->symmAlg,
                                             &destValue->symmAlg);
        if (rv != SECSuccess) {
            goto loser;
        }
    }
    if (srcValue->encSymmKey.data != NULL) {
        rv = crmf_make_bitstring_copy(poolp,
                                      &destValue->encSymmKey,
                                      &srcValue->encSymmKey);
        if (rv != SECSuccess) {
            goto loser;
        }
    }
    if (srcValue->keyAlg != NULL) {
        rv = crmf_copy_encryptedvalue_secalg(poolp,
                                             srcValue->keyAlg,
                                             &destValue->keyAlg);
        if (rv != SECSuccess) {
            goto loser;
        }
    }
    if (srcValue->valueHint.data != NULL) {
        rv = SECITEM_CopyItem(poolp,
                              &destValue->valueHint,
                              &srcValue->valueHint);
        if (rv != SECSuccess) {
            goto loser;
        }
    }
    if (srcValue->encValue.data != NULL) {
        rv = crmf_make_bitstring_copy(poolp,
                                      &destValue->encValue,
                                      &srcValue->encValue);
        if (rv != SECSuccess) {
            goto loser;
        }
    }
    return SECSuccess;
loser:
    if (poolp == NULL && destValue != NULL) {
        crmf_destroy_encrypted_value(destValue, PR_FALSE);
    }
    return SECFailure;
}