diff options
| author | miod <> | 2014-07-09 08:55:32 +0000 |
|---|---|---|
| committer | miod <> | 2014-07-09 08:55:32 +0000 |
| commit | d320f209305bffb35416629baaa01f65fff8fc6a (patch) | |
| tree | 2ec32e3be23a5e22a38511c5477a7619f55849cc /src/lib/libcrypto/rsa/rsa_lib.c | |
| parent | 0d58c752b5803f02daa608c8d315fad91203bf42 (diff) | |
| download | openbsd-d320f209305bffb35416629baaa01f65fff8fc6a.tar.gz openbsd-d320f209305bffb35416629baaa01f65fff8fc6a.tar.bz2 openbsd-d320f209305bffb35416629baaa01f65fff8fc6a.zip | |
Remove RSA_memory_lock(). This undocumented function sort-of serializes your
RSA components to memory and clears them, but there is no unserializing
function, so its usefulness is close to zero.
A grep through the ports tree sources show that it is only present in ports
embedding their own openssl copy, and never used otherwise.
ok jsing@
Diffstat (limited to 'src/lib/libcrypto/rsa/rsa_lib.c')
| -rw-r--r-- | src/lib/libcrypto/rsa/rsa_lib.c | 47 |
1 files changed, 1 insertions, 46 deletions
diff --git a/src/lib/libcrypto/rsa/rsa_lib.c b/src/lib/libcrypto/rsa/rsa_lib.c index 5ccdfe9810..62d415a27b 100644 --- a/src/lib/libcrypto/rsa/rsa_lib.c +++ b/src/lib/libcrypto/rsa/rsa_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: rsa_lib.c,v 1.22 2014/07/09 08:44:53 miod Exp $ */ | 1 | /* $OpenBSD: rsa_lib.c,v 1.23 2014/07/09 08:55:32 miod Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -265,48 +265,3 @@ RSA_get_ex_data(const RSA *r, int idx) | |||
| 265 | { | 265 | { |
| 266 | return CRYPTO_get_ex_data(&r->ex_data, idx); | 266 | return CRYPTO_get_ex_data(&r->ex_data, idx); |
| 267 | } | 267 | } |
| 268 | |||
| 269 | int RSA_memory_lock(RSA *r) | ||
| 270 | { | ||
| 271 | int i,j,k,off; | ||
| 272 | char *p; | ||
| 273 | BIGNUM *bn,**t[6],*b; | ||
| 274 | BN_ULONG *ul; | ||
| 275 | |||
| 276 | if (r->d == NULL) return(1); | ||
| 277 | t[0]= &r->d; | ||
| 278 | t[1]= &r->p; | ||
| 279 | t[2]= &r->q; | ||
| 280 | t[3]= &r->dmp1; | ||
| 281 | t[4]= &r->dmq1; | ||
| 282 | t[5]= &r->iqmp; | ||
| 283 | k=sizeof(BIGNUM)*6; | ||
| 284 | off=k/sizeof(BN_ULONG)+1; | ||
| 285 | j=1; | ||
| 286 | for (i=0; i<6; i++) | ||
| 287 | j+= (*t[i])->top; | ||
| 288 | if ((p=reallocarray(NULL, (off+j), sizeof(BN_ULONG))) == NULL) | ||
| 289 | { | ||
| 290 | RSAerr(RSA_F_RSA_MEMORY_LOCK,ERR_R_MALLOC_FAILURE); | ||
| 291 | return(0); | ||
| 292 | } | ||
| 293 | bn=(BIGNUM *)p; | ||
| 294 | ul=(BN_ULONG *)&(p[off]); | ||
| 295 | for (i=0; i<6; i++) | ||
| 296 | { | ||
| 297 | b= *(t[i]); | ||
| 298 | *(t[i])= &(bn[i]); | ||
| 299 | memcpy((char *)&(bn[i]),(char *)b,sizeof(BIGNUM)); | ||
| 300 | bn[i].flags=BN_FLG_STATIC_DATA; | ||
| 301 | bn[i].d=ul; | ||
| 302 | memcpy((char *)ul,b->d,sizeof(BN_ULONG)*b->top); | ||
| 303 | ul+=b->top; | ||
| 304 | BN_clear_free(b); | ||
| 305 | } | ||
| 306 | |||
| 307 | /* I should fix this so it can still be done */ | ||
| 308 | r->flags&= ~(RSA_FLAG_CACHE_PRIVATE|RSA_FLAG_CACHE_PUBLIC); | ||
| 309 | |||
| 310 | r->bignum_data=p; | ||
| 311 | return(1); | ||
| 312 | } | ||
