/* crypto/bn/bn_blind.c */
/* ====================================================================
- * Copyright (c) 1998-2005 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
BIGNUM *mod; /* just a reference */
unsigned long thread_id; /* added in OpenSSL 0.9.6j and 0.9.7b;
* used only by crypto/rsa/rsa_eay.c, rsa_lib.c */
+ void *thread_idptr; /* added in OpenSSL 0.9.9;
+ * used only by crypto/rsa/rsa_eay.c, rsa_lib.c */
unsigned int counter;
unsigned long flags;
BN_MONT_CTX *m_ctx;
int BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *ctx)
{
+ int ret = 1;
+
bn_check_top(n);
if ((b->A == NULL) || (b->Ai == NULL))
{
- BNerr(BN_F_BN_BLINDING_CONVERT,BN_R_NOT_INITIALIZED);
+ BNerr(BN_F_BN_BLINDING_CONVERT_EX,BN_R_NOT_INITIALIZED);
return(0);
}
if (r != NULL)
- BN_copy(r, b->Ai);
+ {
+ if (!BN_copy(r, b->Ai)) ret=0;
+ }
- return BN_mod_mul(n,n,b->A,b->mod,ctx);
+ if (!BN_mod_mul(n,n,b->A,b->mod,ctx)) ret=0;
+
+ return ret;
}
int BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx)
bn_check_top(n);
if ((b->A == NULL) || (b->Ai == NULL))
{
- BNerr(BN_F_BN_BLINDING_INVERT,BN_R_NOT_INITIALIZED);
+ BNerr(BN_F_BN_BLINDING_INVERT_EX,BN_R_NOT_INITIALIZED);
return(0);
}
b->thread_id = n;
}
+void *BN_BLINDING_get_thread_idptr(const BN_BLINDING *b)
+ {
+ return b->thread_idptr;
+ }
+
+void BN_BLINDING_set_thread_idptr(BN_BLINDING *b, void *p)
+ {
+ b->thread_idptr = p;
+ }
+
unsigned long BN_BLINDING_get_flags(const BN_BLINDING *b)
{
return b->flags;
BN_MONT_CTX *m_ctx)
{
int retry_counter = 32;
- BIGNUM *a, *ai;
BN_BLINDING *ret = NULL;
if (b == NULL)
return ret;
}
-