• M
    Revert BN_copy() flag copy semantics change · 7d461736
    Matt Caswell 提交于
    Commit 9f944291 changed the semantics of BN_copy() to additionally
    copy the BN_FLG_CONSTTIME flag if it is set. This turns out to be
    ill advised as it has unintended consequences. For example calling
    BN_mod_inverse_no_branch() can sometimes return a result with the flag
    set and sometimes not as a result. This can lead to later failures if we
    go down code branches that do not support constant time, but check for
    the presence of the flag.
    
    The original commit was made due to an issue in BN_MOD_CTX_set(). The
    original PR fixed the problem in that function, but it was changed in
    review to fix it in BN_copy() instead. The solution seems to be to revert
    the BN_copy() change and go back to the originally proposed way.
    Reviewed-by: NPaul Dale <paul.dale@oracle.com>
    (Merged from https://github.com/openssl/openssl/pull/5080)
    7d461736
bn_mont.c 11.3 KB