OLD | NEW |
1 /* crypto/bn/bn_ctx.c */ | 1 /* crypto/bn/bn_ctx.c */ |
2 /* Written by Ulf Moeller for the OpenSSL project. */ | 2 /* Written by Ulf Moeller for the OpenSSL project. */ |
3 /* ==================================================================== | 3 /* ==================================================================== |
4 * Copyright (c) 1998-2004 The OpenSSL Project. All rights reserved. | 4 * Copyright (c) 1998-2004 The OpenSSL Project. All rights reserved. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * | 9 * |
10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 #ifdef BN_CTX_DEBUG | 154 #ifdef BN_CTX_DEBUG |
155 static const char *ctxdbg_cur = NULL; | 155 static const char *ctxdbg_cur = NULL; |
156 static void ctxdbg(BN_CTX *ctx) | 156 static void ctxdbg(BN_CTX *ctx) |
157 { | 157 { |
158 unsigned int bnidx = 0, fpidx = 0; | 158 unsigned int bnidx = 0, fpidx = 0; |
159 BN_POOL_ITEM *item = ctx->pool.head; | 159 BN_POOL_ITEM *item = ctx->pool.head; |
160 BN_STACK *stack = &ctx->stack; | 160 BN_STACK *stack = &ctx->stack; |
161 fprintf(stderr,"(%08x): ", (unsigned int)ctx); | 161 fprintf(stderr,"(%08x): ", (unsigned int)ctx); |
162 while(bnidx < ctx->used) | 162 while(bnidx < ctx->used) |
163 { | 163 { |
164 » » fprintf(stderr,"%02x ", item->vals[bnidx++ % BN_CTX_POOL_SIZE].d
max); | 164 » » fprintf(stderr,"%03x ", item->vals[bnidx++ % BN_CTX_POOL_SIZE].d
max); |
165 if(!(bnidx % BN_CTX_POOL_SIZE)) | 165 if(!(bnidx % BN_CTX_POOL_SIZE)) |
166 item = item->next; | 166 item = item->next; |
167 } | 167 } |
168 fprintf(stderr,"\n"); | 168 fprintf(stderr,"\n"); |
169 bnidx = 0; | 169 bnidx = 0; |
170 fprintf(stderr," : "); | 170 fprintf(stderr," : "); |
171 while(fpidx < stack->depth) | 171 while(fpidx < stack->depth) |
172 { | 172 { |
173 while(bnidx++ < stack->indexes[fpidx]) | 173 while(bnidx++ < stack->indexes[fpidx]) |
174 » » » fprintf(stderr," "); | 174 » » » fprintf(stderr," "); |
175 » » fprintf(stderr,"^^ "); | 175 » » fprintf(stderr,"^^^ "); |
176 bnidx++; | 176 bnidx++; |
177 fpidx++; | 177 fpidx++; |
178 } | 178 } |
179 fprintf(stderr,"\n"); | 179 fprintf(stderr,"\n"); |
180 } | 180 } |
181 #define CTXDBG_ENTRY(str, ctx) do { \ | 181 #define CTXDBG_ENTRY(str, ctx) do { \ |
182 ctxdbg_cur = (str); \ | 182 ctxdbg_cur = (str); \ |
183 fprintf(stderr,"Starting %s\n", ctxdbg_cur); \ | 183 fprintf(stderr,"Starting %s\n", ctxdbg_cur); \ |
184 ctxdbg(ctx); \ | 184 ctxdbg(ctx); \ |
185 } while(0) | 185 } while(0) |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 if(!offset) | 445 if(!offset) |
446 { | 446 { |
447 offset = BN_CTX_POOL_SIZE - 1; | 447 offset = BN_CTX_POOL_SIZE - 1; |
448 p->current = p->current->prev; | 448 p->current = p->current->prev; |
449 } | 449 } |
450 else | 450 else |
451 offset--; | 451 offset--; |
452 } | 452 } |
453 } | 453 } |
454 | 454 |
OLD | NEW |